qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
48,397
<p>Is there a redistributable .Net 3.5 installation package that is a silent installer? </p> <p>Or alternatively, is there a switch that can be passed to the main redistributable .Net 3.5 installer to make it silent?</p>
[ { "answer_id": 59395072, "author": "Jean Fiedler", "author_id": 7761893, "author_profile": "https://Stackoverflow.com/users/7761893", "pm_score": -1, "selected": false, "text": "DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:\"Path\\To\\microsoft-windows-netfx...
2008/09/07
[ "https://Stackoverflow.com/questions/48397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
48,426
<p>My gcc build toolchain produces a .map file. How do I display the memory map graphically?</p>
[ { "answer_id": 112078, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 6, "selected": true, "text": "sections" }, { "answer_id": 35893722, "author": "Sredni", "author_id": 1761205, "author_profile": "ht...
2008/09/07
[ "https://Stackoverflow.com/questions/48426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445087/" ]
48,432
<p>Being relatively new to the .net game, I was wondering, has anyone had any experience of the pros / cons between the use of LINQ and what could be considered more traditional methods working with lists / collections? </p> <p>For a specific example of a project I'm working on : a list of unique id / name pairs are being retrieved from a remote web-service.</p> <ul> <li>this list will change infrequently (once per day), </li> <li>will be read-only from the point of view of the application where it is being used</li> <li>will be stored at the application level for all requests to access</li> </ul> <p>Given those points, I plan to store the returned values at the application level in a singleton class.</p> <p>My initial approach was to iterate through the list returned from the remote service and store it in a NameValueCollection in a singleton class, with methods to retrieve from the collection based on an id:</p> <pre><code>sugarsoap soapService = new sugarsoap(); branch_summary[] branchList = soapService.getBranches(); foreach (branch_summary aBranch in branchList) { branchNameList.Add(aBranch.id, aBranch.name); } </code></pre> <p>The alternative using LINQ is to simply add a method that works on the list directly once it has been retrieved:</p> <pre><code>public string branchName (string branchId) { //branchList populated in the constructor branch_summary bs = from b in branchList where b.id == branchId select b; return branch_summary.name; } </code></pre> <p>Is either better than the other - is there a third way? I'm open to all answers, for both approaches and both in terms of solutions that offer elegance, and those which benefit performance.</p>
[ { "answer_id": 48545, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 3, "selected": true, "text": "public string branchName (string branchId) \n{\n //branchList populated in the constructor\n branch_summary bs = (fro...
2008/09/07
[ "https://Stackoverflow.com/questions/48432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4396/" ]
48,442
<p>Anyone have a good rule of thumb for choosing between different implementations of Java Collection interfaces like List, Map, or Set?</p> <p>For example, generally why or in what cases would I prefer to use a Vector or an ArrayList, a Hashtable or a HashMap?</p>
[ { "answer_id": 48525, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 4, "selected": false, "text": "ArrayList" }, { "answer_id": 59806362, "author": "Basil Bourque", "author_id": 642706, "author_profil...
2008/09/07
[ "https://Stackoverflow.com/questions/48442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1294/" ]
48,446
<p>How do you schedule a Windows Mobile application to periodically start up to perform some background processing. For example, assume I'm writing an email client and want to check for email every hour, regardless of whether my app is running at the time.</p> <p>The app is a native C/C++ app on Windows Mobile 5.0 or later.</p>
[ { "answer_id": 48466, "author": "quick_dry", "author_id": 3716, "author_profile": "https://Stackoverflow.com/users/3716", "pm_score": 3, "selected": true, "text": "CeRunAppAtTime( appname, time )" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2716/" ]
48,458
<p>I started an application in Google App Engine right when it came out, to play with the technology and work on a pet project that I had been thinking about for a long time but never gotten around to starting. The result is <a href="http://www.bowlsk.com" rel="noreferrer">BowlSK</a>. However, as it has grown, and features have been added, it has gotten really difficult to keep things organized - mainly due to the fact that this is my first python project, and I didn't know anything about it until I started working.</p> <p>What I have:</p> <ul> <li>Main Level contains: <ul> <li>all .py files (didn't know how to make packages work)</li> <li>all .html templates for main level pages</li> </ul></li> <li>Subdirectories: <ul> <li>separate folders for css, images, js, etc.</li> <li>folders that hold .html templates for subdirecty-type urls</li> </ul></li> </ul> <p>Example:<br/> <a href="http://www.bowlsk.com/" rel="noreferrer">http://www.bowlsk.com/</a> maps to HomePage (default package), template at "index.html"<br/> <a href="http://www.bowlsk.com/games/view-series.html?series=7130" rel="noreferrer">http://www.bowlsk.com/games/view-series.html?series=7130</a> maps to ViewSeriesPage (again, default package), template at "games/view-series.html"</p> <p>It's nasty. How do I restructure? I had 2 ideas:</p> <ul> <li><p>Main Folder containing: appdef, indexes, main.py?</p> <ul> <li>Subfolder for code. Does this have to be my first package?</li> <li>Subfolder for templates. Folder heirarchy would match package heirarchy</li> <li>Individual subfolders for css, images, js, etc.</li> </ul></li> <li><p>Main Folder containing appdef, indexes, main.py?</p> <ul> <li>Subfolder for code + templates. This way I have the handler class right next to the template, because in this stage, I'm adding lots of features, so modifications to one mean modifications to the other. Again, do I have to have this folder name be the first package name for my classes? I'd like the folder to be "src", but I don't want my classes to be "src.WhateverPage"</li> </ul></li> </ul> <p>Is there a best practice? With Django 1.0 on the horizon, is there something I can do now to improve my ability to integrate with it when it becomes the official GAE templating engine? I would simply start trying these things, and seeing which seems better, but pyDev's refactoring support doesn't seem to handle package moves very well, so it will likely be a non-trivial task to get all of this working again.</p>
[ { "answer_id": 70271, "author": "fuentesjr", "author_id": 10708, "author_profile": "https://Stackoverflow.com/users/10708", "pm_score": 8, "selected": true, "text": "import wsgiref.handlers\n\nfrom google.appengine.ext import webapp\nfrom myapp.views import *\n\napplication = webapp.WSGI...
2008/09/07
[ "https://Stackoverflow.com/questions/48458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96/" ]
48,470
<p>Whenever I use a macro in Visual Studio I get an annoying tip balloon in the system tray and an accompanying "pop" sound. It says:</p> <blockquote> <p>Visual Studio .NET macros</p> <p>To stop the macro from running, double-click the spinning cassette.<br> Click here to not show this balloon again.</p> </blockquote> <p>I have trouble clicking the balloon because my macro runs so quickly.</p> <p>Is this controllable by some dialog box option?</p> <p>(I found someone else asking this question on <a href="http://www.tech-archive.net/Archive/VisualStudio/microsoft.public.vsnet.ide/2005-11/msg00267.html" rel="noreferrer">some other site</a> but it's not answered there. I give credit here because I've copied and pasted some pieces from there.)</p>
[ { "answer_id": 48478, "author": "Owen", "author_id": 4790, "author_profile": "https://Stackoverflow.com/users/4790", "pm_score": 2, "selected": false, "text": "System.Threading.Thread.Sleep(2000)\n" }, { "answer_id": 296494, "author": "Community", "author_id": -1, "au...
2008/09/07
[ "https://Stackoverflow.com/questions/48470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4790/" ]
48,474
<p>I'm a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with a red square in the upper right corner of the blue square (but not tight in the corner). I am trying to avoid compositing (with ImageMagick and similar) due to performance issues.</p> <p>I just want to position overlapping images relative to one another.</p> <p>As a more difficult example, imagine an odometer placed inside a larger image. For six digits, I would need to composite a million different images, or do it all on the fly, where all that is needed is to place the six images on top of the other one.</p>
[ { "answer_id": 48484, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 6, "selected": false, "text": "img {\n position: absolute;\n top: 25px;\n left: 25px;\n}\n.imgA1 {\n z-index: 1;\n}\n.imgB1 {\n z-index: 3;\n}" }, { ...
2008/09/07
[ "https://Stackoverflow.com/questions/48474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5038/" ]
48,475
<p>How would you design a database to support the following tagging features:</p> <ul> <li>items can have a large number of tags</li> <li>searches for all items that are tagged with a given set of tags must be quick (the items must have ALL tags, so it's an AND-search, not an OR-search)</li> <li>creating/writing items may be slower to enable quick lookup/reading</li> </ul> <p>Ideally, the lookup of all items that are tagged with (at least) a set of n given tags should be done using a single SQL statement. Since the number of tags to search for as well as the number of tags on any item are unknown and may be high, using JOINs is impractical.</p> <p>Any ideas?</p> <hr> <p>Thanks for all the answers so far.</p> <p>If I'm not mistaken, however, the given answers show how to do an OR-search on tags. (Select all items that have one or more of n tags). I am looking for an efficient AND-search. (Select all items that have ALL n tags - and possibly more.)</p>
[ { "answer_id": 48480, "author": "Slartibartfast", "author_id": 4433, "author_profile": "https://Stackoverflow.com/users/4433", "pm_score": 4, "selected": false, "text": "SELECT * FROM items WHERE id IN \n (SELECT DISTINCT item_id FROM item_tag WHERE \n tag_id = tag1 OR tag_id = t...
2008/09/07
[ "https://Stackoverflow.com/questions/48475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5035/" ]
48,491
<p>I have two machines, speed and mass. speed has a fast Internet connection and is running a crawler which downloads a lot of files to disk. mass has a lot of disk space. I want to move the files from speed to mass after they're done downloading. Ideally, I'd just run:</p> <pre><code>$ rsync --remove-source-files speed:/var/crawldir . </code></pre> <p>but I worry that rsync will unlink a source file that hasn't finished downloading yet. (I looked at the source code and I didn't see anything protecting against this.) Any suggestions?</p>
[ { "answer_id": 48517, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 3, "selected": false, "text": "mass" }, { "answer_id": 48628, "author": "Grey Panther", "author_id": 1265, "author_profile": "https:...
2008/09/07
[ "https://Stackoverflow.com/questions/48491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4300/" ]
48,497
<p>The following XHTML code is not working:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;link rel="stylesheet" type="text/css" href="/dojotoolkit/dijit/themes/tundra/tundra.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="/dojotoolkit/dojo/resources/dojo.css" /&gt; &lt;script type="text/javascript" src="/dojotoolkit/dojo/dojo.js" djConfig="parseOnLoad: true" /&gt; &lt;script type="text/javascript"&gt; dojo.require("dijit.form.ValidationTextBox"); dojo.require("dojo.parser"); &lt;/script&gt; &lt;/head&gt; &lt;body class="nihilo"&gt; &lt;input type="text" dojoType="dijit.form.ValidationTextBox" size="30" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In Firebug I get the following error message:</p> <blockquote> <p>[Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: <a href="http://localhost:21000/dojotoolkit/dojo/dojo.js" rel="nofollow noreferrer">http://localhost:21000/dojotoolkit/dojo/dojo.js</a> :: anonymous :: line 319" data: no] <a href="http://localhost:21000/dojotoolkit/dojo/dojo.js" rel="nofollow noreferrer">http://localhost:21000/dojotoolkit/dojo/dojo.js</a> Line 319</p> </blockquote> <p>Any idea what is wrong?</p>
[ { "answer_id": 48554, "author": "Brian Gianforcaro", "author_id": 3415, "author_profile": "https://Stackoverflow.com/users/3415", "pm_score": 1, "selected": false, "text": "<script type=\"text/javascript\" src=\"/dojotoolkit/dojo/dojo.js\" djConfig=\"parseOnLoad: true\"/>\n" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4875/" ]
48,505
<p>Does anyone know of a similar product to Citrix Server that'll run on the Mac OS?</p> <p>Essentially, I'm looking to allow multiple remote users to log in to the same OSX Server at the same time (with full visual desktop, not SSH).</p>
[ { "answer_id": 48729, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 2, "selected": true, "text": "@Soeren Kuklau" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1902010/" ]
48,521
<p>I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ?</p> <p>The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the question though.</p>
[ { "answer_id": 48522, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 4, "selected": true, "text": "DataBindObject.DataSource = new List<YourObject>().Add(YourObjectInstance);\n" }, { "answer_id": 48523, "author": ...
2008/09/07
[ "https://Stackoverflow.com/questions/48521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4694/" ]
48,526
<p>I've been looking into different web statistics programs for my site, and one promising one is <a href="http://www.hping.org/visitors/" rel="nofollow noreferrer">Visitors</a>. Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's <a href="http://us.php.net/manual/en/function.shell-exec.php" rel="nofollow noreferrer">shell_exec</a>, but my web host (<a href="https://www.nearlyfreespeech.net/" rel="nofollow noreferrer">NFSN</a>) has PHP's <a href="http://us2.php.net/features.safe-mode" rel="nofollow noreferrer">safe mode</a> on and it's giving me an error message.</p> <p>Is there a way to execute the program within safe mode? If not, can it work with CGI? If so, how? (I've never used CGI before)</p>
[ { "answer_id": 48721, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 1, "selected": true, "text": "#!/bin/sh\n\nprintf \"Content-type: text/html\\n\\n\"\nexec visitors -A /home/logs/access_log\n" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658/" ]
48,550
<p>I am trying to publish an Asp.net MVC web application locally using the NAnt and MSBuild. This is what I am using for my NAnt target;</p> <pre><code>&lt;target name="publish-artifacts-to-build"&gt; &lt;msbuild project="my-solution.sln" target="Publish"&gt; &lt;property name="Configuration" value="debug" /&gt; &lt;property name="OutDir" value="builds\" /&gt; &lt;arg line="/m:2 /tv:3.5" /&gt; &lt;/msbuild&gt; &lt;/target&gt; </code></pre> <p>and all I get is this as a response;</p> <pre><code>[msbuild] Skipping unpublishable project. </code></pre> <p>Is it possible to publish web applications via the command line in this way?</p>
[ { "answer_id": 6762142, "author": "Alexander Beletsky", "author_id": 386751, "author_profile": "https://Stackoverflow.com/users/386751", "pm_score": 4, "selected": false, "text": "msbuild /t:ResolveReferences;_WPPCopyWebApplication /p:BuildingProject=true;OutDir=C:\\Temp\\buidl\\ Test.cs...
2008/09/07
[ "https://Stackoverflow.com/questions/48550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4642/" ]
48,555
<p>I have a few sites on a shared host that is running Apache 2. I would like to compress the HTML, CSS and Javascript that is delivered to the browser. The host has disabled mod_deflate and mod_gzip, so these options are out. I do have PHP 5 at my disposal, though, so I could use the gzip component of that.</p> <p>I am currently placing the following in my .htaccess file:</p> <blockquote> <p>php_value output_handler ob_gzhandler</p> </blockquote> <p>However, this only compresses the HTML and leaves out the CSS and JS.</p> <p>Is there a reliable way of transparently compressing the output of the CSS and JS without having to change every page? I have searched Google and a number of solutions are presented, but I've yet to get one to work. If anyone could suggest a solution that they know to work, that would be very gratefully received.</p> <p>Note, <strong>Method 2</strong> in <strong><a href="http://www.fiftyfoureleven.com/weblog/web-development/css/the-definitive-css-gzip-method" rel="noreferrer">The Definitive Post on Gzipping your CSS</a></strong> looks like a good solution, but I couldn't get it working. Has anyone else succeeded using this method?</p>
[ { "answer_id": 48583, "author": "macbirdie", "author_id": 5049, "author_profile": "https://Stackoverflow.com/users/5049", "pm_score": 1, "selected": false, "text": "$_SERVER['QUERY_STRING']" }, { "answer_id": 48592, "author": "Sören Kuklau", "author_id": 1600, "author...
2008/09/07
[ "https://Stackoverflow.com/questions/48555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1944/" ]
48,562
<p>I was wondering if anyone here had some experience writing this type of script and if they could give me some pointers.</p> <p>I would like to modify this <a href="http://wordaligned.org/articles/a-subversion-pre-commit-hook" rel="nofollow noreferrer">script</a> to validate that the check-in file does not have a Carriage Return in the EOL formatting. The EOL format is CR LF in Windows and LF in Unix. When a User checks-in code with the Windows format. It does not compile in Unix anymore. I know this can be done on the client side but I need to have this validation done on the server side. To achieve this, I need to do the following:</p> <p>1) Make sure the file I check is not a binary, I dont know how to do this with svnlook, should I check the mime:type of the file? The <a href="http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html" rel="nofollow noreferrer">Red Book</a> does not indicate this clearly or I must have not seen it.</p> <p>2) I would like to run the <a href="http://linux.about.com/od/commands/l/blcmdl1_dos2uni.htm" rel="nofollow noreferrer">dos2unix</a> command to validate that the file has the correct EOL format. I would compare the output of the dos2unix command against the original file. If there is a diff between both, I give an error message to the client and cancel the check-in.</p> <p>I would like your comments/feedback on this approach.</p>
[ { "answer_id": 50507, "author": "Stephen Johnson", "author_id": 5063, "author_profile": "https://Stackoverflow.com/users/5063", "pm_score": 3, "selected": true, "text": "svn:eol-style" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5060/" ]
48,567
<p>I wrote a simple Windows Forms program in C#. I want to be able to input a windows user name and password and when I click a login button to run code run as the user I've entered as input.</p>
[ { "answer_id": 48571, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 3, "selected": true, "text": "// This sample demonstrates the use of the WindowsIdentity class to impersonate a user.\n// IMPORTANT NOTES:\n// This sample can ...
2008/09/07
[ "https://Stackoverflow.com/questions/48567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1360/" ]
48,570
<p>I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically, some resource-intensive calls that get queued, cached and dispatched when the underlying system gets around to it. When the asynchronous call finally receives a response I would like a callback event to be raised.</p> <p>I am having some problems coming up with a mechanism to do callbacks in PHP. I have come up with a method that works for now but I am unhappy with it. Basically, it involves passing a reference to the object and the name of the method on it that will serve as the callback (taking the response as an argument) and then use eval to call the method when need be. This is sub-optimal for a variety of reasons, is there a better way of doing this that anyone knows of? </p>
[ { "answer_id": 48585, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 2, "selected": false, "text": "// This function uses a callback function. \nfunction doIt($callback) \n{ \n $data = \"this is my data\";\n $ca...
2008/09/07
[ "https://Stackoverflow.com/questions/48570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
48,578
<p>Not entirely sure what's going on here; any help would be appreciated.</p> <p>I'm trying to create a new .NET MVC web app. I was pretty sure I had it set up correctly, but I'm getting the following error:</p> <pre><code>The type 'System.Web.Mvc.ViewPage' is ambiguous: it could come from assembly 'C:\MyProject\bin\System.Web.Mvc.DLL' or from assembly 'C:\MyProject\bin\MyProject.DLL'. Please specify the assembly explicitly in the type name. </code></pre> <p>The source error it reports is as follows:</p> <pre><code>Line 1: &lt;%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %&gt; Line 2: Line 3: &lt;asp:Content ID="indexContent" ContentPlaceHolderID="MainContentPlaceHolder" runat="server"&gt; </code></pre> <p>Anything stand out that I'm doing completely wrong?</p>
[ { "answer_id": 48589, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 1, "selected": false, "text": " Inherits=\"System.Web.Mvc.ViewPage\"\n" }, { "answer_id": 48594, "author": "Dale Ragan", "author_id": 1117, ...
2008/09/07
[ "https://Stackoverflow.com/questions/48578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1540/" ]
48,605
<p>Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first "constructed" did not seem to share a relationship. </p> <p>However, whenever I see architects design an application, the first thing they do is start programming to an interface. How come? How do you know all the relationships between objects that will occur within that interface? If you already know those relationships, then why not just extend an abstract class?</p>
[ { "answer_id": 48611, "author": "Brian Warshaw", "author_id": 1344, "author_profile": "https://Stackoverflow.com/users/1344", "pm_score": 6, "selected": true, "text": "IPoweredByMotor" }, { "answer_id": 48624, "author": "Eugene Yokota", "author_id": 3827, "author_prof...
2008/09/07
[ "https://Stackoverflow.com/questions/48605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
48,616
<p>How do I set a property of a user control in <code>ListView</code>'s <code>LayoutTemplate</code> from the code-behind?</p> <pre><code>&lt;asp:ListView ...&gt; &lt;LayoutTemplate&gt; &lt;myprefix:MyControl id="myControl" ... /&gt; &lt;/LayoutTemplate&gt; ... &lt;/asp:ListView&gt; </code></pre> <p>I want to do this:</p> <pre><code>myControl.SomeProperty = somevalue; </code></pre> <p>Please notice that my control is not in <code>ItemTemplate</code>, it is in <code>LayoutTemplate</code>, so it does not exist for all items, it exists only once. So I should be able to access it once, not for every data bound item.</p>
[ { "answer_id": 48636, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 1, "selected": false, "text": "var control = (MyControl)Item.FindControl(\"yourControlId\");\n" }, { "answer_id": 1315742, "author": "Community"...
2008/09/07
[ "https://Stackoverflow.com/questions/48616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
48,642
<p>I want to write a command that specifies "the word under the cursor" in VIM. For instance, let's say I have the cursor on a word and I make it appear twice. For instance, if the word is "abc" and I want "abcabc" then I could type: </p> <pre><code>:s/\(abc\)/\1\1/ </code></pre> <p>But then I'd like to be able to move the cursor to "def" and use the same command to change it to "defdef": </p> <pre><code>:s/\(def\)/\1\1/ </code></pre> <p>How can I write the command in the commandline so that it does this?</p> <pre><code>:s/\(*whatever is under the commandline*\)/\1\1 </code></pre>
[ { "answer_id": 48657, "author": "hazzen", "author_id": 5066, "author_profile": "https://Stackoverflow.com/users/5066", "pm_score": 7, "selected": true, "text": "<cword>" }, { "answer_id": 76316, "author": "Community", "author_id": -1, "author_profile": "https://Stacko...
2008/09/07
[ "https://Stackoverflow.com/questions/48642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1084/" ]
48,647
<p>I came across <a href="http://www.ddj.com/cpp/184403758" rel="noreferrer">this article</a> written by Andrei Alexandrescu and Petru Marginean many years ago, which presents and discusses a utility class called ScopeGuard for writing exception-safe code. I'd like to know if coding with these objects truly leads to better code or if it obfuscates error handling, in that perhaps the guard's callback would be better presented in a catch block? Does anyone have any experience using these in actual production code?</p>
[ { "answer_id": 48663, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 7, "selected": true, "text": "catch" }, { "answer_id": 48786, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": ...
2008/09/07
[ "https://Stackoverflow.com/questions/48647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4928/" ]
48,668
<p>I've seen lots of descriptions how anonymous types work, but I'm not sure how they're really useful. What are some scenarios that anonymous types can be used to address in a well-designed program?</p>
[ { "answer_id": 48677, "author": "George Mauer", "author_id": 5056, "author_profile": "https://Stackoverflow.com/users/5056", "pm_score": 3, "selected": false, "text": "var pl = new List<Object>();\nforeach(var p in Process.GetProcesses())\n pl.Add(new {p.Id, p.ProcessName, Memory=p.Work...
2008/09/07
[ "https://Stackoverflow.com/questions/48668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
48,669
<p>I receive HTML pages from our creative team, and then use those to build aspx pages. One challenge I frequently face is getting the HTML I spit out to match theirs exactly. I almost always end up screwing up the nesting of <code>&lt;div&gt;</code>s between my page and the master pages.</p> <p>Does anyone know of a tool that will help in this situation -- something that will compare 2 pages and output the structural differences? I can't use a standard diff tool, because IDs change from what I receive from creative, text replaces <i>lorem ipsum</i>, etc.. </p>
[ { "answer_id": 49348, "author": "Peter Hilton", "author_id": 2670, "author_profile": "https://Stackoverflow.com/users/2670", "pm_score": 3, "selected": false, "text": "tidy -asxml index.html\n" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2757/" ]
48,679
<p>Anybody know of a way to copy a file from path A to path B and suppressing the Windows file system cache?<br> Typical use is copying a large file from a USB drive, or server to your local machine. Windows seems to swap everything out if the file is really big, e.g. 2GiB. Prefer example in C#, but I'm guessing this would be a Win32 call of some sort if possible.</p>
[ { "answer_id": 6198881, "author": "nietras", "author_id": 98692, "author_profile": "https://Stackoverflow.com/users/98692", "pm_score": 3, "selected": false, "text": " public static byte[] ReadAllBytesUnbuffered(string filePath)\n {\n const FileOptions FileFlagNoBuffering = ...
2008/09/07
[ "https://Stackoverflow.com/questions/48679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5080/" ]
48,680
<p>Say I have a <code>Textbox</code> nested within a <code>TabControl</code>. </p> <p>When the form loads, I would like to focus on that <code>Textbox</code> (by default the focus is set to the <code>TabControl</code>).</p> <p>Simply calling <code>textbox1.focus()</code> in the <code>Load</code> event of the form does not appear to work. </p> <p>I have been able to focus it by doing the following:</p> <pre><code> private void frmMainLoad(object sender, EventArgs e) { foreach (TabPage tab in this.tabControl1.TabPages) { this.tabControl1.SelectedTab = tab; } } </code></pre> <p><strong>My question is:</strong></p> <p>Is there a more elegant way to do this?</p>
[ { "answer_id": 48719, "author": "samjudson", "author_id": 1908, "author_profile": "https://Stackoverflow.com/users/1908", "pm_score": 7, "selected": true, "text": "private void frmMainLoad(object sender, EventArgs e)\n{\n ActiveControl = textBox1;\n}\n" }, { "answer_id": 63485...
2008/09/07
[ "https://Stackoverflow.com/questions/48680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1736/" ]
48,744
<h2>How do you find the phone numbers in 50,000 HTML pages?<br><br></h2> <blockquote> <h3>Jeff Attwood posted 5 Questions for programmers applying for jobs:</h3> <p>In an effort to make life simpler for phone screeners, I've put together this list of Five Essential Questions that you need to ask during an SDE screen. They won't guarantee that your candidate will be great, but they will help eliminate a huge number of candidates who are slipping through our process today.</p> <p><strong>1) Coding</strong> The candidate has to write some simple code, with correct syntax, in C, C++, or Java.</p> <p><strong>2) OO design</strong> The candidate has to define basic OO concepts, and come up with classes to model a simple problem.</p> <p><strong>3) Scripting and regexes</strong> The candidate has to describe how to find the phone numbers in 50,000 HTML pages.</p> <p><strong>4) Data structures</strong> The candidate has to demonstrate basic knowledge of the most common data structures.</p> <p><strong>5) Bits and bytes</strong> The candidate has to answer simple questions about bits, bytes, and binary numbers.</p> <p>Please understand: what I'm looking for here is a total vacuum in one of these areas. It's OK if they struggle a little and then figure it out. It's OK if they need some minor hints or prompting. I don't mind if they're rusty or slow. What you're looking for is candidates who are utterly clueless, or horribly confused, about the area in question.</p> <p><strong><a href="http://www.codinghorror.com/blog/archives/001042.html" rel="noreferrer">>>> The Entirety of Jeff´s Original Post &lt;&lt;&lt;</a></strong></p> </blockquote> <p><br> <strong>Note:</strong> Steve Yegge originally posed the Question.</p>
[ { "answer_id": 48767, "author": "Ande Turner", "author_id": 4857, "author_profile": "https://Stackoverflow.com/users/4857", "pm_score": 1, "selected": false, "text": "#!/usr/bin/perl\nwhile (<*.html>) {\n my $filename = $_;\n my @data = <$filename>;\n\n # Loop once through w...
2008/09/07
[ "https://Stackoverflow.com/questions/48744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4857/" ]
48,772
<p>I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far:</p> <pre><code>drop table exams; drop table question_bank; drop table anwser_bank; create table exams ( exam_id uniqueidentifier primary key, exam_name varchar(50), ); create table question_bank ( question_id uniqueidentifier primary key, question_exam_id uniqueidentifier not null, question_text varchar(1024) not null, question_point_value decimal, constraint question_exam_id foreign key references exams(exam_id) ); create table anwser_bank ( anwser_id uniqueidentifier primary key, anwser_question_id uniqueidentifier, anwser_text varchar(1024), anwser_is_correct bit ); </code></pre> <p>When I run the query I get this error:</p> <blockquote> <p>Msg 8139, Level 16, State 0, Line 9 Number of referencing columns in foreign key differs from number of referenced columns, table 'question_bank'.</p> </blockquote> <p>Can you spot the error?</p>
[ { "answer_id": 48778, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 9, "selected": true, "text": "create table question_bank\n(\n question_id uniqueidentifier primary key,\n question_exam_id uniqueidentifier not nul...
2008/09/07
[ "https://Stackoverflow.com/questions/48772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
48,773
<p>I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called "ResponseData", so I can track exactly what my code couldn't handle.</p> <p>In custom exceptions such as this one, should that extra response data go into the exception "message"? If it goes there, the message could be huge. I kind of want it there because I'm using Elmah, and that's how I can get at that data.</p> <p>So the question is either: - How can I get Elmah to record extra information from a field in a custom exception OR - Should extra exception details go into the "message" property?</p>
[ { "answer_id": 48792, "author": "Sören Kuklau", "author_id": 1600, "author_profile": "https://Stackoverflow.com/users/1600", "pm_score": 4, "selected": true, "text": ".Message" }, { "answer_id": 155606, "author": "Atif Aziz", "author_id": 6682, "author_profile": "http...
2008/09/07
[ "https://Stackoverflow.com/questions/48773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
48,774
<p>What's the "right" way to do the following as a boolean expression?</p> <pre><code>for i in `ls $1/resources`; do if [ $i != "database.db" ] then if [ $i != "tiles" ] then if [ $i != "map.pdf" ] then if [ $i != "map.png" ] then svn export -q $1/resources/$i ../MyProject/Resources/$i ... </code></pre>
[ { "answer_id": 48787, "author": "frizz", "author_id": 1003, "author_profile": "https://Stackoverflow.com/users/1003", "pm_score": 1, "selected": false, "text": "for i in `ls $1/resources`; do\n if [ $i != \"database.db\" ] && [ $i != \"tiles\" ] && [ $i != \"map.pdf\" ] && [ $i != \"m...
2008/09/07
[ "https://Stackoverflow.com/questions/48774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/79/" ]
48,794
<p>Here is a scenario: Let's say I have site with two controllers responsible for displaying different type of content - Pages and Articles. I need to embed Partial View into my masterpage that will list pages and articles filtered with some criteria, and be displayed on each page. I cannot set Model on my masterpage (am I right?). How do I solve this task using Html.RenderPartial?</p> <p>[EDIT] Yes, I'd probably create separate partial views for listing articles and pages, but still, there is a barrier that I cannot and shouldn't set model on masterpage. I need somehow to say "here are the pages" as an argument to my renderpartial, and also for articles. Entire concept of renderpartial with data from database in masterpages is a bit blurry to me.</p>
[ { "answer_id": 919625, "author": "user113588", "author_id": 113588, "author_profile": "https://Stackoverflow.com/users/113588", "pm_score": 2, "selected": false, "text": " public static void RenderPartialAction<TController>(this HtmlHelper helper, Func<TController, PartialViewResult> act...
2008/09/07
[ "https://Stackoverflow.com/questions/48794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/481/" ]
48,805
<p>Some e-Marketing tools claim to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.</p> <p>I know you can get the immediate preceding page with HTTP_REFERRER, but how do you know where they were 6 sites ago? </p>
[ { "answer_id": 5494272, "author": "heymatthew", "author_id": 81271, "author_profile": "https://Stackoverflow.com/users/81271", "pm_score": 3, "selected": false, "text": "document.referrer" } ]
2008/09/07
[ "https://Stackoverflow.com/questions/48805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2757/" ]
48,872
<p>In <a href="https://web.archive.org/web/20141127115939/https://blogs.msmvps.com/kathleen/2008/09/05/in-praise-of-nested-classes/" rel="noreferrer">Kathleen Dollard's 2008 blog post</a>, she presents an interesting reason to use nested classes in .net. However, she also mentions that FxCop doesn't like nested classes. I'm assuming that the people writing FxCop rules aren't stupid, so there must be reasoning behind that position, but I haven't been able to find it.</p>
[ { "answer_id": 48879, "author": "hazzen", "author_id": 5066, "author_profile": "https://Stackoverflow.com/users/5066", "pm_score": 8, "selected": true, "text": "public class SortedMap {\n private class TreeNode {\n TreeNode left;\n TreeNode right;\n }\n}\n" }, { ...
2008/09/07
[ "https://Stackoverflow.com/questions/48872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100/" ]
48,884
<p>What Python libraries do folks use for querying Amazon product data? (Amazon Associates Web Service - used to be called E-Commerce API, or something along those lines).</p> <p>Based on my research, <a href="http://pyaws.sourceforge.net/" rel="noreferrer">PyAWS</a> seems okay, but still pretty raw (and hasn't been updated in a while). Wondering if there's an obvious canonical library that I'm just missing.</p>
[ { "answer_id": 4251893, "author": "tobych", "author_id": 76452, "author_profile": "https://Stackoverflow.com/users/76452", "pm_score": 5, "selected": false, "text": "ACCESS_KEY_ID = \"...\"\nSECRET_KEY = \"...\"\nASSOC_TAG = \"...\"\n\nimport bottlenose\namazon = bottlenose.Amazon(ACCESS...
2008/09/07
[ "https://Stackoverflow.com/questions/48884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2678/" ]
48,908
<p>I am a bit confused about socket programming in C.</p> <p>You create a socket, bind it to an interface and an IP address and get it to listen. I found a couple of web resources on that, and understood it fine. In particular, I found an article <s><a href="http://users.actcom.co.il/~choo/lupg/tutorials/internetworking/internet-theory.html" rel="nofollow noreferrer">Network programming under Unix systems</a></s> to be very informative.</p> <p>What confuses me is the timing of data arriving on the socket.</p> <p>How can you tell when packets arrive, and how big the packet is, do you have to do all the heavy lifting yourself? </p> <p>My basic assumption here is that packets can be of variable length, so once binary data starts appearing down the socket, how do you begin to construct packets from that?</p>
[ { "answer_id": 48929, "author": "dfjacobs", "author_id": 4848, "author_profile": "https://Stackoverflow.com/users/4848", "pm_score": 5, "selected": true, "text": "/* buffer points to memory block that is bigger than the number of bytes to be read */\n/* socket is open socket that is conn...
2008/09/08
[ "https://Stackoverflow.com/questions/48908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
48,916
<p>I want a splash screen to show while the application is loading. I have a form with a system tray control tied to it. I want the splash screen to display while this form loads, which takes a bit of time since it's accessing a web service API to populate some drop-downs. I also want to do some basic testing for dependencies before loading (that is, the web service is available, the configuration file is readable). As each phase of the startup goes, I want to update the splash screen with progress.</p> <p>I have been reading a lot on threading, but I am getting lost on where this should be controlled from (the <code>main()</code> method?). I am also missing how <code>Application.Run()</code> works, is this where the threads for this should be created from? Now, if the form with the system tray control is the "living" form, should the splash come from there? Wouldn't it not load until the form is completed anyway?</p> <p>I'm not looking for a code handout, more of an algorithm/approach so I can figure this out once and for all :) </p>
[ { "answer_id": 48944, "author": "McKenzieG1", "author_id": 3776, "author_profile": "https://Stackoverflow.com/users/3776", "pm_score": 3, "selected": false, "text": "<STAThread()> Public Shared Sub Main()\n\n splash = New frmSplash\n splash.Show()\n\n ' Your startup code goes he...
2008/09/08
[ "https://Stackoverflow.com/questions/48916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4246/" ]
48,919
<p>What is the JavaScript to scroll to the top when a button/link/etc. is clicked?</p>
[ { "answer_id": 48925, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 4, "selected": true, "text": "<a href=\"javascript:scroll(0, 0)\">Top</a>\n" }, { "answer_id": 48939, "author": "Rob Rolnick", "author_id...
2008/09/08
[ "https://Stackoverflow.com/questions/48919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469/" ]
48,931
<p>I used jQuery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behaviour for some elements. The new module has no access to the original code for the hover functions.</p> <p>I want to store the old hover functions before I set new ones so I can restore them when finished with the temporary hover behaviour.</p> <p>I think these can be stored using the <code>jQuery.data()</code> function:</p> <pre><code>//save old hover behavior (somehow) $('#foo').data('oldhoverin',???) $('#foo').data('oldhoverout',???); //set new hover behavior $('#foo').hover(newhoverin,newhoverout); </code></pre> <p>Do stuff with new hover behaviour...</p> <pre><code>//restore old hover behaviour $('#foo').hover($('#foo').data('oldhoverin'),$('#foo').data('oldhoverout')); </code></pre> <p>But how do I get the currently registered hover functions from jQuery?</p> <p>Shadow2531, I am trying to do this without modifying the code which originally registered the callbacks. Your suggestion would work fine otherwise. Thanks for the suggestion, and for helping clarify what I'm searching for. Maybe I have to go into the source of jquery and figure out how these callbacks are stored internally. Maybe I should change the question to "Is it possible to do this without modifying jquery?"</p>
[ { "answer_id": 49126, "author": "Shadow2531", "author_id": 1697, "author_profile": "https://Stackoverflow.com/users/1697", "pm_score": 1, "selected": false, "text": "\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Jquery - Get, change a...
2008/09/08
[ "https://Stackoverflow.com/questions/48931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5114/" ]
48,933
<p>Does anybody know of a way to list up the "loaded plugins" in <strong>Vim</strong>? I know I should be keeping track of this kind of stuff myself but it would always be nice to be able to check the current status.</p>
[ { "answer_id": 48952, "author": "Rob Rolnick", "author_id": 4798, "author_profile": "https://Stackoverflow.com/users/4798", "pm_score": 10, "selected": true, "text": "\" where was an option set \n:scriptnames : list all plugins, _vimrcs loaded (super) \n:verbose set history?...
2008/09/08
[ "https://Stackoverflow.com/questions/48933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4037/" ]
48,934
<p>I copied some Delphi code from one project to another, and found that it doesn't compile in the new project, though it did in the old one. The code looks something like this:</p> <pre><code>procedure TForm1.CalculateGP(..) const Price : money = 0; begin ... Price := 1.0; ... end; </code></pre> <p>So in the new project, Delphi complains that "left side cannot be assigned to" - understandable! But this code compiles in the old project. So my question is, <strong>why</strong>? Is there a compiler switch to allow consts to be reassigned? How does that even work? I thought consts were replaced by their values at compile time?</p>
[ { "answer_id": 48938, "author": "Ray", "author_id": 233, "author_profile": "https://Stackoverflow.com/users/233", "pm_score": 6, "selected": true, "text": "{$J+}" }, { "answer_id": 100061, "author": "PatrickvL", "author_id": 12170, "author_profile": "https://Stackover...
2008/09/08
[ "https://Stackoverflow.com/questions/48934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369/" ]
48,935
<p>I'm building an application in C# using WPF. How can I bind to some keys?</p> <p>Also, how can I bind to the <a href="http://en.wikipedia.org/wiki/Windows_key" rel="noreferrer">Windows key</a>?</p>
[ { "answer_id": 49102, "author": "Andy", "author_id": 3857, "author_profile": "https://Stackoverflow.com/users/3857", "pm_score": 0, "selected": false, "text": "RegisterHotKey()" }, { "answer_id": 49171, "author": "Gishu", "author_id": 1695, "author_profile": "https://...
2008/09/08
[ "https://Stackoverflow.com/questions/48935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/146637/" ]
48,947
<p>How are callbacks written in PHP?</p>
[ { "answer_id": 48948, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 5, "selected": false, "text": "// This function uses a callback function. \nfunction doIt($callback) \n{ \n $data = \"this is my data\";\n $ca...
2008/09/08
[ "https://Stackoverflow.com/questions/48947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
48,984
<p>We're using WatiN for testing our UI, but one page (which is unfortunately not under our teams control) takes forever to finish loading. Is there a way to get WatiN to click a link on the page before the page finishes rendering completely?</p>
[ { "answer_id": 49136, "author": "Glenn Slaven", "author_id": 2975, "author_profile": "https://Stackoverflow.com/users/2975", "pm_score": 5, "selected": true, "text": "IE browser = new IE(....);\nbrowser.Button(\"SlowPageLoadingButton\").ClickNoWait();\nLink continueLink = browser.Link(Fi...
2008/09/08
[ "https://Stackoverflow.com/questions/48984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975/" ]
48,993
<p>I am wondering if anyone has any experience using a JQuery plugin that converts a html </p> <pre><code>&lt;select&gt; &lt;option&gt; Blah &lt;/option&gt; &lt;/select&gt; </code></pre> <p>combo box into something (probably a div) where selecting an item acts the same as clicking a link.</p> <p>I guess you could probably use javascript to handle a selection event (my javascript knowledge is a little in disrepair at the moment) and 'switch' on the value of the combo box but this seems like more of a hack.</p> <p>Your advice, experience and recommendations are appreciated.</p>
[ { "answer_id": 49027, "author": "Matt Mitchell", "author_id": 364, "author_profile": "https://Stackoverflow.com/users/364", "pm_score": 0, "selected": false, "text": "onchange=\"if(this.options[this.selectedIndex].value!=''){this.form.submit()}\"\n" }, { "answer_id": 49419, "...
2008/09/08
[ "https://Stackoverflow.com/questions/48993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364/" ]
48,999
<p>The problem I'm trying to solve is "What's at this position?"</p> <p>It's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position?</p>
[ { "answer_id": 49936, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "function getDivByXY(x,y) {\n var alldivs = document.getElementsByTagName('div');\n\n for(var d = 0; d < alldivs.length; d++...
2008/09/08
[ "https://Stackoverflow.com/questions/48999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5123/" ]
49,002
<p>Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?</p>
[ { "answer_id": 891820, "author": "aleemb", "author_id": 50475, "author_profile": "https://Stackoverflow.com/users/50475", "pm_score": 8, "selected": false, "text": "class Person {\n String Title;\n String Name;\n Int Age\n}\n\nclass Employee : Person {\n Int Salary;\n String Ti...
2008/09/08
[ "https://Stackoverflow.com/questions/49002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
49,035
<p>Given a declaration like this:</p> <pre><code>class A { public: void Foo() const; }; </code></pre> <p>What does it mean?</p> <p>Google turns up this:</p> <blockquote> <p>Member functions should be declared with the const keyword after them if they can operate on a const (this) object. If the function is not declared const, in can not be applied to a const object, and the compiler will give an error message.</p> </blockquote> <p>But I find that somewhat confusing; can anyone out there put it in better terms?</p> <p>Thanks. </p>
[ { "answer_id": 49039, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 2, "selected": false, "text": "const" }, { "answer_id": 49044, "author": "dfjacobs", "author_id": 4848, "author_profile": "http...
2008/09/08
[ "https://Stackoverflow.com/questions/49035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
49,046
<p>Why does <code>n</code> not equal to <code>8</code> in the following function?</p> <pre><code>void foo(char cvalue[8]) { int n = sizeof (cvalue); } </code></pre> <p>But <code>n</code> <em>does</em> equal to <code>8</code> in this version of the function:</p> <pre><code>void bar() { char cvalue[8]; int n = sizeof (cvalue); } </code></pre>
[ { "answer_id": 49055, "author": "Nick Retallack", "author_id": 2653, "author_profile": "https://Stackoverflow.com/users/2653", "pm_score": 7, "selected": true, "text": "// These all do the same thing\nvoid foo(char cvalue[8])\nvoid foo(char cvalue[])\nvoid foo(char *cvalue)\n" }, { ...
2008/09/08
[ "https://Stackoverflow.com/questions/49046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5065/" ]
49,066
<p>I have a vs.net project, and after some refactoring, have modified the name of the project. How can I easily rename the underlying windows folder name to match this new project name under a TFS controlled project and solution?<br> Note, I used to be able to do by fiddling with things in the background using SourceSafe ... </p>
[ { "answer_id": 10853509, "author": "Scott Munro", "author_id": 81595, "author_profile": "https://Stackoverflow.com/users/81595", "pm_score": 7, "selected": false, "text": "No" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5110/" ]
49,092
<p>Where can I find an online interactive console for programming language or api?</p> <ul> <li><a href="http://tryruby.org/" rel="nofollow noreferrer">Ruby</a></li> <li><a href="http://shell.appspot.com/" rel="nofollow noreferrer">Python</a></li> <li><a href="http://groovyconsole.appspot.com/" rel="nofollow noreferrer">Groovy</a></li> <li>PHP?</li> <li>Perl?</li> <li><a href="http://eval.ironscheme.net/" rel="nofollow noreferrer">Scheme</a></li> <li><a href="http://www.javarepl.com/" rel="nofollow noreferrer">Java</a></li> <li>C?</li> </ul>
[ { "answer_id": 6141374, "author": "OnesimusUnbound", "author_id": 24755, "author_profile": "https://Stackoverflow.com/users/24755", "pm_score": 1, "selected": false, "text": "# Script text here\nimport itertools\n\ng = itertools.chain(\"AB\", range(2))\n\nprint g.next()\nprint g.next()\n...
2008/09/08
[ "https://Stackoverflow.com/questions/49092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2653/" ]
49,098
<p>So I have a function that looks something like this:</p> <pre><code>float function(){ float x = SomeValue; return x / SomeOtherValue; } </code></pre> <p>At some point, this function overflows and returns a really large negative value. To try and track down exactly where this was happening, I added a cout statement so that the function looked like this:</p> <pre><code>float function(){ float x = SomeValue; cout &lt;&lt; x; return x / SomeOtherValue; } </code></pre> <p>and it worked! Of course, I solved the problem altogether by using a double. But I'm curious as to why the function worked properly when I couted it. Is this typical, or could there be a bug somewhere else that I'm missing?</p> <p>(If it's any help, the value stored in the float is just an integer value, and not a particularly big one. I just put it in a float to avoid casting.)</p>
[ { "answer_id": 50068, "author": "David Joyner", "author_id": 1146, "author_profile": "https://Stackoverflow.com/users/1146", "pm_score": 2, "selected": false, "text": "const" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
49,107
<p>Actionscript 3.0 (and I assume Javascript and ECMAScript in general) lacks pass-by-reference for native types like ints. As a result I'm finding getting values back from a function really clunky. What's the normal pattern to work around this? </p> <p>For example, is there a clean way to implement <em>swap( intA, intB )</em> in Actionscript?</p>
[ { "answer_id": 49109, "author": "Nick Retallack", "author_id": 2653, "author_profile": "https://Stackoverflow.com/users/2653", "pm_score": -1, "selected": false, "text": "[a,b] = [b,a]\n" }, { "answer_id": 50755, "author": "hasseg", "author_id": 4111, "author_profile"...
2008/09/08
[ "https://Stackoverflow.com/questions/49107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4969/" ]
49,110
<p>I'm looking for the basic loop like:</p> <pre><code>for(int i = 0; i &lt; MAX; i++) { doSomething(i); } </code></pre> <p>but for Bash.</p>
[ { "answer_id": 49111, "author": "Rob Rolnick", "author_id": 4798, "author_profile": "https://Stackoverflow.com/users/4798", "pm_score": 8, "selected": true, "text": "for i in $(seq 1 10);\ndo\n echo $i\ndone\n" }, { "answer_id": 49114, "author": "Nick Stinemates", "aut...
2008/09/08
[ "https://Stackoverflow.com/questions/49110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3535/" ]
49,137
<p>I would like to call python script files from my c++ program.</p> <p>I am not sure that the people I will distribute to will have python installed.</p>
[ { "answer_id": 53325201, "author": "ingomueller.net", "author_id": 651937, "author_profile": "https://Stackoverflow.com/users/651937", "pm_score": 5, "selected": false, "text": "#include <pybind11/embed.h> // everything needed for embedding\nnamespace py = pybind11;\n\nint main() {\n ...
2008/09/08
[ "https://Stackoverflow.com/questions/49137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
49,147
<p>I have just installed C# for the first time, and at first glance it appears to be very similar to VB6. I decided to start off by trying to make a 'Hello, World!' UI Edition.</p> <p>I started in the Form Designer and made a button named "Click Me!" proceeded to double-click it and typed in</p> <pre><code>MessageBox("Hello, World!"); </code></pre> <p>I received the following error:</p> <p>MessageBox is a 'type' but used as a 'variable'</p> <p>Fair enough, it seems in C# MessageBox is an Object. I tried the following</p> <pre><code>MessageBox a = new MessageBox("Hello, World!"); </code></pre> <p>I received the following error: MessageBox does not contain a constructor that takes '1' arguments</p> <p>Now I am stumped. Please help.</p>
[ { "answer_id": 49151, "author": "moobaa", "author_id": 3569, "author_profile": "https://Stackoverflow.com/users/3569", "pm_score": 5, "selected": false, "text": "using System.Windows.Forms;\n\n...\n\nMessageBox.Show( \"hello world\" );\n" }, { "answer_id": 49152, "author": "G...
2008/09/08
[ "https://Stackoverflow.com/questions/49147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
49,158
<p>I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. </p> <p>Is there a way I can use GreaseMonkey to log me into this site automatically?</p> <p>Edit: I am aware of the store password functionality in browsers, but my scripts go a step further by checking if I'm logged into the site when it loads (by traversing HTML) and then submitting a post to the login page. This removes the step of having to load up the site, entering the login page, entering my credentials, then hitting submit</p>
[ { "answer_id": 49736, "author": "pkaeding", "author_id": 4257, "author_profile": "https://Stackoverflow.com/users/4257", "pm_score": 2, "selected": false, "text": "http://username:password@host/\n" }, { "answer_id": 55744, "author": "jklp", "author_id": 3847, "author_...
2008/09/08
[ "https://Stackoverflow.com/questions/49158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3847/" ]
49,164
<p>How do I turn a python program into an .egg file?</p>
[ { "answer_id": 49169, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 5, "selected": true, "text": "distutils" }, { "answer_id": 61389995, "author": "Manthan Trivedi", "author_id": 12557421, "author_profile": "...
2008/09/08
[ "https://Stackoverflow.com/questions/49164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
49,194
<p>I have an action like this:</p> <pre><code>public class News : System.Web.Mvc.Controller { public ActionResult Archive(int year) { / *** / } } </code></pre> <p>With a route like this:</p> <pre><code>routes.MapRoute( "News-Archive", "News.mvc/Archive/{year}", new { controller = "News", action = "Archive" } ); </code></pre> <p>The URL that I am on is:</p> <pre><code>News.mvc/Archive/2008 </code></pre> <p>I have a form on this page like this:</p> <pre><code>&lt;form&gt; &lt;select name="year"&gt; &lt;option value="2007"&gt;2007&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; </code></pre> <p>Submitting the form should go to News.mvc/Archive/2007 if '2007' is selected in the form.</p> <p>This requires the form 'action' attribute to be "News.mvc/Archive".</p> <p>However, if I declare a form like this:</p> <pre><code>&lt;form method="get" action="&lt;%=Url.RouteUrl("News-Archive")%&gt;"&gt; </code></pre> <p>it renders as:</p> <pre><code>&lt;form method="get" action="/News.mvc/Archive/2008"&gt; </code></pre> <p>Can someone please let me know what I'm missing?</p>
[ { "answer_id": 49223, "author": "Matt Mitchell", "author_id": 364, "author_profile": "https://Stackoverflow.com/users/364", "pm_score": 0, "selected": false, "text": "routes.MapRoute(\n \"News-Archive\", \n \"News.mvc/Archive/{year...
2008/09/08
[ "https://Stackoverflow.com/questions/49194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364/" ]
49,211
<p>I have an existing application that is written in C++ for Windows. This application uses the Win32 CryptoAPI to generate a TripleDES session key for encrypting/decrypting data. We're using the <a href="http://www.phdcc.com/cryptorc4.htm" rel="nofollow noreferrer">exponent of one trick</a> to export the session key out as a blob, which allows the blob to be stored somewhere in a decrypted format.</p> <p>The question is how can we use this in our .NET application (C#). The framework encapsulates/wraps much of what the CryptoAPI is doing. Part of the problem is the CryptAPI states that the TripleDES algorithm for the <a href="http://msdn.microsoft.com/en-us/library/aa386986(VS.85).aspx" rel="nofollow noreferrer">Microsoft Enhanced Cryptographic Provider</a> is 168 bits (3 keys of 56 bits). However, the .NET framework states their keys are 192 bits (3 keys of 64 bits). Apparently, the 3 extra bytes in the .NET framework is for parity?</p> <p>Anyway, we need to read the key portion out of the blob and somehow be able to use that in our .NET application. Currently we are not getting the expected results when attempting to use the key in .NET. The decryption is failing miserably. Any help would be greatly appreciated. </p> <h2>Update:</h2> <p>I've been working on ways to resolve this and have come up with a solution that I will post in time. However, still would appreciate any feedback from others.</p>
[ { "answer_id": 345696, "author": "Scott Saad", "author_id": 4916, "author_profile": "https://Stackoverflow.com/users/4916", "pm_score": 4, "selected": true, "text": "Array.Reverse( keyByteArray );\n" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916/" ]
49,214
<p>I need a list of integers from 1 to x where x is set by the user. I could build it with a for loop eg assuming x is an integer set previously:</p> <pre><code>List&lt;int&gt; iList = new List&lt;int&gt;(); for (int i = 1; i &lt;= x; i++) { iList.Add(i); } </code></pre> <p>This seems dumb, surely there's a more elegant way to do this, something like the <a href="http://au2.php.net/manual/en/function.range.php" rel="noreferrer">PHP range method</a></p>
[ { "answer_id": 49216, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 6, "selected": false, "text": "// Adding value to existing list\nvar list = new List<int>();\nlist.AddRange(Enumerable.Range(1, x));\n\n// Creating new list\nva...
2008/09/08
[ "https://Stackoverflow.com/questions/49214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975/" ]
49,251
<p>Following this question:<br> <a href="https://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">Good crash reporting library in c#</a></p> <p>Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notify the developer about it?</p> <p>Edit: This seems to be a duplicate of <a href="https://stackoverflow.com/questions/18265/getting-stack-traces-on-unix-systems-automatically">this question</a></p>
[ { "answer_id": 54243, "author": "Martin Del Vecchio", "author_id": 5397, "author_profile": "https://Stackoverflow.com/users/5397", "pm_score": 0, "selected": false, "text": "x86" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1084/" ]
49,252
<p>For a project I am working on in ruby I am overriding the method_missing method so that I can set variables using a method call like this, similar to setting variables in an ActiveRecord object:</p> <p><code>Object.variable_name= 'new value'</code> </p> <p>However, after implementing this I found out that many of the variable names have periods (.) in them. I have found this workaround:</p> <p><code>Object.send('variable.name=', 'new value')</code></p> <p>However, I am wondering is there a way to escape the period so that I can use</p> <p><code>Object.variable.name= 'new value'</code></p>
[ { "answer_id": 49255, "author": "Nick Retallack", "author_id": 2653, "author_profile": "https://Stackoverflow.com/users/2653", "pm_score": 4, "selected": true, "text": "attr_writer :bar\nattr_reader :baz\nattr_accessor :foo\n" }, { "answer_id": 49575, "author": "James A. Rose...
2008/09/08
[ "https://Stackoverflow.com/questions/49252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
49,258
<p>I am writing my first serious wxWidgets program. I'd like to use the wxConfig facility to make the program's user options persistent. However I <em>don't</em> want wxConfigBase to automatically use the Windows registry. Even though I'm initially targeting Windows, I'd prefer to use a configuration (eg .ini) file. Does anyone know a clean and simple way of doing this ? Thanks.</p>
[ { "answer_id": 49255, "author": "Nick Retallack", "author_id": 2653, "author_profile": "https://Stackoverflow.com/users/2653", "pm_score": 4, "selected": true, "text": "attr_writer :bar\nattr_reader :baz\nattr_accessor :foo\n" }, { "answer_id": 49575, "author": "James A. Rose...
2008/09/08
[ "https://Stackoverflow.com/questions/49258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3955/" ]
49,267
<p>Embedded custom-tag in dynamic content (nested tag) not rendering.</p> <p>I have a page that pulls dynamic content from a javabean and passes the list of objects to a custom tag for processing into html. Within each object is a bunch of html to be output that contains a second custom tag that I would like to also be rendered. The problem is that the tag invocation is rendered as plaintext.</p> <p>An example might serve me better.</p> <p>1 Pull information from a database and return it to the page via a javabean. Send this info to a custom tag for outputting.</p> <pre><code>&lt;jsp:useBean id="ImportantNoticeBean" scope="page" class="com.mysite.beans.ImportantNoticeProcessBean"/&gt; &lt;%-- Declare the bean --%&gt; &lt;c:forEach var="noticeBean" items="${ImportantNoticeBean.importantNotices}"&gt; &lt;%-- Get the info --%&gt; &lt;mysite:notice importantNotice="${noticeBean}"/&gt; &lt;%-- give it to the tag for processing --%&gt; &lt;/c:forEach&gt; </code></pre> <p>this tag should output a box div like so</p> <pre><code>*SNIP* class for custom tag def and method setup etc out.println("&lt;div class=\"importantNotice\"&gt;"); out.println(" " + importantNotice.getMessage()); out.println(" &lt;div class=\"importantnoticedates\"&gt;Posted: " + importantNotice.getDateFrom() + " End: " + importantNotice.getDateTo()&lt;/div&gt;"); out.println(" &lt;div class=\"noticeAuthor\"&gt;- " + importantNotice.getAuthor() + "&lt;/div&gt;"); out.println("&lt;/div&gt;"); *SNIP* </code></pre> <p>This renders fine and as expected</p> <pre><code>&lt;div class="importantNotice"&gt; &lt;p&gt;This is a very important message. Everyone should pay attenton to it.&lt;/p&gt; &lt;div class="importantnoticedates"&gt;Posted: 2008-09-08 End: 2008-09-08&lt;/div&gt; &lt;div class="noticeAuthor"&gt;- The author&lt;/div&gt; &lt;/div&gt; </code></pre> <p>2 If, in the above example, for instance, I were to have a custom tag in the importantNotice.getMessage() String:</p> <pre><code>*SNIP* "This is a very important message. Everyone should pay attenton to it. &lt;mysite:quote author="Some Guy"&gt;Quote this&lt;/mysite:quote&gt;" *SNIP* </code></pre> <p>The important notice renders fine but the quote tag will not be processed and simply inserted into the string and put as plain text/html tag.</p> <pre><code>&lt;div class="importantNotice"&gt; &lt;p&gt;This is a very important message. Everyone should pay attenton to it. &lt;mysite:quote author="Some Guy"&gt;Quote this&lt;/mysite:quote&gt;&lt;/p&gt; &lt;div class="importantnoticedates"&gt;Posted: 2008-09-08 End: 2008-09-08&lt;/div&gt; &lt;div class="noticeAuthor"&gt;- The author&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Rather than </p> <pre><code>&lt;div class="importantNotice"&gt; &lt;p&gt;This is a very important message. Everyone should pay attenton to it. &lt;div class="quote"&gt;Quote this &lt;span class="authorofquote"&gt;Some Guy&lt;/span&gt;&lt;/div&gt;&lt;/p&gt; // or wahtever I choose as the output &lt;div class="importantnoticedates"&gt;Posted: 2008-09-08 End: 2008-09-08&lt;/div&gt; &lt;div class="noticeAuthor"&gt;- The author&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I know this has to do with processors and pre-processors but I am not to sure about how to make this work.</p>
[ { "answer_id": 49410, "author": "Georgy Bolyuba", "author_id": 4052, "author_profile": "https://Stackoverflow.com/users/4052", "pm_score": 2, "selected": true, "text": "<bodycontent>JSP</bodycontent>\n" }, { "answer_id": 6538030, "author": "Samuel Marchant", "author_id": ...
2008/09/08
[ "https://Stackoverflow.com/questions/49267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431280/" ]
49,269
<p>I have a number of application settings (in user scope) for my custom grid control. Most of them are color settings. I have a form where the user can customize these colors and I want to add a button for reverting to default color settings. How can I read the default settings?</p> <p>For example:</p> <ol> <li>I have a user setting named <code>CellBackgroundColor</code> in <code>Properties.Settings</code>.</li> <li>At design time I set the value of <code>CellBackgroundColor</code> to <code>Color.White</code> using the IDE.</li> <li>User sets <code>CellBackgroundColor</code> to <code>Color.Black</code> in my program.</li> <li>I save the settings with <code>Properties.Settings.Default.Save()</code>.</li> <li>User clicks on the <code>Restore Default Colors</code> button.</li> </ol> <p>Now, <code>Properties.Settings.Default.CellBackgroundColor</code> returns <code>Color.Black</code>. How do I go back to <code>Color.White</code>?</p>
[ { "answer_id": 49289, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 6, "selected": true, "text": "Settings.Default.Properties[\"property\"].DefaultValue // initial value from config file\n" }, { "answer_id": 49336, "...
2008/09/08
[ "https://Stackoverflow.com/questions/49269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/976/" ]
49,274
<p>I have a string, say <code>'123'</code>, and I want to convert it to the integer <code>123</code>.</p> <p>I know you can simply do <code>some_string.to_i</code>, but that converts <code>'lolipops'</code> to <code>0</code>, which is not the effect I have in mind. I want it to blow up in my face when I try to convert something invalid, with a nice and painful <code>Exception</code>. Otherwise, I can't distinguish between a valid <code>0</code> and something that just isn't a number at all.</p> <p><strong>EDIT:</strong> I was looking for the standard way of doing it, without regex trickery.</p>
[ { "answer_id": 49282, "author": "Slartibartfast", "author_id": 4433, "author_profile": "https://Stackoverflow.com/users/4433", "pm_score": 9, "selected": true, "text": "Integer('1001') # => 1001 \nInteger('1001 nights') \n# ArgumentError: invalid valu...
2008/09/08
[ "https://Stackoverflow.com/questions/49274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2018/" ]
49,284
<p>I've come across a rather interesing (and frustrating) problem with IE6. We are serving up some server generated pdfs and then simply setting headers in PHP to force a browser download of the file. Works fine and all, except in IE6 but <strong>only</strong> if the windows user account is set to standard user (ie. not administrator).</p> <p>Since this is for a corporate environment, of course all their accounts are setup this way. Weird thing is, that in the download dialog, the Content-Type is not recognized:</p> <pre><code>header( 'Pragma: public' ); header( 'Expires: 0' ); header( 'Cache-Control: must-revalidate, pre-check=0, post-check=0' ); header( 'Cache-Control: public' ); header( 'Content-Description: File Transfer' ); header( 'Content-Type: application/pdf' ); header( 'Content-Disposition: attachment; filename="xxx.pdf"' ); header( 'Content-Transfer-Encoding: binary' ); echo $content; exit; </code></pre> <p>I also tried writing the file content to a temporary file first so I could also set the <code>Content-Length</code> in the header but that didn't help.</p>
[ { "answer_id": 49306, "author": "Stu Thompson", "author_id": 2961, "author_profile": "https://Stackoverflow.com/users/2961", "pm_score": 1, "selected": false, "text": " response.setHeader(\"Content-Type\", \"application/pdf \"; name=\" + file.getName());\n response.setContentType(\...
2008/09/08
[ "https://Stackoverflow.com/questions/49284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3196/" ]
49,299
<p>I am considering building a application using PRISM (Composite WPF Guidance/Library). The application modules will be vertically partitioned (i.e. Customers, Suppliers, Sales Orders, etc). This is still all relatively easy... I also have a Shell with a main region were all the work will happen but now I need the following behavior: I need a menu on my main Shell and when each one of the options gets clicked (like customers, suppliers, etc) I need to find the module and load it into the region (Only 1 view at a time)? </p> <p>Does anybody know of any sample applications with this type of behavior? All the samples are more focused on having all the modules loaded on the main shell? And should my menu bar also be a module?</p> <p>[<strong>UPDATE</strong>] How do I inject a module into a region based on it being selected from a menu? All the examples show that the module injects the view into the region on initialize? I need to only inject the view if the module is selected on a menu?</p>
[ { "answer_id": 881213, "author": "Scott Barnes", "author_id": 94167, "author_profile": "https://Stackoverflow.com/users/94167", "pm_score": 2, "selected": false, "text": "MyConstructor(IRegionManager regionManager, IUnityContainer container) \n" }, { "answer_id": 3321851, "au...
2008/09/08
[ "https://Stackoverflow.com/questions/49299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5147/" ]
49,302
<p>We have some legacy code that needs to identify in the Page_Load which event caused the postback. At the moment this is implemented by checking the Request data like this...</p> <p>if (Request.Form["__EVENTTARGET"] != null<br> &amp;&amp; (Request.Form["__EVENTTARGET"].IndexOf("BaseGrid") > -1 // BaseGrid event ( e.g. sort)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|| Request.Form["btnSave"] != null // Save button </p> <p>This is pretty ugly and breaks if someone renames a control. Is there a better way of doing this?</p> <p>Rewriting each page so that it does not need to check this in Page_Load is not an option at the moment.</p>
[ { "answer_id": 49311, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 4, "selected": true, "text": "public static Control GetPostBackControl(Page page)\n{\n Control control = null;\n\n string ctrlname = page.Request.Params....
2008/09/08
[ "https://Stackoverflow.com/questions/49302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
49,307
<p>Using the <code>zip</code> function, Python allows for loops to traverse multiple sequences in parallel. </p> <p><code>for (x,y) in zip(List1, List2):</code></p> <p>Does MATLAB have an equivalent syntax? If not, what is the best way to iterate over two parallel arrays at the same time using MATLAB?</p>
[ { "answer_id": 49514, "author": "sven", "author_id": 46, "author_profile": "https://Stackoverflow.com/users/46", "pm_score": 3, "selected": false, "text": "for i=1:length(a)\n c(i) = a(i) + b(i);\nend\n" }, { "answer_id": 51137, "author": "DMC", "author_id": 3148, "a...
2008/09/08
[ "https://Stackoverflow.com/questions/49307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5148/" ]
49,334
<p>In my database, I have an entity table (let's call it Entity). Each entity can have a number of entity types, and the set of entity types is static. Therefore, there is a connecting table that contains rows of the entity id and the name of the entity type. In my code, EntityType is an enum, and Entity is a Hibernate-mapped class.<br> in the Entity code, the mapping looks like this:</p> <pre><code>@CollectionOfElements @JoinTable( name = "ENTITY-ENTITY-TYPE", joinColumns = @JoinColumn(name = "ENTITY-ID") ) @Column(name="ENTITY-TYPE") public Set&lt;EntityType&gt; getEntityTypes() { return entityTypes; } </code></pre> <p>Oh, did I mention I'm using annotations?<br> Now, what I'd like to do is create an HQL query or search using a Criteria for all Entity objects of a specific entity type.<p> <a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-869?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel" rel="nofollow noreferrer">This</a> page in the Hibernate forum says this is impossible, but then this page is 18 months old. Can anyone tell me if this feature has been implemented in one of the latest releases of Hibernate, or planned for the coming release?</p>
[ { "answer_id": 50402, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 0, "selected": false, "text": "EntityType" }, { "answer_id": 53405, "author": "marcospereira", "author_id": 4600, "author_profile": "ht...
2008/09/08
[ "https://Stackoverflow.com/questions/49334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2819/" ]
49,346
<p>Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?</p> <p>I know that marking it as disabled works but then it gets displayed differently (greyed out).</p> <p>To clarify my point, I have a list of user names at the top of my page which are built dynamically using a user control. Most of the time these names are linkable to an email page. However if the user has been disabled the name is displayed in grey but currently still links to the email page. I want these disabled users to not link.</p> <p>I know that really I should be replacing them with a label but this does not seem quite as elegant as just removing the linking ability usings CSS say (if thats possible). They are already displayed in a different colour so its obvious that they are disabled users. I just need to switch off the link.</p>
[ { "answer_id": 49358, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 2, "selected": false, "text": "a: link, visited, hover, active {\n text-decoration: none;\n}\n" }, { "answer_id": 49362, "author": "Slartiba...
2008/09/08
[ "https://Stackoverflow.com/questions/49346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
49,350
<p>What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?</p> <p>Some details:</p> <ul> <li><p>I am looking for solution for the entire page.</p></li> <li><p>You need to specify only width of the element to be centered. Height of the element is not known in design time.</p></li> <li><p>When minimizing window, scrolling should appear only when all white space is gone. In other words, width of screen should be represented as: </p></li> </ul> <p>"leftSpace width=(screenWidth-widthOfCenteredElement)/2"+<br> "centeredElement width=widthOfCenteredElement"+<br> "rightSpace width=(screenWidth-widthOfCenteredElement)/2" </p> <p>And the same for the height:</p> <p>"topSpace height=(screenHeight-heightOfCenteredElement)/2"+<br> "centeredElement height=heightOfCenteredElement"+<br> "bottomSpace height=(screenWidth-heightOfCenteredElement)/2"</p> <ul> <li>By practical I mean that use of tables is OK. I intend to use this layout mostly for special pages like login. So CSS purity is not so important here, while following standards is desirable for future compatibility.</li> </ul>
[ { "answer_id": 49353, "author": "Oleksandr Yanovets", "author_id": 5139, "author_profile": "https://Stackoverflow.com/users/5139", "pm_score": 2, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">...
2008/09/08
[ "https://Stackoverflow.com/questions/49350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5139/" ]
49,356
<p>We have the standard Subversion trunk/branches/tags layout. We have several branches for medium- and long-term projects, but none so far for a release. This is approaching fast.</p> <p>Should we:</p> <ol> <li>Mix release branches and project branches together?</li> <li>Create a releases folder? If so, is there a better name than releases?</li> <li>Create a projects folder and move the current branches there? If so, is there a better name than projects? I've seen "sandbox" and "spike" in other repositories.</li> <li>Something else altogether?</li> </ol>
[ { "answer_id": 49366, "author": "Polsonby", "author_id": 137, "author_profile": "https://Stackoverflow.com/users/137", "pm_score": -1, "selected": false, "text": "trunk\n fooapp\n stuff...\n barapp\n stuff...\ntags\n fooapp\n 1.0.0\n 1.0.1\n ...
2008/09/08
[ "https://Stackoverflow.com/questions/49356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3984/" ]
49,368
<p><a href="http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors" rel="noreferrer">CSS Attribute selectors</a> allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly that I was able to use them to adorn all external links with an icon, by using a code similar to the following:</p> <pre><code>a[href=http] { background: url(external-uri); padding-left: 12px; } </code></pre> <p>The above code doesn't work. My question is: <strong>How does it work?</strong> How do I select all <code>&lt;a&gt;</code> tags whose <code>href</code> attribute starts with <code>"http"</code>? The official CSS spec (linked above) doesn't even mention that this is possible. But I do remember doing this.</p> <p>(<em>Note</em>: The obvious solution would be to use <code>class</code> attributes for distinction. I want to avoid this because I have little influence of the way the HTML code is built. All I can edit is the CSS code.)</p>
[ { "answer_id": 49373, "author": "Antti Kissaniemi", "author_id": 2948, "author_profile": "https://Stackoverflow.com/users/2948", "pm_score": 6, "selected": true, "text": "a[href^=http]\n{\n background: url(external-uri);\n padding-left: 12px;\n}\n" }, { "answer_id": 49462, ...
2008/09/08
[ "https://Stackoverflow.com/questions/49368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1968/" ]
49,379
<p>How do I lock compiled Java classes to prevent decompilation?</p> <p>I know this must be very well discussed topic on the Internet, but I could not come to any conclusion after referring them.</p> <p>Many people do suggest obfuscator, but they just do renaming of classes, methods, and fields with tough-to-remember character sequences but what about sensitive constant values?</p> <p>For example, you have developed the encryption and decryption component based on a password based encryption technique. Now in this case, any average Java person can use <a href="http://www.kpdus.com/jad.html" rel="noreferrer">JAD</a> to decompile the class file and easily retrieve the password value (defined as constant) as well as <a href="http://en.wikipedia.org/wiki/Salt_%28cryptography%29" rel="noreferrer">salt</a> and in turn can decrypt the data by writing small independent program!</p> <p>Or should such sensitive components be built in native code (for example, VC++) and call them via <a href="http://en.wikipedia.org/wiki/Java_Native_Interface" rel="noreferrer">JNI</a>?</p>
[ { "answer_id": 9598442, "author": "Yury Bendersky", "author_id": 1239661, "author_profile": "https://Stackoverflow.com/users/1239661", "pm_score": 2, "selected": false, "text": "ClassLoader.defineClass(...)" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/959/" ]
49,382
<p>Are the naming conventions similar in different languages? If not, what are the differences?</p>
[ { "answer_id": 49530, "author": "Anders Sandvig", "author_id": 1709, "author_profile": "https://Stackoverflow.com/users/1709", "pm_score": 3, "selected": true, "text": "lowercase, lowercase_with_underscores" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
49,402
<p>Imagine a DOS style .cmd file which is used to launch interdependent windowed applications in the right order.</p> <p>Example:<br> 1) Launch a server application by calling an exe with parameters.<br> 2) Wait for the server to become initialized (or a fixed amount of time).<br> 3) Launch client application by calling an exe with parameters.</p> <p>What is the simplest way of accomplishing this kind of batch job in PowerShell?</p>
[ { "answer_id": 49520, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 0, "selected": false, "text": "launch-server-application serverparam1 serverparam2 ...\nStart-Sleep -s 10\nlaunch-client-application clientparam1 clien...
2008/09/08
[ "https://Stackoverflow.com/questions/49402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5085/" ]
49,403
<p>I have a filename in a format like:</p> <blockquote> <p><code>system-source-yyyymmdd.dat</code></p> </blockquote> <p>I'd like to be able to parse out the different bits of the filename using the "-" as a delimiter.</p>
[ { "answer_id": 49406, "author": "David", "author_id": 381, "author_profile": "https://Stackoverflow.com/users/381", "pm_score": 3, "selected": false, "text": "cut" }, { "answer_id": 49409, "author": "Bobby Jack", "author_id": 5058, "author_profile": "https://Stackover...
2008/09/08
[ "https://Stackoverflow.com/questions/49403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4003/" ]
49,404
<p>I have a table containing prices for a lot of different "things" in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times.</p> <pre><code>ID uniqueidentifier not null, ThingID int NOT NULL, PriceDateTime datetime NOT NULL, Price decimal(18,4) NOT NULL </code></pre> <p>I need to get today's latest prices for a group of things. The below query works but I'm getting hundreds of rows back and I have to loop trough them and only extract the latest one per ThingID. How can I (e.g. via a GROUP BY) say that I want the latest one per ThingID? Or will I have to use subqueries?</p> <pre><code>SELECT * FROM Thing WHERE ThingID IN (1,2,3,4,5,6) AND PriceDate &gt; cast( convert(varchar(20), getdate(), 106) as DateTime) </code></pre> <p><strong>UPDATE:</strong> In an attempt to hide complexity I put the ID column in a an int. In real life it is GUID (and not the sequential kind). I have updated the table def above to use uniqueidentifier.</p>
[ { "answer_id": 49414, "author": "BlaM", "author_id": 999, "author_profile": "https://Stackoverflow.com/users/999", "pm_score": 5, "selected": true, "text": "SELECT *\n FROM Thing\n WHERE ID IN (SELECT max(ID) FROM Thing \n WHERE ThingID IN (1,2,3,4)\n ...
2008/09/08
[ "https://Stackoverflow.com/questions/49404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1008/" ]
49,426
<p>Take a .Net Winforms App.. mix in a flakey wireless network connection, stir with a few users who like to simply pull the blue plug out occasionally and for good measure, add a Systems Admin that decides to reboot the SQL server box without warning now and again just to keep everyone on their toes.</p> <p>What are the suggestions and strategies for handling this sort of scenario in respect to :</p> <ul> <li><p>Error Handling - for example, do you wrap every call to the server with a Try/Catch or do you rely on some form of Generic Error Handling to manage this? If so what does it look like?</p></li> <li><p>Application Management - for example, do you disable the app and not allow users to interact with it until a connection is detected again? What would you do?</p></li> </ul>
[ { "answer_id": 49433, "author": "Simon Keep", "author_id": 1127460, "author_profile": "https://Stackoverflow.com/users/1127460", "pm_score": 1, "selected": false, "text": "Main()" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3849/" ]
49,430
<p>I have just started working with the <code>AnimationExtender</code>. I am using it to show a new div with a list gathered from a database when a button is pressed. The problem is the button needs to do a postback to get this list as I don't want to make the call to the database unless it's needed. The postback however stops the animation mid flow and resets it. The button is within an update panel.</p> <p>Ideally I would want the animation to start once the postback is complete and the list has been gathered. I have looked into using the <code>ScriptManager</code> to detect when the postback is complete and have made some progress. I have added two javascript methods to the page.</p> <pre><code>function linkPostback() { var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_endRequest(playAnimation) } function playAnimation() { var onclkBehavior = $find("ctl00_btnOpenList").get_OnClickBehavior().get_animation(); onclkBehavior.play(); } </code></pre> <p>And I’ve changed the <code>btnOpenList.OnClientClick=”linkPostback();”</code></p> <p>This almost solves the problem. I’m still get some animation stutter. The animation starts to play before the postback and then plays properly after postback. Using the <code>onclkBehavior.pause()</code> has no effect. I can get around this by setting the <code>AnimationExtender.Enabled = false</code> and setting it to true in the buttons postback event. This however works only once as now the AnimationExtender is enabled again. I have also tried disabling the <code>AnimationExtender</code> via javascript but this has no effect.</p> <p>Is there a way of playing the animations only via javascript calls? I need to decouple the automatic link to the buttons click event so I can control when the animation is fired.</p> <p>Hope that makes sense.</p> <p>Thanks</p> <p>DG</p>
[ { "answer_id": 57774, "author": "Andrew Johnson", "author_id": 5109, "author_profile": "https://Stackoverflow.com/users/5109", "pm_score": 2, "selected": true, "text": "function linkPostback() {\n\n var prm = Sys.WebForms.PageRequestManager.getInstance();\n prm.add_endRequest(playA...
2008/09/08
[ "https://Stackoverflow.com/questions/49430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5170/" ]
49,442
<p>When do you recommend integrating a custom view into Interface Builder with a plug-in? When skimming through Apple's <a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/CreatingPluginBundle/chapter_2_section_3.html#//apple_ref/doc/uid/TP40004323-CH4-DontLinkElementID_15" rel="noreferrer" title="Interface Builder Plug-In Programming Guide">Interface Builder Plug-In Programming Guide</a> I found:</p> <blockquote> <ul> <li>Are your custom objects going to be used by only one application?</li> <li>Do your custom objects rely on state information found only in your application?</li> <li>Would it be problematic to encapsulate your custom views in a standalone library or framework?</li> </ul> <p>If you answered yes to any of the preceding questions, your objects may not be good candidates for a plug-in.</p> </blockquote> <p>That answers some of my questions, but I would still like your thoughts on when it's a good idea. What are the benefits and how big of a time investment is it?</p>
[ { "answer_id": 89185, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 4, "selected": true, "text": "-awakeFromNib" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156/" ]
49,445
<p>I have a WCF service which includes UI components, which forces me to be in STA mode.</p> <p>How do I set the service behaviour to STA-mode?</p> <hr> <p>The service uses a reference to a WPF DLL file which opens a UI window (used as view port) for picture analysis. When the service is trying to create an instance of that item (inherits from window) it throws an exception:</p> <blockquote> <p>The calling thread must be an STA</p> </blockquote>
[ { "answer_id": 49448, "author": "John Sibly", "author_id": 1078, "author_profile": "https://Stackoverflow.com/users/1078", "pm_score": 0, "selected": false, "text": "[STAThread]\nstatic void Main()\n{\n ServiceBase[] ServicesToRun;\n ServicesToRun = new ServiceBase[] { new ...
2008/09/08
[ "https://Stackoverflow.com/questions/49445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
49,450
<p>I'm just about wrapped up on a project where I was using a commercial SVN provider to store the source code. The web host the customer ultimately picked includes a repository as part of the hosting package, so, now that the project is over, I'd like to relocate the repository to their web host and discontinue the commercial account.</p> <p>How would I go about doing this?</p>
[ { "answer_id": 49468, "author": "pilif", "author_id": 5083, "author_profile": "https://Stackoverflow.com/users/5083", "pm_score": 3, "selected": false, "text": "svnadmin dump\n" }, { "answer_id": 49483, "author": "Tadmas", "author_id": 3750, "author_profile": "https:/...
2008/09/08
[ "https://Stackoverflow.com/questions/49450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1344/" ]
49,458
<p>We have an application that has to be flexible in how it displays it's main form to the user - depending on the user, the form should be slightly different, maybe an extra button here or there, or some other nuance. In order to stop writing code to explicitly remove or add controls etc, I turned to visual inheritance to solve the problem - in what I thought was a neat, clean and logical OO style - turns out that half the time inherited forms have a hard time rendering themeselves in VS for no good reason etc - and I get the feeling that developers and to some extent Microsoft have shunned the practice of Visual Inheritance - can you confirm this, am I missing something here?</p> <p>Regards.</p>
[ { "answer_id": 49554, "author": "Mendelt", "author_id": 3320, "author_profile": "https://Stackoverflow.com/users/3320", "pm_score": 2, "selected": false, "text": "public class MyForm<MyObject> : Form\n" }, { "answer_id": 258868, "author": "Tigraine", "author_id": 21699, ...
2008/09/08
[ "https://Stackoverflow.com/questions/49458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175/" ]
49,461
<p>Is there a C# equivalent for the VB.NET <code>FormatNumber</code> function? </p> <p>I.e.:</p> <pre><code>JSArrayString += "^" + (String)FormatNumber(inv.RRP * oCountry.ExchangeRate, 2); </code></pre>
[ { "answer_id": 49476, "author": "d91-jal", "author_id": 5085, "author_profile": "https://Stackoverflow.com/users/5085", "pm_score": 1, "selected": false, "text": "double MyNumber = inv.RRP * oCountry.ExchangeRate;\nJSArrayString += \"^\" + MyNumber.ToString(\"#0.00\");\n" }, { "a...
2008/09/08
[ "https://Stackoverflow.com/questions/49461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1583/" ]
49,473
<p>Is <a href="http://bouncycastle.org/java.html" rel="nofollow noreferrer">Bouncy Castle API</a> Thread Safe ? Especially,</p> <pre><code>org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher org.bouncycastle.crypto.paddings.PKCS7Padding org.bouncycastle.crypto.engines.AESFastEngine org.bouncycastle.crypto.modes.CBCBlockCipher </code></pre> <p>I am planning to write a singleton Spring bean for basic level cryptography support in my app. Since it is a web application, there are greater chances of multiple threads accessing this component at a time. So tread safety is essential here.</p> <p>Please let me know if you have come across such situations using Bouncy Castle.</p>
[ { "answer_id": 49498, "author": "Tnilsson", "author_id": 4165, "author_profile": "https://Stackoverflow.com/users/4165", "pm_score": 5, "selected": true, "text": "E(X) = Enctrypt message X\nD(X) = Dectrypt X. (Note that D(E(X)) = X)\nIV = Initialization vector. A random sequence to boots...
2008/09/08
[ "https://Stackoverflow.com/questions/49473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/959/" ]
49,478
<p>Which files should I include in <code>.gitignore</code> when using <em>Git</em> in conjunction with <em>Xcode</em>?</p>
[ { "answer_id": 49488, "author": "Hagelin", "author_id": 5156, "author_profile": "https://Stackoverflow.com/users/5156", "pm_score": 8, "selected": false, "text": ".DS_Store\n*.swp\n*~.nib\n\nbuild/\n\n*.pbxuser\n*.perspective\n*.perspectivev3\n" }, { "answer_id": 50283, "auth...
2008/09/08
[ "https://Stackoverflow.com/questions/49478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5156/" ]
49,500
<p>I'm trying to redirect requests for a wildcard domain to a sub-directory.<br /> ie. <code>something.blah.example.com</code> --&gt; <code>blah.example.com/something</code></p> <p>I don't know how to get the subdomain name to use in the rewrite rule.</p> <p><strong>Final Solution:</strong></p> <pre><code>RewriteCond %{HTTP_HOST} !^blah\.example\.com RewriteCond %{HTTP_HOST} ^([^.]+) RewriteRule ^(.*) /%1/$1 [L] </code></pre> <p>Or as pointed out by pilif</p> <pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.example\.com$ </code></pre>
[ { "answer_id": 49504, "author": "pilif", "author_id": 5083, "author_profile": "https://Stackoverflow.com/users/5083", "pm_score": 6, "selected": true, "text": "RewriteCond %{HTTP_HOST} ^([^.]+)\\.blah\\.domain\\.com$\nRewriteRule ^/(.*)$ http://blah.domain.com/%1/$1 [L,R] \n" ...
2008/09/08
[ "https://Stackoverflow.com/questions/49500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428/" ]
49,507
<p>The system I'm currently working on consists of a controller PC running XP with .Net 2 connected to a set of embedded systems. All these components communicate with each other over an ethernet network. I'm currently using TcpClient.Connect on the XP computer to open a connection to the embedded systems to send TCP/IP messages. </p> <p>I now have to connect the XP computer to an external network to send processing data to, so there are now two network cards on the XP computer. However, the messages sent to the external network mustn't appear on the network connecting the embedded systems together (don't want to consume the bandwidth) and the messages to the embedded systems mustn't appear on the external network.</p> <p>So, the assertion I'm making is that messages sent to a defined IP address are sent out on both network cards when using the TcpClient.Connect method.</p> <p>How do I specify which physical network card messages are sent via, ideally using the .Net networking API. If no such method exists in .Net, then I can always P/Invoke the Win32 API.</p> <p>Skizz</p>
[ { "answer_id": 49545, "author": "Hath", "author_id": 5186, "author_profile": "https://Stackoverflow.com/users/5186", "pm_score": 3, "selected": false, "text": " int port = 1234;\n\n IPHostEntry entry = Dns.GetHostEntry(Dns.GetHostName());\n\n //find ip address for your adapter h...
2008/09/08
[ "https://Stackoverflow.com/questions/49507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1898/" ]
49,510
<p>How do you set your Cocoa application as the default web browser?</p> <p>I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.).</p>
[ { "answer_id": 49512, "author": "georgebrock", "author_id": 5168, "author_profile": "https://Stackoverflow.com/users/5168", "pm_score": 7, "selected": true, "text": "http://" }, { "answer_id": 65479328, "author": "vauxhall", "author_id": 4691224, "author_profile": "ht...
2008/09/08
[ "https://Stackoverflow.com/questions/49510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5168/" ]
49,511
<p>I have played with the idea of using a wiki (MediaWiki) to centralize all project information for a development project. This was done using extensions that pull information from SVN (using <a href="http://svnkit.com/" rel="nofollow noreferrer">SVNKit</a>) and by linking to Bugzilla to extract work assigned to a developer or work remaining for a release.</p> <p>Examples:</p> <pre><code>&lt;bugzilla type="summary" user="richard.tasker@gmail.com" /&gt; </code></pre> <p>would return a summary</p> <p><img src="https://i.stack.imgur.com/rfJjy.png" alt="Bugzilla Summary"></p> <pre><code>&lt;bugzilla type="status" status="ASSIGNED" product="SCM BEPPI" /&gt; </code></pre> <p>would return</p> <p><img src="https://i.stack.imgur.com/YSV0t.png" alt="Bugzilla Status"></p> <p>Do you think that this would be useful? If so then what other integrations would you think would be valuable?</p>
[ { "answer_id": 49541, "author": "Richard Tasker", "author_id": 2939, "author_profile": "https://Stackoverflow.com/users/2939", "pm_score": 0, "selected": false, "text": "<project file=\"AOZA_BEPPI_Billing_Project_Plan_v0.2.mpp\" type=\"list\" user=\"Martin\" />\n" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2939/" ]
49,536
<p>You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:</p> <pre><code># THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE # # ^ ^ # </code></pre> <ul> <li>There's an varying number of text-only menu items and the page layout is fluid.</li> <li>The first menu item should be left-aligned, the last menu item should be right-aligned.</li> <li>The remaining items should be spread optimally on the menu bar.</li> <li>The number is varying,so there's no chance to pre-calculate the optimal widths.</li> </ul> <p>Note that a TABLE won't work here as well:</p> <ul> <li>If you center all TDs, the first and the last item aren’t aligned correctly.</li> <li>If you left-align and right-align the first resp. the last items, the spacing will be sub-optimal.</li> </ul> <p>Isn’t it strange that there is no obvious way to implement this in a clean way by using HTML and CSS?</p>
[ { "answer_id": 49538, "author": "Jordi Bunster", "author_id": 4272, "author_profile": "https://Stackoverflow.com/users/4272", "pm_score": 2, "selected": false, "text": "<p>" }, { "answer_id": 49558, "author": "flight", "author_id": 3377, "author_profile": "https://Sta...
2008/09/08
[ "https://Stackoverflow.com/questions/49536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3377/" ]
49,547
<p>Our investigations have shown us that not all browsers respect the HTTP cache directives in a uniform manner.</p> <p>For security reasons we do not want certain pages in our application to be cached, <strong>ever,</strong> by the web browser. This must work for at least the following browsers:</p> <ul> <li>Internet Explorer 6+</li> <li>Firefox 1.5+</li> <li>Safari 3+</li> <li>Opera 9+</li> <li>Chrome</li> </ul> <p>Our requirement came from a security test. After logging out from our website you could press the back button and view cached pages.</p>
[ { "answer_id": 49549, "author": "Edward Wilde", "author_id": 5182, "author_profile": "https://Stackoverflow.com/users/5182", "pm_score": 5, "selected": false, "text": "Response.ClearHeaders(); \nResponse.AppendHeader(\"Cache-Control\", \"no-cache\"); //HTTP 1.1\nResponse.AppendHeader(\"C...
2008/09/08
[ "https://Stackoverflow.com/questions/49547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5182/" ]
49,562
<p>I think this is a fun engineering-level question.</p> <p>I need to design a control which displays a line chart. What I want to be able to do is use a designer to add multiple <code>Pens</code> which actually describe the data and presentation so that it ends up with Xaml something along these lines:</p> <pre><code>&lt;Chart&gt; &lt;Pen Name="SalesData" Color="Green" Data="..."/&gt; &lt;Pen Name="CostData" Color="Red" Data="..." /&gt; ... &lt;/chart&gt; </code></pre> <p>My first thought is to extend <code>ItemsControl</code> for the <code>Chart</code> class. Will that get me where I want to go or should I be looking at it from a different direction such as extending <code>Panel</code>?</p> <p>The major requirement is to be able to use it in a designer without adding any C# code. In order for that to even be feasible, it needs to retain its structure in the tree-view model. In other words, if I were working with this in Expression Blend or Mobiform Aurora, I would be able to select the chart from the logical tree or select any of the individual pens to edit their properties.</p>
[ { "answer_id": 334399, "author": "Rhys", "author_id": 22169, "author_profile": "https://Stackoverflow.com/users/22169", "pm_score": 1, "selected": false, "text": "<Chart>\n <Chart.Pens>\n <Pen Name=\"SalesData\" Data=\"{Binding Name=SalesData}\" /> \n <Pen Name=\"CostData\"...
2008/09/08
[ "https://Stackoverflow.com/questions/49562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93/" ]
49,564
<p>I would like display something more meaningful that animated gif while users upload file to my web application. What possibilities do I have? </p> <p><em>Edit: I am using .Net but I don't mind if somebody shows me platform agnostic version.</em></p>
[ { "answer_id": 51641, "author": "georgebrock", "author_id": 5168, "author_profile": "https://Stackoverflow.com/users/5168", "pm_score": 2, "selected": false, "text": "uploadStarted" } ]
2008/09/08
[ "https://Stackoverflow.com/questions/49564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2361/" ]
49,582
<p>In our current database development evironment we have automated build procceses check all the sql code out of svn create database scripts and apply them to the various development/qa databases.</p> <p>This is all well and good, and is a tremdous improvement over what we did in the past, but we have a problem with rerunning scripts. Obviously this isn't a problem with some scripts like altering procedures, because you can run them over and over without adversly affecting the system. Right now to add metadata and run statements like create/alter table statements we add code to check and see if the objects exists, and if they do, don't run them.</p> <p>Our problem is that we really only get one shot to run the script, because once the script has been run, the objects are in the environment and system won't run the script again. If something needs to change once it's been deployed, we have a difficult process of running update scripts agaist the update scripts and hoping that everything falls in the correct order and all of the PKs line up between the environments (the databases are, shall we say, "special").</p> <p>Short of dropping the database and starting the process from scratch (the last most current release), does anyone have a more elegant solution to this? </p>
[ { "answer_id": 49597, "author": "Ryan Lanciaux", "author_id": 1385358, "author_profile": "https://Stackoverflow.com/users/1385358", "pm_score": 1, "selected": false, "text": "http://www.rikware.com/RikMigrations.html\n" }, { "answer_id": 49845, "author": "Ben Scheirman", ...
2008/09/08
[ "https://Stackoverflow.com/questions/49582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1942/" ]