qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
58,280
<p>Is it possible to use an UnhandledException Handler in a Windows Service?</p> <p>Normally I would use a custom built Exception Handling Component that does logging, phone home, etc. This component adds a handler to System.AppDomain.CurrentDomain.UnhandledException but as far as I can tell this doesn’t achieve anything win a Windows Service so I end up with this pattern in my 2 (or 4) Service entry points:</p> <pre> <code> Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. Try MyServiceComponent.Start() Catch ex As Exception 'call into our exception handler MyExceptionHandlingComponent.ManuallyHandleException (ex) 'zero is the default ExitCode for a successfull exit, so if we set it to non-zero ExitCode = -1 'So, we use Environment.Exit, it seems to be the most appropriate thing to use 'we pass an exit code here as well, just in case. System.Environment.Exit(-1) End Try End Sub </code> </pre> <p>Is there a way my Custom Exception Handling component can deal with this better so I don't have to fill my OnStart with messy exception handling plumbing?</p>
[ { "answer_id": 58450, "author": "Scott", "author_id": 6042, "author_profile": "https://Stackoverflow.com/users/6042", "pm_score": 5, "selected": true, "text": "\nPrivate Sub ServiceQueuedMainCallback(ByVal state As Object)\n Dim args As String() = DirectCast(state, String())\n Try ...
2008/09/12
[ "https://Stackoverflow.com/questions/58280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6042/" ]
58,294
<p>When I call <code>socket.getsockname()</code> on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this?</p>
[ { "answer_id": 2646313, "author": "frankjania", "author_id": 317610, "author_profile": "https://Stackoverflow.com/users/317610", "pm_score": 0, "selected": false, "text": "import urllib\ndef get_my_ip_address():\n whatismyip = 'http://www.whatismyip.com/automation/n09230945.asp'\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5342/" ]
58,305
<p>Simple as the title states: Can you use only Java commands to take a screenshot and save it? Or, do I need to use an OS specific program to take the screenshot and then grab it off the clipboard?</p>
[ { "answer_id": 58326, "author": "David Citron", "author_id": 5309, "author_profile": "https://Stackoverflow.com/users/5309", "pm_score": 9, "selected": true, "text": "java.awt.Robot" }, { "answer_id": 10796047, "author": "DejanLekic", "author_id": 876497, "author_prof...
2008/09/12
[ "https://Stackoverflow.com/questions/58305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
58,306
<p>I am trying to determine the best time efficient algorithm to accomplish the task described below.</p> <p>I have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another. This basically represents an undirected graph, with the records being the vertices and the connection data the edges.</p> <p>All of the records in the set have connection information (i.e. no orphan records are present; each record in the set connects to one or more other records in the set).</p> <p>I want to choose any two records from the set and be able to show all simple paths between the chosen records. By "simple paths" I mean the paths which do not have repeated records in the path (i.e. finite paths only).</p> <p>Note: The two chosen records will always be different (i.e. start and end vertex will never be the same; no cycles).</p> <p>For example:</p> <pre> If I have the following records: A, B, C, D, E and the following represents the connections: (A,B),(A,C),(B,A),(B,D),(B,E),(B,F),(C,A),(C,E), (C,F),(D,B),(E,C),(E,F),(F,B),(F,C),(F,E) [where (A,B) means record A connects to record B] </pre> <p>If I chose B as my starting record and E as my ending record, I would want to find all simple paths through the record connections that would connect record B to record E.</p> <pre> All paths connecting B to E: B->E B->F->E B->F->C->E B->A->C->E B->A->C->F->E </pre> <p>This is an example, in practice I may have sets containing hundreds of thousands of records.</p>
[ { "answer_id": 58444, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "static bool[] visited;//all false\nStack<int> currentway; initialize empty\n\nfunction findnodes(int nextnode)\n{\nif (nextnode...
2008/09/12
[ "https://Stackoverflow.com/questions/58306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3534/" ]
58,340
<p>Using win forms with an <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="noreferrer">MVC</a>/<a href="http://msdn.microsoft.com/en-us/magazine/cc188690.aspx" rel="noreferrer">MVP</a> architecture, I would normally use a class to wrap a view to test the UI while using mocks for the model and controller/presenter. The wrapper class would make most everything in the UI an observable property for the test runner through properties and events.</p> <p>Would this be a viable approach to testing a WPF app? Is there a better way? Are there any gotchas to watch out for?</p>
[ { "answer_id": 40271736, "author": "Justas", "author_id": 407108, "author_profile": "https://Stackoverflow.com/users/407108", "pm_score": 4, "selected": false, "text": "using TestStack.White;\nusing TestStack.White.UIItems;\nusing TestStack.White.Factory;\n\n[TestMethod]\npublic void Tes...
2008/09/12
[ "https://Stackoverflow.com/questions/58340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3826/" ]
58,354
<p>What are some simple algorithm or data structure related "white boarding" problems that you find effective during the candidate screening process?</p> <p>I have some simple ones that I use to validate problem solving skills and that can be simply expressed but have some opportunity for the application of some heuristics.</p> <p>One of the basics that I use for junior developers is:</p> <blockquote> <p>Write a C# method that takes a string which contains a set of words (a sentence) and rotates those words X number of places to the right. When a word in the last position of the sentence is rotated it should show up at the front of the resulting string.</p> </blockquote> <p>When a candidate answers this question I look to see that they available .NET data structures and methods (string.Join, string.Split, List, etc...) to solve the problem. I also look for them to identify special cases for optimization. Like the number of times that the words need to be rotated isn't really X it's X % number of words.</p> <p>What are some of the white board problems that you use to interview a candidate and what are some of the things you look for in an answer (do not need to post the actual answer).</p>
[ { "answer_id": 90047, "author": "user11318", "author_id": 11318, "author_profile": "https://Stackoverflow.com/users/11318", "pm_score": 2, "selected": false, "text": "# @a and @b are two arrays which are already populated.\nmy @int;\nOUTER: for my $x (@a) {\n for my $y (@b) {\n if ($...
2008/09/12
[ "https://Stackoverflow.com/questions/58354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3957/" ]
58,380
<p>The following bit of code catches the EOS Exception</p> <pre><code>using (var reader = new BinaryReader(httpRequestBodyStream)) { try { while (true) { bodyByteList.Add(reader.ReadByte()); } } catch (EndOfStreamException) { } } </code></pre> <p>So why do I still receive first-chance exceptions in my console? </p> <blockquote> <p>A first chance exception of type 'System.IO.EndOfStreamException' occurred in mscorlib.dll</p> </blockquote> <p>Is there a way to hide these first chance exception messages?</p>
[ { "answer_id": 58409, "author": "loudej", "author_id": 6056, "author_profile": "https://Stackoverflow.com/users/6056", "pm_score": 4, "selected": false, "text": "while (reader.PeekChar() != -1)\n{\n bodyByteList.Add(reader.ReadByte());\n}\n" }, { "answer_id": 1247084, "aut...
2008/09/12
[ "https://Stackoverflow.com/questions/58380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209/" ]
58,384
<p>I am facing a problem with .NET generics. The thing I want to do is saving an array of generics types (GraphicsItem):</p> <pre><code>public class GraphicsItem&lt;T&gt; { private T _item; public void Load(T item) { _item = item; } } </code></pre> <p>How can I save such open generic type in an array?</p>
[ { "answer_id": 58406, "author": "Alex Duggleby", "author_id": 5790, "author_profile": "https://Stackoverflow.com/users/5790", "pm_score": 0, "selected": false, "text": "static void foo()\n{\n var _bar = List<GraphicsItem<T>>();\n}\n" }, { "answer_id": 58462, "author": "Omer ...
2008/09/12
[ "https://Stackoverflow.com/questions/58384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2078/" ]
58,399
<p>I love the way Mac OS <em>beautifully</em> renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows?</p> <p>Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?</p>
[ { "answer_id": 2573130, "author": "William", "author_id": 213197, "author_profile": "https://Stackoverflow.com/users/213197", "pm_score": 0, "selected": false, "text": "g.setFont(new Font(\"Century Schoolbook\", Font.PLAIN, 36));\ng.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,\...
2008/09/12
[ "https://Stackoverflow.com/questions/58399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6059/" ]
58,425
<p>I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with a "TypeInitializationException".</p> <p>The InnerException property reveals that "The type initializer for 'System.Windows.Navigation.BaseUriHelper' threw an exception."</p> <p>Here is my app.xaml:</p> <pre><code>&lt;Application x:Class="MyNamespace.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; &lt;Application.Resources&gt; &lt;/Application.Resources&gt; &lt;/Application&gt; </code></pre> <p>And here is my app.xaml.cs (exception thrown at "public App()"):</p> <pre><code>public partial class App : Application { public App() { Bootstrapper bootStrapper = new Bootstrapper(); bootStrapper.Run(); } } </code></pre> <p>I have set the "App" class as the startup object in the project.</p> <p>What is going astray?</p>
[ { "answer_id": 58464, "author": "Adrian Clark", "author_id": 148, "author_profile": "https://Stackoverflow.com/users/148", "pm_score": 6, "selected": true, "text": "<configuration>\n <startup>\n <supportedRuntime version=\"v2.0.50727\" sku=\"Client\"/>\n </startup>\n <configSection...
2008/09/12
[ "https://Stackoverflow.com/questions/58425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/148/" ]
58,429
<p>How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop.<p> I know I can just create a small table with integers in it, say from 1 to 1000 and then use it for range operations that are within that range. <p>For example, if I had that table I could make a select to find the sum of numbers 100-200 like this:</p> <pre><code>select sum(n) from numbers where n between 100 and 200 </code></pre> <p>Any ideas? I'm kinda looking for something that works for T-SQL but any platform would be okay.</p> <p>[Edit] I have my own solution for this using SQL CLR which works great for MS SQL 2005 or 2008. <a href="https://stackoverflow.com/questions/58429/sql-set-based-range#59657">See below.</a></p>
[ { "answer_id": 59314, "author": "Chris Ammerman", "author_id": 2729, "author_profile": "https://Stackoverflow.com/users/2729", "pm_score": 4, "selected": true, "text": "WITH\n digits AS -- Limit recursion by just using it for digits.\n (SELECT\n LEVEL - 1 AS num\n FROM\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4489/" ]
58,431
<p>I have wondered for some time, what a nice, clean solution for joining an array of strings might look like. Example: I have ["Alpha", "Beta", "Gamma"] and want to join the strings into one, separated by commas – "Alpha, Beta, Gamma".</p> <p>Now I know that most programming languages offer some kind of join method for this. I just wonder how these might be implemented. When I took introductory courses, I often tried to go it alone, but never found a satisfactory algorithm. Everything seemed rather messy, the problem being that you can not just loop through the array, concatenating the strings, as you would add one too many commas (either before or after the last string). I don’t want to check conditions in the loop. I don’t really want to add the first or the last string before/after the loop (I guess this is maybe the best way?).</p> <p>Can someone show me an elegant solution? Or tell me exactly why there can’t be anything more elegant?</p>
[ { "answer_id": 58437, "author": "Mendelt", "author_id": 3320, "author_profile": "https://Stackoverflow.com/users/3320", "pm_score": 4, "selected": false, "text": "separator = \"\"\nforeach(item in stringCollection)\n{\n concatenatedString += separator + item\n separator = \",\"\n}\...
2008/09/12
[ "https://Stackoverflow.com/questions/58431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4991/" ]
58,457
<p>How do you randomly select a table row in T-SQL based on an applied weight for all candidate rows?</p> <p>For example, I have a set of rows in a table weighted at 50, 25, and 25 (which adds up to 100 but does not need to), and I want to select one of them randomly with a statistical outcome equivalent to the respective weight.</p>
[ { "answer_id": 58459, "author": "Dane", "author_id": 2929, "author_profile": "https://Stackoverflow.com/users/2929", "pm_score": 3, "selected": false, "text": "DECLARE @id int, @weight_sum int, @weight_point int\nDECLARE @table TABLE (id int, weight int)\n\nINSERT INTO @table(id, weight)...
2008/09/12
[ "https://Stackoverflow.com/questions/58457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2929/" ]
58,478
<p>I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use? What's the best way to do this?</p>
[ { "answer_id": 59285, "author": "pauliephonic", "author_id": 5374, "author_profile": "https://Stackoverflow.com/users/5374", "pm_score": 1, "selected": false, "text": "require 'net/smtp'\nSMTP_SERVER = 'mailserver01' #change to your server\n\ndef send_emails(sender_address, recipients, s...
2008/09/12
[ "https://Stackoverflow.com/questions/58478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381/" ]
58,482
<p>I'm not entirely sure if this is possible in Ruby, but hopefully there's an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet:</p> <pre><code>foo = ["goo", "baz"] </code></pre> <p>How can I get the name of the array (here, "foo") back? If it is indeed possible, does this work on any variable (e.g., scalars, hashes, etc.)?</p> <p>Edit: Here's what I'm basically trying to do. I'm writing a SOAP server that wraps around a class with three important variables, and the validation code is essentially this:</p> <pre><code> [foo, goo, bar].each { |param| if param.class != Array puts "param_name wasn't an Array. It was a/an #{param.class}" return "Error: param_name wasn't an Array" end } </code></pre> <p>My question is then: Can I replace the instances of 'param_name' with foo, goo, or bar? These objects are all Arrays, so the answers I've received so far don't seem to work (with the exception of re-engineering the whole thing ala <a href="https://stackoverflow.com/questions/58482/ruby-get-a-variables-name#58870">dbr's answer</a>) </p>
[ { "answer_id": 58492, "author": "Josh Moore", "author_id": 5004, "author_profile": "https://Stackoverflow.com/users/5004", "pm_score": 2, "selected": false, "text": "instance_variables" }, { "answer_id": 58734, "author": "James A. Rosen", "author_id": 1190, "author_pr...
2008/09/12
[ "https://Stackoverflow.com/questions/58482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/422/" ]
58,493
<p>I have an array of numbers that potentially have up to 8 decimal places and I need to find the smallest common number I can multiply them by so that they are all whole numbers. I need this so all the original numbers can all be multiplied out to the same scale and be processed by a sealed system that will only deal with whole numbers, then I can retrieve the results and divide them by the common multiplier to get my relative results.</p> <p>Currently we do a few checks on the numbers and multiply by 100 or 1,000,000, but the processing done by the *sealed system can get quite expensive when dealing with large numbers so multiplying everything by a million just for the sake of it isn’t really a great option. As an approximation lets say that the sealed algorithm gets 10 times more expensive every time you multiply by a factor of 10.</p> <p>What is the most efficient algorithm, that will also give the best possible result, to accomplish what I need and is there a mathematical name and/or formula for what I’m need?</p> <p>*The sealed system isn’t really sealed. I own/maintain the source code for it but its 100,000 odd lines of proprietary magic and it has been thoroughly bug and performance tested, altering it to deal with floats is not an option for many reasons. It is a system that creates a grid of X by Y cells, then rects that are X by Y are dropped into the grid, “proprietary magic” occurs and results are spat out – obviously this is an extremely simplified version of reality, but it’s a good enough approximation.</p> <p>So far there are quiet a few good answers and I wondered how I should go about choosing the ‘correct’ one. To begin with I figured the only fair way was to create each solution and performance test it, but I later realised that pure speed wasn’t the only relevant factor – an more accurate solution is also very relevant. I wrote the performance tests anyway, but currently the I’m choosing the correct answer based on speed as well accuracy using a ‘gut feel’ formula.</p> <p>My performance tests process 1000 different sets of 100 randomly generated numbers. Each algorithm is tested using the same set of random numbers. Algorithms are written in .Net 3.5 (although thus far would be 2.0 compatible) I tried pretty hard to make the tests as fair as possible.</p> <ul> <li>Greg – Multiply by large number and then divide by GCD – 63 milliseconds</li> <li>Andy – String Parsing – 199 milliseconds </li> <li>Eric – Decimal.GetBits – 160 milliseconds</li> <li>Eric – Binary search – 32 milliseconds </li> <li>Ima – sorry I couldn’t figure out a how to implement your solution easily in .Net (I didn’t want to spend too long on it) </li> <li>Bill – I figure your answer was pretty close to Greg’s so didn’t implement it. I’m sure it’d be a smidge faster but potentially less accurate.</li> </ul> <p>So Greg’s Multiply by large number and then divide by GCD” solution was the second fastest algorithm and it gave the most accurate results so for now I’m calling it correct.</p> <p>I really wanted the Decimal.GetBits solution to be the fastest, but it was very slow, I’m unsure if this is due to the conversion of a Double to a Decimal or the Bit masking and shifting. There should be a similar usable solution for a straight Double using the BitConverter.GetBytes and some knowledge contained here: <a href="http://blogs.msdn.com/bclteam/archive/2007/05/29/bcl-refresher-floating-point-types-the-good-the-bad-and-the-ugly-inbar-gazit-matthew-greig.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/bclteam/archive/2007/05/29/bcl-refresher-floating-point-types-the-good-the-bad-and-the-ugly-inbar-gazit-matthew-greig.aspx</a> but my eyes just kept glazing over every time I read that article and I eventually ran out of time to try to implement a solution.</p> <p>I’m always open to other solutions if anyone can think of something better.</p>
[ { "answer_id": 58512, "author": "Evil Andy", "author_id": 4431, "author_profile": "https://Stackoverflow.com/users/4431", "pm_score": 0, "selected": false, "text": "myNumber.ToString().Substring(myNumber.ToString().IndexOf(\".\")+1).Length\n" }, { "answer_id": 60085, "author"...
2008/09/12
[ "https://Stackoverflow.com/questions/58493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6042/" ]
58,510
<p>I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to <a href="https://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java">this question</a> only in .Net.</p>
[ { "answer_id": 58570, "author": "Steve Morgan", "author_id": 5806, "author_profile": "https://Stackoverflow.com/users/5806", "pm_score": 7, "selected": true, "text": "FindMimeFromData" }, { "answer_id": 62007, "author": "Richard Gourlay", "author_id": 2674, "author_pr...
2008/09/12
[ "https://Stackoverflow.com/questions/58510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2674/" ]
58,513
<p>How do I Unit Test a MVC redirection?</p> <pre><code>public ActionResult Create(Product product) { _productTask.Save(product); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } </code></pre> <p>Is <a href="http://www.ayende.com/Blog/archive/2007/12/13/Dont-like-visibility-levels-change-that.aspx" rel="nofollow noreferrer">Ayende's</a> approach still the best way to go, with preview 5:</p> <pre><code> public static void RenderView(this Controller self, string action) { typeof(Controller).GetMethod("RenderView").Invoke(self,new object[] { action} ); } </code></pre> <p>Seems odd to have to do this, especially as the MVC team have said they are writing the framework to be testable.</p>
[ { "answer_id": 58818, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 6, "selected": true, "text": "[TestFixture]\npublic class RedirectTester\n{\n [Test]\n public void Should_redirect_to_success_action()\n {\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
58,517
<p>Is there a way to combine Enums in VB.net?</p>
[ { "answer_id": 58526, "author": "Jonas Follesø", "author_id": 1199387, "author_profile": "https://Stackoverflow.com/users/1199387", "pm_score": 1, "selected": false, "text": "Enum" }, { "answer_id": 58527, "author": "Dave Arkell", "author_id": 4002, "author_profile": ...
2008/09/12
[ "https://Stackoverflow.com/questions/58517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5055/" ]
58,520
<p>We need to regularly synchronize many dozens of binary files (project executables and DLLs) between many developers at several different locations, so that every developer has an up to date environment to build and test at. Due to nature of the project, updates must be done often and on-demand (overnight updates are not sufficient). This is not pretty, but we are stuck with it for a time.</p> <p>We settled on using a regular version (source) control system: put everything into it as binary files, get-latest before testing and check-in updated DLL after testing.</p> <p>It works fine, but a version control client has a lot of features which don't make sense for us and people occasionally get confused.</p> <p>Are there any tools better suited for the task? Or may be a completely different approach?</p> <p><strong>Update:</strong> </p> <p>I need to clarify that it's not a tightly integrated project - more like extensible system with a heap of "plugins", including thrid-party ones. We need to make sure those modules-plugins works nicely with recent versions of each other and the core. Centralised build as was suggested was considered initially, but it's not an option.</p>
[ { "answer_id": 58576, "author": "Rob Wells", "author_id": 2974, "author_profile": "https://Stackoverflow.com/users/2974", "pm_score": 0, "selected": false, "text": "const char cvsid[] = \"@(#)INETOPS_filter_ip_$Revision: 1.9 $\";" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5733/" ]
58,538
<p>I'm creating an installer for a website that uses a custom event log source. I would like our WiX based installer to create that event log source during installation.</p> <p>Does anyone know the best way to do this using the WiX framework.</p>
[ { "answer_id": 58686, "author": "Paul Lalonde", "author_id": 5782, "author_profile": "https://Stackoverflow.com/users/5782", "pm_score": 7, "selected": true, "text": "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\"\n xmlns:util=\"http://schemas.microsoft.com/wix/UtilExtension\...
2008/09/12
[ "https://Stackoverflow.com/questions/58538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5182/" ]
58,540
<p>When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error:</p> <blockquote> <p>Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the entire SQL command is stored in a variable.<br> ADDITIONAL INFORMATION:<br> Provider cannot derive parameter information and SetParameterInfo has not been called. (Microsoft OLE DB Provider for Oracle) </p> </blockquote> <p>I have tried following the suggestion here but don't quite understand what is required:<a href="http://microsoftdw.blogspot.com/2005/11/parameterized-queries-against-oracle.html" rel="noreferrer">Parameterized queries against Oracle</a></p> <p>Any ideas?</p>
[ { "answer_id": 59116, "author": "Rich Lawrence", "author_id": 1281, "author_profile": "https://Stackoverflow.com/users/1281", "pm_score": 5, "selected": true, "text": "select * from book where book.BOOK_ID = ?\n" }, { "answer_id": 51440458, "author": "toha", "author_id": ...
2008/09/12
[ "https://Stackoverflow.com/questions/58540", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281/" ]
58,543
<p>I have an application that I would like to embed inside our companies CMS. The only way to do that (I am told), is to load it in an <code>&lt;iframe&gt;</code>.</p> <p>Easy: just set <code>height</code> and <code>width</code> to <code>100%</code>! Except, it doesn't work.</p> <p>I did find out about setting <code>frameborder</code> to <code>0</code>, so it at least <em>looks</em> like part of the site, but I'd prefer not to have an ugly scrollbar <em>inside</em> a page that allready has one.</p> <p>Do you know of any tricks to do this?</p> <p><strong>EDIT:</strong> I think I need to clarify my question somewhat:</p> <ul> <li>the company CMS displays the fluff and stuff for our whole website</li> <li>most pages created through the CMS</li> <li>my application isn't, but they will let me embedd it in an <code>&lt;iframe&gt;</code></li> <li>I have no control over the <code>iframe</code>, so any solution must work from the referenced page (according to the <code>src</code> attribute of the <code>iframe</code> tag)</li> <li>the CMS displays a footer, so setting the height to 1 million pixels is not a good idea</li> </ul> <p>Can I access the parent pages DOM from the referenced page? This might help, but I can see some people might not want this to be possible...</p> <p>This technique seems to work (<a href="http://bytes.com/forum/thread91876.html" rel="noreferrer">gleaned</a> from several sources, but inspired by the <a href="http://brondsema.net/blog/index.php/2007/06/06/100_height_iframe" rel="noreferrer">link</a> from the accepted answer:</p> <p>In parent document:</p> <pre><code>&lt;iframe id="MyIFRAME" name="MyIFRAME" src="http://localhost/child.html" scrolling="auto" width="100%" frameborder="0"&gt; no iframes supported... &lt;/iframe&gt; </code></pre> <p>In child:</p> <pre><code>&lt;!-- ... --&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; function resizeIframe() { var docHeight; if (typeof document.height != 'undefined') { docHeight = document.height; } else if (document.compatMode &amp;&amp; document.compatMode != 'BackCompat') { docHeight = document.documentElement.scrollHeight; } else if (document.body &amp;&amp; typeof document.body.scrollHeight != 'undefined') { docHeight = document.body.scrollHeight; } // magic number: suppress generation of scrollbars... docHeight += 20; parent.document.getElementById('MyIFRAME').style.height = docHeight + "px"; } parent.document.getElementById('MyIFRAME').onload = resizeIframe; parent.window.onresize = resizeIframe; &lt;/script&gt; &lt;/body&gt; </code></pre> <p><strong>BTW:</strong> This will only work if parent and child are in the same domain due to a restriction in JavaScript for security reasons...</p>
[ { "answer_id": 58562, "author": "Adam Hepton", "author_id": 2268, "author_profile": "https://Stackoverflow.com/users/2268", "pm_score": 0, "selected": false, "text": "scrolling=no" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2260/" ]
58,547
<p>In C++ we acquiring a resource in a constructor and release it in a destructor.</p> <p>So when an exception rises in a middle of a function there will be no resource leak or locked mutexes or whatever.</p> <p>AFAIK java classes don't have destructors. So how does one do the resource management in Java.</p> <p>For example:</p> <pre><code>public int foo() { Resource f = new Resource(); DoSomething(f); f.Release(); } </code></pre> <p>How can one release resource if DoSomething throws an exception? We can't put try\catch blocks all over the code, can we?</p>
[ { "answer_id": 58552, "author": "qbeuek", "author_id": 5348, "author_profile": "https://Stackoverflow.com/users/5348", "pm_score": 3, "selected": true, "text": "public int foo() {\n Resource f = new Resource();\n try {\n DoSomething(f);\n }\n finally {\n f.Relea...
2008/09/12
[ "https://Stackoverflow.com/questions/58547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1007/" ]
58,554
<p>I'm using Eclipse as my IDE for a C++ project, and I would love for it to tell me where a given symbol is defined and what the parameters are for a function.</p> <p>However, there's a catch: I also use <a href="http://www.lazycplusplus.com/" rel="nofollow noreferrer">Lazy C++</a>, a tool that takes a single source file and generates the .h and the .cpp files. Those .lzz files look like headers, but this tool supports some very mild syntactic benefits, like combining nested namespaces into a qualified name. Additionally, it has some special tags to tell the tool specifically where to put what (in header or in source file).</p> <p>So my typical SourceFile.lzz looks like this:</p> <pre><code>$hdr #include &lt;iosfwd&gt; #include "ProjectA/BaseClass.h" $end $src #include &lt;iostream&gt; #include "ProjectB/OtherClass.h" $end // Forward declarations namespace BigScope::ProjectB { class OtherClass; } namespace BigScope::ProjectA { class MyClass : public ProjectA::BaseClass { void SomeMethod(const ProjectB::OtherClass&amp; Foo) { } } } </code></pre> <p>As you see, it's still recognizable C++, but with a few extras.</p> <p>For some reason, CDT's indexer does not seem to want to index anything, and I don't know what's wrong. In the Indexer View, it shows me an empty tree, but tells me that it has some 15000 symbols and more stuff, none of which I can seem to access.</p> <p>So here's my <strong>question</strong>: how can I make the Indexer output some more information about what it's doing and why it fails when it does so, and can I tweak it more than with just the GUI-accessible options?</p> <p>Thanks,</p> <p>Carl</p>
[ { "answer_id": 837016, "author": "Mike Kucera", "author_id": 102367, "author_profile": "https://Stackoverflow.com/users/102367", "pm_score": 1, "selected": false, "text": "$hdr" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2095/" ]
58,558
<p>I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs.</p> <p>For UNIXy servers (and Windows servers with Cygwin), I can just log in over SSH and run <code>md5sum foo.jar</code>. Ideally, I'd like to avoid installing extra software on the remote servers (there may be thousands), so is there a good way to do this on vanilla Windows servers?</p>
[ { "answer_id": 837016, "author": "Mike Kucera", "author_id": 102367, "author_profile": "https://Stackoverflow.com/users/102367", "pm_score": 1, "selected": false, "text": "$hdr" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4702/" ]
58,561
<p>I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if it's possible using criteria ?</p> <p>An example :</p> <pre><code>final StringBuilder hql = new StringBuilder(); hql.append( "select bob.id from " ) .append( bob.class.getName() ).append( " bob " ) .append( "where bob.id &gt; 10"); final Query query = session.createQuery( hql.toString() ); return query.list(); </code></pre>
[ { "answer_id": 58624, "author": "agnul", "author_id": 6069, "author_profile": "https://Stackoverflow.com/users/6069", "pm_score": 6, "selected": false, "text": "Criteria.forClass(bob.class.getName())\n .add(Restrictions.gt(\"id\", 10))\n .setProjection(Projections.property(...
2008/09/12
[ "https://Stackoverflow.com/questions/58561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
58,564
<p>I have a core dump file from a process that has probably a file descriptor leak (it opens files and sockets but apparently sometimes forgets to close some of them). Is there a way to find out which files and sockets the process had opened before crashing? I can't easily reproduce the crash, so analyzing the core file seems to be the only way to get a hint on the bug.</p>
[ { "answer_id": 58580, "author": "mweerden", "author_id": 4285, "author_profile": "https://Stackoverflow.com/users/4285", "pm_score": 2, "selected": false, "text": "strace" }, { "answer_id": 58606, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "http...
2008/09/12
[ "https://Stackoverflow.com/questions/58564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148773/" ]
58,584
<p>Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e.g. three large methods out to another file and then delete them for testing purposes in Vim when using it via putty/ssh where you cannot use the mouse?</p> <p>I can easily yank-to-the-end-of-line or yank-to-the-end-of-code-block but if the text extends over many screens, or has lots of blank lines in it, I feel like my hands are tied in Vim. Any solutions?</p> <p>And a related question: is there a way to somehow select 40 lines, and then comment them all out (with "#" or "//"), as is common in most IDEs?</p>
[ { "answer_id": 58588, "author": "zigdon", "author_id": 4913, "author_profile": "https://Stackoverflow.com/users/4913", "pm_score": 6, "selected": true, "text": "vim" }, { "answer_id": 58592, "author": "Swaroop C H", "author_id": 4869, "author_profile": "https://Stacko...
2008/09/12
[ "https://Stackoverflow.com/questions/58584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
58,614
<p>I'm developing a multi-threaded app for a Linux embedded platform.</p> <p>At the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would like to fine tune that value for each thread to something smaller to reduce my application's memory usage. I could go through the trial and error route of setting each thread's stack size to progressively smaller values until the program crashed, but the application uses ~15 threads each with completely different functionality/attributes so that approach would be extremely time consuming.</p> <p>I would much rather prefer being able to directly measure each thread's stack usage. Is there some utility people can recommend to do this? (For example, I come from a vxWorks background and using the 'ti' command from the vxWorks shell directly gives stats on the stack usage as well as other useful info on the task status.)</p> <p>Thanks</p>
[ { "answer_id": 58628, "author": "Tobi", "author_id": 5422, "author_profile": "https://Stackoverflow.com/users/5422", "pm_score": 2, "selected": false, "text": "__thread void* stack_start;\n__thread long stack_max_size = 0L;\n\nvoid check_stack_size() {\n // address of 'nowhere' approxim...
2008/09/12
[ "https://Stackoverflow.com/questions/58614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6089/" ]
58,620
<p>How do I create a button control (with <code>CreateWindow</code> of a <code>BUTTON</code> window class) that has a standard system-wide size (especially height) that's consistent with the rest of Windows applications? I should of course take DPI into account and probably other settings.</p> <blockquote> <p><strong>Remark:</strong> Using <code>USE_CW_DEFAULT</code> for width and height results in a 0, 0 size button, so that's not a solution.</p> </blockquote>
[ { "answer_id": 58689, "author": "macbirdie", "author_id": 5049, "author_profile": "https://Stackoverflow.com/users/5049", "pm_score": 4, "selected": true, "text": "LONG units = GetDialogBaseUnits();\nm_hButton = CreateWindow(TEXT(\"BUTTON\"), TEXT(\"Close\"), \n WS_VISIBL...
2008/09/12
[ "https://Stackoverflow.com/questions/58620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5049/" ]
58,621
<p>How do I make an MD5 hash of a string with Delphi?</p>
[ { "answer_id": 58626, "author": "devstopfix", "author_id": 3366, "author_profile": "https://Stackoverflow.com/users/3366", "pm_score": 5, "selected": false, "text": "uses SysUtils, IdGlobal, IdHash, IdHashMessageDigest;\n\nwith TIdHashMessageDigest5.Create do\ntry\n Result := TIdHash1...
2008/09/12
[ "https://Stackoverflow.com/questions/58621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3366/" ]
58,622
<p>I like Doxygen to create documentation of C or PHP code. I have an upcoming Python project and I think I remember that Python doesn't have <code>/* .. */</code> comments, and also has its own self-documentation facility which seems to be the pythonic way to document.</p> <p>Since I'm familiar with Doxygen, how can I use it to produce my Python documentation? Is there anything in particular that I need to be aware of?</p>
[ { "answer_id": 58701, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 7, "selected": true, "text": "\"\"\"@package docstring\nDocumentation for this module.\n\nMore details.\n\"\"\"\n\ndef func():\n \"\"\"Documentation...
2008/09/12
[ "https://Stackoverflow.com/questions/58622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
58,638
<p>How do I take a set of polygons which contain arbitrary values and create a corresponding bitmap where each pixel contains the value of the polygon at that location?</p> <p>To put the question into context, my polygons contain information about the average number of people per square kilometre within the polygon. I need to create a raster/bitmap that contains pixels representing the population in 200 metre bins.</p> <p>I've done something similar in the past where I've used a polygon to create a mask by drawing into a bitmap and filling values, then converting the bitmap into an array that I can manipulate. I'm sure there's a better method for doing this!</p> <p>I'm clarifying the question a bit more as requested.</p> <ol> <li>There are multiple polygons, each polygon is a set of vectors</li> <li>Each polygon will have a single unique value</li> <li>The polygons don't overlap</li> </ol> <p>Thanks</p> <p>Nick</p>
[ { "answer_id": 58793, "author": "Chris Upchurch", "author_id": 2600, "author_profile": "https://Stackoverflow.com/users/2600", "pm_score": 2, "selected": false, "text": "PolygonToRaster_conversion (in_features, value_field, out_raster_dataset, cell_assignment, priority_field, cellsize)\n...
2008/09/12
[ "https://Stackoverflow.com/questions/58638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5932/" ]
58,649
<p>I would like to write a small program in C# which goes through my jpeg photos and, for example, sorts them into dated folders (using MY dating conventions, dammit...). </p> <p>Does anyone know a relatively easy way to get at the EXIF data such as Date And Time or Exposure programatically? Thanks!</p>
[ { "answer_id": 156640, "author": "Dave Griffiths", "author_id": 15379, "author_profile": "https://Stackoverflow.com/users/15379", "pm_score": 6, "selected": true, "text": "var directories = ImageMetadataReader.ReadMetadata(imagePath);\n\n// print out all metadata\nforeach (var directory ...
2008/09/12
[ "https://Stackoverflow.com/questions/58649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6091/" ]
58,670
<p>Does anyone know a method to programmatically close the CD tray on Windows 2000 or higher? Open CD tray exists, but I can't seem to make it close especially under W2k. </p> <p>I am especially looking for a method to do this from a batch file, if possible, but API calls would be OK.</p>
[ { "answer_id": 58725, "author": "DaveK", "author_id": 4244, "author_profile": "https://Stackoverflow.com/users/4244", "pm_score": 4, "selected": true, "text": "\n[DllImport(\"winmm.dll\", EntryPoint = \"mciSendStringA\", CharSet = CharSet.Ansi)]\n protected static extern int mciSe...
2008/09/12
[ "https://Stackoverflow.com/questions/58670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3225/" ]
58,694
<p>I want to prevent XSS attacks in my web application. I found that HTML Encoding the output can really prevent XSS attacks. Now the problem is that how do I HTML encode every single output in my application? I there a way to automate this?</p> <p>I appreciate answers for JSP, ASP.net and PHP.</p>
[ { "answer_id": 58791, "author": "reefnet_alex", "author_id": 2745, "author_profile": "https://Stackoverflow.com/users/2745", "pm_score": 1, "selected": false, "text": "echo \"blah\";\n" }, { "answer_id": 58938, "author": "Peter Bernier", "author_id": 6112, "author_pro...
2008/09/12
[ "https://Stackoverflow.com/questions/58694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
58,697
<p>The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort.</p> <p>I recently received a non-pieceofcrapuous laptop, and I am in the process of copying everything from old to new. I'm trying to xcopy c:*.* from the old machine to an external hard drive, but because the cord pulls out so frequently, the xcopy is interrupted fairly often.</p> <p>What I need is a switch in XCopy that will copy eveything except for files that already exist in the destination folder -- the exact opposite of the behavior of the /U switch. </p> <p>Does anyone know of a way to do this? </p>
[ { "answer_id": 58729, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 4, "selected": true, "text": "xcopy \"O:\\*.*\" N:\\Whatever /C /D /S /H \n\n/C Continues copying even if errors occur. \n/D:m-d-y Copies files changed on...
2008/09/12
[ "https://Stackoverflow.com/questions/58697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2757/" ]
58,709
<p>I'm using ADO.NET to access SQL Server 2005 and would like to be able to log from inside the T-SQL stored procedures that I'm calling. Is that somehow possible?</p> <p>I'm unable to see output from the 'print'-statement when using ADO.NET and since I want to use logging just for debuging the ideal solution would be to emit messages to DebugView from SysInternals.</p>
[ { "answer_id": 59017, "author": "hollystyles", "author_id": 2083160, "author_profile": "https://Stackoverflow.com/users/2083160", "pm_score": 0, "selected": false, "text": "create procedure usp_LoggableProc \n\n@log varchar(max) OUTPUT \n\nas\n\n-- T-SQL statement here ...\n\nselect @log...
2008/09/12
[ "https://Stackoverflow.com/questions/58709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4164/" ]
58,711
<p>I have been playing with the Ruby library "shoes". Basically you can write a GUI application in the following way:</p> <pre><code>Shoes.app do t = para "Not clicked!" button "The Label" do alert "You clicked the button!" # when clicked, make an alert t.replace "Clicked!" # ..and replace the label's text end end </code></pre> <p>This made me think - how would I design a similarly nice-to-use GUI framework in Python? One that doesn't have the usual tyings of basically being wrappers to a C* library (In the case of GTK, Tk, wx, QT etc etc)</p> <p>Shoes takes things from web devlopment (like <code>#f0c2f0</code> style colour notation, CSS layout techniques, like <code>:margin =&gt; 10</code>), and from ruby (extensively using blocks in sensible ways)</p> <p>Python's lack of "rubyish blocks" makes a (metaphorically)-direct port impossible:</p> <pre><code>def Shoeless(Shoes.app): self.t = para("Not clicked!") def on_click_func(self): alert("You clicked the button!") self.t.replace("clicked!") b = button("The label", click=self.on_click_func) </code></pre> <p>No where near as clean, and wouldn't be <em>nearly</em> as flexible, and I'm not even sure if it would be implementable.</p> <p>Using decorators seems like an interesting way to map blocks of code to a specific action:</p> <pre><code>class BaseControl: def __init__(self): self.func = None def clicked(self, func): self.func = func def __call__(self): if self.func is not None: self.func() class Button(BaseControl): pass class Label(BaseControl): pass # The actual applications code (that the end-user would write) class MyApp: ok = Button() la = Label() @ok.clicked def clickeryHappened(): print "OK Clicked!" if __name__ == '__main__': a = MyApp() a.ok() # trigger the clicked action </code></pre> <p>Basically the decorator function stores the function, then when the action occurred (say, a click) the appropriate function would be executed.</p> <p>The scope of various stuff (say, the <code>la</code> label in the above example) could be rather complicated, but it seems doable in a fairly neat manner..</p>
[ { "answer_id": 58990, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 2, "selected": false, "text": "from Boots import App, Para, Button, alert\n\ndef Shoeless(App):\n t = Para(text = 'Not Clicked')\n b = Button(label = 'The...
2008/09/12
[ "https://Stackoverflow.com/questions/58711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
58,743
<p>As an example take the following code:</p> <pre><code>public enum ExampleEnum { FooBar, BarFoo } public class ExampleClass : INotifyPropertyChanged { private ExampleEnum example; public ExampleEnum ExampleProperty { get { return example; } { /* set and notify */; } } } </code></pre> <p>I want a to databind the property ExampleProperty to a ComboBox, so that it shows the options "FooBar" and "BarFoo" and works in mode TwoWay. Optimally I want my ComboBox definition to look something like this:</p> <pre><code>&lt;ComboBox ItemsSource="What goes here?" SelectedItem="{Binding Path=ExampleProperty}" /&gt; </code></pre> <p>Currently I have handlers for the ComboBox.SelectionChanged and ExampleClass.PropertyChanged events installed in my Window where I do the binding manually.</p> <p>Is there a better or some kind of canonical way? Would you usually use Converters and how would you populate the ComboBox with the right values? I don't even want to get started with i18n right now.</p> <p><strong>Edit</strong></p> <p>So one question was answered: How do I populate the ComboBox with the right values.</p> <p>Retrieve Enum values as a list of strings via an ObjectDataProvider from the static Enum.GetValues method:</p> <pre><code>&lt;Window.Resources&gt; &lt;ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="ExampleEnumValues"&gt; &lt;ObjectDataProvider.MethodParameters&gt; &lt;x:Type TypeName="ExampleEnum" /&gt; &lt;/ObjectDataProvider.MethodParameters&gt; &lt;/ObjectDataProvider&gt; &lt;/Window.Resources&gt; </code></pre> <p>This I can use as an ItemsSource for my ComboBox:</p> <pre><code>&lt;ComboBox ItemsSource="{Binding Source={StaticResource ExampleEnumValues}}"/&gt; </code></pre>
[ { "answer_id": 58766, "author": "rudigrobler", "author_id": 5147, "author_profile": "https://Stackoverflow.com/users/5147", "pm_score": 5, "selected": false, "text": "typesComboBox1.ItemsSource = Enum.GetValues(typeof(ExampleEnum));\n" }, { "answer_id": 58819, "author": "rudi...
2008/09/12
[ "https://Stackoverflow.com/questions/58743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1733/" ]
58,744
<p>I want to copy the entire contents of a directory from one location to another in C#.</p> <p>There doesn't appear to be a way to do this using <code>System.IO</code> classes without lots of recursion.</p> <p>There is a method in VB that we can use if we add a reference to <code>Microsoft.VisualBasic</code>:</p> <pre><code>new Microsoft.VisualBasic.Devices.Computer(). FileSystem.CopyDirectory( sourceFolder, outputFolder ); </code></pre> <p>This seems like a rather ugly hack. Is there a better way?</p>
[ { "answer_id": 58759, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 6, "selected": false, "text": "Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(fromDirectory, toDirectory);\n" }, { "answer_id": 58762, "aut...
2008/09/12
[ "https://Stackoverflow.com/questions/58744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/905/" ]
58,750
<p>Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?</p>
[ { "answer_id": 68766, "author": "Shermozle", "author_id": 10788, "author_profile": "https://Stackoverflow.com/users/10788", "pm_score": 5, "selected": true, "text": "var _ugifpath2=\"http://www.google-analytics.com/__utm.gif\";\nif (_udl.protocol==\"https:\") _ugifpath2=\"https://ssl.goo...
2008/09/12
[ "https://Stackoverflow.com/questions/58750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/370899/" ]
58,755
<p>What is the best way to do per-user database connections in <code>Rails</code>? </p> <p>I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.</p>
[ { "answer_id": 59063, "author": "Kevin Kaske", "author_id": 2737, "author_profile": "https://Stackoverflow.com/users/2737", "pm_score": 4, "selected": true, "text": "class ApplicationController < ActionController::Base\n\n before_filter :hijack_db\n\n def hijack_db\n db_name = reque...
2008/09/12
[ "https://Stackoverflow.com/questions/58755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/624/" ]
58,774
<p>I want to paste something I have cut from my desktop into a file open in Vi.</p> <p>But if I paste the tabs embed on top of each other across the page.</p> <p>I think it is some sort of visual mode change but can't find the command.</p>
[ { "answer_id": 58794, "author": "Antti Kissaniemi", "author_id": 2948, "author_profile": "https://Stackoverflow.com/users/2948", "pm_score": 7, "selected": true, "text": "autoindent" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/58774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6096/" ]
58,782
<p>I need to copy files using Windows command-line (available on XP Pro or later by default) and show progress during the process.</p> <p>The progress indicator could be in a terminal or a GUI window. It is intended to be used during batch file scripting.</p>
[ { "answer_id": 58785, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 4, "selected": false, "text": "robocopy" }, { "answer_id": 13695754, "author": "djangofan", "author_id": 118228, "author_profile":...
2008/09/12
[ "https://Stackoverflow.com/questions/58782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
58,783
<p>I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use ?</p>
[ { "answer_id": 58811, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 1, "selected": false, "text": "find . -name *.cs -exec wc -l {} \\;\n" }, { "answer_id": 212802, "author": "Constantin", "author_id"...
2008/09/12
[ "https://Stackoverflow.com/questions/58783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4694/" ]
58,825
<p>Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting.</p> <p>Are there any work-arounds or ways to fix this? I'm using vim 7.1.</p>
[ { "answer_id": 59211, "author": "Thomas Kammeyer", "author_id": 4410, "author_profile": "https://Stackoverflow.com/users/4410", "pm_score": 4, "selected": false, "text": ":syn sync fromstart\n" }, { "answer_id": 5652956, "author": "Jose Elera", "author_id": 428786, "a...
2008/09/12
[ "https://Stackoverflow.com/questions/58825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1693/" ]
58,827
<p>OK, I am not sure if the title it completely accurate, open to suggestions!</p> <p>I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me.</p> <p>I am thinking about the event model. Since we are not using Web Controls there are no events being fired from buttons, rather I am manually calling <strong>__doPostBack</strong> with the appropriate arguments. However this can obviously mean that there are a lot of postbacks occuring when say, selecting options (which render differently when selected).</p> <p>In time, I will need to make this more Ajax-y and responsive, so I will need to change the event binding to call local Javascript.</p> <p>So, I was thinking I should be able to toggle the "mode" of the control, it can either use postback and handlle itself, or you can specify the Javascript function names to call instead of the doPostBack.</p> <ul> <li>What are your thoughts on this?</li> <li>Am I approaching the raising of the events from the control in the wrong way? (totally open to suggestions here!)</li> <li>How would you approach a similar problem? <hr></li> </ul> <h2>Edit - To Clarify</h2> <ul> <li>I am creating a custom rendered control (i.e. inherits from WebControl).</li> <li>We are not using existnig Web Controls since we want complete control over the rendered output.</li> <li>AFAIK the only way to get a server side event to occur from a custom rendered control is to call doPostBack from the rendered elements (please correct if wrong!).</li> <li>ASP.NET MVC is not an option.</li> </ul>
[ { "answer_id": 59211, "author": "Thomas Kammeyer", "author_id": 4410, "author_profile": "https://Stackoverflow.com/users/4410", "pm_score": 4, "selected": false, "text": ":syn sync fromstart\n" }, { "answer_id": 5652956, "author": "Jose Elera", "author_id": 428786, "a...
2008/09/12
[ "https://Stackoverflow.com/questions/58827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
58,831
<p>My boss found a bug in a query I created, and I don't understand the reasoning behind the bug, although the query results prove he's correct. Here's the query (simplified version) before the fix:</p> <pre><code>select PTNO,PTNM,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); </code></pre> <p>and here it is after the fix:</p> <pre><code>select PTNO,PTNM,PARTS.CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD); </code></pre> <p>The bug was, that null values were being shown for column CATCD, i.e. the query results included results from table CATEGORIES instead of PARTS. Here's what I don't understand: if there was ambiguity in the original query, why didn't Oracle throw an error? As far as I understood, in the case of left joins, the "main" table in the query (PARTS) has precedence in ambiguity. Am I wrong, or just not thinking about this problem correctly?</p> <p>Update:</p> <p>Here's a revised example, where the ambiguity error is not thrown:</p> <pre><code>CREATE TABLE PARTS (PTNO NUMBER, CATCD NUMBER, SECCD NUMBER); CREATE TABLE CATEGORIES(CATCD NUMBER); CREATE TABLE SECTIONS(SECCD NUMBER, CATCD NUMBER); select PTNO,CATCD from PARTS left join CATEGORIES on (CATEGORIES.CATCD=PARTS.CATCD) left join SECTIONS on (SECTIONS.SECCD=PARTS.SECCD) ; </code></pre> <p>Anybody have a clue?</p>
[ { "answer_id": 58902, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 2, "selected": false, "text": "select id\nfrom sysobjects s\nleft join syscolumns c on s.id = c.id\n" }, { "answer_id": 58907, "author": "Pat", ...
2008/09/12
[ "https://Stackoverflow.com/questions/58831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751/" ]
58,841
<p>How can I get precompiled headers working with GCC?</p> <p>I have had no luck in my attempts and I haven't seen many good examples for how to set it up. I've tried on <a href="https://en.wikipedia.org/wiki/Cygwin" rel="nofollow noreferrer">Cygwin</a> GCC 3.4.4 and using 4.0 on <a href="https://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29" rel="nofollow noreferrer">Ubuntu</a>.</p>
[ { "answer_id": 60577, "author": "simon", "author_id": 4875, "author_profile": "https://Stackoverflow.com/users/4875", "pm_score": 3, "selected": false, "text": "g++ $(CPPFLAGS) test.h\n" }, { "answer_id": 1191407, "author": "Brian R. Bondy", "author_id": 3153, "author...
2008/09/12
[ "https://Stackoverflow.com/questions/58841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5200/" ]
58,851
<p>I am running an application through gdb and I want to set a breakpoint for any time a specific variable is accessed / changed. Is there a good method for doing this? I would also be interested in other ways to monitor a variable in C/C++ to see if/when it changes.</p>
[ { "answer_id": 58892, "author": "mweerden", "author_id": 4285, "author_profile": "https://Stackoverflow.com/users/4285", "pm_score": 3, "selected": false, "text": " $ cat gdbtest.c\n int abc = 43;\n\n int main()\n {\n abc = 10;\n }\n $ gcc -g -o gdbtest gdbtest.c\n $ gdb gdbtest\n ...\...
2008/09/12
[ "https://Stackoverflow.com/questions/58851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3022/" ]
58,872
<p>I've read in several places that the rectangle functions in emacs are very useful. I've read a bit about them, and I can't quite figure why. I mean, when you want to kill a paragraph, you mark the first row/column and then the last one, and that's actually a rectangle, right? But you can still use the normal kill...</p> <p>So what kind of transformations would you do with them?</p>
[ { "answer_id": 58885, "author": "David Webb", "author_id": 3171, "author_profile": "https://Stackoverflow.com/users/3171", "pm_score": 6, "selected": true, "text": "M-x delete-rectangle" }, { "answer_id": 59523, "author": "Mike Stone", "author_id": 122, "author_profil...
2008/09/12
[ "https://Stackoverflow.com/questions/58872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3785/" ]
58,910
<p>I've been trying to convert SVG images to PNG using C#, without having to write too much code. Can anyone recommend a library or example code for doing this?</p>
[ { "answer_id": 548553, "author": "stevenvh", "author_id": 66056, "author_profile": "https://Stackoverflow.com/users/66056", "pm_score": 3, "selected": false, "text": "procedure ExecNewProcess(ProgramName : String; Wait: Boolean);\nvar\n StartInfo : TStartupInfo;\n ProcInfo : TProcessIn...
2008/09/12
[ "https://Stackoverflow.com/questions/58910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5744/" ]
58,916
<p>Suppose I have a table called Companies that has a DepartmentID column. There's also a Departaments table that has as EmployeeID column. Of course I have an Employee table as well. The problem is that I want to delete a company, so first i have to delete all the employees for every departament and then all the departaments in the company. Cascade Delete is not an option, therefore i wish to use nested transactions. I'm new to SQL so I would appreciate your help.</p>
[ { "answer_id": 58943, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 0, "selected": false, "text": "BEGIN\n delete from Employee where departmentId = 1;\n BEGIN\n delete from Department where companyId = 2;\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1360/" ]
58,925
<p>I have any ASP.NET control. I want the HTML string how to do I get the HTML string of the control?</p>
[ { "answer_id": 58931, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 6, "selected": true, "text": "public string RenderControlToHtml(Control ControlToRender)\n{\n System.Text.StringBuilder sb = new System.Text.String...
2008/09/12
[ "https://Stackoverflow.com/questions/58925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2469/" ]
58,937
<p>Using VB.NET, how do I toggle the state of Caps Lock? </p>
[ { "answer_id": 58941, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": 4, "selected": true, "text": "Imports System.Runtime.InteropServices\n\nPublic Class Form2\n\n Private Declare Sub keybd_event Lib \"user32\" ( _\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133/" ]
58,939
<p>I'm trying to get an event to fire whenever a choice is made from a <code>JComboBox</code>.</p> <p>The problem I'm having is that there is no obvious <code>addSelectionListener()</code> method.</p> <p>I've tried to use <code>actionPerformed()</code>, but it never fires.</p> <p>Short of overriding the model for the <code>JComboBox</code>, I'm out of ideas.</p> <p>How do I get notified of a selection change on a <code>JComboBox</code>?**</p> <p><strong>Edit:</strong> I have to apologize. It turns out I was using a misbehaving subclass of <code>JComboBox</code>, but I'll leave the question up since your answer is good.</p>
[ { "answer_id": 58963, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 9, "selected": true, "text": "combo.addActionListener (new ActionListener () {\n public void actionPerformed(ActionEvent e) {\n doSomething();\n...
2008/09/12
[ "https://Stackoverflow.com/questions/58939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
58,940
<p>I'm using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, how do I access them from, for example, another stored procedure?</p> <pre><code>CREATE PROCEDURE getOrder (@orderId as numeric) AS BEGIN select order_address, order_number from order_table where order_id = @orderId select item, number_of_items, cost from order_line where order_id = @orderId END </code></pre> <p>I need to be able to iterate through both result sets individually.</p> <p>EDIT: Just to clarify the question, I want to test the stored procedures. I have a set of stored procedures which are used from a VB.NET client, which return multiple result sets. These are not going to be changed to a table valued function, I can't in fact change the procedures at all. Changing the procedure is not an option.</p> <p>The result sets returned by the procedures are not the same data types or number of columns.</p>
[ { "answer_id": 59015, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 6, "selected": true, "text": "INSERT INTO #Table (...columns...)\nEXEC MySproc ...parameters...\n" }, { "answer_id": 879516, "author": "Communit...
2008/09/12
[ "https://Stackoverflow.com/questions/58940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1836/" ]
58,969
<p>I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass this to each function but I can't figure out how to pass this or test the different errors that could come back as being correct or not.</p> <p><b>Edit:</b> I should have said. I have a user class and I want to pass a different instance of this class to each unit test. </p>
[ { "answer_id": 63442, "author": "Andrew Culver", "author_id": 7549, "author_profile": "https://Stackoverflow.com/users/7549", "pm_score": 3, "selected": true, "text": "class User\n{\n public function commonFunctionality()\n {\n return 'Something';\n }\n\n public functi...
2008/09/12
[ "https://Stackoverflow.com/questions/58969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4437/" ]
58,976
<p>How do I find out whether or not Caps Lock is activated, using VB.NET?</p> <p>This is a follow-up to my <a href="https://stackoverflow.com/questions/58937/how-do-i-toggle-caps-lock-in-vbnet">earlier question</a>.</p>
[ { "answer_id": 58991, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 2, "selected": false, "text": "Declare Function GetKeyState Lib \"user32\" \n Alias \"GetKeyState\" (ByValnVirtKey As Int32) As Int16\n\nPrivate Const VK_CAPS...
2008/09/12
[ "https://Stackoverflow.com/questions/58976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/133/" ]
58,988
<p>The Interface Segregation Principle (ISP) says that many client specific interfaces are better than one general purpose interface. Why is this important?</p>
[ { "answer_id": 17999321, "author": "isJustMe", "author_id": 571946, "author_profile": "https://Stackoverflow.com/users/571946", "pm_score": 3, "selected": false, "text": "public interface Reportable {\n\n void printPDF();\n void printWord();\n void printExcel();\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/58988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012/" ]
59,007
<p>I'd like to automate TortoiseSVN as part of a commit process. Specifically I'd like to dynamically create a log entry for the commit dialog.</p> <p>I know that I can launch the commit dialog either from the commandline or by right clicking on a folder and selecting svncommit.</p> <p>I'd like to use the start commit hook to setup a log entry. I thought this worked by passing an entry file name in the MESSAGEFILE variable but when I add a hook script it cannot see this variable (hook launched successfully after right clicking and choosing svncommit).</p> <p>When I try using the commandline I use the /logmsgfile parameter but it seems to have no effect.</p> <p>I'm using tortoisesvn 1.5.3.</p>
[ { "answer_id": 59379, "author": "Nathan Jones", "author_id": 5848, "author_profile": "https://Stackoverflow.com/users/5848", "pm_score": 1, "selected": false, "text": "GenerateLogMsg.exe > tmp.msg\n\"C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe\" /command:commit /path:. /logmsgf...
2008/09/12
[ "https://Stackoverflow.com/questions/59007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427/" ]
59,013
<p>Context: I'm in charge of running a service written in .NET. Proprietary application. It uses a SQL Server database. It ran as a user member of the Administrators group in the local machine. It worked alright before I added the machine to a domain.</p> <p>So, I added the machine to a domain (Win 2003) and changed the user to a member of the Power Users group and now, the</p> <p>Problem: Some of the SQL sentences it tries to execute are "magically" in spanish localization (where , separates floating point numbers instead of .), leading to errors. </p> <blockquote> <p>There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)</p> </blockquote> <p>Operating System and Regional Settings in the machine are in English. I asked the provider of the application and he said:</p> <blockquote> <p>Looks like you have a combination of code running under Spanish locale, and SQL server under English locale. So the SQL expects '15.28' and not '15,28'</p> </blockquote> <p>Which looks wrong to me in various levels (how can SQL Server distinguish between commas to separate arguments and commas belonging to a floating point number?).</p> <p>So, the code seems to be grabbing the spanish locale from somewhere, I don't know if it's the user it runs as, or someplace else (global policy, maybe?). But the question is</p> <p>What are the places where localization is defined on a machine/user/domain basis?</p> <p>I don't know all the places I must search for the culprit, so please help me to find it!</p>
[ { "answer_id": 59071, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 3, "selected": true, "text": "HKEY_CURRENT_USER\\Control Panel\\International\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5190/" ]
59,016
<p>The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?</p>
[ { "answer_id": 44913685, "author": "maysara", "author_id": 5503714, "author_profile": "https://Stackoverflow.com/users/5503714", "pm_score": 3, "selected": false, "text": "var juiceTypes = ['Mango','Apple','Lemon'];\nfunction juiceMaker(type){\n if(juiceTypes.indexOf(type)!=-1)\n ...
2008/09/12
[ "https://Stackoverflow.com/questions/59016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3012/" ]
59,022
<p>We are currently storing plain text passwords for a web app that we have. </p> <p>I keep advocating moving to a password hash but another developer said that this would be less secure -- more passwords could match the hash and a dictionary/hash attack would be faster.</p> <p>Is there any truth to this argument? </p>
[ { "answer_id": 59054, "author": "Tim Howland", "author_id": 4276, "author_profile": "https://Stackoverflow.com/users/4276", "pm_score": 1, "selected": false, "text": "String hashedPass=CryptUtils.MD5(\"alsdl;ksahglhkjfsdkjhkjhkfsdlsdf\" + user.getCreateDate().toString() + user.getPasswo...
2008/09/12
[ "https://Stackoverflow.com/questions/59022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5882/" ]
59,044
<p>Question is pretty self explanitory. I want to do a simple find and replace, like you would in a text editor on the data in a column of my database (which is MsSQL on MS Windows server 2003)</p>
[ { "answer_id": 59055, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 8, "selected": true, "text": "a" }, { "answer_id": 59057, "author": "Jiaaro", "author_id": 2908, "author_profile": "https://Stackoverflo...
2008/09/12
[ "https://Stackoverflow.com/questions/59044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2908/" ]
59,075
<p>How do I save each sheet in an Excel workbook to separate <code>CSV</code> files with a macro?</p> <p>I have an excel with multiple sheets and I was looking for a macro that will save each sheet to a separate <code>CSV (comma separated file)</code>. Excel will not allow you to save all sheets to different <code>CSV</code> files.</p>
[ { "answer_id": 59078, "author": "Alex Duggleby", "author_id": 5790, "author_profile": "https://Stackoverflow.com/users/5790", "pm_score": 4, "selected": false, "text": "Private Sub SaveAllSheetsAsCSV()\nOn Error GoTo Heaven\n\n' each sheet reference\nDim Sheet As Worksheet\n' path to out...
2008/09/12
[ "https://Stackoverflow.com/questions/59075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5790/" ]
59,083
<h2>Question</h2> <p>Alright, I'm confused by all the buzzwords and press release bingo going on.</p> <ul> <li>What is the relationship between flash and flex: <ul> <li>Replace flash (not really compatible)</li> <li>Enhance flash</li> <li>The next version of flash but still basically compatible</li> <li>Separate technology altogether</li> <li>???</li> </ul></li> <li>If I'm starting out in Flash now, should I just skip to Flex?</li> </ul> <h2>Follow up</h2> <p>Ok, so what I'm hearing is that there's three different parts to the puzzle:</p> <ul> <li><strong>Flash</strong> <ul> <li>The graphical editor used to make "Flash Movies", ie it's an IDE that focuses on the visual aspect of "Flash" (Officially Flash CS3?)</li> <li>The official name for the display plugins (ie, "Download Flash Now!")</li> <li>A general reference to the entire technology stack</li> <li>In terms of the editor, it's a linear timeline based editor, best used for animations with complex interactivity.</li> </ul></li> <li><strong>Actionscript</strong> <ul> <li>The "Flash" programming language</li> </ul></li> <li><strong>Flex</strong> <ul> <li>An Adobe Flash IDE that focuses on the coding/programming aspect of "Flash" (Flex Builder?)</li> <li>A Flash library that enhances Flash and makes it easier to <em>program</em> for (Flex SDK?)</li> <li>Is not bound to a timeline (as the Flash IDE is) and so "standard" applications are more easily accomplished.</li> </ul></li> </ul> <p>Is this correct?</p> <p>-Adam</p>
[ { "answer_id": 2276350, "author": "JD Isaacks", "author_id": 46011, "author_profile": "https://Stackoverflow.com/users/46011", "pm_score": 2, "selected": false, "text": ".net" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2915/" ]
59,098
<p>We have some Win32 console applications running on Windows Server 2003 Service Pack 2 that regularly fail with this:</p> <blockquote> <p>Error 1450 (<code>ERROR_NO_SYSTEM_RESOURCES</code>): "Insufficient system resources exist to complete the requested service."</p> </blockquote> <p>All the documentation we've found suggests it is linked to the number of <strong>Free System Page Table Entries</strong> running out. We have 16GB RAM in these machines and use the <code>/3GB</code> Operating System switch to squeeze the Windows kernel into 1GB and allow our processes access to 3GB of address space. This drastically reduces the total number of Free System Page Table Entries, so combined with our heavy use of MapViewOfFile() it is perhaps not surprising that the kernel page table entries are running out.</p> <p>However, when using Performance Monitor to view the Free System Page Table Entries counter, the value is around 36,000 on reboot and <strong>doesn't go down when our application starts</strong>. I find it hard to believe that our application, which opens many large memory-mapped files, doesn't have any effect on the kernel page table. If we can't believe the counter, it's much more difficult to test the effect of any system changes we make.</p> <p>There is a promising Knowledge Base article, <a href="http://support.microsoft.com/kb/894067" rel="nofollow noreferrer">The Performance tool does not accurately show the available Free System Page Table entries in Windows Server 2003</a>, but it says the problem has been fixed in Service Pack 1, and we are already on Service Pack 2.</p> <p>Has anyone else struggled with or solved this issue?</p> <p><strong>Update:</strong> I have checked !sysptes in windbg (debugging the kernel) and the value matches the performance counter, around 36,000. I guess this is most likely to mean that there really are that many free page table entries and Windows <em>is</em> telling the truth. It does leave the question of why we're getting 1450 errors though, if the PTEs are not running out.</p> <p><strong>Further update:</strong> We never did get to the bottom of why the 1450 errors were occurring. <em>However</em>, instead we upgraded the OS on these servers to 64-bit Windows. This allows the existing 32-bit applications (without recompilation) to access a full 4GB of virtual address space, and lets the kernel memory area with those pesky Page Table Entries be as big as it likes too. I don't think we've had a 1450 error since.</p>
[ { "answer_id": 139529, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 0, "selected": false, "text": "ERROR_NO_SYSTEM_RESOURCES" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5536/" ]
59,099
<p>Visually both of the following snippets produce the same UI. So why are there 2 controls..<br> <strong>Snippet1</strong> </p> <pre><code>&lt;TextBlock&gt;Name:&lt;/TextBlock&gt; &lt;TextBox Name="nameTextBox" /&gt; </code></pre> <p><strong>Snippet2</strong></p> <pre><code>&lt;Label&gt;Name:&lt;/Label&gt; &lt;TextBox Name="nameTextBox" /&gt; </code></pre> <p>(<em>Well I am gonna answer this myself... thought this is a useful tidbit I learnt today from <a href="https://rads.stackoverflow.com/amzn/click/com/0596510373" rel="noreferrer" rel="nofollow noreferrer">Programming WPF</a></em>) </p>
[ { "answer_id": 59104, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 4, "selected": false, "text": "<Label Target=\"{Binding ElementName=nameTextBox}\">_Name:</Label>\n<TextBox x:Name=\"nameTextBox\" />\n" }, { "answer_...
2008/09/12
[ "https://Stackoverflow.com/questions/59099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1695/" ]
59,102
<p>Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter?</p> <p>Example 1 - separate parameters: function convertTemperature("celsius", "fahrenheit", 22)</p> <p>Example 2 - combined parameter: function convertTemperature("c-f", 22)</p> <p>The code inside the function is probably where it counts. With two parameters, the logic to determine what formula we're going to use is slightly more complicated, but a single parameter doesn't feel right somehow.</p> <p>Thoughts?</p>
[ { "answer_id": 59108, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 5, "selected": true, "text": "convertTemperature (TempScale.CELSIUS, TempScale.FAHRENHEIT, 22)\n" }, { "answer_id": 59117, "author": "Adam Wri...
2008/09/12
[ "https://Stackoverflow.com/questions/59102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6126/" ]
59,105
<p>Almost 5 years ago Joel Spolsky wrote this article, <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow noreferrer">"The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)"</a>.</p> <p>Like many, I read it carefully, realizing it was high-time I got to grips with this "replacement for ASCII". Unfortunately, 5 years later I feel I have slipped back into a few bad habits in this area. Have you?</p> <p>I don't write many specifically international applications, however I have helped build many ASP.NET internet facing websites, so I guess that's not an excuse. </p> <p>So for my benefit (and I believe many others) can I get some input from people on the following:</p> <ul> <li>How to "get over" ASCII once and for all</li> <li>Fundamental guidance when working with Unicode.</li> <li>Recommended (recent) books and websites on Unicode (for developers). </li> <li>Current state of Unicode (5 years after Joels' article) </li> <li>Future directions.</li> </ul> <p>I must admit I have a .NET background and so would also be happy for information on Unicode in the .NET framework. Of course this shouldn't stop anyone with a differing background from commenting though.</p> <p>Update: See <a href="https://stackoverflow.com/questions/898/internationalization-in-your-projects">this related question</a> also asked on StackOverflow previously.</p>
[ { "answer_id": 59225, "author": "OwenP", "author_id": 2547, "author_profile": "https://Stackoverflow.com/users/2547", "pm_score": 2, "selected": false, "text": "StreamReader" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5023/" ]
59,107
<p>I'm converting an application to use Java 1.5 and have found the following method:</p> <pre><code> /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1&amp;lt;o2, 0 if o1==o2, 1 if o1&amp;gt;o2 */ protected static int nullCompare(Comparable o1, Comparable o2) { if (o1 == null) { if (o2 == null) { return 0; } else { return -1; } } else if (o2 == null) { return 1; } else { return o1.compareTo(o2); } } </code></pre> <p>Ideally I would like to make the method take two Comparables of the same type, is it possible to convert this and how? </p> <p>I thought the following would do the trick:</p> <pre><code>protected static &lt;T extends Comparable&gt; int nullCompare(T o1, T o2) { </code></pre> <p>but it has failed to get rid of a warning in IntelliJ "Unchecked call to 'compareTo(T)' as a member of raw type 'java.lang.Comparable'" on the line:</p> <pre><code>return o1.compareTo(o2); </code></pre>
[ { "answer_id": 59119, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 5, "selected": true, "text": "protected static <T extends Comparable<T>> int nullCompare(T o1, T o2) {\n" }, { "answer_id": 85739, "author": "...
2008/09/12
[ "https://Stackoverflow.com/questions/59107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4389/" ]
59,120
<p>I am getting this error now that I hit version number 1.256.0: Error 4 Invalid product version '1.256.0'. Must be of format '##.##.####'</p> <p>The installer was fine with 1.255.0 but something with 256 (2^8) it doesn't like. I found this stated on msdn.com: The Version property must be formatted as N.N.N, where each N represents at least one and no more than four digits. (<a href="http://msdn.microsoft.com/en-us/library/d3ywkte8(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/d3ywkte8(VS.80).aspx</a>)</p> <p>Which would make me believe there is nothing wrong 1.256.0 because it meets the rules stated above.</p> <p>Does anyone have any ideas on why this would be failing now?</p>
[ { "answer_id": 59119, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 5, "selected": true, "text": "protected static <T extends Comparable<T>> int nullCompare(T o1, T o2) {\n" }, { "answer_id": 85739, "author": "...
2008/09/12
[ "https://Stackoverflow.com/questions/59120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5967/" ]
59,128
<p>What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in .NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean. </p> <p>Now, I have to write some Java code and want to run something similar using JUnit. The JUnit documentation is nice and clear about adding the attributes necessary to create tests, but its pretty lean on how to fire up a runner and see the results of those tests.</p>
[ { "answer_id": 11132066, "author": "antonv", "author_id": 472020, "author_profile": "https://Stackoverflow.com/users/472020", "pm_score": 1, "selected": false, "text": "junit.textui.TestRunner %your_class%" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
59,154
<p>When I press F5 in Visual Studio 2008, I want Google Chrome launched as the browser that my ASP.NET app runs in. May I know how this can be done?</p>
[ { "answer_id": 44865188, "author": "Soenhay", "author_id": 1339704, "author_profile": "https://Stackoverflow.com/users/1339704", "pm_score": 2, "selected": false, "text": "C:\\Users\\[UserName]\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe\n" }, { "answer_id": 72770808...
2008/09/12
[ "https://Stackoverflow.com/questions/59154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
59,166
<p>So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects.</p> <pre><code>List&lt;MyObject&gt; myObjects = new List&lt;MyObject&gt;(); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); </code></pre> <p>So I want to remove objects from my list based on some criteria. For instance, <code>myObject.X &gt;= 10.</code> I would like to use the <code>RemoveAll(Predicate&lt;T&gt; match)</code> method for to do this.</p> <p>I know I can define a delegate which can be passed into RemoveAll, but I would like to know how to define this inline with an anonymous delegate, instead of creating a bunch of delegate functions which are only used in once place.</p>
[ { "answer_id": 59172, "author": "Erik van Brakel", "author_id": 909, "author_profile": "https://Stackoverflow.com/users/909", "pm_score": 7, "selected": true, "text": "myObjects.RemoveAll(delegate (MyObject m) { return m.X >= 10; });\n" }, { "answer_id": 59174, "author": "Mar...
2008/09/12
[ "https://Stackoverflow.com/questions/59166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454247/" ]
59,181
<p>I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. </p> <p>Restarting IIS or clearing out the Temp ASP.Net files or setting batch="false" on the compilation tag in web.config does not resolve the problem</p> <p>From the browser </p> <p><a href="https://Myserver/MyApp/Services/MyService.svc" rel="nofollow noreferrer">https://Myserver/MyApp/Services/MyService.svc</a> displays the service metadata</p> <p>however </p> <p><a href="https://Myserver/MyApp/Services/MyService.svc/jsdebug" rel="nofollow noreferrer">https://Myserver/MyApp/Services/MyService.svc/jsdebug</a> results in a 404.</p> <p>The issue seems to be with the https protocol. With http /jsdebug downloads the supporting JS file.</p> <p>Any ideas?</p> <p>TIA</p>
[ { "answer_id": 59764, "author": "rams", "author_id": 3635, "author_profile": "https://Stackoverflow.com/users/3635", "pm_score": 5, "selected": true, "text": "<services>\n <service name=\"MyService\">\n <endpoint address=\"\" behaviorConfiguration=\"MyServiceAspNetAjaxBehavio...
2008/09/12
[ "https://Stackoverflow.com/questions/59181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3635/" ]
59,182
<p>What is the best way to keep an asp:button from displaying it's URL on the status bar of the browser? The button is currently defines like this:</p> <pre><code>&lt;asp:button id="btnFind" runat="server" Text="Find Info" onclick="btnFind_Click"&gt; &lt;/asp:button&gt; </code></pre> <p><strong>Update:</strong></p> <p>This appears to be specific to IE7, IE6 and FF do not show the URL in the status bar.</p>
[ { "answer_id": 59234, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": -1, "selected": false, "text": "javascript:__doPostBack('btn','');\n" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206/" ]
59,191
<p>I'm using a deploy project to deploy my ASP.net web application. When I build the deploy project, all the .compiled files are re-created.</p> <p>Do I need to FTP them to the production web server?<br> If I do a small change do I need to copy all the web site again?</p>
[ { "answer_id": 2142674, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 0, "selected": false, "text": ".compiled" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
59,213
<p>What's the easiest way to add a header and footer to a .Net PrintDocument object, either pragmatically or at design-time?</p> <p>Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a PrintDocument object and draws itself into it.</p> <p>The resulting page just contains the grid and it's contents - however I would like to add a header or title to identify the printed report, and possibly a footer to show who printed it, when, and ideally a page number and total pages.</p> <p>I'm using VB.Net 2.0.</p> <p>Thanks for your help!</p>
[ { "answer_id": 224934, "author": "Andrew", "author_id": 5662, "author_profile": "https://Stackoverflow.com/users/5662", "pm_score": 3, "selected": false, "text": "Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click\n\n Dim ...
2008/09/12
[ "https://Stackoverflow.com/questions/59213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
59,217
<p>Is there a built in function in .NET 2.0 that will take two arrays and merge them into one array?</p> <p>The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different format.</p> <p>I'm looking to avoid writing my own function to accomplish this if possible.</p>
[ { "answer_id": 59233, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 3, "selected": false, "text": "Array.Copy()" }, { "answer_id": 59246, "author": "apandit", "author_id": 6128, "author_profile": "h...
2008/09/12
[ "https://Stackoverflow.com/questions/59217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3058/" ]
59,220
<p>I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use.</p> <p>What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an exported HTML form as fields. That form will be then used in my ASP.NET MVC app as the beginning of a View.</p> <p>As I'm using Subsonic objects for the applications where I want to use, this should be reasonable and I figured that, by wanting to include things like differing output HTML depending on data type, Reflection was the way to get this done.</p> <p>What I'm looking for, however, seems to be elusive. I'm trying to take the DLL/EXE that's chosen through the OpenFileDialog as the starting point and load it:</p> <pre><code>String FilePath = Path.GetDirectoryName(FileName); System.Reflection.Assembly o = System.Reflection.Assembly.LoadFile(FileName); </code></pre> <p>That works fine, but because Subsonic-generated objects actually are full of object types that are defined in Subsonic.dll, etc., those dependent objects aren't loaded. Enter:</p> <pre><code>AssemblyName[] ReferencedAssemblies = o.GetReferencedAssemblies(); </code></pre> <p>That, too, contains exactly what I would expect it to. However, what I'm trying to figure out is how to load those assemblies so that my digging into my objects will work properly. I understand that if those assemblies were in the GAC or in the directory of the running executable, I could just load them by their name, but that isn't likely to be the case for this use case and it's my primary use case.</p> <p>So, what it boils down to is how do I load a given assembly and all of its arbitrary assemblies starting with a filename and resulting in a completely Reflection-browsable tree of types, properties, methods, etc.</p> <p>I know that tools like Reflector do this, I just can't find the syntax for getting at it. </p>
[ { "answer_id": 59243, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 5, "selected": true, "text": "AppDomain.AssemblyResolve" }, { "answer_id": 37060921, "author": "mathume", "author_id": 400694, "au...
2008/09/12
[ "https://Stackoverflow.com/questions/59220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124/" ]
59,221
<p>I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy").</p> <p>For clarity, <strong>I would like to have a tooltip pop up with the related action</strong> (ie. "edit", "copy") when I hover the mouse over the icon.</p> <p>I thought I could do this by adding a simple "alt" definition to the tag, but that doesn't appear to work.</p> <p>Can somebody point me in the right direction?</p>
[ { "answer_id": 59226, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "alt" }, { "answer_id": 59228, "author": "Prestaul", "author_id": 5628, "author_profile": "https://S...
2008/09/12
[ "https://Stackoverflow.com/questions/59221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3764/" ]
59,232
<p>What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table?</p> <p>For example: I have a <code>JOBS</code> table with the column <code>JOB_NUMBER</code>. How can I find out if I have any duplicate <code>JOB_NUMBER</code>s, and how many times they're duplicated?</p>
[ { "answer_id": 59242, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 10, "selected": true, "text": "SELECT column_name, COUNT(column_name)\nFROM table_name\nGROUP BY column_name\nHAVING COUNT(column_name) > 1;\n" },...
2008/09/12
[ "https://Stackoverflow.com/questions/59232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
59,267
<p>Starting from ASP.NET MVC Preview 3, HTML.Button ( and other related HTML controls) are no longer supported.</p> <p>The question is, what is the equivalent for them? I've an app that was built using Preview 2, now I have to make it compatible with the latest CTP releases.</p>
[ { "answer_id": 59271, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": false, "text": "<input type=\"button\" ... />" }, { "answer_id": 59286, "author": "Thunder3", "author_id": 2832, "a...
2008/09/12
[ "https://Stackoverflow.com/questions/59267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
59,280
<p>I need to update a <code>combobox</code> with a new value so it changes the reflected text in it. The cleanest way to do this is after the <code>combobox</code>has been initialised and with a message.</p> <p>So I am trying to craft a <code>postmessage</code> to the hwnd that contains the <code>combobox</code>.</p> <p>So if I want to send a message to it, changing the currently selected item to the nth item, what would the <code>postmessage</code> look like?</p> <p>I am guessing that it would involve <code>ON_CBN_SELCHANGE</code>, but I can't get it to work right.</p>
[ { "answer_id": 59317, "author": "Simon Steele", "author_id": 4591, "author_profile": "https://Stackoverflow.com/users/4591", "pm_score": 4, "selected": true, "text": "ComboBox_SetCurSel(hWndCombo, n);\n" }, { "answer_id": 59350, "author": "Mark Ingram", "author_id": 986, ...
2008/09/12
[ "https://Stackoverflow.com/questions/59280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342/" ]
59,294
<p>I have the following query:</p> <pre><code>select column_name, count(column_name) from table group by column_name having count(column_name) &gt; 1; </code></pre> <p>What would be the difference if I replaced all calls to <code>count(column_name)</code> to <code>count(*)</code>?</p> <p>This question was inspired by <a href="https://stackoverflow.com/questions/59232/how-do-i-find-duplicate-values-in-a-table-in-oracle">How do I find duplicate values in a table in Oracle?</a>.</p> <hr> <p>To clarify the accepted answer (and maybe my question), replacing <code>count(column_name)</code> with <code>count(*)</code> would return an extra row in the result that contains a <code>null</code> and the count of <code>null</code> values in the column.</p>
[ { "answer_id": 59302, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 9, "selected": true, "text": "count(*)" }, { "answer_id": 59369, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stac...
2008/09/12
[ "https://Stackoverflow.com/questions/59294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
59,297
<p>When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it?</p> <p>This probably applies to other databases as well.</p> <p>I'm looking most of all for concrete examples of each scenario, preferably from someone who has used them successfully.</p>
[ { "answer_id": 216301, "author": "WW.", "author_id": 14663, "author_profile": "https://Stackoverflow.com/users/14663", "pm_score": 2, "selected": false, "text": " DELETE FROM table WHERE SomeDate < 7 years ago;\n" }, { "answer_id": 73498113, "author": "Jonas Kello", "auth...
2008/09/12
[ "https://Stackoverflow.com/questions/59297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
59,299
<p>I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated.</p> <p>Thanks</p>
[ { "answer_id": 61394, "author": "Mat Mannion", "author_id": 6282, "author_profile": "https://Stackoverflow.com/users/6282", "pm_score": 2, "selected": false, "text": "<attribute name=\"MaxCapacity\">20000</attribute>" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5425/" ]
59,309
<p>What is the best way to vertically center the content of a div when the height of the content is variable. In my particular case, the height of the container div is fixed, but it would be great if there were a solution that would work in cases where the container has a variable height as well. Also, I would love a solution with no, or very little use of CSS hacks and/or non-semantic markup.</p> <p><img src="https://content.screencast.com/users/jessegavin/folders/Jing/media/ba5c2688-0aad-4e89-878a-8911946f8612/2008-09-12_1027.png" alt="alt text"></p>
[ { "answer_id": 59324, "author": "Prestaul", "author_id": 5628, "author_profile": "https://Stackoverflow.com/users/5628", "pm_score": 4, "selected": false, "text": "position:table\\table-cell" }, { "answer_id": 13075912, "author": "Fadi", "author_id": 856921, "author_p...
2008/09/12
[ "https://Stackoverflow.com/questions/59309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5651/" ]
59,322
<p>I have the following code:</p> <pre><code>SELECT &lt;column&gt;, count(*) FROM &lt;table&gt; GROUP BY &lt;column&gt; HAVING COUNT(*) &gt; 1; </code></pre> <p>Is there any difference to the results or performance if I replace the COUNT(*) with COUNT('x')?</p> <p>(This question is related to a <a href="https://stackoverflow.com/questions/59294/in-sql-whats-the-difference-between-countcolumn-and-count">previous one</a>)</p>
[ { "answer_id": 59385, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 2, "selected": false, "text": "select count(*) from table\n" }, { "answer_id": 59412, "author": "Matt Rogish", "author_id": 2590, "autho...
2008/09/12
[ "https://Stackoverflow.com/questions/59322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
59,331
<p>Suppose I have <code>fileA.h</code> which declares a class <code>classA</code> with template function <code>SomeFunc&lt;T&gt;()</code>. This function is implemented directly in the header file (as is usual for template functions). Now I add a specialized implementation of <code>SomeFunc()</code> (like for <code>SomeFunc&lt;int&gt;()</code>) in <code>fileA.C</code> (ie. not in the header file).</p> <p>If I now call <code>SomeFunc&lt;int&gt;()</code> from some other code (maybe also from another library), would it call the generic version, or the specialization?</p> <p>I have this problem right now, where the class and function live in a library which is used by two applications. And one application correctly uses the specialization, while another app uses the generic form (which causes runtime problems later on). Why the difference? Could this be related to linker options etc? This is on Linux, with g++ 4.1.2.</p>
[ { "answer_id": 59359, "author": "Brandon", "author_id": 5959, "author_profile": "https://Stackoverflow.com/users/5959", "pm_score": 0, "selected": false, "text": "SomeFunc<int>()" }, { "answer_id": 59361, "author": "Serge", "author_id": 1007, "author_profile": "https:...
2008/09/12
[ "https://Stackoverflow.com/questions/59331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148773/" ]
59,357
<p><strong>Edit</strong>: Let me completely rephrase this, because I'm not sure there's an XML way like I was originally describing.</p> <p><strong>Yet another edit</strong>: This needs to be a repeatable process, and it has to be able to be set up in a way that it can be called in C# code.</p> <p>In database A, I have a set of tables, related by PKs and FKs. A parent table, with child and grandchild tables, let's say.</p> <p>I want to <strong>copy a set of rows from database A to database B</strong>, which has identically named tables and fields. For each table, I want to insert into the same table in database B. But I can't be constrained to use the same primary keys. <strong>The copy routine must create new PKs</strong> for each row in database B, and must propagate those to the child rows. I'm keeping the same relations between the data, in other words, but not the same exact PKs and FKs.</p> <p>How would you solve this? I'm open to suggestions. SSIS isn't completely ruled out, but it doesn't look to me like it'll do this exact thing. I'm also open to a solution in LINQ, or using typed DataSets, or using some XML thing, or just about anything that'll work in SQL Server 2005 and/or C# (.NET 3.5). The best solution wouldn't require SSIS, and wouldn't require writing a lot of code. But I'll concede that this "best" solution may not exist.</p> <p>(I didn't make this task up myself, nor the constraints; this is how it was given to me.)</p>
[ { "answer_id": 59407, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 1, "selected": false, "text": "SELECT" } ]
2008/09/12
[ "https://Stackoverflow.com/questions/59357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5486/" ]
59,380
<p>I have a wildcard subdomain enabled and dynamically parse the URL by passing it as-is to my <code>index.php</code> (ex. <code>somecity.domain.com</code>). </p> <p>Now, I wish to create a few subdomains that are static where I can install different application and not co-mingle with my current one (ex. <code>blog.domain.com</code>).</p> <p>My <code>.htaccess</code> currently reads:</p> <pre><code>RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </code></pre> <p>Can I manipulate this <code>.htaccess</code> to achieve what I need? Can it be done through Apache?</p>
[ { "answer_id": 59403, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "NameVirtualHost *:80\n\n# Begin virtual host directives.\n\n<VirtualHost *:80>\n\n# myblog.com virtual host.\n\nServerAdmin web...
2008/09/12
[ "https://Stackoverflow.com/questions/59380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6140/" ]
59,390
<p>In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables?</p> <p>Am I going to get myself into trouble if I change this:</p> <pre><code>&lt;cfcomponent&gt; &lt;cfset variables.foo = "a private instance variable"&gt; &lt;cffunction name = "doSomething"&gt; &lt;cfset var bar = "a function local variable"&gt; &lt;cfreturn "I have #variables.foo# and #bar#."&gt; &lt;/cffunction&gt; &lt;/cfcomponent&gt; </code></pre> <p>to this?</p> <pre><code>&lt;cfcomponent&gt; &lt;cfset foo = "a private instance variable"&gt; &lt;cffunction name = "doSomething"&gt; &lt;cfset var bar = "a function local variable"&gt; &lt;cfreturn "I have #foo# and #bar#."&gt; &lt;/cffunction&gt; &lt;/cfcomponent&gt; </code></pre>
[ { "answer_id": 59554, "author": "Soldarnal", "author_id": 3420, "author_profile": "https://Stackoverflow.com/users/3420", "pm_score": 4, "selected": true, "text": "<cfcomponent>\n <cfset foo = \"a private instance variable\">\n\n <cffunction name=\"doSomething\">\n <cfargume...
2008/09/12
[ "https://Stackoverflow.com/questions/59390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/437/" ]
59,396
<p>I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with RhinoMocks how can I indicate that it should transform its input?</p> <p>Ideally I would like to write something like this:</p> <pre><code>Expect.Call(delegate {dao.Save(transaction);}).Override(x =&gt; x.IsSaved=true); </code></pre> <p>Does anyone know how to do this?</p> <hr> <p>Though I got a hint how to do it from the answer specified below the actual type signature is off, you have to do something like this: Because of what Mark Ingram posted, seems like the best answer, though nobody's explicitly said it, is to do this:</p> <pre><code>public delegate void FakeSave(Transaction t); ... Expect.Call(delegate {dao.Save(t); }).Do( new FakeSave(delegate(Transaction t2) { t.IsSaved = true; })); </code></pre>
[ { "answer_id": 59420, "author": "chrissie1", "author_id": 2936, "author_profile": "https://Stackoverflow.com/users/2936", "pm_score": -1, "selected": false, "text": "ITransaction transaction = _Mocker.dynamicMock<ITransaction>;\nExpect.Call(transaction.IsSaved).IgnoreArguments.Return(tru...
2008/09/12
[ "https://Stackoverflow.com/questions/59396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
59,422
<p>Is accessing a <strong>bool</strong> field atomic in C#? In particular, do I need to put a lock around:</p> <pre><code>class Foo { private bool _bar; //... in some function on any thread (or many threads) _bar = true; //... same for a read if (_bar) { ... } } </code></pre>
[ { "answer_id": 59505, "author": "McKenzieG1", "author_id": 3776, "author_profile": "https://Stackoverflow.com/users/3776", "pm_score": 5, "selected": false, "text": "_bar" }, { "answer_id": 106301, "author": "Dror Helper", "author_id": 11361, "author_profile": "https:...
2008/09/12
[ "https://Stackoverflow.com/questions/59422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/838/" ]
59,423
<p>I've got the following in my .css file creating a little image next to each link on my site:</p> <pre class="lang-css prettyprint-override"><code>div.post .text a[href^="http:"] { background: url(../../pics/remote.gif) right top no-repeat; padding-right: 10px; white-space: nowrap; } </code></pre> <p>How do I modify this snippet (or add something new) to exclude the link icon next to images that are links themselves?</p>
[ { "answer_id": 59448, "author": "Thunder3", "author_id": 2832, "author_profile": "https://Stackoverflow.com/users/2832", "pm_score": 1, "selected": false, "text": "<a>" }, { "answer_id": 59454, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stack...
2008/09/12
[ "https://Stackoverflow.com/questions/59423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1683/" ]