qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
196,390
<p>I heard somewhere that you can drop down to C++ directly inside C# code. How is this done? Or did I hear wrong?</p> <p>Note: I do not mean C++ / CLI.</p>
[ { "answer_id": 196397, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 4, "selected": true, "text": "unsafe" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
196,407
<p>From within a DLL that's being called by a C#.NET web app, how do you find the base url of the web app?</p>
[ { "answer_id": 196464, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 5, "selected": true, "text": "HttpContext.Current.Request.Url\n" }, { "answer_id": 196473, "author": "Guy", "author_id": 1463, ...
2008/10/13
[ "https://Stackoverflow.com/questions/196407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
196,415
<p>For a current project I am working I need to return an aggregate report based on date ranges. </p> <p>I have 3 types of reports, yearly, monthly and daily.</p> <p>To assist in returning this report I need a function that will return all of the sub-ranges of datetimes, within a big range.</p> <p>So for example if I as for all the daily ranges between '2006-01-01 11:10:00' and '2006-01-05 08:00:00' I would expect the following results.</p> <pre><code>select * from dbo.fnGetDateRanges('d', '2006-01-01 11:10:00', '2006-01-05 08:00:00') 2006-01-01 11:10:00.000, 2006-01-02 00:00:00.000 2006-01-02 00:00:00.000, 2006-01-03 00:00:00.000 2006-01-03 00:00:00.000, 2006-01-04 00:00:00.000 2006-01-04 00:00:00.000, 2006-01-05 00:00:00.000 2006-01-05 00:00:00.000, 2006-01-05 08:00:00.000 </code></pre> <p>For the yearly range of '2006-01-01 11:10:00' to '2009-05-05 08:00:00', I would expect.</p> <pre><code>select * from dbo.fnGetDateRanges('y', '2006-01-01 11:10:00', '2009-05-05 08:00:00') 2006-01-01 11:10:00.000, 2007-01-01 00:00:00.000 2007-01-01 00:00:00.000, 2008-01-01 00:00:00.000 2008-01-01 00:00:00.000, 2009-01-01 00:00:00.000 2009-01-01 00:00:00.000, 2009-05-05 08:00:00.000 </code></pre> <p>How would I implement this function? </p>
[ { "answer_id": 196416, "author": "Sam Saffron", "author_id": 17174, "author_profile": "https://Stackoverflow.com/users/17174", "pm_score": 3, "selected": true, "text": "create function dbo.fnGetDateRanges\n(\n @type char(1),\n @start datetime,\n @finish datetime\n)\nreturns @ran...
2008/10/13
[ "https://Stackoverflow.com/questions/196415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
196,418
<p>I know of many utilities that can tell me the bitrate of an MP3 file, but I've never seen one that can tell me whether or not the MP3 file is VBR (variable bit rate - the bit rate fluctuates within the file) or a CBR (constant bit rate - the bit rate stays the same within the file). My guess is that most programs aren't interested in finding this out since it involves analyzing the file somewhat to see if the bitrate changes, which takes away from speed.</p> <p>So, in lieu of finding a utility, I'd like to write one - so how could I programmatically determine whether or not an MP3 file is VBR or CBR? I have about 15,000 files to go through to find this out for, so I need to automate the process.</p>
[ { "answer_id": 196447, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 2, "selected": false, "text": "...\nboolVBitRate = LoadVBRHeader(bytVBitRate);\n...\n" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
196,424
<p>Should I be using this method of throwing errors:</p> <pre><code>if (isset($this-&gt;dbfields[$var])) { return $this-&gt;dbfields[$var]; } else { throw new FieldNotFoundException($var); } </code></pre> <p>or this style:</p> <pre><code>try { return $this-&gt;dbfields[$var]; } catch (Exception $e) { throw new FieldNotFoundException($var); } </code></pre> <p>...or something else altogether?</p> <p><em>quick explanation of the code:</em> <code>$this-&gt;dbfields</code> is an array. <code>isset()</code> checks if a variable is set, in this case, whether the array element exists.</p>
[ { "answer_id": 196428, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 4, "selected": true, "text": "try" }, { "answer_id": 196431, "author": "yfeldblum", "author_id": 12349, "author_profile": "https:/...
2008/10/13
[ "https://Stackoverflow.com/questions/196424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
196,465
<p>The <a href="http://en.wikipedia.org/wiki/Effect_system" rel="noreferrer">Wikipedia article on <em>Effect system</em></a> is currently just a short stub and I've been wondering for a while as to what is an effect system. </p> <ul> <li>Are there any languages that have an effect system in addition to a type system? </li> <li>What would a possible (hypothetical) notation in a <strong>mainstream</strong> language, that you're familiar, with look like with effects? </li> </ul>
[ { "answer_id": 196748, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 5, "selected": true, "text": "close" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1659/" ]
196,468
<p>I am using the Maven (2) Cobertura plug-in to create reports on code coverage, and I have the following stub I am using in a method:</p> <pre><code>try { System.exit(0); } catch (final SecurityException exception) { exception.printStackTrace(); } System.err.println("The program never exited!"); </code></pre> <p>I know that I need to log the exception, etc, but that's not the point right now...Cobertura is refusing to acknowledge that the line after the stack trace is printed is covered. That is, the line with the '}' before the <code>System.err.println</code> statement is not being shown as covered. Before, the ending curly brace of the method was not being shown as covered, hence the <code>System.err</code> statement. Any idea how I can convince cobertura's maven plugin that, since the <code>System.err.println</code> statement is covered, that ending brace has to have been covered?</p> <p>Oh yeah, and I use a mock security manager to throw the security exception, since that's the easiest way I have found of making the test continue executing after the <code>System.exit</code> call.</p>
[ { "answer_id": 16798306, "author": "Bruno D. Rodrigues", "author_id": 661475, "author_profile": "https://Stackoverflow.com/users/661475", "pm_score": 0, "selected": false, "text": "try {\n System.exit(0);\n} catch (final SecurityException exception) {\n exception.printStackTrace();...
2008/10/13
[ "https://Stackoverflow.com/questions/196468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8026/" ]
196,480
<p>I have a table with two fields of interest for this particular exercise: a CHAR(3) ID and a DATETIME. The ID identifies the submitter of the data - several thousand rows. The DATETIME is not necessarily unique, either. (The primary keys are other fields of the table.)</p> <p>Data for this table is submitted every six months. In December, we receive July-December data from each submitter, and in June we receive July-June data. My task is to write a script that identifies people who have only submitted half their data, or only submitted January-June data in June.</p> <p>...Does anyone have a solution?</p>
[ { "answer_id": 196499, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "select * from (\n select T.submitterId,\n (select count(*) \n from TABLE T1\n where T1.datefi...
2008/10/13
[ "https://Stackoverflow.com/questions/196480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27290/" ]
196,488
<p>Hey all I'm hoping someone has enough experience with Cake PHP to make this work. </p> <p>I'm working on something that at the moment could affectionately be called a twitter clone. Essentially I have a set up like this. </p> <p>Users have many friends. This is a many to many relationship to the user table. It is stored in a link tabled called friends_users with columns user_id, friend_id. Users is a table with column user_id. </p> <p>Then I have a table called tips which associates to a user. A user can have many tips. </p> <p>I want to figure out a way to do a find on the Tip model that returns all tips owned by the userid i pass in as well as any tips owned by any friends of that user. </p> <p>This SQL query works perfectly - </p> <pre><code>SELECT * FROM `tips` JOIN users ON users.id = tips.user_id JOIN friends_users ON tips.user_id = friends_users.friend_id WHERE (friends_users.user_id =2 or tips.user_id=2) LIMIT 0 , 30 </code></pre> <p>That returns user#2s Tips as well as the tips of anyone who is a friend of User 2. </p> <p>Now how can I do the same thing using <code>$this-&gt;Tip-&gt;findxxxxx(user_id)</code></p> <p>I know I can use <code>Tip-&gt;query</code> if need be but I'm trying to learn the hard way. </p>
[ { "answer_id": 197040, "author": "neilcrookes", "author_id": 9968, "author_profile": "https://Stackoverflow.com/users/9968", "pm_score": 3, "selected": true, "text": "function findTipsByUserAndFriends($userId) {\n //FriendsUser is automagically created by CakePHP \"with\" association\n ...
2008/10/13
[ "https://Stackoverflow.com/questions/196488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7018/" ]
196,498
<p>I have a text file in the root of my web app <em><a href="http://localhost/foo.txt" rel="noreferrer">http://localhost/foo.txt</a></em> and I'd like to load it into a variable in javascript.. in groovy I would do this:</p> <pre><code>def fileContents = 'http://localhost/foo.txt'.toURL().text; println fileContents; </code></pre> <p>How can I get a similar result in javascript?</p>
[ { "answer_id": 196510, "author": "Edward Z. Yang", "author_id": 23845, "author_profile": "https://Stackoverflow.com/users/23845", "pm_score": 8, "selected": true, "text": "var client = new XMLHttpRequest();\nclient.open('GET', '/foo.txt');\nclient.onreadystatechange = function() {\n ale...
2008/10/13
[ "https://Stackoverflow.com/questions/196498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2031/" ]
196,500
<p>I have a WordPress installation with an <code>.htaccess</code> file that looks like this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre> <p>I tried installing a fresh copy of WordPress into a subdirectory for a separate blog and am getting 404 errors within the root WordPress when I try to view it. I'm assuming this is because of the <code>.htaccess</code> file. </p> <p>How do I change it so that I can view the subfolder?</p>
[ { "answer_id": 196553, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 2, "selected": false, "text": "# BEGIN WordPress\n<IfModule mod_rewrite.c>\n RewriteEngine On\n RewriteBase /\n RewriteCond %{REQUEST_URI} !^/blog2/.*\n R...
2008/10/13
[ "https://Stackoverflow.com/questions/196500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12765/" ]
196,505
<p>Is there a way to use <strong>THE LOOP</strong> in <strong>Wordpress</strong> to load pages instead of posts?</p> <p>I would like to be able to query a set of child pages, and then use <strong>THE LOOP</strong> function calls on it - things like <code>the_permalink()</code> and <code>the_title()</code>.</p> <p>Is there a way to do this? I didn't see anything in <code>query_posts()</code> documentation.</p>
[ { "answer_id": 196742, "author": "Simon Lehmann", "author_id": 27011, "author_profile": "https://Stackoverflow.com/users/27011", "pm_score": 7, "selected": true, "text": "query_posts(array('showposts' => <number_of_pages_to_show>, 'post_parent' => <ID of the parent page>, 'post_type' => ...
2008/10/13
[ "https://Stackoverflow.com/questions/196505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22306/" ]
196,509
<p>I want to delete <strong>all</strong> the previously created indices. I am using <code>Lucene.net</code>.</p> <p>I tried the following:</p> <pre><code>Term term = new Term(); //empty because I want to delete all the indices IndexReader rdr = IndexReader.Open(_directory); rdr.DeleteDocuments(term); rdr.Close(); </code></pre> <p>But I get error. Any idea how to go about it?</p>
[ { "answer_id": 3242491, "author": "Jeremy Cade", "author_id": 99240, "author_profile": "https://Stackoverflow.com/users/99240", "pm_score": 1, "selected": false, "text": "DirectoryInfo directoryInfo = new DirectoryInfo(@\"IndexLocation\");\nParallel.ForEach(directoryInfo.GetFiles(), file...
2008/10/13
[ "https://Stackoverflow.com/questions/196509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
196,512
<p>I'm looking for a container that keeps all its items in order. I looked at SortedList, but that requires a separate key, and does not allow duplicate keys. I could also just use an unsorted container and explicitly sort it after each insert.</p> <p>Usage:</p> <ul> <li>Occasional insert</li> <li>Frequent traversal in order</li> <li>Ideally not working with keys separate from the actual object, using a compare function to sort.</li> <li>Stable sorting for equivalent objects is desired, but not required. </li> <li>Random access is not required.</li> </ul> <p>I realize I can just build myself a balanced tree structure, I was just wondering if the framework already contains such a beast.</p>
[ { "answer_id": 196539, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": -1, "selected": false, "text": "System.Collections.ObjectModel.KeyedCollection<TKey, TItem>" }, { "answer_id": 196615, "author": "Perry P...
2008/10/13
[ "https://Stackoverflow.com/questions/196512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8701/" ]
196,518
<p>Problem with dynamic controls</p> <p>Hello all,</p> <p>I'm wanting to create some dynamic controls, and have them persist their viewstate across page loads. Easy enough, right? All I have to do is re-create the controls upon each page load, using the same IDs. HOWEVER, here's the catch - in my PreRender event, I'm wanting to clear the controls collection, and then recreate the dynamic controls with new values. The reasons for this are complicated, and it would probably take me about a page or so to explain why I want to do it. So, in the interests of brevity, let's just assume that I absolutely must do this, and that there's no other way.</p> <p>The problem comes in after I re-create the controls in my PreRender event. The re-created controls never bind to the viewstate, and their values do not persist across page loads. I don't understand why this happens. I'm already re-creating the controls in my OnLoad event. When I do this, the newly created controls bind to the ViewState just fine, provided that I use the same IDs every time. However, when I try to do the same thing in the PreRender event, it fails.</p> <p>In any case, here is my example code : </p> <p>namespace TestFramework.WebControls {</p> <pre><code>public class ValueLinkButton : LinkButton { public string Value { get { return (string)ViewState[ID + "vlbValue"]; } set { ViewState[ID + "vlbValue"] = value; } } } public class TestControl : WebControl { protected override void OnLoad(EventArgs e) { base.OnLoad(e); Controls.Clear(); ValueLinkButton tempLink = null; tempLink = new ValueLinkButton(); tempLink.ID = "valueLinkButton"; tempLink.Click += new EventHandler(Value_Click); if (!Page.IsPostBack) { tempLink.Value = "old value"; } Controls.Add(tempLink); } protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); ValueLinkButton tempLink = ((ValueLinkButton)FindControl("valueLinkButton")); //[CASE 1] //ValueLinkButton tempLink = new ValueLinkButton(); [CASE 2] tempLink.ID = "valueLinkButton"; tempLink.Value = "new value"; tempLink.Text = "Click"; Controls.Clear(); Controls.Add(tempLink); } void Value_Click(object sender, EventArgs e) { Page.Response.Write("[" + ((ValueLinkButton)sender).Value + "]"); } } </code></pre> <p>}</p> <p>So, let's examine case 1, where the line next to [CASE 1] is not commented out, but the line next to [CASE 2] is commented out. Here, everything works just fine. When I put this control on a page and load the page, I see a link that says "Click". When I click the link, the page outputs the text "[new value]", and on the next line, we see the familiar "Click" link. Every subesquent time I click on the "Click" link, we see the same thing. So far, so good.</p> <p>But now let's examine case 2, where the line next to [CASE 1] is commented out, but the line next to [CASE 2] is not commented out. Here we run into problems. When we load the page, we see the "Click" link. However, when I click on the link, the page outputs the text "[]" instead of "[new value]". The click event is firing normally. However, the "new value" text that I assigned to the Value attribute of the control does not get persisted. Once again, this is a bit of a mystery to me. How come, when I recreate the control in OnLoad, everything's fine and dandy, but when I recreate the control in PreRender, the value doesn't get persisted?</p> <p>I feel like there simply has to be a way to do this. When I re-create the control in PreRender, is there some way to bind the newly created control to the ViewState?</p> <p>I've struggled with this for days. Any help that you can give me will be appreciated.</p> <p>Thanks.</p>
[ { "answer_id": 196568, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 0, "selected": false, "text": "Page.RegisterRequiresControlState()" }, { "answer_id": 196614, "author": "Samuel Kim", "author_id": 4374...
2008/10/13
[ "https://Stackoverflow.com/questions/196518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27293/" ]
196,520
<p>What's the best/most efficient way to extract text set between parenthesis? Say I wanted to get the string "text" from the string "ignore everything except this (text)" in the most efficient manner possible.</p> <p>So far, the best I've come up with is this:</p> <pre><code>$fullString = "ignore everything except this (text)"; $start = strpos('(', $fullString); $end = strlen($fullString) - strpos(')', $fullString); $shortString = substr($fullString, $start, $end); </code></pre> <p>Is there a better way to do this? I know in general using regex tends to be less efficient, but unless I can reduce the number of function calls, perhaps this would be the best approach? Thoughts?</p>
[ { "answer_id": 196536, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 8, "selected": true, "text": "$text = 'ignore everything except this (text)';\npreg_match('#\\((.*?)\\)#', $text, $match);\nprint $match[1];\n" }, { "...
2008/10/13
[ "https://Stackoverflow.com/questions/196520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
196,521
<p>There's something I want to customize in the System.Web.Script.Services.ScriptHandlerFactory and other .NET stuff inside an internal class. Unfortunately, it's an internal class. What options do I have when trying to customize a method in this class?</p>
[ { "answer_id": 196525, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 3, "selected": false, "text": "internal" }, { "answer_id": 196551, "author": "Kris", "author_id": 18565, "author_profile": "https...
2008/10/13
[ "https://Stackoverflow.com/questions/196521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
196,522
<p>I've programmed C and C++ for a long time and so far I've never used exceptions and try / catch. What are the benefits of using that instead of just having functions return error codes? </p>
[ { "answer_id": 196537, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 4, "selected": false, "text": "int DoSomeThings()\n{\n int error = 0;\n HandleA hA;\n error = CreateAObject(&ha);\n if (error)\n goto cle...
2008/10/13
[ "https://Stackoverflow.com/questions/196522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13676/" ]
196,566
<p>I am trying to connect to a webservice over ssl with a client certificate. Is there an elegant way of doing this apart from shoving things like "javax.net.ssl.keyStore" into System.properties.</p> <p>Any pointers to code examples would be appreciated.</p>
[ { "answer_id": 196537, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 4, "selected": false, "text": "int DoSomeThings()\n{\n int error = 0;\n HandleA hA;\n error = CreateAObject(&ha);\n if (error)\n goto cle...
2008/10/13
[ "https://Stackoverflow.com/questions/196566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22888/" ]
196,567
<p>I have a mockup layout for something <a href="http://www.mylittlepwnage.com/misc/forms-editor.html" rel="nofollow noreferrer">here</a>. Essentially there are sections, columns and fields, which are all written as a combination of <code>&lt;ul&gt;</code> and <code>&lt;li&gt;</code> elements. This is done specifically for later parsing. </p> <p>A snippet of the HTML:</p> <pre><code>&lt;li class="layout"&gt;&lt;span class="type"&gt;[Column] &lt;/span&gt; &lt;ul class="layout-children"&gt; &lt;li class="field"&gt;&lt;span class="type"&gt;[Text] &lt;/span&gt;A field&lt;/li&gt; &lt;li class="field"&gt;&lt;span class="type"&gt;[Text] &lt;/span&gt;Another field&lt;/li&gt; &lt;li class="field"&gt;&lt;span class="type"&gt;[Text] &lt;/span&gt;Yet another field&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li class="layout"&gt;&lt;span class="type"&gt;[Column] &lt;/span&gt; &lt;ul class="layout-children"&gt; &lt;li class="field"&gt;&lt;span class="type"&gt;[Text] &lt;/span&gt;More fields&lt;/li&gt; &lt;li class="field"&gt;&lt;span class="type"&gt;[Text] &lt;/span&gt;And one more field&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>If you go to the <a href="http://www.mylittlepwnage.com/misc/forms-editor.html" rel="nofollow noreferrer">linked content</a> you'll note that those columns sit vertically. I want the columns to sit beside each other, but I am not sure how to go about it.</p> <p>It would be preferable if the HTML didn't change, just the CSS.</p>
[ { "answer_id": 196571, "author": "Joe Basirico", "author_id": 20795, "author_profile": "https://Stackoverflow.com/users/20795", "pm_score": 2, "selected": false, "text": "<UL>" }, { "answer_id": 196573, "author": "Dimitry", "author_id": 27073, "author_profile": "https...
2008/10/13
[ "https://Stackoverflow.com/questions/196567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1666/" ]
196,585
<p>I've got some LINQ to SQL that sometimes throws a </p> <blockquote> <p>"Cannot insert duplicate key row in object 'dbo.Table' with unique index 'IX_Indexname'.The statement has been terminated."</p> </blockquote> <p>Is there some way I can turn on logging or at least debug into the datacontext to see what sql is being executed at the time that error is raised?</p> <p><strong>Update:</strong> I should have mentioned I know about the <code>GetChangeSet()</code> method, I was wondering if there is a property on the DataContext that shows the last SQL that was executed, or a property on the sql exception that shows the SQL.</p> <p>The odd thing about this error is that in the change sets, there is only one update &amp; the only field that's changing is a datetime field that isn't in the index that causing the error.</p>
[ { "answer_id": 196594, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 1, "selected": false, "text": "context.GetChangedSet();\n" }, { "answer_id": 196607, "author": "Bradley Grainger", "author_id": 2363...
2008/10/13
[ "https://Stackoverflow.com/questions/196585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2975/" ]
196,591
<p>I need to pad the output of an integer to a given length.</p> <p>For example, with a length of 4 digits, the output of the integer 4 is "0004" instead of "4". How can I do this in C# 2.0?</p>
[ { "answer_id": 196599, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 6, "selected": true, "text": "output = String.Format(\"{0:0000}\", intVariable); \n" }, { "answer_id": 68529323, "author": "Rob Hoff",...
2008/10/13
[ "https://Stackoverflow.com/questions/196591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20910/" ]
196,603
<p>My company has a large application written in VB6, and for historical reasons, the application is navigated with the Enter key instead of with the Tab key. I don't know VB6, but I know that they currently set the focus for each control in a big select statement in the Form's KeyUp event if it's an EnterKey. Now we are starting to convert to .NET, and have to keep things consistent so the users won't have to TAB on some forms and ENTER on others. I want to write ancestor forms that will automatically ENTER from field to field instead of tabbing. A coworker told me that the way it's done in VB6 is to process buttons not on the CLICK event but on the KEYUP event. I need to continue doing this so I won't have leftover KeyUp events to pass back to VB6 after my form is finished. The order of events for buttons is</p> <ol> <li>button_PreviewKeyDown </li> <li>button_Click (apparently replacing the KeyPress event)</li> <li>form_KeyUp </li> <li>button_KeyUp</li> </ol> <p>I created forms as follows:</p> <ul> <li>On the ANCESTOR form's KeyUp event, checks to see if it's an enter key. If it is an enter key, and the active control is not a button, it moves to the next field in tab order. Otherwise it ignores the key and lets the control handle it. If it is a button, the ancestor doesn't presume to know where the button wants control to go, because it will depend on what the button wants to do when it is "clicked".</li> <li>On the CHILD form's buttons, the click event does nothing, and the processing is duplicated in the KeyUp event and the MouseClick event. </li> <li>The ANCESTOR form has a protected Boolean, EatKeyUp, that can be set to True by the CHILD. This is used when the child form needs to send a MessageBox, because if the user enters through the OK button on the MessageBox, there is still a leftover KeyUp event that will be consumed by the ancestor form.</li> </ul> <p>Although klugey, this actually seems to work. What I want to know is, is there a better way? Perhaps some setting somewhere that I can tell my application "Enter through forms instead of tabbing"? Are the events that I'm using instead of the click events the best ones?</p>
[ { "answer_id": 196599, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 6, "selected": true, "text": "output = String.Format(\"{0:0000}\", intVariable); \n" }, { "answer_id": 68529323, "author": "Rob Hoff",...
2008/10/13
[ "https://Stackoverflow.com/questions/196603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12897/" ]
196,626
<p>I need to do a query that search for a text with <strong>'Nome % teste \ / '</strong> as prefix. I'm doing the query using:</p> <p><strong>where "name" ILIKE 'Nome a% teste \ /%' ESCAPE 'a'</strong> (using a as escape character).</p> <p>There is a row that match this, but this query returns nothing. Removing the slash (<strong>'Nome % teste \'</strong>), it works. But I don't see why the <strong>slash</strong> is a problem, since the default escape is a <strong>backslash</strong> and I've changed it to <strong>'a'</strong> in this test.</p> <p>There is something that I'm missing? (I've consulted TFM)</p>
[ { "answer_id": 196631, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 1, "selected": false, "text": "where \"name\" ILIKE 'Nome \\% teste \\\\\\/';\n" }, { "answer_id": 196648, "author": "Kent Fredric", "a...
2008/10/13
[ "https://Stackoverflow.com/questions/196626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18403/" ]
196,628
<p>I have the following problem in my <i>Data Structures and Problem Solving using Java</i> book:</p> <blockquote> <p>Write a routine that uses the Collections API to print out the items in any Collection in reverse order. Do not use a ListIterator.</p> </blockquote> <p>I'm not putting it up here because I want somebody to do my homework, I just can't seem to understand exactly what it is asking for me to code!</p> <p>When it asks me to write a 'routine', is it looking for a single method? I don't really understand how I can make a single method work for all of the various types of Collections (linked list, queue, stack).</p> <p>If anybody could guide me in the right direction, I would greatly appreciate it.</p>
[ { "answer_id": 196638, "author": "AdamC", "author_id": 16476, "author_profile": "https://Stackoverflow.com/users/16476", "pm_score": 2, "selected": false, "text": "void printReverseList(Collection col) {}\n" }, { "answer_id": 196642, "author": "ddimitrov", "author_id": 18...
2008/10/13
[ "https://Stackoverflow.com/questions/196628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14013/" ]
196,661
<p>I was hoping to do something like this, but it appears to be illegal in C#:</p> <pre><code>public Collection MethodThatFetchesSomething&lt;T&gt;() where T : SomeBaseClass { return T.StaticMethodOnSomeBaseClassThatReturnsCollection(); } </code></pre> <p>I get a compile-time error:</p> <blockquote> <p>'T' is a 'type parameter', which is not valid in the given context.</p> </blockquote> <p>Given a generic type parameter, how can I call a static method on the generic class? The static method has to be available, given the constraint.</p>
[ { "answer_id": 196977, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 7, "selected": true, "text": "T.StaticMethodOnSomeBaseClassThatReturnsCollection\n" }, { "answer_id": 462136, "author": "Community", "au...
2008/10/13
[ "https://Stackoverflow.com/questions/196661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8169/" ]
196,664
<p>I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.</p>
[ { "answer_id": 196672, "author": "defeated", "author_id": 16997, "author_profile": "https://Stackoverflow.com/users/16997", "pm_score": 6, "selected": true, "text": "var_dump($_REQUEST);" }, { "answer_id": 196714, "author": "Paolo Bergantino", "author_id": 16417, "aut...
2008/10/13
[ "https://Stackoverflow.com/questions/196664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
196,668
<p>I'm working on a system that includes a large number of reports, generated using <a href="http://jasperforge.org/plugins/project/project_home.php?group_id=102" rel="noreferrer">JasperReports</a>. One of the newer features is that you can define styles for reports.</p> <p>From the available docs I believe there is some way to have an external file defining styles to use, and you can reference that in your jasper reports. This allows a single style to be used by multiple reports.</p> <p>I can't find any concrete information on whether this is an actual feature, and if it is, how to use it. Does anyone know if it is possible to have external styles for jasper reports, and if so, how to do it?</p>
[ { "answer_id": 206403, "author": "Jamie Love", "author_id": 27308, "author_profile": "https://Stackoverflow.com/users/27308", "pm_score": 6, "selected": true, "text": ".jrtx" }, { "answer_id": 595933, "author": "Community", "author_id": -1, "author_profile": "https://...
2008/10/13
[ "https://Stackoverflow.com/questions/196668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27308/" ]
196,684
<p>All right, say I have this:</p> <pre><code>&lt;select id='list'&gt; &lt;option value='1'&gt;Option A&lt;/option&gt; &lt;option value='2'&gt;Option B&lt;/option&gt; &lt;option value='3'&gt;Option C&lt;/option&gt; &lt;/select&gt; </code></pre> <p>What would the selector look like if I wanted to get "Option B" when I have the value '2'?</p> <p>Please note that this is not asking how to get the <em>selected</em> text value, but just any one of them, whether selected or not, depending on the value attribute. I tried:</p> <pre><code>$("#list[value='2']").text(); </code></pre> <p>But it is not working.</p>
[ { "answer_id": 196687, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 11, "selected": true, "text": "list" }, { "answer_id": 196689, "author": "Andrew Moore", "author_id": 26210, "author_profile": "https://S...
2008/10/13
[ "https://Stackoverflow.com/questions/196684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16417/" ]
196,702
<p>Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via <code>&lt;script src="..."&gt;</code>, not pasted into the HTML itself.</p> <p>Where’s the best place to put this in the HTML?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;!-- here? --&gt; &lt;link rel="stylesheet" href="stylez.css" type="text/css" /&gt; &lt;!-- here? --&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- here? --&gt; &lt;p&gt;All the page content ...&lt;/p&gt; &lt;!-- or here? --&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Will there be any functional difference between each of the options?</p>
[ { "answer_id": 196933, "author": "bart", "author_id": 19966, "author_profile": "https://Stackoverflow.com/users/19966", "pm_score": 2, "selected": false, "text": "x.js" }, { "answer_id": 23476758, "author": "martynas", "author_id": 3300831, "author_profile": "https://...
2008/10/13
[ "https://Stackoverflow.com/questions/196702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
196,713
<p>I need to match something in the form </p> <pre><code>&lt;a href="pic/5" id="piclink"&gt;&lt;img src="thumb/5" /&gt;&lt;/a&gt; </code></pre> <p>to find the number, in this case 5, using JavaScript. I have no idea how to use regexes, so I was wondering if anyone here could help out.</p>
[ { "answer_id": 196717, "author": "num1", "author_id": 306, "author_profile": "https://Stackoverflow.com/users/306", "pm_score": 1, "selected": false, "text": "'<a href=\"pic/5\" id=\"piclink\"><img src=\"thumb/5\" /></a>'.match(/[0-9]/);\n" }, { "answer_id": 196743, "author":...
2008/10/13
[ "https://Stackoverflow.com/questions/196713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306/" ]
196,721
<p>I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book <a href="http://oreilly.com/catalog/9780596527938/" rel="noreferrer">Java Power Tools</a>, but with no success. Here's the relevant snippet of my project's Maven 2 POM:</p> <pre><code>&lt;build&gt; ... &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt; &lt;version&gt;2.2&lt;/version&gt; &lt;configuration&gt; &lt;check&gt; &lt;!-- Per-class thresholds --&gt; &lt;lineRate&gt;80&lt;/lineRate&gt; &lt;branchRate&gt;80&lt;/branchRate&gt; &lt;!-- Project-wide thresholds --&gt; &lt;totalLineRate&gt;90&lt;/totalLineRate&gt; &lt;totalBranchRate&gt;90&lt;/totalBranchRate&gt; &lt;/check&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;clean&lt;/goal&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;coverage-tests&lt;/id&gt; &lt;!-- The &quot;verify&quot; phase occurs just before &quot;install&quot; --&gt; &lt;phase&gt;verify&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;clean&lt;/goal&gt; &lt;goal&gt;check&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;instrumentation&gt; &lt;excludes&gt; &lt;exclude&gt;au/**/*Constants.*&lt;/exclude&gt; &lt;/excludes&gt; &lt;ignores&gt; &lt;ignore&gt;au/**/*Constants.*&lt;/ignore&gt; &lt;/ignores&gt; &lt;/instrumentation&gt; &lt;/configuration&gt; &lt;/plugin&gt; ... &lt;/plugins&gt; ... &lt;/build&gt; </code></pre> <p>As I say, the coverage report works fine, the problem is that the &quot;install&quot; goal isn't failing as it should if the line or branch coverage is below my specified thresholds. Does anyone have this working, and if so, what does your POM look like and which version of Cobertura and Maven are you using? I'm using Maven 2.0.9 and Cobertura 2.2.</p> <p>I've tried Googling and reading the Cobertura docs, but no luck (the latter are sparse to say the least).</p>
[ { "answer_id": 1618213, "author": "Pascal Thivent", "author_id": 70604, "author_profile": "https://Stackoverflow.com/users/70604", "pm_score": 5, "selected": true, "text": "<haltOnFailure>" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10433/" ]
196,729
<p>I'm developing an operating system and rather than programming the kernel, I'm designing the kernel. This operating system is targeted at the x86 architecture and my target is for modern computers. The estimated number of required RAM is 256Mb or more.</p> <p>What is a good size to make the stack for each thread run on the system? Should I try to design the system in such a way that the stack can be extended automatically if the maximum length is reached?</p> <p>I think if I remember correctly that a page in RAM is 4k or 4096 bytes and that just doesn't seem like a lot to me. I can definitely see times, especially when using lots of recursion, that I would want to have more than 1000 integars in RAM at once. Now, the real solution would be to have the program doing this by using <code>malloc</code> and manage its own memory resources, but really I would like to know the user opinion on this.</p> <p>Is 4k big enough for a stack with modern computer programs? Should the stack be bigger than that? Should the stack be auto-expanding to accommodate any types of sizes? I'm interested in this both from a practical developer's standpoint and a security standpoint.</p> <p>Is 4k too big for a stack? Considering normal program execution, especially from the point of view of classes in C++, I notice that good source code tends to <code>malloc/new</code> the data it needs when classes are created, to minimize the data being thrown around in a function call.</p> <p>What I haven't even gotten into is the size of the processor's cache memory. Ideally, I think the stack would reside in the cache to speed things up and I'm not sure if I need to achieve this, or if the processor can handle it for me. I was just planning on using regular boring old RAM for testing purposes. I can't decide. What are the options?</p>
[ { "answer_id": 6001984, "author": "Peter Teoh", "author_id": 315046, "author_profile": "https://Stackoverflow.com/users/315046", "pm_score": 2, "selected": false, "text": "./arch/cris/include/asm/processor.h:\n#define KERNEL_STACK_SIZE PAGE_SIZE\n\n./arch/ia64/include/asm/ptrace.h:\n# de...
2008/10/13
[ "https://Stackoverflow.com/questions/196729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19521/" ]
196,730
<p>I need to extract only the 2nd level part of the domain from request.servervariables("HTTP_HOST") what is the best way to do this?</p>
[ { "answer_id": 196752, "author": "Brian Boatright", "author_id": 3747, "author_profile": "https://Stackoverflow.com/users/3747", "pm_score": 1, "selected": false, "text": "If Len(strHostDomain) > 0 Then \n aryDomain = Split(strHostDomain,\".\")\n\n If uBound(aryDomain) >= 1 Th...
2008/10/13
[ "https://Stackoverflow.com/questions/196730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
196,732
<p>I've inherited a piece of code with a snippet which empties the database as follows:</p> <pre><code>dbmopen (%db,"file.db",0666); foreach $key (keys %db) { delete $db{$key}; } dbmclose (%db); </code></pre> <p>This is usually okay but sometimes the database grows very large before this cleanup code is called and it's usually when a user wants to do something important.</p> <p>Is there a better way of doing this?</p>
[ { "answer_id": 196816, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 3, "selected": false, "text": "dbmopen (%db,\"file.db\",0666);\n%db = ();\ndbmclose (%db);\n" }, { "answer_id": 196884, "author": "paxdiabl...
2008/10/13
[ "https://Stackoverflow.com/questions/196732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14860/" ]
196,733
<p>I have code like this:</p> <pre><code>class RetInterface {...} class Ret1: public RetInterface {...} class AInterface { public: virtual boost::shared_ptr&lt;RetInterface&gt; get_r() const = 0; ... }; class A1: public AInterface { public: boost::shared_ptr&lt;Ret1&gt; get_r() const {...} ... }; </code></pre> <p><strong>This code does not compile.</strong></p> <p>In visual studio it raises</p> <blockquote> <p>C2555: overriding virtual function return type differs and is not covariant</p> </blockquote> <p>If I do not use <code>boost::shared_ptr</code> but return raw pointers, the code compiles (I understand this is due to <a href="http://en.wikipedia.org/wiki/Parameter_covariance#C.2B.2B" rel="noreferrer">covariant return types</a> in C++). I can see the problem is because <code>boost::shared_ptr</code> of <code>Ret1</code> is not derived from <code>boost::shared_ptr</code> of <code>RetInterface</code>. But I want to return <code>boost::shared_ptr</code> of <code>Ret1</code> for use in other classes, else I must cast the returned value after the return. </p> <ol> <li>Am I doing something wrong? </li> <li>If not, why is the language like this - it should be extensible to handle conversion between smart pointers in this scenario? Is there a desirable workaround?</li> </ol>
[ { "answer_id": 196744, "author": "Mr Fooz", "author_id": 25050, "author_profile": "https://Stackoverflow.com/users/25050", "pm_score": 2, "selected": false, "text": "A1::get_r" }, { "answer_id": 197157, "author": "Anthony Williams", "author_id": 5597, "author_profile"...
2008/10/13
[ "https://Stackoverflow.com/questions/196733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19501/" ]
196,737
<p>I've been working with the Joomla framework and I have noticed that they use a convention to designate private or protected methods (they put an underscore "<code>_</code>" in front of the method name), but they do not explicitly declare any methods <code>public</code>, <code>private</code>, or <code>protected</code>. Why is this? Does it have to do with portability? Are the <code>public</code>, <code>private</code>, or <code>protected</code> keywords not available in older versions of PHP?</p>
[ { "answer_id": 4299774, "author": "naught101", "author_id": 210945, "author_profile": "https://Stackoverflow.com/users/210945", "pm_score": 2, "selected": false, "text": "private" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831/" ]
196,741
<p>How are arrays manipulated in D?</p>
[ { "answer_id": 196799, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 2, "selected": false, "text": "int[7] a;\nint[] b;\nb = a[5..7];\n" }, { "answer_id": 269166, "author": "Community", "author_id": -1, ...
2008/10/13
[ "https://Stackoverflow.com/questions/196741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13295/" ]
196,754
<p>I've seen some horrific code written in Perl, but I can't make head nor tail of this one:</p> <pre><code>select((select(s),$|=1)[0]) </code></pre> <p>It's in some networking code that we use to communicate with a server and I assume it's something to do with buffering (since it sets <code>$|</code>).</p> <p>But I can't figure out why there's multiple <code>select</code> calls or the array reference. Can anyone help me out?</p>
[ { "answer_id": 196768, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 7, "selected": true, "text": "select()" }, { "answer_id": 196769, "author": "Andy Lester", "author_id": 8454, "author_profile": "https://...
2008/10/13
[ "https://Stackoverflow.com/questions/196754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14860/" ]
196,755
<p>Given a string of keywords, such as "Python best practices", I would like to obtain the first 10 Stack Overflow questions that contain that keywords, sorted by relevance (?), say from a Python script. My goal is to end up with a list of tuples (title, URL).</p> <p>How can I accomplish this? Would you consider querying Google instead? (How would you do it from Python?)</p>
[ { "answer_id": 196763, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 3, "selected": false, "text": "<h3><a href=\"/questions/5119/what-are-the-best-rss-feeds-for-programmersdevelopers#5150\" class=\"answer-title\">What are...
2008/10/13
[ "https://Stackoverflow.com/questions/196755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18770/" ]
196,771
<p>I have a PHP application which needs to output a python script, more specifically a bunch of variable assignment statements, eg.</p> <pre><code>subject_prefix = 'This String From User Input' msg_footer = """This one too.""" </code></pre> <p>The contents of subject_prefix et al need to be written to take user input; as such, I need to escape the contents of the strings. Writing something like the following isn't going to cut it; we're stuffed as soon as someone uses a quote or newline or anything else that I'm not aware of that could be hazardous:</p> <pre><code>echo "subject_prefix = '".$subject_prefix."'\n"; </code></pre> <p>So. Any ideas?</p> <p>(Rewriting the app in Python isn't possible due to time constraints. :P )</p> <p><strong>Edit, years later:</strong></p> <p>This was for integration between a web-app (written in PHP) and Mailman (written in Python). I couldn't modify the install of the latter, so I needed to come up with a way to talk in its language to manage its configuration.</p> <p>This was also a <em>really</em> bad idea.</p>
[ { "answer_id": 196783, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": -1, "selected": false, "text": "function escape_string($text, $type) {\n // Escape backslashes for all types of strings?\n $text = str_replace('\\\...
2008/10/13
[ "https://Stackoverflow.com/questions/196771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3528/" ]
196,776
<p>I need to be able to send encrypted data between a Ruby client and a Python server (and vice versa) and have been having trouble with the <a href="http://rubyforge.org/projects/ruby-aes" rel="nofollow noreferrer">ruby-aes</a> gem/library. The library is very easy to use but we've been having trouble passing data between it and the pyCrypto AES library for Python. These libraries seem to be fine when they're the only one being used, but they don't seem to play well across language boundaries. Any ideas?</p> <p>Edit: We're doing the communication over SOAP and have also tried converting the binary data to base64 to no avail. Also, it's more that the encryption/decryption is almost but not exactly the same between the two (e.g., the lengths differ by one or there is extra garbage characters on the end of the decrypted string)</p>
[ { "answer_id": 196794, "author": "mhawke", "author_id": 21945, "author_profile": "https://Stackoverflow.com/users/21945", "pm_score": 1, "selected": false, "text": "f = open('/path/to/file', 'rb')\n" }, { "answer_id": 196896, "author": "HughE", "author_id": 7875, "aut...
2008/10/13
[ "https://Stackoverflow.com/questions/196776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422/" ]
196,788
<p>I'm trying to implement search result highlighting for pdfs in a web app. I have the original pdfs, and small png versions that are used in search results. Essentially I'm looking for an api like:</p> <pre><code>pdf_document.find_offsets('somestring') # =&gt; { top: 501, left: 100, bottom: 520, right: 150 }, { ... another box ... }, ... </code></pre> <p>I know it's possible to get this information out of a pdf because Apple's Preview.app implements this.</p> <p>Need something that runs on Linux and ideally is open source. I'm aware you can do this with acrobat on windows.</p>
[ { "answer_id": 203553, "author": "Chris Dolan", "author_id": 14783, "author_profile": "https://Stackoverflow.com/users/14783", "pm_score": 2, "selected": false, "text": "use CAM::PDF;\nmy $pdf = CAM::PDF->new('my.pdf') or die $CAM::PDF::errstr;\nfor my $pagenum (1 .. $pdf->numPages) {\n ...
2008/10/13
[ "https://Stackoverflow.com/questions/196788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3624/" ]
196,820
<p>I need a cross-platform editor control to use as GUI-part in an in-house tool. The control may be commercial, but with reasonable price.</p> <p>Required features:</p> <ul> <li>Platforms: Win32, OS X, Linux</li> <li>UTF-8 support</li> <li>Fine-grained run-time control to the text style (or at least color)</li> <li>Nice low-level plain C API without usual horrible bloat</li> <li>Should not prevent me to have these features (even if I'll have to implement them myself): <ul> <li>Undo / Redo</li> <li>Copy / Paste</li> <li>Context menu, depending on click position in text</li> <li>Toolbar, depending on cursor position in text</li> <li>Sidebar panel, depending on cursor position in text</li> </ul></li> </ul> <p>Actually above requires not simple control, but whole cross-platform GUI library.</p> <p>Discarded options:</p> <ul> <li>Scintilla and descendants</li> <li>FLTK</li> <li>Fox-toolkit</li> <li>gtksourceview</li> </ul> <p><strong>Update:</strong> </p> <p>Note: I've slipped in some half-written discard reasoning here, I apologize. Scintilla indeed does work on OS X. However, if I get it correctly, Scintilla's API is in C++. </p> <p>Use-case:</p> <p>My use-case is to write custom "semi-rigid" logic editor, where user is free to copy-paste around, add comments where he wishes, even type in text directly if he wish. But text structure is a rigid natural language representation of logic tree (somewhat AST-like in nature). I plan to write something intellisense-like (or code-template-like) to be used as the main authoring tool (instead of typing logic by hand).</p> <p>BTW, storage format would not be plain text, but instead internal representation of mentioned logic tree (with comments and whitespaces etc. metainfo).</p> <p>So, I have all necessary information to render text in needed colors by myself. I do not need any external lexers etc.</p>
[ { "answer_id": 196856, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 3, "selected": true, "text": "GtkTextView" }, { "answer_id": 197714, "author": "PhiLho", "author_id": 15459, "author_profile": "h...
2008/10/13
[ "https://Stackoverflow.com/questions/196820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6236/" ]
196,824
<p>How do you process information in Java that was input from a file. For Example: suppose you have a file input.txt. The contents of this file is: abcdefghizzzzjklmnop azzbcdefghijklmnop</p> <p>My hope would be that the information would be put into the argument array of strings such that the following code would output "abcdefghizzzzjklmnop"</p> <pre><code>class Test { public static void main(String[] args) { System.out.println(args[0]); } } </code></pre> <p>The command I have been using throws an array out of bound exception. This command is:</p> <blockquote> <blockquote> <p>java Test &lt; input.txt</p> </blockquote> </blockquote> <p>Non-file based arguments work fine though. ie. java Test hello,a nd java Test &lt; input.txt hello. </p> <p>More information: I have tried putting the file contents all on one line to see if \n \r characters may be messing things up. That didn't seem to help. </p> <p>Also, I can't use the bufferedreader class for this because this is for a program for school, and it has to work with my professors shell script. He went over this during class, but I didn't write it down (or I can't find it).</p> <p>Any help?</p>
[ { "answer_id": 196831, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 3, "selected": false, "text": "System.in" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
196,830
<p>Some ways to iterate through the characters of a string in Java are:</p> <ol> <li>Using <code>StringTokenizer</code>?</li> <li>Converting the <code>String</code> to a <code>char[]</code> and iterating over that.</li> </ol> <p>What is the easiest/best/most correct way to iterate?</p>
[ { "answer_id": 196834, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 10, "selected": true, "text": "charAt()" }, { "answer_id": 196842, "author": "Alan", "author_id": 17205, "author_profile": "https://Stac...
2008/10/13
[ "https://Stackoverflow.com/questions/196830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85/" ]
196,840
<p>I am looking for a way to add a drop down list in WPF to a menu. This used to be really easy in winforms and so I am expecting you experts to know just now to do it in WPF. Thanks.</p> <p>Sorry if this is a bad question, it is late and I don't want to think.</p>
[ { "answer_id": 196873, "author": "Jobi Joy", "author_id": 8091, "author_profile": "https://Stackoverflow.com/users/8091", "pm_score": 6, "selected": true, "text": "<Menu>\n <MenuItem Header=\"File\">\n <MenuItem Header=\"Open\"/>\n <MenuItem Header=\"Close\"/>\n <...
2008/10/13
[ "https://Stackoverflow.com/questions/196840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22914/" ]
196,841
<p>In Python, you can do this:</p> <pre><code>print &quot;Hi! I'm %(name)s, and I'm %(age)d years old.&quot; % ({&quot;name&quot;:&quot;Brian&quot;,&quot;age&quot;:30}) </code></pre> <p>What's the closest, simplest Ruby idiom to replicate this behavior? (No monkeypatching the String class, please.)</p> <p>One of the really excellent benefits of this is that you can store the pre-processed string in a variable and use it as a &quot;template&quot;, like so:</p> <pre><code>template = &quot;Hi! I'm %(name)s, and I'm %(age)d years old.&quot; def greet(template,name,age): print template % ({&quot;name&quot;:name,&quot;age&quot;:age}) </code></pre> <p>This is obviously a trivial example, but there is a lot of utility in being able to store such a string for later use. Ruby's <code>&quot;Hi! I'm #{name}&quot;</code> convention is cursorily similar, but the immediate evaluation makes it less versatile.</p>
[ { "answer_id": 196847, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 2, "selected": false, "text": "puts \"Hi! I'm #{name}, and I'm #{age} years old.\"\n" }, { "answer_id": 196854, "author": "Honza", "auth...
2008/10/13
[ "https://Stackoverflow.com/questions/196841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16034/" ]
196,859
<p>I need to change color of TextBox whenever its required field validator is fired on Clicking the Submit button</p>
[ { "answer_id": 196916, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 0, "selected": false, "text": "<html>\n <head>\n <script type=\"text/javascript\">\n function mkclr(cntl,clr) {\n document.getElementBy...
2008/10/13
[ "https://Stackoverflow.com/questions/196859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
196,876
<p>Just looking at ways of getting named constants in python.</p> <pre><code>class constant_list: (A_CONSTANT, B_CONSTANT, C_CONSTANT) = range(3) </code></pre> <p>Then of course you can refer to it like so: </p> <pre><code>constant_list.A_CONSTANT </code></pre> <p>I suppose you could use a dictionary, using strings: </p> <pre><code>constant_dic = { "A_CONSTANT" : 1, "B_CONSTANT" : 2, "C_CONSTANT" : 3,} </code></pre> <p>and refer to it like this:</p> <pre><code>constant_dic["A_CONSTANT"] </code></pre> <hr> <p>My question, then, is simple. Is there any better ways of doing this? Not saying that these are inadequate or anything, just curious - any other common idioms that I've missed?</p> <p>Thanks in advance.</p>
[ { "answer_id": 196881, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "class Enumerate(object):\n def __init__(self, names):\n for number, name in enumerate(names.split()):\n setattr(se...
2008/10/13
[ "https://Stackoverflow.com/questions/196876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
196,883
<p>I am having an ASP.net page in my page i am having this as my code behind files. on first access the page the page preinit, init, load methods are called. on postbacks the preinit, init, load methods are called.</p> <p>My question is LoadViewstate and control state events (Overridden methods) are not firing after postbacks also</p> <pre><code>protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); } protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); } protected override void LoadControlState(object savedState) { base.LoadControlState(savedState); } protected void Page_Init(object sender, EventArgs e) { } protected void Page_Load(object sender, EventArgs e) { // lblName.Text = ViewState["Test"].ToString(); } </code></pre>
[ { "answer_id": 196881, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 5, "selected": true, "text": "class Enumerate(object):\n def __init__(self, names):\n for number, name in enumerate(names.split()):\n setattr(se...
2008/10/13
[ "https://Stackoverflow.com/questions/196883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22162/" ]
196,885
<p>How can I determine if I'm running on a 32bit or a 64bit version of matlab?</p> <p>I have some pre-compiled mex-files which need different path's depending on 32/64bit matlab.</p>
[ { "answer_id": 206927, "author": "Adrian", "author_id": 28406, "author_profile": "https://Stackoverflow.com/users/28406", "pm_score": 2, "selected": false, "text": "if regexp(computer,'..$','match','64'),\n % setup 64bit options\nelse,\n % 32bit options\nend\n" }, { "answer_i...
2008/10/13
[ "https://Stackoverflow.com/questions/196885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27331/" ]
196,890
<p>I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to enable 3D acceleration for 2D, but even using that has some weird issues. </p> <p>Here are results of tests I ran:</p> <p>Drawing a 25x18 map with 32x32 pixel tiles on a JComponent<br> Image 1 = .bmp format, Image 2 = A .png format</p> <h2>Without -Dsun.java2d.opengl=true</h2> <p>120 FPS using .BMP image 1<BR> 13 FPS using .PNG image 2</p> <h2>With -Dsun.java2d.opengl=true</h2> <p>12 FPS using .BMP image 1<BR> 700 FPS using .PNG image 2</p> <p>Without acceleration, I'm assuming some kind of transformation is taking place with every drawImage() I do in software, and is pulling down the FPS considerably in the case of .PNG. Why though, with acceleration, would the results switch (and PNG actually performs incredibly faster)?! Craziness!</p> <p>.BMP Image 1 is translated to an image type of TYPE_INT_RGB. .PNG Image 2 is translated to an image type of TYPE_CUSTOM. In order to get consistent speed with and without opengl acceleration, I have to create a new BufferedImage with an image type of TYPE_INT_ARGB, and draw Image 1 or Image 2 to this new image. </p> <p>Here are the results running with that:</p> <h2>Without -Dsun.java2d.opengl=true</h2> <p>120 FPS using .BMP image 1<BR> 120 FPS using .PNG image 2</p> <h2>With -Dsun.java2d.opengl=true</h2> <p>700 FPS using .BMP image 1<BR> 700 FPS using .PNG image 2</p> <p>My real question is, can I assume that TYPE_INT_ARGB will be the native image type for all systems and platforms? I'm assuming this value could be different. Is there some way for me to get the native value so that I can always create new BufferedImages for maximum performance? </p> <p>Thanks in advance...</p>
[ { "answer_id": 197060, "author": "Consty", "author_id": 1191472, "author_profile": "https://Stackoverflow.com/users/1191472", "pm_score": 7, "selected": true, "text": "private BufferedImage toCompatibleImage(BufferedImage image)\n{\n // obtain the current system graphical settings\n ...
2008/10/13
[ "https://Stackoverflow.com/questions/196890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1191472/" ]
196,897
<p>I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified.</p> <p>Linux, on the other hand, does not lock executing files and you <em>can</em> delete, move, or modify them.</p> <p>Why does Windows lock when Linux does not? Is there an advantage to locking?</p>
[ { "answer_id": 30273566, "author": "Thorsten Schöning", "author_id": 2055163, "author_profile": "https://Stackoverflow.com/users/2055163", "pm_score": 2, "selected": false, "text": "dwShareMode" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27332/" ]
196,925
<p>JavaScript doesn't seem to have a native <code>trim()</code> method. How can I trim white spaces at the start and end of a string with JavaScript?</p>
[ { "answer_id": 196926, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 5, "selected": false, "text": "return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n" }, { "answer_id": 196928, "author": "Peter Boughton", ...
2008/10/13
[ "https://Stackoverflow.com/questions/196925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896/" ]
196,930
<p>How, in the simplest possible way, distinguish between Windows XP and Windows Vista, using Python and <a href="http://python.net/crew/mhammond/win32/Downloads.html" rel="noreferrer">pywin32</a> or <a href="http://www.wxpython.org/" rel="noreferrer">wxPython</a>?</p> <p>Essentially, I need a function that called will return True iff current OS is Vista:</p> <pre><code>&gt;&gt;&gt; isWindowsVista() True </code></pre>
[ { "answer_id": 196931, "author": "DzinX", "author_id": 18745, "author_profile": "https://Stackoverflow.com/users/18745", "pm_score": 3, "selected": false, "text": "import sys\n\ndef isWindowsVista():\n '''Return True iff current OS is Windows Vista.'''\n if sys.platform != \"win32\...
2008/10/13
[ "https://Stackoverflow.com/questions/196930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18745/" ]
196,936
<p>I'm writing some code for a class constructor which loops through all the properties of the class and calls a generic static method which populates my class with data from an external API. So I've got this as an example class:</p> <pre><code>public class MyClass{ public string Property1 { get; set; } public int Property2 { get; set; } public bool Property3 { get; set; } public static T DoStuff&lt;T&gt;(string name){ // get the data for the property from the external API // or if there's a problem return 'default(T)' } } </code></pre> <p>Now in my constructor I want something like this:</p> <pre><code>public MyClass(){ var properties = this.GetType().GetProperties(); foreach(PropertyInfo p in properties){ p.SetValue(this, DoStuff(p.Name), new object[0]); } } </code></pre> <p>So the above constructor will thrown an error because I'm not supplying the generic type.</p> <p>So how do I pass in the type of the property in?</p>
[ { "answer_id": 196945, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "var properties = this.GetType().GetProperties();\nforeach (PropertyInfo p in properties)\n{\n object value = typeof...
2008/10/13
[ "https://Stackoverflow.com/questions/196936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11388/" ]
196,946
<p>I was trying the following example, but with external URLs: <a href="http://android-developers.blogspot.com/2008/09/using-webviews.html" rel="nofollow noreferrer">Using WebViews</a></p> <p>The example shows how to load an HTML file from assets folder (<code>file:// url</code>) and display it in a WebView. </p> <p>But when I try it with external URLs (like <a href="http://google.com" rel="nofollow noreferrer">http://google.com</a>), I am always getting a "Website Not Available" error. Android's built-in browser is able to access all external URLs. </p> <p>I suspect that it has something to do with permissions, but wasn't able to confirm it.</p>
[ { "answer_id": 198662, "author": "Tahir Akhtar", "author_id": 18027, "author_profile": "https://Stackoverflow.com/users/18027", "pm_score": 6, "selected": true, "text": "<uses-permission android:name=\"android.permission.INTERNET\"></uses-permission>\n" }, { "answer_id": 679774, ...
2008/10/13
[ "https://Stackoverflow.com/questions/196946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18027/" ]
196,949
<p>I have an application that I have to run as Administrator.</p> <p>One small part of that application is to start other applications with Process.Start</p> <p>The started applications will also be run as administrators, but I'd rather see them run as the 'normal' user.</p> <p>How do I accomplish that?</p> <p>/johan/</p>
[ { "answer_id": 196959, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 3, "selected": false, "text": "//---------------------------------------------------------------------\n// This file is part of the Microsoft .NET...
2008/10/13
[ "https://Stackoverflow.com/questions/196949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21761/" ]
196,960
<p>I have a dict, which I need to pass key/values as keyword arguments.. For example..</p> <pre><code>d_args = {'kw1': 'value1', 'kw2': 'value2'} example(**d_args) </code></pre> <p>This works fine, <em>but</em> if there are values in the d_args dict that are not accepted by the <code>example</code> function, it obviously dies.. Say, if the example function is defined as <code>def example(kw2):</code></p> <p>This is a problem since I don't control either the generation of the <code>d_args</code>, or the <code>example</code> function.. They both come from external modules, and <code>example</code> only accepts some of the keyword-arguments from the dict..</p> <p>Ideally I would just do</p> <pre><code>parsed_kwargs = feedparser.parse(the_url) valid_kwargs = get_valid_kwargs(parsed_kwargs, valid_for = PyRSS2Gen.RSS2) PyRSS2Gen.RSS2(**valid_kwargs) </code></pre> <p>I will probably just filter the dict, from a list of valid keyword-arguments, but I was wondering: <strong>Is there a way to programatically list the keyword arguments the a specific function takes?</strong></p>
[ { "answer_id": 196978, "author": "DzinX", "author_id": 18745, "author_profile": "https://Stackoverflow.com/users/18745", "pm_score": 5, "selected": false, "text": "def func(one, two=\"value\"):\n y = one, two\n return y\nprint func.func_code.co_varnames[:func.func_code.co_argcount]...
2008/10/13
[ "https://Stackoverflow.com/questions/196960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
196,966
<p>I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application I'm building, but I can't figure out how it's supposed to fit, or what the best practice is. I want to do the following:</p> <pre><code>$().ready(function() { $('#searchHolder').customSearch('MyApp.Models.User'); }); </code></pre> <p>As long as I have implemented a specific interface on Models.User, jQuery will be able to talk to a reflection service to generically construct the relevant UI.</p> <p>Sounds fun, but it seems that I'm now calling the JavaScript from the View, which is in turn going to do some View-related activity to build the search UI, and then to do the search and interact with the user it's going to throw a bunch of Controller tasks in there.</p> <p>So where does this really fit? Is there a different way I can structure my jQuery plugin so that it conforms more to the idea of MVC? Does MVC work when it scales down to its own form <em>within</em> another MVC structure? Should I just ignore these issues for the sake of one plugin?</p>
[ { "answer_id": 200410, "author": "roryf", "author_id": 270, "author_profile": "https://Stackoverflow.com/users/270", "pm_score": 1, "selected": false, "text": "partials" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/196966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
196,972
<p>Is there a simple way to convert a string to Title Case? E.g. <code>john smith</code> becomes <code>John Smith</code>. I'm not looking for something complicated like <a href="http://ejohn.org/blog/title-capitalization-in-javascript/" rel="noreferrer">John Resig's solution</a>, just (hopefully) some kind of one- or two-liner.</p>
[ { "answer_id": 196989, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 3, "selected": false, "text": "var toMatch = \"john w. smith\";\nvar result = toMatch.replace(/(\\w)(\\w*)/g, function (_, i, r) {\n return i.toUpper...
2008/10/13
[ "https://Stackoverflow.com/questions/196972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1896/" ]
196,976
<p>I have an old project that was built using visual studio 2003 and I recompiled it with vs2005 recently. However, during runtime, I get the following error:</p> <p>list iterator not incrementable</p> <p>I traced the program to this function:</p> <pre><code>void InputQueue::update() { list&lt;PCB&gt;::iterator iter; list&lt;PCB&gt;::iterator iterTemp; for(iter = begin(); iter != end(); iter++) { if(iter-&gt;arrivalTime == 0) { ReadyQueue::getInstance()-&gt;add(*iter); iterTemp = iter; iter++; erase(iterTemp); } } } </code></pre> <p>I'm not a C++ expert and this is as far as the VS debugger got me. Could somebody explain to me what the problem is?</p> <p>Thanks</p>
[ { "answer_id": 196988, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": false, "text": "iter->arrivalTime == 0" }, { "answer_id": 196994, "author": "1800 INFORMATION", "author_id": 3146, "auth...
2008/10/13
[ "https://Stackoverflow.com/questions/196976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
196,980
<p>The rich text editor must be implemented in Java, provide Swing support, and preferably be open source.</p> <p>I'm looking to integrate it into an existing Java/Swing application. </p> <p>Thanks.</p>
[ { "answer_id": 197036, "author": "dalyons", "author_id": 16925, "author_profile": "https://Stackoverflow.com/users/16925", "pm_score": 5, "selected": false, "text": "jpane.getSelectionStart()" }, { "answer_id": 2736329, "author": "user328744", "author_id": 328744, "au...
2008/10/13
[ "https://Stackoverflow.com/questions/196980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27344/" ]
196,993
<p>i have a wordpress blog and want to give people the same user experience for adding comments that is in stackoverflow. There are a number of comments ajax plugins out there but i can't find a working one that allows you to inline on the main page, go in and add comments without first drilling down into a seperate single post page.</p> <p>Can anyone help here with either a wordpress plugin or php code to do this.</p>
[ { "answer_id": 207140, "author": "coderGeek", "author_id": 28426, "author_profile": "https://Stackoverflow.com/users/28426", "pm_score": 4, "selected": true, "text": "<?php the_content(''); ?>\n" }, { "answer_id": 1082189, "author": "anshul", "author_id": 17674, "auth...
2008/10/13
[ "https://Stackoverflow.com/questions/196993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
197,009
<p>A python script is running two parallel python processes ( created via os.fork() ) each of which eventually tries to check out a subversion repository leaf into the same working copy dir.</p> <p>Before running 'svn co ...' command in a sub-process ( via python subprocess module ) the parent python code checks if the working copy dir already exists. </p> <pre><code> if os.path.isdir(checkout_dir): # working copy dir already exists return checkout_dir </code></pre> <p>So that if it does there shouldn't be any 'svn co' running, but rather immediate return from the parent function.</p> <p>Nevertheless some collision happened and one of the python processes failed on 'svn co ..' with the following error.</p> <pre><code>checked-out failed: svn: Working copy '/tmp/qm_23683' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)** </code></pre> <p>So the first question is why the working copy dir existence check didn't work and the second - is there a way to find out that a working copy dir is locked by svn and loop until it is unlocked?</p> <p>Thanks.</p>
[ { "answer_id": 199791, "author": "zaphod", "author_id": 13871, "author_profile": "https://Stackoverflow.com/users/13871", "pm_score": 3, "selected": true, "text": "svn" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/140995/" ]
197,027
<p>I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown boxes (date time pickers and the rest)?.</p> <p>I also don't know what structure I should pass to my view for giving the values to the dropdown box. I assume I need both an id and a description.</p> <p>Finally, how do I pass the selected id from the dropdown box back to my action in the controller?</p>
[ { "answer_id": 197549, "author": "Elijah Manor", "author_id": 4481, "author_profile": "https://Stackoverflow.com/users/4481", "pm_score": 1, "selected": false, "text": "<%= Html.DropDownList(\"Select One\", \"CategoryId\", ViewData.Model.Categories, \"Id\", \"Name\", ViewData.Model.Selec...
2008/10/13
[ "https://Stackoverflow.com/questions/197027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2812/" ]
197,028
<p>neither</p> <pre><code>&lt;?php system('php file.php'); ?&gt; </code></pre> <p>nor</p> <pre><code>&lt;?php system('/usr/bin/php file.php'); ?&gt; </code></pre> <p>worked. Why?</p> <p>I tried with <code>-q</code>, with <code>!#/usr/bin/php</code> etc.</p>
[ { "answer_id": 197034, "author": "Vegard Larsen", "author_id": 1606, "author_profile": "https://Stackoverflow.com/users/1606", "pm_score": 2, "selected": false, "text": "<?php system('/usr/bin/php -f file.php'); ?>\n" }, { "answer_id": 197038, "author": "Tahir Akhtar", "a...
2008/10/13
[ "https://Stackoverflow.com/questions/197028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7398/" ]
197,033
<p>Where is the location of my oracle event log (on a default Linux installation)?</p>
[ { "answer_id": 197108, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 5, "selected": true, "text": "select value from v$parameter where name = 'background_dump_dest'\n" }, { "answer_id": 197120, "author": "And...
2008/10/13
[ "https://Stackoverflow.com/questions/197033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27346/" ]
197,045
<p>Is it possible to set a default value for columns in JPA, and if, how is it done using annotations?</p>
[ { "answer_id": 375202, "author": "Cameron Pope", "author_id": 1385388, "author_profile": "https://Stackoverflow.com/users/1385388", "pm_score": 9, "selected": true, "text": "columnDefinition" }, { "answer_id": 1013520, "author": "Pablo Venturino", "author_id": 16732, ...
2008/10/13
[ "https://Stackoverflow.com/questions/197045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16152/" ]
197,047
<p>What is the difference between <code>&lt;% %&gt;</code> and <code>&lt;%= %&gt;</code> in ASP.NET MVC? And when to use which?</p>
[ { "answer_id": 197055, "author": "Erik van Brakel", "author_id": 909, "author_profile": "https://Stackoverflow.com/users/909", "pm_score": 3, "selected": false, "text": "protected string SayHello()\n{\n return \"Hello!\";\n}\n" }, { "answer_id": 197090, "author": "Keith", ...
2008/10/13
[ "https://Stackoverflow.com/questions/197047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
197,048
<p>Now that <code>shared_ptr</code> is in tr1, what do you think should happen to the use of <code>std::auto_ptr</code>? They both have different use cases, but all use cases of <code>auto_ptr</code> can be solved with <code>shared_ptr</code>, too. Will you abandon <code>auto_ptr</code> or continue to use it in cases where you want to express explicitly that only one class has ownership at any given point?</p> <p>My take is that using <code>auto_ptr</code> can add clarity to code, precisely by adding nuance and an indication of the design of the code, but on the other hand, it add yet another subtle issue when training new programmers: they need to understand smart pointers and the fine details of how they work. When you use only one smart pointer everywhere, you can just lay down a rule 'wrap all pointers in <code>shared_ptr</code>' and be done with it.</p> <p>What's your take on this?</p>
[ { "answer_id": 197054, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 2, "selected": false, "text": "shared_ptr" }, { "answer_id": 197083, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "...
2008/10/13
[ "https://Stackoverflow.com/questions/197048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11449/" ]
197,057
<p>Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example?</p>
[ { "answer_id": 197588, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": false, "text": "-cp tools.jar" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15441/" ]
197,059
<p>What is the most efficient way of turning the list of values of a dictionary into an array?</p> <p>For example, if I have a <code>Dictionary</code> where <code>Key</code> is <code>String</code> and <code>Value</code> is <code>Foo</code>, I want to get <code>Foo[]</code></p> <p>I am using VS 2005, C# 2.0</p>
[ { "answer_id": 197062, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 8, "selected": true, "text": "// dict is Dictionary<string, Foo>\n\nFoo[] foos = new Foo[dict.Count];\ndict.Values.CopyTo(foos, 0);\n\n// or in C# 3.0:...
2008/10/13
[ "https://Stackoverflow.com/questions/197059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
197,070
<p>Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code?</p> <p>eg getting the AST for:</p> <hr> <h2>Class1.java</h2> <pre><code>package parseable; public class Class1 { /** * @param args */ public static void main(String[] args) { System.out.println("Hello world!"); } </code></pre> <p>}</p>
[ { "answer_id": 6565258, "author": "johncip", "author_id": 353434, "author_profile": "https://Stackoverflow.com/users/353434", "pm_score": 1, "selected": false, "text": "// get an ICompilationUnit by some means\n// you might drill down from an IJavaProject, for instance \nICompilationUnit...
2008/10/13
[ "https://Stackoverflow.com/questions/197070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15441/" ]
197,081
<p>How can I do the Ruby method <a href="http://www.ruby-doc.org/core/classes/Array.html#M002241" rel="noreferrer">"Flatten" Ruby Method</a> in C#. This method flattens a jagged array into a single-dimensional array.</p> <p>For example:</p> <pre><code>s = [ 1, 2, 3 ] #=&gt; [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=&gt; [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=&gt; [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] a.flatten #=&gt; [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 </code></pre>
[ { "answer_id": 197087, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 5, "selected": true, "text": "IEnumerable Flatten(IEnumerable array)\n{\n foreach(var item in array)\n {\n if(item is IEnumerable)\...
2008/10/13
[ "https://Stackoverflow.com/questions/197081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4455/" ]
197,088
<p>In WPF, there are two ways to set the focus to an element.<br> You can either call the .Focus() method of the input element, or call Keyboard.Focus() with the input element as parameter.</p> <pre><code>// first way: item.Focus(); // alternate way: Keyboard.Focus(item); </code></pre> <p>What is the difference between these two? Are there special reasons to use one of them instead of the other in some cases?<br> So far I noticed no difference - what ever method I used, the item always got logical focus as well as keyboard focus.</p>
[ { "answer_id": 197309, "author": "decasteljau", "author_id": 12082, "author_profile": "https://Stackoverflow.com/users/12082", "pm_score": 0, "selected": false, "text": "DependencyObject focusScope = FocusManager.GetFocusScope(item);\nif (FocusManager.GetFocusedElement(focusScope) == nul...
2008/10/13
[ "https://Stackoverflow.com/questions/197088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
197,095
<p>The following code has a simple binding which binds the Text of the TextBlock named MyTextBlock to TextBox's Text and ToolTip property using the exact same Binding notation:</p> <pre><code>&lt;StackPanel&gt; &lt;TextBlock x:Name="MyTextBlock"&gt;Foo Bar&lt;/TextBlock&gt; &lt;TextBox Text="{Binding ElementName=MyTextBlock, Path=Text, StringFormat='It is: \{0\}'}" ToolTip="{Binding ElementName=MyTextBlock, Path=Text, StringFormat='It is: \{0\}'}" /&gt; &lt;/StackPanel&gt; </code></pre> <p>The binding also uses the <a href="http://blogs.msdn.com/llobo/archive/2008/05/19/wpf-3-5-sp1-feature-stringformat.aspx" rel="noreferrer">StringFormat property introduced with .NET 3.5 SP1</a> which is working fine for the above Text property but seems to be broken for the ToolTip. The expected result is "It is: Foo Bar" but when you hover over the TextBox, the ToolTip shows only the binding value, not the string formatted value. Any ideas?</p>
[ { "answer_id": 197130, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 7, "selected": false, "text": "<TextBox ...>\n <TextBox.ToolTip>\n <ToolTip \n Content=\"{Binding ElementName=myTextBlock,Path=Text}\"\n ...
2008/10/13
[ "https://Stackoverflow.com/questions/197095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39/" ]
197,096
<p>In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possible in SQL and how can I realize this?</p>
[ { "answer_id": 197138, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": true, "text": " select convert(varchar(8), dateadd(second, [SecondsColumn], 0), 108)\n" }, { "answer_id": 197143, "author": "A...
2008/10/13
[ "https://Stackoverflow.com/questions/197096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
197,097
<p>I'm having a bit of trouble with the UTL_MAIL package in Oracle 10g, and was wondering if anyone had any solutions?</p> <p>I connect to my DB as SYSMAN and load the following two scripts;</p> <p><strong>@C:\oracle\product\10.2.0\db_1\rdbms\admin\utlmail.sql</strong></p> <p><strong>@C:\oracle\product\10.2.0\db_1\rdbms\admin\prvtmail.plb</strong></p> <p>I set up the SMTP server;</p> <p><strong>ALTER SYSTEM SET smtp_out_server='mymailserver.fake:25' SCOPE=BOTH;</strong></p> <p>I grant the user the required permission;</p> <p><strong>GRANT execute ON utl_mail TO MYUSER;</strong></p> <p>But then if I connect to the "MYTABLESPACE" (where MYUSER exists), I get the following error if I make reference to UTL_MAIL.SEND;</p> <p><strong>PLS-00201: identifier 'UTL_MAIL.SEND' must be declared</strong></p> <p>If I prefix it with SYSMAN though (SYSMAN.UTL_MAIL.SEND), it works, but I don't want to do this as this procedure that contains this call has no knowledge of the tablespace which installed the scripts.</p> <p>Is there a way to install these scripts so that they are accessible universally, and do not require the SYSMAN prefix to execute?</p> <p>Cheers,</p> <p>Chris</p>
[ { "answer_id": 197103, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 2, "selected": false, "text": "CREATE PUBLIC SYNONYM UTL_MAIL FOR SYSMAN.UTL_MAIL;\n" }, { "answer_id": 197197, "author": "cagcowboy", ...
2008/10/13
[ "https://Stackoverflow.com/questions/197097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5827/" ]
197,099
<p>I'm trying to select data from a table defined similar to the following :</p> <pre><code>Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML </code></pre> <p>but I only want to select those rows with a specific DataType value, and that contain a string (or evaluates a piece of XPath) in the LoggedData column.</p> <p>A quick Google search turned up nothing useful, and I am in a bit of a rush to get an answer... I'll carry on searching, but if anyone can help me out on this in the mean time, I'd really appreciate it.</p> <p><strong>EDIT</strong> _ Clarification</p> <p>So, what I'm after is something like this, but in the correct format...</p> <pre><code>select Id, LoggedData from myTable where DataType = 29 and LoggedData.query('RootNode/ns1:ChildNode[@value="searchterm"]'); </code></pre> <p>Still might not be clear...</p>
[ { "answer_id": 197106, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "SELECT\n Id, \n LoggedData \nFROM\n myTable \nWHERE\n DataType = 29 \n AND LoggedData.exist('RootNode/ns1:ChildNode[@...
2008/10/13
[ "https://Stackoverflow.com/questions/197099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/377/" ]
197,111
<p>What is an example of a fast SQL to get duplicates in datasets with hundreds of thousands of records. I typically use something like:</p> <pre><code>SELECT afield1, afield2 FROM afile a WHERE 1 &lt; (SELECT count(afield1) FROM afile b WHERE a.afield1 = b.afield1); </code></pre> <p>But this is quite slow.</p>
[ { "answer_id": 197114, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 7, "selected": true, "text": "select afield1,count(afield1) from atable \ngroup by afield1 having count(afield1) > 1\n" }, { "answer_id": 1...
2008/10/13
[ "https://Stackoverflow.com/questions/197111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3535708/" ]
197,112
<p>This <a href="http://my.php.net/static" rel="nofollow noreferrer">example</a> is from php.net:</p> <pre><code>&lt;?php function Test() { static $a = 0; echo $a; $a++; } ?&gt; </code></pre> <p>And this is my code:</p> <pre><code>function getNextQuestionID() { static $idx = 0; return $idx++; } </code></pre> <p>And I use it in JavaScript:</p> <pre><code>'quizID=' + "&lt;?php echo getNextQuestionID(); ?&gt;" </code></pre> <p>Returns 0 everytime. Why?</p>
[ { "answer_id": 197126, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": true, "text": "echo getNextQuestionID() . \", \" getNextQuestionID() . \", \" getNextQuestionID();\n" }, { "answer_id": 197600, "a...
2008/10/13
[ "https://Stackoverflow.com/questions/197112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15345/" ]
197,121
<p>I'm trying to do the following without too much special case code to deal with invalidated POSITIONs etc:</p> <p>What's the best way to fill in the blanks?</p> <pre><code>void DeleteUnreferencedRecords(CAtlMap&lt;Record&gt;&amp; records) { for(____;____;____) { if( NotReferencedElsewhere(record) ) { // Delete record _______; } } } </code></pre>
[ { "answer_id": 197209, "author": "Rob", "author_id": 9236, "author_profile": "https://Stackoverflow.com/users/9236", "pm_score": 0, "selected": false, "text": "GetNext" }, { "answer_id": 198050, "author": "Head Geek", "author_id": 12193, "author_profile": "https://Sta...
2008/10/13
[ "https://Stackoverflow.com/questions/197121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11898/" ]
197,122
<p>I am fairly new to WPF. I want to develop a datagrid control which supports databinding.</p> <p>There is a lot of information available about databinding to existing controls, but I cannot find any information how to develop a control from scratch which supports databinding. </p> <p>I do not expect a simple answer to this question, a link to get me started would be nice.</p>
[ { "answer_id": 249080, "author": "Scott Weinstein", "author_id": 25201, "author_profile": "https://Stackoverflow.com/users/25201", "pm_score": 0, "selected": false, "text": "AffectsArrange" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10329/" ]
197,127
<p>How do I make my application always use English when displaying win32/.net exceptions messages?</p> <p>I got this message, it looks like someone used babelfish to translate it (it's Swedish): "System.ComponentModel.Win32Exception: Programmet kunde inte starta eftersom programmets sida-vid-sidakonfiguration är felaktig."</p> <p>Extremely unhelpful, and Google had a whopping 4 hits for it, none of them helpful. So I have to guess what the original message was and google that. (It's was: "The application has failed to start because its side-by-side configuration is incorrect.")</p> <p>This time it was fairly simple to find out what the original error message was, having the message in English from the start would of course save me time.</p> <p>So how do I do that?</p>
[ { "answer_id": 197141, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 4, "selected": true, "text": "Thread.CurrentThread.CurrentUICulture" }, { "answer_id": 197262, "author": "Joe", "author_id": 130...
2008/10/13
[ "https://Stackoverflow.com/questions/197127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17413/" ]
197,135
<p>My application is implemented as a service (running under services.exe). I am adding a new feature which requires being notified when the user sends an SMS.</p> <p>I have tried using <code>IMAPIAdviseSink</code>, registering with both <code>IMAPISession</code> and <code>IMsgStore</code>, but I do not get any notifications.</p> <p>The other options I can see are to create a Short Message Service Provider or to implement the <code>IFormProviderEx</code> interface, but I am not sure about the impact this might have on SMS functionality and the user experience.</p> <p>Is there any way in which my application can reliably get notifications of SMSs being created in the Outbox?</p> <p>edit: The app is written in native C++. I've looked into RIL and several other APIs, but I can only find information about getting notified of incoming SMSs.</p> <p>OK, some more information: The same code for registering my <code>IMAPIAdviseSink</code> works in a stand alone app. It's only failing to get notifications in the service.</p> <p>Is there anyway to get notifications in my service? Or do I need a separate process to monitor SMS events and notify my service?</p> <p>Mark</p>
[ { "answer_id": 207796, "author": "Mark Cheeseborough", "author_id": 13570, "author_profile": "https://Stackoverflow.com/users/13570", "pm_score": 3, "selected": true, "text": "IMAPIAdviseSink" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13570/" ]
197,150
<p>I can write a trivial script to do this but in my ongoing quest to get more familliar with unix I'd like to learn efficient methods using built in commands instead.</p> <p>I need to deal with very large files that have a variable number of header lines. the last header line consists of the text 'LastHeaderLine'. I wish to output everything after this line. (I'm not worried about false positive matches.)</p>
[ { "answer_id": 197169, "author": "Avi", "author_id": 1605, "author_profile": "https://Stackoverflow.com/users/1605", "pm_score": 4, "selected": false, "text": "sed -ne '/LastHeaderLine/,$p' <inputfile\n" }, { "answer_id": 197175, "author": "Ralph M. Rickenbach", "author_i...
2008/10/13
[ "https://Stackoverflow.com/questions/197150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
197,162
<p>How does Windows with NTFS perform with large volumes of files and directories?</p> <p>Is there any guidance around limits of files or directories you can place in a single directory before you run into performance problems or other issues? </p> <p>E.g. is having a folder with 100,000 folders inside of it an OK thing to do?</p>
[ { "answer_id": 26205776, "author": "Spoc", "author_id": 3746069, "author_profile": "https://Stackoverflow.com/users/3746069", "pm_score": 5, "selected": false, "text": "(FOPS = File Operations per Second)\n(DOPS = Directory Operations per Second)\n\n#Files lg(#) FOPS FOPS2 DOPS ...
2008/10/13
[ "https://Stackoverflow.com/questions/197162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11829/" ]
197,164
<p>In my views I use a helper that takes arbitrary HTML as a block:</p> <pre><code>&lt;% some_block_helper do %&gt; Some arbitrary HTML and ERB variables here. More HTML here. &lt;% end %&gt; </code></pre> <p>My helper does a bunch of things to the passed block of HTML before rendering it back to the view (Markdown and other formatting). I would like to know what are the cleanest ways of testing the result of the helper call in rSpec, if any. I've found a few examples that muck about with private methods of ERB but that seems a bit brittle and hard to read.</p>
[ { "answer_id": 249295, "author": "Cameron Booth", "author_id": 14873, "author_profile": "https://Stackoverflow.com/users/14873", "pm_score": 3, "selected": false, "text": "describe SomeHelper do\n it 'should do something' do\n helper.some_block_helper { the_block_code }.should XXXX\n...
2008/10/13
[ "https://Stackoverflow.com/questions/197164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21702/" ]
197,170
<p>When I <kbd>Alt</kbd>+<kbd>Tab</kbd> to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has the focus rather then the application inside it, if you do <kbd>ctrl</kbd>+<kbd>Z</kbd> (normally for undo) it <strong>suspends</strong> the VM.</p> <p>This is driving me barmey. I have looked through all the options and preferences in VMWare Server and can't find anyway to disable this.</p> <p>Anyone know how to disable this?</p>
[ { "answer_id": 197186, "author": "Argalatyr", "author_id": 18484, "author_profile": "https://Stackoverflow.com/users/18484", "pm_score": 2, "selected": false, "text": "vmware.exe" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26792/" ]
197,171
<p>Not too long ago, I had a problem which required me to <a href="https://stackoverflow.com/questions/186237/program-only-crashes-as-release-build-how-to-debug">set WinDbg.exe as the default post-mortem debugger</a>. Now that I've fixed that and am back doing normal work, it would be really nice if I could set VS to be my default post-mortem debugger. How does one go about doing this?</p> <p>Also, how do I make VS attach to an already existing session? That is, I've got my VS project open in one window, and a command line open where I'm launching my program from. If the program crashes, how do I get VS to figure out to attach the debugger to the active line in the project that's already open?</p>
[ { "answer_id": 197208, "author": "MvdD", "author_id": 18044, "author_profile": "https://Stackoverflow.com/users/18044", "pm_score": 4, "selected": true, "text": "1. Start Registry Editor and locate the following Registry subkey in the HKEY_LOCAL_MACHINE subtree:\n\n\\SOFTWARE\\MICROSOFT...
2008/10/13
[ "https://Stackoverflow.com/questions/197171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14302/" ]
197,190
<p>So, I understand <i>that</i> the following doesn't work, but <i>why</i> doesn't it work?</p> <pre><code>interface Adapter&lt;E&gt; {} class Adaptulator&lt;I&gt; { &lt;E, A extends I &amp; Adapter&lt;E&gt;&gt; void add(Class&lt;E&gt; extl, Class&lt;A&gt; intl) { addAdapterFactory(new AdapterFactory&lt;E, A&gt;(extl, intl)); } } </code></pre> <p>The <code>add()</code> method gives me a compile error, "Cannot specify any additional bound Adapter&lt;E&gt; when first bound is a type parameter" (in Eclipse), or "Type parameter cannot be followed by other bounds" (in IDEA), take your pick.</p> <p>Clearly you're just Not Allowed to use the type parameter <code>I</code> there, before the <code>&amp;</code>, and that's that. (And before you ask, it doesn't work if you switch 'em, because there's no guarantee that <code>I</code> isn't a concrete class.) But why not? I've looked through Angelika Langer's FAQ and can't find an answer.</p> <p>Generally when some generics limitation seems arbitrary, it's because you've created a situation where the type system can't actually enforce correctness. But I don't see what case would break what I'm trying to do here. I'd say maybe it has something to do with method dispatch after type erasure, but there's only one <code>add()</code> method, so it's not like there's any ambiguity...</p> <p>Can someone demonstrate the problem for me?</p>
[ { "answer_id": 197391, "author": "Bruno De Fraine", "author_id": 6918, "author_profile": "https://Stackoverflow.com/users/6918", "pm_score": 6, "selected": true, "text": "max" }, { "answer_id": 210992, "author": "Chris Povirk", "author_id": 28465, "author_profile": "h...
2008/10/13
[ "https://Stackoverflow.com/questions/197190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27358/" ]
197,199
<p>We're running a Rails site at <a href="http://hansard.millbanksystems.com" rel="nofollow noreferrer">http://hansard.millbanksystems.com</a>, on a dedicated Accelerator. We currently have Apache setup with mod-proxy-balancer, proxying to four mongrels running the application.</p> <p>Some requests are rather slow and in order to prevent the situation where other requests get queued up behind them, we're considering options for proxying that will direct requests to an idle mongrel if there is one.</p> <p>Options appear to include:</p> <ul> <li><p>recompiling mod_proxy_balancer for Apache as described at <a href="http://labs.reevoo.com/2008/7/30/fixing-uneven-load-balancing-between-apache-and-mongrel-for-ruby-on-rails-applications" rel="nofollow noreferrer">http://labs.reevoo.com/</a></p></li> <li><p>compiling nginx with the fair proxy balancer for Solaris</p></li> <li><p>compiling haproxy for Open Solaris (although this may not work well with SMF)</p></li> </ul> <p>Are these reasonable options? Have we missed anything obvious? We'd be very grateful for your advice.</p>
[ { "answer_id": 393331, "author": "James Brady", "author_id": 29903, "author_profile": "https://Stackoverflow.com/users/29903", "pm_score": 2, "selected": false, "text": "mod_proxy_balancer" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20035/" ]
197,211
<p>what is the best way to put a container class or a some other class inside a class as private or a public member?</p> <p>Requirements:</p> <p>1.Vector&lt; someclass> inside my class</p> <p>2.Add and count of vector is needed interface</p>
[ { "answer_id": 197250, "author": "xtofl", "author_id": 6610, "author_profile": "https://Stackoverflow.com/users/6610", "pm_score": 1, "selected": false, "text": "vector" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
197,215
<p>Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client?</p> <p>As an example:</p> <p>Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages of pdf, watermarked pdf is returned to client.</p> <p>Regards, Mike </p>
[ { "answer_id": 197272, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 2, "selected": false, "text": "mod_proxy" } ]
2008/10/13
[ "https://Stackoverflow.com/questions/197215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27376/" ]
197,218
<p>I am trying to get system date in a C program on a MSVC++ 6.0 compiler. I am using a system call:</p> <p><strong>system("date /T")</strong> (output is e.g. 13-Oct-08 which is date on my system in the format i have set) </p> <p>but this prints the date to the i/o console. </p> <p>How do i make take this date as returned by above system call and store it as a string value to a string defined in my code? Or </p> <p>Is there any other API i can use to get the date in above mentioned format (13-Oct-08, or 13-10-08) ?</p> <p>-AD</p>
[ { "answer_id": 197230, "author": "Constantin", "author_id": 20310, "author_profile": "https://Stackoverflow.com/users/20310", "pm_score": 1, "selected": false, "text": "#include <windows.h>\n#include <iostream>\n\nint main() {\n\n SYSTEMTIME systmDateTime = {};\n ::GetLocalTime(&systmD...
2008/10/13
[ "https://Stackoverflow.com/questions/197218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2759376/" ]
197,220
<p>I've got an ASP.NET 2.0 website that connects to a SQL database. I've upgraded the SQL server from 2000 to 2008 and since then, one page refuses to work. </p> <p>I've worked out the problem is that the call to SqlDataReader.HasRows is returning false even though the dataset is not empty and removing the check allows the loop through reader.Read() to access the expected data. </p> <pre><code> _connectionString = WebConfigurationManager.ConnectionStrings["SQLServer"].ConnectionString; SqlConnection connection = new SqlConnection(_connectionString); SqlCommand command = new SqlCommand(searchtype, connection); SqlParameter _parSeachTerm = new SqlParameter("@searchterm", SqlDbType.VarChar, 255); _parSeachTerm.Value = searchterm; command.Parameters.Add(_parSeachTerm); command.CommandType = CommandType.StoredProcedure; try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) //this always returns false!? { while (reader.Read()) {... </code></pre> <p>Does anybody have any idea what's going on? There are similar code blocks on other pages where HasRows returns the correct value.</p> <p>EDIT- Just to clarify, the stored procedure DOES return results which I have confirmed because the loop runs through fine if I remove the HasRows check. Changing just the name of the SQL server in the connection string to an identical database running on SQL 2000 makes the problem go away. I've checked that NOCOUNT is off, so what else could make HasRows return false when that's not the case??</p> <p>EDIT2- Here's the SP</p> <pre><code>CREATE PROCEDURE StaffEnquirySurnameSearch @searchterm varchar(255) AS SELECT AD.Name, AD.Company, AD.telephoneNumber, AD.manager, CVS.Position, CVS.CompanyArea, CVS.Location, CVS.Title, AD.guid AS guid, AD.firstname, AD.surname FROM ADCVS AD LEFT OUTER JOIN CVS ON AD.Guid=CVS.Guid WHERE AD.SurName LIKE @searchterm ORDER BY AD.Surname, AD.Firstname GO </code></pre> <p>Many thanks in advance.</p>
[ { "answer_id": 197964, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 1, "selected": false, "text": "HasRows" }, { "answer_id": 198127, "author": "shahkalpesh", "author_id": 23574, "author_profile": ...
2008/10/13
[ "https://Stackoverflow.com/questions/197220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27377/" ]
197,224
<p>I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?</p>
[ { "answer_id": 468475, "author": "patmortech", "author_id": 19090, "author_profile": "https://Stackoverflow.com/users/19090", "pm_score": 8, "selected": false, "text": "pre-revprop-change.bat" }, { "answer_id": 4876694, "author": "Philibert Perusse", "author_id": 7984, ...
2008/10/13
[ "https://Stackoverflow.com/questions/197224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
197,228
<p>I'm using the jquery library to load the content of an html file. Something like this:</p> <p>$("#Main").load("login.html")</p> <p>If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or not?</p>
[ { "answer_id": 197237, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 5, "selected": true, "text": "$(\"#someDivId\").ajaxComplete(function(request, settings){\n if (settings.status===404){\n //redirect here\n ...
2008/10/13
[ "https://Stackoverflow.com/questions/197228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15928/" ]