qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
52,092
<p>This caught my attention last night.</p> <p>On the latest <a href="http://altnetpodcast.com/episodes/10-oop-in-ruby" rel="nofollow noreferrer">ALT.NET Podcast</a> Scott Bellware discusses how as opposed to Ruby, languages like C#, Java et al. are not truly object oriented rather opting for the phrase &quot;class-oriented&quot;. They talk about this distinction in very vague terms without going into much detail or discussing the pros and cons much.</p> <p>What is the real difference here and how much does it matter? What are other languages then are &quot;object-oriented&quot;? It sounded pretty interesting but I don't want to have to learn Ruby just to know what if anything I am missing.</p> <h2>Update</h2> <p>After reading some of the answers below it seems like people generally agree that the reference is to duck-typing. What I'm not sure I understand still though is the claim that this ultimately changes all that much. Especially if you are already doing proper TDD with loose coupling etc. Can someone show me an example of a specific thing I could do with Ruby that I cannot do with C# and that exemplifies this different OOP approach?</p>
[ { "answer_id": 52107, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https://Stackoverflow.com/users/2260", "pm_score": 2, "selected": false, "text": "__iter__()" }, { "answer_id": 93409, "author": "Gishu", "author_id": 1695, "author_profile": "https:...
2008/09/09
[ "https://Stackoverflow.com/questions/52092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
52,098
<p>I'm developing an application for Windows Mobile Devices using Visual Studio .NET 2008 whose UI requires the use of a ComboBox control. Unfortunately, for devices with neither a hardware fullsize keyboard nor a touchscreen interface, there is no way to move (tab) from the ComboBox control to another control on the same form (say, specifying a product in the ComboBox and then moving to a text field to add a quantity).</p> <p>I've tried creating an event handler for the ComboBox's KeyPress event and setting the focus to the next control manually whenever the user presses the Right or Left directional key but unfortunately the event handler does not capture those key presses.</p> <p>Any ideas? I have a strong suspicion that this is being over-engineered and that there exists a better control more suited to what I need to do; I find it a bit inconceivable that tabbing out of a Combo Box control could be that difficult.</p> <p>Thanks!</p> <p>EDIT: Apparently I can capture the KeyDown and KeyUp events on the ComboBox, which allows me to set the focus or tab to the next control. Still over-engineered - still looking for ideas!</p>
[ { "answer_id": 52116, "author": "Billy Jo", "author_id": 3447, "author_profile": "https://Stackoverflow.com/users/3447", "pm_score": 2, "selected": true, "text": "KeyDown" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1943/" ]
52,108
<p>What is the shortcut to open a file within your solution in Visual Studio 2008 (+ Resharper)?</p>
[ { "answer_id": 79864, "author": "Steve Steiner", "author_id": 3892, "author_profile": "https://Stackoverflow.com/users/3892", "pm_score": 2, "selected": false, "text": ">of f" }, { "answer_id": 106681, "author": "Hamish Smith", "author_id": 15572, "author_profile": "h...
2008/09/09
[ "https://Stackoverflow.com/questions/52108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4140/" ]
52,134
<p>How can I tell from the assembly name, or assembly class (or others like it), whether an assembly is part of the <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> framework (that is, <code>System.windows.Forms</code>)?</p> <p>So far I've considered the PublicKeyToken, and CodeBase properties, but these are not always the same for the whole framework.</p> <p>The reason I want this information is to get a list of assemblies that my EXE file is using that need to be on client machines, so I can package the correct files in a setup file without using the Visual Studio setup system. The problem is, I don't want to pick up any .NET framework assemblies, and I want it to be an automatic process that is easy to roll out whenever a major update is finished.</p> <p>The ultimate solution would be that there is an IsFramework property... :)</p>
[ { "answer_id": 52199, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": 1, "selected": false, "text": "C:\\Windows\\Microsoft.NET\\Framework" }, { "answer_id": 749535, "author": "Community", "author_id": -...
2008/09/09
[ "https://Stackoverflow.com/questions/52134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4002/" ]
52,160
<p>How can you obtain the Type (the name as a string is sufficient) of an Object in VB6 at runtime?</p> <p>i.e. something like:</p> <pre><code>If Typeof(foobar) = "CommandButton" Then ... </code></pre> <p><strong>/EDIT:</strong> to clarify, I need to check on Dynamically Typed objects. An example:</p> <pre><code>Dim y As Object Set y = CreateObject("SomeType") Debug.Print( &lt;The type name of&gt; y) </code></pre> <p>Where the output would be "CommandButton"</p>
[ { "answer_id": 52181, "author": "Daren Thomas", "author_id": 2260, "author_profile": "https://Stackoverflow.com/users/2260", "pm_score": 0, "selected": false, "text": "IDispatch" }, { "answer_id": 52243, "author": "Kris Erickson", "author_id": 3798, "author_profile": ...
2008/09/09
[ "https://Stackoverflow.com/questions/52160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1111/" ]
52,176
<p>Since Graduating from a very small school in 2006 with a badly shaped &amp; outdated program (I'm a foreigner &amp; didn't know any better school at the time) I've come to realize that I missed a lot of basic concepts from a mathematical &amp; software perspective that are mostly the foundations of other higher concepts.</p> <p>I.e. I tried to listen/watch the open courseware from MIT on <a href="http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/CourseHome/" rel="nofollow noreferrer">Introduction to Algorithms</a> but quickly realized I was missing several mathematical concepts to better understand the course.</p> <p>So what are the core mathematical concepts a good software engineer should know? And what are the possible books/sites you will recommend me?</p>
[ { "answer_id": 52338, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 4, "selected": false, "text": "if (condition-1) {\n if (condition-2) {\n action-1\n } else {\n action-2\n} else {\n action-2\n}\n"...
2008/09/09
[ "https://Stackoverflow.com/questions/52176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5413/" ]
52,187
<p>I need to test a serial port application on Linux, however, my test machine only has one serial port. </p> <p>Is there a way to add a virtual serial port to Linux and test my application by emulating a device through a shell or script?</p> <p>Note: I cannot remap the port, it hard coded on ttys2 and I need to test the application as it is written.</p>
[ { "answer_id": 74517, "author": "apenwarr", "author_id": 42219, "author_profile": "https://Stackoverflow.com/users/42219", "pm_score": 7, "selected": true, "text": "/dev/ptyp5" }, { "answer_id": 10555885, "author": "slonik", "author_id": 1384839, "author_profile": "ht...
2008/09/09
[ "https://Stackoverflow.com/questions/52187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445087/" ]
52,213
<p>When a user hits Refresh on their browser, it reloads the page but keeps the contents of form fields. While I can see this being a useful default, it can be annoying on some dynamic pages, leading to a broken user experience.</p> <p>Is there a way, in HTTP headers or equivalents, to change this behaviour?</p>
[ { "answer_id": 52226, "author": "Joseph Bui", "author_id": 3275, "author_profile": "https://Stackoverflow.com/users/3275", "pm_score": 6, "selected": true, "text": "<input autocomplete=\"off\">\n" }, { "answer_id": 52229, "author": "Espo", "author_id": 2257, "author_p...
2008/09/09
[ "https://Stackoverflow.com/questions/52213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000/" ]
52,234
<p>Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible?</p> <p>If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)?</p>
[ { "answer_id": 52242, "author": "Curt Hagenlocher", "author_id": 533, "author_profile": "https://Stackoverflow.com/users/533", "pm_score": 7, "selected": true, "text": "tf diff /shelveset:shelveset /format:unified\n" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/736/" ]
52,238
<p>How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag?</p> <p>An answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be most helpful.</p>
[ { "answer_id": 52250, "author": "pix0r", "author_id": 72, "author_profile": "https://Stackoverflow.com/users/72", "pm_score": 3, "selected": false, "text": "addClassName" }, { "answer_id": 52253, "author": "swilliams", "author_id": 736, "author_profile": "https://Stac...
2008/09/09
[ "https://Stackoverflow.com/questions/52238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3920/" ]
52,239
<p>We are working with an oracle database in which the person that set it up is "long gone" and thus do not know the sysdba password, but need it. We have root access to the box (its on linux). Is there any way to recover or change the sys passwords?</p>
[ { "answer_id": 52244, "author": "Paul Hargreaves", "author_id": 5330, "author_profile": "https://Stackoverflow.com/users/5330", "pm_score": 6, "selected": true, "text": "sqlplus \"/ as sysdba\"\n" }, { "answer_id": 34349844, "author": "Lalit Kumar B", "author_id": 3989608...
2008/09/09
[ "https://Stackoverflow.com/questions/52239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/673/" ]
52,256
<p>I need to check programmatically (in .NET) whether a given user (domain account) is a member of the built-in Administrators group on a current computer (the one where the application gets executed).</p> <p>Is it possible?</p>
[ { "answer_id": 52257, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 1, "selected": false, "text": "System.DirectoryServices.AccountManagement" }, { "answer_id": 310125, "author": "Ryan", "author_id": 20198, ...
2008/09/09
[ "https://Stackoverflow.com/questions/52256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/95/" ]
52,286
<p>Wrote the following in PowersHell as a quick iTunes demonstration:</p> <pre><code>$iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource foreach ($PList in $LibrarySource.Playlists) { write-host $PList.name } </code></pre> <p>This works well and pulls back a list of playlist names. However on trying to close iTunes a warning appears</p> <blockquote> <p>One or more applications are using the iTunes scripting interface. Are you sure you want to quit?</p> </blockquote> <p>Obviously I can just ignore the message and press [Quit] or just wait the 20 seconds or so, but is there a clean way to tell iTunes that I've finished working with it?</p> <pre><code>Itunes 7.7.1, Windows XP </code></pre>
[ { "answer_id": 52309, "author": "bruceatk", "author_id": 791, "author_profile": "https://Stackoverflow.com/users/791", "pm_score": 3, "selected": true, "text": "\n [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$LibrarySource)\n [void][System.R...
2008/09/09
[ "https://Stackoverflow.com/questions/52286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5330/" ]
52,312
<p>So, I know that try/catch does add some overhead and therefore isn't a good way of controlling process flow, but where does this overhead come from and what is its actual impact?</p>
[ { "answer_id": 52330, "author": "Tobi", "author_id": 5422, "author_profile": "https://Stackoverflow.com/users/5422", "pm_score": 3, "selected": false, "text": "bool HasRight(string rightName, DomainObject obj) {\n try {\n CheckRight(rightName, obj);\n return true;\n }\n catch (E...
2008/09/09
[ "https://Stackoverflow.com/questions/52312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
52,313
<p>This question is kind of an add-on to this <a href="https://stackoverflow.com/questions/44905/c-switch-statement-limitations-why">question</a></p> <p>In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month total for the selected month and each subsequent month thereafter. (simple example, not meant to be real) </p> <pre><code>switch (month) { case 0: add something to month totals case 1: add something to month totals case 2: add something to month totals default: break; } </code></pre> <p>Is there a logical alternative to this in C# without having to write out a ton of if statements?</p> <pre><code>if (month &lt;= 0) add something to month if (month &lt;= 1) add something to month if (month &lt;= 2) add something to month .... etc </code></pre>
[ { "answer_id": 52318, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 5, "selected": true, "text": "foreach(MonthSpecification spec in this.MonthSpecifications)\n{\n if(spec.IsSatisfiedBy(month))\n spec.Perform(m...
2008/09/09
[ "https://Stackoverflow.com/questions/52313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4144/" ]
52,315
<p>We have some input data that sometimes appears with &amp;nbsp characters on the end.</p> <p>The data comes in from the source system as varchar() and our attempts to cast as decimal fail b/c of these characters.</p> <p>Ltrim and Rtrim don't remove the characters, so we're forced to do something like:</p> <pre><code>UPDATE myTable SET myColumn = replace(myColumn,char(160),'') WHERE charindex(char(160),myColumn) &gt; 0 </code></pre> <p>This works for the &amp;nbsp, but is there a good way to do this for any non-alphanumeric (or in this case numeric) characters?</p>
[ { "answer_id": 52327, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 4, "selected": true, "text": "-- Put something like this into a user function:\nDECLARE @cString VARCHAR(32)\nDECLARE @nPos INTEGER\nSELECT @cString = '...
2008/09/09
[ "https://Stackoverflow.com/questions/52315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5202/" ]
52,321
<p>Using the obsolete System.Web.Mail sending email works fine, here's the code snippet:</p> <pre><code> Public Shared Sub send(ByVal recipent As String, ByVal from As String, ByVal subject As String, ByVal body As String) Try Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage Message.To = recipent Message.From = from Message.Subject = subject Message.Body = body Message.BodyFormat = MailFormat.Html Try SmtpMail.SmtpServer = MAIL_SERVER SmtpMail.Send(Message) Catch ehttp As System.Web.HttpException critical_error("Email sending failed, reason: " + ehttp.ToString) End Try Catch e As System.Exception critical_error(e, "send() in Util_Email") End Try End Sub </code></pre> <p>and here's the updated version:</p> <pre><code>Dim mailMessage As New System.Net.Mail.MailMessage() mailMessage.From = New System.Net.Mail.MailAddress(from) mailMessage.To.Add(New System.Net.Mail.MailAddress(recipent)) mailMessage.Subject = subject mailMessage.Body = body mailMessage.IsBodyHtml = True mailMessage.Priority = System.Net.Mail.MailPriority.Normal Try Dim smtp As New Net.Mail.SmtpClient(MAIL_SERVER) smtp.Send(mailMessage) Catch ex As Exception MsgBox(ex.ToString) End Try </code></pre> <p>I have tried many different variations and nothing seems to work, I have a feeling it may have to do with the SmtpClient, is there something that changed in the underlying code between these versions?</p> <p>There are no exceptions that are thrown back.</p>
[ { "answer_id": 52361, "author": "Kevin Fairchild", "author_id": 3743, "author_profile": "https://Stackoverflow.com/users/3743", "pm_score": 0, "selected": false, "text": "smtp.UseDefaultCredentials = True \n" }, { "answer_id": 52371, "author": "David Basarab", "author_id"...
2008/09/09
[ "https://Stackoverflow.com/questions/52321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4827/" ]
52,344
<p>I'm thinking this might be a quick and easy way to lower the form spam on our site just a little bit. The idea being that (I have read) spammers aren't running with javascript enabled. (Or at least they are accessing your website without running javascript. I.e., they aren't browsing up to it in IE or FF.</p> <p>I can use .asp or .aspx.</p>
[ { "answer_id": 52372, "author": "Brian Warshaw", "author_id": 1344, "author_profile": "https://Stackoverflow.com/users/1344", "pm_score": 0, "selected": false, "text": "noscript" }, { "answer_id": 52379, "author": "chrisofspades", "author_id": 2614, "author_profile": ...
2008/09/09
[ "https://Stackoverflow.com/questions/52344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4906/" ]
52,353
<p>I have an application that reads a CSV file with piles of data rows. I give the user a summary of the number of rows based on types of data, but I want to make sure that I don't read in too many rows of data and cause <code>OutOfMemoryError</code>s. Each row translates into an object. Is there an easy way to find out the size of that object programmatically? Is there a reference that defines how large primitive types and object references are for a <code>VM</code>?</p> <p>Right now, I have code that says read up to <strong>32,000 rows</strong>, but I'd also like to have code that says read as many rows as possible until I've used <strong>32MB</strong> of memory. Maybe that is a different question, but I'd still like to know. </p>
[ { "answer_id": 52362, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": -1, "selected": false, "text": "Serializable myObject;\nObjectOutputStream oos = new ObjectOutputStream (new FileOutputStream (\"obj.ser\"));\noos.write (...
2008/09/09
[ "https://Stackoverflow.com/questions/52353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5074/" ]
52,356
<p>I'm still fairly new to T-SQL and SQL 2005. I need to import a column of integers from a table in database1 to a identical table (only missing the column I need) in database2. Both are sql 2005 databases. I've tried the built in import command in Server Management Studio but it's forcing me to copy the entire table. This causes errors due to constraints and 'read-only' columns (whatever 'read-only' means in sql2005). I just want to grab a single column and copy it to a table.</p> <p>There must be a simple way of doing this. Something like:</p> <pre><code>INSERT INTO database1.myTable columnINeed SELECT columnINeed from database2.myTable </code></pre>
[ { "answer_id": 52376, "author": "Peter", "author_id": 5189, "author_profile": "https://Stackoverflow.com/users/5189", "pm_score": 2, "selected": false, "text": "INSERT INTO Datbase1..MyTable\n (ColumnList)\nSELECT FieldsIWant\n FROM Database2..MyTable\n" }, { "answer_id": 524...
2008/09/09
[ "https://Stackoverflow.com/questions/52356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5433/" ]
52,357
<p>I've been wondering, what is the point of clog? As near as I can tell, clog is the same as cerr but with buffering so it is more efficient. Usually stderr is the same as stdout, so clog is the same as cout. This seems pretty lame to me, so I figure I must be misunderstanding it. If I have log messages going out to the same place I have error messages going out to (perhaps something in /var/log/messages), then I probably am not writing too much out (so there isn't much lost by using non-buffered cerr). In my experience, I want my log messages up to date (not buffered) so I can help find a crash (so I don't want to be using the buffered clog). Apparently I should always be using cerr.</p> <p>I'd like to be able to redirect clog inside my program. It would be useful to redirect cerr so that when I call a library routine I can control where cerr and clog go to. Can some compilers support this? I just checked DJGPP and stdout is defined as the address of a FILE struct, so it is illegal to do something like "stdout = freopen(...)".</p> <ul> <li>Is it possible to redirect clog, cerr, cout, stdin, stdout, and/or stderr?</li> <li>Is the only difference between clog and cerr the buffering?</li> <li>How should I implement (or find) a more robust logging facility (links please)?</li> </ul>
[ { "answer_id": 52365, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 6, "selected": true, "text": "rdbuf" }, { "answer_id": 52381, "author": "Ben Collins", "author_id": 3279, "author_profile": "http...
2008/09/09
[ "https://Stackoverflow.com/questions/52357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4662/" ]
52,359
<p>I'm trying to reduce the form spam on our website. (It's actually pretty recent).</p> <p>I seem to remember reading somewhere that the spammers aren't executing the Javascript on the site.</p> <p>Is that true? And if so, then could you simply check for javascript being disabled and then figure it's <em>likely</em> that it's spam?</p>
[ { "answer_id": 52382, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 1, "selected": false, "text": "<noscript>" }, { "answer_id": 52392, "author": "Jason Navarrete", "author_id": 3920, "author_profil...
2008/09/09
[ "https://Stackoverflow.com/questions/52359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4906/" ]
52,360
<p>What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?</p>
[ { "answer_id": 52422, "author": "Ryan Farley", "author_id": 1627, "author_profile": "https://Stackoverflow.com/users/1627", "pm_score": 2, "selected": false, "text": "System.Environment.Version\n" }, { "answer_id": 3161437, "author": "cognitiaclaeves", "author_id": 305442...
2008/09/09
[ "https://Stackoverflow.com/questions/52360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2141/" ]
52,398
<p>So I have some files I want to ignore in a subversion repository, but I don't want my ignore patterns for this to be propagated to the repository.</p> <p>In other words, I added some private files in my checkout that I want to keep, but they only exist for me and wouldn't make sense to be ignored for everyone, so if I use the svn:ignore, this will apply on the directory, and I either have to check that in (which I don't want to do), or see that this directory was modified every time I do an svn status.</p> <p>So, ideally I would like something like a .svnignore file which I could then mark to ignore itself as well as some other files (I think this is a possibility in git for example, using a .gitignore file, or whatever the name is).</p> <p>I'm guessing it might work to ignore the whole directory (maybe), but then I suspect I won't see any new files in that directory, which would also not be desirable.</p> <p>So does anybody know a way to do this in subversion?</p>
[ { "answer_id": 52574, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": ".subversion" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
52,400
<p>I'm sure this has already been asked and answered so I apologize in advance for that but I'm not figuring out the correct keywords to search for. Searching for "Pattern" hits way too many Q &amp; A's to be useful.</p> <p>I'm working on a regression testing app. I'm displaying a form on the screen and according to which user is logged in to the app some of the fields should be read-only. So I can abstract a field object and I can abstract a user object but what pattern should I be looking at to describe the intersection of these two concepts? In other words how should I describe that for Field 1 and User A, the field should be read-only? It seems like read-only (or not) should be a property of the Field class but as I said, it depends on which user is looking at the form. I've considered a simple two-dimensional array (e. g. ReadOnly[Field,User] = True) but I want to make sure I've picked the most effective structure to represent this. </p> <p>Are there any software design patterns regarding this kind of data structure? Am I overcomplicating things--would a two-dimensional array be the best way to go here? As I said if this has been asked and answered, I do apologize. I did search here and didn't find anything and a Google search failed to turn up anything either. </p>
[ { "answer_id": 52481, "author": "maccullt", "author_id": 4945, "author_profile": "https://Stackoverflow.com/users/4945", "pm_score": 3, "selected": true, "text": "Field1ReadonlyRules = {\n 'user class 1' : True,\n 'user class 2' : False\n}\n\nfield1.readOnly = Field1ReadonlyRules[ ...
2008/09/09
[ "https://Stackoverflow.com/questions/52400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2820/" ]
52,430
<p>I've got the following rough structure:</p> <pre><code>Object -&gt; Object Revisions -&gt; Data </code></pre> <p>The Data can be shared between several Objects.</p> <p>What I'm trying to do is clean out old Object Revisions. I want to keep the first, active, and a spread of revisions so that the last change for a time period is kept. The Data might be changed a lot over the course of 2 days then left alone for months, so I want to keep the last revision before the changes started and the end change of the new set.</p> <p>I'm currently using a cursor and temp table to hold the IDs and date between changes so I can select out the low hanging fruit to get rid of. This means using @LastID, @LastDate, updates and inserts to the temp table, etc... </p> <p>Is there an easier/better way to calculate the date difference between the current row and the next row in my initial result set without using a cursor and temp table? </p> <p>I'm on sql server 2000, but would be interested in any new features of 2005, 2008 that could help with this as well.</p>
[ { "answer_id": 52455, "author": "Peter", "author_id": 5189, "author_profile": "https://Stackoverflow.com/users/5189", "pm_score": 2, "selected": false, "text": "SELECT DATEDIFF(HOUR, prev.ActivityDate, curr.ActivityDate)\n FROM MyTable curr\n JOIN MyTable prev\n ON prev.ObjectID = c...
2008/09/09
[ "https://Stackoverflow.com/questions/52430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5201/" ]
52,438
<p>I've been doing c# for a long time, and have never come across an easy way to just new up a hash.</p> <p>I've recently become acquainted with the ruby syntax of hashes and wonder, does anyone know of a simple way to declare a hash as a literal, without doing all the add calls.</p> <pre><code>{ "whatever" =&gt; {i =&gt; 1}; "and then something else" =&gt; {j =&gt; 2}}; </code></pre>
[ { "answer_id": 52443, "author": "Wheelie", "author_id": 1131, "author_profile": "https://Stackoverflow.com/users/1131", "pm_score": 6, "selected": true, "text": "var students = new Dictionary<int, StudentName>()\n{\n { 111, new StudentName {FirstName=\"Sachin\", LastName=\"Karnik\", I...
2008/09/09
[ "https://Stackoverflow.com/questions/52438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220/" ]
52,449
<p>Can I return it as an object if I am doing a </p> <pre><code>Select OneItem from Table Where OtherItem = "blah"? </code></pre> <p>Is there a better way to do this?</p> <p>I am building a constructor to return an object based on its name rather than its ID.</p>
[ { "answer_id": 52470, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 4, "selected": true, "text": "query.UniqueResult<T>()" }, { "answer_id": 214317, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "auth...
2008/09/09
[ "https://Stackoverflow.com/questions/52449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4140/" ]
52,485
<p>I have a Question class:</p> <pre><code>class Question { public int QuestionNumber { get; set; } public string Question { get; set; } public string Answer { get; set; } } </code></pre> <p>Now I make an ICollection of these available through an ObjectDataSource, and display them using a Repeater bound to the DataSource. I use <strong>&lt;%#Eval("Question")%></strong> to display the Question, and I use a TextBox and <strong>&lt;%#Bind("Answer")%></strong> to accept an answer.</p> <p>If my ObjectDataSource returns three Question objects, then my Repeater displays the three questions with a TextBox following each question for the user to provide an answer.</p> <p>So far it works great.</p> <p>Now I want to take the user's response and put it back into the relevant Question classes, which I will then persist.</p> <p>Surely the framework should take care of all of this for me? I've used the Bind method, I've specified a DataSourceID, I've specified an Update method in my ObjectDataSource class, but there seems no way to actually kickstart the whole thing.</p> <p>I tried adding a Command button and in the code behind calling MyDataSource.Update(), but it attempts to call my Update method with no parameters, rather than the Question parameter it expects.</p> <p>Surely there's an easy way to achieve all of this with little or no codebehind?</p> <p>It seems like all the bits are there, but there's some glue missing to stick them all together.</p> <p>Help!</p> <p>Anthony</p>
[ { "answer_id": 52513, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 2, "selected": true, "text": "foreach(RepeaterItem item in rptQuestions.Items)\n{\n //pull out question\n var question = (Question)item.DataItem;\...
2008/09/09
[ "https://Stackoverflow.com/questions/52485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/366/" ]
52,492
<p>I just started using GNU Emacs as my text editor and I am concerned about getting afflicted with "<a href="http://en.wikipedia.org/wiki/Emacs#Emacs_pinky" rel="nofollow noreferrer">Emacs Pinky</a>" by having to constantly press the control key with my pinky finger as is required when using Emacs. How can I avoid potentially getting this type of repetitive strain injury?</p>
[ { "answer_id": 52564, "author": "Eric Z Beard", "author_id": 1219, "author_profile": "https://Stackoverflow.com/users/1219", "pm_score": 3, "selected": false, "text": "[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout] \"Scancode Map\"=hex:00,00,00,00,00,00,00,00,0...
2008/09/09
[ "https://Stackoverflow.com/questions/52492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
52,506
<p>A friend and I were discussing C++ templates. He asked me what this should do:</p> <pre><code>#include &lt;iostream&gt; template &lt;bool&gt; struct A { A(bool) { std::cout &lt;&lt; "bool\n"; } A(void*) { std::cout &lt;&lt; "void*\n"; } }; int main() { A&lt;true&gt; *d = 0; const int b = 2; const int c = 1; new A&lt; b &gt; (c) &gt; (d); } </code></pre> <p>The last line in main has two reasonable parses. Is 'b' the template argument or is <code>b &gt; (c)</code> the template argument? </p> <p>Although, it is trivial to compile this, and see what we get, we were wondering what resolves the ambiguity?</p>
[ { "answer_id": 52617, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 4, "selected": true, "text": "new A<b>(c) > d" }, { "answer_id": 52875, "author": "Lee Baldwin", "author_id": 5200, "author_prof...
2008/09/09
[ "https://Stackoverflow.com/questions/52506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4798/" ]
52,550
<p>What does the <code>,</code> operator do in C?</p>
[ { "answer_id": 52558, "author": "lillq", "author_id": 2064, "author_profile": "https://Stackoverflow.com/users/2064", "pm_score": 8, "selected": true, "text": "(expression1, expression2)\n" }, { "answer_id": 52559, "author": "Ben Collins", "author_id": 3279, "author_...
2008/09/09
[ "https://Stackoverflow.com/questions/52550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064/" ]
52,557
<p>Anyone know this compiler feature? It seems GCC support that. How does it work? What is the potential gain? In which case it's good? Inner loops?</p> <p>(this question is specific, not about optimization in general, thanks)</p>
[ { "answer_id": 52569, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "gperf" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1277510/" ]
52,561
<p>What is iPhone's browser tag and how iPhone optimized web site is different from a usual mobile web site?</p> <p>Thanks!</p>
[ { "answer_id": 52570, "author": "Espen Herseth Halvorsen", "author_id": 1542, "author_profile": "https://Stackoverflow.com/users/1542", "pm_score": 2, "selected": true, "text": "<!--#if expr=\"(${HTTP_USER_AGENT} = /iPhone/)\"--> \n\n<!-- \nplace iPhone code in here \n--> \n\n<!--#...
2008/09/09
[ "https://Stackoverflow.com/questions/52561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4808/" ]
52,563
<p>I'm trying to let an <code>&lt;input type="text"&gt;</code> (henceforth referred to as “textbox”) fill a parent container by settings its <code>width</code> to <code>100%</code>. This works until I give the textbox a padding. This is then added to the content width and the input field overflows. Notice that in Firefox this only happens when rendering the content as standards compliant. In quirks mode, another box model seems to apply.</p> <p>Here's a minimal code to reproduce the behaviour in all modern browsers.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>#x { background: salmon; padding: 1em; } #y, input { background: red; padding: 0 20px; width: 100%; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="x"&gt; &lt;div id="y"&gt;x&lt;/div&gt; &lt;input type="text"/&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>My question: <strong>How do I get the textbox to fit the container?</strong></p> <p><em>Notice</em>: for the <code>&lt;div id="y"&gt;</code>, this is straightforward: simply set <code>width: auto</code>. However, if I try to do this for the textbox, the effect is different and the textbox takes its default row count as width (even if I set <code>display: block</code> for the textbox).</p> <p>EDIT: David's solution would of course work. However, I do not want to modify the HTML – I do especially not want to add dummy elements with no semantic functionality. This is a typical case of <a href="http://en.wiktionary.org/wiki/Citations:divitis" rel="nofollow noreferrer">divitis</a> that I want to avoid at all cost. This can only be a last-resort hack.</p>
[ { "answer_id": 52575, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 0, "selected": false, "text": "margin: -1em;\n" }, { "answer_id": 52633, "author": "David Kolar", "author_id": 3283, "author_profile": "...
2008/09/09
[ "https://Stackoverflow.com/questions/52563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1968/" ]
52,591
<p>A requirement for an ASP.Net 2.0 project I'm working on limits a certain field to a max of 10 words (not characters). I'm currently using a CustomValidator control with the following ServerValidate method:</p> <pre><code>Protected Sub TenWordsTextBoxValidator_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles TenWordsTextBoxValidator.ServerValidate '' 10 words args.IsValid = args.Value.Split(" ").Length &lt;= 10 End Sub </code></pre> <p>Does anyone have a more thorough/accurate method of getting a word count?</p>
[ { "answer_id": 52610, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 3, "selected": false, "text": "(\\b.*\\b){0,10}\n" }, { "answer_id": 52737, "author": "travis", "author_id": 1414, "author_profile": "...
2008/09/09
[ "https://Stackoverflow.com/questions/52591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1414/" ]
52,600
<p>I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects.</p> <pre><code>CorpObject o = new CorpObject(); Int32 result = o.DoSomethingLousy(); </code></pre> <p>While debugging, the method 'DoSomethingLousy' throws an exception. What does the PDB file do for me? If it does something nice, how can I be sure I'm making use of it?</p>
[ { "answer_id": 53095, "author": "Henk", "author_id": 4613, "author_profile": "https://Stackoverflow.com/users/4613", "pm_score": 4, "selected": true, "text": "Symbols loaded" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3619/" ]
52,646
<p>While cross-site scripting is generally regarded as negative, I've run into several situations where it's necessary.</p> <p>I was recently working within the confines of a very limiting content management system. I needed to include database code within the page, but the hosting server didn't have anything usable available. I set up a couple bare-bones scripts on my own server, originally thinking that I could use AJAX to import the contents of my scripts directly into the template of the CMS (thus retaining dynamic images, menu items, CSS, etc.). I was wrong.</p> <p>Due to the limitations of <code>XMLHttpRequest</code> objects, it's not possible to grab content from a different domain. So I thought <em>iFrame</em> - even though I'm not a fan of frames, I thought that I could create a frame that matched the width and height of the content so that it would appear native. Again, I was blocked by cross-site scripting "protections." While I could indeed load a remote file into the <em>iFrame</em>, I couldn't execute JavaScript to modify its size on either the host page or inside the loaded page.</p> <p>In this particular scenario, I wasn't able to point a subdomain to my server. <strong>I also couldn't create a script on the CMS server that could proxy content from my server, so my last thought was to use a remote JavaScript.</strong></p> <p>A remote JavaScript works. It breaks when the user has JavaScript disabled, which is a downside; but it works. The "problem" I was having with using a remote JavaScript was that I had to use the JS function <code>document.write()</code> to output any content. Any output that isn't JS causes script errors. In addition to using <code>document.write()</code> for every line, you also have to ensure that the content is escaped - or else you end up with more script errors.</p> <p>My solution was as follows:</p> <p>My script received a GET parameter ("page") and then looked for the file (<code>{$page}.php</code>), and read the contents into a variable. However, I had to use awkward buffering techniques in order to actually execute the included scripts (for things like database interaction) then strip the final content of all line break characters (<code>\n</code>) followed by escaping all required characters. The end result is that my original script (which outputs JavaScript) accesses seemingly "standard" scripts on my server and converts their standard output to JavaScript for displaying within the CMS template.</p> <p>While this solution works, it seems like there may be a better way to accomplish the same thing. What is the best way to make cross-site scripting work specifically for the purpose of including content from a completely different domain?</p>
[ { "answer_id": 2802549, "author": "plop", "author_id": 337228, "author_profile": "https://Stackoverflow.com/users/337228", "pm_score": 0, "selected": false, "text": "document.domain" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/52646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1581/" ]
52,652
<p>What are the available libraries for creating pretty charts and graphs in a Python application?</p>
[ { "answer_id": 926029, "author": "serbaut", "author_id": 84760, "author_profile": "https://Stackoverflow.com/users/84760", "pm_score": 4, "selected": false, "text": "from reportlab.graphics.shapes import Drawing\nfrom reportlab.graphics.charts.barcharts import VerticalBarChart\n\nd = Dra...
2008/09/09
[ "https://Stackoverflow.com/questions/52652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/473/" ]
52,657
<p>How are people unit testing code that uses Linq to SQL? </p>
[ { "answer_id": 9353934, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "public class ProductRepo {\n IExampleDataContext DB { get; set };\n public ProductRepo(IExampleDataContext db) {\n ...
2008/09/09
[ "https://Stackoverflow.com/questions/52657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5189/" ]
52,674
<p>Let's say you have a variable in a makefile fragment like the following:</p> <pre><code>MY_LIST=a b c d </code></pre> <p>How do I then reverse the order of that list? I need:</p> <pre><code>$(warning MY_LIST=${MY_LIST}) </code></pre> <p>to show</p> <pre><code>MY_LIST=d c b a </code></pre> <p>Edit: the real problem is that </p> <pre><code>ld -r some_object.o ${MY_LIST} </code></pre> <p>produces an <code>a.out</code> with undefined symbols because the items in <code>MY_LIST</code> are actually archives, but in the wrong order. If the order of <code>MY_LIST</code> is reversed, it will link correctly (I think). If you know a smarter way to get the link order right, clue me in.</p>
[ { "answer_id": 52722, "author": "Ben Collins", "author_id": 3279, "author_profile": "https://Stackoverflow.com/users/3279", "pm_score": 3, "selected": false, "text": "(for d in ${MY_LIST}; do echo $$d; done) | tac" }, { "answer_id": 52903, "author": "ajax", "author_id": 5...
2008/09/09
[ "https://Stackoverflow.com/questions/52674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3279/" ]
52,676
<p>I'm a keyboard junkie. I love having a key sequence to do everything. What are your favorite keyboard shortcuts?</p> <p>I'll start by naming a couple of mine:</p> <p>1 - <kbd>Alt</kbd>-<kbd>Space</kbd> to access the windows menu for the current window</p> <p>2 - <kbd>F2</kbd> to rename a file in Windows Explorer</p>
[ { "answer_id": 843863, "author": "Peter Perháč", "author_id": 81520, "author_profile": "https://Stackoverflow.com/users/81520", "pm_score": 1, "selected": false, "text": "rightclick->Open Link in New Tab" }, { "answer_id": 19919862, "author": "Scott Pelak", "author_id": 2...
2008/09/09
[ "https://Stackoverflow.com/questions/52676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
52,702
<p>I am looking to stream a file housed in a SharePoint 2003 document library down to the browser. Basically the idea is to open the file as a stream and then to "write" the file stream to the reponse, specifying the content type and content disposition headers. Content disposition is used to preserve the file name, content type of course to clue the browser about what app to open to view the file. </p> <p>This works all good and fine in a development environment and UAT environment. However, in the production environment, things do not always work as expected,however only with IE6/IE7. FF works great in all environments. </p> <p>Note that in the production environment SSL is enabled and generally used. (When SSL is not used in the production environment, file streams, is named as expected, and properly dislays.)</p> <p>Here is a code snippet:</p> <pre><code>System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath(".") + "\\" + "test.doc", System.IO.FileMode.Open); long byteNum = fs.Length; byte[] pdfBytes = new byte[byteNum]; fs.Read(pdfBytes, 0, (int)byteNum); Response.AppendHeader("Content-disposition", "filename=Testme.doc"); Response.CacheControl = "no-cache"; Response.ContentType = "application/msword; charset=utf-8"; Response.Expires = -1; Response.OutputStream.Write(pdfBytes, 0, pdfBytes.Length); Response.Flush(); Response.Close(); fs.Close(); </code></pre> <p>Like I said, this code snippet works fine on the dev machine and in the UAT environment. A dialog box opens and asks to save, view or cancel Testme.doc. But in production onnly when using SSL, IE 6 &amp; IE7 don't use the name of the attachment. Instead it uses the name of the page that is sending the stream, testheader.apx and then an error is thrown. </p> <p>IE does provide an advanced setting "Do not save encrypted pages to disk". </p> <p>I suspect this is part of the problem, the server tells the browser not to cache the file, while IE has the "Do not save encrypted pages to disk" enabled.</p> <p>Yes I am aware that for larger files, the code snippet above will be a major drag on memory and this implimentation will be problematic. So the real final solution will not open the entire file into a single byte array, but rather will open the file as a stream, and then send the file down to the client in bite size chunks (e.g. perhaps roughly 10K in size).</p> <p>Anyone else have similar experience "streaming" binary files over ssl? Any suggestions or recommendations?</p>
[ { "answer_id": 53078, "author": "Mauro", "author_id": 2208, "author_profile": "https://Stackoverflow.com/users/2208", "pm_score": 2, "selected": false, "text": "\nResponse.AddHeader(\"Content-Disposition\", \"attachment;filename=myfile.doc\");\n" }, { "answer_id": 77958, "aut...
2008/09/09
[ "https://Stackoverflow.com/questions/52702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4764/" ]
52,703
<p>Has anyone encountered this oddity?</p> <p>I'm checking for the existence of a number of directories in one of my unit tests. <code>is_dir</code> is reporting true (1) in spite of the folder not existing at the time it is called. The code looks like this (with a few extraneous intermediate vars to ease debugging):</p> <pre><code>foreach($userfolders as $uf) { $uf = sprintf($uf, $user_id); $uf = ltrim($uf,'/'); $path = trim($base . '/' . $uf); $res = is_dir($path); //returns false except last time returns 1 $this-&gt;assertFalse($res, $path); } </code></pre> <p>The machine running Ubuntu Linux 8.04 with PHP Version 5.2.4-2ubuntu5.3</p> <p>Things I have checked:</p> <pre><code> - Paths are full paths - The same thing happens on two separate machines (both running Ubuntu) - I have stepped through line by line in a debugger - Paths genuinely don't exist at the point where is_dir is called - While the code is paused on this line, I can actually drop to a shell and run </code></pre> <p>the interactive PHP interpreter and get the correct result - The paths are all WELL under 256 chars - I can't imagine a permissions problem as the folder doesn't exist! The parent folder can't be causing permissions problems as the other folders in the loop are correctly reported as missing.</p> <p>Comments on the PHP docs point to the odd issue with <code>is_dir</code> but not this particular one.</p> <p>I'm not posting this as a "please help me fix" but in the hope that somebody encountering the same thing can search here and <em>hopefully</em> an answer from somebody else who has seen this!</p>
[ { "answer_id": 52712, "author": "reefnet_alex", "author_id": 2745, "author_profile": "https://Stackoverflow.com/users/2745", "pm_score": 1, "selected": false, "text": "is_readable" }, { "answer_id": 52721, "author": "dragonmantank", "author_id": 204, "author_profile":...
2008/09/09
[ "https://Stackoverflow.com/questions/52703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2745/" ]
52,704
<p>How do I discard changes in my working copy that are not in the index?</p>
[ { "answer_id": 52713, "author": "Tobi", "author_id": 5422, "author_profile": "https://Stackoverflow.com/users/5422", "pm_score": 13, "selected": false, "text": "git restore .\n" }, { "answer_id": 52719, "author": "Greg Hewgill", "author_id": 893, "author_profile": "ht...
2008/09/09
[ "https://Stackoverflow.com/questions/52704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
52,714
<p>In the STL almost all containers have an erase function. The question I have is in a vector, the erase function returns an iterator pointing to the next element in the vector. The map container does not do this. Instead it returns a void. Anyone know why there is this inconsistancy?</p>
[ { "answer_id": 52735, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "vector" }, { "answer_id": 52761, "author": "Henk", "author_id": 4613, "author_profile": "https://S...
2008/09/09
[ "https://Stackoverflow.com/questions/52714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2328/" ]
52,732
<p>I need to dynamically create a Video object in ActionScript 2 and add it to a movie clip. In AS3 I just do this:</p> <pre><code>var videoViewComp:UIComponent; // created elsewhere videoView = new Video(); videoView.width = 400; videoView.height = 400; this.videoViewComp.addChild(videoView); </code></pre> <p>Unfortunately, I can't figure out how to accomplish this in AS2. Video isn't a child of MovieClip, so attachMovie() doesn't seem to be getting me anything. I don't see any equivalent to AS3's UIComponent.addChild() method either.</p> <p>Is there any way to dynamically create a Video object in AS2 that actually shows up on the stage?</p> <hr> <p>I potentially need multiple videos at a time though. Is it possible to duplicate that video object?</p> <p>I think I have another solution working. It's not optimal, but it fits with some of the things I have to do for other components so it's not too out of place in the project. Once I get it figured out I'll post what I did here.</p>
[ { "answer_id": 53254, "author": "Pedro", "author_id": 5488, "author_profile": "https://Stackoverflow.com/users/5488", "pm_score": 0, "selected": false, "text": "videoview.visible = false" }, { "answer_id": 3603369, "author": "Tonio FERENER-VARI", "author_id": 435264, ...
2008/09/09
[ "https://Stackoverflow.com/questions/52732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1409/" ]
52,739
<p>Is there a good way to see what format an image is, without having to read the entire file into memory? </p> <p>Obviously this would vary from format to format (I'm particularly interested in TIFF files) but what sort of procedure would be useful to determine what kind of image format a file is without having to read through the entire file?</p> <p><strong>BONUS</strong>: What if the image is a Base64-encoded string? Any reliable way to infer it before decoding it?</p>
[ { "answer_id": 52750, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 5, "selected": true, "text": "file" }, { "answer_id": 52833, "author": "verix", "author_id": 5342, "author_profile": "https://Stackov...
2008/09/09
[ "https://Stackoverflow.com/questions/52739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
52,753
<p>What is best practice when creating your exception classes in a .NET solution: To derive from <code>System.Exception</code> or from <code>System.ApplicationException</code>?</p>
[ { "answer_id": 52762, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": false, "text": "ApplicationException" }, { "answer_id": 52770, "author": "fryguybob", "author_id": 4592, "author_p...
2008/09/09
[ "https://Stackoverflow.com/questions/52753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5392/" ]
52,755
<p>I am using Windows, and I have two monitors.</p> <p>Some applications will <em>always</em> start on my primary monitor, no matter where they were when I closed them.</p> <p>Others will always start on the <em>secondary</em> monitor, no matter where they were when I closed them.</p> <p>Is there a registry setting buried somewhere, which I can manipulate to control which monitor applications launch into by default?</p> <p>@rp: I have Ultramon, and I agree that it is indispensable, to the point that Microsoft should buy it and incorporate it into their OS. But as you said, it doesn't let you control the default monitor a program launches into.</p>
[ { "answer_id": 53187, "author": "David Citron", "author_id": 5309, "author_profile": "https://Stackoverflow.com/users/5309", "pm_score": 7, "selected": true, "text": "GetWindowPlacement()" }, { "answer_id": 511735, "author": "Community", "author_id": -1, "author_profi...
2008/09/09
[ "https://Stackoverflow.com/questions/52755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
52,785
<p>I think this is specific to IE 6.0 but...</p> <p>In JavaScript I add a <code>div</code> to the DOM. I assign an <code>id</code> attribute. When I later try to pick up the <code>div</code> by the <code>id</code> all I get is <code>null</code>.</p> <p>Any suggestions?</p> <p>Example:</p> <pre><code>var newDiv = document.createElement("DIV"); newDiv.setAttribute("ID", "obj_1000"); document.appendChild(newDiv); alert("Added:" + newDiv.getAttribute("ID") + ":" + newDiv.id + ":" + document.getElementById("obj_1000") ); </code></pre> <p>Alert prints <code>"::null"</code></p> <p>Seems to work fine in Firefox 2.0+</p>
[ { "answer_id": 52791, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 1, "selected": false, "text": "// Create the Div\nvar oDiv = document.createElement('div');\ndocument.body.appendChild(oDiv);\n" }, { "answer_...
2008/09/09
[ "https://Stackoverflow.com/questions/52785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2490/" ]
52,794
<p>How do I create a branch in subversion that is deeper' than just the 'branches' directory?</p> <p>I have the standard <code>trunk</code>, <code>tags</code> and <code>branches</code> structure and I want to create a branch that is several directories deeper than the 'branches' tag.</p> <p>Using the standard svn move method, it gives me a <strong>folder not found</strong> error. I also tried copying it into the branches folder, checked it out, and the 'svn move' it into the tree structure I wanted, but also got a 'working copy admin area is missing' error.</p> <p>What do I need to do to create this?</p> <p>For the sake of illustration, let us suppose I want to create a branch to go directly into 'branches/version_1/project/subproject' (which does not exist yet)?</p>
[ { "answer_id": 52799, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 5, "selected": true, "text": "svn copy --parents http://url/to/subproject http://url/to/repository/branches/version_1/project/subproject\n" }, { ...
2008/09/09
[ "https://Stackoverflow.com/questions/52794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
52,797
<p>Is there a way to get the path for the assembly in which the current code resides? I do not want the path of the calling assembly, just the one containing the code. </p> <p>Basically my unit test needs to read some xml test files which are located relative to the dll. I want the path to always resolve correctly regardless of whether the testing dll is run from TestDriven.NET, the MbUnit GUI or something else.</p> <p><strong>Edit</strong>: People seem to be misunderstanding what I'm asking.</p> <p>My test library is located in say </p> <blockquote> <p>C:\projects\myapplication\daotests\bin\Debug\daotests.dll</p> </blockquote> <p>and I would like to get this path:</p> <blockquote> <p>C:\projects\myapplication\daotests\bin\Debug\</p> </blockquote> <p>The three suggestions so far fail me when I run from the MbUnit Gui:</p> <ul> <li><p><code>Environment.CurrentDirectory</code> gives <em>c:\Program Files\MbUnit</em></p></li> <li><p><code>System.Reflection.Assembly.GetAssembly(typeof(DaoTests)).Location</code> gives <em>C:\Documents and Settings\george\Local Settings\Temp\ ....\DaoTests.dll</em></p></li> <li><p><code>System.Reflection.Assembly.GetExecutingAssembly().Location</code> gives the same as the previous.</p></li> </ul>
[ { "answer_id": 52802, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 5, "selected": false, "text": "string path = System.Reflection.Assembly.GetExecutingAssembly().Location\n" }, { "answer_id": 52803, "author": ...
2008/09/09
[ "https://Stackoverflow.com/questions/52797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
52,806
<p>As part of a larger web-app (using CakePHP), I'm putting together a simple blog system. The relationships are exceedingly simple: each User has a Blog, which has many Entries, which have many Comments.</p> <p>An element I'd like to incorporate is a list of "Popular Entries." Popular Entries have been defined as those with the most Comments in the last month, and ultimately they need to be ordered by the number of recent Comments.</p> <p>Ideally, I'd like the solution to stay within Cake's Model data-retrieval apparatus (<code>Model-&gt;find()</code>, etc.), but I'm not sanguine about this.</p> <p>Anyone have a clever/elegant solution? I'm steeling myself for some wild SQL hacking to make this work...</p>
[ { "answer_id": 52814, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 2, "selected": false, "text": "SELECT entry-id, count(id) AS c \nFROM comment \nWHERE comment.createdate >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH) \nGROUP ...
2008/09/09
[ "https://Stackoverflow.com/questions/52806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5030/" ]
52,821
<pre><code>var e1 = new E1(); e1.e2s.Add(new e2()); //e2s is null until e1 is saved, i want to save them all at the same time context.e1s.imsertonsubmit(e1); context.submitchanges(); </code></pre>
[ { "answer_id": 52870, "author": "John Christensen", "author_id": 1194, "author_profile": "https://Stackoverflow.com/users/1194", "pm_score": 0, "selected": false, "text": "var e1 = new E1();\nvar e2 = new e2();\ne1.e2s.Add(e2); //e2s is null until e1 is saved, i want to save them all at ...
2008/09/09
[ "https://Stackoverflow.com/questions/52821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5236/" ]
52,822
<p>How can you import a foxpro DBF file in SQL Server?</p>
[ { "answer_id": 52828, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 5, "selected": true, "text": "SELECT * into SomeTable\nFROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;\nSourceDB=\\\\SomeServer\\SomePath...
2008/09/09
[ "https://Stackoverflow.com/questions/52822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4685/" ]
52,824
<p>Is it possible to merge to a branch that is not a direct parent or child in TFS? I suspect that the answer is no as this is what I've experienced while using it. However, it seems that at certain times it would be really useful when there are different features being worked on that may have different approval cycles (ie. feature one <strong>might</strong> be approved before feature two). This becomes exceedingly difficult when we have production branches where we have to merge some feature into a previous branch so we can release before the next full version.</p> <p>Our current branching strategy is to develop in the trunk (or mainline as we call it), and create a branch to stabilize and release to production. This branch can then be used to create hotfixes and other things while mainline can diverge for upcoming features.</p> <p>What techniques can be used otherwise to mitigate a scenario such as the one(s) described above?</p>
[ { "answer_id": 52894, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 3, "selected": false, "text": "tf.exe merge /recursive /baseless $/TeamProject/SourceBranch $/TeamProject/TargetBranch\n" }, { "answer_id": 5290...
2008/09/09
[ "https://Stackoverflow.com/questions/52824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5416/" ]
52,842
<p><code>System.IO.Directory.GetFiles()</code> returns a <code>string[]</code>. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date? </p> <p><strong>Update:</strong> MSDN points out that the sort order is not guaranteed for .Net 3.5, but the 2.0 version of the page doesn't say anything at all and neither page will help you sort by things like creation or modification time. That information is lost once you have the array (it contains only strings). I could build a comparer that would check for each file it gets, but that means accessing the file system repeatedly when presumably the .GetFiles() method already does this. Seems very inefficient.</p>
[ { "answer_id": 52847, "author": "Kibbee", "author_id": 1862, "author_profile": "https://Stackoverflow.com/users/1862", "pm_score": 3, "selected": false, "text": "Dim Files() As String\nFiles = System.IO.Directory.GetFiles(\"C:\\\")\nArray.Sort(Files)\n" }, { "answer_id": 52865, ...
2008/09/09
[ "https://Stackoverflow.com/questions/52842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
52,874
<p>I have a piece of server-ish software written in Java to run on Windows and OS X. (It is not running on a server, but just a normal user's PC - something like a torrent client.) I would like the software to signal to the OS to keep the machine awake (prevent it from going into sleep mode) while it is active.</p> <p>Of course I don't expect there to be a cross platform solution, but I would love to have some very minimal C programs/scripts that my app can spawn to inform the OS to stay awake.</p> <p>Any ideas?</p>
[ { "answer_id": 52906, "author": "Matt Dillard", "author_id": 863, "author_profile": "https://Stackoverflow.com/users/863", "pm_score": 4, "selected": false, "text": "SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 0, NULL, 0 );\n" }, { "answer_id": 52966, "author": "ScArcher2", ...
2008/09/09
[ "https://Stackoverflow.com/questions/52874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
52,880
<p>Does Google Reader have an API and if so, how can I get the count of the number of unread posts for a specific user knowing their username and password?</p>
[ { "answer_id": 582108, "author": "jimmyorr", "author_id": 19239, "author_profile": "https://Stackoverflow.com/users/19239", "pm_score": 7, "selected": true, "text": "import urllib\nimport urllib2\n\nusername = 'username@gmail.com'\npassword = '******'\n\n# Authenticate to obtain SID\naut...
2008/09/09
[ "https://Stackoverflow.com/questions/52880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
52,883
<p>I'm looking for a graph algorithm with some unusual properties.</p> <p>Each edge in the graph is either an "up" edge or a "down" edge.</p> <p>A valid path can go an indefinite number of "up"'s followed by an indefinite number of "down"'s, or vice versa. However it cannot change direction more than once.</p> <p>E.g., a valid path might be A "up" B "up" C "down" E "down" F an invalid path might be A "up" B "down" C "up" D</p> <p>What is a good algorithm for finding the shortest valid path between two nodes? What about finding all of the equal length shortest paths?</p>
[ { "answer_id": 52920, "author": "Christian Oudard", "author_id": 3757, "author_profile": "https://Stackoverflow.com/users/3757", "pm_score": 5, "selected": true, "text": "UUUDDDD" }, { "answer_id": 985840, "author": "ilya n.", "author_id": 115200, "author_profile": "h...
2008/09/09
[ "https://Stackoverflow.com/questions/52883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
52,898
<p>I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them.</p> <p>Example:</p> <p>Visual Studio:</p> <pre><code>SELECT [column1], [column2] etc... </code></pre> <p>My own way:</p> <pre><code>SELECT column1, column2 etc... </code></pre>
[ { "answer_id": 52901, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 9, "selected": true, "text": "[First Name]" }, { "answer_id": 52910, "author": "Blorgbeard", "author_id": 369, "author_profile": "http...
2008/09/09
[ "https://Stackoverflow.com/questions/52898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5433/" ]
52,927
<p>I frequently find myself writing code like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; foreach (int i in list) { Console.Write("{0}\t", i.ToString()); } Console.WriteLine(); </code></pre> <p>Better would be something like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 3, 5 }; Console.WriteLine("{0}\t", list); </code></pre> <p>I suspect there's some clever way of doing this, but I don't see it. Does anybody have a better solution than the first block? </p>
[ { "answer_id": 52940, "author": "Jason Bunting", "author_id": 1790, "author_profile": "https://Stackoverflow.com/users/1790", "pm_score": 8, "selected": true, "text": "list.ForEach(i => Console.Write(\"{0}\\t\", i));\n" }, { "answer_id": 52941, "author": "John Boker", "au...
2008/09/09
[ "https://Stackoverflow.com/questions/52927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
52,950
<p>I'm not too sure what is going on here, but sometimes a particular file in my repository will change the case of its name. e.g.,:</p> <p>before: <code>File.h</code></p> <p>after: <code>file.h</code></p> <p>I don't really care why this is happening, but this causes git to think it is a new file, and then I have to go and change the file name back. Can you just make git ignore case changes?</p> <p><strong>[edit]</strong> I suspect it is Visual Studio doing something weird with that particular file, because it seems to happen most often when I open and save it after changes. I don't have any way to fix bugs in VS however, but git should be a bit more capable I hope.</p>
[ { "answer_id": 53116, "author": "MarkB", "author_id": 2996, "author_profile": "https://Stackoverflow.com/users/2996", "pm_score": 9, "selected": true, "text": "ignorecase" }, { "answer_id": 38288815, "author": "Andrew Arnott", "author_id": 46926, "author_profile": "ht...
2008/09/09
[ "https://Stackoverflow.com/questions/52950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
52,952
<p>So I'm using an IDataReader to hydrate some business objects, but I don't know at runtime exactly what fields will be in the reader. Any fields that aren't in the reader would be left null on the resulting object. How do you test if a reader contains a specific field without just wrapping it in a try/catch?</p>
[ { "answer_id": 299772, "author": "adparadox", "author_id": 1962, "author_profile": "https://Stackoverflow.com/users/1962", "pm_score": -1, "selected": false, "text": " /// <summary>\n /// Grabs the value from a specific datareader for a list of column names.\n /// </summary>\n ...
2008/09/09
[ "https://Stackoverflow.com/questions/52952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
52,954
<p>Right now my ant task looks like.</p> <pre><code>&lt;javadoc sourcepath="${source}" destdir="${doc}"&gt; &lt;link href="http://java.sun.com/j2se/1.5.0/docs/api/" /&gt; &lt;/javadoc&gt; </code></pre> <p>And I'm getting this warning:</p> <pre><code>javadoc: warning - Error fetching URL: http://java.sun.com/j2se/1.5.0/docs/api/package-list </code></pre> <p>How do I get the javadoc to properly link to the API? I am behind a proxy.</p>
[ { "answer_id": 52973, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 4, "selected": true, "text": "ANT_OPTS=\"-Dhttp.proxyHost=proxy.y.com\" ant doc" }, { "answer_id": 54281, "author": "Rob Spieldenner", "aut...
2008/09/09
[ "https://Stackoverflow.com/questions/52954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5118/" ]
52,964
<p>What is the best way to sort the results of a sql query into a random order within a stored procedure?</p>
[ { "answer_id": 52976, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 4, "selected": false, "text": "select foo from Bar order by newid()\n" }, { "answer_id": 52988, "author": "Jon Galloway", "author_id": 5, ...
2008/09/09
[ "https://Stackoverflow.com/questions/52964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5466/" ]
52,984
<p>How do I setup an Ant task to generate <a href="http://emma.sourceforge.net" rel="noreferrer">Emma</a> code coverage reports?</p>
[ { "answer_id": 52994, "author": "Rob Spieldenner", "author_id": 5118, "author_profile": "https://Stackoverflow.com/users/5118", "pm_score": 5, "selected": true, "text": "<property file=\"build.properties\" />\n<property name=\"source\" location=\"src/main/java\" />\n<property name=\"test...
2008/09/09
[ "https://Stackoverflow.com/questions/52984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5118/" ]
52,989
<p>I have a generic Repository&lt;T&gt; class I want to use with an ObjectDataSource. Repository&lt;T&gt; lives in a separate project called DataAccess. According to <a href="http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/767f1a821d9b23da/b1e045958ae427a5?lnk=st#b1e045958ae427a5" rel="noreferrer">this post from the MS newsgroups</a> (relevant part copied below):</p> <blockquote> <p>Internally, the ObjectDataSource is calling Type.GetType(string) to get the type, so we need to follow the guideline documented in Type.GetType on how to get type using generics. You can refer to MSDN Library on Type.GetType:</p> <p><a href="http://msdn2.microsoft.com/en-us/library/w3f99sx1.aspx" rel="noreferrer">http://msdn2.microsoft.com/en-us/library/w3f99sx1.aspx</a></p> <p>From the document, you will learn that you need to use backtick (`) to denotes the type name which is using generics.</p> <p>Also, here we must specify the assembly name in the type name string.</p> <p>So, for your question, the answer is to use type name like follows:</p> <p>TypeName="TestObjectDataSourceAssembly.MyDataHandler`1[System.String],TestObjectDataSourceAssembly"</p> </blockquote> <p>Okay, makes sense. When I try it, however, the page throws an exception:</p> <pre><code>&lt;asp:ObjectDataSource ID="MyDataSource" TypeName="MyProject.Repository`1[MyProject.MessageCategory],DataAccess" /&gt; </code></pre> <blockquote> <p>[InvalidOperationException: The type specified in the TypeName property of ObjectDataSource 'MyDataSource' could not be found.]</p> </blockquote> <p>The curious thing is that this only happens when I'm viewing the page. When I open the "Configure Data Source" dialog from the VS2008 designer, it properly shows me the methods on my generic Repository class. Passing the TypeName string to Type.GetType() while debugging also returns a valid type. So what gives?</p>
[ { "answer_id": 53106, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 5, "selected": true, "text": "Type type = typeof(Repository<MessageCategory);\nstring assemblyQualifiedName = type.AssemblyQualifiedName;\n" }, { "a...
2008/09/09
[ "https://Stackoverflow.com/questions/52989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4160/" ]
53,025
<p>I've been utilizing the <a href="http://en.wikipedia.org/wiki/Command_pattern" rel="nofollow noreferrer">command pattern</a> in my Flex projects, with asynchronous callback routes required between:</p> <ul> <li>whoever instantiated a given command object and the command object,</li> <li>the command object and the "data access" object (i.e. someone who handles the remote procedure calls over the network to the servers) that the command object calls.</li> </ul> <p>Each of these two callback routes has to be able to be a one-to-one relationship. This is due to the fact that I might have several instances of a given command class running the exact same job at the same time but with slightly different parameters, and I don't want their callbacks getting mixed up. Using events, the default way of handling asynchronicity in AS3, is thus pretty much out since they're inherently based on one-to-many relationships.</p> <p>Currently I have done this using <strong>callback function references</strong> with specific kinds of signatures, but I was wondering <em>if someone knew of a better (or an alternative) way?</em></p> <p>Here's an example to illustrate my current method:</p> <ul> <li>I might have a view object that spawns a <code>DeleteObjectCommand</code> instance due to some user action, passing references to two of its own private member functions (one for success, one for failure: let's say <code>"deleteObjectSuccessHandler()"</code> and <code>"deleteObjectFailureHandler()"</code> in this example) as callback function references to the command class's constructor.</li> <li>Then the command object would repeat this pattern with its connection to the "data access" object.</li> <li>When the RPC over the network has successfully been completed (or has failed), the appropriate callback functions are called, first by the "data access" object and then the command object, so that finally the view object that instantiated the operation in the first place gets notified by having its <code>deleteObjectSuccessHandler()</code> or <code>deleteObjectFailureHandler()</code> called.</li> </ul>
[ { "answer_id": 53743, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 1, "selected": false, "text": "RemoteObject" }, { "answer_id": 53843, "author": "Theo", "author_id": 1109, "author_profile": "https://Stack...
2008/09/09
[ "https://Stackoverflow.com/questions/53025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4111/" ]
53,026
<p>I have a table with an XML column. This column is storing some values I keep for configuring my application. I created it to have a more flexible schema. I can't find a way to update this column directly from the table view in SQL Management Studio. Other (INT or Varchar for example) columns are editable. I know I can write an UPDATE statement or create some code to update it. But I'm looking for something more flexible that will let power users edit the XML directly.</p> <p>Any ideas?</p> <blockquote> <p>Reiterating again: Please don't answer I can write an application. I know that, And that is exactly what I'm trying to avoid.</p> </blockquote>
[ { "answer_id": 8827253, "author": "Jacob", "author_id": 181298, "author_profile": "https://Stackoverflow.com/users/181298", "pm_score": 6, "selected": true, "text": "select 'update [table name] set [xml field name] = ''' + \nconvert(varchar(max), [xml field name]) +\n''' where [primary k...
2008/09/09
[ "https://Stackoverflow.com/questions/53026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1363/" ]
53,041
<p>Visual Studio Solution files contain two GUID's per project entry. I figure one of them is from the AssemblyInfo.cs</p> <p>Does anyone know for sure where these come from, and what they are used for?</p>
[ { "answer_id": 53048, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 3, "selected": false, "text": "Project" }, { "answer_id": 53050, "author": "Jason Olson", "author_id": 5418, "author_profile": "https://Stac...
2008/09/09
[ "https://Stackoverflow.com/questions/53041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
53,046
<p>In python, there are some special variables and filenames that are surrounded by double-underscores. For example, there is the</p> <pre><code>__file__ </code></pre> <p>variable. I am only able to get them to show up correctly inside of a code block. What do I need to enter to get double underscores in regular text without having them interpreted as an emphasis?</p>
[ { "answer_id": 53052, "author": "Blorgbeard", "author_id": 369, "author_profile": "https://Stackoverflow.com/users/369", "pm_score": 6, "selected": true, "text": "\\__file__\n" }, { "answer_id": 53054, "author": "Chris Upchurch", "author_id": 2600, "author_profile": "...
2008/09/09
[ "https://Stackoverflow.com/questions/53046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
53,057
<p>When I drag &amp; drop a dll to the assembly folder on vista, I get the error "Access is denied: mydll.dll". How can I bypass the error message and add my dll to gac?</p>
[ { "answer_id": 74013, "author": "dummy", "author_id": 6297, "author_profile": "https://Stackoverflow.com/users/6297", "pm_score": 0, "selected": false, "text": "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\n" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/53057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
53,069
<p>I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before dropping the dependent table.</p>
[ { "answer_id": 53092, "author": "Almond", "author_id": 1603, "author_profile": "https://Stackoverflow.com/users/1603", "pm_score": -1, "selected": false, "text": "USE AdventureWorks\nGO\nEXEC sp_depends @objname = N'Sales.Customer' ;" }, { "answer_id": 1010628, "author": "gla...
2008/09/09
[ "https://Stackoverflow.com/questions/53069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
53,086
<p>Is the return value of GetHashCode() guaranteed to be consistent assuming the same string value is being used? (C#/ASP.NET)</p> <p>I uploaded my code to a server today and to my surprise I had to reindex some data because my server (win2008 64-bit) was returning different values compared to my desktop computer.</p>
[ { "answer_id": 835571, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": " /// <summary>\n /// Similar to String.GetHashCode but returns the same as the x86 version of String.GetHashCode for x64...
2008/09/09
[ "https://Stackoverflow.com/questions/53086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368/" ]
53,102
<p>From the <em>Immediate Window</em> in Visual Studio: </p> <pre><code>&gt; Path.Combine(@"C:\x", "y") "C:\\x\\y" &gt; Path.Combine(@"C:\x", @"\y") "\\y" </code></pre> <p>It seems that they should both be the same. </p> <p>The old FileSystemObject.BuildPath() didn't work this way...</p>
[ { "answer_id": 53110, "author": "elarson", "author_id": 5434, "author_profile": "https://Stackoverflow.com/users/5434", "pm_score": 2, "selected": false, "text": "urljoin('/some/abs/path', '../other') = '/some/abs/other'\n" }, { "answer_id": 53118, "author": "Ryan Lundy", ...
2008/09/09
[ "https://Stackoverflow.com/questions/53102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3798/" ]
53,108
<p>I have a table similar to this:</p> <pre><code>CREATE TABLE example ( id integer primary key, name char(200), parentid integer, value integer); </code></pre> <p>I can use the parentid field to arrange data into a tree structure.</p> <p>Now here's the bit I can't work out. Given a parentid, is it possible to write an SQL statement to add up all the value fields under that parentid and recurse down the branch of the tree ?</p> <p><strong>UPDATE:</strong> I'm using posgreSQL so the fancy MS-SQL features are not available to me. In any case, I'd like this to be treated as a generic SQL question.</p> <p>BTW, I'm very impressed to have 6 answers within 15 minutes of asking the question! Go stack overflow!</p>
[ { "answer_id": 53137, "author": "jason saldo", "author_id": 1293, "author_profile": "https://Stackoverflow.com/users/1293", "pm_score": 1, "selected": false, "text": "select \n lpad(' ',2*(level-1)) || to_char(child) s\n\nfrom \n test_connect_by \n\nstart with parent is null\nconne...
2008/09/09
[ "https://Stackoverflow.com/questions/53108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5324/" ]
53,112
<p>What are good ways of dealing with the issues surrounding plugin code that interacts with outside system?</p> <p>To give a concrete and representative example, suppose I would like to use Subversion and Eclipse to develop plugins for WordPress. The main code body of WordPress is installed on the webserver, and the plugin code needs to be available in a subdirectory of that server.</p> <p>I could see how you could simply checkout a copy of your code directly under the web directory on a development machine, but how would you also then integrate this with the IDE?</p> <p>I am making the assumption here that all the code for the plugin is located under a single directory.</p> <p>Do most people just add the plugin as a project in an IDE and then place the working folder for the project wherever the 'main' software system wants it to be? Or do people use some kind of symlinks to their home directory?</p>
[ { "answer_id": 53137, "author": "jason saldo", "author_id": 1293, "author_profile": "https://Stackoverflow.com/users/1293", "pm_score": 1, "selected": false, "text": "select \n lpad(' ',2*(level-1)) || to_char(child) s\n\nfrom \n test_connect_by \n\nstart with parent is null\nconne...
2008/09/09
[ "https://Stackoverflow.com/questions/53112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
53,128
<p>I have a webapp that uses JNDI lookups to get a connection to the database.</p> <p>The connection works fine and returns the query no problems. The issue us that the connection does not close properly and is stuck in the 'sleep' mode (according to mysql administrator). This means that they become unusable nad then I run out of connections.</p> <p>Can someone give me a few pointers as to what I can do to make the connection return to the pool successfully.</p> <pre><code>public class DatabaseBean { private static final Logger logger = Logger.getLogger(DatabaseBean.class); private Connection conn; private PreparedStatement prepStmt; /** * Zero argument constructor * Setup generic databse connection in here to avoid redundancy * The connection details are in /META-INF/context.xml */ public DatabaseBean() { try { InitialContext initContext = new InitialContext(); DataSource ds = (DataSource) initContext.lookup("java:/comp/env/jdbc/mysite"); conn = ds.getConnection(); } catch (SQLException SQLEx) { logger.fatal("There was a problem with the database connection."); logger.fatal(SQLEx); logger.fatal(SQLEx.getCause()); } catch (NamingException nameEx) { logger.fatal("There was a naming exception"); logger.fatal(nameEx); logger.fatal(nameEx.getCause()); } } /** * Execute a query. Do not use for statements (update delete insert etc). * * @return A ResultSet of the execute query. A set of size zero if no results were returned. It is never null. * @see #executeUpdate() for running update, insert delete etc. */ public ResultSet executeQuery() { ResultSet result = null; try { result = prepStmt.executeQuery(); logger.debug(prepStmt.toString()); } catch (SQLException SQLEx) { logger.fatal("There was an error running a query"); logger.fatal(SQLEx); } return result; } </code></pre> <p><em>SNIP</em></p> <pre><code>public void close() { try { prepStmt.close(); prepStmt = null; conn.close(); conn = null; } catch (SQLException SQLEx) { logger.warn("There was an error closing the database connection."); } } } </code></pre> <p>This is inside a javabean that uses the database connection.</p> <pre><code>public LinkedList&lt;ImportantNoticeBean&gt; getImportantNotices() { DatabaseBean noticesDBBean = new DatabaseBean(); LinkedList&lt;ImportantNoticeBean&gt; listOfNotices = new LinkedList&lt;ImportantNoticeBean&gt;(); try { PreparedStatement preStmt = noticesDBBean.getConn().prepareStatement("SELECT pseudonym, message, date_to, date_from " + "FROM importantnotices, users " + "WHERE importantnotices.username = users.username " + "AND NOW() &gt;= date_from AND NOW() &lt;= date_to;"); noticesDBBean.setPrepStmt(preStmt); ResultSet result = noticesDBBean.executeQuery(); while (result.next()) { ImportantNoticeBean noticeBean = new ImportantNoticeBean(); noticeBean.setAuthor(result.getString("pseudonym")); noticeBean.setMessage(result.getString("message")); noticeBean.setDateTo(result.getDate("date_to")); noticeBean.setDateFrom(result.getDate("date_from")); listOfNotices.add(noticeBean); } result.close(); } catch (SQLException SQLEx) { logger.error("There was an error in ImportantNoticesBean.getImportantNotices()"); logger.error(SQLEx); } finally { noticesDBBean.close(); } return listOfNotices; } &lt;Context reloadable="true"&gt; &lt;Resource name="jdbc/mysite" auth="Container" type="javax.sql.DataSource" username="user" password="password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mysite" maxActive="10" maxIdle="5" maxWait="6000" removeAbandoned="true" logAbandoned="false" removeAbandonedTimeout="20" /&gt; &lt;/Context&gt; </code></pre>
[ { "answer_id": 54095, "author": "ScArcher2", "author_id": 1310, "author_profile": "https://Stackoverflow.com/users/1310", "pm_score": 2, "selected": false, "text": "* Jakarta-Commons DBCP\n* Jakarta-Commons Collections\n* Jakarta-Commons Pool\n" }, { "answer_id": 58778, "auth...
2008/09/09
[ "https://Stackoverflow.com/questions/53128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3431280/" ]
53,135
<p>I know that we shouldn't being using the registry to store Application Data anymore, but in updating a Legacy application (and wanting to do the fewest changes), what Registry Hives are non-administrators allowed to use? </p> <p>Can I access all of <code>HKEY_CURRENT_USER</code> (the application currently access <code>HKEY_LOCAL_MACHINE</code>) without Administrator privileges? </p>
[ { "answer_id": 53181, "author": "Euro Micelli", "author_id": 2230, "author_profile": "https://Stackoverflow.com/users/2230", "pm_score": 8, "selected": true, "text": "HKEY_CURRENT_USER" } ]
2008/09/09
[ "https://Stackoverflow.com/questions/53135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3798/" ]
53,161
<p>what I'm after is something I can feed a number into and it will return the highest order bit. I'm sure there's a simple way. Below is an example output (left is the input)</p> <pre>1 -> 1 2 -> 2 3 -> 2 4 -> 4 5 -> 4 6 -> 4 7 -> 4 8 -> 8 9 -> 8 ... 63 -> 32</pre>
[ { "answer_id": 53174, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 3, "selected": false, "text": "int highest_order_bit( int x )\n{\n int y = x;\n do { \n x = y;\n y = x & (x-1); //remove low order bit\n...
2008/09/09
[ "https://Stackoverflow.com/questions/53161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1057/" ]
53,162
<p>Given:</p> <pre><code>e = 'a' + 'b' + 'c' + 'd' </code></pre> <p>How do I write the above in two lines?</p> <pre><code>e = 'a' + 'b' + 'c' + 'd' </code></pre>
[ { "answer_id": 53173, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 5, "selected": false, "text": "\\" }, { "answer_id": 53180, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stac...
2008/09/09
[ "https://Stackoverflow.com/questions/53162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
53,164
<p>After working for a while developing games, I've been exposed to both variable frame rates (where you work out how much time has passed since the last tick and update actor movement accordingly) and fixed frame rates (where you work out how much time has passed and choose either to tick a fixed amount of time or sleep until the next window comes).</p> <p>Which method works best for specific situations? Please consider:</p> <ul> <li>Catering to different system specifications;</li> <li>Ease of development/maintenance;</li> <li>Ease of porting;</li> <li>Final performance.</li> </ul>
[ { "answer_id": 59512, "author": "Paul", "author_id": 5841, "author_profile": "https://Stackoverflow.com/users/5841", "pm_score": 3, "selected": false, "text": "const float STEP = 60.f / 1000.f;\nfloat accumulator = 0.f;\n\nvoid Update(float delta)\n{\n accumulator += delta;\n\n whi...
2008/09/09
[ "https://Stackoverflow.com/questions/53164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5488/" ]
53,208
<p>In C++ Windows app, I launch several long running child processes (currently I use CreateProcess(...) to do this. </p> <p>I want the child processes to be automatically closed <strong>if my main processes crashes</strong> or is closed.</p> <p>Because of the requirement that this needs to work for a crash of the "parent", I believe this would need to be done using some API/feature of the operating system. So that all the "child" processes are cleaned up.</p> <p>How do I do this?</p>
[ { "answer_id": 53214, "author": "jm.", "author_id": 814, "author_profile": "https://Stackoverflow.com/users/814", "pm_score": 7, "selected": true, "text": "HANDLE ghJob = CreateJobObject( NULL, NULL); // GLOBAL\nif( ghJob == NULL)\n{\n ::MessageBox( 0, \"Could not create job object\",...
2008/09/10
[ "https://Stackoverflow.com/questions/53208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/814/" ]
53,224
<p>I want to scrape some information off a football (soccer) web page using simple python regexp's. The problem is that players such as the first chap, ÄÄRITALO, comes out as &amp;#196;&amp;#196;RITALO!<br> That is, html uses escaped markup for the special characters, such as &amp;#196;</p> <p>Is there a simple way of reading the html into the correct python string? If it was XML/XHTML it would be easy, the parser would do it.</p>
[ { "answer_id": 53246, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 4, "selected": true, "text": ">>> from BeautifulSoup import BeautifulSoup \n>>> html = \"<html>&#196;&#196;RITALO!</html>\"\n>>> soup = BeautifulSoup(html, c...
2008/09/10
[ "https://Stackoverflow.com/questions/53224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5346/" ]
53,225
<p>Given a reference to a method, is there a way to check whether the method is bound to an object or not? Can you also access the instance that it's bound to?</p>
[ { "answer_id": 53322, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 7, "selected": true, "text": "def isbound(method):\n return method.im_self is not None\n \ndef instance(bounded_method):\n return bounded_method.im_sel...
2008/09/10
[ "https://Stackoverflow.com/questions/53225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
53,256
<p>I have two elements:</p> <pre><code>&lt;input a&gt; &lt;input b onclick="..."&gt; </code></pre> <p>When b is clicked, I want to access a and manipulate some of its data. A does not have a globally unique name, so <code>document.getElementsByName</code> is out. Looking into the event object, I thought <code>event.target.parentNode</code> would have some function like <code>getElementsByName</code>, but this does not seem to be the case with &lt;td&gt;s. Is there any simple way to do this?</p>
[ { "answer_id": 53261, "author": "17 of 26", "author_id": 2284, "author_profile": "https://Stackoverflow.com/users/2284", "pm_score": 4, "selected": true, "text": "a" }, { "answer_id": 53262, "author": "Joseph Pecoraro", "author_id": 792, "author_profile": "https://Sta...
2008/09/10
[ "https://Stackoverflow.com/questions/53256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/429/" ]
53,260
<p>Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue.</p> <p>Assume the login page asks for a username and password, and redirects the user back to the URL they were going to when the login was required. That redirect works find for a URL with only GET parameters, but if the request originally contained some HTTP POST data, that is now lost.</p> <p>Can anyone recommend a way to handle this scenario when HTTP POST data is involved?</p> <p>Obviously, if necessary, the login page could dynamically generate a form with all the POST parameters to pass them along (though that seems messy), but even then, I don't know of any way for the login page to redirect the user on to their intended page while keeping the POST data in the request.</p> <hr> <p><strong>Edit</strong> : One extra constraint I should have made clear - Imagine we don't know if a login will be required until the user submits their comment. For example, their cookie might have expired between when they loaded the form and actually submitted the comment.</p>
[ { "answer_id": 53289, "author": "Robert Swisher", "author_id": 1852, "author_profile": "https://Stackoverflow.com/users/1852", "pm_score": 2, "selected": false, "text": "if ( !loggedIn ) {\n StorePostInSession();\n ShowLoginForm();\n}\n\nif ( postIsStored ) {\n RetrievePostFromS...
2008/09/10
[ "https://Stackoverflow.com/questions/53260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/797/" ]
53,292
<p>I'm trying to use the <a href="http://optiflag.rubyforge.org/discussion.html" rel="nofollow noreferrer">Optiflag</a> package in my Ruby code and whenever I try to do the necessary <code>require optiflag.rb</code>, my program fails with the standard <code>no such file to load -- optiflag</code> message. I added the directory with that library to my $PATH variable, but it's still not working. Any ideas?</p>
[ { "answer_id": 53313, "author": "Purfideas", "author_id": 4615, "author_profile": "https://Stackoverflow.com/users/4615", "pm_score": 3, "selected": true, "text": "require 'rubygems'\nrequire 'optiflag'\n" }, { "answer_id": 53390, "author": "Dominik Grabiec", "author_id":...
2008/09/10
[ "https://Stackoverflow.com/questions/53292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422/" ]
53,295
<p>I'm trying to use some data from a PlanPlusOnline account. They only provide a java web services API. The server for the site where the data will be used does not allow me to install Tomcat (edit: or a JVM for that matter). I'm not going to lie, I am a Java software engineer, and I do some web work on the side. I'm not familiar with web services or servlets, but I was willing to give it a shot. I'd much rather they have JSON access to the data, but as far as I know they don't. Any ideas?</p> <p>EDIT: to clarify. The web service provided by planplusonline is Java based. I am trying to access the data from this web service without using Java. I believe this is possible now, but I need to do more research. Anyone who can help point me in the right direction is appreciated.</p>
[ { "answer_id": 53360, "author": "Jacob Schoen", "author_id": 3340, "author_profile": "https://Stackoverflow.com/users/3340", "pm_score": 0, "selected": false, "text": "public final class PlanPlusOnlineClient\n{\n //instance to this class so that we do not have to reinstantiate it ever...
2008/09/10
[ "https://Stackoverflow.com/questions/53295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5054/" ]
53,316
<p>I have a one to many relationship between two tables. The many table contains a clob column. The clob column looks like this in hibernate:</p> <pre><code>@CollectionOfElements(fetch = EAGER) @JoinTable(name = NOTE_JOIN_TABLE, joinColumns = @JoinColumn(name = "note")) @Column(name = "substitution") @IndexColumn(name = "listIndex", base = 0) @Lob private List&lt;String&gt; substitutions; </code></pre> <p>So basically I may have a Note with some subsitutions, say <code>"foo"</code> and <code>"fizzbuzz"</code>. So in my main table I could have a Note with id 4 and in my <code>NOTE_JOIN_TABLE</code> I would have two rows, <code>"foo"</code> and <code>"fizzbuzz"</code> that both have a relationship to the Note.</p> <p>However, when one of these is inserted into the DB <strong>the larger substitution values are cropped to be as long as the shortest.</strong> So in this case I would have <code>"foo"</code> and <code>"fiz"</code> in the DB instead of <code>"foo"</code> and <code>"fizzbuzz"</code>.</p> <p>Do you have any idea why this is happening? I have checked and confirmed they aren't being cropped anywhere in our code, it's defintely hibernate.</p>
[ { "answer_id": 53360, "author": "Jacob Schoen", "author_id": 3340, "author_profile": "https://Stackoverflow.com/users/3340", "pm_score": 0, "selected": false, "text": "public final class PlanPlusOnlineClient\n{\n //instance to this class so that we do not have to reinstantiate it ever...
2008/09/10
[ "https://Stackoverflow.com/questions/53316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1666/" ]
53,355
<p>Better yet, how can I make My Computer always open in Explorer as well?</p> <p>I usually make a shortcut to my programming directories on my quick launch bar, but I'd love for them to open in Explorer.</p>
[ { "answer_id": 53366, "author": "csjohnst", "author_id": 1292, "author_profile": "https://Stackoverflow.com/users/1292", "pm_score": 2, "selected": false, "text": "i.e.:\nexplorer /e,%HOMEDRIVE%%HOMEPATH%\n" }, { "answer_id": 53367, "author": "Blorgbeard", "author_id": 36...
2008/09/10
[ "https://Stackoverflow.com/questions/53355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
53,364
<p>Is it possible to generate PDF Documents in an Adobe AIR application without resorting to a round trip web service for generating the PDF? I've looked at the initial Flex Reports on GoogleCode but it requires a round trip for generating the actual PDF.</p> <p>Given that AIR is supposed to be the Desktop end for RIAs is there a way to accomplish this? I suspect I am overlooking something but my searches through the documentation don't reveal too much and given the target for AIR I can't believe that it's just something they didn't include.</p>
[ { "answer_id": 8766756, "author": "Kamran Aslam", "author_id": 653011, "author_profile": "https://Stackoverflow.com/users/653011", "pm_score": 0, "selected": false, "text": "public function createFlexPdf() : String\n{\n pdf = new PDF();\n pdf.setDisplayMode (Display.FULL_WIDTH,Layo...
2008/09/10
[ "https://Stackoverflow.com/questions/53364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4959/" ]
53,365
<p><em>(see <a href="https://stackoverflow.com/questions/53316/hibernate-crops-clob-values-oddly">here</a> for the problem I'm trying to solve)</em></p> <p>How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc.</p> <p>I have the following in my log4j config:</p> <pre><code>log4j.logger.net.sf.hibernate.SQL=DEBUG log4j.logger.org.hibernate.SQL=DEBUG log4j.logger.net.sf.hibernate.type=DEBUG log4j.logger.org.hibernate.type=DEBUG </code></pre> <p>Which produces output such as:</p> <pre><code>(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?) (org.hibernate.type.LongType) binding '170650' to parameter: 1 (org.hibernate.type.IntegerType) binding '0' to parameter: 2 (org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?) (org.hibernate.type.LongType) binding '170650' to parameter: 1 (org.hibernate.type.IntegerType) binding '1' to parameter: 2 </code></pre> <p>However you'll note that it never displays <code>parameter: 3</code> which is our clob.</p> <p>What I would really want is something like:</p> <pre><code>(org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?) (org.hibernate.type.LongType) binding '170650' to parameter: 1 (org.hibernate.type.IntegerType) binding '0' to parameter: 2 (org.hibernate.type.ClobType) binding 'something' to parameter: 3 (org.hibernate.SQL) insert into NoteSubstitutions (note, listIndex, substitution) values (?, ?, ?) (org.hibernate.type.LongType) binding '170650' to parameter: 1 (org.hibernate.type.IntegerType) binding '1' to parameter: 2 (org.hibernate.type.ClobType) binding 'something else' to parameter: 3 </code></pre> <p>How do I get it to show this in the log?</p>
[ { "answer_id": 53419, "author": "Marcio Aguiar", "author_id": 4213, "author_profile": "https://Stackoverflow.com/users/4213", "pm_score": 2, "selected": true, "text": "log4j.logger.net.sf.hibernate=DEBUG\nlog4j.logger.org.hibernate=DEBUG\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1666/" ]
53,379
<p>Does anyone have examples of how to use <a href="http://www.oracle-base.com/articles/8i/DBMS_APPLICATION_INFO.php" rel="nofollow noreferrer">DBMS_APPLICATION_INFO</a> package with JBOSS? </p> <p>We have a various applications which run within JBOSS and share db pools. I would like, at the start of each session these applications to identify themselves to the database using DBMS_APPLICATION_INFO so I can more easily track which sections of the application is causing database issues.</p> <p>I'm not too familiar with session life cycles in JBOSS, but at the end of the day, what needs to happen is at the start and end of a transaction, this package needs to be called.</p> <p>Has anyone done this before?</p>
[ { "answer_id": 378045, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<local-tx-datasource>\n <jndi-name>jdbc/myDS</jndi-name>\n <connection-url>jdbc:oracle:thin:@10.10.1.15:1521:SID</connec...
2008/09/10
[ "https://Stackoverflow.com/questions/53379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3839/" ]
53,387
<p>I downloaded a couple of webapps and placed them in my /webapps folder. Some of them I could open by going to <code>http://localhost:8080/app1</code> and it would open. However, some others I would do the exact same thing and go to <code>http://localhost:8080/app2</code> and it will display "HTTP Status 404 - /app2/", even though I am sure it is there. I've checked that it contains a WEB-INF folder just like app1, and I've even restarted Tomcat to be sure.</p> <p>My question is: is there anything (perhaps in the web.xml file) that specifies what the URL has to be to start the webapp? Or is it simply just <code>http://localhost:8080/&lt;folder name&gt;</code> ?</p> <p>P.S. If you want to know exactly what app1 and app2 I am refering to: app1 (works) = <a href="http://assets.devx.com/sourcecode/11237.zip" rel="nofollow noreferrer">http://assets.devx.com/sourcecode/11237.zip</a> app2 (doesn't work) = <a href="http://www.laliluna.de/download/eclipse-spring-jdbc-tutorial.zip" rel="nofollow noreferrer">http://www.laliluna.de/download/eclipse-spring-jdbc-tutorial.zip</a></p> <p>I've tried a few others as well, some work, some don't. I'm just wondering if I'm missing something.</p>
[ { "answer_id": 53422, "author": "Tony BenBrahim", "author_id": 80075, "author_profile": "https://Stackoverflow.com/users/80075", "pm_score": 2, "selected": false, "text": "eclipse-spring-jdbc-tutorial.zip\\SpringJdbc\\src\\test\\de\\laliluna\\library\\TestClient.java" }, { "answe...
2008/09/10
[ "https://Stackoverflow.com/questions/53387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
53,395
<p>I know the answer is not going to be simple, and I already use a couple of (I think ugly) cludges. I am simply looking for some elegant answers.</p> <p>Abstract class:</p> <pre><code>public interface IOtherObjects; public abstract class MyObjects&lt;T&gt; where T : IOtherObjects { ... public List&lt;T&gt; ToList() { ... } } </code></pre> <p>Children:</p> <pre><code>public class MyObjectsA : MyObjects&lt;OtherObjectA&gt; //(where OtherObjectA implements IOtherObjects) { } public class MyObjectsB : MyObjects&lt;OtherObjectB&gt; //(where OtherObjectB implements IOtherObjects) { } </code></pre> <p>Is it possible, looping through a collection of MyObjects (or other similar grouping, generic or otherwise) to then utilise to <em>ToList</em> method of the <em>MyObjects</em> base class, as we do not specifically know the type of T at this point. </p> <p><strong>EDIT</strong> As for specific examples, whenever this has come up, I've thought about it for a while, and done something different instead, so there is no current requirement. but as it has come up quite frequently, I thought I would float it.</p> <p><strong>EDIT</strong> @Sara, it's not the specific type of the collection I care about, it could be a List, but still the ToList method of each instance is relatively unusable, without an anonymous type)</p> <p>@aku, true, and this question may be relatively hypothetical, however being able to retrieve, and work with a list of T of objects, knowing only their base type would be very useful. Having the ToList returning a List Of BaseType has been one of my workarounds</p> <p><strong>EDIT</strong> @ all: So far, this has been the sort of discussion I was hoping for, though it largely confirms all I suspected. Thanks all so far, but anyone else, feel free to input.</p> <p><strong>EDIT</strong>@Rob, Yes it works for a defined type, but not when the type is only known as a List of IOtherObjects. </p> <p>@Rob <strong>Again</strong> Thanks. That has usually been my cludgy workaround (no disrespect :) ). Either that or using the ConvertAll function to Downcast through a delegate. Thanks for taking the time to understand the problem.</p> <p><strong>QUALIFYING EDIT</strong> in case I have been a little confusing</p> <p>To be more precise, (I may have let my latest implementation of this get it too complex):</p> <p>lets say I have 2 object types, B and C inheriting from object A.</p> <p>Many scenarios have presented themselves where, from a List of B or a List of C, or in other cases a List of either - but I don't know which if I am at a base class, I have needed a less specific List of A. </p> <p>The above example was a watered-down example of the <em>List Of Less Specific</em> problem's latest incarnation.</p> <p>Usually it has presented itself, as I think through possible scenarios that limit the amount of code that needs writing and seems a little more elegant than other options. I really wanted a discussion of possibilities and other points of view, which I have more or less got. I am surprised no one has mentioned ConvertAll() so far, as that is another workaround I have used, but a little too verbose for the scenarios at hand</p> <p>@Rob <strong>Yet Again</strong> and Sara</p> <p>Thanks, however I do feel I understand generics in all their static contexted glory, and did understand the issues at play here.</p> <p>The actual design of our system and usage of generics it (and I can say this without only a touch of bias, as I was only one of the players in the design), has been done well. It is when I have been working with the core API, I have found situations when I have been in the wrong scope for doing something simply, instead I had to deal with them with a little less elegant than I like (trying either to be clever or perhaps lazy - I'll accept either of those labels).</p> <p>My distaste for what I termed a cludge is largely that we require to do a loop through our record set simply to convert the objects to their base value which may be a performance hit.</p> <p>I guess I was wondering if anyone else had come across this in their coding before, and if anyone had been cleverer, or at least more elegant, than me in dealing with it.</p>
[ { "answer_id": 53406, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 1, "selected": false, "text": "foreach(var myObject in myObjectsList)\n foreach(var obj in myObject.ToList())\n //do something\n" }, { "a...
2008/09/10
[ "https://Stackoverflow.com/questions/53395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
53,404
<p>An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple unmanaged samples but I can't find any managed.</p>
[ { "answer_id": 53427, "author": "Rob Cooper", "author_id": 832, "author_profile": "https://Stackoverflow.com/users/832", "pm_score": -1, "selected": false, "text": "using System.Data.OleDb;\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/223/" ]
53,411
<p>I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in Flash using AS3</p> <p>I'm sure it'll be a right pain...</p> <p>I have no idea where to start, can anyone offer any pointers? reference material?</p> <p>----much later--- Thank you all very much for your input... It seems I have a long road ahead of me yet!</p>
[ { "answer_id": 67764, "author": "Jeremy Wadhams", "author_id": 8995, "author_profile": "https://Stackoverflow.com/users/8995", "pm_score": 1, "selected": false, "text": "exec()" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/53411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5503/" ]