qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
14,464 | <p>I have a structure which I need to populate and write to disk (several actually).</p>
<p>An example is:</p>
<pre><code>byte-6
bit0 - original_or_copy
bit1 - copyright
bit2 - data_alignment_indicator
bit3 - PES_priority
bit4-bit5 - PES_scrambling control.
bit6-bit7 - reserved
</code></pre>
<p>In C I might do something like the following:</p>
<pre><code>struct PESHeader {
unsigned reserved:2;
unsigned scrambling_control:2;
unsigned priority:1;
unsigned data_alignment_indicator:1;
unsigned copyright:1;
unsigned original_or_copy:1;
};
</code></pre>
<p>Is there any way to do this in C# that would enable me to access the bits using the struct dereferencing dot operator? </p>
<p>For a couple of structures, I can just do bit shifting wrapped in an accessor function.</p>
<p>I have loads of structures to handle in this way, so I'm looking for something that's easier to read and quicker to write.</p>
| [
{
"answer_id": 14475,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 5,
"selected": false,
"text": "[StructLayout(LayoutKind.Explicit, Size=1, CharSet=CharSet.Ansi)]\npublic struct Foo \n{ [FieldOffset(0)]public byte orig... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1006/"
] |
14,491 | <p>What is the proper way for an MFC application to cleanly close itself?</p>
| [
{
"answer_id": 14492,
"author": "Mike",
"author_id": 1743,
"author_profile": "https://Stackoverflow.com/users/1743",
"pm_score": 4,
"selected": false,
"text": "AfxGetMainWnd()->PostMessage(WM_CLOSE);\n"
},
{
"answer_id": 14841,
"author": "Mat Noguchi",
"author_id": 1799,
... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1743/"
] |
14,504 | <p>I would really like to see a proportional font IDE, even if I have to build it myself (perhaps as an extension to Visual Studio). What I basically mean is MS Word style editing of code that sort of looks like the typographical style in <a href="http://www.research.att.com/~bs/3rd.html" rel="nofollow noreferrer">The C++ Programming Language book</a>.</p>
<p>I want to set tab stops for my indents and lining up function signatures and rows of assignment statements, which could be specified in points instead of fixed character positions. I would also like bold and italics. Various font sizes and even style sheets would be cool.</p>
<p>Has anyone seen anything like this out there or know the best way to start building one?</p>
| [
{
"answer_id": 14583,
"author": "Thomas Owens",
"author_id": 572,
"author_profile": "https://Stackoverflow.com/users/572",
"pm_score": 1,
"selected": false,
"text": "int var1 = 1 //Comment\nint longerVar = 2 //Comment\nint anotherVar = 4 //Command\n int var2 = 1 //Comment\nint long... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1659/"
] |
14,505 | <p>In the Full .NET framework you can use the Color.FromArgb() method to create a new color with alpha blending, like this:</p>
<pre><code>Color blended = Color.FromArgb(alpha, color);
</code></pre>
<p>or</p>
<pre><code>Color blended = Color.FromArgb(alpha, red, green , blue);
</code></pre>
<p>However in the Compact Framework (2.0 specifically), neither of those methods are available, you only get:</p>
<pre><code>Color.FromArgb(int red, int green, int blue);
</code></pre>
<p>and</p>
<pre><code>Color.FromArgb(int val);
</code></pre>
<p>The first one, obviously, doesn't even let you enter an alpha value, but the documentation for the latter shows that "val" is a 32bit ARGB value (as 0xAARRGGBB as opposed to the standard 24bit 0xRRGGBB), so it would make sense that you could just build the ARGB value and pass it to the function. I tried this with the following:</p>
<pre><code>private Color FromARGB(byte alpha, byte red, byte green, byte blue)
{
int val = (alpha << 24) | (red << 16) | (green << 8) | blue;
return Color.FromArgb(val);
}
</code></pre>
<p>But no matter what I do, the alpha blending never works, the resulting color always as full opacity, even when setting the alpha value to 0.</p>
<p>Has anyone gotten this to work on the Compact Framework?</p>
| [
{
"answer_id": 2870347,
"author": "fede",
"author_id": 345622,
"author_profile": "https://Stackoverflow.com/users/345622",
"pm_score": 0,
"selected": false,
"text": "device.RenderState.AlphaBlendEnable = true;\ndevice.RenderState.AlphaFunction = Compare.Greater;\ndevice.RenderState.Alpha... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] |
14,527 | <p>I need to be able to find the last occurrence of a character within an element.</p>
<p>For example:</p>
<pre><code><mediaurl>http://www.blah.com/path/to/file/media.jpg</mediaurl>
</code></pre>
<p>If I try to locate it through using <code>substring-before(mediaurl, '.')</code> and <code>substring-after(mediaurl, '.')</code> then it will, of course, match on the first dot. </p>
<p>How would I get the file extension? Essentially, I need to get the file name and the extension from a path like this, but I am quite stumped as to how to do it using XSLT.</p>
| [
{
"answer_id": 14547,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": 0,
"selected": false,
"text": "Example: tokenize(\"XPath is fun\", \"\\s+\")\nResult: (\"XPath\", \"is\", \"fun\")\n"
},
{
"answer_id": 14686,
"au... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/274/"
] |
14,530 | <p>I took a look at the "Beginner's Guide to LINQ" post here on StackOverflow (<a href="https://stackoverflow.com/questions/8050/beginners-guide-to-linq">Beginners Guide to LINQ</a>), but had a follow-up question:</p>
<p>We're about to ramp up a new project where nearly all of our database op's will be fairly simple data retrievals (there's another segment of the project which already writes the data). Most of our other projects up to this point make use of stored procedures for such things. However, I'd like to leverage LINQ-to-SQL if it makes more sense.</p>
<p>So, the question is this: For simple data retrievals, which approach is better, LINQ-to-SQL or stored procs? Any specific pro's or con's?</p>
<p>Thanks.</p>
| [
{
"answer_id": 32688,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 5,
"selected": false,
"text": "var p = \n from n in x.AddressTypes \n where n.Name == \"Billing\" \n select n;\n\nvar p = \n from n in x.Address... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1683/"
] |
14,545 | <p>What I mean by autolinking is the process by which wiki links inlined in page content are generated into either a hyperlink to the page (if it does exist) or a create link (if the page doesn't exist).</p>
<p>With the parser I am using, this is a two step process - first, the page content is parsed and all of the links to wiki pages from the source markup are extracted. Then, I feed an array of the existing pages back to the parser, before the final HTML markup is generated.</p>
<p>What is the best way to handle this process? It seems as if I need to keep a cached list of every single page on the site, rather than having to extract the index of page titles each time. Or is it better to check each link separately to see if it exists? This might result in a lot of database lookups if the list wasn't cached. Would this still be viable for a larger wiki site with thousands of pages?</p>
| [
{
"answer_id": 31864,
"author": "palotasb",
"author_id": 3063,
"author_profile": "https://Stackoverflow.com/users/3063",
"pm_score": 0,
"selected": false,
"text": "SELECT title FROM articles"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14446/"
] |
14,577 | <p>Imagine the scene, you're updating some legacy Sybase code and come across a cursor. The stored procedure builds up a result set in a #temporary table which is all ready to be returned except that one of columns isn't terribly human readable, it's an alphanumeric code.</p>
<p>What we need to do, is figure out the possible distinct values of this code, call another stored procedure to cross reference these discrete values and then update the result set with the newly deciphered values:</p>
<pre><code>declare c_lookup_codes for
select distinct lookup_code
from #workinprogress
while(1=1)
begin
fetch c_lookup_codes into @lookup_code
if @@sqlstatus<>0
begin
break
end
exec proc_code_xref @lookup_code @xref_code OUTPUT
update #workinprogress
set xref = @xref_code
where lookup_code = @lookup_code
end
</code></pre>
<p>Now then, whilst this may give some folks palpitations, it does work. My question is, how best would one avoid this kind of thing?</p>
<p>_NB: for the purposes of this example you can also imagine that the result set is in the region of 500k rows and that there are 100 distinct values of look_up_code and finally, that it is not possible to have a table with the xref values in as the logic in proc_code_xref is too arcane._</p>
| [
{
"answer_id": 988077,
"author": "B0rG",
"author_id": 122093,
"author_profile": "https://Stackoverflow.com/users/122093",
"pm_score": 0,
"selected": false,
"text": "declare @lookup_code char(8)\n\nselect distinct lookup_code\ninto #lookup_codes\nfrom #workinprogress\n\nwhile 1=1\nbegin\n... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] |
14,582 | <p>I've been using Subversion for code control with TortoiseSVN to interface with the server for the past few months, and in general it's been going great! However, occasionally my FoxPro IDE will change the case of a file extension without warning where "<em>program.prg</em>" becomes "<em>program.<strong>PRG</em></strong>") TortoiseSVN apparently takes this to mean the first file was removed, becoming flagged as "missing" and the second name comes up as "non-versioned", wreaking havoc on my ability to track changes to the file. I understand that Subversion has it origins in the case-sensitive world of *nix but, is there any way to control this behavior in either Subversion or TortoiseSVN to be file name case-insensitive when used with Windows?</p>
| [
{
"answer_id": 51399368,
"author": "Hugo González Castro",
"author_id": 10098670,
"author_profile": "https://Stackoverflow.com/users/10098670",
"pm_score": 0,
"selected": false,
"text": "FixCaseSensitiveFileNames.bat call FixCaseSensitiveFileNames.bat C:\\MyRepo -n @echo off\nREM *** Thi... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339/"
] |
14,614 | <p>First off, I understand the reasons why an interface or abstract class (in the .NET/C# terminology) cannot have abstract static methods. My question is then more focused on the best design solution.</p>
<p>What I want is a set of "helper" classes that all have their own static methods such that if I get objects A, B, and C from a third party vendor, I can have helper classes with methods such as</p>
<pre>
AHelper.RetrieveByID(string id);
AHelper.RetrieveByName(string name);
AHelper.DumpToDatabase();
</pre>
<p>Since my AHelper, BHelper, and CHelper classes will all basically have the same methods, it seems to makes sense to move these methods to an interface that these classes then derive from. However, wanting these methods to be static precludes me from having a generic interface or abstract class for all of them to derive from.</p>
<p>I could always make these methods non-static and then instantiate the objects first such as</p>
<pre>
AHelper a = new AHelper();
a.DumpToDatabase();
</pre>
<p>However, this code doesn't seem as intuitive to me. What are your suggestions? Should I abandon using an interface or abstract class altogether (the situation I'm in now) or can this possibly be refactored to accomplish the design I'm looking for?</p>
| [
{
"answer_id": 14622,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "static class HelperMethods\n { //IHelper h = new HeleperA();\n //h.DumpToDatabase() \n public static void DumpToDa... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108/"
] |
14,617 | <p>I'm trying to retrieve a file from a server using SFTP (as opposed to FTPS) using Java. How can I do this?</p>
| [
{
"answer_id": 14629,
"author": "David Hayes",
"author_id": 1769,
"author_profile": "https://Stackoverflow.com/users/1769",
"pm_score": 5,
"selected": false,
"text": "SshClient ssh = new SshClient();\nssh.connect(host, port);\n//Authenticate\nPasswordAuthenticationClient passwordAuthenti... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1769/"
] |
14,618 | <p>What's the best way of implementing a multiple choice option in Windows Forms? I want to enforce a single selection from a list, starting with a default value.</p>
<p>It seems like a ComboBox would be a good choice, but is there a way to specify a non-blank default value?<br>
I could just set it in the code at some appropriate initialisation point, but I feel like I'm missing something.</p>
| [
{
"answer_id": 14710,
"author": "wusher",
"author_id": 1632,
"author_profile": "https://Stackoverflow.com/users/1632",
"pm_score": 1,
"selected": false,
"text": "private sub populateList( items as List(of UserChoices))\n dim choices as UserChoices\n dim defaultChoice as UserChoices \... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077/"
] |
14,634 | <p>Let's take a web development environment, where developers checkout a project onto their local machines, work on it, and check in changes to development.<br>
These changes are further tested on development and moved live on a regular schedule (eg weekly, monthly, etc.).<br>
Is it possible to have an auto-moveup of the latest tagged version (and not the latest checkin, as that might not be 100% stable), for example 8AM on Monday mornings, either using a script or a built-in feature of the VCS?</p>
| [
{
"answer_id": 14680,
"author": "icco",
"author_id": 1063,
"author_profile": "https://Stackoverflow.com/users/1063",
"pm_score": 1,
"selected": false,
"text": "hg update\n svn co http://host/repository/branchname/\n svn up\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
14,656 | <p>Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't.</p>
<p>I'm considering a desktop application, run by a number of people behind their companies proxy. This application may access services across the internet and I'd like to take advantage of the in-built internet caching infrastructure for 'reads'. If the caching proxy servers can't cache SSL delivered content, would simply encrypting the content of a response be a viable option?</p>
<p>I am considering all GET requests that we wish to be cachable be requested over http with the body encrypted using asymmetric encryption, where each client has the decryption key. Anytime we wish to perform a GET that is not cachable, or a POST operation, it will be performed over SSL.</p>
| [
{
"answer_id": 2861265,
"author": "Jesse Hallett",
"author_id": 103017,
"author_profile": "https://Stackoverflow.com/users/103017",
"pm_score": 0,
"selected": false,
"text": "application server <---> Squid or Varnish (cache) <---> Apache (performs SSL encryption)\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
14,697 | <p>I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why. </p>
<p>Here are the ones that I have used or looked at:</p>
<ul>
<li><a href="http://www.codeproject.com/KB/aspnet/urlrewriter.aspx" rel="nofollow noreferrer">ThunderMain URLRewriter</a>: used in a previous project, didn't quite have the flexibility/performance we were looking for</li>
<li><a href="http://web.archive.org/web/20070202012119/blog.ewal.net/2004/04/14/a-url-redirecting-url-rewriting-httpmodule/" rel="nofollow noreferrer">Ewal UrlMapper</a>: used in a current project, but source seems to be abandoned</li>
<li><a href="http://www.urlrewriting.net/149/en/home.html" rel="nofollow noreferrer">UrlRewritingNet.UrlRewrite</a>: seems like a decent library but documentation's poor grammar leaves me feeling uneasy</li>
<li><a href="http://urlrewriter.net/" rel="nofollow noreferrer">UrlRewriter.NET</a>: this is my current fav, has great flexibility, although the extra functions pumped into the replacement regexs changes the standard .Net regex syntax a bit</li>
<li><a href="http://www.managedfusion.com/products/url-rewriter/" rel="nofollow noreferrer">Managed Fusion URL Rewriter</a>: I found this one in a <a href="https://stackoverflow.com/questions/2262/aspnet-url-rewriting#2268">previous question</a> on stack overflow, but haven't tried it out yet, from the example syntax, it doesn't seem to be editable via web.config</li>
</ul>
| [
{
"answer_id": 12120464,
"author": "Paras",
"author_id": 615798,
"author_profile": "https://Stackoverflow.com/users/615798",
"pm_score": 0,
"selected": false,
"text": " protected void Application_Start(object sender, EventArgs e)\n {\n\n RegisterRoutes(Route... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1414/"
] |
14,698 | <p>When I try to precompile a *.pc file that contains a #warning directive I recieve the following error:</p>
<blockquote>
<p>PCC-S-02014, Encountered the symbol "warning" when expecting one of the following: (bla bla bla).</p>
</blockquote>
<p>Can I somehow convince Pro*C to ignore the thing if it doesn't know what to do with it? I can't remove the <code>#warning</code> directive as it's used in a header file that I can't change and must include.</p>
| [
{
"answer_id": 14999,
"author": "Jon Bright",
"author_id": 1813,
"author_profile": "https://Stackoverflow.com/users/1813",
"pm_score": 0,
"selected": false,
"text": "grep -v -E '^#(warning|pragma|define)' unchangeable.h >unchangeable.pc.h\n"
},
{
"answer_id": 23585,
"author":... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1733/"
] |
14,708 | <p>What's the DOS FINDSTR equivalent for <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" rel="noreferrer">PowerShell</a>? I need to search a bunch of log files for "ERROR".</p>
| [
{
"answer_id": 14724,
"author": "Monroecheeseman",
"author_id": 1351,
"author_profile": "https://Stackoverflow.com/users/1351",
"pm_score": 5,
"selected": false,
"text": "Get-ChildItem -Recurse -Include *.log | select-string ERROR \n"
},
{
"answer_id": 14725,
"author": "slips... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1351/"
] |
14,712 | <p>does anyone have a clue why the TortoiseSVN windows client (in Win32 XP and Vista)
is so incredible slow when used with Putty and PAM? It seems it connects for each request
since datatransfers (checkout) are not slow at all?</p>
<p>Any ideas how to change it?</p>
<p>Update: I had no problems with SSH before. But I have to use key based authentification. </p>
| [
{
"answer_id": 22714832,
"author": "bebbo",
"author_id": 1412279,
"author_profile": "https://Stackoverflow.com/users/1412279",
"pm_score": 0,
"selected": false,
"text": "svn+ssh://xxx.yy/path/to/svn/trunk/foobar\n xxx.yy\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
14,717 | <p>We're having sporadic, random query timeouts on our SQL Server 2005 cluster. I own a few apps that use it, so I'm helping out in the investigation. When watching the % CPU time in regular ol' Perfmon, you can certainly see it pegging out. However, SQL activity monitor only gives cumulative CPU and IO time used by a process, not what it's using right then, or over a specific timeframe. Perhaps I could use the profiler and run a trace, but this cluster is very heavily used and I'm afraid I'd be looking for a needle in a haystack. Am I barking up the wrong tree?</p>
<p>Does anyone have some good methods for tracking down expensive queries/processes in this environment?</p>
| [
{
"answer_id": 14766,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 5,
"selected": true,
"text": "SELECT TOP 50\n qs.total_worker_time/qs.execution_count as [Avg CPU Time],\n SUBSTRING(qt.text,qs.statement_star... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212/"
] |
14,731 | <p>Normally I would just use:</p>
<pre><code>HttpContext.Current.Server.UrlEncode("url");
</code></pre>
<p>But since this is a console application, <code>HttpContext.Current</code> is always going to be <code>null</code>.</p>
<p>Is there another method that does the same thing that I could use?</p>
| [
{
"answer_id": 14736,
"author": "Andrew Taylor",
"author_id": 1776,
"author_profile": "https://Stackoverflow.com/users/1776",
"pm_score": 6,
"selected": false,
"text": "HttpUtility.UrlEncode Method (String)\n"
},
{
"answer_id": 14745,
"author": "Kibbee",
"author_id": 1862... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1469/"
] |
14,760 | <p>In the Visual Studio toolbar, you can enter commands into the search box by prefixing them with a > symbol. Is there any way to disable this? I've never used the feature, and it's slightly annoying when trying to actually search for something that you know is prefixed by greater-than in the code. It's particularly annoying when you accidentally search for "> exit" and the IDE quits (I knew there was a line in the code that was something like <code>if(counter > exitCount)</code> so entered that search without thinking).</p>
<p>At the very least, can you escape the > symbol so that you can search for it? Prefixing with ^ doesn't seem to work.</p>
| [
{
"answer_id": 15301,
"author": "James Sutherland",
"author_id": 1739,
"author_profile": "https://Stackoverflow.com/users/1739",
"pm_score": 0,
"selected": false,
"text": "alias"
},
{
"answer_id": 15335,
"author": "eplawless",
"author_id": 1370,
"author_profile": "htt... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1739/"
] |
14,770 | <p>In .NET there are two version numbers available when building a project, File Version and Assembly Version. How are you using these numbers? Keeping them the same? Auto-incrementing one, but manually changing the other?</p>
<p>Also what about the <code>AssemblyInformationalVersion</code> attribute?</p>
<p>I'd found this support Microsoft Knowledge Base (KB) article that provided some help: <a href="http://support.microsoft.com/kb/556041" rel="noreferrer">How to use Assembly Version and Assembly File Version</a>.</p>
| [
{
"answer_id": 14835,
"author": "Jon Dewees",
"author_id": 1365,
"author_profile": "https://Stackoverflow.com/users/1365",
"pm_score": 6,
"selected": false,
"text": "[assembly: AssemblyVersion(Foo.StaticVersion.Bar)]\n namespace Foo\n{\n public static class StaticVersion\n {\n ... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1752/"
] |
14,775 | <p>I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers. </p>
<p>I have been looking online trying to find real differences between the two and have asked on crackoverflow. The only major differences are a few syntax difference which are trivial to me because I am also a Java developer. </p>
<p>What would be a good response to an interviewer when they tell me they are looking for a C# developer - or similar questions? </p>
| [
{
"answer_id": 14814,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 2,
"selected": false,
"text": "Function(x) x.ToString()\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1632/"
] |
14,791 | <p>We have a website that uses <code>#include file</code> command to roll info into some web pages. The authors can access the text files to update things like the occasional class or contact information for the department.</p>
<p>My question is this, I don't <em>see</em> anyone using this method and wonder if it is a good idea to keep using it. If not, what method should I transition to instead?</p>
| [
{
"answer_id": 14814,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 2,
"selected": false,
"text": "Function(x) x.ToString()\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] |
14,801 | <p>Suppose you have the following EJB 3 interfaces/classes:</p>
<pre><code>public interface Repository<E>
{
public void delete(E entity);
}
public abstract class AbstractRepository<E> implements Repository<E>
{
public void delete(E entity){
//...
}
}
public interface FooRepository<Foo>
{
//other methods
}
@Local(FooRepository.class)
@Stateless
public class FooRepositoryImpl extends
AbstractRepository<Foo> implements FooRepository
{
@Override
public void delete(Foo entity){
//do something before deleting the entity
super.delete(entity);
}
//other methods
}
</code></pre>
<p>And then another bean that accesses the <code>FooRepository</code> bean :</p>
<pre><code>//...
@EJB
private FooRepository fooRepository;
public void someMethod(Foo foo)
{
fooRepository.delete(foo);
}
//...
</code></pre>
<p>However, the overriding method is never executed when the delete method of the <code>FooRepository</code> bean is called. Instead, only the implementation of the delete method that is defined in <code>AbstractRepository</code> is executed. </p>
<p>What am I doing wrong or is it simply a limitation of Java/EJB 3 that generics and inheritance don't play well together yet ?</p>
| [
{
"answer_id": 15279,
"author": "ScArcher2",
"author_id": 1310,
"author_profile": "https://Stackoverflow.com/users/1310",
"pm_score": 3,
"selected": true,
"text": "public static void main(String[] args){\n FooRepository fooRepository = new FooRepositoryImpl();\n fooReposito... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1793/"
] |
14,828 | <p>I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.com), and uploading the site files, I get an error... I'm 99.9% sure that it's not file related, so not sure where to begin in the DB. Unfortunately with DotNetNuke you don't get the YSOD, but a generic error, with no real way to find the actual exception that has occured.</p>
<p>I'm just curious if anyone has had similar deployment issues using the Database Publishing Wizard, and if so, how they overcame them? I own the RedGate toolset, but some hosts like GoDaddy don't allow you to direct connect to their servers...</p>
| [
{
"answer_id": 16369,
"author": "Ian Robinson",
"author_id": 326,
"author_profile": "https://Stackoverflow.com/users/326",
"pm_score": 0,
"selected": false,
"text": "customErrors mode=\"Off\"\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1795/"
] |
14,857 | <p><strong>Bounty:</strong> I will send $5 via paypal for an answer that fixes this problem for me.</p>
<p>I'm not sure what VS setting I've changed or if it's a web.config setting or what, but I keep getting this error in the error list and yet all solutions build fine. Here are some examples:</p>
<pre>
Error 5 'CompilerGlobalScopeAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'. C:\projects\MyProject\Web\Controls\EmailStory.ascx 609 184 C:\...\Web\
Error 6 'ArrayList' is ambiguous in the namespace 'System.Collections'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb 13 28 C:\...\Web\
Error 7 'Exception' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb 37 21 C:\...\Web\
Error 8 'EventArgs' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb 47 64 C:\...\Web\
Error 9 'EventArgs' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb 140 72 C:\...\Web\
Error 10 'Array' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\Controls\EmailStory.ascx.vb 147 35 C:\...\Web\
[...etc...]
Error 90 'DateTime' is ambiguous in the namespace 'System'. C:\projects\MyProject\Web\App_Code\XsltHelperFunctions.vb 13 8 C:\...\Web\
</pre>
<p>As you can imagine, it's really annoying since there are blue squiggly underlines everywhere in the code, and filtering out relevant errors in the Error List pane is near impossible. I've checked the default ASP.Net web.config and machine.config but nothing seemed to stand out there.</p>
<hr>
<p><em>Edit:</em> Here's some of the source where the errors are occurring:</p>
<pre><code>'Error #5: whole line is blue underlined'
<%= addEmailToList.ToolTip %>
'Error #6: ArrayList is blue underlined'
Private _emails As New ArrayList()
'Error #7: Exception is blue underlined'
Catch ex As Exception
'Error #8: System.EventArgs is blue underlined'
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Error #9: System.EventArgs is blue underlined'
Protected Sub sendMessage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles sendMessage.Click
'Error #10: Array is blue underlined'
Me.emailSentTo.Text = Array.Join(";", mailToAddresses)
'Error #90: DateTime is blue underlined'
If DateTime.TryParse(data, dateValue) Then
</code></pre>
<hr>
<p><em>Edit</em>: GacUtil results</p>
<pre>
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\gacutil -l mscorlib
Microsoft (R) .NET Global Assembly Cache Utility. Version 1.1.4318.0
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
The Global Assembly Cache contains the following assemblies:
The cache of ngen files contains the following entries:
mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c5619
34e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d003700430039004
40037004500430036000000
mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c5619
34e089, Custom=5a00410050002d004e0035002e0031002d0038004600440053002d00370043003
900450036003100370035000000
Number of items = 2
</pre>
<pre>
"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" -l mscorlib
Microsoft (R) .NET Global Assembly Cache Utility. Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
Number of items = 0
</pre>
<hr>
<p><em>Edit</em>: interesting results from ngen:</p>
<pre><code>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen display mscorlib /verbose
Microsoft (R) CLR Native Image Generator - Version 2.0.50727.832
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
NGEN Roots:
mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d00330037004200430043003300430035000000
ScenarioDefault
mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=5a00410050002d004e0035002e0031002d003800460053002d00330037004200430043003300430035000000
DisplayName = mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Native image = {7681CE0F-F0E7-F03A-2B56-96345589D82B}
Hard Dependencies:
Soft Dependencies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
ScenarioNoDependencies
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
DisplayName = mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Native image = {7681CE0F-F0E7-F03A-2B56-96345589D82B}
Hard Dependencies:
Soft Dependencies:
NGEN Roots that depend on "mscorlib":
[...a bunch of stuff...]
Native Images:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Source MVID: {D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Source HASH: bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
NGen GUID sign: {7681CE0F-F0E7-F03A-2B56-96345589D82B}
OS: WinNT
Processor: x86(Pentium 4) (features: 00008001)
Runtime: 2.0.50727.832
mscorwks.dll: TimeStamp=461F2E2A, CheckSum=00566DC9
Flags:
Scenarios: <no debug info> <no debugger> <no profiler> <no instrumentation>
Granted set: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true"/>
File:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\0fce8176e7f03af02b5696345589d82b\mscorlib.ni.dll
Dependencies:
mscorlib, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089:
Guid:{D34102CF-2ABF-4004-8B42-2859D8FF27F3}
Sign:bbf5cfc19bea4e13889e39eb1fb72479a45ad0ec
</code></pre>
<p>There should only be one mscorlib in the native images, correct? How can I get rid of the others?</p>
| [
{
"answer_id": 592331,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 0,
"selected": false,
"text": "gacutil mscorlib"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1414/"
] |
14,872 | <blockquote>
<p>CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file
C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed.
A database with the same name exists, or specified file cannot be
opened, or it is located on UNC share.</p>
</blockquote>
<p>I've found these links:</p>
<ul>
<li><a href="http://blog.benhall.me.uk/2008/03/sql-server-and-vista-create-database.html" rel="nofollow noreferrer">http://blog.benhall.me.uk/2008/03/sql-server-and-vista-create-database.html</a></li>
<li><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=702726&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=702726&SiteID=1</a></li>
</ul>
| [
{
"answer_id": 1412028,
"author": "zanona",
"author_id": 165750,
"author_profile": "https://Stackoverflow.com/users/165750",
"pm_score": 2,
"selected": false,
"text": "<system.web>\n <identity impersonate=\"true\" userName=\"admin_user\" password=\"admin_password\" />\n...\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1659/"
] |
14,873 | <p>I've noticed that a few Wordpress blogs have query statistics present in their footer that simply state the number of queries and the total time required to process them for the particular page, reading something like:</p>
<blockquote>
<p>23 queries. 0.448 seconds</p>
</blockquote>
<p>I was wondering how this is accomplished. Is it through the use of a particular Wordpress plug-in or perhaps from using some particular php function in the page's code?</p>
| [
{
"answer_id": 14972,
"author": "pix0r",
"author_id": 72,
"author_profile": "https://Stackoverflow.com/users/72",
"pm_score": 5,
"selected": true,
"text": "<?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>\n"
},
{
"answer_i... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339/"
] |
14,874 | <p>For part of my application I have a need to create an image of a certain view and all of its subviews.</p>
<p>To do this I'm creating a context that wraps a bitmap with the same-size as the view, but I'm unsure how to draw the view hierarchy into it. I can draw a single view just be setting the context and explicitly calling drawRect, but this does not deal with all of the subviews.</p>
<p>I can't see anything in the NSView interface that could help with this so I suspect the solution may lie at a higher level.</p>
| [
{
"answer_id": 14947,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 2,
"selected": false,
"text": "-[NSView dataWithPDFInsideRect:] NSData"
},
{
"answer_id": 15489,
"author": "Chris Hanson",
"author_id": 7... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1043/"
] |
14,893 | <p>Or, actually establishing a build process when there isn't much of one in place to begin with.</p>
<p>Currently, that's pretty much the situation my group faces. We do web-app development primarily (but no desktop development at this time). Software deployments are ugly and unwieldy even with our modest apps, and we've had far too many issues crop up in the two years I have been a part of this team (and company). It's past time to do something about that, and the upshot is that we'll be able to kill two Joel Test birds with one stone (daily builds and one-step builds, neither of which exists in any form whatsoever).</p>
<p>What I'm after here is some general insight on the kinds of things I need to be doing or thinking about, from people who have been in software development for longer than I have and also have bigger brains. I'm confident that will be most of the people currently posting in the beta.</p>
<p>Relevant Tools:
Visual Build
Source Safe 6.0 (I know, but I can't do anything about whether or not we use Source Safe at this time. That might be the next battle I fight.)</p>
<p>Tentatively, I've got a Visual Build project that does this:</p>
<ol>
<li>Get source and place in local directory, including necessary DLLs needed for project.</li>
<li>Get config files and rename as needed (we're storing them in a special sub directory that isn't part of the actual application, and they are named according to use).</li>
<li>Build using Visual Studio</li>
<li>Precompile using command line, copying into what will be a "build" directory</li>
<li>Copy to destination.</li>
<li>Get any necessary additional resources - mostly things like documents, images, and reports that are associated with the project (and put into directory from step 5). There's a lot of this stuff, and I didn't want to include it previously. However, I'm going to only copy changed items, so maybe it's irrelevant. I wasn't sure whether I really wanted to include this stuff in earlier steps.</li>
</ol>
<p>I still need to coax some logging out of Visual Build for all of this, but I'm not at a point where I need to do that yet.</p>
<p>Does anyone have any advice or suggestions to make? We're not currently using a Deployment Project, I'll note. It would remove some of the steps necessary in this build I presume (like web.config swapping).</p>
| [
{
"answer_id": 14903,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 3,
"selected": false,
"text": "<appSettings file=\"Local.config\">\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/14893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1734/"
] |
14,923 | <p>I'm thinking of learning the <code>ASP.NET MVC</code> framework for an upcoming project. Can I use the advanced routing to create long URLs based on the sitemap hierarchy?</p>
<p>Example navigation path:</p>
<p><strong>Home > Shop > Products > Household > Kitchen > Cookware > Cooksets > Nonstick</strong></p>
<p>Typical (I think) MVC URL:<br/>
<a href="http://example.com/products/category/NonstickCooksets" rel="nofollow noreferrer">http://example.com/products/category/NonstickCooksets</a></p>
<p>Desired URL:<br/>
<a href="http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick" rel="nofollow noreferrer">http://example.com/shop/products/household/kitchen/cookware/cooksets/nonstick</a></p>
<p>Can I do this?</p>
| [
{
"answer_id": 36833,
"author": "Andrei Rînea",
"author_id": 1796,
"author_profile": "https://Stackoverflow.com/users/1796",
"pm_score": 4,
"selected": true,
"text": "public class ShopController : Controller\n{\n...\n public ActionResult Products(string categoryPath)\n {\n /... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
14,934 | <p>.NET, Java and other high level database API's in various language often provide techniques known as prepared statements and parameter binding as opposed to sending plain text commands to the Database server. What I would like to know is what happens when you execute a statement like this:</p>
<pre><code>SqlCommand cmd = new SqlCommand("GetMemberByID");
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@ID", memberID);
para.DbType = DbType.Integer;
cmd.Parameters.Add(param);
</code></pre>
<p>I know this is a best practice. SQL injection attacks are minimized this way. But what exactly happens under the hood when you execute these statements? Is the end result still a SQL safe string? If not, what is the end result? And is this enough to prevent SQL injection attacks?</p>
| [
{
"answer_id": 14986,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 0,
"selected": false,
"text": "string sql = \"SELECT * FROM tblDomains WHERE DomainName = @DomName AND DomainID = @Did\";\nDatabase db = DatabaseFactory.CreateDat... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
14,943 | <p>What is the best way to disable <kbd>Alt</kbd> + <kbd>F4</kbd> in a c# win form to prevent the user from closing the form?</p>
<p>I am using a form as a popup dialog to display a progress bar and I do not want the user to be able to close it.</p>
| [
{
"answer_id": 14949,
"author": "Timbo",
"author_id": 1810,
"author_profile": "https://Stackoverflow.com/users/1810",
"pm_score": 4,
"selected": false,
"text": "FormClosing FormClosingEventArgs.Cancel true"
},
{
"answer_id": 14960,
"author": "Martin",
"author_id": 770,
... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1375/"
] |
14,967 | <p>I'm a recent AI graduate (circa 2 years) working for a modest operation. It has fallen to me (primarily as I'm the first 'adopter' in the department) to create a basic (read useful?) C# coding standards document. </p>
<p>I think I should explain that I'm probably the most junior software engineer going, but I'm looking forward to this task as hopefully I might actually be able to produce something half usable. I've done a pretty extensive search of the Internet and read articles on what a coding standards document should / should not contain. This seems like a good as place as any to ask for some suggestions.</p>
<p>I realise that I am potentially opening a door to a whole world of disagreement about 'the best way to do things'. I both understand and respect the undeniable fact that each programmer has a preferred method of solving each individual task, as a result I'm not looking to write anything so draconianly proscriptive as to stifle personal flair but to try and get a general methodology and agreed standards (e.g. naming conventions) to help make individuals code more readable.</p>
<p>So here goes .... any suggestions? Any at all?</p>
| [
{
"answer_id": 6120801,
"author": "Dan Abramov",
"author_id": 458193,
"author_profile": "https://Stackoverflow.com/users/458193",
"pm_score": 0,
"selected": false,
"text": "try\n{\n if (condition)\n {\n Something(new delegate\n {\n SomeCall(a, b);\n ... | 2008/08/18 | [
"https://Stackoverflow.com/questions/14967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] |
15,023 | <p>In WindowsForms world you can get a list of available image encoders/decoders with</p>
<pre><code>System.Drawing.ImageCodecInfo.GetImageDecoders() / GetImageEncoders()
</code></pre>
<p>My question is, is there a way to do something analogous for the WPF world that would allow me to get a list of available </p>
<pre><code>System.Windows.Media.Imaging.BitmapDecoder / BitmapEncoder
</code></pre>
| [
{
"answer_id": 17448,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 2,
"selected": false,
"text": "Bitmap Encoders:\nSystem.Windows.Media.Imaging.BmpBitmapEncoder\nSystem.Windows.Media.Imaging.GifBitmapEncoder\nSystem.Wi... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
15,024 | <p>Questions #1 through #4 on the <a href="http://www.joelonsoftware.com/articles/fog0000000043.html" rel="nofollow noreferrer">Joel Test</a> in my opinion are all about the development tools being used and the support system in place for developers:</p>
<ol>
<li>Do you use source control? </li>
<li>Can you make a build in one step? </li>
<li>Do you make daily builds? </li>
<li>Do you have a bug database? </li>
</ol>
<p>I'm just curious what free/cheap (but good) tools exist for the small development shops that don't have large bank accounts to use to achieve a positive answer on these questions.</p>
<p>For source control I know Subversion is a great solution, and if you are a one man shop you could even use SourceGear's <a href="http://www.sourcegear.com/vault/index.html" rel="nofollow noreferrer">Vault</a>.</p>
<p>I use NAnt for my larger projects, but have yet to set up a script to build my installers as well as running the obfusication tools all as a single step. Any other suggestions?</p>
<p>If you can answer yes to the building in a single step, I think creating daily builds would be easy, but what tools would you recommend for automating those daily builds?</p>
<p>For a one or two man team, it's already been discussed on SO that you can use FogBugz On Demand, but what other bug tracking solutions exist for small teams?</p>
| [
{
"answer_id": 904897,
"author": "Jonas Kölker",
"author_id": 58668,
"author_profile": "https://Stackoverflow.com/users/58668",
"pm_score": 2,
"selected": false,
"text": "$(apt-cache search bug tracking)"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1795/"
] |
15,034 | <p>When building a VS 2008 solution with 19 projects I sometimes get:</p>
<pre><code>The "GenerateResource" task failed unexpectedly.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.IO.MemoryStream.set_Capacity(Int32 value)
at System.IO.MemoryStream.EnsureCapacity(Int32 value)
at System.IO.MemoryStream.WriteByte(Byte value)
at System.IO.BinaryWriter.Write(Byte value)
at System.Resources.ResourceWriter.Write7BitEncodedInt(BinaryWriter store, Int32 value)
at System.Resources.ResourceWriter.Generate()
at System.Resources.ResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResourceWriter.Close()
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFile)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, ArrayList inputs, ArrayList outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) C:\Windows\Microsoft.NET\Framework\v3.5
</code></pre>
<p>Usually happens after VS has been running for about 4 hours; the only way to get VS to compile properly is to close out VS, and start it again.</p>
<p>I'm on a machine with 3GB Ram. TaskManager shows the devenv.exe working set to be 578060K, and the entire memory allocation for the machine is 1.78GB. It should have more than enough ram to generate the resources.</p>
| [
{
"answer_id": 8679710,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1365/"
] |
15,040 | <p>I am using xampp on Windows, but I would like to use something closer to my server setup.</p>
<p><a href="http://phpimpact.wordpress.com/2008/05/24/virtual-appliances-lamp-development-made-easy/" rel="nofollow noreferrer">Federico Cargnelutti tutorial</a> explains how to setup LAMP VMWARE appliance; it is a great introduction to VMware appliances, but one of the commands was not working and it doesn't describe how to change the keyboard layout and the timezone.</p>
<p>ps: the commands are easy to find but I don't want to look for them each time I reinstall the server. I am using this question as a reminder.</p>
| [
{
"answer_id": 15683,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": 4,
"selected": true,
"text": "apt-get -yq update\napt-get -yq upgrade\napt-get -yq install sudo\napt-get -yq install gcc\napt-get -yq install g++\napt-get -... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1771/"
] |
15,047 | <p>I'm working on a WinForm .Net application with the basic UI that includes toolbar buttons, menu items and keystrokes that all initiate the same underlying code. Right now the event handlers for each of these call a common method to perform the function.</p>
<p>From what I've read this type of action could be handled by the <a href="http://www.dofactory.com/Patterns/PatternCommand.aspx" rel="noreferrer">Command design pattern</a> with the additional benefit of automatically enabling/disabling or checking/unchecking the UI elements.</p>
<p>I've been searching the net for a good example project, but really haven't found one. Does anyone have a good example that can be shared?</p>
| [
{
"answer_id": 15207,
"author": "Dale Ragan",
"author_id": 1117,
"author_profile": "https://Stackoverflow.com/users/1117",
"pm_score": 5,
"selected": true,
"text": "public interface ICommand\n{\n void Execute();\n}\n public class CutCommand : ICommand\n{\n public void Execute()\n ... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1752/"
] |
15,056 | <p>What are some macros that you have found useful in Visual Studio for code manipulation and automation? </p>
| [
{
"answer_id": 15113,
"author": "travis",
"author_id": 1414,
"author_profile": "https://Stackoverflow.com/users/1414",
"pm_score": 3,
"selected": false,
"text": "''''replaceunicodechars.vb\nOption Strict Off\nOption Explicit Off\nImports EnvDTE\nImports System.Diagnostics\n\nPublic Modul... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185/"
] |
15,062 | <p>How do I convert function input parameters to the right type?</p>
<p>I want to return a string that has part of the URL passed into it removed.</p>
<p><strong>This works, but it uses a hard-coded string:</strong></p>
<pre><code>function CleanUrl($input)
{
$x = "http://google.com".Replace("http://", "")
return $x
}
$SiteName = CleanUrl($HostHeader)
echo $SiteName
</code></pre>
<p><strong>This fails:</strong></p>
<pre><code>function CleanUrl($input)
{
$x = $input.Replace("http://", "")
return $x
}
Method invocation failed because [System.Array+SZArrayEnumerator] doesn't contain a method named 'Replace'.
At M:\PowerShell\test.ps1:13 char:21
+ $x = $input.Replace( <<<< "http://", "")
</code></pre>
| [
{
"answer_id": 15068,
"author": "ESV",
"author_id": 150,
"author_profile": "https://Stackoverflow.com/users/150",
"pm_score": 3,
"selected": false,
"text": "function CleanUrl([string] $url)\n{\n return $url.Replace(\"http://\", \"\")\n}\n"
},
{
"answer_id": 15094,
"author"... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636/"
] |
15,066 | <p>I have a form in C# that has a button that, when clicked, I want the background image to cycle through a set of images (which I have as resources to the project). The images are named '_1', '_2', etc. and each time I click the button I want its background image to increment to the next one and go back to "_1" when it gets to the highest. Is there a way to do this?</p>
<p>I tried getting <code>button1.BackgroundImage.ToString()</code> but that yields <code>System.Drawing.Bitmap</code> instead of <code>Resources._1</code> like I was thinking it would (in which case I could just get the last character and switch on that to change the background to the appropriate new image).</p>
<p>Thanks for your help.</p>
| [
{
"answer_id": 12660196,
"author": "zahir",
"author_id": 311618,
"author_profile": "https://Stackoverflow.com/users/311618",
"pm_score": 0,
"selected": false,
"text": "class YourClass\n{\n private IEnumerator<Image> enumerator;\n\n YourClass(IEnumerable<Image> images)\n {\n ... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/271/"
] |
15,087 | <p>The company I work for has an old Access 2000 application that was using a SQL Server 2000 back-end. We were tasked with moving the back-end to a SQL Server 2005 database on a new server. Unfortunately, the application was not functioning correctly while trying to do any inserts or updates. My research has found many forum posts that Access 2000 -> SQL 2005 is not supported by Microsoft, but I cannot find any Microsoft documentation to verify that. </p>
<p>Can anyone either link me to some official documentation, or has anyone used this setup and can confirm that this should be working and our problems lie somewhere else?</p>
<p>Not sure if it matters, but the app is an ADP compiled into an ADE. </p>
| [
{
"answer_id": 15101,
"author": "Martin",
"author_id": 770,
"author_profile": "https://Stackoverflow.com/users/770",
"pm_score": 0,
"selected": false,
"text": "EXEC sp_dbcmptlevel Name_of_your_database, 80;\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1749/"
] |
15,109 | <p>I have a setup project created by Visual Studio 2005, and consists of both a C# .NET 2.0 project and C++ MFC project, and the C++ run time. It works properly when run from the main console, but when run over a Terminal Server session on a Windows XP target, the install fails in the following way -
When the Setup.exe is invoked, it immediately crashes before the first welcome screen is displayed. When invoked over a physical console, the setup runs normally.</p>
<p>I figured I could go back to a lab machine to debug, but it runs fine on a lab machine over Terminal Server.</p>
<p>I see other descriptions of setup problems over Terminal Server sessions, but I don't see a definite solution. Both machines have a nearly identical configuration except that the one that is failing also has the GoToMyPC Host installed.</p>
<p>Has anyone else seen these problems, and how can I troubleshoot this?</p>
<p>Thanks,</p>
| [
{
"answer_id": 15286,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 3,
"selected": true,
"text": "%TEMP% %TEMP% 1 2"
},
{
"answer_id": 289025,
"author": "saschabeaumont",
"author_id": 592,
"author_pro... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1743/"
] |
15,142 | <p>What are the advantages/disadvantages of keeping SQL in your C# source code or in Stored Procs? I've been discussing this with a friend on an open source project that we're working on (C# ASP.NET Forum). At the moment, most of the database access is done by building the SQL inline in C# and calling to the SQL Server DB. So I'm trying to establish which, for this particular project, would be best.</p>
<p>So far I have:</p>
<p>Advantages for in Code:</p>
<ul>
<li>Easier to maintain - don't need to run a SQL script to update queries</li>
<li>Easier to port to another DB - no procs to port</li>
</ul>
<p>Advantages for Stored Procs:</p>
<ul>
<li>Performance</li>
<li>Security</li>
</ul>
| [
{
"answer_id": 229708,
"author": "huo73",
"author_id": 15657,
"author_profile": "https://Stackoverflow.com/users/15657",
"pm_score": 6,
"selected": false,
"text": "(Pseudocode)\n\nFunction createOrder(Order yourOrder) \nBegin\n Call SP_createOrder(yourOrder)\nEnd\n"
},
{
"answer... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
15,163 | <p>In some VB6 code, I have a handler for a TreeView's Collapse event:</p>
<pre><code>Private Sub MyTree_Collapse(ByVal Node as MSComCtlLib.Node)
</code></pre>
<p>This is called whenever a node in the tree is collapsed, whether by the user or programmatically. As it turns out, through some roundabout execution, it may happen that this handler will wind up telling a node to collapse, leading to infinite recursion.</p>
<p>I can think of multiple ways to skin this cat, but what seems simplest to me is to tell the TreeView not to raise events for some period of time. I can't find a simple call to let me do this, though. Has anyone successfully done this, or do I need to keep track of state in some other manner so I can respond appropriately when recursive events come along?</p>
| [
{
"answer_id": 16629,
"author": "Matt Dillard",
"author_id": 863,
"author_profile": "https://Stackoverflow.com/users/863",
"pm_score": 2,
"selected": false,
"text": "MyTree_Collapse m_bHandlingCallback Private Sub MyTree_Collapse(ByVal Node as MSComCtlLib.Node)\n If m_bHandlingCallbac... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863/"
] |
15,171 | <p>In the linux file system, where should user scripts be placed?</p>
<p>I'm thinking specifically python scripts to be called by cron.</p>
| [
{
"answer_id": 15476,
"author": "Mo.",
"author_id": 1870,
"author_profile": "https://Stackoverflow.com/users/1870",
"pm_score": 2,
"selected": false,
"text": "/home/username/.bin\n"
},
{
"answer_id": 1759292,
"author": "pete",
"author_id": 214121,
"author_profile": "h... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479/"
] |
15,187 | <p>I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml.</p>
<p>Does anybody know of a way to write Emacs extensions in a language other than Lisp? This could either take the form of bindings to the Emacs extension API in some other language (e.g., making OCaml a first-class Emacs extension language) or an Emacs interaction mode where, for example, the extension has a pipe into which it can write Emacs Lisp expressions and read out result values.</p>
| [
{
"answer_id": 15260,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 2,
"selected": false,
"text": "(shell-command-to-string\n \"bash -c \\\"script-to-exec args\\\"\")\n"
},
{
"answer_id": 28643496,
"author": ... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1412/"
] |
15,204 | <p>What is the best way to iterate through a strongly-typed generic List in C#.NET and VB.NET?</p>
| [
{
"answer_id": 15210,
"author": "mbillard",
"author_id": 810,
"author_profile": "https://Stackoverflow.com/users/810",
"pm_score": 6,
"selected": true,
"text": "foreach(ObjectType objectItem in objectTypeList)\n{\n // ...do some stuff\n}\n For Each objectItem as ObjectType in objectTy... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1224/"
] |
15,219 | <p>I'm using the Infragistics grid and I'm having a difficult time using a drop-down list as the value selector for one of my columns.</p>
<p>I tried reading the documentation but Infragistics' documentation is not so good. I've also taken a look at this <a href="http://news.infragistics.com/forums/p/9063/45792.aspx" rel="nofollow noreferrer">discussion</a> with no luck.</p>
<p>What I'm doing so far:</p>
<pre><code>col.Type = ColumnType.DropDownList;
col.DataType = "System.String";
col.ValueList = myValueList;
</code></pre>
<p>where <code>myValueList</code> is:</p>
<pre><code>ValueList myValueList = new ValueList();
myValueList.Prompt = "My text prompt";
myValueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
foreach(MyObjectType item in MyObjectTypeCollection)
{
myValueList.ValueItems.Add(item.ID, item.Text); // Note that the ID is a string (not my design)
}
</code></pre>
<p>When I look at the page, I expect to see a drop-down list in the cells for this column, but my columns are empty.</p>
| [
{
"answer_id": 16347,
"author": "Erick B",
"author_id": 1373,
"author_profile": "https://Stackoverflow.com/users/1373",
"pm_score": 2,
"selected": false,
"text": "UltraWebGrid uwgMyGrid = new UltraWebGrid();\nuwgMyGrid.Columns.Add(\"colTest\", \"Test Dropdown\");\nuwgMyGrid.Columns.FromK... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810/"
] |
15,228 | <p>I'm working on a site which needs to be able to support two or more looks, changable at runtime. I'd hoped to be able to handle the change with a CSS switch, but it looks like I'll need to use a different masterpage for each design.</p>
<p>So, what's the best way to set the masterpage at runtime? Page.MasterPageFile can only be set in the Page.OnPreInit event. It looks like the solutions are to make all my pages inherit from a common base which handles the PreInit event, or to use an HttpModule which does that.</p>
<p>Any advice?</p>
| [
{
"answer_id": 15242,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "this.Page.MasterPageFile = \"~/default.master\";\n"
},
{
"answer_id": 15274,
"author": "Brian G Swanson",
"auth... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5/"
] |
15,240 | <p>I'd like to make a debug logging function with the same parameters as <code>printf</code>. But one that can be removed by the pre-processor during optimized builds.</p>
<p>For example:</p>
<pre><code>Debug_Print("Warning: value %d > 3!\n", value);
</code></pre>
<p>I've looked at variadic macros but those aren't available on all platforms. <code>gcc</code> supports them, <code>msvc</code> does not.</p>
| [
{
"answer_id": 15262,
"author": "Graeme Perrow",
"author_id": 1821,
"author_profile": "https://Stackoverflow.com/users/1821",
"pm_score": 4,
"selected": false,
"text": "\n int debug_printf( const char *fmt, ... );\n #if defined( DEBUG )\n #define DEBUG_PRINTF(x) debug_printf x\n #else\n... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841/"
] |
15,241 | <p>The main web application of my company is crying out for a nifty set of libraries to make it in some way maintainable and scalable, and one of my colleagues has suggested CSLA. So I've bought the book but as :</p>
<blockquote>
<p><em>programmers don't read books anymore</em></p>
</blockquote>
<p>I wanted to gauge the SOFlow community's opinion of it.</p>
<p>So here are my questions:</p>
<ol>
<li>How may people are using CSLA?</li>
<li>What are the pros and cons?</li>
<li>Does CSLA really not fit in with TDD?</li>
<li>What are my alternatives?</li>
<li>If you have stopped using it or decided against why?</li>
</ol>
| [
{
"answer_id": 1219364,
"author": "Gregory Higley",
"author_id": 27779,
"author_profile": "https://Stackoverflow.com/users/27779",
"pm_score": 5,
"selected": false,
"text": "WCFDataPortal"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116/"
] |
15,247 | <p>Given a list of locations such as</p>
<pre class="lang-html prettyprint-override"><code> <td>El Cerrito, CA</td>
<td>Corvallis, OR</td>
<td>Morganton, NC</td>
<td>New York, NY</td>
<td>San Diego, CA</td>
</code></pre>
<p>What's the easiest way to generate a Google Map with pushpins for each location?</p>
| [
{
"answer_id": 17132,
"author": "Bernie Perez",
"author_id": 1992,
"author_profile": "https://Stackoverflow.com/users/1992",
"pm_score": 5,
"selected": true,
"text": "<head>\n <script \n type=\"text/javascript\"\n href=\"http://maps.google.com/maps?\n file=api&v=2&key=xxxxx\... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] |
15,254 | <p>Is it possible to actually make use of placement new in portable code when using it for arrays?</p>
<p>It appears that the pointer you get back from new[] is not always the same as the address you pass in (5.3.4, note 12 in the standard seems to confirm that this is correct), but I don't see how you can allocate a buffer for the array to go in if this is the case.</p>
<p>The following example shows the problem. Compiled with Visual Studio, this example results in memory corruption:</p>
<pre><code>#include <new>
#include <stdio.h>
class A
{
public:
A() : data(0) {}
virtual ~A() {}
int data;
};
int main()
{
const int NUMELEMENTS=20;
char *pBuffer = new char[NUMELEMENTS*sizeof(A)];
A *pA = new(pBuffer) A[NUMELEMENTS];
// With VC++, pA will be four bytes higher than pBuffer
printf("Buffer address: %x, Array address: %x\n", pBuffer, pA);
// Debug runtime will assert here due to heap corruption
delete[] pBuffer;
return 0;
}
</code></pre>
<p>Looking at the memory, the compiler seems to be using the first four bytes of the buffer to store a count of the number of items in it. This means that because the buffer is only <code>sizeof(A)*NUMELEMENTS</code> big, the last element in the array is written into unallocated heap.</p>
<p>So the question is can you find out how much additional overhead your implementation wants in order to use placement new[] safely? Ideally, I need a technique that's portable between different compilers. Note that, at least in VC's case, the overhead seems to differ for different classes. For instance, if I remove the virtual destructor in the example, the address returned from new[] is the same as the address I pass in.</p>
| [
{
"answer_id": 15273,
"author": "Yossi Kreinin",
"author_id": 1648,
"author_profile": "https://Stackoverflow.com/users/1648",
"pm_score": 1,
"selected": false,
"text": "\ntypedef A Arr[NUMELEMENTS]; \n\n A* p = new (buffer) Arr;\n"
},
{
"answer_id": 15343,
"author": "OJ.",
... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1739/"
] |
15,266 | <p>Using <strong>NSURLRequest</strong>, I am trying to access a web site that has an expired certificate. When I send the request, my <strong>connection:didFailWithError</strong> delegate method is invoked with the following info:</p>
<pre><code>-1203, NSURLErrorDomain, bad server certificate
</code></pre>
<p>My searches have only turned up one solution: a hidden class method in NSURLRequest:</p>
<pre><code>[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:myHost];
</code></pre>
<p>However, I don't want to use private APIs in a production app for obvious reasons.</p>
<p>Any suggestions on what to do? Do I need to use CFNetwork APIs, and if so, two questions:</p>
<ul>
<li>Any sample code I can use to get started? I haven't found any online.</li>
<li>If I use CFNetwork for this, do I have to ditch NSURL entirely?</li>
</ul>
<hr>
<p>EDIT:</p>
<p>iPhone OS 3.0 introduced a supported method for doing this. More details here: <a href="https://stackoverflow.com/questions/933331/how-to-use-nsurlconnection-to-connect-with-ssl-for-an-untrusted-cert">How to use NSURLConnection to connect with SSL for an untrusted cert?</a></p>
| [
{
"answer_id": 245903,
"author": "Louis Gerbarg",
"author_id": 30506,
"author_profile": "https://Stackoverflow.com/users/30506",
"pm_score": 3,
"selected": false,
"text": "CFURLRef myURL = CFURLCreateWithString(kCFAllocatorDefault, CFSTR(\"http://www.apple.com\"), NULL);\nCFHTTPMessageRe... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544/"
] |
15,272 | <p>I want a data structure that will allow querying <em>how many items in last <strong>X</strong> minutes</em>. An item may just be a simple identifier or a more complex data structure, preferably the timestamp of the item will be in the item, rather than stored outside (as a hash or similar, wouldn't want to have problems with multiple items having same timestamp).</p>
<p>So far it seems that with LINQ I could easily filter items with timestamp greater than a given time and aggregate a count. Though I'm hesitant to try to work .NET 3.5 specific stuff into my production environment yet. Are there any other suggestions for a similar data structure?</p>
<p>The other part that I'm interested in is <em>aging</em> old data out, If I'm only going to be asking for counts of items less than 6 hours ago I would like anything older than that to be removed from my data structure because this may be a long-running program.</p>
| [
{
"answer_id": 15904,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 3,
"selected": true,
"text": "list.push_end(new_data)\nwhile list.head.age >= age_limit:\n list.pop_head()\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/163/"
] |
15,310 | <p>First off I understand that it is a horrible idea to run extremely large/long running reports. I am aware that Microsoft has a rule of thumb stating that a SSRS report should take no longer than 30 seconds to execute. However sometimes gargantuan reports are a preferred evil due to external forces such complying with state laws.</p>
<p>At my place of employment, we have an asp.net (2.0) app that we have migrated from Crystal Reports to SSRS. Due to the large user base and complex reporting UI requirements we have a set of screens that accepts user inputted parameters and creates schedules to be run over night. Since the application supports multiple reporting frameworks we do not use the scheduling/snapshot facilities of SSRS. All of the reports in the system are generated by a scheduled console app which takes user entered parameters and generates the reports with the corresponding reporting solutions the reports were created with. In the case of SSRS reports, the console app generates the SSRS reports and exports them as PDFs via the SSRS web service API. </p>
<p>So far SSRS has been much easier to deal with than Crystal with the exception of a certain 25,000 page report that we have recently converted from crystal reports to SSRS. The SSRS server is a 64bit 2003 server with 32 gigs of ram running SSRS 2005. All of our smaller reports work fantastically, but we are having trouble with our larger reports such as this one. Unfortunately, we can't seem to generate the aforemention report through the web service API. The following error occurs roughly 30-35 minutes into the generation/export:</p>
<p>Exception Message: The underlying connection was closed: An unexpected error occurred on a receive.</p>
<p>The web service call is something I'm sure you all have seen before: </p>
<pre><code>data = rs.Render(this.ReportPath, this.ExportFormat, null, deviceInfo,
selectedParameters, null, null, out encoding, out mimeType, out usedParameters,
out warnings, out streamIds);
</code></pre>
<p>The odd thing is that this report will run/render/export if the report is run directly on the reporting server using the report manager. The proc that produces the data for the report runs for about 5 minutes. The report renders in SSRS native format in the browser/viewer after about 12 minutes. Exporting to pdf through the browser/viewer in the report manager takes an additional 55 minutes. This works reliably and it produces a whopping 1.03gb pdf.</p>
<p>Here are some of the more obvious things I've tried to get the report working via the web service API: </p>
<ul>
<li>set the HttpRuntime ExecutionTimeout
value to 3 hours on the report
server</li>
<li>disabled http keep alives on the report server</li>
<li>increased the script timeout on the report server</li>
<li>set the report to never time out on the server</li>
<li>set the report timeout to several hours on the client call </li>
</ul>
<p>From the tweaks I have tried, I am fairly comfortable saying that any timeout issues have been eliminated. </p>
<p>Based off of my research of the error message, I believe that the web service API does not send chunked responses by default. This means that it tries to send all 1.3gb over the wire in one response. At a certain point, IIS throws in the towel. Unfortunately the API abstracts away web service configuration so I can't seem to find a way to enable response chunking. </p>
<ol>
<li>Does anyone know of anyway to reduce/optimize the PDF export phase and or the size of the PDF without lowering the total page count?</li>
<li>Is there a way to turn on response chunking for SSRS?</li>
<li>Does anyone else have any other theories as to why this runs on the server but not through the API?</li>
</ol>
<p>EDIT: After reading kcrumley's post I began to take a look at the average page size by taking file size / page count. Interestingly enough on smaller reports the math works out so that each page is roughly 5K. Interestingly, when the report gets larger this "average" increases. An 8000 page report for example is averaging over 40K/page. Very odd. I will also add that the number of records per page is set except for the last page in each grouping, so it's not a case where some pages have more records than another. </p>
| [
{
"answer_id": 10481764,
"author": "StuartLC",
"author_id": 314291,
"author_profile": "https://Stackoverflow.com/users/314291",
"pm_score": 2,
"selected": false,
"text": "Times New Roman, Courier New, or Arial FontFamily"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1644/"
] |
15,315 | <p>Is there a method for handling errors from COM objects in RDML? For instance, when calling Word VBA methods like <code>PasteSpecial</code>, an error is returned and the LANSA application crashes. I cannot find anything in the documentation to allow handling of these errors.</p>
<p>Actually, error handling in general is a weak-point for LANSA and RDML, but that's another topic.</p>
| [
{
"answer_id": 10481764,
"author": "StuartLC",
"author_id": 314291,
"author_profile": "https://Stackoverflow.com/users/314291",
"pm_score": 2,
"selected": false,
"text": "Times New Roman, Courier New, or Arial FontFamily"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15315",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
15,326 | <p>Here is the scenario: </p>
<p>I have a table with a margin-bottom of 19px. Below that I have a form that contains some fieldsets. One of them is floated right. The problem is that the margin-bottom is not getting the full 19px in IE7. I've gone through all of the IE7 css/margin/float bugs that I can think of and have tried remedies but have been unsuccessful. I have been googling for a while now and cannot find anything that is helping out. </p>
<p>Here is what I have tried. </p>
<ol>
<li>Wrapping the form or fieldset in an unstyled div. No apparent change.</li>
<li>Nixing the margin-bottom on the table and instead wrapping that with a div and giving it a padding-bottom of 19px. No apparent change.</li>
<li>Nixing the margin-bottom on the table and adding a div with a fixed height of 19px. No apparent change.</li>
<li>Putting a clear between the table and the fieldset.</li>
</ol>
<p>I know there are some others that I am forgetting, but those are the things I have tried out recently. This happens to each fieldset. </p>
<hr>
<p>I am using a reset style sheet and have a xhtml transitional doctype. </p>
<p><strong>Edit:</strong> I also have the IE7 web developer toolbar and Firebug. The style information for both browsers says that it has a margin-bottom: 19px; but it clearly is not for IE7.</p>
| [
{
"answer_id": 15356,
"author": "eplawless",
"author_id": 1370,
"author_profile": "https://Stackoverflow.com/users/1370",
"pm_score": 1,
"selected": false,
"text": "Ctrl+Shift+Y CSS -> View Style Information <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1797/"
] |
15,334 | <p>I have recently started using Vim as my text editor and am currently working on my own customizations.</p>
<p>I suppose keyboard mappings can do pretty much anything, but for the time being I'm using them as a sort of snippets facility almost exclusively.</p>
<p>So, for example, if I type <code>def{TAB}</code> (<code>:imap def{TAB} def ():<ESC>3ha</code>), it expands to:</p>
<pre><code>def |(): # '|' represents the caret
</code></pre>
<p>This works as expected, but I find it annoying when Vim waits for a full command while I'm typing a word containing "def" and am not interested in expanding it.</p>
<ul>
<li>Is there a way to avoid this or use this function more effectively to this end?</li>
<li>Is any other Vim feature better suited for this?</li>
</ul>
<hr>
<p>After taking a quick look at <a href="http://www.vim.org/scripts/script.php?script_id=1318" rel="noreferrer">SnippetsEmu</a>, it looks like it's the best option and much easier to customize than I first thought.</p>
<p>To continue with the previous example:</p>
<pre><code>:Snippet def <{}>():
</code></pre>
<p>Once defined, you can expand your snippet by typing <code>def{TAB}</code>.</p>
| [
{
"answer_id": 32324,
"author": "Sébastien RoccaSerra",
"author_id": 2797,
"author_profile": "https://Stackoverflow.com/users/2797",
"pm_score": 2,
"selected": false,
"text": ":ab[breviate] :ab[breviate] [<expr>] {lhs} {rhs}\n add abbreviation for {lhs} to {rhs}. If {lhs} already... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1670/"
] |
15,366 | <p>What's the best practice for making sure that certain ajax calls to certain pages are only accepted from authenticated users?</p>
<p>For example:</p>
<p>Let's say that I have a main page called <strong>blog.php</strong> (I know, creativity abounds). Let's also say that there is a page called <strong>delete.php</strong> which looks for the parameter <strong>post_id</strong> and then deletes some entry from a database.</p>
<p>In this very contrived example, there's some mechanism on blog.php which sends a request via ajax to delete.php to delete an entry. </p>
<p>Now this mechanism is only going to be available to authenticated users on blog.php. But what's to stop someone from just calling delete.php with a bunch of random numbers and deleting everything in site?</p>
<p>I did a quick test where I set a session variable in blog.php and then did an ajax call to delete.php to return if the session variable was set or not <strong><em>(it wasn't)</em></strong>.</p>
<p>What's the accepted way to handle this sort of thing?</p>
<hr>
<p>OK. I must have been crazy the first time I tried this.</p>
<p>I just did another test like the one I described above and it worked perfectly.</p>
| [
{
"answer_id": 15368,
"author": "pix0r",
"author_id": 72,
"author_profile": "https://Stackoverflow.com/users/72",
"pm_score": 4,
"selected": true,
"text": "session_start() session_id()"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] |
15,390 | <p>What are some standard practices for managing a medium-large JavaScript application? My concerns are both speed for browser download and ease and maintainability of development.</p>
<p>Our JavaScript code is roughly "namespaced" as:</p>
<pre><code>var Client = {
var1: '',
var2: '',
accounts: {
/* 100's of functions and variables */
},
orders: {
/* 100's of functions and variables and subsections */
}
/* etc, etc for a couple hundred kb */
}
</code></pre>
<p>At the moment, we have one (unpacked, unstripped, highly readable) JavaScript file to handle all the business logic on the web application. In addition, there is jQuery and several jQuery extensions. The problem we face is that it takes <em>forever</em> to find anything in the JavaScript code and the browser still has a dozen files to download.</p>
<p>Is it common to have a handful of "source" JavaScript files that gets "compiled" into one final, compressed JavaScript file? Any other handy hints or best practices?</p>
| [
{
"answer_id": 15402,
"author": "Steve M",
"author_id": 1693,
"author_profile": "https://Stackoverflow.com/users/1693",
"pm_score": 5,
"selected": true,
"text": "<script src='/path/to/js/$file.js' type='text/javascript'>"
},
{
"answer_id": 39011,
"author": "paulgreg",
"au... | 2008/08/18 | [
"https://Stackoverflow.com/questions/15390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1848/"
] |
15,395 | <p>Linq To SQL or Entity framework both integrate nicely with SQL Server 2005.</p>
<p>The SQL Server 2008 spec sheet promises even better integration - but I can't see it.</p>
<p>What are some examples of what you can do Linq-wise when talking to a 2008 server that you can't when talking to SQL Server 2005?</p>
| [
{
"answer_id": 153273,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 1,
"selected": false,
"text": "var orders = (\nfrom c in Customers\nfrom o in c.Orders\nselect new {c, o}\n).Skip(10).Take(10).ToList();\n"
}
] | 2008/08/18 | [
"https://Stackoverflow.com/questions/15395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1855/"
] |
15,414 | <p>I'm quite used to my IDE setup in Delphi 7, where I have my comments rendered in italics.</p>
<p>This doesn't appear to be possible in VS2008. There's only an option for bold font, not italics.</p>
<p>Is there some kind of registry hack or font magic I can perform to get it to work? The font I'm using is Consolas, if that makes a difference.</p>
<p><strong>Edit:</strong> This is possible. See <a href="https://stackoverflow.com/questions/17508/how-to-modify-the-style-property-of-a-font-on-windows#25676">this</a> answer for details.</p>
<hr>
<p>Adam, as far as I can tell, you can't change the font name for just comments - only the colour, and boldness. If I'm wrong, please tell me!</p>
| [
{
"answer_id": 15434,
"author": "Factor Mystic",
"author_id": 1569,
"author_profile": "https://Stackoverflow.com/users/1569",
"pm_score": 2,
"selected": false,
"text": "HKCU\\Software\\Microsoft\\VisualStudio\\9.0\\FontAndColors\\{A27B4E24-A735-4D1D-B8E7-9716E1E3D8E0} \nComment FontFlag... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369/"
] |
15,423 | <p>I'd like to know what's the way to actually set the icon of a <code>.bat</code> file to an arbitrary icon.
How would I go about doing that programmatically, independently of the language I may be using.</p>
| [
{
"answer_id": 15437,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 7,
"selected": true,
"text": ".bat .lnk"
},
{
"answer_id": 856655,
"author": "Joey",
"author_id": 73070,
"author_profile": "https:/... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/883/"
] |
15,470 | <p>I know this site is written using ASP.Net MVC and I do not see "/Home" in the url. This proves to me that it can be done. What special route and do I need?</p>
| [
{
"answer_id": 15474,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 5,
"selected": true,
"text": "routes.MapRoute(\n \"Home\",\n \"\",\n new { action = Index, controller = Home }\n);\n"
},
{
"answer_id": 27... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/692/"
] |
15,478 | <p>GDI+ DrawLines function has a clipping bug that can be reproduced by running the following c# code. When running the code, two line paths appear, that should be identical, because both of them are inside the clipping region. But when the clipping region is set, one of the line segment is not drawn. </p>
<pre><code>protected override void OnPaint(PaintEventArgs e)
{
PointF[] points = new PointF[] { new PointF(73.36f, 196),
new PointF(75.44f, 32),
new PointF(77.52f, 32),
new PointF(79.6f, 196),
new PointF(85.84f, 196) };
Rectangle b = new Rectangle(70, 32, 20, 164);
e.Graphics.SetClip(b);
e.Graphics.DrawLines(Pens.Red, points); // clipped incorrectly
e.Graphics.TranslateTransform(80, 0);
e.Graphics.ResetClip();
e.Graphics.DrawLines(Pens.Red, points);
}
</code></pre>
<p>Setting the antials mode on the graphics object resolves this. But that is not a real solution.</p>
<p>Does anybody know of a workaround?</p>
| [
{
"answer_id": 15813,
"author": "TK.",
"author_id": 1816,
"author_profile": "https://Stackoverflow.com/users/1816",
"pm_score": 0,
"selected": false,
"text": "e.Graphics.FillRectangle( new SolidBrush( Color.Black ), b );"
},
{
"answer_id": 16914,
"author": "TK.",
"author_... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1873/"
] |
15,481 | <p>Sometimes a labeled break or continue can make code a lot more readable. </p>
<pre><code>OUTERLOOP: for ( ;/*stuff*/; ) {
//...lots of code
if ( isEnough() ) break OUTERLOOP;
//...more code
}
</code></pre>
<p>I was wondering what the common convention for the labels was. All caps? first cap? </p>
| [
{
"answer_id": 15501,
"author": "RodeoClown",
"author_id": 943,
"author_profile": "https://Stackoverflow.com/users/943",
"pm_score": 4,
"selected": false,
"text": "for ( ;/*stuff*/; ) \n{\n lotsOfCode();\n\n if ( !isEnough() )\n {\n moreCode();\n }\n}\n"
},
{
"... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870/"
] |
15,486 | <p>So I came across an interesting problem today. We have a WCF web service that returns an IList. Not really a big deal until I wanted to sort it.</p>
<p>Turns out the IList interface doesn't have a sort method built in. </p>
<p>I ended up using the <code>ArrayList.Adapter(list).Sort(new MyComparer())</code> method to solve the problem but it just seemed a bit "ghetto" to me.</p>
<p>I toyed with writing an extension method, also with inheriting from IList and implementing my own Sort() method as well as casting to a List but none of these seemed overly elegant.</p>
<p>So my question is, does anyone have an elegant solution to sorting an IList</p>
| [
{
"answer_id": 15492,
"author": "lubos hasko",
"author_id": 275,
"author_profile": "https://Stackoverflow.com/users/275",
"pm_score": -1,
"selected": false,
"text": "IList List<T> System.Linq"
},
{
"answer_id": 15494,
"author": "Brad Leach",
"author_id": 708,
"author_... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/493/"
] |
15,496 | <p>After reading <a href="https://stackoverflow.com/questions/9033/hidden-features-of-c">Hidden Features of C#</a> I wondered, What are some of the hidden features of Java?</p>
| [
{
"answer_id": 15538,
"author": "Michael Neale",
"author_id": 699,
"author_profile": "https://Stackoverflow.com/users/699",
"pm_score": 5,
"selected": false,
"text": "List<String> ls = List(\"a\", \"b\", \"c\");\n List<Map<String, String>> data = List(Map( o(\"name\", \"michael\"), o(\"s... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486/"
] |
15,513 | <p>I've been tasked with <em>improving the performance of an ASP.NET 2.0 application</em>.<br> The page I'm currently focused on has many problems but one that I'm having trouble digging into is the render time of the page. Using Trace.axd the duration between Begin Render and End Render is 1.4 seconds. From MSDN I see that</p>
<blockquote>
<p>All ASP.NET Web server controls have a
Render method that writes out the
control's markup that is sent to the
browser.</p>
</blockquote>
<p>If I had the source code for all the controls on the page, I would just instrument them to trace out their render time. Unfortunately, this particular page has lots of controls, most of them third-party. Is there tool or technique to get better visibility into what is going on during the render? I would like to know if there is a particularly poorly performing control, or if there are simply too many controls on the page.</p>
| [
{
"answer_id": 15516,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 2,
"selected": false,
"text": "<%@Page Trace=\"true\" %>\n"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/15513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1767/"
] |
15,514 | <p>In my example below I'm using a <code>dijit.form.DateTextBox</code>:</p>
<pre><code><input type="text" name="startDate" dojoType="dijit.form.DateTextBox" constraints="{datePattern:'MM/dd/yyyy'}" value='<c:out value="${sessionScope.adminMessageForm.startDate}"/>' />
</code></pre>
<p>So for example, if the user starts to enter "asdf" into the date the field turns yellow and a popup error message appears saying <code>The value entered is not valid.</code>. Even if I remove the <code>constraints="{datePattern:'MM/dd/yyyy'}"</code> it still validates. </p>
<p>Without going into details as to why, I would like to be able keep the dojoType and still prevent validation in particular circumstances.</p>
| [
{
"answer_id": 15677,
"author": "RodeoClown",
"author_id": 943,
"author_profile": "https://Stackoverflow.com/users/943",
"pm_score": 4,
"selected": true,
"text": "<input type=\"text\" name=\"startDate\" dojoType=\"dijit.form.DateTextBox\" \n constraints=\"{datePattern:'MM/dd/yyyy'}\" \... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/700/"
] |
15,537 | <p>If I press <kbd>Ctrl</kbd>+<kbd>B</kbd> that ought to give me ASCII code 2, but <kbd>Ctrl</kbd>+<kbd>C</kbd> is going to be interpreted as a Break.</p>
<p>So I figure I've got to redirect a file in. How do I get these characters into a file?</p>
| [
{
"answer_id": 15542,
"author": "Steve M",
"author_id": 1693,
"author_profile": "https://Stackoverflow.com/users/1693",
"pm_score": 2,
"selected": false,
"text": "perl -e 'print \"\\xFF\"'\n FF"
},
{
"answer_id": 15574,
"author": "Daniel Fone",
"author_id": 1848,
"aut... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/257/"
] |
15,593 | <p>I understand what <a href="http://msdn.microsoft.com/en-us/library/ms404247.aspx" rel="noreferrer">System.WeakReference</a> does, but what I can't seem to grasp is a practical example of what it might be useful for. The class itself seems to me to be, well, a hack. It seems to me that there are other, better means of solving a problem where a WeakReference is used in examples I've seen. What's the canonical example of where you've really got to use a WeakReference? Aren't we trying to get <i>farther</i> away from this type of behavior and use of this class? </p>
| [
{
"answer_id": 15616,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 4,
"selected": false,
"text": "class Cache<TKey,TValue> : IEnumerable<KeyValuePair<TKey,TValue>>\n{ Dictionary<TKey,WeakReference> dict = new Dictionary... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1875/"
] |
15,621 | <p>I have a few C# <code>.dll</code> projects which are common to many applications. Currently, I have one big repository. I have each DLL stored as a separate project within the repository and every application project stored as a project within the same repository.</p>
<p>I recently switched to Subversion for source control and I fear that I did not do a good job of structuring the repository. I would like to hear what others are doing.</p>
| [
{
"answer_id": 15633,
"author": "Judge Maygarden",
"author_id": 1491,
"author_profile": "https://Stackoverflow.com/users/1491",
"pm_score": 3,
"selected": false,
"text": "branch/\ntags/\ntrunk/\n branch/\ntags/\ntrunk/\n project1/\n project2/\n project1/\n branch/\n tags/\n ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1511/"
] |
15,656 | <p>Another SSRS question here: <br />
We have a development, a QA, a Prod-Backup and a Production SSRS set of servers. <br />
On our production and prod-backup, SSRS will go to sleep if not used for a period of time. <br /><br />
This does not occur on our development or QA server.
<br />In the corporate environment we're in, we don't have physical (or even remote login) access to these machines, and have to work with a team of remote administrators to configure our SSRS application.<br />
<br /> We have asked that they fix, if possible, this issue. So far, they haven't been able to identify the issue, and I would like to know if any of my peers know the answer to this question. Thanks.</p>
| [
{
"answer_id": 10721575,
"author": "Lynn Crumbling",
"author_id": 656243,
"author_profile": "https://Stackoverflow.com/users/656243",
"pm_score": 5,
"selected": false,
"text": "C:\\Program Files\\Microsoft SQL Server\\\n MSRS10_50.MSSQLSERVER\\Reporting Services\\ReportServer\\rs... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1580/"
] |
15,674 | <p>When using Subversion (svn) for source control with multiple projects I've noticed that the revision number increases across all of my projects' directories. To illustrate my svn layout (using fictitious project names): </p>
<pre>
/NinjaProg/branches
/tags
/trunk
/StealthApp/branches
/tags
/trunk
/SnailApp/branches
/tags
/trunk
</pre>
<p>When I perform a commit to the trunk of the Ninja Program, let's say I get that it has been updated to revision 7. The next day let's say that I make a small change to the Stealth Application and it comes back as revision 8.</p>
<p>The question is this: <strong>Is it common accepted practice to, when maintaining multiple projects with one Subversion server, to have unrelated projects' revision number increase across all projects?</strong> Or am I doing it wrong and should be creating individual repositories for each project? Or is it something else entirely?</p>
<p><strong>EDIT:</strong> I delayed in flagging an answer because it had become clear that there are reasons for both approaches, and even though this question came first, I'd like to point to some other questions that are ultimately asking the same question: </p>
<p><a href="https://stackoverflow.com/questions/130447/should-i-store-all-projects-in-one-repository-or-mulitiple">Should I store all projects in one repository or mulitiple?</a></p>
<p><a href="https://stackoverflow.com/questions/252459/one-svn-repository-or-many">One SVN Repository or many?</a> </p>
| [
{
"answer_id": 16057,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stackoverflow.com/users/486",
"pm_score": 2,
"selected": false,
"text": "<Location /svn>\n DAV svn\n SVNParentPath /var/www/svn\n\n AuthType Basic\n AuthName \"Subversion Repository\"\n AuthUserFile... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1339/"
] |
15,678 | <p>I have a solution with several projects, where the startup project has a post-build event that does all the copying of "plugin" projects and other organizing tasks. After upgrading the solution from VS 2005 to VS 2008, it appears as though the post-build event only fires if I modify the startup project, which means my updated plugins don't get plugged in to the current debugging session. This makes sense, but it seems like a change in behavior. Is anyone else noticing a change in behavior with regard to which projects get built?</p>
<p>Does anyone know of a workaround that I can use to force the startup project to rebuild whenever I hit F5? Perhaps I configured VS 2005 to work this way so long ago that I've forgotten all about it ...</p>
| [
{
"answer_id": 15699,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 2,
"selected": false,
"text": "devenv project.csproj /clean\n"
},
{
"answer_id": 3814728,
"author": "Cristian Diaconescu",
"author_id": 11545,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/470/"
] |
15,687 | <p>So, you are all ready to do a big SVN Commit and it bombs because you have inconsistent line endings in some of your files. Fun part is, you're looking at 1,000s of files spanning dozens of folders of different depths.</p>
<p>What do you do?</p>
| [
{
"answer_id": 9727551,
"author": "David W.",
"author_id": 368630,
"author_profile": "https://Stackoverflow.com/users/368630",
"pm_score": 3,
"selected": false,
"text": "$ find . -type f -name \"*.java\" -exec dos2unix {}\\;\n dos2unix svn:eol-style"
},
{
"answer_id": 59680444,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307/"
] |
15,694 | <p>I've recently been looking into targeting the .NET Client Profile for a WPF application I am building. However, I was frustrated to notice that the Client Profile is only valid for the following OS configurations: </p>
<ul>
<li>Windows XP SP2+</li>
<li><strike>Windows Server 2003</strike> <strong>Edit:</strong> <a href="http://blogs.windowsclient.net/trickster92/archive/2008/05/21/introducing-the-net-framework-client-profile.aspx" rel="nofollow noreferrer">Appears</a> the Client Profile will not install on Windows Server 2003.</li>
</ul>
<p>In addition, the client profile is <strong>not</strong> valid for x64 or ia64 editions; and will also not install if <em>any previous version of the .NET Framework has been installed</em>.</p>
<p>I'm wondering if the effort in adding the extra OS configurations to the testing matrix is worth the effort. Is there any metrics available that state the percentage of users that could possibly benefit from the client profile? I believe that once the .NET Framework has been installed, extra information is passed to a web server as part of a web request signifying that the framework is available. Granted, I would imagine that Windows XP SP2 users without the .NET Framework installed would be a large amount of people. It would then be a question of whether my application targeted those individuals specifically.</p>
<p>Has anyone else determined if it is worth the extra effort to target these specific users?</p>
<p><strong>Edit: It seems that it is possible to get a compiler warning if you use features not included in the Client Profile. As I usually run with warnings as errors, this will hopefully be enough to minimise testing in this configuration.</strong> Of course, this configuration will still need to be tested, but it should be as simple as testing if the install/initial run works on XP with SP2+.</p>
| [
{
"answer_id": 15738,
"author": "Sören Kuklau",
"author_id": 1600,
"author_profile": "https://Stackoverflow.com/users/1600",
"pm_score": 2,
"selected": false,
"text": "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; .NET CLR 2.0.50727).\n"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/15694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708/"
] |
15,708 | <p>One of my favourite tools for linux is <a href="http://en.wikipedia.org/wiki/Lsof" rel="noreferrer" title="Wikipedia">lsof</a> - a real swiss army knife!</p>
<p>Today I found myself wondering which programs on a WinXP system had a specific file open. Is there any equivalent utility to lsof? Additionally, the file in question was over a network share so I'm not sure if that complicates matters.</p>
| [
{
"answer_id": 599268,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 6,
"selected": false,
"text": "lsof -p pid handle -p pid\nlistdlls -p pid\n pslist"
},
{
"answer_id": 731125,
"author": "Sean",
"author_id": ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1848/"
] |
15,709 | <p>So for my text parsing in C# <a href="https://stackoverflow.com/questions/13963/best-method-of-textfile-parsing-in-c">question</a>, I got directed at YAML. I'm hitting a wall with this library I was recommended, so this is a quickie.</p>
<pre><code>heading:
name: A name
taco: Yes
age: 32
heading:
name: Another name
taco: No
age: 27
</code></pre>
<p>And so on. Is that valid?</p>
| [
{
"answer_id": 15726,
"author": "Grey Panther",
"author_id": 1265,
"author_profile": "https://Stackoverflow.com/users/1265",
"pm_score": 4,
"selected": false,
"text": "---\nheading:\n name: A name\n taco: Yes\n age: 32\n---\nheading:\n name: Another name\n taco: No\n age: 27\n - heading:... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61/"
] |
15,716 | <p>I have created a UserControl that has a <code>ListView</code> in it. The ListView is publicly accessible though a property. When I put the UserControl in a form and try to design the <code>ListView</code> though the property, the <code>ListView</code> stays that way until I compile again and it reverts back to the default state. </p>
<p>How do I get my design changes to stick for the <code>ListView</code>?</p>
| [
{
"answer_id": 15717,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "public ListView MyListView { get { return this.listView1; } }\n"
},
{
"answer_id": 15803,
"author": "Fredrik ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/788/"
] |
15,729 | <p>As I browse through the site, I find a lot of terms that many developers just starting out (and even some advanced developers) may be unfamiliar with.</p>
<p>It would be great if people could post here with a term and definition that might be unknown to beginners or those from different programming backgrounds. </p>
<p>Some not-so-common terms I've seen are 'auto boxing', 'tuples', 'orthogonal code', 'domain driven design', 'test driven development', etc.</p>
<p>Code snippets would also be helpful where applicable..</p>
| [
{
"answer_id": 15717,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "public ListView MyListView { get { return this.listView1; } }\n"
},
{
"answer_id": 15803,
"author": "Fredrik ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1693/"
] |
15,732 | <p>I'm generating some xml files that needs to conform to an xsd file that was given to me. How should I verify they conform?</p>
| [
{
"answer_id": 15739,
"author": "SCdF",
"author_id": 1666,
"author_profile": "https://Stackoverflow.com/users/1666",
"pm_score": 5,
"selected": false,
"text": "import org.apache.xerces.parsers.DOMParser;\nimport java.io.File;\nimport org.w3c.dom.Document;\n\npublic class SchemaTest {\n ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1650/"
] |
15,734 | <p>I know that there is no official API for Google Analytics but is there a way to access Google Analytics Reports with C#?</p>
| [
{
"answer_id": 23441943,
"author": "Valentin V",
"author_id": 430254,
"author_profile": "https://Stackoverflow.com/users/430254",
"pm_score": 0,
"selected": false,
"text": "async/await dynamic"
}
] | 2008/08/19 | [
"https://Stackoverflow.com/questions/15734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890/"
] |
15,744 | <p>I'm wondering about instances when it makes sent to use #define and #if statements. I've known about it for a while, but never incorporated it into my way of coding. How exactly does this affect the compilation?</p>
<blockquote>
<p>Is #define the only thing that determines if the code is included when compiled? If I have #define DEBUGme as a custom symbol, the only way to exclude it from compile is to remove this #define statement?</p>
</blockquote>
| [
{
"answer_id": 15758,
"author": "Eric Haskins",
"author_id": 100,
"author_profile": "https://Stackoverflow.com/users/100",
"pm_score": 5,
"selected": true,
"text": "#define #define #if static void Main(string[] args)\n {\n#if DEBUG\n //this only compiles if in D... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888/"
] |
15,774 | <p>I run an ASP.NET website solution with a few other projects in it. I've known that MSBuild projects are capable of this, but is it the best way? Are they easy to create? Is nAnt, CruiseControl.NET or any other solution better?</p>
<p>When I build the site (using <a href="http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx" rel="nofollow noreferrer">Web Deployment Projects</a>), can I automate part of the build so that it does not copy certain folders from the project into the Release folder? For instance, I have folders with local search indexes, images and other content part of the folder, but I never need or upload those when deploying the project. </p>
<p>I'm also looking toward this type of solution to automatically increment build and version numbers.</p>
| [
{
"answer_id": 32861,
"author": "icelava",
"author_id": 2663,
"author_profile": "https://Stackoverflow.com/users/2663",
"pm_score": 2,
"selected": false,
"text": "<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \nOther similar extension ... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1888/"
] |
15,798 | <p>I need to validate an XML string (and not a file)
against a DTD description file. </p>
<p>How can that be done in <code>python</code>?</p>
| [
{
"answer_id": 15931,
"author": "Michael Twomey",
"author_id": 995,
"author_profile": "https://Stackoverflow.com/users/995",
"pm_score": 6,
"selected": true,
"text": "from StringIO import StringIO\n\nfrom lxml import etree\n\ndtd = etree.DTD(StringIO(\"\"\"<!ELEMENT foo EMPTY>\"\"\"))\nr... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446497/"
] |
15,816 | <p>I use VNC to connect to a Linux workstation at work. At work I have a 20" monitor that runs at 1600x1200, while at home I use my laptop with its resolution of 1440x900.
If I set the vncserver to run at 1440x900 I miss out on a lot of space on my monitor, whereas if I set it to run at 1600x1200 it doesn't fit on the laptop's screen, and I have to scroll it all the time.</p>
<p>Is there any good way to resize a VNC session on the fly?</p>
<p>My VNC server is RealVNC E4.x (I don't remember the exact version) running on SuSE64.</p>
| [
{
"answer_id": 15926,
"author": "Pat",
"author_id": 238,
"author_profile": "https://Stackoverflow.com/users/238",
"pm_score": 5,
"selected": false,
"text": "$vncserver :0 -geometry 1600x1200\n$vncserver :1 -geometry 1440x900\n"
},
{
"answer_id": 1083668,
"author": "Nathan Fel... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] |
15,828 | <p>Is there a free or open source library to read Excel files (.xls) directly from a C# program? </p>
<p>It does not need to be too fancy, just to select a worksheet and read the data as strings. So far, I've been using Export to Unicode text function of Excel, and parsing the resulting (tab-delimited) file, but I'd like to eliminate the manual step.</p>
| [
{
"answer_id": 15839,
"author": "Ryan Farley",
"author_id": 1627,
"author_profile": "https://Stackoverflow.com/users/1627",
"pm_score": 6,
"selected": false,
"text": "select * from [Sheet1$]"
},
{
"answer_id": 15970,
"author": "hitec",
"author_id": 120,
"author_profil... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/838/"
] |
15,838 | <p>Can the performance of this sequential search algorithm (taken from
<a href="http://books.google.co.uk/books?id=to6M9_dbjosC&dq=the+practice+of+programming&pg=PP1&ots=3YH6Ggq0_a&sig=F2-ajdO37xA4iRec2sCyQF55Jjc&hl=en&sa=X&oi=book_result&resnum=1&ct=result" rel="noreferrer">The Practice of Programming</a>) be improved using any of C's native utilities, e.g. if I set the i variable to be a register variable ?</p>
<pre><code>int lookup(char *word, char*array[])
{
int i
for (i = 0; array[i] != NULL; i++)
if (strcmp(word, array[i]) == 0)
return i;
return -1;
}
</code></pre>
| [
{
"answer_id": 15876,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 1,
"selected": false,
"text": "for (i = 0; i < n; ++i)\n foo(a[i]);\n char **p = a;\nfor (i = 0; i < n; ++i)\n foo(*p);\n ++p;\n for (p = a; *p... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381/"
] |
15,851 | <p>After I was convinced that labeled breaks/continues are a total "nono" over <a href="https://stackoverflow.com/questions/15481/java-coding-standard-best-practices-labeled-brakecontinue#15501">here</a>, I need help to remove the label out of my code.</p>
<p>I have a square matrix and a vector that has the same length. The vector has already some values in it an depending on the values in the matrix the vector is changed in the loop.</p>
<p>I hope, the code-fragment is basically understandable… </p>
<pre><code>vectorLoop:
for( int idx = 0; idx < vectorLength; idx++) {
if( conditionAtVectorPosition( v, idx ) ) continue vectorLoop;
matrixLoop:
for( rowIdx = 0; rowIdx < n; rowIdx++ ) {
if( anotherConditionAtVector( v, rowIdx ) ) continue matrixLoop;
if( conditionAtMatrixRowCol( m, rowIdx, idx ) ) continue vectorLoop;
}
setValueInVector( v, idx );
}
</code></pre>
<p>Please convince me, that there is a more readable/better version without the labels.</p>
| [
{
"answer_id": 15855,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 1,
"selected": false,
"text": "for( int idx = 0; idx < vectorLength; idx++) {\n if( conditionAtVectorPosition( v, idx ) ) continue;\n\n for( rowIdx = 0; row... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870/"
] |
15,880 | <p>I need to read from Outlook .MSG file in .NET <em>without</em> using COM API for Outlook (cos it will not be installed on the machines that my app will run). Are there any free 3rd party libraries to do that? I want to extract From, To, CC and BCC fields. Sent/Receive date fields would be good if they are also stored in MSG files.</p>
| [
{
"answer_id": 2365689,
"author": "Knox",
"author_id": 4873,
"author_profile": "https://Stackoverflow.com/users/4873",
"pm_score": 3,
"selected": false,
"text": "Public Sub ProcessMail()\n\n Dim Sess As RDOSession\n Dim myMsg As RDOMail\n Dim myString As String\n\n Set Sess = Cre... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39/"
] |
15,899 | <p>I have a <code>XmlDocument</code> in java, created with the <code>Weblogic XmlDocument</code> parser.</p>
<p>I want to replace the content of a tag in this <code>XMLDocument</code> with my own data, or insert the tag if it isn't there.</p>
<pre><code><customdata>
<tag1 />
<tag2>mfkdslmlfkm</tag2>
<location />
<tag3 />
</customdata>
</code></pre>
<p>For example I want to insert a URL in the location tag:</p>
<pre><code><location>http://something</location>
</code></pre>
<p>but otherwise leave the XML as is.</p>
<p>Currently I use a <code>XMLCursor</code>:</p>
<pre><code> XmlObject xmlobj = XmlObject.Factory.parse(a.getCustomData(), options);
XmlCursor xmlcur = xmlobj.newCursor();
while (xmlcur.hasNextToken()) {
boolean found = false;
if (xmlcur.isStart() && "schema-location".equals(xmlcur.getName().toString())) {
xmlcur.setTextValue("http://replaced");
System.out.println("replaced");
found = true;
} else if (xmlcur.isStart() && "customdata".equals(xmlcur.getName().toString())) {
xmlcur.push();
} else if (xmlcur.isEnddoc()) {
if (!found) {
xmlcur.pop();
xmlcur.toEndToken();
xmlcur.insertElementWithText("schema-location", "http://inserted");
System.out.println("inserted");
}
}
xmlcur.toNextToken();
}
</code></pre>
<p>I tried to find a "quick" <code>xquery</code> way to do this since the <code>XmlDocument</code> has an <code>execQuery</code> method, but didn't find it very easy. </p>
<p>Do anyone have a better way than this? It seems a bit elaborate.</p>
| [
{
"answer_id": 15961,
"author": "alanl",
"author_id": 1464,
"author_profile": "https://Stackoverflow.com/users/1464",
"pm_score": 0,
"selected": false,
"text": "query fn:replace(string,pattern,replace)\n"
},
{
"answer_id": 15967,
"author": "Olly",
"author_id": 1174,
... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/86/"
] |
15,917 | <p>I'm using NHibernate on a project and I need to do data auditing. I found <a href="http://www.codeproject.com/KB/cs/NHibernate_IInterceptor.aspx" rel="nofollow noreferrer">this article</a> on codeproject which discusses the IInterceptor interface.</p>
<p>What is your preferred way of auditing data? Do you use database triggers? Do you use something similar to what's dicussed in the article?</p>
| [
{
"answer_id": 212932,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 2,
"selected": false,
"text": "public interface IRepository<EntityType> where EntityType:IAuditably\n{ \n public void Save(EntityType entity);\n}\n... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122/"
] |
15,949 | <p>I have a tomcat instance setup but the database connection I have configured in <code>context.xml</code> keeps dying after periods of inactivity.</p>
<p>When I check the logs I get the following error:</p>
<p>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the server was68051 seconds
ago. The last packet sent successfully to the server was 68051 seconds
ago, which is longer than the server configured value of
'wait_timeout'. You should consider either expiring and/or testing
connection validity before use in your application, increasing the
server configured values for client timeouts, or using the Connector/J
connection property 'autoReconnect=true' to avoid this problem.</p>
<p>Here is the configuration in context.xml:</p>
<pre><code><Resource name="dataSourceName"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="username"
password="********"
removeAbandoned = "true"
logAbandoned = "true"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/databasename?autoReconnect=true&amp;useEncoding=true&amp;characterEncoding=UTF-8" />
</code></pre>
<p>I am using <code>autoReconnect=true</code> like the error says to do, but the connection keeps dying. I have never seen this happen before.</p>
<p>I have also verified that all database connections are being closed properly.</p>
| [
{
"answer_id": 16168,
"author": "ScArcher2",
"author_id": 1310,
"author_profile": "https://Stackoverflow.com/users/1310",
"pm_score": 5,
"selected": true,
"text": "* Jakarta-Commons DBCP\n* Jakarta-Commons Collections\n* Jakarta-Commons Pool\n removeAbandonedTimeout=\"60\"\n testWhileIdl... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22/"
] |
15,954 | <p>How can a <code>sdbm</code> hash function (such as <a href="http://www.cse.yorku.ca/~oz/hash.html" rel="nofollow noreferrer">this</a>) be implemented in C# ?</p>
| [
{
"answer_id": 15971,
"author": "Timbo",
"author_id": 1810,
"author_profile": "https://Stackoverflow.com/users/1810",
"pm_score": 2,
"selected": false,
"text": "uint sdbm( string str )\n{\n uint hash = 0;\n foreach( char ch in str )\n {\n hash = ch + (hash << 6) + (hash <... | 2008/08/19 | [
"https://Stackoverflow.com/questions/15954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1658/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.