qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
429,149
<p>When there were only evil datasets and the microsoft application blocks your transfer objects between layers would be either datasets/datatables or DTO/POCO. I belong to the gang that likes using DTO/POCO. </p> <p>Now with this sudden wave of mapping layers like SubSonic, Entity Framework, NHibernate etc, should I still be using my favourite POCOs?? I do this mostly and when working with ASP.net webforms 99% times end up using ObjectDataSource for binding to controls and the features specific to each type.</p> <p>Should I give up this love for POCO and pass around IQueryables or Entities or things like that and make use of other DataSource objects??</p> <p>What are the pros and cons of using these objects instead of DTOs ?? How will it hit my app design and performance?</p> <p>EDIT: When will I get to use the other datasources like Linq Datasorce and Entity datasource etc?</p>
[ { "answer_id": 429229, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 3, "selected": false, "text": " return CurrentSession.CreateQuery(\n \"select new OrganizationListDTO(o.Id,o.Name,o.xxx,o.xxx)\" +\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37494/" ]
429,162
<p>I have a command line app the continuously outputs YAML data in the form:</p> <pre> - col0: datum0 col1: datum1 col2: datum2 - col0: datum0 col1: datum1 col2: datum2 ... </pre> <p>It does this for all of eternity. I would like to write a Python script that continuously reads each of these records.</p> <p>The PyYAML library seems best at taking fully loaded strings and interpreting those as a complete YAML document. Is there a way to put PyYAML into a "streaming" mode?</p> <p>Or is my only option to chunk the data myself and feed it bit by bit into PyYAML?</p>
[ { "answer_id": 431387, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 3, "selected": true, "text": "def streamInYAML(stream):\n y = stream.readline()\n cont = 1\n while cont:\n l = stream.readline()\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
429,164
<p>I have a SOAP request that is known to work using a tool like, say, SoapUI, but I am trying to get it to work using urllib.</p> <p>This is what I have tried so far and it did not work:</p> <pre><code>import urllib f = "".join(open("ws_request_that_works_in_soapui", "r").readlines()) urllib.urlopen('http://url.com/to/Router?wsdl', f) </code></pre> <p>I haven't been able to find the spec on how the document should be posted to the SOAP Server.</p> <p>urllib is not a necessary requirement.</p>
[ { "answer_id": 429349, "author": "Nick Stinemates", "author_id": 4960, "author_profile": "https://Stackoverflow.com/users/4960", "pm_score": 3, "selected": false, "text": "import httplib\n\nf = \"\".join(open('ws_request', 'r'))\n\nwebservice = httplib.HTTP('localhost', 8083)\nwebservice...
2009/01/09
[ "https://Stackoverflow.com/questions/429164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
429,165
<p>The .net framework provides in the Math class a method for powering double. But by precision requirement I need to raise a decimal to a decimal power [ Pow(decimal a, decimal b) ]. Does the framework have such a function? Does anyone know of a library with this kind of function?</p>
[ { "answer_id": 429185, "author": "Dmitri Nesteruk", "author_id": 9476, "author_profile": "https://Stackoverflow.com/users/9476", "pm_score": -1, "selected": false, "text": "decimal double Math.Pow()" }, { "answer_id": 466434, "author": "vappolinario", "author_id": 36147, ...
2009/01/09
[ "https://Stackoverflow.com/questions/429165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36147/" ]
429,174
<p>I have a webpage on my site that displays a table, reloads the XML source data every 10 seconds (with an XmlHttpRequest), and then updates the table to show the user any additions or removals of the data. To do this, the JavaScript function first clears out all elements from the table and then adds a new row for each unit of data.</p> <p>Recently, I battled thru a number of memory leaks in Internet Explorer caused by this DOM destroy-and-create code (most of them having to do with circular references between JavaScript objects and DOM objects, and the JavaScript library we are using quietly keeping a reference to every JS object created with <code>new Element(...)</code> until the page is unloaded). </p> <p>With the memory problems solved, we've now uncovered a CPU-based problem: when the user has a large amount of data to view (100+ units of data, which equals 100 <code>&lt;tr&gt;</code> nodes to create, plus all of the table cells for each column), the process ties up the CPU until Internet Explorer prompts the user with:</p> <blockquote> <p>Stop running this script?<br> A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive.</p> </blockquote> <p>It seems that running the row-and-cell-creation code times 100+ pieces of data is what is causing the CPU usage to spike, the function to take "too long" (from IE's perspective) to run, thus causing IE to generate this warning for the user. I've also noticed that while the "update screen" function runs for the 100 rows, IE does not re-render the table contents until the function completes (since the JS interpreter is using 100% CPU for that time period, I assume).</p> <p>So my question is: Is there any way in JavaScript to tell the browser to pause JS execution and re-render the DOM? If not, are there any strategies for handling creating large amounts of DOM nodes and <em>not</em> having the browser choke? </p> <p>One method I can think of would be to handle the "update table" logic asynchronously; that is, once the Ajax method to reload the XML data is complete, put the data into some sort of array, and then set a function (using <code>setInterval()</code>) to run which will handle one element of the array at a time. However this seems a little bit like re-creating threading in a JavaScript environment, which seems like it could get very complicated (i.e. what if another Ajax data request fires while I'm still re-creating the table's DOM nodes?, etc.) </p> <hr> <p><strong>update</strong>: Just wanted to explain why I'm accepting RoBurg's answer. In doing some testing, I've found that the <code>new Element()</code> method in my framework (I'm using <a href="http://mootools.net/" rel="nofollow noreferrer">mootools</a>) is about 2x as slow as the traditional <code>document.createElement()</code> in IE7. I ran a test to create 1000 <code>&lt;spans&gt;</code> and add them to a <code>&lt;div&gt;</code>, using <code>new Element()</code> takes about 1800ms on IE7 (running on Virtual PC), the traditional method takes about 800ms.</p> <p>My test also revealed an even quicker method, at least for a simple test such as mine: using <a href="http://ejohn.org/blog/dom-documentfragments/" rel="nofollow noreferrer">DocumentFragments as described by John Resig</a>. Running the same test on the same machine with IE7 took 247ms, a <strong>9x</strong> improvement from my original method!</p>
[ { "answer_id": 429199, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "innerHTML" }, { "answer_id": 429209, "author": "Greg", "author_id": 24181, "author_profile": "https://Stac...
2009/01/09
[ "https://Stackoverflow.com/questions/429174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249/" ]
429,186
<p>OK, I'm confused how to write an INSERT/UPDATE for this simple app I'm developing locally to learn more about db interactions.</p> <p>I have an "edit" page, which is populated from the db and lists up to 9 user links (<strong>user_id 2</strong> in this case), so something like:</p> <pre><code>&lt;input type="text" name="link1" value="www.yahoo.com"&gt; &lt;input type="text" name="link2" value="www.google.com"&gt; &lt;input type="text" name="link3" value="www.amazon.com"&gt; &lt;input type="text" name="link4" value=""&gt; &lt;input type="text" name="link5" value=""&gt; &lt;input type="text" name="link6" value=""&gt; &lt;input type="text" name="link7" value=""&gt; &lt;input type="text" name="link8" value=""&gt; &lt;input type="text" name="link9" value=""&gt; &lt;input type="submit" name="submitted" value="update"&gt; </code></pre> <p><em>There should be 9 text inputs showing up here, the first 3 inputs populated with urls from the links table below...Those inputs don't seem to be showing up in my question even though they do in my preview.</em> </p> <p>My <strong>links</strong> table is just 2 columns and looks like:</p> <pre><code>user_id linkurl 1 http://www.abcnews.com 2 http://www.yahoo.com 2 http://www.google.com 2 http://www.amazon.com 3 http://www.ebay.com 3 http://www.craigslist.org </code></pre> <p>How do I go about writing an INSERT/UPDATE query for, say, editing the 3rd link and adding a 4th, possibly a 5th, 6th, 7th, 8th and 9th?</p> <p>I also have on this same page a section for the user's personal info and I can update that easily with a query like:</p> <pre><code>$query = "UPDATE users SET first_name='$firstname', last_name='$lastname', email='$email', state='$state'" if($newpass1){ $query .= ", pass=md5('$newpass1')"; } $query .= " WHERE user_id = {$_SESSION['user_id']}"; </code></pre>
[ { "answer_id": 429221, "author": "Re0sless", "author_id": 2098, "author_profile": "https://Stackoverflow.com/users/2098", "pm_score": 2, "selected": false, "text": "<input type=\"text\" name=\"link1\" value=\"www.yahoo.com\"> \n<input type=\"hidden\" name=\"oldlink1\" value=\"www.yahoo....
2009/01/09
[ "https://Stackoverflow.com/questions/429186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,193
<p>What's the simplest way to parse an Excel file in Perl? Converting it to a text file would also work.</p>
[ { "answer_id": 429492, "author": "jmcnamara", "author_id": 10238, "author_profile": "https://Stackoverflow.com/users/10238", "pm_score": 6, "selected": true, "text": "#!/usr/bin/perl -w\n\nuse strict;\nuse warnings;\n\nuse Spreadsheet::ParseExcel;\n\nmy $parser = Spreadsheet::ParseExce...
2009/01/09
[ "https://Stackoverflow.com/questions/429193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
429,200
<p>I am building a WPF app using navigation style pages and not windows. I want to show a window inside a page, this window must be modal to the page, but allow the user to go to other page, and go back to the same page with the modal window in the same state.</p> <p>I have tried with the WPF popup control but the problem is that the control hides everytime you navigate away from the page. I guess that I can write the code to show it again, but does not seams the right way.</p> <p>What is the best way to do this in WPF?</p>
[ { "answer_id": 584302, "author": "Caleb Vear", "author_id": 67731, "author_profile": "https://Stackoverflow.com/users/67731", "pm_score": 2, "selected": false, "text": "protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)\n{\n // We want this control ...
2009/01/09
[ "https://Stackoverflow.com/questions/429200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
429,202
<p><strong>UPDATE:</strong> <em>I've been experimenting with my controls some more and I think I've gotten closer. Please read on for updated info.</em></p> <p>I have 2 ASP.NET 2.0 user controls, one of which is placed <em>inside</em> of the other one. Inside of the inner control I have an <code>HtmlAnchor</code> tag control which I'm trying to set a URL for from the outer control. When I attempt to set the <code>HRef</code> property from the rendering page's markup, the <code>HtmlAnchor</code> control is <code>null</code> and throws an exception.</p> <p>The URL <code>set</code> property is being called <em>before</em> the OnInit event of either the inner or the outer control and before the main Page's '<code>OnPreInit</code>' event. I'm assuming this is because I am setting the URL of the child control in the markup of the parent control on the page I'm rendering the controls on which means the value is set before <code>OnInit()</code>. Here is the (stripped down) version of the code I'm using: </p> <pre><code>[ParseChildren(true)]// &lt;- Setting this to false makes the // page render without an exception // but ignores anything in the markup. [PersistChildren(false)] public partial class OuterControl : System.Web.UI.UserControl { // The private '_Inner' control is declared // in the .ascx markup of the control [PersistenceMode(PersistenceMode.InnerProperty)] public InnerControl Inner { get{ return _Inner; } set{ _Inner = value; } } } public partial class InnerControl : System.Web.UI.UserControl { // The private 'linkHref' control is declared // in the .ascx markup of the control public string Url { get { return linkHref.HRef; } set { linkHref.HRef = value; } } } </code></pre> <p>The OuterControl is used on my Default.aspx page like this:</p> <pre><code>&lt;uc1:OuterControl ID="OuterCtrl1" runat="server"&gt; &lt;Inner Url="#" /&gt; &lt;/uc1:OuterControl&gt; </code></pre> <p>In the markup example above, if I try to render this page an exception gets thrown because the <code>linkHref</code> control is null. Using my debugger I can see that every control within the InnerControl is null, but both the InnerControl &amp; OuterControl's <code>OnInit()</code> event has not been triggered yet when the <code>Url</code> property is accessed.</p> <p><strong>UPDATE</strong><br> I thought adding the attributes '<code>ParseChildren</code>' and '<code>PersistChildren</code>' would help. I've used them in Server Controls before but never in User Controls, although the effect seems to be similar. I don't think I'm interpreting the documentation for these two properties correctly, but it can stop exceptions from being thrown. The page markup becomes ignored though.</p> <p>Does anyone know a way to have this work. I don't understand why these controls are getting values set before <code>OnInit()</code>. When I try to set their values using the ASPX markup, the constructor for the <code>InnerControl</code> is being called twice. Once to set the values based on the markup (I'm assuming) and again on <code>OnInit()</code> (which I'm guessing is why the markup values are getting ignored).</p> <p>Is this effort hopeless or am I just approaching it from the wrong angle?</p>
[ { "answer_id": 871158, "author": "Nathan Southerland", "author_id": 81690, "author_profile": "https://Stackoverflow.com/users/81690", "pm_score": 0, "selected": false, "text": "// The private 'linkHref' control is declared\n// in the .ascx markup of the control\n" }, { "answer_id...
2009/01/09
[ "https://Stackoverflow.com/questions/429202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
429,205
<p>I'm logging a bunch of data with <code>NSLog()</code>. Is there a way to capture the log data when my iPhone is not connected to my development machine and running under a debugger? </p> <p>For example, can I redirect it to a file and then read the log file back through Xcode at a later point in time? I need to do this in order to test my app when the WiFi is poor, which necessitates that I go far away from my desk.</p>
[ { "answer_id": 429685, "author": "Stephan Burlot", "author_id": 53071, "author_profile": "https://Stackoverflow.com/users/53071", "pm_score": 5, "selected": false, "text": "- (void) redirectConsoleLogToDocumentFolder\n{\n NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDi...
2009/01/09
[ "https://Stackoverflow.com/questions/429205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9530/" ]
429,211
<p>We backed up a site on our development server and restored it to our production server on a different domain.<br /> To clear up all the users on the site we used the web.SiteUsers.Remove() for all users on the root web, on our dev site.<br /> On taking a backup and restoring to the production server using stsadm, we are now getting the error "user does not exist or is not unique" during the restore process which is failing (at the stsadm -o restore command itself). <br /> Any pointers to a solution to this or what are we doing wrong would be welcome. We are looking to remove users from the site collection before restoring to production.<br /></p> <p>Kind regards,</p>
[ { "answer_id": 432946, "author": "Øyvind Skaar", "author_id": 49194, "author_profile": "https://Stackoverflow.com/users/49194", "pm_score": 1, "selected": false, "text": "stsadm -o migrateuser stsadm -o deleteuser" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21586/" ]
429,216
<p>My web application worked very well in a Windows Server 2003 with .NET Framework 2.0. When I migrated to Windows Server 2008 with .NET Framework 3.5.</p> <p>With the same code running in both servers the difference between them was the following: for a given async ASHX (IHttpAsyncHandler) the previous server automatically answered the request with the Connection and Content-Length headers. As the new server didn't automatically generated those headers with the previous code, I had to alter the code to do it manually, or otherwise the web clients couldn't determine the end of the response.</p> <p>My question is, isn't .NET Framework 3.5 supposed to maintain full backwards compatibility with .NET 2.0?</p>
[ { "answer_id": 432946, "author": "Øyvind Skaar", "author_id": 49194, "author_profile": "https://Stackoverflow.com/users/49194", "pm_score": 1, "selected": false, "text": "stsadm -o migrateuser stsadm -o deleteuser" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
429,219
<p>I am working on a CF site and need to get data from MySQL tables.</p> <p>I can create the CFQuery fine and check for records returned, but how do I take the records returned and loop through them and get data from specific fields in each row.</p> <p>I can write while if/end if, etc, I just dont recall how to get access to the data.</p> <p>-JAson</p>
[ { "answer_id": 429320, "author": "Sam Farmer", "author_id": 4927, "author_profile": "https://Stackoverflow.com/users/4927", "pm_score": 3, "selected": false, "text": "<cfoutput query=\"#the_query#\">\n #firstName# ... etc <br>\n</cfoutput>\n" }, { "answer_id": 429338, "auth...
2009/01/09
[ "https://Stackoverflow.com/questions/429219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,225
<p>I was just wondering if it is possible to capture the output of a separate process running on windows?</p> <p>For instance if i have a console app running, could i run a second app, a forms app, and have that app capture the output from the console app and display it in a text box?</p>
[ { "answer_id": 429317, "author": "scottm", "author_id": 53007, "author_profile": "https://Stackoverflow.com/users/53007", "pm_score": 2, "selected": true, "text": " Process[] p = Process.GetProcessesByName(\"myprocess.exe\");\n\n StreamReader sr = p[0].StandardOutput;\n\n while ...
2009/01/09
[ "https://Stackoverflow.com/questions/429225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18811/" ]
429,251
<p>I'm using the selenium IDE and the Selenium-Fitnesse Bridge fixture and I'm trying to test that when I clear a default value out of a form field, my form displays an error message.</p> <p>So when I record with the Selenium IDE, what it does is the equivalent of telling Selenium to type nothing.</p> <pre>| type | text_field | |</pre> <p>The problem with this is that the Fitnesse fixture I'm using expects that second argument to not be null.</p> <p>Is there a way in Selenium to "clear a value" rather than "typing nothing"?</p>
[ { "answer_id": 429285, "author": "Gavin Miller", "author_id": 33226, "author_profile": "https://Stackoverflow.com/users/33226", "pm_score": 3, "selected": false, "text": "| verifyEval | javascript{this.browserbot.getCurrentWindow().document.getElementById('CONTROL_ID').value = ''} || \n"...
2009/01/09
[ "https://Stackoverflow.com/questions/429251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48523/" ]
429,254
<p>Perl uses reference counting for GC, and it's quite easy to make a circular reference by accident. I see that my program seems to be using more and more memory, and it will probably overflow after a few days.</p> <p>Is there any way to debug memory leaks in Perl? Attaching to a program and getting numbers of objects of various types would be a good start. If I knew which objects are much more numerous than expected I could check all references to them and hopefully fix the leak.</p>
[ { "answer_id": 429341, "author": "geocar", "author_id": 37507, "author_profile": "https://Stackoverflow.com/users/37507", "pm_score": 6, "selected": true, "text": "malloc() malloc() malloc() malloc() undef($old_object) free(old_object); exit() and exec() Storable $^F exec($0) $ENV{EXEC_G...
2009/01/09
[ "https://Stackoverflow.com/questions/429254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52751/" ]
429,255
<p>I've recently started using it. However, after running it against one of my company's largest project. It turns up mountains of problems.</p> <p>The list of problems was so overwhelming it would take days to find and fix some, if not all of the stuff.</p> <p>Now, I know that it's not very practical to fix everything FxCop tells you to fix. But as I am new to this little tool...</p> <p><strong>What are some good tips and tricks on using FxCop effectively?</strong></p> <p>On a new project and on an existing project?</p> <p>If also provided the programmers at my company generally writes good code?</p>
[ { "answer_id": 3968358, "author": "Patrick from NDepend team", "author_id": 27194, "author_profile": "https://Stackoverflow.com/users/27194", "pm_score": 0, "selected": false, "text": "warnif count > 0 \nfrom m in Methods\nwhere m.CyclomaticComplexity > 20 &&\n m.WasAdded() || m.Cod...
2009/01/09
[ "https://Stackoverflow.com/questions/429255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3055/" ]
429,275
<p>I'm building a program that uses plugins. Unfortunately, the plugin framework's dynamic linking forces the RTL and VCL out of my project EXE and into the BPL versions, and they don't have debug info enabled.</p> <p>So I built a testing framework that links to my plugins statically so I can actually see what I'm doing while tracing through the code. But now, every time I try to recompile, I get an error: "unit turbu_skills was compiled with a different version of turbu_database.GDatabase"</p> <p>I've seen this error before, but only when I've been changing things I probably shouldn't have been, like the RTL or VCL libraries. I don't understand why it's doing that with my own code. The turbu_skills and turbu_database units are both units I wrote myself. GDatabase is a global singleton variable, whose class definition I haven't changed in weeks. Any change that triggers a recompile causes this error, even if I haven't touched anything in either of the units.</p> <p>Doing a full build (SHIFT-F9) causes it to compile correctly. But if I then press <strong>SPACE</strong> in a unit (<em>any</em> unit) and hit F9, I get the error again. What's going on and how do I stop it? This doesn't happen in the main app, only the testing framework.</p> <p>EDIT: I have the source to all of my units. Deleting DCUs and similar files doesn't help. Copying the entire project to a different computer, deleting all DCUs, and building there doesn't help. There's an objective, reproducible conflict between the layout of my program and the compiler, and I want to be rid of it.</p> <p>The source can be found at <a href="http://www.turbu-rpg.com/downloads/Turbu_source_setup.exe" rel="noreferrer">http://www.turbu-rpg.com/downloads/Turbu_source_setup.exe</a> if anyone wants to test it. It requires Delphi 2009 with the JVCL already installed; the installer package will take care of the rest. Maybe having the source code available will help someone track this down. I certainly hope so, because wherever the issue is, it's beyond me. The problem can be found in testing.exe and also in turbu.exe in turbu.groupproj.</p> <p>EDIT 2: Turns out this was another cross-unit generics issue. Grr. I managed to code a workaround. I just hope they get the generics problems fixed soon.</p>
[ { "answer_id": 429453, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 4, "selected": false, "text": " +--------+\n | unit A |\n +--------+\n | |\n | |\n V |\n +--------+ |\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32914/" ]
429,334
<p>I have an ASP.NET page. What I want to do is pass in an ID field that is in the querystring.</p> <p>So if my page is</p> <p><a href="http://www.mysite.com/default.aspx?id=35" rel="nofollow noreferrer">http://www.mysite.com/default.aspx?id=35</a></p> <p>I want a silverlight control that is on this page to have access to the id field. My silverlight control is going to get data for a grid and it needs to use the id.</p>
[ { "answer_id": 429513, "author": "Michael S. Scherotter", "author_id": 27306, "author_profile": "https://Stackoverflow.com/users/27306", "pm_score": 3, "selected": false, "text": "using System.Windows.Browser;\n\nstring queryString = HtmlPage.Document.DocumentUri.Query;\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
429,351
<p>I have a Clickonce application that is launched from the start menu (local). I would like to be able to specify a parameter so that the application can load certain data. The application lives on a fileshare and will be launched using the URL only once (like <a href="http://msdn.microsoft.com/en-us/library/ms172242(VS.80).aspx" rel="noreferrer">described here on MSDN</a>). This implies that the method describe in this link will not work; users will be launching the application using an .appref-ms shortcut in the Start Menu. </p> <p>I haven't been able to find a solution. Is it possible to somehow pass a parameter into the click once application? If so, how? If not, what are some alternatives?</p>
[ { "answer_id": 430536, "author": "joshua.ewer", "author_id": 28664, "author_profile": "https://Stackoverflow.com/users/28664", "pm_score": 5, "selected": true, "text": "http://clickonce.example.com/shell.application?p1=this&p2=that" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7583/" ]
429,363
<p>If my program was to hit the database with multiple updates would it be better to pull in the tables into a dataset, change the values and then send it back to the database. Does anyone know what's more expensive?</p>
[ { "answer_id": 429369, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 0, "selected": false, "text": "DataSet DataSet XML" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45429/" ]
429,370
<p>Is there the equivalent of the "Hello World" program for GIS applications?</p> <p>I am looking to become more familiar with the development of GIS applications. What are the popular (and free/low cost) tutorials and/or sample applications that would help someone get started? Are there any books that you would consider essential for beginner GIS developers?</p>
[ { "answer_id": 429571, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "( 0, 100), ( 0, 0), ( 0, 50), ( 80, 50), ( 80, 0), ( 80, 100)\n( 180, 100), ( 100, 100), ( 100, 50), ...
2009/01/09
[ "https://Stackoverflow.com/questions/429370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,380
<p>What's the simplest way to get XmlSerializer to also serialize private and "public const" properties of a class or struct? Right not all it will output for me is things that are only public. Making it private or adding const is causing the values to not be serialized.</p>
[ { "answer_id": 429418, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 5, "selected": true, "text": "XmlSerializer" }, { "answer_id": 429551, "author": "Marc Gravell", "author_id": 23354, "author_prof...
2009/01/09
[ "https://Stackoverflow.com/questions/429380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194/" ]
429,385
<p>Use case: User 1 uploads 100 company names (e.g. Microsoft, Bank of Sierra)</p> <p>User 2 uploads 100 company names (e.g. The Gap, Uservoice, Microsoft, Inc.)</p> <p>I want User 1's notion of Microsoft and User 2's notion of Microsoft to map to a centrally maintained entity with a unique index for Microsoft.</p> <p>If someone uploads a name which isn't in the central repository, I guess I'd like it to be entered as is. But then what happens if that first entry is incorrectly spelled (e.g. Vergin Mobile instead of Virgin Mobile?) How can we best correct it and correlate new uploads to that same index?</p> <p>Technically, should the central repository be a separate database altogether? Should even the user generated information be in a separate database, as well, from the business transactions that will occur against it?</p> <p>Starting out with a large definition of the problem and hoping to chunk it up with your input, thanks.</p>
[ { "answer_id": 429411, "author": "mson", "author_id": 36902, "author_profile": "https://Stackoverflow.com/users/36902", "pm_score": -1, "selected": false, "text": "company table \n id\n name\n\ncompany_synonym table\n company_id\n name\n" }, { "answer_id": 429422, "aut...
2009/01/09
[ "https://Stackoverflow.com/questions/429385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43980/" ]
429,386
<p>I have a main TCL proc that sources tons of other tcl procs in other folders and subsequent subdirectories. For example, in the main proc it has:</p> <pre><code>source $basepath/folderA/1A.tcl source $basepath/folderA/2A.tcl source $basepath/folderA/3A.tcl source $basepath/folderB/1B.tcl source $basepath/folderB/2B.tcl source $basepath/folderB/3B.tcl </code></pre> <p>and it seems kind of stupid to do it that way when I always know I will source everything in folderA and folderB. Is there a function (or simple way) that'll allow me to just source all the .tcl files in an entire folder?</p>
[ { "answer_id": 429490, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 2, "selected": false, "text": "set includes [open \"|find $basedir -name \\*.tcl -print\" r]\n\nwhile { [gets $includes include] >= 0 } {\n source $i...
2009/01/09
[ "https://Stackoverflow.com/questions/429386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16866/" ]
429,401
<p>I'm using Instruments to try to determine if there are places in my application that I could be more efficient with use of memory. I've taken the time to get somewhat familiar with Instruments but I'm generally a newbie with hunting memory management issues having come from a Java background. I seem to be using about 1.82mb by calls to this method:</p> <pre><code>+ (NSString *)stringFromDateWithFormat:(NSDate *)date withFormat:(NSString *)format { NSDateFormatter *dateFormatter; NSString *result; if (nil == date || nil == format) return nil; result = nil; if (nil != (dateFormatter = [[NSDateFormatter allocWithZone:[self zone]] init])) { [dateFormatter setDateFormat:format]; if (nil != (result = [dateFormatter stringFromDate:date])) { [dateFormatter release]; return result; } [dateFormatter release]; } return nil; } </code></pre> <p>As I'm releasing the date formatter I'm wondering if the NSString <em>result</em> is my issue. It seems to me that the stringFromDate library call would return an autoreleased object so there's nothing I can do to 'manually' manage it. A bit unsure of how to optimize this method. </p>
[ { "answer_id": 429686, "author": "Tony", "author_id": 34101, "author_profile": "https://Stackoverflow.com/users/34101", "pm_score": 3, "selected": true, "text": "int i;\nNSAutoreasePool* pool = nil;\nfor (i = 0; i < 1000000; ++i) {\n /* Create a new pool every 10000 iterations */\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/386102/" ]
429,414
<p>this is what I did. is there a better way in python?</p> <pre> for k in a_list: if kvMap.has_key(k): kvMap[k]=kvMap[k]+1 else: kvMap[k]=1 </pre> <p>Thanks</p>
[ { "answer_id": 429442, "author": "John Novatnack", "author_id": 53490, "author_profile": "https://Stackoverflow.com/users/53490", "pm_score": 3, "selected": false, "text": "a_list.count(k)\n counts = dict((k, a_list.count(k)) for k in set(a_list))\n" }, { "answer_id": 429469, ...
2009/01/09
[ "https://Stackoverflow.com/questions/429414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53483/" ]
429,416
<p>I'm writing a piece of code that requires the <code>DOM</code> of a website to remain frozen while arbitrary JavaScript runs. Attributes changing is fine but I can't have anything changing the original tag structure of the page!</p> <p>I know in JavaScript there are a base number of functions that can modify the <code>DOM</code>:</p> <pre><code>appendChild( nodeToAppend ) cloneNode( true|false ) createElement( tagName ) createElemeentNS( namespace, tagName ) createTextNode( textString ) innerHTML insertBefore( nodeToInsert, nodeToInsertBefore ) removeChild( nodetoRemove ) replacechild( nodeToInsert, nodeToReplace ) </code></pre> <p>My initial thought was simply to overwrite these functions as no ops:</p> <pre><code>&gt;&gt;&gt; document.write('&lt;p&gt;Changing your DOM. Mwwhaha!&lt;/p&gt;') &gt;&gt;&gt; document.write = function() {} &gt;&gt;&gt; document.write('&lt;p&gt;No-op now!&lt;/p&gt;') </code></pre> <p>While it's easy to do this for the <code>document</code> object the <code>DOM</code> modification functions can be called from many different JavaScript objects! If I could overwrite these functions at top level perhaps it would work?</p> <p>Update from sktrdie:</p> <pre><code>&gt;&gt;&gt; HTMLElement.prototype.appendChild = function(){} &gt;&gt;&gt; $("a").get(0).appendChild(document.createElement("div")) # Still works argh. &gt;&gt;&gt; HTMLAnchorElement.prototype.appendChild = function(){} &gt;&gt;&gt; $("a").get(0).appendChild(document.createElement("div")) # No-op yeah! </code></pre> <p>So it would seem I could just gather the constructors of all <code>DOM</code> elements and run over them putting in no-ops but that still seems pretty messy ... </p> <p><strong>How can I protect the <code>DOM</code> from modification from arbitrary JavaScript?</strong></p>
[ { "answer_id": 429436, "author": "Ali", "author_id": 49153, "author_profile": "https://Stackoverflow.com/users/49153", "pm_score": 0, "selected": false, "text": "<div> <div>" }, { "answer_id": 429733, "author": "TJ L", "author_id": 12605, "author_profile": "https://St...
2009/01/09
[ "https://Stackoverflow.com/questions/429416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37522/" ]
429,439
<p>I have built a simple web service that simply uses HttpListener to receive and send requests. Occasionally, the service fails with &quot;Specified network name is no longer available&quot;. It appears to be thrown when I write to the output buffer of the HttpListenerResponse.</p> <p>Here is the error:</p> <blockquote> <p>ListenerCallback() Error: The specified network name is no longer available at System.Net.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 size)</p> </blockquote> <p>and here is the guilty portion of the code. responseString is the data being sent back to the client:</p> <pre class="lang-cs prettyprint-override"><code>buffer = System.Text.Encoding.UTF8.GetBytes(responseString); response.ContentLength64 = buffer.Length; output = response.OutputStream; output.Write(buffer, 0, buffer.Length); </code></pre> <p>It doesn't seem to always be a huge buffer, two examples are 3,816 bytes and, 142,619 bytes, these errors were thrown about 30 seconds apart. I would not think that my single client application would be overloading HTTPlistener; the client does occasionally sent/receive data in bursts, with several exchanges happening one after another.</p> <p>Mostly Google searches shows that this is a common IT problem where, when there are network problems, this error is shown -- most of the help is directed toward sysadmins diagnosing a problem with an app moreso than developers tracking down a bug. My app has been tested on different machines, networks, etc. and I don't think it's simply a network configuration problem.</p> <p>What may be the cause of this problem?</p>
[ { "answer_id": 1380491, "author": "Nicholas Piasecki", "author_id": 32187, "author_profile": "https://Stackoverflow.com/users/32187", "pm_score": 3, "selected": false, "text": "ContentLength64 KeepAlive false Content-Length HttpListenerResponse" }, { "answer_id": 65074955, "a...
2009/01/09
[ "https://Stackoverflow.com/questions/429439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/525/" ]
429,443
<p>I am writing a Django app, and I would like an account to be created on our Google Apps hosted email using the Provisioning API whenever an account is created locally.</p> <p>I would solely use signals, but since I would like the passwords to be synchronized across sites, I have monkeypatched <code>User.objects.create_user</code> and <code>User.set_password</code> using wrappers to create Google accounts and update passwords respectively.</p> <p>Monkeypatching seems to be frowned upon, so I would to know, is there a better way to accomplish this?</p>
[ { "answer_id": 1157826, "author": "Paul Tarjan", "author_id": 90025, "author_profile": "https://Stackoverflow.com/users/90025", "pm_score": 0, "selected": false, "text": "class User(MyBaseModel):\n user = models.OneToOneField(User, help_text=\"The django created User object\")\n @logi...
2009/01/09
[ "https://Stackoverflow.com/questions/429443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42633/" ]
429,446
<p>I'm currently using ReSharper's 30-day trial, and so far I've been impressed with the suggestions it makes. One suggestion puzzles me, however.</p> <p>When I explicitly define a variable, such as:</p> <pre><code>List&lt;String&gt; lstString = new List&lt;String&gt;(); </code></pre> <p>ReSharped adds a little squiggly green line and tells me to:</p> <blockquote> <p>Use implicitly type local variable declaration.</p> </blockquote> <p>If I then follow its suggestion, ReSharper changes the line of code to:</p> <pre><code>var lstString = new List&lt;String&gt;(); </code></pre> <p>So, is there some sort of performance gain to be had from changing the <code>List&lt;String&gt;</code> to a <code>var</code>, or is this merely a peculiarity of ReSharper? I've always been taught that explicitly defining a variable, rather than using a dynamic, is more optimal.</p>
[ { "answer_id": 429447, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": false, "text": "var IEnumerable<T> List<T>" }, { "answer_id": 429461, "author": "Matt Brunell", "author_id": 24970, "autho...
2009/01/09
[ "https://Stackoverflow.com/questions/429446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50786/" ]
429,448
<p>[I'm not asking about the architecture of SO, but it would be helpful to the question.]</p> <p>On SO, when a user clicks on his/her name and clicks on "responses" they see other users responses to comment threads, questions, and answers in which they have participated. I've had the sneaking suspicion that I've missed certain responses out there, which made me wonder: <strong>if you had to build that thing, would you pull everything dynamically from the database every time a user requested it?</strong> Or would you modify it when there is new related activity in the application? Or would you build it in a nightly daemon process? </p> <p>I imagine that the real answer is that it's dynamically constructed every time, but that the tables are denormalized in such a way so as to make the thing less time-consuming. <strong>How would you build it?</strong></p> <p>I'm asking about any platform, of course, not only on .Net.</p>
[ { "answer_id": 429498, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 1, "selected": false, "text": "select * from responses where user=<userid> order by time desc limit 30\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8047/" ]
429,449
<p>I know that I can display a PDF file in my c# executable (not web app) with:</p> <pre><code>private AxAcroPDFLib.AxAcroPDF axAcroPDF1; axAcroPDF1.LoadFile(@"somefile.pdf"); axAcroPDF1.Show(); </code></pre> <p>But that is the regular pdf viewer like in the browser. I don't want that. I want full Adobe Standard or Professional functionality in my C# application using the Adobe controls. For example, if I use the code above, it loads in the C# app and I can see the adobe toolbar (print, save, etc.) But it is useless to me because I need things like save which cannot be done with the activex viewer above. Specifically, you cannot save, just as you cannot within the broswer.</p> <p>So, I referenced the acrobat.dll and am trying to use:</p> <pre><code>Acrobat.AcroAVDocClass _acroDoc = new Acrobat.AcroAVDocClass(); Acrobat.AcroApp _myAdobe = new Acrobat.AcroApp(); Acrobat.AcroPDDoc _pdDoc = null; _acroDoc.Open(myPath, "test"); pdDoc = (Acrobat.AcroPDDoc)(_acroDoc.GetPDDoc()); _acroDoc.SetViewMode(2); _myAdobe.Show(); </code></pre> <p>It opens adobe acrobat but it opens it outside of my c# application. I need it to open in my c# application like the activex library does. Can it be done with these libraries?</p> <p>If I cannot open it in my c# application I would like to be able to "hold" my c# app tied to it so the c# app knows when I close the adobe app. At least that way I'd have some measure of control. This means I would hit open, the adobe app opens. I close the adobe app, my C# app is aware of this and loads the newly changed doc with the activex library (because I don't need change ability anymore, just displaying.)</p> <p>I have the full versions of adobe acrobat installed on my computer. It is not the reader.</p> <p>Thank you for any help.</p> <p>edit: There is an example in vb in the adobe acrobat sdk. I believe it is called activeview.</p>
[ { "answer_id": 538359, "author": "psamwel", "author_id": 3089, "author_profile": "https://Stackoverflow.com/users/3089", "pm_score": 0, "selected": false, "text": "public void Open(string myPath)\n{\n Acrobat.AcroAVDocClass _acroDoc = new Acrobat.AcroAVDocClass();\n Acrobat.AcroApp...
2009/01/09
[ "https://Stackoverflow.com/questions/429449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28045/" ]
429,450
<p>I am trying to post an array full of checkboxes and to open it in the next page..</p> <p>It only gives me the last result, anyone know why? or how to fix it?</p> <pre><code>&lt;form name="input" action="createevent.php" method="post"&gt; Event title: &lt;input type="text" name="Eventtitle" size="20"&gt; &lt;br&gt;Event Description &lt;input type="text" name="Description" size="20"&gt; &lt;br&gt; Please select the days that you are free to arrange this meeting.&lt;br&gt; Monday &lt;input type="checkbox" name="day" value="Monday" /&gt; &lt;br /&gt; Tuesday &lt;input type="checkbox" name="day" value="Tuesday" /&gt; &lt;br /&gt; Wednesday &lt;input type="checkbox" name="day" value="Wednesday" /&gt; &lt;br /&gt; Thursday &lt;input type="checkbox" name="day" value="Thursday" /&gt; &lt;br /&gt; Friday &lt;input type="checkbox" name="day" value="Friday" /&gt; &lt;br /&gt; Saturday &lt;input type="checkbox" name="day" value="Saturday" /&gt; &lt;br /&gt; Sunday &lt;input type="checkbox" name="day" value="Sunday" /&gt; &lt;br /&gt;&lt;br /&gt; &lt;input type="submit" value="Submit"&gt; </code></pre> <p>and no matter how many you select it only gives a single result on the next page. $day = sizeof($_POST['day']);</p> <p>only ever gives '1' answer. And when I get them to the next page I will want to be able to select them separately.</p> <p>Thanks!</p>
[ { "answer_id": 429479, "author": "Wally Lawless", "author_id": 37, "author_profile": "https://Stackoverflow.com/users/37", "pm_score": 3, "selected": false, "text": "Monday\n<input type=\"checkbox\" name=\"day[]\" value=\"Monday\" />\n<br />\nTuesday\n<input type=\"checkbox\" name=\"day[...
2009/01/09
[ "https://Stackoverflow.com/questions/429450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45344/" ]
429,452
<p>I was wondering if there is a way (hopefully keyboard shortcut) to create auto generate function headers in visual studio.</p> <p>Example:</p> <pre><code>Private Function Foo(ByVal param1 As String, ByVal param2 As Integer) </code></pre> <p>And it would automagically become something like this...</p> <p><br></p> <pre><code>'---------------------------------- 'Pre: 'Post: 'Author: 'Date: 'Param1 (String): 'Param2 (Integer): 'Summary: Private Function Foo(ByVal param1 As String, ByVal param2 As Integer) </code></pre>
[ { "answer_id": 429787, "author": "Michael Paulukonis", "author_id": 41153, "author_profile": "https://Stackoverflow.com/users/41153", "pm_score": 9, "selected": true, "text": "/// /// <summary>\n/// \n/// </summary>\n/// <returns></returns>\n" }, { "answer_id": 429804, "autho...
2009/01/09
[ "https://Stackoverflow.com/questions/429452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53484/" ]
429,470
<p>I distinctly remember that, at one time, the guideline pushed by Microsoft was to add the &quot;Base&quot; suffix to an abstract class to obviate the fact that it was abstract. Hence, we have classes like <code>System.Web.Hosting.VirtualFileBase</code>, <code>System.Configuration.ConfigurationValidatorBase</code>, <code>System.Windows.Forms.ButtonBase</code>, and, of course, <code>System.Collections.CollectionBase</code>.</p> <p>But I've noticed that, of late, a lot of abstract classes in the Framework don't seem to be following this convention. For example, the following classes are all abstract but don't follow this convention:</p> <ul> <li><p><code>System.DirectoryServices.ActiveDirectory.DirectoryServer</code></p> </li> <li><p><code>System.Configuration.ConfigurationElement</code></p> </li> <li><p><code>System.Drawing.Brush</code></p> </li> <li><p><code>System.Windows.Forms.CommonDialog</code></p> </li> </ul> <p>And that's just what I could drum up in a few seconds. So I went looking up what the official documentation had to say, to make sure I wasn't crazy. I found the <a href="http://msdn.microsoft.com/en-us/library/ms229040.aspx" rel="noreferrer">Names of Classes, Structs, and Interfaces</a> on MSDN at <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx" rel="noreferrer">Design Guidelines for Developing Class Libraries</a>. Oddly, I can find no mention of the guideline to add &quot;Base&quot; to the end of an abstract class's name. And the guidelines are no longer available for version 1.1 of the Framework.</p> <p>So, am I losing it? Did this guideline ever exist? Has it just been abandoned without a word? Have I been creating long class names all by myself for the last two years for nothing?</p> <p>Someone throw me a bone here.</p> <p><strong>Update</strong> I'm not crazy. The guideline existed. <a href="https://learn.microsoft.com/en-us/archive/blogs/kcwalina/i-dont-like-the-base-suffix" rel="noreferrer">Krzysztof Cwalina gripes about it in 2005.</a></p>
[ { "answer_id": 429485, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": false, "text": "ConfigurationElement" }, { "answer_id": 48447066, "author": "Kooooons", "author_id": 9268299, "author_prof...
2009/01/09
[ "https://Stackoverflow.com/questions/429470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47580/" ]
429,478
<p>Does the garbage collector clean up web service references or do I need to call dispose on the service reference after I'm finished calling whatever method I call?</p>
[ { "answer_id": 429499, "author": "Dan Herbert", "author_id": 392, "author_profile": "https://Stackoverflow.com/users/392", "pm_score": 6, "selected": true, "text": "public static class WS\n{\n private static object sync = new object();\n private static MyWebService _MyWebServiceIns...
2009/01/09
[ "https://Stackoverflow.com/questions/429478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32908/" ]
429,483
<p>I can find lots of tutorials showing you how to load an array into a database field but can't seem to figure out how to pull each entry in a field into an array as seperate items. Seems simple enough just can't get it to work, any help?</p>
[ { "answer_id": 429511, "author": "Sergey Kuznetsov", "author_id": 102447, "author_profile": "https://Stackoverflow.com/users/102447", "pm_score": 0, "selected": false, "text": "$big_2_dimensional_array_of_data;\n\nforeach ($big_array_of_data as $row) {\n $query = \"INSERT INTO table_nam...
2009/01/09
[ "https://Stackoverflow.com/questions/429483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,486
<p>I'm writing a C program for mac, and I need to allow the user to choose an application to send an apple event to. I can create a navigation window, using <code>NavCreateChooseFileDialog()</code>, but I can't get it to enable any .app files. If I restrict the types using <code>NavDialogSetFilterTypeIdentifiers</code>, it will only allow me to select applications like MS Office, that don't have .app in the folder name. Everything else is greyed out.</p> <p>Any ideas?</p>
[ { "answer_id": 429511, "author": "Sergey Kuznetsov", "author_id": 102447, "author_profile": "https://Stackoverflow.com/users/102447", "pm_score": 0, "selected": false, "text": "$big_2_dimensional_array_of_data;\n\nforeach ($big_array_of_data as $row) {\n $query = \"INSERT INTO table_nam...
2009/01/09
[ "https://Stackoverflow.com/questions/429486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53491/" ]
429,487
<p>Within my a certain function of a class, I need to use <code>setInterval</code> to break up the execution of the code. However, within the <code>setInterval</code> function, "this" no longer refers to the class "myObject." How can I access the variable "name" from within the <code>setInterval</code> function?</p> <pre><code>function myObject() { this.name = "the name"; } myObject.prototype.getName = function() { return this.name; } myObject.prototype.test = function() { // this works alert(this.name); var intervalId = setInterval(function() { // this does not work alert(this.name); clearInterval(intervalId); },0); } </code></pre>
[ { "answer_id": 429501, "author": "jacobangel", "author_id": 31318, "author_profile": "https://Stackoverflow.com/users/31318", "pm_score": 5, "selected": true, "text": "myObject.prototype.test = function() {\n // this works\n alert(this.name);\n var oThis = this;\n var interva...
2009/01/09
[ "https://Stackoverflow.com/questions/429487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53487/" ]
429,508
<p>So I've got a for loop that processes a list of IDs and has some fairly complex things to do. Without going into all the ugly details, basically this:</p> <pre> DECLARE l_selected APEX_APPLICATION_GLOBAL.VC_ARR2; ...snip... BEGIN -- get the list ids l_selected := APEX_UTIL.STRING_TO_TABLE(:P4_SELECT_LIST); -- process each in a nice loop FOR i IN 1..l_selected.count LOOP -- do some data checking stuff... -- here we will look for duplicate entries, so we can noop if duplicate is found BEGIN SELECT county_id INTO v_dup_check FROM org_county_accountable WHERE organization_id = :P4_ID AND county_id = v_county_id; -- NEXT;! NOOP;! but there is no next! EXCEPTION WHEN NO_DATA_FOUND THEN dbms_output.put_line('no dups found, proceeding'); END; -- here we have code we only want to execute if there are no dupes already IF v_dup_check IS NULL THEN -- if not a duplicate record, proceed... ELSE -- reset duplicate check variable v_dup_check := NULL; END; END LOOP; END; </pre> <p>How I normally handle this is by selecting into a value, and then wrap the following code in an IF statement checking to make sure that duplicate check variable is NULL. But it's annoying. I just want to be able to say NEXT; or NOOP; or something. Especially since I already have to catch the NO_DATA_FOUND exception. I suppose I could write a letter to Oracle, but I'm curious how others handle this.</p> <p>I could also wrap this in a function, too, but I was looking for something a little cleaner/simpler.</p>
[ { "answer_id": 429595, "author": "Luke Woodward", "author_id": 48503, "author_profile": "https://Stackoverflow.com/users/48503", "pm_score": 2, "selected": false, "text": "NO_DATA_FOUND l_count" }, { "answer_id": 429598, "author": "jimmyorr", "author_id": 19239, "auth...
2009/01/09
[ "https://Stackoverflow.com/questions/429508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50798/" ]
429,510
<p>I'm trying to understand this bit of code:</p> <p>in display.php:</p> <pre><code>&lt;html&gt; ... &lt;body&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; User info: &lt;iframe id="SpControlFrame1" name="SpControlFrame1" src="javascript:'';"path_src="index.php?cmd=YYY" &gt;&lt;/iframe&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>in another file, I have a switch statement:</p> <p>main.php</p> <pre><code>switch ("cmd") { case ZZZ: include("foo.php"); break; case YYY: include("blah.php") break; } </code></pre> <p>blah.php:</p> <pre><code>&lt;?php //some functions for processing ?&gt; &lt;html&gt; &lt;head&gt; ... &lt;/head&gt; &lt;body&gt; &lt;input type="text" size="12" name="username"&gt; &lt;input type="button" value="submit"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>1) So, can some explain what is happening here? The iframe is embedded in the page and doesn't cause a reload or anything like that. </p> <p>2) I'm trying to duplicate this functionality on another page but the iframe is always empty (I've verified this using the IE developer Toolbar)</p>
[ { "answer_id": 432703, "author": "Hans", "author_id": 51334, "author_profile": "https://Stackoverflow.com/users/51334", "pm_score": 0, "selected": false, "text": "User info: <iframe id=\"SpControlFrame1\" name=\"SpControlFrame1\" src=\"index.php?cmd=YYY\" ></iframe>\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29505/" ]
429,514
<p>I want to proxy all requests to Mongreel except for a few ruby apps that are running with fastcgi on apache.</p> <p>So basically i have <a href="http://domain.com/" rel="nofollow noreferrer">http://domain.com/</a> Mongreel app<br> <a href="http://domain.com/appa" rel="nofollow noreferrer">http://domain.com/appa</a> ruby app handled by apache<br> <a href="http://domain.com/app_testb" rel="nofollow noreferrer">http://domain.com/app_testb</a> ruby app handled by apache</p> <p>My httpd.conf looks like this:</p> <pre><code>RewriteEngine On RewriteCond $1 !^(appa|app_testb) RewriteRule ^(.*)$ http://127.0.0.1:port/$1 [P] </code></pre> <p>But it fails. <a href="http://doamin.com" rel="nofollow noreferrer">http://doamin.com</a> works as expected proxyed to Mongreel but the other 2 app are not handled by apache. Any ideea what's wrong with my config?</p> <p><strong>UPDATE</strong> Or how can i enable mod_proxy for everything except /appa/* and /app_testb/* ?</p>
[ { "answer_id": 429714, "author": "daniels", "author_id": 9789, "author_profile": "https://Stackoverflow.com/users/9789", "pm_score": 1, "selected": true, "text": "ProxyPass /appa !\nProxyPass /app_testb !\nProxyPass / http://127.0.0.1:port/\nProxyPassReverse / http://127.0.0.1:port/\n" ...
2009/01/09
[ "https://Stackoverflow.com/questions/429514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
429,524
<p>Coming up towards the end of developing an iPhone application and I'm wondering just how bad is it to use autorelease when developing for the iphone. I'm faced with some fairly random crashes and, so far, I can't pinpoint it to anything other than sloppy memory usage. </p> <p>As a Cocoa newbie I remember initially reading a guideline document that strongly suggested avoiding autorelease in favor of manual retain/release for iPhone. However, a more 'senior' Cocoa developer came on board early on (who ironically has been let go since), who used autorelease all over the place. Admittedly, I was went into "monkey see monkey do" mode, and it appears to be coming back to haunt me (I'm now the only developer on the project).</p> <p>So what to do next? It seems to me that I have to branch the code and try to go through and replace, where possible, autorelease code keeping my fingers crossed that I don't inadvertently break the app. It seems a lot of library calls result in autoreleased objects like stringWithFormat and pretty much anything where I'm not using alloc myself. Any other gotchyas and/or suggestions I should be looking out for? Thanks Cocoa gurus.</p>
[ { "answer_id": 430841, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 2, "selected": false, "text": "alloc dealloc NSAutoreleasePool autorelease release autorelease NSAutoreleasePool NSThread UIKit" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/386102/" ]
429,527
<p>Ok, I'm an MVC newbie coming from a webforms background, so please excuse any ignorance here. Here is my scenario. I've got a table consisting of a list of applications and associated permissions. Each table row consists of 3 pieces of information: a checkbox, some text describing the row, and a dropdown list allowing the user to select the appropriate permission for the application. I want to post this data and only work with the rows in the table which were checked (the id of the row is embedded as the checkbox name). From there, I want to grab the selected value from the DropDownList, and call the necessary code to update the DB. Here is my View page's code:</p> <pre><code> &lt;%foreach (var app in newApps) { %&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="checkbox" name="AddApps" value="&lt;%=app.ApplicationId %&gt;" /&gt;&lt;/td&gt; &lt;td&gt;&lt;%=Html.Encode(app.ApplicationName)%&gt;&lt;/td&gt; &lt;td&gt;&lt;%=Html.DropDownList("AppRole", new SelectList(app.Roles, "RoleId", "RoleDescription"))%&gt;&lt;/td&gt; &lt;/tr&gt; &lt;%} %&gt; </code></pre> <p>How would I retrieve the appropriate values from the FormCollection when I get to the controller on form post? I have done this in the past when I only had checkbox values to retrieve by just calling Request.Form["CheckBoxName"] and parsing the string. </p> <p>Or am I going about this entirely wrong?</p>
[ { "answer_id": 429914, "author": "TStamper", "author_id": 39809, "author_profile": "https://Stackoverflow.com/users/39809", "pm_score": 3, "selected": true, "text": " <% using(Html.BeginForm(\"Retrieve\", \"Home\")) %>//Retrieve is the name of the action while Home is the name of t...
2009/01/09
[ "https://Stackoverflow.com/questions/429527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
429,529
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/91817/whats-the-use-meaning-of-the-character-in-variable-names-in-c">What&#39;s the use/meaning of the @ character in variable names in C#?</a> </p> </blockquote> <p>I understand that the @ symbol can be used before a string literal to change how the compiler parses the string. But what does it mean when a variable name is prefixed with the @ symbol?</p>
[ { "answer_id": 429534, "author": "Michael Meadows", "author_id": 7643, "author_profile": "https://Stackoverflow.com/users/7643", "pm_score": 11, "selected": true, "text": "int @class = 15;\n int class = 15;\n" }, { "answer_id": 429537, "author": "Joel Coehoorn", "author_i...
2009/01/09
[ "https://Stackoverflow.com/questions/429529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42484/" ]
429,536
<p>Is there a lightweight process execution timer like Unix's <a href="http://en.wikipedia.org/wiki/Time_(Unix)" rel="nofollow noreferrer">time</a> included with Windows? Sometimes I just want a rough estimate, without having to get out a real profiler. While I could roll my own, I would prefer to use an existing solution. </p>
[ { "answer_id": 429560, "author": "scottm", "author_id": 53007, "author_profile": "https://Stackoverflow.com/users/53007", "pm_score": 0, "selected": false, "text": " System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();\n sw.Start();\n //do your processing\n s...
2009/01/09
[ "https://Stackoverflow.com/questions/429536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
429,567
<p>I have a shared disk that I would like to clean up once per week using a scheduled task of some sort. I would like to use a batch script so that the system admins can easily modify it or reuse it on other directories when needed.</p> <p>The directory has files with multiple file extensions but the ones that need to be deleted end in .bkf and must be over 2 weeks old.</p> <p>Does anyone have a batch script solution for this windows server (not sure which version)?</p>
[ { "answer_id": 5184226, "author": "CheeseConQueso", "author_id": 42229, "author_profile": "https://Stackoverflow.com/users/42229", "pm_score": 1, "selected": false, "text": "@echo off\ncls\ndel C:\\some\\directory\\*.bkf\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20471/" ]
429,586
<p>I have a GridView that is populated via a database, inside the GridView tags I have:</p> <pre><code>&lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt;&lt;asp:Panel ID="bar" runat="server" /&gt;&lt;/ItemTemplate&gt; &lt;/TemplateField&gt; &lt;/Columns&gt; </code></pre> <p>Now, I want to be able to (in the code) apply a width attribute to the "bar" panel for each row that is generated. How would I go about targeting those rows? The width attribute would be unique to each row depending on a value in the database for that row. </p>
[ { "answer_id": 429603, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "<asp:Panel ID=\"bar\" runat=\"server\" Width='<%# Eval(\"Width\") %>' />\n Eval(\"Width\")" }, { "answer_id": 429605, ...
2009/01/09
[ "https://Stackoverflow.com/questions/429586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,588
<p>I trying to export an HTML table named Table that is dynamically binded to ViewData.Model in C#. I have a method called export that is called based on another method's actions. so everything before that is set up.. I just don't know how to export the data to a CSV or Excel file.. So when the I step inside the Export method I don't know what next to do to export the table. Can someone help me</p> <pre><code> public void Export(List&lt;data&gt; List) { //the list is the rows that are checked and need to be exported StringWriter sw = new StringWriter(); //I don't believe any of this syntax is right, but if they have Excel export to excel and if not export to csv "|" delimeted for(int i=0; i&lt;List.Count;i++) { sw.WriteLine(List[i].ID+ "|" + List[i].Date + "|" + List[i].Description); } Response.AddHeader("Content-Disposition", "attachment; filename=test.csv"); Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); Response.Write(sw); Response.End(); } </code></pre>
[ { "answer_id": 429656, "author": "Perpetualcoder", "author_id": 37494, "author_profile": "https://Stackoverflow.com/users/37494", "pm_score": 1, "selected": false, "text": " Response.ClearContent(); \n Response.AddHeader(\"content-disposition\", attachment); \n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39809/" ]
429,614
<p>I want to verify if a computer is running .net 3.5 or 3.5 sp1, where do I look this info up?</p>
[ { "answer_id": 429631, "author": "chills42", "author_id": 23855, "author_profile": "https://Stackoverflow.com/users/23855", "pm_score": 3, "selected": true, "text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
429,632
<p>We're doing a great deal of floating-point to integer number conversions in our project. Basically, something like this</p> <pre><code>for(int i = 0; i &lt; HUGE_NUMBER; i++) int_array[i] = float_array[i]; </code></pre> <p>The default C function which performs the conversion turns out to be quite time consuming.</p> <p>Is there any work around (maybe a hand tuned function) which can speed up the process a little bit? We don't care much about a precision. </p>
[ { "answer_id": 429808, "author": "Chris Smith", "author_id": 9073, "author_profile": "https://Stackoverflow.com/users/9073", "pm_score": 0, "selected": false, "text": "float<->int float" }, { "answer_id": 429812, "author": "deft_code", "author_id": 28817, "author_prof...
2009/01/09
[ "https://Stackoverflow.com/questions/429632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007/" ]
429,648
<p>Is there a library to do pretty on screen display with Python (mainly on Linux but preferably available on other OS too) ? I know there is python-osd but it uses <a href="http://sourceforge.net/projects/libxosd" rel="nofollow noreferrer">libxosd</a> which looks quite old. I would not call it <em>pretty</em>.</p> <p>Maybe a Python binding for <a href="http://cia.vc/stats/project/libaosd" rel="nofollow noreferrer">libaosd</a>. But I did not find any.</p>
[ { "answer_id": 56996756, "author": "sdaau", "author_id": 277826, "author_profile": "https://Stackoverflow.com/users/277826", "pm_score": 0, "selected": false, "text": "animosd.py quodlibet sudo apt install quodlibet\n animosd_test.py python2 animosd_test.py\n animosd_test.py #!/usr/bin/e...
2009/01/09
[ "https://Stackoverflow.com/questions/429648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49808/" ]
429,655
<p>When retrieving objects from an NSMutableArray in cocoa-touch is the below code ok? Should I be allocating([alloc]) new Page objects each time or is just pointing to it alright? Do I need to do anything to the Page *pageObj after, such as set it to nil?</p> <pre><code>const char *sql = "insert into Page(Book_ID, Page_Num, Page_Text) Values(?, ?, ?)"; for (i = 0; i &lt; ([[self pagesArray] count] - 1); i++) { if(addStmt == nil) { if(sqlite3_prepare_v2(database, sql, -1, &amp;addStmt, NULL) != SQLITE_OK) { NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database)); } } Page *pageObj = [[self pagesArray] objectAtIndex:i]; if(pageObj.isNew) { sqlite3_bind_int(addStmt, 1, self.book_ID); sqlite3_bind_int(addStmt, 2, pageObj.page_Number); sqlite3_bind_text(addStmt, 3, [[pageObj page_Text] UTF8String], -1, SQLITE_TRANSIENT); if(SQLITE_DONE != sqlite3_step(addStmt)) { NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); } NSLog(@"Inserted Page: %i into DB. Page text: %@", pageObj.page_Number, pageObj.page_Text); } //Reset the add statement. sqlite3_reset(addStmt); } </code></pre> <p>Thanks. I also understand this should probably be in a transaction but I didn't quite get that working just yet.</p>
[ { "answer_id": 431213, "author": "Brad Larson", "author_id": 19679, "author_profile": "https://Stackoverflow.com/users/19679", "pm_score": 2, "selected": false, "text": "+ (BOOL)beginTransactionWithDatabase:(sqlite3 *)database;\n{\n const char *sql1 = \"BEGIN EXCLUSIVE TRANSACTION\";\...
2009/01/09
[ "https://Stackoverflow.com/questions/429655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29941/" ]
429,657
<p>Many years ago I remember a fellow programmer counselling this:</p> <pre><code>new Some::Class; # bad! (but why?) Some::Class-&gt;new(); # good! </code></pre> <p>Sadly now I cannot remember the/his reason why. :( Both forms will work correctly even if the constructor does not actually exist in the Some::Class module but instead is inherited from a parent somewhere.</p> <p>Neither of these forms are the same as Some::Class::new(), which will not pass the name of the class as the first parameter to the constructor -- so this form is always incorrect.</p> <p>Even if the two forms are equivalent, I find Some::Class->new() to be much more clear, as it follows the standard convention for calling a method on a module, and in perl, the 'new' method is not special - a constructor could be called anything, and new() could do anything (although of course we generally expect it to be a constructor).</p>
[ { "answer_id": 429679, "author": "brian d foy", "author_id": 2766176, "author_profile": "https://Stackoverflow.com/users/2766176", "pm_score": 4, "selected": false, "text": "new print FH \"Some message\";\n FH->print( \"Some message\" );\n print print FH, \"some message\"; # GLOB(0xD...
2009/01/09
[ "https://Stackoverflow.com/questions/429657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40468/" ]
429,672
<p>I have a document that I want to be flipped / rotated 180 degrees when printed. (This is due to the orientation of label stock in the printer).</p> <p>There is a property <code>PrintDocument.PrinterSettings.LandscapeAngle</code> but it is read only.</p> <p>I think this property is influenced by the printer driver and therefore not 'settable'.</p> <p>Is there a nice way i can rotate the print by 180 degrees without having to do anything too nasty?</p>
[ { "answer_id": 429711, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "PrintDocument.DefaultPageSettings.Landscape" }, { "answer_id": 2143260, "author": "greektreat", "autho...
2009/01/09
[ "https://Stackoverflow.com/questions/429672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
429,684
<p>I have a SQL Server 2005 database that is linked to an Oracle database. What I want to do is run a query to pull some ID numbers out of it, then find out which ones are in Oracle.</p> <p>So I want to take the results of this query:</p> <pre><code>SELECT pidm FROM sql_server_table </code></pre> <p>And do something like this to query the Oracle database (assuming that the results of the previous query are stored in @pidms):</p> <pre><code>OPENQUERY(oracledb, ' SELECT pidm FROM table WHERE pidm IN (' + @pidms + ')') GO </code></pre> <p>But I'm having trouble thinking of a good way to do this. I suppose that I could do an inner join of queries similar to these two. Unfortunately, there are a lot of records to pull within a limited timeframe so I don't think that will be a very performant option to choose.</p> <p>Any suggestions? I'd ideally like to do this with as little Dynamic SQL as possible.</p>
[ { "answer_id": 429819, "author": "Sam", "author_id": 37379, "author_profile": "https://Stackoverflow.com/users/37379", "pm_score": 3, "selected": true, "text": "select sql.pidm,sql.field2 from sqltable as sql\ninner join\n(select pidm,field2 from oracledb..schema.table) as orcl\non \nsql...
2009/01/09
[ "https://Stackoverflow.com/questions/429684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
429,692
<p>I have a system-wide manual reset event that I create by doing the following:</p> <pre><code>EventWaitHandle notifyEvent = new EventWaitHandle(false, EventResetMode.ManualReset, notifyEventName, out createdEvent); </code></pre> <p>Several processes create this event (e.g. it is shared amongst them). It is used for notifying when something gets updated.</p> <p>I'd like to be able to set this event so that all of processes waiting on it are signaled and then immediately reset it so that subsequent Waits on the event are blocked.</p> <p>If I do a</p> <pre><code>notifyEvent.Set(); notifyEvent.Reset(); </code></pre> <p>It will sometimes notify all listening processes.</p> <p>If I do a </p> <pre><code>notifyEvent.Set(); Thread.Sleep(0); notifyEvent.Reset(); </code></pre> <p>More processes get notified (I assumed this would happen since the scheduler has a chance to run).</p> <p>And if I do</p> <pre><code>notifyEvent.Set(); Thread.Sleep(100); notifyEvent.Reset(); </code></pre> <p>Then everything seems to work out fine and all processes (e.g. ~8) get notified consistently. I don't like the use of a "magic number" for the Sleep call. </p> <p>Is there a better way to notify all listeners of an OS event in other processes that an event has occurred so that everyone listening to it at the time of notification receive the event signal and then immediately reset the event so that anyone else that goes to listen to the event will block?</p> <p><strong>UPDATE:</strong> A Semaphore doesn't seem to be a good fit here since the number of listeners to the event can vary over time. It is not known in advance how many listeners there will be when an even needs to be notified. </p>
[ { "answer_id": 430889, "author": "Spencer Ruport", "author_id": 52551, "author_profile": "https://Stackoverflow.com/users/52551", "pm_score": 3, "selected": true, "text": "static class Program\n{\n static void Main()\n {\n List<ThreadState> states = new List<ThreadState>();\...
2009/01/09
[ "https://Stackoverflow.com/questions/429692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1869/" ]
429,719
<p>I have the following regex:</p> <pre><code>(?!^[&amp;#]*$)^([A-Za-z0-9-'.,&amp;@:?!()$#/\\]*)$ </code></pre> <p>So allow A-Z, a-Z, 0-9, and these special chars <code>'.,&amp;@:?!()$#/\</code></p> <p>I want to NOT match if the following set of chars is encountered anywhere in the string in this order:</p> <pre><code>&amp;# </code></pre> <p>When I run this regex with just "&amp;#" as input, it does not match my pattern, I get an error, great. When I run the regex with <code>'.,&amp;@:?!()$#/\ABC123</code> It does match my pattern, no errors.</p> <p>However when I run it with:</p> <pre><code>'.,&amp;#@:?!()$#/\ABC123 </code></pre> <p>It does not error either. I'm doing something wrong with the check for the &amp;# sequence.</p> <p>Can someone tell me what I've done wrong, I'm not great with these things.</p>
[ { "answer_id": 429749, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "[^A-Za-z0-9'\\.&@:?!()$#^] bool IsValid(string input)\n{\n return !( input.Contains(\"&#\") \n || ...
2009/01/09
[ "https://Stackoverflow.com/questions/429719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22451/" ]
429,738
<p>I need to develop a process that will detect if the users computer has certain programs installed and if so, what version. I believe I will need a list with the registry location and keys to look for and feed it to the program which is not a problem. Is there a better way to accomplish this?</p> <p>My first thought was to check in the registry in the uninstallation entries but it seems one of the apps I wish to detect does not have one. What is the standard location for all registry using applications to make an entry in?</p>
[ { "answer_id": 429810, "author": "coding Bott", "author_id": 44462, "author_profile": "https://Stackoverflow.com/users/44462", "pm_score": 6, "selected": false, "text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\n DisplayName DisplayVersion HKEY_LOCAL_MA...
2009/01/09
[ "https://Stackoverflow.com/questions/429738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25946/" ]
429,745
<p>I am looking for the best way to check that a database login exists in SQL Server 2005. I am currently using </p> <pre><code>IF suser_sid('loginname') IS NOT NULL </code></pre> <p>but suser_sid() returns a value in some cases where a login does not exist. </p> <p>In SQL 2000 we use </p> <pre><code>SELECT * FROM [Master].[dbo].[sysxlogins] WHERE [name] ='loginname' </code></pre> <p>but that table does not exist in SQL 2005.</p> <p>There is a similar question about <a href="https://stackoverflow.com/questions/356000">checking the existence of Users</a>, which is helpful, but I am looking for the existence of Logins.</p>
[ { "answer_id": 429754, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": 3, "selected": true, "text": "select * from master.sys.syslogins WHERE [name] ='loginname'\n" }, { "answer_id": 10268882, "author"...
2009/01/09
[ "https://Stackoverflow.com/questions/429745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3341/" ]
429,758
<p>I've seen two common approaches for checking if a column exists in an IDataReader:</p> <pre><code>public bool HasColumn(IDataReader reader, string columnName) { try { reader.getOrdinal(columnName) return true; } catch { return false; } } </code></pre> <p>Or:</p> <pre><code>public bool HasColumn(IDataReader reader, string columnName) { reader.GetSchemaTable() .DefaultView.RowFilter = "ColumnName='" + columnName + "'"; return (reader.GetSchemaTable().DefaultView.Count &gt; 0); } </code></pre> <p>Personally, I've used the second one, as I hate using exceptions for this reason.</p> <p>However, on a large dataset, I believe RowFilter might have to do a table scan per column, and this may be incredibly slow.</p> <p>Thoughts?</p>
[ { "answer_id": 1122966, "author": "Sam Saffron", "author_id": 17174, "author_profile": "https://Stackoverflow.com/users/17174", "pm_score": 3, "selected": false, "text": "public Dictionary<string,int> CacheFields(IDataReader reader)\n{\n\n var cache = new Dictionary<string,int>();\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
429,762
<p>If I open and close a socket by calling for instance</p> <pre><code>Socket s = new Socket( ... ); s.setReuseAddress(true); in = s.getInputStream(); ... in.close(); s.close(); </code></pre> <p>Linux states that this socket is still open or at least the file descriptor for the connection is presen. When querying the open files for this process by lsof, there is an entry for the closed connection:</p> <pre><code>COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME java 9268 user 5u sock 0,4 93417 can't identify protocol </code></pre> <p>This entry remains until the program is closed. Is there any other way to finally close the socket? I'm a little worried that my java application may block to many file descriptors. Is this possible? Or does java keep these sockets to re-use them even is ReuseAdress is set?</p>
[ { "answer_id": 430084, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 2, "selected": false, "text": "/proc/<pid>/fd" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30294/" ]
429,763
<p>I'm working on a website of a client, a local church. I've embedded a Google Map using the Link feature on the Maps page. The info window on the map includes "Reviews," and the church is concerned about this. Is there a way to remove that from the info window? I don't want to remove any reviews themselves, just that link on the info window?</p> <p>Is this possible? Are there any other customization options (besides the size) one can manipulate via the query string?</p>
[ { "answer_id": 430154, "author": "Ry Biesemeyer", "author_id": 53098, "author_profile": "https://Stackoverflow.com/users/53098", "pm_score": 3, "selected": false, "text": "<script src=\"http://maps.google.com/maps?file=api&v=2&key=YOUR_API_KEY_HERE\"\n type=\"text/javascript\">\n<...
2009/01/09
[ "https://Stackoverflow.com/questions/429763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28240/" ]
429,777
<p>Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to any OCI* functions.</p> <p>Here's the stored procedure that is used to call the failing C code:</p> <pre><code>CREATE OR REPLACE PROCEDURE index_procedure(text in clob, tokens in out nocopy clob, location_needed in boolean) as language c name "c_index_proc" library lexer_lib with context parameters ( context, text, tokens, location_needed ); </code></pre> <p>Any help would be appreciated. Everything I've found on this error message says that the action to take is: Contact Oracle customer support.</p> <p>Edit: I've narrowed it down to the point that I know that there is a segfault deep in libclntsh after I call OCILobTrim (to truncate it down to 0 length) on the tokens clob. Here is the code I've been using to call this procedure.</p> <pre><code>declare text CLOB; tokens CLOB; begin dbms_lob.createtemporary(tokens, TRUE); dbms_lob.append(tokens, 'token'); dbms_lob.createtemporary(text, TRUE); dbms_lob.append(text, '&lt;BODY&gt;Test Document&lt;/BODY&gt;'); index_procedure(text, tokens, FALSE); dbms_output.put_line(tokens); end; / </code></pre> <p>Is there something wrong with this setup that might be causing OCILobTrim problems?</p>
[ { "answer_id": 430154, "author": "Ry Biesemeyer", "author_id": 53098, "author_profile": "https://Stackoverflow.com/users/53098", "pm_score": 3, "selected": false, "text": "<script src=\"http://maps.google.com/maps?file=api&v=2&key=YOUR_API_KEY_HERE\"\n type=\"text/javascript\">\n<...
2009/01/09
[ "https://Stackoverflow.com/questions/429777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/75/" ]
429,805
<p>I'm trying to create a relation where any of four different parts may be included, but any collection of the same parts should be handled as unique.</p> <p>Example: An assignment must have an assigned company, may optionally have an assigned location, workgroup and program. An assignment may not have a workgroup without a location.</p> <p>Let's assume we have companies A, B, C; locations X, Y, Z; workgroups I, J, K and programs 1, 2, 3.</p> <p>So valid relations could include A - X - I - 1 A - Z - 2 B - Y C C - 3 B - Z - K</p> <p>But invalid relations would include A - K (Workgroup without location) Y - K - 1 (No company)</p> <p>So, to create my table, I've created</p> <pre><code>companyID INT NOT NULL, FOREIGN KEY companyKEY (companyID) REFERENCES company (companyID), locationID INT, FOREIGN KEY locationKEY (locationID) REFERENCES location (locationID), workgroupID INT, FOREIGN KEY workgroupKEY (workgroupID) REFERENCES workgroup (workgroupID), programID INT, FOREIGN KEY programKEY (programID) REFERENCES program (programID), UNIQUE KEY companyLocationWorkgroupProgramKEY (companyID, locationID, workgroupID, programID) </code></pre> <p>I figure this would handle all my relations besides the neccessity of an assignment to have a location if there is a workgroup (which I can happily do programatically or with triggers, I think)</p> <p>However, when I test this schema, it allows me to enter the following...</p> <pre><code>INSERT INTO test VALUES (1, null, null, null), (1, null, null, null); </code></pre> <p>...without complaint. I'm guessing that (1, null, null, null) does not equal itself because nulls are included. If this is the case, is there any way I can handle this relation?</p> <p>Any help would be appreciated!</p>
[ { "answer_id": 429826, "author": "Harper Shelby", "author_id": 21196, "author_profile": "https://Stackoverflow.com/users/21196", "pm_score": 2, "selected": false, "text": "INSERT INTO test VALUES (1, NO_LOCATION, NO_WORKGROUP, NO_PROGRAM),\n (1, NO_LOCATION, NO_WOR...
2009/01/09
[ "https://Stackoverflow.com/questions/429805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,806
<p>I've wrapped Perl's <a href="http://search.cpan.org/perldoc?Net::SSH::Expect" rel="nofollow noreferrer">Net::SSH::Expect</a> with a small module to reduce the boilerplate code needed to write a new configuration script for use with our HP <a href="http://en.wikipedia.org/wiki/HP_Integrated_Lights-Out" rel="nofollow noreferrer">iLO</a> cards. While on one hand I want this wrapper to be as lean as possible, so non-programmer colleagues can use it, I also want it to be as well-written as possible.</p> <p>It's used like so:</p> <pre><code>my $ilo = iLO-&gt;new(host =&gt; $host, password =&gt; $password); $ilo-&gt;login; $ilo-&gt;command("cd /system1"); $ilo-&gt;command("set oemhp_server_name=$system_name", 'status=0'); </code></pre> <p>and this is <code>iLO::command()</code>:</p> <pre><code>sub command { my ($self, $cmd, $response) = @_; $response = 'hpiLO-&gt; ' unless defined($response); # $self-&gt;{ssh} is a Net::SSH::Expect object croak "Not logged in!\n" unless ($self-&gt;{ssh}); $self-&gt;{ssh}-&gt;send($cmd); if ($self-&gt;{ssh}-&gt;waitfor($response, $self-&gt;{CMD_TIMEOUT}, '-re')) { return { before =&gt; $self-&gt;{ssh}-&gt;before(), match =&gt; $self-&gt;{ssh}-&gt;match(), after =&gt; $self-&gt;{ssh}-&gt;after(), }; } else { carp "ERROR: '$cmd' response did not match /$response/:\n\n", $self-&gt;{ssh}-&gt;before()), "\n"; return undef; } } </code></pre> <p>I have two related queries. First, how should I deal with responses that don't match the expected response? I guess what I'm doing now is satisfactory -- by returning <code>undef</code> I signal something broke and my <code>croak()</code> will output an error (though hardly gracefully). But it feels like a code smell. If Perl had exceptions I'd raise one and let the calling code decide whether or not to ignore it/quit/print a warning, but it doesn't (well, in 5.8). Perhaps I should return some other object (<code>iLO::response</code>, or something) that carries an error message and the contents of <code>$ilo-&gt;before()</code> (which is just Net::SSH::Expect's <code>before()</code>)? But if I do that -- and have to wrap every <code>$ilo-&gt;command</code> in a test to catch it -- my scripts are going to be full of boilerplate again.</p> <p>Secondly, what should I return for success? Again, my hash containing more-or-less the response from Net::SSH::Expect does the job but it doesn't feel 'right' somehow. Although this example's in Perl my code in other languages emits the same familiar smell: I'm never sure how or what to return from a method. What can you tell me?</p>
[ { "answer_id": 429932, "author": "friedo", "author_id": 20745, "author_profile": "https://Stackoverflow.com/users/20745", "pm_score": 4, "selected": true, "text": "die throw eval try catch undef if ($self->{ssh}->waitfor($response, $self->{CMD_TIMEOUT}, '-re')) {\n return {\n b...
2009/01/09
[ "https://Stackoverflow.com/questions/429806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38388/" ]
429,816
<p>I have a system in production that has several servers in several roles. I would like to test a new app server by deploying to that specific server, without having to redeploy to every server in production. Is there a way to ask Capistrano to deploy to a specific server? Ideally I'd like to be able to run something like</p> <pre><code>cap SERVER=app2.example.com ROLE=app production deploy </code></pre> <p>if I just wanted to deploy to app2.example.com.</p> <p>Thanks!</p> <p>[update] I tried the solution suggested by wulong by executing:</p> <pre><code>cap HOSTS=app2.server.hostname ROLE=app qa deploy </code></pre> <p>but capistrano seemed be trying to execute tasks for other roles on that server in addition to app tasks. Maybe I need to update my version of cap (I'm running v2.2.0)?</p>
[ { "answer_id": 430422, "author": "Dave Pirotte", "author_id": 53600, "author_profile": "https://Stackoverflow.com/users/53600", "pm_score": 1, "selected": false, "text": "task :production do\n if ENV['SERVER'] && ENV['ROLE']\n role ENV['ROLE'], ENV['SERVER']\n else\n # your full ...
2009/01/09
[ "https://Stackoverflow.com/questions/429816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53529/" ]
429,839
<blockquote> <p>A number of students want to get into sections for a class, some are already signed up for one section but want to change section, so they all get on the wait lists. A student can get into a new section only if someone drops from that section. No students are willing to drop a section they are already in unless that can be sure to get into a section they are waiting for. The wait list for each section is first come first serve.</p> <p>Get as many students into their desired sections as you can.</p> </blockquote> <p>The stated problem can quickly devolve to a gridlock scenario. My question is; are there known solutions to this problem?</p> <hr /> <p>One trivial solution would be to take each section in turn and force the first student from the waiting list into the section and then check if someone end up dropping out when things are resolved (O(n) or more on the number of section). This would work for some cases but I think that there might be better options involving forcing more than one student into a section (O(n) or more on the student count) and/or operating on more than one section at a time (O(bad) :-)</p>
[ { "answer_id": 429977, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "+------+-----+-----+-----+\n| stud | now | req | que |\n+------+-----+-----+-----+\n| 1 | A | D | 2 |\n| ...
2009/01/09
[ "https://Stackoverflow.com/questions/429839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
429,841
<pre><code>-(NSDictionary *)properties; +(NSDictionary *)ClassProperties; </code></pre> <p>Now, how can I call ClassProperties from sub-classes?</p> <pre><code>-(NSDictionary *)properties { return [? ClassProperties]; } </code></pre> <p>The point is that <code>ClassProperties</code> gets the list of properties in the class, so i can't call the base class definition.</p>
[ { "answer_id": 430173, "author": "Cody Brimhall", "author_id": 18388, "author_profile": "https://Stackoverflow.com/users/18388", "pm_score": 4, "selected": true, "text": "[[self class] ClassProperties]\n + (NSDictionary *)ClassProperties - (NSDictionary *)properties {\n return [[self ...
2009/01/09
[ "https://Stackoverflow.com/questions/429841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53185/" ]
429,849
<p>I have a question on C++ double dispatch. In the code below, I want the results from the second set to match the results from the first set. </p> <p>I don't know the actual type (unless I try dynamic_cast) but I do know that the object inherited from the BaseClass type. What is the most efficient (performance-wise) way to accomplish this?</p> <p>After googling around for a while I found out about double dispatch and the loki multimethods. The problem I have with the Shape examples is that in my application, Processor and BaseClass are entirely independent and don't have a common method that they can call in each other. Secondly, there is only one Processor (i.e. nothing inherits from it).</p> <p>Thanks for any help.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; class BaseClass{ public: BaseClass(){} virtual void myFunction(){cout &lt;&lt; "base myFunction called" &lt;&lt; endl;} }; class Derived1: public BaseClass{ public: Derived1():BaseClass(){} void myFunction(){cout &lt;&lt; "Derived1 myFunction called" &lt;&lt; endl;} }; class Derived2: public BaseClass{ public: Derived2():BaseClass(){} void myFunction(){cout &lt;&lt; "Derived2 myFunction called" &lt;&lt; endl;} }; class Derived3: public BaseClass{ public: Derived3():BaseClass(){} void myFunction(){cout &lt;&lt; "Derived3 myFunction called" &lt;&lt; endl;} }; class Processor{ public: Processor(){} virtual void processObj(BaseClass* bc){cout &lt;&lt; "got a base object" &lt;&lt; endl; bc-&gt;myFunction();} virtual void processObj(Derived1* d1){cout &lt;&lt; "got a derived1 object" &lt;&lt; endl; d1-&gt;myFunction();} virtual void processObj(Derived2* d2){cout &lt;&lt; "got a derived2 object" &lt;&lt; endl; d2-&gt;myFunction(); } }; int main() { BaseClass *bcp=new BaseClass(); Derived1 *dc1p=new Derived1(); Derived2 *dc2p=new Derived2(); Derived3 *dc3p=new Derived3(); Processor p;//can also use Processor* p = new Processor() //first set results p.processObj(bcp); p.processObj(dc1p); p.processObj(dc2p); p.processObj(dc3p); BaseClass *bcp1=bcp; BaseClass *dc1p1=dc1p; BaseClass *dc2p1=dc2p; BaseClass *dc3p1=dc3p; //second set results p.processObj(bcp1); p.processObj(dc1p1); p.processObj(dc2p1); p.processObj(dc3p1); return 0; } </code></pre>
[ { "answer_id": 429867, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 3, "selected": false, "text": "class BaseClass{\npublic:\n BaseClass(){}\n virtual void ProcessThis(Processor &p) { p.processObj(this); }\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53532/" ]
429,853
<p>I have a C#/.Net job that imports data from Excel and then processes it. Our client drops off the files and we process them. I don't have any control over the original file.</p> <p>I use the OleDb library to fill up a dataset. The file contains some numbers like 30829300, 30071500, etc... The data type for those columns is "Text".</p> <p>Those numbers are converted to scientific notation when I import the data. Is there anyway to prevent this from happening?</p>
[ { "answer_id": 3678379, "author": "Andrew Garrison", "author_id": 16460, "author_profile": "https://Stackoverflow.com/users/16460", "pm_score": 0, "selected": false, "text": "public void ImportSpreadsheet(string path)\n{\n string extendedProperties = \"Excel 12.0;HDR=YES;IMEX=1\";\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/429853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40825/" ]
429,865
<p>For domain entities, should property names be prefaced with the entity name? I.E. my class Warehouse has a property WarehouseNumber. Should that property be named WarehouseNumber or simply Number?</p> <p>Thoughts?</p>
[ { "answer_id": 429886, "author": "Bryan Watts", "author_id": 37815, "author_profile": "https://Stackoverflow.com/users/37815", "pm_score": 2, "selected": false, "text": "Warehouse Number Warehouse Number Warehouse WarehouseNumber Order.WarehouseNumber Warehouse.WarehouseNumber" }, { ...
2009/01/09
[ "https://Stackoverflow.com/questions/429865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46780/" ]
429,878
<p>I'm in the process of working on a user profile system for a website and am pondering what would be a better (scalable) approach to take. I've come up with two solutions and am looking for either input or perhaps pointers to something I might have missed.</p> <p><em>The following create table statements are not meant to be executable but are merely there to give an idea of the layout of the tables involved.</em></p> <p>My initial thought was something like this:</p> <pre><code>CREATE TABLE user( id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_email VARCHAR(320), user_joined DATATIME, user_last_seen DATATIME, user_name_first VARCHAR, user_name_last VARCHAR, user_name_alias VARCHAR, user_location_country VARCHAR, user_location_region VARCHAR, user_location_city VARCHAR # ... ); </code></pre> <p>Obviously this isn't very scalable at all and adding additional properties i annoying. The one advantage is I can quickly search for users matching a specific set of properties. I've done a bit of looking around and this is a pretty common approach (e.g. Wordpress).</p> <p>My second approach (the one I'm currently playing around with) is much more scalable but I'm a little concerned about performance:</p> <pre><code>CREATE TABLE user( id INT UNSIGNED NOT NULL AUTO_INCREMENT, user_email VARCHAR(320) ); CREATE TABLE user_profile( user_id INT UNSIGNED NOT NULL, visibility ENUM('PRIVATE', 'PUBLIC'), name VARCHAR, value VARCHAR ); </code></pre> <p>Using this approach every use has a set of key value pairs associated with it which makes adding additional properties trivial as well as loading the users profile when they login. However I lose all the type information I had in the first approach (e.g. DATETIME is now stored as a formatted string) so some searches become annoying. This does give me more control over selecting which properties the user wants publicly displayed.</p> <p>Would a hybrid approach be better allowing me to balance the advantages and disadvantages of both methods? What method does SO use? Is there another approach to this that I haven't thought of or missed?</p> <p><strong>Extension:</strong> With a hybrid approach would it be advantageous to also insert the properties from the user table into the user_profile table to control their visibility to other users or could that possibly be seen as additional overhead?</p>
[ { "answer_id": 429950, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 0, "selected": false, "text": "users" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/429878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13834/" ]
429,890
<p>I am C# developer. I really love the curly brace because I came from C, C++ and Java background. However, I also like the other programming languages of the .NET Family such as VB.NET. Switching back and forth between C# and VB.NET is not really that big of deal if you have been programming for a while in .NET. That is very common approach in the company where I work. As C# guy, I really like the XML literal and <code>with</code> keywords provided by the VB.NET compiler. I wish Microsoft had included those features in C# also. </p> <p>I am just curious , what other developer has to say about it!</p>
[ { "answer_id": 429903, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "MyObject x = new MyObject { Name=\"Fred\", Age=20, Salary=15000 };\n" }, { "answer_id": 429953, "author": "J...
2009/01/09
[ "https://Stackoverflow.com/questions/429890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50395/" ]
429,907
<p>Sorry, I'm not terribly experienced with Ant.</p> <p>I like the eclipse "Export ant buildfile" function, but I need to insert a few custom tasks (Copying files, calculating checksums that are used at runtime, etc).</p> <p>How do I integrate custom ant tasks with the antfile that Eclipse exports? Also, once I've done so, will the internal build (Run...) pick it up or will I always have to use the external ant file to build from now on?</p> <p>Oh, and I don't want to edit the build.xml that is exported from Eclipse, because I'd like to be able to regenerate it later.</p> <p><b>Edit/Update:</b></p> <p>It took me a while to figure out what was going on--so I thought I'd put some notes here to clarify.</p> <p>When you create a new ant file in your directory and put <code>&lt;?eclipse.ant.import ?&gt;</code> on the first line of your custom ant script (I called mine test.xml), next time you export the buildfile from Eclipse into that directory, it'll see that tag and add <code>&lt;import file="test.xml"/&gt;</code></p> <p>With that Import, the targets in your "Custom" file (test.xml) become valid targets in your exported build.xml (or whatever name you chose when you exported it).</p> <p>After this, anytime you select "build.xml" in Eclipse, the targets pane will also include targets from "test.xml"</p> <p>Also, after that, you can go into your project properties/Builders and add a new builder of type "Ant Build", then select targets to use for building, clean, etc.</p>
[ { "answer_id": 429996, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 5, "selected": true, "text": "<?eclipse.ant.import?>\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?eclipse.ant.import?>\n<project name=\"project\" defa...
2009/01/09
[ "https://Stackoverflow.com/questions/429907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12943/" ]
429,912
<p>I have a query that pulls up questions from one table and answers from another.</p> <pre><code>SELECT questions.question, questions.answers, (SELECT COUNT(answer) FROM answers WHERE question_id = 1 AND answer = 1 GROUP BY answer) as ans1, (SELECT COUNT(answer) FROM answers WHERE question_id = 1 AND answer = 2 GROUP BY answer) as ans2 FROM questions WHERE questions.id = 1 </code></pre> <p>While this works I don't like the idea of adding an extra subquery for each answer (<code>questions.answers</code> is a comma-seperated string of potential answers). It's do-able but I'm sure there must be a better way. The main thing is that different questions have different numbers of answers.</p> <p>Is there a better way to do this or is this an acceptable way of doing things? I'd imagine multiple subselects in a query could have a (small) performance hit in the future (not that I'm performance testing yet).</p> <p>If it's applicable I don't expect to have more than 5 answers per question.</p>
[ { "answer_id": 429936, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 4, "selected": true, "text": "SELECT q.question, q.answers,\n SUM(a.answer = 1) AS ans1,\n SUM(a.answer = 2) AS ans2\nFROM questions q\n LEFT OUTER...
2009/01/09
[ "https://Stackoverflow.com/questions/429912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2025/" ]
429,937
<p>How can I change the Text for a CheckBox without a postback? </p> <pre><code>&lt;asp:CheckBox ID="CheckBox1" runat="server" Text="Open" /&gt; </code></pre> <p>I would like to toggle the Text to read "Open" or "Closed" when the CheckBox is clicked on the client.</p>
[ { "answer_id": 429958, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 1, "selected": false, "text": "CheckBox1.Attributes.Add(\"JavaScipt\")\n" }, { "answer_id": 429978, "author": "tanathos", "author_id": 5129...
2009/01/09
[ "https://Stackoverflow.com/questions/429937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41490/" ]
429,957
<p>When my ASP.NET application crashes (when it shows the default exception page), I'd like to be able to click on a line of the call stack in the browser and Visual Studio would open the code file at the given line.</p> <p>Do you think it's possible ? Maybe with a macro/add-in ?</p>
[ { "answer_id": 429958, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 1, "selected": false, "text": "CheckBox1.Attributes.Add(\"JavaScipt\")\n" }, { "answer_id": 429978, "author": "tanathos", "author_id": 5129...
2009/01/09
[ "https://Stackoverflow.com/questions/429957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50468/" ]
429,962
<p>I understand the reflection API (in c#) but I am not sure in what situation would I use it. What are some patterns - anti-patterns for using reflection?</p>
[ { "answer_id": 429993, "author": "P Daddy", "author_id": 36388, "author_profile": "https://Stackoverflow.com/users/36388", "pm_score": 0, "selected": false, "text": "ServiceBase.Run" }, { "answer_id": 430014, "author": "Marc Gravell", "author_id": 23354, "author_profi...
2009/01/09
[ "https://Stackoverflow.com/questions/429962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30917/" ]
429,963
<p>I'm using ASP .NET MVC Beta and I get the HTTP 404 (The resource cannot be found) error when I use this url which has a "dot" at the end:</p> <p><a href="http://localhost:81/Title/Edit/Code1" rel="noreferrer">http://localhost:81/Title/Edit/Code1</a>.</p> <p>If I remove the dot at the end or the dot is somewhere in the middle I don't get the error.</p> <p>I tried to debug but it I get the error from "System.Web.CachedPathData.GetConfigPathData(String configPath)" before ProcessRequest in MvcHandler.</p> <p>Is "dot" not allowed at the end of a url? Or is there a way to fix the route definition to handle this url?</p> <hr> <p>For an example: I have a table named Detail1 [Id(integer), Code(string), Description(string)] which has FK relationship with Master1 through it's Id column. Whenever I select a record of Master1, I also select it's Detail1 record to get it's Code field. In order to not to make this join everytime (since usually there isn't only one detail, there are more than one) I choose not to use Id column and I make Code PK of Detail1.</p> <p>But when I get rid of Id and use Code as PK then my routes also start to work with Code field, like: Detail1\Edit\Code1</p> <p>This Code can have anything in it or at the end, including DOT. There are cases where I can prohibit a DOT at the end but sometimes it's really meaningfull.</p> <p>And I'have also seen this <a href="http://weblogs.asp.net/scottgu/archive/2008/04/16/asp-net-mvc-source-refresh-preview.aspx" rel="noreferrer">post</a> that routes can be very flexible, so I didn't think mine is so weird.</p> <p>So that's why I do something so non-standard. Any suggestions?</p> <p>And also why it's so weird to have a DOT at the end of a url?</p>
[ { "answer_id": 431158, "author": "recursive", "author_id": 44743, "author_profile": "https://Stackoverflow.com/users/44743", "pm_score": -1, "selected": false, "text": "http://localhost:81/Title/Edit/Code1%2E" }, { "answer_id": 3542532, "author": "bkaid", "author_id": 265...
2009/01/09
[ "https://Stackoverflow.com/questions/429963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53547/" ]
429,964
<p>I'm having some trouble with a large spreadsheet of mine. I bring in a lot of raw data into a data sheet, and then do a number of lookups across the data. Using built in functions I've come up with</p> <pre><code>=IF(ISNA(INDEX(Data!$L$7:$L$1100,MATCH(Data!$I$2&amp;$B$199&amp;$B29&amp;Data!$J$5,Data!$K$7:$K$1100&amp;Data!$J$7:$J$1100&amp;Data!$I$7:$I$1100&amp;Data!$N$7:$N$1100,0))),"0",INDEX(Data!$L$7:$L$1100,MATCH(Data!$I$2&amp;$B$199&amp;$B29&amp;Data!$J$5,Data!$K$7:$K$1100&amp;Data!$J$7:$J$1100&amp;Data!$I$7:$I$1100&amp;Data!$N$7:$N$1100,0))) </code></pre> <p>Not pretty! Basically it does the same lookup twice taking 4 variables, and matching them against 4 concatenated arrays, then uses the point as an index for the value I want.</p> <p>I have 8 of these (slightly different) in each row of 4 sheets and 96 rows in each sheet. Editing them is a pain!</p> <p>Due to the dataset growing hugely this month, the outer bands (x1100) have been surpassed (lesson learned, large is never enough). Unfortunately limitations of the function won't let me use L:L or anything useful like that.</p> <p>I've tried rewriting the code as a user defined function where I can feed the 4 variables in, and get the answer back, but have failed dismally at combining the arrays.</p> <p>I've given the ranges listed above in the original function names to make things easier (and have expanded them to use much wider range values), so I could rewrite all the functions to just use the named ranges, but that still leaves my stuck if I need to change the code.</p> <p>Here's what I have so far:</p> <pre><code> Function Windows_Util(itma As String, env As String) v = "Windows Server" &amp; env &amp; itma &amp; "" r = Concat(Range("Utilchassis")) r = r &amp; Concat(Range("Utilenv")) r = r &amp; Concat(Range("UtilITMA")) r = r &amp; Concat(Range("UtilOS")) m = WorksheetFunction.Match(v, r, 0) i = WorksheetFunction.Index(Range("Utilavg"), m) If WorksheetFunction.IsNA(i) Then Windows_Util = 0 Else Windows_Util = i End If End Function Function Concat(myRange As Range, Optional myDelimiter As String) Dim r As Range Application.Volatile For Each r In myRange If Len(r.Text) Then Concat = Concat &amp; IIf(Concat &lt;&gt; "", myDelimiter, "") &amp; r.Text End If Next End Function </code></pre> <p>This doesn't work! Not only does it concatenate incorrectly (each range is concatenated separately, not combined row by row), it doesn't like some type in one of the queries. (debugging these things is not easy as the function actually completes (it doesn't have any syntax errors in it), so there are no built in step throughs I can use.</p> <p>Any help greatly appreciated.</p> <p>Hopefully I've given enough details to make sense of what I'm trying to do.</p> <p>Cheers,</p> <p>Steve </p>
[ { "answer_id": 430557, "author": "barrowc", "author_id": 2127508, "author_profile": "https://Stackoverflow.com/users/2127508", "pm_score": 1, "selected": false, "text": "r = Range(\"Utilchassis,Utilenv,UtilITMA,UtilOS\")\n" }, { "answer_id": 432213, "author": "Mike Rosenblum"...
2009/01/09
[ "https://Stackoverflow.com/questions/429964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
429,987
<p>This is similar to a <a href="https://stackoverflow.com/questions/236414/">previous question</a>, but the answers there don't satisfy my needs and my question is slightly different:</p> <p>I currently use gzip compression for some very large files which contain sorted data. When the files are not compressed, binary search is a handy and efficient way to support seeking to a location in the sorted data.</p> <p>But when the files are compressed, things get tricky. I recently found out about <a href="http://www.zlib.net/" rel="noreferrer">zlib</a>'s <code>Z_FULL_FLUSH</code> option, which can be used during compression to insert "sync points" in the compressed output (<code>inflateSync()</code> can then begin reading from various points in the file). This is OK, though files I already have would have to be recompressed to add this feature (and strangely <code>gzip</code> doesn't have an option for this, but I'm willing to write my own compression program if I must).</p> <p>It seems from <a href="https://web.archive.org/web/20090530165348/http://newsgroups.derkeiler.com/Archive/Comp/comp.compression/2006-02/msg00327.html" rel="noreferrer">one source</a> that even <code>Z_FULL_FLUSH</code> is not a perfect solution...not only is it not supported by all gzip archives, but the very idea of detecting sync points in archives may produce false positives (either by coincidence with the magic number for sync points, or due to the fact that <code>Z_SYNC_FLUSH</code> also produces sync points but they are not usable for random access).</p> <p>Is there a better solution? I'd like to avoid having auxiliary files for indexing if possible, and explicit, default support for quasi-random access would be helpful (even if it's large-grained--like being able to start reading at each 10 MB interval). Is there another compression format with better support for random reads than gzip?</p> <p><strong>Edit</strong>: As I mentioned, I wish to do binary search in the compressed data. I don't need to seek to a specific (uncompressed) position--only to seek with some coarse granularity within the compressed file. I just want support for something like "Decompress the data starting roughly 50% (25%, 12.5%, etc.) of the way into this compressed file."</p>
[ { "answer_id": 430023, "author": "William Brendel", "author_id": 2405, "author_profile": "https://Stackoverflow.com/users/2405", "pm_score": 2, "selected": false, "text": "\"file\" + (offset / 10485760) + \".gz\" offset % 10485760" }, { "answer_id": 7908880, "author": "Alex R...
2009/01/09
[ "https://Stackoverflow.com/questions/429987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323/" ]
429,995
<p>I am trying to figure out how C and C++ store large objects on the stack. Usually, the stack is the size of an integer, so I don't understand how larger objects are stored there. Do they simply take up multiple stack "slots"?</p>
[ { "answer_id": 430017, "author": "Kevin Loney", "author_id": 13834, "author_profile": "https://Stackoverflow.com/users/13834", "pm_score": 0, "selected": false, "text": "void main() {\n int reallyreallybigobjectonthestack[1000000000];\n}\n" }, { "answer_id": 430049, "autho...
2009/01/09
[ "https://Stackoverflow.com/questions/429995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53557/" ]
429,999
<p>I need to extract options in ``particular select tag. Is it possible to accomplish using one regex or I'll have to capture the inner html of select first and then the options? Here is an example of html:</p> <pre><code>&lt;select id="select_id"&gt; &lt;option selected value=""&gt;Select Type&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;/select&gt; </code></pre> <p>.....</p> <p>Thanks.</p>
[ { "answer_id": 430003, "author": "Godeke", "author_id": 28006, "author_profile": "https://Stackoverflow.com/users/28006", "pm_score": 2, "selected": true, "text": "value=\"(\\d*)\"\n <select.*>(.*?)</select>\n" }, { "answer_id": 431869, "author": "Evan Fosmark", "author_i...
2009/01/09
[ "https://Stackoverflow.com/questions/429999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42646/" ]
430,000
<p>I'm trying to figure out how to exclude items from a select statement from table A using an exclusion list from table B. The catch is that I'm excluding based on the prefix of a field.</p> <p>So a field value maybe "FORD Muffler" and to exclude it from a basic query I would do:</p> <pre><code>SELECT FieldName FROM TableName WHERE UPPER(ColumnName) NOT LIKE 'FORD%' </code></pre> <p>But to use a list of values to exclude from a different tabel I would use a Subquery like:</p> <pre><code>SELECT FieldName FROM TableName WHERE UPPER(ColumnName) NOT IN (Select FieldName2 FROM TableName2) </code></pre> <p>The problem is that it only excludes exact matches and not LIKE or Wildcards (%).</p> <p>How can I accomplish this task? Redesigning the table isn't an option as it is an existing table in use.</p> <p>EDIT: Sorry I am using SQL Server (2005).</p>
[ { "answer_id": 430018, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "SELECT FieldName\nFROM TableName\nLEFT JOIN TableName2 ON UPPER(ColumnName) LIKE TableName2.FieldName2 + '%'\nWHERE Tab...
2009/01/09
[ "https://Stackoverflow.com/questions/430000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8664/" ]
430,012
<p>I need to store whether something happens once, daily, weekdays, weekly, some days of the week, some days of the month, which may be numerical or symbolic, like first Monday of each month, and so on.</p> <p>Any recommendations? Any code, data structure or schema to look at?</p>
[ { "answer_id": 430072, "author": "kellan", "author_id": 50631, "author_profile": "https://Stackoverflow.com/users/50631", "pm_score": 3, "selected": false, "text": "id\nrecurrence_start\nrecurrence_end\ntype (daily|weekly|monthly|yearly)\nday_of_week (for weekly)\nmonth\nday_of_month\n" ...
2009/01/09
[ "https://Stackoverflow.com/questions/430012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6068/" ]
430,047
<p>Assume infile is a variable holding the name of an input file, and similarly outfile for output file. If infile ends in <strong>.js</strong>, I'd like to replace with <strong>.min.js</strong> and that's easy enough (I think).</p> <p><strong>outfile = re.sub(r'\b.js$', '.min.js', infile)</strong></p> <p>But my question is if infile ends in <strong>.min.js</strong>, then I do not want the substitution to take place. (Otherwise, I'll end up with <strong>.min.min.js</strong>) How can I accomplish this by using regular expression?</p> <p>PS: This is not homework. If you're curious what this is for: this is for a small python script to do mass compress of JavaScript files in a directory.</p>
[ { "answer_id": 430064, "author": "Evan Fosmark", "author_id": 49701, "author_profile": "https://Stackoverflow.com/users/49701", "pm_score": 4, "selected": true, "text": "outfile = re.sub(r\"(?<!\\.min)\\.js$\", \".min.js\", infile)\n" }, { "answer_id": 430940, "author": "bobi...
2009/01/09
[ "https://Stackoverflow.com/questions/430047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1244013/" ]
430,074
<p>Suppose you use the following structure:</p> <pre><code>var Args = new Object(); Args.Age = '10'; Args.Weight = '10'; Args.GetAge = function() { return 'I am ' + Age + ' years old'; } Args.GetWeight = function() { return 'I weigh ' + Weight + ' pounds'; } </code></pre> <p>That works great. But is it possible to use a generic so you don't have to create a function for each variable? For example, something like the following:</p> <pre><code>Args.GetValue = function(i) { return this.i; } </code></pre> <p>That doesn't seem to work but I don't even know if this is possible. Anyone know the answer to this riddle?</p>
[ { "answer_id": 430080, "author": "Robert C. Barth", "author_id": 9209, "author_profile": "https://Stackoverflow.com/users/9209", "pm_score": 3, "selected": true, "text": "alert(Args[\"Age\"]);\n alert(Args.Age);\n var args = { Age : '10', Weight : '10' };\n" }, { "answer_id": 430...
2009/01/09
[ "https://Stackoverflow.com/questions/430074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51949/" ]
430,078
<p>What would be your suggestions for a good bash/ksh script template to use as a standard for all newly created scripts?</p> <p>I usually start (after the <code>#!</code> line) with a commented-out header with a filename, synopsis, usage, return values, author(s), changelog and would fit into 80-char lines.</p> <p>All documentation lines I start with double-hash symbols <code>##</code> so I can grep for them easily and local var names are prepended with "__".</p> <p>Any other best practices? Tips? Naming conventions? What about return codes? </p> <p>Comments on version control : we use SVN all right, but another dept in the enterprise has a separate repo and this is their script. How do I know who to contact with Q's if there is no @author info? Using entries similar to javadocs has some merit even in the shell context, IMHO, but I might be wrong.</p>
[ { "answer_id": 430600, "author": "Norman Ramsey", "author_id": 41661, "author_profile": "https://Stackoverflow.com/users/41661", "pm_score": 2, "selected": false, "text": "#!/bin/ksh\n usage() typeset" }, { "answer_id": 430680, "author": "Jonathan Leffler", "author_id": 1...
2009/01/09
[ "https://Stackoverflow.com/questions/430078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7229/" ]
430,079
<p>I'd like to split strings like these</p> <pre><code>'foofo21' 'bar432' 'foobar12345' </code></pre> <p>into</p> <pre><code>['foofo', '21'] ['bar', '432'] ['foobar', '12345'] </code></pre> <p>Does somebody know an easy and simple way to do this in python?</p>
[ { "answer_id": 430102, "author": "Evan Fosmark", "author_id": 49701, "author_profile": "https://Stackoverflow.com/users/49701", "pm_score": 7, "selected": true, "text": "re.match import re\nmatch = re.match(r\"([a-z]+)([0-9]+)\", 'foofo21', re.I)\nif match:\n items = match.groups()\np...
2009/01/09
[ "https://Stackoverflow.com/questions/430079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7029/" ]
430,089
<p>In Java, can Class.forName ever return null, or will it always throw a ClassNotFoundException or NoClassDefFoundError if the class can't be located? </p>
[ { "answer_id": 430494, "author": "Miserable Variable", "author_id": 18573, "author_profile": "https://Stackoverflow.com/users/18573", "pm_score": -1, "selected": false, "text": "NoClassDefFoundError class Outer {\n public static final void main(final String[] args) throws Exception{\n ...
2009/01/09
[ "https://Stackoverflow.com/questions/430089", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33897/" ]
430,112
<p>I do not quite understand the difference between a C# reference and a pointer. They both point to a place in memory don't they? The only difference I can figure out is that pointers are not as clever, cannot point to anything on the heap, are exempt from garbage collection, and can only reference structs or base types.</p> <p>One of the reasons I ask is that there is a perception that people need to understand pointers well (from C, I guess) to be a good programmer. A lot of people who learn higher level languages miss this out and therefore have this weakness.</p> <p>I just don't get what is so complex about a pointer? It is basically just a reference to a place in memory is it not? It can return its location and interact with the object in that location directly?</p> <p>Have I missed a massive point?</p>
[ { "answer_id": 430115, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 7, "selected": true, "text": "fixed" }, { "answer_id": 430432, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stack...
2009/01/09
[ "https://Stackoverflow.com/questions/430112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53059/" ]
430,125
<p>I have a data structure that represents C# code like this:</p> <pre><code>class Namespace: string Name; List&lt;Class&gt; Classes; class Class: string Name; List&lt;Property&gt; Properties; List&lt;Method&gt; Methods; List&lt;Method&gt; Constructors; List&lt;Field&gt; Fields; List&lt;Class&gt; InnerClasses; Class Parent; List&lt;Interface&gt; Implements; </code></pre> <p>... which I'm building using a simple lexer/parser combination. I need to traverse the tree and apply a large set of rules (more than 3000). Rules run when encountering different (and quite complex) patterns in the tree. For example, there's a rule that runs when a class only implements interfaces in the same assembly.</p> <p>My original naïve implementation iterates over each rule and then each rule traverses the tree looking for its specific pattern. Of course, this takes quite a lot of time, even with a small amount of source code.</p> <p>I suppose this could be likened to how antivirus software works, recognizing complex patterns on a large body of binary code.</p> <p>How would you suggest one implement this kind of software?</p> <p>EDT: Just like to add: No, I'm not re-implementing FxCop.</p> <p>Thanks</p>
[ { "answer_id": 430238, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 0, "selected": false, "text": "\"Namespace/Class\" \"Class/Interface\" C I C I" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/430125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
430,142
<p>How do map providers (such as Google or Yahoo! Maps) suggest directions?</p> <p>I mean, they probably have real-world data in some form, certainly including distances but also perhaps things like driving speeds, presence of sidewalks, train schedules, etc. But suppose the data were in a simpler format, say a very large directed graph with edge weights reflecting distances. I want to be able to quickly compute directions from one arbitrary point to another. Sometimes these points will be close together (within one city) while sometimes they will be far apart (cross-country).</p> <p>Graph algorithms like Dijkstra's algorithm will not work because the graph is enormous. Luckily, heuristic algorithms like A* will probably work. However, our data is very structured, and perhaps some kind of tiered approach might work? (For example, store precomputed directions between certain "key" points far apart, as well as some local directions. Then directions for two far-away points will involve local directions to a key points, global directions to another key point, and then local directions again.)</p> <p>What algorithms are actually used in practice?</p> <p>PS. This question was motivated by finding quirks in online mapping directions. Contrary to the triangle inequality, sometimes Google Maps thinks that <a href="http://maps.google.com/maps?f=d&amp;saddr=Place+Jacques+Bonsergent,+75010+Paris&amp;daddr=Place+Louis+Lepine,+75004+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.861295,2.35161&amp;sspn=0.013778,0.029655&amp;ie=UTF8&amp;z=14" rel="noreferrer" title="Place Jacques Bonsergent - Place Louis Lepine">X-Z</a> takes longer and is farther than using an intermediate point as in <a href="http://maps.google.com/maps?f=d&amp;saddr=Place+Jacques+Bonsergent,+75010+Paris&amp;daddr=Square+Emile+Chautemps,+75003+Paris+to:Place+Louis+Lepine,+75004+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.869359,2.357833&amp;sspn=0.006888,0.014827&amp;ie=UTF8&amp;z=14" rel="noreferrer" title="via Square Emile Chautemps">X-Y-Z</a>. But maybe their walking directions optimize for another parameter, too?</p> <p>PPS. Here's another violation of the triangle inequality that suggests (to me) that they use some kind of tiered approach: <a href="http://maps.google.com/maps?f=d&amp;saddr=214,+boulevard+de+la+Villette,+75019+Paris&amp;daddr=Passage+des+Patriarches,+75005+Paris&amp;hl=en&amp;geocode=&amp;sll=48.86278,2.35595&amp;sspn=0.05511,0.118618&amp;mra=cc&amp;dirflg=w&amp;ie=UTF8&amp;z=13" rel="noreferrer" title="214, boulevard de la Villette - Passages des Patriarches">X-Z</a> versus <a href="http://maps.google.com/maps?f=d&amp;saddr=214,+boulevard+de+la+Villette,+75019+Paris&amp;daddr=Square+Emile+Chautemps,+75003+Paris+to:Passage+des+Patriarches,+75005+Paris&amp;hl=en&amp;geocode=&amp;mra=ls&amp;dirflg=w&amp;sll=48.86278,2.35595&amp;sspn=0.05511,0.118618&amp;ie=UTF8&amp;ll=48.862682,2.357941&amp;spn=0.05511,0.118618&amp;z=13" rel="noreferrer" title="via Square Emile Chautemps">X-Y-Z</a>. The former seems to use prominent Boulevard de Sebastopol even though it's slightly out of the way.</p> <p><strong>Edit</strong>: Neither of these examples seem to work anymore, but both did at the time of the original post.</p>
[ { "answer_id": 1662591, "author": "Pål GD", "author_id": 40058, "author_profile": "https://Stackoverflow.com/users/40058", "pm_score": 3, "selected": false, "text": "f(n) = k*h(n) + g(n)\n" } ]
2009/01/09
[ "https://Stackoverflow.com/questions/430142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3508/" ]
430,145
<p>After writing code to populate textboxes from an object, such as:</p> <pre><code>txtFirstName.Text = customer.FirstName; txtLastName.Text = customer.LastName; txtAddress.Text = customer.Address; txtCity.Text = customer.City; </code></pre> <p>is there way in Visual Studio (or even something like Resharper) to copy and paste this code into a save function and reverse the code around the equal sign, so that it will look like:</p> <pre><code>customer.FirstName = txtFirstName.Text; customer.LastName = txtLastName.Text; customer.Address = txtAddress.Text; customer.City = txtCity.Text; </code></pre>
[ { "answer_id": 430155, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "txtFirstName.DataBindings.Add(\"Text\", customer, \"FirstName\");\n" }, { "answer_id": 430160, "author": ...
2009/01/09
[ "https://Stackoverflow.com/questions/430145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10276/" ]
430,161
<p>When I submit a form in HTML, I can pass a parameter multiple times, e.g.</p> <pre><code>&lt;input type="hidden" name="id" value="2"&gt; &lt;input type="hidden" name="id" value="4"&gt; </code></pre> <p>Then in struts I can have a bean with property String[] id, and it'll populate the array correctly.</p> <p>My question is, how can I do that in Javascript? When I have an array, and I set form.id.value = myArray, it just sets the value to a comma-separated list. So then on the Struts end, I just get one-element array, i.e. the String "2,4".</p> <p>I should add, I need to submit this in a form, so I can't just generate a GET request, e.g. id=2&amp;id=4.</p>
[ { "answer_id": 430185, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 1, "selected": false, "text": "<input id=\"id1\" type=\"hidden\" name=\"id\" value=\"2\">\n<input id=\"id2\" type=\"hidden\" name=\"id\" value=\"4\...
2009/01/09
[ "https://Stackoverflow.com/questions/430161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45856/" ]
430,163
<p>I have this piece of code</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt; #include &lt;string.h&gt; int main(){ void *a, *b; a = malloc(16); b = malloc(16); printf("\n block size (for a): %p-%p : %li", b, a, b-a); a = malloc(1024); b = malloc(1024); printf("\n block size (for a): %p-%p : %li", b, a, b-a); } </code></pre> <p>Shouldn't this print the last allocated block size (16 or 1024)? It instead prints 24 and 1032, so the amount of memory allocated seems to have 8 extra bytes.</p> <p>My problem is (before making this test case) that I do <code>malloc()</code> in a function (1024 bytes), and return the allocated result. When checking the block size on the function return I get 516 blocks... and I don't understand why. I guess this might be the reason for the memory corruption that occurs after doing some processing on the allocated buffers:)</p> <p><b>Edit:</b> I've seen <a href="https://stackoverflow.com/questions/232691/array-size-from-pointer-in-c">How can I get the size of an array from a pointer in C?</a> and seems to ask the same thing, sorry for reposting.</p> <p>I've redone my example to my more specific code:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdint.h&gt; #include &lt;string.h&gt; short int * mallocStuff(long int number, short int base){ short int *array; int size=1024; array=(short int*)calloc(1,size); //array=(short int*)malloc(size); return array; } int main(){ short int **translatedArray; translatedArray=malloc(4*sizeof(short int)); int i; for(i=0;i&lt;4;i++){ translatedArray[i]=mallocStuff(0,0); if(i&gt;0) printf("\n block size (for a): %p-%p : %i", translatedArray[i], translatedArray[i-1], translatedArray[i]-translatedArray[i-1]); } return 0; } </code></pre> <p>And the output is</p> <pre><code> block size (for a): 0x804a420-0x804a018 : 516 block size (for a): 0x804a828-0x804a420 : 516 block size (for a): 0x804ac30-0x804a828 : 516 </code></pre> <p>According to the above post that is bigger than 1024. Am I wrong?</p>
[ { "answer_id": 430168, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 4, "selected": false, "text": "malloc free() malloc short int short int malloc array=(short int*)malloc(sizeof(short int) * size);\n" }, { "...
2009/01/09
[ "https://Stackoverflow.com/questions/430163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11301/" ]
430,176
<p>Hello I am working with a simulator that uses rcS scripts to boot, this is my script</p> <pre><code>cd /tests ./test1 &amp; ./test2 &amp; ./test3 &amp; ./test4 exit </code></pre> <p>What I want is run all the test at the same time and that the exit command is executed only when all the previous test have finished. And not only when test 4 has finished, is this possible?. Thank you.</p>
[ { "answer_id": 430190, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "cd /tests\n./test1 &\n./test2 &\n./test3 &\n./test4 &\nwait\nexit\n" }, { "answer_id": 430199, "author": "gak", ...
2009/01/09
[ "https://Stackoverflow.com/questions/430176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39160/" ]
430,182
<p>To quote <a href="http://en.wikipedia.org/wiki/Weak_typing" rel="noreferrer">Wikipedia</a>:</p> <blockquote> <p>Two commonly used languages that support many kinds of implicit conversion are C and C++, and it is sometimes claimed that these are weakly typed languages. However, others argue that these languages place enough restrictions on how operands of different types can be mixed, that the two should be regarded as strongly typed languages.</p> </blockquote> <p>Is there a more definitive answer?</p>
[ { "answer_id": 430204, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 5, "selected": false, "text": "void* void* void*" }, { "answer_id": 430242, "author": "BCS", "author_id": 1343, "author_profile...
2009/01/09
[ "https://Stackoverflow.com/questions/430182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43496/" ]