qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
240,242 | <p>I have a main window (#1) on my webpage from which I open a new browser window (#2) from which I open a new window (#3).</p>
<p>Now if my user closes window#2 before window#3, I have the problem that window#3 no longer can call function in its window.opener since it has gone away.</p>
<p>What I would like to do is to set window#3.opener to window#1 when window#2 closes.</p>
<p>I've tried to do this i window#2 (by the way I use jquery):</p>
<pre><code>var children = [];
$(window).unload( function( ) {
$.each( children, function( p, win ) {
if ( win ) {
win.opener = window.opener;
}
} );
} );
</code></pre>
<p>When window#3 is loaded I add the window to the array children in window#2.</p>
<p>But still when window#2 is closed before window#3, windows#3's window.opener doesn't point to window#1.</p>
<p>How do I make sure that my grand child window (window#3), can still call the main window (window#1) after window#2 is closed?</p>
| [
{
"answer_id": 240275,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 1,
"selected": false,
"text": "window.opener"
},
{
"answer_id": 240288,
"author": "roenving",
"author_id": 23142,
"author_profile": "ht... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441556/"
] |
240,244 | <p>I want to read line n1->n2 from file foo.c into the current buffer.</p>
<p>I tried: <code>147,227r /path/to/foo/foo.c</code></p>
<p>But I get: "E16: Invalid range", though I am certain that foo.c contains more than 1000 lines.</p>
| [
{
"answer_id": 240262,
"author": "Stewart Johnson",
"author_id": 6408,
"author_profile": "https://Stackoverflow.com/users/6408",
"pm_score": 5,
"selected": false,
"text": ":147,227r /path/to/foo/foo.c\n"
},
{
"answer_id": 240274,
"author": "boxxar",
"author_id": 15732,
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29405/"
] |
240,258 | <p>Ok, I am reading in dat files into a byte array. For some reason, the people who generate these files put about a half meg's worth of useless null bytes at the end of the file. Anybody know a quick way to trim these off the end?</p>
<p>First thought was to start at the end of the array and iterate backwards until I found something other than a null, then copy everything up to that point, but I wonder if there isn't a better way.</p>
<p>To answer some questions:
Are you sure the 0 bytes are definitely in the file, rather than there being a bug in the file reading code? Yes, I am certain of that.</p>
<p>Can you definitely trim all trailing 0s? Yes.</p>
<p>Can there be any 0s in the rest of the file? Yes, there can be 0's other places, so, no, I can't start at the beginning and stop at the first 0.</p>
| [
{
"answer_id": 240289,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "Buffer.BlockCopy"
},
{
"answer_id": 240315,
"author": "Rob",
"author_id": 2595,
"author_profile":... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] |
240,263 | <p>I am putting together some ideas for our automated testing platform and have been looking at Selenium for the test runner.</p>
<p>I am wrapping the recorded Selenium C# scripts in an MbUnit test, which is being triggered via the MbUnit NAnt task. The Selenium test client is created as follows:</p>
<pre><code>selenium = new DefaultSelenium("host", 4444, "*iexplore", "http://[url]/");
</code></pre>
<p>How can I pass the host, port and url settings into the test so their values can be controlled via the NAnt task?</p>
<p>For example, I may have multiple Selenium RC servers listening and I want to use the same test code passing in each server address instead of embedding the settings within the tests themselves.</p>
<p>I have an approach mocked up using a custom NAnt task I have written but it is not the most elegant solution at present and I wondered if there was an easier way to accomplish what I want to do.</p>
<p>Many thanks if anyone can help.</p>
| [
{
"answer_id": 446606,
"author": "Igor Brejc",
"author_id": 55408,
"author_profile": "https://Stackoverflow.com/users/55408",
"pm_score": 1,
"selected": false,
"text": " [FixtureSetUp]\n public virtual void TestFixtureSetup ()\n {\n BrowserType = (BrowserType) Enum.Parse ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31412/"
] |
240,269 | <p>I'm hitting this error and I'm not really sure why. I have a minified version of excanvas.js and something is breaking in IE, specifically on:</p>
<p><code>
var b=a.createStyleSheet();
</code></p>
<p>I'm not sure why. Does anyone have any insight? I can provide more information, I'm just not sure what information will help.</p>
| [
{
"answer_id": 652627,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<html>\n<head>\n<title></title>\n<script>\nfor(var i=0;i<32;i++) {\ndocument.createStyleSheet();\n}\n</script>\n</head>\n<body>... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2484/"
] |
240,293 | <p>How would I achieve the pseudo-code below in JavaScript? I want to include the date check in the second code excerpt, where txtDate is for the BilledDate.</p>
<pre><code>If ABS(billeddate – getdate) > 31 then yesno “The date you have entered is more than a month from today, Are you sure the date is correct,”.
if (txtDate && txtDate.value == "")
{
txtDate.focus();
alert("Please enter a date in the 'Date' field.")
return false;
}
</code></pre>
| [
{
"answer_id": 240337,
"author": "roenving",
"author_id": 23142,
"author_profile": "https://Stackoverflow.com/users/23142",
"pm_score": 3,
"selected": true,
"text": " var myDate = new Date(yearno, monthno-1, dayno);\n //you could put hour, minute, second and milliseconds in this to... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] |
240,294 | <p>I'd like something like a generic, re-usable <code>getPosition()</code> method that will tell me the number of bytes read from the starting point of the stream. Ideally, I would prefer this to work with all InputStreams, so that I don't have to wrap each and every one of them as I get them from disparate sources.</p>
<p>Does such a beast exist? If not, can anyone recommend an existing implementation of a counting <code>InputStream</code>?</p>
| [
{
"answer_id": 240312,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 2,
"selected": false,
"text": "InputStream"
},
{
"answer_id": 240431,
"author": "erickson",
"author_id": 3474,
"author_profile": "https... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] |
240,314 | <p>I use Struts v1.3 and have following input form:</p>
<p>In struts-config.xml:</p>
<pre><code> <form-bean name="testForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="displayName" type="java.lang.String" />
</form-bean>
</code></pre>
<p>In validation.xml:</p>
<pre><code> <form name="testForm">
<field property="displayName" depends="required">
<arg key="input.displayName" />
</field>
</form>
</code></pre>
<p>How do I trim value of "displayName"? How do I trim values of all "java.lang.String" input fields of the form?</p>
| [
{
"answer_id": 263444,
"author": "mana",
"author_id": 12016,
"author_profile": "https://Stackoverflow.com/users/12016",
"pm_score": 2,
"selected": false,
"text": "public void setDisplayName(String displayName) {\n this.displayName = displayName.trim();\n}\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11662/"
] |
240,320 | <p>I have a method that I would like to call. However, I'm looking for a clean, simple way to kill it or force it to return if it is taking too long to execute.</p>
<p>I'm using Java.</p>
<p>to illustrate:</p>
<pre><code>logger.info("sequentially executing all batches...");
for (TestExecutor executor : builder.getExecutors()) {
logger.info("executing batch...");
executor.execute();
}
</code></pre>
<p>I figure the <code>TestExecutor</code> class should <code>implement Callable</code> and continue in that direction.</p>
<p>But all i want to be able to do is stop <code>executor.execute()</code> if it's taking too long.</p>
<p>Suggestions...?</p>
<p><strong>EDIT</strong></p>
<p>Many of the suggestions received assume that the method being executed that takes a long time contains some kind of loop and that a variable could periodically be checked.
However, this is not the case. So something that won't necessarily be clean and that will just stop the execution whereever it is is acceptable.</p>
| [
{
"answer_id": 240396,
"author": "krakatoa",
"author_id": 12223,
"author_profile": "https://Stackoverflow.com/users/12223",
"pm_score": 2,
"selected": false,
"text": "public void testStop(Runnable r) {\n Thread t = new Thread(r);\n t.start();\n try {\n t.join(2000);\n ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20498/"
] |
240,333 | <p>I am trying to quantify "site slowness". In the olden days you just made sure that your HTML was lightweight, images optimized and servers not overloaded. In high end sites built on top of modern content management systems there are a lot more variables: third party advertising, trackers and various other callouts, the performance of CDN (interestingly enough sometimes content delivery networks make things worse), javascript execution, css overload, as well as all kinds of server side issues like long queries.</p>
<p>The obvious answer is for every developer to clear the cache and continuously look at the "net" section of the Firebug plugin. What other ways to measure "site dragging ass" have you used?</p>
| [
{
"answer_id": 241518,
"author": "bh213",
"author_id": 28912,
"author_profile": "https://Stackoverflow.com/users/28912",
"pm_score": 0,
"selected": false,
"text": "ab -c <number of CPUs on server> -n 1000 url"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/556/"
] |
240,341 | <p>I need a date formula in Oracle SQL or T-SQL that will return a date of the previous week (eg Last Monday's date).</p>
<p>I have reports with parameters that are run each week usually with parameter dates mon-friday or sunday-saturday of the previous week. I'd like to not have to type in the dates when i run the reports each week. </p>
<p>The data is in Oracle and I am using SQL Server 2005 Reporting Services (SSRS) for the reports.</p>
| [
{
"answer_id": 240368,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "SELECT \n DateColumn,\n DateColumn - CASE DATEPART(dw, DateColumn) \n WHEN 1 THEN 6\n ELSE... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
240,345 | <p>I have a ClickOnce deployed application I want to launch from VBScript, similar to launching Microsoft Word in the following example:</p>
<pre><code>Dim word
Set word = CreateObject("Word.Application")
word.Visible = True
</code></pre>
<p>The problem is I don't know what parameter to pass into the <code>CreateObject</code> function to launch my application. Where would I find the master list of applications installed on my PC/the shortcut to call to launch them?</p>
| [
{
"answer_id": 265911,
"author": "Jeff",
"author_id": 13338,
"author_profile": "https://Stackoverflow.com/users/13338",
"pm_score": 1,
"selected": false,
"text": " Dim program As New Process\n\n 'Try to run a .Net click-once application\n Try\n Dim shortcut As String = En... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13338/"
] |
240,353 | <p>I'm looking for a way to convert a preprocessor token to a string.</p>
<p>Specifically, I've somewhere got:</p>
<pre><code>#define MAX_LEN 16
</code></pre>
<p>and I want to use it to prevent buffer overrun:</p>
<pre><code>char val[MAX_LEN+1]; // room for \0
sscanf(buf, "%"MAX_LEN"s", val);
</code></pre>
<p>I'm open to other ways to accomplish the same thing, but standard library only.</p>
| [
{
"answer_id": 240361,
"author": "davenpcj",
"author_id": 4777,
"author_profile": "https://Stackoverflow.com/users/4777",
"pm_score": 5,
"selected": false,
"text": "#define VERSION_MAJOR 4\n#define VERSION_MINOR 47\n\n#define VERSION_STRING \"v\" #VERSION_MAJOR \".\" #VERSION_MINOR\n"
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4777/"
] |
240,354 | <p>We have a POST to a PL/SQL database procedure that (a) does some database operations based on the POST parameters and (b) redirects the user to a page showing the results.</p>
<p>The problem is, when the user does a browser "refresh" of the results page, that still has the original request, so it calls the database procedure and resends the parameters. </p>
<p>There are things we can do with saving state so bad things don't happen if the request gets sent in again. But that got me wondering. </p>
<p>Is there a way to tell the browser to set the url to the redirect call, not the original user request? This would probably be in either the redirect itself, or in Javascript on the target page. </p>
| [
{
"answer_id": 240361,
"author": "davenpcj",
"author_id": 4777,
"author_profile": "https://Stackoverflow.com/users/4777",
"pm_score": 5,
"selected": false,
"text": "#define VERSION_MAJOR 4\n#define VERSION_MINOR 47\n\n#define VERSION_STRING \"v\" #VERSION_MAJOR \".\" #VERSION_MINOR\n"
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8051/"
] |
240,382 | <p>I need my .net application to use the .html extension instead of .aspx </p>
<p>I'm converting a php app and there are external applications which depend on that extension to function.</p>
<p>What is the best way to do this?</p>
<p>Thanks</p>
| [
{
"answer_id": 240441,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profile": "https://Stackoverflow.com/users/8220",
"pm_score": 5,
"selected": true,
"text": "<httpHandlers>\n <remove verb=\"*\" path=\"*.html\" />\n <add verb=\"*\" path=\"*.html\" type=\"System.Web.UI.PageH... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2424/"
] |
240,393 | <p>I have the following SQL-statement:</p>
<pre><code>SELECT DISTINCT name FROM log WHERE NOT name = '' AND name LIKE '%.EDIT%';
</code></pre>
<p>It works fine on Postgres (returns all different names from log, which aren't empty and contain the string '.EDIT'). But on Oracle this statement doesn't work. Any idea why?</p>
| [
{
"answer_id": 240418,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 2,
"selected": false,
"text": " SELECT DISTINCT name \n FROM log\n WHERE name LIKE '%.EDIT%';\n"
},
{
"answer_id": 240430,
"author": "Tony Andrew... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] |
240,394 | <p>In normal WebForms scenario, any root-relative URLs (e.g. ~/folder/file.txt) <strong>inside</strong> CSS files such as:</p>
<pre><code>.form { background-image: url(~/Content/Images/form_bg.gif); }
</code></pre>
<p>will automatically get resolved during runtime if I specify</p>
<pre><code><head runat="server">
</code></pre>
<p>In the referencing page.</p>
<p>However, that is no longer happening on an ASP.NET MVC Beta1 website.</p>
<p>Is there a way I could enable this functionality without resorting to hacks or CSS-loader file? Like maybe HttpModules or something?</p>
<p>Or am I not desigining my website correctly? What is supposed to be a good design?</p>
<p>Since original ASP.NET WebForms already has this feature, I'd prefer to utilize any existing functionality if possible. But I don't have much clue.</p>
<p>This web application will be deployed in several environments where the ~ root folder might not be obvious.</p>
<hr>
<p><strong>EDIT:</strong> I mean the url in the file's CONTENT not the file's url itself.</p>
| [
{
"answer_id": 243765,
"author": "Boris Callens",
"author_id": 11333,
"author_profile": "https://Stackoverflow.com/users/11333",
"pm_score": 0,
"selected": false,
"text": "<link href=\"<%=PathHelper.CssUrl(\"FormulaIndex.css\")%>\" rel=\"Stylesheet\" type=\"text/css\"/>\n"
},
{
"... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3055/"
] |
240,411 | <p>In a class diagram, is there a way of specifying that a class is an internal class of another class ? </p>
<p>Or is it considered as a pure implementation choice ? </p>
| [
{
"answer_id": 240460,
"author": "Ray Hayes",
"author_id": 7093,
"author_profile": "https://Stackoverflow.com/users/7093",
"pm_score": 3,
"selected": false,
"text": "OuterClass vs OuterClass::InnerClass\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] |
240,419 | <p>I've got a VB.NET class that is invoked with a context menu extension in Internet Explorer. </p>
<p>The code has access to the object model of the page, and reading data is not a problem. This is the code of a test function...it changes the status bar text (OK), prints the page HTML (OK), changes the HTML by adding a text and prints again the page HTML (OK, in the second pop-up my added text is in the HTML)</p>
<p>But the Internet Explorer window doesn't show it. Where am I doing wrong?</p>
<pre><code>Public Sub CallingTest(ByRef Source As Object)
Dim D As mshtml.HTMLDocument = Source.document
Source.status = "Working..."
Dim H As String = D.documentElement.innerHTML()
MsgBox(H)
D.documentElement.insertAdjacentText("beforeEnd", "ThisIsATest")
H = D.documentElement.outerHTML()
MsgBox(H)
Source.status = ""
End Sub
</code></pre>
<p>The function is called like this from JavaScript: </p>
<pre><code><script>
var EB = new ActiveXObject("MyObject.MyClass");
EB.CallingTest(external.menuArguments);
</script>
</code></pre>
| [
{
"answer_id": 240460,
"author": "Ray Hayes",
"author_id": 7093,
"author_profile": "https://Stackoverflow.com/users/7093",
"pm_score": 3,
"selected": false,
"text": "OuterClass vs OuterClass::InnerClass\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22108/"
] |
240,425 | <p>When I merge the trunk into a feature-branch, a delete that occurred on the trunk will not be replicated to my working copy.</p>
<p>Why will a delete on trunk not delete the same file on a branch when merging?
I'm using subversion 1.5 client and server.</p>
<p>I'm assuming that changes to the file in the branch will be skipped when reintegrating the branch?</p>
<p>What's the best way to redeem the file on trunk, as a colleague deleted the file from trunk only because it was not "ready".</p>
<p>Situation:</p>
<pre><code>cd project; svn copy trunk branches/f1; svn ci -m "branching out" branches f1;
echo "modifying a file on branch." >> branches/f1/file1; svn ci branches/f1 -m "Branch modified";
echo "Above modify is not even needed to state the case";
svn rm trunk/file1; svn ci trunk -m "creating (conflicting) delete on trunk";
cd branches/f1; svn merge svn+ssh://repos/trunk .
[ -f file1 ] && echo "file f1 does exist while it should have been deleted by merge.";
</code></pre>
<p>So, the file still exists in my working copy even though I'm merging in trunk where the file has been actively deleted. Highly unexpected. In my case I haven't even made any changes to the file, which is the only reason i can think of why svn would save the file.</p>
| [
{
"answer_id": 242636,
"author": "JXG",
"author_id": 15456,
"author_profile": "https://Stackoverflow.com/users/15456",
"pm_score": 1,
"selected": false,
"text": "svn status"
},
{
"answer_id": 4337918,
"author": "RjOllos",
"author_id": 121694,
"author_profile": "https:... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/972/"
] |
240,428 | <p>What is people's prefered method of storing application configuration data in a database. From having done this in the past myself, I've utilised two ways of doing it.</p>
<ol>
<li>You can create a table where you store key/value pairs, where key is the name of the config option and value is its value. Pro's of this is adding new values is easy and you can use the same routines to set/get data. Downsides are you have untyped data as the value.</li>
<li>Alternatively, you can hardcode a configuration table, with each column being the name of the value and its datatype. The downside to this is more maintenance setting up new values, but it allows you to have typed data.</li>
</ol>
<p>Having used both, my preferences lie with the first option as its quicker to set things up, however its also riskier and can reduce performance (slightly) when looking up data. Does anyone have any alternative methods?</p>
<p><strong>Update</strong></p>
<p>It's necessary to store the information in a database because as noted below, there may be multiple instances of the program that require configuring the same way, as well as stored procedures potentially using the same values.</p>
| [
{
"answer_id": 241703,
"author": "Tom",
"author_id": 13219,
"author_profile": "https://Stackoverflow.com/users/13219",
"pm_score": 0,
"selected": false,
"text": "CREATE TABLE [dbo].[MyOption] (\n [GUID] uniqueidentifier CONSTRAINT [dfMyOptions_GUID] DEFAULT newsequentialid() ROWGUIDCOL... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29086/"
] |
240,467 | <p>Of course, there are a whole range of possible errors relating to document validity, but my immediate stumbling block occurs when changing a paragraph (<code>p</code>) into an <code>address</code> element. My current method is (more-or-less):</p>
<pre><code>var p = $('p#test');
p.replaceWith('<address>' + p.html() + '</address>');
</code></pre>
<p>but that fails for this specific case; it works perfectly for p -> blockquote or h2 -> h3. Firebug suggests that a self-closing element (<code><address/></code>) has been added to the document, for some reason.</p>
<p>Can anyone spot the bug or suggest an alternative method?</p>
| [
{
"answer_id": 240494,
"author": "Daniel Cassidy",
"author_id": 31662,
"author_profile": "https://Stackoverflow.com/users/31662",
"pm_score": 4,
"selected": true,
"text": "var p = $('p#test');\nvar a = $('<address>').\n append(p.contents());\np.replaceWith(a);\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058/"
] |
240,470 | <p>I want to get user input in one page, store that in a php variable and use it in another php page. I have tried using 'sessions' but it doesn't seem to be working. Is there another safe alternative? This information is likely to be usernames and passwords.</p>
| [
{
"answer_id": 240503,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 5,
"selected": true,
"text": "<?php\nsession_start();\n\nif (isset($_POST['username'], $_POST['password']) {\n $_SESSION['username'] = $_POST['username'];\... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24391/"
] |
240,473 | <p>I have an unsorted list of noisy X, Y points. They do, however, form a path through the world. I would like an algorithm to draw an approximation of this data using line segments.</p>
<p>This is similar to how you would use a line -fitting algorithm to pick an approximation of linear data. My problem is only harder because the path bends and winds around the world.
<a href="http://www.praeclarum.org/so/pathfinder.png">alt text http://www.praeclarum.org/so/pathfinder.png</a></p>
<p>Does anyone know of any standard / robust / easy to comprehend algorithms to accomplish this?</p>
<p><strong>Q&A</strong>:</p>
<p><strong>What do you mean by noisy?</strong> If I had an ideal realization of the path, then my set of points would be sampled from that ideal path with gaussian noise added to the X and Y elements. I do not know the mean or standard deviation of that noise. I may be able to guess at the std dev...</p>
<p><strong>Do the points lie near, but not on, some ideal but complicated path which you seek to approximate?</strong> Yes.</p>
<p><strong>Do you have any a priori information about he shape of the path? Any other way to get such information?</strong> Unfortunately not.</p>
| [
{
"answer_id": 274079,
"author": "Jay Kominek",
"author_id": 32878,
"author_profile": "https://Stackoverflow.com/users/32878",
"pm_score": 1,
"selected": false,
"text": "#lang scheme\n\n(require (only-in srfi/1 iota))\n\n; a bunch of trig\n(define (deg->rad d)\n (* pi (/ d 180)))\n\n(de... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338/"
] |
240,510 | <p>I have a string from an email header, like <code>Date: Mon, 27 Oct 2008 08:33:29 -0700</code>. What I need is an instance of GregorianCalendar, that will represent the same moment. As easy as that -- how do I do it?</p>
<p>And for the fastest ones -- this is <strong>not</strong> going to work properly:</p>
<pre><code>SimpleDateFormat format = ... // whatever you want
Date date = format.parse(myString)
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date)
</code></pre>
<p>because it will normalize the timezone to UTC (or your local machine time, depending on Java version). What I need is calendar.getTimeZone().getRawOffset() to return <code>-7 * milisInAnHour</code>.</p>
| [
{
"answer_id": 240565,
"author": "Jack Leow",
"author_id": 31506,
"author_profile": "https://Stackoverflow.com/users/31506",
"pm_score": 5,
"selected": true,
"text": "DateTimeFormatter formatter =\n DateTimeFormat.forPattern(\"your pattern\").withOffsetParsed();\nDateTime dateTime = f... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3105/"
] |
240,531 | <p>I have a weird date rounding problem that hopefully someone can solve. My client uses a work week that runs from Monday through Sunday. Sunday's date is considered the end of the week, and is used to identify all records entered in a particular week (so anything entered last week would have a WEEKDATE value of '10/26/2008', which is Sunday's date).</p>
<p>One little twist is that users enter records for the previous week up until 11 AM on the Monday of the current week.</p>
<p>So I need a function that starts with DateTime.Now and returns the week-ending date (no time part) according to the rules above. Thanks for your help. I have a solution that works, but I'm too embarassed to post it.</p>
<p>Oh, and I can't use LINQ.</p>
| [
{
"answer_id": 240560,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 3,
"selected": true,
"text": "public DateTime WeekNum(DateTime now)\n{\n DateTime NewNow = now.AddHours(-11).AddDays(6);\n\n return (NewNow.Ad... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14606/"
] |
240,537 | <p>Does anyone know of a simple web app that supports running ant tasks? Alternatively it could run command line programs. I need to allow the user to choose parameters for running the ant task. I effectively want a web interface to run the ant task and provide any parameters.</p>
<p>I can write one but this is generic enough that it seems like there should already be a few standard packages that do this.</p>
| [
{
"answer_id": 240558,
"author": "jakber",
"author_id": 29812,
"author_profile": "https://Stackoverflow.com/users/29812",
"pm_score": 0,
"selected": false,
"text": "echo shell_exec('ant');\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6770/"
] |
240,544 | <p>I have the following rails migration:</p>
<pre><code>create_table :articles do |t|
t.integer :user_id, :allow_null => false
t.integer :genre_id, :allow_null => false
t.string :url, :limit => 255, :allow_null => false
t.string :title, :limit => 60, :allow_null => false
t.text :summary, :limit => 350, :allow_null => false
t.integer :votes_count, :default => 0
t.datetime :published_at, :default => nil
t.timestamps
end
</code></pre>
<p>All the fields that are "NOT NULL" are validated in the model first, so I'm wondering if I need to bother having allow_null in the migration? I'm not sure what benefits "NOT NULL" gives to the database, if any.</p>
| [
{
"answer_id": 240556,
"author": "Daniel Spiewak",
"author_id": 9815,
"author_profile": "https://Stackoverflow.com/users/9815",
"pm_score": 5,
"selected": true,
"text": "NULL"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31810/"
] |
240,546 | <p>Is there a good way to remove HTML from a Java string? A simple regex like</p>
<pre class="lang-js prettyprint-override"><code>replaceAll("\\<.*?>", "")
</code></pre>
<p>will work, but some things like <code>&amp;</code> won't be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the <code>.*?</code> in the regex will disappear).</p>
| [
{
"answer_id": 240630,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 7,
"selected": false,
"text": "<b>hey!</b>"
},
{
"answer_id": 241757,
"author": "foxy",
"author_id": 30119,
"author_profile": "... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8973/"
] |
240,582 | <p>I have tried the following two statements:</p>
<ul>
<li><code>SELECT col FROM db.tbl WHERE col (LIKE 'str1' OR LIKE 'str2') AND col2 = num</code> results in a syntax error</li>
<li><code>SELECT col FROM db.tbl WHERE page LIKE ('str1' OR 'str2') AND col2 = num</code> results in "Truncated incorrect DOUBLE value: str1" and "Truncated incorrect DOUBLE value: str2" for what looks like every result. However, no results are actually returned.</li>
</ul>
<p>I figured one of the two statements would work, but they aren't.</p>
| [
{
"answer_id": 240585,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 7,
"selected": true,
"text": "SELECT col FROM db.tbl WHERE (col LIKE 'str1' OR col LIKE 'str2') AND col2 = num\n"
},
{
"answer_id": 240589,
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
240,592 | <p>I'm working on a fiddly web interface which is mostly built with JavaScript. Its basically one (very) large form with many sections. Each section is built based on options from other parts of the form. Whenever those options change the new values are noted in a "registry" type object and the other sections re-populate accordingly.</p>
<p>Having event listeners on the many form fields is starting to slow things down, and refreshing the whole form for each change would be too heavy/slow for the user.</p>
<p>I'm wondering whether its possible to add listeners to the registry object's attributes rather than the form elements to speed things up a bit? And, if so, could you provide/point me to some sample code?</p>
<p>Further information:</p>
<ul>
<li>This is a plug-in for jQuery, so any functionality I can build-on from that library would be helpful but not essential.</li>
<li>Our users are using IE6/7, Safari and FF2/3, so if it is possible but only for "modern" browsers I'll have to find a different solution.</li>
</ul>
| [
{
"answer_id": 240663,
"author": "Ken",
"author_id": 20074,
"author_profile": "https://Stackoverflow.com/users/20074",
"pm_score": 2,
"selected": false,
"text": "$('body').change(function(event){\n /* do whatever you want with event.target here */\n console.debug(event.target); /* ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30478/"
] |
240,648 | <p>I am trying to do a search in my Eclipse (Java) workspace to find all instances of static variables that are not final.</p>
<p>I tried various regexes but they do not result in any matches. Can someone suggest a regex that will match all lines containing <code>static</code> and not containing <code>final</code>, and not ending in a <code>{</code>?</p>
<p>The last part about not ending with a <code>{</code> will eliminate static methods.</p>
<p>An example:</p>
<pre><code>public class FlagOffendingStatics {
private static String shouldBeFlagged = "not ok";
private static final String ok = "this is fine";
public static void methodsAreOK() {
}
}
</code></pre>
| [
{
"answer_id": 240687,
"author": "a2800276",
"author_id": 27408,
"author_profile": "https://Stackoverflow.com/users/27408",
"pm_score": 2,
"selected": false,
"text": "grep -r static . | grep -v final"
},
{
"answer_id": 240848,
"author": "matt b",
"author_id": 4249,
"a... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31837/"
] |
240,659 | <p>I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way?</p>
| [
{
"answer_id": 241430,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https://Stackoverflow.com/users/6760",
"pm_score": 3,
"selected": true,
"text": "post_save"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7437/"
] |
240,660 | <p>I have an associative array in the form <code>key => value</code> where key is a numerical value, however it is not a sequential numerical value. The key is actually an ID number and the value is a count. This is fine for most instances, however I want a function that gets the human-readable name of the array and uses that for the key, without changing the value.</p>
<p>I didn't see a function that does this, but I'm assuming I need to provide the old key and new key (both of which I have) and transform the array. Is there an efficient way of doing this?</p>
| [
{
"answer_id": 240673,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 4,
"selected": false,
"text": "echo 'Widgets: ' . $data[$humanreadbleMapping['Widgets']];\n"
},
{
"answer_id": 240676,
"author": "KernelM",
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
240,661 | <p>Do you think changing directories inside bash or Perl scripts is acceptable? Or should one avoid doing this at all costs?</p>
<p>What is the best practice for this issue?</p>
| [
{
"answer_id": 240703,
"author": "Hugo",
"author_id": 972,
"author_profile": "https://Stackoverflow.com/users/972",
"pm_score": 5,
"selected": true,
"text": "alias build-product1='(cd $working-copy/delivery; mvn package;)'\n"
},
{
"answer_id": 241489,
"author": "Schwern",
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13523/"
] |
240,692 | <p>I am trying to download an xml.gz file from a remote server with HttpsURLConnection in java, but I am getting an empty response. Here is a sample of my code:</p>
<pre><code>URL server = new URL("https://www.myurl.com/path/sample_file.xml.gz");
HttpsURLConnection connection = (HttpsURLConnection)server.openConnection();
connection.connect();
</code></pre>
<p>When I try to get an InputStream from the connection, it is empty. (If I try connection.getInputStream().read() I get -1) The file I am expecting is approximately 50MB. </p>
<p>To test my sanity, I aslo tried entering the exact same url in my browser, and it did return the file I needed. Am I missing something? Do I have to set some sort of parameter in the connection? Any help/direction is much appreciated. </p>
| [
{
"answer_id": 240871,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 2,
"selected": false,
"text": "response code"
},
{
"answer_id": 244318,
"author": "Zakir Hemraj",
"author_id": 29752,
"author_profil... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29752/"
] |
240,704 | <p>Does anyone have any suggestions for a good approach to finding all the CPAN dependencies that might have arisen in a bespoke development project. As tends to be the case your local development environment rarely matches your live one and as you build more and more projects you tend to build up a local library of installed modules. These then lead to you not necessarily noticing that your latest project has a requirement on a non-core module. As there is generally a requirement to package the entire project up for deployment to another group (in our case our operations team), it is important to know what modules should be included in the package. </p>
<p>Does anyone have any insights into the problem.</p>
<p>Thanks</p>
<p>Peter</p>
| [
{
"answer_id": 240723,
"author": "Vagnerr",
"author_id": 3720,
"author_profile": "https://Stackoverflow.com/users/3720",
"pm_score": 3,
"selected": false,
"text": "perl -d:Modlist script.pl\n"
},
{
"answer_id": 240927,
"author": "KeyserSoze",
"author_id": 14116,
"auth... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3720/"
] |
240,713 | <p>I need to encrypt and decrypt a querystring in ASP.NET. </p>
<p>The querystring might look something like this:</p>
<blockquote>
<p><a href="http://www.mysite.com/report.aspx?id=12345&year=2008" rel="noreferrer">http://www.mysite.com/report.aspx?id=12345&year=2008</a></p>
</blockquote>
<p>How do I go about encrypting the entire querystring so that it looks something like the following?</p>
<blockquote>
<p><a href="http://www.mysite.com/report.aspx?crypt=asldjfaf32as98df8a" rel="noreferrer">http://www.mysite.com/report.aspx?crypt=asldjfaf32as98df8a</a></p>
</blockquote>
<p>And then, of course, how to I decrypt it? What's the best encryption to use for something like this? TripleDES?</p>
| [
{
"answer_id": 240730,
"author": "swilliams",
"author_id": 736,
"author_profile": "https://Stackoverflow.com/users/736",
"pm_score": 0,
"selected": false,
"text": "crypt"
},
{
"answer_id": 240751,
"author": "Brian Schmitt",
"author_id": 30492,
"author_profile": "https... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7072/"
] |
240,719 | <p>I'm running SQL Server 2000 and I need to export the SQL Statement from all the DTS objects so that they can be parsed and put into a wiki documentation if needed. </p>
<p>Is there a way to do that?</p>
<p>maybe dumping each DTS object out into a text file with the object name as the file name with the name of the process and the date it was extracted as a file header.</p>
<p>thanks.</p>
| [
{
"answer_id": 1070447,
"author": "eksortso",
"author_id": 446456,
"author_profile": "https://Stackoverflow.com/users/446456",
"pm_score": 2,
"selected": true,
"text": "outExt"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] |
240,721 | <p>Has anyone used jQuery to populate an autocomplete list on a textbox using ASP.NET webforms? If so, can anyone recommend a good method? From my reading so far, it seems like most people are using delimited lists rather than JSON to bring the items back. I'm open to any ideas that will get me up and running rather quickly. </p>
| [
{
"answer_id": 240882,
"author": "Pablo",
"author_id": 22696,
"author_profile": "https://Stackoverflow.com/users/22696",
"pm_score": 2,
"selected": true,
"text": "<BR/>"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] |
240,725 | <p>I have OS X 10.5 set up with the precompiled versions of PHP 5 and Apache 2. I'm trying to set up the Zend Debugger, but with no luck. Here's what I did:</p>
<ul>
<li>I downloaded <code>ZendDebugger-5.2.14-darwin8.6-uni.tar</code></li>
<li>I created the directory <code>/Developer/Extras/PHP</code> and set the permissions to:
<ul>
<li>Permissions: <code>drwxrwxr-x</code></li>
<li>Owner: <code>root:admin</code></li>
</ul></li>
<li>I copied <code>ZendDebugger.so</code> from the <code>5_2_x_comp</code> directory to <code>/Developer/Extras/PHP</code></li>
<li><p>I updated <code>/etc/php.ini</code> file, adding the following lines:</p>
<pre><code>zend_extension=/Developer/Extras/PHP/ZendDebugger.so
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
zend_debugger.allow_hosts=127.0.0.1
</code></pre></li>
<li><p>I restarted Apache via the System Preferences "Sharing" panel</p></li>
</ul>
<p>When I run <code>phpinfo()</code> within a PHP file, I get no mention of the Zend Debugger. When I run <code>php -m</code> from the command line, it shows the Zend Debugger is loaded. Both state that they're running the same version of PHP, and loading the same INI file.</p>
<p>Anyone have another suggestion for me to try?</p>
| [
{
"answer_id": 270352,
"author": "inxilpro",
"author_id": 12549,
"author_profile": "https://Stackoverflow.com/users/12549",
"pm_score": 1,
"selected": false,
"text": "do shell script \"apachectl stop\" with administrator privileges\ndo shell script \"arch -i386 /usr/sbin/httpd\" with adm... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12549/"
] |
240,755 | <p>I have to create the sin function from scratch in my Comp Sci class, and I am getting close to a solution. However, I am still having a few problems. If I put in a value of .5PI or less it works, but otherwise I get the incorrect result. Here is the code I have so far:</p>
<pre><code>double i=1;
double sinSoFar = 0;
int term = 1;
while(i >= .000001)
{
i = pow(-1, term + 1) * pow(sinOf, 2*term-1) / factorial(2*term-1);
sinSoFar=sinSoFar + i;
term++;
}
</code></pre>
| [
{
"answer_id": 240859,
"author": "Luiz Fernando Penkal",
"author_id": 4355,
"author_profile": "https://Stackoverflow.com/users/4355",
"pm_score": 4,
"selected": true,
"text": "public static long factorial(long n) {\n if (n < 0) throw new RuntimeException(\"Underflow error in... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31665/"
] |
240,764 | <p>I have seen some websites use the following tag:</p>
<pre><code><meta type="title" content="Title of the page" />
</code></pre>
<p>Is it needed when you have a <code><title></code>?</p>
<p>Also, what's the best formatting for a page title? Some ideas:</p>
<ul>
<li>Page Description :: Company Name</li>
<li>Page Description - Company Name</li>
<li>Page Description <> Company Name</li>
<li>Company Name: Page Description</li>
<li>...</li>
</ul>
<p>Does it matter to Google/Yahoo/etc? Do you include the company name or a general description of the site in the title on every page? </p>
| [
{
"answer_id": 240867,
"author": "Leandro López",
"author_id": 22695,
"author_profile": "https://Stackoverflow.com/users/22695",
"pm_score": 2,
"selected": false,
"text": "<title>"
},
{
"answer_id": 404992,
"author": "cowgod",
"author_id": 6406,
"author_profile": "htt... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] |
240,765 | <p>I've got a lot of similar oracle jobs I need to create, and I'd like to do it programatically. </p>
<p>Where does the Oracle store the job library (schema/table)?</p>
<p>(yes, I know I might be running with scissors)</p>
| [
{
"answer_id": 240943,
"author": "Leigh Riffel",
"author_id": 27010,
"author_profile": "https://Stackoverflow.com/users/27010",
"pm_score": 4,
"selected": true,
"text": "dbms_job.submit(\nJOB OUT BINARY_INTEGER,\nWHAT IN VARCHAR2,\nNEXT_DATE IN DATE DEFAULT SYSDATE... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685/"
] |
240,774 | <p>I'm having a small problem in Java. I have an interface called Modifiable. Objects implementing this interface are Modifiable.</p>
<p>I also have a ModifyCommand class (with the Command pattern) that receive two Modifiable objects (to swap them in a list further on - that's not my question, I designed that solution already).</p>
<p>The ModifyCommand class starts by making clones of the Modifiable objects. Logically, I made my Modifiable interface extends Cloneable. The interface then defines a clone() method that its implementing classes must redefine.</p>
<p>Then, in ModifyCommand, I can do : firstModifiableObject.clone(). My logic is that classes implementing Modifiable will have to redefine the clone method from Object, as they will be Cloneable (that's what I want to do).</p>
<p>The thing is, when I define classes implements Modifiable and I want to override clone(), it won't let me, stating that the clone() method from the Object class hides the one from Modifiable.</p>
<p>What should I do? I'm under the impression that "I'm doing it wrong"...</p>
<p>Thanks,</p>
<p>Guillaume.</p>
<p>Edit : it think I will forget the clone() thing. I will either a) assume that the object passed to the Modifiable object (implementing the interface) is already cloned or b) make another method called, for example, copy(), that would basically do a deep-copy of the Modifiable object (or maybe the Generic solution will work...).</p>
| [
{
"answer_id": 240806,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 0,
"selected": false,
"text": "public Object clone() throws CloneNotSupportedException {\n return super.clone();\n}\n"
},
{
"answer_id":... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10687/"
] |
240,777 | <p>I've got a series of GIFs that I need to crop on the fly, I'm using a HTTP Handler in C# so I can better encapsulate the code - provide caching for the result etc.</p>
<p>Currently, when I draw the existing image to a new <code>Image</code> via the <code>Graphics</code> object all the transparency is lost.</p>
<p>I've tried various techniques to try and maintain the transparency, but to no avail.</p>
<p>Things I've tried:</p>
<ul>
<li>Using the <code>MakeTransparent (Color)</code> method call</li>
<li>Using the <code>ImageAttriutes</code> with a combination of <code>ColorMap</code> and <code>SetColorKey</code></li>
</ul>
<p>I don't really want to start using unsafe operators or Win32 calls.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 240939,
"author": "Ash",
"author_id": 31128,
"author_profile": "https://Stackoverflow.com/users/31128",
"pm_score": 0,
"selected": false,
"text": "Bitmap"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] |
240,778 | <p>I have a 4 side convex Polygon defined by 4 points in 2D, and I want to be able to generate random points inside it.</p>
<p>If it really simplifies the problem, I can limit the polygon to a parallelogram, but a more general answer is preferred.</p>
<p>Generating random points until one is inside the polygon wouldn't work because it's really unpredictable the time it takes.</p>
| [
{
"answer_id": 240790,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 6,
"selected": true,
"text": "u"
},
{
"answer_id": 240793,
"author": "wprl",
"author_id": 17847,
"author_profile": "https://Stackover... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1815/"
] |
240,788 | <p>Can I call a stored procedure in Oracle via a database link?</p>
<p>The database link is functional so that syntax such as...</p>
<pre><code>SELECT * FROM myTable@myRemoteDB
</code></pre>
<p>is functioning. But is there a syntax for...</p>
<pre><code>EXECUTE mySchema.myPackage.myProcedure('someParameter')@myRemoteDB
</code></pre>
| [
{
"answer_id": 240798,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 7,
"selected": true,
"text": "EXEC mySchema.myPackage.myProcedure@myRemoteDB( 'someParameter' );\n"
},
{
"answer_id": 9313996,
"author": ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13930/"
] |
240,836 | <p>I'm currently working on a project where a section of the code looks like this:</p>
<pre><code>Select Case oReader.Name
Case "NameExample1"
Me.Elements.NameExample1.Value = oReader.ReadString
' ...
Case "NameExampleN"
Me.Elements.NameExampleN.Value = oReader.ReadString
' ...
End Select
</code></pre>
<p>It continues on for a while. The code is obviously verbose and it <em>feels</em> like it could be improved. Is there any way to dynamically invoke a property in VB.NET such that something like this can be done:</p>
<pre><code>Dim sReadString As String = oReader.ReadString
Me.Elements.InvokeProperty(sReadString).Value = sReadString
</code></pre>
| [
{
"answer_id": 241143,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "Dictionary<string, PropertyInfo>"
},
{
"answer_id": 15602458,
"author": "Jet",
"author_id": 1906044,
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20/"
] |
240,850 | <p>I am having an issue when using <code>LoadControl( type, Params )</code>. Let me explain...</p>
<p>I have a super simple user control (ascx)</p>
<pre><code><%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %>
<asp:Label runat="server" ID="lblTitle" />
<asp:Label runat="server" ID="lblDescription" />
</code></pre>
<p>with code ( c# ) behind of:</p>
<pre><code>public partial class ErrorDisplay : System.Web.UI.UserControl
{
private Message _ErrorMessage;
public ErrorDisplay()
{
}
public ErrorDisplay(Message ErrorMessage)
{
_ErrorMessage = ErrorMessage;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (_ErrorMessage != null)
{
lblTitle.Text = _ErrorMessage.Message;
lblDescription.Text = _ErrorMessage.Description;
}
}
}
</code></pre>
<p>Elsewhere in my web application I am adding an instance of the usercontrol to the page using the following code:</p>
<pre><code>divValidationIssues.Controls.Add(LoadControl(typeof(ErrorDisplay), new object[] { MessageDetails }));
</code></pre>
<p>I am using the overloaded version of LoadControl because I want to pass the Message parameter to the constructor. All this <em>appears</em> to work ok.</p>
<p>However, when the <code>OnPreRender()</code> is fired on the ErrorDisplay usercontrol the lblTitle and lblDescription variables are both <code>null</code>, despite them having a markup equivalent. The message variable has been correctly populated.</p>
<p>Can anyone shed any light on why this may be happening?</p>
<p>Thanks</p>
<p><strong>EDIT:</strong></p>
<p>Just for clarity I'll also add that the code which is programatically adding the usercontrol to the page is running in response to a button press, so the 'hosting page' has progressed through Init, Page_Load and is now processing the event handlers.</p>
<p>I cannot add the usercontrols at an earlier asp lifecycle stage as they are being created in response to a button click event.</p>
| [
{
"answer_id": 240998,
"author": "Ash",
"author_id": 31128,
"author_profile": "https://Stackoverflow.com/users/31128",
"pm_score": 6,
"selected": true,
"text": "protected void Page_Load(object sender, EventArgs e)\n{\n if (_ErrorMessage != null)\n {\n lblTitle.Text = _ErrorM... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31128/"
] |
240,863 | <p>So in a .NET app , i got about 2 million items that i need to hold them in memory for processing , 1 by 1, would holding these items in a Stack collection , is better than holding them in a List collection, assuming that the memory used by the stack object will be keep minimizing every time an item is poped out of the stack object , or the memory allocated by the stack will keep the same till the stack is set to null, or cleared.</p>
<p>sorry if i couldn't express the question in the right way.. but here is another way, when a Stack collection is used, does the memory used by the stack get minimized every time an item is pulled out of the stack.</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 240870,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "Stack<T>"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/240863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20006/"
] |
240,874 | <p>When you have a derived class, is there an simpler way to refer to a variable from a method other than:</p>
<pre><code>BaseClass::variable
</code></pre>
<p><strong>EDIT</strong>
<br>As it so happens, I found a page that explained this issue using functions instead:
<a href="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.19" rel="nofollow noreferrer">Template-Derived-Classes Errors</a>. Apparently it makes a difference when using templates classes.</p>
| [
{
"answer_id": 240881,
"author": "Dima",
"author_id": 13313,
"author_profile": "https://Stackoverflow.com/users/13313",
"pm_score": 4,
"selected": true,
"text": "\nclass Base\n{\nprotected:\n int a;\n\nprivate:\n int b;\n};\n\nclass Derived : public Base\n{\n void foo()\n {\n a = ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73/"
] |
240,876 | <p>I have this code</p>
<pre><code>#include <iostream>
using namespace std;
int main(int argc,char **argv) {
unsigned long long num1 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995LL;
unsigned long long num2 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996LL;
unsigned long long num3 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997LL;
unsigned long long num4 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998LL;
unsigned long long num5 = 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999LL;
cout << (unsigned long long)(num1 * num2 * num3 * num4 * num5) << endl;
return 0;
}
</code></pre>
<p>As you can see the numbers are enormous, but when I do the math there I get this:
18446744073709551496</p>
<p>At compile time I get these warnings:</p>
<pre><code>warning: integer constant is too large for its type|
In function `int main(int, char**)':|
warning: this decimal constant is unsigned only in ISO C90|
...
</code></pre>
| [
{
"answer_id": 241116,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 2,
"selected": false,
"text": "stringToBigUnsigned"
},
{
"answer_id": 12458092,
"author": "Anshul garg",
"author_id": 692846,
"author_p... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] |
240,887 | <p>I'm getting a whole bunch of linker errors in Visual studios for methods I'm not even calling directly. I'm a java developer by day, but I have a project I need to do in C++, intended to run on windows machines. Hence, I'm stuck messing about with Visual Studio.</p>
<p>Bascally, I have an os project that I added an accessor method to. I compiled that project as a .lib file (compiles and links fine). </p>
<p>I then have my own project that uses that lib. I've included the library under Project->Properties -> Linker -> Input, and set the appropriate directory in the General -> Additional Lib Directories. I've included the header in the appropriate file, and I'm simply calling the constructor of one of the classes...not even calling the method that I created yet.</p>
<p>The code compiles, but I get the following mountain of linker errors -- mostly LNK2019 and LNK2001 errors. I've tried recompiling under different settings (lib, exe, etc.), and the linker errors only seem to multiply. When I switch back to the previous settings, the number of errors remain at their peak. Any ideas how to fix this?</p>
<p>Build Log</p>
<blockquote>
<p>Build started: Project: SpamCapture, Configuration: Debug|Win32</p>
</blockquote>
<p>Command Lines:</p>
<blockquote>
<p>Creating temporary file "c:\SpamCapture\SpamCapture\SpamCapture\Debug\RSP0000103081740.rsp" with contents
[
/VERBOSE:LIB /OUT:"C:\SpamCapture\SpamCapture\SpamCapture\Debug\SpamCapture.exe" /INCREMENTAL /LIBPATH:"C:\SpamCapture\Config\Debug\" /MANIFEST /MANIFESTFILE:"Debug\SpamCapture.exe.intermediate.manifest" /NODEFAULTLIB:"libcmtd.lib" /NODEFAULTLIB:"nafxcwd.lib" /DEBUG /PDB:"c:\SpamCapture\SpamCapture\SpamCapture\Debug\SpamCapture.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 KeyCapture_Config.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib</p>
<p>".\Debug\Interaction.obj"</p>
<p>".\Debug\InteractionSet.obj"</p>
<p>".\Debug\LogReader.obj"</p>
<p>".\Debug\SpamCapture.obj"</p>
<p>".\Debug\stdafx.obj"</p>
<p>".\Debug\SpamCapture.res"</p>
<p>".\Debug\SpamCapture.exe.embed.manifest.res"
]
Creating command line "link.exe @c:\SpamCapture\SpamCapture\SpamCapture\Debug\RSP0000103081740.rsp /NOLOGO /ERRORREPORT:PROMPT"</p>
</blockquote>
<p>Output Window:</p>
<blockquote>
<p>Linking...
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
Searching libraries
Searching C:\SpamCapture\Config\Debug\KeyCapture_Config.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbccp32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\msvcprtd.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\MSVCRTD.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\mfc80ud.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\mfcs80ud.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\msimg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shlwapi.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\atlsd.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\wininet.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mswsock.lib:
Searching C:\SpamCapture\Config\Debug\KeyCapture_Config.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbccp32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\msvcprtd.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\MSVCRTD.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\mfc80ud.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\mfcs80ud.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\msimg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shlwapi.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\lib\atlsd.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\wininet.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mswsock.lib:
Searching C:\SpamCapture\Config\Debug\KeyCapture_Config.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\kernel32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbc32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbccp32.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\msvcprtd.lib:
Finished searching libraries</p>
</blockquote>
<p>Linker Errors start here:</p>
<blockquote>
<p>KeyCapture_Config.lib(KeyCapture_ConfigDlg.obj) : error LNK2001: unresolved external
symbol "public: virtual int __thiscall CWnd::Create(char const *,char const *,unsigned
long,struct tagRECT const &,class CWnd *,unsigned int,struct CCreateContext *)"
(?Create@CWnd@@UAEHPBD0KABUtagRECT@@PAV1@IPAUCCreateContext@@@Z)</p>
</blockquote>
<p>... a bunch more like this</p>
<blockquote>
<p>KeyCapture_Config.lib(KeyCapture_ConfigDlg.obj) : error LNK2019: unresolved external
symbol "public: struct HICON__ * <strong>thiscall CWinApp::LoadIconA(unsigned int)const "
(?LoadIconA@CWinApp@@QBEPAUHICON</strong>@@I@Z) referenced in function "public: __thiscall
CKeyCapture_ConfigDlg::CKeyCapture_ConfigDlg(class CWnd *)"
(??0CKeyCapture_ConfigDlg@@QAE@PAVCWnd@@@Z)</p>
</blockquote>
<p>...a bunch more like this</p>
<blockquote>
<p>(?DoDataExchange@SetupDialog@@MAEXPAVCDataExchange@@@Z)
C:\SpamCapture\SpamCapture\SpamCapture\Debug\SpamCapture.exe : fatal error LNK1120: 34 unresolved externals</p>
</blockquote>
<p>Results:</p>
<blockquote>
<p>Build log was saved at "file://c:\SpamCapture\SpamCapture\SpamCapture\Debug\BuildLog.htm"
SpamCapture - 44 error(s), 1 warning(s)</p>
</blockquote>
| [
{
"answer_id": 241047,
"author": "Rodney Schuler",
"author_id": 6188,
"author_profile": "https://Stackoverflow.com/users/6188",
"pm_score": 0,
"selected": false,
"text": "#pragma comment(lib, \"nafxcwd.lib\")\n"
},
{
"answer_id": 241137,
"author": "ChrisN",
"author_id": 3... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13825/"
] |
240,903 | <p>I'm looking for a library that can deal with RDF and OWL data.</p>
<p>So far I have found:</p>
<ul>
<li><a href="http://razor.occams.info/code/semweb/" rel="nofollow noreferrer">semweb</a> (no owl support for all I know)</li>
<li><a href="http://rowlex.nc3a.nato.int/HowToUse.aspx" rel="nofollow noreferrer">rowlex</a> (more of a 'browser' application)</li>
</ul>
<p>Your recommendations:</p>
<ul>
<li><a href="https://code.google.com/p/linqtordf/" rel="nofollow noreferrer">LinqToRdf</a> (very interesting, thanks mark!)</li>
</ul>
| [
{
"answer_id": 545739,
"author": "Mr. Lame",
"author_id": 24451,
"author_profile": "https://Stackoverflow.com/users/24451",
"pm_score": 5,
"selected": true,
"text": " RdfDocument rdfDoc = new RdfDocument();\n Car car = new Car(\"myCarUri\", rdfDoc);\n Vehicle vehicle = car; // i... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13466/"
] |
240,946 | <p>I want my WPF ComboBox's ItemsSource property to be bound to MyListObject's MyList property. The problem is that when I update the MyList property in code, the WPF ComboBox is not reflecting the update. I am raising the PropertyChanged event after I perform the update, and I thought WPF was supposed to automatically respond by updating the UI. Am I missing something? </p>
<p>Here's the CLR object:</p>
<pre><code>Imports System.ComponentModel
Public Class MyListObject
Implements INotifyPropertyChanged
Private _mylist As New List(Of String)
Public Sub New()
_mylist.Add("Joe")
_mylist.Add("Steve")
End Sub
Public Property MyList() As List(Of String)
Get
Return _mylist
End Get
Set(ByVal value As List(Of String))
_mylist = value
End Set
End Property
Public Sub AddName(ByVal name As String)
_mylist.Add(name)
NotifyPropertyChanged("MyList")
End Sub
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
End Sub
Public Event PropertyChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.PropertyChangedEventArgs) _
Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
End Class
</code></pre>
<p>Here is the XAML:</p>
<pre><code><Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300"
xmlns:local="clr-namespace:WpfApplication1"
>
<Window.Resources>
<ObjectDataProvider x:Key="MyListObject" ObjectType="{x:Type local:MyListObject}"/>
</Window.Resources>
<Grid>
<ComboBox Height="23"
Margin="24,91,53,0"
Name="ComboBox1"
VerticalAlignment="Top"
ItemsSource="{Binding Path=MyList, Source={StaticResource MyListObject}}"
/>
<TextBox Height="23"
Margin="24,43,134,0"
Name="TextBox1"
VerticalAlignment="Top" />
<Button Height="23"
HorizontalAlignment="Right"
Margin="0,43,53,0"
Name="btn_AddName"
VerticalAlignment="Top"
Width="75">Add</Button>
</Grid>
</Window>
</code></pre>
<p>And here's the simple code-behind:</p>
<pre><code>Class Window1
Private obj As New MyListObject
Private Sub btn_AddName_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) _
Handles btn_AddName.Click
obj.AddName(TextBox1.Text)
End Sub
End Class
</code></pre>
<p>Thanks!</p>
| [
{
"answer_id": 240983,
"author": "Aaron Fischer",
"author_id": 5618,
"author_profile": "https://Stackoverflow.com/users/5618",
"pm_score": 3,
"selected": true,
"text": "Private obj As New MyListObject\n"
},
{
"answer_id": 240991,
"author": "Chris Porter",
"author_id": 134... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] |
240,948 | <p>I'm working on a small app where I can generate a list of barcodes. I have the correct fonts installed on my computer. Right now I am printing them directly to a webpage and it works properly in Chrome and IE 7, but not Firefox. Does anyone know what Firefox would be doing differently than IE and Chrome?</p>
<p>Here is my code:</p>
<pre><code><html>
<head>
<title>Barcode Font Test</title>
<style type="text/css" media="screen">
.barcode { font-family: "wasp 39 m", verdana, calibri; font-size: 36pt; }
</style>
</head>
<body>
<div class="barcode">*574656*</div>
</body>
</html>
</code></pre>
<p><strong>EDIT:</strong>
I probably should have mentioned that this is more of a personal project at the moment and not meant to be released to the world. While I will take a solution that works, I would like something that does not involve Javascript/Flash/etc.</p>
| [
{
"answer_id": 241468,
"author": "Doug L.",
"author_id": 19179,
"author_profile": "https://Stackoverflow.com/users/19179",
"pm_score": 3,
"selected": false,
"text": "<IMG>"
},
{
"answer_id": 61853068,
"author": "broc.seib",
"author_id": 516910,
"author_profile": "http... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444511/"
] |
240,949 | <p>I have a set of templates for emails that my app sends out. The templates have codes embedded in them that correspond to properties of my business object. </p>
<p>Is there a more elegant way than calling </p>
<pre><code>string.Replace("{!MyProperty!}", item.MyProperty.ToString())
</code></pre>
<p>a zillion times? Maybe XMLTransform, regular expressions, or some other magic? I'm using C# 3.5 .</p>
| [
{
"answer_id": 240973,
"author": "Wim",
"author_id": 30874,
"author_profile": "https://Stackoverflow.com/users/30874",
"pm_score": 1,
"selected": false,
"text": "string.Replace"
},
{
"answer_id": 241170,
"author": "Markus Jarderot",
"author_id": 22364,
"author_profile... | 2008/10/27 | [
"https://Stackoverflow.com/questions/240949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
241,003 | <p>Is there some way to get a value from the last inserted row?</p>
<p>I am inserting a row where the PK will automatically increase, and I would like to get this PK. Only the PK is guaranteed to be unique in the table.</p>
<p>I am using Java with a JDBC and PostgreSQL.</p>
| [
{
"answer_id": 241016,
"author": "svrist",
"author_id": 86,
"author_profile": "https://Stackoverflow.com/users/86",
"pm_score": 3,
"selected": false,
"text": "currval(sequence)\n"
},
{
"answer_id": 241019,
"author": "BradC",
"author_id": 21398,
"author_profile": "http... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26567/"
] |
241,009 | <p>In a Visual Basic project, I created a homemade TabControl in order to fix a visual bug. The control works properly, however whenever I modify the form using my tab, Visual Studio adds MyProject in front of the control in its declaration:</p>
<pre><code>Me.tabMenu = New MyProject.MyClass 'Gives a BC30002 compile error
</code></pre>
<p>If I remove the <code>MyProject.</code>, the project compiles properly.</p>
<p>MyClass is in a separate file MyClass.vb and looks mostly like this:</p>
<pre><code>Public Class MyClass
Inherits System.Windows.Forms.TabControl
Public Sub New()
InitializeComponent()
MyBase.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed
End Sub
Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs)
//OnDrawItem code
End Sub
Private Sub My_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
//My_DrawItem code
End Sub
End Class
</code></pre>
<p>I tried removing the file and adding it again, copy and pasting the class inside <code>MyForm.designer.vb</code>, adding <code>MyProject.</code> to the class name, but nothing stopped Visual Studio from adding this so-hated <code>MyProject</code>.</p>
<p><strong>Edit regarding <a href="https://stackoverflow.com/questions/241009/myprojectmyclass-vbnet-custom-controls#241077">this answer</a>:</strong></p>
<p>I understand the thing about the namespace, however my problem is mostly that the compiler does not recognize the class with the project name appended but still adds it everytime.</p>
| [
{
"answer_id": 241077,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 0,
"selected": false,
"text": "MyProject"
},
{
"answer_id": 270041,
"author": "pipTheGeek",
"author_id": 28552,
"author_profile": "... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25818/"
] |
241,015 | <p>I have a backup server that automatically backs up my live site, both files and database.</p>
<p>On the live site, the text looks fine, but when you view the mirrored version of it, it displays '?' within some of the text. This text is stored within the news database table.</p>
<p>Here is a screenshot of it being on the live server and of it on the mirrored server.</p>
<p>What could happen within the process of backing it up to the mirrored server?</p>
<p><img src="https://i.stack.imgur.com/ftKNy.jpg" alt="Alt text" /></p>
<p>The live server is <a href="https://en.wikipedia.org/wiki/Solaris_%28operating_system%29" rel="nofollow noreferrer">Solaris</a>, and the mirrored server is Linux <a href="https://en.wikipedia.org/wiki/Red_Hat_Linux" rel="nofollow noreferrer">Red Hat Linux</a> 5.</p>
| [
{
"answer_id": 241030,
"author": "IAdapter",
"author_id": 30453,
"author_profile": "https://Stackoverflow.com/users/30453",
"pm_score": 6,
"selected": true,
"text": "SET NAMES 'utf8';\n"
},
{
"answer_id": 241037,
"author": "John Rudy",
"author_id": 14048,
"author_prof... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] |
241,034 | <p>I have a very simple Java RMI Server that looks like the following:</p>
<pre><code> import java.rmi.*;
import java.rmi.server.*;
public class CalculatorImpl extends UnicastRemoteObject implements Calculator {
private String mServerName;
public CalculatorImpl(String serverName) throws RemoteException
{
super();
mServerName = serverName;
}
public int calculate(int op1, int op2) throws RemoteException
{
return op1 + op2;
}
public void exit() throws RemoteException
{
try{
Naming.unbind(mServerName);
System.out.println("CalculatorServer exiting.");
}
catch(Exception e){}
System.exit(1);
}
public static void main(String args[]) throws Exception
{
System.out.println("Initializing CalculatorServer.");
String serverObjName = "rmi://localhost/Calculator";
Calculator calc = new CalculatorImpl(serverObjName);
Naming.rebind(serverObjName, calc);
System.out.println("CalculatorServer running.");
}
}
</code></pre>
<p>When I call the exit method, System.exit(1) throws the following exception:</p>
<pre><code>CalculatorServer exiting.
java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:203)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at CalculatorImpl_Stub.exit(Unknown Source)
at CalculatorClient.<init>(CalculatorClient.java:17)
at CalculatorClient.main(CalculatorClient.java:29)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:243)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:189)
... 4 more
[2]+ Exit 1 java CalculatorImpl
</code></pre>
<p>What am I doing wrong in this method?</p>
| [
{
"answer_id": 241214,
"author": "Clayton",
"author_id": 1449,
"author_profile": "https://Stackoverflow.com/users/1449",
"pm_score": 5,
"selected": true,
"text": "public void exit() throws RemoteException\n{\n try{\n // Unregister ourself\n Naming.unbind(mServerName);\n\... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1449/"
] |
241,051 | <p>I have nant set up to build my ASP.NET MVC project and it works fine locally. I add nant to a tools folder and add it to version control. TeamCity picks up my changes and starts the build but it fails.</p>
<p>I believe I'm using the latest version of Nant and I have added the .net framework 3.5 to the nant.exe.config. What am I missing on the server and yes the .net framework is installed on the server as the asp.net mvc app does work if I manually build and deploy there? </p>
<p>The build file is as follows:
</p>
<pre><code><target name="compile" description="Compiles using the AutomatedDebug Configuration">
<msbuild project="Tolt.Sims.sln" />
</target>
</code></pre>
<p></p>
<p>Here is the error:</p>
<pre>
BUILD FAILED Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framework.
Property evaluation failed. Expression: ${path::combine(sdkInstallRoot, 'bin')} ^^^^^^^^^^^^^^ Property 'sdkInstallRoot' has not been set.
For more information regarding the cause of the build failure, run the build again in debug mode. Try 'nant -help' for more information
</pre>
| [
{
"answer_id": 3153659,
"author": "Matt Scully",
"author_id": 380555,
"author_profile": "https://Stackoverflow.com/users/380555",
"pm_score": 2,
"selected": false,
"text": "<directory name=\"${path::combine(sdkInstallRoot, 'bin')}\""
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/241051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9938/"
] |
241,083 | <p>I used to have a class in 1.1 for the Datagrid that inherited from the DataGridColumn class. This allowed me to create a check box column with a client-side un/check-all box in the header. Then as I designed my grid I would just add my custom column.</p>
<p>I am currently on a project where I need similar functionality for the grid view, however, there does not seem to be a way to inherit or add functionality to a column.</p>
<p>So my question is, Is there a way to override a column? or Does this code already exist, in a reusable way?</p>
<p>Needs are simple: I would like for it to just register the JavaScript on the page and render a column of check boxes.</p>
<p>I have come across the 4guys sample already, but they have just put all the code into the code behind, I am looking for something a little less copy/paste.</p>
| [
{
"answer_id": 241617,
"author": "AndyG",
"author_id": 27678,
"author_profile": "https://Stackoverflow.com/users/27678",
"pm_score": 0,
"selected": false,
"text": "<asp:DataGrid id=\"DG1\" runat = \"server\" DataKeyField = \"ID\">\n<Columns>\n<asp:TemplateColumn HeaderText=\"ProductName\... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30492/"
] |
241,086 | <p>I am setting up an Oracle connection for NHibernate for the first time. I have copied the Oracle.DataAccess.dll file into my bin folder. No matter what I try, I keep getting the same error:</p>
<pre><code>Could not load type >NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified.
</code></pre>
<p>I am using the following configuration:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="DefaultSessionFactory">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.Oracle9Dialect</property>
<property name="connection.driver_class">>NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string">Data Source=DB;User ID=USERPassword=****;</property>
<property name="show_sql">true</property>
<mapping assembly="NHibernateExample.DataAccess"/>
</session-factory>
</hibernate-configuration>
</code></pre>
<p>I have previously only set up NHibernate for SQL Server. Am I missing anything here?</p>
| [
{
"answer_id": 241154,
"author": "Nelson Miranda",
"author_id": 1130097,
"author_profile": "https://Stackoverflow.com/users/1130097",
"pm_score": 0,
"selected": false,
"text": "hibernate"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/241086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] |
241,088 | <p>I have some Java code that uses curly braces in two ways</p>
<pre><code>// Curly braces attached to an 'if' statement:
if(node.getId() != null)
{
node.getId().apply(this);
}
// Curly braces by themselves:
{
List<PExp> copy = new ArrayList<PExp>(node.getArgs());
for(PExp e : copy)
{
e.apply(this);
}
}
outAMethodExp(node);
</code></pre>
<p>What do those stand-alone curly braces after the first <code>if</code> statement mean?</p>
| [
{
"answer_id": 241097,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 8,
"selected": true,
"text": "List<PExp> copy"
},
{
"answer_id": 241182,
"author": "Hugo",
"author_id": 972,
"author_profile": "https://... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85/"
] |
241,089 | <p>I need to respond to the events of minimizing / maximizing Eclipse window. How do I do that?</p>
| [
{
"answer_id": 241097,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 8,
"selected": true,
"text": "List<PExp> copy"
},
{
"answer_id": 241182,
"author": "Hugo",
"author_id": 972,
"author_profile": "https://... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/431/"
] |
241,100 | <p>I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let's say after a button is clicked.</p>
<p>The reason I need this is I have set SelectionMode to FullRowSelect and I need to click 2-3 times to open the combo box. I want to click on the combobox cell and it should drop down immediately. I want to do this with CellClick event, or is there any other way?</p>
<p>I am searching in Google and VS help, but I haven't found any information yet.</p>
<p>Can anybody help please?</p>
| [
{
"answer_id": 241218,
"author": "thismat",
"author_id": 14045,
"author_profile": "https://Stackoverflow.com/users/14045",
"pm_score": 6,
"selected": true,
"text": " Private Sub cell_Click(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellCl... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20353/"
] |
241,102 | <p>I have been working on a webpage. It is the first I have actually tried to design using an image and then use proper CSS layout rather than tables.</p>
<p><a href="http://www.roccocammisola.com/proj/brunel/bgimage.html" rel="nofollow noreferrer">http://www.roccocammisola.com/proj/brunel/bgimage.html</a></p>
<p>I have been having issues with the shadows on either side of the main content area. Of course these are only an issue in IE. As you can see the shadow has been cut down to about 10% of its actual height. </p>
<p>With my relative inexperience how do I look for relevant fixes to this issue.</p>
<p>Any help would be very much appreciated.</p>
| [
{
"answer_id": 241115,
"author": "Larsenal",
"author_id": 337,
"author_profile": "https://Stackoverflow.com/users/337",
"pm_score": 1,
"selected": false,
"text": ".mainShadowRight {\n*/ your other stuff */\nurl('images/mainShadowRight.gif');\n}\n"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/241102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31866/"
] |
241,131 | <p>I've got a workspace with multiple RCP plugin projects.</p>
<p>We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.</p>
<p>The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn't seem to have any effect when I add the eclipse directory (it only allows you to add directories). </p>
<p>Copying the source jars from the eclipse directory into the target platform has a similar effect.</p>
<p>What am I doing wrong? How do I attach a set of Source jars to my target platform?</p>
| [
{
"answer_id": 241200,
"author": "jamesh",
"author_id": 4737,
"author_profile": "https://Stackoverflow.com/users/4737",
"pm_score": 0,
"selected": false,
"text": "-install"
},
{
"answer_id": 12535099,
"author": "lueders",
"author_id": 1689420,
"author_profile": "https... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737/"
] |
241,134 | <p>I was recently working with a <code>DateTime</code> object, and wrote something like this:</p>
<pre><code>DateTime dt = DateTime.Now;
dt.AddDays(1);
return dt; // still today's date! WTF?
</code></pre>
<p>The intellisense documentation for <code>AddDays()</code> says it adds a day to the date, which it doesn't - it actually <em>returns</em> a date with a day added to it, so you have to write it like:</p>
<pre><code>DateTime dt = DateTime.Now;
dt = dt.AddDays(1);
return dt; // tomorrow's date
</code></pre>
<p>This one has bitten me a number of times before, so I thought it would be useful to catalog the worst C# gotchas.</p>
| [
{
"answer_id": 241138,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 6,
"selected": false,
"text": "int x = 0;\nx = x++;\nreturn x;\n"
},
{
"answer_id": 241155,
"author": "tvanfosson",
"author_id": ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14606/"
] |
241,141 | <p>I would like create my own collection that has all the attributes of python list and also knows how to save/load itself into/from a database. Also I want to make the load implicit and lazy, as in it doesn't happen at the point of creation of the list, but waits until its first used.</p>
<p>Is there a single<code>__xxx__</code>method I can override to load the list on first usage of any list property (such as<code>len</code>,<code>getitem</code>,<code>iter</code>...etc) without having to override them all?</p>
| [
{
"answer_id": 241169,
"author": "Alex Coventry",
"author_id": 1941213,
"author_profile": "https://Stackoverflow.com/users/1941213",
"pm_score": 2,
"selected": false,
"text": "__getattribute__"
},
{
"answer_id": 242111,
"author": "Glyph",
"author_id": 13564,
"author_p... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52490/"
] |
241,142 | <p>i want to be a good developer citizen, <a href="http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx" rel="nofollow noreferrer">pay my taxes</a>, and disable things if we're running over Remote Desktop, or running on battery.</p>
<p>If we're running over remote desktop (or equivalently in a Terminal server session), we must disable animations and double-buffering. You can check this with:</p>
<pre><code>/// <summary>
/// Indicates if we're running in a remote desktop session.
/// If we are, then you MUST disable animations and double buffering i.e. Pay your taxes!
///
/// </summary>
/// <returns></returns>
public static Boolean IsRemoteSession
{
//This is just a friendly wrapper around the built-in way
get
{
return System.Windows.Forms.SystemInformation.TerminalServerSession;
}
}
</code></pre>
<p>Now i need to find out if the user is running on battery power. If they are, i don't want to blow through their battery. i want to do things such as</p>
<ul>
<li>disable animations</li>
<li>disable background spell-checking</li>
<li>disable background printing</li>
<li>turn off gradients </li>
<li>use <code>graphics.SmoothingMode = SmoothingMode.HighSpeed;</code> </li>
<li>use <code>graphics.InterpolationMode = InterpolationMode.Low;</code></li>
<li>use <code>graphics.CompositingQuality = CompositingQuality.HighSpeed;</code></li>
<li>minimize hard drive access - to avoid spin up</li>
<li>minimize network access - to save WiFi power</li>
</ul>
<p>Is there a managed way to see if the machine is <strong>currently</strong> running on battery?</p>
<h2>Bonus Reading</h2>
<ul>
<li><a href="http://blogs.msdn.com/oldnewthing/archive/2005/08/22/454487.aspx" rel="nofollow noreferrer">How do you convince developers to pay their "taxes"?</a> <em>(<a href="https://archive.fo/iNVg5" rel="nofollow noreferrer">archive.is</a>)</em></li>
<li><a href="http://blogs.msdn.com/oldnewthing/archive/2006/01/03/508694.aspx" rel="nofollow noreferrer">Taxes: Remote Desktop Connection and painting</a> <em>(<a href="https://archive.fo/lJx1u" rel="nofollow noreferrer">archive.is</a>)</em></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms724385(VS.85).aspx" rel="nofollow noreferrer">GetSystemMetrics(SM_REMOTESESSION)</a> <em>(<a href="https://archive.fo/Ywbw7" rel="nofollow noreferrer">archive.is</a>)</em></li>
</ul>
| [
{
"answer_id": 241159,
"author": "driis",
"author_id": 13627,
"author_profile": "https://Stackoverflow.com/users/13627",
"pm_score": 3,
"selected": false,
"text": "using System;\nusing System.Runtime.InteropServices;\nnamespace PowerStateExample\n{\n [StructLayout(LayoutKind.Sequentia... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
241,144 | <p>I know that this is a very specific C++ and Qt related question, but maybe someone can help me, anyway ...</p>
<p>See the code below: I want to display an image within a scroll area. The view port of the scroll area shall have a defined initial size. That means, if the image's size is bigger than the initial size of the view port, scroll bars will be visible, otherwise not.</p>
<pre><code>// create label for displaying an image
QImage image( ":/test.png" );
QLabel *label = new QLabel( this );
label->setPixmap( image.toPixmap() );
// put label into scroll area
QScollArea *area = new QScrollArea( this );
area->setWidget( label );
// set the initial size of the view port
// NOTE: This is what I'd like to do, but this method does not exist :(
area->setViewPortSize( QSize( 300, 300 ) );
</code></pre>
<p>It shall be possible to resize the whole application so that the view port will get another size than the initial one.</p>
<p>Unfortunatelly I was not able to find out, how to set the size of the view port. Qt's layout mechanism seems to set a default size for the view port, but up to now I was not able to change it. Setting a new size with </p>
<pre><code>area->setMinimumSize( QSize( 300, 300 ) );
</code></pre>
<p>will actually set the demanded size, but then the scroll area looses the ability to get resized to a size smaller than 300x300.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 243561,
"author": "Caleb Huitt - cjhuitt",
"author_id": 9876,
"author_profile": "https://Stackoverflow.com/users/9876",
"pm_score": 0,
"selected": false,
"text": "area->resize( 300 + fudge, 300 + fudge )"
},
{
"answer_id": 250257,
"author": "mxcl",
"author_... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012356/"
] |
241,145 | <p>How do you create a simple, custom rule using the jQuery Validate plugin (using <a href="http://jqueryvalidation.org/jQuery.validator.addMethod" rel="noreferrer"><code>addMethod</code></a>) that doesn't use a regex?</p>
<p>For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?</p>
| [
{
"answer_id": 241202,
"author": "Mark Spangler",
"author_id": 456684,
"author_profile": "https://Stackoverflow.com/users/456684",
"pm_score": 9,
"selected": false,
"text": "jQuery.validator.addMethod(\"greaterThanZero\", function(value, element) {\n return this.optional(element) || (... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31869/"
] |
241,150 | <p>I want to filter the selectable dates on a datepicker. I basically need to filter by work days - i.e. make holidays and weekends not selectable.</p>
<p>I know you can specify dates using a function in the beforeShowDate: and you can also use $.datepicker.noWeekends.</p>
<p>Question is: can you do both?</p>
| [
{
"answer_id": 241244,
"author": "Randy",
"author_id": 9361,
"author_profile": "https://Stackoverflow.com/users/9361",
"pm_score": 4,
"selected": true,
"text": "function (date) { \n var day = date.getDay(); \n return [day > 0 && day < 6, \"\"]; \n}\n"
},
{
"answer_id": 1427... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] |
241,152 | <p>I'm displaying a series of images in a UIScrollView. I pretty much want to replicate the Photos application.</p>
<p>My current architecture is:
<li> A parent UIScrollView with content size that is wide enough for <i>x</i> number of pages + some extra space for margins in between the images.</li>
<li> Each image is contained in a UIImageView.</li>
<li> Each UIImageView is contained within its own UIScrollview which are then the subviews of the parent UIScrollView.</p>
<p>So I basically have a row of UIScrollViews within a parent UIScrollView.</p>
<p>The parent UIScrollView has paging enabled so I can scroll from page to page without any problems.</p>
<p>The problem is how to seamlessly pan around a zoomed-in image. I have overridden the <code>viewForZoomingInScrollView</code> method to return the appropriate UIImageView when the user pinches in/out. I have overriden the <code>scrollViewDidEndZooming</code> method to set the parent view's <code>canCancelContentTouches</code> property to <code>NO</code> if the zoom scale is greater than 1. </p>
<p>So users are able to pan around an image. However, they must hold their finger down for a moment to get past the small delay the parent scroll view has before sending touch events down to the subviews. Also, once the user is panning in one image, the next/prev images do not enter the viewable area when the user has reached the border of the current image.</p>
<p>Any ideas?</p>
<p>Thanks.</p>
| [
{
"answer_id": 831262,
"author": "Andrey Tarantsov",
"author_id": 58146,
"author_profile": "https://Stackoverflow.com/users/58146",
"pm_score": 3,
"selected": false,
"text": "viewForZoomingInScrollView:"
},
{
"answer_id": 1805226,
"author": "Community",
"author_id": -1,
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30896/"
] |
241,166 | <p>Question: Is there any reason Autocomplete=off on a ASP:Textbox would not be working in IE 7?</p>
<p>In case this is the best term for it, the IE Autocomplete feature is that drop down list like thing that drops down from textboxes and shows you past things you have typed in.</p>
<p>I need the IE Autocomplete feature to not work at this point for a textbox that is part of a user control that works like an Ajax Autocomplete control. Problem is, when the Ajax Autocomplete selection list shows up, so does the IE Autocomplete selection box. (In cases where I might double click the textbox) I'm using this:</p>
<pre><code>someTextbox.AutoCompleteType = AutoCompleteType.Disabled;
</code></pre>
<p>But it stills shows up. I've tried removing the items from the IE Autocomplete, but the next time I type something in and press enter, the problem reappears. Any ideas?</p>
<p>Note: The textbox is rendered with the Autocomplete=off tag when viewing the source.</p>
<p>Note 2: Have tried someTextbox.Attributes.Add("autocomplete", "off"); also without success</p>
<p><strong>* Update, figured it out a while ago but forgot *</strong></p>
<pre><code>test.AutoCompleteType = AutoCompleteType.None;
</code></pre>
<p>That actually works. I'm not sure what the difference is though. Suppose Ill look that up sometime.</p>
| [
{
"answer_id": 241172,
"author": "BoboTheCodeMonkey",
"author_id": 30532,
"author_profile": "https://Stackoverflow.com/users/30532",
"pm_score": 1,
"selected": false,
"text": "someTextbox.Attributes.Add(\"autocomplete\", \"off\");\n"
},
{
"answer_id": 241184,
"author": "Lea C... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21691/"
] |
241,178 | <p>I would like to know who is locking a file (win32). I know about <a href="http://www.dr-hoiby.com/WhoLockMe/" rel="noreferrer">WhoLockMe</a>, but I would like a <strong>command-line tool</strong> which does more or less the same thing.</p>
<p>I also looked at <a href="https://stackoverflow.com/questions/208283/is-it-possible-to-programatically-find-out-what-process-is-locking-a-file-acros">this question</a>, but it seems only applicable for files opened remotely.</p>
| [
{
"answer_id": 30023333,
"author": "MacGyver",
"author_id": 640205,
"author_profile": "https://Stackoverflow.com/users/640205",
"pm_score": 4,
"selected": false,
"text": "PATH"
},
{
"answer_id": 55616304,
"author": "Augustas",
"author_id": 1278129,
"author_profile": "... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13051/"
] |
241,185 | <p>I'd like to write a MessageConverter class that can wrap another MessageConverter. This MessageConverter would call the child converter, which is assumed to generate a TextMessage. It would take the payload and GZIP compress it, creating a BytesMessage which is ultimately returned to the sender.</p>
<p>The problem is in writing fromMessage(). I can convert the payload back into the string, but then I want to create a "dummy" TextMessage to stuff the string into to then pass to the child MessageConverter's fromMessage() method. There I'm hitting a brick wall because I can't create a TextMessage without a JMS session object, and it appears that there is no way at all to get a session in this context.</p>
<p>I could create additional properties to wire up more stuff to this class, but it doesn't look like I can easily even obtain a session from a JMSTemplate object, and I can't imagine what else I'd need to have.</p>
<p>I am on the verge of creating a private TextMessage implementation within this code just for the purpose of wrapping a string for the child MessageConverter. That class will require tons of dummy methods to flesh out the Interface, and all of that typing makes baby Jesus cry.</p>
<p>Can anyone suggest a better way?</p>
| [
{
"answer_id": 241695,
"author": "nsayer",
"author_id": 13757,
"author_profile": "https://Stackoverflow.com/users/13757",
"pm_score": 2,
"selected": true,
"text": " private static class FakeTextMessage implements TextMessage {\n public FakeTextMessage(Message m) { this.chil... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13757/"
] |
241,193 | <p>Is there a .dll version of the <a href="http://t3.dotgnu.info/blog/php/messy-programmers-beware.html" rel="nofollow noreferrer">inclued</a> extension for <a href="http://us2.php.net/manual/en/intro.inclued.php" rel="nofollow noreferrer">PHP</a>?
The manual's link for <a href="http://pecl4win.php.net/ext.php/php_inclued.dll" rel="nofollow noreferrer">Inclued on PECL4WIN</a> doesn't help. I don't have a compiler to build my own DLL.</p>
<p>NOTE: The spelling "inclued" is correct!</p>
<p>Edit: I don't have a compiler, but do know someone with one... that's really a last resort though.</p>
| [
{
"answer_id": 241239,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 3,
"selected": false,
"text": "ERROR: The DSP inclued.dsp does not exist.\n"
},
{
"answer_id": 243004,
"author": "Ross",
"author_id": 2025... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24181/"
] |
241,211 | <p>I have many instances of an application installed on an IIS 6.0, Windows Server 2003 box under the same application pool. They share many of the same assemblies and can not be joined in to a single application. </p>
<p>I recently added a new instance of the application and obtained a System.OutOfMemoryException when I tried to load the ASP.NET 2.0 application. </p>
<p>Will using the GAC to store common assemblies fix this error or can this only be remedied by spacing the sites between different application pools?</p>
| [
{
"answer_id": 259427,
"author": "Christopher G. Lewis",
"author_id": 13532,
"author_profile": "https://Stackoverflow.com/users/13532",
"pm_score": 1,
"selected": false,
"text": "<system.web>\n <!--\n <deployment\n retail = \"false\" [true|false]\n />\n -->... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
241,222 | <p>For a particular application, I need the screen saver to be disabled while it's running. The operator COULD manually turn it off, and then back on later, but the easiest thing to do would be to just keep the screen saver at bay while the application is running.</p>
<p>How do I do this? I've found code for actually turning off the screen saver with SPI_SETSCREENSAVEACTIVE, but I don't think that's what I want.</p>
| [
{
"answer_id": 1318629,
"author": "Serafeim",
"author_id": 119071,
"author_profile": "https://Stackoverflow.com/users/119071",
"pm_score": 5,
"selected": true,
"text": "SetThreadExecutionState(ES_DISPLAY_REQUIRED)"
},
{
"answer_id": 3739684,
"author": "Ohad Schneider",
"a... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8173/"
] |
241,238 | <p>Could someone supply some code that would get the xpath of a System.Xml.XmlNode instance?</p>
<p>Thanks!</p>
| [
{
"answer_id": 241291,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "using System;\nusing System.Text;\nusing System.Xml;\n\nclass Test\n{\n static void Main()\n {\n string xml ... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5653/"
] |
241,250 | <p>Is there explicit support for Single Table Inheritance in Django? Last I heard, the feature was still under development and debate. </p>
<p>Are there libraries/hacks I can use in the meantime to capture the basic behavior? I have a hierarchy that mixes different objects. The canonical example of a corporation structure with an Employee class, subclasses for types of employees, and a manager_id (parent_id) would be a good approximation of the problem I am solving. </p>
<p>In my case, I would like to represent the idea that an employee can manage other employees while being managed by a different employee. There are not separate classes for Manager and Worker, which makes this hard to spread across tables. Sub-classes would represent types of employees-programmers, accountants, sales, etc and would be independent of who supervises who (OK, I guess it's no longer a typical corporation in some respect). </p>
| [
{
"answer_id": 2383744,
"author": "James",
"author_id": 266572,
"author_profile": "https://Stackoverflow.com/users/266572",
"pm_score": 2,
"selected": false,
"text": "class Citrus(models.Model):\n how_acidic = models.PositiveIntegerField(max_value=100)\n skin_color = models.CharFie... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1227001/"
] |
241,269 | <p>I am writing a program that will be emailing reports out many (~100) clients which I want to test before I spam everyone.</p>
<p>I want to do a test run against my production data and actually send the messages to a SMTP server, but I don't want the SMTP server to actually deliver the messages. I want the server to act like a real SMTP server from the perspective of my application, but instead of delivering messages, I just want it to store the messages, and log what happened.</p>
<p>Is there a SMTP server specifically designed for testing purposes?</p>
<p>Does anyone know of a way to configure exim or postfix to behave like I have described above</p>
<p>What do you use to test a mass-email delivery?</p>
| [
{
"answer_id": 241355,
"author": "vmarquez",
"author_id": 10740,
"author_profile": "https://Stackoverflow.com/users/10740",
"pm_score": 0,
"selected": false,
"text": "/usr/lib/sendmail -bt -Ciu-testconfiguration.cf"
},
{
"answer_id": 253454,
"author": "George",
"author_id... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20267/"
] |
241,285 | <p>I'm developing an algorithm to parse a number out of a series of short-ish strings. These strings are somewhat regular, but there's a few different general forms and several exceptions. I'm trying to build a set of regexes that will handle the various forms and exceptions; I'll apply them one after another to see if I get a match.</p>
<p>One of these forms goes something like this:</p>
<pre><code>X (Y) Z
</code></pre>
<p>Where:</p>
<ul>
<li><code>X</code> is a number I want to capture.</li>
<li><code>Z</code> is static, pre-defined text. it's basically how I determine whether this particular form is applicable or not.</li>
<li><code>Y</code> is a string of unknown length and content, surrounded by parenthesis.</li>
</ul>
<p>Also: <code>Y</code> is optional; it doesn't always appear in a string with <code>Z</code> and <code>X</code>. So, I want to be able to extract the numbers from all of these strings:</p>
<ul>
<li><code>10 Z</code></li>
<li><code>20 (foo) Z</code></li>
<li><code>30 (bar) Z</code></li>
</ul>
<p>Right now, I have a regex that will capture the first one:</p>
<pre><code>([0-9]+) +Z
</code></pre>
<p>My problem is that I don't know how to construct a regex that will match a series of characters if and only if they're enclosed in parenthesis. Can this be done in a single regex?</p>
| [
{
"answer_id": 241288,
"author": "Kip",
"author_id": 18511,
"author_profile": "https://Stackoverflow.com/users/18511",
"pm_score": 2,
"selected": false,
"text": "X (\\(Y\\))? Z\n"
},
{
"answer_id": 241292,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3488/"
] |
241,311 | <p>The question is if a database connection should be passed in by reference or by value?</p>
<p>For me I'm specifically questioning a PHP to MySQL connection, but I think it applies to all databases.</p>
<p>I have heard that in PHP when you pass a variable to a function or object, that it is copied in memory and therefore uses twice as much memory immediately. I have also heard that it's only copied once changes have been made to the value (such as a key being added/removed from an array).</p>
<p>In a database connection, I would think it's being changed within the function as the query could change things like the last insert id or num rows. (I guess this is another question: are things like num rows and insert id stored within the connection or an actual call is made back to the database?)</p>
<p>So, does it matter memory or speed wise if the connection is passed by reference or value? Does it make a difference PHP 4 vs 5?</p>
<pre><code>// $connection is resource
function DoSomething1(&$connection) { ... }
function DoSomething2($connection) { ... }
</code></pre>
| [
{
"answer_id": 241330,
"author": "TJ L",
"author_id": 12605,
"author_profile": "https://Stackoverflow.com/users/12605",
"pm_score": 3,
"selected": false,
"text": "<?php\nClass Factory\n{\n private static $local_db;\n\n/**\n* Open new local database connection\n*\n* @return MySql\n*/\npu... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] |
241,325 | <p>When using <code>grep --color=always</code> I can get pretty color highlighting for regex matches.</p>
<p>However, <code>grep</code> only returns lines with at least one match. Instead, I am looking for a way to simply highlight regex matches, while leaving all other input alone, without dropping lines without any matches.</p>
<p>I have tried to get color working with <code>sed</code>, and read the <code>grep</code> documentation, but I can't seem to get what I want.</p>
<p>In case my description isnt obvious, I want:</p>
<p>INPUT:</p>
<ul>
<li>fred</li>
<li>ted</li>
<li>red</li>
<li>lead</li>
</ul>
<p>Regex:</p>
<ul>
<li>".*red"</li>
</ul>
<p>OUTPUT:</p>
<ul>
<li>fred ( in red )</li>
<li>ted</li>
<li>red ( in red )</li>
<li>lead</li>
</ul>
<p>So that I could do:</p>
<pre><code>list_stuff | color_grep "make_this_stand_out_but_dont_hide_the_rest"
</code></pre>
<p>EDIT:</p>
<p>I have found a solution, which isn't pretty, but it works:</p>
<p>Thanks to:
<a href="http://www.pixelbeat.org/docs/terminal_colours/" rel="noreferrer">http://www.pixelbeat.org/docs/terminal_colours/</a></p>
<p>Particularly the script (which I modified/simplified):
<a href="http://www.pixelbeat.org/talks/iitui/sedgrep" rel="noreferrer">http://www.pixelbeat.org/talks/iitui/sedgrep</a></p>
<pre><code>function sedgrep ()
{
C_PATT=`echo -e '\033[33;01m'`
C_NORM=`echo -e '\033[m'`
sed -s "s/$1/${C_PATT}&${C_NORM}/gi"
}
</code></pre>
<p>Still looking for an easier way to do this!</p>
| [
{
"answer_id": 241390,
"author": "boxxar",
"author_id": 15732,
"author_profile": "https://Stackoverflow.com/users/15732",
"pm_score": 2,
"selected": false,
"text": "function color_grep {\n sed s/$1/$fg[yellow]$1$terminfo[sgr0]/g\n}\n"
},
{
"answer_id": 241547,
"author": "J... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29701/"
] |
241,327 | <p>I'm looking for Python code that removes C and C++ comments from a string. (Assume the string contains an entire C source file.)</p>
<p>I realize that I could .match() substrings with a Regex, but that doesn't solve nesting <code>/*</code>, or having a <code>//</code> inside a <code>/* */</code>.</p>
<p>Ideally, I would prefer a non-naive implementation that properly handles awkward cases.</p>
| [
{
"answer_id": 241329,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 5,
"selected": false,
"text": "//.*?\\n|/\\*.*?\\*/\n"
},
{
"answer_id": 241506,
"author": "Markus Jarderot",
"author_id": 22364,
... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26251/"
] |
241,334 | <p>I need to to iterate over the files in a directory and perform the following replacement.</p>
<p><strong>Before:</strong></p>
<blockquote>
<p>Hello ${USER_NAME}, you live at
${HOME_ADDRESS}. It is now ${TIME}</p>
</blockquote>
<p><strong>After:</strong></p>
<blockquote>
<p>Hello ${userName}, you live at
${homeAddress}. It is now ${time}</p>
</blockquote>
<p>The number of different tokens that appear within ${} is large, so it's not really feasible to run:</p>
<pre><code>find . -name '*' -exec sed -i 's/${USER_NAME}/${userName}/g' {} \;
find . -name '*' -exec sed -i 's/${TIME}/${time}/g' {} \;
</code></pre>
<p>etc.</p>
<p>I'm hoping it's possible to perform this replacement using a single command, that looks something like:</p>
<pre><code>find . -name '*' -exec sed 's/XXX/YYY/g' {} \;
</code></pre>
<p>But I can't figure out what to substitute for XXX and YYY. Is it possible to do this in a single command?</p>
<p>Cheers,
Donal</p>
| [
{
"answer_id": 241350,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": true,
"text": "-i"
},
{
"answer_id": 241386,
"author": "dmckee --- ex-moderator kitten",
"author_id": 2509,
"author_p... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] |
241,339 | <p>Here's what <a href="https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members" rel="noreferrer">MSDN has to say under <em>When to Use Static Classes</em></a>:</p>
<blockquote>
<pre><code>static class CompanyInfo
{
public static string GetCompanyName() { return "CompanyName"; }
public static string GetCompanyAddress() { return "CompanyAddress"; }
//...
}
</code></pre>
<p>Use a static class as a unit of
organization for methods not
associated with particular objects.
Also, a static class can make your
implementation simpler and faster
because you do not have to create an
object in order to call its methods.
It is useful to organize the methods
inside the class in a meaningful way,
such as the methods of the Math class
in the System namespace.</p>
</blockquote>
<p>To me, that example doesn't seem to cover very many possible usage scenarios for static classes. In the past I've used static classes for stateless suites of related functions, but that's about it. So, under what circumstances should (and shouldn't) a class be declared static? </p>
| [
{
"answer_id": 241372,
"author": "Mark S. Rasmussen",
"author_id": 12469,
"author_profile": "https://Stackoverflow.com/users/12469",
"pm_score": 11,
"selected": true,
"text": "new MyClass();"
},
{
"answer_id": 241411,
"author": "Rob",
"author_id": 2595,
"author_profil... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1266/"
] |
241,364 | <p>I admit - I'm a complete novice when it comes to unit testing. I can grasp the concepts easily enough (test one thing, break-fix-test-repeat, etc.), but I'm having a bit of a problem getting my mind around this one...</p>
<p>I've been tasked with rewriting a large section of our application, and I've got the class structure down pretty well. We have our test projects mixed right in with the rest of the solution, and all the references are lining up the way we want them to. Unfortunately, there are a few Friend classes that can only be accessed from inside the same namespace. As it stands, the test class is not a member of this namespace, so I cannot get direct access to any of those underlying methods, which <strong>REALLY</strong> need to be tested. </p>
<p>From what I've been reading, I could create a public mockup of the classes in question and test it that way, but I'm concerned that down the road someone will make a change in the production code and not copy it out to the test code, defeating the purpose of testing entirely. Another option would be to change the access level on the classes themselves, but that would involve a lot of overhead and fiddling with the code already in place. The idea of writing an interface has also come up, but creating a whole structure of interfaces for the sake of testing hasn't flown in management.</p>
<p>Am I just missing something here? What would be the best way to make sure those underlying classes are indeed functioning correctly without changing the access to them?</p>
| [
{
"answer_id": 241383,
"author": "Igal Tabachnik",
"author_id": 8205,
"author_profile": "https://Stackoverflow.com/users/8205",
"pm_score": 2,
"selected": false,
"text": "InternalsVisibleTo"
}
] | 2008/10/27 | [
"https://Stackoverflow.com/questions/241364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2018855/"
] |
241,388 | <p>I'm looking at the following code snippet:</p>
<pre><code>my @ret = <someMethod>
return (undef) if( $DB_ERROR );
return (undef) unless ($#ret >= 0);
</code></pre>
<p>Does <code>$#</code> just give you a count of elements in a array?</p>
| [
{
"answer_id": 241394,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 7,
"selected": true,
"text": "$#arrayname"
},
{
"answer_id": 241462,
"author": "Schwern",
"author_id": 14660,
"author_profile": "htt... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31301/"
] |
241,396 | <p>I produce server software and have been fine with all Linux environments so far, both for production and as deployment target. However, I want to provide a broader choice of target environments in the future and I'm also planning features that would consume and produce Office documents.</p>
<p>As a first step, I am looking for a good way to get a number of MS software products (XP, Vista, Server 2003 & 2008, Office 2000, 2003 & 2007 ...) to put on some VMs in my testing setup, so I can start to play around.</p>
<p>So far, I get quite a good impression from what I read about MS's partner program (aka Action Pack). The only thing I'm missing from what the website tells me is older software versions. As I want to mimick possible customers' setups and there's always a lot of people that run older versions, that would be quite important for the testing scenario.</p>
<p>Eventually, I'm going to face similar questions with Apple OS X, so if anybody has some hints on that, I'd be glad, too.</p>
| [
{
"answer_id": 241394,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 7,
"selected": true,
"text": "$#arrayname"
},
{
"answer_id": 241462,
"author": "Schwern",
"author_id": 14660,
"author_profile": "htt... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] |
241,397 | <p>How do you answer the following questions from managers, testers and other people in your team:</p>
<p>In what build is bug #829 fixed? What tasks have been completed in our current test build?</p>
<p>So simply put, how do you achieve traceability of your requirements, tasks and bugs right from them being reported reporting through to deployment? What processes, tools and techniques are you using to achieve this?</p>
| [
{
"answer_id": 241419,
"author": "Eoin Campbell",
"author_id": 30155,
"author_profile": "https://Stackoverflow.com/users/30155",
"pm_score": 3,
"selected": true,
"text": "Deployed On | Environment | Changeset\n--------------+-------------------------+-----------------------... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30874/"
] |
241,402 | <p>I'm wanting to add a class to the body tag without waiting for the DOM to load, but I'm wanting to know if the following approach would be valid. I'm more concerned with validity than whether the browsers support it for now.</p>
<pre><code><body>
$("body").addClass("active");
...
</body>
</code></pre>
<p>Thanks,
Steve</p>
| [
{
"answer_id": 241418,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<body>\n <div id='topStories'></div>\n <script type='text/javascript'>\n $('div#topStories').addClass('active')... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16124/"
] |
241,403 | <p>How do I get a list of domain user accounts with win32 api? </p>
<p>In particular, I can't get this list when the computer is not the domain controller. Instead it is a member of the domain. </p>
| [
{
"answer_id": 241418,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<body>\n <div id='topStories'></div>\n <script type='text/javascript'>\n $('div#topStories').addClass('active')... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
241,405 | <p>I have a string that I need to convert to the equivalent array of bytes in .NET. </p>
<p>This ought to be easy, but I am having a brain cramp.</p>
| [
{
"answer_id": 241408,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 8,
"selected": true,
"text": "System.Text.Encoding"
},
{
"answer_id": 241409,
"author": "Igal Tabachnik",
"author_id": 8205,
"au... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23862/"
] |
241,407 | <p>For this xml (in a SQL 2005 XML column): </p>
<pre><code><doc>
<a>1</a>
<b ba="1" bb="2" bc="3" />
<c bd="3"/>
<doc>
</code></pre>
<p>I'd like to be able to retrieve the names of the attributes (ba, bb, bc, bd) rather than the values <em>inside SQL Server 2005</em>. Well, XPath certainly allows this with name() but SQL doesn't support that. This is my chief complaint with using XML in SQL; you have to figure out which parts of the XML/Xpath/XQuery spec are in there. </p>
<p>The only way I can think of to do this is to build a CLR proc that loads the XML into an XML Document (iirc) and runs the XPath to extract the names of the nodes. I'm open to suggestions here. </p>
| [
{
"answer_id": 241687,
"author": "Ray Lu",
"author_id": 11413,
"author_profile": "https://Stackoverflow.com/users/11413",
"pm_score": 4,
"selected": true,
"text": "DECLARE @xml as xml\nDECLARE @path as varchar(max)\nDECLARE @index int, @count int\n\nSET @xml = \n'<doc>\n <a>1</a>\n <b ba... | 2008/10/27 | [
"https://Stackoverflow.com/questions/241407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30946/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.