qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
31,790
<p>How many ServiceContracts can a WCF service have?</p> <p>Specifically, since a ServiceContract is an attribute to an interface, how many interfaces can I code into one WCF web service? Is it a one-to-one?</p> <p>Does it make sense to separate the contracts across multiple web services?</p>
[ { "answer_id": 31809, "author": "Ubiguchi", "author_id": 2562, "author_profile": "https://Stackoverflow.com/users/2562", "pm_score": 4, "selected": false, "text": "[ServiceBehavior(Namespace = \"DemoService\")]\npublic class DemoService : IDemoService, IDoNothingService\n <service name=\...
2008/08/28
[ "https://Stackoverflow.com/questions/31790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/831/" ]
31,794
<p>In .net frameworks 1.1, I use </p> <pre><code>System.Configuration.ConfigurationSettings.AppSettings["name"]; </code></pre> <p>for application settings. But in .Net 2.0, it says ConfigurationSettings is obsolete and to use ConfigurationManager instead. So I swapped it out with this:</p> <pre><code>System.Configu...
[ { "answer_id": 31838, "author": "Joda", "author_id": 1090, "author_profile": "https://Stackoverflow.com/users/1090", "pm_score": 1, "selected": false, "text": "ConfigurationSettings.AppSettings[\"name\"];\n" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/31794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2121/" ]
31,799
<p><strong>NOTE: <em>XMLIgnore</em> is NOT the answer!</strong></p> <p>OK, so following on from my question on <a href="https://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types">XML Serialization and Inherited Types</a>, I began integrating that code into my application I am working on, stupidly ...
[ { "answer_id": 31824, "author": "Brian Leahy", "author_id": 580, "author_profile": "https://Stackoverflow.com/users/580", "pm_score": 1, "selected": false, "text": " [XmlArray(\"ProviderPatientLists\")]\n [XmlArrayItem(\"File\")]\n public ProviderPatientList Files\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/31799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
31,818
<p>How can I find out which Service Pack is installed on my copy of SQL Server?</p>
[ { "answer_id": 31820, "author": "Sergio Acosta", "author_id": 2954, "author_profile": "https://Stackoverflow.com/users/2954", "pm_score": 5, "selected": true, "text": "-- SQL Server 2000/2005\nSELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edi...
2008/08/28
[ "https://Stackoverflow.com/questions/31818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3353/" ]
31,849
<p>It seems that it is impossible to capture the keyboard event normally used for copy when running a Flex application in the browser or as an AIR app, presumably because the browser or OS is intercepting it first.</p> <p>Is there a way to tell the browser or OS to let the event through?</p> <p>For example, on an Adv...
[ { "answer_id": 48427, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 0, "selected": false, "text": "event.ctrlKey && event.keyCode = Keyboard.C event.charCode == 67 charCode keyCode 3 charCode 3 keyCode" }, { "answer_id"...
2008/08/28
[ "https://Stackoverflow.com/questions/31849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3023/" ]
31,865
<p>I know this might be a no-brainer, but please read on.</p> <p>I also know it's generally not considered a good idea, maybe the worst, to let a browser run and interact with local apps, even in an intranet context.</p> <p>We use Citrix for home-office, and people really like it. Now, they would like the same kind o...
[ { "answer_id": 33689, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 1, "selected": false, "text": "<a href=\"dial#1800-234-567\">Call John Smith</a>\n" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/31865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2452/" ]
31,867
<p>While I've seen rare cases where <em>private</em> inheritance was needed, I've never encountered a case where <em>protected</em> inheritance is needed. Does someone have an example?</p>
[ { "answer_id": 82215, "author": "Antti Kissaniemi", "author_id": 2948, "author_profile": "https://Stackoverflow.com/users/2948", "pm_score": 1, "selected": false, "text": "derivedFunction() class SomeImplementationClass\n{\nprotected:\n void service() {\n derivedFunction();\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/31867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2638/" ]
31,868
<p>What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?</p> <p><strong>Following the two initial answers...</strong></p> <ul> <li><p>We definitely need to use the Web Service layer as we will be making these calls from remot...
[ { "answer_id": 34274, "author": "Andy McCluggage", "author_id": 3362, "author_profile": "https://Stackoverflow.com/users/3362", "pm_score": 5, "selected": true, "text": "public static void UploadFile2007(string destinationUrl, byte[] fileData)\n{\n // List of desination Urls, Just one...
2008/08/28
[ "https://Stackoverflow.com/questions/31868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3362/" ]
31,870
<p>What is the best way to include an html entity in XSLT?</p> <pre><code>&lt;xsl:template match="/a/node"&gt; &lt;xsl:value-of select="."/&gt; &lt;xsl:text&gt;&amp;nbsp;&lt;/xsl:text&gt; &lt;/xsl:template&gt; </code></pre> <p>this one returns a <strong>XsltParseError</strong></p>
[ { "answer_id": 31873, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 8, "selected": true, "text": "<xsl:text disable-output-escaping=\"yes\"><![CDATA[&nbsp;]]></xsl:text>\n <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp \"&#160;\"> ]>\...
2008/08/28
[ "https://Stackoverflow.com/questions/31870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532/" ]
31,871
<p>Ok, I have a strange exception thrown from my code that's been bothering me for ages.</p> <pre><code>System.Net.Sockets.SocketException: A blocking operation was interrupted by a call to WSACancelBlockingCall at System.Net.Sockets.Socket.Accept() at System.Net.Sockets.TcpListener.AcceptTcpClient() </code></pr...
[ { "answer_id": 261393, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "serverSocket.Stop() Dispose try\n{\n //...\n}\ncatch (SocketException socketEx)\n{ \n if (_disposed)\n ar.SetA...
2008/08/28
[ "https://Stackoverflow.com/questions/31871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3263/" ]
31,875
<p>There seem to be many ways to define <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="noreferrer">singletons</a> in Python. Is there a consensus opinion on Stack&nbsp;Overflow?</p>
[ { "answer_id": 31884, "author": "John", "author_id": 2168, "author_profile": "https://Stackoverflow.com/users/2168", "pm_score": 2, "selected": false, "text": "class Singleton:\n __single = None\n def __init__( self ):\n if Singleton.__single:\n raise Singleton.__...
2008/08/28
[ "https://Stackoverflow.com/questions/31875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3363/" ]
31,913
<p>I'm sorry if my question is so long and technical but I think it's so important other people will be interested about it</p> <p>I was looking for a way to separate clearly some softwares internals from their representation in c++</p> <p>I have a generic parameter class (to be later stored in a container) that can ...
[ { "answer_id": 33452, "author": "genix", "author_id": 2714, "author_profile": "https://Stackoverflow.com/users/2714", "pm_score": 0, "selected": false, "text": "class Visitor\n{\npublic:\n template< class T > void visit( const T& param ) const\n {\n assert( false && \"this parameter...
2008/08/28
[ "https://Stackoverflow.com/questions/31913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3373/" ]
31,919
<p>I'm comparing it Java where you can start your application server in debug mode, then attach your IDE to the server. And you can change your code "on the fly" without restarting the server. As long as your changes don't affect any method signatures or fields you can just hit recompile for a class and the application...
[ { "answer_id": 31984, "author": "Artem Tikhomirov", "author_id": 2313, "author_profile": "https://Stackoverflow.com/users/2313", "pm_score": 2, "selected": false, "text": "<system.web>\n ...\n <trust level=\"WSS_Medium\" originUrl=\"\" />\n ...\n</system.web>\n" }, { "an...
2008/08/28
[ "https://Stackoverflow.com/questions/31919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/578/" ]
31,931
<p>I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly. That is, if I have a date of 'Today', I want to get the date for 'Yesterday'.</p> <p>It always seems to take more code than necessary when I do this, so I'm wondering if there's any simpler way. </p> <p>What's th...
[ { "answer_id": 31938, "author": "liammclennan", "author_id": 2785, "author_profile": "https://Stackoverflow.com/users/2785", "pm_score": 3, "selected": false, "text": "var today = new Date();\nvar yesterday = new Date().setDate(today.getDate() -1);\n" }, { "answer_id": 31939, ...
2008/08/28
[ "https://Stackoverflow.com/questions/31931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/916/" ]
31,935
<p>I'm sure this is easy but I can't figure it out:</p> <p>I have an ASP.NET page with some UpdatePanels on it. I want the page to <em>completely</em> load with some 'Please wait' text in the UpdatePanels. Then once the page is <em>completely loaded</em> I want to call a code-behind function to update the UpdatePane...
[ { "answer_id": 33161, "author": "SAL", "author_id": 3099, "author_profile": "https://Stackoverflow.com/users/3099", "pm_score": 3, "selected": false, "text": " <%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Default.aspx.cs\" Inherits=\"AJAXPostLoadCall._Default\" %>\n\...
2008/08/28
[ "https://Stackoverflow.com/questions/31935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3099/" ]
32,000
<p>I'm basically trying to figure out the simplest way to perform your basic insert operation in C#.NET using the SqlClient namespace. </p> <p>I'm using <code>SqlConnection</code> for my db link, I've already had success executing some reads, and I want to know the simplest way to insert data. I'm finding what seem to...
[ { "answer_id": 32005, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 5, "selected": true, "text": "using (var conn = new SqlConnection(yourConnectionString))\n{\n var cmd = new SqlCommand(\"insert into Foo values (@bar...
2008/08/28
[ "https://Stackoverflow.com/questions/32000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1344/" ]
32,001
<p>I'd like to have a java.utils.Timer with a resettable time in java.I need to set a once off event to occur in X seconds. If nothing happens in between the time the timer was created and X seconds, then the event occurs as normal. </p> <p>If, however, before X seconds has elapsed, I decide that the event should occu...
[ { "answer_id": 32047, "author": "WMR", "author_id": 2844, "author_profile": "https://Stackoverflow.com/users/2844", "pm_score": 1, "selected": false, "text": "Timer/TimerTask java.util.concurrent.ScheduledThreadPoolExecutor" }, { "answer_id": 32057, "author": "C. K. Young", ...
2008/08/28
[ "https://Stackoverflow.com/questions/32001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142/" ]
32,003
<p>Im searching a tool which allows me to specify some folders as "bookmarks" and than access them on the commandline (on Windows XP) via a keyword. Something like:</p> <pre><code>C:\&gt; go home D:\profiles\user\home\&gt; go svn-project1 D:\projects\project1\svn\branch\src\&gt; </code></pre> <p>I'm currently using a...
[ { "answer_id": 32007, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 2, "selected": false, "text": "$vids=\"C:\\Users\\mabster\\Videos\"\n cd $vids\n" }, { "answer_id": 32012, "author": "Espo", "author_id"...
2008/08/28
[ "https://Stackoverflow.com/questions/32003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1462/" ]
32,010
<p><a href="http://twitter.com/codinghorror/statuses/901272685" rel="nofollow noreferrer">Source</a></p> <blockquote> <p>RegexOptions.IgnoreCase is more expensive than I would have thought (eg, should be barely measurable)</p> </blockquote> <p>Assuming that this applies to PHP, Python, Perl, Ruby etc as well as C# ...
[ { "answer_id": 32021, "author": "Jeff Atwood", "author_id": 1, "author_profile": "https://Stackoverflow.com/users/1", "pm_score": 5, "selected": true, "text": "RegexOptions.IgnoreCase" }, { "answer_id": 32135, "author": "Nathan Fellman", "author_id": 1084, "author_pro...
2008/08/28
[ "https://Stackoverflow.com/questions/32010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
32,027
<p>I'm new to NAnt but have some experience with Ant and CruiseControl.</p> <p>What I want to do is have my SVN project include all tools needed (like NUnit and Mocks etc) so I can check out onto a fresh machine and build. This strategy is outlined by J.P Boodhoo <a href="http://blog.jpboodhoo.com/NAntStarterSeries.as...
[ { "answer_id": 32317, "author": "RobertTheGrey", "author_id": 1107, "author_profile": "https://Stackoverflow.com/users/1107", "pm_score": 4, "selected": true, "text": "$ export MONO_NO_UNLOAD=1\n$ make clean\n$ make\n$ mono bin/NAnt.exe clean build\n <project name=\"DualBuild\">\n <prop...
2008/08/28
[ "https://Stackoverflow.com/questions/32027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3024/" ]
32,034
<p>After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework?</p>
[ { "answer_id": 100921, "author": "Hace", "author_id": 18703, "author_profile": "https://Stackoverflow.com/users/18703", "pm_score": 2, "selected": false, "text": "public void NotifyObservers()\n{\n foreach(Product product in ProductList)\n {\n if (product is IProductObserver...
2008/08/28
[ "https://Stackoverflow.com/questions/32034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2993/" ]
32,041
<p>Is it possible for the compiler to remove statements used for debugging purposes (such as logging) from production code? The debug statements would need to be marked somehow, maybe using annotations.</p> <p>It's easy to set a property (debug = true) and check it at each debug statement, but this can reduce performa...
[ { "answer_id": 32067, "author": "izb", "author_id": 974, "author_profile": "https://Stackoverflow.com/users/974", "pm_score": 3, "selected": false, "text": "public abstract class Config\n{\n public static final boolean ENABLELOGGING = true;\n}\n import static Config.*;\n\npublic class...
2008/08/28
[ "https://Stackoverflow.com/questions/32041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1772/" ]
32,044
<p>I have a tree structure in memory that I would like to render in HTML using a Django template. </p> <pre><code>class Node(): name = "node name" children = [] </code></pre> <p>There will be some object <code>root</code> that is a <code>Node</code>, and <code>children</code> is a list of <code>Node</code>s. <cod...
[ { "answer_id": 32125, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 6, "selected": true, "text": "<li> </li>" }, { "answer_id": 11644588, "author": "Rohan", "author_id": 229410, "author_profile": ...
2008/08/28
[ "https://Stackoverflow.com/questions/32044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3154/" ]
32,058
<p>I have a simple web service operation like this one:</p> <pre><code> [WebMethod] public string HelloWorld() { throw new Exception("HelloWorldException"); return "Hello World"; } </code></pre> <p>And then I have a client application that consumes the web service and then calls the ope...
[ { "answer_id": 32508, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 4, "selected": true, "text": "[WebMethod]\npublic ResponseClass HelloWorld()\n{\n ResponseClass c = new ResponseClass();\n try \n {\n throw new Exce...
2008/08/28
[ "https://Stackoverflow.com/questions/32058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3379/" ]
32,059
<p>Let's say I have four tables: <code>PAGE</code>, <code>USER</code>, <code>TAG</code>, and <code>PAGE-TAG</code>:</p> <pre><code>Table | Fields ------------------------------------------ PAGE | ID, CONTENT TAG | ID, NAME USER | ID, NAME PAGE-TAG | ID, PAGE-ID, TAG-ID, USER-ID </code></p...
[ { "answer_id": 32070, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https://Stackoverflow.com/users/2260", "pm_score": 2, "selected": false, "text": "select page.content, count(page-tag.tag-id) as tagcount\nfrom page inner join page-tag on page-tag.page-id = page.id\ngr...
2008/08/28
[ "https://Stackoverflow.com/questions/32059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
32,085
<p>In XLST how would you find out the length of a node-set?</p>
[ { "answer_id": 32092, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 5, "selected": true, "text": "<xsl:variable name=\"length\" select=\"count(nodeset)\"/>\n" }, { "answer_id": 32217, "author": "samjudson", "aut...
2008/08/28
[ "https://Stackoverflow.com/questions/32085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
32,087
<p>I want to know what are the options to do some scripting jobs in windows platform. I need functionality like file manipulations, registry editing etc. Can files be edited using scripting tools? What other functionality does windows scripting tools offer? Can everything that can be done using the Windows GUI be done ...
[ { "answer_id": 55769598, "author": "Zhiyuan-Amos", "author_id": 8828382, "author_profile": "https://Stackoverflow.com/users/8828382", "pm_score": 0, "selected": false, "text": "(Get-Content c:\\temp\\test.txt).replace('[MYID]', 'MyValue') | Set-Content c:\\temp\\test.txt Set-ItemProperty...
2008/08/28
[ "https://Stackoverflow.com/questions/32087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
32,100
<p>What is the simplest SQL query to find the second largest integer value in a specific column? </p> <p>There are maybe duplicate values in the column.</p>
[ { "answer_id": 32108, "author": "Magnar", "author_id": 1123, "author_profile": "https://Stackoverflow.com/users/1123", "pm_score": 3, "selected": false, "text": "SELECT DISTINCT value \nFROM Table \nORDER BY value DESC \nLIMIT 2\n SELECT MIN(value) \nFROM ( SELECT DISTINCT value \n ...
2008/08/28
[ "https://Stackoverflow.com/questions/32100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
32,145
<p>I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it.</p> <p>I didn't want to just dump a bunch of code in the question so I've posted the code for the class on <code>refactormycode</code>.</p> <p><strong><a href="http://www.refactormycode.com...
[ { "answer_id": 32191, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 3, "selected": false, "text": "class test {\n protected $x='';\n protected $y='';\n\n function set_y ($y) {\n print \"specific function set_y\\n\"...
2008/08/28
[ "https://Stackoverflow.com/questions/32145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
32,149
<p>Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase or Upper)? I'm looking for something that takes a value such as <code>"GEORGE BURDELL"</code> or <code>"george burdell"</code> and turns it into <code>"George Burdell"</code>.</p> <p>I have a simple one that handles the simple cases. Th...
[ { "answer_id": 32189, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 1, "selected": false, "text": "/\\w+/\n /(\\w)(\\w*)/\n def make_proper(match):\n return match[1].to_upper + match[2]\n" }, { "answer_id":...
2008/08/28
[ "https://Stackoverflow.com/questions/32149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3203/" ]
32,151
<p>Is there a way to export a simple HTML page to Word (.doc format, not .docx) without having Microsoft Word installed?</p>
[ { "answer_id": 32176, "author": "Biri", "author_id": 968, "author_profile": "https://Stackoverflow.com/users/968", "pm_score": 5, "selected": true, "text": "application/msword doc" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3396/" ]
32,168
<p>A question related to <a href="https://stackoverflow.com/questions/28002">Regular cast vs. static_cast vs. dynamic_cast</a>:</p> <p>What cast syntax style do you prefer in C++?</p> <ul> <li>C-style cast syntax: <code>(int)foo</code></li> <li>C++-style cast syntax: <code>static_cast&lt;int&gt;(foo)</code></li> <li>...
[ { "answer_id": 32224, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 7, "selected": true, "text": "void f(auto_ptr<int> x);\n\nf(static_cast<auto_ptr<int> >(new int(5))); // GOOD\nf(auto_ptr<int>(new int(5)); ...
2008/08/28
[ "https://Stackoverflow.com/questions/32168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2686/" ]
32,173
<p>I'm trying to disable a bunch of controls with JavaScript (so that they post back values). All the controls work fine except for my radio buttons as they lose their value. In the below code which is called via a recursive function to disable all child controls the Second else (else if (control is <code>RadioButton</...
[ { "answer_id": 32473, "author": "Nicholas", "author_id": 2808, "author_profile": "https://Stackoverflow.com/users/2808", "pm_score": 3, "selected": true, "text": " private static void DisableControl(WebControl control)\n {\n Type controlType = control.GetType();\n\n i...
2008/08/28
[ "https://Stackoverflow.com/questions/32173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2808/" ]
32,175
<p>I'm trying to install a .NET service I wrote. As recommended by MSDN, I'm using InstallUtil. But I have missed how I can set the default service user on the command-line or even in the service itself. Now, when InstallUtil is run, it will display a dialog asking the user for the credentials for a user. I'm tryin...
[ { "answer_id": 50661256, "author": "D. Lockett", "author_id": 7716585, "author_profile": "https://Stackoverflow.com/users/7716585", "pm_score": 0, "selected": false, "text": "/username /password installutil.exe /username=user /password=password yourservice.exe\n public override void Inst...
2008/08/28
[ "https://Stackoverflow.com/questions/32175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2494/" ]
32,231
<p>Are there any rapid Database protoyping tools that don't require me to declare a database schema, but rather create it based on the way I'm using my entities.</p> <p>For example, assuming an empty database (pseudo code):</p> <pre><code>user1 = new User() // Creates the user table with a single id column user1.fir...
[ { "answer_id": 32463, "author": "Ed.T", "author_id": 3014, "author_profile": "https://Stackoverflow.com/users/3014", "pm_score": 1, "selected": false, "text": "class User {\n\n String userName\n String firstName\n String lastName\n Date dateCreated\n Date lastUpdated\n\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/32231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
32,241
<p><a href="https://stackoverflow.com/questions/32149/does-anyone-have-a-good-proper-case-algorithm">Using this question</a> as the base is there an alogrithm or coding example to change some text to Pascal or Camel casing.</p> <p>For example:</p> <pre><code>mynameisfred </code></pre> <p>becomes</p> <pre><code>Came...
[ { "answer_id": 32429, "author": "ljs", "author_id": 3394, "author_profile": "https://Stackoverflow.com/users/3394", "pm_score": 3, "selected": true, "text": "camelCase(\"hithisisatest\");\n \"hiThisIsATest\"\n \"hitHisIsATest\"\n SetPhraseCase(phrase, CamelOrPascal):\n if no delimiter...
2008/08/28
[ "https://Stackoverflow.com/questions/32241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1075/" ]
32,243
<p>The following PHP code snippet uses GD to resize a browser-uploaded PNG to 128x128. It works great, except that the transparent areas in the original image are being replaced with a solid color- black in my case. </p> <p>Even though <code>imagesavealpha</code> is set, something isn't quite right.</p> <p>What's the...
[ { "answer_id": 32270, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 4, "selected": false, "text": "$srcImage = imagecreatefrompng($uploadTempFile);\nimagealphablending($srcImage, false);\nimagesavealpha($srcImage, tru...
2008/08/28
[ "https://Stackoverflow.com/questions/32243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1820/" ]
32,260
<p>Instead of relying on my host to send an email, I was thinking of sending the email messages using my <strong>Gmail</strong> account. The emails are personalized emails to the bands I play on my show. </p> <p>Is it possible to do it?</p>
[ { "answer_id": 32336, "author": "Domenic", "author_id": 3191, "author_profile": "https://Stackoverflow.com/users/3191", "pm_score": 11, "selected": true, "text": "System.Net.Mail System.Web.Mail System.Web.Mail using System.Net;\nusing System.Net.Mail;\n\nvar fromAddress = new MailAddres...
2008/08/28
[ "https://Stackoverflow.com/questions/32260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2535/" ]
32,280
<p>I am in the middle of reading the excellent <a href="https://rads.stackoverflow.com/amzn/click/com/0132350882" rel="noreferrer" rel="nofollow noreferrer">Clean Code</a></p> <p>One discussion is regarding passing nulls into a method.</p> <pre><code>public class MetricsCalculator { public double xProjection(Poin...
[ { "answer_id": 32304, "author": "Chris Karcher", "author_id": 2773, "author_profile": "https://Stackoverflow.com/users/2773", "pm_score": 2, "selected": false, "text": "if (p1 == null || p2 == null) {\n throw new IllegalArgumentException(\"Invalid argument for xProjection\");\n}\n" ...
2008/08/28
[ "https://Stackoverflow.com/questions/32280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3295/" ]
32,282
<p>How can I test the same regex against different regular expression engines?</p>
[ { "answer_id": 32354, "author": "Sébastien RoccaSerra", "author_id": 2797, "author_profile": "https://Stackoverflow.com/users/2797", "pm_score": 3, "selected": false, "text": "re-builder" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2820/" ]
32,332
<p>This isn't a design question, really, though it may seem like it. (Well, okay, it's kind of a design question). What I'm wondering is why the C++ <code>std::fstream</code> classes don't take a <code>std::string</code> in their constructor or open methods. Everyone loves code examples so:</p> <pre><code>#include &lt...
[ { "answer_id": 32368, "author": "Christopher", "author_id": 3186, "author_profile": "https://Stackoverflow.com/users/3186", "pm_score": 4, "selected": false, "text": "std::string std::swap std::sort" }, { "answer_id": 37542, "author": "wilhelmtell", "author_id": 456, ...
2008/08/28
[ "https://Stackoverflow.com/questions/32332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
32,333
<p>Here's a perfect example of the problem: <a href="http://blog.teksol.info/2009/03/27/argumenterror-on-number-sum-when-using-classifier-bayes.html" rel="nofollow noreferrer">Classifier gem breaks Rails</a>.</p> <p>** Original question: **</p> <p>One thing that concerns me as a security professional is that Ruby doe...
[ { "answer_id": 33611, "author": "Jörg W Mittag", "author_id": 2988, "author_profile": "https://Stackoverflow.com/users/2988", "pm_score": 3, "selected": false, "text": "require 'awesome'\n# Do something awesome.\n require 'evil_cracker_lib_from_russian_pr0n_site'\n# Overrides crypto func...
2008/08/28
[ "https://Stackoverflow.com/questions/32333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
32,338
<p>I just saw <a href="http://www.codeplex.com/CloneDetectiveVS" rel="nofollow noreferrer">Clone Detective</a> linked on YCombinator news, and the idea heavily appeals to me. It seems like it would be useful for many languages, not just C#, but I haven't seen anything similar elsewhere.</p> <p>Edit: For those who don'...
[ { "answer_id": 33611, "author": "Jörg W Mittag", "author_id": 2988, "author_profile": "https://Stackoverflow.com/users/2988", "pm_score": 3, "selected": false, "text": "require 'awesome'\n# Do something awesome.\n require 'evil_cracker_lib_from_russian_pr0n_site'\n# Overrides crypto func...
2008/08/28
[ "https://Stackoverflow.com/questions/32338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3326/" ]
32,341
<p>I may just be missing this functionality, but does anyone know if there is a widget available:</p> <p>I need to list the subject for all the entries that are associated with a given tag.</p> <p>For example: I have 5 articles tagged with "Tutorial", I'd like to see a list as follows:</p> <ul> <li>Tutorial 1: Insta...
[ { "answer_id": 33611, "author": "Jörg W Mittag", "author_id": 2988, "author_profile": "https://Stackoverflow.com/users/2988", "pm_score": 3, "selected": false, "text": "require 'awesome'\n# Do something awesome.\n require 'evil_cracker_lib_from_russian_pr0n_site'\n# Overrides crypto func...
2008/08/28
[ "https://Stackoverflow.com/questions/32341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2490/" ]
32,343
<p>Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the progr...
[ { "answer_id": 32352, "author": "wvdschel", "author_id": 2018, "author_profile": "https://Stackoverflow.com/users/2018", "pm_score": 2, "selected": false, "text": "Environment.ProcessorCount" }, { "answer_id": 568002, "author": "Joe Erickson", "author_id": 56710, "aut...
2008/08/28
[ "https://Stackoverflow.com/questions/32343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
32,366
<p>I just started thinking about creating/customizing a web crawler today, and know very little about web crawler/robot etiquette. A majority of the writings on etiquette I've found seem old and awkward, so I'd like to get some current (and practical) insights from the web developer community.</p> <p>I want to use a ...
[ { "answer_id": 32452, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 2, "selected": false, "text": "no-cache <link> <script src=\"...\"></script>" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326/" ]
32,369
<p>One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes ...
[ { "answer_id": 32386, "author": "Markus Olsson", "author_id": 2114, "author_profile": "https://Stackoverflow.com/users/2114", "pm_score": 9, "selected": true, "text": "<form id=\"loginForm\" action=\"login.cgi\" method=\"post\" autocomplete=\"off\">\n $('#loginForm').attr('autocomplete',...
2008/08/28
[ "https://Stackoverflow.com/questions/32369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3262/" ]
32,397
<p>On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine. </p>
[ { "answer_id": 32399, "author": "Tall Jeff", "author_id": 1553, "author_profile": "https://Stackoverflow.com/users/1553", "pm_score": 5, "selected": true, "text": "t = (time of entry post) - (Dec 8, 2005)\nx = upvotes - downvotes\n\ny = {1 if x > 0, 0 if x = 0, -1 if x < 0)\nz = {1 if x ...
2008/08/28
[ "https://Stackoverflow.com/questions/32397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942/" ]
32,404
<p>I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service.</p> <p>I am c...
[ { "answer_id": 32440, "author": "Ricardo Reyes", "author_id": 3399, "author_profile": "https://Stackoverflow.com/users/3399", "pm_score": 9, "selected": true, "text": "import win32serviceutil\nimport win32service\nimport win32event\nimport servicemanager\nimport socket\n\n\nclass AppServ...
2008/08/28
[ "https://Stackoverflow.com/questions/32404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
32,412
<p>I've been tasked with the the maintenance of a nonprofit website that recently fell victim to a SQL injection attack. Someone exploited a form on the site to add text to every available text-like field in the database (varchar, nvarchar, etc.) which, when rendered as HTML, includes and executes a JavaScript file. </...
[ { "answer_id": 32422, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 0, "selected": false, "text": "DECLARE @T VARCHAR(255),@C VARCHAR(4000) \nDECLARE Table_Cursor CURSOR FOR \nSELECT a.name,b.name FROM sysobjects a,syscolum...
2008/08/28
[ "https://Stackoverflow.com/questions/32412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
32,414
<p>We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the clien...
[ { "answer_id": 32427, "author": "Huppie", "author_id": 1830, "author_profile": "https://Stackoverflow.com/users/1830", "pm_score": 10, "selected": true, "text": "?<version> <script type=\"text/javascript\" src=\"myfile.js?1500\"></script>\n <script type=\"text/javascript\" src=\"myfile.j...
2008/08/28
[ "https://Stackoverflow.com/questions/32414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2176/" ]
32,428
<p>I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work).</p> <p>Here is the error that is thrown by the custom code I've written.</p> <blockquote> <p>System.Security.SecurityException: R...
[ { "answer_id": 37379, "author": "Ian Robinson", "author_id": 326, "author_profile": "https://Stackoverflow.com/users/326", "pm_score": 4, "selected": true, "text": " <CodeGroup\n class=\"UnionCodeGroup\"\n version=\"1\"\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/32428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326/" ]
32,433
<p>This query works great:</p> <pre><code>var pageObject = (from op in db.ObjectPermissions join pg in db.Pages on op.ObjectPermissionName equals page.PageName where pg.PageID == page.PageID select op) .SingleOrDefault(); </code></pre> <p>I get a ...
[ { "answer_id": 32445, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": " select new { op, pg }\n" }, { "answer_id": 32449, "author": "aku", "author_id": 1196, "author_pro...
2008/08/28
[ "https://Stackoverflow.com/questions/32433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
32,448
<p>The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however <em>very</em> scared of c-comp...
[ { "answer_id": 14654717, "author": "vonbrand", "author_id": 1839777, "author_profile": "https://Stackoverflow.com/users/1839777", "pm_score": 1, "selected": false, "text": "-Wall" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1524/" ]
32,458
<p>I have a coworker who writes unit tests for objects which fill their fields with random data. His reason is that it gives a wider range of testing, since it will test a lot of different values, whereas a normal test only uses a single static value.</p> <p>I've given him a number of different reasons against this, t...
[ { "answer_id": 71762174, "author": "armandino", "author_id": 45112, "author_profile": "https://Stackoverflow.com/users/45112", "pm_score": 2, "selected": false, "text": "Person person = Instancio.create(Person.class);\n Person person = Instancio.of(Person.class)\n .generate(field(\"ag...
2008/08/28
[ "https://Stackoverflow.com/questions/32458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/517/" ]
32,460
<p>Here's the situation: I need to bind a WPF <code>FixedPage</code> against a <code>DataRow</code>. Bindings don't work against <code>DataRows</code>; they work against <code>DataRowViews</code>. I need to do this in the most generic way possible, as I know nothing about and have no control over what is in the <cod...
[ { "answer_id": 32483, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "row.Table.DefaultView[row.Table.Rows.IndexOf(row)]\n" }, { "answer_id": 6989851, "author": "Joel Barsotti", "au...
2008/08/28
[ "https://Stackoverflow.com/questions/32460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
32,462
<p>So I've got a hobby site I'm working on. I've got items that are tagged and I want to associate those items with photos from Flickr. Even with restrictive searches, I might get results numbering in the thousands.</p> <p>Requirements:</p> <ol> <li>I want to display between 10-20 pictures but I want to randomize t...
[ { "answer_id": 32483, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "row.Table.DefaultView[row.Table.Rows.IndexOf(row)]\n" }, { "answer_id": 6989851, "author": "Joel Barsotti", "au...
2008/08/28
[ "https://Stackoverflow.com/questions/32462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2863/" ]
32,529
<p>I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitrary directory.</p> <p>How should I go about doing that?</p>
[ { "answer_id": 32658, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 5, "selected": false, "text": "class DirectoryRestrictedFileSystemView extends FileSystemView\n{\n private final File[] rootDirectories;\n\n Di...
2008/08/28
[ "https://Stackoverflow.com/questions/32529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
32,537
<p>For scripting languages, what is the most effective way to utilize a console when developing? Are there ways to be more productive with a console than a "compile and run" only language?</p> <p>Added clarification: I am thinking more along the lines of Ruby, Python, Boo, etc. Languages that are used for full blown a...
[ { "answer_id": 32686, "author": "Joseph Pecoraro", "author_id": 792, "author_profile": "https://Stackoverflow.com/users/792", "pm_score": 3, "selected": true, "text": "irb .irbrc \"\".ch<tab> String#[] joe[~]$ irb\n>> \"12341:asdf\"[/\\d+/]\n# => \"12341\" \n>> \"12341:asdf\"[/\\d*/]\n#...
2008/08/28
[ "https://Stackoverflow.com/questions/32537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2001/" ]
32,540
<p>How is your javaScript code organized? Does it follow patterns like MVC, or something else? </p> <p>I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com" rel="noreferrer"...
[ { "answer_id": 32594, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 4, "selected": true, "text": "var Vehicle = jQuery.Class.create({ \n init: function(name) { this.name = name; } \n});\n\nvar Car = Vehicle.extend({ ...
2008/08/28
[ "https://Stackoverflow.com/questions/32540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3436/" ]
32,541
<p>Anybody have a good example how to deep clone a WPF object, preserving databindings?</p> <hr> <p>The marked answer is the first part.</p> <p>The second part is that you have to create an ExpressionConverter and inject it into the serialization process. Details for this are here:<br> <a href="http://www.codeproje...
[ { "answer_id": 32575, "author": "Arcturus", "author_id": 900, "author_profile": "https://Stackoverflow.com/users/900", "pm_score": 0, "selected": false, "text": " public static T DeepClone<T>(T from)\n {\n using (MemoryStream s = new MemoryStream())\n {\n B...
2008/08/28
[ "https://Stackoverflow.com/questions/32541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
32,570
<p>Is there some way I can use URLs like: </p> <p><em><a href="http://www.blog.com/team-spirit/" rel="nofollow noreferrer">http://www.blog.com/team-spirit/</a></em></p> <p>instead of</p> <p><em><a href="http://www.blog.com/?p=122" rel="nofollow noreferrer">http://www.blog.com/?p=122</a></em></p> <p>in a Windows hos...
[ { "answer_id": 73370706, "author": "Alamin Sarkar", "author_id": 19773925, "author_profile": "https://Stackoverflow.com/users/19773925", "pm_score": 0, "selected": false, "text": "# any file that exists just return it \nRewriteCond %{REQUEST_FILENAME} -f \nRewriteRule ^(.*) $1 [L]\n" ...
2008/08/28
[ "https://Stackoverflow.com/questions/32570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
32,586
<p>Is there an easy way to discover a File's creation time with Java? The File class only has a method to get the "last modified" time. According to some resources I found on Google, the File class doesn't provide a getCreationTime() method because not all file systems support the idea of a creation time.</p> <p>The...
[ { "answer_id": 3350512, "author": "LiuYan 刘研", "author_id": 404192, "author_profile": "https://Stackoverflow.com/users/404192", "pm_score": 3, "selected": false, "text": "// Get/Set windows file CreationTime/LastWriteTime/LastAccessTime\n// Test with jna-3.2.7\n// [http://maclife.net/wik...
2008/08/28
[ "https://Stackoverflow.com/questions/32586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1471/" ]
32,598
<p>If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the <em>svn</em> protocol instead of <em>file</em>?</p>
[ { "answer_id": 229642, "author": "Peter Wone", "author_id": 1715673, "author_profile": "https://Stackoverflow.com/users/1715673", "pm_score": 0, "selected": false, "text": "file svn http Svn Http" }, { "answer_id": 44699067, "author": "bahrep", "author_id": 761095, "a...
2008/08/28
[ "https://Stackoverflow.com/questions/32598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1670/" ]
32,607
<p>I'd like to rollback a change I made recently in TFS. In Subversion, this was pretty straightforward. However, it seems to be an incredible headache in TFS:</p> <h3>Option 1: Get Prior Version</h3> <ol> <li>Manually get prior version of each file</li> <li>Check out for edit</li> <li>Fail - the checkout (in VS2008) ...
[ { "answer_id": 5355837, "author": "Kevin Lo", "author_id": 199043, "author_profile": "https://Stackoverflow.com/users/199043", "pm_score": 4, "selected": false, "text": "TF - Team Foundation Version Control Tool, Version 10.0.30319.1\nCopyright (c) Microsoft Corporation. All rights rese...
2008/08/28
[ "https://Stackoverflow.com/questions/32607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1338/" ]
32,621
<p>I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit to the ones that need to show on the map.</p> <p>In normal view, VEMap.GetMapView().TopLeftLatLong ...
[ { "answer_id": 33238, "author": "MartinHN", "author_id": 2972, "author_profile": "https://Stackoverflow.com/users/2972", "pm_score": 0, "selected": false, "text": "function GetInfo() \n{\n alert('The latitude,longitude at the center of the map is: '+map.GetCenter()); \n}...
2008/08/28
[ "https://Stackoverflow.com/questions/32621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3420/" ]
32,633
<p>I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way into the script?</p> <p>@Jason: This is a good point, but in my case I do not...
[ { "answer_id": 32711, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 5, "selected": false, "text": "debugger;" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
32,637
<p>I am consuming the Twitter API and want to convert all URLs to hyperlinks. </p> <p>What is the most effective way you've come up with to do this?</p> <p>from</p> <pre><code>string myString = "This is my tweet check it out http://tinyurl.com/blah"; </code></pre> <p>to</p> <pre><code>This is my tweet check it out...
[ { "answer_id": 32648, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 6, "selected": true, "text": "Regex r = new Regex(@\"(https?://[^\\s]+)\");\nmyString = r.Replace(myString, \"<a href=\\\"$1\\\">$1</a>\");\n" }, { ...
2008/08/28
[ "https://Stackoverflow.com/questions/32637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2347826/" ]
32,640
<p>So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET".</p> <p>I've seen some examples/helpers out on the nets, but some ar...
[ { "answer_id": 32672, "author": "Haacked", "author_id": 598, "author_profile": "https://Stackoverflow.com/users/598", "pm_score": 7, "selected": true, "text": "var request = new Mock<HttpRequestBase>();\nrequest.Expect(r => r.HttpMethod).Returns(\"GET\");\nvar mockHttpContext = new Mock<...
2008/08/28
[ "https://Stackoverflow.com/questions/32640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
32,649
<p>When making changes using <code>SubmitChanges()</code>, LINQ sometimes dies with a <code>ChangeConflictException</code> exception with the error message <code>Row not found or changed</code>, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another ...
[ { "answer_id": 32705, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": 6, "selected": true, "text": "try\n{\n db.SubmitChanges(ConflictMode.ContinueOnConflict);\n}\ncatch (ChangeConflictException e)\n{\n Console.Wr...
2008/08/28
[ "https://Stackoverflow.com/questions/32649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3394/" ]
32,664
<p>Can anyone tell me if there is a way with generics to limit a generic type argument <code>T</code> to only:</p> <ul> <li><code>Int16</code></li> <li><code>Int32</code></li> <li><code>Int64</code></li> <li><code>UInt16</code></li> <li><code>UInt32</code></li> <li><code>UInt64</code></li> </ul> <p>I'm aware of the <...
[ { "answer_id": 32687, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 7, "selected": false, "text": "static bool GenericFunction<T>(T value) \n where T : operators( +, -, /, * )\n static bool GenericFunction<T>(T value) \n w...
2008/08/28
[ "https://Stackoverflow.com/questions/32664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736/" ]
32,668
<p>I don't edit CSS very often, and almost every time I need to go and google the <a href="http://www.w3.org/TR/REC-CSS2/box.html" rel="noreferrer">CSS box model</a> to check whether <code>padding</code> is inside the <code>border</code> and <code>margin</code> outside, or vice versa. (Just checked again and <code>pad...
[ { "answer_id": 32696, "author": "Ross", "author_id": 2025, "author_profile": "https://Stackoverflow.com/users/2025", "pm_score": 2, "selected": false, "text": "body body body" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3189/" ]
32,694
<p>I'm trying to use <strong>NIS</strong> for authentication on a st of machines. I had to change one of the user ID numbers for a user account on the NIS server (I changed the userid for <code>username</code> from 500 to 509 to avoid a conflict with a local user account with id 500 on the clients). The problem is that...
[ { "answer_id": 32770, "author": "Lorin Hochstein", "author_id": 742, "author_profile": "https://Stackoverflow.com/users/742", "pm_score": 1, "selected": false, "text": "\"service ypserv restart\"" }, { "answer_id": 12900738, "author": "Bradley Kreider", "author_id": 26890...
2008/08/28
[ "https://Stackoverflow.com/questions/32694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/742/" ]
32,709
<p>Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing <code>Func&lt;T, bool&gt;</code> vs. <code>Predicate&lt;T&gt;</code> </p> <p>I would imagine there is no difference as both take a generic parameter and return bool?</p>
[ { "answer_id": 36872, "author": "ljs", "author_id": 3394, "author_profile": "https://Stackoverflow.com/users/3394", "pm_score": 4, "selected": false, "text": "class A {\n static void Main() {\n Func<int, bool> func = i => i > 100;\n Predicate<int> pred = i => i > 100;\n\n Test<...
2008/08/28
[ "https://Stackoverflow.com/questions/32709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2993/" ]
32,715
<p>When using the app_offline.htm feature of ASP.NET, it only allows html, but no images. Is there a way to get images to display <strong>without having to point them to a different url on another site</strong>?</p>
[ { "answer_id": 32866, "author": "Ryan Sampson", "author_id": 1375, "author_profile": "https://Stackoverflow.com/users/1375", "pm_score": 2, "selected": false, "text": " public void Application_Start(object sender, EventArgs e)\n {\n Application[\"OfflineMessage\"] = \"This website is...
2008/08/28
[ "https://Stackoverflow.com/questions/32715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/820/" ]
32,717
<p>I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited property sheets allowed me to change all the...
[ { "answer_id": 188237, "author": "akmad", "author_id": 1314, "author_profile": "https://Stackoverflow.com/users/1314", "pm_score": 3, "selected": true, "text": "Target Property ItemGroup <Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n <PropertyGroup>\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/32717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3114/" ]
32,744
<p>For the past few weeks, I've been trying to learn about just how email works. I understand the process of a client receiving mail from a server using POP pretty well. I also understand how a client computer can use SMTP to ask an SMTP server to send a message. However, I'm still missing something...</p> <p>The w...
[ { "answer_id": 32776, "author": "dr-jan", "author_id": 2599, "author_profile": "https://Stackoverflow.com/users/2599", "pm_score": 5, "selected": true, "text": "nslookup\n> set type=mx\n> stackoverflow.com\nServer: 158.155.25.16\nAddress: 158.155.25.16#53\n\nNon-authoritat...
2008/08/28
[ "https://Stackoverflow.com/questions/32744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
32,747
<p>How do I get today's date in C# in mm/dd/yyyy format?</p> <p>I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time.</p> <p>BTW: I'm in the US so M/dd would be correct, e.g. September 11th is 9/11.</p> <p><...
[ { "answer_id": 32749, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 9, "selected": true, "text": "DateTime.Now.ToString(\"M/d/yyyy\");\n" }, { "answer_id": 32751, "author": "Corin Blaikie", "author_id":...
2008/08/28
[ "https://Stackoverflow.com/questions/32747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
32,750
<p>I have a <code>byte[]</code> array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the <code>BinaryWriter</code> object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulat...
[ { "answer_id": 32841, "author": "Tim", "author_id": 1970, "author_profile": "https://Stackoverflow.com/users/1970", "pm_score": 3, "selected": true, "text": "MemoryStream ms = new MemoryStream(byteArrayIn);\n ms.Write(byteArrayIn, 0, byteArrayIn.Length);\n" }, { "answer_id": 3310...
2008/08/28
[ "https://Stackoverflow.com/questions/32750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
32,777
<p>I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Windows, but I'm not sure how well that's ...
[ { "answer_id": 99843, "author": "bk1e", "author_id": 8090, "author_profile": "https://Stackoverflow.com/users/8090", "pm_score": 2, "selected": false, "text": "fork()" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
32,790
<p>For various reasons calling <code>System.exit</code> is frowned upon when writing <strong>Java Applications</strong>, so how can I notify the calling process that not everything is going according to plan?</p> <p><strong>Edit:</strong> The 1 is a <code>standin</code> for any non-zero exit code.</p>
[ { "answer_id": 32817, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 1, "selected": false, "text": "Exception at thread 'main': FileNotFoundException \"The file 'foo' doesn't exist\"\n" }, { "answer_id": 33007, "au...
2008/08/28
[ "https://Stackoverflow.com/questions/32790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
32,803
<p>This question comes on the heels of the question asked <a href="https://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marke">here</a>.</p> <p>The email that comes from our web server comes from an IP address that is different than that for the Exchange ser...
[ { "answer_id": 32817, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 1, "selected": false, "text": "Exception at thread 'main': FileNotFoundException \"The file 'foo' doesn't exist\"\n" }, { "answer_id": 33007, "au...
2008/08/28
[ "https://Stackoverflow.com/questions/32803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2535/" ]
32,814
<p>I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a ASP.NET Validator inside of an update panel does not work. Is there a trick to make these work, or do I need to use the ValidatorCallOut control that comes with the AJAX toolkit?</p>
[ { "answer_id": 107824, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": -1, "selected": false, "text": "Page_ClientValidate(\"validationGroupName\");\n" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
32,824
<p>While writing a custom IHttpHandler I came across a behavior that I didn't expect concerning the HttpCachePolicy object.</p> <p>My handler calculates and sets an entity-tag (using the SetETag method on the HttpCachePolicy associated with the current response object). If I set the cache-control to public using the S...
[ { "answer_id": 33555, "author": "Duncan Smart", "author_id": 1278, "author_profile": "https://Stackoverflow.com/users/1278", "pm_score": 2, "selected": false, "text": "System.Web.HttpCachePolicy.UpdateCachedHeaders() Last-Modified/If-Modified-Since" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2114/" ]
32,871
<p>I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very much like <a href="http://www.nike.com/nikeskateboarding/v3/" rel="noreferrer">...
[ { "answer_id": 34523, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 3, "selected": false, "text": "function resizeFlash( h ) {\n // \"flash-node-id\" is the ID of the embedded Flash movie\n document.getElementById(\"flash...
2008/08/28
[ "https://Stackoverflow.com/questions/32871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3435/" ]
32,877
<p>I've got a problem where incoming SOAP messages from one particular client are being marked as invalid and rejected by our XML firewall device. It appears extra payload data is being inserted by Visual Studio; we're thinking the extra data may be causing a problem b/c we're seeing "VsDebuggerCausalityData" in these ...
[ { "answer_id": 33312, "author": "Darryl Braaten", "author_id": 1834, "author_profile": "https://Stackoverflow.com/users/1834", "pm_score": 5, "selected": true, "text": "<configuration>\n <system.diagnostics>\n <switches>\n <add name=\"Remote.Disable\" value=\"1\" />\n </swit...
2008/08/28
[ "https://Stackoverflow.com/questions/32877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683/" ]
32,897
<p>This question would probably apply equally as well to other languages with C-like multi-line comments. Here's the problem I'm encountering. I'm working with Java code in Eclipse, and I wanted to comment out a block of code. However, there is a string that contains the character sequence "*/", and Eclipse thinks that...
[ { "answer_id": 32927, "author": "joev", "author_id": 3449, "author_profile": "https://Stackoverflow.com/users/3449", "pm_score": 0, "selected": false, "text": "public class Test {\n public static final void main(String[] args) throws Exception {\n String s = \"This is the original st...
2008/08/28
[ "https://Stackoverflow.com/questions/32897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
32,899
<p>I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this:</p> <pre><code>import unittest l = [[&quot;foo&quot;, &quot;a&quot;, &quot;a&quot;,], [&quot;bar&quot;, &quot;a&quot;, &quot;b&quot;], [&quot;lee&quot;, &quot;b&quot;, &quot;b&quot;]] class TestSequenc...
[ { "answer_id": 32939, "author": "Dmitry Mukhin", "author_id": 3448, "author_profile": "https://Stackoverflow.com/users/3448", "pm_score": 9, "selected": true, "text": "from parameterized import parameterized\n\nclass TestSequence(unittest.TestCase):\n @parameterized.expand([\n ...
2008/08/28
[ "https://Stackoverflow.com/questions/32899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/720/" ]
32,937
<p>In C# is there a shorthand way to write this:</p> <pre><code>public static bool IsAllowed(int userID) { return (userID == Personnel.JohnDoe || userID == Personnel.JaneDoe ...); } </code></pre> <p>Like:</p> <pre><code>public static bool IsAllowed(int userID) { return (userID in Personnel.JohnDoe, Personnel...
[ { "answer_id": 32942, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 2, "selected": false, "text": "List<int> allowedIDs = ...;\n\npublic bool IsAllowed(int userID)\n{\n return allowedIDs.Contains(userID);\n}\n IEnumer...
2008/08/28
[ "https://Stackoverflow.com/questions/32937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1302/" ]
32,986
<p>I know that if you have a loop that modifies the count of the items in the loop, using the NSEnumerator on a set is the best way to make sure your code blows up, however I would like to understand the performance tradeoffs between the NSEnumerator class and just an old school for loop</p>
[ { "answer_id": 33035, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "NSFastEnumeration objectAtIndex:i objectAtIndex:i method for ( Type newVariable in expression ) { \n stmts \n}\n" }, { ...
2008/08/28
[ "https://Stackoverflow.com/questions/32986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3484/" ]
32,991
<p>The leaving your wireless network open question reminded me of this.</p> <p>I typically share the root drive on my machines across my network, and tie login authorization to the machines NT ID, so there is at least some form of protection.</p> <p>My question, how easy is it to gain access to these drives for ill g...
[ { "answer_id": 32997, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 0, "selected": false, "text": "\\\\yourmachine\\c$\n" } ]
2008/08/28
[ "https://Stackoverflow.com/questions/32991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
33,048
<p>Suppose you have an ActiveRecord::Observer in one of your Ruby on Rails applications - how do you test this observer with rSpec?</p>
[ { "answer_id": 33869, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 4, "selected": false, "text": "should_receive class Person < ActiveRecord::Base\n def set_status( new_status )\n # do whatever\n end\nend\n\nclass ...
2008/08/28
[ "https://Stackoverflow.com/questions/33048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2569/" ]
33,055
<p>I'm new to SVN and I'd like to know what methods are available for backing up repositories in a Windows environment?</p>
[ { "answer_id": 33064, "author": "Nicolai Reuschling", "author_id": 2569, "author_profile": "https://Stackoverflow.com/users/2569", "pm_score": 8, "selected": true, "text": "svnadmin dump repositorypath | gzip > backupname.svn.gz\n svnadmin dump repositorypath > backupname.svn\n" }, {...
2008/08/28
[ "https://Stackoverflow.com/questions/33055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3396/" ]
33,063
<p>I have a big string (let's call it a CSV file, though it isn't actually one, it'll just be easier for now) that I have to parse in C# code.<br> The first step of the parsing process splits the file into individual lines by just using a <code>StreamReader</code> object and calling <code>ReadLine</code> until it's thr...
[ { "answer_id": 33074, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 0, "selected": false, "text": "content = Regex.Replace(content, \"'([^']*)\\n([^']*)'\", \"'\\1TOKEN\\2'\");\n" }, { "answer_id": 33172, "author...
2008/08/28
[ "https://Stackoverflow.com/questions/33063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2187/" ]
33,073
<p>How do I make <code>diff</code> ignore temporary files like <code>foo.c~</code>? Is there a configuration file that will make ignoring temporaries the default?</p> <p>More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project by ema...
[ { "answer_id": 33098, "author": "Fernando Barrocal", "author_id": 2274, "author_profile": "https://Stackoverflow.com/users/2274", "pm_score": 0, "selected": false, "text": "#!/bin/bash\nolddir=\"/tmp/old\"\nnewdir=\"/tmp/new\"\n\npushd $newdir\nfor files in $(find . -name \\*.c)\ndo\n d...
2008/08/28
[ "https://Stackoverflow.com/questions/33073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
33,080
<p>In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window.</p> <p>I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser screen. I have a max height f...
[ { "answer_id": 33096, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 3, "selected": false, "text": "div {\n position: absolute;\n top: 300px;\n bottom: 0px;\n left: 30px;\n right: 30px;\n}\n overflow:auto;" }, ...
2008/08/28
[ "https://Stackoverflow.com/questions/33080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1226/" ]
33,089
<p>I'm using the <a href="http://msdn.microsoft.com/en-us/library/ms178329.aspx" rel="nofollow noreferrer">ASP.NET Login Controls</a> and <a href="http://msdn.microsoft.com/en-us/library/aa480476.aspx" rel="nofollow noreferrer">Forms Authentication</a> for membership/credentials for an ASP.NET web application. It keep...
[ { "answer_id": 33092, "author": "Zack Peterson", "author_id": 83, "author_profile": "https://Stackoverflow.com/users/83", "pm_score": 1, "selected": false, "text": "<?xml version=\"1.0\"?>\n<configuration>\n <system.web>\n ...\n <!--\n The <authentication> sec...
2008/08/28
[ "https://Stackoverflow.com/questions/33089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
33,103
<p>I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item?</p>
[ { "answer_id": 33130, "author": "bdukes", "author_id": 2688, "author_profile": "https://Stackoverflow.com/users/2688", "pm_score": 4, "selected": true, "text": "onpaste return false e.preventDefault() onpaste $(document).on(\"paste\",function(e){\n console.log(\"paste\")\n e.preventDef...
2008/08/28
[ "https://Stackoverflow.com/questions/33103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1450/" ]
33,115
<p>Does C# have the notion of private / protected inheritance, and if not, why?</p> <p><strong>C++</strong></p> <pre> <code> class Foo : private Bar { public: ... }; </code> </pre> <p><strong>C#</strong></p> <pre> <code> public abstract NServlet class : private System.Web.UI.Page { // error "type expected...
[ { "answer_id": 33182, "author": "Chris Karcher", "author_id": 2773, "author_profile": "https://Stackoverflow.com/users/2773", "pm_score": 2, "selected": false, "text": "class Base\n{\n public void F() {}\n}\nclass Derived : Base\n{\n new private void F() {}\n}\n\nBase o = new Derived...
2008/08/28
[ "https://Stackoverflow.com/questions/33115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
33,150
<p>I am working on a Customer Server Control that extends another control. There is no problem with attaching to other controls on the form.</p> <p>in vb.net: <code>Parent.FindControl(TargetControlName)</code></p> <p>I would like to pass a method to the control in the ASPX markup. </p> <p>for example: <code>&lt;c:...
[ { "answer_id": 33179, "author": "Jesse Dearing", "author_id": 1804, "author_profile": "https://Stackoverflow.com/users/1804", "pm_score": 3, "selected": true, "text": "Browsable <Browsable(True)> Public Event InitializeStuffCallback\n [Browsable(true)]\npublic event EventHandler Initiali...
2008/08/28
[ "https://Stackoverflow.com/questions/33150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2017/" ]