qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
9,256 | <p>Thanks to FireFox's buggy implementation of ActiveX components (it really should take an image of them when printing) Flex components (in our case charts) don't print in FX.</p>
<p>They print fine in IE7, even IE6.</p>
<p>We need these charts to print, but they also have dynamic content. I don't really want to draw them again as images when the user prints - the Flex component should do it.</p>
<p>We've found a <a href="http://www.anychart.com/blog/2007/09/23/solving-problem-with-printing-flash-content-in-firefox-browser/" rel="nofollow noreferrer">potential workaround</a>, but unfortunately it doesn't work in FireFox3 (in FireFox2 it sort-of works, but not well enough).</p>
<p>Anyone know a workaround?</p>
| [
{
"answer_id": 16362,
"author": "Matt MacLean",
"author_id": 22,
"author_profile": "https://Stackoverflow.com/users/22",
"pm_score": 3,
"selected": true,
"text": "private function initPrint():void {\n //if we don't have a stage, wait until the next frame and try again\n if ( stage ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] |
9,272 | <p>Anybody have a script or alias to find untracked (really: unadded) files in a Perforce tree?</p>
<p>EDIT: I updated the accepted answer on this one since it looks like P4V added support for this in the January 2009 release.</p>
| [
{
"answer_id": 9280,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 6,
"selected": false,
"text": "find . -type f -print0 | xargs -0 p4 fstat >/dev/null\n"
},
{
"answer_id": 100126,
"author": "ahu",
"autho... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1146/"
] |
9,275 | <p>I writing a report in Visual Studio that takes a user input parameter and runs against an ODBC datasource. I would like to write the query manually and have reporting services replace part of the where clause with the parameter value before sending it to the database. What seems to be happening is that the <code>@parmName</code> I am assuming will be replaced is actually being sent as part of the SQL statement. Am I missing a configuration setting somewhere or is this simply not possible?</p>
<p>I am not using the filter option in the tool because this appears to bring back the full dataset from the database and do the filtering on the SQL Server.</p>
| [
{
"answer_id": 9325,
"author": "Jorriss",
"author_id": 621,
"author_profile": "https://Stackoverflow.com/users/621",
"pm_score": 4,
"selected": true,
"text": "=\"Select col1, col2 from table 1 Where col3 = \" & Parameters!Param1.Value \n"
},
{
"answer_id": 19600,
"author": "M... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1104/"
] |
9,279 | <p>I absolutely love the <a href="http://winscp.net/eng/docs/task_keep_up_to_date" rel="noreferrer">Keep Remote Directory Up-to-date</a> feature in <a href="http://winscp.net/" rel="noreferrer">Winscp</a>. Unfortunately, I can't find anything as simple to use in OS X or Linux. I know the same thing can <em>theoretically</em> be accomplished using <a href="http://freshmeat.net/projects/changedfiles/" rel="noreferrer">changedfiles</a> or <a href="http://samba.anu.edu.au/rsync/" rel="noreferrer">rsync</a>, but I've always found the tutorials for both tools to be lacking and/or contradictory. </p>
<p>I basically just need a tool that works in OSX or Linux and keeps a remote directory in sync (mirrored) with a local directory while I make changes to the local directory.</p>
<hr>
<p><strong>Update</strong></p>
<p>Looking through the solutions, I see a couple which solve the general problem of keeping a remote directory in sync with a local directory <em>manually</em>. I know that I can set a cron task to run rsync every minute, and this should be fairly close to real time. </p>
<p>This is not the exact solution I was looking for as winscp does this and more: it detects file changes in a directory (while I work on them) and then automatically pushes the changes to the remote server. I know this is not the best solution (no code repository), but it allows me to very quickly test code on a server while I develop it. Does anyone know how to combine rsync with any other commands to get this functionality?</p>
| [
{
"answer_id": 9287,
"author": "dwj",
"author_id": 346,
"author_profile": "https://Stackoverflow.com/users/346",
"pm_score": 5,
"selected": true,
"text": "#!/bin/sh\nrsync -avrz --progress --exclude-from .rsync_exclude_remote . remote_login@remote_computer:remote_dir \n\n# options\n# ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/302/"
] |
9,289 | <p>I would like to filter an array of items by using the <code>map()</code> function. Here is a code snippet:</p>
<pre><code>var filteredItems = items.map(function(item)
{
if( ...some condition... )
{
return item;
}
});
</code></pre>
<p>The problem is that filtered out items still uses space in the array and I would like to completely wipe them out.</p>
<p>Any idea?</p>
<p>EDIT: Thanks, I forgot about <code>filter()</code>, what I wanted is actually a <code>filter()</code> then a <code>map()</code>.</p>
<p>EDIT2: Thanks for pointing that <code>map()</code> and <code>filter()</code> are not implemented in all browsers, although my specific code was not intended to run in a browser.</p>
| [
{
"answer_id": 9295,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 4,
"selected": false,
"text": "Array.filter"
},
{
"answer_id": 9297,
"author": "olliej",
"author_id": 784,
"author_profile": "https://Stack... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268/"
] |
9,301 | <p>I'm having trouble with events in Internet Explorer 7.</p>
<p>When I have a form with <strong>two or more</strong> <code>input[type=text]</code> and I press enter, the events occurs in this order:</p>
<ol>
<li>submit button (<code>onClick</code>)</li>
<li>form (<code>onSubmit</code>)</li>
</ol>
<p>Sample code:</p>
<pre><code><form onSubmit="{alert('form::onSubmit'); return false;}">
<input type="text">
<input type="text">
<input type="submit" onClick="{alert('button::onClick');}">
</form>
</code></pre>
<p>If I have only <strong>one</strong> <code>input[type=text]</code> and I press enter the submit button <code>onClick</code> event doesn't fire. Sample code:</p>
<pre><code><form onSubmit="{alert('form::onSubmit'); return false;}">
<input type="text">
<input type="submit" onClick="{alert('button::onClick');}">
</form>
</code></pre>
| [
{
"answer_id": 35775438,
"author": "Crystal Paladin",
"author_id": 5917094,
"author_profile": "https://Stackoverflow.com/users/5917094",
"pm_score": 0,
"selected": false,
"text": "<FORM onSubmit=\"{alert('form::onSubmit'); return false;}\">\n <INPUT TYPE=\"text\">\n <input type=\"h... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100/"
] |
9,303 | <p>How do you retrieve selected text using Regex in C#?</p>
<p>I am looking for C# code that is equivalent to this Perl code:</p>
<pre><code>$indexVal = 0;
if($string =~ /Index: (\d*)/){$indexVal = $1;}
</code></pre>
| [
{
"answer_id": 9306,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 4,
"selected": true,
"text": "int indexVal = 0;\nRegex re = new Regex(@\"Index: (\\d*)\")\nMatch m = re.Match(s)\n\nif(m.Success)\n indexVal = int.TryParse(m.... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] |
9,304 | <p><em>Note: This was posted when I was starting out C#. With 2014 knowledge, I can truly say that auto-properties are among the best things that ever happened to the C# language.</em></p>
<p>I am used to create my properties in C# using a private and a public field:</p>
<pre><code>private string title;
public string Title
{
get { return title; }
set { title = value; }
}
</code></pre>
<p>Now, with <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> 3.0, we got auto-properties:</p>
<pre><code>public string Title { get; set; }
</code></pre>
<p>I know this is more a philosophical/subjective questions, but is there any reason to use these auto-properties except from saving five lines of code for each field? My personal gripe is that those properties are hiding stuff from me, and I am not a big fan of black magic.</p>
<p>In fact, the hidden private field does not even show up in the debugger, which is OK given the fact that the get/set functions do nothing. But when I want to actually implement some getter/setter logic, I have to use the private/public pair anyway.</p>
<p>I see the benefit that I save a lot of code (one vs six lines) without losing the ability to change the getter/setter logic later, but then again I can already do that by simply declaring a public field "Public string Title" without the need of the { get; set; } block, thus even saving more code.</p>
<p>So, what am I missing here? Why would anyone actually want to use auto-properties?</p>
| [
{
"answer_id": 9315,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 3,
"selected": false,
"text": "public string Name = \"DefaultName\";\n"
},
{
"answer_id": 9342,
"author": "Mike Stone",
"author_id": 122,... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91/"
] |
9,314 | <p>I have a .NET 2.0 windows forms app, which makes heavy use of the <code>ListView</code> control.</p>
<p>I've subclassed the <code>ListView</code> class into a templated <code>SortableListView<T></code> class, so it can be a bit smarter about how it displays things, and sort itself.</p>
<p>Unfortunately this seems to break the Visual Studio Forms Designer, in both VS2005 and 2008.</p>
<p>The program compiles and runs fine, but when I try view the owning form in the designer, I get these Errors:</p>
<ul>
<li>Could not find type 'MyApp.Controls.SortableListView'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.</li>
</ul>
<p>There is no stack trace or error line information available for this error </p>
<ul>
<li>The variable 'listViewImages' is either undeclared or was never assigned. </li>
</ul>
<p>At MyApp.Main.Designer.cs Line:XYZ Column:1</p>
<pre><code>Call stack:
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
</code></pre>
<p>The line of code in question is where it is actually added to the form, and is</p>
<pre><code>this.imagesTab.Controls.Add( this.listViewImages );
</code></pre>
<p>listViewImages is declared as</p>
<pre><code>private MyApp.Controls.SortableListView<Image> listViewImages;
</code></pre>
<p>and is instantiated in the <code>InitializeComponent</code> method as follows:</p>
<pre><code>this.listViewImages = new MyApp.Controls.SortableListView<Image>();
</code></pre>
<p>As mentioned earlier, the program compiles and runs perfectly, and I've tried shifting the <code>SortableListView</code> class out to a seperate assembly so it can be compiled seperately, but this makes no difference.</p>
<p>I have no idea where to go from here. Any help would be appreciated!</p>
| [
{
"answer_id": 9320,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 3,
"selected": false,
"text": "using My.Other.Namespace;\n"
},
{
"answer_id": 9387,
"author": "Orion Edwards",
"author_id": 234,
"author_pro... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] |
9,321 | <p>How do you create a static class in C++? I should be able to do something like:</p>
<pre><code>cout << "bit 5 is " << BitParser::getBitAt(buffer, 5) << endl;
</code></pre>
<p>Assuming I created the <code>BitParser</code> class. What would the <code>BitParser</code> class definition look like?</p>
| [
{
"answer_id": 9326,
"author": "Philip Reynolds",
"author_id": 1087,
"author_profile": "https://Stackoverflow.com/users/1087",
"pm_score": 4,
"selected": false,
"text": "class BitParser {\npublic:\n ...\n static ... getBitAt(...) {\n }\n};\n"
},
{
"answer_id": 9328,
"autho... | 2008/08/12 | [
"https://Stackoverflow.com/questions/9321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] |
9,336 | <p>I'm trying to generate a sitemap.xml on the fly for a particular asp.net website.</p>
<p>I found a couple solutions:<br /></p>
<ol>
<li><a href="http://sitemap.chinookwebs.com/" rel="nofollow noreferrer">chinookwebs</a></li>
<li><a href="http://web.archive.org/web/20080307061444/http://www.cervoproject.info:80/sitemaps.aspx" rel="nofollow noreferrer">cervoproject</a></li>
<li><a href="http://www.codeplex.com/Sitemaps" rel="nofollow noreferrer">newtonking</a></li>
</ol>
<p>Chinookwebs is working great but seems a bit inactive right now and it's impossible to personalize the "priority" and the "changefreq" tags of each and every page, they all inherit the same value from the config file.</p>
<p>What solutions do you guys use?</p>
| [
{
"answer_id": 9533,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "void IHttpHandler.ProcessRequest(HttpContext context)\n{\n //\n // Important to return qualified XML (text/xml) for sitemap... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296/"
] |
9,338 | <p>One of the articles I really enjoyed reading recently was <a href="http://blog.last.fm/2008/08/01/quality-control" rel="nofollow noreferrer">Quality Control by Last.FM</a>. In the spirit of this article, I was wondering if anyone else had favorite monitoring setups for web type applications. Or maybe if you don't believe in Log Monitoring, why?<br>
I'm looking for a mix of opinion slash experience here I guess.</p>
| [
{
"answer_id": 9533,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "void IHttpHandler.ProcessRequest(HttpContext context)\n{\n //\n // Important to return qualified XML (text/xml) for sitemap... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1063/"
] |
9,341 | <p>Simple ASP.NET application.</p>
<p>I have two drop-down controls. On the first-drop down I have a JavaScript <code>onChange</code> event. The JavaScript enables the second drop-down and removes a value from it (the value selected in the first drop-down). If they click the blank first value of the drop-down, then the second drop-down will be disabled (and the options reset).</p>
<p>I also have code in the <code>OnPreRender</code> method that will enable or disable the second drop-down based on the value of the first drop-down. This is so that the value of the first drop-down can be selected in code (loading user settings).</p>
<p>My problem is:</p>
<ol>
<li>The user selects something in the first drop-down. The second drop-down will become enabled through JavaScript. </li>
<li>They then change a third drop-down that initiates a post back. After the post back the drop-downs are in the correct state (first value selected, second drop-down enabled).</li>
<li>If they then click the back button, the second drop-down will no longer be enabled although it should be since there's something selected in the first drop-down.</li>
</ol>
<p>I've tried adding a startup script (that will set the correct state of the second-drop down) through <code>ClientScript.RegisterStartupScript</code>, however when this gets called the first drop-down has a <code>selectedIndex</code> of <code>0</code>, not what it actually is. My guess is that the value of the selection gets set after my start script (but still doesn't call the <code>onChange</code> script).</p>
<p>Any ideas on what to try?</p>
| [
{
"answer_id": 9365,
"author": "Adhip Gupta",
"author_id": 384,
"author_profile": "https://Stackoverflow.com/users/384",
"pm_score": 3,
"selected": true,
"text": "<%@ Page Language=\"C#\" %>\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/233/"
] |
9,355 | <p>I can display and select a single file in windows explorer like this:</p>
<pre><code>explorer.exe /select, "c:\path\to\file.txt"
</code></pre>
<p>However, I can't work out how to select more than one file. None of the permutations of select I've tried work.</p>
<p>Note: I looked at these pages for docs, neither helped.</p>
<p><a href="https://support.microsoft.com/kb/314853" rel="nofollow noreferrer">https://support.microsoft.com/kb/314853</a><br />
<a href="http://web.archive.org/web/20100716112458/http://www.infocellar.com:80/Win98/explorer-switches.htm" rel="nofollow noreferrer">http://web.archive.org/web/20100716112458/http://www.infocellar.com:80/Win98/explorer-switches.htm</a></p>
| [
{
"answer_id": 9497,
"author": "bruceatk",
"author_id": 791,
"author_profile": "https://Stackoverflow.com/users/791",
"pm_score": 2,
"selected": false,
"text": "F12:: \n run explorer.exe /select`, \"c:\\path\\to\\file.txt\"\n SendInput {Shift Down}{Down}{Down}{Shift Up}\nreturn\n"
},
... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] |
9,376 | <p>Do you use ILMerge? Do you use ILMerge to merge multiple assemblies to ease deployment of dll's? Have you found problems with deployment/versioning in production after ILMerging assemblies together?</p>
<p>I'm looking for some advice in regards to using ILMerge to reduce deployment friction, if that is even possible.</p>
| [
{
"answer_id": 9784933,
"author": "Contango",
"author_id": 107409,
"author_profile": "https://Stackoverflow.com/users/107409",
"pm_score": 5,
"selected": false,
"text": ".exe + .dll files"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1083/"
] |
9,383 | <p>How do you access a SQL Server 2005 Express Edition from a application in a network computer?</p>
<p>The access I need is both from application (Linq-to-SQL and ODBC) and from Management Studio</p>
| [
{
"answer_id": 9896,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "telnet 192.168.10.10 1433\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1154/"
] |
9,409 | <p>I have a datagrid getting bound to a dataset, and I want to display the average result in the footer for a column populated with integers.</p>
<p>The way I figure, there's 2 ways I can think of:</p>
<p>1."Use the <strong>Source</strong>, Luke"<br>
In the code where I'm calling DataGrid.DataBind(), use the DataTable.Compute() method (<em>or in my case DataSet.DataTable(0).Compute()</em>). For example: </p>
<pre><code>Dim strAverage = DataTable.Compute("Avg(ColumnName)", "")
</code></pre>
<p>But once I have this, how can I insert it into the footer?</p>
<p>2."<strong>Bound</strong> for Glory"<br>
Using the DataGrid.ItemDataBound event, and calculating a running total from every ListItemType.Item and ListItemType.AlternatingItem, finally displaying in ListItemType.Footer. For example: </p>
<pre><code>Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
runningTotal += CInt(e.Item.Cells(2).Text)
Case ListItemType.Footer
e.Item.Cells(2).Text = runningTotal/DataGrid.Items.Count
End Select
</code></pre>
<p>This just feels wrong, plus I would have to make sure the runningTotal is reset on every DataBind. </p>
<p>Is there a better way?</p>
| [
{
"answer_id": 9896,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "telnet 192.168.10.10 1433\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/952/"
] |
9,410 | <p>I want to create a function that performs a function passed by parameter on a set of data. How do you pass a function as a parameter in C?</p>
| [
{
"answer_id": 9413,
"author": "Niyaz",
"author_id": 184,
"author_profile": "https://Stackoverflow.com/users/184",
"pm_score": 11,
"selected": true,
"text": "void func ( void (*f)(int) );\n"
},
{
"answer_id": 9421,
"author": "roo",
"author_id": 716,
"author_profile": ... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] |
9,434 | <p>In my ASP.NET User Control I'm adding some JavaScript to the <code>window.onload</code> event:</p>
<pre><code>if (!Page.ClientScript.IsStartupScriptRegistered(this.GetType(), onloadScriptName))
Page.ClientScript.RegisterStartupScript(this.GetType(), onloadScriptName,
"window.onload = function() {myFunction();};", true);
</code></pre>
<p>My problem is, if there is already something in the <code>onload</code> event, than this overwrites it. How would I go about allowing two user controls to each execute JavaScript in the <code>onload</code> event?</p>
<p><strong>Edit:</strong> Thanks for the info on third party libraries. I'll keep them in mind. </p>
| [
{
"answer_id": 9447,
"author": "Chris Farmer",
"author_id": 404,
"author_profile": "https://Stackoverflow.com/users/404",
"pm_score": 2,
"selected": false,
"text": "window.attachEvent(\"onload\", myOtherFunctionToCall);\n\nfunction myOtherFunctionToCall() {\n // do something\n}\n"
}... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/233/"
] |
9,435 | <p>We are in the initial planning stages of building out a mobile site for one of our clients. This mobile site will be in addition to the main site that we have already built for them. We've determined that the content is going to be a small subsection of the main site and will target the main audience that is expected to use the site.</p>
<p>While looking through some sample mobile sites we noticed that a lot of site that have WAP in the url are actually just simplified HTML files. <a href="http://wap.mlb.com" rel="nofollow noreferrer">http://wap.mlb.com</a> is not really WAP enabled but simple HTML.</p>
<p>My question is WAP a think of the past? With smartphones and the iPhone having the ability to render sites as is do we need to worry about WML and WAP or will a stripped down html version be enough? </p>
<p>Also can you recommend a blog or tutorial or answer below how best to check for mobile devices? Do we as the programmer need to know each variation of user agent in order to redirect them to our mobile site? </p>
<p>Finally, would you program a mobile site for the iPhone/Touch Safari browser or just leave the site as is?</p>
| [
{
"answer_id": 15168,
"author": "crashmstr",
"author_id": 1441,
"author_profile": "https://Stackoverflow.com/users/1441",
"pm_score": 2,
"selected": false,
"text": "<script type=\"application/x-javascript\">\n\n if (navigator.userAgent.indexOf('iPhone') != -1) {\n addEventListener(\"... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/648/"
] |
9,455 | <p>Has anyone been able to get xinc to run correctly under OpenBSD's chrooted default Apache? I'd like to keep our development server running fully chrooted just like our Production server so that we make sure our code runs just fine chrooted.</p>
| [
{
"answer_id": 24990,
"author": "Henrik Gustafsson",
"author_id": 2010,
"author_profile": "https://Stackoverflow.com/users/2010",
"pm_score": 1,
"selected": false,
"text": "systrace -A -d. <app>\nldd <app>\n"
},
{
"answer_id": 36964,
"author": "Till",
"author_id": 2859,
... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] |
9,473 | <p>I have a custom control that implements IPostBackEventHandler. Some client-side events invoke __doPostBack(controlID, eventArgs).</p>
<p>The control is implemented in two different user controls. In one control, RaisePostBackEvent is fired on the server-side when <code>__doPostBack</code> is invoked. In the other control, RaisePostBackEvent is never invoked. I checked the <code>__EVENTTARGET</code> parameter and it does match the ClientID of the control... where else might I look to troubleshoot this?</p>
| [
{
"answer_id": 9523,
"author": "Lars Mæhlum",
"author_id": 960,
"author_profile": "https://Stackoverflow.com/users/960",
"pm_score": 0,
"selected": false,
"text": "public class MyControl : UserControl {}\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67/"
] |
9,486 | <p>I could swear I've seen people typing function headers and then hitting some key combination to auto-create function braces and insert the cursor between them like so:</p>
<pre><code>void foo()_
</code></pre>
<p>to</p>
<pre><code>void foo()
{
_
}
</code></pre>
<p>Is this a built-in feature?</p>
| [
{
"answer_id": 9494,
"author": "Luke",
"author_id": 327,
"author_profile": "https://Stackoverflow.com/users/327",
"pm_score": 3,
"selected": false,
"text": "Sub FunctionBraces()\n DTE.ActiveDocument.Selection.NewLine\n DTE.ActiveDocument.Selection.Text = \"{}\"\n DTE.ActiveDocum... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/327/"
] |
9,508 | <p>This should be fine seeing as the CLR hasn't actually changed?</p>
<p>The boxes running the C# 2.0 code <strong>have</strong> had .NET 3.5 rolled out.</p>
<p>The background is that we have a windows service (.NET 2.0 exe built with VS2005, deployed to ~150 servers) that dynamically loads assemblies (almost like plug-ins) to complete various work items asked of it. Whenever we roll out a new version of the bus logic, we just drop the assemblies on an FTP server and the windows service knows how to check for, grab and store the latest versions. New assemblies are now built using VS2008 and targetting .NET 2.0, we know that works ok. However we'd like to start taking advantage of C# 3.0 language features such as LINQ and targetting the assemblies against .NET 3.5 without having to build and deploy a new version of the windows service.</p>
| [
{
"answer_id": 9526,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 4,
"selected": true,
"text": "yield"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419/"
] |
9,612 | <p>I'm trying to set the group type for a new Active Directory Entry via VB.NET and DirectoryServices to create a distribution list.</p>
<p>How do I access the ADS_GROUP_TYPE enumerations?</p>
<p>Specifically I'm after ADS_GROUP_TYPE_GLOBAL_GROUP.</p>
| [
{
"answer_id": 9617,
"author": "David A Gibson",
"author_id": 982,
"author_profile": "https://Stackoverflow.com/users/982",
"pm_score": 0,
"selected": false,
"text": " Const ADS_GROUP_TYPE_GLOBAL_GROUP As Object = &H2\n adNewGroup.Properties(\"groupType\").Value = ADS_GROUP... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/982/"
] |
9,614 | <p>Suppose we have a table A:</p>
<pre><code>itemid mark
1 5
2 3
</code></pre>
<p>and table B:</p>
<pre><code>itemid mark
1 3
3 5
</code></pre>
<p>I want to join A*B on A.itemid=B.itemid both right and left ways. i.e. result:</p>
<pre><code>itemid A.mark B.mark
1 5 3
2 3 NULL
3 NULL 5
</code></pre>
<p>Is there a way to do it in one query in MySQL?</p>
| [
{
"answer_id": 9625,
"author": "roo",
"author_id": 716,
"author_profile": "https://Stackoverflow.com/users/716",
"pm_score": 2,
"selected": false,
"text": "select distinct T.itemid, A.mark as \"A.mark\", B.mark as \"B.mark\"\n from (select * from A union select * from B) T \n left ... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/844/"
] |
9,632 | <p>Apparantly when users right-click in our WPF application, and they use the Windows Classic theme, the default ContextMenu of the TextBox (which contains Copy, Cut and Paste) has a black background.</p>
<p>I know this works well:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox ContextMenu="{x:Null}"/>
</Page>
</code></pre>
<p>But this doesn't work:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
<Setter Property="ContextMenu" Value="{x:Null}"/>
</Style>
</Page.Resources>
<TextBox/>
</Page>
</code></pre>
<p>Does anyone know how to style or disable the default ContextMenu for all TextBoxes in WPF?</p>
| [
{
"answer_id": 9864,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": " <Style\n TargetType=\"{x:Type ToolTip}\">\n <Setter\n Property=\"Template\">\n <Setter.Value>\n <Control... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/900/"
] |
9,650 | <p>I've been wanting to teach myself Lisp for a while. However, all the interpreters of which I've heard involve some flavor of emacs.
Are there any command line interpreters, such that I could type this into the command line:</p>
<blockquote>
<p>lispinterpret sourcefile.lisp</p>
</blockquote>
<p>just like I can run perl or python.</p>
<p>While I'd also like to become more familiar with Emacs (if only not to be frustrated when I work with somebody who uses Emacs), I'd rather decouple learning Emacs from learning Lisp.</p>
<p>Edit: I actually want to follow SICP which uses Scheme, so an answer about Scheme would be more useful. I'm just not that familiar with the differences.</p>
| [
{
"answer_id": 14731001,
"author": "pnkfelix",
"author_id": 36585,
"author_profile": "https://Stackoverflow.com/users/36585",
"pm_score": 2,
"selected": false,
"text": "scheme"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] |
9,666 | <p>I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.</p>
<p>However, I was looking through System.Web.Security.Membership using Reflector and found code like this:</p>
<pre><code>public static class Membership
{
private static bool s_Initialized = false;
private static object s_lock = new object();
private static MembershipProvider s_Provider;
public static MembershipProvider Provider
{
get
{
Initialize();
return s_Provider;
}
}
private static void Initialize()
{
if (s_Initialized)
return;
lock(s_lock)
{
if (s_Initialized)
return;
// Perform initialization...
s_Initialized = true;
}
}
}
</code></pre>
<p>Why is the s_Initialized field read outside of the lock? Couldn't another thread be trying to write to it at the same time? <strong>Are reads and writes of variables atomic?</strong> </p>
| [
{
"answer_id": 9682,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 0,
"selected": false,
"text": "//Perform initialization"
},
{
"answer_id": 9689,
"author": "John Richardson",
"author_id": 887,
"author_profi... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016/"
] |
9,667 | <p>Given a handle of type <code>HWND</code> is it possible to confirm that the handle represents a real window?</p>
| [
{
"answer_id": 9670,
"author": "Serge",
"author_id": 1007,
"author_profile": "https://Stackoverflow.com/users/1007",
"pm_score": 5,
"selected": true,
"text": "IsWindow"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/887/"
] |
9,673 | <p>I have been working with a <code>string[]</code> array in C# that gets returned from a function call. I could possibly cast to a <code>Generic</code> collection, but I was wondering if there was a better way to do it, possibly by using a temp array.</p>
<p><strong>What is the best way to remove duplicates from a C# array?</strong></p>
| [
{
"answer_id": 9685,
"author": "Jeff Atwood",
"author_id": 1,
"author_profile": "https://Stackoverflow.com/users/1",
"pm_score": 10,
"selected": true,
"text": "int[] s = { 1, 2, 3, 3, 4};\nint[] q = s.Distinct().ToArray();\n"
},
{
"answer_id": 9755,
"author": "GateKiller",
... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/493/"
] |
9,687 | <p>I'm looking for a pattern for performing a dynamic search on multiple tables.</p>
<p>I have no control over the legacy (and poorly designed) database table structure.</p>
<p>Consider a scenario similar to a resume search where a user may want to perform a search against any of the data in the resume and get back a list of resumes that match their search criteria. Any field can be searched at anytime and in combination with one or more other fields.</p>
<p>The actual sql query gets created dynamically depending on which fields are searched. Most solutions I've found involve complicated if blocks, but I can't help but think there must be a more elegant solution since this must be a solved problem by now.</p>
<hr>
<p>Yeah, so I've started down the path of dynamically building the sql in code. Seems godawful. If I really try to support the requested ability to query any combination of any field in any table this is going to be one MASSIVE set of if statements. <em>shiver</em></p>
<hr>
<p>I believe I read that COALESCE only works if your data does not contain NULLs. Is that correct? If so, no go, since I have NULL values all over the place.</p>
| [
{
"answer_id": 9889,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "Users\n-----------\nName nvarchar(20)\nNickname nvarchar(10)\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1097/"
] |
9,734 | <p>Why does C#.Net allow the declaration of the string object to be case-insensitive?</p>
<pre><code>String sHello = "Hello";
string sHello = "Hello";
</code></pre>
<p>Both the lower-case and upper-case S of the word String are acceptable and this seems to be the only object that allows this.</p>
<p>Can anyone explain why?</p>
| [
{
"answer_id": 9742,
"author": "ZombieSheep",
"author_id": 377,
"author_profile": "https://Stackoverflow.com/users/377",
"pm_score": 0,
"selected": false,
"text": "string myString = \"Hello\";\n"
},
{
"answer_id": 9747,
"author": "Keith",
"author_id": 905,
"author_pro... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] |
9,750 | <p>I was reading Joel's book where he was suggesting as interview question:</p>
<blockquote>
<p>Write a program to reverse the "ON" bits in a given byte.</p>
</blockquote>
<p>I only can think of a solution using C. </p>
<p>Asking here so you can show me how to do in a Non C way (if possible)</p>
| [
{
"answer_id": 9752,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 2,
"selected": false,
"text": "; al is input register\n; bl is output register\n\nxor bl, bl ; clear output\n\n; first bit\nrcl al, 1 ; rot... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/123/"
] |
9,805 | <p>I am currently writing a small calendar in ASP.Net C#. Currently to produce the rows of the weeks I do the following for loop:</p>
<pre><code>var iWeeks = 6;
for (int w = 0; w < iWeeks; w++) {
</code></pre>
<p>This works fine, however, some month will only have 5 weeks and in some rare cases, 4.</p>
<p>How can I calculate the number of rows that will be required for a particular month?</p>
<p>This is an example of what I am creating:</p>
<p><img src="https://i.stack.imgur.com/NkxN7.png" alt="enter image description here"></p>
<p>As you can see for the above month, there are only 5 rows required, however. Take the this month (August 2008) which started on a Saturday and ends on a Monday on the 6th Week/Row.</p>
<p><strong><em>Image found on google</em></strong></p>
<hr>
<p>This is an example of what I am creating:</p>
<p><img src="https://i.stack.imgur.com/NkxN7.png" alt="enter image description here"></p>
<p>As you can see for the above month, there are only 5 rows required, however. Take the this month (August 2008) which started on a Saturday and ends on a Monday on the 6th Week/Row.</p>
<p><strong><em>Image found on google</em></strong></p>
| [
{
"answer_id": 9810,
"author": "kokos",
"author_id": 1065,
"author_profile": "https://Stackoverflow.com/users/1065",
"pm_score": 0,
"selected": false,
"text": "var days = DateTime.DaysInMonth(year, month) + \n WhatDayOfWeekTheMonthStarts(year, month); \nint rows = (days / 7)... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] |
9,831 | <p>I've asked this question to the forums on the Mootools website and one person said that my class selection was corrupted before an admin came along and changed my post status to invalid. Needless to say this did not help much. I then posted to a google group for Mootools with no response. My question is why doesn't the 'enter', 'leave', 'drop' events fire for my '.drop' elements? The events for the .drag elements are working.</p>
<pre><code><title>Untitled Page</title>
<script type="text/javascript" src="/SDI/includes/mootools-1.2.js"></script>
<script type="text/javascript" src="/SDI/includes/mootools-1.2-more.js"></script>
<script type="text/javascript" charset="utf-8">
window.addEvent('domready', function() {
var fx = [];
$$('#draggables div').each(function(drag){
new Drag.Move(drag, {
droppables: $$('#droppables div'),
onDrop: function(element, droppable){
if(!droppable) {
}
else {
element.setStyle('background-color', '#1d1d20');
}
element.dispose();
},
onEnter: function(element, droppable){
element.setStyle('background-color', '#ffffff');
},
onLeave: function(element, droppable){
element.setStyle('background-color', '#000000');
}
});
});
$$('#droppables div').each(function(drop, index){
drop.addEvents({
'enter': function(el, obj){
drop.setStyle('background-color', '#78ba91');
},
'leave': function(el, obj){
drop.setStyle('background-color', '#1d1d20');
},
'drop': function(el, obj){
el.remove();
}
});
});
});
</script>
<form id="form1" runat="server">
<div>
<div id="draggables">
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
</div>
<div id="droppables">
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
</div>
</div>
</form>
</code></pre>
| [
{
"answer_id": 9935722,
"author": "Neil",
"author_id": 1302175,
"author_profile": "https://Stackoverflow.com/users/1302175",
"pm_score": 1,
"selected": false,
"text": "droppables"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1491425/"
] |
9,882 | <p>I am working on a project that requires the parsing of log files. I am looking for a fast algorithm that would take groups messages like this:</p>
<blockquote>
<p>The temperature at P1 is 35F.</p>
<p>The temperature at P1 is 40F.</p>
<p>The temperature at P3 is 35F.</p>
<p>Logger stopped.</p>
<p>Logger started.</p>
<p>The temperature at P1 is 40F.</p>
</blockquote>
<p>and puts out something in the form of a printf():</p>
<pre><code>"The temperature at P%d is %dF.", Int1, Int2"
{(1,35), (1, 40), (3, 35), (1,40)}
</code></pre>
<p>The algorithm needs to be generic enough to recognize almost any data load in message groups.</p>
<p>I tried searching for this kind of technology, but I don't even know the correct terms to search for.</p>
| [
{
"answer_id": 10576,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 0,
"selected": false,
"text": "*scanf"
},
{
"answer_id": 10589,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Sta... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
9,905 | <p>Is there a way to check to see if an Microsoft Office process (i.e. Word, Excel) has hung when using Office Automation? Additionally, if the process is hung, is there a way to terminate it?</p>
| [
{
"answer_id": 9947,
"author": "Ed Schwehm",
"author_id": 1206,
"author_profile": "https://Stackoverflow.com/users/1206",
"pm_score": 0,
"selected": false,
"text": "private Microsoft.Office.Interop.Excel.Application _excel;\n// ... do some stuff ...\n_excel.Quit();\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185/"
] |
9,928 | <p>I am working on a small webapp and I want to use Groovy to write some unit testing for my app. Most of my coding is done on Eclipse and I really want to run all the unit testing with the graphical test runner within Eclipse (I really like the green bar :) )</p>
<p>Sadly, after 4 hours of try-and-error, I'm still not able to setup properly. I tried to use the Eclipse Junit4 test runner to run a Groovy file with method annotated for testing using <code>@Test</code>. But it keeps complaining <code>NoClassDefFoundException</code></p>
<p>Anyone can help? </p>
<p>Here is content of my groovy file, named simpleTest.groovy</p>
<pre><code>import org.junit.Test
import static org.junit.Assert.assertEquals
class simpleTest{
@Test
void trial(){
assertEquals 6, 3+3
}
}
</code></pre>
<p>Anyone can help?</p>
| [
{
"answer_id": 79907,
"author": "Peter Kelley",
"author_id": 14893,
"author_profile": "https://Stackoverflow.com/users/14893",
"pm_score": 1,
"selected": false,
"text": "_ECLIPSE"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/9928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
9,974 | <p>This is a question I asked on another forum which received some decent answers, but I wanted to see if anyone here has more insight.</p>
<p>The problem is that you have one of your pages in a web application timing out when it gets to a stored procedure call, so you use Sql Profiler, or your application trace logs, to find the query and you paste it into management studio to figure our why it's running slow. But you run it from there and it just blazes along, returning in less than a second each time.</p>
<p>My particular case was using ASP.NET 2.0 and Sql Server 2005, but I think the problem could apply to any RDBMS system.</p>
| [
{
"answer_id": 9982,
"author": "GateKiller",
"author_id": 383,
"author_profile": "https://Stackoverflow.com/users/383",
"pm_score": -1,
"selected": false,
"text": "DataAdapter.SelectCommand.CommandTimeout = 120;\n"
},
{
"answer_id": 9996,
"author": "Eric Z Beard",
"author... | 2008/08/13 | [
"https://Stackoverflow.com/questions/9974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] |
10,006 | <p>I have a silverlight 2 beta 2 application that accesses a WCF web service. Because of this, it currently can only use basicHttp binding. The webservice will return fairly large amounts of XML data. This seems fairly wasteful from a bandwidth usage standpoint as the response, if zipped, would be smaller by a factor of 5 (I actually pasted the response into a txt file and zipped it.). </p>
<p>The request does have the "Accept-Encoding: gzip, deflate" - Is there any way have the WCF service gzip (or otherwise compress) the response?</p>
<p>I did find this <a href="http://www.vistax64.com/indigo/113763-wcf-client-j2ee-server-using-gzip.html" rel="noreferrer">link</a> but it sure seems a bit complex for functionality that should be handled out-of-the-box IMHO.</p>
<p>OK - at first I marked the solution using the System.IO.Compression as the answer as I could never "seem" to get the IIS7 dynamic compression to work. Well, as it turns out:</p>
<ol>
<li><p>Dynamic Compression on IIS7 <strong>was</strong> working al along. It is just that Nikhil's Web Developer Helper plugin for IE did not show it working. My guess is that since SL hands the web service call off to the browser, that the browser handles it "under the covers" and Nikhil's tool never sees the compressed response. I was able to confirm this by using Fiddler which monitors traffic external to the browser application. In fiddler, the response was, in fact, gzip compressed!!</p></li>
<li><p>The other problem with the System.IO.Compression solution is that System.IO.Compression does not exist in the Silverlight CLR.</p></li>
</ol>
<p>So from my perspective, the EASIEST way to enable WCF compression in Silverlight is to enable Dynamic Compression in IIS7 and write no code at all.</p>
| [
{
"answer_id": 10040,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 4,
"selected": false,
"text": "public static class CompressedSerializer\n{\n /// <summary>\n /// Decompresses the specified compressed data.\n /// ... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/313/"
] |
10,042 | <p>What's the best way to make a linked list in Java?</p>
| [
{
"answer_id": 12432,
"author": "Juha Syrjälä",
"author_id": 1431,
"author_profile": "https://Stackoverflow.com/users/1431",
"pm_score": 5,
"selected": false,
"text": "list = new java.util.LinkedList()\n"
},
{
"answer_id": 25311,
"author": "Aaron",
"author_id": 2628,
... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/571/"
] |
10,059 | <p>I'm developing an MFC application and I've recently been searching for a good method to remove the icon from a Windows title bar, but retain the close button. The two obvious candidate solutions are turning off the system menu style or using the tool window style, but I would prefer not to disable the system menu or use the shrunken tool window title bar. Many MFC applications have this functionality, so I wonder: am I missing some standard way of doing this?</p>
| [
{
"answer_id": 10539,
"author": "Aidan Ryan",
"author_id": 1042,
"author_profile": "https://Stackoverflow.com/users/1042",
"pm_score": 0,
"selected": false,
"text": "int clickX = GET_X_LPARAM(lParam);\nint clickY = GET_Y_LPARAM(lParam);\n\nCRect frameRect;\nmainFrame.GetWindowRect(&frame... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,071 | <p>I'm working on an app that grabs and installs a bunch of updates off an an external server, and need some help with threading. The user follows this process:</p>
<ul>
<li>Clicks button</li>
<li>Method checks for updates, count is returned.</li>
<li>If greater than 0, then ask the user if they want to install using MessageBox.Show().</li>
<li>If yes, it runs through a loop and call BeginInvoke() on the run() method of each update to run it in the background.</li>
<li>My update class has some events that are used to update a progress bar etc. </li>
</ul>
<p>The progress bar updates are fine, but the MessageBox is not fully cleared from the screen because the update loop starts right after the user clicks yes (see screenshot below).</p>
<ul>
<li>What should I do to make the messagebox disappear instantly before the update loop starts?</li>
<li>Should I be using Threads instead of BeginInvoke()?</li>
<li>Should I be doing the initial update check on a separate thread and calling MessageBox.Show() from that thread?</li>
</ul>
<p><strong>Code</strong></p>
<pre><code>// Button clicked event handler code...
DialogResult dlgRes = MessageBox.Show(
string.Format("There are {0} updates available.\n\nInstall these now?",
um2.Updates.Count), "Updates Available",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2
);
if (dlgRes == DialogResult.Yes)
{
ProcessAllUpdates(um2);
}
// Processes a bunch of items in a loop
private void ProcessAllUpdates(UpdateManager2 um2)
{
for (int i = 0; i < um2.Updates.Count; i++)
{
Update2 update = um2.Updates[i];
ProcessSingleUpdate(update);
int percentComplete = Utilities.CalculatePercentCompleted(i, um2.Updates.Count);
UpdateOverallProgress(percentComplete);
}
}
// Process a single update with IAsyncResult
private void ProcessSingleUpdate(Update2 update)
{
update.Action.OnStart += Action_OnStart;
update.Action.OnProgress += Action_OnProgress;
update.Action.OnCompletion += Action_OnCompletion;
//synchronous
//update.Action.Run();
// async
IAsyncResult ar = this.BeginInvoke((MethodInvoker)delegate() { update.Action.Run(); });
}
</code></pre>
<p><strong>Screenshot</strong></p>
<p><a href="http://www.flickr.com/photos/brianly/2760435228/" rel="nofollow noreferrer" title="Windows Mobile Bug by BrianLy, on Flickr"><img src="https://farm4.static.flickr.com/3043/2760435228_1af7dbf365_o.gif" width="233" height="266" alt="Windows Mobile Bug" /></a></p>
| [
{
"answer_id": 10116,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackoverflow.com/users/1075",
"pm_score": 1,
"selected": false,
"text": "Application.DoEvents()\n"
},
{
"answer_id": 10157,
"author": "John Sibly",
"author_id": 1078,
"author... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636/"
] |
10,072 | <p>How do I write code where a company icon appears on the left side next to the URL address in the browser's address bar?</p>
| [
{
"answer_id": 10144,
"author": "y0mbo",
"author_id": 417,
"author_profile": "https://Stackoverflow.com/users/417",
"pm_score": 2,
"selected": false,
"text": "<head>"
},
{
"answer_id": 11896,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackover... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,123 | <p>I'm trying to decode the result of the Python os.wait() function. This returns, according to the Python docs:</p>
<blockquote>
<p>a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced.</p>
</blockquote>
<p>How do I decode the exit status indication (which is an integer) to obtain the high and low byte? To be specific, how do I implement the decode function used in the following code snippet:</p>
<pre><code>(pid,status) = os.wait()
(exitstatus, signum) = decode(status)
</code></pre>
| [
{
"answer_id": 10129,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 5,
"selected": true,
"text": "signum = status & 0xff\nexitstatus = (status & 0xff00) >> 8\n"
},
{
"answer_id": 10132,
"author": "Derek Park"... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/742/"
] |
10,149 | <p>For context, I am something of an emacs newbie. I haven't used it for very long, but have been using it more and more (I like it a lot). Also I'm comfortable with lisp, but not super familiar with elisp.</p>
<p>What I need to do is bind a regular expression to a keyboard combination because I use this particular regex so often.</p>
<p>What I've been doing: </p>
<pre><code>M-C-s ^.*Table\(\(.*\n\)*?GO\)
</code></pre>
<p>Note, I used newline above, but I've found that for <code>isearch-forward-regexp</code>, you really need to replace the <code>\n</code> in the regular expression with the result of <kbd>C-q Q-j</kbd>. This inserts a literal newline (without ending the command) enabling me to put a newline into the expression and match across lines.</p>
<p>How can I bind this to a key combination? </p>
<p>I vaguely understand that I need to create an elisp function which executes <code>isearch-forward-regexp</code> with the expression, but I'm fuzzy on the details. I've searched google and found most documentation to be a tad confusing.</p>
<p><em>How can I bind a regular expression to a key combination in emacs?</em></p>
<hr>
<p><strong>Mike Stone had the best answer so far -- not <em>exactly</em> what I was looking for but it worked for what I needed</strong> </p>
<p>Edit - this sort of worked, but after storing the macro, when I went back to use it later, I couldn't use it with <kbd>C-x e</kbd>. (i.e., if I reboot emacs and then type <kbd>M-x macro-name</kbd>, and then <kbd>C-x e</kbd>, I get a message in the minibuffer like 'no last kbd macro' or something similar)</p>
<hr>
<p>@Mike Stone - Thanks for the information. I tried creating a macro like so:</p>
<pre><code>C-x( M-C-s ^.*Table\(\(.*C-q C-J\)*?GO\) C-x)
</code></pre>
<p>This created my macro, but when I executed my macro I didn't get the same highlighting that I ordinarily get when I use <code>isearch-forward-regexp</code>. Instead it just jumped to the end of the next match of the expression. So that doesn't really work for what I need. Any ideas?</p>
<p>Edit: It looks like I <em>can</em> use macros to do what I want, I just have to think outside the box of <code>isearch-forward-regexp</code>. I'll try what you suggested.</p>
| [
{
"answer_id": 10161,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 4,
"selected": true,
"text": ".emacs"
},
{
"answer_id": 24920,
"author": "Natalie Weizenbaum",
"author_id": 2518,
"author_profile": "ht... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/92/"
] |
10,158 | <p>What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as <code>:</code>? For example: </p>
<ul>
<li><code>this</code> - okay</li>
<li><code>there:is</code> - not okay because of <code>:</code></li>
</ul>
<p>More practically, how can I match the following string: </p>
<pre><code>//foo/bar/baz[1]/ns:foo2/@attr/text()
</code></pre>
<p>For any node test on the xpath that doesn't include a namespace?</p>
<pre><code>(/)?(/)([^:/]+)
</code></pre>
<p>Will match the node tests but includes the namespace prefix which makes it faulty.</p>
| [
{
"answer_id": 10168,
"author": "Adam Lerman",
"author_id": 673,
"author_profile": "https://Stackoverflow.com/users/673",
"pm_score": 0,
"selected": false,
"text": "[any alpha numeric]\\*:[any alphanumeric]\\*"
},
{
"answer_id": 10186,
"author": "Community",
"author_id": ... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64/"
] |
10,190 | <p>Many applications have grids that display data from a database table one page at a time. Many of them also let the user pick the number of records per page, sort by any column, and navigate back and forth through the results.</p>
<p>What's a good algorithm to implement this pattern without bringing the entire table to the client and then filtering the data on the client. How do you bring just the records you want to display to the user?</p>
<p>Does LINQ simplify the solution?</p>
| [
{
"answer_id": 10194,
"author": "Michael Stum",
"author_id": 91,
"author_profile": "https://Stackoverflow.com/users/91",
"pm_score": 5,
"selected": true,
"text": "DECLARE @PageNum AS INT;\nDECLARE @PageSize AS INT;\nSET @PageNum = 2;\nSET @PageSize = 10;\n\nWITH OrdersRN AS\n(\n SELEC... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373/"
] |
10,205 | <p>I'm looking at parsing a delimited string, something on the order of</p>
<p>a,b,c</p>
<p>But this is a very simple example, and parsing delimited data can get complex; for instance</p>
<p>1,"Your simple algorithm, it fails",True</p>
<p>would blow your naiive string.Split implementation to bits. Is there anything I can freely use/steal/copy and paste that offers a relatively bulletproof solution to parsing delimited text? .NET, plox.</p>
<p><em>Update:</em> I decided to go with the <a href="http://msdn.microsoft.com/en-us/library/f68t4563.aspx" rel="nofollow noreferrer">TextFieldParser</a>, which is part of VB.NET's pile of goodies hidden away in Microsoft.VisualBasic.DLL.</p>
| [
{
"answer_id": 10223,
"author": "Stu",
"author_id": 414,
"author_profile": "https://Stackoverflow.com/users/414",
"pm_score": 2,
"selected": false,
"text": "var elements = new List<string>();\nvar current = new StringBuilder();\nvar p = 0;\n\nwhile (p < internalLine.Length) {\n if (in... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,228 | <p>Is there a way to get the tests inside of a <code>TestCase</code> to run in a certain order? For example, I want to separate the life cycle of an object from creation to use to destruction but I need to make sure that the object is set up first before I run the other tests.</p>
| [
{
"answer_id": 24670,
"author": "Gary Richardson",
"author_id": 2506,
"author_profile": "https://Stackoverflow.com/users/2506",
"pm_score": 3,
"selected": false,
"text": "setUp()"
},
{
"answer_id": 1915096,
"author": "mjs",
"author_id": 11543,
"author_profile": "https... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/204/"
] |
10,229 | <p>Consider this problem: I have a program which should fetch (let's say) 100 records from a database, and then for each one it should get updated information from a web service. There are two ways to introduce parallelism in this scenario:</p>
<ol>
<li><p>I start each request to the web service on a new Thread. The number of simultaneous threads is controlled by some external parameter (or dynamically adjusted somehow).</p></li>
<li><p>I create smaller batches (let's say of 10 records each) and launch each batch on a separate thread (so taking our example, 10 threads).</p></li>
</ol>
<p>Which is a better approach, and why do you think so?</p>
| [
{
"answer_id": 10484,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 4,
"selected": true,
"text": "using System.Net; // need this somewhere\n\n// need to declare an class so we can cast our state object back out\nclass Re... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380/"
] |
10,230 | <p>Which is more efficient for the compiler and the best practice for checking whether a string is blank? </p>
<ol>
<li>Checking whether the length of the string == 0</li>
<li>Checking whether the string is empty (strVar == "")</li>
</ol>
<p>Also, does the answer depend on language?</p>
| [
{
"answer_id": 10233,
"author": "Stu",
"author_id": 414,
"author_profile": "https://Stackoverflow.com/users/414",
"pm_score": 5,
"selected": true,
"text": "Length = 0"
},
{
"answer_id": 10234,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverfl... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288/"
] |
10,243 | <p>Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution?</p>
<p><em>edits below</em></p>
<p>@mabwi & @syd - Whether or not I agree about the use of a PNG is not the point. This is a problem that I need to solve!</p>
<p>@Tim Sullivan - IE7.js looks pretty cool, but I don't think I want to introduce all of the other changes an application. I'd like a solution that fixes the PNG issue exclusively. Thanks for the link.</p>
| [
{
"answer_id": 92530,
"author": "hugoware",
"author_id": 17091,
"author_profile": "https://Stackoverflow.com/users/17091",
"pm_score": 2,
"selected": false,
"text": "div.theImage {\n background : url(smile.png) top left no-repeat;\n height : 100px;\n width : 100px;\n... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/326/"
] |
10,274 | <p>When should I <strong>not</strong> use the ThreadPool in .Net?</p>
<p>It looks like the best option is to use a ThreadPool, in which case, why is it not the only option?</p>
<p>What are your experiences around this?</p>
| [
{
"answer_id": 10287,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "ThreadPool"
},
{
"answer_id": 10369,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://St... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380/"
] |
10,300 | <p>I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data and error messages? Also, where should the validation logic go? In the model or the controller? This seems to be one of the few areas where web forms are much stronger (I miss the validation controls).</p>
| [
{
"answer_id": 10364,
"author": "Iain Holder",
"author_id": 1122,
"author_profile": "https://Stackoverflow.com/users/1122",
"pm_score": 0,
"selected": false,
"text": "Update(int id, string name, string foo)\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/10300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/203/"
] |
10,303 | <p>I have some SQL Server DTS packages that import data from a FoxPro database. This was working fine until recently. Now the script that imports data from one of the FoxPro tables bombs out about 470,000 records into the import. I'm just pulling the data into a table with nullable varchar fields so I'm thinking it must be a weird/corrupt data problem.</p>
<p>What tools would you use to track down a problem like this?</p>
<p>FYI, this is the error I'm getting:</p>
<blockquote>
<p>Data for source column 1 ('field1') is not available. Your provider may require that all Blob columns be rightmost in the source result set.</p>
</blockquote>
<p>There should not be any blob columns in this table.</p>
<hr>
<p>Thanks for the suggestions. I don't know if it a corruption problem for sure. I just started downloading FoxPro from my MSDN Subscription, so I'll see if I can open the table. SSRS opens the table, it just chokes before running through all the records. I'm just trying to figure out which record it's having a problem with.</p>
| [
{
"answer_id": 10934,
"author": "PabloG",
"author_id": 394,
"author_profile": "https://Stackoverflow.com/users/394",
"pm_score": 0,
"selected": false,
"text": "SET TABLEVALIDATE 11\nUSE \"YourTable\" EXCLUSIVE && If the table is damaged VFP must display an error here\nPACK && To re... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/571/"
] |
10,308 | <p>Are you aware of any tool that creates diagrams showing the branch/merge activity in a SVN repository?</p>
<p>We've all seen these diagrams in various tutorials. Some good, some not so good. Can they be created automatically (or maybe with a little prodding -- you might have to tell it what if your branching philosophy is dev-test-prod, branch-per-release, etc.)</p>
<p>I'm looking at the TortoiseSVN Revision Graph right now, but it has more detail than I want and the wrong layout.</p>
<hr>
<p>Orion, thanks for the response. I guess since branching and merging are more a convention for managing files in a repository than a "built in feature of SVN, it would be pretty tough. I'll stick with the poorly-drawn diagram at the top of the whiteboard in our team's office.</p>
| [
{
"answer_id": 41939,
"author": "m104",
"author_id": 4039,
"author_profile": "https://Stackoverflow.com/users/4039",
"pm_score": 3,
"selected": false,
"text": "git svn init \"http://host/repo/location/trunk\"\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/10308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/763/"
] |
10,313 | <p>Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script?</p>
<p>What sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive to the library in question because the WSS site is only available to authenticate via NTLM on a port other than 80 or 443. I suppose I could alternately use the WSS web services to push the files out, but I'm really curious about the answer to this question now.</p>
| [
{
"answer_id": 10317,
"author": "Nathan Fellman",
"author_id": 1084,
"author_profile": "https://Stackoverflow.com/users/1084",
"pm_score": 1,
"selected": false,
"text": "copy src \\\\dest-machine\\shared-library-name\\dest\n"
},
{
"answer_id": 10385,
"author": "Abs",
"aut... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1245/"
] |
10,314 | <p>Being new to Objective-C (but a long term C/++) programmer I'm looking for advice/recommendations on naming conventions for variables.</p>
<p>My personal preference would be to utilize a prefix for instance variables both for clarity within functions and to prevent shadowing of function parameters. However I'm a fan of properties which rules out prefixes (unless you also prefix your property names, which doesn't work too well and looks daft). Similarly I could use the "self.variable" convention, but only if I make EVERYTHING a property.</p>
<p>So given the code below what's your preferred naming style for instance/function variables? And if you don't bother, how do you deal with shadowing on function params?</p>
<pre><code>@interface GridItem : NSObject
{
CGRect _rect;
...
}
@end
-(void) initFromRect:(CGRect)rect
{
_rect = rect;
...
}
</code></pre>
<p>Cheers!</p>
| [
{
"answer_id": 11994,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 5,
"selected": true,
"text": "IBOutlet"
},
{
"answer_id": 64371,
"author": "Scott Marcy",
"author_id": 8168,
"author_profile": "https... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1043/"
] |
10,323 | <p>I recently read a nice <a href="http://macdevelopertips.com/ruby/using-a-string-as-a-file-in-ruby.html" rel="noreferrer">post</a> on using <code>StringIO</code> in Ruby. What the author doesn't mention, though, is that <code>StringIO</code> is just an "I." There's no "O." You <em>can't</em> do this, for example:</p>
<pre><code>s = StringIO.new
s << 'foo'
s << 'bar'
s.to_s
# => should be "foo\nbar"
# => really is ''`
</code></pre>
<p>Ruby really needs a StringBuffer just like the one Java has. StringBuffers serve two important purposes. First, they let you test the output half of what Ruby's StringIO does. Second, they are useful for building up long strings from small parts -- something that Joel reminds us over and over again is otherwise very very slow.</p>
<p>Is there a good replacement?</p>
<p>It's true that Strings in Ruby are mutable, but that doesn't mean we should always rely on that functionality. If <code>stuff</code> is large, the performance and memory requirements of this, for example, is really bad.</p>
<pre><code>result = stuff.map(&:to_s).join(' ')
</code></pre>
<p>The "correct" way to do this in Java is:</p>
<pre><code>result = StringBuffer.new("")
for(String s : stuff) {
result.append(s);
}
</code></pre>
<p>Though my Java is a bit rusty.</p>
| [
{
"answer_id": 10335,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 2,
"selected": false,
"text": "first = \"Mike\"\nlast = \"Stone\"\nname = \"#{first} #{last}\"\n"
},
{
"answer_id": 10350,
"author": "Mike Ston... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] |
10,324 | <p>In C, what is the most efficient way to convert a string of hex digits into a binary <code>unsigned int</code> or <code>unsigned long</code>?</p>
<p>For example, if I have <code>0xFFFFFFFE</code>, I want an <code>int</code> with the base10 value <code>4294967294</code>.</p>
| [
{
"answer_id": 10327,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 6,
"selected": true,
"text": "strtol"
},
{
"answer_id": 10331,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Sta... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,349 | <p>I'm sure there is a good (or at least decent) reason for this. What is it?</p>
| [
{
"answer_id": 10359,
"author": "John Sibly",
"author_id": 1078,
"author_profile": "https://Stackoverflow.com/users/1078",
"pm_score": 4,
"selected": true,
"text": "myControl.BeginInvoke(myControl.UpdateFunction);\n"
},
{
"answer_id": 10439,
"author": "Brian Ensink",
"aut... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] |
10,366 | <p>I have an absolutely positioned <code>div</code> that I want to show when the user clicks a link. The <code>onclick</code> of the link calls a js function that sets the display of the div to block (also tried: "", <code>inline</code>, <code>table-cell</code>, <code>inline-table</code>, etc). This works great in IE7, not at all in every other browser I've tried (FF2, FF3, Opera 9.5, Safari).</p>
<p>I've tried adding alerts before and after the call, and they show that the display has changed from <code>none</code> to <code>block</code> but the <code>div</code> does not display.</p>
<p>I can get the <code>div</code> to display in FF3 if I change the display value using Firebug's HTML inspector (but not by running javascript through Firebug's console) - so I know it's not just showing up off-screen, etc.</p>
<p>I've tried everything I can think of, including:</p>
<ul>
<li>Using a different doctype (XHTML 1, HTML 4, etc)</li>
<li>Using visibility visible/hidden instead of display block/none</li>
<li>Using inline javascript instead of a function call</li>
<li>Testing from different machines</li>
</ul>
<p>Any ideas about what could cause this?</p>
| [
{
"answer_id": 10378,
"author": "Serhat Ozgel",
"author_id": 31505,
"author_profile": "https://Stackoverflow.com/users/31505",
"pm_score": 3,
"selected": false,
"text": "function show() {\n var d = document.getElementById('testdiv');\n d.style.display = 'block';\n}"
},
{
"answe... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521/"
] |
10,435 | <p>I have a website that works correctly under IIS 6.0: It authenticates users with windows credentials, and then when talking to the service that hits the DB, it passes the credentials.</p>
<p>In IIS 7.0, the same config settings do not pass the credentials, and the DB gets hit with NT AUTHORITY\ANONYMOUS.</p>
<p>Is there something I'm missing? I've turned ANONYMOUS access off in my IIS 7.0 website, but I can't get the thing to work.</p>
<p>These are the settings that I'm using on both IIS 6.0 and 7.0:</p>
<pre><code><authentication mode="Windows">
<identity impersonate="true">
</code></pre>
<p>What changed from 6.0 to 7.0?</p>
| [
{
"answer_id": 267243,
"author": "Maxime Rouiller",
"author_id": 24975,
"author_profile": "https://Stackoverflow.com/users/24975",
"pm_score": 4,
"selected": true,
"text": "<validation validateIntegratedModeConfiguration=\"false\"\n"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/10435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] |
10,443 | <p>I have this program, we'll call it Host. Host does all kinds of good stuff, but it needs to be able to accept input through the command line <strong>while it's running</strong>. This means it has to somehow send its other process data and then quit. For example, I need to be able to do this:</p>
<pre><code>./Host --blahblah 3 6 3 5
</code></pre>
<p>This should somehow end up calling some function in Host called</p>
<pre><code>handleBlahBlah(int x1, int y1, int x2, int y2){
//do some more sweet stuff
}
</code></pre>
<p>Host is a C program, and does not need to support multiple instances.</p>
<p>An example of this is Amarok music player. With Amarok running and playing, you can type "amarok --pause" and it will pause the music.</p>
<p>I need to be able to do this in Linux or Windows. Preferably Linux.</p>
<p>What is the cleanest way to implement this?</p>
| [
{
"answer_id": 10445,
"author": "Ed S.",
"author_id": 1053,
"author_profile": "https://Stackoverflow.com/users/1053",
"pm_score": -1,
"selected": false,
"text": " int main(int argc, *argv[])\n {\n /*loop through each argument and take action*/\n while (--argc > 0)\n {\n ... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] |
10,456 | <p>The 'click sound' in question is actually a system wide preference, so I only want it to be disabled when my application has focus and then re-enable when the application closes/loses focus.</p>
<p>Originally, I wanted to ask this question here on stackoverflow, but I was not yet in the beta. So, after googling for the answer and finding only a little bit of information on it I came up with the following and decided to post it here now that I'm in the beta.</p>
<pre><code>using System;
using Microsoft.Win32;
namespace HowTo
{
class WebClickSound
{
/// <summary>
/// Enables or disables the web browser navigating click sound.
/// </summary>
public static bool Enabled
{
get
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Current");
string keyValue = (string)key.GetValue(null);
return String.IsNullOrEmpty(keyValue) == false && keyValue != "\"\"";
}
set
{
string keyValue;
if (value)
{
keyValue = "%SystemRoot%\\Media\\";
if (Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor > 0)
{
// XP
keyValue += "Windows XP Start.wav";
}
else if (Environment.OSVersion.Version.Major == 6)
{
// Vista
keyValue += "Windows Navigation Start.wav";
}
else
{
// Don't know the file name so I won't be able to re-enable it
return;
}
}
else
{
keyValue = "\"\"";
}
// Open and set the key that points to the file
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\Explorer\Navigating\.Current", true);
key.SetValue(null, keyValue, RegistryValueKind.ExpandString);
isEnabled = value;
}
}
}
}
</code></pre>
<p>Then in the main form we use the above code in these 3 events: </p>
<ul>
<li>Activated </li>
<li>Deactivated </li>
<li><p>FormClosing</p>
<pre><code>private void Form1_Activated(object sender, EventArgs e)
{
// Disable the sound when the program has focus
WebClickSound.Enabled = false;
}
private void Form1_Deactivate(object sender, EventArgs e)
{
// Enable the sound when the program is out of focus
WebClickSound.Enabled = true;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
// Enable the sound on app exit
WebClickSound.Enabled = true;
}
</code></pre></li>
</ul>
<p>The one problem I see currently is if the program crashes they won't have the click sound until they re-launch my application, but they wouldn't know to do that.</p>
<p>What do you guys think? Is this a good solution? What improvements can be made?</p>
| [
{
"answer_id": 10463,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 5,
"selected": true,
"text": "webBrowser1.DocumentText = \"<h1>Hello, world!</h1>\";\n"
},
{
"answer_id": 4588327,
"author": "DjCzermino",
... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1147/"
] |
10,458 | <p>Ideally, I'm looking for a templated logical Set class. It would have all of the standard set operations such as Union, Intersection, Etc., and collapse duplicated items.</p>
<p>I ended up creating my own set class based on the C# Dictionary<>- just using the Keys.</p>
| [
{
"answer_id": 10459,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 6,
"selected": false,
"text": "HashSet<T>"
},
{
"answer_id": 50264359,
"author": "dharmatech",
"author_id": 268581,
"author_profile"... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,477 | <p>Currently, I'm attempting to make multiple beziers have equidistant points. I'm currently using cubic interpolation to find the points, but because the way beziers work some areas are more dense than others and proving gross for texture mapping because of the variable distance. <strong>Is there a way to find points on a bezier by distance rather than by percentage? Furthermore, is it possible to extend this to multiple connected curves?</strong></p>
| [
{
"answer_id": 34804516,
"author": "enc_life",
"author_id": 3166209,
"author_profile": "https://Stackoverflow.com/users/3166209",
"pm_score": 2,
"selected": false,
"text": "UIBezierPath"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/10477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1256/"
] |
10,478 | <p>One of the things I'd like to do in my browser-based application is allow the user to select some text (not in a <textarea>, just plain ol' text!), and have my application pop up a small toolbar that then can interact with the next (in my case, add annotations).</p>
<p>I've found a lot of stuff on google that seems to be focused on writing WYSIWYG editors, <strong>but that isn't what I want</strong>, and most of it worked in IE but not in FF2 or 3. Ideally, I'd like some function that can return the currently selected text in the browser window that works in <strong>IE7 (and 6 if possible), FireFox 2 & 3 and Safari 2</strong>. If it works in Opera, that'd be a bonus, but it's not a requirement.</p>
<p>Anyone have a function that does this? Or an idea of where to start?</p>
| [
{
"answer_id": 13914,
"author": "Polsonby",
"author_id": 137,
"author_profile": "https://Stackoverflow.com/users/137",
"pm_score": -1,
"selected": false,
"text": "var str = (window.getSelection) ? window.getSelection() : document.selection.createRange();\nstr = str.text || str;\nstr = st... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/722/"
] |
10,486 | <p>What kind of execution rate do you aim for with your unit tests (# test per second)? How long is too long for an individual unit test? </p>
<p>I'd be interested in knowing if people have any specific thresholds for determining whether their tests are too slow, or is it just when the friction of a long running test suite gets the better of you? </p>
<p>Finally, when you do decide the tests need to run faster, what techniques do you use to speed up your tests?</p>
<p><em>Note: integration tests are obviously a different matter again. We are strictly talking unit tests that need to be run as frequently as possible.</em></p>
<hr>
<p><strong>Response roundup:</strong> Thanks for the great responses so far. Most advice seems to be don't worry about the speed -- concentrate on quality and just selectively run them if they are too slow. Answers with specific numbers have included aiming for <10ms up to 0.5 and 1 second per test, or just keeping the entire suite of commonly run tests under 10 seconds. </p>
<p>Not sure whether it's right to mark one as an "accepted answer" when they're all helpful :)</p>
| [
{
"answer_id": 313692,
"author": "Daniel Schierbeck",
"author_id": 20321,
"author_profile": "https://Stackoverflow.com/users/20321",
"pm_score": 0,
"selected": false,
"text": "app/models/foo.rb"
}
] | 2008/08/13 | [
"https://Stackoverflow.com/questions/10486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/906/"
] |
10,499 | <p>Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.</p>
<p>What's the best way to figure this out? ++happy for various platform solutions. </p>
| [
{
"answer_id": 10501,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 5,
"selected": false,
"text": "$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'open.*tnsnames.ora'\n"
},
{
"answer_id": 29807,
"author":... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] |
10,506 | <p>I am having a strange DB2 issue when I run DBUnit tests. My DBUnit tests are highly customized, but I don't think it is the issue. When I run the tests, I get a failure: </p>
<blockquote>
<p>SQLCODE: -1084, SQLSTATE: 57019</p>
</blockquote>
<p><a href="https://www1.columbia.edu/sec/acis/db2/db2m0/sql1000.htm" rel="nofollow noreferrer">which translates to</a> </p>
<blockquote>
<p>SQL1084C Shared memory segments cannot be allocated.</p>
</blockquote>
<p>It sounds like a weird memory issue, though here's the big strange thing. If I ssh to the test database server, then go in to db2 and do "connect to MY_DB", the tests start succeeding! This seems to have no relation to the supposed memory error that is being reported.</p>
<p>I have 2 tests, and the first one actually succeeds, the second one is the one that fails. However, it fails in the DBUnit setup code, when it is obtaining the connection to the DB server to load my xml dataset.</p>
<p>Any ideas what might be going on?</p>
| [
{
"answer_id": 10501,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 5,
"selected": false,
"text": "$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'open.*tnsnames.ora'\n"
},
{
"answer_id": 29807,
"author":... | 2008/08/13 | [
"https://Stackoverflow.com/questions/10506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
10,515 | <p>Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for <em>IIS</em> on windows.</p>
| [
{
"answer_id": 10547,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 2,
"selected": false,
"text": "fcgiconfig.js"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] |
10,532 | <p>I've been using PHP & MySQL for ages and am about to start using PostgreSQL instead.</p>
<p>What's the preferred method? </p>
<p>Is it via the PDO objects or is there something better?</p>
| [
{
"answer_id": 10689,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stackoverflow.com/users/486",
"pm_score": 2,
"selected": false,
"text": "require_once 'Zend/Db.php';\n$DB_ADAPTER = 'Pdo_Pgsql';\n$DB_CONFIG = array(\n 'username' => 'app_db_user',\n 'password' => ... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] |
10,533 | <p>Here's a problem I ran into recently. I have attributes strings of the form</p>
<pre><code>"x=1 and y=abc and z=c4g and ..."
</code></pre>
<p>Some attributes have numeric values, some have alpha values, some have mixed, some have dates, etc.</p>
<p>Every string is <em>supposed</em> to have "<code>x=someval and y=anotherval</code>" at the beginning, but some don't. I have three things I need to do. </p>
<ol>
<li>Validate the strings to be certain that they have <code>x</code> and <code>y</code>. </li>
<li>Actually parse the values for <code>x</code> and <code>y</code>.</li>
<li>Get the rest of the string.</li>
</ol>
<p>Given the example at the top, this would result in the following variables:</p>
<pre><code>$x = 1;
$y = "abc";
$remainder = "z=c4g and ..."
</code></pre>
<p>My question is: Is there a (reasonably) simple way to parse these <em>and</em> validate with a single regular expression? i.e.:</p>
<pre><code>if ($str =~ /someexpression/)
{
$x = $1;
$y = $2;
$remainder = $3;
}
</code></pre>
<p>Note that the string may consist of <em>only</em> <code>x</code> and <code>y</code> attributes. This is a valid string.</p>
<p>I'll post my solution as an answer, but it doesn't meet my single-regex preference.</p>
| [
{
"answer_id": 10537,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 0,
"selected": false,
"text": "($x_str, $y_str, $remainder) = split(/ and /, $str, 3);\n\nif ($x_str !~ /x=(.*)/)\n{\n # error\n}\n\n$x = $1;\n\nif ($y_... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/872/"
] |
10,564 | <p>I'm trying out <strong>Git on Windows</strong>. I got to the point of trying "git commit" and I got this error:</p>
<blockquote>
<p>Terminal is dumb but no VISUAL nor
EDITOR defined. Please supply the
message using either -m or -F option.</p>
</blockquote>
<p>So I figured out I need to have an environment variable called EDITOR. No problem. I set it to point to Notepad. That worked, almost. The default commit message opens in Notepad. But Notepad doesn't support bare line feeds. I went out and got <a href="http://notepad-plus.sourceforge.net/uk/site.htm" rel="noreferrer">Notepad++</a>, but I can't figure out how to get Notepad++ set up as the <code>%EDITOR%</code> in such a way that it works with Git as expected.</p>
<p>I'm not married to Notepad++. At this point I don't mind what editor I use. I just want to be able to <strong>type commit messages in an editor</strong> rather than the command line (with <code>-m</code>).</p>
<p>Those of you using Git on Windows: What tool do you use to edit your commit messages, and what did you have to do to make it work?</p>
| [
{
"answer_id": 10574,
"author": "J Wynia",
"author_id": 1124,
"author_profile": "https://Stackoverflow.com/users/1124",
"pm_score": 1,
"selected": false,
"text": "git commit -m \"Fixed the LoadAll method\"\n"
},
{
"answer_id": 10625,
"author": "Patrick Johnmeyer",
"author... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437/"
] |
10,580 | <p>What is the difference between early and late binding?</p>
| [
{
"answer_id": 10581,
"author": "Ed S.",
"author_id": 1053,
"author_profile": "https://Stackoverflow.com/users/1053",
"pm_score": 3,
"selected": false,
"text": " Dim oXL As Object\n Set oXL = CreateObject(\"Excel.Application\")\n"
},
{
"answer_id": 10582,
"author": "James A. ... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] |
10,586 | <p>I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again.</p>
<p>I have intended to use a StAX parser (<code>javax.xml.stream.XMLStreamReader</code>) to read in each event, see if it was one I wanted to change, and then pass it straight on to the StAX writer (<code>javax.xml.stream.XMLStreamReader</code>) if no changes were required.</p>
<p>Unfortunately, that doesn't look to be so simple - The writer has no way to take an event type and a parser object, only methods like <code>writeAttribute</code> and <code>writeStartElement</code>. Obviously I could write a big switch statement with a case for every possible type of element which can occur in an XML document, and just write it back out again, but it seems like a lot of trouble for something which seems like it should be simple.</p>
<p>Is there something I'm missing that makes it easy to write out a very similar XML document to the one you read in with StAX?</p>
| [
{
"answer_id": 3453006,
"author": "StaxMan",
"author_id": 59501,
"author_profile": "https://Stackoverflow.com/users/59501",
"pm_score": 2,
"selected": false,
"text": "XMLStreamWriter2.copyEventFromReader(XMLStreamReader2 r, boolean preserveEventData) \n"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] |
10,595 | <p>I've grokked the code for all the aforementioned apps and I still can't find a straightforward way to create a static directory structure from a single command.</p>
| [
{
"answer_id": 10613,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 0,
"selected": false,
"text": "cp -r <template> <destination>\n"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1263/"
] |
10,599 | <p>I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users.</p>
<p>What's the best/easiest solution.
BTW: easiest scores 65% of total points</p>
<p>Edit:
What if best was 65% of total points?</p>
| [
{
"answer_id": 10609,
"author": "mbillard",
"author_id": 810,
"author_profile": "https://Stackoverflow.com/users/810",
"pm_score": 0,
"selected": false,
"text": "... onSubmit=\"return validateForm();\" ...\n"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] |
10,610 | <p>Does anyone use have a good regex library that they like to use? Most of the regexes that you find online either contain bugs or are so focused on the edge cases that it turns into a competition to validate whatever spec 100%. Of course you can write your own, but when you are billing by the hour its handy to have a library around. </p>
| [
{
"answer_id": 34544283,
"author": "gsl",
"author_id": 2048692,
"author_profile": "https://Stackoverflow.com/users/2048692",
"pm_score": 0,
"selected": false,
"text": "Regexp::Common::balanced\nProvides regexes for strings with balanced parenthesized delimiters.\n\nRegexp::Common::commen... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/805/"
] |
10,616 | <p>I'm an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="noreferrer">ASP.NET</a> developer who has used <code>Microsoft SQL Server</code> for all my database needs (both at work and for personal projects). </p>
<p>I am considering trying out the <a href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29" rel="noreferrer">LAMP</a> stack for some of my personal projects. </p>
<p>What are some of the main differences between <code>MySQL</code> and <code>SQL Server</code>? Is using <a href="http://en.wikipedia.org/wiki/Stored_procedure" rel="noreferrer">stored procedures</a> a common practice in <code>MySQL</code>? </p>
<p>Any advice or resources you'd recommend to help me with the switch? </p>
<p>To those who have experience with both, are there any missing features from <code>MySQL</code>?</p>
| [
{
"answer_id": 10623,
"author": "Jeff Atwood",
"author_id": 1,
"author_profile": "https://Stackoverflow.com/users/1",
"pm_score": 8,
"selected": true,
"text": "SELECT age\nFROM person\nORDER BY age ASC\nLIMIT 1 OFFSET 2\n"
},
{
"answer_id": 51254,
"author": "Cebjyre",
"au... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285/"
] |
10,635 | <p>I wrote a simple batch file as a PowerShell script, and I am getting errors when they run.</p>
<p>It's in a scripts directory in my path. This is the error I get:</p>
<blockquote>
<p>Cannot be loaded because the execution of scripts is disabled on this system.
Please see "get-help about-signing".</p>
</blockquote>
<p>I looked in the help, but it's less than helpful.</p>
| [
{
"answer_id": 10638,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 8,
"selected": true,
"text": "set-executionpolicy remotesigned\n"
},
{
"answer_id": 10640,
"author": "Leon Bambrick",
"author_id": 49,
... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220/"
] |
10,658 | <p>I'm looking for a good method of generating an iCalendar file (*.ics) in c# (asp.net). I've found a couple resources, but one thing that has been lacking is their support for <strong>quoted-printable</strong> fields - fields that have carriage returns and line feeds.</p>
<p>For example, if the <strong>description</strong> field isn't encoded properly, only the first line will display and possibly corrupting the rest of the information in the *.ics file.</p>
<p>I'm looking for existing classes that can generate *.ics files and/or a class that can generate <strong>quoted-printable</strong> fields.</p>
| [
{
"answer_id": 870249,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": " DESCRIPTION:Meeting to provide technical review for \"Phoenix\"\n design.\\n Happy Face Conference Room. Phoenix design tea... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/519/"
] |
10,668 | <p>I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using <code>ptrace</code> with <code>PEEKDATA</code> and such, however it doesn't have that option on BSD <sup>[<a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/ptrace.2.html" rel="noreferrer"><code>man ptrace</code></a>]</sup>.</p>
<pre><code>int pid = fork();
if (pid > 0) {
// mess around with child-process's memory
}
</code></pre>
<p>How is it possible to read from and write to the memory of another process on Mac OS X?</p>
| [
{
"answer_id": 10676,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 4,
"selected": false,
"text": "ptrace()"
},
{
"answer_id": 63033,
"author": "Trance Diviner",
"author_id": 7365,
"author_profile": "htt... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1114/"
] |
10,680 | <p>Is there any difference between</p>
<pre><code> int on_exit(void (*function)(int , void *), void *arg);
</code></pre>
<p>and</p>
<pre><code> int atexit(void (*function)(void));
</code></pre>
<p>other than the fact that the function used by on_exit gets the exit status?</p>
<p>That is, if I don't care about the exit status, is there any reason to use one or the other?</p>
<p><strong>Edit:</strong> Many of the answers warned against <code>on_exit</code> because it's non-standard. If I'm developing an app that is for internal corporate use and guaranteed to run on specific configurations, should I worry about this? </p>
| [
{
"answer_id": 10684,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 4,
"selected": false,
"text": "atexit()"
},
{
"answer_id": 10686,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] |
10,752 | <p>I know the so-called textbook definition of unit tests and integration tests. What I am curious about is when it is time to write unit tests... I will write them to cover as many sets of classes as possible.</p>
<p>For example, if I have a <code>Word</code> class, I will write some unit tests for the <code>Word</code> class. Then, I begin writing my <code>Sentence</code> class, and when it needs to interact with the <code>Word</code> class, I will often write my unit tests such that they test both <code>Sentence</code> and <code>Word</code>... at least in the places where they interact.</p>
<p><em>Have these tests essentially become integration tests because they now test the integration of these 2 classes, or is it just a unit test that spans 2 classes?</em></p>
<p>In general, because of this uncertain line, I will rarely actually write integration tests... or is my using the finished product to see if all the pieces work properly the actual integration tests, even though they are manual and rarely repeated beyond the scope of each individual feature?</p>
<p>Am I misunderstanding integration tests, or is there really just very little difference between integration and unit tests?</p>
| [
{
"answer_id": 1223466,
"author": "Robert Koritnik",
"author_id": 75642,
"author_profile": "https://Stackoverflow.com/users/75642",
"pm_score": 5,
"selected": false,
"text": "Sentence"
},
{
"answer_id": 7876055,
"author": "Arialdo Martini",
"author_id": 202443,
"autho... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
10,793 | <p>I'm dynamically loading user controls adding them to the Controls collection of the web form.</p>
<p>I'd like to hide user controls if they cause a unhandled exception while rendering.</p>
<p>So, I tried hooking to the Error event of each UserControl but it seems that this event never fires for the UserControls as it does for Page class. </p>
<p>Did some googling around and it doesn't seem promising. Any ideas here?</p>
| [
{
"answer_id": 10797,
"author": "Michael Stum",
"author_id": 91,
"author_profile": "https://Stackoverflow.com/users/91",
"pm_score": 0,
"selected": false,
"text": "void Page_Load(object sender, System.EventArgs e)\n{\n throw(new ArgumentNullException());\n}\n\npublic void Page_Error(o... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1269/"
] |
10,808 | <p>Ok, so I've been refactoring my code in my little Rails app in an effort to remove duplication, and in general make my life easier (as I like an easy life). Part of this refactoring, has been to move code that's common to two of my models to a module that I can include where I need it.</p>
<p>So far, so good. Looks like it's going to work out, but I've just hit a problem that I'm not sure how to get around. The module (which I've called sendable), is just going to be the code that handles faxing, e-mailing, or printing a PDF of the document. So, for example, I have a purchase order, and I have Internal Sales Orders (imaginatively abbreviated to ISO).</p>
<p>The problem I've struck, is that I want some variables initialised (initialized for people who don't spell correctly :P ) after the object is loaded, so I've been using the <strong>after_initialize</strong> hook. No problem... until I start adding some more mixins.</p>
<p>The problem I have, is that I can have an <strong><code>after_initialize</code></strong> in any one of my mixins, so I need to include a <strong>super</strong> call at the start to make sure the other mixin <strong><code>after_initialize</code></strong> calls get called. Which is great, until I end up calling super and I get an error because there is no super to call.</p>
<p>Here's a little example, in case I haven't been confusing enough:</p>
<pre><code>class Iso < ActiveRecord::Base
include Shared::TracksSerialNumberExtension
include Shared::OrderLines
extend Shared::Filtered
include Sendable::Model
validates_presence_of :customer
validates_associated :lines
owned_by :customer
order_lines :despatched # Mixin
tracks_serial_numbers :items # Mixin
sendable :customer # Mixin
attr_accessor :address
def initialize( params = nil )
super
self.created_at ||= Time.now.to_date
end
end
</code></pre>
<p>So, if each one of the mixins have an after_initialize call, with a <strong>super</strong> call, how can I stop that last <strong>super</strong> call from raising the error? How can I test that the super method exists before I call it?</p>
| [
{
"answer_id": 11719,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 0,
"selected": false,
"text": "class ActiveRecord::Base\n def after_initialize\n end\nend\n"
},
{
"answer_id": 11744,
"author": "newto... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/841/"
] |
10,810 | <p>I'm doing a authorization check from a WinForms application with the help of the AzMan authorization provider from Enterprise Library and am receiving the the following error:</p>
<blockquote>
<p>Unable to update the password. The value provided as the current password is incorrect. (Exception from HRESULT: 0x8007052B) (Microsoft.Practices.EnterpriseLibrary.Security.AzMan) </p>
<hr>
<p>Unable to update the password. The value provided as the current password is incorrect. (Exception from HRESULT: 0x8007052B) (Microsoft.Interop.Security.AzRoles) </p>
</blockquote>
<p>The AzMan store is hosted in ADAM on another computer in the same domain. Other computers and users do not have this problem. The user making the call has read access to both ADAM and the AzMan store. The computer running the WinForms app and the computer running ADAM are both on Windows XP SP2.</p>
<p>I've had access problems with AzMan before that I've resolved, but this is a new one... What am I missing?</p>
| [
{
"answer_id": 11719,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 0,
"selected": false,
"text": "class ActiveRecord::Base\n def after_initialize\n end\nend\n"
},
{
"answer_id": 11744,
"author": "newto... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966/"
] |
10,819 | <p>For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.</p>
<p>What is the optimal way to create such a function?</p>
| [
{
"answer_id": 1479258,
"author": "Chadwick",
"author_id": 80714,
"author_profile": "https://Stackoverflow.com/users/80714",
"pm_score": 3,
"selected": false,
"text": "WITH Nbrs ( n ) AS (\n SELECT 1 UNION ALL\n SELECT 1 + n FROM Nbrs WHERE n < 500 )\nSELECT n FROM Nbrs\nOPTION ( M... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224/"
] |
10,822 | <p>What would be a very fast way to determine if your connectionstring lets you connect to a database?</p>
<p>Normally a connection attempt keeps the user waiting a long time before notifying the attempt was futile anyway.</p>
| [
{
"answer_id": 10824,
"author": "GateKiller",
"author_id": 383,
"author_profile": "https://Stackoverflow.com/users/383",
"pm_score": 5,
"selected": true,
"text": "server=<server>;database=<database>;uid=<user>;password=<password>;Connect Timeout=3\n"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1271/"
] |
10,825 | <p>In SQL Server I have a <code>DATETIME</code> column which includes a time element.</p>
<p>Example: </p>
<pre><code>'14 AUG 2008 14:23:019'
</code></pre>
<p>What is the <strong>best</strong> method to only select the records for a particular day, ignoring the time part?</p>
<p>Example: (Not safe, as it does not match the time part and returns no rows)</p>
<pre><code>DECLARE @p_date DATETIME
SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 )
SELECT *
FROM table1
WHERE column_datetime = @p_date
</code></pre>
<p><em>Note: Given this site is also about jotting down notes and techniques you pick up and then forget, I'm going to post my own answer to this question as DATETIME stuff in MSSQL is probably the topic I lookup most in SQLBOL.</em></p>
<hr>
<p><strong>Update</strong> Clarified example to be more specific.</p>
<hr>
<p><strong>Edit</strong> Sorry, But I've had to down-mod WRONG answers (answers that return wrong results).</p>
<p>@Jorrit: <code>WHERE (date>'20080813' AND date<'20080815')</code> will return the 13th and the 14th.</p>
<p>@wearejimbo: <em>Close, but no cigar!</em> badge awarded to you. You missed out records written at 14/08/2008 23:59:001 to 23:59:999 (i.e. Less than 1 second before midnight.)</p>
| [
{
"answer_id": 10826,
"author": "Guy",
"author_id": 993,
"author_profile": "https://Stackoverflow.com/users/993",
"pm_score": 6,
"selected": true,
"text": " DECLARE @p_date DATETIME\n SET @p_date = CONVERT( DATETIME, '14 AUG 2008', 106 )\n\n SELECT *\n FROM table1\n WHERE colum... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/993/"
] |
10,848 | <p>Does anybody know if it's possible, and how, to programmatically send a <strong>SMS</strong> from the <code>iPhone</code>, with the official SDK / Cocoa Touch?</p>
| [
{
"answer_id": 59159,
"author": "millenomi",
"author_id": 6061,
"author_profile": "https://Stackoverflow.com/users/6061",
"pm_score": 6,
"selected": false,
"text": "sms:[target phone number]"
},
{
"answer_id": 59200,
"author": "Adam Davis",
"author_id": 2915,
"author_... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
10,855 | <p>I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example:</p>
<pre><code>var results = from myRow in myDataTable
where results.Field("RowNo") == 1
select results;
</code></pre>
<p>This is not allowed. How do I get something like this working?</p>
<p>I'm amazed that LINQ queries are not allowed on DataTables!</p>
| [
{
"answer_id": 10857,
"author": "David Wengier",
"author_id": 489,
"author_profile": "https://Stackoverflow.com/users/489",
"pm_score": 4,
"selected": false,
"text": "var results = from myRow in myDataTable.Rows where myRow.Field(\"RowNo\") == 1 select myRow;\n"
},
{
"answer_id":... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445/"
] |
10,860 | <p>I am in the middle of a "discussion" with a colleague about the best way to implement the data layer in a new application.</p>
<p>One viewpoint is that the data layer should be aware of business objects (our own classes that represent an entity), and be able to work with that object natively. </p>
<p>The opposing viewpoint is that the data layer should be object-agnostic, and purely handle simple data types (strings, bools, dates, etc.)</p>
<p>I can see that both approaches may be valid, but my own viewpoint is that I prefer the former. That way, if the data storage medium changes, the business layer doesn't (necessarily) have to change to accommodate the new data layer. It would therefore be a trivial thing to change from a SQL data store to a serialized xml filesystem store.</p>
<p>My colleague's point of view is that the data layer shouldn't have to know about object definitions, and that as long as the data is passed about appropriately, that is enough. </p>
<p>Now, I know that this is one of those questions that has the potential to start a religious war, but I'd appreciate any feedback from the community on how you approach such things. </p>
<p>TIA</p>
| [
{
"answer_id": 10863,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "public IList<Foo> GetFoosById(int id) { ... }\n"
}
] | 2008/08/14 | [
"https://Stackoverflow.com/questions/10860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/377/"
] |
10,870 | <p>Once I've called <code>DragManager.acceptDrag</code> is there any way to "unaccept" the drag? Say that I have a view which can accept drag and drop, but only in certain areas. Once the user drags over one of these areas I call <code>DragManager.acceptDrag(this)</code> (from a <code>DragEvent.DRAG_OVER</code> handler), but if the user then moves out of this area I'd like to change the status of the drag to not accepted and show the <code>DragManager.NONE</code> feedback. However, neither calling <code>DragManager.acceptDrag(null)</code> nor <code>DragManager.showFeedback(DragManager.NONE)</code> seems to have any effect. Once I've accepted the drag an set the feedback type I can't seem to change it.</p>
<p>Just to make it clear: the areas where the user should be able to drop are not components or even display objects, in fact they are just ranges in the text of a text field (like the selection). Had they been components of their own I could have solved it by making each of them accept drag events individually. I guess I could create proxy components that float over the text to emulate it, but I'd rather not if it isn't necessary.</p>
<hr>
<p>I've managed to get it working in both AIR and the browser now, but only by putting proxy components on top of the ranges of text where you should be able to drop things. That way I get the right feedback and drops are automatically unaccepted on drag exit.</p>
<p>This is the oddest thing about D&D in AIR:</p>
<pre><code>DragManager.doDrag(initiator, source, event, dragImage, offsetX, offsetY);
</code></pre>
<p>In browser-based Flex, <code>offsetX</code> and <code>offsetY</code> should be negative (so says the documentation, and it works fine). However, when running <em>exactly the same code</em> in AIR you have to make the offsets positive. The same numbers, but positive. That is very, very weird.</p>
<hr>
<p>I've tested some more and what <a href="https://stackoverflow.com/questions/10870/how-can-i-unaccept-a-drag-in-flex#11209">@maclema</a> works, but not if you run in AIR. It seems like drag and drop in AIR is different. It's really, really weird because not only is the feedback not showing correctly, and it's not possible to unaccept, but the coordinates are also completely off. I just tried my application in a browser instead of AIR and dragging and dropping is completely broken.</p>
<p>Also, skipping the <code>dragEnter</code> handler works fine in AIR, but breaks everything when running in a browser.</p>
| [
{
"answer_id": 11209,
"author": "Matt MacLean",
"author_id": 22,
"author_profile": "https://Stackoverflow.com/users/22",
"pm_score": 3,
"selected": false,
"text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<mx:Application xmlns:mx=\"http://www.adobe.com/2006/mxml\" layout=\"absolute\">... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1109/"
] |
10,877 | <p>How can I left-align the numbers in an ordered list?</p>
<pre><code>1. an item
// skip some items for brevity
9. another item
10. notice the 1 is under the 9, and the item contents also line up
</code></pre>
<p>Change the character after the number in an ordered list?</p>
<pre><code>1) an item
</code></pre>
<p>Also is there a CSS solution to change from numbers to alphabetic/roman lists instead of using the type attribute on the ol element.</p>
<p>I am mostly interested in answers that work on Firefox 3.</p>
| [
{
"answer_id": 10887,
"author": "Marcus Downing",
"author_id": 1000,
"author_profile": "https://Stackoverflow.com/users/1000",
"pm_score": 5,
"selected": false,
"text": "li {\n list-style-type: decimal;\n list-style-position: inside;\n}\n"
},
{
"answer_id": 10889,
"auth... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486/"
] |
10,905 | <p>You should be able to create a generic form:</p>
<pre><code>public partial class MyGenericForm<T> :
Form where T : class
{
/* form code */
public List<T> TypedList { get; set; }
}
</code></pre>
<p>Is valid C#, and compiles. However the designer won't work and the form will throw a runtime exception if you have any images stating that it cannot find the resource.</p>
<p>I think this is because the windows forms designer assumes that the resources will be stored under the simple type's name.</p>
| [
{
"answer_id": 10906,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 0,
"selected": false,
"text": "internal class MyGenericForm:\n MyGenericForm<object> { }\n"
},
{
"answer_id": 57163033,
"author": "Ali Osman Yavu... | 2008/08/14 | [
"https://Stackoverflow.com/questions/10905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.