\");\n}\n\nThe key to this method is in that onload bit of Javascript, which , when the body of the page loads, submits the form and then redirects the user back to my own Home page. The reason for that bit of hoodoo is that I'm launching the external site in a new window, but don't want the user to resubmit the hidden form if they refresh the page. Plus that hidden form pushed the page down a few pixels which got on my nerves.\nI'd be very interested in any cleaner ideas anyone has on this one.\nEric Sipple\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/5179\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"38\"\n}"}}},{"rowIdx":517,"cells":{"text":{"kind":"string","value":"Q: How do you pull the URL for an ASP.NET web reference from a configuration file in Visual Studio 2008? I have a web reference for our report server embedded in our application. The server that the reports live on could change though, and I'd like to be able to change it \"on the fly\" if necessary.\nI know I've done this before, but can't seem to remember how. Thanks for your help.\nI've manually driven around this for the time being. It's not a big deal to set the URL in the code, but I'd like to figure out what the \"proper\" way of doing this in VS 2008 is. Could anyone provide any further insights? Thanks!\n\nIn VS2008 when I change the URL Behavior property to Dynamic I get the following code auto-generated in the Reference class.\nCan I override this setting (MySettings) in the web.config? I guess I don't know how the settings stuff works.\nPublic Sub New()\n MyBase.New\n Me.Url = Global.My.MySettings.Default.Namespace_Reference_ServiceName\n If (Me.IsLocalFileSystemWebService(Me.Url) = true) Then\n Me.UseDefaultCredentials = true\n Me.useDefaultCredentialsSetExplicitly = false\n Else\n Me.useDefaultCredentialsSetExplicitly = true\n End If\nEnd Sub\n\nEDIT\nSo this stuff has changed a bit since VS03 (which was probably the last VS version I used to do this).\nAccording to: http://msdn.microsoft.com/en-us/library/a65txexh.aspx it looks like I have a settings object on which I can set the property programatically, but that I would need to provide the logic to retrieve that URL from the web.config.\nIs this the new standard way of doing this in VS2008, or am I missing something?\nEDIT #2\nAnyone have any ideas here? I drove around it in my application and just put the URL in my web.config myself and read it out. But I'm not happy with that because it still feels like I'm missing something.\n\nA: In the properties window change the \"behavior\" to Dynamic.\nSee: http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx\n\nA: If you mean a VS2005 \"Web Reference\", then the generated proxy classes have a URL property that is the SOAP endpoint url of that service. You can change this property and have your subsequent http communications be made to that new endpoint.\nEdit: Ah, thanks bcaff86. I didn't know you could do that simply by changing a property.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/5188\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"8\"\n}"}}},{"rowIdx":518,"cells":{"text":{"kind":"string","value":"Q: When to use an extension method with lambda over LINQtoObjects to filter a collection? I am prototyping some C# 3 collection filters and came across this.\nI have a collection of products:\npublic class MyProduct\n{\n public string Name { get; set; }\n public Double Price { get; set; }\n public string Description { get; set; }\n}\n\nvar MyProducts = new List\n{ \n new MyProduct\n {\n Name = \"Surfboard\",\n Price = 144.99,\n Description = \"Most important thing you will ever own.\"\n },\n new MyProduct\n {\n Name = \"Leash\",\n Price = 29.28,\n Description = \"Keep important things close to you.\"\n }\n ,\n new MyProduct\n {\n Name = \"Sun Screen\",\n Price = 15.88,\n Description = \"1000 SPF! Who Could ask for more?\"\n }\n};\n\nNow if I use LINQ to filter it works as expected:\nvar d = (from mp in MyProducts\n where mp.Price < 50d\n select mp);\n\nAnd if I use the Where extension method combined with a Lambda the filter works as well:\nvar f = MyProducts.Where(mp => mp.Price < 50d).ToList();\n\nQuestion: What is the difference, and why use one over the other?\n\nA: LINQ turns into method calls like the code you have.\nIn other words, there should be no difference.\nHowever, in your two pieces of code you are not calling .ToList in the first, so the first piece of code will produce an enumerable data source, but if you call .ToList on it, the two should be the same.\n\nA: As mentioned d will be IEnumerable while f is List\nThe conversion is done by the C# compiler\nvar d = \n from mp in MyProducts\n where mp.Price < 50d\n select mp;\n\nIs converted to (before compilation to IL and with generics expanded):\nvar d = \n MyProducts.\n Where( mp => mp.Price < 50d ).\n Select( mp => mp ); \n //note that this last select is optimised out if it makes no change\n\nNote that in this simple case it makes little difference. Where Linq becomes really valuable is in much more complicated loops. \nFor instance this statement could include group-bys, orders and a few let statements and still be readable in Linq format when the equivalent .Method().Method.Method() would get complicated.\n\nA: Other than the ToList difference, #2 is a lot more readable and natural IMO\n\nA: The syntax you are using for d will get transformed by the compiler into the same IL as the extension methods. The \"SQL-like\" syntax is supposed to be a more natural way to represent a LINQ expression (although I personally prefer the extension methods). As has already been pointed out, the first example will return an IEnumerable result while the second example will return a List result due to the call to ToList(). If you remove the ToList() call in the second example, they will both return the same result as Where returns an IEnumerable result.\n"},"meta":{"kind":"string","value":"{\n \"language\": \"en\",\n \"url\": \"https://stackoverflow.com/questions/5194\",\n \"timestamp\": \"2023-03-29T00:00:00\",\n \"source\": \"stackexchange\",\n \"question_score\": \"16\"\n}"}}},{"rowIdx":519,"cells":{"text":{"kind":"string","value":"Q: Accessing post variables using Java Servlets What is the Java equivalent of PHP's $_POST? After searching the web for an hour, I'm still nowhere closer.\n\nA: Here's a simple example. I didn't get fancy with the html or the servlet, but you should get the idea.\nI hope this helps you out.\n\n