qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
202,289 | <p>I am building an application where most of the HTML is built using javascript. The DOM structure is built using some JSON data structures that are sent from the server, and then the client-side code builds a UI for that data. </p>
<p>My current approach is to walk the JSON data structures, and call script.aculo.us's Builder.node method to build the DOM structure, and then append it to some element that is actually in the HTML sent from the server. Along the way, I am registering event listeners to the various elements that need them. This allows for a good amount of flexibility, and allows for a very dynamic interface.</p>
<p>However, I feel that it is not very sustainable, since the view logic (ie, the DOM structure) is so tightly coupled to the code that walks the data, and the event handlers, and the data that is kept in memory to maintain the state, and is able to communicate those changes back to the server.</p>
<p>Are there any template-like solutions that will allow me to divorce the DOM structure from the code that drives the app? Currently, my only library dependencies are prototype.js and script.aculo.us, so I would like to avoid introducing any large libraries, but any suggestions are welcome.</p>
<p>Thanks!</p>
<p>EDIT: For some reason, <a href="https://stackoverflow.com/questions/128949/what-good-template-language-is-supported-in-javascript">What good template language is supported in Javascript?</a> didn't show up in the little search results when I was typing this question. It does, however, show up in the "Related" sidebar here.</p>
<p>I will read through some of the suggestions there, and if I find a solution, I will close this question. Otherwise, I will clarify this question with reasons why those solutions won't work for me.</p>
| [
{
"answer_id": 202365,
"author": "Michael",
"author_id": 27966,
"author_profile": "https://Stackoverflow.com/users/27966",
"pm_score": 2,
"selected": false,
"text": "$(document.body).append($('<div id=\"sub-menu-holder\" style=\"position:absolute;top:0;left:0;border:0px none;\"></div>'))... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4257/"
] |
202,299 | <p>What would be the best way to write log statements to a file or database in an iPhone application?</p>
<p>Ideally, NSLog() output could be redirected to a file using freopen(), but I've seen several reports that it doesn't work. Does anyone have this going already or have any ideas how this might best be done?</p>
<p>Thanks!</p>
| [
{
"answer_id": 203561,
"author": "Martin Gordon",
"author_id": 2481,
"author_profile": "https://Stackoverflow.com/users/2481",
"pm_score": 5,
"selected": false,
"text": "NSData *dataToWrite = [[NSString stringWithString:@\"String to write\"] dataUsingEncoding:NSUTF8StringEncoding];\n\nNS... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544/"
] |
202,302 | <p>How can you round <em>any</em> number (not just integers > 0) to N significant digits?</p>
<p>For example, if I want to round to three significant digits, I'm looking for a formula that could take:</p>
<p>1,239,451 and return 1,240,000</p>
<p>12.1257 and return 12.1</p>
<p>.0681 and return .0681</p>
<p>5 and return 5</p>
<p>Naturally the algorithm should not be hard-coded to only handle N of 3, although that would be a start.</p>
| [
{
"answer_id": 202336,
"author": "Claudiu",
"author_id": 15055,
"author_profile": "https://Stackoverflow.com/users/15055",
"pm_score": 4,
"selected": false,
"text": "double roundit(double num, double N)\n{\n double d = log10(num);\n double power;\n if (num > 0)\n {\n d... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7442/"
] |
202,305 | <p>I've created a PHP DOM xml piece and saved it to a string like this:</p>
<pre><code><?php
// create a new XML document
$doc = new DomDocument('1.0');
...
...
...
$xmldata = $doc->saveXML();
?>
</code></pre>
<p>Now I can't use the headers to send a file download prompt and I can't write the file to the server, or rather I don't want the file laying around on it.</p>
<p>Something like a save this file link or a download prompt would be good. How do I do it?</p>
| [
{
"answer_id": 204074,
"author": "Jon Cram",
"author_id": 5343,
"author_profile": "https://Stackoverflow.com/users/5343",
"pm_score": 4,
"selected": true,
"text": "<html>\n<head>\n<title>XML Download Example</title>\n</head>\n\n<body>\n\n<a href=\"download.php\">Download XML example</a>\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27943/"
] |
202,306 | <p>How can I AutoIncrement the assembly (build) number in Visual Studio?</p>
<h3>Duplicate:</h3>
<p><a href="https://stackoverflow.com/questions/650/">/questions/650/automatically-update-version-number</a></p>
| [
{
"answer_id": 202315,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 3,
"selected": false,
"text": "[assembly: AssemblyVersion(\"1.0.*\")]\n"
},
{
"answer_id": 202327,
"author": "hangy",
"author_id": 1196... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,322 | <p>I have a J2EE based web application, in which on clicking a button I need to create a word file from Java. I want to be able to sent the printing command to this file, so that the file is being printed without the user having to open the document and do it manually.</p>
<p>Could anyone please tell me if this is possible and if so how to proceed?</p>
| [
{
"answer_id": 202341,
"author": "Leonel Martins",
"author_id": 26673,
"author_profile": "https://Stackoverflow.com/users/26673",
"pm_score": 1,
"selected": false,
"text": "<script>\nfunction load() {\nwindow.print();\nwindow.close();\n}\n</script>\n"
},
{
"answer_id": 6627350,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23414/"
] |
202,323 | <p>Is there a URL for StackOverflow that I can use on the VS startpage in place of the never updated MS page? The URL that VS uses can be set on the Tools->Options::Startup dialog.</p>
<p>I've tried <a href="https://stackoverflow.com/feeds">https://stackoverflow.com/feeds</a> VS complaints with the following error:</p>
<blockquote>
<p>The current news channel might not be
a valid RSS feed, or your internet
connection might be unavailable. To
change the news channel, on the Tools
menu, click Options, then expand
Environment and click Startup.</p>
</blockquote>
| [
{
"answer_id": 204982,
"author": "Scott Dillman",
"author_id": 10111,
"author_profile": "https://Stackoverflow.com/users/10111",
"pm_score": 2,
"selected": false,
"text": "<link xmlns=\"http://www.w3.org/2005/Atom\" xmlns:thr=\"http://purl.org/syndication/thread/1.0\" rel=\"replies\" typ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18978/"
] |
202,328 | <p>What are some ways that I can query the local machine's specifications (a range of things from CPU specs, OS version, graphics card specs and drivers, etc.) through a programmatic interface? We're writing a simple app in C# to test compatibility of our main app and want to have it dump out some system metrics, but I can't seem to find where to even start, what interfaces to use, libraries, anything.</p>
<p>I've tried all kinds of searches, but can only find programs, and GUI ones at that, which require a user to interact with, or have to install.</p>
<p>Alternatively, a small, command-line program would work just as well, as long as we'd be permitted to distribute it with the test app.</p>
<p>I have found one program that gets some of the specs I'd want, <a href="http://technet.microsoft.com/en-us/sysinternals/bb897550.aspx" rel="nofollow noreferrer">PsInfo</a>. However, it seems to require each user to agree to some license when it is first run, even though it's a command line app. Plus, it only deals with OS/CPU info, and I will need more than that.</p>
<p>Also: forgot to mention explicitly, but this indeed is only going to be necessary for Windows machines. You folks are quick!</p>
<p>Edit: This WMI does look like what I need, thanks! Quite a can of worms though, so I've got to dive in. It mentions that for some things the user has to have administrator privileges; this probably won't be a big problem, but it might limit it a little.</p>
| [
{
"answer_id": 202370,
"author": "Henrik Paul",
"author_id": 2238,
"author_profile": "https://Stackoverflow.com/users/2238",
"pm_score": 0,
"selected": false,
"text": "/proc"
},
{
"answer_id": 205628,
"author": "Doug Kavendek",
"author_id": 9330,
"author_profile": "ht... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9330/"
] |
202,340 | <p>Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.</p>
<p>Often times I should really be rolling my own class instead of just using std::pair. It's pretty easy to see when things start breaking down - when the code becomes littered with make_pair, first, and second, its very hard to remember what is what - an <code>std::pair<int, int></code> conveys less meaning than a type <code>Position</code>.</p>
<p>What have you found are the best ways to wrap the functionality of std::pair in a type that conveys real meaning?</p>
<p>Here are some things I have considered:</p>
<pre><code>typedef std::pair<int, int> Position;
</code></pre>
<p>This at least gives the type a meaningful name when passing it around, but the type isn't enforced, its still really just a pair, and most of the same problems still exist. This is however very simple to write.</p>
<pre><code>struct Position : public std::pair<int, int>
{
typedef std::pair<int, int> Base;
Position() : Base() {}
Position(const Position &x) : Base(x) {}
Position(int a, int b) : Base(a, b) {}
int &row() { return first; }
const int &row() const { return first; }
int &col() { return second; }
const int &col() const { return second; }
};
</code></pre>
<p>This is better, since we can access the variables via a reasonably descriptive name. The problem here is that you can still access first and second, so its easy for the abstraction to leak. Also, accessing simple variables via functions makes the syntax annoying.</p>
<p>The obvious next step is to make the inheritance private:</p>
<pre><code>struct Position : private std::pair<int, int>
{
typedef std::pair<int, int> Base;
Position() {}
Position(const Position &x) : Base(x) {}
Position(int a, int b) : Base(a, b) {}
int &row() { return first; }
const int &row() const { return first; }
int &col() { return second; }
const int &col() const { return second; }
bool operator<(const Position &x) const { return Base(*this) < Base(x); }
// other forwarding operators as needed...
};
</code></pre>
<p>So now at least we have gotten rid of the access to first and second, but now a new problem pops up. When we want to store the type in an std::set, we now don't have access to the operator< overload since we don't have access to first and second. This means we have to define a forwarding function for each operator overload we want. For me this is usually ==, !=, and <, but there could be others that I'd want. Yes I know I probably shouldn't overload operator< just to stick it in an associative container, but it makes everything so darn simple... And defining these operators for each new type is a pain, and we STILL have to access via functions. We can fix that:</p>
<pre><code>struct Position
{
Position() {}
Position(const Position &x) : row(x.row), col(x.col) {}
Position(int row, int col) : row(row), col(col) {}
int row, col;
};
bool operator<(const Position &a, const Position &b)
{
return a.row < b.row || (!(b.row < a.row) && a.col < b.col);
}
// more overloads as needed
</code></pre>
<p>So now we have simple variable access, but now defining overloaded operators is even more of a pain, because instead of just forwarding them to the pair's implementation, we actually have to re-implement them each time...</p>
<p>Are there any solutions I have overlooked that make this easy without the drawbacks? If there aren't which would you tend to prefer?</p>
| [
{
"answer_id": 202363,
"author": "xtofl",
"author_id": 6610,
"author_profile": "https://Stackoverflow.com/users/6610",
"pm_score": 2,
"selected": false,
"text": "pair"
},
{
"answer_id": 202483,
"author": "Greg Rogers",
"author_id": 5963,
"author_profile": "https://Sta... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5963/"
] |
202,368 | <p>I'm writing an ASP.NET application. I have a textbox on a webform, and I want to force whatever the user types to upper case. I'd like to do this on the front end. You should also note that there is a validation control on this textbox, so I want to make sure the solution doesn't interfere with the ASP.NET validation.</p>
<p><strong>Clarification:</strong>
It appears that the CSS text transform makes the user input appear in uppercase. However, under the hood, it's still lower case as the validation control fails. You see, my validation control checks to see if a valid state code is entered, however the regular expression I'm using only works with uppercase characters.</p>
| [
{
"answer_id": 202386,
"author": "billb",
"author_id": 26805,
"author_profile": "https://Stackoverflow.com/users/26805",
"pm_score": 5,
"selected": false,
"text": ".uppercase\n{\n text-transform: uppercase;\n}\n\n<asp:TextBox ID=\"TextBox1\" runat=\"server\" Text=\"\" CssClass=\"upper... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21155/"
] |
202,378 | <p>I am trying to make this feature available, maybe in an apache .htaccess file.</p>
| [
{
"answer_id": 448435,
"author": "OIS",
"author_id": 36175,
"author_profile": "https://Stackoverflow.com/users/36175",
"pm_score": 1,
"selected": false,
"text": "AddHandler php4 .php\nAction php4 /cgi-bin/php4\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,379 | <p>I have a source base that, depending on defined flags at build time, creates two different apps. I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that builds both.</p>
<p>How do I do the equivalent thing from Visual C# Express on Windows?</p>
| [
{
"answer_id": 202774,
"author": "Robert Paulson",
"author_id": 14033,
"author_profile": "https://Stackoverflow.com/users/14033",
"pm_score": 0,
"selected": false,
"text": "Build->Batch Build"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6010/"
] |
202,405 | <p>At work, I use Cygwin a lot because it offers me a small oasis in the vast desert of Windows. I inevitably end up running some non-Cygwin programs through the bash shell, such as build scripts (batch files created in-house) and the Subversion CLI binaries (I have the Windows ones installed). 99% of the time, I don't have any problems using this setup. The other 1%, however, causes a strange issue:</p>
<p>With both the build scripts and SVN, most of the time the enter key is interpreted correctly. For instance, I'll kick off the database creation script and it will prompt me for the server name. I type in "localhost" and hit enter. Everything's fine. Then it gets to the end, if there are errors, and prints things out using <code>more</code>. No key that I press is recognized by <code>more</code>. I have to Ctrl-C out of it.</p>
<p>Similarly, if I do a Subversion update, normally everything is fine. In the case where the interactive conflict resolution happens, however, I'll usually type in "tf" for "theirs-full" and hit enter, but nothing happens. I have to Ctrl-C out of it and re-run the update with force merge or use TortoiseSVN in Windows to do it.</p>
<p>Any idea why Cygwin seems to randomly not be passing the enter key through to the programs? I considered that it may have something to do with Unix vs Windows style line endings, so I've tried typing those characters manually, but that doesn't seem to make a difference. Thanks.</p>
<p><strong>Edit</strong>: I just had this happen to me again and I realized something. It was SVN prompting me for a password. I typed in the password, which it echoed to the screen (bad) and hit enter... nothing. Hit enter a few more times, the cursor moves, but nothing happens. I hit Ctrl-C and it dumps me back to bash, which then says "bash: [my password]: command not found" followed by a number of new prompts equal to the number of times I hit the enter key. So what happened is the input never made it to SVN, but somehow got read by bash after SVN exited. I thought that may help someone figure out what is going on.</p>
| [
{
"answer_id": 11046177,
"author": "Vic",
"author_id": 97439,
"author_profile": "https://Stackoverflow.com/users/97439",
"pm_score": 2,
"selected": false,
"text": "$ conin svn list https://{repo}\nPassword for 'user': ******\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861/"
] |
202,406 | <p>In my user model, I have an attribute called "nickname" and validates as such:</p>
<blockquote>
<p>validates_format_of :nickname, :with => /[a-zA-Z0-9]$/, :allow_nil => true</p>
</blockquote>
<p>However, it is currently letting this string pass as valid:</p>
<p>a?c</p>
<p>I only want to accept alphanumeric strings - does anyone know why my regular expression is failing? If anybody could suggest a better regular expression, I'm all ears.</p>
| [
{
"answer_id": 202411,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 4,
"selected": true,
"text": "/^[a-zA-Z0-9]+$/\n"
},
{
"answer_id": 202412,
"author": "Joel Coehoorn",
"author_id": 3043,
"auth... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19527/"
] |
202,430 | <p>Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.</p>
<p>The <a href="http://www.mono-project.com/Roadmap" rel="nofollow noreferrer">Mono Project Roadmap</a> indicates ASP.NET 3.5 for Mono 2.4 (next year). Any ideas on how to get this useful before then?</p>
<p>More details: The basic MVC Preview 5 template seems to work, so long as I avoid the root directory. If I request the root, I get:</p>
<pre><code>Server Error in '/' Application
The virtual path '' maps to another application.
Description: HTTP 500. Error processing request.
Stack Trace:
System.Web.HttpException: The virtual path '' maps to another application.
at System.Web.HttpContext.RewritePath (System.String filePath, System.String pathInfo, System.String queryString, Boolean setClientFilePath) [0x00000]
at System.Web.HttpContext.RewritePath (System.String path, Boolean rebaseClientPath) [0x00000]
at System.Web.HttpContext.RewritePath (System.String path) [0x00000]
at MvcApplication1._Default.Page_Load (System.Object sender, System.EventArgs e) [0x00000]
at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000]
at System.Web.UI.Control.LoadRecursive () [0x00000]
at System.Web.UI.Page.ProcessLoad () [0x00000]
at System.Web.UI.Page.ProcessPostData () [0x00000]
at System.Web.UI.Page.InternalProcessRequest () [0x00000]
at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000]
Version information: Mono Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.42
</code></pre>
| [
{
"answer_id": 202568,
"author": "MichaelGG",
"author_id": 27012,
"author_profile": "https://Stackoverflow.com/users/27012",
"pm_score": 5,
"selected": true,
"text": "HttpContext.Current.RewritePath(\"/Home/Index\");\n"
},
{
"answer_id": 202570,
"author": "Paco",
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27012/"
] |
202,432 | <p>I am trying to capture output from an install script (that uses scp) and log it. However, I am not getting everything that scp is printing out, namely, the progress bar. </p>
<p>screen output:</p>
<blockquote>
<p>Copying
/user2/cdb/builds/tmp/uat/myfiles/* to
server /users/myfiles as cdb</p>
<p>cdb@server's password:
myfile 100% |*****************************| 2503 00:00</p>
</blockquote>
<p>log output:</p>
<blockquote>
<p>Copying
/user2/cdb/builds/tmp/uat/myfiles/* to
server /users/myfiles as cdb</p>
</blockquote>
<p>I'd really like to know that my file got there. Here's what I am trying now to no avail:</p>
<blockquote>
<p>myscript.sh 2>&1 | tee mylogfile.log</p>
</blockquote>
<p>Does anyone have a good way to capture scp output and log it? </p>
<p>Thanks.</p>
| [
{
"answer_id": 202479,
"author": "Tarski",
"author_id": 27653,
"author_profile": "https://Stackoverflow.com/users/27653",
"pm_score": 4,
"selected": true,
"text": "scp myfile user@host.com:. && echo success!\n"
},
{
"answer_id": 12925408,
"author": "Martin",
"author_id": ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807/"
] |
202,434 | <p>How can I detect the current text formatting at the cursor position in a WPF RichTextBox?</p>
| [
{
"answer_id": 202737,
"author": "Artur Carvalho",
"author_id": 1013,
"author_profile": "https://Stackoverflow.com/users/1013",
"pm_score": 2,
"selected": true,
"text": "TextRange tr = new TextRange(rtb.Selection.Start, rtb.Selection.End);\nobject oFont = tr.GetPropertyValue(Run.FontFami... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807/"
] |
202,440 | <p>I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to narrow a result set by certain factors and column values. </p>
<p>Being that I'm on deadline (you know 3 hours sleep a night, at the point where I am looking like something the cat ate and threw up), I was expecting this page to be very similar to be others and I'm trying to decide whether or not to make a stink. I have never done a full text search on a page before.... is this a mountain to climb or is there a simple solution?</p>
<p>thank you. </p>
| [
{
"answer_id": 202474,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 6,
"selected": true,
"text": "SELECT UserName\nFROM Tbl_Users\nWHERE FREETEXT (UserName, 'bob' )\n\nResults:\n\nJimBob\nLittle Bobby Tables\n"
},
{
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] |
202,442 | <p>What tricks can be used to stop javascript callouts to various online services from slowing down page loading?</p>
<p>The obvious solution is to do all the javascript calls at the bottom of the page, but some calls need to happen at the top and in the middle. Another idea that comes to mind is using iframes. </p>
<p>Have you ever had to untangle a site full of externally loading javascript that is so slow that it does not release apache and causes outages on high load? Any tips and tricks?</p>
| [
{
"answer_id": 202536,
"author": "Christopher Parker",
"author_id": 27583,
"author_profile": "https://Stackoverflow.com/users/27583",
"pm_score": 1,
"selected": false,
"text": "<html>\n <head>\n <title>Test Page</title>\n <script type=\"text/javascript\">\n wi... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/556/"
] |
202,459 | <p>I stumbled across this code and am too proud to go and ask the author what it means.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What is <code>gcnew</code> and how important is it to use that instead of simply <code>new</code>? (I'm also stumped by the caret; I asked about that <a href="https://stackoverflow.com/questions/202463/what-does-the-caret-mean-in-cnet">over here</a>.)</p>
| [
{
"answer_id": 202469,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 6,
"selected": false,
"text": "gcnew"
},
{
"answer_id": 36863084,
"author": "user2796283",
"author_id": 2796283,
"author_profile"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4790/"
] |
202,463 | <p>I just came across this code and a few Google searches turn up no explanation of this mysterious (to me) syntax.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What the heck does the caret mean? (The <code>gcnew</code> is also new to me, and I asked about that <a href="https://stackoverflow.com/questions/202459/what-is-gcnew">here</a>.)</p>
| [
{
"answer_id": 202487,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": false,
"text": "^"
},
{
"answer_id": 14378351,
"author": "salomon",
"author_id": 958953,
"author_profile": "https:... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4790/"
] |
202,470 | <p>In a script, when a command-let or other executable statement errors out, is there a try/catch type of mechanism to recover from these errors? I haven't run across one in the documentation.</p>
| [
{
"answer_id": 202498,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 3,
"selected": false,
"text": "Trap [exception-type] {}"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5619/"
] |
202,471 | <p>I'm trying to subclass NSCell for use in a NSTableView. The cell I want to create is fairly complicated so it would be very useful if I could design it in Interface Builder and then load the NSCell from a nib.</p>
<p>Is this possible? How do I do it?</p>
| [
{
"answer_id": 203292,
"author": "schwa",
"author_id": 23113,
"author_profile": "https://Stackoverflow.com/users/23113",
"pm_score": 0,
"selected": false,
"text": "/* example of a silly way to load a UITableViewCell from a standalone nib */\n\n+ (CEntryTableViewCell *)cell\n{\n// TODO --... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,481 | <p>How can I use HttpWebRequest (.NET, C#) asynchronously?</p>
| [
{
"answer_id": 202896,
"author": "Jon B",
"author_id": 27414,
"author_profile": "https://Stackoverflow.com/users/27414",
"pm_score": 8,
"selected": true,
"text": "HttpWebRequest.BeginGetResponse()"
},
{
"answer_id": 4434127,
"author": "xlarsx",
"author_id": 541167,
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16794/"
] |
202,491 | <p>Is there a way to automatically increment the "minimum required version" fields in a ClickOnce deployment to always equal the current build number? Basically, I always want my deployment to be automatically updated at launch.</p>
<p>I suspect I'm going to need a some pre-/post-build events, but I hope there's an easier way.</p>
| [
{
"answer_id": 224522,
"author": "Scott Weinstein",
"author_id": 25201,
"author_profile": "https://Stackoverflow.com/users/25201",
"pm_score": 3,
"selected": false,
"text": "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n <PropertyGroup>\n <Util-VersionMajor... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6897/"
] |
202,502 | <p>We have recently migrated a large, high demand web application to Tomcat 5.5 from Tomcat 4 and have noticed some peculiar slowdown behavior that appears to be related to JVM pauses. In order to run our application and support increased load over time on Tomcat 4, many not so standard JVM parameters were set and tuned as per the below, and I am hoping someone with Tomcat JVM tuning experience can comment on anything that would likely be detrimental to a Tomcat 5.5 install. Note also that some of these could be carry over from previous versions of Java (we were running Tomcat 4 on Java 1.6 with these parameters successfully for some time, but some may have been introduced to help garbage collection on Java 1.4 which was the basis of our Tomcat 4 install for a long time, and may now doing more harm than good).</p>
<p>Some notes:</p>
<ul>
<li>Application memory footprint is
around 1GB, probably slightly over.</li>
<li>CPU is not an issue - all machines
serving the app (load balanced) are
< 30% CPU</li>
<li>Lots of headroom on physical memory on the machines.</li>
<li>-XX:MaxPermSize=512m was the only parameter added as part of the 5.5 upgrade and was reactive to an outofmemory permgen space issue (which it solved).</li>
<li>Running on Java 1.6, Solaris OS</li>
</ul>
<p>-server -Xms1280m -Xmx1280m -XX:MaxPermSize=512m -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=75 -XX:MaxTenuringThreshold=0 -XX:+AggressiveOpts -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-TraceClassUnloading -Dsun.io.useCanonCaches=false -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000 </p>
| [
{
"answer_id": 204756,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 1,
"selected": false,
"text": "conf/server.xml"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17123/"
] |
202,508 | <p>Rather than population said DOM object with an external page such as HTML CFM or PHP, what if I simply want to send text?</p>
<p>I've tried:</p>
<p>$("#myDOMObject").val("some text");</p>
<p>No errors, but the object value doesn't update either.</p>
| [
{
"answer_id": 202524,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 3,
"selected": true,
"text": "$(\"#myDOMObject\").text(\"some text\");"
},
{
"answer_id": 202543,
"author": "Tamas Czinege",
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26121/"
] |
202,540 | <p>We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter.</p>
<p>This call works fine for other customers calling from C# or Java but this customer is getting an error back from the call. I haven't debugged their specific call but I am guessing that the 64bit integer is getting truncated somehow from PHP. The customer says they are just making the web service call with a string but is there a wrapper in PHP that does type conversion. Could this be losing the number information?</p>
<p>Thanks for any info.</p>
| [
{
"answer_id": 202601,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 2,
"selected": true,
"text": "<?php\n\necho PHP_INT_SIZE, \"\\n\", PHP_INT_MAX;\n\n?>\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27989/"
] |
202,547 | <p>I am writing a command-line tool for Windows that uses libcurl to download files from the internet.</p>
<p>Obviously, the downloading doesn't work when the user is behind a proxy server, because the proxy needs to be configured. I want to keep my tool as simple as possible however, and not have to burden the user with having to configure the proxy. My tool doesn't even have a config file, so the user would otherwise have to pass in the proxy settings on every command, or set an environment variable or somesuch -- way too much hassle.</p>
<p>So I thought, everyone's browser will usually already be set up properly, proxy configured and everything. This will be true for even the most basic user because otherwise "their internet wouldn't work".</p>
<p>So I figure that I can find out whether to use a proxy by looking at IE's proxy settings.</p>
<p>How do I go about this? More specifically:</p>
<ul>
<li>Is there one set of "proxy settings" in Windows, used by all browsers (probably IE's), or would I have to write different routines for IE, Firefox, Opera, etc?</li>
<li>I know that I can probably read the values directly out of the appropriate registry locations if they are configured manually, but does this also work with "automatically detect proxy server?" Do I even have to bother with that option, or is it (almost) never used?</li>
</ul>
<p>Before people start suggesting alternatives: I'm using C, so I'm limited to the Win32 API, and I really really want to keep using C and libcurl.</p>
| [
{
"answer_id": 202608,
"author": "justin.m.chase",
"author_id": 12958,
"author_profile": "https://Stackoverflow.com/users/12958",
"pm_score": 1,
"selected": false,
"text": "using System.Net;\n\nstring url = \"http://www.example.com\";\nWebClient client = new WebClient();\nbyte[] fileBuff... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2474/"
] |
202,552 | <p>How do you get a pointer to the .text section of memory for a program from within that program? I also need the length of the section to do a "Flash to Memory" compare as part of a continuous selftest that runs in the background.</p>
<p>The toolset automatically generates the linker .cmd file for the tools I'm using, and the Board Support Package for the board I'm using requires I use the generated .cmd file instead of making my own. (No make file either to add a script to muck with it afterwords.)</p>
<p>Edit:
I'm working with a TI TMS 6713 DSP using the code composer 3.1 environment. The card I'm using was contracted by our customer and produced by another organization so I can't really point you to any info on it. However the BSP is dependant upon TI's "DSP BIOS" config tool, and I can't really fudge the settings too much without digging into an out of scope effort.</p>
| [
{
"answer_id": 202572,
"author": "Robert Deml",
"author_id": 9516,
"author_profile": "https://Stackoverflow.com/users/9516",
"pm_score": 2,
"selected": false,
"text": " __FlashStart = .;\n"
},
{
"answer_id": 203670,
"author": "DGentry",
"author_id": 4761,
"author_pro... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/134597/"
] |
202,557 | <p>Assuming a fluid layout is not an option (since that is a different discussion all together), what is the recommended width for a site layout? What are the pros and cons of different sizes?</p>
| [
{
"answer_id": 202571,
"author": "Tom",
"author_id": 20,
"author_profile": "https://Stackoverflow.com/users/20",
"pm_score": 1,
"selected": false,
"text": "800px"
},
{
"answer_id": 202575,
"author": "Eric Wendelin",
"author_id": 25066,
"author_profile": "https://Stack... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6007/"
] |
202,560 | <p>So I understand what a static method or field is, I am just wondering when to use them. That is, when writing code what design lends itself to using static methods and fields. </p>
<p>One common pattern is to use static methods as a static factory, but this could just as easily be done by overloading a constructor. Correct? For example:</p>
<pre><code>var bmp = System.Drawing.Bitmap.LoadFromFile("Image01.jpg");
</code></pre>
<p>As for static fields, is creating singelton-objects their best use? </p>
| [
{
"answer_id": 202585,
"author": "shoosh",
"author_id": 9611,
"author_profile": "https://Stackoverflow.com/users/9611",
"pm_score": 5,
"selected": false,
"text": "this"
},
{
"answer_id": 202587,
"author": "JacquesB",
"author_id": 7488,
"author_profile": "https://Stack... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322/"
] |
202,586 | <p>I've used <a href="http://members.fortunecity.com/neshkov/dj.html" rel="noreferrer">DJ Java Decompiler</a>, which has a handy GUI, but it seems as if the latest version is only a trial and forces you to purchase the software after some period of days (I recall using an earlier free version about a year ago at a previous job).</p>
<p>I'm aware of Jad and Jadclipse, but what I loved about DJ Java Decompiler was that it integrated with Windows Explorer - so I could simply open up a JAR in something like WinRAR, navigate thru the packages, and double-click on a .class file to view it's decompiled source.</p>
<p>Can anyone suggest other good, free, .class viewers? The criteria I have in mind for these would be: </p>
<ul>
<li>GUI-based</li>
<li>Integrates to Windows Explorer (so I don't have to run some command-line options like with JAD)</li>
<li>optional - can also show raw JVM bytecode commands </li>
</ul>
<p>In other words - I'd like to find the closest thing to <a href="http://www.red-gate.com/products/reflector/index.htm" rel="noreferrer">.NET Reflector</a> for Java as possible.</p>
| [
{
"answer_id": 17206060,
"author": "Happy",
"author_id": 2412606,
"author_profile": "https://Stackoverflow.com/users/2412606",
"pm_score": 0,
"selected": false,
"text": ".class"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] |
202,605 | <p>What is the best or most concise method for returning a string repeated an arbitrary amount of times?</p>
<p>The following is my best shot so far:</p>
<pre><code>function repeat(s, n){
var a = [];
while(a.length < n){
a.push(s);
}
return a.join('');
}
</code></pre>
| [
{
"answer_id": 202626,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "function repeat(s, n) { var r=\"\"; for (var a=0;a<n;a++) r+=s; return r;}\n"
},
{
"answer_id": 202627,
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208/"
] |
202,609 | <p>This is what I currently have:</p>
<pre><code>CREATE OR REPLACE TRIGGER MYTRIGGER
AFTER INSERT ON SOMETABLE
FOR EACH ROW
DECLARE
v_emplid varchar2(10);
BEGIN
SELECT
personnum into v_emplid
FROM PERSON
WHERE PERSONID = :new.EMPLOYEEID;
dbms_output.put(v_emplid);
/* INSERT INTO SOMEOTHERTABLE USING v_emplid and some of the other values from the trigger table*/
END MYTRIGGER;
</code></pre>
<p>DBA_ERRORS has this error:
PL/SQL: ORA-00923: FROM keyword not found where expected</p>
| [
{
"answer_id": 202634,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 4,
"selected": true,
"text": "SQL> create table someTable( employeeid number );\n\nTable created.\n\nSQL> create table person( personid number, perso... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20836/"
] |
202,610 | <p>I have two scripts that often need to be run with the same parameter:</p>
<pre><code>$ populate.ksh 9241 && check.ksh 9241
</code></pre>
<p>When I need to change the parameter (<strong>9241</strong> in this example), I can go back and edit the line in history. But since I need to change the number in two places, I sometimes make a typo. I'd like to be able to change the parameter just once to change it in both places.</p>
| [
{
"answer_id": 202611,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 1,
"selected": false,
"text": "r=$1\npopulate.ksh $r && check.ksh $r\n"
},
{
"answer_id": 202637,
"author": "zigdon",
"author_id": 4913... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] |
202,630 | <p>How do I determine if an object reference is null in C# w/o throwing an exception if it is null?</p>
<p>i.e. If I have a class reference being passed in and I don't know if it is null or not.</p>
| [
{
"answer_id": 202642,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 0,
"selected": false,
"text": "(YourObject != Null)\n"
},
{
"answer_id": 202646,
"author": "Robert Paulson",
"author_id": 1403... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/177/"
] |
202,631 | <p>I'm working on a project in C#. The previous programmer didn't know object oriented programming, so most of the code is in huge files (we're talking around 4-5000 lines) spread over tens and sometimes hundreds of methods, but only one class. Refactoring such a project is a huge undertaking, and so I've semi-learned to live with it for now.</p>
<p>Whenever a method is used in one of the code files, the class is instantiated and then the method is called on the object instance.</p>
<p>I'm wondering whether there are any noticeable performance penalties in doing it this way? Should I make all the methods static "for now" and, most importantly, will the application benefit from it in any way?</p>
| [
{
"answer_id": 392472,
"author": "Alex",
"author_id": 42707,
"author_profile": "https://Stackoverflow.com/users/42707",
"pm_score": 3,
"selected": false,
"text": "ShoppingController.ListPaymentMethods()\n"
},
{
"answer_id": 26827569,
"author": "Black Dog",
"author_id": 42... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/614/"
] |
202,644 | <p>e.g, Is the user playing a movie full screen, or looking at powerpoint in full screen mode?</p>
<p>I could have sworn I saw a IsFullScreenInteractive API before, but can't find it now</p>
| [
{
"answer_id": 495389,
"author": "Pop Catalin",
"author_id": 4685,
"author_profile": "https://Stackoverflow.com/users/4685",
"pm_score": 3,
"selected": false,
"text": "using System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics;\nusing System.Runtime.In... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,662 | <p>I have a VB6 dll that is trying to create a COM object using the following line of code:</p>
<pre><code>Set CreateObj = CreateObject("OPSValuer.OPSValue")
</code></pre>
<p>However this fails with the error "Object variable or With block variable not set".</p>
<p>I can see OPSValuer.OPSValue in dcomcnfg and it appears to be registered fine. Does anyone have any ideas about what may be causing the problem?</p>
| [
{
"answer_id": 213491,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 0,
"selected": false,
"text": "OPSValuer.OPSValue"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012/"
] |
202,663 | <p>I am testing an application that checks if a file exists across a network. In my testing, I am purposefully pulling the network plug so the file will not be found. The problem is this causes my app to go unresponsive for at least 15 seconds. I have used both the FileExists() and GetAttr() functions in VB6. Does anyone know how to fix this problem? (No, I can't stop using VB6)</p>
<p>Thanks,
Charlie</p>
| [
{
"answer_id": 202852,
"author": "Bullines",
"author_id": 27870,
"author_profile": "https://Stackoverflow.com/users/27870",
"pm_score": -1,
"selected": false,
"text": "Dim objFSO As New FileSystemObject \nIf objFSO.FileExists(\"C:\\path\\to\\your_file.txt\") Then\n ' Do some stuff wit... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27689/"
] |
202,685 | <p>I truly love VIM - it's one of only a handful of applications I've every come across that make you feel warm and fuzzy inside. However, for PHP development, I still use PDT Eclipse although I would love to switch. </p>
<p>The reason I can't quite at the moment is the CTRL+SPACE code-assist functionality that I rely on so much - it's so useful, especially when type hinting, or using PHPDoc variable comment blocks. </p>
<p>I know there are cool plugins for VIM out there that can probably replicate this functionality and then some - but what are they? </p>
| [
{
"answer_id": 202726,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": true,
"text": "filetype plugin on\nau FileType php set omnifunc=phpcomplete#CompletePHP\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25517/"
] |
202,699 | <p>What is the best way to create a clone of a DTO? There is not an ICloneable interface or a BinaryFormatter class in Silverlight. Is reflection the only way?</p>
| [
{
"answer_id": 2195954,
"author": "Mike Schall",
"author_id": 4231,
"author_profile": "https://Stackoverflow.com/users/4231",
"pm_score": 4,
"selected": true,
"text": "Public Shared Function Clone(Of T)(ByVal source As T) As T\n Dim serializer As New DataContractSerializer(GetType(T))... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4231/"
] |
202,702 | <p>I'm not sure why the TSpeedButton has this property but when a TSpeedButton is the only button of a given groupindex, it doesn't stay pressed, whether or not "AllowAllUp" is pressed. Maybe a Jedi control would suffice, but hopefully there's some fix. Any help or anecdotes are appreciated.</p>
<p>BTW, I'm (still) using Delphi 7, not sure if this is an across the board conundrum.</p>
| [
{
"answer_id": 202722,
"author": "onnodb",
"author_id": 1037,
"author_profile": "https://Stackoverflow.com/users/1037",
"pm_score": 1,
"selected": false,
"text": "Down"
},
{
"answer_id": 202980,
"author": "X-Ray",
"author_id": 14031,
"author_profile": "https://Stackov... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1765/"
] |
202,718 | <p>Is there a good method for writing C / C++ function headers with default parameters that are function calls? </p>
<p>I have some header with the function:</p>
<pre><code>int foo(int x, int y = 0);
</code></pre>
<p>I am working in a large code base where many functions call this function and depend on this default value. This default value now needs to change to something dynamic and I am looking for a way to do:</p>
<pre><code>int foo(int x, int y = bar());
</code></pre>
<p>Where bar() is some function that generates the default value based on some system parameters. Alternatively this function prototype would look like:</p>
<pre><code>int foo(int x, int y = baz.bar());
</code></pre>
<p>Where baz is a function belonging to an object that has not been instantiated within the header file.</p>
| [
{
"answer_id": 202758,
"author": "Tim Sharrock",
"author_id": 12840,
"author_profile": "https://Stackoverflow.com/users/12840",
"pm_score": 3,
"selected": false,
"text": "int foo(int x, int y);"
},
{
"answer_id": 202759,
"author": "user21714",
"author_id": 21714,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3022/"
] |
202,723 | <p>This is something I've always wondered, and I can't find any mention of it anywhere online. When a shop from, say Japan, writes code, would I be able to read it in English? Or do languages, like C, PHP, anything, have Japanese translations that they write?</p>
<p>I guess what I'm asking is does every single coder in the world know enough English to use the exact same reserved words I do?</p>
<p>Would this code:</p>
<pre><code>If (i < size){
switch
case 1:
print "hi there"
default:
print "no, thank you"
} else {
print "yes, thank you"
}
</code></pre>
<p>display the exact same as I'm seeing it right now in English, or would some other non-English-speaking person see the words "if", "switch", "case", "default", "print", and "else" in their native language?</p>
<p>EDIT - yes, this is serious. I didn't know if different localizations of a language have different keywords. or if there are even different localizations at all.</p>
| [
{
"answer_id": 202841,
"author": "Dónal",
"author_id": 2648,
"author_profile": "https://Stackoverflow.com/users/2648",
"pm_score": 5,
"selected": false,
"text": "interface Foo {\n\n Color getCouleur();\n\n void setCouleur(Color couleur);\n}\n"
},
{
"answer_id": 202851,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50/"
] |
202,740 | <p>Can I set timeouts for JSP pages in tomcat either on a per page or server level?</p>
| [
{
"answer_id": 202795,
"author": "anjanb",
"author_id": 11142,
"author_profile": "https://Stackoverflow.com/users/11142",
"pm_score": 3,
"selected": true,
"text": "catalina.bat"
},
{
"answer_id": 230399,
"author": "Mojo",
"author_id": 30462,
"author_profile": "https:/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14481/"
] |
202,750 | <p>I mean, is there a coded language with human style coding?
For example:</p>
<pre><code>Create an object called MyVar and initialize it to 10;
Take MyVar and call MyMethod() with parameters. . .
</code></pre>
<p>I know it's not so useful, but it can be interesting to create such a grammar.</p>
| [
{
"answer_id": 202763,
"author": "Robert P",
"author_id": 18097,
"author_profile": "https://Stackoverflow.com/users/18097",
"pm_score": 3,
"selected": false,
"text": "print \"hello!\" and open my $File, '<', $path or die \"Couldn't open the file after saying hello!\";\n"
},
{
"an... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68336/"
] |
202,777 | <p>I'm creating a invoice crystal report for sage mas 500 AR module. In it, I'm attempting to add the <code>tarinvoice.balance</code> field with the following formula: </p>
<pre><code>if {tarPrintInvcHdrWrk.Posted} = 1 then
ToText({tarInvoice.Balance})
</code></pre>
<p>I'm assuming that when the <code>{tarPrintInvcHdrWrk.Posted} = 1</code> conditional statement holds FALSE, it doesn't attempt to pull the invoice field because when I remove the formula from the report, the form displays correctly without it. </p>
<p>When the conditional statement renders true in the report, the balance fields behaves correctly. However, with the formula renders FALSE in the CR form, the entire crystal report bombs and displays blank. Any ideas why or what I'm doing wrong?</p>
<hr>
<p>Just tried setting everything to zero and the report still bombs. I'm starting to think its more of a query error in the report. I wish there was a way to exclude the field in the query when posted = 0. </p>
<p>With <code>tarinvoice.balance</code> removed when the posted = 0, the report works fine.<br>
With <code>tarinvoice.balance</code> included and posted = 1, report works fine. </p>
<p>With <code>tarinvoice.balance</code> included and posted =0, report bombs.</p>
| [
{
"answer_id": 205047,
"author": "user28014",
"author_id": 28014,
"author_profile": "https://Stackoverflow.com/users/28014",
"pm_score": 0,
"selected": false,
"text": "if isnull({tarPrintInvcHdrWrk.Posted}) = FALSE then \n if {tarPrintInvcHdrWrk.Posted} = 1 then \n if isnull({t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28014/"
] |
202,786 | <p>I need to merge a forked project.
Unfortunately, the CVS $Id lines are different so the merge tools I tried report that all the files are different (and 95% of them have only this line different)</p>
<p>Is there a merge tool that can be configured to ignore line comparison results based on a pattern ?</p>
<p>[edit]
I discovered that WinMerge has line filters - setting up them correctly actually works.</p>
<p>Francesco</p>
| [
{
"answer_id": 202868,
"author": "pixelbeat",
"author_id": 4421,
"author_profile": "https://Stackoverflow.com/users/4421",
"pm_score": 2,
"selected": false,
"text": "\\$\\w+(:[^\\n$]+)?\\$\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,790 | <p>I have an <strong>"ldquo"</strong>, <strong>"rdquo"</strong> and several other entities under my RSS feed. Seems like if I add</p>
<pre><code><!DOCTYPE rss [
<!ENTITY % HTMLspec PUBLIC
"-//W3C//ENTITIES Latin 1 for XHTML//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
%HTMLspec;
</code></pre>
<p>below the <strong>xml</strong> tag and above the <strong>rss</strong> tag then I'll be able to include those entities. I added but it doesn't seem to work. Does anyone knows what I missing? Thanks</p>
| [
{
"answer_id": 203765,
"author": "cowgod",
"author_id": 6406,
"author_profile": "https://Stackoverflow.com/users/6406",
"pm_score": 2,
"selected": false,
"text": "“"
},
{
"answer_id": 13870473,
"author": "giacoder",
"author_id": 582864,
"author_profile": "https:... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
202,792 | <p>I'm using a whole bunch of CALayers, creating a tile-based image not unlike GoogleMaps (different versions of the same image with more/less detail).</p>
<p>The code I'm using to do this is:</p>
<pre><code>UIImage* image = [self loadImage:obj.fileName zoomLevel:obj.zoomLevel];
[CATransaction setValue:(id)kCFBooleanTrue
forKey:kCATransactionDisableActions];
obj.layerToAddTo.contents = [image CGImage];
[CATransaction commit];
</code></pre>
<p>I don't really feel like loading the CGImage from file using CoreGraphics because I'm lazy. But I will if there's a big performance boost! LoadImage just mangles a string to get the right path for loading said image, and obj is a NSObject-struct that holds all the info I need for this thread. </p>
<p>Help?</p>
| [
{
"answer_id": 3815801,
"author": "Phil M",
"author_id": 450263,
"author_profile": "https://Stackoverflow.com/users/450263",
"pm_score": -1,
"selected": false,
"text": "UIImage -imageNamed:"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28019/"
] |
202,803 | <p>I use emacs for viewing and editing code and other text files. I wanted to know if there is a way to search forward or backward for text which is marked in the current buffer. Similar to what I can do in notepad or wordpad. As in can I mark some text in the buffer and do a C-s or C-r and be able to search with the marked text without actually typing in the whole search text? </p>
<p>Thank you,</p>
<p>Rohit</p>
| [
{
"answer_id": 202829,
"author": "Alex Coventry",
"author_id": 1941213,
"author_profile": "https://Stackoverflow.com/users/1941213",
"pm_score": 6,
"selected": true,
"text": "M-W"
},
{
"answer_id": 203026,
"author": "Chris Conway",
"author_id": 1412,
"author_profile":... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27928/"
] |
202,813 | <p>Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example:</p>
<pre><code>int[] terms;
for(int runs = 0; runs < 400; runs++)
{
terms[] = runs;
}
</code></pre>
<p>For those who have used PHP, here's what I'm trying to do in C#:</p>
<pre><code>$arr = array();
for ($i = 0; $i < 10; $i++) {
$arr[] = $i;
}
</code></pre>
| [
{
"answer_id": 202830,
"author": "Motti",
"author_id": 3848,
"author_profile": "https://Stackoverflow.com/users/3848",
"pm_score": 3,
"selected": false,
"text": "int [] terms = new int[400]; // allocate an array of 400 ints\nfor(int runs = 0; runs < terms.Length; runs++) // Use Length pr... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] |
202,824 | <p>I am trying to start a service from the command line using "net start SERVICENAME" and I get an access denied error.</p>
<p>I am an administrator on this server since I am in a domain group that are admins on the server. I <strong>can</strong> start/stop the service from the Services tool.</p>
<p>I am new to 2008/Vista so maybe I am just missing something..</p>
<p>update:
I did not use "run as administrator". Is this something new in 2008? Where do I find this option?</p>
| [
{
"answer_id": 203596,
"author": "oz10",
"author_id": 14069,
"author_profile": "https://Stackoverflow.com/users/14069",
"pm_score": 1,
"selected": false,
"text": "runas /user:DOMAIN\\Administrator cmd\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12262/"
] |
202,860 | <p>I know this sounds like a really obvious question, but it's proving harder to figure out than I thought. I'm developing in Flash 8/ActionScript 2.0.</p>
<p>I have a label component, and I'm dynamically assigning it text from an xml document. For example:</p>
<pre><code>label.text = "<b>" + xml_node.firstChild + "</b>";
</code></pre>
<p>This successfully changes the label's text to whatever is in that XML node, and since I enabled HTML, it makes it bold. However, I want to increase the size of the label's font, and using <code><font></code> tags won't work.</p>
<p>Am I missing something? How do I make the font larger? ActionScript is just so picky!</p>
| [
{
"answer_id": 209472,
"author": "MattSayar",
"author_id": 557,
"author_profile": "https://Stackoverflow.com/users/557",
"pm_score": 2,
"selected": true,
"text": "label.text = \"<b><font size=24>\" + xml_node.firstChild + \"</font></b>\";\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557/"
] |
202,871 | <p>I use MyGeneration along with nHibernate to create the basic POCO objects and XML mapping files. I have heard some people say they think code generators are not a good idea. What is the current best thinking? Is it just that code generation is bad when it generates thousands of lines of not understandable code?</p>
| [
{
"answer_id": 203070,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 6,
"selected": true,
"text": "-- =============================================================\n-- === Foobar Module ==================... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27294/"
] |
202,907 | <p>i'm having a problem to create a text_field without a method association. Maybe i even don't need it :-)</p>
<p>I have two radio_buttons associated to the same method:</p>
<pre><code><%= radio_button :comment, :author, "anonymous" %> Anonymous <br>
<%= radio_button :comment, :author, "real_name" %> Name <br>
</code></pre>
<p>What i would like to do is to have an text_field which when the user click on the radio_button "real_name" i can verify the value in this new text_field. </p>
<p>Basically my Controller would be something like:</p>
<p>@comment = Comment.new(params[:comment])</p>
<p>if @comment.author == "real_name"
@comment.author = "value-from-the-new-textfield
end</p>
<p>There is any way to do it?</p>
<p>Regards,</p>
<p>Victor</p>
| [
{
"answer_id": 202970,
"author": "Avdi",
"author_id": 20487,
"author_profile": "https://Stackoverflow.com/users/20487",
"pm_score": 4,
"selected": true,
"text": "text_field_tag"
},
{
"answer_id": 204141,
"author": "JasonOng",
"author_id": 6048,
"author_profile": "http... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18642/"
] |
202,912 | <p>I have some hierarchical data - each entry has an id and a (nullable) parent entry id.
I want to retrieve all entries in the tree under a given entry. This is in a SQL Server 2005 database. I am querying it with LINQ to SQL in C# 3.5.</p>
<p>LINQ to SQL does not support <a href="http://msdn.microsoft.com/en-us/library/ms190766.aspx" rel="noreferrer">Common Table Expressions</a> directly. My choices are to assemble the data in code with several LINQ queries, or to make a view on the database that surfaces a CTE. </p>
<p>Which option (or another option) do you think will perform better when data volumes get large?
Is SQL Server 2008's <a href="http://msdn.microsoft.com/en-us/library/bb677173.aspx" rel="noreferrer">HierarchyId type</a> supported in Linq to SQL?</p>
| [
{
"answer_id": 203071,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 4,
"selected": true,
"text": "CREATE TABLE [dbo].[hierarchical_table](\n [id] [int] IDENTITY(1,1) NOT NULL,\n [parent_id] [int] NULL,\n [data... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5599/"
] |
202,914 | <p>I have a storyboard(1) that does some basic animations in 2 seconds. I want the storyboard(1) to do all the property animations I have set it up to do (this all works fine). But at 3 seconds into the storyboard(1) I want to begin storyboard(2) and exit storyboard(1) without user interaction at all.</p>
<p>Only thing I've seen that allows me to do this is when the user clicks on something. I want this to be automatic based on the position of the current storyboard(1) timeline.</p>
<p>I hope this makes enough sense. Please let me know if you need me to explain something in more detail.</p>
<p>Thanks.</p>
<p>Edit: Please post the answer in XAML or VB.net language. :)</p>
| [
{
"answer_id": 205118,
"author": "Enrico Campidoglio",
"author_id": 26396,
"author_profile": "https://Stackoverflow.com/users/26396",
"pm_score": 3,
"selected": false,
"text": "<StackPanel>\n <Rectangle Name=\"recProgressBar\"\n Fill=\"Orange\"\n Width=\"1\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27494/"
] |
202,946 | <p>I'm working on an application that makes extensive use of ComponentOne's C1FlexGrid. Of the dozens we use, three are missing their licenses.licx file and cause the demo splash screen to pop up while I'm starting the application.</p>
<p>Is there any way to determine which forms are causing this behavior. Short of checking hundreds of directories by hand, I don't see a way.</p>
| [
{
"answer_id": 56021714,
"author": "StayOnTarget",
"author_id": 3195477,
"author_profile": "https://Stackoverflow.com/users/3195477",
"pm_score": 0,
"selected": false,
"text": "LicxGenerator [-r] [-p prefix] [-s] [sourcePath] [outputPath]\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5287/"
] |
202,962 | <p>How do I connect to a MSSQL database using Perl's DBI module in Windows?</p>
| [
{
"answer_id": 202973,
"author": "culix",
"author_id": 28037,
"author_profile": "https://Stackoverflow.com/users/28037",
"pm_score": 3,
"selected": false,
"text": "use DBI;\nmy $dbs = \"dbi:ODBC:DRIVER={SQL Server};SERVER={ServerName}\";\nmy ($username, $password) = ('username', 'passwor... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28037/"
] |
202,971 | <p>I've built a simple application that applies grid-lines to an image or just simple colors for use as desktop wallpaper. The idea is that the desktop icons can be arranged within the grid. The problem is that depending on more things than I understand the actual spacing in pixels seems to be different from system to system. I've learned that at least these things play a factor:</p>
<ul>
<li>Resolution (duh)</li>
<li>Taskbar size and placement</li>
<li>Fonts</li>
</ul>
<p>There has to be more than this. Maybe there's some api call that I don't know about?</p>
| [
{
"answer_id": 202997,
"author": "balexandre",
"author_id": 28004,
"author_profile": "https://Stackoverflow.com/users/28004",
"pm_score": 3,
"selected": true,
"text": "using System.Management; "
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16260/"
] |
202,974 | <p>Especially when considering a fresh Rails project, what does your version control and deployment workflow look like? What tools do you use?</p>
<p>I'm interested in answers for Mac, *nix and Windows work machines. Assume a *nix server.</p>
<p>I'll edit for clarity if need be.</p>
| [
{
"answer_id": 202991,
"author": "Christoph Schiessl",
"author_id": 20467,
"author_profile": "https://Stackoverflow.com/users/20467",
"pm_score": 5,
"selected": true,
"text": "deploy.rb"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/202974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9619/"
] |
202,990 | <p>Suppose I have a dataset with those two immortal tables: Employee & Order <br/>
<strong>Emp</strong> -> ID, Name <br/>
<strong>Ord</strong> -> Something, Anotherthing, EmpID <br/>
And relation <strong>Rel</strong>: Ord (EmpID) -> Emp (ID) <br/></p>
<p>It works great in standard master/detail scenario <br/>
(show employees, follow down the relation, show related orders), <br/>
but what when I wan't to go the opposite way (show Ord table with Emp.Name)? <br/></p>
<p>Something like this:<br/></p>
<pre><code><stackpanel> // with datacontext set from code to dataset.tables["ord"]
<TextBox Text="{Binding Something}"/>
<TextBox Text="{Binding Anotherthing}"/>
<TextBox Text="{Binding ???}"/> // that's my problem, how to show related Emp.Name
</stackpanel>
</code></pre>
<p>Any ideas? I can create value converter, but if I wan't to use dataset instance which I get from parent module it gets tricky.</p>
| [
{
"answer_id": 207805,
"author": "Enrico Campidoglio",
"author_id": 26396,
"author_profile": "https://Stackoverflow.com/users/26396",
"pm_score": 0,
"selected": false,
"text": "using System.Data;\n\npublic partial class OrdDataTable : DataTable\n{\n public string EmpName\n {\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/202990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27956/"
] |
203,022 | <p>I'm writing a simple CMS.</p>
<p>I want to be able to load a View, having it included inside a master page, and then scan the HTML so that I can replace some custom tags (like {{blog}} with my own blog output) and then serve it up to the browser.</p>
<p>How can I get access to the HTML from the ViewResult in order to intercept it?</p>
| [
{
"answer_id": 203850,
"author": "Adrian Clark",
"author_id": 148,
"author_profile": "https://Stackoverflow.com/users/148",
"pm_score": 3,
"selected": true,
"text": "ActionFilterAttribute"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/203022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2285/"
] |
203,030 | <p>I want to get a list of files in a directory, but I want to sort it such that the oldest files are first. My solution was to call File.listFiles and just resort the list based on File.lastModified, but I was wondering if there was a better way.</p>
<p>Edit: My current solution, as suggested, is to use an anonymous Comparator:</p>
<pre><code>File[] files = directory.listFiles();
Arrays.sort(files, new Comparator<File>(){
public int compare(File f1, File f2)
{
return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
} });
</code></pre>
| [
{
"answer_id": 4248059,
"author": "Jason Orendorff",
"author_id": 94977,
"author_profile": "https://Stackoverflow.com/users/94977",
"pm_score": 6,
"selected": false,
"text": "class Pair implements Comparable {\n public long t;\n public File f;\n\n public Pair(File file) {\n ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4828/"
] |
203,050 | <p>I want to deploy my site on my web hosting package by doing a checkout through subversion. I do not have SSH access to my hosting package, which is just a basic LAMP web hosting package, but I do know that there is an SVN client installed on the web server.</p>
<p>I was thinking of writing some sort of script (PHP or Shell) that can do different functions. Like a checkout, update, switch to another tag etc. and that I can call externally in some sort of fashion.</p>
<p>Any input on best practices, things to look out for and how to go about this is very much appreciated.</p>
<blockquote>
<p><strong>UPDATE</strong>: I have been using the
following technique for the past
couple of weeks now. I've carefully
crafted (and well tested) a couple
shell scripts that I can execute from
cron through cPanel. Whenever cron has
completed a job it will email me the
console output of the job. this way I
can monitor if all commands succeeded. Since I only
do updates on the server and no
commits, I haven't run into any
issues concerning Subversion. Of course, in my .htaccess
files I have created a rule that will deny
any access to the hidden .svn folders.</p>
</blockquote>
| [
{
"answer_id": 203084,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "rsync"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/203050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21406/"
] |
203,058 | <p>I have a C application that I've created in VS2008. I am creating a mock creation function that overrides function references in a struct. However if I try and do this in a straight forward fashion with something like:</p>
<pre><code>void *ptr = &(*env)->GetVersion;
*ptr = <address of new function>
</code></pre>
<p>then I get a "error C2100: illegal indirection" error as *ptr, when ptr is a void * seems to be a banned construct. I can get around it by using a int/long pointer as well, mapping that to the same address and modifying the contents of the long pointer:</p>
<pre><code>*structOffsetPointer = &(*env)->GetVersion;
functionPointer = thisGetVersion;
structOffsetPointerAsLong = (long *)structOffsetPointer;
*structOffsetPointerAsLong = (long)functionPointer;
</code></pre>
<p>but I am concerned that using long or int pointers will cause problems if I switch between 32 and 64 bit environments.</p>
<p>So is there are easy way to disable this error? Assuming not, is either int or long 64 bits under win64?</p>
| [
{
"answer_id": 203077,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 1,
"selected": false,
"text": "UINT_PTR"
},
{
"answer_id": 203093,
"author": "Jim Buck",
"author_id": 2666,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7122/"
] |
203,075 | <p>For example, I'm writing tests against a CsvReader. It's a simple class that enumerates and splits rows of text. Its only <em>raison d'être</em> is ignoring commas within quotes. It's less than a page.</p>
<p>By "black box" testing the class, I've checked things like</p>
<ul>
<li>What if the file doesn't exist?</li>
<li>What if I don't have permission on the file?</li>
<li>What if the file has non-Windows line-breaks?</li>
</ul>
<p>But in fact, all of these things are the StreamReader's business. My class works without doing anything about these cases. So in essence, my tests are catching errors thrown by StreamReader, and testing behavior handled by the framework. It feels like a lot of work for nothing.</p>
<p>I've seen the related questions</p>
<ul>
<li><a href="https://stackoverflow.com/questions/164170/should-qa-test-from-a-strictly-black-box-perspective">Should QA test from a strictly black-box perspective?</a> </li>
<li><a href="https://stackoverflow.com/questions/12569/rigor-in-capturing-test-cases-for-unit-testing">Rigor in capturing test cases for unit testing</a></li>
</ul>
<p>My question is, am I missing the point of "glass box" testing if I use what I know to <em>avoid</em> this kind of work?</p>
| [
{
"answer_id": 203175,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "public class CvsReader {\n private string filename;\n public CvsReader(string filename)\n {\n this.filename ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4525/"
] |
203,085 | <p>How can I make my compilation optimized for Windows 64 bit?</p>
| [
{
"answer_id": 204099,
"author": "TimothyP",
"author_id": 28149,
"author_profile": "https://Stackoverflow.com/users/28149",
"pm_score": 3,
"selected": false,
"text": "using System;\nusing System.Runtime.InteropServices;\n\nclass SystemChecker\n{\n static bool Is64Bit\n {\n g... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] |
203,090 | <p>Update: Now that it's 2016 I'd use PowerShell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using <code>date</code>. See @npocmaka's <a href="https://stackoverflow.com/a/19799236/8479">https://stackoverflow.com/a/19799236/8479</a></p>
<hr>
<p>What's a Windows command line statement(s) I can use to get the current datetime in a format that I can put into a filename?</p>
<p>I want to have a .bat file that zips up a directory into an archive with the current date and time as part of the name, for example, <code>Code_2008-10-14_2257.zip</code>. Is there any easy way I can do this, independent of the regional settings of the machine?</p>
<p>I don't really mind about the date format, ideally it'd be yyyy-mm-dd, but anything simple is fine.</p>
<p>So far I've got this, which on my machine gives me <code>Tue_10_14_2008_230050_91</code>:</p>
<pre><code>rem Get the datetime in a format that can go in a filename.
set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%
rem Now use the timestamp by in a new ZIP file name.
"d:\Program Files\7-Zip\7z.exe" a -r Code_%_my_datetime%.zip Code
</code></pre>
<p>I can live with this, but it seems a bit clunky. Ideally it'd be briefer and have the format mentioned earlier.</p>
<p>I'm using Windows Server 2003 and Windows XP Professional. I don't want to install additional utilities to achieve this (although I realise there are some that will do nice date formatting).</p>
| [
{
"answer_id": 203099,
"author": "micahwittman",
"author_id": 11181,
"author_profile": "https://Stackoverflow.com/users/11181",
"pm_score": 3,
"selected": false,
"text": "::Date Variables - replace characters that are not legal as part of filesystem file names (to produce name like \"bac... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] |
203,096 | <p>I created an Interop user control in VS2005. When the user control is shown inside VB6, it does not pickup/use the XP styles (The buttons and the tabs look like VB6 buttons/tabs). </p>
<p>How do I get the XP styles to work with my control while it is in VB6?</p>
| [
{
"answer_id": 203099,
"author": "micahwittman",
"author_id": 11181,
"author_profile": "https://Stackoverflow.com/users/11181",
"pm_score": 3,
"selected": false,
"text": "::Date Variables - replace characters that are not legal as part of filesystem file names (to produce name like \"bac... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1632/"
] |
203,113 | <p>I have a JS function that may occasionally get used on some pages. It is dependent on another JS file (swfObject.js), but I'd like to avoid having to include this file all over the place, as thats a wasted request most of the time.</p>
<p>Instead, I'd like to create a generic function that can inject a script reference into the page DOM as needed, so if this function is called, it would check for the script, and if it does not exist, load it in.</p>
<p>I'm fairly sure this is possible (and I'm not going to use document.write), but before I venture off into uncharted territory, has anyone done this before, and if so, any pointers?</p>
<p>EDIT: Ok, I tried it, and it works in IE6 and FF, I haven't tested other browsers yet.</p>
<p>Here is my code (Rev 2.0, now with optional callbacks):</p>
<pre><code>function loadJSInclude(scriptPath, callback)
{
var scriptNode = document.createElement('SCRIPT');
scriptNode.type = 'text/javascript';
scriptNode.src = scriptPath;
var headNode = document.getElementsByTagName('HEAD');
if (headNode[0] != null)
headNode[0].appendChild(scriptNode);
if (callback != null)
{
scriptNode.onreadystagechange = callback;
scriptNode.onload = callback;
}
}
</code></pre>
<p>and in the method with a dependency:</p>
<pre><code>var callbackMethod = function ()
{
// Code to do after loading swfObject
}
// Include SWFObject if its needed
if (typeof(SWFObject) == 'undefined')
loadJSInclude('/js/swfObject.js', callbackMethod);
else
calbackMethod();
</code></pre>
<p>Any suggestions?</p>
| [
{
"answer_id": 203139,
"author": "abahgat",
"author_id": 27565,
"author_profile": "https://Stackoverflow.com/users/27565",
"pm_score": 2,
"selected": false,
"text": "$.getScript(url, callback)"
},
{
"answer_id": 204100,
"author": "aemkei",
"author_id": 28150,
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
203,126 | <p>Here is an example of polymorphism from <a href="http://www.cplusplus.com/doc/tutorial/polymorphism.html" rel="noreferrer">http://www.cplusplus.com/doc/tutorial/polymorphism.html</a> (edited for readability):</p>
<pre><code>// abstract base class
#include <iostream>
using namespace std;
class Polygon {
protected:
int width;
int height;
public:
void set_values(int a, int b) { width = a; height = b; }
virtual int area(void) =0;
};
class Rectangle: public Polygon {
public:
int area(void) { return width * height; }
};
class Triangle: public Polygon {
public:
int area(void) { return width * height / 2; }
};
int main () {
Rectangle rect;
Triangle trgl;
Polygon * ppoly1 = &rect;
Polygon * ppoly2 = &trgl;
ppoly1->set_values (4,5);
ppoly2->set_values (4,5);
cout << ppoly1->area() << endl; // outputs 20
cout << ppoly2->area() << endl; // outputs 10
return 0;
}
</code></pre>
<p>My question is how does the compiler know that ppoly1 is a Rectangle and that ppoly2 is a Triangle, so that it can call the correct area() function? It could find that out by looking at the "Polygon * ppoly1 = ▭" line and knowing that rect is a Rectangle, but that wouldn't work in all cases, would it? What if you did something like this?</p>
<pre><code>cout << ((Polygon *)0x12345678)->area() << endl;
</code></pre>
<p>Assuming that you're allowed to access that random area of memory.</p>
<p>I would test this out but I can't on the computer I'm on at the moment.</p>
<p>(I hope I'm not missing something obvious...)</p>
| [
{
"answer_id": 203136,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 6,
"selected": true,
"text": "vptr"
},
{
"answer_id": 203167,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://St... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813/"
] |
203,147 | <p>Here's another C#/.NET question based merely on curiousity more than an immediate <em>need</em> ...</p>
<p>If you had a <code>Socket</code> instance and you wanted to wrap it in the higher-level <code>TcpClient</code> class, is that possible and how would you do it?</p>
<p>Conversely if you have an instance of <code>TcpClient</code>, is it possible to get the underlying <code>Socket</code>?</p>
| [
{
"answer_id": 203153,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 2,
"selected": false,
"text": "tcpClientInstance.Client"
},
{
"answer_id": 203160,
"author": "Jorge Ferreira",
"author_id": 6508,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9642/"
] |
203,151 | <p>I have a report that uses a TChart that I am maintaining. One of the TLineSeries that gets added automatically gets assigned the color clWhite, which is too close to the background (clBtnFace). </p>
<p>If I change it, then the next series that gets added takes clWhite. So short of going back and changing it after all the other series are created, is there some way to tell the TChart that I don't want any of my series to be clWhite?</p>
<p>When a series is added to the TChart the TChart assigns it a color. I want it to not assign clWhite.</p>
| [
{
"answer_id": 203236,
"author": "Anya Shenanigans",
"author_id": 17833,
"author_profile": "https://Stackoverflow.com/users/17833",
"pm_score": 2,
"selected": false,
"text": "procedure TForm1.setColors(aChart: TChart; aColorArray: array of TColor);\nvar\n chi : Integer;\n coi : Integer... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/255/"
] |
203,161 | <p>Im just writing a small Ajax framework for re-usability in small projects and i've hit a problem. Basically i get a '<code>NS_ERROR_ILLEGAL_VALUE</code>' error while sending the request and i've no idea what is happening.</p>
<p>The HTML Page
(trimmed but shows the error)</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ajax Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
var COMPLETE = 4;
var OK = 200;
function GetXMLHttpRequestObject()
{
var XMLHttpRequestObject = false;
if(window.XMLHttpRequest)
{
if(typeof XMLHttpRequest != 'undefined')
{
try
{
XMLHttpRequestObject = new XMLHttpRequest();
}
catch (e)
{
XMLHttpRequestObject = false;
}
}
}
else if (window.ActiveXObject)
{
try
{
XMLHttpRequestObject = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e)
{
try
{
XMLHttpRequestObject = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (e)
{
XMLHttpRequestObject = false;
}
}
}
else
{
XMLHttpRequestObject = false;
}
return XMLHttpRequestObject;
}
//The Main Ajax Object
function AjaxRequest(p_RequestMethod, p_DestinationURL)
{
this.XMLHttpRequestObject = GetXMLHttpRequestObject();
this.RequestedMethod = p_RequestMethod;
this.DestinationURL = p_DestinationURL;
this.XMLHttpRequestObject.open(this.RequestMethod, this.DestinationURL);
this.OnStateChange = function(Callback)
{
this.XMLHttpRequestObject.onreadystatechange = Callback;
}
this.Send = function(p_Content)
{
this.XMLHttpRequestObject.send(p_Content);
}
this.GetState()
{
return this.XMLHttpRequestObject.readyState;
}
this.GetResponseText = function()
{
return this.XMLHttpRequestObject.responseText;
}
this.GetResponseStatus = function()
{
return this.XMLHttpRequestObject.status;
}
this.GetResponseStatusText = function()
{
return this.XMLHttpRequestObject.statusText;
}
}
var Request;
function GetData()
{
Request = new AjaxRequest('POST', 'http://www.kalekold.net/ajax/Ajax.php');
Request.OnStateChange = StateChange;
Request.Send();
}
function StateChange()
{
window.alert("State: " + Request.GetState());
window.alert("Response: " + Request.GetResponseStatus());
window.alert("Response Text: " + Request.GetResponseStatusText());
if(Request.GetState() == COMPLETE && Request.GetResponseStatus() == OK)
{
Result = Request.GetResponseText();
window.alert(Result);
}
}
</script>
</head>
<body>
<form>
<textarea name="TextArea" rows="10" cols="80"></textarea><br />
<input type="button" value="Load" onClick="GetData();">
</form>
</body>
</html>
</code></pre>
<p>The PHP File:</p>
<pre><code><?php
$XML = <<< PROLOG
<?xml version="1.0" encoding="iso-8859-1"?>
PROLOG;
$XML .= "<results>";
$XML .= "<result>";
$XML .= "<FirstName>Gary</FirstName>";
$XML .= "<SecondName>Willoughby</SecondName>";
$XML .= "<Age>35</Age>";
$XML .= "</result>";
$XML .= "<result>";
$XML .= "<FirstName>Sara</FirstName>";
$XML .= "<SecondName>Gostick</SecondName>";
$XML .= "<Age>35</Age>";
$XML .= "</result>";
$XML .= "</results>";
header("Content-Type: text/xml");
echo $XML;
?>
</code></pre>
<p>The full error:</p>
<pre><code>uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://www.kalekold.net/ajax/ :: AjaxRequest :: line 63" data: no]
Line 0
</code></pre>
<p>I just can't see where it's going wrong, any ideas?</p>
| [
{
"answer_id": 204048,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 1,
"selected": false,
"text": "XMLHttpRequestObject.responseText"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/203161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13227/"
] |
203,171 | <p>How can I include a bookmarklet in a Markdown parsed document? Is there any "tag" for markdown that basically says "don't parse this"??</p>
<p>For example you could have something like:</p>
<pre><code><a href="javascript:function my_bookmarklet()
{alert('Hello World');}
my_bookmarklet();">Hello</a>
</code></pre>
<p>But if I try to past the javascript from that into a link in markdown like this: </p>
<pre><code>[Hello World!](javascript:function my_bookmarklet(){alert('Hello World');}my_bookmarklet();)
</code></pre>
<p>You get a messed up link, like below.</p>
<p>[Hello World!](javascript:function my_bookmarklet(){alert('Hello World');}my_bookmarklet();)</p>
<p>Is there anyway around this?</p>
<p>And no, I'm not trying to put malicious bookmarklets in SO or anything, but I want to use markdown for my site and would like to post some bookmarklets I wrote.</p>
<p>Edit: I thought I had the answer...but now it seems I don't quite have it.</p>
<p>This seems to work great in WMD and showdown, but in the Markdown.php editor, it does not. Anyone have experience with Markdown.php specifically?</p>
| [
{
"answer_id": 203179,
"author": "stevemegson",
"author_id": 25028,
"author_profile": "https://Stackoverflow.com/users/25028",
"pm_score": 4,
"selected": true,
"text": "<a href=\"javascript:function my_bookmarklet()\n {alert('Hello World');}\n my_bookmarklet... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] |
203,172 | <p>Doxygen is a bit slow - it takes about a couple of minutes to process my whole project, so for small incremental changes this is longer than actually building the rest of my code. There are thousands of files without any documentation so I guess it is spending most of its time processing them. Is there any way to get it to skip files without any documentation?</p>
<p>What about getting it to only process changed files?</p>
| [
{
"answer_id": 672043,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 3,
"selected": false,
"text": "SEARCH_INCLUDES"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/203172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3146/"
] |
203,174 | <p>I have a new app I'll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What's a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some hidden gotcha's in using them?</p>
<p>Some clarifications:</p>
<ul>
<li>I can't output a PDF, they want a Word doc.</li>
<li>They're using MS Word 2003 (or 2007), not OpenOffice</li>
<li>Application is running on *nix app-server</li>
</ul>
<p>It'd be nice if I could start with a template doc and just fill in some spaces with tables, graphs, etc.</p>
<p>Edit: Several good answers below, each with their own faults as far as my current situation. Hard to pick a "final answer" from them. Think I'll leave it open, and hope for better solutions to be created.</p>
<p>Edit: The OpenOffice UNO project does seem to be closest to what I asked for. While POI is certainly more mainstream, it's too immature for what I want.</p>
| [
{
"answer_id": 3332031,
"author": "Leonardo",
"author_id": 401906,
"author_profile": "https://Stackoverflow.com/users/401906",
"pm_score": 3,
"selected": false,
"text": "IDocument myDoc = new Document2004();\nmyDoc.getBody().addEle(new Heading1(\"Heading01\"));\nmyDoc.getBody().addEle(ne... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13824/"
] |
203,180 | <p>Say I have my sources in my src/ tree (and possibly in my test/ tree). Say I would like to compile only <em>part</em> of that tree. The reasons why I might want to do that are various. Just as an example, I might want to create the smallest possible jar (without including certain classes), or I might want the fastest compile time for what I am compiling. I absolutely want to compile all the dependencies, though!</p>
<p>This can be easily achieved from the command line with:</p>
<pre><code>javac -d build/ -cp whatever -sourcepath src src/path/to/MyClass.java
</code></pre>
<p>Now, how can you do that with ant? The javac ant <a href="http://ant.apache.org/manual/Tasks/javac.html" rel="noreferrer">task compiles everything</a>:</p>
<blockquote>
<p>The source and destination directory
will be recursively scanned for Java
source files to compile.</p>
</blockquote>
<p>One can use the <code>excludes</code> and <code>includes</code> parameters, but they are problematic for this purpose. In fact, it seems that one has to explicitly setup all the <code>includes</code> (not automatic dependency lookup), and <strong>even worst</strong> that <a href="http://ant.apache.org/manual/dirtasks.html#patternset" rel="noreferrer">excludes has priority on includes</a>:</p>
<blockquote>
<p>When both inclusion and exclusion are
used, only files/directories that
match at least one of the include
patterns and don't match <em>any</em> of the
exclude patterns are used.</p>
</blockquote>
<p>Thus, you cannot use </p>
<pre><code><javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath"
excludes="**/*.java" includes="src/path/to/MyClass.java" />
</code></pre>
<p>Because it will not compile anything :-(</p>
<p>Is there any way of achieving that simple command line <code>javac</code> with ant?</p>
<hr>
<p>EDITED: Thank you for your answer, Sadie, I'm accepting it, because it does work in the way I was wondering in this question. But I have a couple of comments (too long to be in the comment field of your answer):</p>
<p>1) I did read the documentation (see links above), but it's unclear that with just <code>includes</code> you are actually also excluding everything else</p>
<p>2) When you just <code>includes</code> ant logs something like</p>
<pre><code>[javac] Compiling 1 source file to /my/path/to/build
</code></pre>
<p>even if the dependencies make it compiling (much) more than just one source file.</p>
| [
{
"answer_id": 203552,
"author": "Marcus Downing",
"author_id": 1000,
"author_profile": "https://Stackoverflow.com/users/1000",
"pm_score": 5,
"selected": true,
"text": "<javac srcdir=\"${src.dir}\" destdir=\"${build.dir}\" classpathref=\"classpath\"\n includes=\"src/path/to/MyCla... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25891/"
] |
203,189 | <p>I am intercepting Win32 API calls a native dll or exe is doing from C# using some kind of hooking. In this particular case I am interested in DrawText() in user32.dll. It is declared like this in Win32 API:</p>
<pre><code>INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
</code></pre>
<p>The LPRECT struct has the following signature (also in Win32 API):</p>
<pre><code>typedef struct tagRECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT LPRECT;
</code></pre>
<p>LONG is a typedef for 32bit integers on 32bit systems (don't know about 64bit systems, it is irrelevant at this point because I am on 32bit Windows). To be able to access the members of this struct I declared it in my C# code...</p>
<pre><code>[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RECT
{
public Int32 left;
public Int32 top;
public Int32 right;
public Int32 bottom;
}
</code></pre>
<p>... and wrote the signature of P/Invoke using this RECT struct:</p>
<pre><code>[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
static extern IntPtr DrawText(IntPtr HDC, String str, Int32 count, ref RECT rect, UInt32 flags, IntPtr dtp);
</code></pre>
<p>Since structs are value types in C# as opposed to being reference types like in C/C++, the ref modifier is necessary here.</p>
<p>However when I use <code>rect.top rect.left</code> etc, they almost always return 0. I know for a fact that this is incorrect. But after googling countless hours and trying a lot of different things, I couldn't make this simple stuff work.</p>
<p>Things I've tried:</p>
<ul>
<li>Using different primitives for RECT members (int, long, short, UInt32...). Actually it is kinda obvious that this is not a type problem because in any case I should see some garbled numbers, not 0.</li>
<li>Removing ref modifier. This is also stupid (desperate times, desperate measures) because rect.left correctly returns the pointer to rect instead of its value.</li>
<li>Tried <code>unsafe</code> code blocks. Didn't work but I may have made a mistake in the implementation (I don't remember what I've done). Besides this approach is generally reserved for tricky pointer situations in COM and Win32, it is overkill for my case anyway.</li>
<li>Tried adding <code>[MarshallAs]</code> before the members of RECT. Made no difference.</li>
<li>Played around with <code>Pack</code> values. No difference.</li>
</ul>
<p>I am fairly sure that I'm missing something very easy and straightforward but I have no idea what it is...</p>
<p>Any help is appreciated. Thank you.</p>
| [
{
"answer_id": 203239,
"author": "Werg38",
"author_id": 27569,
"author_profile": "https://Stackoverflow.com/users/27569",
"pm_score": 2,
"selected": false,
"text": "[MarshallAs]"
},
{
"answer_id": 203999,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "ht... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
203,194 | <p>I'm trying to access the Facebook API Admin.getMetrics method via jQuery. I'm correctly composing the request url on the server side (in order to keep my app secret secret). I'm then sending the url over to the browser to be request using <code>jQuery.getJSON()</code>.</p>
<p>Facebook requires that I send a copy of all of my request params hashed with my application secret along with the request in order to verify my authenticity. The problem is that jQuery wants to generate the name of the callback function itself in order to match the name it gives to the anonymous function you pass in to be called when the data returns. Therefore, the name of the function is not available until <code>jQuery.getJSON()</code> executes and Facebook considers my request to be inauthentic due to a mismatched signature (the signature I send along does not include the correct callback param because that was not generated until <code>jQuery.getJSON()</code> ran).</p>
<p>The only way I can think of out of this problem is to somehow specify the name of my function to <code>jQuery.getJSON()</code> instead of allowing it to remain anonymous. But I cannot find any option for doing so in the jQuery AP.</p>
| [
{
"answer_id": 205164,
"author": "Duncan",
"author_id": 25035,
"author_profile": "https://Stackoverflow.com/users/25035",
"pm_score": 0,
"selected": false,
"text": "window.fixed_callback = function(data){\n alert(data.title);\n};\n\n$(function() {\n $.getScript(\"http://api.flickr.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10419/"
] |
203,195 | <p>Is there a Registry setting that I can look for to determine whether or not the Visual C++ redistributable is installed, whether standalone or as part of Visual Studio 2008? I know that I could launch the VC++ 2008 redistributable installer and let it handle the detection, but it would look cleaner if I can check for it and not bother launching the installer if the redistributable is already on the system.</p>
<p>It's no biggie if there is no setting to search for, as this is just for the preliminary installers that we have for the new version of our software. We won't need it for the new Windows Installer-based installers that we are working on that will replace the old tech ones and will use the merge modules.</p>
| [
{
"answer_id": 203268,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 3,
"selected": false,
"text": "if (LoadLibrary(L\"msvcrt80.dll\")!=NULL)\n{\n // it is installed\n}\n"
},
{
"answer_id": 203825,
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21255/"
] |
203,198 | <p>I have a bit of code where I am looping through all the select boxes on a page and binding a <code>.hover</code> event to them to do a bit of twiddling with their width on <code>mouse on/off</code>.</p>
<p>This happens on page ready and works just fine.</p>
<p>The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.</p>
<p>I have found this plugin (<a href="http://brandonaaron.net/docs/livequery/#getting-started" rel="noreferrer">jQuery Live Query Plugin</a>), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.</p>
| [
{
"answer_id": 203220,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 6,
"selected": false,
"text": "var mouseOverHandler = function() {\n // Do stuff\n};\nvar mouseOutHandler = function () {\n // Do stuff\n};\n\n$(functi... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27580/"
] |
203,199 | <p>I tried but I guess Message Box only works with win forms. What is the best alternative to use in web forms?</p>
| [
{
"answer_id": 203205,
"author": "Patrick McElhaney",
"author_id": 437,
"author_profile": "https://Stackoverflow.com/users/437",
"pm_score": 2,
"selected": false,
"text": "result = confirm('Yes or no question here.')\n"
},
{
"answer_id": 203210,
"author": "BoltBait",
"aut... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14752/"
] |
203,207 | <p>I got a program with a fscanf like this:</p>
<p>fscanf(stdin, "%d %d,....</p>
<p>I got many fscanf and files that I'd like to test, the files are like this</p>
<p>10485770 15 51200000
-2 10
10 10485760 10485760
10 10485760 10485760
10 10485760 10485760</p>
<p>Well my question is how can I tell to the program or the compiler to take the inputs not from the keyboard, but from those files. These programs are benchmarks and in the files I got the inputs, I'm sure there is a way to do this automatic because in some case there are many inputs. Thank you in advance.</p>
| [
{
"answer_id": 203216,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "freopen( \"somefile.txt\", \"r\", stdin );\n"
},
{
"answer_id": 203218,
"author": "Sufian",
"author_id": 9241,... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
203,246 | <p>What is the best way to keep a console application open as long as the CancelKeyPress event has not been fired?</p>
<p>I would prefer to not use Console.Read or Console.ReadLine as I do not want to accept input. I just want to enable the underlying application to print to the console event details as they are fired. Then once the CancelKeyPress event is fired I want to gracefully shut down the application.</p>
| [
{
"answer_id": 203289,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 5,
"selected": true,
"text": "class Program\n{\n\n private static volatile bool _s_stop = false;\n\n public static void Main(string[] args)... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3957/"
] |
203,257 | <p>How can my app get a list of the True Type Fonts that are available on Linux. </p>
<p>Is there a standard directory where they are stored across different distributions? Or some other standard way to locate them?</p>
| [
{
"answer_id": 1285647,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": " PangoFontFamily **families;\n\n ...\n\n pango_context_list_families (\n gtk_widget_get_pango_context (GTK_WIDGET... | 2008/10/14 | [
"https://Stackoverflow.com/questions/203257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13676/"
] |
203,288 | <p>I'm a PHP developer who knows a little bit of Ruby. I want to learn Ruby on Rails, but most of the resources I've come across treat RoR functionality as "magic" -- i.e., it has a certain internal consistency, but don't bother asking how it works in terms of Ruby, MySQL, etc.</p>
<p>Anyway, I want a deep understanding of how RoR works, the design decisions that went into building it, etc. In particular I'm interested in ActiveRecord, but really I'm looking for the whole package.</p>
<p>Any books / sites / advice welcome.</p>
| [
{
"answer_id": 217050,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "method_missing"
}
] | 2008/10/15 | [
"https://Stackoverflow.com/questions/203288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25068/"
] |
203,294 | <p>I have two NSURLConnections. The second one depends on the content of the first, so handling the data received from the connection will be different for the two connections. </p>
<p>I'm just picking up Objective-C and I would like to know what the proper way to implement the delegates is.</p>
<p>Right now I'm using: </p>
<pre><code>NSURL *url=[NSURL URLWithString:feedURL];
NSURLRequest *urlR=[[[NSURLRequest alloc] initWithURL:url] autorelease];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:urlR delegate:self];
</code></pre>
<p>I don't want to use self as the delegate, how do I define two connections with different delegates?</p>
<pre><code>NSURLConnection *c1 = [[NSURLConnection alloc] initWithRequest:url delegate:handle1];
NSURLConnection *c2 = [[NSURLConnection alloc] initWithRequest:url delegate:handle2];
</code></pre>
<p>How would do i create handle1 and handle2 as implementations? Or interfaces? I don't really get how you would do this. </p>
<p>Any help would be awesome.</p>
<p>Thanks,
Brian Gianforcaro</p>
| [
{
"answer_id": 206430,
"author": "Brian Gianforcaro",
"author_id": 3415,
"author_profile": "https://Stackoverflow.com/users/3415",
"pm_score": 4,
"selected": false,
"text": "@interface DownloadDelegate : NSObject \n- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSUR... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3415/"
] |
203,302 | <p>I have a table of items, each of which has a date associated with it. If I have the date associated with one item, how do I query the database with SQL to get the 'previous' and 'subsequent' items in the table?</p>
<p>It is not possible to simply add (or subtract) a value, as the dates do not have a regular gap between them. </p>
<p>One possible application would be 'previous/next' links in a photo album or blog web application, where the underlying data is in a SQL table.</p>
<p>I think there are two possible cases:</p>
<p><strong>Firstly</strong> where each date is unique:</p>
<p>Sample data:</p>
<pre><code>1,3,8,19,67,45
</code></pre>
<p>What query (or queries) would give 3 and 19 when supplied 8 as the parameter? (or the rows 3,8,19). Note that there are not always three rows to be returned - at the ends of the sequence one would be missing.</p>
<p><strong>Secondly</strong>, if there is a separate unique key to order the elements by, what is the query to return the set 'surrounding' a date? The order expected is by date then key.</p>
<p>Sample data:</p>
<pre><code>(key:date) 1:1,2:3,3:8,4:8,5:19,10:19,11:67,15:45,16:8
</code></pre>
<p>What query for '8' returns the set:</p>
<pre><code>2:3,3:8,4:8,16:8,5:19
</code></pre>
<p>or what query generates the table:</p>
<pre><code>key date prev-key next-key
1 1 null 2
2 3 1 3
3 8 2 4
4 8 3 16
5 19 16 10
10 19 5 11
11 67 10 15
15 45 11 null
16 8 4 5
</code></pre>
<p>The table order is not important - just the next-key and prev-key fields.</p>
<hr>
<p>Both TheSoftwareJedi and Cade Roux have solutions that work for the data sets I posted last night. For the second question, both seem to fail for this dataset:</p>
<pre><code>(key:date) 1:1,2:3,3:8,4:8,5:19,10:19,11:67,15:45,16:8
</code></pre>
<p>The order expected is by date then key, so one expected result might be: </p>
<pre><code>2:3,3:8,4:8,16:8,5:19
</code></pre>
<p>and another:</p>
<pre><code>key date prev-key next-key
1 1 null 2
2 3 1 3
3 8 2 4
4 8 3 16
5 19 16 10
10 19 5 11
11 67 10 15
15 45 11 null
16 8 4 5
</code></pre>
<p>The table order is not important - just the next-key and prev-key fields.</p>
| [
{
"answer_id": 203310,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 2,
"selected": false,
"text": "select min(a)\nfrom theTable\nwhere a > 8\n\nselect max(a)\nfrom theTable\nwhere a < 8\n"
},
{
"answer_id"... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10019/"
] |
203,316 | <p>I have a table in my database which stores a tree structure. Here are the relevant fields:</p>
<pre><code>mytree (id, parentid, otherfields...)
</code></pre>
<p>I want to find all the leaf nodes (that is, any record whose <code>id</code> is not another record's <code>parentid</code>)</p>
<p>I've tried this:</p>
<pre><code>SELECT * FROM mytree WHERE `id` NOT IN (SELECT DISTINCT `parentid` FROM `mytree`)
</code></pre>
<p>But that returned an empty set. Strangely, removing the "NOT" returns the set of all the non-leaf nodes.</p>
<p>Can anyone see where I'm going wrong?</p>
<p><em>Update:</em> Thanks for the answers folks, they all have been correct and worked for me. I've accepted Daniel's since it also explains why my query didn't work (the NULL thing).</p>
| [
{
"answer_id": 203323,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 3,
"selected": false,
"text": "select a.*\nfrom mytree a left outer join\n mytree b on a.id = b.parentid\nwhere b.parentid is null\n"
},
... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] |
203,333 | <p>What is the equivalent of the extended procedure 'xp_dirscan' in SQL Server 2005?</p>
| [
{
"answer_id": 203374,
"author": "Sam Saffron",
"author_id": 17174,
"author_profile": "https://Stackoverflow.com/users/17174",
"pm_score": 0,
"selected": false,
"text": "xp_dirscan"
}
] | 2008/10/15 | [
"https://Stackoverflow.com/questions/203333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10385/"
] |
203,336 | <p>How would one create a Singleton class using PHP5 classes?</p>
| [
{
"answer_id": 203359,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 9,
"selected": true,
"text": "/**\n * Singleton class\n *\n */\nfinal class UserFactory\n{\n private static $inst = null;\n\n // Prevent cloning and de... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26210/"
] |
203,355 | <p>Does anyone know if there is an API to get the current monitor state (on or off) in Windows (XP/Vista/2000/2003)?</p>
<p>All of my searches seem to indicate there is no real way of doing this. </p>
<p><a href="http://www.promixis.com/forums/archive/index.php/t-1282.html" rel="noreferrer">This thread</a> tries to use <a href="http://msdn.microsoft.com/en-us/library/aa372690(VS.85).aspx" rel="noreferrer">GetDevicePowerState</a> which according to Microsoft's docs does not work for display devices. </p>
<p>In Vista I can listen to <a href="http://msdn.microsoft.com/en-us/library/aa373195(VS.85).aspx" rel="noreferrer">GUID_MONITOR_POWER_ON</a> but I do not seem to get events when the monitor is turned off manually. </p>
<p>In XP I can hook into <code>WM_SYSCOMMAND</code> <code>SC_MONITORPOWER</code>, looking for status 2. This only works for situations where the system triggers the power off. </p>
<p>The WMI <code>Win32_DesktopMonitor</code> class does not seem to help out as well. </p>
<p><strong>Edit</strong>: Here is <a href="http://groups.google.com/group/comp.os.ms-windows.programmer.win32/browse_thread/thread/6d3e0a0828e68b89/d095095f5244bab4?lnk=gst&q=GetDevicePowerState++monitor#d095095f5244bab4" rel="noreferrer">a discussion</a> on comp.os.ms-windows.programmer.win32 indicating there is no reliable way of doing this. </p>
<p>Anyone else have any other ideas? </p>
| [
{
"answer_id": 204453,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 5,
"selected": true,
"text": "\\\\.\\LCD"
},
{
"answer_id": 613300,
"author": "Avram",
"author_id": 61883,
"author_profile": "h... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17174/"
] |
203,358 | <p>I want to set a style on the first and last TabItems in a TabControl, and have them updated as the visibility of the TabItems is changed. I can't see a way to do so with triggers.</p>
<p>What we're after looks like this:</p>
<pre>| > > > |</pre>
<p>And the visibility of TabItems are determined by binding.</p>
<p>I do have it working in code. On TabItem visibility changed, enumerate through TabItems until you find the first visible one. Set the style on that one. For all other visible TabItems, set them to the pointy style (so that the previously first visible one is now pointy). Then start from the end until you find a visible TabItem and set the last style on that one. (This also lets us address an issue with TabControl where it will display the content of a non-visible TabItem if none of the visible TabItems are selected.)</p>
<p>There's undoubtably improvements I could make to my method, but I'm not convinced that it IS the right approach.</p>
<p>How would you approach this?</p>
| [
{
"answer_id": 204455,
"author": "Dave",
"author_id": 28197,
"author_profile": "https://Stackoverflow.com/users/28197",
"pm_score": 1,
"selected": false,
"text": " public Window1()\n {\n InitializeComponent();\n\n this.myTabItem.IsVisibleChanged += new DependencyPrope... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28074/"
] |
203,377 | <p>How do you get the max value of an enum?</p>
| [
{
"answer_id": 203389,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 9,
"selected": true,
"text": "// given this enum:\npublic enum Foo\n{\n Fizz = 3, \n Bar = 1,\n Bang = 2\n}\n\n// this gets Fizz\nvar lastFoo ... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438/"
] |
203,382 | <p>Is there a difference between generating multiple numbers using a single random number generator (RNG) versus generating one number per generator and discarding it? Do both implementations generate numbers which are equally random? Is there a difference between the normal RNGs and the secure RNGs for this?</p>
<p>I have a web application that is supposed to generate a list of random numbers on behalf of clients. That is, the numbers should appear to be random from each client's point of view. Does this mean I need retain a separate random RNG per client session? Or can I share a single RNG across all sessions? Or can I create and discard a RNG on a per-request basis?</p>
<p><strong>UPDATE</strong>: This question is related to <a href="https://stackoverflow.com/questions/471157/is-a-subset-of-a-random-sequence-also-random">Is a subset of a random sequence also random?</a></p>
| [
{
"answer_id": 203646,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 6,
"selected": true,
"text": "/dev/random"
},
{
"answer_id": 203833,
"author": "Daniel Spiewak",
"author_id": 9815,
"author_profile": ... | 2008/10/15 | [
"https://Stackoverflow.com/questions/203382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14731/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.