qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
268,592
<p>For my website I configured some custom error pages. If I generate a 404, the redirect works fine. When hitting a 400, the "bad request" text shows up instead of the configured URl.</p> <p>As a test I copied the URL from 404 to 400. No change. Then I changed the redirect to a file. No change.</p> <p>Any ideas?</p>
[ { "answer_id": 268688, "author": "DOK", "author_id": 27637, "author_profile": "https://Stackoverflow.com/users/27637", "pm_score": 0, "selected": false, "text": "customErrors" }, { "answer_id": 2506144, "author": "Nikita Ignatov", "author_id": 40185, "author_profile":...
2008/11/06
[ "https://Stackoverflow.com/questions/268592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
268,595
<p>I am trying to put version information to my C# GUI framework retrieved from the latest ClearCase label. This was originally done from Visual Soursafe as below. </p> <pre><code>vssDB = new VSSDatabaseClass(); vssDB.Open( databaseName, "vssadmin", "vssadmin" ); VSSItem item = vssDB.get_VSSItem( @"$\BuildDCP.bat", false ); foreach(VSSVersion vssVersion in item.get_Versions(0)) { // Pull the first non-blank label and use that if ( vssVersion.Label != "" ) { labelID = vssVersion.Label.ToString(); break; } } </code></pre> <p>I am trying to do something similar using ClearCase since we changed our source code control from VSS to CC. Any help would be greatly appreciated.</p> <p>Thanks!</p>
[ { "answer_id": 269624, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 2, "selected": true, "text": "Dim CC As New ClearCase.Application \nDim labelID As String\nSet aVersion = CC.Version(\"[Path-To]\\BuildDCP.bat\");\nSet someLa...
2008/11/06
[ "https://Stackoverflow.com/questions/268595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,604
<p>This code:</p> <pre><code>#include &lt;iostream&gt; int main( int, char **argv ) { std::cout &lt;&lt; 1.23e45 &lt;&lt; std::endl; } </code></pre> <p>prints </p> <blockquote> <p>1.23e+045</p> </blockquote> <p>when compiled with MS Visual Studio 2003, and</p> <blockquote> <p>1.23e+45</p> </blockquote> <p>on my Linux machine. </p> <p>How can I specify the width of the exponent field (and why is there a difference in the first place)?</p>
[ { "answer_id": 268693, "author": "Pieter", "author_id": 5822, "author_profile": "https://Stackoverflow.com/users/5822", "pm_score": 2, "selected": true, "text": "// on linux\nstd::cout << std::scientific << 1.23e4 << std::endl\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
268,627
<p>A quick question: When declaring the DLLImport Attribute in .Net, where does the runtime look to resolve that DLL dependency? Would I have to dump the DLL and all of <em>its</em> dependencies in the bin folder?</p>
[ { "answer_id": 268631, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 2, "selected": false, "text": "echo %PATH%" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13286/" ]
268,629
<p>I am running my <code>HTTPServer</code> in a separate thread (using the threading module which has no way to stop threads...) and want to stop serving requests when the main thread also shuts down.</p> <p>The Python documentation states that <code>BaseHTTPServer.HTTPServer</code> is a subclass of <code>SocketServer.TCPServer</code>, which supports a <code>shutdown</code> method, but it is missing in <code>HTTPServer</code>.</p> <p>The whole <code>BaseHTTPServer</code> module has very little documentation :(</p>
[ { "answer_id": 268660, "author": "Ali Afshar", "author_id": 28380, "author_profile": "https://Stackoverflow.com/users/28380", "pm_score": 6, "selected": true, "text": "def serve_forever(self):\n \"\"\"Handle one request at a time until doomsday.\"\"\"\n while 1:\n self.handl...
2008/11/06
[ "https://Stackoverflow.com/questions/268629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2260/" ]
268,648
<p>I'm scanning through a file looking for lines that match a certain regex pattern, and then I want to print out the lines that match but in alphabetical order. I'm sure this is trivial but vbscript isn't my background</p> <p>my array is defined as</p> <pre><code>Dim lines(10000) </code></pre> <p>if that makes any difference, and I'm trying to execute my script from a normal cmd prompt</p>
[ { "answer_id": 268659, "author": "Oskar", "author_id": 5472, "author_profile": "https://Stackoverflow.com/users/5472", "pm_score": 7, "selected": true, "text": "Set outputLines = CreateObject(\"System.Collections.ArrayList\")\n\n'add lines\noutputLines.Add output\noutputLines.Add output\...
2008/11/06
[ "https://Stackoverflow.com/questions/268648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5472/" ]
268,651
<p>How do you do your Hibernate session management in a Java Desktop Swing application? Do you use a single session? Multiple sessions?</p> <p>Here are a few references on the subject:</p> <ul> <li><a href="http://www.hibernate.org/333.html" rel="noreferrer">http://www.hibernate.org/333.html</a></li> <li><a href="http://blog.schauderhaft.de/2008/09/28/hibernate-sessions-in-two-tier-rich-client-applications/" rel="noreferrer">http://blog.schauderhaft.de/2008/09/28/hibernate-sessions-in-two-tier-rich-client-applications/</a> </li> <li><a href="http://in.relation.to/Bloggers/HibernateAndSwingDemoApp" rel="noreferrer">http://in.relation.to/Bloggers/HibernateAndSwingDemoApp</a></li> </ul>
[ { "answer_id": 268784, "author": "Vladimir Dyuzhev", "author_id": 1163802, "author_profile": "https://Stackoverflow.com/users/1163802", "pm_score": 4, "selected": true, "text": "MyHibernateUtils.begin();\nSettings settings = DaoSettings.load();\n// update setttings here\nDaoSettings.save...
2008/11/06
[ "https://Stackoverflow.com/questions/268651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407003/" ]
268,652
<p>I'm using java and referring to the "double" datatype. To keep it short, I'm reading some values from standard input that I read in my code as doubles (I would much rather use something like BigInteger but right now it's not possible).</p> <p>I expect to get double values from the user but sometimes they might input things like: 999999999999999999999999999.9999999999 which I think is beyond an accurate representation for double and get's rounded to 1.0E27 (probably).</p> <p>I would like to get some pointers on how to detect whether a specific value would be unable to be accurately represented in a double and would require rounding (so that I could refuse that value or other such actions).</p> <p>Thank you very much</p>
[ { "answer_id": 268662, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "BigDecimal userAsDecimal = new BigDecimal(userInput);\ndouble userAsDouble = double.parseDouble(userInput);\nBigDecimal d...
2008/11/06
[ "https://Stackoverflow.com/questions/268652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15225/" ]
268,656
<p>I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error:</p> <pre><code>root.play(); </code></pre> <p>"1061: Call to a possibly undefined method play through a reference with static type flash.display:DisplayObjectContainer."</p> <p>Using the Stage class also doesn't work:</p> <pre><code>stage.play(); </code></pre> <p>"1061: Call to a possibly undefined method play through a reference with static type flash.display:Stage."</p> <p>Is there any way to do this?</p>
[ { "answer_id": 268873, "author": "Andres", "author_id": 1815, "author_profile": "https://Stackoverflow.com/users/1815", "pm_score": 4, "selected": true, "text": "(root as MovieClip).play()\n" }, { "answer_id": 1944256, "author": "bagushutomo", "author_id": 236581, "au...
2008/11/06
[ "https://Stackoverflow.com/questions/268656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25280/" ]
268,671
<p>I have a HQL query that can generate either an IList of results, or an IEnumerable of results. </p> <p>However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.</p> <p>Is there any better way? I went with the CopyTo-approach.</p>
[ { "answer_id": 268699, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "ToArray()" }, { "answer_id": 5703033, "author": "Michael Joyce", "author_id": 623004, "author_profile...
2008/11/06
[ "https://Stackoverflow.com/questions/268671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33663/" ]
268,672
<p>I know about <a href="https://docs.oracle.com/javase/9/docs/api/java/util/SortedSet.html" rel="noreferrer"><code>SortedSet</code></a>, but in my case I need something that implements <code>List</code>, and not <code>Set</code>. So is there an implementation out there, in the API or elsewhere?</p> <p>It shouldn't be hard to implement myself, but I figured why not ask people here first?</p>
[ { "answer_id": 268691, "author": "Daniel Hiller", "author_id": 16193, "author_profile": "https://Stackoverflow.com/users/16193", "pm_score": 3, "selected": false, "text": "new ArrayList( new LinkedHashSet() )\n" }, { "answer_id": 268713, "author": "Calum", "author_id": 84...
2008/11/06
[ "https://Stackoverflow.com/questions/268672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2819/" ]
268,674
<p>I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable </p> <pre><code>public interface ISelectable : INotifyPropertyChanged { event EventHandler IsSelected; bool Selected { get; set; } string DisplayText { get; } } </code></pre> <p>I want to keep track of which object is selected regardless of how it is selected. The user could click on the representation of the object in the ListBox but it could also be that an object is selected via code. If the user selects an object via the ListBox I cast the the selected item to an ISelectable and set the Selected property to true.</p> <pre><code>ISelectable selectable = (ISelectable)e.AddedItems[0]; selectable.Selected = true; </code></pre> <p>My problem is that when I select the object using code I can't get ListBox to change the selected item. I'm using a DataTemplate to show the selected object in a different color which means everything is displayed correctly. But the ListBox has the last object the user clicked as the SelectedItem which means that item can't be clicked without first selecting another object in the list.</p> <p>Anyone got any idea on how to solve this? I pretty sure I can accomplish what I want by writing some custom code to handle the Mouse and Keyboard events but I rather not. I have tried adding a SelectedItem property to the collection and bind it to the ListBox's SelectItemProperty but no luck. </p>
[ { "answer_id": 269094, "author": "Sorskoot", "author_id": 31722, "author_profile": "https://Stackoverflow.com/users/31722", "pm_score": 0, "selected": false, "text": "private bool _Selected;\n public bool Selected\n {\n get\n {\n return ...
2008/11/06
[ "https://Stackoverflow.com/questions/268674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143/" ]
268,680
<p>I would like to monitor the number of threads used by a specific process on Linux. Is there an easy way to get this information without impacting the performance of the process?</p>
[ { "answer_id": 272716, "author": "slav0nic", "author_id": 2201031, "author_profile": "https://Stackoverflow.com/users/2201031", "pm_score": 8, "selected": false, "text": "ps huH p <PID_OF_U_PROCESS> | wc -l\n" }, { "answer_id": 7216452, "author": "flexo", "author_id": 906...
2008/11/06
[ "https://Stackoverflow.com/questions/268680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,698
<p>This is somewhat of a follow-up question to this <a href="https://stackoverflow.com/questions/267045/is-there-a-benefit-to-having-both-an-abstract-class-and-an-interface">question</a>.</p> <p>Suppose I have an inheritance tree as follows:</p> <pre><code>Car -&gt; Ford -&gt; Mustang -&gt; MustangGT </code></pre> <p>Is there a benefit to defining interfaces for <em>each</em> of these classes? Example:</p> <pre><code>ICar -&gt; IFord -&gt; IMustang -&gt; IMustangGT </code></pre> <p>I can see that maybe other classes (like <code>Chevy</code>) would want to implement <code>Icar</code> or <code>IFord</code> and maybe even <code>IMustang</code>, but probably not <code>IMustangGT</code> because it is so specific. Are the interfaces superfluous in this case?</p> <p>Also, I would think that any class that would want to implement <code>IFord</code> would definitely want to use its one inheritance by inheriting from <code>Ford</code> so as not to duplicate code. If that is a given, what is the benefit of also implementing <code>IFord</code>?</p>
[ { "answer_id": 268747, "author": "eddy147", "author_id": 30759, "author_profile": "https://Stackoverflow.com/users/30759", "pm_score": -1, "selected": false, "text": "class Ford{\n public function Foo(){\n ...\n Mustang mustang = new Mustang();\n return mustang.Foo();\n}\n" ...
2008/11/06
[ "https://Stackoverflow.com/questions/268698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
268,706
<p>I'm currently developing a Facebook application which will eventually end up on a Facebook Page. The problem is that I don't know how to remove the box header (handle?) with the application name and the close-button.</p> <p>I've seen other applications on Pages being able to remove the header. Look at Apples Page here: <a href="http://www.facebook.com/home.php#/pages/Apple-Students/11147074409" rel="nofollow noreferrer">http://www.facebook.com/home.php#/pages/Apple-Students/11147074409</a></p> <p>Is it because they use an IFrame? I've tried that as well but I still need to call setFBML and embed an IFrame inside it.</p>
[ { "answer_id": 268747, "author": "eddy147", "author_id": 30759, "author_profile": "https://Stackoverflow.com/users/30759", "pm_score": -1, "selected": false, "text": "class Ford{\n public function Foo(){\n ...\n Mustang mustang = new Mustang();\n return mustang.Foo();\n}\n" ...
2008/11/06
[ "https://Stackoverflow.com/questions/268706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29886/" ]
268,736
<p>An svn repository I'm mirroring through git-svn has changed URL.</p> <p>In vanilla svn you'd just do <code>svn switch --relocate old_url_base new_url_base</code>.</p> <p>How can I do this using git-svn? </p> <p>Simply changing the svn url in the config file fails.</p>
[ { "answer_id": 268739, "author": "Adam Alexander", "author_id": 33164, "author_profile": "https://Stackoverflow.com/users/33164", "pm_score": 2, "selected": false, "text": "git-svn-id" }, { "answer_id": 268767, "author": "kch", "author_id": 13989, "author_profile": "h...
2008/11/06
[ "https://Stackoverflow.com/questions/268736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13989/" ]
268,750
<p>I have a JFrame with a menu bar and a canvas covering all the remaining surface. When I click on the menu bar, the menu opens <strong>behind</strong> the Canvas and I can't see it. Has anyone experienced this? Other than resizing the Canvas (which I am reluctant to do) is there any solution?</p> <p>Thanks,<br/> Vlad</p>
[ { "answer_id": 268815, "author": "basszero", "author_id": 287, "author_profile": "https://Stackoverflow.com/users/287", "pm_score": 4, "selected": true, "text": "// Call this sometime before you use your menus \nJPopupMenu.setDefaultLightWeightPopupEnabled(false)\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1155998/" ]
268,771
<p>Ok, so I have this regex:</p> <pre><code>( |^|&gt;)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|&lt;) </code></pre> <p>It formats Dutch and Belgian phone numbers (I only want those hence the 31 and 32 as country code).</p> <p>Its not much fun to decipher but as you can see it also has a lot duplicated. but now it does handles it very accurately</p> <p>All the following European formatted phone numbers are accepted</p> <pre><code>0031201234567 0031223234567 0031612345678 +31(0)20-1234567 +31(0)223-234567 +31(0)6-12345678 020-1234567 0223-234567 06-12345678 0201234567 0223234567 0612345678 </code></pre> <p>and the following false formatted ones are not</p> <pre><code>06-1234567 (mobile phone number in the Netherlands should have 8 numbers after 06 ) 0223-1234567 (area code with home phone) </code></pre> <p>as opposed to this which is good.</p> <pre><code>020-1234567 (area code with 3 numbers has 7 numbers for the phone as opposed to a 4 number area code which can only have 6 numbers for phone number) </code></pre> <p>As you can see it's the '-' character that makes it a little difficult but I need it in there because it's a part of the formatting usually used by people, and I want to be able to parse them all.</p> <p>Now is my question... do you see a way to simplify this regex (or even improve it if you see a fault in it), while keeping the same rules?</p> <p>You can test it at <a href="http://regextester.com/" rel="nofollow noreferrer">regextester.com</a></p> <p>(The '( |^|>)' is to check if it is at the start of a word with the possibility it being preceded by either a new line or a '>'. I search for the phone numbers in HTML pages.) </p>
[ { "answer_id": 268810, "author": "Pistos", "author_id": 28558, "author_profile": "https://Stackoverflow.com/users/28558", "pm_score": 3, "selected": false, "text": "if number =~ /...../ # Dutch mobiles\n # ...\nelsif number =~ /..../ # Belgian landlines\n # ...\n# etc.\nend\n" }, ...
2008/11/06
[ "https://Stackoverflow.com/questions/268771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16805/" ]
268,778
<p>I have a class called EventConsumer which defines an event EventConsumed and a method OnEventConsumed as follows:</p> <pre><code>public event EventHandler EventConsumed; public virtual void OnEventConsumed(object sender, EventArgs e) { if (EventConsumed != null) EventConsumed(this, e); } </code></pre> <p>I need to add attributes to the at OnEventConsumed runtime, so I'm generating a subclass using System.Reflection.Emit. What I want is the MSIL equivalent of this:</p> <pre><code>public override void OnEventConsumed(object sender, EventArgs e) { base.OnEventConsumed(sender, e); } </code></pre> <p>What I have so far is this:</p> <pre><code>... MethodInfo baseMethod = typeof(EventConsumer).GetMethod("OnEventConsumed"); MethodBuilder methodBuilder = typeBuilder.DefineMethod("OnEventConsumed", baseMethod.Attributes, baseMethod.CallingConvention, typeof(void), new Type[] {typeof(object), typeof(EventArgs)}); ILGenerator ilGenerator = methodBuilder.GetILGenerator(); // load the first two args onto the stack ilGenerator.Emit(OpCodes.Ldarg_1); ilGenerator.Emit(OpCodes.Ldarg_2); // call the base method ilGenerator.EmitCall(OpCodes.Callvirt, baseMethod, new Type[0] ); // return ilGenerator.Emit(OpCodes.Ret); ... </code></pre> <p>I create the type, create an instance of the type, and call its OnEventConsumed function, and I get:</p> <pre><code>Common Language Runtime detected an invalid program. </code></pre> <p>...which is not exactly helpful. What am I doing wrong? What's the correct MSIL to call the base class's event handler?</p>
[ { "answer_id": 268803, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 0, "selected": false, "text": "public virtual void OnEventConsumed(object sender, EventArgs e)\n{\n if (EventConsumed != null)\n EventConsumed(thi...
2008/11/06
[ "https://Stackoverflow.com/questions/268778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15371/" ]
268,782
<p>How do I implement the WS addressing using WCF?</p>
[ { "answer_id": 3519385, "author": "Shameer Kunjumohamed", "author_id": 423735, "author_profile": "https://Stackoverflow.com/users/423735", "pm_score": 0, "selected": false, "text": "<textMessageEncoding messageVersion=\"Soap11WSAddressing10\"/>\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,802
<p>In my Silverlight app I want a multi-line text box to expand every time the user hits Enter.</p> <p>The difficult part is how to calculate the correct height based on the number of text lines.</p> <p>I have tried the following but the textbox becomes too small:</p> <pre><code>box.Height = box.FontSize*lineCount + box.Padding.Top + box.Padding.Bottom + box.BorderThickness.Top + box.BorderThickness.Bottom; </code></pre> <p>What am I missing here? Or maybe it can be done automatically somehow?</p> <p>Thanks, Jacob</p> <p><strong>Edit:</strong> I suspect the problem to be in the FontSize property (does it use another size unit?)</p>
[ { "answer_id": 2683688, "author": "Mike Blandford", "author_id": 28643, "author_profile": "https://Stackoverflow.com/users/28643", "pm_score": 0, "selected": false, "text": "TextBox" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30056/" ]
268,808
<p>I have a need to determine what security group(s) a user is a member of from within a SQL Server Reporting Services report. Access to the report will be driven by membership to one of two groups: 'report_name_summary' and 'report_name_detail'. Once the user is executing the report, we want to be able to use their membership (or lack of membership) in the 'report_name_detail' group to determine whether or not a "drill down" should be allowed.</p> <p>I don't know of any way out of the box to access the current user's AD security group membership, but am open to any suggestions for being able to access this info from within the report.</p>
[ { "answer_id": 285601, "author": "PJ8", "author_id": 35490, "author_profile": "https://Stackoverflow.com/users/35490", "pm_score": 4, "selected": true, "text": "Public Function ShouldReportBeHidden() As Boolean\nDim Principal As New System.Security.Principal.WindowsPrincipal(System.Secur...
2008/11/06
[ "https://Stackoverflow.com/questions/268808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1680/" ]
268,814
<p>Consider this:</p> <pre><code>public class TestClass { private String a; private String b; public TestClass() { a = "initialized"; } public void doSomething() { String c; a.notify(); // This is fine b.notify(); // This is fine - but will end in an exception c.notify(); // "Local variable c may not have been initialised" } } </code></pre> <p>I don't get it. "b" is never initialized but will give the same run-time error as "c", which is a compile-time error. Why the difference between local variables and members?</p> <p><strong>Edit</strong>: making the members private was my initial intention, and the question still stands...</p>
[ { "answer_id": 268909, "author": "Yuval", "author_id": 2819, "author_profile": "https://Stackoverflow.com/users/2819", "pm_score": 5, "selected": false, "text": "TestClass tc = new TestClass();\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24545/" ]
268,816
<p>What are some strategies to achieve code separation in AJAX applications?</p> <p>I am building a PHP application that I would like to have a nice AJAX front end on. I have long since learned to use some kind of templating in my PHP code to make sure I maintain good separation between my logic and display code, but I'm having trouble finding good ways to do this with the JavaScript code on the front end. I'm using jQuery to make the fetching of XML data and DOM manipulation easy, but I'm finding that the logic and layout code is starting to intermix.</p> <p>The real problem is that I get XML data from the back end that then has to be reformatted and helpful text has to be wrapped around it (directions and the like). I've thought about sending over already formatted HTML, but that would require extensive reworking of the backend, and there must be a better way than what I have come up with on my own.</p>
[ { "answer_id": 268847, "author": "James Hughes", "author_id": 34671, "author_profile": "https://Stackoverflow.com/users/34671", "pm_score": 2, "selected": false, "text": "var XMLFormatter = function(){\n /* PRIVATE AREA */\n\n /* PUBLIC API */\n return {\n formatXML : fun...
2008/11/06
[ "https://Stackoverflow.com/questions/268816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24215/" ]
268,820
<p>I have a servlet that I would like to run within ColdFusion MX 7. I would like to make use of an existing ColdFusion DSN as a javax.sql.DataSource, if possible.</p> <p>I thought something like </p> <pre><code>coldfusion.server.ServiceFactory.getDataSourceService().getDatasource(dsname); </code></pre> <p>would work, but unfortunately the servlet returns</p> <pre><code>java.lang.NoClassDefFoundError: coldfusion/server/ServiceFactory </code></pre>
[ { "answer_id": 272072, "author": "AlexJReid", "author_id": 32320, "author_profile": "https://Stackoverflow.com/users/32320", "pm_score": 1, "selected": true, "text": "Context context = new InitialContext();\nDataSource ds = (DataSource)context.lookup(\"mydatasource\"); \n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32320/" ]
268,824
<p>We're working now on the design of a new API for our product, which will be exposed via web services. We have a dispute whether we should use strict parameters with well defined types (my opinion) or strings that will contain XML in whatever structure needed. It is quite obvious that ideally using a strict signature is safer, and it will allow our users to use tools like wsdl2java. OTOH, our product is developing rapidly, and if the parameters of a service will have to be changed, using XML (passed as a string or anyType - not complex type, which is well defined type) will not require the change of the interface.</p> <p>So, what I'm asking for is basically rule of thumb recommendations - would you prefer using strict types or flexible XML? Have you had any significant problems using either way?</p> <p>Thanks, Eran</p>
[ { "answer_id": 272072, "author": "AlexJReid", "author_id": 32320, "author_profile": "https://Stackoverflow.com/users/32320", "pm_score": 1, "selected": true, "text": "Context context = new InitialContext();\nDataSource ds = (DataSource)context.lookup(\"mydatasource\"); \n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26039/" ]
268,835
<p>I am new to Hibernate and attempting to run a java/spring example that retrieves data from a table in MS SqlServer. Everytime I try to run the program, the data source loads ok. But when spring tries to load the session facotry it gets the following error:</p> <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [ml/spring/src/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager </code></pre> <p>Below is the application Context file I am using:</p> <pre><code>&lt;!-- Data source bean --&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" &gt; &lt;property name="driverClassName"&gt; &lt;value&gt;com.microsoft.jdbc.sqlserver.SQLServerDriver&lt;/value&gt;&lt;/property&gt; &lt;property name="url"&gt; &lt;value&gt;jdbc:microsoft:sqlserver://machine:port&lt;/value&gt;&lt;/property&gt; &lt;property name="username"&gt;&lt;value&gt;user&lt;/value&gt;&lt;/property&gt; &lt;property name="password"&gt;&lt;value&gt;password&lt;/value&gt;&lt;/property&gt; &lt;/bean&gt; &lt;!-- Session Factory Bean --&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; &lt;property name="dataSource"&gt;&lt;ref local="dataSource"/&gt;&lt;/property&gt; &lt;property name="mappingResources"&gt; &lt;list&gt; &lt;value&gt;authors.hbm.xml&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;value&gt; hibernate.dialect=net.sf.hibernate.dialect.SQLServerDialect &lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; </code></pre>
[ { "answer_id": 268883, "author": "toolkit", "author_id": 3295, "author_profile": "https://Stackoverflow.com/users/3295", "pm_score": 4, "selected": false, "text": "jta-1.1.jar\n" }, { "answer_id": 43872451, "author": "Georgios Syngouroglou", "author_id": 1123501, "aut...
2008/11/06
[ "https://Stackoverflow.com/questions/268835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,836
<p>Can someone explain why there is the need to add an out or in parameter to indicate that a generic type is Co or Contra variant in C# 4.0?</p> <p>I've been trying to understand why this is important and why the compiler can't just figure it out..</p> <p>Thanks,</p> <p>Josh</p>
[ { "answer_id": 268871, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 1, "selected": false, "text": "in" }, { "answer_id": 268900, "author": "James Curran", "author_id": 12725, "author_profile": "https...
2008/11/06
[ "https://Stackoverflow.com/questions/268836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26160/" ]
268,853
<p>This is just to satisfy my own curiosity.</p> <p>Is there an implementation of this:</p> <pre><code>float InvSqrt (float x) { float xhalf = 0.5f*x; int i = *(int*)&amp;x; i = 0x5f3759df - (i&gt;&gt;1); x = *(float*)&amp;i; x = x*(1.5f - xhalf*x*x); return x; } </code></pre> <p>in C#? If it exists, post the code. </p> <p>I guess I should have mentioned I was looking for a "safe" implementation... Either way, the BitConverter code solves the problem. The union idea is interesting. I'll test it and post my results.</p> <p>Edit: As expected, the unsafe method is the quickest, followed by using a union (inside the function), followed by the BitConverter. The functions were executed 10000000 times, and the I used the System.Diagnostics.Stopwatch class for timing. The results of the calculations are show in brackets.</p> <pre><code>Input: 79.67 BitConverter Method: 00:00:01.2809018 (0.1120187) Union Method: 00:00:00.6838758 (0.1120187) Unsafe Method: 00:00:00.3376401 (0.1120187) </code></pre> <p>For completeness, I tested the built-in Math.Pow method, and the "naive" method (1/Sqrt(x)).</p> <pre><code>Math.Pow(x, -0.5): 00:00:01.7133228 (0.112034710535584) 1 / Math.Sqrt(x): 00:00:00.3757084 (0.1120347) </code></pre> <p>The difference between 1 / Math.Sqrt() is so small that I don't think one needs to resort to the Unsafe Fast InvSqrt() method in C# (or any other unsafe method). Unless one <em>really</em> needs to squeeze out that last bit of juice from the CPU... 1/Math.Sqrt() is also much more accurate.</p>
[ { "answer_id": 268901, "author": "Bradley Grainger", "author_id": 23633, "author_profile": "https://Stackoverflow.com/users/23633", "pm_score": 4, "selected": false, "text": "float InvSqrt(float x)\n{\n float xhalf = 0.5f * x;\n int i = BitConverter.SingleToInt32Bits(x);\n i = 0...
2008/11/06
[ "https://Stackoverflow.com/questions/268853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825/" ]
268,865
<p>Someone left the organisation but before leaving, he locked all the files for an unknown reason. </p> <p>How do you unlock them all so that the other developers can work?</p>
[ { "answer_id": 12187348, "author": "AaronLS", "author_id": 84206, "author_profile": "https://Stackoverflow.com/users/84206", "pm_score": 3, "selected": false, "text": "tf workspace /delete /server:http://machinename:8080/tfs/DefaultCollection someMachine123;someUser:1\n" }, { "an...
2008/11/06
[ "https://Stackoverflow.com/questions/268865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24975/" ]
268,884
<p>I am trying to convert an access datetime field to a mysdl format, using the following string:</p> <pre><code>select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T'); </code></pre> <p>While I do not get an error, I do not get the expected result, instead I get this:</p> <pre><code>+---------------------------------------------------+ | str_to_date('04/03/1974 12:21:22', '%Y %m %d %T') | +---------------------------------------------------+ | NULL | +---------------------------------------------------+ 1 row in set, 1 warning (0.01 sec) </code></pre> <p>The access dates are in this format:</p> <pre><code>06.10.2008 14:19:08 </code></pre> <p>I am not sure what I am missing.</p> <p>As a side question, I am wondering if it is possible when importing a csv file to change the data in a column before? I want to replace the insert_date and update_date fields with my own dates, and I am not sure if it would be easier to do this before importing or after.</p> <p>Many thanks for assistance.</p>
[ { "answer_id": 268942, "author": "andyhky", "author_id": 2764, "author_profile": "https://Stackoverflow.com/users/2764", "pm_score": 3, "selected": true, "text": "select str_to_date('04/03/1974 12:21:22', '%m/%d/%Y %T');\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
268,885
<p>What's the best way to write a LINQ query that inserts a record and then returns the primary key of that newly inserted record using C# ?</p>
[ { "answer_id": 268888, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 6, "selected": true, "text": "MyTable record = new MyTable();\nrecord.Name = \"James Curran\";\ndb.MyTable.InsertOnSubmit(record);\ndb.SubmitChanges...
2008/11/06
[ "https://Stackoverflow.com/questions/268885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26809/" ]
268,891
<p>I've got this python dictionary "mydict", containing arrays, here's what it looks like :</p> <pre><code>mydict = dict( one=['foo', 'bar', 'foobar', 'barfoo', 'example'], two=['bar', 'example', 'foobar'], three=['foo', 'example']) </code></pre> <p>i'd like to replace all the occurrences of "example" by "someotherword". </p> <p>While I can already think of a few ways to do it, is there a most "pythonic" method to achieve this ?</p>
[ { "answer_id": 269043, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 3, "selected": true, "text": "for arr in mydict.values():\n for i, s in enumerate(arr):\n if s == 'example':\n arr[i] = 'someotherword'\n"...
2008/11/06
[ "https://Stackoverflow.com/questions/268891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35100/" ]
268,898
<h3>Duplicate:</h3> <blockquote> <p><a href="https://stackoverflow.com/questions/263945/what-happens-if-you-call-erase-on-a-map-element-while-iterating-from-begin-to-e">What happens if you call erase on a map element while iterating from begin to end</a></p> <p><a href="https://stackoverflow.com/questions/180516/how-to-filter-items-from-a-stdmap">How to filter items from a stdmap</a><br></p> </blockquote> <p>I have a map <code>map1&lt;string,vector&lt;string&gt;&gt;</code> i have a iterator for this map &quot;itr&quot;. i want to delete the entry from this map which is pointed by &quot;itr&quot;. i can use the function map1.erase(itr); after this line the iterator &quot;itr&quot; becomes invalid. as per my requirement in my project,the iterator must point to the next element. can any body help me regerding this thans in advance:) santhosh</p>
[ { "answer_id": 268964, "author": "Igor Semenov", "author_id": 11401, "author_profile": "https://Stackoverflow.com/users/11401", "pm_score": 2, "selected": false, "text": "map<...>::iterator tmp(iter++);\nmap1.erase(tmp);\n" }, { "answer_id": 268979, "author": "Leon Timmermans...
2008/11/06
[ "https://Stackoverflow.com/questions/268898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,899
<p>Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa?</p> <p>I'm especially interested in proper handling of character encoding (Windows XP an later).</p> <p>The following method seems to be okay for creating a multistring, but I don't have an example of decoding a multistring.</p> <pre><code>static string StringArrayToMultiString( ICollection&lt;string&gt; stringArray ) { StringBuilder multiString = new StringBuilder(); if (stringArray != null) { foreach (string s in stringArray) { multiString.Append(s); multiString.Append('\0'); } } return multiString.ToString(); } </code></pre>
[ { "answer_id": 268944, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "static string[] MultiStringToArray(string multiString)\n{\n return multiString.TrimEnd('\\0').Split('\\0');\n}\n" ...
2008/11/06
[ "https://Stackoverflow.com/questions/268899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35090/" ]
268,902
<p>I have a few links that should all open in the same window or tab. To accomplish this I've given the window a name like in this example code:</p> <pre><code>&lt;a href="#" onClick='window.open("http://somesite.com", "mywindow", "");'&gt;link 1&lt;/a&gt; &lt;a href="#" onClick='window.open("http://someothersite.com", "mywindow", "");'&gt;link 2&lt;/a&gt; </code></pre> <p>This works OK in internet explorer, but firefox always opens a new tab/window. Any ideas? </p>
[ { "answer_id": 269039, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 3, "selected": false, "text": "<a href=\"#\" onClick='window.open(\"http://somesite.com\", \"mywindow\", \"width=700\", \"height=500\"...
2008/11/06
[ "https://Stackoverflow.com/questions/268902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24046/" ]
268,920
<p>We have a decent sized object-oriented application. Whenever an object in the app is changed, the object changes are saved back to the DB. However, this has become less than ideal.</p> <p>Currently, transactions are stored as a transaction and a set of transactionLI's.</p> <p>The transaction table has fields for who, what, when, why, foreignKey, and foreignTable. The first four are self-explanatory. ForeignKey and foreignTable are used to determine which object changed.</p> <p>TransactionLI has timestamp, key, val, oldVal, and a transactionID. This is basically a key/value/oldValue storage system.</p> <p>The problem is that these two tables are used for every object in the application, so they're pretty big tables now. Using them for anything is slow. Indexes only help so much.</p> <p>So we're thinking about other ways to do something like this. Things we've considered so far: - Sharding these tables by something like the timestamp. - Denormalizing the two tables and merge them into one. - A combination of the two above. - Doing something along the lines of serializing each object after a change and storing it in subversion. - Probably something else, but I can't think of it right now.</p> <p>The whole problem is that we'd like to have some mechanism for properly storing and searching through transactional data. Yeah you can force feed that into a relational database, but really, it's transactional data and should be stored accordingly.</p> <p>What is everyone else doing?</p>
[ { "answer_id": 269008, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 0, "selected": false, "text": "<objectDiff>\n<field name=\"firstName\" newValue=\"Josh\" oldValue=\"joshua\"/>\n<field name=\"lastName\" newValue=\"Box...
2008/11/06
[ "https://Stackoverflow.com/questions/268920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35101/" ]
268,923
<p>I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow the user to select a particular value. When I click the next button, I want the controller to retrieve those values. </p> <p>How can I do that I a clean way? </p>
[ { "answer_id": 1152483, "author": "Berryl", "author_id": 95245, "author_profile": "https://Stackoverflow.com/users/95245", "pm_score": 3, "selected": true, "text": "public interface ITextWidget\n{\n event EventHandler TextChanged;\n string Text { get; set; }\n}\n\npublic abstract c...
2008/11/06
[ "https://Stackoverflow.com/questions/268923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/201997/" ]
268,929
<p>I have two Java classes: B, which extends another class A, as follows :</p> <pre><code>class A { public void myMethod() { /* ... */ } } class B extends A { public void myMethod() { /* Another code */ } } </code></pre> <p>I would like to call the <code>A.myMethod()</code> from <code>B.myMethod()</code>. I am coming from the <a href="https://stackoverflow.com/questions/357307/how-to-call-a-parent-class-function-from-derived-class-function">C++ world</a>, and I don't know how to do this basic thing in Java.</p>
[ { "answer_id": 268939, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 8, "selected": true, "text": "super" }, { "answer_id": 268940, "author": "Robin", "author_id": 21925, "author_profile": "https://Stack...
2008/11/06
[ "https://Stackoverflow.com/questions/268929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26465/" ]
268,968
<p>Less than 10 client computers, each with their own installation have to upload data to a central server.</p> <p>The client database looks like:</p> <p>tblSales - rowGuid - randomNumber</p> <p>Central Server database:</p> <ul> <li>rowGuid</li> <li>randomNumber</li> <li>dateInserted</li> </ul> <p>I plan to use WCF to send the files to the central server.</p> <p><b>How can I verify the rows were inserted to the server? What kind of verification options do I have?</b></p> <p>I could return the # of rows inserted and compare that with the # that was sent, but is there any other more robust method?</p>
[ { "answer_id": 269011, "author": "GeekyMonkey", "author_id": 29900, "author_profile": "https://Stackoverflow.com/users/29900", "pm_score": 0, "selected": false, "text": "bool Success;\nSuccess = MyWCFService.InsertRecord(MyNewRecord);\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/268968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
268,982
<p>Please help!</p> <p><em>Background info</em></p> <p>I have a WPF application which accesses a SQL Server 2005 database. The database is running locally on the machine the application is running on.</p> <p>Everywhere I use the Linq DataContext I use a using { } statement, and pass in a result of a function which returns a SqlConnection object which has been opened and had an SqlCommand executed using it before returning to the DataContext constructor.. I.e.</p> <pre><code>// In the application code using (DataContext db = new DataContext(GetConnection())) { ... Code } </code></pre> <p>where getConnection looks like this (I've stripped out the 'fluff' from the function to make it more readable, but there is no additional functionality that is missing).</p> <pre><code>// Function which gets an opened connection which is given back to the DataContext constructor public static System.Data.SqlClient.SqlConnection GetConnection() { System.Data.SqlClient.SqlConnection Conn = new System.Data.SqlClient.SqlConnection(/* The connection string */); if ( Conn != null ) { try { Conn.Open(); } catch (System.Data.SqlClient.SqlException SDSCSEx) { /* Error Handling */ } using (System.Data.SqlClient.SqlCommand SetCmd = new System.Data.SqlClient.SqlCommand()) { SetCmd.Connection = Conn; SetCmd.CommandType = System.Data.CommandType.Text; string CurrentUserID = System.String.Empty; SetCmd.CommandText = "DECLARE @B VARBINARY(36); SET @B = CAST('" + CurrentUserID + "' AS VARBINARY(36)); SET CONTEXT_INFO @B"; try { SetCmd.ExecuteNonQuery(); } catch (System.Exception) { /* Error Handling */ } } return Conn; } </code></pre> <p><strong>I do not think that the application being a WPF one has any bearing on the issue I am having.</strong></p> <p><em>The issue I am having</em> </p> <p>Despite the SqlConnection being disposed along with the DataContext in Sql Server Management studio I can still see loads of open connections with :</p> <pre><code>status : 'Sleeping' command : 'AWAITING COMMAND' last SQL Transact Command Batch : DECLARE @B VARBINARY(36); SET @B = CAST('GUID' AS VARBINARY(36)); SET CONTEXT_INFO @B </code></pre> <p>Eventually the connection pool gets used up and the application can't continue. </p> <p>So I can only conclude that somehow running the SQLCommand to set the Context_Info is meaning that the connection doesn't get disposed of when the DataContext gets disposed. </p> <p>Can anyone spot anything obvious that would be stopping the connections from being closed and disposed of when the DataContext they are used by are disposed?</p>
[ { "answer_id": 268993, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "DataContext Constructor (IDbConnection)" }, { "answer_id": 268995, "author": "Robert S.", "author_id":...
2008/11/06
[ "https://Stackoverflow.com/questions/268982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31128/" ]
269,005
<p>I'm trying to do a subselect in pgsql aka postgresql and the example I found doesn't work:</p> <pre><code>SELECT id FROM (SELECT * FROM table); </code></pre>
[ { "answer_id": 269033, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 1, "selected": false, "text": "SELECT * FROM table WHERE id IN (SELECT id FROM table2);\n" }, { "answer_id": 269037, "author": "TravisO", "...
2008/11/06
[ "https://Stackoverflow.com/questions/269005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35116/" ]
269,009
<p>I've been researching modules for Nginx (my preferred webserver) to serve a Lisp webapp, but I haven't been able to find anything.</p> <p>Is there modules for Nginx, or is there better ways to serve Lisp webapps? If so, what are they?</p>
[ { "answer_id": 21647266, "author": "sçuçu", "author_id": 2605049, "author_profile": "https://Stackoverflow.com/users/2605049", "pm_score": 0, "selected": false, "text": "upstream hunchentoot { server 127.0.0.1:5050; }\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1555170/" ]
269,010
<p>I have created a proc that grabs all the user tables in a local DB on my machine. I want to be able to create a flat file of all my tables using BCP and SQL. Its a dummy database in SQL 2000 connecting through windows authentication. I have set my enviroment path variable in WinXP SP2. I have created new users to access the db, switched off my firewall, using trusted connection. I have tried dozens of forums, no luck. </p> <p>In dos command prompt I get the same error. </p> <p>SQLState = 37000, NativeError = 4060 Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database requested in login '[HelpDesk-EasyPay'. Login fails.</p> <p>Here is my SP: </p> <pre><code>@Path VARCHAR(100), @UserName VARCHAR(15), @PassWord VARCHAR(15), @ServerName VARCHAR(15) AS set quoted_identifier off set nocount on declare @n int declare @db varchar(40) set @db=DB_NAME() declare @TableName varchar(15) declare @bcp varchar(200) select identity(int,1,1) as tblNo,name tblname into #T from Sysobjects where xtype='u' select @n=COUNT(*) from #T WHILE (@n&gt;0) BEGIN SELECT @TableName=tblname FROM #T WHERE tblno=@n PRINT 'Now BCP out for table: ' + @TableName SET @bcp = "master..xp_cmdshell 'BCP " + "[" + @db + ".." + @TableName + "]" + " OUT" + @Path + "" + @TableName+".txt -c -U" + @UserName + " -P" + @PassWord + " -S" + @ServerName + " -T" + "'" EXEC(@bcp) SET @n=@n-1 END DROP TABLE #T </code></pre> <p>Can anyone advise. This seems to be a connection problem or BCP ? Not sure. </p> <p>edit: I am running this from query analyzer because I have 118 tables to output to flat file. I seem to agree that its an authentication issue because I tried connecting to master db with username sa password root. which is what its set to and I get the same error: SQLState = 37000, NativeError = 4060</p>
[ { "answer_id": 272094, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 1, "selected": false, "text": "bcp [HelpDesk-EasyPay].dbo.[customer] out d:\\MSSQL\\Data\\customer.bcp -N -Utest -Ptest -T\n" }, { "answer_id":...
2008/11/06
[ "https://Stackoverflow.com/questions/269010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35109/" ]
269,017
<p>So here is the simple code:</p> <pre><code> [System.ComponentModel.DefaultValue(true)] public bool AnyValue { get; set; } </code></pre> <p>I am sure I don't set AnyValue to false again (I just created it). This property is a property of a Page class of ASP.NET. And I am cheking the value in a button event handling function. But somehow it is still false. I wonder when actually it is set true? On compile time? When class is instantiated?</p> <p>What do you think about what I am doing wrong?</p>
[ { "answer_id": 269089, "author": "yusuf", "author_id": 35012, "author_profile": "https://Stackoverflow.com/users/35012", "pm_score": 0, "selected": false, "text": " private bool myVal = true;\n public bool MyVal\n {\n get { return myVal; } \n set { myVal = value; }...
2008/11/06
[ "https://Stackoverflow.com/questions/269017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35012/" ]
269,026
<p>How can I document a member inline in .Net? Let me explain. Most tools that extract documentation from comments support some kind of inline documentation where you can add a brief after the member declaration. Something like:</p> <pre><code>public static string MyField; /// &lt;summary&gt;Information about MyField.&lt;/summary&gt; </code></pre> <p>Is there a way to do this in C# or the .NET languages?</p>
[ { "answer_id": 269038, "author": "GeekyMonkey", "author_id": 29900, "author_profile": "https://Stackoverflow.com/users/29900", "pm_score": 1, "selected": false, "text": "/// <summary>Information about MyField.</summary>\npublic static string MyField; \n" }, { "answer_id": 269055,...
2008/11/06
[ "https://Stackoverflow.com/questions/269026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10688/" ]
269,042
<p>I´ve been looking for it yet in stackoverflow without success...</p> <p>Is it posible a connection pooling in asp.net? Is it worthwhile? How?</p>
[ { "answer_id": 269056, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 3, "selected": true, "text": "Min Pool Size=5; Max Pool Size=60; Connect Timeout=300;\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34432/" ]
269,044
<p><strong>Background:</strong> I have an HTML page which lets you expand certain content. As only small portions of the page need to be loaded for such an expansion, it's done via JavaScript, and not by directing to a new URL/ HTML page. However, as a bonus the user is able to permalink to such expanded sections, i.e. send someone else a URL like</p> <p><em><a href="http://example.com/#foobar" rel="noreferrer">http://example.com/#foobar</a></em></p> <p>and have the "foobar" category be opened immediately for that other user. This works using parent.location.hash = 'foobar', so that part is fine.</p> <p><strong>Now the question:</strong> When the user closes such a category on the page, I want to empty the URL fragment again, i.e. turn <a href="http://example.com/#foobar" rel="noreferrer">http://example.com/#foobar</a> into <a href="http://example.com/" rel="noreferrer">http://example.com/</a> to update the permalink display. However, doing so using <code>parent.location.hash = ''</code> causes a reload of the whole page (in Firefox 3, for instance), which I'd like to avoid. Using <code>window.location.href = '/#'</code> won't trigger a page reload, but leaves the somewhat unpretty-looking "#" sign in the URL. So is there a way in popular browsers to JavaScript-remove a URL anchor including the "#" sign without triggering a page refresh?</p>
[ { "answer_id": 269118, "author": "Florin", "author_id": 34565, "author_profile": "https://Stackoverflow.com/users/34565", "pm_score": -1, "selected": false, "text": "$(document).ready(function() {\n $(\".lnk\").click(function(e) {\n e.preventDefault();\n $(th...
2008/11/06
[ "https://Stackoverflow.com/questions/269044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34170/" ]
269,046
<p>I have an MSI file that I have created using a Visual Studio Setup Project. The installed generates an .InstallState file in the application directory. Is there a way to have this file generated in a different location rather than the default location?</p>
[ { "answer_id": 1943145, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "private string GetInstallStatePath(string assemblyPath)\n{\n string str2 = base.Context.Parameters[\"InstallStateDir\"];\n...
2008/11/06
[ "https://Stackoverflow.com/questions/269046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/324/" ]
269,050
<p>I'm writing code on the master page, and I need to know which child (content) page is being displayed. How can I do this programmatically? </p>
[ { "answer_id": 269091, "author": "spilliton", "author_id": 21367, "author_profile": "https://Stackoverflow.com/users/21367", "pm_score": 0, "selected": false, "text": "this.Request.Url.AbsolutePath\n" }, { "answer_id": 269167, "author": "Kon", "author_id": 22303, "aut...
2008/11/06
[ "https://Stackoverflow.com/questions/269050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1316/" ]
269,053
<p>I have a program that runs osql.exe from microsoft sql server tools directory and runs a script. </p> <p>The problem is that on computers that don't have an installation of sql server, this tool is missing. So my question is whether or not is possible to run it as a standalone( along with any dll that may be required ) meaning that run them from Process.Start from a local directory of the application.</p>
[ { "answer_id": 269064, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 0, "selected": false, "text": "Server.ConnectionContext.ExecuteNonQuery" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17443/" ]
269,058
<p>Lets say I have an array like this:</p> <pre><code>string [] Filelist = ... </code></pre> <p>I want to create an Linq result where each entry has it's position in the array like this:</p> <pre><code>var list = from f in Filelist select new { Index = (something), Filename = f}; </code></pre> <p>Index to be 0 for the 1st item, 1 for the 2nd, etc.</p> <p>What should I use for the expression Index= ?</p>
[ { "answer_id": 269070, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "Select" }, { "answer_id": 269109, "author": "GeekyMonkey", "author_id": 29900, "author_profile": "htt...
2008/11/06
[ "https://Stackoverflow.com/questions/269058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28260/" ]
269,060
<p>I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get out a unicode string approximating the original one without throwing a <code>UnicodeDecodeError</code>.</p> <p>So, I'm looking for a function that takes a <code>str</code> and optionally some hints and does its darndest to give me back a <code>unicode</code>. I could write one of course, but if such a function exists its author has probably thought a bit deeper about the best way to go about this.</p> <p>I also know that Python's design prefers explicit to implicit and that the standard library is designed to avoid implicit magic in decoding text. I just want to explicitly say "go ahead and guess".</p>
[ { "answer_id": 269276, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 5, "selected": false, "text": "@insin" }, { "answer_id": 273631, "author": "Nick", "author_id": 5222, "author_profile": "https://Stackoverf...
2008/11/06
[ "https://Stackoverflow.com/questions/269060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
269,062
<p>I want to use LabVIEW's Call Library Function Node to access a DLL function, and have this function return a string to displayed on my VI. How would I go about doing this? I am quite happy returning numbers from my DLL, but am really struggling to find any examples of how to return a string.</p>
[ { "answer_id": 269608, "author": "Azim J", "author_id": 4612, "author_profile": "https://Stackoverflow.com/users/4612", "pm_score": 3, "selected": true, "text": "void returnString(char myString[])\n{\n const char *aString = \"test string\";\n memcpy(myString, aString, 12);\n}\n" }, ...
2008/11/06
[ "https://Stackoverflow.com/questions/269062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1555/" ]
269,063
<p>After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects.</p> <p>Sample code for test (actual code doesn't matter, just used to create the warnings):</p> <pre><code>using System; using System.DirectoryServices; using ActiveDs; namespace Test { public class Class1 { public static void Main(string[] args) { string adsPath = String.Format("WinNT://{0}/{1}", args[0], args[1]); DirectoryEntry localuser = new DirectoryEntry(adsPath); IADsUser pUser = (IADsUser) localuser.NativeObject; Console.WriteLine("User = {0}", pUser.ADsPath); } } } </code></pre> <p>Warning messages look like</p> <p><em>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning : At least one of the arguments for 'ITypeLib.RemoteGetLibAttr' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.</em></p> <p>Observations:</p> <ul> <li>Happens for ActiveDs (11 warnings) and MSXML2 (54 warnings).</li> <li>Not seen for our own COM objects.</li> <li><code>&lt;Reference&gt;</code> entry in .csproj file contains attribute <code>WrapperTool = "tlbimp"</code></li> <li>Despite of all warnings, no problems have been observed in the running system.</li> </ul> <p>Any idea how to get rid of the warnings?</p>
[ { "answer_id": 1402834, "author": "Tony Lee", "author_id": 5819, "author_profile": "https://Stackoverflow.com/users/5819", "pm_score": 4, "selected": true, "text": " tlbimp c:\\WINNT\\system32\\activeds.tlb /out:interop.activeds.dll\n" }, { "answer_id": 33213457, "author": ...
2008/11/06
[ "https://Stackoverflow.com/questions/269063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23772/" ]
269,073
<p>Is there a collection (BCL or other) that has the following characteristics:</p> <p>Sends event if collection is changed AND sends event if any of the elements in the collection sends a <code>PropertyChanged</code> event. Sort of an <code>ObservableCollection&lt;T&gt;</code> where <code>T: INotifyPropertyChanged</code> and the collection is also monitoring the elements for changes. </p> <p>I could wrap an observable collection my self and do the event subscribe/unsubscribe when elements in the collection are added/removed but I was just wondering if any existing collections did this already?</p>
[ { "answer_id": 269113, "author": "soren.enemaerke", "author_id": 9222, "author_profile": "https://Stackoverflow.com/users/9222", "pm_score": 6, "selected": true, "text": "public class ObservableCollectionEx<T> : ObservableCollection<T> where T : INotifyPropertyChanged\n{\n protected o...
2008/11/06
[ "https://Stackoverflow.com/questions/269073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9222/" ]
269,081
<pre><code>template &lt;class M, class A&gt; class C { std::list&lt;M&gt; m_List; ... } </code></pre> <p>Is the above code possible? I would like to be able to do something similar.</p> <p>Why I ask is that i get the following error:</p> <pre><code>Error 1 error C2079: 'std::_List_nod&lt;_Ty,_Alloc&gt;::_Node::_Myval' uses undefined class 'M' C:\Program Files\Microsoft Visual Studio 9.0\VC\include\list 41 </code></pre>
[ { "answer_id": 269206, "author": "xtofl", "author_id": 6610, "author_profile": "https://Stackoverflow.com/users/6610", "pm_score": 3, "selected": true, "text": "// template definition file\n#include <list>\n\ntemplate< class aM, class aT >\nclass C {\n std::list<M> m_List;\n ...\n}...
2008/11/06
[ "https://Stackoverflow.com/questions/269081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23528/" ]
269,093
<p>I've a terrible memory. Whenever I do a CONNECT BY query in Oracle - and I do mean <em>every</em> time - I have to think hard and usually through trial and error work out on which argument the PRIOR should go.</p> <p>I don't know why I don't remember - but I don't.</p> <p>Does anyone have a handy memory mnemonic so I always remember ?</p> <p>For example:</p> <p>To go <strong>down</strong> a tree from a node - obviously I had to look this up :) - you do something like:</p> <pre><code>select * from node connect by prior node_id = parent_node_id start with node_id = 1 </code></pre> <p>So - I start with a <code>node_id</code> of 1 (the top of the branch) and the query looks for all nodes where the <code>parent_node_id</code> = 1 and then iterates down to the bottom of the tree.</p> <p>To go <strong>up</strong> the tree the prior goes on the parent:</p> <pre><code>select * from node connect by node_id = prior parent_node_id start with node_id = 10 </code></pre> <p>So starting somewhere down a branch (<code>node_id = 10</code> in this case) Oracle first gets all nodes where the <code>parent_node_id</code> is the same as the one for which <code>node_id</code> is 10.</p> <p><strong>EDIT</strong>: I <strong>still</strong> get this wrong so thought I'd add a clarifying edit to expand on the accepted answer - here's how I remember it now:</p> <pre><code>select * from node connect by prior node_id = parent_node_id start with node_id = 1 </code></pre> <p>The 'english language' version of this SQL I now read as...</p> <blockquote> <p>In NODE, starting with the row in which <code>node_id = 1</code>, the next row selected has its <code>parent_node_id</code> equal to <code>node_id</code> from the previous (prior) row.</p> </blockquote> <p><strong>EDIT</strong>: Quassnoi makes a great point - the order you write the SQL makes things a lot easier.</p> <pre><code>select * from node start with node_id = 1 connect by parent_node_id = prior node_id </code></pre> <p>This feels a lot clearer to me - the "start with" gives the first row selected and the "connect by" gives the next row(s) - in this case the children of node_id = 1.</p>
[ { "answer_id": 754290, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 3, "selected": false, "text": "JOIN" }, { "answer_id": 53173301, "author": "cartbeforehorse", "author_id": 1176987, "author_profile"...
2008/11/06
[ "https://Stackoverflow.com/questions/269093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4003/" ]
269,096
<p>I'm trying to create a WSTransfer implementation (I realise Roman Kiss has written one already for WCF - but it doesn't actually meet the specifications)</p> <p>I've ended up abandoning data contracts on the service contacts because WSTransfer is loosely coupled; so each the create message looks like Message Create(Message request).</p> <p>This works fine, and everything is lovely until it's time to fire back a response.</p> <p>The problem I have is in the way a WSTransfer response is constructed. Taking create as the example the response looks like</p> <pre><code>&lt;wxf:ResourceCreated&gt; &lt;wsa:Address&gt;....&lt;/wsa:Address&gt; &lt;wsa:ReferenceProperties&gt; &lt;xxx:MyID&gt;....&lt;/xxx:MyId&gt; &lt;/wsa:ReferenceProperties&gt; &lt;/wxf:ResourceCreated&gt; </code></pre> <p>As you can see there are 3 different XML namespaces within the response message.</p> <p>Now, it's easy enough when one is involved; you can (even if you're not exposing it), create a data contract and set the values and fire it back </p> <pre><code>Message response = Message.CreateMessage(request.Version, "http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse", resourceCreatedMessage); </code></pre> <p>However the problem arises in setting different namespaces for the child elements within the response; it appears WCF's datacontracts don't do this. Even using</p> <pre><code>[MessageBodyMember(Namespace="....")] </code></pre> <p>on the individual elements within the response class don't appear to make any changes, everything becomes part of the namespace specified for the contract class.</p> <p>So how do I apply different namespaces to individual elements in a WCF Message; either via a contract, or via some other jiggery pokery?</p>
[ { "answer_id": 754290, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 3, "selected": false, "text": "JOIN" }, { "answer_id": 53173301, "author": "cartbeforehorse", "author_id": 1176987, "author_profile"...
2008/11/06
[ "https://Stackoverflow.com/questions/269096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2525/" ]
269,101
<p>I'm using the code below to save a password to the registry, how do I convert it back? The code below isn't mine but it encrypts well.</p> <p>Thanks</p> <pre><code>using System.Security.Cryptography; public static string EncodePasswordToBase64(string password) { byte[] bytes = Encoding.Unicode.GetBytes(password); byte[] dst = new byte[bytes.Length]; byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(dst); return Convert.ToBase64String(inArray); } </code></pre>
[ { "answer_id": 269218, "author": "Bradley Grainger", "author_id": 23633, "author_profile": "https://Stackoverflow.com/users/23633", "pm_score": 4, "selected": false, "text": "public static string ProtectPassword(string password)\n{\n byte[] bytes = Encoding.Unicode.GetBytes(password);...
2008/11/06
[ "https://Stackoverflow.com/questions/269101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
269,106
<p>I am fairly new to WPF and I am having a problem with inheriting from a user control.</p> <p>I created a User Control and now I need to inherit from that control and add some more functionality.</p> <p>Has anyone does this sort of thing before? Any help would be greatly appreciated.</p> <p>Thank you</p>
[ { "answer_id": 269132, "author": "sirrocco", "author_id": 5246, "author_profile": "https://Stackoverflow.com/users/5246", "pm_score": 5, "selected": false, "text": "public abstract class BaseUserControl : UserControl{...}\n" }, { "answer_id": 1034172, "author": "Tomáš Kafka",...
2008/11/06
[ "https://Stackoverflow.com/questions/269106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35129/" ]
269,124
<p>I am reading a binary log file produced by a piece of equipment. </p> <p>I have the data in a byte[]. </p> <p>If I need to read two bytes to create a short I can do something like this:</p> <pre><code>short value = (short)(byte[1] &lt;&lt; 8); value += byte[2]; </code></pre> <p>Now I know the value is the correct for valid data. </p> <p>How would I know if the file was messed up and lets say the values FF FF were in those two places in the byte array?</p> <p>When I look at the resultant value of converting FF FF to a short, I get a -1.</p> <p>Is this a normal value for FF FF?, or did the computer just hit some kind of short bound and roll over with invalid data?</p> <p>For my purposes all of theses numbers are going to be positive. If FF FF is actually a short -1, then I just need to validate that all my results are postitive. </p> <p>Thank you,<br> Keith</p> <p><em>BTW, I am also reading other number data types. I'll show them here just because. The Read function is the basic part of reading from the byte[]. All the other data type reads use the basic Read() function.</em></p> <pre><code> public byte Read() { //advance position and then return byte at position byte returnValue; if (_CurrentPosition &lt; _count - 1) { returnValue= _array[_offset + ++_CurrentPosition]; return returnValue; } else throw new System.IO.EndOfStreamException ("Cannot Read Array, at end of stream."); } public float ReadFloat() { byte[] floatTemp = new byte[4]; for (int i = 3; i &gt;= 0; i--) { floatTemp[i] = Read(); } float returnValue = System.BitConverter.ToSingle (floatTemp, 0); if (float.IsNaN(returnValue)) { throw new Execption("Not a Number"); } return returnValue; } public short ReadInt16() { short returnValue = (short)(Read() &lt;&lt; 8); returnValue += Read(); return returnValue; } public int ReadInt32() { int returnValue = Read() &lt;&lt; 24; returnValue += Read() &lt;&lt; 16; returnValue += Read() &lt;&lt; 8; returnValue += Read(); return returnValue; } </code></pre>
[ { "answer_id": 269156, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 3, "selected": true, "text": "0xffff" }, { "answer_id": 269201, "author": "James Curran", "author_id": 12725, "author_profile": "https...
2008/11/06
[ "https://Stackoverflow.com/questions/269124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1048/" ]
269,164
<p>I am looking for an elegant solution for removing content from an ASP.Net page if no data has been set. Let me explain this a little more.</p> <p>I have some blocks of data on a page that contain some sub-sections with individual values in them. If no data has been set for one of the values I need to hide it (so it does not take up space). Also, if none of the values within a sub-section have been set, it needs to be hidden as well. Finally if none of the sub-sections are visible within the block/panel, then I need to hide the entire thing.</p> <p>The layout is implemented using nested Panels/DIVs</p> <pre><code>&lt;Panel id="block"&gt; &lt;Panel id="sub1"&gt; &lt;Panel id="value1-1"&gt;blah&lt;/Panel&gt; &lt;Panel id="value1-2"&gt;blah&lt;/Panel&gt; &lt;/Panel&gt; &lt;Panel id="sub2"&gt; &lt;Panel id="value2-1"&gt;blah&lt;/Panel&gt; &lt;Panel id="value2-2"&gt;blah&lt;/Panel&gt; &lt;/Panel&gt; &lt;/panel&gt; </code></pre> <p>I am wondering if anyone has any decent ideas on implementing something like this without writing a bunch of nested <strong>If..Else</strong> statements, and without creating a bunch of custom controls. Whatever I implement needs to be robust enough to handle changes in the markup without constantly manipulating the codebehind.</p> <p>I am hoping there is a way to do this through some simple markup changes (custom attribute) and a recursive function call on PageLoad or PreRender.</p> <p>Any help is greatly appreciated.</p> <h2>EDIT:</h2> <p>Ok so what makes this tricky is that there might be other controls inside the sub-sections that do not factor into the hiding and showing of the controls. And each <em>value</em> panel could potentially have controls in it that do not factor into whether or not it is shown. Example:</p> <pre><code>&lt;Panel id="sub2"&gt; &lt;Image id="someImage" src="img.png" /&gt; &lt;Panel id="value2-1"&gt; &lt;Label&gt;blah&lt;/Label&gt; &lt;TextBox id="txtValue" /&gt; &lt;/Panel&gt; &lt;Panel id="value2-2"&gt;blah&lt;/Panel&gt; &lt;/Panel&gt; </code></pre> <p>This is an over simplified example, but not far off from what I have to worry about.</p>
[ { "answer_id": 269195, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "<Panel id=\"block\" runat=\"server\" visible=\"<%=IsBlockVisible%>\">\n <Panel id=\"sub1\" runat=\"server\" visibl...
2008/11/06
[ "https://Stackoverflow.com/questions/269164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11702/" ]
269,172
<p>It appear that SQL Server like most other products Random Function really is not that random. So we have this nice little function to generate a 10 char value. Is there a better way to accomplish what the following does. I am betting there is.</p> <pre><code>DECLARE @SaltCount INT; SELECT @SaltCount = COUNT(*) FROM tmp_NewLogin; PRINT 'Set Salt values for all records' + CAST(@SaltCount AS VARCHAR(10)) DECLARE @CharPool CHAR(83); DECLARE @Salt VARCHAR(10); SET @CharPool = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!"#$%&amp;()*+,-./:;&lt;=&gt;?@'; SET NOCOUNT ON; updateSaltValue: SET @Salt = '' SELECT @Salt = @Salt + SUBSTRING(@CharPool, number, 1) FROM ( SELECT TOP 10 number FROM MASTER..[spt_values] WHERE TYPE = 'p' AND Number BETWEEN 1 AND 83 ORDER BY NEWID() ) AS t UPDATE TOP(1) [table] SET [Salt] = @Salt WHERE [Salt] IS NULL IF (@@ROWCOUNT &gt; 0) GOTO updateSaltValue SET NOCOUNT OFF; PRINT 'Completed setting salts for all records'; </code></pre>
[ { "answer_id": 269222, "author": "Aleksandar", "author_id": 29511, "author_profile": "https://Stackoverflow.com/users/29511", "pm_score": 1, "selected": false, "text": "create view [dbo].[wrapped_rand_view]\nas\nselect rand( ) as random_value\n" }, { "answer_id": 269445, "aut...
2008/11/06
[ "https://Stackoverflow.com/questions/269172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24500/" ]
269,179
<p>I have a lot of spare intel linux servers laying around (hundreds) and want to use them for a distributed file system in a web hosting and file sharing environment. This isn't for a HPC application, so high performance isn't critical. The main requirement is high availability, if one server goes offline, the data stored on it's hard drives is still available from other nodes. It must run over TCP/IP and provide standard POSIX file permissions.</p> <p>I've looked at the following:</p> <ul> <li><p>Lustre (<a href="http://wiki.lustre.org/index.php?title=Main_Page" rel="noreferrer">http://wiki.lustre.org/index.php?title=Main_Page</a>): Comes <em>really</em> close, but it doesn't provide redundancy for data on a node. You must make the data HA using RAID or DRBD. Supported by Sun and Open Source, so it should be around for a while</p></li> <li><p>gfarm (<a href="http://datafarm.apgrid.org/" rel="noreferrer">http://datafarm.apgrid.org/</a>): Looks like it provides the redundancy but at the cost of complexity and maintainability. Not as well supported as Lustre.</p></li> </ul> <p>Does anyone have any experience with these or any other systems that might work?</p>
[ { "answer_id": 269187, "author": "Javier", "author_id": 11649, "author_profile": "https://Stackoverflow.com/users/11649", "pm_score": 5, "selected": true, "text": "librados" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34227/" ]
269,181
<p>When you link to an unmanaged library (say 'A.dll') which in turn links to another library ('B.dll'), and B.dll is missing, you will get a run-time error message about failing to load 'B.dll'.</p> <p>But when you P/Invoke into 'A.dll' from managed code, you'll get a general exception of this form:</p> <p>Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'A.dll': The specified module could not be found.</p> <p>How can I get an error message that pinpoints the specific unmanaged dll file that failed to load, when p/invoking from managed code ?</p>
[ { "answer_id": 269197, "author": "Bradley Grainger", "author_id": 23633, "author_profile": "https://Stackoverflow.com/users/23633", "pm_score": 2, "selected": false, "text": "LoadLibrary" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
269,186
<p>We use Tomcat to host our WAR based applications. We are servlet container compliant J2EE applications with the exception of org.apache.catalina.authenticator.SingleSignOn.</p> <p>We are being asked to move to a commercial Java EE application server.</p> <ol> <li>The first downside to changing that I see is the cost. No matter what the charges for the application server, Tomcat is free.</li> <li>Second is the complexity. We don't use either EJB nor EAR features (of course not, we can't), and have not missed them.</li> </ol> <p>What then are the benefits I'm not seeing?</p> <p>What are the drawbacks that I haven't mentioned?</p> <hr> <p>Mentioned were...</p> <ol> <li>JTA - Java Transaction API - We control transaction via database stored procedures.</li> <li>JPA - Java Persistence API - We use JDBC and again stored procedures to persist.</li> <li>JMS - Java Message Service - We use XML over HTTP for messaging.</li> </ol> <p>This is good, please more!</p>
[ { "answer_id": 9199893, "author": "David Blevins", "author_id": 190816, "author_profile": "https://Stackoverflow.com/users/190816", "pm_score": 6, "selected": false, "text": "UserTransaction" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
269,193
<p>I've got two ListBox'es that are databound to the same BindingList.</p> <p>The issue is that when changing the selected item from the GUI it's changing the position in the BindingList and then the BindingList signals the other ListBox to change its selected item.</p> <p>So I've got the two ListBoxes Selected Item also synchronized which is not good for me.</p> <p>I'd like to maintain the list of items in sync. without the cursor position.</p> <p>How do I disable that cursor so it's not maintained?</p> <p>sample code (just add two ListBoxes to the Form at design time and register the SelectedIndexChanged events and register the button click event with a button):</p> <pre><code>public partial class Form1 : Form { BindingList&lt;string&gt; list = new BindingList&lt;string&gt;(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { list.Add("bla1"); list.Add("bla2"); list.Add("bla3"); this.listBox1.DataSource = list; this.listBox2.DataSource = list; } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) System.Diagnostics.Trace.WriteLine("ListBox1: " + listBox1.SelectedItem.ToString()); } private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { if (listBox2.SelectedIndex != -1) System.Diagnostics.Trace.WriteLine("ListBox2: " + listBox2.SelectedItem.ToString()); } // Register this event to a button private void button1_Click(object sender, EventArgs e) { list.Add("Test"); } } </code></pre> <p>Thanks, --Ran.</p>
[ { "answer_id": 270622, "author": "tamberg", "author_id": 3588, "author_profile": "https://Stackoverflow.com/users/3588", "pm_score": 2, "selected": false, "text": "class MyListBox: ListBox {\n\n protected override void OnSelectedIndexChanged (EventArgs a) {\n if (DataManager !=...
2008/11/06
[ "https://Stackoverflow.com/questions/269193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35139/" ]
269,207
<p>I have implemented a SAX parser in Java by extending the default handler. The XML has a ñ in its content. When it hits this character it breaks. I print out the char array in the character method and it simply ends with the character before the ñ. The parser seems to stop after this as no other methods are called even though there is still much more content. ie the endElement method is never called again. Has anyone run into this problem before or have any suggestion on how to deal with it?</p>
[ { "answer_id": 269288, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 3, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" }, { "answer_id": 34519333, "author": "Amarnath Reddy Dornala", ...
2008/11/06
[ "https://Stackoverflow.com/questions/269207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35140/" ]
269,212
<p>We have an Java application running on Weblogic server that picks up XML messages from a JMS or MQ queue and writes it into another JMS queue. The application doesn't modify the XML content in any way. We use BEA's XMLObject to read and write the messages into queues.</p> <p>The XML messages contain the encoding type declarations as UTF-8.</p> <p>We have an issue when the XML contains characters that are out side the normal ASCII range (like £ symbol for example). When the message is read from the queue we can see that the £ symbol is intact, however once we write it to the destination queue, the £ symbol is lost and is replaced with £ instead.</p> <p>I have checked the OS level settings (locale settings) and everything seems to be fine. What else should I be checking to make sure that this doesn't happen?</p>
[ { "answer_id": 269891, "author": "Alan Moore", "author_id": 20938, "author_profile": "https://Stackoverflow.com/users/20938", "pm_score": 4, "selected": true, "text": "ÃX" }, { "answer_id": 269949, "author": "erickson", "author_id": 3474, "author_profile": "https://St...
2008/11/06
[ "https://Stackoverflow.com/questions/269212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34026/" ]
269,213
<p>What are good ways of achieving this DB agnosticism without actually coding two DAL's? I've heard that the Data Access Application Block is suitable for this.</p>
[ { "answer_id": 331193, "author": "Patrick de Kleijn", "author_id": 33221, "author_profile": "https://Stackoverflow.com/users/33221", "pm_score": 0, "selected": false, "text": " private static DbProviderFactory _provider = DbProviderFactories.GetFactory(WebConfigurationManager.Connecti...
2008/11/06
[ "https://Stackoverflow.com/questions/269213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
269,223
<p>As I understand, the pimpl idiom is exists only because C++ forces you to place all the private class members in the header. If the header were to contain only the public interface, theoretically, any change in class implementation would not have necessitated a recompile for the rest of the program. </p> <p>What I want to know is why C++ is not designed to allow such a convenience. Why does it demand at all for the private parts of a class to be openly displayed in the header (no pun intended)?</p>
[ { "answer_id": 269251, "author": "Dan Hewett", "author_id": 17975, "author_profile": "https://Stackoverflow.com/users/17975", "pm_score": 4, "selected": true, "text": "class MyClass\n{\npublic:\n // public stuff\n\nprivate:\n#include \"MyClassPrivate.h\"\n};\n" }, { "answer_id"...
2008/11/06
[ "https://Stackoverflow.com/questions/269223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32688/" ]
269,228
<p>I am trying to write a tool that can compare a database’s schema to the SQL in an install script. Getting the information from the database is pretty straightforward but I am having a little trouble parsing the install scripts. </p> <p>I have played with a few of the parsers that show up on Google but they seemed somewhat incomplete. Ideally I would like to find an open source parser that is fairly stable and has half decent documentation. </p> <p>Also, I am not really concerned about types and syntax that specific to certain databases. The databases that need to be check are pretty simple.</p>
[ { "answer_id": 909531, "author": "Klathzazt", "author_id": 35223, "author_profile": "https://Stackoverflow.com/users/35223", "pm_score": 0, "selected": false, "text": "PRAGMA table_info(my_table)\nPRAGMA table_info(temporary_my_table)\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13054/" ]
269,241
<p>I have a not-so-small class under development (that it changes often) and I need not to provide a public copy constructor and copy assignment. The class has objects with value semantics, so default copy and assignment work.</p> <p>the class is in a hierarchy, with virtual methods, so I provide a virtual Clone() to avoid slicing and to perform "polymorphic copy".</p> <p>I don't want to declare copy assignment and construction protected AND to define them (and to maintain in-sync with changes) unless I have some special thing to perform.</p> <p>Do someone knows if there's another way?</p> <p>thanks!</p> <p>UgaSofT</p>
[ { "answer_id": 6938247, "author": "小太郎", "author_id": 359653, "author_profile": "https://Stackoverflow.com/users/359653", "pm_score": 0, "selected": false, "text": "class A\n{\n protected:\n A(const A&) = default;\n};\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10120/" ]
269,243
<p>I have a multi-threaded Windows application that occasionally deadlocks. Inevitably this happens on a customer system and not when the software is in test. What is the easiest way of getting a Windows Minidump of the current state of the application? If it could also terminate the application so the user can restart it and continue using the system that would be great.</p>
[ { "answer_id": 269257, "author": "davefiddes", "author_id": 6353, "author_profile": "https://Stackoverflow.com/users/6353", "pm_score": 1, "selected": false, "text": "ntsd -pn MyApp.exe\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6353/" ]
269,252
<p>Is there an event for when a document is edited? If not, does anyone know where I could find a list of the available VBA events?</p>
[ { "answer_id": 269323, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 2, "selected": false, "text": "DocumentBeforeClose : Immediately before any open document closes. \nDocumentBeforePrint : Before any open document is pri...
2008/11/06
[ "https://Stackoverflow.com/questions/269252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5653/" ]
269,253
<p>Is there a way to restrict a specific SQL 2005 login on a Microsoft SQL Server 2005, standard version (sql is in mixed mode) to specific IP addresses, while other logins, Windows authenticated ones, are unaffected?</p>
[ { "answer_id": 325936, "author": "Thuglife", "author_id": 41612, "author_profile": "https://Stackoverflow.com/users/41612", "pm_score": 3, "selected": false, "text": "CREATE TRIGGER [LOGIN_IP_RESTRICTION]\n ON ALL SERVER FOR LOGON\nAS\nBEGIN\n DECLARE @host NVARCHAR(255);\n\n SE...
2008/11/06
[ "https://Stackoverflow.com/questions/269253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35150/" ]
269,263
<p>I have just been getting into low level programming (reading/writing to memory that sort of thing) and have run into an issue i cannot find an answer to.</p> <p>The piece of information i want to read from has an address that is relative to a DLL loaded in memory e,g, it is at mydll.dll + 0x01234567. the problem im having is that the dll moves around in memory but the offset stays the same. Is there anyway to find out the location of this dll in memory.</p> <p>I am currently trying to do this preferably in c# but i would be grateful for help in most highish level languages.</p>
[ { "answer_id": 280960, "author": "Paul Harris", "author_id": 35148, "author_profile": "https://Stackoverflow.com/users/35148", "pm_score": 3, "selected": true, "text": "String appToHookTo = \"applicationthatloadedthedll\";\nProcess[] foundProcesses = Process.GetProcessesByName(appToHookT...
2008/11/06
[ "https://Stackoverflow.com/questions/269263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35148/" ]
269,267
<p>Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions.</p> <p>How do I get Excel to display say, six different background cell colors depending upon the value of the cell? (IE Make the cell red if the value is "Red", and blue if "Blue" etc.)</p>
[ { "answer_id": 269278, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 4, "selected": true, "text": "Private Sub Worksheet_Change(ByVal Target As Range)\n\nDim icolor As Integer\n\n If Not Intersect(Target, Range(\"A1:A10...
2008/11/06
[ "https://Stackoverflow.com/questions/269267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35154/" ]
269,268
<p>I'd like to implement a big int class in C++ as a programming exercise&mdash;a class that can handle numbers bigger than a long int. I know that there are several open source implementations out there already, but I'd like to write my own. I'm trying to get a feel for what the right approach is.</p> <p>I understand that the general strategy is get the number as a string, and then break it up into smaller numbers (single digits for example), and place them in an array. At this point it should be relatively simple to implement the various comparison operators. My main concern is how I would implement things like addition and multiplication.</p> <p>I'm looking for a general approach and advice as opposed to actual working code.</p>
[ { "answer_id": 269302, "author": "hark", "author_id": 34826, "author_profile": "https://Stackoverflow.com/users/34826", "pm_score": 2, "selected": false, "text": "typedef struct {\n int high, low;\n} BiggerInt;\n" }, { "answer_id": 270258, "author": "mstrobl", "author_...
2008/11/06
[ "https://Stackoverflow.com/questions/269268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9435/" ]
269,285
<p>I have this simple controller:</p> <pre><code>public class OneController : Controller { [AcceptVerbs(HttpVerbs.Get)] public ActionResult Create() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(IList&lt;TestModel&gt; m) { return View(m); } } </code></pre> <p>And a very simple view with two objects of type TestModel, properly indexed. When I submit the form with invalid data, I get the view with the errors highlighted. However, when I re-submit it (without changing anything), I get this error:</p> <blockquote> <p>[NullReferenceException: Object reference not set to an instance of an object.] System.Web.Mvc.DefaultModelBinder.UpdateCollection(ModelBindingContext bindingContext, Type itemType) +612 System.Web.Mvc.DefaultModelBinder.BindModelCore(ModelBindingContext bindingContext) +519 System.Web.Mvc.DefaultModelBinder.BindModel(ModelBindingContext bindingContext) +829 System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ParameterInfo parameterInfo) +313 System.Web.Mvc.ControllerActionInvoker.GetParameterValues(MethodInfo methodInfo) +399 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +232 System.Web.Mvc.Controller.ExecuteCore() +152 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +86 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +28 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +332 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +55 System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +28 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +64</p> </blockquote> <p>Any idea on how can I debug this?</p>
[ { "answer_id": 426803, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<%= Html.Hidden(\"submitFormFields.index\", controlID) %>\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7277/" ]
269,298
<p>I have a list of items that I am displaying in a floated list, with each item in the list at a fixed width so that there's two per row. What is the best practice to prevent this horrible thing from happening:</p> <p><a href="http://x01.co.uk/floated_items.gif">alt text http://x01.co.uk/floated_items.gif</a></p> <p>Possibilites:</p> <ul> <li>Trim to a specified number of characters before displaying the data. Requires guesswork on how many characters will be "safe".</li> <li>Overflow: hidden. Hacky.</li> <li>Remove the background and just have a top border on each item.</li> </ul> <p>Possible but silly:</p> <ul> <li>Have a scrollbar in each item by doing overflow: auto, this will look horrendous.</li> <li>Add a background image to the container. It's not guaranteed that there's always an equal number of items so this option is out.</li> </ul> <p>Any help on this irritating issue appreciated!</p>
[ { "answer_id": 274983, "author": "Esteban Küber", "author_id": 34813, "author_profile": "https://Stackoverflow.com/users/34813", "pm_score": 0, "selected": false, "text": "ul li{\n display:block;\n float:left;\n width:6em;\n height:4em;\n background-color:black;\n color:white;\n m...
2008/11/06
[ "https://Stackoverflow.com/questions/269298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
269,303
<p>After using them a while I can't help but feel that the hoops you're forced to jump through when using anonymous classes are not worth it.</p> <p>You end up with <code>final</code> all over the place and no matter what the code is more difficult to read than if you'd used a well named inner class.</p> <p>So what are the advantages of using them? I must be missing something.</p>
[ { "answer_id": 269345, "author": "Vinze", "author_id": 26859, "author_profile": "https://Stackoverflow.com/users/26859", "pm_score": 2, "selected": false, "text": "this.addListener(new IListener(){\n public void listen() {...}\n});\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
269,314
<p>On Linux (or Solaris) is there a better way than hand parsing <code>/proc/self/maps</code> repeatedly to figure out whether or not you can read, write or execute whatever is stored at one or more addresses in memory?</p> <p>For instance, in Windows you have <code>VirtualQuery</code>. </p> <p>In Linux, I can <code>mprotect</code> to change those values, but I can't read them back.</p> <p>Furthermore, is there any way to know when those permissions change (e.g. when someone uses <code>mmap</code> on a file behind my back) other than doing something terribly invasive and using <code>ptrace</code> on all threads in the process and intercepting any attempt to make a <code>syscall</code> that could affect the memory map?</p> <p><strong>Update:</strong></p> <p>Unfortunately, I'm using this inside of a JIT that has very little information about the code it is executing to get an approximation of what is constant. Yes, I realize I could have a constant map of mutable data, like the vsyscall page used by Linux. I <em>can</em> safely fall back on an assumption that anything that isn't included in the initial parse is mutable and dangerous, but I'm not entirely happy with that option.</p> <p>Right now what I do is I read <code>/proc/self/maps</code> and build a structure I can binary search through for a given address's protection. Any time I need to know something about a page that isn't in my structure I reread /proc/self/maps assuming it has been added in the meantime or I'd be about to segfault anyways.</p> <p>It just seems that parsing text to get at this information and not knowing when it changes is awfully crufty. (<code>/dev/inotify</code> doesn't work on pretty much anything in <code>/proc</code>)</p>
[ { "answer_id": 269572, "author": "Pierre", "author_id": 24449, "author_profile": "https://Stackoverflow.com/users/24449", "pm_score": 4, "selected": true, "text": "VirtualQuery" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34707/" ]
269,326
<p>I'm running Apache on Windows XP via Xampplite, and could use help configuring my virtual directory. Here's what I'm hoping to do on my dev box:</p> <ol> <li>I want my source files to live outside of the xampp htdocs dir</li> <li>on my local machine I can access the project at <a href="http://myproject" rel="noreferrer">http://myproject</a></li> <li>others on my local network can access the project at my.ip.address/myproject</li> <li>keep localhost pointing to the xampp's htdocs folder so I can easily add other projects.</li> </ol> <p>I've got 1 &amp; 2 working by editing the windows hosts file, and adding a virtual directory in xampp's apache\conf\extra\httpd-vhosts.conf file. I don't immediately see how to do 3 without messing up 4.</p>
[ { "answer_id": 269378, "author": "sprugman", "author_id": 24197, "author_profile": "https://Stackoverflow.com/users/24197", "pm_score": 6, "selected": true, "text": "Alias /myproject \"C:/path/to/my/project\"\n<Directory \"C:/path/to/my/project\">\n Options Indexes FollowSymLinks MultiV...
2008/11/06
[ "https://Stackoverflow.com/questions/269326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24197/" ]
269,363
<p>I have written a windows service using the Apache.NMS and Apcahe.NMS.ActiveMQ (version 1.0) libraries. The service consumes messages from ActiveMQ from a vendor server.</p> <p>The service spins up a connection and listens for messages (I handle the OnMessage event)</p> <p>The connection is a transacted connection so I call commit after each message.</p> <p>When the service starts up, everything works very well and does so for a while. However, after it has run for a while, it will no longer consume messages. Even if I reset the service. It usually takes a restart of my service AND the vendor server (tomcat) to get things going again. The vendor insists that nothing is wrong on their side.</p> <p>No exceptions are thrown on either side (client or server) - it's just 'stuck'.</p> <p>Should I consider using Spring.Messaging.Nms? </p>
[ { "answer_id": 302728, "author": "theGecko", "author_id": 39022, "author_profile": "https://Stackoverflow.com/users/39022", "pm_score": 0, "selected": false, "text": "ConnectionFactory connectionFactory = new ConnectionFactory(\"tcp://activemq:61616\");\n\nConnection connection = (Connec...
2008/11/06
[ "https://Stackoverflow.com/questions/269363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35165/" ]
269,366
<p>Until this morning, I have had Apache 2.0 running as a service using a local account which was configured with appropriate permissions. Sometime yesterday, someone must have changed something, and now Apache 2.0 won't start as a service under this account.</p> <p>I made the account an Administrator temporarily, and Apache 2.0 starts fine.</p> <p>I tried following the access listed in the <a href="http://httpd.apache.org/docs/2.0/platform/windows.html" rel="nofollow noreferrer">official documentation</a>, but it seems to require more access. <strong>Does anyone know what access Apache 2.0 needs to start as a service?</strong></p> <p>I'm running Apache 2.0.63 with SVN 1.4.6 and mod_auth_sspi for windows domain authentication.</p> <p>I also checked the syntax of the configuration file from command-line using the <strong>-t</strong> parameter, but I received the message <strong>Syntax OK</strong>.</p> <p>Here's the error I get when starting as a service from command-line:</p> <pre> X:\>net start apache2 The Apache2 service is starting. The Apache2 service could not be started. A service specific error occurred: 1. More help is available by typing NET HELPMSG 3547. </pre>
[ { "answer_id": 302728, "author": "theGecko", "author_id": 39022, "author_profile": "https://Stackoverflow.com/users/39022", "pm_score": 0, "selected": false, "text": "ConnectionFactory connectionFactory = new ConnectionFactory(\"tcp://activemq:61616\");\n\nConnection connection = (Connec...
2008/11/06
[ "https://Stackoverflow.com/questions/269366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2273/" ]
269,367
<p>I have a form which is used to <em>insert/display</em> and <em>update</em>. In the edit mode (<em>update</em>), when I pass my <code>BO</code> back to the Controller, what is the best possible way to check if any of the property values were changed, in order to execute the update to the datastore? </p> <pre><code>textbox1.text = CustomerController.GetCustomerInformation(id).Name </code></pre> <p>A customer object is returned from the controller. I need to check if the the object is dirty in order to execute an update. I would assume the object sent from the client has to be compared with the one sent from the controller when I do:</p> <pre><code>CustomerController.Save(customer) </code></pre> <p>How is this normally done?</p>
[ { "answer_id": 269371, "author": "vfilby", "author_id": 24279, "author_profile": "https://Stackoverflow.com/users/24279", "pm_score": 3, "selected": true, "text": "public string Name {\n get { return _name; }\n set {\n _name = value;\n _isDirty = true;\n }\n}\n" ...
2008/11/06
[ "https://Stackoverflow.com/questions/269367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
269,373
<p>I want to do something like this:</p> <pre><code>&lt;MyTemplate&gt; &lt;span&gt;&lt;%# Container.Title %&gt;&lt;/span&gt; &lt;MySubTemplate&gt; &lt;span&gt;&lt;%# Container.Username %&gt;&lt;/span&gt; &lt;/MySubTemplate&gt; &lt;/MyTemplate&gt; </code></pre> <p>Assuming I have a list of Titles that each have a list of Usernames.. If this is a correct approach how can I do this or what is a better way?</p>
[ { "answer_id": 273051, "author": "Max Schilling", "author_id": 29662, "author_profile": "https://Stackoverflow.com/users/29662", "pm_score": 2, "selected": true, "text": " <asp:Repeater ID=\"rptTitle\" runat=\"server\" >\n <ItemTemplate>\n <%# Eval(\"Title\") %>\n ...
2008/11/06
[ "https://Stackoverflow.com/questions/269373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18926/" ]
269,390
<p>At the moment I have setup a custom ok cancel dialog with a drop down in c#. The ok and cancel buttons use the DialogResult property so no code behind it. What I now need to do is validate the drop down to check it isn't left empty before posting back a dialogresult.</p> <p>Is this possible?</p>
[ { "answer_id": 269396, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 3, "selected": true, "text": "private void Second_Closing(object sender, \n System.ComponentModel.CancelEventArgs e)\n{\n // When the user att...
2008/11/06
[ "https://Stackoverflow.com/questions/269390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16989/" ]
269,402
<p>I've been asked to add Google e-commerce tracking into my site. This tracking involves inserting some javascript on your receipt page and then calling it's functions. From my asp.net receipt page, I need to call one function (_addTrans) for the transaction info and then another (_addItem) for each item on the order. An example of what they want is <a href="http://www.google.com/support/analytics/bin/answer.py?answer=55528" rel="nofollow noreferrer">here</a></p> <p>This is for a 1.1 site. Can anybody give me a jumpstart on calling these two functions from my c# code-behind? I can't imagine that I'm alone out there in needing to call Google e-commerce tracking, so I'm hopeful.</p>
[ { "answer_id": 269472, "author": "stevemegson", "author_id": 25028, "author_profile": "https://Stackoverflow.com/users/25028", "pm_score": 4, "selected": true, "text": "StringBuilder sb = new StringBuilder()\nsb.AppendLine( \"<script>\" );\nsb.AppendLine( \"var pageTracker = _gat._getTra...
2008/11/06
[ "https://Stackoverflow.com/questions/269402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
269,404
<p>I have been reading about the differences between Table Variables and Temp Tables and stumbled upon the following issue with the Table Variable. I did not see this issue mentioned in the articles I pursued. </p> <p>I pass in a series of PKs via a XML data type and successfully create the records in both temp table structures. When I attempt to update further fields in the temp tables the Table Variable fails but the Temp Table has no problem with the Update Statement. What do need to do different? I would like to take advantage of the speed boost that Table Variables promise…</p> <p>Here are the SP snippets and Results:</p> <pre><code>CREATE PROCEDURE ExpenseReport_AssignApprover ( @ExpenseReportIDs XML ) AS DECLARE @ERTableVariable TABLE ( ExpenseReportID INT, ExpenseReportProjectID INT, ApproverID INT) CREATE TABLE #ERTempTable ( ExpenseReportID INT, ExpenseReportProjectID INT, ApproverID INT ) INSERT INTO @ERTableVariable (ExpenseReportID) SELECT ParamValues.ID.value('.','VARCHAR(20)') FROM @ExpenseReportIDs.nodes('/Root/ExpenseReportID') as ParamValues(ID) INSERT INTO #ERTempTable (ExpenseReportID) SELECT ParamValues.ID.value('.','VARCHAR(20)') FROM @ExpenseReportIDs.nodes('/Root/ExpenseReportID') as ParamValues(ID) UPDATE #ERTempTable SET ExpenseReportProjectID = ( SELECT TOP 1 ExpenseReportProjectID FROM ExpenseReportItem WHERE(ExpenseReportID = #ERTempTable.ExpenseReportID)) UPDATE @ERTableVariable SET ExpenseReportProjectID = ( SELECT TOP 1 ExpenseReportProjectID FROM ExpenseReportItem WHERE(ExpenseReportID = @ERTableVariable.ExpenseReportID)) </code></pre> <p>Error when last update statement in there : Must declare the scalar variable "@ERTableVariable".</p> <p>ExpenseReportProjectID is updated in #ERTempTable when the last update is commented out:</p>
[ { "answer_id": 269418, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 0, "selected": false, "text": "CREATE PROCEDURE ExpenseReport_AssignApprover\n(\n @ExpenseReportIDs XML\n)\nAS BEGIN\n\n\nDECLARE ...
2008/11/06
[ "https://Stackoverflow.com/questions/269404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30934/" ]
269,408
<p>We have Core2 machines (Dell T5400) with XP64.</p> <p>We observe that when running 32-bit processes, the performance of memcpy is on the order of 1.2GByte/s; however memcpy in a 64-bit process achieves about 2.2GByte/s (or 2.4GByte/s with the Intel compiler CRT's memcpy). While the initial reaction might be to just explain this away as due to the wider registers available in 64-bit code, we observe that our own memcpy-like SSE assembly code (which should be using 128-bit wide load-stores regardless of 32/64-bitness of the process) demonstrates similar upper limits on the copy bandwidth it achieves.</p> <p>My question is, what's this difference actually due to ? Do 32-bit processes have to jump through some extra WOW64 hoops to get at the RAM ? Is it something to do with TLBs or prefetchers or... what ?</p> <p>Thanks for any insight.</p> <p>Also raised on <a href="http://software.intel.com/en-us/forums/intel-avx-and-cpu-instructions/topic/63277/" rel="noreferrer">Intel forums</a>.</p>
[ { "answer_id": 269762, "author": "Mecki", "author_id": 15809, "author_profile": "https://Stackoverflow.com/users/15809", "pm_score": 3, "selected": false, "text": "mov eax, [address]\nmov [address2], eax\n" }, { "answer_id": 536652, "author": "timday", "author_id": 24283,...
2008/11/06
[ "https://Stackoverflow.com/questions/269408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24283/" ]
269,423
<p><strong>Is there a tool to generate WiX XML given a .reg file?</strong></p> <hr> <p>In 2.0, you were supposed to be able to run tallow to generate registry XML:</p> <pre><code>tallow -r my.reg </code></pre> <p>For what it's worth, the version of tallow I have is producing empty XML.</p> <p>In 3.0, tallow has been replaced with heat, but I can't figure out how to get it to produce output from a .reg file.</p> <p>Is there a way to do this in 3.0?</p>
[ { "answer_id": 270442, "author": "Adam Tegen", "author_id": 4066, "author_profile": "https://Stackoverflow.com/users/4066", "pm_score": 5, "selected": true, "text": "using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.IO;\nusing System.Xml;\nusing System.Te...
2008/11/06
[ "https://Stackoverflow.com/questions/269423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
269,425
<p>When I right-click a solution in VS2008 and select Check In... I am presented with a list of changed files with check boxes and a comment area. (This is done against TFS.)</p> <p>Our check-in process requires that we enter this list of changed files into the bug tracking ticket. This requires typing in the name of each each file: time-consuming and error prone.</p> <p>Ideally I'd like to be able to select that list and copy it to the clipboard so that I can paste it into the bug tracking system.</p> <p>Does anybody have a way that I can easily get that list into the clipboard?</p>
[ { "answer_id": 269484, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": 2, "selected": false, "text": " string strServer = startInfo.Server;\n string strWorkspace = startInfo.Workspace;\n\n Micro...
2008/11/06
[ "https://Stackoverflow.com/questions/269425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
269,436
<p>I have set a canvas' background to an image of a company logo. I would like for this image to be aligned to the bottom right corner of the canvas.<br> Is it possible to do this, or would it require for the image to be added into the canvas as a child? That would not work with this program as all children of the canvas are handled differently.</p> <p>Thank You</p>
[ { "answer_id": 269514, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 0, "selected": false, "text": "<Window x:Class=\"HelloWPF.Window1\" xmlns...\n Title=\"Window1\" Height=\"300\" Width=\"339\">\n <Canvas>\n <Ima...
2008/11/06
[ "https://Stackoverflow.com/questions/269436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30838/" ]
269,440
<p>I have the following query:</p> <pre><code>UPDATE lessonstatus INNER JOIN user ON lessonstatus.user_id = user.user_id SET user_id = (SELECT user_id FROM user WHERE username = 'too_many_accounts') WHERE last_name = 'stupid' AND first_name = 'user' AND username != 'too_many_accounts' AND lessonstatus.lesson_id NOT IN (SELECT lesson_id FROM lessonstatus WHERE user_id = 1); </code></pre> <p>However, I get the following error when trying to execute it:</p> <pre><code>Error Code : 1093 You can't specify target table 'lessonstatus_rtab' for update in FROM clause </code></pre> <p>How would I fix this query so that it works?</p>
[ { "answer_id": 269471, "author": "Arvo", "author_id": 35777, "author_profile": "https://Stackoverflow.com/users/35777", "pm_score": 0, "selected": false, "text": "UPDATE lessonstatus\nSET user_id = (SELECT TOP 1 user_id FROM user WHERE username = 'too_many_accounts')\nFROM lessonstatus\n...
2008/11/06
[ "https://Stackoverflow.com/questions/269440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
269,456
<p>We are rolling out a site for a client using IIS tomorrow. </p> <p>I am to take the site down to the general public (Sorry, we are updating message) and allow the client to test over the weekend after we perform the upgrade.</p> <p>If it is successful, I open it to everbody - if not, I rollback.</p> <p>What is the easiest way to put a "We're not open" sign for the general public, but leave the rest open to testers?</p>
[ { "answer_id": 269998, "author": "Tim Farley", "author_id": 4425, "author_profile": "https://Stackoverflow.com/users/4425", "pm_score": 3, "selected": false, "text": "app_offline.htm\n" } ]
2008/11/06
[ "https://Stackoverflow.com/questions/269456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
269,458
<p>Ages ago when I was a java developer I could make separate ant scripts that I would call from my main ant script. I would put properties unique to each environment where my main script would run. I want to do the same thing in MSBuild but I can't find out how to chain MSBuild scripts together.</p>
[ { "answer_id": 269482, "author": "Scott Dorman", "author_id": 1559, "author_profile": "https://Stackoverflow.com/users/1559", "pm_score": 3, "selected": true, "text": " <Import Project=\"MyTargets\" Condition=\"Exists('MyTargets')\"/>\n" }, { "answer_id": 269498, "author": ...
2008/11/06
[ "https://Stackoverflow.com/questions/269458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
269,462
<p>I'm doing some small changes to C++ MFC project. I'm .NET developer so Windows programming is new to me.</p> <p>I need to launch some method right after CDialog is completely shown (painted) for the first time, but only once.</p> <p>How can I do this? In .NET I would handle <strong>Form.Shown</strong> event.</p> <p>Do I need to handle some message? Which? Do I need to override some CDialog method? Or is there no easy way? I'm thinking of handling WM_ACTIVATE and then using a flag to ensure I call another method only once.</p>
[ { "answer_id": 269850, "author": "Sumrak", "author_id": 19124, "author_profile": "https://Stackoverflow.com/users/19124", "pm_score": 3, "selected": true, "text": "Short story:\nINT_PTR CALLBACK\nDlgProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)\n{\n switch (uiMsg) {\n\n cas...
2008/11/06
[ "https://Stackoverflow.com/questions/269462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19124/" ]