qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
184,272
<p>What exactly does the word patch mean when referring to 'submitting a patch'?</p> <p>I've seen this used a lot, especially in the open source world. What what does it mean and what exactly is involved in submitting a patch?</p>
[ { "answer_id": 184277, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 5, "selected": true, "text": "<?php\n $foo = 0;\n?>\n" }, { "answer_id": 184284, "author": "Jim Puls", "author_id": 6010, "author_prof...
2008/10/08
[ "https://Stackoverflow.com/questions/184272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13227/" ]
184,292
<p>I am wondering what the correct mechanism to enable communication between controls in WPF is. My goal is to not use conventional events and have to manually wire them up. The default behavior of routed commands (tunneling, bubbling) seems to be along the right lines but I guess I'm missing something.</p> <blockquote> <p>Routed events are a new infrastructure provided by WPF which allows events to tunnel down the visual tree to the target element, or bubble up to the root element. When an event is raised, it “travels” up or down the visual tree invoking handlers for that event on any element subscribed to that event it encounters en route. <strong>Note that this tree traversal does not cover the entire visual tree, only the ancestral element</strong> </p> </blockquote> <p>That is from this <a href="http://joshsmithonwpf.wordpress.com/2007/06/22/overview-of-routed-events-in-wpf/" rel="nofollow noreferrer">WPF Article</a></p> <p>Using the image in the article, I want "Immediate Element #1" to initiate (raise) an event and then have "Immediate Element #2" handle that event. I'd like to achieve this without having to put any code in the "Root Element".</p> <p>Basically fire an event (save, status updated, selection changed, etc..) from any where in my app, then have it be handled somewhere else with out the 2 parties knowing anything about each other. Is this possible?</p> <p>I dont believe data bainding is the answer. I'd like to use Routed Events / Commands as they were designed just across the entire tree, not just within the source control's branch. Maybe it can't be done using routed events / commands, and data binding is the answer. I just dont know...</p> <p>Any ideas?</p>
[ { "answer_id": 184314, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 1, "selected": false, "text": "Binding" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
184,309
<p>I know there are <a href="https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files">libraries out there for working with ZIP files</a>. And, you can alternatively <a href="https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-script-able">use the functionality built into Windows for working ZIP files</a>.</p> <p>But, I'm wondering if anyone has worked out how to use the tools built into the System.IO.Compression namespace within .NET for reading/writing ZIP files? Or, is it not possible using only this namespace?</p> <p>UPDATED: I've seem someone comment that the System.IO.Packaging namespace might be usefull with this also. Does anyone know exactly how to do it?</p>
[ { "answer_id": 184529, "author": "Sean Hanley", "author_id": 7290, "author_profile": "https://Stackoverflow.com/users/7290", "pm_score": 0, "selected": false, "text": "myDataSet.WriteXML()" }, { "answer_id": 410397, "author": "Cheeso", "author_id": 48082, "author_prof...
2008/10/08
[ "https://Stackoverflow.com/questions/184309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7831/" ]
184,312
<p>I am building Java web applications, and I hate the traditional "code-compile-deploy-test" cycle. I want to type in one tiny change, then see the result INSTANTLY, without having to compile and deploy.</p> <p>Fortunately, <a href="http://www.mortbay.org/jetty/" rel="noreferrer">Jetty</a> is great for this. It is a pure-java web server. It comes with a really nice <a href="http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin" rel="noreferrer">maven plugin</a> which lets you launch Jetty reading directly from your build tree -- no need to package a war file or deploy. It even has a scanInterval setting: put this to a non-zero value and it will watch your java files and various config files for changes and automatically re-deploy a few seconds after you make a change.</p> <p>There's just one thing keeping me from nirvana. I have javascript and css files in my src/main/webapp directory which just get served up by Jetty. I would like to be able to edit <em>these</em> and have the changes show up when I refresh the page in the browser. Unfortunately, Jetty holds these files open so I can't (on Windows) modify them while it is running.</p> <p>Does anyone know how to make Jetty let go of these files so I can edit them, then serve up the edited files for subsequent requests?</p>
[ { "answer_id": 185675, "author": "Athena", "author_id": 17846, "author_profile": "https://Stackoverflow.com/users/17846", "pm_score": 5, "selected": true, "text": "useFileMappedBuffer" }, { "answer_id": 4985717, "author": "kybernetikos", "author_id": 412335, "author_p...
2008/10/08
[ "https://Stackoverflow.com/questions/184312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14570/" ]
184,313
<p>I have this .NET regex:</p> <pre><code>^(?&lt;prefix&gt;("[^"]*"))\s(?&lt;attrgroup&gt;(\([^\)]*\)))\s(?&lt;suffix&gt;("[^"]*"))$ </code></pre> <p>It properly matches the following strings:</p> <pre><code>"some prefix" ("attribute 1" "value 1") "some suffix" "some prefix" ("attribute 1" "value 1" "attribute 2" "value 2") "some suffix" </code></pre> <p>It fails on...</p> <pre><code>"some prefix" ("attribute 1" "value (fail) 1") "some suffix" </code></pre> <p>...due to the right paren after "fail".</p> <p>How can I modify my regex so that the <code>attrgroup</code> match group will end up containing "<code>("attribute 1" "value (fail) 1")</code>"? I've been looking at it for too long and need some fresh eyes. Thanks!</p> <p><strong>Edit:</strong> <code>attrgroup</code> won't ever contain anything other than pairs of double-quoted strings.</p>
[ { "answer_id": 184392, "author": "hometoast", "author_id": 2009, "author_profile": "https://Stackoverflow.com/users/2009", "pm_score": 1, "selected": false, "text": "^(?<prefix>\"[^\"]*\")\\s+(?<attrgroup>\\(.*\\))\\s+(?<suffix>\"[^\"]*\")$\n" }, { "answer_id": 184451, "autho...
2008/10/08
[ "https://Stackoverflow.com/questions/184313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3447/" ]
184,340
<p>I have an application that manages patient demographic information. Along with this data a user can scan a picture of a patient and assign that picture to a patient. When the user clicks the scan button a separate application is opened as a dialog in order to scan the image. When running this on XP everything worked fine. The imaging application loaded up fine and gained focus. On Vista however occasionally the imaging application will not gain focus and will popup behind the main application. When running full screen or through 2008 Application Server you cannot see the application, you only get a locked screen and it appears nothing has happened. Is there any way to change the window focus management on Vista to work the way XP did? I'm looking for a way to solve this without making changes to the actual application if possible.</p>
[ { "answer_id": 184422, "author": "Bradley Grainger", "author_id": 23633, "author_profile": "https://Stackoverflow.com/users/23633", "pm_score": 1, "selected": false, "text": "ShellExecute" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25511/" ]
184,409
<p>The documentation for <code>+[NSThread detachNewThreadSelector:toTarget:withObject:]</code> says:</p> <blockquote> <p>For non garbage-collected applications, the method <code>aSelector</code> is responsible for setting up an autorelease pool for the newly detached thread and freeing that pool before it exits.</p> </blockquote> <p>My question is, do I need to create my own <code>NSAutoreleasePool</code> in my override of the <code>-[NSOperation main]</code> method, or is the creation of the <code>NSAutoreleasePool</code> handled by <code>NSOperation</code>?</p>
[ { "answer_id": 185954, "author": "Barry Wark", "author_id": 2140, "author_profile": "https://Stackoverflow.com/users/2140", "pm_score": 2, "selected": false, "text": "NSAutoreleasePool" }, { "answer_id": 1606179, "author": "Community", "author_id": -1, "author_profile...
2008/10/08
[ "https://Stackoverflow.com/questions/184409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23028/" ]
184,414
<p>I have one action I want to perform when a TSpeedButton is pressed and another I want to perform when the same button is "unpressed". I know there's no onunpress event, but is there any easy way for me to get an action to execute when a different button is pressed? </p> <pre><code>procedure ActionName.ActionNameExecute(Sender: TObject); begin PreviousActionName.execute(Sender); // end; </code></pre> <p>Seems too clunky.</p>
[ { "answer_id": 185954, "author": "Barry Wark", "author_id": 2140, "author_profile": "https://Stackoverflow.com/users/2140", "pm_score": 2, "selected": false, "text": "NSAutoreleasePool" }, { "answer_id": 1606179, "author": "Community", "author_id": -1, "author_profile...
2008/10/08
[ "https://Stackoverflow.com/questions/184414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1765/" ]
184,431
<p>I'm trying to convert an XML file into the markup used by dokuwiki, using XSLT. This actually works to some degree, but the indentation in the XSL file is getting inserted into the results. At the moment, I have two choices: abandon this XSLT thing entirely, and find another way to convert from XML to dokuwiki markup, or delete about 95% of the whitespace from the XSL file, making it nigh-unreadable and a maintenance nightmare.</p> <p>Is there some way to keep the indentation in the XSL file without passing all that whitespace on to the final document?</p> <p>Background: I'm migrating an autodoc tool from static HTML pages over to dokuwiki, so the API developed by the server team can be further documented by the applications team whenever the apps team runs into poorly-documented code. The logic is to have a section of each page set aside for the autodoc tool, and to allow comments anywhere outside this block. I'm using XSLT because we already have the XSL file to convert from XML to XHTML, and I'm assuming it will be faster to rewrite the XSL than to roll my own solution from scratch.</p> <p><i>Edit: Ah, right, foolish me, I neglected the indent attribute. (Other background note: I am new to XSLT.) On the other hand, I still have to deal with newlines. Dokuwiki uses pipes to differentiate between table columns, which means that all of the data in a table line must be on one line. Is there a way to suppress newlines being outputted (just occasionally), so I can do some fairly complex logic for each table cell in a somewhat readable fasion?</i></p>
[ { "answer_id": 184449, "author": "Lindsay", "author_id": 23520, "author_profile": "https://Stackoverflow.com/users/23520", "pm_score": 2, "selected": false, "text": "<xsl:output method=\"text\" indent=\"no\" />\n" }, { "answer_id": 184931, "author": "Odilon Redo", "author...
2008/10/08
[ "https://Stackoverflow.com/questions/184431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26257/" ]
184,436
<p>I'm working with an old Access database (yes, it's very ugly and I hate it). I need to modify some of the columns from a VB app that I'm creating. I have most the modifications setup correctly, but I'm fighting with the fact that modifying a column to text has it default to "Allow Zero Length" to false.</p> <p>SO ALTER TABLE [Applicant Table] ALTER COLUMN [Applicant ID] Text(255)</p> <p>I need that alter to have "Allow Zero Length" set to true.</p> <p>I have tried ALTER TABLE [Applicant Table] ALTER COLUMN [Applicant ID] Text(255) NULL</p> <p>but that doesn't seem to work either. I've looked all over for the solution, but can't seem to find a straight answer.</p> <p>Any ideas?</p> <p>Thanks, Ryan.</p> <hr> <p>Thanks for the info. I'm glad that it's Access and not me.</p> <p>I guess I'm just going to hack my way through this application since the entire data model is trash anyway.</p>
[ { "answer_id": 184575, "author": "Chris OC", "author_id": 11041, "author_profile": "https://Stackoverflow.com/users/11041", "pm_score": 3, "selected": true, "text": "Public Function setAllowZeroLenStr() \n On Error GoTo Proc_Err\n\n Dim db As Database\n Dim tbl As TableDef\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10420/" ]
184,448
<p>I maintain an application that uses the win32 EnumPorts() function to help determine the set of serial ports installed on the computer. I have seen cases on some computers where the call to get this information fails with a GetLastError() code of 1722 (RPC server is unavailable). I assume that this has something to do with either registry settings or a required service being disabled but my search so far has been rather fruitless. Has anyonw else encountered this issue?</p> <p>In answer to Euro Micelli's comments. I am specifically attempting to fill a pick list that will allow the user to choose an available picklist. To begin with, I relied exclusively on EnumPorts() to provide me a list of potential serial port names. It has proven to be unreliable, however in several senses: It has not always provided the complete set of port names and, as I have recently seen, it can fail to function altogether when the "RPC service is unavailable". Why RPC is needed to find out what ports are available on the local machine is completely beyond me but there it is. This latter problem was the final straw. So far as relying completely on the list of names provided, i filter these names using the GetDefaultCommConfig() function to determine the exact nature of each of the names that I came up with.</p> <p>In my experience, the list of names provided by the previously mentioned registry key has been the most reliable method for getting port names. As a matter of fact, I can see the key get updated as I disable port drivers in the device device manager. Under normal experiences, I would agree with the assessment that relying upon a particular key is fraught with peril. In this case, however, M$ has never provided a decent mechanism to evaluate the names of available ports.</p> <p>I should point out that I have already replaced the call to EnumPorts() with an algorithm that scans the registry key: HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM for serial port names. This should resolve the issue once my software is released. What I am after is pointers that can be given to customers who are using the released package at the present.</p>
[ { "answer_id": 25234746, "author": "Valdar Moridin", "author_id": 2499546, "author_profile": "https://Stackoverflow.com/users/2499546", "pm_score": 0, "selected": false, "text": "RPC Server is unavailable" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19674/" ]
184,456
<p>Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going well, except one procedure used the MySQL <code>SHA1()</code> function. I cannot seem to find an equivalent to this in MS-SQL.</p> <p>Does anyone know a valid equivalent for <code>SHA1()</code> on MS-SQL?</p>
[ { "answer_id": 12207895, "author": "Peter", "author_id": 460053, "author_profile": "https://Stackoverflow.com/users/460053", "pm_score": 5, "selected": false, "text": "SELECT sys.fn_varbintohexsubstring(0, HashBytes('SHA1', 'password'), 1, 0)\n" }, { "answer_id": 65934009, "a...
2008/10/08
[ "https://Stackoverflow.com/questions/184456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5640/" ]
184,471
<p>Replaces Question: <a href="https://stackoverflow.com/questions/184096/update-multiple-rows-into-sql-table">Update multiple rows into SQL table</a></p> <p>Here's a Code Snippet to update an exam results set. DB structure is as given, but I can submit Stored Procedures for inclusion (Which are a pain to modify, so I save that until the end.)</p> <p>The question: Is there a better way using SQL server v 2005.,net 2.0 ?</p> <pre><code>string update = @"UPDATE dbo.STUDENTAnswers SET ANSWER=@answer WHERE StudentID =@ID and QuestionNum =@qnum"; SqlCommand updateCommand = new SqlCommand( update, conn ); conn.Open(); string uid = Session["uid"].ToString(); for (int i= tempStart; i &lt;= tempEnd; i++) { updateCommand.Parameters.Clear(); updateCommand.Parameters.AddWithValue("@ID",uid); updateCommand.Parameters.AddWithValue("@qnum",i); updateCommand.Parameters.AddWithValue("@answer", Request.Form[i.ToString()]); try { updateCommand.ExecuteNonQuery(); } catch { } } </code></pre>
[ { "answer_id": 184503, "author": "Hafthor", "author_id": 4489, "author_profile": "https://Stackoverflow.com/users/4489", "pm_score": -1, "selected": false, "text": "UPDATE s SET ANSWER=a FROM dbo.STUDENTAnswers s JOIN (\n SELECT 1 as q, 'answer1' as a\n UNION ALL SELECT 2, 'answer2' --...
2008/10/08
[ "https://Stackoverflow.com/questions/184471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18907/" ]
184,476
<p>I have been pushing into the .NET framework in PowerShell, and I have hit something that I don't understand. This works fine:</p> <pre><code>$foo = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]" $foo.Add("FOO", "BAR") $foo Key Value --- ----- FOO BAR </code></pre> <p>This however does not:</p> <pre><code>$bar = New-Object "System.Collections.Generic.SortedDictionary``2[System.String,System.String]" New-Object : Cannot find type [System.Collections.Generic.SortedDictionary`2[System.String,System.String]]: make sure t he assembly containing this type is loaded. At line:1 char:18 + $bar = New-Object &lt;&lt;&lt;&lt; "System.Collections.Generic.SortedDictionary``2[System.String,System.String]" </code></pre> <p>They are both in the same assembly, so what am I missing?</p> <p>As was pointed out in the answers, this is pretty much only an issue with PowerShell v1.</p>
[ { "answer_id": 185885, "author": "tomasr", "author_id": 10292, "author_profile": "https://Stackoverflow.com/users/10292", "pm_score": 5, "selected": true, "text": "$bar = new-object \"System.Collections.Generic.Dictionary``2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, Pub...
2008/10/08
[ "https://Stackoverflow.com/questions/184476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1358/" ]
184,482
<p>I display data into an html table, w/ a drop down box with a list of venues. Each volunteer will be assigned a venue. I envision being able to go down thru the html table and assigning each volunteer a venue. The drop down box contains all the possible venues that they can be assigned to.</p> <pre><code>&lt;select&gt; &lt;option value="1"&gt;Setup&lt;/option&gt; &lt;option value="2"&gt;Check in&lt;/option&gt; etc... &lt;/select&gt; </code></pre> <p>Then once I am done assigning each volunteer, I want to hit submit and it will assign the appropriate value for each volunteer.</p> <p>How would I go about doing that, I know how to do that, but only one at a time.</p>
[ { "answer_id": 184517, "author": "Darryl Hein", "author_id": 5441, "author_profile": "https://Stackoverflow.com/users/5441", "pm_score": 0, "selected": false, "text": "UPDATE volunteer SET venue = 1 WHERE id = 2;\nUPDATE volunteer SET venue = 2 WHERE id = 3;\n...\n" }, { "answer_...
2008/10/08
[ "https://Stackoverflow.com/questions/184482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
184,489
<p>I am trying to retrieve an image stored in an oracle blob and place it in a new System.Drawing.Image instance. I know I can write the stream to a temp.bmp file on the disk and read it from there but thats just not l33t enough for me. How do I convert the blob object directly to an image?</p>
[ { "answer_id": 184577, "author": "osp70", "author_id": 2357, "author_profile": "https://Stackoverflow.com/users/2357", "pm_score": 0, "selected": false, "text": "Dim cn As SqlConnection = Nothing\n Dim cmd As SqlCommand = Nothing\n Dim da As SqlDataAdapter = Nothing\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
184,491
<p>We have a Java Applet built using AWT. This applet lets you select pictures from your hard drive and upload them to a server. The applet includes a scrollable list of pictures, which works fine in Windows, Linux and Mac OS X 10.5. We launch this applet via Java Web Start or within a web page. </p> <p>Our applet does not behave properly in Mac OS X 10.4, regardless of the version of Java (1.4 or 1.5). You can find a screenshot of the incorrect behaviour, when scrolling, here:</p> <p><a href="http://www.lavablast.com/tmp/ui_error.png" rel="nofollow noreferrer">http://www.lavablast.com/tmp/ui_error.png</a></p> <p>Simply put, sometimes when scrolling the pictures end up overlapping the header or footer of the application. This behaviour does not occur on other platforms. On Mac OS X 10.4, it shows the pictures in the incorrect location when scrolling, which would not be so bad if it refreshed the screen after painting the image at that location. However, it does not appear that the application knows it painted it incorrectly and thus does not refresh.</p> <p>If the window is minimized, resized or even moved, the application is refreshed and the incorrectly positioned elements vanish and the application resumes normally. I spent quite some time trying to force a refresh of the background image unsuccessfully. (the repaint the image directly, repaint all children of a few panels, etc. ) Thus, I am looking for any tips that would help me resolve this problem under Mac OS X 10.4 or, in the worst case, simply simulate a full applet refresh. </p> <p>Until recently, everything was compatible with Java 1.1 but this has changed in a few locations which now require 1.4. I don't feel these changes created the issue, I am just providing this as extra information. If you are interested in implementation details of the scroll panel, I will investigate, but I am assuming this is a common platform bug for which workarounds must be known.</p> <p>To replicate the problem, open the following Java Web Start application: <a href="http://www.lavablast.com/tmp/opal-webstart.php.jnlp" rel="nofollow noreferrer">http://www.lavablast.com/tmp/opal-webstart.php.jnlp</a></p> <p>Select a folder containing lots of images and play with the scrollbar. At some point (fairly quickly), you should get the refresh problem. </p> <p>Edit: I followed the first suggestion here and replaced all my controls that feature background images with a Swing equivalent and the issue is still there. (Plus, there are numerous other fixes I would need to do to do a complete change). Any other ideas? A simple one line of code that forces a full refresh would be great :)</p> <p>Edit2: The main thread creates the panels and launches X threads. Using an observer/notifier pattern, the threads complete and notify the main control, which adds a panel to the page. This is done via an EventQueue.invokeLater which, unless I am mistaken, should run on the right thread. The issue is at its most severe when scrolling even if no extra threads are running (as during the loading). </p>
[ { "answer_id": 184577, "author": "osp70", "author_id": 2357, "author_profile": "https://Stackoverflow.com/users/2357", "pm_score": 0, "selected": false, "text": "Dim cn As SqlConnection = Nothing\n Dim cmd As SqlCommand = Nothing\n Dim da As SqlDataAdapter = Nothing\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20893/" ]
184,502
<p>In this particular case I'm trying to discover if a mylib.a file is 32 or 64 bit compatible. I'm familiar with ldd for shared objects (mylib.so) but how do I inspect a regular .a archive? </p>
[ { "answer_id": 184602, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 3, "selected": false, "text": "binutils" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26261/" ]
184,511
<p>How would you implement a GUI similar to the "My Computer" view in Windows Explorer?</p> <p>In particular the "Icons" view mode. Including the grouping of different item types (as Files Stored on This Computer/Hard Disk Drives/Devices with Removable Storage groups in Windows Explorer)</p> <p>In WinForms I would use a ListView for this thing but in WPF the only thing that has even come close is a listbox with a custom ControlTemplate but it seems like too much effort!</p>
[ { "answer_id": 650714, "author": "Nir", "author_id": 3509, "author_profile": "https://Stackoverflow.com/users/3509", "pm_score": 1, "selected": false, "text": "public class Item\n{\n public string Type { get; set; }\n public string Name { get; set; }\n public ImageSource Icon { ...
2008/10/08
[ "https://Stackoverflow.com/questions/184511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5776/" ]
184,522
<p>I have a ListBox that when in focus, and when I have an item selected returns a valid SelectedIndex. If I have a valid SelectedIndex and I click on a TextBox on the same Forum, the SelectedIndex now becomes -1. However I want it to keep its SelectedIndex from changing. How would I go about doing this?</p>
[ { "answer_id": 20203641, "author": "Danny S", "author_id": 1452485, "author_profile": "https://Stackoverflow.com/users/1452485", "pm_score": 2, "selected": false, "text": "<Style d:IsControlPart=\"True\" TargetType=\"{x:Type ListBoxItem}\">\n....\n<Style.Triggers>\n <Trigger Prope...
2008/10/08
[ "https://Stackoverflow.com/questions/184522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41/" ]
184,537
<p>I see in C++ there are multiple ways to allocate and free data and I understand that when you call <code>malloc</code> you should call <code>free</code> and when you use the <code>new</code> operator you should pair with <code>delete</code> and it is a mistake to mix the two (e.g. Calling <code>free()</code> on something that was created with the <code>new</code> operator), but I'm not clear on when I should use <code>malloc</code>/ <code>free</code> and when I should use <code>new</code>/ <code>delete</code> in my real world programs.</p> <p>If you're a C++ expert, please let me know any rules of thumb or conventions you follow in this regard.</p>
[ { "answer_id": 184540, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 9, "selected": false, "text": "malloc" }, { "answer_id": 184548, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, ...
2008/10/08
[ "https://Stackoverflow.com/questions/184537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
184,538
<p>PNG images appear "fuzzy" in flash CS3. They are very blocky and appear unanti-aliased (if that is a word) Does anyone have a fix for this? Is there some setting I'm missing? </p>
[ { "answer_id": 184808, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 2, "selected": false, "text": "myBitmap.smoothing = true;\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25280/" ]
184,541
<p>I've been fooling around with the Google App Engine for a few days and I have a little hobby application that I want to write and deploy.</p> <p>However I'd like to set it up so that users are <strong>not</strong> directly accessing the app via appspot.com.</p> <p>Is hosting it through Google Apps and then pointing it at my own domain the only way to go? I looked at that a little bit and it seemed like a pain to implement but maybe I'm just missing something.</p> <p>My other thought was to write the app-engine piece as a more generic web-service. </p> <p>Then I could have the user-facing piece be hosted anywhere, written in any language, and have it query the appspot.com url.</p> <p>Anyone have any luck with the web-service approach?</p>
[ { "answer_id": 5695742, "author": "Sangan", "author_id": 712420, "author_profile": "https://Stackoverflow.com/users/712420", "pm_score": 1, "selected": false, "text": "request.getRequestURI()" }, { "answer_id": 48001832, "author": "I. J. Kennedy", "author_id": 8677, "...
2008/10/08
[ "https://Stackoverflow.com/questions/184541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
184,560
<p>I downloaded a VM image of a web application that uses MySQL.</p> <p>How can I monitor its space consumption and know when additional space must be added?</p>
[ { "answer_id": 4055942, "author": "RolandoMySQLDBA", "author_id": 491757, "author_profile": "https://Stackoverflow.com/users/491757", "pm_score": 6, "selected": true, "text": "SELECT IFNULL(B.engine,'Total') \"Storage Engine\",\nCONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),',',''...
2008/10/08
[ "https://Stackoverflow.com/questions/184560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15884/" ]
184,563
<p>We are introducing static analysis tools into the build system for our Java product. We are using Maven2 so <a href="http://checkstyle.sourceforge.net/" rel="noreferrer">Checkstyle</a> and <a href="http://pmd.sourceforge.net/" rel="noreferrer">PMD</a> integration come for free. However it looks like there is a large overlap in functionality between these two tools, in terms of enforcing basic style rules.</p> <p>Is there a benefit from utilizing both of these? I don't want to maintain 2 tools if one will work. If we choose one, which one should we use and why?</p> <p>We are also planning on using FindBugs. Are there other static analysis tools we should look at?</p> <p><strong>Update:</strong> Consensus seems to be that PMD is preferred over CheckStyle. I don't see a solid reason to use both, and I don't want to maintain 2 sets of rule files, so we will probably aim for PMD exclusively. We'll also be bringing in FindBugs, and perhaps, eventually, Macker to enforce architectural rules.</p>
[ { "answer_id": 13035733, "author": "yegor256", "author_id": 187141, "author_profile": "https://Stackoverflow.com/users/187141", "pm_score": 2, "selected": false, "text": "<plugin>\n <groupId>com.qulice</groupId>\n <artifactId>qulice-maven-plugin</artifactId>\n <version>0.15</version>\...
2008/10/08
[ "https://Stackoverflow.com/questions/184563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5874/" ]
184,574
<p>If I have two variables containing binary values, how do I append them together as one binary value? For example, if I used WMI to read the registry of two REG_BINARY value, I then want to be able to concatenate the values.</p> <p>VBScript complains of a type mismatch when you try to join with the '&amp;' operator.</p>
[ { "answer_id": 185045, "author": "aphoria", "author_id": 2441, "author_profile": "https://Stackoverflow.com/users/2441", "pm_score": 0, "selected": false, "text": "result = CStr(val1) & CStr(val2)\n" }, { "answer_id": 186339, "author": "AnthonyWJones", "author_id": 17516,...
2008/10/08
[ "https://Stackoverflow.com/questions/184574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3347/" ]
184,590
<p>Is there a way to do this in one line?</p> <pre><code>$x =~ s/^\s+//; $x =~ s/\s+$//; </code></pre> <p>In other words, remove all leading and trailing whitespace from a string.</p>
[ { "answer_id": 184610, "author": "moritz", "author_id": 14132, "author_profile": "https://Stackoverflow.com/users/14132", "pm_score": 2, "selected": false, "text": "$x =~ s/\\A\\s*(.*?)\\s*\\z/$1/;\n" }, { "answer_id": 184613, "author": "Lev", "author_id": 7224, "auth...
2008/10/08
[ "https://Stackoverflow.com/questions/184590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
184,592
<p>I have topics(id*) and tags(id*,name) and a linking table topic_tags(topicFk*,tagFk*).</p> <p>Now I want to select every single topic, that has all of the good tags (a,b,c) but none of the bad tags (d,e,f).</p> <p>How do I do that?</p>
[ { "answer_id": 184614, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 2, "selected": false, "text": "SELECT *\nFROM topics\nWHERE topic_id IN\n (SELECT topic_id\n FROM topic_tags a\n INNER JOIN topic_tags b\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407880/" ]
184,600
<p>I have a situation where I have two models, companies and permissions, where companies is in a separate database from my permissions database. This is a has and belongs to many relationship because each company can have many permissions and each permission can belong to many companies.</p> <p>The reason the two databases are split is because the company database runs a high demand production application and the permissions database controls the permissions for another application.</p> <p>With rails, it looks for the join table in the same database as the primary table. For instance, if I do company.permissions, it looks in the company database for company_permissions. If I do permission.companies it looks in the permissions database.</p> <p>What is the best solution to using a has and belongs to many relationship with multiple databases?</p>
[ { "answer_id": 186310, "author": "JasonOng", "author_id": 6048, "author_profile": "https://Stackoverflow.com/users/6048", "pm_score": 3, "selected": false, "text": "permissions:\n adapter: mysql\n database: permissions\n username: root\n password: \n socket: /tmp/mysql.sock\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21872/" ]
184,609
<p>Consider the following two ways of writing a loop in Java to see if a list contains a given value:</p> <h3>Style 1</h3> <pre><code>boolean found = false; for(int i = 0; i &lt; list.length &amp;&amp; !found; i++) { if(list[i] == testVal) found = true; } </code></pre> <h3>Style 2</h3> <pre><code>boolean found = false; for(int i = 0; i &lt; list.length &amp;&amp; !found; i++) { found = (list[i] == testVal); } </code></pre> <p>The two are equivalent, but I always use style 1 because 1) I find it more readable, and 2) I am assuming that reassigning <code>found</code> to <code>false</code> hundreds of times feels like it would take more time. I am wondering: is this second assumption true?</p> <h3>Nitpicker's corner</h3> <ul> <li>I am well aware that this is a case of premature optimization. That doesn't mean that it isn't something that is useful to know.</li> <li>I don't care which style you think is more readable. I am only interested in whether one has a performance penalty compared to the other.</li> <li>I know that style 1 has the advantage of allowing you to also put a <code>break;</code> statement in the <code>if</code> block, but I don't care. Again, this question is about performance, not style.</li> </ul>
[ { "answer_id": 184632, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflow.com/users/4418", "pm_score": 1, "selected": false, "text": "for(i=0; i<list.length && list[i]!=testval; i++);\nboolean found = (i!=list.length);\n" }, { "answer_id": 184776, ...
2008/10/08
[ "https://Stackoverflow.com/questions/184609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18511/" ]
184,618
<p>What is the best comment in source code you have ever encountered?</p>
[ { "answer_id": 184629, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 5, "selected": false, "text": "//ALL YOUR BASE ARE BELONG TO US\n" }, { "answer_id": 184633, "author": "Walter Mitty", ...
2008/10/08
[ "https://Stackoverflow.com/questions/184618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15985/" ]
184,641
<p>I have a mysql table with albums. Each album can be a top level album, or a child album of another album. Each album has a foldername which is the name of the folder its pictures are in. Each album also has a field called parent which is the id of the parent album. So, if I have a path to an image like this:</p> <pre><code>root/album1/album2/image1.jpg </code></pre> <p>then the album table in the database will look like this:</p> <pre><code>id parent foldername 1 NULL root 2 1 album1 3 2 album2 </code></pre> <p>The question is then, how do I get the path printed earlier from this table with only mysql?</p>
[ { "answer_id": 185255, "author": "BoltBait", "author_id": 20848, "author_profile": "https://Stackoverflow.com/users/20848", "pm_score": 0, "selected": false, "text": "DECLARE @FOLDER VARCHAR(200)\nDECLARE @TOPID AS INT\nDECLARE @MYID As int\n\nCREATE TABLE #tmp\n(\n [id] INT,\n [pa...
2008/10/08
[ "https://Stackoverflow.com/questions/184641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1585/" ]
184,643
<p>What is the best way to copy a list? I know the following ways, which one is better? Or is there another way?</p> <pre><code>lst = ['one', 2, 3] lst1 = list(lst) lst2 = lst[:] import copy lst3 = copy.copy(lst) </code></pre>
[ { "answer_id": 184660, "author": "Mark Roddy", "author_id": 9940, "author_profile": "https://Stackoverflow.com/users/9940", "pm_score": 8, "selected": true, "text": "lst2=lst1[:]\n" }, { "answer_id": 184679, "author": "Andrea Ambu", "author_id": 21384, "author_profile...
2008/10/08
[ "https://Stackoverflow.com/questions/184643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4915/" ]
184,662
<p>In our product we have a big utilities file that we require (with <code>do</code>) at the beginning of a lot of our files. Is there a reason <em>not</em> to turn this into a module? For example, instead of doing this:</p> <pre><code>do '../dbi_utilities.pl'; our ($db,$user,$pw,$attr); my $Data = DBI-&gt;connect($db,$user,$pw,$attr) or die "Could not connect to database: $DBI::errstr"; </code></pre> <p>Couldn't I just do this?:</p> <pre><code>use AppUtil; my $Data = AppUtil-&gt;connect(); </code></pre>
[ { "answer_id": 184689, "author": "bmdhacks", "author_id": 14032, "author_profile": "https://Stackoverflow.com/users/14032", "pm_score": 3, "selected": false, "text": "use" }, { "answer_id": 184717, "author": "J.J.", "author_id": 21204, "author_profile": "https://Stack...
2008/10/08
[ "https://Stackoverflow.com/questions/184662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
184,678
<p>I'm using SimpleDateFormat with the pattern <code>EEE MM/dd hh:mma</code>, passing in the date String <code>Thu 10/9 08:15PM</code> and it's throwing an Unparseable date exception. Why? I've used various patterns with <code>SimpleDateFormat</code> before so I'm fairly familiar with its usage. Maybe I'm missing something obvious from staring at it too long.</p> <p>The other possibility is funky (technical term) whitespace. The context is a screen-scraping app, where I'm using HtmlCleaner to tidy up the messy html. While I've found HtmlCleaner to be pretty good overall, I've noticed strange issues with characters that look like whitespace but aren't recognized as such with a StringTokenizer, for example. I've mostly worked around it and haven't dug into the character encoding or anything like that but am starting to wonder.</p>
[ { "answer_id": 184694, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "EEE MM/d hh:mma\n" }, { "answer_id": 184827, "author": "Eric Tuttleman", "author_id": 25677, "auth...
2008/10/08
[ "https://Stackoverflow.com/questions/184678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26270/" ]
184,681
<p>Which of these pieces of code is faster?</p> <pre><code>if (obj is ClassA) {} if (obj.GetType() == typeof(ClassA)) {} </code></pre> <p>Edit: I'm aware that they don't do the same thing.</p>
[ { "answer_id": 184697, "author": "MagicKat", "author_id": 8505, "author_profile": "https://Stackoverflow.com/users/8505", "pm_score": 8, "selected": true, "text": "if (obj.GetType() == typeof(ClassA)) {}" }, { "answer_id": 184718, "author": "Jay Bazuzi", "author_id": 5314...
2008/10/08
[ "https://Stackoverflow.com/questions/184681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825/" ]
184,683
<p>Is there a way in C# to play audio (for example, MP3) direcly from a <a href="http://msdn.microsoft.com/en-us/library/system.io.stream%28v=vs.110%29.aspx" rel="noreferrer">System.IO.Stream</a> that for instance was returend from a WebRequest without saving the data temporarily to the disk?</p> <hr> <h3>Solution with <a href="https://github.com/naudio/NAudio" rel="noreferrer">NAudio</a></h3> <p>With the help of <a href="https://github.com/naudio/NAudio" rel="noreferrer">NAudio</a> 1.3 it is possible to:</p> <ol> <li>Load an MP3 file from a URL into a MemoryStream</li> <li>Convert MP3 data into wave data after it was completely loaded</li> <li>Playback the wave data using <a href="https://github.com/naudio/NAudio" rel="noreferrer">NAudio</a>'s WaveOut class</li> </ol> <p>It would have been nice to be able to even play a half loaded MP3 file, but this seems to be impossible due to the <a href="https://github.com/naudio/NAudio" rel="noreferrer">NAudio</a> library design.</p> <p>And this is the function that will do the work:</p> <pre><code> public static void PlayMp3FromUrl(string url) { using (Stream ms = new MemoryStream()) { using (Stream stream = WebRequest.Create(url) .GetResponse().GetResponseStream()) { byte[] buffer = new byte[32768]; int read; while ((read = stream.Read(buffer, 0, buffer.Length)) &gt; 0) { ms.Write(buffer, 0, read); } } ms.Position = 0; using (WaveStream blockAlignedStream = new BlockAlignReductionStream( WaveFormatConversionStream.CreatePcmStream( new Mp3FileReader(ms)))) { using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback())) { waveOut.Init(blockAlignedStream); waveOut.Play(); while (waveOut.PlaybackState == PlaybackState.Playing ) { System.Threading.Thread.Sleep(100); } } } } } </code></pre>
[ { "answer_id": 184796, "author": "OwenP", "author_id": 2547, "author_profile": "https://Stackoverflow.com/users/2547", "pm_score": 3, "selected": false, "text": "Play" }, { "answer_id": 185041, "author": "Mark Heath", "author_id": 7532, "author_profile": "https://Stac...
2008/10/08
[ "https://Stackoverflow.com/questions/184683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25782/" ]
184,703
<p>I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i'm using:</p> <pre><code>if ($_POST['sizes'] == "Small ($30)"){$total = "30";} if ($_POST['sizes'] == "Medium ($40)"){$total = "40";} if ($_POST['sizes'] == "Large ($50)"){$total = "50";} else {$total = $_POST['price'];} </code></pre> <p>What am i doing wrong here? I can echo $_POST['sizes'] and it gives me exactly one of those things.</p>
[ { "answer_id": 184737, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 1, "selected": false, "text": "if ($_POST['sizes'] == 'Small ($30)'){$total = \"30\";}\nelseif ($_POST['sizes'] == 'Medium ($40)'){$total = \"40\";}\nel...
2008/10/08
[ "https://Stackoverflow.com/questions/184703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50/" ]
184,704
<p>In Java, is there an elegant way to detect if an exception occurred prior to running the finally block? When dealing with "close()" statements, it's common to need exception handling within the finally block. Ideally, we'd want to maintain both exceptions and propagate them up (as both of them may contain useful information). The only way I can think of to do this is to have a variable outside the try-catch-finally scope to save a reference to a thrown exception. Then propagate the "saved" exception up with any that occur in the finally block.</p> <p>Is there a more elegant way of doing this? Perhaps an API call that will reveal this?</p> <p>Here's some rough code of what I'm talking about:</p> <pre><code>Throwable t = null; try { stream.write(buffer); } catch(IOException e) { t = e; //Need to save this exception for finally throw e; } finally { try { stream.close(); //may throw exception } catch(IOException e) { //Is there something better than saving the exception from the exception block? if(t!=null) { //propagate the read exception as the "cause"--not great, but you see what I mean. throw new IOException("Could not close in finally block: " + e.getMessage(),t); } else { throw e; //just pass it up } }//end close } </code></pre> <p>Obviously, there are a number of other similar kludges that might involve saving the exception as an member variable, returning it from a method, etc... but I'm looking for something a bit more elegant.</p> <p>Maybe something like <code>Thread.getPendingException()</code> or something similar? For that matter, is there an elegant solution in other languages?</p> <p>This question actually spawned from comments in <a href="https://stackoverflow.com/questions/183499/is-there-a-preference-for-nested-trycatch-blocks#183572">another question</a> that raised an interesting question. </p>
[ { "answer_id": 190631, "author": "gedevan", "author_id": 20225, "author_profile": "https://Stackoverflow.com/users/20225", "pm_score": 2, "selected": false, "text": "try { \n stream.write(buffer); \n} catch(IOException ex) {\n if (LOG.isErrorEnabled()) { // You can use log level w...
2008/10/08
[ "https://Stackoverflow.com/questions/184704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17871/" ]
184,710
<p>What is the difference between a deep copy and a shallow copy?</p>
[ { "answer_id": 184730, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 6, "selected": false, "text": "class String\n{\n int size;\n char* data;\n};\n\nString s1(\"Ace\"); // s1.size = 3 s1.data=0x0000F000\n\...
2008/10/08
[ "https://Stackoverflow.com/questions/184710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1447/" ]
184,721
<p>I have a windows c# application and I want to display a pdf file, located on a webserver, in an acrobat com object added to my form. </p> <pre><code>pdf.loadfile(@"http://somewhere.com/nowwhere.pdf") </code></pre> <p>As my pdf is large, the application seems to hang till the entire file is loaded. </p> <p>I want to read the large file without the user being under the perception that the application is hung.</p>
[ { "answer_id": 184818, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 0, "selected": false, "text": "Pdf pdf;\n\nvoid ShowPdf() {\n if (this.InvokeRequired) {\n this.Invoke(() => this.ShowPdf());\n }\n // give...
2008/10/08
[ "https://Stackoverflow.com/questions/184721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
184,766
<p>I believe the simplest way to request data from a server in XML format is to have a PHP/JSP/ASP.net page which actually generates XML based on HTTP GET params, and to somehow call/load this page from Flex.</p> <p>How exactly can this be achieved using the Flex library classes?</p>
[ { "answer_id": 185061, "author": "Raleigh Buckner", "author_id": 1153, "author_profile": "https://Stackoverflow.com/users/1153", "pm_score": 1, "selected": false, "text": "public var dataRequest:URLRequest;\npublic var dataLoader:URLLoader;\npublic var allowCache:Boolean;\n\ndataLoader =...
2008/10/08
[ "https://Stackoverflow.com/questions/184766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13220/" ]
184,773
<p>I am looking for a general UI design / work-flow for changing the same property across multiple objects. </p> <p>Suppose I have an object class called Person. The Person class has a property called City. I want to select 5 Person objects and change the City property on all 5 to "New York" in one action in the UI. </p> <p>This is not difficult to accomplish programatically, but I am having a difficult time coming up with an intuitive UI work-flow. One thought is to use a modal like the one used in iTunes to change information about multiple selected songs. I would like to come up with another work-flow, as this idea has already gotten push-back at work.</p> <p>Thoughts? Ideas?</p> <p><strong>Edit:</strong> I appreciate the answers so far. There are couple of extra points I would like to call out:</p> <ol> <li>Should the previous City values be display in some way? If so, how? Or how should the combined property screen show that all the City values are currently the same or different with a color or other indicator?</li> <li>How should boolean properties (Person.IsAlive for example) be displayed? Do you use a three-state toggle/check box? Us a drop-down with three values? Other ideas?</li> </ol>
[ { "answer_id": 1671912, "author": "Peter", "author_id": 202363, "author_profile": "https://Stackoverflow.com/users/202363", "pm_score": 0, "selected": false, "text": "Rows to update : 3\n\n ..........Old Value... Change?....New Value\n\n Field A ABC\n Field B 123 Y ...
2008/10/08
[ "https://Stackoverflow.com/questions/184773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13103/" ]
184,782
<p>I'm a doing some blackbox testing of a ASP.Net website and I need to test different session timeout scenarios. </p> <p>I'm not sure they fully encapsulated session timeouts. Other then leaving a page open for 20 minutes is there an easier way to force a session timeout?</p>
[ { "answer_id": 184810, "author": "Eduardo Campañó", "author_id": 12091, "author_profile": "https://Stackoverflow.com/users/12091", "pm_score": 2, "selected": false, "text": " <authentication mode=\"Forms\">\n <forms timeout=\"10\" protection=\"All\" slidingExpiration=\"true\" loginU...
2008/10/08
[ "https://Stackoverflow.com/questions/184782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6161/" ]
184,813
<p>I have a (Wordpress powered) website, and Google is indexing some of the sub-directories. How can I stop Apache from showing users the directory listing? I know I can edit .htaccess to password-protect a directory, but I would prefer a 403 / custom redirect if possible.</p>
[ { "answer_id": 184821, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 5, "selected": true, "text": ".htaccess" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4812/" ]
184,823
<p>I want to place a combobox inside one column of a Xtragrid. I can bind the combobox to array values but how do you bind the combobox to the column? </p>
[ { "answer_id": 5633362, "author": "Soham Dasgupta", "author_id": 238631, "author_profile": "https://Stackoverflow.com/users/238631", "pm_score": 2, "selected": false, "text": "Dim xSunday As New DevExpress.XtraEditors.Repository.RepositoryItemComboBox\nMe.GridView1.Columns(\"Sunday\").Co...
2008/10/08
[ "https://Stackoverflow.com/questions/184823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
184,840
<p>I'm working on an asp.net web site. We have to use com interop to interact with legacy vb6 activex components. The components in many cases rely on receiving a context object (which is itself a vb6 activex component) as a parameter. The context object is fairly costly to construct.</p> <p>Therefore one idea is that a context object is constructed once and stored in asp.net session. However, if this object is just a .net wrapper around an activex component, is it wise or advisible to persist such an object in session?</p> <p>Additionally the context object contains user specific information, so persisting using .net HttpRuntime Caching could be used, but would require a user specific key. </p> <p>I understand the other limitations and things you need to be aware of with asp.net session, <a href="https://stackoverflow.com/questions/133236/aspnet-session">aspnet-session question</a>.</p> <p>To ask the question a slightly different way: are their any issues or problems with storing an .net object that is just a wrapper around a com object? </p>
[ { "answer_id": 185051, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 3, "selected": true, "text": "AspCompat" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4764/" ]
184,853
<p>I swear there used to be a way in X to start capturing all terminal traffic to a file on your host. It may have been a HummingBird extension, but I thought it was standard. Now, I can't find the trick. Am I hallucinating (happens when you get old), or is it possible?<br><br>I'm not talking about 'tee'. I want to be able to send a xterm control-sequence to stdout, giving a file name, and have everthing shown in the window from that time onward saved to the file (until the bookend cancel is issued).</p>
[ { "answer_id": 184867, "author": "André", "author_id": 9683, "author_profile": "https://Stackoverflow.com/users/9683", "pm_score": 0, "selected": false, "text": "man tee" }, { "answer_id": 759017, "author": "andrewdotn", "author_id": 14558, "author_profile": "https://...
2008/10/08
[ "https://Stackoverflow.com/questions/184853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14028/" ]
184,857
<p>I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider?</p>
[ { "answer_id": 5226127, "author": "Adam M", "author_id": 625338, "author_profile": "https://Stackoverflow.com/users/625338", "pm_score": 0, "selected": false, "text": "GetList parameters = new GetList(TestConstants.USERNAME,\n TestConstants.PASSWORD,\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5569/" ]
184,858
<p>I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this:</p> <pre><code>&lt;a href="#" onclick="foo()"&gt;Click&lt;/a&gt; </code></pre> <p>But I'm not sure that is the best way and in this case it is navigating to page.html# which isn't good for what I'm doing. </p>
[ { "answer_id": 184876, "author": "Chris Cudmore", "author_id": 18907, "author_profile": "https://Stackoverflow.com/users/18907", "pm_score": 0, "selected": false, "text": "<a href=\"javascript: foo()\" >Click</a>\n" }, { "answer_id": 184877, "author": "Avdi", "author_id":...
2008/10/08
[ "https://Stackoverflow.com/questions/184858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4915/" ]
184,863
<p>To save some typing and clarify my code, is there a standard version of the following method?</p> <pre><code>public static boolean bothNullOrEqual(Object x, Object y) { return ( x == null ? y == null : x.equals(y) ); } </code></pre>
[ { "answer_id": 32725394, "author": "Sam Berry", "author_id": 1756430, "author_profile": "https://Stackoverflow.com/users/1756430", "pm_score": 3, "selected": false, "text": "Objects.equal(x, y)" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
184,864
<p>Has anyone had good experiences of talking direct to RPG programs running on a V5R4 iSeries machine from Java? If so, what are the recommendations of the community, and what pitfalls should I try to avoid?</p> <p>From the various pieces of literature and spike solutions I have attempted it looks as though we can use ProgramCallBeans (either through PCML or xPCML), talking to the DataQueues (for asynchronous comms), or even JNI.</p> <p>I'm looking for something that's robust, performant, quick to develop, easy to maintain, and easy to test (aren't we all!?!).</p>
[ { "answer_id": 222558, "author": "Tracy Probst", "author_id": 22770, "author_profile": "https://Stackoverflow.com/users/22770", "pm_score": 4, "selected": false, "text": "CommandCall command = new CommandCall(as400);\ncommand.run(\"CPYF FROMFILE(BLAH) TOFILE(BLAHBLAH) CRTFILE(*YES)\");\n...
2008/10/08
[ "https://Stackoverflow.com/questions/184864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26283/" ]
184,865
<p>I have an RDLC report that I'm having problems with page breaks. The report has a group that has a number of records that do not fit on one page. This report renders fine in Normal Mode, but when I switch to Print Mode, "extra" page breaks that were not there before appear. This is causing the report to print on more pages than necessary. I do not have the group set to keep on one page, and I have been playing with the values for Height and InteractiveHeight, but nothing seems to work.</p> <p>Is there any way to resolve this problem? I need this report to print out properly, and these mysterious page breaks are causing this problem. Any help or suggestions are appreciated.</p>
[ { "answer_id": 32787126, "author": "ozat", "author_id": 4871939, "author_profile": "https://Stackoverflow.com/users/4871939", "pm_score": 1, "selected": false, "text": "ConsumeContainerWhiteSpace = True" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
184,869
<p>I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a collision still possible?</p>
[ { "answer_id": 253830, "author": "GalacticCowboy", "author_id": 29638, "author_profile": "https://Stackoverflow.com/users/29638", "pm_score": 1, "selected": false, "text": "declare @table table\n(\n column1 uniqueidentifier default (newid()),\n column2 int,\n column3 datetime de...
2008/10/08
[ "https://Stackoverflow.com/questions/184869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
184,871
<p>I just want to enable or disable the button inside a ControlTemplate for a WPF Editor that I'm using.</p>
[ { "answer_id": 184963, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 2, "selected": false, "text": "ControlTemplate" }, { "answer_id": 7016854, "author": "Jerry Nixon", "author_id": 265706, "author_...
2008/10/08
[ "https://Stackoverflow.com/questions/184871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
184,927
<p>I have a webapp which resizes its window to exactly fit its contents:</p> <pre><code>window.resizeTo(200,300) </code></pre> <p>People do like having the page fit its window in this way. However with Firefox the next browser window the user opens comes up at the same size, which is ridiculously small.</p> <p>Is there a way to tell Firefox to resize the current window, but not change its notion of how large subsequent windows should be?</p>
[ { "answer_id": 184964, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 2, "selected": false, "text": "window.open" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/184927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4761/" ]
184,970
<p>I am using partial classes to split some functionality between 2 files, but I am getting an error. What am I doing wrong?</p> <p>A1.cs:</p> <pre><code>private partial class A { private string SomeProperty { get { return "SomeGeneratedString"; } } } </code></pre> <p>A2.cs:</p> <pre><code>private partial class A { void SomeFunction() { //trying to access this.SomeProperty produces the following compiler error, at least with C# 2.0 //error CS0117: 'A' does not contain a definition for 'SomeProperty' } } </code></pre>
[ { "answer_id": 185055, "author": "Troy Howard", "author_id": 19258, "author_profile": "https://Stackoverflow.com/users/19258", "pm_score": 3, "selected": false, "text": "namespace stackoverflow.answers\n{\n public class Foo\n {\n private partial class Bar\n {\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
184,983
<p>I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though there is a type for it?). </p> <p>I could do the conversion manually (the conversion is not difficult) but this would immediately kick my image out of the 'fast-path'. Does anyone know a solution?</p>
[ { "answer_id": 185055, "author": "Troy Howard", "author_id": 19258, "author_profile": "https://Stackoverflow.com/users/19258", "pm_score": 3, "selected": false, "text": "namespace stackoverflow.answers\n{\n public class Foo\n {\n private partial class Bar\n {\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25920/" ]
184,985
<p>I seem to be having an issue with iPhone SDK 2.1 in as far as being able to establish a relationship between a ViewController and a View window. In as far as a Cocoa Touch Class, I went forward and added a <code>UIViewController</code> subclass. I made sure that the target is part of the existing project. Right afterwards I added a User Interfaces -> View XIB. Within the <code>UIViewController</code> I have some straight forward code I literally copy/pasted from sample code elsewhere:</p> <p>EditViewController.h:</p> <pre><code>@interface EditorViewController : UIViewController &lt;UITextFieldDelegate&gt; { UITextField *field; } @property(nonatomic, retain) IBOutlet UITextField *field; @end </code></pre> <p>EditViewController.m</p> <pre><code>#import "EditorViewController.h" @implementation EditorViewController - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)dealloc { [super dealloc]; } @end </code></pre> <p>As you can tell, it doesn't do much. Now when I click my new xib, and reference a class identity with <code>EditorViewController</code>, no auto complete happens, which to me implies that it has no such awareness of a <code>EditorViewClass</code>. When I attempt to control+click from the view to File's Owners, I get nada.</p> <p>What are some of the possible idiosyncrasies in this process that I'm overlooking that's not allowing me to outlet my view to a controller?</p> <p>How would I also ensure that my User Interface View XIB is associated with the project besides seeing the project name checked off as a Target?</p>
[ { "answer_id": 185055, "author": "Troy Howard", "author_id": 19258, "author_profile": "https://Stackoverflow.com/users/19258", "pm_score": 3, "selected": false, "text": "namespace stackoverflow.answers\n{\n public class Foo\n {\n private partial class Bar\n {\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/184985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
185,004
<p>I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example:</p> <pre><code>public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } </code></pre> <p>Introspecting on Employee only yields salary even though name is inherited from Person.</p> <p>Why is this? I would rather not have to use reflection to get all the getters.</p>
[ { "answer_id": 185959, "author": "MetroidFan2002", "author_id": 8026, "author_profile": "https://Stackoverflow.com/users/8026", "pm_score": 1, "selected": false, "text": "public static BeanInfo getBeanInfo(Class<?> beanClass, Introspector.USE_ALL_BEANINFO);\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
185,034
<p>Is there a way to test the type of an element in JavaScript? </p> <p>The answer may or may not require the prototype library, however the following setup does make use of the library.</p> <pre><code>function(event) { var element = event.element(); // if the element is an anchor ... // if the element is a td ... } </code></pre>
[ { "answer_id": 185039, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 6, "selected": false, "text": "if (element.nodeName == \"A\") {\n ...\n} else if (element.nodeName == \"TD\") {\n ...\n}\n" }, { "answer_id":...
2008/10/08
[ "https://Stackoverflow.com/questions/185034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682/" ]
185,042
<p><strong>Environment:</strong><br/> Windows Server 2003 R2 Enterprise 64bit, SP2<br/> .NET framework is supposedly installed (2.0 SP2, 3.0 SP2, 3.5 SP1)</p> <p>I say "supposedly" because they are listed as installed under Add/Remove programs. I'm not sure it's <em>properly</em> installed, because the "ASP.NET" tab isn't added to any of the sites in IIS.</p> <p>In the IIS Web Service Extensions section, I have both "ASP.NET v2.0.50727" (Allowed), and "ASP.NET v2.0.50727 (32-bit)" (Prohibited).</p> <p>The site in question has script-execute enabled.</p> <p><strong>Problem:</strong></p> <p>I created a super-simple ASP.NET/C# website: Default.aspx with a label id="Label1", and a code-behind with: <code>Label1.text = "Hello World";</code> and the error I'm getting is:</p> <blockquote> <p>%1 is not a valid Win32 application.</p> </blockquote>
[ { "answer_id": 185056, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 4, "selected": true, "text": "aspnet_regiis -i\n" }, { "answer_id": 14991957, "author": "Tom Kelly TAK", "author_id": 2093432, "aut...
2008/10/08
[ "https://Stackoverflow.com/questions/185042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/751/" ]
185,043
<p>In emacs there is a handy way to launch the gdb and gui options for gdb, the C debugger.</p> <p>Is there a similar option in gvim?</p>
[ { "answer_id": 185295, "author": "bog", "author_id": 20909, "author_profile": "https://Stackoverflow.com/users/20909", "pm_score": -1, "selected": false, "text": "!gdb blah blah blah\n" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9628/" ]
185,072
<p>I took the plunge this afternoon and began studying LINQ, so far just mucking around with LINQ on collections. One of the first things I tried was to implement QSort.</p> <p>Now -- ignoring the fact that I <em>could</em> just use an ORDERBY and that this is a very silly qsort implementation -- what I came up with was this:</p> <pre><code>public class lqsort { public static List&lt;int&gt; QSLinq(List&lt;int&gt; _items) { if (_items.Count &lt;= 1) return _items; int _pivot = _items[0]; List&lt;int&gt; _less = (from _item in _items where _item &lt; _pivot select _item).ToList(); List&lt;int&gt; _same = (from _item in _items where _item == _pivot select _item).ToList(); List&lt;int&gt; _greater = (from _item in _items where _item &gt; _pivot select _item).ToList(); return (QSLinq(_less).Concat(_same.Concat(QSLinq(_greater)))).ToList(); } } </code></pre> <p>The only thing that really bugs me is all of the casting involved. Are there any LINQ tricks I might use? Or am I just using LINQ for things it wasn't intended for?</p>
[ { "answer_id": 185128, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 2, "selected": false, "text": "public static IEnumerable<int> QSLinq(IEnumerable<int> items)\n{\n if (items.Count() <= 1)\n return items;\n\n in...
2008/10/08
[ "https://Stackoverflow.com/questions/185072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7856/" ]
185,073
<p>I'm trying to call into a C++ library from Perl on an AIX 5.1 machine. I've created a very simple test project to try to exercise this.</p> <p>My C++ shared library (<code>test.cpp</code>):</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;iostream&gt; void myfunc() { printf("in myfunc()\n"); std::cout &lt;&lt; "in myfunc() also" &lt;&lt; std::endl; } </code></pre> <p>My SWIG interface file (<code>test.i</code>):</p> <pre><code>%module test %{ void myfunc(); %} void myfunc(); </code></pre> <p>I then build the shared object like so:</p> <pre><code>swig -c++ -perl test.i g++ -c test_wrap.cxx -I/usr/opt/perl5/lib/5.6.0/aix/CORE -o test_wrap.o g++ -c test.cpp -o test.o ld -G -bI:/usr/opt/perl5/lib/5.6.0/aix/CORE/perl.exp -bnoentry -bexpall -lc_r test.o test_wrap.o -o test.so </code></pre> <p>At this point, I have a <code>test.so</code> shared object that should be loadable in perl (via the SWIG generated <code>test.pm</code>). I have a very simple perl script to try to load the shared object and call the one function that I am exporting (<code>test.pl</code>):</p> <pre><code>#!/usr/bin/perl use test; test::myfunc(); </code></pre> <p>When I run <code>test.pl</code>, I get the following output:</p> <blockquote> <p>in myfunc()<br> Illegal instruction (core dumped)</p> </blockquote> <p>If I comment-out the <code>std::cout</code> usage in <code>myfunc</code>, it works without problem. It appears as though using anything in the C++ STL causes a core dump (I tried just declaring a <code>std::vector</code> and <code>std::stringstream</code>, both result in the core dump). I can create a standalone C++ executable that uses the STL without any issues, it's only when called in my shared object when loaded from perl that I get into trouble.</p> <p>I've also tried using xlc rather than gcc, but I get the same result. I'm thinking there is some funky linker flag that I need to pass in to ensure that all of the linkage occurs correctly? Any ideas are welcome...</p> <p>Edit: If I link using <code>gcc</code>/<code>xlc</code> instead of invoking the linker directly (<code>ld</code>), I immediately get a segmentation fault. It looks like it crashes when perl is trying to simply load the shared library. Calling <code>ld</code> as I have above is the closest that I've got it to working, but I think I may be missing some libraries or special AIX linker flags for the C++ libraries.</p> <p>Edit2: Ok, I've got it working. AIX is very fragile when it comes to linking. I ultimately came up with the following link command that seems to be working correctly:</p> <pre><code>ld -G -bI:/usr/opt/perl5/lib/5.6.0/aix/CORE/perl.exp -bnoentry -bexpall -lC -lc -ldl test.o test_wrap.o -o test.so </code></pre> <p>The libraries that I linked against are the most relevant. It turns out that the order in which the libraries are mentioned is very important also (ugh). Also note that this is being built against Perl 5.6.0 that ships with AIX 5.1. I've tried building this same simple application against Perl 5.8.8 and it doesn't work. However, I'm pretty sure the much more sane method of linking (using straight <code>gcc</code>/<code>xlc</code> instead of having to call <code>ld</code> directly) seems to work better. So this issue appears to be a bug in the Perl distribution or the linker or something.</p> <p>Hopefully this will help some poor soul cursed with having to work with AIX...</p>
[ { "answer_id": 185118, "author": "Tanktalus", "author_id": 23512, "author_profile": "https://Stackoverflow.com/users/23512", "pm_score": 2, "selected": false, "text": "-lstdc++" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26302/" ]
185,082
<p>I would like to be able to spawn a linux process that would only have access to stdin, stdout, and stderr (nothing more and nothing less). Can I do this at the process level itself? I am also implicitly stating (oxymoron) that I don't want the spawned process to be able to change the "thing" that the other end of the stream points to. </p> <p>Metaphorically:</p> <ul> <li>the process has a input pipe that comes from somewhere, it cannot change where the pipe starts from, so it cannot control where input comes from.</li> <li>the process has output and error pipes that go somewhere, it cannot change where the other end of the output pipes point to, so it cannot control where output goes to.</li> <li>it cannot create any new pipes.</li> </ul> <p>I am also currently looking at SElinux. Would this allow me to create a process that only had access to these three streams? Thank you.</p>
[ { "answer_id": 185568, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 1, "selected": false, "text": "ptrace" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21317/" ]
185,083
<p>I was wondering if its possible to inject a thread into a remote app domain running in a separate process. </p> <p>My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way? </p>
[ { "answer_id": 189039, "author": "Ghirai", "author_id": 570, "author_profile": "https://Stackoverflow.com/users/570", "pm_score": 0, "selected": false, "text": "SetThreadContext" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
185,091
<p>I got a very similar error to the one below:</p> <p><a href="https://stackoverflow.com/questions/97800/how-can-i-fix-this-delphi-7-compile-error-duplicate-resources">How can I fix this delphi 7 compile error - &quot;Duplicate resource(s)&quot;</a></p> <p>However, the error I got is this:</p> <pre><code> [Error] WARNING. Duplicate resource(s): [Error] Type 10 (RCDATA), ID TFMMAINTQUOTE: [Error] File P:\[PATH SNIPPED]\Manufacturing.RES resource kept; file FMaintQuote.DFM resource discarded. </code></pre> <p>Manufacturing.res is the default resource file (application is called Manufacturing.exe), and FMainQuote is one of the forms. .dfm files are plain text files, so I'm not sure what resources is being duplicated, how to find it and fix it?</p> <p>If I tried to compile the project again, it works OK, but the exe's icon is different to the one I've set in Project Options using the "Load Icon" button. The icon on the app is some sort of bell image that I don't recognize.</p>
[ { "answer_id": 844181, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "{$R *.res}" }, { "answer_id": 5051631, "author": "Pekka Puhakka", "author_id": 624467, "author_profile": "...
2008/10/08
[ "https://Stackoverflow.com/questions/185091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26305/" ]
185,094
<p>I'm fairly new to MVC coming from a php background where I designed by view and created pages when I needed something like say a login form. I'd have a file called login. This only sucked when I needed a new login form to login a different type of user. Say an admin. I'd then have to create a new page called login-admin.php or something of that nature.</p> <p>Recently I began to explore MVC and particularly frameworks and the biggest problem I am having is determining how exactly you come up with your controllers. I've been told to either go the one controller per view file route, or get your controllers based upon your domain objects.</p> <p>I understand I can have a user controller and a lot of methods to manipulate that object say user/add, user/edit, user/delete, user/profile. But in this instance it seems that once you need views that don't necessarily fit within a "domain object" that it's hard to decide where to stick them.</p> <p>So, what is the best practice when determining what your controllers will be???</p>
[ { "answer_id": 185133, "author": "dbr", "author_id": 745, "author_profile": "https://Stackoverflow.com/users/745", "pm_score": 2, "selected": false, "text": "controller = mysection" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
185,101
<p>I have an XSL stylesheet with content in an <code>xsl:text</code> node like this:</p> <pre><code>&lt;xsl:text&gt; foo bar baz &lt;/xsl:text&gt; </code></pre> <p>The stylesheet itself is a text file with "unix-style" newline line terminators. I invoke this stylesheet on Windows as well as unix-like platforms. It would be nice to have the output conform to the conventions of the platform on which it is invoked.</p> <p>When I run this stylesheet on Windows, the output has carriage return/newline pairs for everything <em>except</em> the contents of the <code>xsl:text</code> node.</p> <p><strong>Can I instruct the XSLT processor to translate the newline characters in the content of the <code>xsl:text</code> node into platform specific end-of-lines?</strong></p> <p>More context: I'm invoking the stylesheet from the <a href="http://ant.apache.org/manual/Tasks/style.html" rel="noreferrer">Apache Ant 1.7.1 XSLT task</a> like this:</p> <pre><code>&lt;xslt in="in.xml" out="out.xml" style="stylesheet.xsl"/&gt; </code></pre> <p>The stylesheet header currently looks like this:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xslt" exclude-result-prefixes="xalan"&gt; &lt;!-- contents elided --&gt; &lt;/xsl:stylesheet&gt; </code></pre>
[ { "answer_id": 185231, "author": "Jen A", "author_id": 12979, "author_profile": "https://Stackoverflow.com/users/12979", "pm_score": 1, "selected": false, "text": "&#xD; &#xA;" }, { "answer_id": 187729, "author": "Adam Crume", "author_id": 25498, "author_profile": "ht...
2008/10/08
[ "https://Stackoverflow.com/questions/185101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13940/" ]
185,110
<p>Can you please let me know the SQL to split date ranges when they overlap?</p> <p>Data (sample data with a date range and possibly other columns):</p> <pre><code> Col1 FromDate ToDate 1. 1 1/1/2008 31/12/2010 2. 1 1/1/2009 31/12/2012 3. 1 1/1/2009 31/12/2014 </code></pre> <p>Output:</p> <pre><code> Col1 From Date ToDate 1. 1 1/1/2008 31/12/2008 (from row 1 above) 2. 1 1/1/2009 31/12/2010 (from rows 1,2 and 3 above) 3. 1 1/1/2011 31/12/2012 (from rows 2 and 3 above) 4. 1 1/1/2013 31/12/2014 (from row 3 above) </code></pre>
[ { "answer_id": 185305, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 3, "selected": false, "text": "SQL query: SELECT * FROM `test` LIMIT 0, 30 ;\nRows: 3\nstart end\n2008-01-01 2010-12-31\n2009-01-01 2012-12-31\n200...
2008/10/08
[ "https://Stackoverflow.com/questions/185110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26309/" ]
185,112
<p>I have a bit of html like so:</p> <pre><code>&lt;a href="#somthing" id="a1"&gt;&lt;img src="something" /&gt;&lt;/a&gt; &lt;a href="#somthing" id="a2"&gt;&lt;img src="something" /&gt;&lt;/a&gt; </code></pre> <p>I need to strip off the links so I'm just left with a couple of image tags. What would be the most efficient way to do this with jQuery?</p>
[ { "answer_id": 185140, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 4, "selected": true, "text": "$(\"a > img\").parent() // match all <a><img></a>, select <a> parents\n .each( function() // for each link\n { \n $...
2008/10/08
[ "https://Stackoverflow.com/questions/185112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6007/" ]
185,114
<p>I have a module in the parent directory of my script and I would like to 'use' it.</p> <p>If I do</p> <pre><code>use '../Foo.pm'; </code></pre> <p>I get syntax errors.</p> <p>I tried to do:</p> <pre><code>push @INC, '..'; use EPMS; </code></pre> <p>and .. apparently doesn't show up in @INC</p> <p>I'm going crazy! What's wrong here?</p>
[ { "answer_id": 185120, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 2, "selected": false, "text": "push" }, { "answer_id": 185121, "author": "ephemient", "author_id": 20713, "author_profile": ...
2008/10/08
[ "https://Stackoverflow.com/questions/185114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
185,124
<p>Say if I have a dropdown in a form and I have another nested class inside of this class . Now what's the best way to access this dropdown from the nested class? </p>
[ { "answer_id": 185144, "author": "Ray Hayes", "author_id": 7093, "author_profile": "https://Stackoverflow.com/users/7093", "pm_score": 7, "selected": false, "text": "// C#\nclass OuterClass \n{\n string s;\n // ...\n class InnerClass \n {\n OuterClass o_;\n public...
2008/10/08
[ "https://Stackoverflow.com/questions/185124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
185,141
<p>I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it. </p> <p>I am just drawing a simple rectangle around the ListView and updating the opacity of the rectangle inside of a timer tick event. When the opacity is changed, the border is re-drawn. I am double-buffering the painting at this point. I am also only allowing a redraw every 15 ticks or so (the timer interval is 20 ms). After all of this, the drawing process still flickers a bit. This is not acceptable, so I need some guidance on how I could avoid this.</p> <p>I don't see a way around painting the control quite often. There needs to be a smooth transition from opaque to solid and back again. When I lower the tick interval enough (down to about 300 -500 ms), the flashing stops, but the refresh rate is too slow.</p> <p>I am open to any and all ideas. Perhaps the way I am approaching this is just plain wrong, or perhaps one of you have already created a glow effect and know what to do. Thanks for any help in advance.</p>
[ { "answer_id": 185178, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 0, "selected": false, "text": "SetStyle(ControlStyles.OptimizedDoubleBuffer, true);\n" }, { "answer_id": 185475, "author": "Ed S.", "au...
2008/10/08
[ "https://Stackoverflow.com/questions/185141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1053/" ]
185,149
<p>Please take a look at the html listed below and let me know why IE6 freezes when trying to load the remote script (located at '<a href="http://code.katzenbach.com/Default.aspx" rel="nofollow noreferrer">http://code.katzenbach.com/Default.aspx</a>'). The script returns JSONP and executes the 'callbackFunction' listed in the header. When it runs correctly, you'll see a pop-up alert showing numbers 1-500. This works fine in FF3 and IE7. I can't understand why it fails in Internet Explorer 6 -the processor gets pegged and everything hangs.</p> <p>Run it yourself and let me know if you experience the same problem. I've been staring at this problem all day. Thanks for your help.</p> <p>Andrew</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function callbackFunction(Result) { alert(Result) ; } &lt;/script&gt; &lt;script type="text/javascript" src="http://code.katzenbach.com/Default.aspx?callback=callbackFunction&amp;test=true&amp;c=500"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; Here &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 185188, "author": "cllpse", "author_id": 20946, "author_profile": "https://Stackoverflow.com/users/20946", "pm_score": 0, "selected": false, "text": "callbackFunction([\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"1...
2008/10/08
[ "https://Stackoverflow.com/questions/185149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21832/" ]
185,203
<p>I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x.</p> <p>To formulate my problem with one example:</p> <p>I have an ASCII-file which only stores a number, the value of a page load counter. At application deployment the file will simply hold a 0. For each access the value will be incremented by one. The goal is to keep track of page loads.</p> <p>The problem comes when many users are concurrently accessing the page containing the counter. When thread A has read the current value, let's say it is 11, another thread which we call B reads the value, still 11. Then the first thread A increments the read value and writes 12 in the file and closes it. Then the second thread B, increments the read value, which was 11, gets 12 and writes that into the file. The value 12 is stored in the file, when it really should have been 13.</p> <p>In another programming language I would have solved this using a mutex. I understand there are mutexes, shared memory and other funcionality as part of modules. But I would like a solution which works on "most servers" out there. Platform independent. Installed on most cheap web hosts. Is there a good solution to this problem? And if there isn't, which way would you take if using a <strong>database is not an option</strong>?</p>
[ { "answer_id": 185218, "author": "terson", "author_id": 22974, "author_profile": "https://Stackoverflow.com/users/22974", "pm_score": 4, "selected": true, "text": "<?php\n\n$fp = fopen(\"/tmp/counter.txt\", \"r+\");\n\necho \"Attempt to lock\\n\";\nif (flock($fp, LOCK_EX)) {\n echo \"Lo...
2008/10/08
[ "https://Stackoverflow.com/questions/185203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
185,204
<p>I have a PHP script that sends out critical e-mails that needs to reach its destination. I know how to check whether the e-mail sent successfully, the only issue is knowing whether it actually got to its recipient.</p> <p>Any suggestions? If there is no way of knowing, how would you handle this situation?</p>
[ { "answer_id": 185271, "author": "stalepretzel", "author_id": 1615, "author_profile": "https://Stackoverflow.com/users/1615", "pm_score": 1, "selected": false, "text": "myserver.com/images/logo.gif?recipient@email.com" }, { "answer_id": 185364, "author": "Gary Richardson", ...
2008/10/08
[ "https://Stackoverflow.com/questions/185204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131/" ]
185,208
<p>How can I get Environnment variables and if something is missing, set the value?</p>
[ { "answer_id": 185214, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 9, "selected": true, "text": "var value = System.Environment.GetEnvironmentVariable(variable [, Target])\n" }, { "answer_id": 2763116,...
2008/10/08
[ "https://Stackoverflow.com/questions/185208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14441/" ]
185,235
<p>I've previously used <a href="https://jqueryui.com/tabs/" rel="nofollow noreferrer"><code>jquery-ui tabs</code></a> extension to load page fragments via <code>ajax</code>, and to conceal or reveal hidden <code>div</code>s within a page. Both of these methods are well documented, and I've had no problems there.</p> <p>Now, however, I want to do something different with tabs. When the user selects a tab, it should reload the page entirely - the reason for this is that the contents of each tabbed section are somewhat expensive to render, so I don't want to just send them all at once and use the normal method of toggling 'display:none' to reveal them.</p> <p>My plan is to intercept the tabs' <code>select</code> event, and have that function reload the page with by manipulating document.location.</p> <p>How, in the <code>select</code> handler, can I get the newly selected tab index and the html LI object it corresponds to?</p> <pre><code>$('#edit_tabs').tabs( { selected: 2, // which tab to start on when page loads select: function(e, ui) { var t = $(e.target); // alert("data is " + t.data('load.tabs')); // undef // alert("data is " + ui.data('load.tabs')); // undef // This gives a numeric index... alert( "selected is " + t.data('selected.tabs') ) // ... but it's the index of the PREVIOUSLY selected tab, not the // one the user is now choosing. return true; // eventual goal is: // ... document.location= extract-url-from(something); return false; } }); </code></pre> <p>Is there an attribute of the event or ui object that I can read that will give the index, id, or object of the newly selected tab or the anchor tag within it? </p> <p>Or is there a better way altogether to use tabs to reload the entire page?</p>
[ { "answer_id": 185257, "author": "imjoevasquez", "author_id": 24630, "author_profile": "https://Stackoverflow.com/users/24630", "pm_score": 6, "selected": true, "text": " $('.ui-tabs-nav').bind('tabsselect', function(event, ui) {\n ui.options // options used to intialize this widget\...
2008/10/08
[ "https://Stackoverflow.com/questions/185235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2554901/" ]
185,236
<p>I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus keeping a zip file on my server. Is there any reasonable way to open an uploaded file and "check" to see if it truly is of the said filetype?</p>
[ { "answer_id": 185756, "author": "Shoan", "author_id": 17404, "author_profile": "https://Stackoverflow.com/users/17404", "pm_score": 2, "selected": false, "text": "$ php -r 'var_dump(getimagesize(\"b&n.jpg\"));'\narray(7) {\n [0]=>\n int(200)\n [1]=>\n int(200)\n [2]=>\n int(2)\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/185236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
185,239
<p>I have a button on my webform. Clicking this button will do an HttpWebRequest during the onclick event handler. After the request we copy the response from the request into HttpContext.Current.Response and send that to the client.</p> <p>This web request can take a while (up to 5 seconds, since it's generating a report). During this time the user has no indication that anything is going on, except for the browser progress bar and the spinning IE icon (if they're using IE). So I need a loading indicator while this is happening.</p> <p>I've tried using javascript that fires during the button's onclick event (using OnClientClick) and while that works, I don't know how to find out when the web request is finished. Since we just send the response to the client, a full postback doesn't happen.</p> <p>I've tried wrapping the button in an UpdatePanel and using the UpdateProgress, but when we send the response to HttpContext.Current.Response and call Response.End(), we get an error in the javascript, since the response isn't well formed (we're sending back an excel sheet for the user to download).</p> <p>Since we're sending back a file for users to download, I don't want to pop-up a separate window, since then in IE they'd get the information bar blocking the download.</p> <p>Any ideas here? </p>
[ { "answer_id": 602412, "author": "Federico Zancan", "author_id": 15908, "author_profile": "https://Stackoverflow.com/users/15908", "pm_score": 0, "selected": false, "text": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n <head>\n <title>First Example</tit...
2008/10/08
[ "https://Stackoverflow.com/questions/185239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/233/" ]
185,240
<p>I have an import-from-excel script as part of a CMS that previously ran without issue.</p> <p>My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offset: -XXX in /path/scriptname.php on line 27" (XXX being a decreasing number from 512 and /path/scriptname.php of course being the full path to script in question). </p> <p>It returns this error for every line of the excel file. Line 27 is just a return from within a function that is the first point at which the imported data is being processed:</p> <pre><code>function GetInt4d($data, $pos) { return ord($data[$pos]) | (ord($data[$pos+1]) &lt;&lt; 8) | (ord($data[$pos+2]) &lt;&lt; 16) | (ord($data[$pos+3]) &lt;&lt; 24); } </code></pre> <p>It finally implodes with a "Fatal error: Allowed memory size of 47185920 bytes exhausted (tried to allocate 71 bytes) in /path/scriptname.php on line 133".</p> <p>There's nothing useful in Apache error logs. I am stumped. Anyone have any ideas of at least where to look? Even knowing if it's likely to be something within my script or something to do with upgrade would be useful. I had another issue with a different site on same provider that (after upgrade) couldn't write sessions to tmp directory (since resolved), but am pretty sure it's not that (?).</p> <p>EDIT: As it turned out that the answer was to do with the version of the parser being incompatible in some way with PHP 5.2.6, I thought it might be of use to someone that the parser in question is <a href="http://sourceforge.net/project/showfiles.php?group_id=99160&amp;package_id=106368" rel="nofollow noreferrer">Spreadsheet Excel Reader</a> .</p>
[ { "answer_id": 189625, "author": "Till", "author_id": 2859, "author_profile": "https://Stackoverflow.com/users/2859", "pm_score": 3, "selected": true, "text": "$data" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14979/" ]
185,252
<p>I have a Flex application where load time is extremely important (consumer site). i want to be able to get something up on screen and then allow additional modules to be loaded as necessary.</p> <p>The issue I'm facing is that the sum total of all the modules is much larger than if i were to include all the components in a single .swf file.</p> <p>Its pretty obvious why. For instance the classes needed for web service access seem to take about 100kb. If I dont use those classes in my main.swf then they'll be included in EVERY module that uses them. So if I have 5 modules thats an extra 500kB wasted.</p> <p>In theory I want 3 levels</p> <p>main.swf - minimum possible layout / style / font / framework type stuff common.swf - additional classes needed by module 1 + module 2 (such as web services) module1.swf - module 1 in site module2.swf - module 2 in site</p> <p>I dont know if this is even possible.</p> <p>I'm wondering if I can load swz/swf files for portions of the framework instead of the entire framework.</p> <p>I really need to get my main app size down to 200Kb. It grows to 450kb when I add web services and basic datagrid functionality.</p> <p>Any lessons learned would be appreciated.</p>
[ { "answer_id": 194615, "author": "James Fassett", "author_id": 27081, "author_profile": "https://Stackoverflow.com/users/27081", "pm_score": 1, "selected": false, "text": "\nprivate function loadContent(path:String):void \n{\n var contentLoader:Loader = new Loader();\n contentLoader....
2008/10/08
[ "https://Stackoverflow.com/questions/185252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24727/" ]
185,254
<p>I'm currently passing the pid on the command line to the child, but is there a way to do this in the Win32 API? Alternatively, can someone alleviate my fear that the pid I'm passing might belong to another process after some time if the parent has died?</p>
[ { "answer_id": 558251, "author": "Jay", "author_id": 20840, "author_profile": "https://Stackoverflow.com/users/20840", "pm_score": 6, "selected": false, "text": "#include <stdio.h>\n#include <windows.h>\n#include <tlhelp32.h>\n\nint main(int argc, char *argv[]) \n{\n int pid = -1;\n ...
2008/10/08
[ "https://Stackoverflow.com/questions/185254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23524/" ]
185,262
<p>We've talked about <b>personal</b> password management <a href="https://stackoverflow.com/questions/11362/what-is-your-favorite-password-storage-tool">here</a> but how do you guys manage your passwords at a company wide level?</p>
[ { "answer_id": 185340, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 0, "selected": false, "text": "passwords.txt" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25820/" ]
185,282
<p>I would like to access a class everywhere in my application, how can I do this?</p> <p>To make it more clear, I have a class somewhere that use some code. I have an other class that use the same code. I do not want to duplicate so I would like to call the same code in both place by using something. In php I would just include("abc.php") in both... I do not want to create the object everytime I want to use the code.</p>
[ { "answer_id": 185296, "author": "Max Schmeling", "author_id": 3226, "author_profile": "https://Stackoverflow.com/users/3226", "pm_score": 3, "selected": false, "text": "public static class MyClass { }" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21386/" ]
185,291
<p>This is kinda a general question, open for opinions. I've been trying to come up with a good way to design for localization of string resources for a Windows MFC application and related utilities. My wishlist is:</p> <ul> <li>Must preserve string literals in code (as opposed to replacing with macro #define resource ID's), so that the messages are still readable inline</li> <li>Must allow localized string resources (duh)</li> <li>Must not impose additional run-time environment restrictions (eg: dependency on .NET, etc.)</li> <li>Should have minimal obtrusion into existing code (the less modification the better)</li> <li>Should be debuggable</li> <li>Should generate resource files which are editable by common tools (ie: common format)</li> <li>Should not use copy/paste comment blocks to preserve literal strings in code, or anything else which creates the potential for de-synchronization</li> <li>Would be nice to allow static (compile-time) checking that every "notated" string is in the resource file(s)</li> <li>Would be nice to allow cross-language resource string pooling (for components in various languages, eg: native C++ and .NET)</li> </ul> <p>I have a way which fulfills all my wishlist to some extent except for static checking, but I have had to develop a bit of custom code to achieve it (and it has limitations). I'm wondering if anyone has solved this problem in a particularly good way.</p> <p>Edit: The solution I currently have looks like this:</p> <pre><code>ShowMessage( RESTRING( _T("Some string") ) ); ShowMessage( RESTRING( _T("Some string with variable %1"), sNonTranslatedStringVariable ) ); </code></pre> <p>I then have a custom utility to parse out the strings from within the 'RESTRING' blocks and put them into a .resx file for localization, and a separate C# COM object to load them from localized resource files with fallback. If the C# object is not available (or cannot load), I fallback to the string in the code. The macro expands to a template class which calls the COM object and does the formatting, etc.</p> <p>Anyway, I thought it would be useful to add what I have now for reference.</p>
[ { "answer_id": 185356, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 2, "selected": false, "text": "doAction(I18N.get(\"Press OK to continue\"));\n" }, { "answer_id": 185700, "author": "KPexEA", "author...
2008/10/08
[ "https://Stackoverflow.com/questions/185291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26240/" ]
185,314
<p>I have a C# app which uses a System.Diagnostics.Process to run another exe. I ran into some example code where the process is started in a try block and closed in a finally block. I also saw example code where the process is not closed.</p> <p>What happens when the process is not closed? </p> <p>Are the resources used by the process reclaimed when the console app that created the process is closed? </p> <p>Is it bad to open lots of processes and not close any of them in a console app that's open for long periods of time?</p> <p>Cheers!</p>
[ { "answer_id": 185342, "author": "Duncan Smart", "author_id": 1278, "author_profile": "https://Stackoverflow.com/users/1278", "pm_score": 5, "selected": true, "text": "Close()" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
185,327
<p>I knew stackoverflow would help me for other than know what is the "favorite programming cartoon" :P </p> <p>This was the accepted answer by: <a href="https://stackoverflow.com/questions/185327/oracle-joins-left-outer-right-etc-s#185439">Bill Karwin</a></p> <p>Thanks to all for the help ( I would like to double vote you all ) </p> <p>My query ended up like this ( this is the real one ) </p> <pre><code>SELECT accepted.folio, COALESCE( inprog.activityin, accepted.activityin ) as activityin, inprog.participantin, accepted.completiondate FROM performance accepted LEFT OUTER JOIN performance inprog ON( accepted.folio = inprog.folio AND inprog.ACTIVITYIN IN ( 4, 435 ) -- both are ids for inprogress AND inprog.PARTICIPANTIN != 1 ) -- Ignore the "bot" participant LEFT OUTER JOIN performance closed ON( accepted.folio = closed.folio AND closed.ACTIVITYIN IN ( 10,436, 4, 430 ) ) -- all these are closed or cancelled WHERE accepted.ACTIVITYIN IN ( 3, 429 ) --- both are id for new AND accepted.folio IS NOT NULL AND closed.folio IS NULL; </code></pre> <p>Now I just have to join with the other tables for a human readable report.</p> <p><hr> <strong>ORIGINAL POST</strong></p> <p>Hello. </p> <p>I'm struggling for about 6 hrs. now with a DB query ( my long time nemesis ) </p> <p>I have a data table with some fields like:</p> <pre><code>table performance( identifier varchar, activity number, participant number, closedate date, ) </code></pre> <p>It is used to keep track of the history of ticket</p> <p><strong>Identifier</strong>: is a customer id like ( NAF0000001 ) </p> <p><strong>activity</strong>: is a fk of where the ticket is ( new, in_progress, rejected, closed, etc )</p> <p><strong>participant</strong>: is a fk of who is attending at that point the ticket</p> <p><strong>closedate</strong>: is the date when that activity finished.</p> <p><strong>EDIT:</strong> I should have said "completiondate" rather than closedate. This is the date when the activity was completed, not necessary when the ticket was closed.</p> <p>For instance a typical history may be like this:</p> <pre> identifier|activity|participant|closedate ------------------------------------------- NA00000001| 1| 1|2008/10/08 15:00| ------------------------------------------- NA00000001| 2| 2|2008/10/08 15:20| ------------------------------------------- NA00000001| 3| 2|2008/10/08 15:40| ------------------------------------------- NA00000001| 4| 4|2008/10/08 17:05| ------------------------------------------- </pre> <p>And participant 1=jonh, 2=scott, 3=mike, 4=rob</p> <p>and activties 1=new, 2=inprogress, 3=waitingforapproval, 4=closed</p> <p>etc. And tens of other irrelevant info.</p> <p>Well my problem is the following.</p> <p>I have managed to create a query where I can know when a ticket was opened and closed</p> <p>it is like this:</p> <pre><code> select a.identifier, a.participant, a.closedate as start, b.closedate as finish from performance a, performance b where a.activity = 1 -- new and b.activity = 4 -- closed and a.identifier = b.identifier </code></pre> <p>But I can't know what tickets are <strong>not</strong> closed and who is attending them.</p> <p>So far I have something like this:</p> <pre><code> select a.identifier, a.participant, a.closedate as start from performance a where a.activity = 1 -- new and a.identifier not in ( select identifier from performance where activity = 4 ) --closed </code></pre> <p>That is give me all the ones who have an start ( new = 1 ) but are not closed ( closed = 4 ) </p> <p>But the big problem here is that it prints the participant who opened the ticket, but I need the participant who is attending it. So I add the "inprogress" activity to the query.</p> <pre><code> select a.identifier, a.participant, a.closedate as start from performance a, performance b where a.activity = 1 -- new and a.identifier not in ( select identifier from performance where activity = 4 ) --closed and b.identifier = a.identifier and b.activity = 2 -- inprogress.. </code></pre> <p>But not all the rows that are in "new" are "inprogress" and with that query I drop all of them.</p> <p>What I need is to show all the "inprogress" participant and if the ticket is not "inprogress", it will show as empty.</p> <p>Somthing like</p> <pre> identifier|activity|participant|closedate ------------------------------------------- NA00000002| 1| |2008/10/08 15:00| ------------------------------------------- NA00000003| 1| |2008/10/08 15:20| ------------------------------------------- NA00000004| 1| |2008/10/08 15:40| ------------------------------------------- NA00000005| 2| 4|2008/10/08 15:40| ------------------------------------------- NA00000006| 2| 4|2008/10/08 15:40| </pre> <p>In this case</p> <p>NA002, NA003 and NA004 are in "new", so no participant is shown</p> <p>While</p> <p>NA005 and NA006 are being "inprgress (act = 2 )" and they are being attended by rob ( participant 4 ) </p> <p>So I remember there was this thing called left outer join or something like that but I never ever understand it. What I would like to know is how can I fetch the identifiers that are "inprogress" and "new" and that are not closed.</p> <p>Probably taking a little rest would help me to clear my mind. If anyone knows how to do it I'll appreciate it.</p> <p>By the way I've tried:</p> <pre><code> select a.identifier, a.participant, a.closedate as start from performance a left outer join performance b on b.identifier = a.identifier where a.activity = 1 -- new and a.identifier not in ( select identifier from performance where activity = 4 ) --closed and b.activity = 2 -- inprogress.. </code></pre> <p>But gives me the same result as the previous ( drop the only in "new" records )</p>
[ { "answer_id": 185375, "author": "Andy Lester", "author_id": 8454, "author_profile": "https://Stackoverflow.com/users/8454", "pm_score": 2, "selected": false, "text": "select * from performance p1\nwhere not exists \n ( select * from performance p2 \n where p2.identifier = p1.ide...
2008/10/08
[ "https://Stackoverflow.com/questions/185327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
185,349
<p>In XAML I can declare a DataTemplate so that the template is used whenever a specific type is displayed. For example, this DataTemplate will use a TextBlock to display the name of a customer:</p> <pre><code>&lt;DataTemplate DataType="{x:Type my:Customer}"&gt; &lt;TextBlock Text="{Binding Name}" /&gt; &lt;/DataTemplate&gt; </code></pre> <p>I'm wondering if it's possible to define a DataTemplate that will be used any time an IList&lt;Customer&gt; is displayed. So if a ContentControl's Content is, say, an ObservableCollection&lt;Customer&gt; it would use that template.</p> <p>Is it possible to declare a generic type like IList in XAML using the {x:Type} Markup Extension?</p>
[ { "answer_id": 186694, "author": "Ian Oakes", "author_id": 21606, "author_profile": "https://Stackoverflow.com/users/21606", "pm_score": 5, "selected": false, "text": "DataTemplateSelector" }, { "answer_id": 4047863, "author": "Claudiu Mihaila", "author_id": 167350, "...
2008/10/08
[ "https://Stackoverflow.com/questions/185349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615/" ]
185,378
<p>What is the regular expression to match strings (in this case, file names) that start with 'Run' and have a filename extension of '.py'?</p> <p>The regular expression should match any of the following:</p> <pre><code>RunFoo.py RunBar.py Run42.py </code></pre> <p>It should not match:</p> <pre><code>myRunFoo.py RunBar.py1 Run42.txt </code></pre> <p>The SQL equivalent of what I am looking for is <code>... LIKE 'Run%.py' ...</code>.</p>
[ { "answer_id": 185387, "author": "moo", "author_id": 23107, "author_profile": "https://Stackoverflow.com/users/23107", "pm_score": 0, "selected": false, "text": "/^Run[\\w]*?\\.py$/\n" }, { "answer_id": 185388, "author": "Rob Howard", "author_id": 3528, "author_profil...
2008/10/08
[ "https://Stackoverflow.com/questions/185378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
185,381
<p>I have some System.Diagnotics.Processes to run. I'd like to call the close method on them automatically. Apparently the "using" keyword does this for me.</p> <p>Is this the way to use the using keyword?</p> <pre><code>foreach(string command in S) // command is something like "c:\a.exe" { try { using(p = Process.Start(command)) { // I literally put nothing in here. } } catch (Exception e) { // notify of process failure } } </code></pre> <p>I'd like to start multiple processes to run concurrently.</p>
[ { "answer_id": 185419, "author": "JB King", "author_id": 8745, "author_profile": "https://Stackoverflow.com/users/8745", "pm_score": 0, "selected": false, "text": "try\n{\n foreach(string command in S) // command is something like \"c:\\a.exe\"\n {\n using(p = Process.Start(comm...
2008/10/08
[ "https://Stackoverflow.com/questions/185381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
185,384
<p>While working on a C# app I just noticed that in several places static initializers have dependencies on each other like this:</p> <pre><code>static private List&lt;int&gt; a = new List&lt;int&gt;() { 0 }; static private List&lt;int&gt; b = new List&lt;int&gt;() { a[0] }; </code></pre> <p>Without doing anything special that worked. Is that just luck? Does C# have rules to resolve this?</p> <p><strong>Edit:</strong> (re: Panos) In a file lexical order seems to be king? what about across files?</p> <p>In looking I tried a cyclical dependency like this:</p> <pre><code>static private List&lt;int&gt; a = new List&lt;int&gt;() { b[0] }; static private List&lt;int&gt; b = new List&lt;int&gt;() { a[0] }; </code></pre> <p>and the program didn't run the same (the test suit failed across the board and I didn't look further).</p>
[ { "answer_id": 185409, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 5, "selected": true, "text": "static private List<int> a = new List<int>() { 1 };\nstatic private List<int> b = new List<int>() { a[0] };\n" }, { "an...
2008/10/08
[ "https://Stackoverflow.com/questions/185384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
185,389
<p>I'm having problems structuring classes in the Model part of an MVC pattern in my Python app. No matter how I turn things, I keep running into circular imports. Here's what I have:</p> <p><strong>Model/__init__p.y</strong></p> <ul> <li>should hold all Model class names so I can do a "from Model import User" e.g. from a Controller or a unit test case</li> </ul> <p><strong>Model/Database.py</strong> </p> <ul> <li>holds Database class</li> <li>needs to import all Model classes to do ORM</li> <li>initialization should be performed on first module import, i.e. no extra init calls or instantiations (all methods on Database class are @classmethods)</li> </ul> <p><strong>Model/User.py</strong></p> <ul> <li>contains User model class</li> <li>needs access to Database class to do queries</li> <li>should inherit from base class common to all Model classes to share functionality (database persistency methods, parameter validation code etc.)</li> </ul> <p>I have yet to see a real world Python app employing MVC, so my approach is probably un-Pythonic (and possibly a language-agnostic mess on top of that...) - any suggestions on how to solve this?</p> <p>Thanks, Simon</p>
[ { "answer_id": 185411, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "__init__.py" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22404/" ]
185,391
<p>In ASP.NET, I have an XML file (within my project) that I would like to deserialize. FileStream objects do not allow you to open a file via URL. </p> <p>What is the easiest way to open the file so that I can deserialize it? </p>
[ { "answer_id": 185411, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "__init__.py" } ]
2008/10/08
[ "https://Stackoverflow.com/questions/185391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
185,423
<p>I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <code>&lt;a href="url" target="_blank"&gt;</code> opens the link in IE regardless of the default browser.</p> <p>Is there a way to use the default browser? Using JavaScript is an option.</p>
[ { "answer_id": 185581, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 6, "selected": true, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html lang=\"en\">\n<h...
2008/10/08
[ "https://Stackoverflow.com/questions/185423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7441/" ]
185,429
<p>I know how to use JSON to create objects, but there doesn't seem to be away to use JSON to create an object that is of a specific object type.</p> <p>Here's an example of an Object and creating an instance of it:</p> <pre><code>Person = function() { }; Person.prototype = { FirstName: null, GetFirstName: function() { return this.FirstName; } }; //Create an instance of the Person Object var me = new Person(); me.FirstName = "Chris"; alert(me.GetFirstName()); //alert the FirstName property </code></pre> <p>Now, I would like to use JSON to create a new Person object so that the GetFirstName function works on it.</p> <p>Here's something like that I'm looking to do (but this code doesn't work):</p> <pre><code>var you = new Person() { FirstName: "Mike" }; // OR var you = new Person{ FirstName: "Mike" }; </code></pre> <p>Is there anyway to use JSON to create an object that is of a specific type?</p> <p>UPDATE: My sample with the Person object is just to simplify the question. In fact, I am unable to modify the constructors of the actual objects that I need to create instances of. The objects are part of a third-party library.</p> <p>UPDATE: Using some of the suggestions below, I was able to figure out a way to create an object that inherits from the original, and accept JSON in it's constructor. This is neat!</p> <pre><code>personWrapper = function(obj){ for(var o in obj){ this[o] = obj[o]; } }; personWrapper.prototype = new Person(); var you = new personWrapper({FirstName: "Chris"}); alert(you.GetFirstName()); alert(you instanceof Person); // returns True - we are successfully inheriting from Person! </code></pre>
[ { "answer_id": 185438, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 5, "selected": true, "text": "function Person() {\n this.loadFromJSON = function(json) {\n this.FirstName = json.FirstName;\n };\n}\n" }, { ...
2008/10/09
[ "https://Stackoverflow.com/questions/185429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7831/" ]
185,445
<p>My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off this managed c++ project on my XP development box, it works fine. On QA/Customer Windows 2003 boxes, a FileLoadException is thrown.</p> <p>First off, this used to work fine. Secondly, I've validated the same working code on my box fails on the qa box. </p> <p>How can I track down the cause of this exception?</p>
[ { "answer_id": 185580, "author": "Henk", "author_id": 4613, "author_profile": "https://Stackoverflow.com/users/4613", "pm_score": 2, "selected": true, "text": "depends.exe" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/185445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18313/" ]
185,447
<p>Okay, I got this small program which tags (as in ID3v2.4 etc.) some music files. Now I want the user to have the option to move and/or rename those tagged files if he/she wishes to.</p> <p>Considering that I am trying to keep a fairly clean and loosely coupled design in this system (even though extensibility is not really important here, it's just fun), would you just call <code>someFileInfoObject.Move(someWhere)</code> where <code>someWhere</code> is the applied pattern or would it be wise to implement some classes - maybe MoveFileStrategy, RenameFileStrategy (I know that moving/renaming can be considered the same in some systems, but I want them to be enabled separately) - which figure out the destination and whether the strategy should be applied when an <code>Apply(FileInfo file)</code> method or so is called.</p> <p>If you think that some strategy classes may be useful, do you have any suggestion on a good implementation strategy?</p> <p>As already said, over-engineering is not really an issue here, because it is a fun project mainly targeted at getting some programming and engineering practice. :)</p>
[ { "answer_id": 185580, "author": "Henk", "author_id": 4613, "author_profile": "https://Stackoverflow.com/users/4613", "pm_score": 2, "selected": true, "text": "depends.exe" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/185447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11963/" ]