qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
231,893
<p>I have seen this syntax in MSDN: <a href="https://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx" rel="noreferrer"><code>yield break</code></a>, but I don't know what it does. Does anyone know?</p>
[ { "answer_id": 231915, "author": "Trap", "author_id": 7839, "author_profile": "https://Stackoverflow.com/users/7839", "pm_score": 5, "selected": false, "text": "public interface INode\n{\n IEnumerable<Node> GetChildren();\n}\n\npublic class NodeWithTenChildren : INode\n{\n private ...
2008/10/23
[ "https://Stackoverflow.com/questions/231893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
231,912
<p>I was about to add an extra signal handler to an app we have here and I noticed that the author had used <code>sigaction()</code> to set up the other signal handlers. I was going to use <code>signal()</code>. To follow convention I should use <code>sigaction()</code> but if I was writing from scratch, which should I choose?</p>
[ { "answer_id": 231933, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 2, "selected": false, "text": "signal(3)" }, { "answer_id": 232711, "author": "Jonathan Leffler", "author_id": 15168...
2008/10/23
[ "https://Stackoverflow.com/questions/231912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20889/" ]
231,917
<p>This originally was a problem I ran into at work, but is now something I'm just trying to solve for my own curiosity.</p> <p>I want to find out if int 'a' contains the int 'b' in the most efficient way possible. I wrote some code, but it seems no matter what I write, parsing it into a string and then using indexOf is twice as fast as doing it mathematically.</p> <p>Memory is not an issue (within reason), just sheer processing speed.</p> <p>This is the code I have written to do it mathematically:</p> <pre><code>private static int[] exponents = {10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; private static boolean findMatch(int a, int b) { if (b &gt; a) return false; if (a == b) return true; int needleLength = getLength(b); int exponent = exponents[needleLength]; int subNum; while (a &gt;= 1) { subNum = a % exponent; if (subNum == b) return true; a /= 10; } return false; } private static int getLength(int b) { int len = 0; while (b &gt;= 1) { len++; b /= 10; } return len; } </code></pre> <p>Here's the string method I'm using, which seems to trump the mathematical method above:</p> <pre><code>private static boolean findStringMatch(int a, int b) { return String.valueOf(a).indexOf(String.valueOf(b)) != -1; } </code></pre> <p>So although this isn't really required for me to complete my work, I was just wondering if anyone could think of any way to further optimize my way of doing it mathematically, or an entirely new approach altogether. Again memory is no problem, I am just shooting for sheer speed.</p> <p>I'm really interested to see or hear anything anyone has to offer on this.</p> <p><strong>EDIT:</strong> When I say contains I mean can be anywhere, so for example, findMatch(1234, 23) == true</p> <p><strong>EDIT:</strong> For everyone saying that this crap is unreadable and unnecessary: you're missing the point. The point was to get to geek out on an interesting problem, not come up with an answer to be used in production code.</p>
[ { "answer_id": 231936, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 0, "selected": false, "text": "// Check if A is inside B lol\nbool Contains (int a, int b)\n{\n return (a <= b);\n}\n" }, { "answer_id": 231950,...
2008/10/23
[ "https://Stackoverflow.com/questions/231917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14007/" ]
231,937
<p>I am trying to show and hide an inline element (eg a span) using jQuery.</p> <p>If I just use toggle(), it works as expected but if I use toggle("slow") to give it an animation, it turns the span into a block element and therefore inserts breaks.</p> <p>Is animation possible with inline elements? I would prefer a smooth sliding if possible, rather than a fade in.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $('.toggle').click(function() { $('.hide').toggle("slow") }); }); &lt;/script&gt; &lt;p&gt;Hello &lt;span class="hide"&gt;there&lt;/span&gt; jquery&lt;/p&gt; &lt;button class="toggle"&gt;Toggle&lt;/button&gt; </code></pre>
[ { "answer_id": 232005, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 1, "selected": false, "text": "$('.toggle').click(function() {\n $('.hide:visible').animate(\n {opacity : 0},\n function() { $(this).hide();...
2008/10/23
[ "https://Stackoverflow.com/questions/231937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31012/" ]
231,947
<p>I have a project that is based on the Navigation Based Application template. In the AppDelegate are the methods <code>-applicationDidFinishLoading:</code> and <code>-applicationWillTerminate:</code>. In those methods, I am loading and saving the application data, and storing it in an instance variable (it is actually an object-graph).</p> <p>When the application loads, it loads MainWindow.xib, which has a NavigationConroller, which in turn has a RootViewController. The RootViewController <code>nibName</code> property points to RootView (my actual controller class).</p> <p>In my class, I wish to refer to the object that I created in the <code>-applicationDidFinishLoading:</code> method, so that I can get a reference to it.</p> <p>Can anyone tell me how to do that? I know how to reference between objects that I have created programmatically, but I can't seem to figure out to thread my way back, given that the middle step was done from within the NIB file.</p>
[ { "answer_id": 232016, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 4, "selected": false, "text": "UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window];\n//do something with mainWindow\n" },...
2008/10/23
[ "https://Stackoverflow.com/questions/231947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,004
<p>For the moment the best way that I have found to be able to manipulate DOM from a string that contain HTML is:</p> <pre><code>WebBrowser webControl = new WebBrowser(); webControl.DocumentText = html; HtmlDocument doc = webControl.Document; </code></pre> <p>There are two problems:</p> <ol> <li>Requires the <code>WebBrowser</code> object! </li> <li>This can't be used with multiple threads; I need something that would work on different thread (other than the main thread).</li> </ol> <p>Any ideas?</p>
[ { "answer_id": 232021, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 3, "selected": false, "text": "XmlDocument" }, { "answer_id": 242704, "author": "Martin Kool", "author_id": 216896, "author_profi...
2008/10/23
[ "https://Stackoverflow.com/questions/232004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
232,008
<p>I've been exploring the details of Django for about a week now and like what I see. However I've come upon some.. negativity in relation to fine-grained control of permissions to the CRUD interface.</p> <p>What I'm writing is an Intranet client management web-app. The organisation is about 6 tiers, and I need to restrict access to client groups based on tiers. Continually expanding. I have a fairly good idea how I'm going to do this, but am not sure if I'll be able to integrate it well into the pre-built admin interface. </p> <p>I've done absolutely zero Django development otherwise I'd probably have a better idea on whether this would work or not. I probably won't use Django if the generated admin interface is going to be useless to this project - but like I said, there is a heavy reliance on fine-grained custom permissions.</p> <p>Will Django let me build custom permissions/rules and integrate it seamlessly into the admin CRUD interface?</p> <p>Update One: I want to use the admin app to minimise the repitition of generating CRUD interfaces, so yes I consider it a must have.</p> <p>Update Two:</p> <p>I want to describe the permissions required for this project.</p> <p>A client can belong to one or many 'stores'. Full time employees should only be able to edit clients at their store (even if they belong to another store). However, they should not be able to see/edit clients at another store. Casuals should only be able to view clients based on what store they are rostered too (or if the casual is logged in as the store user - more likely).</p> <p>Management above them need to be able to see all employees for the stores they manage, nothing more.</p> <p>Senior management should be able to edit ALL employees and grant permissions below themselves.</p> <p>After reading the django documentation, it says you can't (autmoatically) set permissions for a sub-set of a group. Only the entire group. Is it easy enough to mock up your own permissions for this purpose?</p>
[ { "answer_id": 232051, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 2, "selected": false, "text": "has_add_permission" } ]
2008/10/23
[ "https://Stackoverflow.com/questions/232008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10583/" ]
232,020
<p>I am working on a project that I need to use the Infragistics WebGrid control for some lists of data. I am loading the data on the client-side using JavaScript for display on a Map, and then I need to display that same data within multiple WebGrids. All the data available will be displayed in the WebGrids, but only a subset of the data (only that which is currently within view) will be plotted on the Map at any given time. Since I am loading the data using JavaScript/Ajax, I would like to only load it once, and use the same mechanism to populate the WebGrid control with data too.</p> <p>Does anyone have any tips/pointers on working with the WebGrid completely from within client-side JavaScript/Ajax code?</p>
[ { "answer_id": 444340, "author": "Tj Kellie", "author_id": 54055, "author_profile": "https://Stackoverflow.com/users/54055", "pm_score": 2, "selected": false, "text": "var grid = igtbl_getGridById('dataGridControlID');\n" } ]
2008/10/23
[ "https://Stackoverflow.com/questions/232020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7831/" ]
232,030
<p>I want a pure virtual parent class to call a child implementation of a function like so:</p> <pre><code>class parent { public: void Read() { //read stuff } virtual void Process() = 0; parent() { Read(); Process(); } } class child : public parent { public: virtual void Process() { //process stuff } child() : parent() { } } int main() { child c; } </code></pre> <p>This should work, but I get an unlinked error :/ This is using VC++ 2k3</p> <p>Or shouldn't it work, am I wrong?</p>
[ { "answer_id": 232042, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 2, "selected": false, "text": "class parent\n{\n public:\n void Read() { //read stuff }\n virtual void Process() { }\n parent() \n {\n ...
2008/10/23
[ "https://Stackoverflow.com/questions/232030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23829/" ]
232,052
<p>I have an MSBuild task to build a specific project in a solution file. It looks something like this:</p> <pre><code>&lt;Target Name="Baz"&gt; &lt;MSBuild Projects="Foo.sln" Targets="bar:$(BuildCmd)" /&gt; &lt;/Target&gt; </code></pre> <p>From the command line, I can set my <code>BuildCmd</code> to either <code>Rebuild</code> or <code>Clean</code> and it works as expected:</p> <blockquote> <p>msbuild /target:Baz /property:BuildCmd=Rebuild MyMsbuildFile.xml msbuild /target:Baz /property:BuildCmd=Clean MyMsbuildFile.xml</p> </blockquote> <p>But what word do I use to set <code>BuildCmd</code> to in order to just build? I've tried <code>Build</code> and <code>Compile</code> and just leaving it blank or undefined, but I always get an error.</p> <blockquote> <p>msbuild /target:Baz /property:BuildCmd=Build MyMsbuildFile.xml Foo.sln : error MSB4057: The target "bar:Build" does not exist in the project.</p> <p>msbuild /target:Baz /property:BuildCmd=Compile MyMsbuildFile.xml Foo.sln : error MSB4057: The target "bar:Compile" does not exist in the project.</p> <p>msbuild /target:Baz MyMsbuildFile.xml Foo.sln : error MSB4057: The target "bar:" does not exist in the project.</p> </blockquote>
[ { "answer_id": 233738, "author": "CheGueVerra", "author_id": 17787, "author_profile": "https://Stackoverflow.com/users/17787", "pm_score": 6, "selected": true, "text": "<PropertyGroup>\n <BuildCmd Condition=\" '$(BuildCmd)' == ''\">Build</BuildCmd>\n</PropertyGroup>\n" }, { "ans...
2008/10/24
[ "https://Stackoverflow.com/questions/232052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,053
<p>I'm writing javascript code that is read in as a string and executed via eval() by a firefox extension. Firebug does "see" my script so I am not able to use breakpoints, see objects, etc. </p> <p>I am currently using Firefox's error console which I'm starting to find limiting. What are my other options? Ideally, I would be able to use Firebug or something similar to it. How do people generally debug Greasemonkey scripts?</p> <p>I've tried using Lint and other validators, but my script uses a lot of objects and functions provided by the extension environment, making of a lot of the errors reported irrelevant. Also, the output tends to be too nitpicky (focusing of spacing issues, etc). </p>
[ { "answer_id": 232206, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 1, "selected": false, "text": "eval()" }, { "answer_id": 3483247, "author": "knoopx", "author_id": 62368, "author_profile"...
2008/10/24
[ "https://Stackoverflow.com/questions/232053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1227001/" ]
232,075
<p>In C and C++ a variable can be marked as <a href="http://en.wikipedia.org/wiki/Volatile_variable" rel="noreferrer"><strong>volatile</strong></a>, which means the compiler will not optimize it because it may be modified external to the declaring object. Is there an equivalent in Delphi programming? If not a keyword, maybe a work around?</p> <p>My thought was to use <strong>Absolute</strong>, but I wasn't sure, and that may introduce other side effects.</p>
[ { "answer_id": 232675, "author": "Thomas Mueller", "author_id": 21506, "author_profile": "https://Stackoverflow.com/users/21506", "pm_score": 0, "selected": false, "text": "var\n MyVarPtr: ^integer;\nbegin\n New(MyVarPtr);\n MyVarPtr^ := 5;\n...\n" }, { "answer_id": 37145389, ...
2008/10/24
[ "https://Stackoverflow.com/questions/232075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/255/" ]
232,078
<p>I have three projects. One is a WCF Services Project, one is a WPF Project, and one is a Microsoft Unit Testing Project. I setup the WCF Services project with a data object that looks like this:</p> <pre><code>[DataContract] public enum Priority { Low, Medium, High } [DataContract] public struct TimeInfo { [DataMember] public Int16 EstimatedHours { get; set; } [DataMember] public Int16 ActualHours { get; set; } [DataMember] public DateTime StartDate { get; set; } [DataMember] public DateTime EndDate { get; set; } [DataMember] public DateTime CompletionDate { get; set; } } [DataContract] public class Task { [DataMember] public string Title { get; set; } [DataMember] public string Description { get; set; } [DataMember] public Priority Priority { get; set; } [DataMember] public TimeInfo TimeInformation { get; set; } [DataMember] public Decimal Cost { get; set; } } </code></pre> <p>My contract looks like this:</p> <pre><code>[ServiceContract] public interface ITaskManagement { [OperationContract] List&lt;Task&gt; GetTasks(); [OperationContract] void CreateTask(Task taskToCreate); [OperationContract] void UpdateTask(Task taskToCreate); [OperationContract] void DeleteTask(Task taskToDelete); } </code></pre> <p>When I try to use the service in either the WPF Application or the Unit Test Project with this code:</p> <pre><code>var client = new TaskManagementClient(); textBox1.Text = client.GetTasks().ToString(); client.Close(); </code></pre> <p>I get the following error: "The underlying connection was closed: The connection was closed unexpectedly."</p> <p>The app.config for the WPF and Unit Test Projects look like this:</p> <pre><code>&lt;system.serviceModel&gt; &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="WSHttpBinding_ITaskManagement" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"&gt; &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt; &lt;reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /&gt; &lt;security mode="Message"&gt; &lt;transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /&gt; &lt;message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true" /&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;client&gt; &lt;endpoint address="http://localhost:9999/TaskManagement.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ITaskManagement" contract="TaskManagement.ITaskManagement" name="WSHttpBinding_ITaskManagement"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;/client&gt; &lt;/system.serviceModel&gt; </code></pre> <p>and the web.config of the WCF Service looks like this:</p> <pre><code> &lt;system.serviceModel&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="InternetBasedWcfServices.TaskManagementBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt; &lt;/behavior&gt; &lt;behavior name="InternetBasedWcfServices.ScheduleManagementBehavior"&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;services&gt; &lt;service behaviorConfiguration="InternetBasedWcfServices.TaskManagementBehavior" name="InternetBasedWcfServices.TaskManagement"&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="InternetBasedWcfServices.ITaskManagement"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;service behaviorConfiguration="InternetBasedWcfServices.ScheduleManagementBehavior" name="InternetBasedWcfServices.ScheduleManagement"&gt; &lt;endpoint address="" binding="wsHttpBinding" contract="InternetBasedWcfServices.IScheduleManagement"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;/system.serviceModel&gt; </code></pre> <p>This is not the first time this has happened, and I'm guessing it is a configuration issue. But each time I've usually just blown away my service and put it back or created a new service project. Then everything works wonderfully. If anyone has any ideas, that would be awesome. Thx.</p> <p>**</p> <blockquote> <p>Updated: I've added comments for more of my troubleshooting on this problem. When an answer is available, if the answer is unpublished, I'll add it as an official "answer".</p> </blockquote> <p>**</p>
[ { "answer_id": 234584, "author": "Adron", "author_id": 29345, "author_profile": "https://Stackoverflow.com/users/29345", "pm_score": 5, "selected": true, "text": "[DataContract]\npublic enum Priority\n{\n [EnumMember]\n Low,\n [EnumMember]\n Medium,\n [EnumMember]\n Hig...
2008/10/24
[ "https://Stackoverflow.com/questions/232078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29345/" ]
232,083
<p>Is there a way to know which file is being selected in windows explorer? I've been looking at the tutorial posted here <a href="https://stackoverflow.com/questions/140312/tutorial-for-windows-shell-extensions">Idiots guide to ...</a> but the actions described are:</p> <p>hover</p> <p>context </p> <p>menu properties </p> <p>drag</p> <p>drag and drop</p> <p>I wonder if is there a method that get invoked when a file is selected. For instance to create a thumbnail view of the file. </p> <p>Thanks.</p>
[ { "answer_id": 234584, "author": "Adron", "author_id": 29345, "author_profile": "https://Stackoverflow.com/users/29345", "pm_score": 5, "selected": true, "text": "[DataContract]\npublic enum Priority\n{\n [EnumMember]\n Low,\n [EnumMember]\n Medium,\n [EnumMember]\n Hig...
2008/10/24
[ "https://Stackoverflow.com/questions/232083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
232,140
<p>My <sub>crappy</sub> web host did some upgrades the other day and some settings have gone awry, because looking at our company's wiki (MediaWiki), every quote is being escaped with a backslashes. It's not even just data which is being posted (i.e.: the articles) which are affected, but also the standard MediaWiki text. For example,</p> <blockquote> <p>You\'ve followed a link to a page that doesn\'t exist yet. To create the page, start typing in the box below (see the help page for more info). If you are here by mistake, just click your browser\'s \'\'\'back\'\'\' button.</p> </blockquote> <p>The first thing I did was disable <code>magic_quotes_gpc</code> AND <code>magic_quotes_runtime</code> using a <code>.htaccess</code> file, but this is still occurring. My <code>php_info()</code> reports this:</p> <pre><code>Setting Local Value Master Value magic_quotes_gpc Off On magic_quotes_runtime Off On magic_quotes_sybase Off Off </code></pre> <p>Any ideas?</p>
[ { "answer_id": 232242, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 1, "selected": false, "text": "magic_quotes_gpc()" }, { "answer_id": 232789, "author": "troelskn", "author_id": 18180, "author_profile": "...
2008/10/24
[ "https://Stackoverflow.com/questions/232140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
232,141
<p>I’m listening to the Hanselminutes Podcast; "StackOverflow uses ASP.NET MVC - Jeff Atwood and his technical team". During the course of the Podcast they are speaking about SQL server and say something along the lines of 'The days of the Stored Procedure are over'. </p> <p>Now I'm not a DBA but this has taken me a bit by surprise. I always assumed that SPs were the way to go for speed (as they are complied) and security not to mention scalability and maintainability. If this is not the case and SPs are on their last legs, what will replace them or what should we be doing in the future?</p>
[ { "answer_id": 232210, "author": "mjallday", "author_id": 6084, "author_profile": "https://Stackoverflow.com/users/6084", "pm_score": 1, "selected": false, "text": "select a from b where x = y\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26300/" ]
232,144
<p>I have a volunteers_2009 table that lists all the volunteers and a venues table that lists the venues that a volunteer can be assigned to, they are only assigned to one.</p> <p>What I want to do, is print out the number of volunteers assigned to each venue.</p> <p>I want it to print out like this:</p> <p>Name of Venue: # of volunteers</p> <p>table: volunteers_2009 columns: id, name, <code>venue_id</code></p> <p>table: venues columns: id, venue_name</p> <p>They relate by <code>volunteers_2009.venue_id = venues.id</code></p> <p>This is what I have but it is not working properly.</p> <pre><code>$sql = "SELECT venues.venue_name as 'Venue', COUNT(volunteers_2009.id) as 'Number Of Volunteers' FROM venues ven JOIN volunteers_2009 vol ON (venues.id=volunteers_2009.venue_id) GROUP BY venues.venue_name ORDER BY venues.venue_name ASC"; $result = mysql_query($sql); while(list($name,$vols) = mysql_fetch_array($result)) { print '&lt;p&gt;'.$name.': '.$vols.'&lt;/p&gt;'; } </code></pre>
[ { "answer_id": 232159, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "$sql = \"SELECT ven.venue_name as 'Venue', COUNT(vol.id) as 'Number Of \nVolunteers' FROM venues ven JOIN volunteers_200...
2008/10/24
[ "https://Stackoverflow.com/questions/232144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
232,161
<p>I'm currently developing an application that is comprised of five separate executables that communicate via ActiveMQ. I have a Visual Studio Solution that contains the five executable projects. One of the projects (the launcher.exe) launches the other four projects from their local folders as separate processes. As such, the launcher project is set as the "Startup Project" and, as a result, it's the only one I can set break points in and debug due to my limited knowledge of VS2005.</p> <p>Is there a way to set multiple breakpoints across my five c++ projects in my single VS solution and debug them at the same time if the launcher project is the only project executed from VS? </p> <p><strong><em>Note:</em></strong> <em>Manually starting new instances of each project via Visual Studio is not an option since their execution needs to be synchronized by the launcher.exe.</em></p> <p>I apologize if this is convoluted, it's the best I can explain it. Thanks in advance for your help! </p>
[ { "answer_id": 232176, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 4, "selected": true, "text": "while( !IsDebuggerPresent() )\n Sleep( 500 );\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
232,162
<p>I have a bunch of C files that are generated by a collection of python programs that have a number of shared python modules and I need to account for this in my make system.</p> <p>It is easy enough to enumerate which python program need to be run to generate each C file. What I can't find a good solution for is determining which other python files those programs depend on. I need this so make will know what needs regenerating if one of the shared python files changes.</p> <p>Is there a good system for producing make style dependency rules from a collection of python sources?</p>
[ { "answer_id": 232233, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 1, "selected": false, "text": "import" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10471/" ]
232,168
<p>I'm trying to get a file with ant, using the get property. I'm running apache 2, and I can get the file from the indicated URL using wget and firefox, but ant gives me the following error:</p> <pre><code>[get] Error opening connection java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost/jars/jai_core.jar </code></pre> <p>This is what I'm doing in my build.xml:</p> <pre><code>&lt;get src="http://localhost/jars/jai_core.jar" dest="${build.dir}/lib/jai_core.jar" usetimestamp="true"/&gt; </code></pre> <p>Any idea what could be going wrong?</p> <p><strong>EDIT:</strong> On to something. When I provide the full host name of my box instead of localhost, it works.</p>
[ { "answer_id": 232220, "author": "Ken Gentle", "author_id": 8709, "author_profile": "https://Stackoverflow.com/users/8709", "pm_score": 3, "selected": true, "text": "src" }, { "answer_id": 232299, "author": "mhawke", "author_id": 21945, "author_profile": "https://Stac...
2008/10/24
[ "https://Stackoverflow.com/questions/232168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3434/" ]
232,171
<p>I have an IQueryable and an object of type T.</p> <p>I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))</p> <p>so ...</p> <pre><code>public IQueryable&lt;T&gt; DoWork&lt;T&gt;(string fieldName) where T : EntityObject { ... T objectOfTypeT = ...; .... return SomeIQueryable&lt;T&gt;().Where(o =&gt; o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName)); } </code></pre> <p>Fyi, GetProperty isn't a valid function. I need something which performs this function.</p> <p>Am I having a Friday afternoon brain melt or is this a complex thing to do?</p> <hr> <p>objectOfTypeT I can do the following ...</p> <pre><code>var matchToValue = Expression.Lambda(ParameterExpression .Property(ParameterExpression.Constant(item), "CustomerKey")) .Compile().DynamicInvoke(); </code></pre> <p>Which works perfectly,now I just need the second part:</p> <p>return SomeIQueryable().Where(o => <strong>o.GetProperty(fieldName)</strong> == matchValue);</p>
[ { "answer_id": 232304, "author": "JTew", "author_id": 25372, "author_profile": "https://Stackoverflow.com/users/25372", "pm_score": 0, "selected": false, "text": "IQueryable<T>().Where(t => \nMemberExpression.Property(MemberExpression.Constant(t), fieldName) == \nParameterExpression.Prop...
2008/10/24
[ "https://Stackoverflow.com/questions/232171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25372/" ]
232,202
<p>I was planning to implememt owner-drawn of CListCtrl. I thought that drawing an item is after the item is inserted into the control. So my method is declare a class which is derived from CListCtrl and override its DrawItem() method. The problem is DrawItem is never invoked after inserting an item. Is there anything wrong with my method?</p> <p>Thank you!</p>
[ { "answer_id": 232209, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 0, "selected": false, "text": "m_myListbox.ModifyStyle(0, LBS_OWNERDRAWFIXED, 0);\n" }, { "answer_id": 232428, "author": "Adam Pierce", ...
2008/10/24
[ "https://Stackoverflow.com/questions/232202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26404/" ]
232,212
<p>I would guess most people on this site are familiar with tail, if not - it provides a "follow" mode that as text is appended to the file tail will dump those characters out to the terminal.</p> <p>What I am looking for (and possibly to write myself if necessary) is a version of tail that works on binary files. Basically I have a wireless link that I would like to trickle a file across as it comes down from another network link. Looking over the tail source code it wouldn't be too hard to rewrite, but I would rather not reinvent the wheel! This wouldn't strictly be "tail" as I would like the entire file to be copied, but it would watch as new bytes were added and stream those.</p> <p>Ideas?</p>
[ { "answer_id": 232218, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 4, "selected": false, "text": "tail -f somefile | hexdump -C\n" }, { "answer_id": 232229, "author": "mhawke", "author_id": 21945, "...
2008/10/24
[ "https://Stackoverflow.com/questions/232212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243/" ]
232,222
<p>Are there any Platform agnostic (not CLI) movements to get LINQ going for C++ in some fashion? </p> <p>I mean a great part of server frameworks around the world run on flavors of UNIX and having access to LINQ for C++ on UNIX would probably make lots of people happy!</p>
[ { "answer_id": 2308031, "author": "Chris", "author_id": 36269, "author_profile": "https://Stackoverflow.com/users/36269", "pm_score": 2, "selected": false, "text": "auto" }, { "answer_id": 9160622, "author": "Paolo Severini", "author_id": 980602, "author_profile": "ht...
2008/10/24
[ "https://Stackoverflow.com/questions/232222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
232,237
<p>What's the best way to return a random line in a text file using C? It has to use the standard I/O library (<code>&lt;stdio.h&gt;</code>) because it's for Nintendo DS homebrew.</p> <p><strong>Clarifications:</strong></p> <ul> <li>Using a header in the file to store the number of lines won't work for what I want to do.</li> <li>I want it to be as random as possible (the best being if each line has an equal probability of being chosen as every other line.)</li> <li>The file will never change while the program is being run. (It's the DS, so no multi-tasking.)</li> </ul>
[ { "answer_id": 232248, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 6, "selected": true, "text": "count = 0;\nwhile (fgets(line, length, stream) != NULL)\n{\n count++;\n if ((rand() * count) / RAND_MAX == 0)\n ...
2008/10/24
[ "https://Stackoverflow.com/questions/232237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/813/" ]
232,267
<p>I've got a complex dialog, and it is full of whitespace and I can't shrink it. In Designer, it has lots of components that then get dynamically hidden, and a few which are dynamically added. I've added dumping of size policies, size hints, and minimum sizes, but still can't figure out why Qt won't let me drag it smaller.</p> <p>There must be some tools or techniques for troubleshooting this. </p> <p>Please share.</p>
[ { "answer_id": 5357723, "author": "Chris", "author_id": 113450, "author_profile": "https://Stackoverflow.com/users/113450", "pm_score": 0, "selected": false, "text": "\nQHBoxLayout* layout = new QHBoxLayout;\nQPushButton* myBtn = new QPushButton(\"Test\");\n\nlayout->insertStretch(1);\nl...
2008/10/24
[ "https://Stackoverflow.com/questions/232267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19193/" ]
232,269
<p>Is there a way to mount a Linux directory from a different PC to your local Linux PC? How?</p>
[ { "answer_id": 232286, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "/etc/exports" }, { "answer_id": 232340, "author": "Georg Zimmer", "author_id": 3569719, "author_profile": ...
2008/10/24
[ "https://Stackoverflow.com/questions/232269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16139/" ]
232,271
<p>I have an undefined number of display context and each will display a texture. When I call glGenTextures I get the same name returned across all display contexts. Will this work? Even though they have the same name will they still store and display different textures? If not what should do to get around this? </p>
[ { "answer_id": 232331, "author": "Menkboy", "author_id": 29539, "author_profile": "https://Stackoverflow.com/users/29539", "pm_score": 2, "selected": false, "text": "wglShareLists" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55638/" ]
232,274
<p>When I browse code in Vim, I need to see opening and closing parenthesis/ brackets, and pressing <kbd>%</kbd> seems unproductive.</p> <p>I tried <code>:set showmatch</code>, but it makes the cursor jump back and forth when you type in a bracket. But what to do if I am browsing already written code?</p>
[ { "answer_id": 232278, "author": "jcoby", "author_id": 2884, "author_profile": "https://Stackoverflow.com/users/2884", "pm_score": 5, "selected": false, "text": "set showmatch" }, { "answer_id": 232289, "author": "Harley Holcombe", "author_id": 1057, "author_profile":...
2008/10/24
[ "https://Stackoverflow.com/questions/232274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29405/" ]
232,280
<p>Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1's in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the 1's in there. But my proc is always returning zero.</p> <p>I was able to make sure it was looping properly and it is.</p> <p>The text = Hello which is 16 1's, here is my proc for looping through that text to count the number of ones in it.</p> <pre><code>sub AX,AX sub SI,SI mov bx,[bp+6] ;get message offset @@mainLoop: mov cx,8 mov dh,80h cmp byte ptr [bx + si],0 je @@endChecker @@innerLoop: test byte ptr [bx + si],dh jz @@zeroFound inc AX @@zeroFound: shr bh,1 loop @@innerLoop @@continue: inc si jmp @@mainLoop </code></pre> <p>the rest of the proc is just push/pops. What im wanting this to actually do is use TEST to compare 100000000 to a byte, if its a 1 inc AX else shift right the mask by 1 and loop a whole byte, than inc to next byte and do again.</p>
[ { "answer_id": 232860, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 1, "selected": false, "text": " mov cx, 8\n mov dh, byte ptr [bx+si] \n@@innerLoop:\n add dh, dh \n adc ...
2008/10/24
[ "https://Stackoverflow.com/questions/232280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18431/" ]
232,316
<p>I'm tinkering with Silverlight 2.0.</p> <p>I have some images, which I currently have a static URL for the image source. Is there a way to dynamically load the image from a URL path for the site that is hosting the control?</p> <p>Alternatively, a configuration setting, stored in a single place, that holds the base path for the URL, so that each image only holds the filename?</p>
[ { "answer_id": 232414, "author": "Aaron Fischer", "author_id": 5618, "author_profile": "https://Stackoverflow.com/users/5618", "pm_score": 5, "selected": true, "text": " Uri uri = new Uri(\"http://testsvr.com/hello.jpg\");\n YourImage.Source = new BitmapImage(uri);\n" }, { "ans...
2008/10/24
[ "https://Stackoverflow.com/questions/232316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
232,318
<p>Java requires that you catch all possible exceptions or declare them as thrown in the method signature. This isn't the case with C# but I still feel that it is a good practice to catch all exceptions. Does anybody know of a tool which can process a C# project and point out places where an exception is thrown but not caught? </p>
[ { "answer_id": 232354, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "Application.ThreadException += new ThreadExceptionEventHandler( Application_ThreadException );\n\nprivate static void Applicat...
2008/10/24
[ "https://Stackoverflow.com/questions/232318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/361/" ]
232,333
<p>How long should it take to run </p> <pre><code>ALTER DATABASE [MySite] SET READ_COMMITTED_SNAPSHOT ON </code></pre> <p>I just ran it and it's taken 10 minutes.</p> <p>How can I check if it is applied?</p>
[ { "answer_id": 232358, "author": "Rick", "author_id": 14138, "author_profile": "https://Stackoverflow.com/users/14138", "pm_score": 7, "selected": true, "text": "sys.databases" }, { "answer_id": 1253452, "author": "Community", "author_id": -1, "author_profile": "https...
2008/10/24
[ "https://Stackoverflow.com/questions/232333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
232,344
<p>I have some code which ignores a specific exception. </p> <pre><code>try { foreach (FileInfo fi in di.GetFiles()) { collection.Add(fi.Name); } foreach (DirectoryInfo d in di.GetDirectories()) { populateItems(collection, d); } } catch (UnauthorizedAccessException ex) { //ignore and move onto next directory } </code></pre> <p>of course this results in a compile time warning as ex is unused. Is there some standard accept noop which should be used to remove this warning? </p>
[ { "answer_id": 232350, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 5, "selected": true, "text": "catch (UnauthorizedAccessException) {}\n" }, { "answer_id": 232363, "author": "Booji Boy", "author_id": ...
2008/10/24
[ "https://Stackoverflow.com/questions/232344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/361/" ]
232,347
<p>Many programs include an auto-updater, where the program occasionally looks online for updates, and then downloads and applies any updates that are found. Program bugs are fixed, supporting files are modified, and things are (usually) made better.</p> <p>Unfortunately no matter how hard I look, I can't find information on this process anywhere. It seems like the auto-updaters that have been implemented have either been proprietary or not considered important.</p> <p>It seems fairly easy to implement the system that looks for updates on a network and downloads them if they are available. That part of the auto-updater will change significantly from implementation to implementation. The question is what are the different approaches of <strong>applying</strong> patches. Just downloading files and replacing old ones with new ones, running a migration script that was downloaded, monkey patching parts of the system, etc.? Concepts are preferred, but examples in Java, C, Python, Ruby, Lisp, etc. would be appreciated.</p>
[ { "answer_id": 339731, "author": "abatishchev", "author_id": 41956, "author_profile": "https://Stackoverflow.com/users/41956", "pm_score": 3, "selected": false, "text": "Version GetLatestVersion() {\nHttpWebRequestrequest = (HttpWebRequest)WebRequest.Create(new Uri(new Uri(http://example...
2008/10/24
[ "https://Stackoverflow.com/questions/232347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306/" ]
232,386
<p>I'm trying to make an item on ToolBar (specifically a Label, TextBlock, or a TextBox) That will fill all available horizontal space. I've gotten the ToolBar itself to stretch out by taking it out of its ToolBarTray, but I can't figure out how to make items stretch.</p> <p>I tried setting Width to Percenatage or Star values, but it doesn't accept that. Setting Horizontal(Content)Alignment to Stretch in various places seems to have no effect either.</p>
[ { "answer_id": 299786, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 4, "selected": false, "text": "<DockPanel>\n <ToolBar DockPanel.Dock=\"Top\">\n <ToolBar.Resources>\n <Style TargetType=\"{x:T...
2008/10/24
[ "https://Stackoverflow.com/questions/232386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7649/" ]
232,387
<p>Suppose I have a table with a numeric column (lets call it "score").</p> <p>I'd like to generate a table of counts, that shows how many times scores appeared in each range.</p> <p>For example:</p> <pre> score range | number of occurrences ------------------------------------- 0-9 | 11 10-19 | 14 20-29 | 3 ... | ... </pre> <p>In this example there were 11 rows with scores in the range of 0 to 9, 14 rows with scores in the range of 10 to 19, and 3 rows with scores in the range 20-29.</p> <p>Is there an easy way to set this up? What do you recommend?</p>
[ { "answer_id": 232405, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": false, "text": "create table scores (\n user_id int,\n score int\n)\n\nselect t.range as [score range], count(*) as [number of occu...
2008/10/24
[ "https://Stackoverflow.com/questions/232387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31060/" ]
232,395
<p>I have a two-dimensional array (of Strings) which make up my data table (of rows and columns). I want to sort this array by any column. I tried to find an algorithm for doing this in C#, but have not been successful.</p> <p>Any help is appreciated.</p>
[ { "answer_id": 232444, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 6, "selected": true, "text": "// assumes stringdata[row, col] is your 2D string array\nDataTable dt = new DataTable();\n// assumes first row contains...
2008/10/24
[ "https://Stackoverflow.com/questions/232395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15052/" ]
232,435
<p>I have a two way foreign relation similar to the following</p> <pre><code>class Parent(models.Model): name = models.CharField(max_length=255) favoritechild = models.ForeignKey("Child", blank=True, null=True) class Child(models.Model): name = models.CharField(max_length=255) myparent = models.ForeignKey(Parent) </code></pre> <p>How do I restrict the choices for Parent.favoritechild to only children whose parent is itself? I tried</p> <pre><code>class Parent(models.Model): name = models.CharField(max_length=255) favoritechild = models.ForeignKey("Child", blank=True, null=True, limit_choices_to = {"myparent": "self"}) </code></pre> <p>but that causes the admin interface to not list any children.</p>
[ { "answer_id": 232644, "author": "Eric Holscher", "author_id": 4169, "author_profile": "https://Stackoverflow.com/users/4169", "pm_score": 4, "selected": false, "text": "class Parent(models.Model):\n name = models.CharField(max_length=255)\n\nclass Child(models.Model):\n name = models....
2008/10/24
[ "https://Stackoverflow.com/questions/232435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25521/" ]
232,445
<p>I'm just starting to learn C++ so excuse me for this simple question. What I'm doing is reading in numbers from a file and then trying to add them to an array. My problem is how do you increase the size of the array? For example I thought might be able to just do:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { double *x; x = new double[1]; x[0]=5; x = new double[1]; x[1]=6; cout &lt;&lt; x[0] &lt;&lt; "," &lt;&lt; x[1] &lt;&lt; endl; return 0; } </code></pre> <p>But this obviously just overwrites the value, 5, that I initially set to x[0] and so outputs 0,6. How would I make it so that it would output 5,6?<br /><br />Please realize that for the example I've included I didn't want to clutter it up with the code reading from a file or code to get numbers from a user. In the actual application I won't know how big of an array I need at compile time so please don't tell me to just make an array with two elements and set them equal to 5 and 6 respectively.<br /><br />Thanks for your help.</p>
[ { "answer_id": 232454, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 5, "selected": true, "text": "vector" }, { "answer_id": 232462, "author": "markets", "author_id": 4662, "author_profile": "https://Stac...
2008/10/24
[ "https://Stackoverflow.com/questions/232445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38/" ]
232,450
<p>I wanted to see if folks were using decimal for financial applications instead of double. I have seen lots of folks using double all over the place with unintended consequences . .</p> <p>Do you see others making this mistake . . .</p>
[ { "answer_id": 232460, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "float" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
232,472
<p>In C and C++ what do the following declarations do?</p> <pre><code>const int * i; int * const i; const volatile int ip; const int *i; </code></pre> <p>Are any of the above declarations wrong?</p> <p>If not what is the meaning and differences between them?</p> <p>What are the useful uses of above declarations (I mean in which situation we have to use them in C/C++/embedded C)?</p>
[ { "answer_id": 232479, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 5, "selected": false, "text": "const int * i;" }, { "answer_id": 232480, "author": "Ty.", "author_id": 16948, "author_profile":...
2008/10/24
[ "https://Stackoverflow.com/questions/232472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,475
<p>I need to add unit testing to some old scripts, the scripts are all basically in the following form:</p> <pre><code>#!/usr/bin/perl # Main code foo(); bar(); # subs sub foo { } sub bar { } </code></pre> <p>If I try to 'require' this code in a unit test, the main section of the code will run, where as I want to be able to just test "foo" in isolation.</p> <p>Is there any way to do this without moving foo,bar into a seperate .pm file?</p>
[ { "answer_id": 232552, "author": "ysth", "author_id": 17389, "author_profile": "https://Stackoverflow.com/users/17389", "pm_score": 4, "selected": false, "text": "use File::Slurp \"read_file\";\neval \"package Script; sub {\" . read_file(\"script\") . \"}\";\n\nis(Script::foo(), \"foo\")...
2008/10/24
[ "https://Stackoverflow.com/questions/232475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3839/" ]
232,486
<p>I've used Slime within Emacs as my primary development environment for Common Lisp (or Aquamacs on OS X), but are there other compelling choices out there? I've heard about Lispworks, but is that [or something else] worth looking at? Or does anyone have tips to getting the most out of Emacs (e.g., hooking it up to the hyperspec for easy reference)?</p> <p>Update: Section 7 of Pascal Costanza's <a href="http://p-cos.net/lisp/guide.html" rel="noreferrer">Highly Opinionated Guide to Lisp</a> give one perspective. But to me, <a href="http://common-lisp.net/project/slime/" rel="noreferrer">SLIME</a> really seems to be <a href="http://www.cliki.net/Editing%20Lisp%20Code%20with%20Emacs" rel="noreferrer">where it's at</a>.</p> <p>More resources:</p> <ul> <li><a href="http://common-lisp.net/project/movies/movies/slime.mov" rel="noreferrer">Video of Marco Baringer showing SLIME</a></li> <li><a href="http://homepage.mac.com/svc/LispMovies/index.html" rel="noreferrer">Videos of Sven Van Caekenberghe showing the LispWorks IDE</a></li> <li><a href="http://www.cl-http.org:8002/mov/dsl-in-lisp.mov" rel="noreferrer">Video of Rainer Joswig using the LispWorks IDE to create a DSL</a></li> <li><a href="http://bc.tech.coop/blog/041130.html" rel="noreferrer">Blog post by Bill Clementson discussing IDE choices</a></li> </ul>
[ { "answer_id": 232904, "author": "Vebjorn Ljosa", "author_id": 17498, "author_profile": "https://Stackoverflow.com/users/17498", "pm_score": 3, "selected": false, "text": "~/.emacs.el" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31049/" ]
232,506
<p>What tips and "standards" do you use in your Redmine project management process?</p> <p>Do you have a standard wiki insert template you could share or a standard way to work a project using bugs features tasks and support issues?</p> <p>Do you let issues and updates get emailed into Redmine? Do you use the forums? Do you use SVN repository? Do you use Mylyn in eclipse to work the task lists?</p> <p>I'm trying to drag our dept. into some web based PM instead of emailed Word docs of vague requirements followed by Word docs explaining how to QA and Deploy that all get lost in a pile of competing updates and projects so that by the time I have to fix something, no one can find any documentation on how it works.</p>
[ { "answer_id": 10316605, "author": "Scott Corscadden", "author_id": 297472, "author_profile": "https://Stackoverflow.com/users/297472", "pm_score": 3, "selected": false, "text": "svn switch https//.../branches/1.3-stable ." } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5281/" ]
232,507
<p>I'm a rookie designer having a few troubles with this page: <a href="http://www.resolvegroup.co.nz/javasurvey.php" rel="nofollow noreferrer">http://www.resolvegroup.co.nz/javasurvey.php</a></p> <p>There are problems with the javascript operation of the expanded questions. For Internet Explorer (Version 7) the first question when expanded gets partly hidden under question 2. This happens to varying degrees with all questions, at times making the next question completely hidden and other problems.</p> <p>Firefox (Version 3.03) does not have the problem as above, but you cannot get access to the explanations or select next question as in IE7.</p> <p>Does anyone know what's going on with this, and how to fix it?</p>
[ { "answer_id": 232514, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "$(\".score-list\").slideUp(speed);\n$(\".score-list\").removeClass(\"open\");\n$(\"a.open-answer\").removeClass(\"hidden\");\n...
2008/10/24
[ "https://Stackoverflow.com/questions/232507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,508
<p>I am currently using a dotted border for certain UI stuff such as instructions, notes, error boxes, etc.</p> <p>But recently I changed to a solid border, due to a requirement, but I just find it kind of strange.</p> <p>It seems that by making it solid it puts too much emphasis on page elements which are just informational.</p> <p>What are your views?</p>
[ { "answer_id": 232522, "author": "cowgod", "author_id": 6406, "author_profile": "https://Stackoverflow.com/users/6406", "pm_score": 0, "selected": false, "text": "<abbr style=\"border-bottom:1px dotted #000;cursor:help;\">\n <span style=\"cursor:help;\" title=\"Cascading Style Sheets\...
2008/10/24
[ "https://Stackoverflow.com/questions/232508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25368/" ]
232,519
<p>What I can think of is pre-populating certain form input elements based on the user's geographical information.</p> <p>What are other ways can you think of to speed up user input on long application forms?</p> <p>Or at least keep them focus on completing the application form?</p>
[ { "answer_id": 249177, "author": "Már Örlygsson", "author_id": 16271, "author_profile": "https://Stackoverflow.com/users/16271", "pm_score": 1, "selected": false, "text": "reset" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25368/" ]
232,524
<p>How does one go about creating a virtual CD driver on Mac OS X programatically? </p> <p>I can't find any relevant Cocoa APIs or any pure C BSD solutions. </p> <p>Any help or information is appreciated.</p>
[ { "answer_id": 66885701, "author": "malhal", "author_id": 259521, "author_profile": "https://Stackoverflow.com/users/259521", "pm_score": 0, "selected": false, "text": "/Library/Extensions/DAEMONToolsVirtualSCSIBus.kext/Contents/MacOS/DAEMONToolsVirtualSCSIBus" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,535
<p>What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime?</p> <p>Consider the following sample code - inside the <code>Example()</code> method, what's the most concise way to invoke <code>GenericMethod&lt;T&gt;()</code> using the <code>Type</code> stored in the <code>myType</code> variable?</p> <pre><code>public class Sample { public void Example(string typeName) { Type myType = FindType(typeName); // What goes here to call GenericMethod&lt;T&gt;()? GenericMethod&lt;myType&gt;(); // This doesn't work // What changes to call StaticMethod&lt;T&gt;()? Sample.StaticMethod&lt;myType&gt;(); // This also doesn't work } public void GenericMethod&lt;T&gt;() { // ... } public static void StaticMethod&lt;T&gt;() { //... } } </code></pre>
[ { "answer_id": 232621, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 11, "selected": true, "text": "MethodInfo method = typeof(Sample).GetMethod(nameof(Sample.GenericMethod));\nMethodInfo generic = method.MakeGenericMeth...
2008/10/24
[ "https://Stackoverflow.com/questions/232535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30280/" ]
232,545
<p>Say I have a rectangular string array - not a jagged array</p> <pre><code>string[,] strings = new string[8, 3]; </code></pre> <p>What's the best way to extract a one-dimensional array from this (either a single row or a single column)? I can do this with a for loop, of course, but I'm hoping .NET has a more elegant way built in.</p> <p>Bonus points for converting the extracted string array to an object array.</p>
[ { "answer_id": 232553, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 1, "selected": false, "text": "static object[] GetColumn(string[][] source, int col) {\n return source.Iterate().Select(x => source[x.Index][col]).Ca...
2008/10/24
[ "https://Stackoverflow.com/questions/232545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14606/" ]
232,558
<p>I noticed that the generic <code>IEnumerator&lt;T&gt;</code> inherits from IDisposable, but the non-generic interface IEnumerator does not. Why is it designed in this way?</p> <p>Usually, we use foreach statement to go through a <code>IEnumerator&lt;T&gt;</code> instance. The generated code of foreach actually has try-finally block that invokes Dispose() in finally. </p>
[ { "answer_id": 232561, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": -1, "selected": false, "text": "IEnumerable<T>" }, { "answer_id": 232616, "author": "Jon Skeet", "author_id": 22656, "author_profile": "htt...
2008/10/24
[ "https://Stackoverflow.com/questions/232558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26349/" ]
232,575
<p>How do I check if a column exists in SQL Server 2000?</p>
[ { "answer_id": 232582, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 5, "selected": false, "text": "IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS\nWHERE TABLE_NAME='tablename' AND COLUMN_NAME='columname'...
2008/10/24
[ "https://Stackoverflow.com/questions/232575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31071/" ]
232,622
<p><strong>Update:</strong> So, this turns out to have nothing to do with Tortoise SVN. I use Mozy.com for off-site backups and their new version includes these icon overlays. They can be disabled via the config options...or see here <a href="http://forum.pcmech.com/showthread.php?p=1385433" rel="nofollow noreferrer">http://forum.pcmech.com/showthread.php?p=1385433</a>. Thanks @OS for the answer.</p> <p>Been using Tortoise SVN for some time on my Vista box. Within the last few days (and after recently upgrading to 1.5.4) the icon overlays are displaying on all files. </p> <p>My exclude path is:</p> <p>*</p> <p>My include paths are:</p> <p>C:\Users\jw\Documents\Visual Studio 2008\Projects\SVNProjects*</p> <p>C:\Users\jw\Documents\VB Projects\SVNProjects*</p> <p>I haven't touched those settings in months. Any ideas? Help. Thanks.</p>
[ { "answer_id": 232628, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 1, "selected": false, "text": "%USERPROFILE%\\AppData\\Local" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/689/" ]
232,625
<p>How to invoke the default browser with an URL from C#?</p>
[ { "answer_id": 232633, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 3, "selected": false, "text": "System.Diagnostics.Process.Start(\"http://mysite.com\");\n" }, { "answer_id": 232634, "author": "An...
2008/10/24
[ "https://Stackoverflow.com/questions/232625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,651
<p>While running a batch file in Windows XP I have found randomly occurring error message:</p> <blockquote> <p>The system cannot find the batch label specified name_of_label</p> </blockquote> <p>Of course label existed. What causes this error?</p>
[ { "answer_id": 232674, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 8, "selected": true, "text": ".bat" }, { "answer_id": 6419068, "author": "Marshal", "author_id": 548098, "author_profile": "https://Stacko...
2008/10/24
[ "https://Stackoverflow.com/questions/232651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31086/" ]
232,662
<p>I have a function which launches a javascript window, like this</p> <pre><code> function genericPop(strLink, strName, iWidth, iHeight) { var parameterList = "location=0,directories=0,status=0,menubar=0,resizable=no, scrollbars=no,toolbar=0,maximize=0,width=" + iWidth + ", height=" + iHeight; var new_window=""; new_window = open(strLink, strName, parameterList); window.self.name = "main"; new_window.moveTo(((screen.availWidth/2)-(iWidth/2)),((screen.availHeight/2)-(iHeight/2))); new_window.focus(); } </code></pre> <p>This function is called about 52 times from different places in my web application.</p> <p>I want to re-factor this code to use a DHTML modal pop-up window. The change should be as unobtrusive as possible.</p> <p>To keep this solution at par with the old solution, I think would also need to do the following</p> <ol> <li>Provide a handle to "Close" the window.</li> <li>Ensure the window cannot be moved, and is positioned at the center of the screen.</li> <li>Blur the background as an option.</li> </ol> <p>I thought <a href="http://particletree.com/features/lightbox-gone-wild/" rel="nofollow noreferrer">this solution</a> is the closest to what I want, but I could not understand how to incorporate it.</p> <p>Edit: A couple of you have given me a good lead. Thank you. But let me re-state my problem here. I am re-factoring existing code. I should avoid any change to the present HTML or CSS. Ideally I would like to achieve this effect by keeping the function signature of the genericPop(...) same as well.</p>
[ { "answer_id": 232684, "author": "Gene", "author_id": 22673, "author_profile": "https://Stackoverflow.com/users/22673", "pm_score": 2, "selected": false, "text": "showDialog('title','content (can be html if encoded)','dialog_style/*4 predefined styles to choose from*/');\n" }, { ...
2008/10/24
[ "https://Stackoverflow.com/questions/232662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11602/" ]
232,677
<p>Could you tell me, please, if it's possible to preview (or at least retroview, for example, in a kind of a log file) SQL commands which SQL Server Management Studio Express is about to execute (or has just executed)?</p> <p>In the past I used Embarcadero DBArtisan which shows SQL queries to be executed before actually running them on the server, so I am eager for this feature in Management Studio.</p> <p>I have found an option "Auto generate change scripts", but it shows only DDL SQL queries (structure change), not data change.</p>
[ { "answer_id": 232700, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 1, "selected": false, "text": "BEGIN TRAN\n\n INSERT INTO Clients \n SELECT 'Bruno', 'Alexandre';\n\nEND\n\nROLLBACK TRAN\n" }, { "answer_id":...
2008/10/24
[ "https://Stackoverflow.com/questions/232677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11256/" ]
232,678
<p>I am working on implementing tail for an assignment. I have it working correctly however I seem to be getting an error from free at random times.</p> <p>I can't see, to track it down to a pattern or anything besides it is consistent.</p> <p>For example if I call my program as "tail -24 test.in" I would get the the the incorrect checksum error at the same line on multiple runs. However, with different files and even different numbers of lines to print back I will come back without errors.</p> <p>Any idea on how to track down the issue, I've been trying to debug it for hours to no avail.</p> <p>Here is the offending code:</p> <p>lines is defined as a char** and was malloc as:</p> <pre><code>lines = (char**) malloc(nlines * sizeof(char *)); void insert_line(char *s, int len){ printf("\t\tLine Number: %d Putting a %d line into slot: %d\n",processed,len,slot); if(processed &gt; numlines -1){//clean up free(*(lines+slot)); *(lines + slot) = NULL; } *(lines + slot) = (char *) malloc(len * sizeof(char)); if(*(lines + slot) == NULL) exit(EXIT_FAILURE); strcpy(*(lines+slot),s); slot = ++processed % numlines; } </code></pre>
[ { "answer_id": 232720, "author": "Remo.D", "author_id": 16827, "author_profile": "https://Stackoverflow.com/users/16827", "pm_score": 0, "selected": false, "text": " *(lines + slot) = (char *) malloc(len * sizeof(char));\n if((lines + slot) == NULL) exit(EXIT_FAILURE);\n" }, { ...
2008/10/24
[ "https://Stackoverflow.com/questions/232678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25012/" ]
232,681
<p>I’ve almost 6 years of experience in application development using .net technologies. Over the years I have improved as a better OO programmer but when I see code written by other guys (especially the likes of Jeffrey Richter, Peter Golde, Ayende Rahien, Jeremy Miller etc), I feel there is a generation gap between mine and their designs. I usually design my classes on the fly with some help from tools like ReSharper for refactoring and code organization. </p> <p>So, my question is “what does it takes to be a better OO programmer”. Is it </p> <p>a) Experience</p> <p>b) Books (reference please)</p> <p>c) Process (tdd or uml) </p> <p>d) patterns</p> <p>e) anything else?</p> <p>And how should one validate that the design is good, easy to understand and maintainable. As there are so many buzzwords in industry like dependency injection, IoC, MVC, MVP, etc where should one concentrate more in design. I feel abstraction is the key. What else?</p>
[ { "answer_id": 232960, "author": "Sébastien RoccaSerra", "author_id": 2797, "author_profile": "https://Stackoverflow.com/users/2797", "pm_score": 1, "selected": false, "text": "self/this" }, { "answer_id": 10637273, "author": "Webist", "author_id": 465096, "author_pro...
2008/10/24
[ "https://Stackoverflow.com/questions/232681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31081/" ]
232,682
<p>I've already written a generator that does the trick, but I'd like to know the best possible way to implement the off-side rule.</p> <p>Shortly: <a href="http://en.wikipedia.org/wiki/Off-side_rule" rel="noreferrer">Off-side rule</a> means in this context that indentation is getting recognized as a syntactic element.</p> <p>Here is the offside rule in pseudocode for making tokenizers that capture indentation in usable form, I don't want to limit answers by language:</p> <pre><code>token NEWLINE matches r"\n\ *" increase line count pick up and store the indentation level remember to also record the current level of parenthesis procedure layout tokens level = stack of indentation levels push 0 to level last_newline = none per each token if it is NEWLINE put it to last_newline and get next token if last_newline contains something extract new_level and parenthesis_count from last_newline - if newline was inside parentheses, do nothing - if new_level &gt; level.top push new_level to level emit last_newline as INDENT token and clear last_newline - if new_level == level.top emit last_newline and clear last_newline - otherwise while new_level &lt; level.top pop from level if new_level &gt; level.top freak out, indentation is broken. emit last_newline as DEDENT token clear last_newline emit token while level.top != 0 emit token as DEDENT token pop from level comments are ignored before they are getting into the layouter layouter lies between a lexer and a parser </code></pre> <p>This layouter doesn't generate more than one NEWLINE at time, and doesn't generate NEWLINE when there's indentation coming up. Therefore parsing rules remain quite simple. It's pretty good I think but inform if there's better way of accomplishing it.</p> <p>While using this for a while, I've noticed that after DEDENTs it may be nice to emit newline anyway, this way you can separate the expressions with NEWLINE while keeping the INDENT DEDENT as a trailer for expression.</p>
[ { "answer_id": 258167, "author": "zaphod", "author_id": 13871, "author_profile": "https://Stackoverflow.com/users/13871", "pm_score": 4, "selected": true, "text": "this line introduces an indented block of literal text:\n this line of the block is indented four spaces\n but this line...
2008/10/24
[ "https://Stackoverflow.com/questions/232682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21711/" ]
232,688
<pre><code>&lt;style type="text/css"&gt; html, body { background: #fff; margin: 0; padding: 0; } #nav { font-family: Verdana, sans-serif; height: 29px; font-size: 12px; padding: 0 0 0 10px; /* this is used for something else */ background-color: #456; } #nav ul, #nav ul li { list-style: none; margin: 0; padding: 9px 0 0 0px; } #nav ul { text-align: center; } #nav ul li { display: inline; } #nav ul li.last { margin-right: 0; } #nav ul li a { color: #FFF; text-decoration: none; padding: 0px 0 0 20px; height: 29px; } #nav ul li a span { padding: 8px 20px 0 0; height: 21px; } #nav ul li a:hover { background: #789; } &lt;/style&gt; &lt;div id="nav"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="/1/"&gt;&lt;span&gt;One&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/2/"&gt;&lt;span&gt;Two&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/3/"&gt;&lt;span&gt;Three&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/4/"&gt;&lt;span&gt;Four&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I have a little problem with that, as it doesn't make the "hover background" 100% of the height of the nav bar.</p>
[ { "answer_id": 232699, "author": "Gene", "author_id": 22673, "author_profile": "https://Stackoverflow.com/users/22673", "pm_score": 0, "selected": false, "text": "#nav ul li a {\n color: #FFF;\n text-decoration: none;\n padding: 0px 0 0 20px;\n height: 29px;\n line-height:...
2008/10/24
[ "https://Stackoverflow.com/questions/232688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21559/" ]
232,691
<p>I've allocated an "array" of <code>mystruct</code> of size <code>n</code> like this:</p> <pre><code>if (NULL == (p = calloc(sizeof(struct mystruct) * n,1))) { /* handle error */ } </code></pre> <p>Later on, I only have access to <code>p</code>, and no longer have <code>n</code>. Is there a way to determine the length of the array given just the pointer <code>p</code>?</p> <p>I figure it <em>must</em> be possible, since <code>free(p)</code> does just that. I know <code>malloc()</code> keeps track of how much memory it has allocated, and that's why it knows the length; perhaps there is a way to query for this information? Something like...</p> <pre><code>int length = askMallocLibraryHowMuchMemoryWasAlloced(p) / sizeof(mystruct) </code></pre> <p>I know I should just rework the code so that I know <code>n</code>, but I'd rather not if possible. Any ideas?</p>
[ { "answer_id": 232719, "author": "Barry Wark", "author_id": 2140, "author_profile": "https://Stackoverflow.com/users/2140", "pm_score": 7, "selected": true, "text": "malloc" }, { "answer_id": 232729, "author": "paercebal", "author_id": 14089, "author_profile": "https:...
2008/10/24
[ "https://Stackoverflow.com/questions/232691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31092/" ]
232,693
<p>Is it OK (or even recommended/good practice) to <code>#include</code> a <code>.c</code> file in another <code>.c</code> file?</p>
[ { "answer_id": 38953443, "author": "milad", "author_id": 4697004, "author_profile": "https://Stackoverflow.com/users/4697004", "pm_score": -1, "selected": false, "text": "#include <another.c>\n" }, { "answer_id": 39063753, "author": "sumitroy", "author_id": 6458680, "...
2008/10/24
[ "https://Stackoverflow.com/questions/232693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,722
<p>When querying ntp servers with the command <strong>ntpdate</strong>, I can use the <strong>-u</strong> argument to make the source port an unrestricted port (port 1024 and above).</p> <p>With ntpd, which is meant to run in the background, I can't seem to find a way to turn this option on. So the source port is always 123. It's playing around horribly with my firewall configuration.</p> <p>Is there a configuration option in <strong>ntp.conf</strong> to make it use a random source port?</p>
[ { "answer_id": 29970572, "author": "Daniel Alder", "author_id": 1353930, "author_profile": "https://Stackoverflow.com/users/1353930", "pm_score": 1, "selected": false, "text": "ntpdate -q" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15087/" ]
232,732
<p>How do I convert a string to DateTime format? For example, if I had a string like:</p> <p><code>"24/10/2008"</code></p> <p>How do I get that into DateTime format ?</p>
[ { "answer_id": 232739, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "string str = \"24/10/2008\";\nDateTime dt = DateTime.ParseExact(str, \"dd/MM/yyyy\", \n ...
2008/10/24
[ "https://Stackoverflow.com/questions/232732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,736
<p>Has anybody used a good obfuscator for PHP? I've tried some but they don't work for very big projects. They can't handle variables that are included in one file and used in another, for instance.</p> <p>Or do you have any other tricks for stopping the spread of your code?</p>
[ { "answer_id": 232767, "author": "Schwern", "author_id": 14660, "author_profile": "https://Stackoverflow.com/users/14660", "pm_score": 7, "selected": false, "text": "perl -MO=Deparse some_program\n" }, { "answer_id": 3781356, "author": "John", "author_id": 456505, "au...
2008/10/24
[ "https://Stackoverflow.com/questions/232736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29593/" ]
232,744
<p>Sometimes gdb prints "incomplete type" for some type of variables. What does this mean and how can we see that value?</p>
[ { "answer_id": 240856, "author": "Daniel Cassidy", "author_id": 31662, "author_profile": "https://Stackoverflow.com/users/31662", "pm_score": 6, "selected": true, "text": "struct hatstand;\nstruct hatstand *foo;\n" }, { "answer_id": 12884788, "author": "Peter", "author_id...
2008/10/24
[ "https://Stackoverflow.com/questions/232744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1692070/" ]
232,747
<p>I'm trying to read variables from a batch file for later use in the batch script, which is a Java launcher. I'd ideally like to have the same format for the settings file on all platforms (Unix, Windows), and also be a valid Java Properties file. That is, it should look like this:</p> <pre><code>setting1=Value1 setting2=Value2 ... </code></pre> <p>Is it possible to read such values like you would in a Unix shell script? The could should look something like this:</p> <pre><code>READ settingsfile.xy java -Dsetting1=%setting1% ... </code></pre> <p>I know that this is probably possible with <code>SET setting1=Value1</code>, but I'd really rather have the same file format for the settings on all platforms.</p> <p>To clarify: I need to do this in the command line/batch environment as I also need to set parameters that cannot be altered from within the JVM, like -Xmx or -classpath.</p>
[ { "answer_id": 232813, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 6, "selected": true, "text": "setlocal\nFOR /F \"tokens=*\" %%i in ('type Settings.txt') do SET %%i\njava -Dsetting1=%setting1% ...\nendlocal\n" }, { ...
2008/10/24
[ "https://Stackoverflow.com/questions/232747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22227/" ]
232,748
<p>User A logs into a ticket management system to edit content on "SomePage.aspx"</p> <p>User B logs in 30 seconds later to edit the same ticket on "SomePage.aspx"</p> <p>What are some of the best known practices(in a 3-tier architecture) for notifying each of the users that someone else is modifying the same content? </p>
[ { "answer_id": 232770, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 1, "selected": false, "text": "SELECT * FROM Tickets WHERE TicketID = 897; \nUPDATE Tickets SET EditingBy = @UserID WHERE TicketID = 897;\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4646/" ]
232,775
<p>This is one of those ajax "alternate flow" questions. Normally I expect my ajax request to return a part of the page. But sometimes it may return a full page with html, head and body tag. </p> <p>At the time I return from my ajax-request I can detect if this is a full page, but is it possible to trigger a full page reload (with full event cycle) based on the string content I have ?</p> <p>(And yes, I have tried replacing the body element, but that does not give me the events and does not allow me to change the content in the head block)</p> <p>Any framework reference is ok</p>
[ { "answer_id": 232784, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 3, "selected": true, "text": "location.href = ..." }, { "answer_id": 232809, "author": "gimel", "author_id": 6491, "author_profile": "ht...
2008/10/24
[ "https://Stackoverflow.com/questions/232775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
232,781
<p>can anybody show me how to build a string using checkbox. what would be the best way to do this.</p> <p>for example i have 4 checkbox's each with its own value (valueA, valueB, valueC, valueD) the thing is i want to display each result in different lines.</p> <p>result if B &amp; C is selected : </p> <p>valueB <br> valueC </p> <p>and how would i display this again if i saved this into a database?</p>
[ { "answer_id": 232801, "author": "Unsliced", "author_id": 2902, "author_profile": "https://Stackoverflow.com/users/2902", "pm_score": 0, "selected": false, "text": "\"if I saved this into a database\" ? \n" }, { "answer_id": 232803, "author": "Jon Skeet", "author_id": 226...
2008/10/24
[ "https://Stackoverflow.com/questions/232781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23491/" ]
232,785
<p>What are some uses of <code>#pragma</code> in C, with examples?</p>
[ { "answer_id": 232790, "author": "Schildmeijer", "author_id": 148909, "author_profile": "https://Stackoverflow.com/users/148909", "pm_score": 4, "selected": false, "text": "#pragma once" }, { "answer_id": 232793, "author": "SmacL", "author_id": 22564, "author_profile"...
2008/10/24
[ "https://Stackoverflow.com/questions/232785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,846
<p>After installing asp.net (and aspnet_regIIS.exe -i) the site doesn't accept my default.aspx page. When trying to access it I get a 404. When hitting directly to my mvc pages (/search.mvc for example) it works like a charm.</p> <p>We checked the website configuration and noted that there are no .aspx references in the scriptmaps node.</p> <p>What am I missing?</p>
[ { "answer_id": 232868, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "aspnet_regIIS.exe -i" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,848
<p>I'm writing code like this, doing a little quick and dirty timing:</p> <pre><code>var sw = new Stopwatch(); sw.Start(); for (int i = 0; i &lt; 1000; i++) { b = DoStuff(s); } sw.Stop(); Console.WriteLine(sw.ElapsedMilliseconds); </code></pre> <p>Surely there's a way to call this bit of timing code as a fancy-schmancy .NET 3.0 lambda rather than (God forbid) cutting and pasting it a few times and replacing the <strong><code>DoStuff(s)</code></strong> with <strong><code>DoSomethingElse(s)</code></strong>?</p> <p>I know it can be done as a <code>Delegate</code> but I'm wondering about the lambda way.</p>
[ { "answer_id": 232852, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 4, "selected": false, "text": "Stopwatch sw = MyObject.TimedFor(1000, () => DoStuff(s));\n" }, { "answer_id": 232870, "author": "Matt Hamilto...
2008/10/24
[ "https://Stackoverflow.com/questions/232848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1/" ]
232,861
<p>Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, <code>f</code>, which prints the Fibonacci numbers.</p> <p>Starting point: <strong><s>25</s> 14 characters</strong> in <strong>Haskell</strong>:</p> <p><s> <code>f=0:1:zipWith(+)f(tail f)</code> </s></p> <pre><code>f=0:scanl(+)1f </code></pre>
[ { "answer_id": 232943, "author": "Chris Young", "author_id": 9417, "author_profile": "https://Stackoverflow.com/users/9417", "pm_score": 3, "selected": false, "text": "1[pdd5**v1++2/lxx]dsxx\n" }, { "answer_id": 233161, "author": "C. K. Young", "author_id": 13, "autho...
2008/10/24
[ "https://Stackoverflow.com/questions/232861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
232,863
<p>How can I check in C# if button.Click event has any handlers associated? If (button.Click != null) throws compile error.</p>
[ { "answer_id": 232927, "author": "Brody", "author_id": 17131, "author_profile": "https://Stackoverflow.com/users/17131", "pm_score": 0, "selected": false, "text": "event System.EventHandler NewEvent;\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,869
<pre><code>&lt;style type="text/css"&gt; body { font-family:Helvetica, sans-serif; font-size:12px; } p, h1, form, button { border: 0; margin: 0; padding: 0; } .spacer { clear: both; height: 1px; } /* ----------- My Form ----------- */ .myform { margin: 0 auto; width: 400px; padding: 14px; } /* ----------- basic ----------- */ #basic { border: solid 2px #DEDEDE; } #basic h1 { font-size: 14px; font-weight: bold; margin-bottom: 8px; } #basic p { font-size: 11px; color: #666666; margin-bottom: 20px; border-bottom: solid 1px #dedede; padding-bottom: 10px; } #basic label { display: block; font-weight: bold; text-align: right; width: 140px; float: left; } #basic .small{ color:#666666; display:block; font-size:11px; font-weight:normal; text-align:right; width:140px; } #basic input{ float:left; width:200px; margin:2px 0 30px 10px; } #basic button{ clear:both; margin-left:150px; background:#888888; color:#FFFFFF; border:solid 1px #666666; font-size:11px; font-weight:bold; padding:4px 6px; } &lt;/style&gt; &lt;div id="basic" class="myform"&gt; &lt;form id="form1" name="form1" method="post" action=""&gt; &lt;h1&gt;Sign-up form&lt;/h1&gt; &lt;p&gt;This is the basic look of my form without table&lt;/p&gt; &lt;label&gt;Name &lt;span class="small"&gt;Add your name&lt;/span&gt; &lt;/label&gt; &lt;input type="text" name="textfield" id="textfield" /&gt; &lt;label&gt;Email &lt;span class="small"&gt;Add a valid address&lt;/span&gt; &lt;/label&gt; &lt;input type="text" name="textfield" id="textfield" /&gt; &lt;label&gt;Email &lt;span class="small"&gt;Add a valid address&lt;/span&gt; &lt;/label&gt; &lt;!-- Problem ---&gt; &lt;input type="radio" name="something" id="r1" class="radio" value="1" /&gt;&lt;label for="r1"&gt;One&lt;/label&gt; &lt;input type="radio" name="something" id="r2" class="radio" value="2" /&gt;&lt;label for="r2"&gt;Two&lt;/label&gt; &lt;!-- Problem ---&gt; &lt;button type="submit"&gt;Sign-up&lt;/button&gt; &lt;div class="spacer"&gt;&lt;/div&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>I was given this example form, however I cannot add radio buttons without them being messed up.</p>
[ { "answer_id": 232880, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 0, "selected": false, "text": "name=\"textfield\"" }, { "answer_id": 232910, "author": "pilsetnieks", "author_id": 6615, "author_profile...
2008/10/24
[ "https://Stackoverflow.com/questions/232869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21559/" ]
232,881
<p>In VS2005 and up, is it possible to specify which configuration should be selected by default?</p> <p>I have several configurations in my solution but one of them should be used in most cases. Hence I'd like to make sure that devs who pull it out of Source Control use the right configuration(unless of course they specifically choose another one).</p> <p>Ideally, this setting should be in the .sln file since that one is under Source Control.</p>
[ { "answer_id": 31524307, "author": "Ringil", "author_id": 4882032, "author_profile": "https://Stackoverflow.com/users/4882032", "pm_score": 3, "selected": false, "text": "Debug" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
232,884
<p>Like most developers here and in the entire world, I have been developing software systems using object-oriented programming (OOP) techniques for many years. So when I read that aspect-oriented programming (AOP) addresses many of the problems that traditional OOP doesn't solve completely or directly, I pause and think, is it real?</p> <p>I have read a lot of information trying to learn the keys of this AOP paradigm and I´m in the same place, so, I wanted to better understand its benefits in real world application development.</p> <p>Does somebody have the answer?</p>
[ { "answer_id": 232918, "author": "Mecki", "author_id": 15809, "author_profile": "https://Stackoverflow.com/users/15809", "pm_score": 9, "selected": true, "text": "void set...(...) {\n :\n :\n Display.update();\n}\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30715/" ]
232,895
<p>I came across an interesting article which shows how we can transparently encrypt jdbc connections using java thin client. </p> <p><a href="http://javasight.wordpress.com/2008/08/29/network-data-encryption-and-integrity-for-thin-jdbc-clients/" rel="nofollow noreferrer">http://javasight.wordpress.com/2008/08/29/network-data-encryption-and-integrity-for-thin-jdbc-clients/</a></p> <p>However I want to know how this can be achieved for application servers (like oc4j) datasources.</p>
[ { "answer_id": 574473, "author": "Franklin", "author_id": 67517, "author_profile": "https://Stackoverflow.com/users/67517", "pm_score": 1, "selected": false, "text": "// Set the Client encryption level \n\"oracle.net.encryption_client\" = Service.getLevelString(level) \n\n// Set the Cl...
2008/10/24
[ "https://Stackoverflow.com/questions/232895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
232,905
<p>I got this logic in a control to create a correct url for an image. My control basically needs to diplay an image, but the src is actually a complex string based on different parameters pointing at an image-server.</p> <p>So we decided to to create a control MyImage derived from asp:Image - it works like a charm. Now i need the same logic but my image now needs to respond to a click. What i mean is - the 'MyImage' is used to display images on the site but in a few rare cases i would like it to be clickable.</p> <p>I think i got three choices.</p> <ol> <li>Change MyImage to derive from asp:ImageButton instead of asp:Image.</li> <li>Copy all the code from MyImage into a new MyClickImage and derive from asp:ImageButton.</li> <li>Wrap logic on MyImage to add a hyperlink, implement IPostbackHandler for that hyperlink and add the logic to handle the event.</li> </ol> <p>Obviously i would very much like to avoid using option 2) since i would have to maintain two almost identically controls. The problem with option 1) <em>as i see it</em> (perhaps i'm wrong?) Is that all the images on the site that are not supposed to be clickable will automaticly become clickable. Option 3) seems overly complicated as i would have to maintain state, events and building the link manually.</p> <p>I'm looking for a quick answer like 'you're stupid, just set property 'x' to false when you don't want it to be clickable' - but if i'm not mistaking it is not that obvious and ofcourse a more elaborate answer would be fine :)</p> <p>EDIT: Added the 3rd option - i forgot to put that there in the first place :)</p>
[ { "answer_id": 574473, "author": "Franklin", "author_id": 67517, "author_profile": "https://Stackoverflow.com/users/67517", "pm_score": 1, "selected": false, "text": "// Set the Client encryption level \n\"oracle.net.encryption_client\" = Service.getLevelString(level) \n\n// Set the Cl...
2008/10/24
[ "https://Stackoverflow.com/questions/232905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11619/" ]
232,926
<p>For instance, winsock libs works great across all versions of the visual studio. But I am having real trouble to provide a consistent binary across all the versions. The dll compiled with VS 2005 won't work when linked to an application written in 2008. I upgraded both 2k5 and 2k8 to SP1, but the results haven't changed much. It works some what ok. But when they include this with a C# app, the C# app gets access violation errors, but with classic C++ application it works fine.</p> <p>Is there a strategy that I should know when I provide dlls ?</p>
[ { "answer_id": 232959, "author": "Chris Becke", "author_id": 27491, "author_profile": "https://Stackoverflow.com/users/27491", "pm_score": 5, "selected": true, "text": " struct IExportedMethods {\n virtual long __stdcall AMethod(void)=0;\n };\n // with the win32 macros:\n interfac...
2008/10/24
[ "https://Stackoverflow.com/questions/232926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1781/" ]
232,933
<p>How do I multiply the values of a multi-dimensional array with weights and sum up the results into a new array in PHP or in general?</p> <p>The boring way looks like this:</p> <pre><code>$weights = array(0.25, 0.4, 0.2, 0.15); $values = array ( array(5,10,15), array(20,25,30), array(35,40,45), array(50,55,60) ); $result = array(); for($i = 0; $i &lt; count($values[0]); ++$i) { $result[$i] = 0; foreach($weights as $index =&gt; $thisWeight) $result[$i] += $thisWeight * $values[$index][$i]; } </code></pre> <p>Is there a more elegant solution?</p>
[ { "answer_id": 232963, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "foreach($values as $index => $ary )\n $result[$index] = array_sum($ary) * $weights[$index];\n" }, { "answer_id": ...
2008/10/24
[ "https://Stackoverflow.com/questions/232933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6260/" ]
232,934
<p>I want to subclass the built-in DropDownList in ASP.NET so that I can add functionality to it and use it in my pages. I tried doing this with a UserControl but found that it doesn't expose the internal DropDownList (logically, I guess). I've googled for the answer but can't find anything. </p> <p>I've come as far as writing the actual class, and it's possible to subclass from DropDownList but I'm unable to register the file in my ASP.NET page and use it in the source view. Maybe I'm missing some properties in my class?</p> <p>Any ideas?</p>
[ { "answer_id": 232972, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 5, "selected": true, "text": "namespace My.Namespace.Controls\n{\n[ToolboxData(\"<{0}:MyDropDownList runat=\\\"server\\\"></{0}:MyDropDownList>\")]...
2008/10/24
[ "https://Stackoverflow.com/questions/232934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614/" ]
232,935
<p>I want to find an SQL query to find rows where field1 does not contain $x. How can I do this?</p>
[ { "answer_id": 232942, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 5, "selected": false, "text": "SELECT * FROM table WHERE field1 NOT LIKE '%$x%';" }, { "answer_id": 232951, "author": "Vegard Larsen", "auth...
2008/10/24
[ "https://Stackoverflow.com/questions/232935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26823/" ]
232,938
<p>I have a .rc file which is used to include some text data in my executable, like this:</p> <pre><code>1234 RCDATA myfile.txt </code></pre> <p>This works fine: the content of the 'myfile.txt' is included in my executable. The problem is that no 0-terminator is added to the string, and I cannot add it to the file. Is there any way of adding a 0-terminator from within the .rc file? Something like this:</p> <pre><code>1234 RCDATA { myfile.txt, "\0" } // error RC2104 </code></pre> <p>Note that I already found this solution, but I am looking for something more elegant.</p> <pre><code>1234 RCDATA myfile.txt 1235 RCDATA { "\0" } </code></pre> <p>Thanks alot, eli</p>
[ { "answer_id": 232992, "author": "eugensk", "author_id": 17495, "author_profile": "https://Stackoverflow.com/users/17495", "pm_score": 3, "selected": true, "text": "makeZ myfile.txt myfileZ.txt\n" }, { "answer_id": 239279, "author": "bugmagnet", "author_id": 426, "aut...
2008/10/24
[ "https://Stackoverflow.com/questions/232938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12893/" ]
232,945
<p>I have an XML document which looks like this:</p> <pre><code>&lt;xconnect&gt; &lt;type&gt;OK&lt;/type&gt; &lt;response/&gt; &lt;report&gt; &lt;id&gt;suppressionlist_get&lt;/id&gt; &lt;name&gt;Suppression List Get&lt;/name&gt; &lt;timestamp&gt;24 Oct 08 @ 10:16AM&lt;/timestamp&gt; &lt;records type=\"user\"/&gt; &lt;records type=\"client\"/&gt; &lt;records type=\"group\"&gt; &lt;record&gt; &lt;email&gt;investorrelations@hfh.com&lt;/email&gt; &lt;type&gt;RECIPSELF&lt;/type&gt; &lt;long_type&gt;Recipient self suppressed&lt;/long_type&gt; &lt;created&gt;23 Oct 08 @ 8:53PM&lt;/created&gt; &lt;user&gt;facm&lt;/user&gt; &lt;/record&gt; </code></pre> <p>I have omitted the closing of the document for clarity and to keep this post short.</p> <p>Anyway, I have a GridView and I want to bind this XML to the GridView so I get table, like:</p> <pre><code>email | type | long | created | user ------------------------------------ data data data data data </code></pre> <p>And so forth.</p> <p>I was playing with DataSets and XMLDataDocuments and when stepping through, each attribute seemed to be represented as its own table in a data collection table.</p> <p>Any ideas on how to achieve the above? I thought it was as simple as just adding a GridView, and XML data source with the data file specified.</p> <p>Thanks</p>
[ { "answer_id": 232954, "author": "benPearce", "author_id": 4490, "author_profile": "https://Stackoverflow.com/users/4490", "pm_score": 0, "selected": false, "text": "DataSet.LoadXml()" }, { "answer_id": 7355097, "author": "jon3laze", "author_id": 399770, "author_profi...
2008/10/24
[ "https://Stackoverflow.com/questions/232945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30004/" ]
232,979
<p>I'm looking to get data such as Size/Capacity, Serial No, Model No, Heads Sectors, Manufacturer and possibly SMART data.</p>
[ { "answer_id": 232995, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 4, "selected": true, "text": "ManagementObject disk = new ManagementObject(\"win32_logicaldisk.deviceid=\\\"c:\\\"\"); \ndisk.Get(); \nConsole.Writ...
2008/10/24
[ "https://Stackoverflow.com/questions/232979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11538/" ]
232,982
<p>I'm looking to create an Intellij IDEA language support plugin for Erlang.</p> <p>The first and biggest problem I've had is in making the JFlex Erlang syntax definition.</p> <p>Does anyone know where can I get the EBNF or BNF for Erlang?</p>
[ { "answer_id": 240652, "author": "a2800276", "author_id": 27408, "author_profile": "https://Stackoverflow.com/users/27408", "pm_score": 1, "selected": false, "text": "lib/compiler/src/core_parse.yrl" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/232982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17375/" ]
232,986
<p>I am attempting to bind a WPF textbox's Maxlength property to a known constant deep within a class. I am using c#.</p> <p>The class has a structure not too dissimilar to the following:</p> <pre><code>namespace Blah { public partial class One { public partial class Two { public string MyBindingValue { get; set; } public static class MetaData { public static class Sizes { public const int Length1 = 10; public const int Length2 = 20; } } } } } </code></pre> <p>Yes it is deeply nested, but unfortunately in this instance I can't move things round very much without huge rewrites required.</p> <p>I was hoping I'd be able to bind the textbox MaxLength to the Length1 or Length2 values but I can't get it to work.</p> <p>I was expecting the binding to be something like the following:</p> <pre><code>&lt;Textbox Text="{Binding Path=MyBindingValue}" MaxLength="{Binding Path=Blah.One.Two.MetaData.Sizes.Length1}" /&gt; </code></pre> <p>Any help is appreciated.</p> <p>Many thanks</p>
[ { "answer_id": 232996, "author": "Joachim Kerschbaumer", "author_id": 20227, "author_profile": "https://Stackoverflow.com/users/20227", "pm_score": 0, "selected": false, "text": "{x:Static local:Sizes.Length1}\n" }, { "answer_id": 233017, "author": "Ash", "author_id": 311...
2008/10/24
[ "https://Stackoverflow.com/questions/232986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31128/" ]
232,997
<p>I have what is essentially a jagged array of name value pairs - i need to generate a set of unique name values from this. the jagged array is approx 86,000 x 11 values. It does not matter to me what way I have to store a name value pair (a single string "name=value" or a specialised class for example KeyValuePair).<br> <strong>Additional Info:</strong> There are 40 distinct names and a larger number of distinct values - probably in the region 10,000 values.</p> <p>I am using C# and .NET 2.0 (and the performance is so poor I am thinking that it may be better to push my entire jagged array into a sql database and do a select distinct from there).</p> <p>Below is the current code Im using:</p> <pre><code>List&lt;List&lt;KeyValuePair&lt;string,string&gt;&gt;&gt; vehicleList = retriever.GetVehicles(); this.statsLabel.Text = "Unique Vehicles: " + vehicleList.Count; Dictionary&lt;KeyValuePair&lt;string, string&gt;, int&gt; uniqueProperties = new Dictionary&lt;KeyValuePair&lt;string, string&gt;, int&gt;(); foreach (List&lt;KeyValuePair&lt;string, string&gt;&gt; vehicle in vehicleList) { foreach (KeyValuePair&lt;string, string&gt; property in vehicle) { if (!uniqueProperties.ContainsKey(property)) { uniqueProperties.Add(property, 0); } } } this.statsLabel.Text += "\rUnique Properties: " + uniqueProperties.Count; </code></pre>
[ { "answer_id": 233005, "author": "Eoin Campbell", "author_id": 30155, "author_profile": "https://Stackoverflow.com/users/30155", "pm_score": 0, "selected": false, "text": "Dictionary<System.Guid, KeyValuePair<string, string>> myDict \n = new Dictionary<Guid, KeyValuePair<string, string...
2008/10/24
[ "https://Stackoverflow.com/questions/232997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22100/" ]
233,009
<p>Ok: This is some of my table structure that matters here</p> <pre><code>CaseStudyID int Title nvarchar(50) OverrideTitle nvarchar(50) </code></pre> <p>Part of my procedure</p> <pre><code>Declare @Temp table(CaseStudyID int, Title nvarchar(50)) Insert Into @Temp SELECT CaseStudyID,Title FROM CaseStudy WHERE Visible = 1 AND DisplayOnHomePage = 1 ORDER BY Title Update @Temp Set Title = TitleOverride --Here is where im lost if the title occurs more than once --I need to replace it with the override --Schoolboy error or leaking brain I cant get it going Select * From @Temp </code></pre> <p>Can anyone help?</p>
[ { "answer_id": 233039, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 1, "selected": false, "text": "SELECT \n MIN(CaseStudyID) AS CaseStudyID, \n CASE WHEN count(*) = 1 THEN \n MIN(Title) \n ELSE\n MIN(...
2008/10/24
[ "https://Stackoverflow.com/questions/233009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11394/" ]
233,013
<p>I recently started learning Python and I was rather surprised to find a 1000 deep recursion limit (by default). If you set it high enough, about 30000, it crashes with a segmentation fault just like C. Although, C seems to go quite a lot higher.</p> <p>(The Python folks are quick to point out that you can always convert recursive functions to iterative ones and that they're always faster. That's 100% true. It's not really what my question is about though.)</p> <p>I tried the same experiment in Perl and somewhere around 10 million recursions it consumed all of my 4 gigs of ram and I used ^C to stop trying. Clearly Perl doesn't use the C stack, but it does use a ridiculous amount of memory when it recurses -- not terribly shocking considering how much work it has to do to call functions.</p> <p>I tried in Pike and was completely surprised to get 100,000,000 recursions in about 2 seconds. I have no idea how it did that, but I suspect it flattened the recursion to an iterative process -- it doesn't seem to consume any extra memory while it does it. [Note: Pike does flatten trivial cases, but segfaults on more complicated ones, or so I'm told.]</p> <p>I used these otherwise useless functions:</p> <pre><code>int f(int i, int l) { if(i&lt;l) return f(i+1,l); return i; } sub f { return f($_[0]+1, $_[1]) if $_[0]&lt;$_[1]; return $_[0] }; def f(i,l): if i&lt;l: return f(i+1,l) return i </code></pre> <p>I'm very curious how other languages (e.g., PHP, Ruby, Java, Lua, Ocaml, Haskell) handle recursion and why they handle it that way. Additionally, please note whether it makes a difference if the function is "tail-recursive" (see comment).</p>
[ { "answer_id": 233028, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "Fatal error: Maximum function nesting level of '100' reached, aborting!" }, { "answer_id": 233190, "author": "Phi...
2008/10/24
[ "https://Stackoverflow.com/questions/233013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/388466/" ]
233,026
<p>I have a database with a table which is full of conditions and error messages for checking another database.</p> <p>I want to run a loop such that each of these conditions is checked against all the tables in the second database and generae a report which gives the errors.</p> <p>Is this possible in ms access.</p> <p>For example,</p> <p>querycrit table</p> <pre><code>id query error 1 speed&lt;25 and speed&gt;56 speed above limit 2 dist&lt;56 or dist &gt;78 dist within limit </code></pre> <p>I have more than 400 queries like this of different variables.</p> <p>THe table against which I am running the queries is</p> <p>records table</p> <pre><code>id speed dist accce decele aaa bbb ccc 1 33 34 44 33 33 33 33 2 45 44 55 55 55 22 23 </code></pre> <p>regards ttk</p>
[ { "answer_id": 233136, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 0, "selected": false, "text": "Dim rs AS DAO.Recordset\nDim rs2 AS DAO.Recordset\n\nSet rs=CurrentDB.OpenRecordset(\"querycrit\")\n\nstrSQL=\"SELECT * Fr...
2008/10/24
[ "https://Stackoverflow.com/questions/233026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
233,072
<p><p>How to include any assembly code lines into my C program ? <p>In turbo c is there a possibility to add an assembly code file (.asm) to a project of few .c files?</p>
[ { "answer_id": 233090, "author": "xsl", "author_id": 11387, "author_profile": "https://Stackoverflow.com/users/11387", "pm_score": 3, "selected": true, "text": "void wrapper_function()\n{\n asm\n {\n /* your assembly code */\n }\n}\n" }, { "answer_id": 4147512, ...
2008/10/24
[ "https://Stackoverflow.com/questions/233072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31116/" ]
233,074
<p>Please could someone help me with writing a regex expression to replace 0044 token which will be at the start of the string with a 0. Please note that I do not want to replace all 0044 tokens with 0, only those that appear at the start of the string.</p> <p>Thanks a lot</p>
[ { "answer_id": 233076, "author": "Graeme Perrow", "author_id": 1821, "author_profile": "https://Stackoverflow.com/users/1821", "pm_score": 1, "selected": false, "text": "s/^0044/0/;\n" }, { "answer_id": 233442, "author": "David Santamaria", "author_id": 24097, "author...
2008/10/24
[ "https://Stackoverflow.com/questions/233074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
233,088
<p>The fundamental equation of weight loss/gain is:</p> <pre><code>weight_change = convert_to_weight_diff(calories_consumed - calories_burnt); </code></pre> <p>I'm going on a health kick, and like a good nerd I thought I'd start keeping track of these things and write some software to process my data. I'm not attentive and disciplined enough to count calories in food, so I thought I'd work backwards:</p> <ul> <li>I can weigh myself every day</li> <li>I can calculate my BMR and hence how many calories I burn doing nothing all day</li> <li>I can use my heart-rate monitor to figure out how many calories I burn doing exercise</li> </ul> <p>That way I can generate an approximate "calories consumed" graph based on my exercise and weight records, and use that to motivate myself when I'm tempted to have a donut.</p> <p>The thing I'm stuck on is the function:</p> <pre><code>int convert_to_weight_diff(int calorie_diff); </code></pre> <p>Anybody know the pseudo-code for that function? If you've got some details, make sure you specify if we're talking calories, Calories, kilojoules, pounds, kilograms, etc.</p> <p>Thanks! </p>
[ { "answer_id": 9695826, "author": "hetelek", "author_id": 877651, "author_profile": "https://Stackoverflow.com/users/877651", "pm_score": 1, "selected": false, "text": "int convert_to_weight_diff(int calories)\n{\n return 0.000000000000046 * calories;\n}\n" } ]
2008/10/24
[ "https://Stackoverflow.com/questions/233088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6408/" ]
233,113
<p>How do I get the type of a generic typed class within the class?</p> <p>An example:</p> <p>I build a generic typed collection implementing <em>ICollection&lt; T></em>. Within I have methods like </p> <pre><code> public void Add(T item){ ... } public void Add(IEnumerable&lt;T&gt; enumItems){ ... } </code></pre> <p>How can I ask within the method for the given type <em>T</em>?</p> <p>The reason for my question is: If <em>object</em> is used as <em>T</em> the collection uses Add(object item) instead of Add(IEnumerable&lt;object> enumItems) even if the parameter is IEnumerable. So in the first case it would add the whole enumerable collection as one object instead of multiple objects of the enumerable collection.</p> <p>So i need something like </p> <pre><code>if (T is object) { // Check for IEnumerable } </code></pre> <p>but of course that cannot work in C#. Suggestions?</p> <p>Thank you very much!</p> <p>Michael</p>
[ { "answer_id": 233120, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 5, "selected": false, "text": "typeof(T)" }, { "answer_id": 233146, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https:...
2008/10/24
[ "https://Stackoverflow.com/questions/233113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9470/" ]
233,127
<p>We have a function which a single thread calls into (we name this the main thread). Within the body of the function we spawn multiple worker threads to do CPU intensive work, wait for all threads to finish, then return the result on the main thread.</p> <p>The result is that the caller can use the function naively, and internally it'll make use of multiple cores.</p> <p><em>All good so far..</em></p> <p>The problem we have is dealing with exceptions. We don't want exceptions on the worker threads to crash the application. We want the caller to the function to be able to catch them on the main thread. We must catch exceptions on the worker threads and propagate them across to the main thread to have them continue unwinding from there.</p> <p><strong><em>How can we do this?</em></strong></p> <p>The best I can think of is:</p> <ol> <li>Catch a whole variety of exceptions on our worker threads (std::exception and a few of our own ones).</li> <li>Record the type and message of the exception.</li> <li>Have a corresponding switch statement on the main thread which rethrows exceptions of whatever type was recorded on the worker thread.</li> </ol> <p>This has the obvious disadvantage of only supporting a limited set of exception types, and would need modification whenever new exception types were added.</p>
[ { "answer_id": 233206, "author": "n-alexander", "author_id": 23420, "author_profile": "https://Stackoverflow.com/users/23420", "pm_score": 2, "selected": false, "text": "try\n{\n start thread();\n wait_finish( thread );\n}\ncatch(...)\n{\n // will catch exceptions generated within sta...
2008/10/24
[ "https://Stackoverflow.com/questions/233127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/755/" ]