qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
118,261 | <p>E.g. we this code in the asp.net form codebihind:</p>
<pre><code>private void btnSendEmails_OnClick()
{
Send100000EmailsAndWaitForReplies();
}
</code></pre>
<p>This code execution will be killed by the timeout reason.
For resolving the problem I'd like to see something like this:</p>
<pre><code>private void b... | [
{
"answer_id": 118278,
"author": "madcolor",
"author_id": 13954,
"author_profile": "https://Stackoverflow.com/users/13954",
"pm_score": 0,
"selected": false,
"text": "<p>One option is to have the task execute a certain amount of emails, then Response.Redirect back to itself and repeat un... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9198/"
] | E.g. we this code in the asp.net form codebihind:
```
private void btnSendEmails_OnClick()
{
Send100000EmailsAndWaitForReplies();
}
```
This code execution will be killed by the timeout reason.
For resolving the problem I'd like to see something like this:
```
private void btnSendEmails_OnClick()
{
var task... | 1. [QueueBackgroundWorkItem](http://blogs.msdn.com/b/webdev/archive/2014/06/04/queuebackgroundworkitem-to-reliably-schedule-and-run-long-background-process-in-asp-net.aspx) My sample shows sending email.
2. [HangFire](http://hangfire.io/) Open source project works on shared hosting.
3. On Azure, you can use [WebJobs](h... |
118,272 | <p>(Java question)</p>
<p>If I reference a field in an inner class, does this cause a circular dependency between the enclosing class and the inner class?</p>
<p>How can I avoid this? </p>
<p>Here is an example:</p>
<pre><code>public class Outer {
private Other o;
private Inner i;
public Outer() {
o... | [
{
"answer_id": 118317,
"author": "William",
"author_id": 9193,
"author_profile": "https://Stackoverflow.com/users/9193",
"pm_score": 0,
"selected": false,
"text": "<p>The syntax you're using in the example is a little off there is no declaration of the class or interface Inner. But there... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18445/"
] | (Java question)
If I reference a field in an inner class, does this cause a circular dependency between the enclosing class and the inner class?
How can I avoid this?
Here is an example:
```
public class Outer {
private Other o;
private Inner i;
public Outer() {
o = new Other();
i = new Inner(... | **Static vs instance class:** If you declare the inner class as static then the instances of the inner class doesn't have any reference to the outer class. If it's not satic then your inner object efectivelly points to the outer object that created it (it has an implicit reference, in fact, if you use reflection over i... |
118,280 | <p>I thought I had seen a bug report about this on the jQuery site, but now I cannot find it. I'm trying to resize a dialog in IE6. But when the element is resized, the content and title bar don't resize down. They will resize up if the dialog is made larger, however. The result is that the close button ends up being c... | [
{
"answer_id": 120050,
"author": "Dave Richardson",
"author_id": 3392,
"author_profile": "https://Stackoverflow.com/users/3392",
"pm_score": 0,
"selected": false,
"text": "<p>The css may be a factor. Could you change your example so we can see your stylesheet? I've updated the example so... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6118/"
] | I thought I had seen a bug report about this on the jQuery site, but now I cannot find it. I'm trying to resize a dialog in IE6. But when the element is resized, the content and title bar don't resize down. They will resize up if the dialog is made larger, however. The result is that the close button ends up being cut ... | I was able to come up with a solution. If you add the style **overflow: hidden** to the dialog container div element (which has the css class .ui-dialog-container applied to it), then everything resizes correctly. All I did was add a css rule as follows to the flora theme:
```
.ui-dialog .ui-dialog-container {
overf... |
118,289 | <p>I have a string with possible command line arguments (using an Read-Eval-Print-Loop program) and I want it to be parsed similar to the command line arguments when passed to Getopt::Long.</p>
<p>To elaborate:</p>
<p>I have a string</p>
<pre><code>$str = '--infile /tmp/infile_location --outfile /tmp/outfile'
</code... | [
{
"answer_id": 118339,
"author": "user11318",
"author_id": 11318,
"author_profile": "https://Stackoverflow.com/users/11318",
"pm_score": 3,
"selected": false,
"text": "<p>Instead of splitting on whitespace, use the built-in glob function. In addition to splitting on whitespace, that wil... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406/"
] | I have a string with possible command line arguments (using an Read-Eval-Print-Loop program) and I want it to be parsed similar to the command line arguments when passed to Getopt::Long.
To elaborate:
I have a string
```
$str = '--infile /tmp/infile_location --outfile /tmp/outfile'
```
I want it to be parsed by Ge... | Check out the section [parsing options from an arbitrary string](http://perldoc.perl.org/Getopt/Long.html#Parsing-options-from-an-arbitrary-string) in the [man page for Getopt::Long](http://perldoc.perl.org/Getopt/Long.html), I think it does exactly what you're looking for. |
118,292 | <p>So I was writing some code today that basically looks like this:</p>
<pre><code>string returnString = s.Replace("!", " ")
.Replace("@", " ")
.Replace("#", " ")
.Replace("$", " ")
.Replace("%", " ")
.Replace("^", " ")
.Replace("*", " ")
... | [
{
"answer_id": 118306,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 6,
"selected": true,
"text": "<p>You can use <strong>Regex.Replace()</strong>. All of the characters can be placed between square brackets, which match... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/493/"
] | So I was writing some code today that basically looks like this:
```
string returnString = s.Replace("!", " ")
.Replace("@", " ")
.Replace("#", " ")
.Replace("$", " ")
.Replace("%", " ")
.Replace("^", " ")
.Replace("*", " ")
.Replace("... | You can use **Regex.Replace()**. All of the characters can be placed between square brackets, which matches any character between the square brackets. Some special characters have to be escaped with backslashes, and I use a @verbatim string here, so I don't have to double-escape them for the C# compiler. The first para... |
118,305 | <p>How can UTF-8 strings (i.e. 8-bit string) be converted to/from XML-compatible 7-bit strings (i.e. printable ASCII with numeric entities)?</p>
<p>i.e. an <code>encode()</code> function such that:</p>
<pre><code>encode("“£”") -> "&#8220;&#163;&#8221;"
</code></pre>
<p><code>decode()</code> would also... | [
{
"answer_id": 193057,
"author": "Kris",
"author_id": 18565,
"author_profile": "https://Stackoverflow.com/users/18565",
"pm_score": 0,
"selected": false,
"text": "<p>It's a bit of a workaround, but I read a bit about <code>iconv()</code> and i don't think it'll give you numeric entities ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11543/"
] | How can UTF-8 strings (i.e. 8-bit string) be converted to/from XML-compatible 7-bit strings (i.e. printable ASCII with numeric entities)?
i.e. an `encode()` function such that:
```
encode("“£”") -> "“£”"
```
`decode()` would also be useful:
```
decode("“£”") -> "“£”"
```
PHP's `... | [`mb_encode_numericentity`](http://php.net/manual/en/function.mb-encode-numericentity.php) does that exactly. |
118,307 | <p>Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage:</p>
<ul>
<li>Program code is shared between multiple instances of the same program.</li>
<li>Shared library program code is shared between all processes... | [
{
"answer_id": 118726,
"author": "Chris",
"author_id": 15578,
"author_profile": "https://Stackoverflow.com/users/15578",
"pm_score": 3,
"selected": false,
"text": "<p>Top knows how to do this. It shows VIRT, RES and SHR by default on Debian Linux. VIRT = SWAP + RES. RES = CODE + DATA. ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/118307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20816/"
] | Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage:
* Program code is shared between multiple instances of the same program.
* Shared library program code is shared between all processes that use that librar... | On OSX the Activity Monitor gives you actually a very good guess.
Private memory is for sure memory that is only used by your application. E.g. stack memory and all memory dynamically reserved using malloc() and comparable functions/methods (alloc method for Objective-C) is private memory. If you fork, private memory ... |
118,341 | <p>I have a Linq to objects statement</p>
<pre><code> var confirm = from l in lines.Lines
where (l.LineNumber == startline.LineNumber) || (l.LineNumber == endline.LineNumber)
select l;
</code></pre>
<p>The confirm object is returning an 'Object Null or Not A Reference' at at System.Linq.Enumerable.WhereListIterat... | [
{
"answer_id": 118347,
"author": "OwenP",
"author_id": 2547,
"author_profile": "https://Stackoverflow.com/users/2547",
"pm_score": 6,
"selected": true,
"text": "<p>I'm not sure if it's possible to debug from VS, but I find <a href=\"http://www.linqpad.net/\" rel=\"noreferrer\">LINQPad</a... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5302/"
] | I have a Linq to objects statement
```
var confirm = from l in lines.Lines
where (l.LineNumber == startline.LineNumber) || (l.LineNumber == endline.LineNumber)
select l;
```
The confirm object is returning an 'Object Null or Not A Reference' at at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
If the re... | I'm not sure if it's possible to debug from VS, but I find [LINQPad](http://www.linqpad.net/) to be quite useful. It'll let you dump the results of each part of the LINQ query. |
118,342 | <p>I am aware of this command:
<code>cvs log -N -w<userid> -d"1 day ago"</code></p>
<p>Unfortunately this generates a formatted report with lots of newlines in it, such that the file-path, the file-version, and the comment-text are all on separate lines. Therefore it is difficult to scan it for all occurrences o... | [
{
"answer_id": 118372,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>This might be way overkill, but you could use <a href=\"http://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14749/"
] | I am aware of this command:
`cvs log -N -w<userid> -d"1 day ago"`
Unfortunately this generates a formatted report with lots of newlines in it, such that the file-path, the file-version, and the comment-text are all on separate lines. Therefore it is difficult to scan it for all occurrences of comment text, (eg, grep),... | The `-w` options seems to work better with the `-S` option. Otherwise there are additional results which don't seem related to the userid. Perhaps someone can explain it.
```
cvs log -N -S -w<userid> -d"1 day ago"
```
With that I have been getting reasonable success piping it to grep:
```
cvs log -N -S -w<userid> -... |
118,343 | <p>Ruby on Rails has <a href="http://wiki.rubyonrails.com/rails/pages/Timestamping" rel="nofollow noreferrer">magic timestamping fields</a> that are automatically updated when a record is created or updated. I'm trying to find similar functionality in Entity Framework. I've considered database triggers and a SavingChan... | [
{
"answer_id": 118372,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>This might be way overkill, but you could use <a href=\"http://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/453303/"
] | Ruby on Rails has [magic timestamping fields](http://wiki.rubyonrails.com/rails/pages/Timestamping) that are automatically updated when a record is created or updated. I'm trying to find similar functionality in Entity Framework. I've considered database triggers and a SavingChanges event handler. Is there a more obvio... | The `-w` options seems to work better with the `-S` option. Otherwise there are additional results which don't seem related to the userid. Perhaps someone can explain it.
```
cvs log -N -S -w<userid> -d"1 day ago"
```
With that I have been getting reasonable success piping it to grep:
```
cvs log -N -S -w<userid> -... |
118,370 | <p>This came up in <a href="https://stackoverflow.com/questions/101268/hidden-features-of-python">Hidden features of Python</a>, but I can't see good documentation or examples that explain how the feature works.</p>
| [
{
"answer_id": 118395,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 8,
"selected": true,
"text": "<p><code>Ellipsis</code>, or <code>...</code> is not a hidden feature, it's just a constant. It's quite different to, say, j... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15677/"
] | This came up in [Hidden features of Python](https://stackoverflow.com/questions/101268/hidden-features-of-python), but I can't see good documentation or examples that explain how the feature works. | `Ellipsis`, or `...` is not a hidden feature, it's just a constant. It's quite different to, say, javascript ES6 where it's a part of the language syntax. No builtin class or Python language constuct makes use of it.
So the syntax for it depends entirely on you, or someone else, having written code to understand it.
... |
118,371 | <p>When a class field is accessed via a getter method by multiple threads, how do you maintain thread safety? Is the synchronized keyword sufficient?</p>
<p>Is this safe:</p>
<pre><code>public class SomeClass {
private int val;
public synchronized int getVal() {
return val;
}
private void se... | [
{
"answer_id": 118377,
"author": "Jacob Schoen",
"author_id": 3340,
"author_profile": "https://Stackoverflow.com/users/3340",
"pm_score": 2,
"selected": false,
"text": "<p>From my understanding you should use synchronized on both the getter and the setter methods, and that is sufficient.... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119/"
] | When a class field is accessed via a getter method by multiple threads, how do you maintain thread safety? Is the synchronized keyword sufficient?
Is this safe:
```
public class SomeClass {
private int val;
public synchronized int getVal() {
return val;
}
private void setVal(int val) {
... | If you use 'synchronized' on the setter here too, this code is threadsafe. However it may not be sufficiently granular; if you have 20 getters and setters and they're all synchronized, you may be creating a synchronization bottleneck.
In this specific instance, with a single int variable, then eliminating the 'synchro... |
118,415 | <p>My database is located in e.g. california.
My user table has all the user's timezone e.g. -0700 UTC </p>
<p>How can I adjust the time from my database server whenever I display a date to the user who lives in e.g. new york? UTC/GMT -4 hours</p>
| [
{
"answer_id": 118432,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "<p>You should store your data in UTC format and showing it in local timezone format.</p>\n\n<pre><code>DateTime.ToUniversalTime(... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1368/"
] | My database is located in e.g. california.
My user table has all the user's timezone e.g. -0700 UTC
How can I adjust the time from my database server whenever I display a date to the user who lives in e.g. new york? UTC/GMT -4 hours | You should store your data in UTC format and showing it in local timezone format.
```
DateTime.ToUniversalTime() -> server;
DateTime.ToLocalTime() -> client
```
You can adjust date/time using AddXXX methods group, but it can be error prone. .NET has support for time zones in [System.TimeZoneInfo](http://msdn.microso... |
118,423 | <p>I've been impressed by the screencasts for Rails that demonstrate the built-in web server, and database to allow development and testing to occur on the local machine. How can I get an instance of Apache to execute a project directory as its DocumentRoot, and maybe serve up the files on port 8080 (or something simil... | [
{
"answer_id": 118450,
"author": "phloopy",
"author_id": 8507,
"author_profile": "https://Stackoverflow.com/users/8507",
"pm_score": 0,
"selected": false,
"text": "<p>You could use a low up front setup package such as <a href=\"http://www.apachefriends.org/en/index.html\" rel=\"nofollow ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658/"
] | I've been impressed by the screencasts for Rails that demonstrate the built-in web server, and database to allow development and testing to occur on the local machine. How can I get an instance of Apache to execute a project directory as its DocumentRoot, and maybe serve up the files on port 8080 (or something similar)... | Your Mac comes with both an Apache Web Server and a build of PHP. It's one of the big reasons the platform is well loved by web developers.
Since you're using Code Igniter, you'll want PHP 5, which is the default version of PHP shipped with 10.5. If you're on a previous version of the OS hop on over to [entropy.ch](ht... |
118,443 | <p>I have an application that tracks high scores in a game. </p>
<p>I have a <strong>user_scores</strong> table that maps a user_id to a score.</p>
<p>I need to return the 5 highest scores, but only 1 high score for any <em>specific</em> user.</p>
<p>So if user X has the 5 highest scores on a purely numerical basis,... | [
{
"answer_id": 118446,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 0,
"selected": false,
"text": "<p>You can't group by without a summary-function (SUM, COUNT, etc.)</p>\n\n<p>The GROUP BY clause says how to group the SUM... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14971/"
] | I have an application that tracks high scores in a game.
I have a **user\_scores** table that maps a user\_id to a score.
I need to return the 5 highest scores, but only 1 high score for any *specific* user.
So if user X has the 5 highest scores on a purely numerical basis, I simply return the highest one and then ... | This should work:
```
SELECT user_id, MAX(score)
FROM user_scores
GROUP BY user_id
ORDER BY MAX(score) DESC
LIMIT 5
``` |
118,458 | <p>Along the lines of my previous <a href="https://stackoverflow.com/questions/118096/how-can-i-parse-a-comma-delimited-string-into-a-list-caveat">question</a>, how can i join a list of strings into a string such that values get quoted cleanly. Something like:</p>
<pre><code>['a', 'one "two" three', 'foo, bar', """bot... | [
{
"answer_id": 118462,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 4,
"selected": true,
"text": "<p>Using the <code>csv</code> module you can do that way:</p>\n\n<pre><code>import csv\nwriter = csv.writer(open(\"some.csv\... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] | Along the lines of my previous [question](https://stackoverflow.com/questions/118096/how-can-i-parse-a-comma-delimited-string-into-a-list-caveat), how can i join a list of strings into a string such that values get quoted cleanly. Something like:
```
['a', 'one "two" three', 'foo, bar', """both"'"""]
```
into:
```
... | Using the `csv` module you can do that way:
```
import csv
writer = csv.writer(open("some.csv", "wb"))
writer.writerow(the_list)
```
If you need a string just use `StringIO` instance as a file:
```
f = StringIO.StringIO()
writer = csv.writer(f)
writer.writerow(the_list)
print f.getvalue()
```
The output: `a,"one ... |
118,474 | <p>Has anybody established a good naming convention for action in MVC? I was specifically looking at ASP.net MVC but it is a general question. For instance I have an action which displays the login screen (Login) and one which process the login request from that page (LoginTest). I'm not keen on the names and I have... | [
{
"answer_id": 118495,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 0,
"selected": false,
"text": "<p>The builtin Django actions suffix _done. So LoginDone would be the page that processes Login (in ASP.NET MVC camel ca... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/361/"
] | Has anybody established a good naming convention for action in MVC? I was specifically looking at ASP.net MVC but it is a general question. For instance I have an action which displays the login screen (Login) and one which process the login request from that page (LoginTest). I'm not keen on the names and I have a lot... | Rob Conery at MS suggested some useful RESTful style naming for actions.
>
>
> ```
> * Index - the main "landing" page. This is also the default endpoint.
> * List - a list of whatever "thing" you're showing them - like a list of Products.
> * Show - a particular item of whatever "thing" you're showing them (like a ... |
118,487 | <p>Sorry the title isn't more help. I have a database of media-file URLs that came from two sources: </p>
<p>(1) RSS feeds and (2) manual entries. </p>
<p>I want to find the ten most-recently added URLs, but a maximum of one from any feed. To simplify, table '<code>urls</code>' has columns <code>'url, feed_id, timest... | [
{
"answer_id": 118523,
"author": "Aeon",
"author_id": 13289,
"author_profile": "https://Stackoverflow.com/users/13289",
"pm_score": 0,
"selected": false,
"text": "<p>You probably want a <a href=\"http://dev.mysql.com/doc/refman/5.0/en/union.html\" rel=\"nofollow noreferrer\">union</a>. S... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17307/"
] | Sorry the title isn't more help. I have a database of media-file URLs that came from two sources:
(1) RSS feeds and (2) manual entries.
I want to find the ten most-recently added URLs, but a maximum of one from any feed. To simplify, table '`urls`' has columns `'url, feed_id, timestamp'`.
`feed_id=''` for any URL... | Assuming feed\_id = 0 is the manually entered stuff this does the trick:
```
select p.* from programs p
left join
(
select max(id) id1 from programs
where feed_id <> 0
group by feed_id
order by max(id) desc
limit 10
) t on id1 = id
where id1 is not null or feed_id = 0
order by id desc
limit 10;
... |
118,490 | <p>Can anyone recommend a cheap and good RTF control for .Net 1.1 Windows development. It needs to be able to do print/preview and some basic text formatting, fonts etc but nothing too advanced.</p>
<p>Cheers</p>
<p>Andreas</p>
| [
{
"answer_id": 118523,
"author": "Aeon",
"author_id": 13289,
"author_profile": "https://Stackoverflow.com/users/13289",
"pm_score": 0,
"selected": false,
"text": "<p>You probably want a <a href=\"http://dev.mysql.com/doc/refman/5.0/en/union.html\" rel=\"nofollow noreferrer\">union</a>. S... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anyone recommend a cheap and good RTF control for .Net 1.1 Windows development. It needs to be able to do print/preview and some basic text formatting, fonts etc but nothing too advanced.
Cheers
Andreas | Assuming feed\_id = 0 is the manually entered stuff this does the trick:
```
select p.* from programs p
left join
(
select max(id) id1 from programs
where feed_id <> 0
group by feed_id
order by max(id) desc
limit 10
) t on id1 = id
where id1 is not null or feed_id = 0
order by id desc
limit 10;
... |
118,501 | <p>If I was, for example, going to <em>count</em> "activities" across many computers and show a rollup of that activity, what would the database look like to store the data? </p>
<p>Simply this? Seems too simple. I'm overthinking this.</p>
<pre><code>ACTIVITYID COUNT
---------- -----
</code></pre>
| [
{
"answer_id": 118568,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, I'm afraid it's that simple, assuming you are only interested in the number of times each activity occurs. On... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6380/"
] | If I was, for example, going to *count* "activities" across many computers and show a rollup of that activity, what would the database look like to store the data?
Simply this? Seems too simple. I'm overthinking this.
```
ACTIVITYID COUNT
---------- -----
``` | If the volume is not going to be ridiculously large, I'd probably create a table that logs each event individually, with a DateTime as @Turnkey suggests, and possibly the machine that logged it, etc.
```
LOGID (PK) ACTIVITYID SOURCE DATELOGGED
---------- ---------- ------ ----------
```
That would give you the... |
118,506 | <p>The question is a fairly open one. I've been using Stored Procs with MS SQLServer for some time with classic ASP and ASP.net and love them, lots.</p>
<p>I have a small hobby project I'm working on and for various reasons have gone the LAMP route. Any hints/tricks/traps or good starting points to get into using stor... | [
{
"answer_id": 118582,
"author": "Gleb Popoff",
"author_id": 18076,
"author_profile": "https://Stackoverflow.com/users/18076",
"pm_score": 2,
"selected": false,
"text": "<p>You'll need to use <strong>MySQLI</strong> (MySQL Improved Extension) to call stored procedures. Here's how you wou... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4665/"
] | The question is a fairly open one. I've been using Stored Procs with MS SQLServer for some time with classic ASP and ASP.net and love them, lots.
I have a small hobby project I'm working on and for various reasons have gone the LAMP route. Any hints/tricks/traps or good starting points to get into using stored procedu... | Forget about `mysqli`, it's much harder to use than PDO and should have been already removed. It is true that it introduced huge improvements over mysql, but to achieve the same effect in mysqli sometimes requires enormous effort over PDO i.e. associative `fetchAll`.
Instead, take a look at [PDO](http://www.php.net/ma... |
118,516 | <p>My issue is below but would be interested comments from anyone with experience with xlrd.</p>
<p>I just found xlrd and it looks like the perfect solution but I'm having a little problem getting started. I am attempting to extract data programatically from an Excel file I pulled from Dow Jones with current component... | [
{
"answer_id": 118586,
"author": "Michael Neale",
"author_id": 699,
"author_profile": "https://Stackoverflow.com/users/699",
"pm_score": 0,
"selected": false,
"text": "<p>Well here is some code that I did: (look down the bottom): <a href=\"http://anonsvn.labs.jboss.com/labs/jbossrules/tr... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My issue is below but would be interested comments from anyone with experience with xlrd.
I just found xlrd and it looks like the perfect solution but I'm having a little problem getting started. I am attempting to extract data programatically from an Excel file I pulled from Dow Jones with current components of the D... | FWIW, I'm the author of xlrd, and the maintainer of xlwt (a fork of pyExcelerator). A few points:
1. The file ComponentReport-DJI.xls is misnamed; it is not an XLS file, it is a tab-separated-values file. Open it with a text editor (e.g. Notepad) and you'll see what I mean. You can also look at the not-very-raw raw by... |
118,528 | <h2>I've actually solved this, but I'm posting it for posterity.</h2>
<p>I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests itself as an EXTREMELY slow repaint of the control (<em>like 30 seconds for a full repaint</em>), but only when it is on one of my screens. When on t... | [
{
"answer_id": 157386,
"author": "Benoit",
"author_id": 10703,
"author_profile": "https://Stackoverflow.com/users/10703",
"pm_score": 7,
"selected": true,
"text": "<p>You just need to make a custom class based off of DataGridView so you can enable its DoubleBuffering. That's it!</p>\n\n<... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5927/"
] | I've actually solved this, but I'm posting it for posterity.
------------------------------------------------------------
I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests itself as an EXTREMELY slow repaint of the control (*like 30 seconds for a full repaint*), but only ... | You just need to make a custom class based off of DataGridView so you can enable its DoubleBuffering. That's it!
```
class CustomDataGridView: DataGridView
{
public CustomDataGridView()
{
DoubleBuffered = true;
}
}
```
As long as all of my instances of the grid are using this custom version, al... |
118,540 | <p>First of all, I'm fairly sure snapping to grid is fairly easy, however I've run into some odd trouble in this situation and my maths are too weak to work out specifically what is wrong.</p>
<p>Here's the situation</p>
<p>I have an abstract concept of a grid, with Y steps exactly Y_STEP apart (the x steps are worki... | [
{
"answer_id": 118645,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 0,
"selected": false,
"text": "<p>Do you have a typo in positionChanged() ?</p>\n\n<pre><code>def positionChanged(self, newPos):\n self.snapp... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First of all, I'm fairly sure snapping to grid is fairly easy, however I've run into some odd trouble in this situation and my maths are too weak to work out specifically what is wrong.
Here's the situation
I have an abstract concept of a grid, with Y steps exactly Y\_STEP apart (the x steps are working fine so ignor... | Ok, I'm answering my own question here, as alexk mentioned, using int to truncate was my mistake.
The behaviour I'm after is best modeled by math.floor().
Apologies, the original question does not contain enough information to really work out what the problem is. I didn't have the extra bit of information at that po... |
118,547 | <p>I am looking for a way to create a ZIP file from a folder in Windows C/C++ APIs. I can find the way to do this in VBScript using the Shell32.Application CopyHere method, and I found a tutorial explaining how to do it in C# also, but nothing for the C API (C++ is fine too, project already uses MFC).</p>
<p>I'd be re... | [
{
"answer_id": 118602,
"author": "Sparr",
"author_id": 13675,
"author_profile": "https://Stackoverflow.com/users/13675",
"pm_score": 1,
"selected": false,
"text": "<p>I do not think that MFC or the Windows standard C/C++ APIs provide an interface to the built in zip functionality.</p>\n"... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20840/"
] | I am looking for a way to create a ZIP file from a folder in Windows C/C++ APIs. I can find the way to do this in VBScript using the Shell32.Application CopyHere method, and I found a tutorial explaining how to do it in C# also, but nothing for the C API (C++ is fine too, project already uses MFC).
I'd be really grate... | EDIT: This answer is old, but I cannot delete it because it was accepted. See the next one
<https://stackoverflow.com/a/121720/3937>
----- ORIGINAL ANSWER -----
There is sample code to do that here
[EDIT: Link is now broken]
<http://www.eggheadcafe.com/software/aspnet/31056644/using-shfileoperation-to.aspx>
Make ... |
118,565 | <p>Say I have a web service <a href="http://www.example.com/webservice.pl?q=google" rel="noreferrer">http://www.example.com/webservice.pl?q=google</a> which returns text "google.com". I need to call this web service (<a href="http://www.example.com/webservice.pl" rel="noreferrer">http://www.example.com/webservice.pl</a... | [
{
"answer_id": 118574,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": true,
"text": "<p>Take a look at one of the many javascript libraries out there. I'd recommend <a href=\"http://www.jquery.com\" rel=\"norefer... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5734/"
] | Say I have a web service <http://www.example.com/webservice.pl?q=google> which returns text "google.com". I need to call this web service (<http://www.example.com/webservice.pl>) from a JavaScript module with a parameter (q=google) and then use the return value ("google.com") to do further processing.
What's the simpl... | Take a look at one of the many javascript libraries out there. I'd recommend [jQuery](http://www.jquery.com), personally. Aside from all the fancy UI stuff they can do, it has really good [cross-browser AJAX libraries](http://docs.jquery.com/Ajax).
```
$.get(
"http://xyz.com/webservice.pl",
{ q : "google" },
... |
118,591 | <p>I have this line in a useful Bash script that I haven't managed to translate into Python, where 'a' is a user-input number of days' worth of files to archive:</p>
<pre><code>find ~/podcasts/current -mindepth 2 -mtime '+`a`+' -exec mv {} ~/podcasts/old \;
</code></pre>
<p>I am familiar with the os.name and getpass.... | [
{
"answer_id": 118647,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "<p>That's not a Bash command, it's a <code>find</code> command. If you really want to port it to Python it's possible,... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11596/"
] | I have this line in a useful Bash script that I haven't managed to translate into Python, where 'a' is a user-input number of days' worth of files to archive:
```
find ~/podcasts/current -mindepth 2 -mtime '+`a`+' -exec mv {} ~/podcasts/old \;
```
I am familiar with the os.name and getpass.getuser for the most gener... | ```
import os
import shutil
from os import path
from os.path import join, getmtime
from time import time
archive = "bak"
current = "cur"
def archive_old_versions(days = 3):
for root, dirs, files in os.walk(current):
for name in files:
fullname = join(root, name)
if (getmtime(fullna... |
118,599 | <p>I'm trying to store a password in a file that I'd like to retrieve for later. Hashing is not an option as I need the password for connecting to a remote server for later.</p>
<p>The following code works well, but it creates a different output each time even though the key is the same. This is bad as when the applic... | [
{
"answer_id": 118613,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 4,
"selected": true,
"text": "<p>I believe that what's happening is that the crypto provider is randomly generating an IV. Specify this and it s... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17211/"
] | I'm trying to store a password in a file that I'd like to retrieve for later. Hashing is not an option as I need the password for connecting to a remote server for later.
The following code works well, but it creates a different output each time even though the key is the same. This is bad as when the application shut... | I believe that what's happening is that the crypto provider is randomly generating an IV. Specify this and it should no longer differ.
Edit: You can do this in your 'keyProvider' by setting the IV property. |
118,630 | <p>I had assumed that the canonical form for operator+, assuming the existence of an overloaded operator+= member function, was like this:</p>
<pre><code>const T operator+(const T& lhs, const T& rhs)
{
return T(lhs) +=rhs;
}
</code></pre>
<p>But it was pointed out to me that this would also work:</p>
<pr... | [
{
"answer_id": 118664,
"author": "Kris Kumler",
"author_id": 4281,
"author_profile": "https://Stackoverflow.com/users/4281",
"pm_score": 3,
"selected": true,
"text": "<p>With the edited question, the first form would be preferred. The compiler will more likely optimize the return value ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1674/"
] | I had assumed that the canonical form for operator+, assuming the existence of an overloaded operator+= member function, was like this:
```
const T operator+(const T& lhs, const T& rhs)
{
return T(lhs) +=rhs;
}
```
But it was pointed out to me that this would also work:
```
const T operator+ (T lhs, const T& rh... | With the edited question, the first form would be preferred. The compiler will more likely optimize the return value (you could verify this by placing a breakpoint in the constructor for T). The first form also takes both parameters as const, which would be more desirable.
Research on the topic of **return value optim... |
118,632 | <p>I need to layout a html datatable with CSS. </p>
<p>The actual content of the table can differ, but there is always one main column and 2 or more other columns. I'd like to make the main column take up as MUCH width as possible, regardless of its contents, while the other columns take up as little width as possible... | [
{
"answer_id": 118655,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 4,
"selected": true,
"text": "<p>I'm far from being a CSS expert but this works for me (in IE, FF, Safari and Chrome):</p>\n\n<pre><code>td.zero... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20851/"
] | I need to layout a html datatable with CSS.
The actual content of the table can differ, but there is always one main column and 2 or more other columns. I'd like to make the main column take up as MUCH width as possible, regardless of its contents, while the other columns take up as little width as possible. I can't ... | I'm far from being a CSS expert but this works for me (in IE, FF, Safari and Chrome):
```
td.zero_width {
width: 1%;
}
```
Then in your HTML:
```
<td class="zero_width">...</td>
``` |
118,643 | <p>I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter ... | [
{
"answer_id": 118651,
"author": "Mez",
"author_id": 20010,
"author_profile": "https://Stackoverflow.com/users/20010",
"pm_score": 4,
"selected": false,
"text": "<p>I personally doubt that there currently is at the moment, as a lot of the Python afficionados love the fact that Python is ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14744/"
] | I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and... | There's a solution to your problem that is distributed with python itself. `pindent.py`, it's located in the Tools\Scripts directory in a windows install (my path to it is C:\Python25\Tools\Scripts), it looks like you'd have to [grab it from svn.python.org](https://svn.python.org/projects/python/trunk/Tools/scripts/pin... |
118,654 | <p>Does beautiful soup work with iron python?
If so with which version of iron python?
How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? </p>
| [
{
"answer_id": 118671,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 0,
"selected": false,
"text": "<p>I haven't tested it, but I'd say it'll most likely work with the latest IPy2.</p>\n\n<p>As for distribution, it... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7883/"
] | Does beautiful soup work with iron python?
If so with which version of iron python?
How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)? | I was asking myself this same question and after struggling to follow advice here and elsewhere to get IronPython and BeautifulSoup to play nicely with my existing code I decided to go looking for an alternative native .NET solution. BeautifulSoup is a wonderful bit of code and at first it didn't look like there was an... |
118,686 | <p>I'm using GDI+ in C++. (This issue might exist in C# too). </p>
<p>I notice that whenever I call Graphics::MeasureString() or Graphics::DrawString(), the string is padded with blank space on the left and right.</p>
<p>For example, if I am using a Courier font, (not italic!) and I measure "P" I get 90, but "PP" gi... | [
{
"answer_id": 118764,
"author": "HitScan",
"author_id": 9490,
"author_profile": "https://Stackoverflow.com/users/9490",
"pm_score": 5,
"selected": true,
"text": "<p>It's by design, that method doesn't use the actual glyphs to measure the width and so adds a little padding in the case of... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10592/"
] | I'm using GDI+ in C++. (This issue might exist in C# too).
I notice that whenever I call Graphics::MeasureString() or Graphics::DrawString(), the string is padded with blank space on the left and right.
For example, if I am using a Courier font, (not italic!) and I measure "P" I get 90, but "PP" gives me 150. I woul... | It's by design, that method doesn't use the actual glyphs to measure the width and so adds a little padding in the case of overhangs.
[MSDN](http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx) suggests using a different method if you need more accuracy:
>
> To obtain metrics suitable for adjacent strings in layou... |
118,693 | <p>Dynamically creating a radio button using eg </p>
<pre><code>var radioInput = document.createElement('input');
radioInput.setAttribute('type', 'radio');
radioInput.setAttribute('name', name);
</code></pre>
<p>works in Firefox but not in IE. Why not?</p>
| [
{
"answer_id": 118702,
"author": "Patrick Wilkes",
"author_id": 6370,
"author_profile": "https://Stackoverflow.com/users/6370",
"pm_score": 3,
"selected": false,
"text": "<p>Based on this post and its comments:\n<a href=\"http://cf-bill.blogspot.com/2006/03/another-ie-gotcha-dynamiclly-c... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6370/"
] | Dynamically creating a radio button using eg
```
var radioInput = document.createElement('input');
radioInput.setAttribute('type', 'radio');
radioInput.setAttribute('name', name);
```
works in Firefox but not in IE. Why not? | Taking a step from what Patrick suggests, using a temporary node we can get rid of the try/catch:
```
function createRadioElement(name, checked) {
var radioHtml = '<input type="radio" name="' + name + '"';
if ( checked ) {
radioHtml += ' checked="checked"';
}
radioHtml += '/>';
var radioFr... |
118,698 | <p>In JavaScript, you can use <a href="http://peter.michaux.ca/article/3556" rel="noreferrer">Lazy Function Definitions</a> to optimize the 2nd - Nth call to a function by performing the <strong>expensive</strong> one-time operations only on the first call to the function.</p>
<p>I'd like to do the same sort of thing ... | [
{
"answer_id": 118717,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 3,
"selected": false,
"text": "<p>Have you actually profiled this code? I'm doubtful that an extra boolean test is going to have any measurable impac... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6144/"
] | In JavaScript, you can use [Lazy Function Definitions](http://peter.michaux.ca/article/3556) to optimize the 2nd - Nth call to a function by performing the **expensive** one-time operations only on the first call to the function.
I'd like to do the same sort of thing in PHP 5, but redefining a function is not allowed,... | Use a local static var:
```
function foo() {
static $called = false;
if ($called == false) {
$called = true;
expensive_stuff();
}
}
```
Avoid using a global for this. It clutters the global namespace and makes the function less encapsulated. If other places besides the innards of the func... |
118,719 | <p>Usecase: The user makes font customizations to an object on the design surface, that I need to load/save to my datastore. I.e. settings like Bold, Italics, Size, Font Name need to persisted.</p>
<p>Is there some easy (and reliable) mechanism to convert/read back from a string representation of the font object (in w... | [
{
"answer_id": 118754,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 4,
"selected": true,
"text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx\" rel=\"noreferrer\">TypeConver... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] | Usecase: The user makes font customizations to an object on the design surface, that I need to load/save to my datastore. I.e. settings like Bold, Italics, Size, Font Name need to persisted.
Is there some easy (and reliable) mechanism to convert/read back from a string representation of the font object (in which case ... | Use [TypeConverter](http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx):
```
Font font = new Font("Arial", 12, GraphicsUnit.Pixel);
TypeConverter converter = TypeDescriptor.GetConverter(typeof (Font));
string fontStr = converter.ConvertToInvariantString(font);
Font font2 = (Font) conve... |
118,727 | <p>I'm in the process of moving one of our projects from VS6 to VS2008 and I've hit the following compile error with mshtml.h:</p>
<pre><code>1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5272) : error C2143: syntax error : missing '}' before 'constant'
1>c:\program files\microsoft sdks\window... | [
{
"answer_id": 118734,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 2,
"selected": true,
"text": "<p>There is probably a #define changing something. Try running just the preprocessor on your .cpp and generating a .i fil... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341/"
] | I'm in the process of moving one of our projects from VS6 to VS2008 and I've hit the following compile error with mshtml.h:
```
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5272) : error C2143: syntax error : missing '}' before 'constant'
1>c:\program files\microsoft sdks\windows\v6.0a\include\msht... | There is probably a #define changing something. Try running just the preprocessor on your .cpp and generating a .i file. The setting is in the project property pages.
EDIT: Also, you can get the answer from that other expert site by scrolling to the bottom of the page. They have to do that or Google will take them out... |
118,730 | <p>Does anyone know how I can get rid of the following assembler warning?</p>
<p>Code is x86, 32 bit:</p>
<pre><code>int test (int x)
{
int y;
// do a bit-rotate by 8 on the lower word. leave upper word intact.
asm ("rorw $8, %0\n\t": "=q"(y) :"0"(x));
return y;
}
</code></pre>
<p>If I compile it I get the f... | [
{
"answer_id": 118737,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 5,
"selected": true,
"text": "<p>You can use <code>%w0</code> if I remember right. I just tested it, too. :-)</p>\n<pre><code>int\ntest(int x)\n{\n int ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15955/"
] | Does anyone know how I can get rid of the following assembler warning?
Code is x86, 32 bit:
```
int test (int x)
{
int y;
// do a bit-rotate by 8 on the lower word. leave upper word intact.
asm ("rorw $8, %0\n\t": "=q"(y) :"0"(x));
return y;
}
```
If I compile it I get the following (very valid) warning:
`... | You can use `%w0` if I remember right. I just tested it, too. :-)
```
int
test(int x)
{
int y;
asm ("rorw $8, %w0" : "=q" (y) : "0" (x));
return y;
}
```
Edit: In response to the OP, yes, you can do the following too:
```
int
test(int x)
{
int y;
asm ("xchg %b0, %h0" : "=Q" (y) : "0" (x));
r... |
118,748 | <p>How do I open multiple pages in Internet Explorer 7 with a single DOS command? Is a batch file the only way to do this?</p>
<p>Thanks!</p>
| [
{
"answer_id": 118763,
"author": "Ben Hoffstein",
"author_id": 4482,
"author_profile": "https://Stackoverflow.com/users/4482",
"pm_score": 1,
"selected": false,
"text": "<p>Unfortunately, there is no way to include multiple URLs as command-line parameters. Here is a a <a href=\"http://b... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I open multiple pages in Internet Explorer 7 with a single DOS command? Is a batch file the only way to do this?
Thanks! | A batch file will work as a quick and dirty solution.
```
@echo off
@setlocal
:openurl
set url=%~1
if "%url:~0,4%" == "http" (
start "%ProgramFiles%\Internet Explorer\iexplore.exe" "%url%"
)
if NOT "%url:~0,4%" == "http" (
start "%ProgramFiles%\Internet Explorer\iexplore.exe" "http://%url%"
)
shift
if "%~1" =... |
118,774 | <p>Deep down in WinDef.h there's this relic from the segmented memory era:</p>
<pre><code>#define far
#define near
</code></pre>
<p>This obviously causes problems if you attempt to use near or far as variable names. Any clean workarounds? Other then renaming my variables?</p>
| [
{
"answer_id": 118779,
"author": "John Boker",
"author_id": 2847,
"author_profile": "https://Stackoverflow.com/users/2847",
"pm_score": 2,
"selected": false,
"text": "<p>maybe:</p>\n\n<pre><code>#undef near\n#undef far\n</code></pre>\n\n<p>could be dangerous though...</p>\n"
},
{
... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841/"
] | Deep down in WinDef.h there's this relic from the segmented memory era:
```
#define far
#define near
```
This obviously causes problems if you attempt to use near or far as variable names. Any clean workarounds? Other then renaming my variables? | You can safely undefine them, contrary to claims from others. The reason is that they're just macros's. They only affect the preprocessor between their definition and their undefinition. In your case, that will be from early in windows.h to the last line of windows.h. If you need extra windows headers, you'd include th... |
118,813 | <p>I want to use the macports version of python instead of the one that comes with Leopard.</p>
| [
{
"answer_id": 118820,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 6,
"selected": true,
"text": "<p>I have both installed:</p>\n\n<pre><code>$ which python\n/usr/bin/python\n$ which python2.5\n/opt/local/bin/python2.5\n... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6013/"
] | I want to use the macports version of python instead of the one that comes with Leopard. | I have both installed:
```
$ which python
/usr/bin/python
$ which python2.5
/opt/local/bin/python2.5
```
I also added the following line to my `.profile`:
```
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
``` |
118,839 | <p>I would like to replace only the group in parenthesis in this expression :</p>
<pre><code>my_string.gsub(/<--MARKER_START-->(.)*<--MARKER_END-->/, 'replace_text')
</code></pre>
<p>so that I get : <code><--MARKER_START-->replace_text<--MARKER_END--></code></p>
<p>I know I could repeat the w... | [
{
"answer_id": 118852,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>You could do something like this:</p>\n\n<pre><code>my_string.gsub(/(<--MARKER_START-->)(.*)(<--MARKER_END--&g... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20871/"
] | I would like to replace only the group in parenthesis in this expression :
```
my_string.gsub(/<--MARKER_START-->(.)*<--MARKER_END-->/, 'replace_text')
```
so that I get : `<--MARKER_START-->replace_text<--MARKER_END-->`
I know I could repeat the whole `MARKER_START` and `MARKER_END` blocks in the substitution expr... | You could do something like this:
```
my_string.gsub(/(<--MARKER_START-->)(.*)(<--MARKER_END-->)/, '\1replace_text\3')
``` |
118,851 | <p>Up until now I've been able to get away with using the default routing that came with ASP.NET MVC. Unfortunately, now that I'm branching out into more complex routes, I'm struggling to wrap my head around how to get this to work.</p>
<p>A simple example I'm trying to get is to have the path /User/{UserID}/Items to... | [
{
"answer_id": 118996,
"author": "Ricky",
"author_id": 653,
"author_profile": "https://Stackoverflow.com/users/653",
"pm_score": 1,
"selected": false,
"text": "<p>Can you post more information? What URL is the aspx page generating in the link? It could be because of the order of your rou... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | Up until now I've been able to get away with using the default routing that came with ASP.NET MVC. Unfortunately, now that I'm branching out into more complex routes, I'm struggling to wrap my head around how to get this to work.
A simple example I'm trying to get is to have the path /User/{UserID}/Items to map to the... | Going by the MVC Preview 4 code I have in front of me the overload for Html.ActionLink() you are using is this one:
```
public string ActionLink(string linkText, string actionName, object values);
```
Note how the second parameter is the *actionName* not the *routeName*.
As such, try:
```
Html.ActionLink("Items", ... |
118,863 | <p>When is it appropriate to use a class in Visual Basic for Applications (VBA)?</p>
<p>I'm assuming the <a href="http://en.wikipedia.org/wiki/Class_(computer_science)#Reasons_for_using_classes" rel="noreferrer">accelerated development and reduction of introducing bugs</a> is a common benefit for most languages that s... | [
{
"answer_id": 118870,
"author": "JosephStyons",
"author_id": 672,
"author_profile": "https://Stackoverflow.com/users/672",
"pm_score": -1,
"selected": false,
"text": "<p>I don't see why the criteria for VBA would be any different from another language, particularly if you are referring ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3155/"
] | When is it appropriate to use a class in Visual Basic for Applications (VBA)?
I'm assuming the [accelerated development and reduction of introducing bugs](http://en.wikipedia.org/wiki/Class_(computer_science)#Reasons_for_using_classes) is a common benefit for most languages that support OOP. But with VBA, is there a s... | It depends on who's going to develop and maintain the code. Typical "Power User" macro writers hacking small ad-hoc apps may well be confused by using classes. But for serious development, the reasons to use classes are the same as in other languages. You have the same restrictions as VB6 - no inheritance - but you can... |
118,884 | <p>I have noticed that some browsers (in particular, Firefox and <a href="https://en.wikipedia.org/wiki/Opera_%28web_browser%29" rel="noreferrer">Opera</a>) are very zealous in using cached copies of <strong>.css</strong> and <strong>.js</strong> files, even between browser sessions. This leads to a problem when you up... | [
{
"answer_id": 118886,
"author": "Kip",
"author_id": 18511,
"author_profile": "https://Stackoverflow.com/users/18511",
"pm_score": 9,
"selected": false,
"text": "<p>This solution is written in PHP, but it should be easily adapted to other languages.</p>\n<p>The original <code>.htaccess</... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] | I have noticed that some browsers (in particular, Firefox and [Opera](https://en.wikipedia.org/wiki/Opera_%28web_browser%29)) are very zealous in using cached copies of **.css** and **.js** files, even between browser sessions. This leads to a problem when you update one of these files, but the user's browser keeps on ... | This solution is written in PHP, but it should be easily adapted to other languages.
The original `.htaccess` regex can cause problems with files like `json-1.3.js`. The solution is to only rewrite if there are exactly 10 digits at the end. (Because 10 digits covers all timestamps from 9/9/2001 to 11/20/2286.)
First,... |
118,905 | <p>I'm trying to write a parser to get the data out of a typical html table day/time schedule (like <a href="http://kut.org/about/schedule" rel="nofollow noreferrer">this</a>). </p>
<p>I'd like to give this parser a page and a table class/id, and have it return a list of events, along with days & times they occur.... | [
{
"answer_id": 119029,
"author": "treat your mods well",
"author_id": 20772,
"author_profile": "https://Stackoverflow.com/users/20772",
"pm_score": 0,
"selected": false,
"text": "<p>This is what the program will need to do:</p>\n\n<ol>\n<li>Read the tags in (detect attributes and open/cl... | 2008/09/23 | [
"https://Stackoverflow.com/questions/118905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to write a parser to get the data out of a typical html table day/time schedule (like [this](http://kut.org/about/schedule)).
I'd like to give this parser a page and a table class/id, and have it return a list of events, along with days & times they occur. It should take into account rowspans and colspans,... | The best thing to do here is to use a HTML parser. With a HTML parser you can look at the table rows programmatically, without having to resort to fragile regular expressions and doing the parsing yourself.
Then you can run some logic along the lines of (this is not runnable code, just a sketch that you should be able... |
119,009 | <p>In our Java applications we typically use the maven conventions (docs, src/java, test, etc.). For Perl we follow similar conventions only using a top level 'lib' which is easy to add to Perl's @INC.</p>
<p>I'm about to embark on creating a service written in Erlang, what's a good source layout for Erlang applicati... | [
{
"answer_id": 119443,
"author": "Bwooce",
"author_id": 15290,
"author_profile": "https://Stackoverflow.com/users/15290",
"pm_score": 5,
"selected": true,
"text": "<p>The Erlang recommended standard directory structure can be <a href=\"http://erlang.org/doc/design_principles/applications... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19784/"
] | In our Java applications we typically use the maven conventions (docs, src/java, test, etc.). For Perl we follow similar conventions only using a top level 'lib' which is easy to add to Perl's @INC.
I'm about to embark on creating a service written in Erlang, what's a good source layout for Erlang applications? | The Erlang recommended standard directory structure can be [found here](http://erlang.org/doc/design_principles/applications.html#id80846).
In addition you may need a few more directories depending on your project, common ones are (credit to Vance Shipley):
```
lib: OS driver libraries
bin: OS... |
119,011 | <p>Can anyone suggest a good way of detecting if a database is empty from Java (needs to support at least Microsoft SQL Server, Derby and Oracle)?</p>
<p>By empty I mean in the state it would be if the database were freshly created with a new create database statement, though the check need not be 100% perfect if cove... | [
{
"answer_id": 119046,
"author": "Nathan Feger",
"author_id": 8563,
"author_profile": "https://Stackoverflow.com/users/8563",
"pm_score": 0,
"selected": false,
"text": "<p>Are you always checking databases created in the same way? If so you might be able to simply select from a subset o... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] | Can anyone suggest a good way of detecting if a database is empty from Java (needs to support at least Microsoft SQL Server, Derby and Oracle)?
By empty I mean in the state it would be if the database were freshly created with a new create database statement, though the check need not be 100% perfect if covers 99% of ... | There are some cross-database SQL-92 schema query standards - mileage for this of course varies according to vendor
```
SELECT COUNT(*) FROM [INFORMATION_SCHEMA].[TABLES] WHERE [TABLE_TYPE] = <tabletype>
```
Support for these varies by vendor, as does the content of the columns for the Tables view. SQL implementatio... |
119,018 | <p>It seems that anyone can snoop on incoming/outgoing .NET web service SOAP messages just by dropping in a simple SoapExtension into the bin folder and then plumbing it in using:</p>
<pre><code><soapExtensionTypes>
<add type="MyLoggingSoapExtension, SoapLoggingTools" priority="0" group="High" />
<soa... | [
{
"answer_id": 119212,
"author": "hurst",
"author_id": 10991,
"author_profile": "https://Stackoverflow.com/users/10991",
"pm_score": 3,
"selected": true,
"text": "<p>I am not sure what you mean by extensions and bin folders (I would guess you are using .NET), so I can't answer about them... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419/"
] | It seems that anyone can snoop on incoming/outgoing .NET web service SOAP messages just by dropping in a simple SoapExtension into the bin folder and then plumbing it in using:
```
<soapExtensionTypes>
<add type="MyLoggingSoapExtension, SoapLoggingTools" priority="0" group="High" />
<soapExtensionTypes>
```
Is the... | I am not sure what you mean by extensions and bin folders (I would guess you are using .NET), so I can't answer about them being loaded etc.
However, note that SOAP is designed to allow intermediaries to read the headers and even to modify them. (Do a search for "SOAP Active Intermediaries"). **Judging by that, I expe... |
119,060 | <p>The Image Web Part doesn't seem to have an href attribute that I can set. Is there something I am missing?</p>
| [
{
"answer_id": 119122,
"author": "Christian Hagelid",
"author_id": 202,
"author_profile": "https://Stackoverflow.com/users/202",
"pm_score": 3,
"selected": false,
"text": "<p>Does it have to be an Image Web Part? If not I would simply use a <a href=\"http://office.microsoft.com/en-us/sha... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The Image Web Part doesn't seem to have an href attribute that I can set. Is there something I am missing? | Does it have to be an Image Web Part? If not I would simply use a [Content Editor Web Part](http://office.microsoft.com/en-us/sharepointserver/HA100240461033.aspx) and paste the required HTML there.
```
<a href="http://www.google.com"><img src="urlToImage" /></a>
``` |
119,098 | <p>In new C++ code, I tend to use the C++ iostream library instead of the C stdio library.</p>
<p>I've noticed some programmers seem to stick to stdio, insisting that it's more portable.</p>
<p>Is this really the case? What is better to use?</p>
| [
{
"answer_id": 119118,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://Stackoverflow.com/users/5324",
"pm_score": 3,
"selected": false,
"text": "<p>If, like me, you learned C before learning C++, the stdio libraries seem more natural to use. There are pros and cons... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4086/"
] | In new C++ code, I tend to use the C++ iostream library instead of the C stdio library.
I've noticed some programmers seem to stick to stdio, insisting that it's more portable.
Is this really the case? What is better to use? | To answer the original question:
Anything that can be done using stdio can be done using the iostream library.
```
Disadvantages of iostreams: verbose
Advantages of iostreams: easy to extend for new non POD types.
```
The step forward the C++ made over C was type safety.
* iostreams was designed to be expli... |
119,107 | <p>This is what I have so far: </p>
<pre><code>myArray.map!{ rand(max) }
</code></pre>
<p>Obviously, however, sometimes the numbers in the list are not unique. How can I make sure my list only contains unique numbers without having to create a bigger list from which I then just pick the n unique numbers?</p>
<p><st... | [
{
"answer_id": 119120,
"author": "Kyle Burton",
"author_id": 19784,
"author_profile": "https://Stackoverflow.com/users/19784",
"pm_score": 1,
"selected": false,
"text": "<p>You could use a hash to track the random numbers you've used so far:</p>\n\n<pre><code>seen = {}\nmax = 100\n(1..10... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] | This is what I have so far:
```
myArray.map!{ rand(max) }
```
Obviously, however, sometimes the numbers in the list are not unique. How can I make sure my list only contains unique numbers without having to create a bigger list from which I then just pick the n unique numbers?
**Edit:**
I'd really like to see t... | This uses Set:
```
require 'set'
def rand_n(n, max)
randoms = Set.new
loop do
randoms << rand(max)
return randoms.to_a if randoms.size >= n
end
end
``` |
119,114 | <p>I code C++ using MS Dev Studio and I work from home two days per week. I use CVS to keep my sources synchronized between the two computers but there are difference between the environments the machines are in.</p>
<p>Can anyone suggest a way I can conditionally modify constants in my code depending on whether I am ... | [
{
"answer_id": 119121,
"author": "Martin Beckett",
"author_id": 10897,
"author_profile": "https://Stackoverflow.com/users/10897",
"pm_score": 2,
"selected": false,
"text": "<p>You can set preproccesor variables in the properties->c++->preprocessor<br>\nin visual studio settings you can u... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5324/"
] | I code C++ using MS Dev Studio and I work from home two days per week. I use CVS to keep my sources synchronized between the two computers but there are difference between the environments the machines are in.
Can anyone suggest a way I can conditionally modify constants in my code depending on whether I am compiling ... | On your home and work machines, set an environment variable `LOCATION` that is either "1" for home or "2" for work.
Then in the preprocessor options, add a preprocessor define /DLOCATION=$(LOCATION). This will evaluate to either the "home" or "work" string that you set in the environment variable.
Then in your code:
... |
119,123 | <p>Why does the <code>sizeof</code> operator return a size larger for a structure than the total sizes of the structure's members?</p>
| [
{
"answer_id": 119128,
"author": "Kevin",
"author_id": 6386,
"author_profile": "https://Stackoverflow.com/users/6386",
"pm_score": 11,
"selected": true,
"text": "<p>This is because of padding added to satisfy alignment constraints. <a href=\"http://en.wikipedia.org/wiki/Data_structure_al... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6386/"
] | Why does the `sizeof` operator return a size larger for a structure than the total sizes of the structure's members? | This is because of padding added to satisfy alignment constraints. [Data structure alignment](http://en.wikipedia.org/wiki/Data_structure_alignment) impacts both performance and correctness of programs:
* Mis-aligned access might be a hard error (often `SIGBUS`).
* Mis-aligned access might be a soft error.
+ Either c... |
119,160 | <p>What is the difference between this:</p>
<pre><code>this.btnOk.Click += new System.EventHandler(this.btnOK_Click);
</code></pre>
<p>and this?</p>
<pre><code>this.btnOk.Click += this.btnOK_Click;
</code></pre>
<p>They both work. The former is what Visual Studio defaults to when you use the snippets. But it seem... | [
{
"answer_id": 119162,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 1,
"selected": false,
"text": "<p>I believe that C# since 3.0 has implicitly added the delegate handler. However, it can help to be more explici... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3798/"
] | What is the difference between this:
```
this.btnOk.Click += new System.EventHandler(this.btnOK_Click);
```
and this?
```
this.btnOk.Click += this.btnOK_Click;
```
They both work. The former is what Visual Studio defaults to when you use the snippets. But it seems like it only ads extra verbiage, or am I missing ... | No difference. Omitting the delegate instantiation is just syntax candy; the C# compiler will generate the delegate instantiation for you under the hood. |
119,167 | <p>I'm taking a look at how the model system in django works and I noticed something that I don't understand.</p>
<p>I know that you create an empty <code>__init__.py</code> file to specify that the current directory is a package. And that you can set some variable in <code>__init__.py</code> so that import * works p... | [
{
"answer_id": 119178,
"author": "Alexander Kojevnikov",
"author_id": 712,
"author_profile": "https://Stackoverflow.com/users/712",
"pm_score": 7,
"selected": true,
"text": "<p>All imports in <code>__init__.py</code> are made available when you import the package (directory) that contain... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3935/"
] | I'm taking a look at how the model system in django works and I noticed something that I don't understand.
I know that you create an empty `__init__.py` file to specify that the current directory is a package. And that you can set some variable in `__init__.py` so that import \* works properly.
But django adds a bunc... | All imports in `__init__.py` are made available when you import the package (directory) that contains it.
Example:
`./dir/__init__.py`:
```
import something
```
`./test.py`:
```
import dir
# can now use dir.something
```
EDIT: forgot to mention, the code in `__init__.py` runs the first time you import any modul... |
119,168 | <p>I have a datagridview assigned a datasource to it. now how to add a new row to that grid and remove a row from it?</p>
| [
{
"answer_id": 119175,
"author": "Joe Phillips",
"author_id": 20471,
"author_profile": "https://Stackoverflow.com/users/20471",
"pm_score": 0,
"selected": false,
"text": "<p>I believe you'll have to get the Table collection item and retrieve the Row collection item from that. Then you ca... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a datagridview assigned a datasource to it. now how to add a new row to that grid and remove a row from it? | One way to do this is as follows:
**Step #1** Setup the Data Adapter, Data Grid etc:
```
// the data grid
DataGridView dataGrid;
// create a new data table
DataTable table = new DataTable();
// create the data adapter
SqlDataAdapter dataAdapter = new SqlDataAdapter(strSQL, strDSN);
// populate the table using the ... |
119,197 | <p>I have a question about how to do something "The Rails Way". With an application that has a public facing side and an admin interface what is the general consensus in the Rails community on how to do it?</p>
<p>Namespaces, subdomains or forego them altogether?</p>
| [
{
"answer_id": 119301,
"author": "psst",
"author_id": 6392,
"author_profile": "https://Stackoverflow.com/users/6392",
"pm_score": 3,
"selected": false,
"text": "<p>In some smaller applications I don't think you need to separate the admin interface. Just use the regular interface and add ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20899/"
] | I have a question about how to do something "The Rails Way". With an application that has a public facing side and an admin interface what is the general consensus in the Rails community on how to do it?
Namespaces, subdomains or forego them altogether? | There's no real "Rails way" for admin interfaces, actually - you can find every possible solution in a number of applications. DHH has implied that he prefers namespaces (with HTTP Basic authentication), but that has remained a simple implication and not one of the official Rails Opinions.
That said, I've found good s... |
119,207 | <p>I'm new to Ruby, and I'm trying the following: </p>
<pre><code>mySet = numOfCuts.times.map{ rand(seqLength) }
</code></pre>
<p>but I get the 'yield called out of block' error. I'm not sure what his means. BTW, this question is part of a more general question I asked <a href="https://stackoverflow.com/questions/11... | [
{
"answer_id": 119226,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 1,
"selected": false,
"text": "<p>if \"numOfCuts\" is an integer, </p>\n\n<pre><code>5.times.foo \n</code></pre>\n\n<p>is invalid </p>\n\n<p>\"t... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] | I'm new to Ruby, and I'm trying the following:
```
mySet = numOfCuts.times.map{ rand(seqLength) }
```
but I get the 'yield called out of block' error. I'm not sure what his means. BTW, this question is part of a more general question I asked [**here**](https://stackoverflow.com/questions/119107/how-do-i-generate-a-... | The problem is that the times method expects to get a block that it will yield control to. However you haven't passed a block to it. There are two ways to solve this. The first is to not use times:
```
mySet = (1..numOfCuts).map{ rand(seqLength) }
```
or else pass a block to it:
```
mySet = []
numOfCuts.times {mySe... |
119,271 | <p>Just wondering if someone could help me with some msbuild scripts that I am trying to write. What I would like to do is copy all the files and sub folders from a folder to another folder using msbuild.</p>
<pre><code>{ProjectName}
|----->Source
|----->Tools
|----->Viewer
... | [
{
"answer_id": 119288,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "<p>Did you try to specify concrete destination directory instead of</p>\n<pre><code>DestinationFolder="@(Viewer->'$(Outp... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | Just wondering if someone could help me with some msbuild scripts that I am trying to write. What I would like to do is copy all the files and sub folders from a folder to another folder using msbuild.
```
{ProjectName}
|----->Source
|----->Tools
|----->Viewer
|-----{ab... | I was searching help on this too. It took me a while, but here is what I did that worked really well.
```
<Target Name="AfterBuild">
<ItemGroup>
<ANTLR Include="..\Data\antlrcs\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(ANTLR)" DestinationFolder="$(TargetDir)\%(RecursiveDir)" SkipUnchangedFiles="... |
119,278 | <p>I am using informix database, I want a query which you could also generate a row number along with the query</p>
<p>Like</p>
<pre><code>select row_number(),firstName,lastName
from students;
row_number() firstName lastName
1 john mathew
2 ricky pointing
3 sachin tendul... | [
{
"answer_id": 120767,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 1,
"selected": false,
"text": "<p>I think the easiest way would be to use the following code and adjust its return accordingly.\n SELECT rowid, ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using informix database, I want a query which you could also generate a row number along with the query
Like
```
select row_number(),firstName,lastName
from students;
row_number() firstName lastName
1 john mathew
2 ricky pointing
3 sachin tendulkar
```
Here firstN... | The best way is to use a (newly initialized) sequence.
```
begin work;
create sequence myseq;
select myseq.nextval,s.firstName,s.lastName from students s;
drop sequence myseq;
commit work;
``` |
119,281 | <ol>
<li><p>New class is a subclass of the original object</p></li>
<li><p>It needs to be php4 compatible</p></li>
</ol>
| [
{
"answer_id": 119287,
"author": "Joe Phillips",
"author_id": 20471,
"author_profile": "https://Stackoverflow.com/users/20471",
"pm_score": 1,
"selected": false,
"text": "<p>I would imagine you would have to invent some sort of a \"copy constructor\". Then you would just create a new sub... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20907/"
] | 1. New class is a subclass of the original object
2. It needs to be php4 compatible | You could have your classes instantiated empty and then loaded by any number of methods. One of these methods could accept an instance of the parent class as an argument, and then copy its data from there
```
class childClass extends parentClass
{
function childClass()
{
//do nothing
}
functio... |
119,284 | <p>I would like to be able to override the default behaviour for positioning the caret in a masked textbox.</p>
<p>The default is to place the caret where the mouse was clicked, the masked textbox already contains characters due to the mask.</p>
<p>I know that you can hide the caret as mentioned in this <a href="http... | [
{
"answer_id": 119368,
"author": "Abbas",
"author_id": 4714,
"author_profile": "https://Stackoverflow.com/users/4714",
"pm_score": 6,
"selected": true,
"text": "<p>This should do the trick:</p>\n\n<pre><code> private void maskedTextBox1_Enter(object sender, EventArgs e)\n {\n ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4490/"
] | I would like to be able to override the default behaviour for positioning the caret in a masked textbox.
The default is to place the caret where the mouse was clicked, the masked textbox already contains characters due to the mask.
I know that you can hide the caret as mentioned in this [post](https://stackoverflow.c... | This should do the trick:
```
private void maskedTextBox1_Enter(object sender, EventArgs e)
{
this.BeginInvoke((MethodInvoker)delegate()
{
maskedTextBox1.Select(0, 0);
});
}
``` |
119,286 | <p>Consider the following ruby code</p>
<p>test.rb:</p>
<pre><code>begin
puts
thisFunctionDoesNotExist
x = 1+1
rescue Exception => e
p e
end
</code></pre>
<p>For debugging purposes, I would like the rescue block to know that the error occurred in line 4 of this file. Is there a clean way of doing that?<... | [
{
"answer_id": 119304,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 7,
"selected": true,
"text": "<pre><code>p e.backtrace \n</code></pre>\n\n<p>I ran it on an IRB session which has no source and it still gave releva... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17674/"
] | Consider the following ruby code
test.rb:
```
begin
puts
thisFunctionDoesNotExist
x = 1+1
rescue Exception => e
p e
end
```
For debugging purposes, I would like the rescue block to know that the error occurred in line 4 of this file. Is there a clean way of doing that? | ```
p e.backtrace
```
I ran it on an IRB session which has no source and it still gave relevant info.
```
=> ["(irb):11:in `foo'",
"(irb):17:in `irb_binding'",
"/usr/lib64/ruby/1.8/irb/workspace.rb:52:in `irb_binding'",
"/usr/lib64/ruby/1.8/irb/workspace.rb:52"]
```
If you want a nicely parsed ba... |
119,295 | <p>Within our Active Directory domain, we have a MS SQL 2005 server, and a SharePoint (MOSS 3.0 I believe) server. Both authenticate against our LDAP server. Would like to allow these authenticated SharePoint visitors to see some of the data from the MS SQL database. Primary challenge is authentication.</p>
<p>Any ... | [
{
"answer_id": 119348,
"author": "Leo Moore",
"author_id": 6336,
"author_profile": "https://Stackoverflow.com/users/6336",
"pm_score": 2,
"selected": true,
"text": "<p>If you are using C# the code and connection string is:</p>\n\n<pre><code>using System.Data.SqlClient; \n... \nSqlConnect... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18484/"
] | Within our Active Directory domain, we have a MS SQL 2005 server, and a SharePoint (MOSS 3.0 I believe) server. Both authenticate against our LDAP server. Would like to allow these authenticated SharePoint visitors to see some of the data from the MS SQL database. Primary challenge is authentication.
Any tips on getti... | If you are using C# the code and connection string is:
```
using System.Data.SqlClient;
...
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString =
"Data Source=(local);" +
"Initial Catalog=myDatabaseName;" +
"Integrated Security=SSPI";
//Or
// "Server=(local);" +
// "Database=my... |
119,308 | <p>I have a huge database with some 100 tables and some 250 stored procedures. I want to know the list of tables affected by a subset of stored procedures. For example, I have a list of 50 stored procedures, out of 250, and I want to know the list of tables that will be affected by these 50 stored procedures. Is there ... | [
{
"answer_id": 119333,
"author": "BCS",
"author_id": 1343,
"author_profile": "https://Stackoverflow.com/users/1343",
"pm_score": -1,
"selected": false,
"text": "<p>One very invasive option would be to get a duplicate database and set a trigger on every table that logs that something happ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a huge database with some 100 tables and some 250 stored procedures. I want to know the list of tables affected by a subset of stored procedures. For example, I have a list of 50 stored procedures, out of 250, and I want to know the list of tables that will be affected by these 50 stored procedures. Is there any... | This would be your SQL Server query:
```
SELECT
[NAME]
FROM
sysobjects
WHERE
xType = 'U' AND --specifies a user table object
id in
(
SELECT
sd.depid
FROM
sysobjects so,
sysdepends sd
WHERE
so.name = 'NameOfStoredProcedure' A... |
119,328 | <p>How do I truncate a java <code>String</code> so that I know it will fit in a given number of bytes storage once it is UTF-8 encoded?</p>
| [
{
"answer_id": 119338,
"author": "billjamesdev",
"author_id": 13824,
"author_profile": "https://Stackoverflow.com/users/13824",
"pm_score": 3,
"selected": false,
"text": "<p>UTF-8 encoding has a neat trait that allows you to see where in a byte-set you are.</p>\n\n<p>check the stream at ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4220/"
] | How do I truncate a java `String` so that I know it will fit in a given number of bytes storage once it is UTF-8 encoded? | Here is a simple loop that counts how big the UTF-8 representation is going to be, and truncates when it is exceeded:
```
public static String truncateWhenUTF8(String s, int maxBytes) {
int b = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// ranges from http://en.wikipedia.o... |
119,336 | <p>I've got a customer trying to access one of my sites, and they keep getting this error > ssl_error_rx_record_too_long</p>
<p>They're getting this error on all browsers, all platforms. I can't reproduce the problem at all.</p>
<p>My server and myself are located in the USA, the customer is located in India.</p>
<p... | [
{
"answer_id": 119345,
"author": "dan-manges",
"author_id": 20072,
"author_profile": "https://Stackoverflow.com/users/20072",
"pm_score": 3,
"selected": false,
"text": "<p>Ask the user for the exact URL they're using in their browser. If they're entering <a href=\"https://your.site:80\" ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10596/"
] | I've got a customer trying to access one of my sites, and they keep getting this error > ssl\_error\_rx\_record\_too\_long
They're getting this error on all browsers, all platforms. I can't reproduce the problem at all.
My server and myself are located in the USA, the customer is located in India.
I googled on the p... | The [link mentioned by Subimage](http://support.servertastic.com/error-code-ssl-error-rx-record-too-long/) was right on the money for me. It suggested changing the virtual host tag, ie, from `<VirtualHost myserver.example.com:443>` to `<VirtualHost _default_:443>`
>
> Error code: `ssl_error_rx_record_too_long`
>
>
... |
119,404 | <p>What is the simplest way to determine the length (in seconds) of a given mp3 file, <strong>without using outside libraries</strong>? (python source highly appreciated)</p>
| [
{
"answer_id": 119418,
"author": "Harley Holcombe",
"author_id": 1057,
"author_profile": "https://Stackoverflow.com/users/1057",
"pm_score": 6,
"selected": true,
"text": "<p>You can use <a href=\"http://spacepants.org/src/pymad/\" rel=\"noreferrer\">pymad</a>. It's an external library, ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9440/"
] | What is the simplest way to determine the length (in seconds) of a given mp3 file, **without using outside libraries**? (python source highly appreciated) | You can use [pymad](http://spacepants.org/src/pymad/). It's an external library, but don't fall for the Not Invented Here trap. Any particular reason you don't want any external libraries?
```
import mad
mf = mad.MadFile("foo.mp3")
track_length_in_milliseconds = mf.total_time()
```
Spotted [here](http://simonwi... |
119,426 | <p>Are there any industry standard conventions for naming jar files?</p>
| [
{
"answer_id": 119430,
"author": "Ron Tuffin",
"author_id": 939,
"author_profile": "https://Stackoverflow.com/users/939",
"pm_score": 6,
"selected": true,
"text": "<p>I have been using </p>\n\n<pre><code>*Informative*-*name*-*M*.*m*.*b*.jar\n</code></pre>\n\n<p>Where:</p>\n\n<p><em>M</em... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/939/"
] | Are there any industry standard conventions for naming jar files? | I have been using
```
*Informative*-*name*-*M*.*m*.*b*.jar
```
Where:
*M* = `major version number` (changed when backward compatibility is not necessarily maintained)
*m* = `minor version number` (feature additions etc)
*b* = `build number` (for releases containing bug fixes) |
119,432 | <p>Im running a ASP.NET Site where I have problems to find some JavaScript Errors just with manual testing.</p>
<p>Is there a possibility to catch all JavaScript Errors on the Clientside and log them on the Server i.e. in the EventLog (via Webservice or something like that)?</p>
| [
{
"answer_id": 119442,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 0,
"selected": false,
"text": "<p>You could potentially make an Ajax call to the server from a try/catch, but that's probably about the best you can do.</... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17558/"
] | Im running a ASP.NET Site where I have problems to find some JavaScript Errors just with manual testing.
Is there a possibility to catch all JavaScript Errors on the Clientside and log them on the Server i.e. in the EventLog (via Webservice or something like that)? | You could try setting up your own handler for the [onerror event](http://developer.mozilla.org/En/DOM:window.onerror) and use XMLHttpRequest to tell the server what went wrong, however since it's not part of any specification, [support is somewhat flaky](http://www.quirksmode.org/dom/events/error.html).
Here's an exam... |
119,441 | <p>I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text:</p>
<pre class="lang-html prettyprint-override"><code><p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>
<p>
Quisque bibend... | [
{
"answer_id": 119450,
"author": "Sebastian Hoitz",
"author_id": 9535,
"author_profile": "https://Stackoverflow.com/users/9535",
"pm_score": 1,
"selected": false,
"text": "<p>You need to get the content of the p tag and replace all the dolors in it with the highlighted version.</p>\n\n<p... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text:
```html
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>
<p>
Quisque bibendum sem ut lacus. Integer dolor ullamcorper libero.
Aliquam rhoncus eros ... | ~~Try [highlight: JavaScript text highlighting jQuery plugin](http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html).~~
**Warning: The source code available on this page contains a cryptocurrency mining script, either use the code below or remove the mining script ... |
119,462 | <p>I'd like to remove all of the black from a picture attached to a sprite so that it becomes transparent. </p>
| [
{
"answer_id": 124493,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>This looks like it'll do the trick:</p>\n\n<p><a href=\"http://www.quartzcompositions.com/phpBB2/viewtopic.php?t=281\" rel=... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20824/"
] | I'd like to remove all of the black from a picture attached to a sprite so that it becomes transparent. | I'll copy and paste in case that link dies:
*" I used a 'Color Matrix' patch, setting 'Alpha Vector (W)' and 'Bias Vector(X,Y,Z)' to 1 and all other to 0.
You will then find the alpha channel from the input image at the output."*
I found this before, but I can't figure out exactly how to do it.
I found another sol... |
119,477 | <p>I have an MSSQL2005 stored procedure here, which is supposed to take an XML message as input, and store it's content into a table.
The table fields are varchars, because our delphi backend application could not handle unicode.
Now, the messages that come in, are encoded ISO-8859-1. All is fine until characters over ... | [
{
"answer_id": 119836,
"author": "TToni",
"author_id": 20703,
"author_profile": "https://Stackoverflow.com/users/20703",
"pm_score": 0,
"selected": false,
"text": "<p>The errorcode you mention seems to come from the MSXML Library. How is that involved there? From your question I would as... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15477/"
] | I have an MSSQL2005 stored procedure here, which is supposed to take an XML message as input, and store it's content into a table.
The table fields are varchars, because our delphi backend application could not handle unicode.
Now, the messages that come in, are encoded ISO-8859-1. All is fine until characters over the... | I don't know if anybody with enough rights to edit the answer will see this but while the answer is correct I would like to add that without specifying the collation explicitly the default collation of the database would be used in this case since it is implicitly assigned to every varchar-variable without a collation ... |
119,548 | <p>I have created a webservice in .net 2.0, C#. I need to log some information to a file whenever different methods are called by the web service clients. </p>
<p>The problem comes when one user process is writing to a file and another process tries to write to it. I get the following error:</p>
<blockquote>
<p>The... | [
{
"answer_id": 119564,
"author": "Joel",
"author_id": 13713,
"author_profile": "https://Stackoverflow.com/users/13713",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe write a \"queue line\" of sorts for writing to the file, so when you try to write to the file it keeps checking to s... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20933/"
] | I have created a webservice in .net 2.0, C#. I need to log some information to a file whenever different methods are called by the web service clients.
The problem comes when one user process is writing to a file and another process tries to write to it. I get the following error:
>
> The process cannot access the ... | The locking is probably failing because your webservice is being run by more than one worker process.
You could protect the access with a named mutex, which is shared across processes, unlike the locks you get by using `lock(someobject) {...}`:
```
Mutex lock = new Mutex("mymutex", false);
lock.WaitOne();
// access ... |
119,559 | <p>Is there an easy way to programmatically determine the number of lines within a text file? </p>
| [
{
"answer_id": 119572,
"author": "Greg Beech",
"author_id": 13552,
"author_profile": "https://Stackoverflow.com/users/13552",
"pm_score": 10,
"selected": true,
"text": "<p><strong>Seriously belated edit: If you're using .NET 4.0 or later</strong></p>\n\n<p>The <code>File</code> class has... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | Is there an easy way to programmatically determine the number of lines within a text file? | **Seriously belated edit: If you're using .NET 4.0 or later**
The `File` class has a new [`ReadLines`](http://msdn.microsoft.com/en-us/library/dd383503.aspx) method which lazily enumerates lines rather than greedily reading them all into an array like `ReadAllLines`. So now you can have both efficiency and conciseness... |
119,578 | <p>What is the best way to disable the warnings generated via <code>_CRT_SECURE_NO_DEPRECATE</code> that allows them to be reinstated with ease and will work across Visual Studio versions?</p>
| [
{
"answer_id": 119619,
"author": "dennisV",
"author_id": 20208,
"author_profile": "https://Stackoverflow.com/users/20208",
"pm_score": 1,
"selected": false,
"text": "<p>You can define the _CRT_SECURE_NO_WARNINGS symbol to suppress them and undefine it to reinstate them back.</p>\n"
},
... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8516/"
] | What is the best way to disable the warnings generated via `_CRT_SECURE_NO_DEPRECATE` that allows them to be reinstated with ease and will work across Visual Studio versions? | If you don't want to pollute your source code (after all this warning presents only with Microsoft compiler), add `_CRT_SECURE_NO_WARNINGS` symbol to your project settings via "Project"->"Properties"->"Configuration properties"->"C/C++"->"Preprocessor"->"Preprocessor definitions".
Also you can define it just before yo... |
119,588 | <p>I've just built a basic ASP MVC web site for deployment on our intranet. It expects users to be on the same domain as the IIS box and if you're not an authenticated Windows User, you should not get access.</p>
<p>I've just deployed this to IIS6 running on Server 2003 R2 SP2. The web app is configured with it's own ... | [
{
"answer_id": 119689,
"author": "Matt Mitchell",
"author_id": 364,
"author_profile": "https://Stackoverflow.com/users/364",
"pm_score": 0,
"selected": false,
"text": "<p>It sounds to me as though you've done everything right.</p>\n\n<p>I'm sure you are but have you made sure you are usi... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20819/"
] | I've just built a basic ASP MVC web site for deployment on our intranet. It expects users to be on the same domain as the IIS box and if you're not an authenticated Windows User, you should not get access.
I've just deployed this to IIS6 running on Server 2003 R2 SP2. The web app is configured with it's own pool with ... | After extensive Googling I managed to find a solution on the following MSDN article:
[How To: Create a Service Account for an ASP.NET 2.0 Application](http://msdn.microsoft.com/en-us/library/ms998297.aspx)
Specifically the Additional Considerations section which describes "Creating Service Principal Names (SPNs) fo... |
119,609 | <p>I have 20 ips from my isp. I have them bound to a router box running centos. What commands, and in what order, do I set up so that the other boxes on my lan, based either on their mac addresses or 192 ips can I have them route out my box on specific ips. For example I want mac addy <code>xxx:xxx:xxx0400</code> to go... | [
{
"answer_id": 119655,
"author": "Christopher Mahan",
"author_id": 479,
"author_profile": "https://Stackoverflow.com/users/479",
"pm_score": 0,
"selected": false,
"text": "<p>What's the router hardware and software version?</p>\n\n<p>Are you trying to do this with a linux box? Stop now a... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8456/"
] | I have 20 ips from my isp. I have them bound to a router box running centos. What commands, and in what order, do I set up so that the other boxes on my lan, based either on their mac addresses or 192 ips can I have them route out my box on specific ips. For example I want mac addy `xxx:xxx:xxx0400` to go out `72.049.1... | Use `iptables` to setup `NAT`.
```
iptables -t nat -I POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 72.049.12.157
iptables -t nat -I POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 72.049.12.158
```
This should cause any ips on the `192.168.0.0` subnet to have an 'external' ip of `72.049.12.157` and those on... |
119,627 | <p>I'm trying to store an xml serialized object in a cookie, but i get an error like this:</p>
<pre><code>A potentially dangerous Request.Cookies value was detected from the client (KundeContextCookie="<?xml version="1.0" ...")
</code></pre>
<p>I know the problem from similiar cases when you try to store something... | [
{
"answer_id": 119665,
"author": "stephbu",
"author_id": 12702,
"author_profile": "https://Stackoverflow.com/users/12702",
"pm_score": 2,
"selected": true,
"text": "<p>I wouldn't store data in XML in the cookie - there is a limit on cookie size for starters (used to be 4K for <em>all</em... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11619/"
] | I'm trying to store an xml serialized object in a cookie, but i get an error like this:
```
A potentially dangerous Request.Cookies value was detected from the client (KundeContextCookie="<?xml version="1.0" ...")
```
I know the problem from similiar cases when you try to store something that looks like javascript c... | I wouldn't store data in XML in the cookie - there is a limit on cookie size for starters (used to be 4K for *all* headers including the cookie). Pick a less verbose encoding strategy such as delimiters instead e.g. a|b|c or separate cookie values. Delimited encoding makes it especially easy and fast to decode the valu... |
119,651 | <p>Let me start off with a bit of background.</p>
<p>This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of another program (SpyBot) have reported the same pro... | [
{
"answer_id": 119671,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 1,
"selected": false,
"text": "<p>Why don't you contact CA and ask them to tell them what they're searching for, for that virus?</p>\n\n<p>Or, you coul... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15109/"
] | Let me start off with a bit of background.
This morning one of our users reported that Testuff's setup file has been reported as infected with a virus by the CA antivirus. Confident that this was a false positive, I looked on the web and found that users of another program (SpyBot) have reported the same problem.
A n... | See [the longest common substring problem](http://en.wikipedia.org/wiki/Longest_common_substring_problem). I guess difflib uses the DP solution, which is certainly too slow to compare executables. You can do much better with suffix trees/arrays.
Using perl [Tree::Suffix](http://search.cpan.org/~gray/Tree-Suffix-0.20/l... |
119,669 | <p>How can I fetch data in a Winforms application or ASP.NET form from a SAP database? The .NET framework used is 2.0. , language is C# and SAP version is 7.10. </p>
| [
{
"answer_id": 119671,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 1,
"selected": false,
"text": "<p>Why don't you contact CA and ask them to tell them what they're searching for, for that virus?</p>\n\n<p>Or, you coul... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4021/"
] | How can I fetch data in a Winforms application or ASP.NET form from a SAP database? The .NET framework used is 2.0. , language is C# and SAP version is 7.10. | See [the longest common substring problem](http://en.wikipedia.org/wiki/Longest_common_substring_problem). I guess difflib uses the DP solution, which is certainly too slow to compare executables. You can do much better with suffix trees/arrays.
Using perl [Tree::Suffix](http://search.cpan.org/~gray/Tree-Suffix-0.20/l... |
119,679 | <p>I have a huge database with 100's of tables and stored procedures. Using SQL Server 2005, how can I get a list of stored procedures that are doing an insert or update operation on a given table.</p>
| [
{
"answer_id": 119704,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 1,
"selected": false,
"text": "<p>You could try exporting all of your stored procedures into a text file and then use a simple search.</p>\n\n<p>A ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | I have a huge database with 100's of tables and stored procedures. Using SQL Server 2005, how can I get a list of stored procedures that are doing an insert or update operation on a given table. | ```
select
so.name,
sc.text
from
sysobjects so inner join syscomments sc on so.id = sc.id
where
sc.text like '%INSERT INTO xyz%'
or sc.text like '%UPDATE xyz%'
```
This will give you a list of all stored procedure contents with INSERT or UPDATE in them for a particular table (you can obviously tweak the que... |
119,696 | <p>Is there anywhere on the web free vista look and feel theme pack for java?</p>
| [
{
"answer_id": 119722,
"author": "Josh Moore",
"author_id": 5004,
"author_profile": "https://Stackoverflow.com/users/5004",
"pm_score": 0,
"selected": false,
"text": "<p>If you use SWT it has a native vista look and feel built in. However, if you are using swing I honestly do not know.<... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15878/"
] | Is there anywhere on the web free vista look and feel theme pack for java? | I'm guessing that what you want is to use the system look and feel regardless on whatever platform your application is started. This can be done with
```
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
```
on the main() method (you have to handle possible exceptions of course ;-).
As I don't ... |
119,730 | <p>I have a <code>VARCHAR</code> column in a <code>SQL Server 2000</code> database that can contain either letters or numbers. It depends on how the application is configured on the front-end for the customer. </p>
<p>When it does contain numbers, I want it to be sorted numerically, e.g. as "1", "2", "10" instead of "... | [
{
"answer_id": 119780,
"author": "Cowan",
"author_id": 17041,
"author_profile": "https://Stackoverflow.com/users/17041",
"pm_score": 4,
"selected": false,
"text": "<p>There are a few possible ways to do this.</p>\n\n<p>One would be</p>\n\n<pre><code>SELECT\n ...\nORDER BY\n CASE \n W... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585/"
] | I have a `VARCHAR` column in a `SQL Server 2000` database that can contain either letters or numbers. It depends on how the application is configured on the front-end for the customer.
When it does contain numbers, I want it to be sorted numerically, e.g. as "1", "2", "10" instead of "1", "10", "2". Fields containing... | One possible solution is to pad the numeric values with a character in front so that all are of the same string length.
Here is an example using that approach:
```sql
select MyColumn
from MyTable
order by
case IsNumeric(MyColumn)
when 1 then Replicate('0', 100 - Len(MyColumn)) + MyColumn
else My... |
119,754 | <p>I am sending newsletters from a Java server and one of the hyperlinks is arriving missing a period, rendering it useless:</p>
<pre><code>Please print your <a href=3D"http://xxxxxxx.xxx.xx.edu=
au//newsletter2/3/InnovExpoInviteVIP.pdf"> VIP invitation</a> for future re=
ference and check the Inn... | [
{
"answer_id": 119772,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>From an SMTP perspective, you can start a line with a period but you have to send two periods instead. If the SMTP cli... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9731/"
] | I am sending newsletters from a Java server and one of the hyperlinks is arriving missing a period, rendering it useless:
```
Please print your <a href=3D"http://xxxxxxx.xxx.xx.edu=
au//newsletter2/3/InnovExpoInviteVIP.pdf"> VIP invitation</a> for future re=
ference and check the Innovation Expo website <a href=3D"htt... | From an SMTP perspective, you can start a line with a period but you have to send two periods instead. If the SMTP client you're using doesn't do this, you may encounter the problem you describe.
It might be worth trying an IP sniffer to see where the problem really is. There are likely at least two separate SMTP tran... |
119,788 | <p>Before moving on to use SVN, I used to manage my project by simply keeping a <code>/develop/</code> directory and editing and testing files there, then moving them to the <code>/main/</code> directory. When I decided to move to SVN, I needed to be sure that the directories were indeed in sync.</p>
<p>So, what is a ... | [
{
"answer_id": 119811,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 6,
"selected": true,
"text": "<p>The diff command has a -r option to recursively compare directories:</p>\n\n<pre><code>diff -r /develop /main\n</code><... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20386/"
] | Before moving on to use SVN, I used to manage my project by simply keeping a `/develop/` directory and editing and testing files there, then moving them to the `/main/` directory. When I decided to move to SVN, I needed to be sure that the directories were indeed in sync.
So, what is a good way to write a shell script... | The diff command has a -r option to recursively compare directories:
```
diff -r /develop /main
``` |
119,792 | <p>I've got a Subversion repository, backed by the berkeley DB. Occasionally it breaks down due to some locks and such not being released, but this morning it was impossible to recover it using the 'svnadmin recover' command. Instead it failed with the following error:</p>
<pre><code>svnadmin: Berkeley DB error for fi... | [
{
"answer_id": 119798,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<blockquote>\n <p>I've got a Subversion repository, backed by the berkeley DB.</p>\n</blockquote>\n\n<p>Sorry to hear th... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3197/"
] | I've got a Subversion repository, backed by the berkeley DB. Occasionally it breaks down due to some locks and such not being released, but this morning it was impossible to recover it using the 'svnadmin recover' command. Instead it failed with the following error:
```
svnadmin: Berkeley DB error for filesystem 'db' ... | >
> I've got a Subversion repository, backed by the berkeley DB.
>
>
>
Sorry to hear that. I would suggest that at your earliest convenience, you dump that repository (`svnadmin dump`) and reload it into a new one backed by FSFS (`svnadmin load`). |
119,802 | <p>I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this:</p>
<pre><code>server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT))
service = Service()
server.register_instance(service)
server.serve_forever()
</code></pre... | [
{
"answer_id": 119943,
"author": "Rafał Dowgird",
"author_id": 12166,
"author_profile": "https://Stackoverflow.com/users/12166",
"pm_score": 1,
"selected": false,
"text": "<p>As far as I know, the underlying protocol doesn't support named varargs (or any named args for that matter). The ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3355/"
] | I have a class that I wish to expose as a remote service using pythons SimpleXMLRPCServer. The server startup looks like this:
```
server = SimpleXMLRPCServer((serverSettings.LISTEN_IP,serverSettings.LISTEN_PORT))
service = Service()
server.register_instance(service)
server.serve_forever()
```
I then have a Servic... | You can't do this with plain xmlrpc since it has no notion of keyword arguments. However, you can superimpose this as a protocol on top of xmlrpc that would always pass a list as first argument, and a dictionary as a second, and then provide the proper support code so this becomes transparent for your usage, example be... |
119,818 | <p>I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id is know only at the... | [
{
"answer_id": 119833,
"author": "convex hull",
"author_id": 10747,
"author_profile": "https://Stackoverflow.com/users/10747",
"pm_score": 0,
"selected": false,
"text": "<p>If it's your only checkbox you can do a getElementsByTagName() call to get all inputs and then iterate through the ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id is know only at the se... | Here is a thought:
As indicated by Anonymous you can generate javascript, if you are in ASP.NET you have some help with the RegisterClientScriptBlock() method. [MSDN on Injecting Client Side Script](http://msdn.microsoft.com/en-us/library/aa478975.aspx)
Also you could write, or generate, a javascript function that ta... |
119,819 | <p>I need to cleanup the HTML of pasted text into TinyMCE by passing it to a webservice and then getting it back into the textarea.
So I need to override the Ctrl+V in TinyMCE to caputre the text, do a background request, and on return continue with whatever the paste handler was for TinyMCE.
First off, where is TinyMC... | [
{
"answer_id": 119901,
"author": "Aleksi Yrttiaho",
"author_id": 11427,
"author_profile": "https://Stackoverflow.com/users/11427",
"pm_score": 2,
"selected": false,
"text": "<p>You could write a plug-in that handles the ctrl+v event and passes it through or modify the paste plug-in. The ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to cleanup the HTML of pasted text into TinyMCE by passing it to a webservice and then getting it back into the textarea.
So I need to override the Ctrl+V in TinyMCE to caputre the text, do a background request, and on return continue with whatever the paste handler was for TinyMCE.
First off, where is TinyMCE's... | You could write a plug-in that handles the ctrl+v event and passes it through or modify the paste plug-in. The following code is found at [plugins/paste/editor\_plugin.js](http://source.ibiblio.org/trac/lyceum/browser/vendor/wordpress/trunk/wp-includes/js/tinymce/plugins/paste/editor_plugin.js?rev=1241) and it handles ... |
119,857 | <p>I am reading image files in Java using</p>
<pre><code>java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath);
</code></pre>
<p>On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit.</p>
<p>How else can you create a java.awt.Image object from an i... | [
{
"answer_id": 119864,
"author": "jjnguy",
"author_id": 2598,
"author_profile": "https://Stackoverflow.com/users/2598",
"pm_score": 4,
"selected": true,
"text": "<p>I read images using <a href=\"http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html\" rel=\"noreferrer\">ImageIO... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119/"
] | I am reading image files in Java using
```
java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath);
```
On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit.
How else can you create a java.awt.Image object from an image file? | I read images using [ImageIO](http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html).
```
Image i = ImageIO.read(InputStream in);
```
The javadoc will offer more info as well. |
119,860 | <p>Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup?</p>
| [
{
"answer_id": 119883,
"author": "Luke Bennett",
"author_id": 17602,
"author_profile": "https://Stackoverflow.com/users/17602",
"pm_score": 3,
"selected": true,
"text": "<p>The following is a macro taken from a comment by Lozza on <a href=\"https://blog.codinghorror.com/visual-studio-net... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | Using Visual Studio 2008 Team Edition, is it possible to assign a shortcut key that switches between markup and code? If not, is it possible to assign a shortcut key that goes from code to markup? | The following is a macro taken from a comment by Lozza on <https://blog.codinghorror.com/visual-studio-net-2003-and-2005-keyboard-shortcuts/>. You just need to bind it to a shortcut of your choice:
```
Sub SwitchToMarkup()
Dim FileName
If (DTE.ActiveWindow.Caption().EndsWith(".cs")) Then
' swith from .aspx.cs... |
119,869 | <p>Can someone give me some working examples of how you can create, add messages, read from, and destroy a private message queue from C++ APIs? I tried the MSDN pieces of code but i can't make them work properly.</p>
<p>Thanks</p>
| [
{
"answer_id": 120457,
"author": "Nevermind",
"author_id": 12366,
"author_profile": "https://Stackoverflow.com/users/12366",
"pm_score": -1,
"selected": false,
"text": "<p>Not quite sure how you'd go about creating or destroying message queues. Windows should create one per thread. </p>\... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can someone give me some working examples of how you can create, add messages, read from, and destroy a private message queue from C++ APIs? I tried the MSDN pieces of code but i can't make them work properly.
Thanks | Actualy this is the code i was interested in:
```
#include "windows.h"
#include "mq.h"
#include "tchar.h"
HRESULT CreateMSMQQueue(
LPWSTR wszPathName,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
LPWSTR wszOutFormatName,
DWO... |
119,941 | <p>I want to create variables inside function from dictionary.</p>
<p>Lets say I have a dictionary</p>
<pre><code>bar = {'a': 1, 'b': 2, 'c': 3}
</code></pre>
<p>and function</p>
<pre><code>def foo():
pass
</code></pre>
<p>What I want to do is to create inside function "foo" variables with names of each dictiona... | [
{
"answer_id": 119964,
"author": "Brian",
"author_id": 9493,
"author_profile": "https://Stackoverflow.com/users/9493",
"pm_score": 1,
"selected": false,
"text": "<p>Why would you want to do such a thing? Unless you actually do anything with the variables inside the function, a function ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20955/"
] | I want to create variables inside function from dictionary.
Lets say I have a dictionary
```
bar = {'a': 1, 'b': 2, 'c': 3}
```
and function
```
def foo():
pass
```
What I want to do is to create inside function "foo" variables with names of each dictionary item name and values as dictionary item values
So in... | Your question is not clear.
If you want to "set" said variables when foo is not running, no, you can't. There is no frame object yet to "set" the local variables in.
If you want to do that in the function body, you shouldn't (check the [python documentation](http://docs.python.org/lib/built-in-funcs.html) for locals(... |
119,961 | <p>Normally you can do this:</p>
<pre><code><select size="3">
<option>blah</option>
<option>blah</option>
<option>blah</option>
</select>
</code></pre>
<p>And it would render as a selectionbox where all three options are visible (without dropping down)<br>
I... | [
{
"answer_id": 119977,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": -1,
"selected": false,
"text": "<p>I do not believe this is possible no</p>\n"
},
{
"answer_id": 119988,
"author": "pilif",
"author_id": ... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | Normally you can do this:
```
<select size="3">
<option>blah</option>
<option>blah</option>
<option>blah</option>
</select>
```
And it would render as a selectionbox where all three options are visible (without dropping down)
I'm looking for a way to set this size attribute from css. | There ins't an option for setting the size, but if you do set the size some browsers will let you set the width/height properties to whatever you want via CSS.
Some = Firefox, Chrome, Safari, Opera.
Not much works in IE though (no surprise)
You could though, if you wanted, use CSS expressions in IE, to check if the ... |
119,971 | <p>I'm trying to run Selenium RC against my ASP.NET code running on a Cassini webserver.</p>
<p>The web application works when i browse it directly but when running through Selenium I get </p>
<p>HTTP ERROR: 403<br>
Forbidden for Proxy</p>
<hr>
<p>Running Selenium i interactive mode I start a new session with: </p... | [
{
"answer_id": 121055,
"author": "HAXEN",
"author_id": 11434,
"author_profile": "https://Stackoverflow.com/users/11434",
"pm_score": 1,
"selected": false,
"text": "<p>I think the problem is that both Selenium and the webserver is running on localhost.<br>\nIt works if I run with the \"ie... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11434/"
] | I'm trying to run Selenium RC against my ASP.NET code running on a Cassini webserver.
The web application works when i browse it directly but when running through Selenium I get
HTTP ERROR: 403
Forbidden for Proxy
---
Running Selenium i interactive mode I start a new session with:
```
cmd=getNewBrowserSession... | I think the problem is that both Selenium and the webserver is running on localhost.
It works if I run with the "iehta" instead of "iexplore". |
119,980 | <p>Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser?</p>
<p>I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silverlight control which is just shown if the S... | [
{
"answer_id": 119992,
"author": "Domenic",
"author_id": 3191,
"author_profile": "https://Stackoverflow.com/users/3191",
"pm_score": 5,
"selected": true,
"text": "<p>Include Silverlight.js (from Silverlight SDK)</p>\n\n<p><code>Silverlight.isInstalled(\"4.0\")</code></p>\n\n<hr>\n\n<p><s... | 2008/09/23 | [
"https://Stackoverflow.com/questions/119980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] | Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser?
I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silverlight control which is just shown if the Silverlight... | Include Silverlight.js (from Silverlight SDK)
`Silverlight.isInstalled("4.0")`
---
**Resource:**
[<http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx>](http://msdn.microsoft.com/en-us/library/cc265155(vs.95).aspx) |
120,001 | <p>I am looking for a free tool to load Excel data sheet into an Oracle database. I tried the Oracle SQL developer, but it keeps throwing a NullPointerException. Any ideas?</p>
| [
{
"answer_id": 120021,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 4,
"selected": false,
"text": "<p>Excel -> CSV -> Oracle</p>\n\n<p>Save the Excel spreadsheet as file type 'CSV' (Comma-Separated Values).</p>\n\n<p>Tran... | 2008/09/23 | [
"https://Stackoverflow.com/questions/120001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233512/"
] | I am looking for a free tool to load Excel data sheet into an Oracle database. I tried the Oracle SQL developer, but it keeps throwing a NullPointerException. Any ideas? | Excel -> CSV -> Oracle
Save the Excel spreadsheet as file type 'CSV' (Comma-Separated Values).
Transfer the .csv file to the Oracle server.
Create the Oracle table, using the SQL `CREATE TABLE` statement to define the table's column lengths and types.
Use sqlload to load the .csv file into the Oracle table. Create... |
120,016 | <p>I have the following XML structure:</p>
<pre><code><?xml version="1.0" ?>
<course xml:lang="nl">
<body>
<item id="787900813228567" view="12000" title="0x|Beschrijving" engtitle="0x|Description"><![CDATA[Dit college leert studenten hoe ze een onderzoek kunn$
<item id="54531166... | [
{
"answer_id": 120069,
"author": "Marc Gear",
"author_id": 6563,
"author_profile": "https://Stackoverflow.com/users/6563",
"pm_score": 2,
"selected": false,
"text": "<p>I believe its equivalent to the __toString() method on the object, so </p>\n\n<pre><code>echo $description[0];\n</code>... | 2008/09/23 | [
"https://Stackoverflow.com/questions/120016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18922/"
] | I have the following XML structure:
```
<?xml version="1.0" ?>
<course xml:lang="nl">
<body>
<item id="787900813228567" view="12000" title="0x|Beschrijving" engtitle="0x|Description"><![CDATA[Dit college leert studenten hoe ze een onderzoek kunn$
<item id="5453116633894965" view="12000" title="0x|Onderwijsvo... | When you load the XML file, you'll need to handle the CDATA.. This example works:
```
<?php
$xml = simplexml_load_file('file.xml', NULL, LIBXML_NOCDATA);
$description = $xml->xpath("//item[@title='0x|Beschrijving']");
var_dump($description);
?>
```
Here's the output:
```
array(1) {
[0]=>
object(SimpleXMLElement... |