qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
152,323
<p>I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box.</p> <p>The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl is not available on the server.</p> <p>Is there an easy way of doing this from a .bat-file or any other way that doesn't require installing some additional software?</p> <p><code>Edit:</code><br> Thanks for the quick replies. The "blat" thingie would probably work fine but with wscript I don't have to use a separate binary.</p> <p>I didn't see PhiLho's post the first time I edited and selected an answer. No need for me to duplicate the code here.</p> <p>Just save the script to a file, say sendmail.vbs, and then call it from the command prompt like so:<br> <code>wscript sendmail.vbs</code></p>
[ { "answer_id": 152392, "author": "Re0sless", "author_id": 2098, "author_profile": "https://Stackoverflow.com/users/2098", "pm_score": 1, "selected": false, "text": "wscript mail.vbs\n" }, { "answer_id": 152411, "author": "PhiLho", "author_id": 15459, "author_profile":...
2008/09/30
[ "https://Stackoverflow.com/questions/152323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5264/" ]
152,328
<p>What is better?</p> <p><strong>A:</strong></p> <pre><code>server:1080/repo/projectA/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... server:1080/repo/projectB/trunk/... branches/branch1 branches/branch2 branches/branch3 tags/tag1/... tags/tag2/... </code></pre> <p><strong>B:</strong></p> <pre><code>server:1080/repo/trunk/projectA/... branches/projectA/branch1 branches/projectA/branch2 branches/projectA/branch3 tags/projectA/tag1/... tags/projectA/tag2/... server:1080/repo/trunk/projectB/trunk/... branches/projectB/branch1 branches/projectB/branch2 branches/projectB/branch3 tags/projectB/tag1/... tags/projectB/tag2/... </code></pre> <p>What repository structure do you use and WHY?</p>
[ { "answer_id": 152345, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "server:1080/projectA/trunk/...\n branches/branch1\n branches/branch2\n ...
2008/09/30
[ "https://Stackoverflow.com/questions/152328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8986/" ]
152,338
<p>How to unit test WCF services? Any 3rd Party tools available?</p>
[ { "answer_id": 5029051, "author": "Jeno Laszlo", "author_id": 621390, "author_profile": "https://Stackoverflow.com/users/621390", "pm_score": 5, "selected": false, "text": " ServiceHost serviceHost = null;\n\n try\n {\n var baseAddress = new Uri(\"http://localhost:8000/Te...
2008/09/30
[ "https://Stackoverflow.com/questions/152338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11039/" ]
152,342
<p>I fill a collection one single time when my J2EE webapp starts. Then, several thread may access it at same time but only to read it.</p> <p>I know using a synchronized collection is mandatory for parallels write but do I still need it for parallels read ?</p>
[ { "answer_id": 152348, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 5, "selected": true, "text": "class Test {\n public Test(final int a, final int b) {\n this.a = a;\n this.b = b;\n }\n\n publ...
2008/09/30
[ "https://Stackoverflow.com/questions/152342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3122/" ]
152,344
<p>I have a statusItem application written in PyObjC. The statusItem has a menuItem which is supposed to launch a new window when it is clicked:</p> <pre><code># Create statusItem statusItem = NSStatusBar.systemStatusBar().statusItemWithLength_(NSVariableStatusItemLength) statusItem.setHighlightMode_(TRUE) statusItem.setEnabled_(TRUE) statusItem.retain() # Create menuItem menu = NSMenu.alloc().init() menuitem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Preferences', 'launchPreferences:', '') menu.addItem_(menuitem) statusItem.setMenu_(menu) </code></pre> <p>The launchPreferences: method is:</p> <pre><code>def launchPreferences_(self, notification): preferences = Preferences.alloc().initWithWindowNibName_('Preferences') preferences.showWindow_(self) </code></pre> <p>Preferences is an NSWindowController class:</p> <pre><code>class Preferences(NSWindowController): </code></pre> <p>When I run the application in XCode (Build &amp; Go), this works fine. However, when I run the built .app file externally from XCode, the statusItem and menuItem appear as expected but when I click on the Preferences menuItem the window does not appear. I have verified that the launchPreferences code is running by checking console output. </p> <p>Further, if I then double click the .app file again, the window appears but if I change the active window away by clicking, for example, on a Finder window, the preferences window disappears. This seems to me to be something to do with the active window. </p> <p><strong>Update 1</strong> I have tried <a href="https://stackoverflow.com/questions/152344/nswindow-launched-from-statusitem-menuitem-does-not-appear-as-active-window#152399">these</a> <a href="https://stackoverflow.com/questions/152344/nswindow-launched-from-statusitem-menuitem-does-not-appear-as-active-window#152409">two</a> answers but neither work. If I add in to the launchPreferences method:</p> <pre><code>preferences.makeKeyAndOrderFront_() </code></pre> <p>or</p> <pre><code>preferences.setLevel_(NSNormalWindowLevel) </code></pre> <p>then I just get an error:</p> <blockquote> <p>'Preferences' object has no attribute</p> </blockquote>
[ { "answer_id": 152399, "author": "Nathan Kinsinger", "author_id": 20045, "author_profile": "https://Stackoverflow.com/users/20045", "pm_score": 3, "selected": false, "text": "[NSApp activateIgnoringOtherApps:YES];\n[[self window] makeKeyAndOrderFront:self];\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2183/" ]
152,376
<p>How do I set the background colour of items in a list box dynamically? i.e. there is some property on my business object that I'm binding too, so based on some business rules I want the background colour to be different?</p> <pre><code> &lt;ListBox Background="Red"&gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType="ListBoxItem"&gt; &lt;Setter Property="Background" Value="Red"/&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal" Margin="5"&gt; &lt;TextBlock VerticalAlignment="Bottom" FontFamily="Comic Sans MS" FontSize="12" Width="70" Text="{Binding Name}" /&gt; &lt;TextBlock VerticalAlignment="Bottom" FontFamily="Comic Sans MS" FontSize="12" Width="70" Text="{Binding Age}" /&gt; &lt;/StackPanel&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; </code></pre> <p>EDIT: It says <a href="http://msdn.microsoft.com/en-us/library/cc189093(VS.95).aspx" rel="nofollow noreferrer">here</a></p> <blockquote> <p>In Silverlight, you must add x:Key attributes to your custom styles and reference them as static resources. Silverlight does not support implicit styles applied using the TargetType attribute value.</p> </blockquote> <p>Does this impact my approach?</p>
[ { "answer_id": 1123045, "author": "Stephen Price", "author_id": 24395, "author_profile": "https://Stackoverflow.com/users/24395", "pm_score": 0, "selected": false, "text": "<Border Margin=\"-2,-2,-2,0\" Background=\"{TemplateBinding Background}\" BorderBrush=\"{TemplateBinding BorderBrus...
2008/09/30
[ "https://Stackoverflow.com/questions/152376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
152,382
<p>We recently installed SVN 1.5.2 (with VisualSVN/Apache) on some of our servers / virtual machines, and now when I send a commandline command with username/password they don't get cached anymore. Before, we were running SVN 1.5.0 installed with CollabNet, on svn://, and the credentials were cached after the first command.</p> <p>So far, I'm finding difficulties in troubleshooting this. My situation is:</p> <ul> <li>SERVER_SVN (SVN 1.5.2 via svn://)</li> <li>SERVER_HTTP (SVN 1.5.2 via http://)</li> </ul> <p>Command from commandline to SERVER_SVN: credentials cached fine</p> <p>Same command to SERVER_HTTP: credentials are not cached</p> <p>So, it seems like an http/apache server problem... BUT, from Tortoise the credentials are cached to both servers, so it also seems a client call problem. I'm running out of ideas... </p> <p>A sample command sequence I use:</p> <pre><code> svn ls c:\mylocalfolderSVN --username foo --password bar svn ls c:\mylocalfolderSVN // this works svn ls c:\mylocalfolderHTTP --username foo --password bar svn ls c:\mylocalfolderHTTP // this fails </code></pre> <p>The last command stops and asks for authentication.</p> <p>Is credentials caching different between svn:// and http://, or did we miss something in the server configuration?</p> <p>Thanks in advance for any suggestion.</p>
[ { "answer_id": 1071691, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "svn ls REPOSITORY_URL" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21162/" ]
152,384
<p>I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design.</p> <p>Assume two tables, Category and CategoryDetail. Category contains the CategoryId (PK), ParentId and TemplateId. CategoryDetail contains the CategoryId (FK), LanguageId, Title and Description (in the appropriate language), with a combined PK of CategoryId and LanguageId.</p> <p>If I drag-and-drop these tables into the LinqToSQL designer, the resultant object model has Category with a collection of CategoryDetail objects, which should never be the case. I'd like to be able to filter on LanguageId at the DataContext level, meaning that the whole Category is encapsulated within Category.CategoryDetail, not all language version encapsulated within Category.CategoryDetails.</p> <p>This database worked fine on my old object library (an old-school custom BOL and DAL), but I fear that LinqToSQL would require this to change in order to give me the required result.</p> <p>What is the best way to make this relationship (and language filtering) as seamless as possible?</p>
[ { "answer_id": 152446, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 0, "selected": false, "text": "public partial class Category \n{\n public IEnumerable<CategoryDetail> GetDetailsByLanguage(string langID)\n {\n return t...
2008/09/30
[ "https://Stackoverflow.com/questions/152384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
152,405
<p>I have a program with two TForm classes and have added a TMainMenu to them each. I am then trying to merge them dynamically at run-time.</p> <p>My problem is that when they merge the menu items in the merged in TMainMenu now display images stored in the imagelist in the form they were merged into rather than the images stored in their original form's imagelist.</p> <p>Am I doing something wrong? is there a work around so that the menu item's continue to use the imagelist in the form they originated from?</p> <p>I use the merged-in form in a number of projects, otherwise a single shared imagelist would make sense.</p> <p>If I need to clarify anything, please say.</p> <p>Thanks</p> <p>Peter</p>
[ { "answer_id": 153799, "author": "onnodb", "author_id": 1037, "author_profile": "https://Stackoverflow.com/users/1037", "pm_score": 2, "selected": false, "text": "ImageIndex" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,416
<p>Given the following idioms:</p> <p>1)</p> <p><pre><code>variable = value1 if condition variable = value2</code></pre></p> <p>2)</p> <p><pre><code>variable = value2 if not condition variable = value1</pre></code></p> <p>3)</p> <p><pre><code>if condition variable = value2 else variable = value1</pre></code></p> <p>4)</p> <p><pre><code>if not condition variable = value1 else variable = value2</pre></code></p> <p>Which do you prefer, and why?</p> <p>We assume the most common execution path to be that of <code>condition</code> being false.</p> <p>I tend to learn towards using 1), although I'm not exactly sure why I like it more.</p> <p><em>Note: The following examples may be simpler&mdash;and thus possibly more readable&mdash;but not all languages provide such syntax, and they are not suitable for extending the variable assignment to include more than one statement in the future.</em></p> <pre><code>variable = condition ? value2 : value1 ... variable = value2 if condition else value1</code></pre>
[ { "answer_id": 152424, "author": "Jarrett Meyer", "author_id": 5834, "author_profile": "https://Stackoverflow.com/users/5834", "pm_score": 0, "selected": false, "text": "switch" }, { "answer_id": 152431, "author": "Matthew Scharley", "author_id": 15537, "author_profil...
2008/09/30
[ "https://Stackoverflow.com/questions/152416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709/" ]
152,419
<p>I've added a custom soap header <code>&lt;MyApp:FOO&gt;</code> element to the <code>&lt;soap:Header&gt;</code> element and the requirments states that i must sign this element , how would one do that? <code>&lt;MyApp:FOO&gt;</code> contains a number of things (username, preferences, etc) that identifies a user on higher level. I've succesfully used a policy file and now a policyClass with CertificateAssertions and SoapFilters to sign wsu:Timestamp, wsu:action, wsu:MessageId etc. But now the <code>&lt;MyApp:FOO&gt;</code> element needs to signed aswell.</p> <p>What i've understood this far is that the element that needs to be signed must be indentified with a wsu:Id attribute and then transformed using xml-exc-c14n.</p> <p>So, how do I specify that the soap header should be signed aswell? This is the current class that i use for signing my message.</p> <pre><code>internal class FOOClientOutFilter: SendSecurityFilter { X509SecurityToken clientToken; public FOOClientOutFilter(SSEKCertificateAssertion parentAssertion) : base(parentAssertion.ServiceActor, true) { // Get the client security token. clientToken = X509TokenProvider.CreateToken(StoreLocation.CurrentUser, StoreName.My, "CN=TestClientCert"); // Get the server security token. serverToken = X509TokenProvider.CreateToken(StoreLocation.LocalMachine, StoreName.My, "CN=TestServerCert"); } public override void SecureMessage(SoapEnvelope envelope, Security security) { // Sign the SOAP message with the client's security token. security.Tokens.Add(clientToken); security.Elements.Add(new MessageSignature(clientToken)); } } </code></pre>
[ { "answer_id": 152522, "author": "Carl-Johan", "author_id": 15406, "author_profile": "https://Stackoverflow.com/users/15406", "pm_score": 2, "selected": false, "text": " public override void SecureMessage(SoapEnvelope envelope, Security security)\n {\n //EncryptedData data =...
2008/09/30
[ "https://Stackoverflow.com/questions/152419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15406/" ]
152,435
<p>Does anyone have tools or experience with code coverage for PL/SQL. I believe this is possible using DBMS_PROFILER?</p>
[ { "answer_id": 214018, "author": "Dilshod Tadjibaev", "author_id": 29122, "author_profile": "https://Stackoverflow.com/users/29122", "pm_score": 1, "selected": false, "text": "select exec.cnt/total.cnt * 100 \"Code% coverage\"\nfrom (select count(1) cnt\n from plsql_profiler_data d...
2008/09/30
[ "https://Stackoverflow.com/questions/152435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3839/" ]
152,439
<p>I am actually new to this forum and I kept trying for a few days to find an easy way to copy an entire LDAP subtree to another tree. Since I couldn't find anything useful, i thought of dropping a question here as well. Does anybody know how to do this programatically ?</p> <p>For normal operations like add, remove, search, I've been using Spring LDAP. </p> <p>Thanks a lot !</p>
[ { "answer_id": 152529, "author": "Stefan Gehrig", "author_id": 11354, "author_profile": "https://Stackoverflow.com/users/11354", "pm_score": 1, "selected": false, "text": "function copySubtree(oldDn, newDn)\n{\n copyNode(oldDn, newDn); // the new node will be created here\n if (nod...
2008/09/30
[ "https://Stackoverflow.com/questions/152439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,441
<p>Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?</p>
[ { "answer_id": 269397, "author": "GregW", "author_id": 17783, "author_profile": "https://Stackoverflow.com/users/17783", "pm_score": 1, "selected": false, "text": "py.test" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3839/" ]
152,447
<p>When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still need to wait for it to finish. If I kick off the backup or restore with a script, is there a way to monitor the progress, or do I just sit back and wait for it to finish (hoping that nothing has gone wrong?)</p> <p><strong>Edited:</strong> My need is specifically to be able to monitor the backup or restore progress completely separate from the session where the backup or restore was initiated.</p>
[ { "answer_id": 152477, "author": "Veldmuis", "author_id": 18826, "author_profile": "https://Stackoverflow.com/users/18826", "pm_score": 8, "selected": false, "text": "SELECT r.session_id,r.command,CONVERT(NUMERIC(6,2),r.percent_complete)\nAS [Percent Complete],CONVERT(VARCHAR(20),DATEADD...
2008/09/30
[ "https://Stackoverflow.com/questions/152447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18826/" ]
152,457
<p>This was a question raised by one of the software engineers in my organisation. I'm interested in the broadest definition.</p>
[ { "answer_id": 152863, "author": "Peter Wone", "author_id": 1715673, "author_profile": "https://Stackoverflow.com/users/1715673", "pm_score": 10, "selected": false, "text": "netstat -an -p tcp" }, { "answer_id": 153015, "author": "Mark Brackett", "author_id": 2199, "a...
2008/09/30
[ "https://Stackoverflow.com/questions/152457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199234/" ]
152,462
<p>I need to run a Java application, which we are trying to port to Java 6, on an NT box.</p> <p>I manage to run java 5 on it (although not officially supported), but when I try to run java 6 I get the following error:</p> <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre1.6.0_05\bin\awt.dll: The specified procedure could not be found at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at sun.security.action.LoadLibraryAction.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.NativeLibLoader.loadLibraries(Unknown Source) at sun.awt.DebugHelper.&lt;clinit&gt;(Unknown Source) at java.awt.EventQueue.&lt;clinit&gt;(Unknown Source) at javax.swing.SwingUtilities.invokeLater(Unknown Source) at ui.sequencer.test.WindowTest.main(WindowTest.java:136) </code></pre> <p>Anybody has any idea how to solve this?</p> <p>This persists even when I move the java executables to another directory with no spaces in its name.</p> <p>p.s. I know, I should upgrade, but it's not up to me or my company - this is a very very bug huge gigantic company we work with, and they intend to keep NT for another 5 years.</p>
[ { "answer_id": 152607, "author": "Roel Spilker", "author_id": 12634, "author_profile": "https://Stackoverflow.com/users/12634", "pm_score": 1, "selected": false, "text": "java -Djava.awt.headless=true" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11699/" ]
152,469
<p>I want to make a login system using ASP.NET (MVC).</p> <p>On the internet, I found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider.</p> <p>However, I want to roll my own. I don't want to use the built-in membership provider, as it only seems to work on MS SQL, and I don't like the idea of having a few foreign tables in my database.</p> <p>I could probably think of something, but I need a few pointers in the right direction. It does not have to be high-security, but just regular common-sense security.</p> <p>And I have a few direct questions:</p> <ol> <li><p>A lot of systems seem to have the Session ID stored in a user table. I guess this is to tie a session to a user to prevent hijacking. Do check this every time a user enters a page? And what do I do if the session expires?</p></li> <li><p>Hashing, salting, what does it do? I know of MD5 hashing and I have used it before. But not salting.</p></li> <li><p>Best practices for cookies?</p></li> </ol>
[ { "answer_id": 152523, "author": "mattlant", "author_id": 14642, "author_profile": "https://Stackoverflow.com/users/14642", "pm_score": 4, "selected": true, "text": "if(SecurityHelper.LoginUser(txtUsername.Text, txtPassword.Text))\n{ \n FormsAuthentication.RedirectFromLoginPage(txt...
2008/09/30
[ "https://Stackoverflow.com/questions/152469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,483
<p>Is there a way to print all methods of an object in JavaScript?</p>
[ { "answer_id": 152499, "author": "WalkingRandomly", "author_id": 1856916, "author_profile": "https://Stackoverflow.com/users/1856916", "pm_score": 1, "selected": false, "text": "for (var myprop in navigator){\n document.write(myprop+\": \"+navigator[myprop]+\"<br>\")\n}\n" }, { "...
2008/09/30
[ "https://Stackoverflow.com/questions/152483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21132/" ]
152,487
<p>There is a MSBuild script, that includes number if Delphi and C# projects, unit tests etc. </p> <p>The problem is: how to mark build failed if warnings were raised (for testing purposes, not for release builds)? Using LogError instead of LogWarning in custom tasks seems to be not a good option, because the build should test as much as it's able (until real error) to report as much warnings as possible in a time (build project is using in CruiseControl.NET).</p> <p>May be, the solution is to create my own logger that would store warnings flag inside, but I cannot find if there is a way to read this flag in the end of build?</p> <p>P.S. There is no problem to fail the build immediately after receiving a warning (Delphi compiler output is processed by custom task, and /warnaserror could be used for C#), but the desired behavior is "build everything; collect all warnings; fail the build" to report about all warnings, not only about the first one.</p> <p><strong>P.P.S. As far as I really need not number of warnings, but just flag of their presence, I decided to simplify signaling mechanism, and use trivial Mutex instead of shared memory. Code is below:</strong></p> <pre><code>using System; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using System.Threading; namespace Intrahealth.Build.WarningLogger { public sealed class WarningLoggerCheck : Task { public override bool Execute() { Log.LogMessage("WarningLoggerCheck:" + mutexName + "..."); result = false; Mutex m = null; try { m = Mutex.OpenExisting(mutexName); } catch (WaitHandleCannotBeOpenedException) { result = true; } catch (Exception) { } if (result) Log.LogMessage("WarningLoggerCheck PASSED"); else Log.LogError("Build log contains warnings. Build is FAILED"); return result; } private bool result = true; [Output] public bool Result { get { return result; } } private string mutexName = "WarningLoggerMutex"; public string MutexName { get { return mutexName; } set { mutexName = value ?? "WarningLoggerMutex"; } } } public class WarningLogger : Logger { internal static int warningsCount = 0; private string mutexName = String.Empty; private Mutex mutex = null; public override void Initialize(IEventSource eventSource) { eventSource.WarningRaised += new BuildWarningEventHandler(eventSource_WarningRaised); } private void SetMutex() { if (mutexName == String.Empty) { mutexName = "WarningLoggerMutex"; if (this.Parameters != null &amp;&amp; this.Parameters != String.Empty) { mutexName = this.Parameters; } } mutex = new Mutex(false, mutexName); } void eventSource_WarningRaised(object sender, BuildWarningEventArgs e) { if (e.Message != null &amp;&amp; e.Message.Contains("MSB3146")) return; if (e.Code != null &amp;&amp; e.Code.Equals("MSB3146")) return; if (warningsCount == 0) SetMutex(); warningsCount++; } } } </code></pre>
[ { "answer_id": 152538, "author": "kenny", "author_id": 3225, "author_profile": "https://Stackoverflow.com/users/3225", "pm_score": 1, "selected": false, "text": "msbuild.exe %~nx1 /t:Rebuild /p:Configuration=Release >> %MrB-BUILDLOG%\nfindstr /r /c:\"[1-9][0-9]* Error(s)\" >> %MrB-BUILDL...
2008/09/30
[ "https://Stackoverflow.com/questions/152487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11391/" ]
152,514
<p>I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter).</p> <p>Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any Linux box.</p> <p>There were some valid arguments about details of the file renaming.</p> <ol> <li><p>I think files with the same lowercase names should be overwritten; it's the user's problem. When checked out on a case-ignoring file system, it would overwrite the first one with the latter, too.</p></li> <li><p>I would consider A-Z characters and transform them to a-z, everything else is just calling for problems (at least with source code).</p></li> <li><p>The script would be needed to run a build on a Linux system, so I think changes to CVS or Subversion version control files should be omitted. After all, it's just a scratch checkout. Maybe an "export" is more appropriate.</p></li> </ol>
[ { "answer_id": 152519, "author": "vividos", "author_id": 23740, "author_profile": "https://Stackoverflow.com/users/23740", "pm_score": 3, "selected": false, "text": "#!/bin/bash\n# First, rename all folders\nfor f in `find . -depth ! -name CVS -type d`; do\n g=`dirname \"$f\"`/`basenam...
2008/09/30
[ "https://Stackoverflow.com/questions/152514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23740/" ]
152,537
<p>I need to add the ability for users of my software to select records by character ranges.<br> How can I write a query that returns all widgets from a table whose name falls in the range Ba-Bi for example?</p> <p>Currently I'm using greater than and less than operators, so the above example would become:</p> <pre><code>select * from widget where name &gt;= 'ba' and name &lt; 'bj' </code></pre> <p>Notice how I have "incremented" the last character of the upper bound from i to j so that "bike" would not be left out.</p> <p>Is there a generic way to find the next character after a given character based on the field's collation or would it be safer to create a second condition?</p> <pre><code>select * from widget where name &gt;= 'ba' and (name &lt; 'bi' or name like 'bi%') </code></pre> <p>My application needs to support localization. How sensitive is this kind of query to different character sets?</p> <p>I also need to support both MSSQL and Oracle. What are my options for ensuring that character casing is ignored no matter what language appears in the data?</p>
[ { "answer_id": 152728, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 0, "selected": false, "text": "MY_SUBSTRING(name, 2) >= 'ba' AND MY_SUBSTRING(name, 2) <= 'bi'\n" }, { "answer_id": 152786, "author": "Geor...
2008/09/30
[ "https://Stackoverflow.com/questions/152537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8799/" ]
152,541
<p>I have a stored procedure that looks like:</p> <pre><code>CREATE PROCEDURE dbo.usp_TestFilter @AdditionalFilter BIT = 1 AS SELECT * FROM dbo.SomeTable T WHERE T.Column1 IS NOT NULL AND CASE WHEN @AdditionalFilter = 1 THEN T.Column2 IS NOT NULL </code></pre> <p>Needless to say, this doesn't work. How can I activate the additional where clause that checks for the @AdditionalFilter parameter? Thanks for any help.</p>
[ { "answer_id": 152551, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 1, "selected": false, "text": "CREATE PROCEDURE dbo.usp_TestFilter\n @AdditionalFilter BIT = 1\nAS\n SELECT *\n FROM dbo.SomeTable T\n WHERE...
2008/09/30
[ "https://Stackoverflow.com/questions/152541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
152,555
<p>I've always used a <code>*.h</code> file for my class definitions, but after reading some boost library code, I realised they all use <code>*.hpp</code>. I've always had an aversion to that file extension, I think mainly because I'm not used to it.</p> <p>What are the advantages and disadvantages of using <code>*.hpp</code> over <code>*.h</code>?</p>
[ { "answer_id": 152557, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 6, "selected": false, "text": "*.h" }, { "answer_id": 152565, "author": "slashmais", "author_id": 15161, "author_profile": "https://...
2008/09/30
[ "https://Stackoverflow.com/questions/152555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/986/" ]
152,580
<p>How do I check if an object is of a given type, or if it inherits from a given type?</p> <p>How do I check if the object <code>o</code> is of type <code>str</code>?</p> <hr /> <p><sub>Beginners often wrongly expect the string to <em>already be</em> &quot;a number&quot; - either expecting Python 3.x <code>input</code> to convert type, or expecting that a string like <code>'1'</code> is <em>also simultaneously</em> an integer. This is the wrong canonical for those questions. Please carefully read the question and then use <a href="https://stackoverflow.com/questions/354038">How do I check if a string represents a number (float or int)?</a>, <a href="https://stackoverflow.com/questions/20449427/">How can I read inputs as numbers?</a> and/or <a href="https://stackoverflow.com/questions/23294658/">Asking the user for input until they give a valid response</a> as appropriate.</sub></p>
[ { "answer_id": 152583, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 4, "selected": false, "text": "isinstance(o, str)\n" }, { "answer_id": 152592, "author": "Herge", "author_id": 14102, "autho...
2008/09/30
[ "https://Stackoverflow.com/questions/152580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14102/" ]
152,585
<p>What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?</p>
[ { "answer_id": 152599, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 6, "selected": false, "text": "request.get?" }, { "answer_id": 152652, "author": "Ben Scofield", "author_id": 6478, "author_profile...
2008/09/30
[ "https://Stackoverflow.com/questions/152585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18768/" ]
152,586
<p>I want to test ASP.NET application using NUnit, but it seems WebConfigurationManager.ConnectionStrings collection is empty when running from NUnit GUI.</p> <p>Could you tell me how to initialize this collection (probably in [SetUp] function of [TestFixture])? Should I copy Web.config somethere?</p> <p>Thank you!</p>
[ { "answer_id": 266119, "author": "Martin Brown", "author_id": 20553, "author_profile": "https://Stackoverflow.com/users/20553", "pm_score": 3, "selected": false, "text": "\\bin\\debug\\MyTests.dll" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11256/" ]
152,602
<p>Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"?</p> <ol> <li>f arg (obj.DoStuff())</li> <li>f arg &lt;| obj.DoStuff()</li> </ol>
[ { "answer_id": 152933, "author": "Brian", "author_id": 19299, "author_profile": "https://Stackoverflow.com/users/19299", "pm_score": 4, "selected": true, "text": "raise <| new FooException(\"blah\")\n" }, { "answer_id": 300465, "author": "namin", "author_id": 34596, "...
2008/09/30
[ "https://Stackoverflow.com/questions/152602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21182/" ]
152,613
<p>I have a specialized list that holds items of type <code>IThing</code>:</p> <pre><code>public class ThingList : IList&lt;IThing&gt; {...} public interface IThing { Decimal Weight { get; set; } Decimal Velocity { get; set; } Decimal Distance { get; set; } Decimal Age { get; set; } Decimal AnotherValue { get; set; } [...even more properties and methods...] } </code></pre> <p>Sometimes I need to know the maximum or minimum of a certain property of all the things in the list. Because of "Tell don't ask" we let the List figure it out:</p> <pre><code>public class ThingList : IList&lt;IThing&gt; { public Decimal GetMaximumWeight() { Decimal result = 0; foreach (IThing thing in this) { result = Math.Max(result, thing.Weight); } return result; } } </code></pre> <p>Thats very nice. But sometimes I need the minimum weight, sometimes the maximum velocity and so on. I don't want a <code>GetMaximum*()/GetMinimum*()</code> pair for every single property.</p> <p>One solution would be reflection. Something like (hold your nose, strong code smell!):</p> <pre><code>Decimal GetMaximum(String propertyName); Decimal GetMinimum(String propertyName); </code></pre> <p>Are there any better, less smelly ways to accomplish this?</p> <p>Thanks, Eric</p> <p>Edit: @Matt: .Net 2.0</p> <p><strike>Conclusion: There is no better way for .Net 2.0 (with Visual Studio 2005). Maybe we should move to .Net 3.5 and Visual Studio 2008 sometime soon. Thanks, guys.</strike></p> <p>Conclusion: There are diffent ways that are far better than reflection. Depending on runtime and C# version. Have a look at Jon Skeets answer for the differences. All answers are are very helpful.</p> <p>I will go for Sklivvz suggestion (anonymous methods). There are several code snippets from other people (Konrad Rudolph, Matt Hamilton and Coincoin) which implement Sklivvz idea. I can only "accept" one answer, unfortunately.</p> <p>Thank you very much. You can all feel "accepted", altough only Sklivvz gets the credits ;-)</p>
[ { "answer_id": 152619, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": false, "text": "Decimal result = myThingList.Max(i => i.Weight);\n" }, { "answer_id": 152624, "author": "Konrad Rudolph", ...
2008/09/30
[ "https://Stackoverflow.com/questions/152613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8976/" ]
152,643
<p>For an <code>std::map&lt;std::string, std::string&gt; variables</code>, I'd like to do this:</p> <pre><code>BOOST_CHECK_EQUAL(variables["a"], "b"); </code></pre> <p>The only problem is, in this context <code>variables</code> is <code>const</code>, so <code>operator[]</code> won't work :(</p> <p>Now, there are several workarounds to this; casting away the <code>const</code>, using <code>variables.count("a") ? variables.find("a")-&gt;second : std::string()</code> or even making a function wrapping that. None of these seem to me to be as nice as <code>operator[]</code>. What should I do? Is there a standard way of doing this (beautifully)?</p> <p><strong>Edit:</strong> Just to state the answer that none of you want to give: No, there is no convenient, beautiful, standard way of doing this in C++. I will have to implement a support function.</p>
[ { "answer_id": 152658, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "find" }, { "answer_id": 152660, "author": "xtofl", "author_id": 6610, "author_profile": "https://...
2008/09/30
[ "https://Stackoverflow.com/questions/152643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2971/" ]
152,664
<p>I have many items inside a list control. I want each item to have a different item template depending on the type of the item. So the first item in the list is a ObjectA type and so I want it to be rendered with ItemTemplateA. Second item is a ObjectB type and so I want it to have ItemTemplateB for rendering. At the moment I can only use the ItemTemplate setting to define one template for them all. Any way to achieve this?</p>
[ { "answer_id": 152779, "author": "rudigrobler", "author_id": 5147, "author_profile": "https://Stackoverflow.com/users/5147", "pm_score": 5, "selected": true, "text": "ItemTemplateSelector" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6276/" ]
152,670
<p>Is it possible to prevent the Windows Installer from running every time Access 2003 and Access 2007 are started, when they are both installed on the same machine at the same time..?</p> <p>Like many developers I need to run more than 1 version of MS Access. I have just installed Access 2007. If I open Access 2003 and then open Access 2007 I have to wait 3mins for the 'Configuring Microsoft Office Enterprise 2007..." dialog. Then if I open Access 2003 again it takes another 30secs or so to configure that. </p> <p>PLEASE NOTE: I am using shortcuts to open the files that include the full path to Access. Eg to open Access 2007:</p> <pre><code> "C:\program files\microsoft office 12\office12\msaccess.exe" "C:\test.accdb" </code></pre> <p>and for 2003:</p> <pre><code> "C:\program files\microsoft office 11\office11\msaccess.exe" "C:\test.mdb" </code></pre>
[ { "answer_id": 1450798, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "reg add HKCU\\Software\\Microsoft\\Office\\11.0\\Word\\Options /v NoReReg /t REG_DWORD /d 1\n\nreg add HKCU\\Software\\Micros...
2008/09/30
[ "https://Stackoverflow.com/questions/152670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10422/" ]
152,675
<p>There is probably is simple fix for this but I currently have code similar to </p> <pre><code>dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close end if end try </code></pre> <p>However Visual Studio still warns me that the </p> <pre><code>if not IsNothing(dr) then dr.close end if </code></pre> <p>Can cause a NullReferenceException. What is the best way to mitigate this? I can't move the declaration into the try block.</p>
[ { "answer_id": 152715, "author": "Joseph Daigle", "author_id": 507, "author_profile": "https://Stackoverflow.com/users/507", "pm_score": 0, "selected": false, "text": "finally" }, { "answer_id": 152718, "author": "TcKs", "author_id": 20382, "author_profile": "https://...
2008/09/30
[ "https://Stackoverflow.com/questions/152675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11802/" ]
152,693
<p>I have an <strong>if</strong> condition which checks for value and the it throws new <strong>NumberFormatException</strong></p> <p>Is there any other way to code this</p> <pre><code>if (foo) { throw new NumberFormatException } // .. catch (NumberFormatException exc) { // some msg... } </code></pre>
[ { "answer_id": 152709, "author": "Burkhard", "author_id": 12860, "author_profile": "https://Stackoverflow.com/users/12860", "pm_score": 2, "selected": false, "text": "if(foo)\n{\n //some msg...\n} else\n{\n //do something else\n}\n" }, { "answer_id": 152716, "author": "Mark...
2008/09/30
[ "https://Stackoverflow.com/questions/152693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11114/" ]
152,694
<p>I'm setting up a new project using CruiseControl.net 1.4.</p> <p>I see from <a href="http://confluence.public.thoughtworks.org/display/CCNETCOMM/Contributions" rel="nofollow noreferrer">ccnet contributions</a> that there are two options for a subversion repository number labeller - a feature that I would really like to make use of.</p> <p>1) SVNLabeller available from <a href="http://www.jcxsoftware.com/jcx/ccnet-dev" rel="nofollow noreferrer">jcxsoftware</a></p> <p>and</p> <p>2) Svnrevisionlabeller available from <a href="http://code.google.com/p/svnrevisionlabeller/" rel="nofollow noreferrer">google code</a></p> <p>My problem is that (1) claims support for ccnet 1.4 but I can't find any documentation on how to configure it.</p> <p>(2) comes with documentation but does not claim to support ccnet 1.4</p> <p>Can anyone help me with either how to configure SVNLabeller or tell me if Svnrevisionlabeller works with 1.4? </p>
[ { "answer_id": 2017464, "author": "VS.Php", "author_id": 245085, "author_profile": "https://Stackoverflow.com/users/245085", "pm_score": 1, "selected": false, "text": " <labeller type=\"SvnLabeller\">\n <MajorVersion>1</MajorVersion>\n <MinorVersion>2</MinorVersion>\n <BuildNum...
2008/09/30
[ "https://Stackoverflow.com/questions/152694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427/" ]
152,699
<p>In Python, you can do this:</p> <pre><code>import webbrowser webbrowser.open_new("http://example.com/") </code></pre> <p>It will open the passed in url in the default browser</p> <p>Is there a ruby equivalent?</p>
[ { "answer_id": 152765, "author": "Ken", "author_id": 20621, "author_profile": "https://Stackoverflow.com/users/20621", "pm_score": 2, "selected": false, "text": "require 'win32ole'\nshell = WIN32OLE.new('Shell.Application')\nshell.ShellExecute(...)\n" }, { "answer_id": 152951, ...
2008/09/30
[ "https://Stackoverflow.com/questions/152699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147/" ]
152,708
<p>I needed to find all the files that contained a specific string pattern. The first solution that comes to mind is using <em>find</em> piped with <em>xargs grep</em>:</p> <pre><code>find . -iname '*.py' | xargs grep -e 'YOUR_PATTERN' </code></pre> <p>But if I need to find patterns that spans on more than one line, I'm stuck because vanilla grep can't find multiline patterns.</p>
[ { "answer_id": 152711, "author": "Oli", "author_id": 22035, "author_profile": "https://Stackoverflow.com/users/22035", "pm_score": 8, "selected": true, "text": "find . -iname '*.py' | xargs pcregrep -M '_name.*\\n.*_description'\n" }, { "answer_id": 152755, "author": "ayaz", ...
2008/09/30
[ "https://Stackoverflow.com/questions/152708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22035/" ]
152,714
<p>I am relatively new to matchers. I am toying around with <a href="http://code.google.com/p/hamcrest/" rel="noreferrer">hamcrest</a> in combination with JUnit and I kinda like it.</p> <p>Is there a way, to state that one of multiple choices is correct?</p> <p>Something like</p> <pre><code>assertThat( result, is( either( 1, or( 2, or( 3 ) ) ) ) ) //does not work in hamcrest </code></pre> <p>The method I am testing returns one element of a collection. The list may contain multiple candidates. My current implementation returns the first hit, but that is not a requirement. I would like my testcase to succeed, if any of the possible candidates is returned. How would you express this in Java?</p> <p>(I am open to hamcrest-alternatives)</p>
[ { "answer_id": 153198, "author": "marcospereira", "author_id": 4600, "author_profile": "https://Stackoverflow.com/users/4600", "pm_score": 8, "selected": true, "text": "assertThat(result, anyOf(equalTo(1), equalTo(2), equalTo(3)))\n" }, { "answer_id": 6554732, "author": "Tyle...
2008/09/30
[ "https://Stackoverflow.com/questions/152714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1870/" ]
152,729
<p>If you use Image.Save Method to save an image to a EMF/WMF, you get an exception (<a href="http://msdn.microsoft.com/en-us/library/ktx83wah.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ktx83wah.aspx</a>)</p> <p>Is there another way to save the image to an EMF/WMF? Are there any encoders available?</p>
[ { "answer_id": 152830, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 2, "selected": false, "text": "Metafile" }, { "answer_id": 688593, "author": "Community", "author_id": -1, "author_profile": "http...
2008/09/30
[ "https://Stackoverflow.com/questions/152729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12192/" ]
152,744
<p>in Erlang I have a supervisor-tree of processes, containing one that accepts tcp/ip connections. For each incoming connection I spawn a new process. Should this process be added to the supervisor tree or not?</p> <p>Regards, Steve</p>
[ { "answer_id": 154457, "author": "Adam Lindberg", "author_id": 2457, "author_profile": "https://Stackoverflow.com/users/2457", "pm_score": 2, "selected": false, "text": "simple_one_for_one" }, { "answer_id": 178426, "author": "archaelus", "author_id": 9040, "author_pr...
2008/09/30
[ "https://Stackoverflow.com/questions/152744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23760/" ]
152,745
<p>I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. </p> <p>I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as:</p> <pre><code>vector&lt;vector&lt;double&gt; &gt; matrix(n,vector&lt;double&gt;(n)); </code></pre> <p>and accessed through <code>matrix[i][j]</code> is between 5% and 100% slower to access than an array declared as:</p> <pre><code>double *matrix = new double[n*n]; </code></pre> <p>accessed through an inlined index function <code>matrix[index(i,j)]</code>, where <code>index(i,j)</code> evaluates to i+n*j. Other ways of arranging a 2-D array without STL - an array of n pointers to the start of each row, or defining the whole thing on the stack as a constant size <code>matrix[n][n]</code> - run at almost exactly the same speed as the index function method.</p> <p>Recent GCC versions (> 4.0) seem to be able to compile the STL vector-of-vectors to nearly the same efficiency as the non-STL code when optimisations are turned on, but this is somewhat machine-dependent.</p> <p>I'd like to use STL if possible, but will have to choose the fastest solution. Does anyone have any experience in optimising STL with GCC?</p>
[ { "answer_id": 152761, "author": "PierreBdR", "author_id": 7136, "author_profile": "https://Stackoverflow.com/users/7136", "pm_score": 3, "selected": false, "text": "valarray<double> a;\n" }, { "answer_id": 152776, "author": "Mike Dimmick", "author_id": 6970, "author_...
2008/09/30
[ "https://Stackoverflow.com/questions/152745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23732/" ]
152,757
<p>I am wondering whether it is safe to mix jdk 1.5 and 1.6 (Java 6) object serialization (biderctional communication). I searched for an explicit statement from sun concerning this question but did not succeed. So, besides the technical feasability I am searching for an "official" statement concerning the problem.</p>
[ { "answer_id": 152792, "author": "Tom", "author_id": 22850, "author_profile": "https://Stackoverflow.com/users/22850", "pm_score": 4, "selected": false, "text": "private static final long serialVersionUID = 8683452581122892189L;\n" }, { "answer_id": 155521, "author": "oxbow_l...
2008/09/30
[ "https://Stackoverflow.com/questions/152757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,770
<p>Is there any facility of transposing rows to columns in SQL Server (it is possible in MS-Access)? I was befuddled because this facility is available in MS-Access but not in SQL Server. Is it by design that this feature has not been included in SQL Server?</p>
[ { "answer_id": 152963, "author": "Corey Trager", "author_id": 9328, "author_profile": "https://Stackoverflow.com/users/9328", "pm_score": 3, "selected": true, "text": "color red\nsize big\ncity Chicago\n" }, { "answer_id": 169412, "author": "Codewerks", "author_id": 177...
2008/09/30
[ "https://Stackoverflow.com/questions/152770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4021/" ]
152,774
<p>What's the best way to trim a DateTime object to a specific precision? For instance, if I have a DateTime with a value of '2008-09-29 09:41:43', but I only want it's precision to be to the minute, is there any better way to do it than this?</p> <pre><code>private static DateTime TrimDateToMinute(DateTime date) { return new DateTime( date.Year, date.Month, date.Day, date.Hour, date.Minute, 0); } </code></pre> <p>What I would really want is to make it variable so that I could set its precision to the second, minute, hour, or day.</p>
[ { "answer_id": 152803, "author": "Rikalous", "author_id": 4271, "author_profile": "https://Stackoverflow.com/users/4271", "pm_score": 3, "selected": false, "text": "public enum DateTimePrecision\n{\n Hour, Minute, Second\n}\n\npublic static DateTime TrimDate(DateTime date, DateTimePreci...
2008/09/30
[ "https://Stackoverflow.com/questions/152774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21807/" ]
152,807
<p><strong>UPDATE:</strong> i updated the code and problem description to reflect my changes. </p> <p>I know now that i'm trying a Socket operation on nonsocket. or that my fd_set is not valid since:</p> <p><code>select</code> returns -1 and <code>WSAGetLastError()</code>returns 10038. </p> <p>But i can't seem to figure out what it is. Platform is Windows. I have not posted the <code>WSAStartup</code> part.</p> <pre><code>int loop = 0; FILE *output int main() { fd_set fd; output = _popen("tail -f test.txt","r"); while(forceExit == 0) { FD_ZERO(&amp;fd); FD_SET(_fileno(output),&amp;fd); int returncode = select(_fileno(output)+1,&amp;fd,NULL,NULL,NULL); if(returncode == 0) { printf("timed out"); } else if (returncode &lt; 0) { printf("returncode: %d\n",returncode); printf("Last Error: %d\n",WSAGetLastError()); } else { if(FD_ISSET(_fileno(output),&amp;fd)) { if(fgets(buff, sizeof(buff), output) != NULL ) { printf("Output: %s\n", buff); } } else { printf("."); } } Sleep(500); } return 0; } </code></pre> <p>The new outcome now is of course the print out of the returncode and the last error.</p>
[ { "answer_id": 152831, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 0, "selected": false, "text": " int select(int nfds, fd_set *readfds, fd_set *writefds,\n fd_set *exceptfds, struct timeval *timeout)...
2008/09/30
[ "https://Stackoverflow.com/questions/152807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10010/" ]
152,822
<p>I want something like this:</p> <pre><code>&lt;msxsl:script language="C#"&gt; ??? getNodes() { ... return ... } &lt;/msxsl:script&gt; &lt;xsl:for-each select="user:getNodes()"&gt; ... &lt;/xsl:for-each&gt; </code></pre> <p>What return type should i use for <code>getNodes()</code> and what should i put in it's body?</p>
[ { "answer_id": 414009, "author": "Boaz", "author_id": 2892, "author_profile": "https://Stackoverflow.com/users/2892", "pm_score": 4, "selected": true, "text": "<msxsl:script language=\"C#\">\n XPathNodeIterator getNodes() \n { \n XmlDocument doc = new XmlDocument();\n doc.P...
2008/09/30
[ "https://Stackoverflow.com/questions/152822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20310/" ]
152,823
<p>XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling <code>.htaccess</code> files is such a nightmare.</p> <p>My problem: I've got a PHP application that requires apache/php to search for an <code>/includes/</code> directory contained within the application. To do this, <code>.htaccess</code> files must be allowed in Apache and the <code>.htaccess</code> file must specify exactly where the includes directory is.</p> <p>Problem is, I can't get my Apache config to view these <code>.htaccess</code> files. I had major hassles installing this app at uni and getting the admins there to help with the setup. This shouldn't be so hard but for some reason I just can't get Apache to play nice.</p> <p>This is my setup:</p> <p><code>c:\xampp</code> <code>c:\xampp\htdocs</code> <code>c:\xampp\apache\conf\httpd.conf</code> - where I've made the changes listed below <code>c:\xampp\apache\bin\php.ini</code> - where changes to this file affect the PHP installation It is interesting to note that <code>c:\xampp\php\php.ini</code> changes mean nothing - this is NOT the ini that affects the PHP installation.</p> <p>The following lines are additions I've made to the <code>httpd.conf</code> file</p> <pre><code>#AccessFileName .htaccess AccessFileName htaccess.txt # # The following lines prevent .htaccess and .htpasswd # files from being viewed by Web clients. # #&lt;Files ~ &quot;^\.ht&quot;&gt; &lt;Files ~ &quot;^htaccess\.&quot;&gt; Order allow,deny Deny from all &lt;/Files&gt; &lt;Directory &quot;c:/xampp/htdocs&quot;&gt; # # AllowOverride controls what directives may be placed in # .htaccess files. # It can be &quot;All&quot;, &quot;None&quot;, or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all &lt;/Directory&gt; </code></pre> <p>The following is the entire <code>.htaccess</code> file contained in: <code>c:\xampp\htdocs\application\htaccess.txt</code></p> <pre><code>&lt;Files ~ &quot;\.inc$&quot;&gt; Order deny,allow Deny from all &lt;/Files&gt; php_value default_charset &quot;UTF-8&quot; php_value include_path &quot;.;c:\xampp\htdocs\application\includes&quot; php_value register_globals 0 php_value magic_quotes_gpc 0 php_value magic_quotes_runtime 0 php_value magic_quotes_sybase 0 php_value session.use_cookies 1 php_value session.use_only_cookies 0 php_value session.use_trans_sid 1 php_value session.gc_maxlifetime 3600 php_value arg_separator.output &quot;&amp;amp;&quot; php_value url_rewriter.tags &quot;a=href,area=href,frame=src,input=src,fieldset=&quot; </code></pre> <p>The includes directory exists at the location specified.</p> <p>When I try to access the application I receive the following error:</p> <pre><code>Warning: require(include.general.inc) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\application\menu\logon.php on line 21 </code></pre> <p>Fatal error: require() [function.require]: Failed opening required <code>include.general.inc</code> (include_path='.;C:\xampp\php\pear\random') in <code>C:\xampp\htdocs\application\menu\logon.php</code> on line 21</p> <p>The include path <code>c..\random\</code> is specified in the <code>php.ini</code> file listed above. The XAMPP install fails to allow another include path as specified in the <code>htaccess.txt</code> file.</p> <p>I'm guessing there's probably an error with the <code>httpd.conf</code> OR the <code>htaccess.txt</code> file.. but it doesn't seem to be reading the <code>.htaccess</code> file. I've tried to be as thorough as possible so forgive the verbosity of the post.</p> <p>Now I know a workaround could be to simply add the include_path to the PHP file, but I'm not going to have access to the <code>php.ini</code> file on the location I plan to deploy my app. I will, however, be able to request the server admin allows <code>.htaccess</code> files.</p> <p>renamed <code>htacces.txt</code> to <code>.htaccess</code> and ammended the appropriate directives in the <code>httpd.conf</code> file and all seems to work. The application suggested the naming of <code>htaccess.txt</code> and the ammended directives in the httpd. These are obviously wrong (at least for a XAMPP stack).</p> <p>By the way, using ini_set() is a much friendlier way if the app needs to be deployed to multiple locations so thanks especially for that pointer.</p>
[ { "answer_id": 32487080, "author": "Deepak", "author_id": 4490437, "author_profile": "https://Stackoverflow.com/users/4490437", "pm_score": 1, "selected": false, "text": "open file ...\\xampp\\apache\\conf\\httpd.conf\n\nfind line \"LoadModule rewrite_module modules/mod_rewrite.so\"\n\ni...
2008/09/30
[ "https://Stackoverflow.com/questions/152823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10583/" ]
152,834
<p>I need to know the default port settings for the following services</p> <ol> <li>SQL Server</li> <li>SQL Browser</li> <li>SQL Reporting services</li> <li>SQL Analysis services</li> </ol> <p>I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008)</p> <p>Also let me know whether the default port setting will change based on sql server versions.</p>
[ { "answer_id": 152902, "author": "Mike Dimmick", "author_id": 6970, "author_profile": "https://Stackoverflow.com/users/6970", "pm_score": 3, "selected": false, "text": "cliconfg" }, { "answer_id": 5035845, "author": "Jared Moore", "author_id": 425852, "author_profile"...
2008/09/30
[ "https://Stackoverflow.com/questions/152834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22162/" ]
152,837
<p>How can I write an insert statement which includes the &amp; character? For example, if I wanted to insert "J&amp;J Construction" into a column in the database.</p> <p>I'm not sure if it makes a difference, but I'm using Oracle 9i.</p>
[ { "answer_id": 152849, "author": "stjohnroe", "author_id": 2985, "author_profile": "https://Stackoverflow.com/users/2985", "pm_score": 0, "selected": false, "text": "SET SCAN OFF\n" }, { "answer_id": 152852, "author": "hamishmcn", "author_id": 3590, "author_profile": ...
2008/09/30
[ "https://Stackoverflow.com/questions/152837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/466/" ]
152,866
<p>For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the main config file using the 'configSource' attribute. For example:</p> <pre><code>&lt;appSettings configSource="appSettings.config"/&gt; </code></pre> <p>and then placing all of the key/value pairs in that appSettings.config file instead of having this in-line in the main config file:</p> <pre><code>&lt;appSettings&gt; &lt;add key="FirstKey" value="FirstValue"/&gt; &lt;add key="SecondKey" value="SecondValue"/&gt; ... &lt;/appSettings&gt; </code></pre> <p>This typically works great with the application itself, but I run into problems when attempting to write unit tests that, for whatever reason, need to get at some value from a configuration section that is stored in one of these external files. (I understand that most of these would likley be considered "integration tests", as they are relying on the Configuration system, and I do have "pure unit tests" as well, but those are the not the problem. I'm really looking to test that these configuration values are retrieved correctly and impact behavior in the correct way).</p> <p>Due to how MSTest compiles and copies the output to obfuscated-looking folders that are different from every test run (rather than to the 'bin' folder like you might think), it never seems to be able to find those external files while the tests are executing. I've tried messing around with post build actions to make this work but with no luck. Is there a way to have these external files copied over into the correct output folder at run time?</p>
[ { "answer_id": 638298, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "DeploymentItem" }, { "answer_id": 42199914, "author": "Ghebrehiywet", "author_id": 4915864, "author_profil...
2008/09/30
[ "https://Stackoverflow.com/questions/152866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1680/" ]
152,869
<p>It is easy to highlight a selected datagrid row, by for example using toggleClass in the tr's click event. But how best to later remove the highlight after a different row has been selected? Iterating over all the rows to unhighlight them could become expensive for larger datagrids. I'd be interested in the simplest solution, as well as the most performant.</p> <p>Thanks,<br> Mike </p>
[ { "answer_id": 152877, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 2, "selected": false, "text": "$('.toggledClass').removeClass('toggledClass');\n" }, { "answer_id": 153102, "author": "nickf", "aut...
2008/09/30
[ "https://Stackoverflow.com/questions/152869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/785/" ]
152,871
<p>When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)?</p> <p>I'm not necessarily saying it's a bad thing, but rather that if they are <strike>essentially the same</strike> very similar then it becomes much easier to understand REST and the implications that such an architecture entails.</p> <p><strong>Update:</strong> Here are more specific details:</p> <ol> <li>REST resources are equivalent to public classes. Private classes/resources are simply not exposed.</li> <li>Resource state is equivalent to class public methods or fields. Private methods/fields/state is simply not exposed (this doesn't mean it's not there).</li> <li>While it is certainly true that REST does not retain client-specific state across requests, it <strong>does</strong> retain resource state across all clients. Resources <strong>have</strong> state, the same way classes have state.</li> <li>REST resources are are globally uniquely identified by a URI in the same way that server objects are globally uniquely identified by their database address, table name and primary key. Granted there isn't (yet) a URI to represent this, but you can easily construct one.</li> </ol>
[ { "answer_id": 153200, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 6, "selected": true, "text": "ToString()" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14731/" ]
152,887
<p>This has been bugging me for a long time -- how do I properly resolve a merge conflict within the SVN properties set on a directory? Say for instance there are two developers working on a project where svn:ignore is set on some directory. If both developers make changes to this property, when the second one updates, they will see a merge conflict.</p> <p>Unlike file merge conflicts, a single file is generated in the directory called "dir_conflicts.prej", which the second developer must read and manually correct. Usually, what I end up doing is reverting all my changes to the local copy, then re-setting these properties manually with the info in dir_conflicts.prej. However, this is rather cumbersome when dealing with a big list of URLs in an svn:externals property, as many of our projects use.</p> <p>There has got to be a better way to do this -- does anybody know how?</p>
[ { "answer_id": 36070180, "author": "jpllosa", "author_id": 5797400, "author_profile": "https://Stackoverflow.com/users/5797400", "pm_score": 0, "selected": false, "text": "dir_conflicts.prej" }, { "answer_id": 41954466, "author": "Ashwani Kumar", "author_id": 3522181, ...
2008/09/30
[ "https://Stackoverflow.com/questions/152887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14302/" ]
152,893
<p>We have a form that allows a user to dynamically add inputs for fields. For example if you have a form for tracking projects, you want to dynamically add tasks to that project. Just to clarify my language: you dynamically add inputs for the task field. The problem is, we have 50 of those fields. Our current solution presents all 50 fields with a plus (+) next to the field to allow them to add another input box for that field. The labels for the field are to the left of the field and each input box that is added goes below the current input box. </p> <p>Please trust that dynamically adding inputs is the right solution, please trust that it has been thought out, please trust that this is what the users wants, please trust that we have gone down various other roads and this is the best solution. </p> <p>My question is about presentation: How would you do it?</p> <p>Please keep the answers to UI design. We already have the database schema figured out.</p> <hr> <p><strong>Update</strong></p> <p><em>Current Solution is a web based application that uses JavaScript to dynamically add new inputs and looks very similar to Corey Trager's drawing:</em></p> <pre><code>Task [.............] + [.............] + [.............] + [.............] + Foo [.............] + [.............] + [.............] + Repeat 50 times... </code></pre>
[ { "answer_id": 152931, "author": "Corey Trager", "author_id": 9328, "author_profile": "https://Stackoverflow.com/users/9328", "pm_score": 1, "selected": false, "text": "Task [.............] + \n [.............] + \n [.............] + \n [.............] +\n\...
2008/09/30
[ "https://Stackoverflow.com/questions/152893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1681/" ]
152,900
<p>When loading XML into an XmlDocument, i.e.</p> <pre> XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); </pre> <p>is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converted into the TM character. As far as I'm concerned this shouldn't happen as the XML document has the encoding ISO-8859-1 (which doesn't have the TM symbol)</p> <p>Thanks</p>
[ { "answer_id": 152935, "author": "Andy", "author_id": 3585, "author_profile": "https://Stackoverflow.com/users/3585", "pm_score": 0, "selected": false, "text": "<root>\n<testnode>\n<![CDATA[some text &#8482;]]>\n</testnode>\n</root>\n" }, { "answer_id": 152936, "author": "Mar...
2008/09/30
[ "https://Stackoverflow.com/questions/152900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21299/" ]
152,919
<p>I need to get a listing of a server-side directory inside SAP. How do I achieve this in ABAP? Are there any built-in SAP functions I can call?</p> <p>Ideally I want a function which I can pass a path as input, and which will return a list of filenames in an internal table.</p>
[ { "answer_id": 165295, "author": "Chris Carruthers", "author_id": 1119, "author_profile": "https://Stackoverflow.com/users/1119", "pm_score": 3, "selected": false, "text": "FUNCTION RZL_READ_DIR_LOCAL.\n*\"----------------------------------------------------------------------\n*\"Lokale ...
2008/09/30
[ "https://Stackoverflow.com/questions/152919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1119/" ]
152,926
<p>In Visual Studio with TFS as source control, when I view the history and double click a cs file, the file is loaded in notepad. How can i change the application to be notepad++? </p> <p>I also would like the OS's default application for the file to still be visual studio</p>
[ { "answer_id": 3944620, "author": "Aardvark", "author_id": 3655, "author_profile": "https://Stackoverflow.com/users/3655", "pm_score": 4, "selected": false, "text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\SystemFileAssociations\\text\\shell\\edit\\command" }, { "answer_id": 52388...
2008/09/30
[ "https://Stackoverflow.com/questions/152926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,946
<p>There is a GUI ADM2 Progress v9 application using AppServer. </p> <p>It needs to give users an ability to view MS Excel files stored on the AppServer. So far it:</p> <ol> <li>Pulls .xls file from AppServer to a local drive.</li> <li>Fires up a copy of MS Excel and opens the file.</li> </ol> <p>The problem is that the temporary file on the local drive needs to be removed once it's no longer required. Any hints?</p>
[ { "answer_id": 155122, "author": "BKimmel", "author_id": 13776, "author_profile": "https://Stackoverflow.com/users/13776", "pm_score": 0, "selected": false, "text": "Excel.exe \"http://myserver/myexcelbook.xls\"" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,968
<p>Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M?</p> <p>Right now I can do this by making several comparisons, but I'm not happy with my method:</p> <pre><code>if($bytes &gt; 1000000000){ $bytes = ( sprintf( "%0.2f", $bytes/1000000000 )). " Gb/s"; } elsif ($bytes &gt; 1000000){ $bytes = ( sprintf( "%0.2f", $bytes/1000000 )). " Mb/s"; } elsif ($bytes &gt; 1000){ $bytes = ( sprintf( "%0.2f", $bytes/1000 )). " Kb/s"; } else{ $bytes = sprintf( "%0.2f", $bytes ). "b/s"; } </code></pre> <p>Thank you for your help!</p>
[ { "answer_id": 152978, "author": "WalkingRandomly", "author_id": 1856916, "author_profile": "https://Stackoverflow.com/users/1856916", "pm_score": 5, "selected": true, "text": " use Number::Bytes::Human qw(format_bytes);\n\n $size = format_bytes(0); # '0'\n $size = format_bytes(2*1024...
2008/09/30
[ "https://Stackoverflow.com/questions/152968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23780/" ]
152,975
<p>I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area.</p> <p>Is something like this possible with jQuery?</p> <pre><code>$("#menuscontainer").clickOutsideThisElement(function() { // Hide the menus }); </code></pre>
[ { "answer_id": 153047, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 12, "selected": true, "text": "stopPropagation" }, { "answer_id": 154268, "author": "Joe Lencioni", "author_id": 18986, "author...
2008/09/30
[ "https://Stackoverflow.com/questions/152975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
153,021
<p>I need to generate an XML file in C#.</p> <p>I want to write the code that generates this in a file that is mostly XML with code inside of it as I can in an ASP.NET MVC page. </p> <p>So I want a code file that looks like:</p> <pre><code>&lt;lots of angle brackets...&gt; &lt;% foreach(data in myData) { %&gt; &lt; &lt;%= data.somefield %&gt; &lt;% } %&gt; More angle brackets&gt; </code></pre> <p>This would generate my XML file. I would not mind using part of <code>System.Web</code> if someone tells me how I can do it without IIS overhead or kludging a generation of a web file.</p> <p><strong>I want to use templating and I want templating that is similar to ASP.NET</strong></p>
[ { "answer_id": 153232, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": -1, "selected": false, "text": "XmlWriterSettings settings = new XmlWriterSettings();\nsettings.Indent = true;\nsettings.IndentChars = (\" \");\nusing (...
2008/09/30
[ "https://Stackoverflow.com/questions/153021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5189/" ]
153,023
<p>I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an Access mdb.</p> <p>Yes, I know Access sucks. It's a huge legacy app, and everything else works OK.</p> <p>The table has an autonumber column. I insert the rows, but the autonumber column is set to zero.</p> <p>I Googled the question and read all the articles I could find on this subject. One suggested inserting -1 for the autonumber column, but this didn't work. None of the other suggestions I could find worked.</p> <p>I am using OleDbParameter's, not concatenating a big SQL text string.</p> <p>I've tried the insert with and without a transaction. No difference.</p> <p>How do I get this insert to work (i.e. set the autonumber column contents correctly)?</p> <p>Thanks very much in advance,</p> <p>Adam Leffert</p>
[ { "answer_id": 157815, "author": "onedaywhen", "author_id": 15354, "author_profile": "https://Stackoverflow.com/users/15354", "pm_score": 3, "selected": true, "text": "INSERT INTO (<column list>) ... \n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6783/" ]
153,046
<p>Ok, this probably has a really simple answer, but I've never tried to do it before: How do you launch a web page from within an app? You know, "click here to go to our FAQ", and when they do it launches their default web browser and goes to your page. I'm working in C/C++ in Windows, but if there's a broader, more portable way to do it I'd like to know that, too.</p>
[ { "answer_id": 153058, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 5, "selected": true, "text": "#include <windows.h>\n\nvoid main()\n{\n ShellExecute(NULL, \"open\", \"http://yourwebpage.com\",\n ...
2008/09/30
[ "https://Stackoverflow.com/questions/153046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17693/" ]
153,048
<p>I'm new to mock objects, but I understand that I need to have my classes implement interfaces in order to mock them.</p> <p>The problem I'm having is that in my data access layer, I want to have static methods, but I can't put a static method in an interface. </p> <p>What's the best way around this? Should I just use instance methods (which seems wrong) or is there another solution?</p>
[ { "answer_id": 153056, "author": "Grundlefleck", "author_id": 4120, "author_profile": "https://Stackoverflow.com/users/4120", "pm_score": 6, "selected": true, "text": "private static final MethodObject methodObject = new MethodObject();\n\npublic static void doSomething(){\n methodObj...
2008/09/30
[ "https://Stackoverflow.com/questions/153048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4219/" ]
153,053
<h2>The problem:</h2> <p>We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program.</p> <p>Now this program is most of the time extremely slow when using it with two or more user so I tried to look behind the curtain and find the source of the problem.</p> <h2>Some points about the program I found out so far:</h2> <ul> <li>It's written in VB 6.0</li> <li>It uses a password-protected Access-DB (Access 2000 MDB) that is located a folder on one user's machine.</li> <li>That folder is shared over the network and used by all other users.</li> <li>It uses the msjet40.dll version 4.00.9704 to communicate with access. I guess it's ADO?</li> </ul> <p>I also used <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="noreferrer">Process Monitor</a> to monitor file access and found out why the program is so slow: it is doing thousands of read operations on the mdb-file, even when the program is idle. Over the network this is of course tremendously slow:</p> <p><a href="http://img217.imageshack.us/img217/1456/screenshothw5.png" rel="noreferrer">Process Monitor Trace http://img217.imageshack.us/img217/1456/screenshothw5.png</a></p> <h2>The real question:</h2> <p>Is there any way to monitor the queries that are responsible for the read activity? Is there a trace flag I can set? Hooking the JET DLL's? I guess the program is doing some expensive queries that are causing JET to read lots of data in the process.</p> <p>PS: I already tried to put the mdb on our company's file server with the success that accessing it was even slower than over the local share. I also tried changing the locking mechanisms (opportunistic locking) on the client with no success.</p> <p>I want to know what's going on and need some hard facts and suggestions for our customer's developer to help him/her make the programm faster.</p>
[ { "answer_id": 168993, "author": "Tim Lara", "author_id": 3469, "author_profile": "https://Stackoverflow.com/users/3469", "pm_score": 0, "selected": false, "text": "\"Path to MSACCESS.EXE\" \"Path To foo.mdb\" /wrkgrp \"Path to foo.mdw\"\n" }, { "answer_id": 781916, "author":...
2008/09/30
[ "https://Stackoverflow.com/questions/153053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21038/" ]
153,054
<p>I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there another way to do it?</p>
[ { "answer_id": 317442, "author": "JamesEggers", "author_id": 28540, "author_profile": "https://Stackoverflow.com/users/28540", "pm_score": 4, "selected": true, "text": "HttpRuntime.AppDomainAppId" }, { "answer_id": 9329364, "author": "Stephen Kennedy", "author_id": 397817...
2008/09/30
[ "https://Stackoverflow.com/questions/153054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
153,061
<p>I'm currently writing an edit-in-place script for MooTools and I'm a little stumped as to how I can make it degrade gracefully without JavaScript while still having some functionality. I would like to use progressive enhancement in some way. I'm not looking for code, but more a concept as to how one would approach the situation. If you have any ideas or know of any edit-in-place scripts that degrade gracefully, please share.</p>
[ { "answer_id": 153214, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<li>\n <span id=\"editable\">Editable text</span> <a class=\"edit_button\"> </a>\n</li>\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13281/" ]
153,062
<p>How do I escape '&lt;' and '>' character in sed.</p> <p>I have some xml files which needs some text between the tags to be replaced. How do I escape the '>' and '&lt;' characters.</p> <p>The problem with > and &lt; is it has special meaning in the shell to redirect the output to a file. So backslash doesn't work.</p>
[ { "answer_id": 153070, "author": "Douglas Mayle", "author_id": 8458, "author_profile": "https://Stackoverflow.com/users/8458", "pm_score": 0, "selected": false, "text": "sed -re 's@(<TAG.*?>).*?(</TAG>)@\\1hi\\2@' test.xml\n" }, { "answer_id": 153075, "author": "cnu", "au...
2008/09/30
[ "https://Stackoverflow.com/questions/153062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448/" ]
153,065
<p>I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function itself. A short example:</p> <pre><code>void function(MESSAGE_ID id, void* param) { if(id == FOO) { int real_param = (int)param; // ... } } </code></pre> <p>Of course, on a 64 bit machine, I get the error:</p> <pre><code>error: cast from 'void*' to 'int' loses precision </code></pre> <p>I would like to correct this so that it still works on a 32 bit machine and as cleanly as possible. Any idea ?</p>
[ { "answer_id": 153077, "author": "Milan Babuškov", "author_id": 14690, "author_profile": "https://Stackoverflow.com/users/14690", "pm_score": 7, "selected": true, "text": "intptr_t" }, { "answer_id": 153083, "author": "moonshadow", "author_id": 11834, "author_profile"...
2008/09/30
[ "https://Stackoverflow.com/questions/153065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7136/" ]
153,079
<p>The interop library is slow and needs MS Office installed. Many times you don't want to install MS Office on servers.</p> <p>I'd like to use <a href="http://en.wikipedia.org/wiki/Apache_POI" rel="nofollow noreferrer">Apache POI</a>, but I'm on .NET.</p> <p>I need only to extract the text portion of the files, not creating nor "storing information" in Office files.</p> <p>I need to tell you that I've got a very large document library, and I can't convert it to newer XML files.</p> <p>I don't want to write a parser for the binaries files. A library like Apache POI does this for us. Unfortunately, it is only for the Java platform. Maybe I should consider writing this application in Java.</p> <p>I am still not finding an open source alternative to POI in .NET, I think I'll write my own application in Java.</p>
[ { "answer_id": 153182, "author": "ahin4114", "author_id": 11579, "author_profile": "https://Stackoverflow.com/users/11579", "pm_score": 2, "selected": false, "text": "System.IO.Packaging" }, { "answer_id": 153203, "author": "Ilya Kochetov", "author_id": 15329, "author...
2008/09/30
[ "https://Stackoverflow.com/questions/153079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4206/" ]
153,087
<p>I have a requirement to read and display the owner of a file (for audit purposes), and potentially changing it as well (this is secondary requirement). Are there any nice C# wrappers?</p> <p>After a quick google, I found only <a href="http://web.archive.org/web/20061116233324/http://www.softinsight.com/bnoyes/PermaLink.aspx?guid=8edc9d4c-0f2c-4006-8186-a3697ebc7476" rel="noreferrer">the WMI solution</a> and a suggestion to PInvoke GetSecurityInfo</p>
[ { "answer_id": 153146, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 7, "selected": true, "text": "const string FILE = @\"C:\\test.txt\";\n\nvar fs = File.GetAccessControl(FILE);\n\nvar sid = fs.GetOwner(typeof(Securit...
2008/09/30
[ "https://Stackoverflow.com/questions/153087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5363/" ]
153,123
<p>I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same width, but the width may vary in real life), i would like, instead of. </p> <pre><code>-r1- -r2-- -r3-- -r4- -r5-- </code></pre> <p>something like.</p> <pre><code>-r1- -r3-- -r2-- -r4- -r5-- </code></pre> <p>All hints will be appreciated. I am not necessarily looking for "the" best solution.</p>
[ { "answer_id": 153357, "author": "Jasper", "author_id": 18702, "author_profile": "https://Stackoverflow.com/users/18702", "pm_score": 1, "selected": false, "text": "Collection<Rectangle> overlaps (int startx, int endx, Collection<Rectangle> rects){\n...\n}\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8776/" ]
153,151
<p>I recently upgraded my oracle client to 10g (10.2.0.1.0).</p> <p>Now when I try to connect to a legacy 8.0 database, I get</p> <pre><code>ORA-03134: Connections to this server version are no longer supported. </code></pre> <p>Is there any workaround for this problem, or do I have to install two clients on my local machine?</p>
[ { "answer_id": 153191, "author": "Andrew", "author_id": 5662, "author_profile": "https://Stackoverflow.com/users/5662", "pm_score": 4, "selected": true, "text": "selecthome.bat" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
153,152
<p>I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. </p> <p>How do I resize the iframes to fit the height of the iframes' content?</p> <p>I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitless so far.</p> <p><strong>Update:</strong> Please note that content is loaded from other domains, so the <a href="https://en.wikipedia.org/wiki/Same-origin_policy" rel="noreferrer">same-origin policy</a> applies.</p>
[ { "answer_id": 153196, "author": "Ólafur Waage", "author_id": 22459, "author_profile": "https://Stackoverflow.com/users/22459", "pm_score": -1, "selected": false, "text": "parent.document.getElementById(iFrameID).style.height=framedPage.scrollHeight;\n" }, { "answer_id": 250275, ...
2008/09/30
[ "https://Stackoverflow.com/questions/153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3842/" ]
153,156
<p>How to count distinct values in a node in XSLT?</p> <p>Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3.</p> <pre><code>&lt;Artists_by_Countries&gt; &lt;Artist_by_Country&gt; &lt;Location_ID&gt;62&lt;/Location_ID&gt; &lt;Artist_ID&gt;212&lt;/Artist_ID&gt; &lt;Country&gt;Argentina&lt;/Country&gt; &lt;/Artist_by_Country&gt; &lt;Artist_by_Country&gt; &lt;Location_ID&gt;4&lt;/Location_ID&gt; &lt;Artist_ID&gt;108&lt;/Artist_ID&gt; &lt;Country&gt;Australia&lt;/Country&gt; &lt;/Artist_by_Country&gt; &lt;Artist_by_Country&gt; &lt;Location_ID&gt;4&lt;/Location_ID&gt; &lt;Artist_ID&gt;111&lt;/Artist_ID&gt; &lt;Country&gt;Australia&lt;/Country&gt; &lt;/Artist_by_Country&gt; &lt;Artist_by_Country&gt; &lt;Location_ID&gt;12&lt;/Location_ID&gt; &lt;Artist_ID&gt;78&lt;/Artist_ID&gt; &lt;Country&gt;Germany&lt;/Country&gt; &lt;/Artist_by_Country&gt; &lt;/Artists_by_Countries&gt; </code></pre>
[ { "answer_id": 153204, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 3, "selected": false, "text": "count(//Country[not(following::Country/text() = text())])\n" }, { "answer_id": 153218, "author": "samjud...
2008/09/30
[ "https://Stackoverflow.com/questions/153156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
153,166
<p>I'm trying to find out whether there is a way to reliably determine when a managed thread is about to terminate. I'm using a third-party library that includes support for PDF documents and the problem is that in order to use the PDF functionality, I have to explicitly initialize the PDF component, do the work, then explicitly uninitialize the component before the thread terminates. If the uninitialize is not called, exceptions are thrown because unmanaged resources are not being released correctly. Since the thread class is sealed and has no events, I have to wrap the thread instance into a class and only allow instances of this class to do the work. </p> <p>I should point out that this is part of a shared library used by multiple Windows applications. I may not always have control of threads making calls into this library.</p> <p>Since a PDF object may be the output of a call to this library, and since the calling thread may do some other work with that object, I don't want to call the cleanup function immediately; I need to try to do it right before the thread terminates. Ideally I'd like to be able to subscribe to something like a Thread.Dispose event, but that's what I'm missing. </p>
[ { "answer_id": 153219, "author": "McKenzieG1", "author_id": 3776, "author_profile": "https://Stackoverflow.com/users/3776", "pm_score": 2, "selected": false, "text": "System.Thread" }, { "answer_id": 153428, "author": "stefano m", "author_id": 19261, "author_profile":...
2008/09/30
[ "https://Stackoverflow.com/questions/153166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22239/" ]
153,183
<p>I am working on the admin section of a new rails app and i'm trying to setup some routes to do things "properly". I have the following controller:</p> <pre><code>class Admin::BlogsController &lt; ApplicationController def index @blogs = Blog.find(:all) end def show @blog = Blog.find(params[:id]) end ... end </code></pre> <p>in routes.rb:</p> <pre><code>map.namespace :admin do |admin| admin.resources :blogs end </code></pre> <p>in views/admin/blogs/index.html.erb:</p> <pre><code>&lt;% for blog in @blogs %&gt; &lt;%= link_to 'Delete', admin_blog(blog), :method =&gt; :delete &lt;% end %&gt; </code></pre> <p>i have verified that the routes exist:</p> <pre><code>admin_blogs GET /admin/blogs {:action =&gt; "index", :controller=&gt;"admin/blogs"} admin_blog GET /admin/blogs/:id {:action =&gt; "show", :controller =&gt; "admin/blogs"} .... </code></pre> <p>but when i try to view <a href="http://localhost:3000/admin/blogs" rel="nofollow noreferrer">http://localhost:3000/admin/blogs</a> i get this error:</p> <pre><code>undefined method 'admin_blog' for #&lt;ActionView::Base:0xb7213da8&gt; </code></pre> <p>where am i going wrong and why?</p>
[ { "answer_id": 153228, "author": "TonyLa", "author_id": 1295, "author_profile": "https://Stackoverflow.com/users/1295", "pm_score": 2, "selected": false, "text": "admin_blog_path(blog) \n" }, { "answer_id": 153245, "author": "John Topley", "author_id": 1450, "author_p...
2008/09/30
[ "https://Stackoverflow.com/questions/153183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18811/" ]
153,227
<p>When I call</p> <pre><code>help(Mod.Cls.f) </code></pre> <p>(Mod is a C extension module), I get the output</p> <pre>Help on method_descriptor: f(...) doc_string</pre> <p>What do I need to do so that the help output is of the form</p> <pre>Help on method f in module Mod: f(x, y, z) doc_string</pre> <p>like it is for random.Random.shuffle, for example?</p> <p>My PyMethodDef entry is currently:</p> <pre><code>{ "f", f, METH_VARARGS, "doc_string" } </code></pre>
[ { "answer_id": 153284, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 3, "selected": true, "text": ">>> help(range)\nHelp on built-in function range in module __builtin__:\n\nrange(...)\n range([start,] stop[, ste...
2008/09/30
[ "https://Stackoverflow.com/questions/153227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11828/" ]
153,234
<p>The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill?</p> <p>My question is to what level of granularity do you write you unit tests at?</p> <p>..and is there a case of testing too much?</p>
[ { "answer_id": 153429, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 2, "selected": false, "text": "TestFixture" }, { "answer_id": 759143, "author": "j_random_hacker", "author_id": 47984, "author_pr...
2008/09/30
[ "https://Stackoverflow.com/questions/153234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1116/" ]
153,248
<p>I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found:</p> <ul> <li>Manually creating the XML, as outlined in <a href="https://stackoverflow.com/questions/150339/generating-an-excel-file-in-aspnet#150368">this post</a></li> <li>Using a Third Party Library like <a href="http://www.codeplex.com/ExcelPackage" rel="nofollow noreferrer">ExcelPackage</a>.</li> </ul> <p>Currently, I use ExcelPackage, which has some really serious drawbacks and issues. As I do not need to create overly complex Excel sheets (the most "complicated" thing is that I explicitely need to set a cell type to numeric or text), I 'm looking towards Option 1 next, but I just wonder if there are any other good and supported ways to generate Excel 2007 Sheets? Bonus Points if they can be created without having to save them to the harddrive, i.e. generate and directly output them into a stream.</p> <p>.net 3.0 is the target here, no 3.5 goodness :(</p> <p><strong>Edit:</strong> Thanks so far. The XML SDK is indeed 3.5 only, but Russian Roulet... erm... COM Interop is also something I want to avoid whenever possible, especially since Excel 2007 has a somewhat complicated but still rather easy to create document format. I'll have a look at the various links and hints posted.</p>
[ { "answer_id": 153277, "author": "Compile This", "author_id": 4048, "author_profile": "https://Stackoverflow.com/users/4048", "pm_score": 4, "selected": true, "text": "MemoryStream" }, { "answer_id": 155072, "author": "BKimmel", "author_id": 13776, "author_profile": "...
2008/09/30
[ "https://Stackoverflow.com/questions/153248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
153,266
<p>In C and C++ you can tell the compiler that a number is a 'long' by putting an 'l' at the end of the number. e.g long x = 0l;</p> <p>How can I tell the C# compiler that a number is a byte?</p>
[ { "answer_id": 153271, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 3, "selected": false, "text": "byte b = (byte) 123; \n" }, { "answer_id": 153280, "author": "casademora", "author_id": 5619, "author_pr...
2008/09/30
[ "https://Stackoverflow.com/questions/153266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9516/" ]
153,287
<p>I have implemented a simple file upload-download mechanism. When a user clicks a file name, the file is downloaded with these HTTP headers:</p> <pre><code>HTTP/1.1 200 OK Date: Tue, 30 Sep 2008 14:00:39 GMT Server: Microsoft-IIS/6.0 Content-Disposition: attachment; filename=filename.doc; Content-Type: application/octet-stream Content-Length: 10754 </code></pre> <p>I also support Japanese file names. In order to do that, I encode the file name with this java method:</p> <pre><code>private String encodeFileName(String name) throws Exception{ String agent = request.getHeader("USER-AGENT"); if(agent != null &amp;&amp; agent.indexOf("MSIE") != -1){ // is IE StringBuffer res = new StringBuffer(); char[] chArr = name.toCharArray(); for(int j = 0; j &lt; chArr.length; j++){ if(chArr[j] &lt; 128){ // plain ASCII char if (chArr[j] == '.' &amp;&amp; j != name.lastIndexOf(".")) res.append("%2E"); else res.append(chArr[j]); } else{ // non-ASCII char byte[] byteArr = name.substring(j, j + 1).getBytes("UTF8"); for(int i = 0; i &lt; byteArr.length; i++){ // byte must be converted to unsigned int res.append("%").append(Integer.toHexString((byteArr[i]) &amp; 0xFF)); } } } return res.toString(); } // Firefox/Mozilla return MimeUtility.encodeText(name, "UTF8", "B"); } </code></pre> <p>It worked well so far, until someone found out that it doesn't work well with long file names. For example: <code>あああああああああああああああ2008.10.1あ.doc</code>. If I change one of the single-byte dots to a single-byte underline , or if I remove the first character, it works OK. i.e., it depends on length and URL-encoding of a dot character. Following are a few examples. </p> <p>This is broken (<code>あああああああああああああああ2008.10.1あ.doc</code>):</p> <pre><code>Content-Disposition: attachment; filename=%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%822008%2E10%2E1%e3%81%82.doc; </code></pre> <p>This is OK (<code>あああああああああああああああ2008_10.1あ.doc</code>):</p> <pre><code>Content-Disposition: attachment; filename=%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%822008_10%2E1%e3%81%82.doc; </code></pre> <p>This is also fine (<code>あああああああああああああああ2008.10.1あ.doc</code>):</p> <pre><code>Content-Disposition: attachment; filename=%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%82%e3%81%822008%2E10%2E1%e3%81%82.doc; </code></pre> <p>Anybody have a clue?</p>
[ { "answer_id": 153400, "author": "Ovesh", "author_id": 3751, "author_profile": "https://Stackoverflow.com/users/3751", "pm_score": 4, "selected": true, "text": "Content-Disposition: attachment; filename=\"%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E...
2008/09/30
[ "https://Stackoverflow.com/questions/153287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751/" ]
153,291
<p>I have a question at <a href="https://stackoverflow.com/questions/150038/how-to-wire-a-middle-tier-of-objects-to-a-data-tier-consisting-of-a-dataset#151255">SO</a> asking how to wire a middle tier to a DataSet.</p> <p>I put up an answer showing what I had come up with, but I am not happy with the tight coupling. I have just started to get into testing and find it a good goal for my code.</p> <p>How would this code be de-coupled to allow for unit testing? </p> <p>Thank you,<br> Keith</p>
[ { "answer_id": 237138, "author": "Thomas Eyde", "author_id": 3282, "author_profile": "https://Stackoverflow.com/users/3282", "pm_score": 0, "selected": false, "text": "var order = repository.GetOrderBy(id);\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1048/" ]
153,354
<p>I have the following code that I wrote but it the SQLBindCol does not seem to work correctly (of course I could have screwed up the whole program too!.) The connection works, it creates the table in the DB, addes the record fine and they all look good in SQL Enterprise Manager. So what I need help with is after the comment "Part 3 &amp; 4: Searchs based on criteria." Perhaps I should have done this assignment completely different or is this an acceptable method?</p> <pre><code>#include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;string&gt; #include &lt;windows.h&gt; #include &lt;sql.h&gt; #include &lt;sqlext.h&gt; #include &lt;sqltypes.h&gt; using namespace std; // to save us having to type std:: const int MAX_CHAR = 1024; int main ( ) { SQLCHAR SQLStmt[MAX_CHAR]; char strSQL[MAX_CHAR]; char chrTemp; SQLVARCHAR rtnFirstName[50]; SQLVARCHAR rtnLastName[50]; SQLVARCHAR rtnAddress[30]; SQLVARCHAR rtnCity[30]; SQLVARCHAR rtnState[3]; SQLDOUBLE rtnSalary; SQLVARCHAR rtnGender[1]; SQLINTEGER rtnAge; // Get a handle to the database SQLHENV EnvironmentHandle; RETCODE retcode = SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &amp;EnvironmentHandle ); // Set the SQL environment flags retcode = SQLSetEnvAttr( EnvironmentHandle, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER ); // create handle to the SQL database SQLHDBC ConnHandle; retcode = SQLAllocHandle( SQL_HANDLE_DBC, EnvironmentHandle, &amp;ConnHandle ); // Open the database using a System DSN retcode = SQLDriverConnect(ConnHandle, NULL, (SQLCHAR*)"DSN=PRG411;UID=myUser;PWD=myPass;", SQL_NTS, NULL, SQL_NTS, NULL, SQL_DRIVER_NOPROMPT); if (!retcode) { cout &lt;&lt; "SQLConnect() Failed"; } else { // create a SQL Statement variable SQLHSTMT StatementHandle; retcode = SQLAllocHandle(SQL_HANDLE_STMT, ConnHandle, &amp;StatementHandle); // Part 1: Create the Employee table (Database) do { cout &lt;&lt; "Create the new table? "; cin &gt;&gt; chrTemp; } while (cin.fail()); if (chrTemp == 'y' || chrTemp == 'Y') { strcpy((char *) SQLStmt, "CREATE TABLE [dbo].[Employee]([pkEmployeeID] [int] IDENTITY(1,1) NOT NULL,[FirstName] [varchar](50) NOT NULL,[LastName] [varchar](50) NOT NULL,[Address] [varchar](30) NOT NULL,[City] [varchar](30) NOT NULL,[State] [varchar](3) NOT NULL, [Salary] [double] NOT NULL,[Gender] [varchar](1) NOT NULL, [Age] [int] NOT NULL, CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED ([pkEmployeeID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); } // Part 2: Hardcode records into the table do { cout &lt;&lt; "Add records to the table? "; cin &gt;&gt; chrTemp; } while (cin.fail()); if (chrTemp == 'y' || chrTemp == 'Y') { strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Mike','Slentz','123 Torrey Dr.','North Clairmont','CA', 48000.00 ,'M',34)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Sue','Vander Hayden','46 East West St.','San Diego','CA', 36000.00 ,'F',28)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Sharon','Stonewall','756 West Olive Garden Way','Plymouth','MA', 56000.00 ,'F',58)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('James','Bartholemew','777 Praying Way','Falls Church','VA', 51000.00 ,'M',45)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Joe','Smith','111 North 43rd Ave','Peoria','AZ', 44000.00 ,'M', 40)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Michael','Smith','20344 North Swan Park','Phoenix','AZ', 24000.00 ,'M', 40)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Jennifer','Jones','123 West North Ave','Flagstaff','AZ', 40000.00 ,'F', 40)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Cora','York','33rd Park Way Drive','Mayville','MI', 30000.00 ,'F', 61)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); strcpy((char *) SQLStmt, "INSERT INTO employee([FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age]) VALUES ('Tom','Jefferson','234 Friendship Way','Battle Creek','MI', 41000.00 ,'M', 31)"); retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); } // Part 3 &amp; 4: Searchs based on criteria do { cout &lt;&lt; "1. Display all records in the database" &lt;&lt; endl; cout &lt;&lt; "2. Display all records with age greater than 40" &lt;&lt; endl; cout &lt;&lt; "3. Display all records with salary over $30K" &lt;&lt; endl; cout &lt;&lt; "4. Exit" &lt;&lt; endl &lt;&lt; endl; do { cout &lt;&lt; "Please enter a selection: "; cin &gt;&gt; chrTemp; } while (cin.fail()); if (chrTemp == '1') { strcpy((char *) SQLStmt, "SELECT [FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age] FROM EMPLOYEE"); } else if (chrTemp == '2') { strcpy((char *) SQLStmt, "SELECT [FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age] FROM EMPLOYEE WHERE [AGE] &gt; 40"); } else if (chrTemp == '3') { strcpy((char *) SQLStmt, "SELECT [FirstName], [LastName], [Address], [City], [State], [Salary], [Gender],[Age] FROM EMPLOYEE WHERE [Salary] &gt; 30000"); } if (chrTemp == '1' || chrTemp == '2' || chrTemp == '3') { retcode = SQLExecDirect(StatementHandle, SQLStmt, SQL_NTS); SQLBindCol(StatementHandle, 1, SQL_C_CHAR, &amp;rtnFirstName, sizeof(rtnFirstName), NULL ); SQLBindCol(StatementHandle, 2, SQL_C_CHAR, &amp;rtnLastName, sizeof(rtnLastName), NULL ); SQLBindCol(StatementHandle, 3, SQL_C_CHAR, &amp;rtnAddress, sizeof(rtnAddress), NULL ); SQLBindCol(StatementHandle, 4, SQL_C_CHAR, &amp;rtnCity, sizeof(rtnCity), NULL ); SQLBindCol(StatementHandle, 5, SQL_C_CHAR, &amp;rtnState, sizeof(rtnState), NULL ); SQLBindCol(StatementHandle, 6, SQL_C_DOUBLE, &amp;rtnSalary, sizeof(rtnSalary), NULL ); SQLBindCol(StatementHandle, 7, SQL_C_CHAR, &amp;rtnGender, sizeof(rtnGender), NULL ); SQLBindCol(StatementHandle, 8, SQL_C_NUMERIC, &amp;rtnAge, sizeof(rtnAge), NULL ); for(;;) { retcode = SQLFetch(StatementHandle); if (retcode == SQL_NO_DATA_FOUND) break; cout &lt;&lt; rtnFirstName &lt;&lt; " " &lt;&lt; rtnLastName &lt;&lt; " " &lt;&lt; rtnAddress &lt;&lt; " " &lt;&lt; rtnCity &lt;&lt; " " &lt;&lt; rtnState &lt;&lt; " " &lt;&lt; rtnSalary &lt;&lt; " " &lt;&lt; rtnGender &lt;&lt; "" &lt;&lt; rtnAge &lt;&lt; endl; } } } while (chrTemp != '4'); SQLFreeStmt(StatementHandle, SQL_CLOSE ); SQLFreeConnect(ConnHandle); SQLFreeEnv(EnvironmentHandle); printf( "Done.\n" ); } return 0; } </code></pre>
[ { "answer_id": 153386, "author": "antik", "author_id": 1625, "author_profile": "https://Stackoverflow.com/users/1625", "pm_score": 2, "selected": false, "text": "SQL_SUCCESS" }, { "answer_id": 155047, "author": "Community", "author_id": -1, "author_profile": "https://...
2008/09/30
[ "https://Stackoverflow.com/questions/153354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
153,372
<p>I am trying to create a StringNameSpaceBinding using the wsadmin tool of Websphere 6.1</p> <p>Here are the steps i take set cell [$AdminConfig getid /Cell:cell/] $AdminConfig create StringNameSpaceBinding $cell { {name bindname} {nameInNameSpace Bindings/string} {stringToBind "This is the String value that gets bound"} }</p> <p>But when i run this last step i get an error like this: WASX7015E: Exception running command: "$AdminConfig create StringNameSpaceBinding $cell { {name bindname} {nameInNameSpace Bindings/string} {stringToBind "This is the String value that gets bound"} }"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7444E: Invalid parameter value "" for parameter "parent config id" on command "create"</p> <p>Any idea what could be up with this?</p> <p>Thanks Damien</p>
[ { "answer_id": 3836682, "author": "Isaac", "author_id": 443716, "author_profile": "https://Stackoverflow.com/users/443716", "pm_score": 3, "selected": true, "text": "set cell [$AdminConfig getid /Cell:cell/]\n" }, { "answer_id": 4406507, "author": "jitendra", "author_id":...
2008/09/30
[ "https://Stackoverflow.com/questions/153372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11612/" ]
153,381
<p>I have to concatenate a bunch of Strings in Javascript and am searching for the fastest way to do so. Let's assume that the Javascript has to create a large XML-"file" that, naturally, consists of many small Strings. So I came up with:</p> <pre><code> var sbuffer = []; for (var idx=0; idx&lt;10000; idx=idx+1) { sbuffer.push(‘&lt;xmltag&gt;Data comes here... bla... &lt;/xmltag&gt;’); } // Now we "send" it to the browser... alert(sbuffer.join(”)); </code></pre> <p>Do not pay any attention to the loop or the other "sophisticated" code which builds the example. </p> <p>My question is: For an unknown number of Strings, do you have a faster algorithm / method / idea to concatenate many small Strings to a huge one?</p>
[ { "answer_id": 153646, "author": "Sergey Ilinsky", "author_id": 23815, "author_profile": "https://Stackoverflow.com/users/23815", "pm_score": 5, "selected": true, "text": "sbuffer.push(‘Data comes here... bla... ’); " } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13209/" ]
153,388
<p>I'm really sick of this problem. Google searches always seem to suggest "delete all bpls for the package", "delete all dcus". Sometimes this just-does-not-work. Hopefully I can get some other ideas here.</p> <p>I have a package written in-house, which had been installed without issue a few months ago. Having made a few changes to the source, I figured it was time to recompile/reinstall the package. Now I get two errors, the first if I choose "install" is</p> <p><em>Access violation at address 02422108 in module 'dcc100.dll'. Read of address 00000000.</em></p> <p>...or if I try to build/compile the package, I get</p> <p><em>[Pascal Fatal Error] F2084 Internal Error: LA33</em></p> <p>This is one of those Delphi problems that seems to occur time and time again for many of us. Would be great if we could collate a response something along the lines of "any one or combination of these steps <em>might</em> fix it, but if you do <em>all</em> these steps it <em>will</em> fix it...."</p> <p>At the moment, I've removed all references to the bpl/dcp files for this package, but still getting the same error...</p> <p>Using BDS2006 (Delphi)</p> <p><em>Update 01-Oct-2008: I managed to solve this - see my post below. As I can't accept my own answer, I'm not entirely sure what to do here. Obviously these types of issues occur frequently for some people, so I'll leave it open for a while to get other suggestions. Then I guess if someone collates all the info into a super-post, I can accept the answer</em></p>
[ { "answer_id": 156746, "author": "Graza", "author_id": 11820, "author_profile": "https://Stackoverflow.com/users/11820", "pm_score": 5, "selected": true, "text": "TMyClass = class(TComponent)\nprivate\n const ErrStrs: array[TErrEnum] of string\n = ('', //erOK\n 'Invalid user na...
2008/09/30
[ "https://Stackoverflow.com/questions/153388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11820/" ]
153,394
<p>I believe in OO, but not to the point where inappropriate designs/implementations should be used just to be "OO Compliant".</p> <p>So, how to deal with the Serlvet/EJB/DataContainer layered architecture:</p> <ul> <li>Servlets receive requests and call a "business layer" (e.g. session EJBs)</li> <li>The business layer locates DataContainers from the database and manipulates them to implement the business logic</li> <li>DataContainers contain no real code, just get/set corresponding to the database.</li> </ul> <p>This approach has appeal; the DataContainers are clear in what they do and it's very easy to know where data comes from.</p> <p>Aside from not being OO, this leads to unclear Business Layer classes that can be hard to name and hard to organize.</p> <p>Even if we <strong>were</strong> trying to be more "OO" (e.g. putting some of these methods in the DataConatiners), some of these operations operate on more than one set of data.</p> <p>How do you keep your Business Layer from getting confusingly procedural, but without polluting your DataContainers with business logic?</p> <h3>Example</h3> <pre><code>class UserServlet { handleRequest() { String id = request.get("id"); String name = request.get("name"); if (UserBizLayer.updateUserName(id,name)) response.setStatus(OK); else response.setStatus(BAD_REQUEST); } } class UseBizLayer { updateUserName(String id, String name) { long key = toLong(id); user = userDAO.find(key); if user == null return false; if (!validateUserName(name)) return false; user.setName(name); userDAO.update(user); return true; } validateUserName(String name) { // do some validations and return } } class User { long key; String name; String email; // imagine getters/setters here } </code></pre> <ul> <li>We don't want <code>validateUserName</code> on the user, since it only operates on a name; I guess it could go into another class, but then we have <strong>another</strong> procedural "uti" type class</li> <li>We don't want persistence methods on the User, since there's value in decoupling data structures from their persistence strategy</li> <li>We don't want business logic in our Servlet, since we may need to re-use that logic elsewhere</li> <li>We don't want our business logic in our User, as this draws in way too much to the User class, making re-use of the business logic difficult and coupling the user with its persistence strategy</li> </ul> <p>I realize this example isn't that bad, but imagine 10 DataContainers and 20 BizLayer objects with several methods each. Imagine that some of those operations aren't "centered" on a particular data container.</p> <p>How do we keep this from being a procedural mess?</p>
[ { "answer_id": 153510, "author": "JeeBee", "author_id": 17832, "author_profile": "https://Stackoverflow.com/users/17832", "pm_score": 0, "selected": false, "text": "\npublic class UserModel extends DatabaseModel implements XMLable, CRUDdy, Serializable, Fooable, Barloney, Baznatchy, Wibb...
2008/09/30
[ "https://Stackoverflow.com/questions/153394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3029/" ]
153,407
<p>I am upgrading a silverlight beta 2 app to RC0 and have a function that translates a point from a child element to it's parent. The purpose of the function is to ensure that an element appears exactly on top of the child even though they are not on the same canvas and don't share a parent.</p> <p>Here is the current function:</p> <pre><code> protected Point TranslatePosition(Point current, Panel from, Panel to, MouseEventArgs e) { Point rtn = new Point(-1, -1); // get point relative to existing parent Point fromPoint = e.GetPosition(from); // get point relative to new parent Point toPoint = e.GetPosition(to); // calculate delta double deltaX = fromPoint.X - toPoint.X; double deltaY = fromPoint.Y - toPoint.Y; // calculate new position rtn = new Point(current.X - deltaX, current.Y - deltaY); return rtn; } </code></pre> <p>Notice that it relies on the MouseEventArgs.GetPosition function to get the position relative to existing and new parent. In cases where there is no MouseEventArgs available, we were creating a new instance and passing it in. This was a hack but seemed to work. Now, in RC0, the MouseEventArgs constructor is internal so this hack no longer works.</p> <p>Any ideas on how to write a method to do the translation of a point in RC0 that doesn't rely on MouseEventArgs.GetPosition? </p>
[ { "answer_id": 154150, "author": "Santiago Palladino", "author_id": 12791, "author_profile": "https://Stackoverflow.com/users/12791", "pm_score": 3, "selected": true, "text": "var transform = from.TransformToVisual(to);\nreturn transform.Transform(current);\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21818/" ]
153,413
<p>I'm trying to extract the polygons from placemarks in a KML file. So far so good:</p> <pre><code>Imports &lt;xmlns:g='http://earth.google.com/kml/2.0'&gt; Imports System.Xml.Linq Partial Class Test_ImportPolygons Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim Kml As XDocument = XDocument.Load(Server.MapPath("../kmlimport/ga.kml")) For Each Placemark As XElement In Kml.&lt;g:Document&gt;.&lt;g:Folder&gt;.&lt;g:Placemark&gt; Dim Name As String = Placemark.&lt;g:name&gt;.Value ... Next End Sub End Class </code></pre> <p>I'd like to capture the entire <code>&lt;polygon&gt;...&lt;/polygon&gt;</code> block as a string. I tried something like this (where the ... is above):</p> <pre><code> Dim Polygon as String = Placemark.&lt;g:Polygon&gt;.InnerText </code></pre> <p>but the XElement object doesn't have an InnerText property, or any equivalent as far as I can tell. How do I grab the raw XML that defines an XElement?</p>
[ { "answer_id": 153486, "author": "tbrownell", "author_id": 1981, "author_profile": "https://Stackoverflow.com/users/1981", "pm_score": 1, "selected": false, "text": "Placemark.ToString()\n" }, { "answer_id": 153519, "author": "Herb Caudill", "author_id": 239663, "auth...
2008/09/30
[ "https://Stackoverflow.com/questions/153413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
153,420
<p>I'm starting a project using a Restful architecture implemented in Java (using the new JAX-RS standard)</p> <p>We are planning to develop the GUI with a Flex application. I have already found some problems with this implementation using the HTTPService component (the response error codes, headers access...).</p> <p>Any of you guys have some experience in a similar project. Is it feasible?</p>
[ { "answer_id": 157532, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 3, "selected": false, "text": "HTTPService" }, { "answer_id": 163228, "author": "Guerry", "author_id": 9190, "author_profile": "https://St...
2008/09/30
[ "https://Stackoverflow.com/questions/153420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2937/" ]
153,427
<p>I am currently using JUnit 4 and have a need to divide my tests into groups that can be run selectively in any combination. I know TestNG has a feature to annotate tests to assign them to groups, but I can't migrate to TestNG right now. It seems this could easily be accomplished in JUnit with some custom annotations and a custom JUnit TestRunner. I've checked both the JUnit docs and searched the web but couldn't find such a thing. Is anyone aware of such a TestRunner?</p> <p>Update: Thanks for your replies regarding test suites. I should have addressed these in my original question. Here we go: I don't want to use test suites because they would require me to manually create and manage them, which means touching ALL my tests and arranging them into suites manually (too much work and a maintenance nightmare). All I need to do is run all unit tests, except a few that are really integration tests. So I want to annotate these, and run all others. At other times, I want to just run the integration tests. I also have the need to put a unit test into multiple groups, which is not possible with suites. Hope this helps to clear things up.</p> <p>Update 2: If JUnit doesn't have this OOB, I'm looking for an Open Source library that adds this to JUnit (annotations + custom JUnit Test Runner).</p>
[ { "answer_id": 153538, "author": "flicken", "author_id": 12880, "author_profile": "https://Stackoverflow.com/users/12880", "pm_score": 4, "selected": true, "text": "@IfProfileValue(name=\"test-groups\", values={\"unit-tests\", \"integration-tests\"})\n public void testWhichRunsForUnitOr...
2008/09/30
[ "https://Stackoverflow.com/questions/153427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13041/" ]
153,438
<p>I have a VB6 COM component which I need to call from my .Net method. I use reflection to create an instance of the COM object and activate it in the following manner:</p> <pre><code>f_oType = Type.GetTypeFromProgID(MyProgId); f_oInstance = Activator.CreateInstance(f_oType); </code></pre> <p>I need to use GetTypeFromProgID rather than using tlbimp to create a library against the COM DLL as the ProgId of the type I need to instantiate can vary. I then use Type.InvokeMember to call the COM method in my code like:</p> <pre><code>f_oType.InvokeMember(&quot;Process&quot;, BindingFlags.InvokeMethod, null, f_oInstance, new object[] { param1, param2, param3, param4 }); </code></pre> <p>I catch any raised TargetInvocationException's for logging and can get the detailed error description from the TargetInvocationException.InnerException field. However, I know that the COM component uses Error.Raise to generate an error number and I need to somehow get hold of this in my calling .Net application.</p> <p>The problem seems to stem from the TargetInvocationException not containing the error number as I'd expect if it were a normal COMException so:</p> <p><em><strong>How can I get the Error Number from the COM object in my .Net code?</strong></em></p> <p>or</p> <p><em><strong>Can I make this same call in a way that would cause a COMException (containing the error number) rather than a TargetInvocationException when the COM component fails?</strong></em></p> <p>Please also note that the target platform is .Net 2.0 and I do have access to the VB6 source code but would regard altering the error message raised from VB6 to contain the error code as part of the text to be a bit of a hack.</p>
[ { "answer_id": 153538, "author": "flicken", "author_id": 12880, "author_profile": "https://Stackoverflow.com/users/12880", "pm_score": 4, "selected": true, "text": "@IfProfileValue(name=\"test-groups\", values={\"unit-tests\", \"integration-tests\"})\n public void testWhichRunsForUnitOr...
2008/09/30
[ "https://Stackoverflow.com/questions/153438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15570/" ]
153,439
<p>I'm trying to place 4 of my image containers into a new pane, having a total of 16 images. The jQuery below is what I came up with to do it. The first pane comes out correctly with 4 images in it. But the second has 4 images, plus the 3rd pane. And the 3rd pane has 4 images plus the 4th pane. I don't know exactly why the nesting is occurring. My wrapping can't be causing their index to change. I added css borders to them and it appears to be indexed correctly. How should I be going about this? What I want is to have 1-4 in one pane, 5-8 in another, 9-12, and 13-16. It needs to be dynamic so that I can change the number in each pane, so just doing it in the HTML isn't an option.</p> <p>A demo of the issue can be seen here: <a href="http://beta.whipplehill.com/mygal/rotate.html" rel="noreferrer">http://beta.whipplehill.com/mygal/rotate.html</a>. I'm using firebug to view the DOM.</p> <p>Any help would be splentabulous!</p> <p>The jQuery Code</p> <pre><code>$(function() { $(".digi_image:gt(-1):lt(4)").wrapAll("&lt;div class=\"digi_pane\"&gt;&lt;/div&gt;").css("border", "2px solid red"); $(".digi_image:gt(3):lt(8)").wrapAll("&lt;div class=\"digi_pane\"&gt;&lt;/div&gt;").css("border", "2px solid blue"); $(".digi_image:gt(7):lt(12)").wrapAll("&lt;div class=\"digi_pane\"&gt;&lt;/div&gt;").css("border", "2px solid green"); $(".digi_image:gt(11):lt(16)").wrapAll("&lt;div class=\"digi_pane\"&gt;&lt;/div&gt;").css("border", "2px solid orange"); $(".digi_pane").append("&lt;div style=\"clear: both;\"&gt;&lt;/div&gt;"); }); </code></pre> <p>The HTML (abbreviated), but essentially repeated 16 times.</p> <pre><code>&lt;div class="digi_image"&gt; &lt;div class="space_holder"&gt;&lt;img src="images/n883470064_4126667_9320.jpg" width="100" /&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 153624, "author": "Wes P", "author_id": 13611, "author_profile": "https://Stackoverflow.com/users/13611", "pm_score": 1, "selected": false, "text": "$(\".digi_image\").slice(0, 4).wrapAll(\"<div class=\\\"digi_pane\\\"></div>\").css(\"border\", \"2px solid red\");\n$(\".di...
2008/09/30
[ "https://Stackoverflow.com/questions/153439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13611/" ]
153,445
<p><strong>Introduction</strong></p> <p>In my current organisation, we have many desktop and web applications all feeding into each other at some point. When looking after older applications or creating new applications, it's proving very difficult to try and remember which system rely on other systems in order to work. I'm not talking about software dependencies like DLL's and images, I'm talking about entire systems like a Finance system dependant on the HR system etc.</p> <p><strong>My Question</strong></p> <p>Which is the one best way to track how one entire system is dependant on another?</p> <p><sub>The answer can suggest either a method of doing the above, a software package or documentation techniques.</sub></p> <p><sub>In my particular case, <em>Many</em> means over 20 web and desktop application over a dozen servers.</sub></p>
[ { "answer_id": 6228754, "author": "MetalOx", "author_id": 782905, "author_profile": "https://Stackoverflow.com/users/782905", "pm_score": 1, "selected": false, "text": "digraph g {\n rankdir=LR;\n app1->app2->db1;\n app1->app3;\n}\n" }, { "answer_id": 47445354, "author": "Jef...
2008/09/30
[ "https://Stackoverflow.com/questions/153445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
153,451
<p>I am trying to use <code>WebClient</code> to download a file from web using a WinForms application. However, I really only want to download HTML file. Any other type I will want to ignore.</p> <p>I checked the <code>WebResponse.ContentType</code>, but its value is always <code>null</code>. </p> <p>Anyone have any idea what could be the cause?</p>
[ { "answer_id": 153694, "author": "mdb", "author_id": 8562, "author_profile": "https://Stackoverflow.com/users/8562", "pm_score": 0, "selected": false, "text": "Dim wc As New Net.WebClient()\nDim LocalFile As String = IO.Path.Combine(Environment.GetEnvironmentVariable(\"TEMP\"), Guid.NewG...
2008/09/30
[ "https://Stackoverflow.com/questions/153451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
153,460
<p>Most applications only have "Restore, Move, Size, Minimize, Maximize and Close", however <i>MS SQL</i> offers extra options "Help, Customize view". Along those lines, is it possible to add to the right click menu of an application in the task bar? </p> <p>Note: I'm <b>not</b> referring to an icon in the notification area next to the clock.</p>
[ { "answer_id": 153568, "author": "C. Ross", "author_id": 16487, "author_profile": "https://Stackoverflow.com/users/16487", "pm_score": 1, "selected": false, "text": " private const int WMTaskbarRClick = 0x0313;\n\n protected override void WndProc(ref Message m)\n {\n swit...
2008/09/30
[ "https://Stackoverflow.com/questions/153460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1484/" ]
153,461
<p>I notice that Rails 2.2 (currently edge) supports <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1046-http-only-cookies-in-cookiestore" rel="nofollow noreferrer">setting HttpOnly on the session cookie</a>.</p> <p>Is there a way of setting it on a Rails 2.1 application without moving to edge/2.2?</p>
[ { "answer_id": 153499, "author": "John Topley", "author_id": 1450, "author_profile": "https://Stackoverflow.com/users/1450", "pm_score": 0, "selected": false, "text": "http_only" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/153461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19079/" ]
153,482
<p>I have a Tapestry application that is serving its page as UTF-8. That is, server responses have header:</p> <pre><code>Content-type: text/html;charset=UTF-8 </code></pre> <p>Now within this application there is a single page that should be served with ISO-8859-1 encoding. That is, server response should have this header:</p> <pre><code>Content-type: text/html;charset=ISO-8859-1 </code></pre> <p>How to do this? I don't want to change default encoding for whole application.</p> <p>Based on google searching I have tried following:</p> <pre><code> @Meta({ "org.apache.tapestry.output-encoding=ISO-8859-1", "org.apache.tapestry.response-encoding=ISO-8859-1", "org.apache.tapestry.template-encoding=ISO-8859-1", "tapestry.response-encoding=ISO-8859-1"}) abstract class MyPage extends BasePage { @Override protected String getOutputEncoding() { return "ISO-8859-1"; } } </code></pre> <p>But neither setting those values with @Meta annotation or overriding getOutputEncoding method works.</p> <p>I am using Tapestry 4.0.2.</p> <p>EDIT: I ended up doing this with a Servlet filter with subclassed HttpServletResposeWrapper. The wrapper overrides setContentType() to force required encoding for the response.</p>
[ { "answer_id": 160706, "author": "Brian", "author_id": 700, "author_profile": "https://Stackoverflow.com/users/700", "pm_score": 3, "selected": true, "text": "public class EncodingFilter implements Filter {\nprivate String encoding;\nprivate FilterConfig filterConfig;\n\n/**\n* @see java...
2008/09/30
[ "https://Stackoverflow.com/questions/153482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1431/" ]
153,496
<p>.Net Compact Framework</p> <p>Scenario: User is on a screen. Device can't finds a printer and asks the user if they want to try again. If they click "No", the current screen is closed and they are returned to the parent menu screen. If they click the "No" button multiple times, the first click will be used by the No button and the next click will take effect once the screen has completed redrawing. (In effect clicking a menu item which then takes the user to another screen.)</p> <p>I don't see a good place to put a wait cursor...there isn't much happening when the user clicks "No" except a form closing. But the CF framework is slow to redraw the screen.</p> <p>Any ideas?</p>
[ { "answer_id": 204298, "author": "tamberg", "author_id": 3588, "author_profile": "https://Stackoverflow.com/users/3588", "pm_score": 2, "selected": false, "text": "using System;\nusing System.Windows.Forms;\n\npublic sealed class Event {\n\n bool forwarding;\n\n public event EventH...
2008/09/30
[ "https://Stackoverflow.com/questions/153496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/620435/" ]