qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
204,576
<p>In my MFC program I am using a splitter to create two panes. I now want to split one of these panes in half again and put in another view, can someone talk me through how to do it or point me in the direction of some code?</p> <p>I would prefer to code it myself so I am not interested in custom derived classes unless they are extremely basic.</p> <p>Thanks!</p>
[ { "answer_id": 204662, "author": "Rob", "author_id": 9236, "author_profile": "https://Stackoverflow.com/users/9236", "pm_score": 4, "selected": true, "text": "CMainFrame::OnCreateClient" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
204,606
<p>In my current 32-bit application, I check (very occasionally) for overflow by doing operations on 64-bit integers.</p> <p>However, on 64-bit systems there does not seem to be a standard 128-bit integer. Is there a simple way of checking for overflow, or a way of getting 128-bit integers, which works on all OSes and compilers?</p> <p>I tried using GMP as a more generic solution, but it is a little heavyweight for my requirements.</p> <p>Efficiency is not too important, no processor specific-ASM is.</p>
[ { "answer_id": 204808, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 1, "selected": false, "text": "int64 myint64::add (int64 a, int64 b) {\n if (MAX_INT64 - a > b) {\n // error condition here.\n }\n retu...
2008/10/15
[ "https://Stackoverflow.com/questions/204606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27074/" ]
204,611
<p>I am working with Crystal Reports and MS SQL Server. I need to remap the crystal report to point to a different database on the same SQL Server. Is there an automated way of doing this, or do I have to remap for every single report? I am currently doing this by adding a new data connection, and then updating the stored procedure with the specified paramether to change database(catalog). Also, after remaping, the .asp that displays the report crashes like this:</p> <p>Active Server Pages, ASP 0115 (0x80004005) A trappable error (E06D7363) occurred in an external object. The script cannot continue running.</p> <p>The code is: </p> <p>Set mainReportTableCollection = Session("oRpt").Database.Tables</p> <pre><code>For Each mnTable in mainReportTableCollection With mnTable.ConnectionProperties .Item("user ID") = "&lt;some_login_name&gt;" .Item("Password") = "&lt;some_password&gt;" .Item("DSN") = "&lt;some_DSN&gt;" .Item("Database") ="&lt;some_Database&gt;" End With Next </code></pre> <p>It runs, however, if i comment out the last two assignations.</p> <p>Thanks in advance.</p> <p>Yours trully, Silviu.</p>
[ { "answer_id": 209010, "author": "Jas", "author_id": 777, "author_profile": "https://Stackoverflow.com/users/777", "pm_score": 0, "selected": false, "text": "'SET REPORT CONNECTION INFO\nFor i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1\n rsource.ReportDocument.DataS...
2008/10/15
[ "https://Stackoverflow.com/questions/204611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
204,612
<p>Trying to make a form wizard with <a href="http://docs.jquery.com/UI/Tabs" rel="nofollow noreferrer">jQuery tabs</a>.</p> <p>Is it possible to have each step of the form in separate views, then load each via jQuery/AJAX tabs option? When I AJAX load the partial form, it has no way to access the js, css, etc.; as there are is no 'header' for the partial file. It doesn't seem to inherit from the parent page at all. As a workaround I have all the forms on one page, divided into tabs with <code>&lt;div&gt;</code>s. This does the job, but with js turned off it doesn't make much sense (though the app relies on js, and will be used in-house only with js enabled browsers).</p> <p>I'm using CodeIgniter, but I guess the question is valid for any MVC framework.</p>
[ { "answer_id": 392306, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": " jQuery(document).ready(function(){\n var tabs = jQuery(\"#tabs > ul\").tabs().bind('tabsload', function( event, ui ){\n ...
2008/10/15
[ "https://Stackoverflow.com/questions/204612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
204,616
<p>We are in the process of moving our SVN repositories from one machine to another one, and with it will come a new domain name for the new repo. The problem is, that within the repository, there are lots of svn:externals references to other projects within the repository. So for example, we have projectA, which has in the svn:externals properties:</p> <pre><code>external/libraryA svn://oldserver.net/repo/libraryA external/libraryB svn://oldserver.net/repo/libraryB </code></pre> <p>...and so on. All of the URL's reference this particular domain name, so it can be easily parsed. Having already learned my lesson, I will migrate these URLs to be "svn://localhost/", but I need to find a way to go through the repository history and rewrite all of the old URLs, so that we can still check out older revisions of these projects without having broken links.</p> <p>How would I go about doing this?</p>
[ { "answer_id": 234106, "author": "yvandermeer", "author_id": 31201, "author_profile": "https://Stackoverflow.com/users/31201", "pm_score": 4, "selected": true, "text": "$ svnadmin dump /path/to/repos > original-dumpfile\n* Dumped revision 0.\n* Dumped revision 1.\n* Dumped revision 2.\n*...
2008/10/15
[ "https://Stackoverflow.com/questions/204616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14302/" ]
204,627
<p>I'm trying to start using LINQ and specifically LINQ to SQL but I'm having some difficulties</p> <p>I've tried this with SqlMetal and now using the database table designer in Visual Studio and I keep getting similar errors, like in this code, using the data context I created with the database layout designer in VS2008.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { string usn = UserNameBox.Text; string pss = PassBox.Text; if (usn == "" || pss == "") return; DataClassesDataContext dc = new DataClassesDataContext(); var user = from u in User where u.UserName == usn select u; } } } </code></pre> <p>I get an error on the where saying: Could not find an implementation of the query pattern for source type 'System.Security.Principal.IPrincipal'. And also: 'Where' not found.</p> <p>I had something similar to this when I tried to use the results of SqlMetal. I deleted that source and started over using the designer. I must be missing something here but I can't figure out what. Shouldn't the tables implement what I need since I'm using LINQ to SQL, or do I need to do something extra to make that happen?</p>
[ { "answer_id": 204631, "author": "Sam", "author_id": 7021, "author_profile": "https://Stackoverflow.com/users/7021", "pm_score": 2, "selected": false, "text": "protected void Page_Load(object sender, EventArgs e) \n{ \n if (Page.IsPostBack) \n {\n string usn = UserNameBox.Text; \n ...
2008/10/15
[ "https://Stackoverflow.com/questions/204627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
204,644
<p>What is the name of the technology behind Google Maps which allows the server to send only the part of the map requested from the user to enhance the performance, and is there any library to handle this?</p>
[ { "answer_id": 204684, "author": "Geoff", "author_id": 1097, "author_profile": "https://Stackoverflow.com/users/1097", "pm_score": 2, "selected": false, "text": "http://maps.google.com/maps?f=q&hl=en&sll=37.0625,-95.677068&sspn=53.345014,88.769531&ie=UTF8&ll=41.226264,-81.454246&spn=0.01...
2008/10/15
[ "https://Stackoverflow.com/questions/204644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459737/" ]
204,646
<p>Does anyone have a simple, efficient way of checking that a string doesn't contain HTML? Basically, I want to check that certain fields only contain plain text. I thought about looking for the &lt; character, but that can easily be used in plain text. Another way might be to create a new System.Xml.Linq.XElement using:</p> <pre><code>XElement.Parse("&lt;wrapper&gt;" + MyString + "&lt;/wrapper&gt;") </code></pre> <p>and check that the XElement contains no child elements, but this seems a little heavyweight for what I need.</p>
[ { "answer_id": 204664, "author": "ICR", "author_id": 214, "author_profile": "https://Stackoverflow.com/users/214", "pm_score": 6, "selected": false, "text": "Regex tagRegex = new Regex(@\"<\\s*([^ >]+)[^>]*>.*?<\\s*/\\s*\\1\\s*>\");\n" }, { "answer_id": 204668, "author": "Jos...
2008/10/15
[ "https://Stackoverflow.com/questions/204646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/203/" ]
204,653
<p>Using a web service is often an excellent architectural approach. And, with the advent of WCF in .Net, it's getting even better.</p> <p>But, in my experience, some people seem to think that web services should always be used in the data access layer for calls to the database. I don't think that web services are the universal solution.</p> <p>I am thinking of smaller intranet applications with a few dozen users. The web app and its web service are deployed to one web server, not a web farm. There isn't going to be another web app in the future that can use this particular web service. It seems to me that the cost of calling the web service unnecessarily increases the burden on the web server. There is a performance hit to inter-process calls. Maintaining and debugging the code for the web app and the web service is more complicated. So is deployment. I just don't see the advantages of using a web service here.</p> <p>One could test this by creating two versions of the web app, with and without the web service, and do stress testing, but I haven't done it.</p> <p>Do you have an opinion on using web services for small-scale web app's? Any other occasions when web services are not a good architectural choice?</p>
[ { "answer_id": 204713, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 6, "selected": true, "text": " - someService.SaveOrder(order); // <-- bad\n // some other code for shipping, charging, emailing, etc\n\n - some...
2008/10/15
[ "https://Stackoverflow.com/questions/204653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27637/" ]
204,670
<p>If I query a table with a condition on the key field as in:</p> <pre><code> var user = from u in dc.Users where u.UserName == usn select u; </code></pre> <p>I know that I will either get zero results or one result. Should I still go ahead and retrieve the results using a for-each or is there another preferred way to handle this kind of situation. </p>
[ { "answer_id": 204678, "author": "Danimal", "author_id": 2757, "author_profile": "https://Stackoverflow.com/users/2757", "pm_score": 4, "selected": false, "text": "var user = dc.Users.SingleOrDefault(u=> u.UserName==usn);\n" }, { "answer_id": 204679, "author": "Joel Cunningha...
2008/10/15
[ "https://Stackoverflow.com/questions/204670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
204,676
<p>I'm about to release a set of Eclipse plug-ins as Open Source and noticed that most source code released under the LGPL/EPL contains a header banner in each file that refers to the license or contains the license itself.</p> <p>Since adding these banners to each file manually seems to be a daunting and error-prone task. How can I go about automating the insertion of these banners?</p> <p><strong><em>Edit:</em></strong> I've eventually found <a href="https://marketplace.eclipse.org/content/copyright-wizard" rel="nofollow noreferrer">Copyright Wizard</a> and <a href="https://marketplace.eclipse.org/content/eclipse-copyright-generator" rel="nofollow noreferrer">Copyright Generator</a> which are Eclipse plug-ins which also allow for updating existing license banners.</p>
[ { "answer_id": 204928, "author": "idrosid", "author_id": 17876, "author_profile": "https://Stackoverflow.com/users/17876", "pm_score": 3, "selected": false, "text": "ls \"*.java\"" }, { "answer_id": 206602, "author": "Chris R", "author_id": 23309, "author_profile": "h...
2008/10/15
[ "https://Stackoverflow.com/questions/204676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4445/" ]
204,682
<p>I want to limit the number of words a person can enter in a text field. How can I track the number of words (by using a second field) in that field as each word is entered?</p>
[ { "answer_id": 2408592, "author": "Phil Rykoff", "author_id": 284364, "author_profile": "https://Stackoverflow.com/users/284364", "pm_score": 2, "selected": false, "text": "$('#newKeywords').bind('change', function() {\n\n $('#wordsLong').text($('#newKeywords').val().split(' ').length ...
2008/10/15
[ "https://Stackoverflow.com/questions/204682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
204,694
<p>I have worked on several distributed client/server projects recently, and one pain point that we always run into is translating the DTO objects into our entities and vice-versa. I was wondering if anyone has a "simple" solution to this time sink?</p> <p>One thing I thought about was coming up with some sort of translation using reflection...I guess you'd have to make sure your property names were exactly the same on each side of the wire - but seems like it might work. </p> <p>Just looking for a way to avoid some of this time sink in my development.</p> <p>Thanks!!</p>
[ { "answer_id": 3043781, "author": "Omu", "author_id": 112100, "author_profile": "https://Stackoverflow.com/users/112100", "pm_score": 0, "selected": false, "text": " object <-> object\n object <-> Form/WebForm\n DataReader -> object\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10589/" ]
204,695
<p>I'm writing a page that can use a couple of different themes, and I'm going to store some information about each theme in the web.config. </p> <p>Is it more efficient to create a new sectionGroup and store everything together, or just put everything in appSettings?</p> <p><b>configSection solution</b></p> <pre><code>&lt;configSections&gt; &lt;sectionGroup name="SchedulerPage"&gt; &lt;section name="Providers" type="System.Configuration.NameValueSectionHandler"/&gt; &lt;section name="Themes" type="System.Configuration.NameValueSectionHandler"/&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;SchedulerPage&gt; &lt;Themes&gt; &lt;add key="PI" value="PISchedulerForm"/&gt; &lt;add key="UB" value="UBSchedulerForm"/&gt; &lt;/Themes&gt; &lt;/SchedulerPage&gt; </code></pre> <p>To access values in the configSection, I am using this code:</p> <pre><code> NameValueCollection themes = ConfigurationManager.GetSection("SchedulerPage/Themes") as NameValueCollection; String SchedulerTheme = themes["UB"]; </code></pre> <p><b>appSettings solution</b></p> <pre><code>&lt;appSettings&gt; &lt;add key="PITheme" value="PISchedulerForm"/&gt; &lt;add key="UBTheme" value="UBSchedulerForm"/&gt; &lt;/appSettings&gt; </code></pre> <p>To access values in appSettings, I am using this code</p> <pre><code> String SchedulerTheme = ConfigurationManager.AppSettings["UBSchedulerForm"].ToString(); </code></pre>
[ { "answer_id": 204745, "author": "Nick Allen", "author_id": 12918, "author_profile": "https://Stackoverflow.com/users/12918", "pm_score": 5, "selected": true, "text": "<appMonitoring enabled=\"true\" smtpServer=\"xxx\">\n <alertRecipients>\n <add name=\"me\" email=\"me@me.com\"/>\n ...
2008/10/15
[ "https://Stackoverflow.com/questions/204695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3018/" ]
204,696
<p>My question is in regards to MySQL, but I also wonder how this affects other databases. I have several fields that are <code>varchar(255)</code> but my coworker insists if they were <code>varchar(30)</code> -- or any smaller size -- then queries would run faster. I'm not so sure, but if it's so I'll admit to it.</p>
[ { "answer_id": 204767, "author": "macbirdie", "author_id": 5049, "author_profile": "https://Stackoverflow.com/users/5049", "pm_score": 0, "selected": false, "text": "tinytext" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28240/" ]
204,711
<p>Of the two methods below, which do you prefer to read?<br> Is there another (better?) way to check if a flag is set?</p> <pre><code> bool CheckFlag(FooFlag fooFlag) { return fooFlag == (this.Foo &amp; fooFlag); } </code></pre> <p>And</p> <pre><code> bool CheckFlag(FooFlag fooFlag) { return (this.Foo &amp; fooFlag) != 0; } </code></pre> <p><hr/> Please vote up the method you prefer.</p>
[ { "answer_id": 204726, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 3, "selected": false, "text": "bool CheckFlag(FooFlag fooFlag)\n{\n return fooFlag == (this.Foo & fooFlag);\n}\n" }, { "answer_id": 2047...
2008/10/15
[ "https://Stackoverflow.com/questions/204711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14484/" ]
204,733
<p>I am constructing a search page with a textbox and a button for now, and probably a dropdown to filter results later on. I have my button's PostBackUrl set to my search page (~/search.aspx). Is there an easy way to pass the value in the text box to the search page?</p>
[ { "answer_id": 204816, "author": "Andy May", "author_id": 12367, "author_profile": "https://Stackoverflow.com/users/12367", "pm_score": 0, "selected": false, "text": "$(document).ready(function(){\n // Event Handlers to allow searching after pressing Enter key\n $(\"#myTextBoxID\")...
2008/10/15
[ "https://Stackoverflow.com/questions/204733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
204,737
<p>I have a lot of castle xml configs where properties like connectionstring are also held under .Net configuration sections.</p> <p>I'd like to be able to read out the properties using the container but can't see a mechanism to do it.</p> <p>ie </p> <pre><code>&lt;castle&gt; &lt;configuration&gt; &lt;properties&gt; &lt;connectionString&gt;Data Source=MyServer;Initial Catalog=YadaYada;User ID=me;Password=IAmGod&lt;/connectionString&gt; &lt;/properties&gt; &lt;components&gt; </code></pre> <p>...</p> <p>Obviously the properties are there as there are component dependencies on them. I can resolve the components but not the properties.</p> <p>Sure I could new up a component just to read out the property castle injected it, or I could wrap all the properties in a component specialised simply to hold name/val pairs. But I would have thought there be a simple container.resolve("property.connectionstring") notation.</p> <p>*Edit Not very good with markdown, above was meant to be a xml section.</p>
[ { "answer_id": 204835, "author": "Ronnie", "author_id": 193, "author_profile": "https://Stackoverflow.com/users/193", "pm_score": 1, "selected": false, "text": "<component type=\"SessionManager\">\n <parameters>\n <connectionString>#{connectionString}</connectionString>\n </paramete...
2008/10/15
[ "https://Stackoverflow.com/questions/204737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
204,739
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/203616/why-does-c-sharp-not-provide-the-c-style-friend-keyword">Why does C# not provide the C++ style ‘friend’ keyword?</a> </p> </blockquote> <p>I'd like the private member variables of a class to be accessible to a Tester class without exposing them to other classes. </p> <p>In C++ I'd just declare the Tester class as a friend, how do I do this in C#? Can someone give me an example?</p>
[ { "answer_id": 204744, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 9, "selected": true, "text": "AssemblyInfo.cs" }, { "answer_id": 204782, "author": "RobG", "author_id": 28232, "author_profile": "h...
2008/10/15
[ "https://Stackoverflow.com/questions/204739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22185/" ]
204,742
<p>Right now I'm working on a web application that receives a significant amount of data from a database that has a potential to return null results. When going through the cyclomatic complexity for the application a number of functions are weighing in between 10 - 30. For the most part the majority of the functions with the high numbers have a lot of lines similar to the following:</p> <pre><code>If Not oraData.IsDBNull(4) Then row("Field") = oraData.GetString(4) </code></pre> <p>Which leads me to my question, what is the best way to go about trying to bring these numbers down? Right now I'm looking at having the majority of the functions below 10. </p>
[ { "answer_id": 204783, "author": "Barry Carr", "author_id": 51820, "author_profile": "https://Stackoverflow.com/users/51820", "pm_score": 2, "selected": false, "text": "//Object Pascal\nprocedure UpdateIfNotNull( const fldName: String; fldIndex : integer );\nbegin\n if oraData.IsDBNull(...
2008/10/15
[ "https://Stackoverflow.com/questions/204742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185/" ]
204,746
<p>For a web application, I want to build a WHERE clause AND submit it to the server. There I will append it to a query. The clause will be something like</p> <pre><code>LASTNAME LIKE 'Pep%' AND (DOB BETWEEN '19600101' AND '19601231 OR SALARY&lt;35000) </code></pre> <p>Can you propose a regular expression to validate the clause before submitting it to SQL Server?</p> <p>(Yes, of course, I would like a regex for the ORDER clause)</p>
[ { "answer_id": 204750, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": false, "text": "LASTNAME LIKE 'Pep%'--\nDROP TABLE People\n--\n" }, { "answer_id": 204974, "author": "Jimmy", "author...
2008/10/15
[ "https://Stackoverflow.com/questions/204746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28207/" ]
204,759
<p>Is there a way to perform an HTTP GET request within a Visual Basic script? I need to get the contents of the response from a particular URL for processing.</p>
[ { "answer_id": 204851, "author": "Svante Svenson", "author_id": 19707, "author_profile": "https://Stackoverflow.com/users/19707", "pm_score": 7, "selected": true, "text": "Dim o\nSet o = CreateObject(\"MSXML2.XMLHTTP\")\no.open \"GET\", \"http://www.example.com\", False\no.send\n' o.resp...
2008/10/15
[ "https://Stackoverflow.com/questions/204759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/271/" ]
204,765
<p>For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script:</p> <pre><code>find -type f | while read file do if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ] then echo "found BOM in: $file" fi done</code></pre> <p>Or, if you prefer short, unreadable one-liners:</p> <pre><code>find -type f|while read file;do [ "`head -c3 -- "$file"`" == $'\xef\xbb\xbf' ] && echo "found BOM in: $file";done</code></pre> <p>It doesn't work with filenames that contain a line break, but such files are not to be expected anyway.</p> <p>Is there any shorter or more elegant solution?</p> <p>Are there any interesting text editors or macros for text editors?</p>
[ { "answer_id": 211855, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 3, "selected": false, "text": "fgrep -rl `echo -ne '\\xef\\xbb\\xbf'` .\n" }, { "answer_id": 212214, "author": "Jonathan Wright", "author_...
2008/10/15
[ "https://Stackoverflow.com/questions/204765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19163/" ]
204,779
<p>I'm VERY new to WPF, and still trying to wrap my head around binding in XAML.</p> <p>I'd like to populate a combobox with the values of a string collection in my.settings. I can do it in code like this:</p> <p>Me.ComboBox1.ItemsSource = My.Settings.MyCollectionOfStrings</p> <p>...and it works.</p> <p>How can I do this in my XAML? is it possible?</p> <p>Thanks</p>
[ { "answer_id": 204855, "author": "Enrico Campidoglio", "author_id": 26396, "author_profile": "https://Stackoverflow.com/users/26396", "pm_score": 5, "selected": true, "text": "<Window x:Class=\"WpfApplication1.Window1\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentati...
2008/10/15
[ "https://Stackoverflow.com/questions/204779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/641985/" ]
204,784
<p>Given two absolute paths, e.g.</p> <pre><code>/var/data/stuff/xyz.dat /var/data </code></pre> <p>How can one create a relative path that uses the second path as its base? In the example above, the result should be: <code>./stuff/xyz.dat</code></p>
[ { "answer_id": 204847, "author": "Keeg", "author_id": 21059, "author_profile": "https://Stackoverflow.com/users/21059", "pm_score": 3, "selected": false, "text": "String s1 = \"/var/data/stuff/xyz.dat\";\nString s2 = \"/var/data\";\nString s3 = s1.substring(s2.length());\n" }, { ...
2008/10/15
[ "https://Stackoverflow.com/questions/204784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23424/" ]
204,801
<p>I believe the following VB.Net code is the equivalent of the proceeding C# code; however the VB.Net test fails - the event handling Lambda is never called.</p> <p>What is going on?</p> <p>VB.Net version - fails:</p> <pre class="lang-vb prettyprint-override"><code>&lt;TestFixture()&gt; _ Public Class TestClass &lt;Test()&gt; _ Public Sub EventTest() Dim eventClass As New EventClass Dim eventRaised As Boolean = False AddHandler eventClass.AnEvent, Function() (eventRaised = True) eventClass.RaiseIt() Assert.IsTrue(eventRaised) End Sub End Class Public Class EventClass Public Event AnEvent() Public Sub RaiseIt() RaiseEvent AnEvent() End Sub End Class </code></pre> <p>C# version - passes:</p> <pre><code>[TestFixture] public class TestClass { [Test] public void EventTest() { var eventClass = new EventClass(); var eventRaised = false; eventClass.AnEvent += () =&gt; { eventRaised = true; }; eventClass.RaiseIt(); Assert.IsTrue(eventRaised); } } public class EventClass { public delegate void EventHandler(); public event EventHandler AnEvent; public void RaiseIt() { AnEvent(); } } </code></pre>
[ { "answer_id": 204992, "author": "Gareth D", "author_id": 3580, "author_profile": "https://Stackoverflow.com/users/3580", "pm_score": 5, "selected": true, "text": "eventRaised = true" }, { "answer_id": 14182962, "author": "svick", "author_id": 41071, "author_profile":...
2008/10/15
[ "https://Stackoverflow.com/questions/204801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3580/" ]
204,806
<p>This concept is new to me, and a colleague suggested it. Sadly, I had no idea what he was talking about. Can someone enlighten me?</p>
[ { "answer_id": 204923, "author": "ilitirit", "author_id": 9825, "author_profile": "https://Stackoverflow.com/users/9825", "pm_score": 2, "selected": false, "text": "object _comObject;\nType _comObjectType;\n_comObjectType = Type.GetTypeFromProgID(\"MyCompany.MyApplication.MyObject\", tru...
2008/10/15
[ "https://Stackoverflow.com/questions/204806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5469/" ]
204,807
<p>I am looking for a way to create or implement a collapsible side panel inside of a form. Similar in the way a ToolStripContainer works I would like the same general concept except using panels that I can fill with controls. Does anyone know of a simple way to do this with the provided .Net controls or is this a total custom job. Either way I would appreciate some suggestions.</p>
[ { "answer_id": 11003847, "author": "General Grey", "author_id": 1034475, "author_profile": "https://Stackoverflow.com/users/1034475", "pm_score": 1, "selected": false, "text": " private void button1_Click(object sender, EventArgs e)\n {\n if (button1.Text == \">\")\n ...
2008/10/15
[ "https://Stackoverflow.com/questions/204807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25511/" ]
204,813
<p>In the past people used to wrap HTML comment tags around blocks of JavaScript in order to prevent "older" browsers from displaying the script. Even Lynx is smart enough to ignore JavaScript, so why do some people keep doing this? Are there any valid reasons these days?</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;!-- //some js code //--&gt; &lt;/script&gt; </code></pre> <p>Edit: There is ONE situation I did encounter. Some code editors, such as Dreamweaver, get confused by quoted HTML inside a JavaScript string when in "design view" and try to display it as part of your page.</p>
[ { "answer_id": 207749, "author": "Ionuț Staicu", "author_id": 23810, "author_profile": "https://Stackoverflow.com/users/23810", "pm_score": 4, "selected": false, "text": "<script type=\"text/javascript\" charset=\"utf-8\">\n/* <![CDATA[ */\n\n/* ]]> */\n</script>\n" }, { "answer_...
2008/10/15
[ "https://Stackoverflow.com/questions/204813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
204,814
<p>Wow, I just got back a huge project in C# from outsourced developers and while going through my code review my analysis tool revealed bunches of what it considered bad stuff. One of the more discouraging messages was:</p> <pre><code>Exceptions.DontSwallowErrorsCatchingNonspecificExceptionsRule : 2106 defects </code></pre> <p>The developers assure me they had good reason for all the empty catch blocks, that sometimes the try with empty catch blocks are just there to ignore useless exceptions and keep the application from crashing. I feel this is a cop out and complete BS. Some of the examples I actually looked up were database calls where the record was being saved to the database, and in this case, if an exception was ignored, the user would get back an okay prompt, think everything was okay, and continue on with their work. In reality, their work was never saved. I think this is absolutely the most horrible kind of error. In this case, they are completely wrong in throwing that code in a try with an empty catch block. But my question is, "Is this EVER acceptable in ANY situation?" I think not, but I've been known to be wrong. </p>
[ { "answer_id": 204870, "author": "rjzii", "author_id": 1185, "author_profile": "https://Stackoverflow.com/users/1185", "pm_score": 7, "selected": true, "text": "try {\n // Do something that might generate an exception\n} catch (System.InvalidCastException ex) {\n // This exception is s...
2008/10/15
[ "https://Stackoverflow.com/questions/204814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18893/" ]
204,823
<p>I'm required to write documentation for my current project that lists all .c files and for each one lists every .h file which is directly or indirectly included by that file.</p> <p>This is a large project, and although we have Makefiles which theoretically have this information, those Makefiles are sometimes incorrect (we inherited this project from another company). We've often had to do a <code>make clean ; make</code> for our changes to actually be reflected in the recompilation, so I don't want to rely on these Makefiles.</p> <p>So is there a tool which lets us give it the name of a .c file and an include path and have it tell us all of the .h files which are directly or indirectly included by the .c file? We don't have anything weird like</p> <pre><code>#define my_include "some_file.h" #include my_include </code></pre> <p>so the tool doesn't need to be perfect. Anything that searched .c and .h files in an include path for regular includes would be good enough.</p>
[ { "answer_id": 204893, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "gcc -M file.c" }, { "answer_id": 204930, "author": "Mark Baker", "author_id": 11815, "author_profile": "ht...
2008/10/15
[ "https://Stackoverflow.com/questions/204823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1694/" ]
204,829
<p>Situation:</p> <ul> <li>text: a string</li> <li>R: a regex that matches part of the string. This might be expensive to calculate. </li> </ul> <p>I want to both delete the R-matches from the text, and see what they actually contain. Currently, I do this like:</p> <pre><code>import re ab_re = re.compile("[ab]") text="abcdedfe falijbijie bbbb laifsjelifjl" ab_re.findall(text) # ['a', 'b', 'a', 'b', 'b', 'b', 'b', 'b', 'a'] ab_re.sub('',text) # 'cdedfe flijijie lifsjelifjl' </code></pre> <p>This runs the regex twice, near as I can tell. Is there a technique to do it all on pass, perhaps using re.split? It seems like with split based solutions I'd need to do the regex at least twice as well. </p>
[ { "answer_id": 204961, "author": "Hamish Downer", "author_id": 3189, "author_profile": "https://Stackoverflow.com/users/3189", "pm_score": 0, "selected": false, "text": "import re\nab_re = re.compile(\"([ab])\")\ntext=\"abcdedfe falijbijie bbbb laifsjelifjl\"\nmatches = ab_re.split(text)...
2008/10/15
[ "https://Stackoverflow.com/questions/204829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842/" ]
204,831
<p>With so many languages and frameworks that exist, and with new ones appearing all the time, I don't have the time to download, install, and configure each one to evaluate it. In the past I've run across webapps that allow one to write or paste code into a window, and see the results in realtime in the browser, usually in a tutorial setting. </p> <p>What are your favorite sandbox sites for a given technology?</p> <p><strong>Edit:</strong> @fretj provided the link to the excellent <a href="http://code.google.com/apis/ajax/playground/" rel="noreferrer">Google Code Playground</a> (+1 upvote), but I thought that it was just for experimenting with Google's own apps (Search, Maps, Earth, Language, etc). But it turns out that it contains a few hidden gems: In addition to their apps, you can try out the many Javascript libraries that they host including <a href="http://code.google.com/apis/ajax/playground/#jquery" rel="noreferrer">jQuery</a>, <a href="http://code.google.com/apis/ajax/playground/#jqueryui" rel="noreferrer">jQuery UI</a>, <a href="http://code.google.com/apis/ajax/playground/#mootools" rel="noreferrer">MooTools</a>, <a href="http://code.google.com/apis/ajax/playground/#dojo" rel="noreferrer">Dojo</a>, and <a href="http://code.google.com/apis/ajax/playground/#prototype_scriptaculous" rel="noreferrer">Prototype Scriptaculous</a>. </p> <p>They're all hidden under the Libraries category in the "Pick an API" box. I overlooked the category because I thought it was for an app called Google Libraries. There's also a Javascript category for Javascript itself.</p>
[ { "answer_id": 27371632, "author": "DJMcMayhem", "author_id": 3524982, "author_profile": "https://Stackoverflow.com/users/3524982", "pm_score": 0, "selected": false, "text": "from time import sleep\nprint \"We are going to sleep for 5 seconds.\"\nsleep(5)\nprint \"Now we will sleep for 3...
2008/10/15
[ "https://Stackoverflow.com/questions/204831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8161/" ]
204,852
<p>I have an xsd like this </p> <pre><code>&lt;xsd:complexType name="A"&gt; &lt;xsd:complexContent&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="options"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="Day"&gt; ... &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="B"&gt; &lt;xsd:complexContent&gt; &lt;xsd:extension base="A"&gt; ...What would go here... &lt;/xsd:extension&gt; &lt;/xsd:complexContent&gt; &lt;/xsd:complexType&gt; </code></pre> <p>So basically I want class A to have a sequence of options (Day, Week for example) then I want B to inherit from A and have all of A's options and an additional 2 or 3 options like hours, seconds.</p>
[ { "answer_id": 205247, "author": "csgero", "author_id": 21764, "author_profile": "https://Stackoverflow.com/users/21764", "pm_score": 3, "selected": false, "text": "<xsd:sequence>" }, { "answer_id": 207487, "author": "Richard Nienaber", "author_id": 9539, "author_prof...
2008/10/15
[ "https://Stackoverflow.com/questions/204852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22763/" ]
204,877
<p>What does the following mean?</p> <pre><code>Class.Function(variable := 1 + 1) </code></pre> <p>What is this operator called, and what does it do? </p>
[ { "answer_id": 204935, "author": "Ikke", "author_id": 20261, "author_profile": "https://Stackoverflow.com/users/20261", "pm_score": 5, "selected": true, "text": "sub test(optional a as string = \"\", optional b as string = \"\")\n msgbox(a & b)\nend sub\n" }, { "answer_id": 204...
2008/10/15
[ "https://Stackoverflow.com/questions/204877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40/" ]
204,886
<p>you can request the http header to check if a web page has been edited by looking at its date but how about dynamic pages such as - php, aspx- which grabs its data from a database?</p>
[ { "answer_id": 204971, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 0, "selected": false, "text": "Last-Modified" }, { "answer_id": 236380, "author": "Leandro López", "author_id": 22695, "author_profile"...
2008/10/15
[ "https://Stackoverflow.com/questions/204886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459737/" ]
204,914
<p>I'm trying to simply use some of the examples and instructions regarding the YUI-Uploader, and I'm being frustrated by a number of issues.</p> <ol> <li>The "YUI Library: Uploader" cheat sheet's simple use case doesn't work for me because all the listed methods except <code>addListener()</code> do not exist on the myUploader object.</li> <li>The <a href="http://developer.yahoo.com/yui/examples/uploader/uploader-simple.html" rel="nofollow noreferrer">example</a> is for version 2.5.1 and includes a method called <code>browse()</code>, which not only was removed in version 2.6.0 but I cannot find any documentation for how to use the 2.5.1 version if I so choose.</li> <li>I can't find the source FLA to the <code>uploader.swf</code> file so that I could theoretically diagnose all these issues.</li> </ol> <p>Has anyone successfully used the 2.6.0 YUI Uploader, and if so is there some common interfering JavaScript I should avoid, or a better example to follow? Thank you.</p> <p>Thanks for the replies.</p> <p>I might note that I finished my "uploader" project before receiving any responses to this. Part of my problems were due to some of the examples being for v2.5.1 and another part were due to not using an event listener to see when the component was ready. I got the most help from just dissecting what <a href="http://flickr.com" rel="nofollow noreferrer">Flickr</a> did.</p>
[ { "answer_id": 689083, "author": "Simon Lieschke", "author_id": 2766, "author_profile": "https://Stackoverflow.com/users/2766", "pm_score": 3, "selected": true, "text": "uploader.swf" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459/" ]
204,918
<p>Does SQLAlchemy support some kind of caching so if I repeatedly run the same query it returns the response from cache instead of querying the database? Is this cache automatically cleared when the DB is updated?</p> <p>Or what's the best way to implement this on a CherryPy + SQLAlchemy setup?</p>
[ { "answer_id": 232376, "author": "torial", "author_id": 13990, "author_profile": "https://Stackoverflow.com/users/13990", "pm_score": 4, "selected": false, "text": "Does SQLAlchemy do any kind of internal caching?\n\nFor example, if you ask for the same data twice (or an obvious subset\n...
2008/10/15
[ "https://Stackoverflow.com/questions/204918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
204,924
<p>I know that you can apply CSS in order to style objects in Flex using the StyleManager:<br> <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/help.html?content=styles_07.html</a> </p> <p>You can also load <strong>compiled</strong> CSS files (SWFs) dynamically:<br> <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/html/help.html?content=styles_10.html</a> </p> <p>However, I'm dynamically creating my CSS files using a web GUI and a server-side script. If the CSS is changed, then the script would also need to compile the CSS into an SWF (which is not a viable option). Is there any way around this?</p>
[ { "answer_id": 7534609, "author": "sixtyfootersdude", "author_id": 251589, "author_profile": "https://Stackoverflow.com/users/251589", "pm_score": 2, "selected": false, "text": "public function extractFromStyleSheet(css:String):void {\n\n // Create a StyleSheet Object\n var styleSh...
2008/10/15
[ "https://Stackoverflow.com/questions/204924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18146/" ]
204,926
<p>Are there any good code profilers/analyzers for Erlang? I need something that can build a call graph (eg gprof) for my code.</p>
[ { "answer_id": 205002, "author": "krakatoa", "author_id": 12223, "author_profile": "https://Stackoverflow.com/users/12223", "pm_score": 3, "selected": false, "text": "fprof:apply(foo, create_file_slow, [junk, 1024]).\nfprof:profile().\nfprof:analyse().\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2727/" ]
204,933
<p>I read an excel sheet into a datagrid.From there , I have managed to read the grid's rows into a DataTable object.The DataTable object has data because when I make equal a grid's datasource to that table object , the grid is populated.</p> <p>My Problem : I want to use the table object and manipulate its values using SQL server,(i.e. I want to store it as a temporary table and manipulate it using SQL queries from within C# code and , I want it to return a different result inte a grid.(I don't know how to work with temporary tables in C#)</p> <p>Here's code to execute when clicking button....</p> <pre><code> SqlConnection conn = new SqlConnection("server = localhost;integrated security = SSPI"); //is connection string incorrect? SqlCommand cmd = new SqlCommand(); //!!The method ConvertFPSheetDataTable Returns a DataTable object// cmd.Parameters.AddWithValue("#table",ConvertFPSheetDataTable(12,false,fpSpread2_Sheet1)); //I am trying to create temporary table //Here , I do a query cmd.CommandText = "Select col1,col2,SUM(col7) From #table group by col1,col2 Drop #table"; SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText,conn); DataTable dt = new DataTable(); da.Fill(dt); ***// I get an error here 'Invalid object name '#table'.'*** fpDataSet_Sheet1.DataSource = dt; //**NOTE:** fpDataSet_Sheet1 is the grid control </code></pre>
[ { "answer_id": 204964, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": " var query = from row in table.Rows.Cast<DataRow>()\n group row by new\n {\n...
2008/10/15
[ "https://Stackoverflow.com/questions/204933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
204,936
<p>What is the best way to set the time on a remote machine remotely? The machine is running Windows XP and is receiving the new time through a web service call. The goal is to keep the remote machines in synch with the server. The system is locked down so that our web service is the only access, so I cannot use a time server on each remote machine.</p>
[ { "answer_id": 204967, "author": "Robert S.", "author_id": 7565, "author_profile": "https://Stackoverflow.com/users/7565", "pm_score": 3, "selected": false, "text": "[StructLayout(LayoutKind.Sequential)] \npublic struct SYSTEMTIME { \n public short wYear; \n public short wMonth; \n publi...
2008/10/15
[ "https://Stackoverflow.com/questions/204936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3457/" ]
204,942
<p>We have an application that installs SQL Server Express from the command line and specifies the service account as the LocalSystem account via the parameter SQLACCOUNT="NT AUTHORITY\SYSTEM".</p> <p>This doesn't work with different languages because the account name for LocalSystem is different. There's a table listing the differences here:</p> <p><a href="http://forums.microsoft.com/MSR/ShowPost.aspx?PostID=685354&amp;SiteID=37" rel="nofollow noreferrer">http://forums.microsoft.com/MSR/ShowPost.aspx?PostID=685354&amp;SiteID=37</a></p> <p>This doesn't seem to be complete (the Swedish version isn't listed). So I'd like to be able to determine the name programmatically, perhaps using the SID?</p> <p>I've found some VB Script to do this:</p> <pre><code>Set objWMI = GetObject("winmgmts:root\cimv2") Set objSid = objWMI.Get("Win32_SID.SID='S-1-5-18'") MsgBox objSid.ReferencedDomainName &amp; "\" &amp; objSid.AccountName </code></pre> <p>Does anyone know the equivalent code that can be used in C#?</p>
[ { "answer_id": 204955, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": 1, "selected": false, "text": "ManagementObject m = new ManagementObject(\"winmgmts:root\\cimv2\");\nm.Get();\nMessageBox.Show(m[\"Win32_SID.SID='S-...
2008/10/15
[ "https://Stackoverflow.com/questions/204942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5449/" ]
204,950
<p>I have just installed the Krypton Toolkit 3.0.6 from component Factory. I find that in the create new Project Dialog Box , Krypton Form does not show up as an option. I am sure it used to show up ( and I have actually used it in an earlier version of krypton toolkit).But after the new install it does not.</p>
[ { "answer_id": 208226, "author": "dezkev", "author_id": 28291, "author_profile": "https://Stackoverflow.com/users/28291", "pm_score": 2, "selected": false, "text": "public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
204,963
<p>I'm quite confused by something. I've got 2 select lists, and if you choose an option in the first, I then load the 2nd with a certain set of options. I clear this out and repopulate it every time you change the selection in the first select element. Now, on postback, I need to know the value of the option that was selected in the 2nd select element, but it is always showing up as -1.</p> <p>I'm sure I'm missing something fundamental and dumb on my part, but can anyone point me in the right direction?</p>
[ { "answer_id": 208226, "author": "dezkev", "author_id": 28291, "author_profile": "https://Stackoverflow.com/users/28291", "pm_score": 2, "selected": false, "text": "public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/204963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/232/" ]
204,970
<p>Suppose I have following string:</p> <pre><code>String asd = "this is test ass this is test" </code></pre> <p>and I want to split the string using "ass" character sequence.</p> <p>I used:</p> <pre><code>asd.split("ass"); </code></pre> <p>It doesn't work. What do I need to do?</p>
[ { "answer_id": 205004, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "public class Test\n{\n public static void main(String[] args) {\n String asd = \"this is test ass this is test...
2008/10/15
[ "https://Stackoverflow.com/questions/204970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25778/" ]
204,983
<p>If you want to associate some constant value with a class, here are two ways to accomplish the same goal:</p> <pre><code>class Foo { public: static const size_t Life = 42; }; class Bar { public: enum {Life = 42}; }; </code></pre> <p>Syntactically and semantically they appear to be identical from the client's point of view:</p> <pre><code>size_t fooLife = Foo::Life; size_t barLife = Bar::Life; </code></pre> <p>Is there any reason other than just pure style concerns why one would be preferable to another?</p>
[ { "answer_id": 204999, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "size_t *pLife1 = &Foo::Life;\nsize_t *pLife2 = &Bar::Life;\n" }, { "answer_id": 205000, "author": "Konrad Rudolph"...
2008/10/15
[ "https://Stackoverflow.com/questions/204983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/241536/" ]
204,991
<p>I'm not quite sure how this happened, but somehow a completely empty hierarchy of directories has ended up in my repository:</p> <pre><code>com/ com/companyname/ com/companyname/blah/ com/sun/ com/sun/java/ com/sun/java/jax_rpc_ri/ </code></pre> <p>I think what happened was that these directories did have files in them, but then a developer realized he/she shouldn't have checked them in in the first place since these are by-products of the build process, so he/she removed the files but somehow the empty directories are left in the repository as ancient relics.</p> <p>How can I remove this from CVS? The only results I seem to be able to find on google say that there shouldn't be a need to remove empty directories as CVS won't keep them around in the first place, and that the <code>-P</code> (prune) options to <code>cvs update</code> should remove them from the working directory - which is zero help if you actually have empty directories in your repository.</p> <p>A <code>cvs remove</code> and <code>cvs commit</code> doesn't seem to take care of this situation:</p> <pre><code>$ cvs remove -Rf com cvs remove: Removing com cvs remove: Removing com/companyname cvs remove: Removing com/companyname/blah cvs remove: Removing com/sun cvs remove: Removing com/sun/java cvs remove: Removing com/sun/java/jax_rpc_ri $ cvs commit com cvs commit: Examining com cvs commit: Examining com/companyname cvs commit: Examining com/companyname/blah cvs commit: Examining com/sun cvs commit: Examining com/sun/java cvs commit: Examining com/sun/java/jax_rpc_ri $ ls -l com total 24 drwxrwxr-x 2 matt matt 4096 Oct 15 14:38 CVS drwxrwxr-x 9 matt matt 4096 Oct 15 14:38 companyname drwxrwxr-x 4 matt matt 4096 Oct 15 14:38 sun </code></pre> <p>It's still there!</p> <p>Does SVN have this weird behavior too?</p>
[ { "answer_id": 205042, "author": "Commodore Jaeger", "author_id": 4659, "author_profile": "https://Stackoverflow.com/users/4659", "pm_score": 5, "selected": false, "text": "cvs update -dP\n" }, { "answer_id": 205081, "author": "Rob Wells", "author_id": 2974, "author_p...
2008/10/15
[ "https://Stackoverflow.com/questions/204991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249/" ]
205,001
<p>What's the best way to remove a page frame automatically?</p> <p>I've used this type of code before:</p> <pre><code>&lt;script language="JavaScript"&gt; setTimeout ("changePage()", 3000); function changePage() { if (self.parent.frames.length != 0) self.parent.location="http://www.example.com"; } &lt;/script&gt; </code></pre>
[ { "answer_id": 205055, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 0, "selected": false, "text": "if ( self.location !== top.location )\n{\n top.location.replace( self.location );\n}\n" }, { "answer_id": 20...
2008/10/15
[ "https://Stackoverflow.com/questions/205001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28260/" ]
205,040
<p>In my SQL database, I have a one-to-many relationship, something like this:</p> <pre> Teacher Student John Alex John Mike John Sean Bob Jack Gary George Gary Paul </pre> <p>I'd like to display a table listing each teacher, with their students as a comma-delimited list, like this:</p> <pre> Teacher Students John Alex, Mike, Sean Bob Jack Gary George, Paul </pre> <p><a href="https://stackoverflow.com/questions/180032/how-can-i-combine-multiple-rows-into-a-comma-delimited-list-in-sql-server-2005">This question</a> describes how to do this on the SQL Server end, but is there a way to do this on the SSRS side of things?</p>
[ { "answer_id": 30518651, "author": "Jerry", "author_id": 53531, "author_profile": "https://Stackoverflow.com/users/53531", "pm_score": 4, "selected": true, "text": "=Join(LookUpSet(Fields!TeacherName.Value, \n Fields!TeacherName.Value, \n Fields!StudentName.Value, \n \"YourTeach...
2008/10/15
[ "https://Stackoverflow.com/questions/205040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16911/" ]
205,064
<p>On Unix, is there any way that one process can change another's environment variables (assuming they're all being run by the same user)? A general solution would be best, but if not, what about the specific case where one is a child of the other?</p> <p>Edit: How about via gdb?</p>
[ { "answer_id": 205082, "author": "Davide", "author_id": 25891, "author_profile": "https://Stackoverflow.com/users/25891", "pm_score": 3, "selected": false, "text": "/proc/${pid}/environ" }, { "answer_id": 211064, "author": "An̲̳̳drew", "author_id": 17035, "author_prof...
2008/10/15
[ "https://Stackoverflow.com/questions/205064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
205,070
<p>Real UID, effective UID, and some systems even have a "saved UID". What's the purpose of all these, especially the last one?</p>
[ { "answer_id": 24708775, "author": "LGkash", "author_id": 2922591, "author_profile": "https://Stackoverflow.com/users/2922591", "pm_score": 2, "selected": false, "text": "setuid" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/205070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
205,073
<p>This is probably a simple answer but I can't find it. I have a table with a column of integers and I want to ensure that when a row is inserted that the value in this column is greater than zero. I could do this on the code side but thought it would be best to enforce it on the table.</p> <p>Thanks!</p> <p>I was in error with my last comment all is good now.</p>
[ { "answer_id": 205093, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 3, "selected": false, "text": "ALTER TABLE Table1 ADD CONSTRAINT Constraint1 CHECK (YourCol > 0)\n" }, { "answer_id": 205095, "author": "Conc...
2008/10/15
[ "https://Stackoverflow.com/questions/205073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2357/" ]
205,087
<p>We are using jQuery <a href="http://jquery.com/demo/thickbox/" rel="noreferrer">thickbox</a> to dynamically display an iframe when someone clicks on a picture. In this iframe, we are using <a href="http://devkick.com/lab/galleria/demo_01.htm" rel="noreferrer">galleria</a> a javascript library to display multiple pictures.</p> <p>The problem seems to be that <code>$(document).ready</code> in the iframe seems to be fired too soon and the iframe content isn't even loaded yet, so galleria code is not applied properly on the DOM elements. <code>$(document).ready</code> seems to use the iframe parent ready state to decide if the iframe is ready.</p> <p>If we extract the function called by document ready in a separate function and call it after a timeout of 100&nbsp;ms. It works, but we can't take the chance in production with a slow computer.</p> <pre><code>$(document).ready(function() { setTimeout(ApplyGalleria, 100); }); </code></pre> <p>My question: which jQuery event should we bind to to be able to execute our code when the dynamic iframe is ready and not just it's a parent?</p>
[ { "answer_id": 205221, "author": "Pier Luigi", "author_id": 27789, "author_profile": "https://Stackoverflow.com/users/27789", "pm_score": 9, "selected": true, "text": "function callIframe(url, callback) {\n $(document.body).append('<IFRAME id=\"myId\" ...>');\n $('iframe#myId').att...
2008/10/15
[ "https://Stackoverflow.com/questions/205087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9140/" ]
205,112
<p>Is there any way to print in memory collection or variable size in WPF? </p> <p>I am using the following code in which I print the ListView control. But when the content is larger than the vertical scroll bar takes over and cuts the content. </p> <pre><code> PrintDialog printDialog = new PrintDialog(); printDialog.ShowDialog(); printDialog.PrintVisual(lvDocumentSummary, "testing printing!"); </code></pre>
[ { "answer_id": 380522, "author": "Ifeanyi Echeruo", "author_id": 47702, "author_profile": "https://Stackoverflow.com/users/47702", "pm_score": 4, "selected": true, "text": "FlowDocument fd = new FlowDocument();\n\nforeach(object item in items)\n{\n fd.Blocks.Add(new Paragraph(new Run(...
2008/10/15
[ "https://Stackoverflow.com/questions/205112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3797/" ]
205,114
<p>I have an asp.net 2.0 page that contains 2 <code>UpdatePanels</code>.</p> <p>The first panel contains a <code>TreeView</code> control, when I select a node in the three view control it triggers an update of the second <code>UpdatePanel</code> only. This much is behaving correctly.</p> <p>There are two buttons on the page outside of an update panel (previous/next). These buttons trigger an update of both panels. The behaviour of the buttons is to select the adjacent node in the tree. The first time I click on one of these buttons I get the expected behaviour, and adjacent node is selected and the both panels are updated to reflect this change.</p> <p>The problem happens when I click any of these buttons again. The selected node of the treeview seems to remember the previously selected node and the buttons act on this node. So the behaviour of the previous/next buttons is to do nothing or jump back two.</p> <p><strong>Edit</strong> - Sample code that demonstrates my problem</p> <p>The markup</p> <pre><code> &lt;asp:UpdatePanel ID="myTreeViewPanel" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:TreeView runat="server" ID="myTreeView" OnSelectedNodeChanged="myTreeView_SelectedNodeChanged"&gt; &lt;SelectedNodeStyle BackColor="#FF8000" /&gt; &lt;/asp:TreeView&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="myButton" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:UpdatePanel ID="myLabelPanel" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Label runat="server" ID="myLabel" Text="myLabel"&gt;&lt;/asp:Label&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="myTreeView" EventName="SelectedNodeChanged" /&gt; &lt;asp:AsyncPostBackTrigger ControlID="myButton" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:Button runat="server" ID="myButton" Text="myButton" OnClick="myButton_Click" /&gt; </code></pre> <p>The code behind</p> <pre><code> protected void Page_Load ( object sender, EventArgs e ) { if ( !IsPostBack ) { myTreeView.Nodes.Add( new TreeNode( "Test 1", "Test One" ) ); myTreeView.Nodes.Add( new TreeNode( "Test 2", "Test two" ) ); myTreeView.Nodes.Add( new TreeNode( "Test 3", "Test three" ) ); myTreeView.Nodes.Add( new TreeNode( "Test 4", "Test four" ) ); myTreeView.Nodes.Add( new TreeNode( "Test 5", "Test five" ) ); myTreeView.Nodes.Add( new TreeNode( "Test 6", "Test size" ) ); } } protected void myTreeView_SelectedNodeChanged ( object sender, EventArgs e ) { UpdateLabel( ); } protected void myButton_Click ( object sender, EventArgs e ) { // here we just select the next node in the three int index = myTreeView.Nodes.IndexOf( myTreeView.SelectedNode ); myTreeView.Nodes[ index + 1 ].Select( ); UpdateLabel( ); } private void UpdateLabel ( ) { myLabel.Text = myTreeView.SelectedNode.Value; } </code></pre> <p>It is like the viewstate of the tree is not being saved?</p>
[ { "answer_id": 206077, "author": "tpower", "author_id": 18107, "author_profile": "https://Stackoverflow.com/users/18107", "pm_score": 0, "selected": false, "text": "protected override object SaveViewState()\n{\n ViewState[\"SelectedNodePath\"] = myTreeView.SelectedNode.ValuePath;\n r...
2008/10/15
[ "https://Stackoverflow.com/questions/205114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
205,154
<p>I'm exploring git to see how it might work for my company. I've got git installed and I need to know a couple things:</p> <ul> <li>How can I set up a git server on my computer to act as my central repo?</li> <li>I'm trying to figure out how to manage my workflow with just the GUI on Windows (using the GUI is a requirement). How do I take a bunch of files in a folder and get them into my GIT repo?</li> </ul> <p>If there's a good tutorial for each item I'm plenty happy looking there instead if you can point me in the right direction. Thanks!</p>
[ { "answer_id": 205295, "author": "Grant Limberg", "author_id": 27314, "author_profile": "https://Stackoverflow.com/users/27314", "pm_score": 2, "selected": false, "text": "git init\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/205154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9401/" ]
205,158
<p>Sorry, that title just hurts. I'm wondering if there is a Linq to collections extension method that collapses the following code segment into a single line:</p> <pre><code>public IEnumerable&lt;Child&gt; GetAllChildren(IEnumerable&lt;Parent&gt; parents){ var result = new List&lt;Child&gt;(); foreach(Parent parent in parents) foreach(Child child in parent.Children) result.Add(child); return result; } </code></pre> <p>If you can collapse that into a single statement, try it on insane difficulty:</p> <pre><code>public IEnumerable&lt;Child&gt; GetAllChildren(IEnumerable&lt;Grandparent&gt; nanas){ var result = new List&lt;Child&gt;(); foreach(Grandparent papa in nanas) foreach(Parent parent in papa.Children) foreach(Child child in parent.Children) result.Add(child); return result; } </code></pre>
[ { "answer_id": 205169, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": false, "text": "public IEnumerable<Child> GetAllChildren(IEnumerable<Parent> parents)\n{\n return from parent in parents\n ...
2008/10/15
[ "https://Stackoverflow.com/questions/205158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
205,159
<p>I would like to execute <code>ls</code> in a Perl program as part of a CGI script. For this I used <code>exec(ls)</code>, but this does not return from the <code>exec</code> call.</p> <p>Is there a better way to get a listing of a directory in Perl?</p>
[ { "answer_id": 205168, "author": "holli", "author_id": 18606, "author_profile": "https://Stackoverflow.com/users/18606", "pm_score": 3, "selected": false, "text": "$listing = `ls`;\n" }, { "answer_id": 205172, "author": "Leon Timmermans", "author_id": 4727, "author_pr...
2008/10/15
[ "https://Stackoverflow.com/questions/205159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28280/" ]
205,160
<p>We are running our Junit 4 test suite against Weblogic 9 in front of an Oracle 10 database (using Hudson as a continuous integration server) and occasionally we will get an ORA-12519 crash during script teardown. However, the error is very intermittent: </p> <ul> <li>It usually happens for the same Test class </li> <li>It doesn't always happen for the same test cases (sometimes they pass) </li> <li>It doesn't happen for the same number of test cases (anywhere from 3-9) </li> <li>Sometimes it doesn't happen at all, everything passes </li> </ul> <p>While I can't guarantee this doesn't happen locally (when running against the same database, of course), I have run the same suite of class multiple times with no issues.</p> <p>Any ideas?</p>
[ { "answer_id": 9561838, "author": "edwardsmatt", "author_id": 91362, "author_profile": "https://Stackoverflow.com/users/91362", "pm_score": 5, "selected": false, "text": "SQL*Plus" }, { "answer_id": 36326337, "author": "Rahul Vishwakarma", "author_id": 5312512, "autho...
2008/10/15
[ "https://Stackoverflow.com/questions/205160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/410/" ]
205,165
<p>As you may already know, the .NET Framework's <a href="http://msdn.microsoft.com/en-us/library/ms173121.aspx" rel="noreferrer"><em>protected internal</em></a> access modifier works in a strange way: It doesn't mean the class is <em>protected</em> <strong>AND</strong> <em>internal</em>, it says the class is <em>protected</em> <strong>OR</strong> <em>internal</em>; that is, the modified class or member can be accessed from whitin the same assembly <strong>as well as</strong> from the same hierarchy.</p> <p>So, knowing this: When would you use it? Can you give an example? Is there a good, <em>illuminating</em> usage example inside .NET Base Class Library?</p>
[ { "answer_id": 205191, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 4, "selected": true, "text": "ToString()" }, { "answer_id": 9251173, "author": "stackoverflowuser", "author_id": 237121, "author_p...
2008/10/15
[ "https://Stackoverflow.com/questions/205165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18552/" ]
205,179
<p>What is a <code>DOCVARIABLE</code> in Microsoft Word 2003? How do I set it? How do I make it display in my Word document?</p>
[ { "answer_id": 205210, "author": "Chris Serra", "author_id": 13435, "author_profile": "https://Stackoverflow.com/users/13435", "pm_score": 3, "selected": false, "text": "Sub GetSetDocVars()\n\nDim fName As String\nfName = \"Jeff Smith\"\n' Set contents of variable \"fName\" in a document...
2008/10/15
[ "https://Stackoverflow.com/questions/205179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5653/" ]
205,180
<p>In a Web application, is it possible to force a PDF file to be printed on the client? If the browser is configured to open the PDF inside the window, I guess that calling window.print() will work, but some browsers (like mine) are configured to open the PDF externally.</p>
[ { "answer_id": 4655430, "author": "taeyoung", "author_id": 570957, "author_profile": "https://Stackoverflow.com/users/570957", "pm_score": 3, "selected": false, "text": "<html>\n<script language=\"javascript\">\ntimerID = setTimeout(\"exPDF.print();\", 1000);\n</script>\n<body>\n<object ...
2008/10/15
[ "https://Stackoverflow.com/questions/205180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2680/" ]
205,182
<p>Is there a way of reusing the same resultMap multiple times in a single query.</p> <p>For example, suppose I have a "foo" resultMap:</p> <pre><code>&lt;resultMap id="foo" class="Foo"&gt; &lt;result property="Bar" column="bar" /&gt; &lt;/resultMap&gt; </code></pre> <p>Is there a way to define another resultMap that reuses the above for different columns? Something like...</p> <pre><code>&lt;resultMap id="fizz"class="Fizz"&gt; &lt;result property="Foo1" column="bar=bar1" resultMapping="foo" /&gt; &lt;result property="Foo2" column="bar=bar2" resultMapping="foo" /&gt; &lt;result property="Foo3" column="bar=bar3" resultMapping="foo" /&gt; &lt;/resultMap&gt; </code></pre>
[ { "answer_id": 205257, "author": "James Rose", "author_id": 9703, "author_profile": "https://Stackoverflow.com/users/9703", "pm_score": 3, "selected": true, "text": "<result property=\"Foo1\" column=\"bar1Id\" select=\"selectFoo\"/>" }, { "answer_id": 11127823, "author": "duf...
2008/10/15
[ "https://Stackoverflow.com/questions/205182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4094/" ]
205,188
<p>There seems to be lots of different ways to register assemblies with the GAC, as in, they 'work'. However, what's the "proper" way of doing it?</p> <p>In response to Lou Franco (and gacutil):</p> <p>I'm using Gacutil for development, but it seems to me to be not the proper way to install it, since gacutil isn't included in the basic .NET utilities past .NET 1.1 - it's only a developer tool.</p> <p>Additional: Gacutil (as seen in responses below) is not redistributable, and therefore should not be used in any app that you intend to give to people who are not developers. AKA, customers. See <a href="http://blogs.msdn.com/astebner/archive/2006/11/04/why-to-not-use-gacutil-exe-in-an-application-setup.aspx" rel="noreferrer">This blog post (and comments) by Aaron Stebner</a>.</p> <p>In response to using WIX:</p> <p>WIX might be great and all, but how does it work under the hood? What details makes the way WIX installs the assembly the right way to install it? How does it look it up? Is it a system/.NET call? Is there some call in a dll buried somewhere in System32 that needs to be made? </p> <p>(Edit: it looks like WIX uses MSI under the hood. See my comments in the accepted answer.)</p> <p>Final edit: It looks like the correct way to install an assembly to the GAC is using windows installer, and nothing else. I'm going to give Wix a try. Thanks all!</p>
[ { "answer_id": 205212, "author": "Robert P", "author_id": 18097, "author_profile": "https://Stackoverflow.com/users/18097", "pm_score": 2, "selected": false, "text": "System.EnterpriseServices.Internal.Publish" }, { "answer_id": 205223, "author": "Mathieu Garstecki", "aut...
2008/10/15
[ "https://Stackoverflow.com/questions/205188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18097/" ]
205,190
<p>Clearly the following is incorrect.</p> <pre><code>INSERT INTO `aTable` (`A`,`B`) VALUES((SELECT MAX(`A`) FROM `aTable`)*2),'name'); </code></pre> <p>I get the value:</p> <p>SQL query: </p> <pre><code>INSERT INTO `aTable` (`A`, `B` ) VALUES ( ( SELECT MAX(`A`) FROM `aTable` ) *2 , 'name' ) </code></pre> <p>MySQL said:</p> <p>1093 - You can't specify target table 'aTable' for update in FROM clause </p> <p>So, I'm trying to make a bitmap table, each row corresponds to one Bit, and has a 'map' value.</p> <p>To insert in the table, I don't want to do two queries, I want to do one. How should I do this?</p> <p>No one commented on this, but since I am trying to make a bitmap, it should be * 2 not ^ 2, my mistake, please note that is why the comments often say ^ 2, it was an error in the version that the commenters read.</p>
[ { "answer_id": 205844, "author": "Leonel Martins", "author_id": 26673, "author_profile": "https://Stackoverflow.com/users/26673", "pm_score": 5, "selected": true, "text": "insert into aTable select max(a)^2, 'name' from aTable;\n" }, { "answer_id": 7960671, "author": "Hoser",...
2008/10/15
[ "https://Stackoverflow.com/questions/205190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/144/" ]
205,239
<p>Consider the following interface in Java:</p> <pre><code>public interface I { public final String KEY = "a"; } </code></pre> <p>And the following class:</p> <pre><code>public class A implements I { public String KEY = "b"; public String getKey() { return KEY; } } </code></pre> <p>Why is it possible for class A to come along and override interface I's final constant?</p> <p>Try for yourself:</p> <pre><code>A a = new A(); String s = a.getKey(); // returns "b"!!! </code></pre>
[ { "answer_id": 205249, "author": "Bill K", "author_id": 12943, "author_profile": "https://Stackoverflow.com/users/12943", "pm_score": 5, "selected": false, "text": "public class A implements I {\n public String KEY = \"b\";\n\n public String getKey() {\n String KEY = \"c\";\...
2008/10/15
[ "https://Stackoverflow.com/questions/205239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24545/" ]
205,240
<p>Is it possible with Axis2 and Eclipse to generate a Web Service client and have it use java types that you already have in packages instead of creating it's own types. Reason being of course if I have type A already created and it creates it's own Type A I can't just assign variable of type A to variable of type B.</p> <p>The wsdl is being generated from a Web Service deployed to an application server. If it's not possible to generate it from that would it be possible to generate a client from the already existing java files.</p>
[ { "answer_id": 206188, "author": "Michael Sharek", "author_id": 1958, "author_profile": "https://Stackoverflow.com/users/1958", "pm_score": 3, "selected": true, "text": "serviceClient = new RPCServiceClient();\nOptions options = serviceClient.getOptions();\n\nEndpointReference targetEPR ...
2008/10/15
[ "https://Stackoverflow.com/questions/205240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28288/" ]
205,270
<p>My MFC application using the "ESRI MapObjects LT2" ActiveX plugin throws an ASSERT at me when closing it. The error occurs in <code>cmdtarg.cpp</code>:</p> <pre><code>CCmdTarget::~CCmdTarget() { #ifndef _AFX_NO_OLE_SUPPORT if (m_xDispatch.m_vtbl != 0) ((COleDispatchImpl*)&amp;m_xDispatch)-&gt;Disconnect(); ASSERT(m_dwRef &lt;= 1); //&lt;--- Fails because m_dwRef is 3 #endif m_pModuleState = NULL; } </code></pre> <p>I built the (native C++) application with VC9. When I compile the application with VC6, it behaves nicely.</p> <p>What could be the reason for this?</p>
[ { "answer_id": 205639, "author": "Alessandro Jacopson", "author_id": 15485, "author_profile": "https://Stackoverflow.com/users/15485", "pm_score": 2, "selected": false, "text": "_ATL_DEBUG_INTERFACES" }, { "answer_id": 205890, "author": "foraidt", "author_id": 27596, ...
2008/10/15
[ "https://Stackoverflow.com/questions/205270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27596/" ]
205,271
<p>I've recently begun evaluating a few project management projects for the company I work for. It's the classic case - growing company looking for the right solution (meaning, free or really cheap). It's a combination shop - Windows, Macs, and Linux on the desktop. The tech savviness, of course, ranges from newbie to unix guru. </p> <p>I have yet to find anything really close to a total solution. I don't expect to find one, but I am looking for suggestions/guidance/any sort of feedback based on people's experience.</p> <p>What I'm looking for:</p> <ul> <li>web based</li> <li>methodology independent (not looking for an agile solution, etc.)</li> <li>free or really cheap</li> <li>document management</li> <li>timelines and milestones</li> <li>task tracking and assigning </li> <li>reporting</li> <li>source control</li> <li>development wiki</li> </ul> <p>I've looked at Trac, Projectivity, Basecamp, JIRA, RT, XPlanner, and SharedPlan. I've stayed away from Bugzilla due to previous unhappy experiences with it. None of these things really does everything - some are extendable, but I'd check here before going down that path.</p> <p>Thanks,</p>
[ { "answer_id": 1051092, "author": "Kasper", "author_id": 23499, "author_profile": "https://Stackoverflow.com/users/23499", "pm_score": 1, "selected": false, "text": "* web based\n* methodology independent \n* free or really cheap\n* document management\n* timelines and milestones\n* task...
2008/10/15
[ "https://Stackoverflow.com/questions/205271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13483/" ]
205,296
<p>I have a local svn repository in my PC, I have been using it for a hobby project and it wasn't meant to be accessible to anyone, so I commited files with passwords in them.</p> <p>Now, I'm thinking of making the repository available for other people and I don't want to have that data there.</p> <p>Is there a way to crawl the repository and replace all the passwords and account data with a text like "xxxxxxxxxx"?</p>
[ { "answer_id": 205329, "author": "Matt", "author_id": 17803, "author_profile": "https://Stackoverflow.com/users/17803", "pm_score": 3, "selected": false, "text": "svnadmin dump > mysvn\n" }, { "answer_id": 6236215, "author": "dr jerry", "author_id": 288190, "author_pr...
2008/10/15
[ "https://Stackoverflow.com/questions/205296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
205,299
<p>I tried the following code in LINQPad and got the results given below:</p> <pre><code>List&lt;string&gt; listFromSplit = new List&lt;string&gt;("a, b".Split(",".ToCharArray())).Dump(); listFromSplit.ForEach(delegate(string s) { s.Trim(); }); listFromSplit.Dump(); </code></pre> <blockquote> <p>"a" and " b"</p> </blockquote> <p>so the letter b didn't get the white-space removed as I was expecting...?</p> <p>Anyone have any ideas</p> <p>[NOTE: the .Dump() method is an extension menthod in LINQPad that prints out the contents of any object in a nice intelligently formatted way]</p>
[ { "answer_id": 205306, "author": "Sciolist", "author_id": 16045, "author_profile": "https://Stackoverflow.com/users/16045", "pm_score": 4, "selected": false, "text": "var s = \" asd \";\ns.Trim();\n" }, { "answer_id": 205339, "author": "akmad", "author_id": 1314, "...
2008/10/15
[ "https://Stackoverflow.com/questions/205299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5351/" ]
205,340
<p>I'm getting odd results from a <code>MySQL SELECT</code> query involving a <code>LEFT JOIN</code>, and I can't understand whether my understanding of <code>LEFT JOIN</code> is wrong or whether I'm seeing a genuinely odd behavior.</p> <p>I have a two tables with a many-to-one relationship: For every record in <code>table 1</code> there are 0 or more records in <code>table 2</code>. I want to select all the records in table 1 with a column that counts the number of related records in table 2. As I understand it, <code>LEFT JOIN</code> should always return all records on the <code>LEFT</code> side of the statement.</p> <p>Here's a test database that exhibits the problem:</p> <pre><code>CREATE DATABASE Test; USE Test; CREATE TABLE Dates ( dateID INT UNSIGNED NOT NULL AUTO_INCREMENT, date DATE NOT NULL, UNIQUE KEY (dateID) ) TYPE=MyISAM; CREATE TABLE Slots ( slotID INT UNSIGNED NOT NULL AUTO_INCREMENT, dateID INT UNSIGNED NOT NULL, UNIQUE KEY (slotID) ) TYPE=MyISAM; INSERT INTO Dates (date) VALUES ('2008-10-12'),('2008-10-13'),('2008-10-14'); INSERT INTO Slots (dateID) VALUES (3); </code></pre> <p>The Dates table has three records, and the Slots 1 - and that record points to the third record in Dates.</p> <p>If I do the following query..</p> <pre><code>SELECT d.date, count(s.slotID) FROM Dates AS d LEFT JOIN Slots AS s ON s.dateID=d.dateID GROUP BY s.dateID; </code></pre> <p>..I expect to see a table with 3 rows in - two with a count of 0, and one with a count of 1. But what I actually see is this:</p> <pre><code>+------------+-----------------+ | date | count(s.slotID) | +------------+-----------------+ | 2008-10-12 | 0 | | 2008-10-14 | 1 | +------------+-----------------+ </code></pre> <p>The first record with a zero count appears, but the later record with a zero count is ignored. </p> <p>Am I doing something wrong, or do I just not understand what LEFT JOIN is supposed to do?</p>
[ { "answer_id": 205372, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 4, "selected": true, "text": "GROUP BY d.dateID" }, { "answer_id": 205578, "author": "John Nilsson", "author_id": 24243, "author_pr...
2008/10/15
[ "https://Stackoverflow.com/questions/205340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28299/" ]
205,359
<p>This is similar to my previous posting. But this time I want to call a function that exists on the main mxml page.</p> <p>This is my main mxml page:</p> <p>main.mxml</p> <pre><code>&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="*"&gt; &lt;mx:Script&gt; &lt;![CDATA[ public function changeText(currentText:String):void{ switch (currentText){ case "changeText": lblOne.text = "More Text"; } } ]]&gt; &lt;/mx:Script&gt; &lt;mx:HBox x="137.5" y="10" width="100%" height="100%"&gt; &lt;ns1:menu id="buttons"&gt; &lt;/ns1:menu&gt; &lt;/mx:HBox&gt; &lt;mx:Canvas x="137" y="88" width="408.5" height="200"&gt; &lt;mx:HBox x="0" y="10" width="388.5" height="190"&gt; &lt;mx:Panel width="388" height="179" layout="absolute"&gt; &lt;mx:Label x="10" y="10" text="Some Text" visible="{buttons.showLabel}" id="lblOne"/&gt; &lt;/mx:Panel&gt; &lt;/mx:HBox&gt; &lt;/mx:Canvas&gt; &lt;/mx:Application&gt; </code></pre> <p>Here is my included page:</p> <p>menu.mxml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"&gt; &lt;mx:Script&gt; &lt;![CDATA[ [Bindable] public var showLabel:Boolean = true; ]]&gt; &lt;/mx:Script&gt; &lt;mx:MenuBar width="380" height="58"&gt;&lt;/mx:MenuBar&gt; &lt;mx:Button x="10" y="10" width="80" label="Show" id="btnOne" click="this.showLabel=true;" /&gt; &lt;mx:Button x="94" y="10" width="80" label="Hide" id="btnTwo" click="this.showLabel=false;"/&gt; &lt;mx:Button x="181" y="10" width="80" label="Run Function" id="btnThree" click="{changeText('changeText')}"/&gt; &lt;/mx:Canvas&gt; </code></pre> <p>How do I call the changeText function from the button on menu.mxml?</p>
[ { "answer_id": 205462, "author": "Brandon", "author_id": 23133, "author_profile": "https://Stackoverflow.com/users/23133", "pm_score": 3, "selected": true, "text": " <mx:Metadata>\n [Event(name=\"buttonClicked\", type=\"flash.events.Event\")]\n </mx:Metadata>\n\n <mx:Button x...
2008/10/15
[ "https://Stackoverflow.com/questions/205359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24563/" ]
205,375
<p>I have a String such as: </p> <pre><code>Cerepedia, una apliación web </code></pre> <p>I would like to transform it into something URL valid such as: </p> <pre><code>Cerepedia,unaaplicacionweb </code></pre> <p><strong>Note:</strong> the special character transformation and spaces removal. </p> <p>By the way, are commas allowed in URLs?</p>
[ { "answer_id": 205423, "author": "Dónal", "author_id": 2648, "author_profile": "https://Stackoverflow.com/users/2648", "pm_score": 2, "selected": false, "text": "public class AsciiUtils {\n\n /**\n * Contains a list of all the characters that map one to one for UNICODE.\n */\n...
2008/10/15
[ "https://Stackoverflow.com/questions/205375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
205,382
<p>I have the following C# which simply replaces parts of the input string that look like EQUIP:19d005 into URLs, like this:</p> <pre><code>input = Regex.Replace(input, @"(EQUIP:)(\S+)", @"&lt;a title=""View equipment item $2"" href=""/EquipmentDisplay.asp?eqnum=$2""&gt;$1$2&lt;/a&gt;", RegexOptions.IgnoreCase); </code></pre> <p>The HTML ends up looking like this.</p> <pre><code>&lt;a title="View equipment item 19d005" href="/EquipmentDisplay.asp?eqnum=19d005"&gt;EQUIP:19d005&lt;/a&gt; </code></pre> <p>The only trouble is that the destination page expects the eqnum querystring to be all UPPERCASE so it returns the correct equipment when eqnum=19D005 but fails if it receives eqnum=19d005.</p> <p>I guess I can modify and correct EquipmentDisplay.asp's errant requirement of uppercase values however, if possible I'd like to make the C# code comply with the existing classic ASP page by uppercasing the $2 in the Regex.Replace statement above.</p> <p>Ideally, I'd like the HTML returned to look like this:</p> <pre><code>&lt;a title="View equipment item 19d005" href="/EquipmentDisplay.asp?eqnum=19D005"&gt;EQUIP:19d005&lt;/a&gt; </code></pre> <p><em>Notice although the original string was EQUIP:19d005 (lowercase), only the eqnum= value is uppercased.</em></p> <p>Can it be done and if so, what's the tidiest way to do it?</p>
[ { "answer_id": 205413, "author": "John Fiala", "author_id": 9143, "author_profile": "https://Stackoverflow.com/users/9143", "pm_score": 0, "selected": false, "text": "input = Regex.Replace(input.ToUpper, @\"(EQUIP:)(\\S+)\", @\"<a title=\"\"View equipment item $2\"\" href=\"\"/EquipmentD...
2008/10/15
[ "https://Stackoverflow.com/questions/205382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7508/" ]
205,386
<p>What are those bad habits you've developed since you've started coding in Cocoa?</p> <p>I think making a list of bad habits and actively adding to it and, more importantly, breaking those habits is a good technique to produce your code quality. So start now, get your bad habits off your chest. Maybe other people share your bad habits. </p>
[ { "answer_id": 205618, "author": "Jablair", "author_id": 24168, "author_profile": "https://Stackoverflow.com/users/24168", "pm_score": 3, "selected": false, "text": "self.displayName = name\n" }, { "answer_id": 206002, "author": "lfalin", "author_id": 28106, "author_p...
2008/10/15
[ "https://Stackoverflow.com/questions/205386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23113/" ]
205,393
<p>Is it possible to reload a page that was loaded thru link_to_remote? I'm doing this in my controller: <br></p> <pre><code>def create if captchas_verified do_something else render :action=&gt;'new' end </code></pre> <p>But when the captchas is wrong, it do not render a form that is inside of the new template. By the way, in the webserver log, it shows that the templades was rendered.</p> <p>Thanks!</p> <p>UPDATED: Today i changed the render to:</p> <pre><code>render(:update) { |page| page.call 'location.reload' } </code></pre> <p>But it makes me update the page that called the link_to_remote not the page that was opened thru the link_to_remote</p> <p>UPDATED 2: I fixed using page.replace_html "mydiv", :partial => "new" instead of page.call 'location.reload'</p>
[ { "answer_id": 206115, "author": "jdl", "author_id": 9465, "author_profile": "https://Stackoverflow.com/users/9465", "pm_score": 1, "selected": false, "text": "render :update do |page| page << 'window.location.reload()' end\n" }, { "answer_id": 206144, "author": "salt.racer",...
2008/10/15
[ "https://Stackoverflow.com/questions/205393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18642/" ]
205,411
<p>How would you go about creating a random alpha-numeric string that matches a certain regular expression?</p> <p>This is specifically for creating initial passwords that fulfill regular password requirements.</p>
[ { "answer_id": 648840, "author": "Chas. Owens", "author_id": 78259, "author_profile": "https://Stackoverflow.com/users/78259", "pm_score": 4, "selected": false, "text": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nuse String::Random qw/random_regex/;\n\nprint random_regex('[A-Za-z]{...
2008/10/15
[ "https://Stackoverflow.com/questions/205411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1550/" ]
205,431
<p>I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an <code>EXEC_BAD_ACCESS</code> - <code>KERN_INVALID_ADDRESS</code>. I thought this might be related to the <a href="https://stackoverflow.com/questions/158914/cropping-a-uiimage">cropping question</a> I asked a few weeks back, but I believe I'm setting up the clipping path correctly.</p> <p>Here's the code I'm using - when it doesn't crash, the result looks fine and anybody looking to get a similar look is free to borrow the code.</p> <pre><code>- (UIImage *)borderedImageWithRect: (CGRect)dstRect radius:(CGFloat)radius { UIImage *maskedImage = nil; radius = MIN(radius, .5 * MIN(CGRectGetWidth(dstRect), CGRectGetHeight(dstRect))); CGRect interiorRect = CGRectInset(dstRect, radius, radius); UIGraphicsBeginImageContext(dstRect.size); CGContextRef maskedContextRef = UIGraphicsGetCurrentContext(); CGContextSaveGState(maskedContextRef); CGMutablePathRef borderPath = CGPathCreateMutable(); CGPathAddArc(borderPath, NULL, CGRectGetMinX(interiorRect), CGRectGetMinY(interiorRect), radius, PNDegreeToRadian(180), PNDegreeToRadian(270), NO); CGPathAddArc(borderPath, NULL, CGRectGetMaxX(interiorRect), CGRectGetMinY(interiorRect), radius, PNDegreeToRadian(270.0), PNDegreeToRadian(360.0), NO); CGPathAddArc(borderPath, NULL, CGRectGetMaxX(interiorRect), CGRectGetMaxY(interiorRect), radius, PNDegreeToRadian(0.0), PNDegreeToRadian(90.0), NO); CGPathAddArc(borderPath, NULL, CGRectGetMinX(interiorRect), CGRectGetMaxY(interiorRect), radius, PNDegreeToRadian(90.0), PNDegreeToRadian(180.0), NO); CGContextBeginPath(maskedContextRef); CGContextAddPath(maskedContextRef, borderPath); CGContextClosePath(maskedContextRef); CGContextClip(maskedContextRef); [self drawInRect: dstRect]; maskedImage = UIGraphicsGetImageFromCurrentImageContext(); CGContextRestoreGState(maskedContextRef); UIGraphicsEndImageContext(); return maskedImage; } </code></pre> <p>and here's the crash log. It looks the same whenever I get one of these crashes</p> <pre> Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x6e2e6181 Crashed Thread: 0 Thread 0 Crashed: 0 com.apple.CoreGraphics 0x30fe56d8 CGGStateGetRenderingIntent + 4 1 libRIP.A.dylib 0x33c4a7d8 ripc_RenderImage + 104 2 libRIP.A.dylib 0x33c51868 ripc_DrawImage + 3860 3 com.apple.CoreGraphics 0x30fecad4 CGContextDelegateDrawImage + 80 4 com.apple.CoreGraphics 0x30feca40 CGContextDrawImage + 368 5 UIKit 0x30a6a708 -[UIImage drawInRect:blendMode:alpha:] + 1460 6 UIKit 0x30a66904 -[UIImage drawInRect:] + 72 7 MyApp 0x0003f8a8 -[UIImage(PNAdditions) borderedImageWithRect:radius:] (UIImage+PNAdditions.m:187) </pre>
[ { "answer_id": 206005, "author": "benzado", "author_id": 10947, "author_profile": "https://Stackoverflow.com/users/10947", "pm_score": 1, "selected": false, "text": "CGPathRelease(borderPath)" }, { "answer_id": 510228, "author": "PCheese", "author_id": 61274, "author_...
2008/10/15
[ "https://Stackoverflow.com/questions/205431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24168/" ]
205,435
<p>I keep getting an NHibernate.PersistentObjectException when calling session.Save() which is due to an uninitialized proxy passed to save(). If I fiddle with my cascade settings I can make it go away, but then child objects aren't being saved.</p> <p>The only other fix I have found is by adding the following to my DefaultSaveEventListener.</p> <pre><code> protected override bool ReassociateIfUninitializedProxy(object obj, global::NHibernate.Engine.ISessionImplementor source) { if (!NHibernateUtil.IsInitialized(obj)) NHibernateUtil.Initialize(obj); return base.ReassociateIfUninitializedProxy(obj, source); } </code></pre> <p>This is obviously not an ideal solution.</p> <p>Any ideas?</p>
[ { "answer_id": 2936444, "author": "mathieu", "author_id": 971, "author_profile": "https://Stackoverflow.com/users/971", "pm_score": 2, "selected": false, "text": "use ISession.Get()" }, { "answer_id": 3309406, "author": "Rabid", "author_id": 123883, "author_profile": ...
2008/10/15
[ "https://Stackoverflow.com/questions/205435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4590/" ]
205,440
<p>I like to know if there is a way to read the user input inside a batch file, because i have a file named: "fif.bat" that recives two parameters (just call them <strong><em>paramA</em></strong> and <strong><em>paramB</em></strong>) so i execute the file like this:</p> <pre><code>fif paramA paramB </code></pre> <p>I have to change paramA every month, but i call this file lot of times so i like to open a console and have printed this:</p> <pre><code>fif paramA </code></pre> <p>So i only have to write paramB and change paramA when i want it.</p> <p>PD: paramA is very large so it's very helpful if i can have it there instead of writing every time. And i don't want to make another batch file to call fif whit paramA.</p>
[ { "answer_id": 205461, "author": "David Webb", "author_id": 3171, "author_profile": "https://Stackoverflow.com/users/3171", "pm_score": 0, "selected": false, "text": "SET /P" }, { "answer_id": 205471, "author": "Jeremy", "author_id": 9266, "author_profile": "https://S...
2008/10/15
[ "https://Stackoverflow.com/questions/205440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20601/" ]
205,444
<p>We are implementing an IP based geolocation service, and we need to find some IP's from various markets (LA, NY etc) to fully test the service.</p> <p>Does anybody know of a directory where we could find what IP ranges are used where?</p> <p>EDIT: We have already implemented the system, it uses a 3rd party DB and a webservice. We just want some IP's from known markets to verify its working properly.</p> <p>I'm going to see if I can get what I need from the free maxmind database.</p>
[ { "answer_id": 10543947, "author": "Jay Prall", "author_id": 56083, "author_profile": "https://Stackoverflow.com/users/56083", "pm_score": 0, "selected": false, "text": "ExitNodes server1, server2, server3\nStrictExitNodes 1\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/205444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
205,447
<p>I've got a model in CakePHP that doesn't have a table, called Upload. I've got a validation in this Model for a field called source_id.</p> <p>I've got a form that builds a nice looking $this-data, giving me a well formated set, including:</p> <pre><code>$this-&gt;data['Upload']['source_id'] </code></pre> <p>However, the validation rule I have set doesn't seem to run at all. I copied this validation rule from another model where it does work, so I'm confident that it works:</p> <pre><code>var $validate = array( 'source_id' =&gt; array( rule' =&gt; 'numeric', 'required' =&gt; true, 'allowEmpty' =&gt; false, 'message' =&gt; 'Error!.' ) ); </code></pre> <p>Can you not validate fields for a model that lacks a database table?</p> <p>The form uses the Upload model, and submits to another controller action method.</p> <p>CakePHP 1.2, PHP/MySQL 5, XAMPP.</p>
[ { "answer_id": 205459, "author": "Justin", "author_id": 43, "author_profile": "https://Stackoverflow.com/users/43", "pm_score": 4, "selected": true, "text": "$this->Upload->set($this->data);\n$this->Upload->validates();\n" }, { "answer_id": 298222, "author": "Chris Hawes", ...
2008/10/15
[ "https://Stackoverflow.com/questions/205447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43/" ]
205,458
<p>For years, I've been using named blocks to limit the scope of temporary variables. I've never seen this done anywhere else, which makes me wonder if this is a bad idea. Especially since the Eclipse IDE flags these as warnings by default.</p> <p>I've used this to good effect, I think, in my own code. But since it is un-idiomatic to the point where good programmers will distrust it when they see it, I really have two ways to go from here: </p> <ol> <li>avoid doing it, or </li> <li>promote it, with the hope that it will become an idiom.</li> </ol> <p>Example (within a larger method):</p> <pre><code>final Date nextTuesday; initNextTuesday: { GregorianCalendar cal = new GregorianCalendar(); ... // About 5-10 lines of setting the calendar fields nextTuesday = cal.getTime(); } </code></pre> <p>Here I'm using a GregorianCalendar just to initialize a date, and I want to make sure that I don't accidentally reuse it.</p> <p>Some people have commented that you don't actually need to name the block. While that's true, a raw block looks even more like a bug, as the intent is unclear. Furthermore, naming something encourages you to think about the intention of the block. The goal here is to identify distinct sections of code, not to give every temporary variable its own scope.</p> <p>Many people have commented that it's best to go straight to small methods. I agree that this should be your first instinct. However, there may be several mitigating factors:</p> <ul> <li>To even consider a named block, the code should be short, one-off code that will never be called elsewhere.</li> <li>A named block is a quick way to organize an oversized method without creating a one-off method with a dozen parameters. This is especially true when a class is in flux, and the inputs are likely to change from version to version.</li> <li>Creating a new method encourages its reuse, which may be ill-advised if the use cases aren't well-established. A named block is easier (psychologically, at least) to throw away.</li> <li>Especially for unit tests, you may need to define a dozen different objects for one-off assertions, and they are just different enough that you can't (yet) find a way to consolidate them into a small number of methods, nor can you think of a way to distinguish them with names that aren't a mile long.</li> </ul> <p>Advantages of using the named scope:</p> <ol> <li>Can't accidentally reuse temporary variables</li> <li>Limited scope gives garbage collector and JIT compiler more information about programmer intent</li> <li>Block name provides a comment on a block of code, which I find more readable than open-ended comments</li> <li>Makes it easier to refactor code out of a big method into little methods, or vice versa, since the named block is easier to separate than unstructured code.</li> </ol> <p>Disadvantages:</p> <p>Not idiomatic: programmers who haven't seen this use of named blocks (i.e. everyone but me) assume it's buggy, since they can't find references to the block name. (Just like Eclipse does.) And getting something to become idiomatic is an uphill battle.</p> <p>It can be used as an excuse for bad programming habits, such as:</p> <ul> <li>Making huge, monolithic methods where several small methods would be more legible.</li> <li>Layers of indentation too deep to read easily.</li> </ul> <p>Note: I've edited this question extensively, based on some thoughtful responses. Thanks!</p>
[ { "answer_id": 205548, "author": "John Nilsson", "author_id": 24243, "author_profile": "https://Stackoverflow.com/users/24243", "pm_score": 3, "selected": false, "text": "final String example;\n{\n final StringBuilder sb = new StringBuilder();\n for(int i = 0; i < 100; i++)\n sb....
2008/10/15
[ "https://Stackoverflow.com/questions/205458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18078/" ]
205,468
<p>Hey everyone, I am researching a project where we would need to keep a value encrypted from the client all the way to a black box system without decrypting it at any point in between. We are using SSL between the browser and web server, but the values are automatically decrypted at the web server, which is what we need to keep from happening. We need to be able to pass it through the web server (still encrypted) and through other back end systems until it hits its final destination where it would be decrypted. </p> <p>So my question is what options are available to us for maintaining an encrypted state for a value from the browser back, without decrypting it anywhere along the way?</p> <p>Thanks Mark</p>
[ { "answer_id": 205484, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 2, "selected": false, "text": " client browser web server random server blackbox\nroute ---- SSL -------------><------------- not encr...
2008/10/15
[ "https://Stackoverflow.com/questions/205468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15815/" ]
205,521
<p>I'm trying to write a regex to replace all spaces that are not included in quotes so something like this:</p> <pre><code>a = 4, b = 2, c = "space here" </code></pre> <p>would return this:</p> <pre><code>a=4,b=2,c="space here" </code></pre> <p>I spent some time searching this site and I found a similar q/a ( <a href="https://stackoverflow.com/questions/79968/split-a-string-by-spaces-in-python#80449">Split a string by spaces -- preserving quoted substrings -- in Python</a> ) that would replace all the spaces inside quotes with a token that could be re-substituted in after wiping all the other spaces...but I was hoping there was a cleaner way of doing it.</p>
[ { "answer_id": 205581, "author": "Rômulo Ceccon", "author_id": 23193, "author_profile": "https://Stackoverflow.com/users/23193", "pm_score": 2, "selected": false, "text": "mystring.scan(/((\".*?\")|([^ ]))/).map { |x| x[0] }.join\n" }, { "answer_id": 205862, "author": "Borgar...
2008/10/15
[ "https://Stackoverflow.com/questions/205521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
205,522
<p>I have image data and i want to get a sub image of that to use as an opengl texture. </p> <pre><code>glGenTextures(1, &amp;m_name); glGetIntegerv(GL_TEXTURE_BINDING_2D, &amp;oldName); glBindTexture(GL_TEXTURE_2D, m_name); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_data); </code></pre> <p>How can i get a sub image of that image loaded as a texture. I think it has something to do with using glTexSubImage2D, but i have no clue how to use it to create a new texture that i can load. Calling: </p> <pre><code>glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, xWidth, yHeight, GL_RGBA, GL_UNSIGNED_BYTE, m_data); </code></pre> <p>does nothing that i can see, and calling glCopyTexSubImage2D just takes part of my framebuffer. Thanks</p>
[ { "answer_id": 205569, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "GL_UNPACK_ROW_LENGTH" }, { "answer_id": 48332955, "author": "vedranm", "author_id": 1111634, "author_profil...
2008/10/15
[ "https://Stackoverflow.com/questions/205522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25893/" ]
205,526
<p>I'm working on an application for work that is going to query our employee database. The end users want the ability to search based on the standard name/department criteria, but they also want the flexibility to query for all people with the first name of "James" that works in the Health Department. The one thing I want to avoid is to simply have the stored procedure take a list of parameters and generate a SQL statement to execute, since that would open doors to SQL injection at an internal level.</p> <p>Can this be done?</p>
[ { "answer_id": 205537, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": -1, "selected": false, "text": "SELECT EmpId, NameLast, NameMiddle, NameFirst, DepartmentName\n FROM dbo.Employee\n INNER JOIN dbo.Department ON dbo.Em...
2008/10/15
[ "https://Stackoverflow.com/questions/205526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71/" ]
205,529
<p>Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function?</p> <p>Example:</p> <pre><code>void format_string(char *fmt, ...); void debug_print(int dbg_lvl, char *fmt, ...) { format_string(fmt, /* how do I pass all the arguments from '...'? */); fprintf(stdout, fmt); } </code></pre>
[ { "answer_id": 205584, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 9, "selected": true, "text": "va_list" }, { "answer_id": 205589, "author": "Community", "author_id": -1, "author_profile": "https://Sta...
2008/10/15
[ "https://Stackoverflow.com/questions/205529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4381/" ]
205,546
<p>Visual Studio makes calling a web service easy, trying to figure out what is going on under the covers is difficult.</p> <p>How can I see the actual XML generated from my .Net app when making a call to a web service?</p>
[ { "answer_id": 205572, "author": "DOK", "author_id": 27637, "author_profile": "https://Stackoverflow.com/users/27637", "pm_score": 1, "selected": false, "text": "myDataSet.WriteXml(filename);\n" }, { "answer_id": 205828, "author": "quickcel", "author_id": 9129, "autho...
2008/10/15
[ "https://Stackoverflow.com/questions/205546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25121/" ]
205,555
<p>During my work with databases I noticed that I write query strings and in this strings I have to put several restrictions in the where-clause from a list/array/collection. Should look like this:</p> <pre><code>select * from customer where customer.id in (34, 26, ..., 2); </code></pre> <p>You can simplify this by reducing this to the question that you have collection of strings and want to create a comma-separated list of this strings in just one string.</p> <p>My approach I have used so far is something like that:</p> <pre><code>String result = ""; boolean first = true; for(String string : collectionOfStrings) { if(first) { result+=string; first=false; } else { result+=","+string; } } </code></pre> <p>But this is as you can see very ugly. You cannot see what happens there on the first look, especially when the constructed strings (like every SQL query) is getting complicated.</p> <p>What is your (more) elegant way?</p>
[ { "answer_id": 205596, "author": "Dónal", "author_id": 2648, "author_profile": "https://Stackoverflow.com/users/2648", "pm_score": 1, "selected": false, "text": "public static final String toSqlList(Collection<?> values) {\n\n String collectionString = values.toString();\n\n // Con...
2008/10/15
[ "https://Stackoverflow.com/questions/205555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1038/" ]
205,557
<p>If you develop for ATG Dynamo, how do you structure your modules and dependencies?</p> <p>How do you structure the projects? source directories, JARs configs etc.</p> <p>How do you build and deploy? What tools do you use?</p>
[ { "answer_id": 271071, "author": "talanb", "author_id": 20103, "author_profile": "https://Stackoverflow.com/users/20103", "pm_score": 3, "selected": false, "text": "root\n deploy\n class (compile java to here)\n config (primary configpath)\n docroot (JHTML docroot)\n dev (co...
2008/10/15
[ "https://Stackoverflow.com/questions/205557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15452/" ]
205,568
<p>There's a lot of advice out there that you shouldn't expose your fields publically, and instead use trivial properties. I see it over &amp; over.</p> <p>I understand the arguments, but <a href="https://stackoverflow.com/questions/174198/c35-automatic-properties-why-not-access-the-field-directly#205567">I don't think it's good advice in most cases</a>.</p> <p>Does anyone have an example of a time when it really mattered? When writing a trivial property made something important possible in the future (or when failing to use one got them in to real trouble)?</p> <p>EDIT: The DataBinding argument is correct, but not very interesting. It's a bug in the DataBinding code that it won't accept public fields. So, we have to write properties to work around that bug, not because properties are a wise class design choice.</p> <p>EDIT: To be clear, I'm looking for real-world examples, not theory. A time when it really mattered.</p> <p>EDIT: The ability to set a breakpoint on the setter seems valuable. Designing my code for the debugger is unfortunate: I'd rather the debugger get smarter, but given the debugger we have, I'll take this ability. Good stuff.</p>
[ { "answer_id": 207146, "author": "Robert Paulson", "author_id": 14033, "author_profile": "https://Stackoverflow.com/users/14033", "pm_score": 6, "selected": true, "text": "get" }, { "answer_id": 13385502, "author": "supercat", "author_id": 363751, "author_profile": "h...
2008/10/15
[ "https://Stackoverflow.com/questions/205568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5314/" ]
205,573
<p>I want to do something like this:</p> <pre><code>List&lt;Animal&gt; animals = new ArrayList&lt;Animal&gt;(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c() ); </code></pre> <p>So, I want to look at all of the classes in my application's universe, and when I find one that descends from Animal, I want to create a new object of that type and add it to the list. This allows me to add functionality without having to update a list of things. I can avoid the following:</p> <pre><code>List&lt;Animal&gt; animals = new ArrayList&lt;Animal&gt;(); animals.add( new Dog() ); animals.add( new Cat() ); animals.add( new Donkey() ); ... </code></pre> <p>With the above approach, I can simply create a new class that extends Animal and it'll get picked up automatically.</p> <p>UPDATE: 10/16/2008 9:00 a.m. Pacific Standard Time:</p> <p>This question has generated a lot of great responses -- thank you. <s>From the responses and my research, I've found that what I really want to do is just not possible under Java. There are approaches, such as ddimitrov's ServiceLoader mechanism that can work -- but they are very heavy for what I want, and I believe I simply move the problem from Java code to an external configuration file.</s> <strong>Update 5/10/19</strong> (11 years later!) There are now several libraries that can help with this according to @IvanNik's <a href="https://stackoverflow.com/a/9240969/9648">answer</a> <a href="https://github.com/ronmamo/reflections" rel="noreferrer">org.reflections</a> looks good. Also <a href="https://github.com/classgraph/classgraph" rel="noreferrer">ClassGraph</a> from @Luke Hutchison's <a href="https://stackoverflow.com/a/51625104/9648">answer</a> looks interesting. There are several more possibilities in the answers as well.</p> <p>Another way to state what I want: a static function in my Animal class finds and instantiates all classes that inherit from Animal -- without any further configuration/coding. If I have to configure, I might as well just instantiate them in the Animal class anyway. I understand that because a Java program is just a loose federation of .class files that that's just the way it is.</p> <p>Interestingly, it seems this is <a href="http://my.safaribooksonline.com/0596003390/csharpckbk-CHP-12-SECT-8" rel="noreferrer">fairly trivial</a> in C#.</p>
[ { "answer_id": 205903, "author": "jonathan-stafford", "author_id": 27587, "author_profile": "https://Stackoverflow.com/users/27587", "pm_score": 3, "selected": false, "text": "for (String classpathEntry : System.getProperty(\"java.class.path\").split(System.getProperty(\"path.separator\"...
2008/10/15
[ "https://Stackoverflow.com/questions/205573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9648/" ]
205,582
<p>The new ASP.NET routing is great for simple path style URL's but if you want to use a url such as:</p> <p><a href="http://example.com/items/search.xhtml?term=Text+to+find&amp;page=2" rel="nofollow noreferrer">http://example.com/items/search.xhtml?term=Text+to+find&amp;page=2</a></p> <p>Do you have to use a catch all parameter with a validation?</p>
[ { "answer_id": 207748, "author": "Richard Szalay", "author_id": 3603, "author_profile": "https://Stackoverflow.com/users/3603", "pm_score": 3, "selected": true, "text": "Search(string term, int page)\n" }, { "answer_id": 7725561, "author": "George Filippakos", "author_id"...
2008/10/15
[ "https://Stackoverflow.com/questions/205582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16340/" ]
205,583
<p>I need to reproduce a bug, and a guy from the other team has sent me a .mdf and .ldf files from his sql server 2005 instance. When I attach the database, all I get is empty tables, even though file is 2 mb large. The db contains 2 tables that have, among other thing, a varbinary(max) field. At the same time another database, which has no varbinaries in tables, is attached ok and data are in place. What could be possible reason why data became inaccessible?</p>
[ { "answer_id": 207748, "author": "Richard Szalay", "author_id": 3603, "author_profile": "https://Stackoverflow.com/users/3603", "pm_score": 3, "selected": true, "text": "Search(string term, int page)\n" }, { "answer_id": 7725561, "author": "George Filippakos", "author_id"...
2008/10/15
[ "https://Stackoverflow.com/questions/205583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17481/" ]
205,614
<p>My initial installation for the <strong>MySQL</strong> had no password for root. I assigned a password for root and everything worked fine. Due to some reason (don't ask why) I had to revert back to the original settings where root didn't have any password.</p> <p>I changed the root password to <code>'' (empty string)</code>. The problem now is that MySQL doesn't run with <code>'mysql -uroot'</code>, it expects a password. On running <code>'mysql -uroot -p'</code> and hitting enter on the password prompt gets me into the db, but is not same as the default setting.</p> <p>Is there any other flag/setting that I am missing to set/unset which tells mysql to not expect a password?</p> <p>Thanks</p>
[ { "answer_id": 205661, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": false, "text": "[client]\nhost=localhost\nuser = root\npassword = mypassword\ndatabase = mydatabase\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/205614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13492/" ]
205,631
<p>i got a client side javascript function which is triggered on a button click (basically, its a calculator!!). Sometimes, due to enormous data on the page, the javascript calculator function take to long &amp; makes the page appear inactive to the user. I was planning to display a transparent div over entire page, maybe with a busy indicator (in the center) till the calculator function ends, so that user waits till process ends. </p> <pre> function CalculateAmountOnClick() { // Display transparent div // MY time consuming loop! { } // Remove transparent div } </pre> <p>Any ideas on how to go about this? Should i assign a css class to a div (which surrounds my entire page's content) using javascript when my calculator function starts? I tried that but didnt get desired results. Was facing issues with transparency in IE 6. Also how will i show a loading message + image in such a transparent div?</p> <p>TIA</p>
[ { "answer_id": 205648, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 2, "selected": false, "text": "display:inline" }, { "answer_id": 205707, "author": "Joel Anair", "author_id": 7441, "author_profil...
2008/10/15
[ "https://Stackoverflow.com/questions/205631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28321/" ]
205,644
<p>I came across an issue that makes me think there is bug in the 3.0 framework. When I try to use extension methods I get the following error: </p> <pre><code>Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor' </code></pre> <p>When using this simple code:</p> <pre><code>public static class StringUtils { static void TestExtension(this String targetString) { } } </code></pre> <p>The only way to make this compile error go away is to add the following code:</p> <pre><code>namespace System.Runtime.CompilerServices { public class ExtensionAttribute : Attribute { } } </code></pre> <p>It's been a few months since I have used extensions methods, but I'm pretty sure I didn't have to do this. Has anyone else come across this issue?</p>
[ { "answer_id": 577527, "author": "lexx", "author_id": 67014, "author_profile": "https://Stackoverflow.com/users/67014", "pm_score": 1, "selected": false, "text": "<assemblies>\n <add assembly=\"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089\"/>\n</assemb...
2008/10/15
[ "https://Stackoverflow.com/questions/205644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17902/" ]