instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>When I use the <code>MouseUp</code> event, I can get it to fire with a mouse right-click. But <code>MouseLeftButtonUp</code> won't fire with either click!</p> <pre class="lang-xml prettyprint-override"><code>&lt;Button MouseLeftButtonUp="btnNewConfig_MouseUp" Name="btnNewConfig"&gt; &lt;StackPanel Orientation=...
<p>Looks like <code>Button</code> control is eating up that event Since <code>Button.Click</code> is actually a combination of <code>LeftButtonDown</code> event and <code>LeftButtonUp</code> event.</p> <p>But you can subscribe to the tunneled event <strong><code>PreviewMouseLeftButtonUp</code></strong> on the <code>Bu...
<p><code>Button</code> is using the Mouse[Left/Right]Button[Up/Down] events (and marking them as <code>Handled</code>) for its <code>Button.Click</code> events.</p> <p>As <a href="https://stackoverflow.com/a/318304/10927863">Jobi said</a>, you can use the <code>PreviewMouseLeftButtonUp</code> event, but I want to sugg...
41,134
<p>What tools allows me keep track of tags when doing web development? For example, I would like to be able to quickly find whether I missed closing a div tag.</p> <p>At the moment I am using notepad++ to write html. It highlights starting and ending tags, but it can take me time to review almost all tags to find wher...
<p><a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer">HTMLTidy</a> is pretty much the de-facto standard for this kind of thing nowadays</p> <p><a href="http://dev.int64.org/tidy.html" rel="nofollow noreferrer">Tidy Windows Installer</a></p> <p><a href="http://tidy.sourceforge.net/docs/faq.html" rel="nof...
<p>Indenting is helpful. I also find the <a href="http://users.skynet.be/mgueury/mozilla/" rel="nofollow noreferrer" title="Html Validator">Html Validator</a> extension for Firefox to be handy for checking for HTML issues once you're viewing the page in the browser (which is especially handy for checking server-generat...
14,498
<p>With squid, we can cache webpages. I am not sure if it provides the same number of caching methods as ASP.NET caching (I primarily use ASP.NET), but it's a tool to cache webpages.</p> <p>Then we have memcached, which can cache database tables. I believe this is correct, and it is like SqlCacheDependency (correct me...
<p>Try the method <code>rstrip()</code> (see doc <a href="http://docs.python.org/2/library/stdtypes.html#str.rstrip" rel="noreferrer">Python 2</a> and <a href="https://docs.python.org/3/library/stdtypes.html#str.rstrip" rel="noreferrer">Python 3</a>)</p> <pre><code>&gt;&gt;&gt; 'test string\n'.rstrip() 'test string' </...
<p>A catch all:</p> <pre><code>line = line.rstrip('\r|\n') </code></pre>
34,656
<p>I am aware that in <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> there are three timer types (see <em><a href="http://msdn.microsoft.com/en-us/magazine/cc164015.aspx" rel="noreferrer">Comparing the Timer Classes in the .NET Framework Class Library</a></em>). I have chosen a threaded...
<p>You can use something like <code>Console.ReadLine()</code> to block the main thread, so other background threads (like timer threads) will still work. You may also use an <a href="https://learn.microsoft.com/en-us/dotnet/api/system.threading.autoresetevent" rel="noreferrer">AutoResetEvent</a> to block the execution,...
<p>According to <a href="https://learn.microsoft.com/en-us/dotnet/api/system.threading.timer?view=net-5.0" rel="nofollow noreferrer">MSDN</a> and the other answers, a minimal working example of a Console application using a System.Threading.Timer without exiting immediately :</p> <pre><code>private static void Main() {...
2,243
<p>I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image.</p> <p>Example:</p> <pre><code>&lt;object id="img" data="image.svg" width="500" height="300"/&gt; &lt;script&gt;document.getElementById("img").addData([1,23,...
<p>Solution:</p> <p>in svg:</p> <pre><code>&lt;script&gt;document.method = function() {}&lt;/script&gt; </code></pre> <p>in html (using prototype to add event listeners):</p> <pre><code>&lt;script&gt;$("img").observe("load", function() {$("img").contentDocument.method()}); </code></pre> <p>You need to listen to th...
<p>For support in IE6, have a look at <a href="http://code.google.com/p/svgweb/" rel="nofollow">SVGWeb</a>.</p> <p>There are examples on how to manipulate SVG with JavaScript in the sample code supplied with the library.</p> <p>There is also a fair amount of information in the archives of the mailing list.</p>
16,740
<p>I need to do a comparaison between an object and NULL. When the object is not NULL I fill it with some data.</p> <p>Here is the code :</p> <pre><code> if (region != null) { .... } </code></pre> <p>This is working but when looping and looping sometime the region object is NOT null (I can see data inside it in ...
<p>Is the == and/or != operator overloaded for the region object's class?</p> <p>Now that you've posted the code for the overloads:</p> <p>The overloads should probably look like the following (code taken from postings made by <a href="https://stackoverflow.com/questions/155458/c-object-is-not-null-but-myobject-null-...
<p>So is it that these checks here are not right:</p> <pre><code>public static bool operator !=(Region r1, Region r2) { if (object.ReferenceEquals(r1, null)) { return false; } if (object.ReferenceEquals(r2, null)) { return false; } ... </code></pre>
18,803
<p>This is on iPhone 0S 2.0. Answers for 2.1 are fine too, though I am unaware of any differences regarding tables.</p> <p>It feels like it should be possible to get text to wrap without creating a custom cell, since a <code>UITableViewCell</code> contains a <code>UILabel</code> by default. I know I can make it work i...
<p>Here is a simpler way, and it works for me:</p> <p>Inside your <code>cellForRowAtIndexPath:</code> function. The first time you create your cell:</p> <pre><code>UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyl...
<p>I don't think you can manipulate a base <code>UITableViewCell's</code> private <code>UILabel</code> to do this. You could add a new <code>UILabel</code> to the cell yourself and use <code>numberOfLines</code> with <code>sizeToFit</code> to size it appropriately. Something like:</p> <pre><code>UILabel* label = [[UIL...
15,745
<p>I've asked a question before on the extruder gear clicking on my CR-10, but I'm certain its because of the nozzle getting clogged for some reason. I'm using a standard 0.4&nbsp;mm nozzle with white PLA and randomly during the print the extruder gear starts clicking on the fast parts and then under extrudes the rest ...
<p>Turns out the filament was the problem, I tried printing a model with a high quality sample PLA filament I had and it printed perfectly; one of the cleanest prints I've had. Never skimp on filament.</p> <p><img src="https://i.stack.imgur.com/AT3cW.jpg" alt="enter image description here"></p>
<p>White PLA is usually some of the worst stuff to print with, generally avoid it. I would say. I myself are having a lot of problems with it as well.</p>
1,457
<p>(Java question)</p> <p>If I reference a field in an inner class, does this cause a circular dependency between the enclosing class and the inner class?</p> <p>How can I avoid this? </p> <p>Here is an example:</p> <pre><code>public class Outer { private Other o; private Inner i; public Outer() { o...
<p><strong>Static vs instance class:</strong> If you declare the inner class as static then the instances of the inner class doesn't have any reference to the outer class. If it's not satic then your inner object efectivelly points to the outer object that created it (it has an implicit reference, in fact, if you use r...
<p>The syntax you're using in the example is a little off there is no declaration of the class or interface Inner. But there isn't anything wrong with the concept of the example. In Java it will work fine.</p> <p>I'm not sure what you're doing here, but you may want to consider a more simple design for maintainability...
14,397
<p>I am currently porting a lot of code from an MFC-based application to a DLL for client branding purposes.</p> <p>I've come across an unusual problem. This bit of code is the same in both systems:</p> <pre><code>// ... CCommsProperties props; pController-&gt;GetProperties( props ); if (props.handshake ...
<p>It is difficult to see what is wrong from the given code alone. Some general pointers:</p> <ol> <li><p>The object is initialized and processed in different binary modules with incompatible linking (such as C-run times)</p></li> <li><p>If the class/structure is shared it is not exported/imported correctly.</p></li> ...
<p>To really figure out what is going on, you probably need to post your source code -- or at least as much to replicate the problem. Unfortunately, StackOverflow doesn't seem like it encourages this. You could post your code on an FTP site or go to a site that allows posting of source code (like CodeGuru).</p>
19,518
<p>I'm just starting to pick up ASP.Net MVC and find myself writing a lot of &lt;%= %> in the views. Intellisense does supply the closing %>, but I find that typing the introductory &lt;%= to be burdensome (they are tough for me to type :-)).</p> <p>I've dabbled around a bit with Rails and the NetBeans IDE where I wa...
<p>This macro function should do it:</p> <p>The main code will do one of two things, if nothing is selected it will just insert the &lt;%= %> code construct, if you have something currently selected in the editor, it will wrap that code with the construct E.G. &lt;%= selected code here %></p> <pre><code>Public Sub Wr...
<p>I believe <a href="http://www.dotnetjunkies.ddj.com/Article/C95AC204-DE44-4D4A-A2B7-1EB1BE14A8A1.dcik" rel="nofollow noreferrer">Code Snippets</a> would fit the bill.</p>
32,772
<p>What's the most efficient way to calculate the last day of the prior quarter?</p> <p>Example: given the date 11/19/2008, I want to return 9/30/2008.</p> <p>Platform is SQL Server </p>
<p>If @Date has the date in question</p> <pre><code>Select DateAdd(day, -1, dateadd(qq, DateDiff(qq, 0, @Date), 0)) </code></pre> <p>EDIT: Thanks to @strEagle below, simpler still is:</p> <pre><code>Select dateadd(qq, DateDiff(qq, 0, @Date), -1) </code></pre>
<p><strong>In amazon redshift:</strong></p> <p>Last day of the previous quarter:</p> <pre><code>select dateadd(day,-1,DATE_TRUNC('qtr', current_date)) from whatever </code></pre> <p>Last day of current quarter:</p> <pre><code>select dateadd(qtr,1,dateadd(day,-1,DATE_TRUNC('qtr', current_date))) from whatever </code...
38,837
<p>I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. </p> <p>How does one go about writing 'hooks' into their code so that plugins can attach to specific events?</p>
<p>You could use an Observer pattern. A simple functional way to accomplish this:</p> <pre><code>&lt;?php /** Plugin system **/ $listeners = array(); /* Create an entry point for plugins */ function hook() { global $listeners; $num_args = func_num_args(); $args = func_get_args(); if($num_args &lt...
<p>I am surprised that most of the answers here seem to be geared about plugins that are local to the web application, ie, plugins that run on the local web server.</p> <p>What about if you wanted the plugins to run on a different - remote - server? The best way to do this would be to provide a form that allows you to...
2,244
<p>I find that whenever I begin writing an app in Java/C#, things start off good, but over time, as the app becomes more complex, it just gets more and more complicated. I've become aware of the fact that I'm not very good at design and high level architecture. All my classes become fairly strongly coupled and the de...
<p><strong>Books:</strong></p> <ul> <li>Code Complete, by Steve McConnel</li> <li>Design Patterns, by Gamma, et. al.</li> </ul>
<p>Try making program outlines and diagrams before you start, and have someone else review and critique it. Then as the program grows, continually update the outlines and diagrams to include the new functionality. Get it reviewed and critiqued by someone else. Eventually, assuming you are learning from the critiques, y...
30,777
<p>On the Python side, I can create new numpy record arrays as follows:</p> <pre><code>numpy.zeros((3,), dtype=[('a', 'i4'), ('b', 'U5')]) </code></pre> <p>How do I do the same from a C program? I suppose I have to call <code>PyArray_SimpleNewFromDescr(nd, dims, descr)</code>, but how do I construct a <code>PyArray_...
<p>Use <code>PyArray_DescrConverter</code>. Here's an example:</p> <pre><code>#include &lt;Python.h&gt; #include &lt;stdio.h&gt; #include &lt;numpy/arrayobject.h&gt; int main(int argc, char *argv[]) { int dims[] = { 2, 3 }; PyObject *op, *array; PyArray_Descr *descr; Py_Initialize(); import...
<p>See the <a href="http://csc.ucdavis.edu/~chaos/courses/nlp/Software/NumPyBook.pdf" rel="nofollow noreferrer">Guide to NumPy</a>, section 13.3.10. There's lots of different ways to make a descriptor, although it's not nearly as easy as writing <code>[('a', 'i4'), ('b', 'U5')]</code>.</p>
26,370
<p>I have a text string value that I'd like to persist from one web page to another without using query strings or the session/view states. I've been trying to get the ASP http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hiddenfield.aspx">HiddenField control to pass information from one web form to a ...
<p>If both pages live in the same application you can use Server.Transfer:</p> <p>firstpage.aspx:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Server.Transfer("~/secondpage.aspx"); } </code></pre> <p>secondpage.aspx:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { ...
<p>I would presume that the Response.Redirect() sends a Location: HTTP header to do a redirect.</p> <p>As HTTP is stateless, I'd also presume that these variables are inaccessible.</p> <p>There are however, solutions.</p> <ol> <li>Print a form with hidden fields, and use javascript to submit it</li> <li>Redirect in ...
21,909
<p>I'm a bit newbieish when it comes to the deeper parts of OSX configuration and am having to put up with a fairly irritating niggle which while I can put up with it, I know under Windows I could have sorted in minutes.</p> <p>Basically, I have an external disk with two volumes: </p> <p>One is an HFS+ volume which I...
<p>The following entry in <code>/etc/fstab</code> will do what you want, even on 10.5 (Leopard):</p> <pre><code>LABEL=VolumeName none ntfs noauto </code></pre> <p>If the file is not already there, just create it. Do not use <code>/etc/fstab.hd</code>! No reloading of <code>diskarbitrationd</code> needed.</p> ...
<p>This is not directly an answer, but</p> <blockquote> <p>The thing is that to remove the disk you have to eject the volume and in this case do it for both volumes</p> </blockquote> <p>I have a similar situation.</p> <p>OSX remembers where you put your icons on the desktop - I've moved the icons for both of my re...
4,121
<p>I assume that <code>char* = "string"</code> is the same to <code>char* = new char[6]</code>. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves?</p>
<p>No. You only need to manually free strings when you manually allocate the memory yourself using the <code>malloc</code> function (in C) or the <code>new</code> operator (in C++). If you do not use <code>malloc</code> or <code>new</code>, then the <code>char*</code> or string will be created on the stack or as a comp...
<p>new is always an allocation whereas defining a string inline actually embeds the data in the program itself and cannot be changed (some compilers allow this by a smart trick, don't bother).</p> <p>Some compilers type inline strings so that you cannot modify the buffer.</p> <pre><code>char* const sz1 = "string"; //...
7,475
<p>I have this piece of code in my PHP code:</p> <pre><code>while ($row = mysqli_fetch_assoc($result)) { extract($row); echo "&lt;tr&gt;"; echo "&lt;td bgcolor='#FFFFFF'&gt;&lt;input id='bookArray[]' name='bookArray[]' type='checkbox' value='$book_id' /&gt;$book_id&lt;/td&gt;"; echo "&lt;td bgcolor='#F...
<p>easy: <code>serialize().replace(/%5B%5D/g, '[]')</code></p>
<p>You may need to change your PHP as @Tomalak suggests, but you will also need to change your javascript. To reference a named element use the #name selector:</p> <pre><code>var selectedbooks = $('form#book_form').serialize();; </code></pre>
39,135
<p>I have a form with a textarea. Users enter a block of text which is stored in a database.</p> <p>Occasionally a user will paste text from Word containing smart quotes or emdashes. Those characters appear in the database as: –, ’, “ ,â€</p> <p>What function should I call on the input string to <em>convert sma...
<p>This sounds like a Unicode issue. Joel Spolsky has a good jumping off point on the topic: <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="noreferrer">http://www.joelonsoftware.com/articles/Unicode.html</a></p>
<p>We would often use standard string replace functions for that. Even though the nature of ASCII/Unicode in that context is pretty murky, it works. Just make sure your php file is saved in the right encoding format, etc. </p>
21,179
<p>I'm developing an invisible Java Applet, that will be controlled entirely from JavaScript.</p> <p>I can call the applet's Java methods easily, and I can call JavaScript methods from within the applet by using <code>netscape.javascript.JSObject.getWindow(this).call()</code>.</p> <p>But in order to register a JavaSc...
<p>I am brand new to Java &lt;-> JavaScript communication, as I planned to explore it this week. A good opportunity here... :-)</p> <p>After some tests, it seems you cannot pass a JS function to a Java applet. Unless I am doing it the wrong way...</p> <p>I tried:</p> <pre><code>function CallJava() { document.Apple...
<p>win.eval() will call a predefined javascript.</p> <pre><code>String callbackFunction; public void RegisterCallback(String functionName) { callbackFunction = functionName; } void UseCallbackFunction() { if (callbackFunction == null) return; JSObject win = (JSObject) JSObject.getWindow(this); win.eval(c...
37,791
<p>I am using Enterprise Library 4.0 and I can't find any documentation on creating a custom logging filter. Has anyone done this or seen any good online documentation on this?</p>
<p><a href="https://web.archive.org/web/20160512123637/http://geekswithblogs.net:80/.NETonMyMind/archive/2006/05/15/78201.aspx" rel="nofollow noreferrer">Using Custom Filters in the Enterprise Library Logging Block</a></p> <p>Great Article.</p>
<p>Perusing through EntLib's source code would probably help you if the documentation is scant; it's well-written and well-commented.</p>
18,163
<p>I'm trying to select more than 80,000 record in SQL Server in a table that has millions of records. The issue is that I've the correct Index, but it takes more than 15 minutes to return the recordset.</p> <p>I'm using MS SQL Server 2000, I found a pagination method using stored procedures but it uses a temporal tab...
<p>You'll have to edit this to implement your input parameters for user's filtering and sort options, but the general principle will apply.. I used this technique with SQL 2000 in 2000/2001 timeframe with 90M record table to deliver fast paging for 150-200k row resultsets. Since only the key is in the temp table, it ...
<p>There are a few of options. The usual DB tuning tricks (on which I'm not an expert). Is it possible to extract the subset data you care about into a smaller table behind the scenes?</p>
49,954
<p>I have found <a href="http://www.jamesholmes.com/struts/console/help.html" rel="nofollow noreferrer">Struts Console Tool</a> but its development stopped in 2004, so it works with Netbeans 3.2.</p> <p>Is there a way to install it under Netbeans 6.5?</p> <p>Are there any options to edit struts-config.xml above the X...
<p>Netbeans supports automatic <code>struts-config.xml</code> modifications. For instance if you right click on your project and choose <code>New/Struts Action</code> Netbeans will not only create a new class, but it can also modify your <code>struts-config.xml</code> and add a new <code>&lt;action&gt;</code> tag. Of c...
<p>You need a tool to write a very simple XML file? Especially when the IDE should offer you tag completion, member list assistance, etc, in the XML editor?</p>
47,296
<p>I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script <code>set_abc_env.rb</code> to set environment variable 'ABC' to 'blah', I expect to run the following:</p> <pre><code>C:&gt; echo %ABC% C:&gt; set_abc_env.rb C:&gt; echo %ABC% bl...
<p>You can access environment variables via Ruby ENV object:</p> <pre><code>i = ENV['ABC']; # nil ENV['ABC'] = '123'; i = ENV['ABC']; # '123' </code></pre> <p>Bad news is, as MSDN <a href="http://msdn.microsoft.com/en-us/library/ms682009(VS.85).aspx" rel="noreferrer">says</a>, a process can never directly change the ...
<p>For anyone else looking for a solution for this and looking for a more of a hack that doesn't require logging in or out I came up with this solution for a similar problem :</p> <p><strong>WORKAROUND:</strong></p> <p>My work around is dependent on combination of ruby and a command line utility called <a href="http:...
23,073
<p>I would like to create a database backed interactive AJAX webapp which has a custom (specific kind of events, editing) calendaring system. This would involve quite a lot of JavaScript and AJAX, and I thought about Google Web Toolkit for the interface and Ruby on Rails for server side.</p> <p>Is Google Web Toolkit r...
<p>RoR is actually one of the things the GWT is made to work well with, as long as you're using REST properly. It's in the Google Web Toolkit Applications book, and you can see a demo from the book using this kind of idea <a href="http://www.gwtapps.com/?page_id=33" rel="noreferrer">here</a>. That's not to say that y...
<p>You could also consider <a href="http://grails.org/" rel="nofollow noreferrer">Grails</a> ("Groovy on Rails") which gives you the benefits of a Rails framework and the use of the Java VM.</p>
5,067
<p>I googled a lot, and could not find a single open source implementation of SFTP in .NET. All i got is 3rd party component for SFTP. can anyone help me with SFTP implenetation in .NET ?</p>
<p>See <a href="https://stackoverflow.com/questions/86458/how-do-i-upload-a-file-to-an-sftp-server-in-c-net#86510">this question</a> and <a href="http://sourceforge.net/projects/sharpssh" rel="nofollow noreferrer">shrpssh</a>, which was the accepted answer.</p>
<p>You may want to check out Granados</p> <p><a href="http://www.csharpopensource.net/granados.aspx" rel="nofollow noreferrer">http://www.csharpopensource.net/granados.aspx</a></p>
21,659
<p>web2py to is a Python framework but shares the "convention over configuration" design that Ruby on Rails has. On the plus side it packages a lot more functionality with its s standard distribution and we claim it is faster and easier to use.</p> <p>Has any Rails user tried it? What is your impression?</p> <p>No r...
<p>c'mon guys... your only argument is "Technical differences are rather irrelevant." and "it don't matter what web framework you use"? I disagree. The size of the users base has more to do with marketing and how long a framework has been around. By that argument ASP and PHP are better than Rails.</p> <p>Has anyb...
<p>I would say the biggest "con" of using webpy over Rails is that there are not a lot of Rails-specific hosting services around, and the huge community based around it (there are Rails plugins and tools for.. everything). The same cannot be said for web2py.</p> <p>It depends what you want to do with it - if it's some...
42,382
<p>I have inherited some code for a custom CMS that is a little out of my league and keep stumbling over the same errors, Notice: Undefined variable: media in /Applications/MAMP/htdocs/Chapman/Chapman_cms/admin/team-2.php on line 48. This is supposed to create new users and edit old users. However, it does not work whe...
<p>To remove the notice in the right way is to do this with the code</p> <pre><code>&lt;?php if(isset($media['copy'])){ echo $media['copy']; } ?&gt; </code></pre>
<p>The code you posted does not do any creating, so that problem does not stemfrom this bit of code.</p> <p>The undefined notice is from the <code>&lt;?=$media['copy']?&gt;</code> bit. $media was never defined. If this is not an issue, ignore it and tell PHP to not output notices. This isn't exactly good practice, but...
18,981
<p>I need to test some HTTP interaction with a client I'd rather not modify. What I need to test is the behavior of the server when the client's requests include a certain, static header.</p> <p>I'm thinking the easiest way to run this test is to set up an HTTP proxy that inserts the header on every request. What woul...
<p>I do something like this in my development environment by configuring Apache on port 80 as a proxy for my application server on port 8080, with the following Apache config:</p> <pre><code>NameVirtualHost * &lt;VirtualHost *&gt; &lt;Proxy http://127.0.0.1:8080/*&gt; Allow from all &lt;/Proxy&gt; &lt;L...
<p>If you have ruby on your system, how about a small Ruby Proxy using Sinatra (make sure to install the Sinatra Gem). This should be easier than setting up apache. The code can be found <a href="http://thecoderslife.blogspot.com/2015/07/a-http-proxy-using-sinatra.html" rel="nofollow">here.</a></p>
18,665
<p>Has anybody implemented a feature where if the user has not touched the screen for a certain time period, you take a certain action? I'm trying to figure out the best way to do that.</p> <p>There's this somewhat-related method in UIApplication:</p> <pre><code>[UIApplication sharedApplication].idleTimerDisabled; </...
<p>Here's the answer I had been looking for:</p> <p>Have your application delegate subclass UIApplication. In the implementation file, override the sendEvent: method like so:</p> <pre><code>- (void)sendEvent:(UIEvent *)event { [super sendEvent:event]; // Only want to reset the timer on a Began touch or an En...
<p>Outside is 2021 and I would like share my approach to handle this without extending the UIApplication. I will not describe how to create a timer and reset it. But rather how to catch all events. So your AppDelegate starts with this:</p> <pre><code>@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDeleg...
34,447
<p>Is there any way to direct C# to ignore <code>NullReferenceException</code> (or any specific exception for that matter) for a set of statements. This is useful when trying to read properties from a deserialized object that may contain many null objects in it. Having a helper method to check for null could be one wa...
<p>In short: no. Null-check the reference before trying to use it. One useful trick here might be C# 3.0 extension methods... they allow you to <em>appear to</em> invoke something on a null reference without error:</p> <pre><code>string foo = null; foo.Spooky(); ... public static void Spooky(this string bar) { Con...
<pre><code>try { // exceptions thrown here... } catch (NullReferenceException) { } </code></pre>
38,137
<p>Per this <a href="http://www.15seconds.com/issue/040830.htm" rel="nofollow noreferrer">helpful article</a> I have confirmed I have a connection pool leak in some application on my IIS 6 server running W2k3. </p> <p>The tough part is that I'm serving 300 websites written by 700 developers from this server in 6 appli...
<p>Try starting with this <a href="http://msdn.microsoft.com/en-us/library/aa175863(SQL.80).aspx" rel="nofollow noreferrer">first article from Bill Vaughn</a>.</p>
<p>Todd Denlinger wrote a fantastic class <a href="http://www.codeproject.com/KB/database/connectionmonitor.aspx" rel="nofollow">http://www.codeproject.com/KB/database/connectionmonitor.aspx</a> which watches Sql Server connections and reports on ones that have not been properly disposed within a period of time. Wire i...
19,727
<p>Another easy one hopefully.</p> <p>Let's say I have a collection like this:</p> <pre><code>List&lt;DateTime&gt; allDates; </code></pre> <p>I want to turn that into </p> <pre><code>List&lt;List&lt;DateTime&gt;&gt; dividedDates; </code></pre> <p>where each List in 'dividedDates' contains all of the dates in 'allD...
<pre><code>var q = from date in allDates group date by date.Year into datesByYear select datesByYear.ToList(); q.ToList(); //returns List&lt;List&lt;DateTime&gt;&gt; </code></pre>
<p>Here's the methods form.</p> <pre> allDates .GroupBy(d => d.Year) .Select(g => g.ToList()) .ToList(); </pre>
9,514
<p>Has anyone implements Subversion with Siteminder as authentication provider ? If yes, would it be possible to provide an overview of how the whole setup is done ?</p> <p>Since I am using only HTTP authentication, I think it would be easier to integrate with SM, but I am not able to find much help on this on the net...
<p>SVN with Siteminder has been implemented and is working now. Since there is not much of information out there on this, I would like to post the overview of steps followed:</p> <ol> <li>Cookie based authentcation was disabled on Siteminder end</li> <li>HTTP AUTH was enabled (in Siteminder) and all webdav methods wer...
<p>Look for information about <strong>Apache</strong> and Siteminder as Apache is responsible for the HTTP transport stuff in Subversion</p>
9,936
<p>I want to have a web based admin to upload, delete files and folders in Amazon S3 on ASP.NET website. <br/> I am pretty sure something like this already exist, has anyone seen it? </p>
<p>Have you tried this one? <a href="http://www.codeplex.com/ThreeSharp" rel="nofollow noreferrer">http://www.codeplex.com/ThreeSharp</a></p>
<p><a href="http://www.cloudberrylab.com" rel="nofollow">Cloudberry has some cool products, I love the backup besides the explorer.</a></p>
29,247
<p>I'd love to use PHP variables in my CSS files but I don't want to load up the whole Symfony stack for each file load. Any one have any best practices and/or plugins to manage their CSS files in Symfony?</p>
<p>but you dont need full symfony stack for that ( except if you need some internal symfony state / variable ).</p> <p>You just use</p> <pre><code>&lt;link rel="stylesheet" type="text/css" media="screen" href="/css/mycss.php" /&gt; </code></pre> <p>and then you can use php inside your css. you could add appropriate ...
<p>Here's one good Plugin that tries to manage and/or combine your assets:</p> <p><a href="http://www.symfony-project.org/plugins/sfCombinePlugin" rel="nofollow noreferrer">http://www.symfony-project.org/plugins/sfCombinePlugin</a></p> <p>Here's their description:</p> <blockquote> <p>Combines multiple JavaScript a...
48,342
<p>I have a c# site which makes use of a lot of images with embedded english text. </p> <p>How can I use a standard resource file to swap out images depending on the language?</p> <p>I have a resx file in my App_GlobalResources directory, but I can't seem to get it plugged into an asp:image control for the imageurl ...
<p>you can store the url of the image in your resource file and use the following inline code in the control </p> <pre><code>&lt;asp:Image ImageUrl="&lt;%$resources:Image1 %&gt;" /&gt; </code></pre> <h3>Update</h3> <p>this <a href="http://aspalliance.com/726" rel="noreferrer">link</a> could be helpful on what you ar...
<p>if you are using global resources file you need to add it like this </p> <pre><code>&lt;img id="WelocmeICon" runat="server" alt="welcome icon" src="&lt;%$resources:NmcResource,WelcomeIcon %&gt;" /&gt; </code></pre> <p>and because i use img control i added runatserver and id for it </p>
30,360
<p>Does anyone have any code examples on how to create controllers that have parameters other than using a Dependency Injection Container? </p> <p>I see plenty of samples with using containers like StructureMap, but nothing if you wanted to pass in the dependency class yourself.</p>
<p>You can use poor-man's dependency injection:</p> <pre><code>public ProductController() : this( new Foo() ) { //the framework calls this } public ProductController(IFoo foo) { _foo = foo; } </code></pre>
<p>You can create an IModelBinder that spins up an instance from a factory - or, yes, the container. =)</p>
14,870
<p>My professor did an informal benchmark on a little program and the Java times were: 1.7 seconds for the first run, and 0.8 seconds for the runs thereafter. </p> <ul> <li><p>Is this due entirely to the loading of the runtime environment into the operating environment ?</p> <p>OR </p></li> <li><p>Is it influenced b...
<p>Okay, I found where I read that. This is all from &quot;Learning Java&quot; (O'Reilly 2005):</p> <blockquote> <p>The problem with a traditional JIT compilation is that optimizing code takes time. So a JIT compiler can produce decent results but may suffer a significant latency when the application starts up. This i...
<p>Java JVM (actually might change from different implementations of the JVM) when first started out will interpret the byte code. Once it detects that the code will be running enough number of times JITs it to native machine language so it runs faster. </p>
9,361
<p>Is it possible to just send a JPanel or any other component to the printer? Or do I have to implement all the drawing to the graphics object by hand?</p> <p>I have tried to use the Print* functions of the JPanel to print to the graphics object but the page that gets printed is blank.</p>
<p>Check out the Java printing API <a href="http://java.sun.com/docs/books/tutorial/2d/printing/gui.html" rel="nofollow noreferrer">and tutorial</a> along with JComponent.print(Graphics).</p> <p>Here is a rudimentary class which will print any component which fits on 1 page (I can't take credit for this, I got the cod...
<p>please consider <a href="https://stackoverflow.com/a/49378186/1273555">this answer</a> for printing a <code>Component</code> to multiple pages:</p> <pre><code>import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.print.*; import javax.swing.Repa...
44,299
<p>I want to know what exactly is the sequence of calls that occurs when a getter/setter created through Class::MethodMaker is called?</p> <p>How much costlier are getter/setters defined by MethodMaker than the native ones (overwritten in the module)?</p>
<p>I don't have a simple answer for your question regarding Class::MethodMaker performance. As a previous answer mentioned, you can use the debugger to find out what's going on under the hood. However, I know that Class::MethodMaker generates <em>huge</em> amounts of code at install time. This would indicate three sepa...
<p>The real question is: does it matter?</p> <p>It's yet another accessors generating module. These modules all have a speed/functionality trade-off. Just pick one that offers everything you need. It's not like accessors are likely to become a bottleneck in your application.</p>
8,745
<p>I have a database with 2 tables.</p> <p>One of the tables holds a row containing numbers, from 0 to 10.</p> <p>In PHP, I do this: </p> <pre><code>$query = "SELECT ".$param." FROM issues WHERE ".$param." &gt;=0"; $result = @mysql_query($query) or showError("query failed"); if (!($record = mysql_fetch_array($resul...
<p>I'm not exactly sure what you are trying to achieve here, but I think what you want is:</p> <pre><code>// query... $records = array(); while($r = mysql_fetch_array($result)) { $records[] = $r; } return $records; </code></pre>
<p>By default <a href="http://it.php.net/mysql_fetch_array" rel="nofollow noreferrer">mysql_fetch_array</a> returns both normal and associative arrays, so you can access the values by position ($result[0]) or by name ($result['user_name'])':</p> <pre><code>array mysql_fetch_array ( resource $result [, int $result_ty...
45,635
<p>I need to open a password protected shared folder on a network to gain access to an Access 97 database. How do I open the folder and pass in the password?</p>
<p>found here <a href="http://www.mredkj.com/vbnet/vbnetmapdrive.html" rel="noreferrer">http://www.mredkj.com/vbnet/vbnetmapdrive.html</a></p> <pre><code>Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" _ ( ByRef lpNetResource As NETRESOURCE, ByVal lpPassword As String, _ ByVal lp...
<p>one solution would be to map the network folder to an available drive letter. You could accomplish that using Windows OS commands:</p> <pre><code>System.Diagnostics.Process.Start("net.exe", "use K: \\Server\URI\path\here /USER:&lt;username&gt; &lt;password&gt;" ) </code></pre> <p>Simply replace the username and pa...
41,552
<p>I'm trying to figure out how to parse out the text of an email from any quoted reply text that it might include. I've noticed that usually email clients will put an "On such and such date so and so wrote" or prefix the lines with an angle bracket. Unfortunately, not everyone does this. Does anyone have any idea o...
<p>I did a lot more searching on this and here's what I've found. There are basically two situations under which you are doing this: when you have the entire thread and when you don't. I'll break it up into those two categories:</p> <p><strong>When you have the thread:</strong></p> <p>If you have the entire series ...
<p>It is old post, however, not sure if you are aware github has <a href="https://github.com/github/email_reply_parser" rel="nofollow">a Ruby lib</a> extracting the reply. If you use .NET, I have a .NET one at <a href="https://github.com/EricJWHuang/EmailReplyParser" rel="nofollow">https://github.com/EricJWHuang/EmailR...
35,208
<p>I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate.</p> <p>But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error.</p> <p>What is going on here?</p>
<p>No, you can't use a DynamicResource in a Storyboard that is contained within a Style or ControlTemplate. In fact, you can't use a data binding expression either.</p> <p>The story here is that everything within a Style or ControlTemplate must be safe for use across threads and the timing system actually tries to fre...
<p>While you can have <code>DynamicResource</code> in a <code>ControlTemplate</code>, you just can't have one in a <code>StoryBoard</code>.</p> <p>I worked around this with a <code>Opacity</code> (or <code>Visibility</code>) hack. You can add two elements to your <code>ControlTemplate</code>. Each of them uses one of t...
18,631
<p>I have a file that lists filenames, each on it's own line, and I want to test if each exists in a particular directory. For example, some sample lines of the file might be</p> <pre><code>mshta.dll foobar.dll somethingelse.dll </code></pre> <p>The directory I'm interested in is <code>X:\Windows\System32\</code>, so...
<p>In cmd.exe, the <strong>FOR /F %</strong><em>variable</em> <strong>IN (</strong> <em>filename</em> <b>) DO</b> <em>command</em> should give you what you want. This reads the contents of <em>filename</em> (and they could be more than one filenames) one line at a time, placing the line in %variable (more or less; do a...
<p>In Windows:</p> <pre><code> type file.txt >NUL 2>NUL if ERRORLEVEL 1 then echo "file doesn't exist" </code></pre> <p>(This may not be the best way to do it; it is a way I know of; see also <a href="http://blogs.msdn.com/oldnewthing/archive/2008/09/26/8965755.aspx" rel="nofollow noreferrer"><a href="http://blogs.ms...
18,179
<p>When using </p> <pre><code>$('.foo').click(function(){ alert("I haz class alertz!"); return false; }); </code></pre> <p>in application.js, and</p> <pre><code>&lt;a href = "" class = "foo" id = "foobar_1" &gt;Teh Foobar &lt;/a&gt; </code></pre> <p>in any div that initializes with the page, when c...
<p>We've used <a href="http://www.openssl.org/" rel="noreferrer">OpenSSL</a> with good success. Portable, standards compliant and easy to use.</p>
<p><a href="http://www.gnupg.org/related_software/gpgme/index.en.html" rel="nofollow noreferrer">GPGme</a>. Simple to use and compatible with the <a href="http://www.ietf.org/rfc/rfc4880.txt" rel="nofollow noreferrer">OpenPGP format</a></p>
21,823
<p>Does anyone know of a library or set of classes for splines - specifically b-splines and NURBS (optional). </p> <p>A fast, efficient b-spline library would be so useful for me at the moment.</p>
<p>1.) For B Splines - You should check Numerical Recipes in C (there is book for that and it is also available online for reference)</p> <p>2.) Also check: <a href="http://sourceforge.net/projects/einspline/" rel="noreferrer">sourceforge.net/projects/einspline/</a> &amp; <a href="http://www.gnu.org/software/gsl/ma...
<p><a href="https://github.com/SINTEF-Geometry/SISL" rel="nofollow">SISL</a> seems to be a good NURBS library (under the AGPL licence). It is part of <a href="http://www.sintef.no/Geometry-Toolkits" rel="nofollow">GoTools</a> which can be cloned <a href="https://github.com/SINTEF-Geometry/GoTools" rel="nofollow">here</...
42,399
<p>I have a SOAP client in Ruby that I'm trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here's what the server looks like:</p> <pre><code>require 'soap/rpc/standaloneServer' require 'soap/rpc/driver' require 'rubygems...
<p>Arg. I was trying to follow along <a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/108292" rel="nofollow noreferrer">this link</a> and it turns out I was missing a simple include statement:</p> <pre><code>require 'webrick/https' </code></pre> <p>That, combined with the help from the link in the...
<p>Me too.. and don't forget to put the :SSLEnable => true spend couple of hours figuring that out...</p> <pre><code>server = Server.new(:BindAddress =&gt; HelperFunctions.local_ip, :Port =&gt; 1234, :SSLEnable =&gt; true, :SSLCertificate =&gt; cert("path to cert"), :SSLPrivateKey =&gt; key("path to rsa private key"))...
24,346
<p>How can you get a recent release, i.e. 4.2+, of g++/gcc for windows? Mingw's standard g++ is 3.4.5 which is 3 years old, released Nov 2005. Mingw have a 4.2 version but this is only in the Alpha stage. I cannot find a stable recent release of g++ for windows, surely I must be missing something.</p>
<p><a href="http://www.tdragon.net/" rel="nofollow noreferrer">Twilight Dragon Media</a> track and regularly release GCC releases usable for MinGW environments.</p> <p>The current release is based on GCC 4.3.2.</p> <p>The packages can be downloaded <a href="http://www.tdragon.net/recentgcc/" rel="nofollow noreferrer"...
<p>You can get a MinGW distro that uses gcc 4.3.3 <a href="http://nuwen.net/mingw.html" rel="nofollow noreferrer">here</a> - I've played with it but not used it in anger. It comes complete with boost and several other useful libraries</p>
47,509
<p>Is there any way other than using reflection to access the members of a anonymous inner class?</p>
<p>Anonymous inner classes have a type but no name.</p> <p>You can access fields not defined by the named supertype. However once assigned to a named type variable, the interface is lost.</p> <p>Obviously, you can access the fields from within the inner class itself. One way of adding code is through an instance init...
<p>If it implements an interface or extends an existing class, you can access the members defined in the interface or base class.</p>
41,353
<p>I am trying to set a <code>javascript</code> <code>date</code> so that it can be submitted via <code>JSON</code> to a <code>.NET</code> type, but when attempting to do this, <code>jQuery</code> sets the <code>date</code> to a full <code>string</code>, what format does it have to be in to be converted to a <code>.NET...
<p><a href="http://support.microsoft.com/kb/320687" rel="nofollow noreferrer" title="KB Article 320687">Microsoft KB Article 320687</a> has a detailed answer to this question.</p> <p>Basically, you override the WndProc method to return HTCAPTION to the WM_NCHITTEST message when the point being tested is in the client ...
<p>VC++ 2010 Version (of FlySwat's):</p> <pre><code>#include &lt;Windows.h&gt; namespace DragWithoutTitleBar { using namespace System; using namespace System::Windows::Forms; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Data; using names...
5,008
<p>It's one of those things that seems to have an odd curve where the more I think about it, the more it makes sense. To a certain extent, of course. And then it doesn't make sense to me at all.</p> <p>Care to enlighten me?</p>
<p>Because in most cases you've got to sort your results first. For example, when you search on Google, <a href="http://www.google.com.au/search?hl=en&amp;safe=off&amp;q=google&amp;start=1000&amp;sa=N" rel="noreferrer">you can view only up to 100 pages of results</a>. They don't bother sorting by page-rank beyond 1000 ...
<p>Of course sorting on a random query takes some time, but if you're having problems with the same paginated query being used regulary, there's either something wrong with the database setup (improperly indexing/none at all, too little memory etc. I'm not a db-manager) or you're doing pagination seriously wrong: </p> ...
4,925
<p>I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess backend for a pretty small database concept I have. </p> <p>I have written this application once before in just MSAccess but I now need the app and database to be in different places. I have now figured out (thanks to a StackOverflow user) th...
<p>If you're targeting modern versions of Windows (Windows 2000) and above, you can use the <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-updatelayeredwindow" rel="nofollow noreferrer">UpdateLayeredWindow</a> function to display any bitmap (including one with an alpha channel, if so de...
<p>It's a Win32 api FAQ</p> <p>See professional Win32api forum news://194.177.96.26/comp.os.ms-windows.programmer.win32 where it has been answered hundreds of times for 20 years..</p>
20,262
<p>What i mean exactly is that build.xml that actually included those plugins like findbugs etc. Or nicely done build.xml </p>
<p>A great resource for sample Ant build files is Google code search. <a href="http://code.google.com/search/#q=build.xml" rel="nofollow noreferrer">Search Google Code for build.xml</a>. Once you search, narrow it down to "Project Hosting" to get the real meat. You will find dozens of examples of real, working, usable ...
<p>You could use maven 2, because it has built-in plugin support.And all the stuff like: PMD, Findbugs, Checkstyle etc , could be integrated automatically . If you have some existing code it could be called from maven you could use maven-antrun-plugin. </p>
18,969
<p>I have problems opening a berkeley db in python using bdtables. As bdtables is used by the library I am using to access the database, I need it to work.</p> <p>The problem seems to be that the db environment I am trying to open (I got a copy of the database to open), is version 4.4 while libdb is version 4.6. I get...
<p>I think answers should go in the "answer" section rather than as an addendum to the question since that marks the question as having an answer on the various question-list pages. I'll do that for you but, if you also get around to doing it, leave a comment on my answer so I can delete it.</p> <p>Quoting "answer in...
<p>Damn, verifying everything in this question I eventually solved the problem. The 'No such file or directory' are caused by some __db.XXX files missing. Using bsddb.dbtables.bsdTableDB([dbname],[folder], create=1) after db4.4_recover, these files got created and everything is now working.</p> <p>Still, it was a bit ...
21,932
<p>I'm a bit surprised I haven't found a good open source library for performing common network tasks. There are a few very good commercial libraries, but they're too expensive to use on an open source project. </p> <p>Anyone know of any?</p>
<p>SSH.NET Library - <a href="https://github.com/sshnet/SSH.NET" rel="nofollow noreferrer">https://github.com/sshnet/SSH.NET</a></p> <p>Inspired by Sharp.SSH, this library is complete rewrite using .NET 4.0, without any third party dependencies and utilizes parallelism as much as possible to allow best performance.</p...
<p>IIRC, FTP is built in to .NET, (System.Net.FtpWebRequest) and last time I looked (a couple of years ago, admittedly) I couldn't find any free SSH / SFTP assemblies. That might have changed, though.</p>
18,487
<p>Is it possible to find the <code>foreach</code> index?</p> <p>in a <code>for</code> loop as follows:</p> <pre><code>for ($i = 0; $i &lt; 10; ++$i) { echo $i . ' '; } </code></pre> <p><code>$i</code> will give you the index.</p> <p>Do I have to use the <code>for</code> loop or is there some way to get the inde...
<pre><code>foreach($array as $key=&gt;$value) { // do stuff } </code></pre> <p><code>$key</code> is the index of each <code>$array</code> element</p>
<pre><code>foreach(array_keys($array) as $key) { // do stuff } </code></pre>
17,042
<p>I'm wondering what is the quickest and most reliable way to forward mail from an IMAP account.</p> <p>My university does not allow our student-mailbox to forward to a private e-mail account (everybody uses either Gmail or Hotmail here). It's a political thing, not technical. We do have IMAP access to the mailbox. I...
<p>You might want to look at <A HREF="http://www.fetchmail.info//" rel="nofollow noreferrer">Fetchmail</A>, as this sounds like the problem it was designed to solve. Fetchmail retrieves mail from POP/IMAP/etc servers and forwards it to SMTP/LMTP/etc servers. Fetchmail has the advantage of a few years and lots of users ...
<p>If using Gmail you can configure GMAIL to pick up mail from other accounts.</p>
8,184
<p>I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.com), and uploading the site files, I g...
<p>The Database Publishing Wizard's generated scripts usually need to be tweaked since it sometimes gets the order wrong of table/procedure creation when dealing with constraints. What I do is first backup the database, then run the script, and if I get an error, I move that query to the end of the script. Continue res...
<p>You should be able to expose the underlying error message by setting the following in the web.config:</p> <pre><code>customErrors mode="Off" </code></pre> <p>Could you elaborate on "and uploading the site files"? New instance of DNN? updating an existing site? upgrading DNN version? If upgrade or update -- what fi...
3,560
<p>That is a problem I'm facing right now. I need to specify the hardware that will run my piece of software. The thing is: the project isn't finished yet, and I need it running in "real" conditions before I can go on, conditions which I cannot reproduce at home; what I can test at home barely scratches them. We don't ...
<p>If you need to test your setup on a machine with less specifications then your own machine then you could use a virtual pc setup to test it and just keep reducing the virtual pc settings until your software stops performing adequately.</p> <p>If its the other way around, then I think, as Paul said, its a case of be...
<p>Can't you beg, borrow or steal the biggest hardware you can get, and then once it's in those "real" conditions, start reducing the capacity either by hardware changes (removing memory, underclocking) or by software (running other programs that consume memory or CPU cycles) until you find a point where it doesn't wor...
20,616
<p>I am following a VB tutorial to do some <a href="http://blogs.msdn.com/bethmassi/archive/2008/04/25/querying-html-with-linq-to-xml.aspx" rel="nofollow noreferrer">HTML manipulation using LINQ</a> </p> <p>It has the following construct</p> <pre><code>Imports &lt;xmlns="http://www.w3.org/1999/xhtml"&gt; </code></pre...
<p>VB.Net has a feature called <code>XML Literals</code> that is not present in C#. This import statement adds a namespace for use with those literals.</p> <p>In researching this information, I found this link helpful:<br> <a href="http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-dat...
<p>I think the example you're looking at may be using XML literals, which are not supported in C#.</p>
39,388
<p>I need to do a date comparison in Mysql without taking into account the time component i.e. i need to convert '2008-11-05 14:30:00' to '2008-11-05'</p> <p>Currently i am doing this:</p> <pre><code>SELECT from_days(to_days(my_date)) </code></pre> <p>Is there a proper way of doing this?</p>
<p>Yes, use the <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date" rel="noreferrer">date</a> function:</p> <pre><code>SELECT date(my_date) </code></pre>
<p>You could use <code>ToShortDateString();</code></p>
33,581
<p>I'm writing a helper method for ASP.NET MVC and I need to call <code>Url.Content</code> to get an appropriate URL for the context. However, in order to create a new <code>UrlHelper()</code> I need to get the current <code>RequestContext</code> (<code>System.Web.Routing.RequestContext</code> to be precise) and I'm n...
<p>If the current IHttpHandler is MvcHandler, you can use</p> <pre><code>((MvcHandler)HttpContext.Current.Handler).RequestContext </code></pre>
<p>Don't create a new one. Just extend the existing UrlHelper, just like you'd extend HtmlHelper:</p> <pre><code>public static string IdLink(this UrlHelper helper, Guid id) { //... </code></pre> <p>If you must use both HtmlHelper and UrlHelper, pass one of them as a regular (non-"this") argument.</p>
45,709
<p>The following code produces an error hr=0x80020005 (wrong type).</p> <pre><code>#import &lt;msi.dll&gt; using namespace WindowsInstaller; main() { ::CoInitialize(NULL); InstallerPtr pInstaller("WindowsInstaller.Installer"); DatabasePtr pDB = pInstaller-&gt;OpenDatabase( "c:\\foo\\bar.msi", ...
<p>I finally got the answer on <a href="http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/225c2a86-aa2e-4eab-b2be-0897c695eb7f/?ppud=4&amp;ffpr=0" rel="nofollow noreferrer">msdn forums</a></p> <pre><code>DatabasePtr pDB = pInstaller-&gt;OpenDatabase( "c:\\foo\\bar.msi", ...
<p>MSDN says <a href="http://msdn.microsoft.com/en-us/library/aa370338(VS.85).aspx" rel="nofollow noreferrer">OpenDatabase</a> is available from MSI version 4.0 onwards, <a href="http://msdn.microsoft.com/en-us/library/bb736312(VS.85).aspx" rel="nofollow noreferrer">transactions</a> in general from MSI 4.5 onwards. Jus...
42,190
<p>I'm looking for a c# snippet which I can insert in a Windows service. The code must empty the recycle bin for all users on the computer.</p> <p>I have previously tried using <code>SHEmptyRecycleBin</code> (ref <a href="http://www.codeproject.com/KB/cs/Empty_Recycle_Bin.aspx" rel="nofollow noreferrer">http://www.cod...
<p>I think doing something like this is against Microsoft recommended practices. What are you trying to do that requires emptying the Recycle Bin from a Windows service?</p>
<p>First, have you tried running the service on an interactive user account? Maybe SHEmptyRecycleBin requires an interactive user even though it doesn't necessarily display a Window.</p> <p>Second, I'm not sure it's a good idea to delete other users' stuff but I guess you have a very good reason?</p>
3,009
<p>I currently have a cluster of 4 Apache web servers which are used to serve up static files of up to 30Mb in size. Generally, I can expect up to 5000 concurrent connections to these servers. What performance improvement would I expect to get by moving this to lighttpd?</p>
<p>I would expect it to handle the concurrency with much more ease and less memory overhead. I've stopped deploying Apache pretty much everywhere I can.</p> <p>You may also consider nginx for a comparison.</p>
<p>From the top of my head:</p> <ol> <li>Smaller memory footprint</li> <li>Quicker file reads</li> </ol> <p>Definitely check out the benchmark at their site, they provide a lot of information on this topic: <a href="http://www.lighttpd.net/benchmark" rel="nofollow">http://www.lighttpd.net/benchmark</a></p>
42,509
<p>I'm struggling to get around the 404 errors from asp.net mvc beta when deploying on IIS 6. I had this working in one of the previews by mapping .mvc in IIS but this no longer works. I've read <a href="http://msmvps.com/blogs/omar/archive/2008/06/30/deploy-asp-net-mvc-on-iis-6-solve-404-compression-and-performance-pr...
<p>I found a solution to my problem from <a href="http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/" rel="nofollow noreferrer">Steve Sanderson's blog</a> (Thanks Steve):</p> <p>Use a wildcard mapping for <code>aspnet_isapi.dll</code>. This tells IIS 6 to process all requests using ASP.NET...
<p>Url rewriting can help you to solve the problem. I've implemented solution allowing to deploy MVC application at any IIS version even when virtual hosting is used. <a href="http://www.codeproject.com/KB/aspnet/iis-aspnet-url-rewriting.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/iis-aspnet-ur...
29,703
<p>If I have two objects, one being the list of items, and the other having a property storing the selected item of the other list, is it possible to update the selected item through binding in WPF?</p> <p>Lets say I have these two data structures:</p> <pre><code>public class MyDataList { public ObservableCollect...
<p>I believe you should be able to do this (make sure to declare the local namespace):</p> <pre><code>&lt;Window.Resources&gt; &lt;local:MyDataStructure x:Key="mds1" /&gt; &lt;/Window.Resources&gt; &lt;ListBox ItemsSource="{Binding Data}" SelectedValue="{Binding Source={StaticResource mds1} Path=ChosenItem}"/&...
<p>Make this two properties inside a single class(Just to simplify the solution) and make the code ready for property changed events</p> <pre><code> public class MyDataList : INotifyPropertyChanged { private Guid _choosen; public ObservableCollection&lt;Guid&gt; Data { get; set; } public Guid ChosenItem ...
46,253
<p>I am hoping to find a resource for lining up input elements in a HTML page. I find it difficult to get a select element and a text box to be the same width even when using the width style attribute, and it is even more difficult across browsers. Finally, file inputs seem impossible to get to the same width cross bro...
<p>I tested this out in Internet Explorer 7, Firefox 3 and Safari/Google Chrome. I definitely see the problem with <code>&lt;select&gt;</code> and <code>&lt;input type="file"&gt;</code>. My findings showed that if you styled all the inputs at the same width, the <code>&lt;select&gt;</code> would be about 5 pixels sho...
<p>Do you start your CSS files with some base settings? It may be useful to turn padding and margin off on all elements. I haven't tested to see if this could be affecting select / input elements.</p> <p>Here's an example CSS Reset from Eric Meyer:</p> <p><a href="http://meyerweb.com/eric/thoughts/2007/05/01/reset-re...
21,794
<p>There are two popular naming conventions:</p> <ol> <li>vc90/win64/debug/foo.dll</li> <li>foo-vc90-win64-debug.dll</li> </ol> <p>Please discuss the problems/benefits associated with either approach.</p> <p>I am also wondering if it is possible to expose meta-data (i.e. compiler, platform, build-type) in approach #...
<p>#2 is good for distribution, where several variation will be packaged in the same folder/zip file together. However, you probably don't want all that information in the file name itself, as it make it difficult to vary those via parameters to your makefile/csproj/nant script etc. It would be easier to have severa...
<p>For .NET assemblies, you can store this information in the assembly itself:</p> <p><a href="http://www.codinghorror.com/blog/archives/000142.html" rel="nofollow noreferrer">http://www.codinghorror.com/blog/archives/000142.html</a></p> <p>I'm not familiar enough with other assembly types to know what they provide.<...
12,231
<p>I'm currently in the process of setting up a continuous integration environment at work. We are using VisualSVN Server and CrusieControl.NET. Occasionally a build will fail and a symptom is that there are conflicts in the CruiseControl.NET working copy. I believe this is due to the way I've setup the Visual Studio s...
<p>Doing a full delete before or after your build is good practice. This means that there is no chance of your build environment picking up an out of date file. Your building exactly against what is in the repository.</p> <p>Deleting the working copy is possible as I have done it with Nant. </p> <p>In Nant I would h...
<p>It is very common and generally a good practice for any build process to do a 'clean' before doing any significant build. This prevents any 'artifacts' from previous builds to taint the output.</p> <p>A clean is essentially what you are doing by deleting the working copy.</p>
2,959
<p>At work we recently upgraded from Microsoft SQL Server 7 to SQL 2005. The database engine is a lot more advanced, but the management studio is pretty awful in a number of ways. Most of our developers decided they preferred to stick with the old Query Analyzer tool, even though it had a lot of limitations.</p> <p>...
<p>While I would love something better, it would have to be significantly better and free. SMS is definetly a hog but I've gotten used to it. What I miss the most is Query Analyzer. I don't mind using SSMS to manage the server but having a fast lightweight, editor for SQL queries would be awsome...</p> <p>Did I mentio...
<p>I, for one, would definitely like something other than Management Studio. Is it just me, or do other people feel that it is <em>wayyyyy</em> slower than SQL Server 2000's Enterprise Manager? More features or not, I need something that can get the job done quickly.</p>
47,584
<p>I'd like to make status icons for a C# WinForms TreeList control. The statuses are combinations of other statuses (eg. a user node might be inactive or banned or inactive and banned), and the status icon is comprised of non-overlapping, smaller glyphs. </p> <p>I'd really like to avoid having to hand-generate all ...
<pre><code>Bitmap image1 = ... Bitmap image2 = ... Bitmap combined = new Bitmap(image1.Width, image1.Height); using (Graphics g = Graphics.FromImage(combined)) { g.DrawImage(image1, new Point(0, 0)); g.DrawImage(image2, new Point(0, 0); } imageList.Add(combined); </code></pre>
<p>Just use Images.Add from the ImageList to add in the individual images. So, something like:</p> <pre><code> Image img = Image.FromStream( /*get stream from resources*/ ); ImageList1.Images.Add( img ); </code></pre>
12,239
<p>We are building a multi-tenant website in ASP.NET, and we must let each customer configure their own security model. They must be able to define their own roles, and put users in those roles. What is the best way to do this?</p> <p>There are tons of simple examples of page_load events that have code like:</p> <p...
<p>Perhaps put the configurable roles in a DB table, where you store the roles and tenant, and then the PagePermissions in another table, for example:</p> <pre><code>Table "Role" RoleId, TenantId, Role Table "PagePermissions" PageId, RoleId Table "UserRoles" UserId, RoleId </code></pre> <p>Then in the page load che...
<p>I would create a configuration system for the website that is easily managed in config-files. Where you could get typed members and use like this.</p> <pre><code>foreach(var group in ThisPageConfiguration.AcceptedRoleNames) if (user.IsInRole(group)) ... </code></pre> <p>Each customer could then configure their sit...
21,472
<p>I'm using the build-helper-maven-plugin to add it to my build, but I'd like to see the XREF source for this extra source directory as well.</p> <p>FYI:</p> <p><a href="http://maven.apache.org/plugins/maven-jxr-plugin/index.html" rel="nofollow noreferrer">maven-jxr-plugin</a> - The JXR plugin produces a cross-refer...
<p>Rather than exposing your DAO beans directly, you should create some Spring MVC controller beans, and call those from the client-side (using AJAX). Ideally, the controllers should not call the DAOs directly, but should instead call service beans (and the service beans should call the DAOs). One advantage of this app...
<p>You have to expose your DAO's or beans by means of http. Typically you create a layer above the DAO layer to expose your services through HTTP, which are available to any AJAX framework such as jQuery. What jQuery and other frameworks ends up doing is using a special asynchronous request called XMLHttpRequest and th...
22,842
<p>I know about code-behind files, but what is the best real-world way of Designers that are using DreamWeaver or other Design Tools to work with Visual Studio programmers? </p> <p>For example, say you have a basic website with user interface forms hitting the database... the database work is definitely done by the d...
<p>Use another approach like <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="nofollow noreferrer">MVC</a>, separate your design from your logic. Like this every member (designer / developer) of the team can focus on what they do best.</p> <p>MVC implementations: <a href="http://www.asp.net/mvc/" rel=...
<p>Unfortunately this is an all too common problem. Dreamweaver typically doesn't write html that is friendly to a .net developer. If at all possible, get someone who can actually read, and write HTML,not just use the Dreamweaver WYSIWYG editor. </p> <p>I often found that if I'm working with a designer that doesn't kn...
36,854
<p>Are the any task tracking systems with command-line interface? </p> <p>Here is a list of features I'm interested in:</p> <ul> <li>Simple task template<br> Something like plain-text file with property:type pairs, for example:</li> </ul> <blockquote> <pre><code>description:string some-property:integer required </...
<blockquote> <p>Ditz is a simple, light-weight distributed issue tracker designed to work with distributed version control systems like darcs and git.</p> </blockquote> <p>Ditz: <a href="http://web.archive.org/web/20121212202849/http://gitorious.org/ditz" rel="nofollow noreferrer">http://web.archive.org/web/201212...
<p>Fogbugz has a <a href="http://support.fogcreek.com/default.asp?W840" rel="nofollow noreferrer">Command Line Client</a>.</p>
10,744
<p>I want to catch the NavigationService.Navigating event from my Page, to prevent the user from navigating forward. I have an event handler defined thusly:</p> <pre><code>void PreventForwardNavigation(object sender, NavigatingCancelEventArgs e) { if (e.NavigationMode == NavigationMode.Forward) { e.Can...
<p>Create your own function to execute an OS command through the <a href="http://www.computerhope.com/shutdown.htm" rel="nofollow noreferrer">command line</a>?</p> <p>For the sake of an example. But know where and why you'd want to use this as others note.</p> <pre><code>public static void main(String arg[]) throws IOE...
<p>On Windows Embedded by default there is no shutdown command in cmd. In such case you need add this command manually or use function ExitWindowsEx from win32 (user32.lib) by using JNA (if you want more Java) or JNI (if easier for you will be to set priviliges in C code).</p>
4,523
<p>Can I determine from an ASP.NET application the transfer rate, i.e. how many KB per second are transferd?</p>
<p>You can set some performance counters on ASP.NET.</p> <p>See <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/852720c8-7589-49c3-a9d1-73fdfc9126f0.mspx?mfr=true" rel="nofollow noreferrer">here</a> for some examples.</p> <p>Some specific ones that may help you figure out what you ...
<p>There are a number of debugging tools you can use to check this at the browser. It will of course vary by page, cache settings, server load, network connection speed, etc.</p> <p>Check out <a href="http://www.fiddlertool.com/fiddler/" rel="nofollow noreferrer">http://www.fiddlertool.com/fiddler/</a></p> <p>Or if ...
12,774
<p>I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can't seem to find anything on Google so I...
<p>You can use javascript to construct the embeds and insert them into the DOM when a user clicks a button or something similar.</p>
<p>You will want to use the Object tag vs. the Embed tag for one, but that said, don't set the auto-play option and they won't load until requested.</p>
29,049
<p>I'm in the middle of building a pretty big site using asp.net (forms if it's of any interest), and I'm wondering if i need a logging framework such as log4net. I've used such frameworks before, but i don't see how i could put it to any use in this type of project. usually i think logging is needed for customer deliv...
<p>Heck no - logging is <em>incredibly</em> important for web applications. If you log appropriately, it makes troubleshooting <em>so</em> much easier.</p> <p>Log4Net is probably a good bet as a framework. You might also want a way of gathering logs together from multiple servers - and even if you don't use more than ...
<p>I would certainly vouch for enterprise information sink (I think this is the right name, it's a Microsoft api for logging), or Enterprise Library.</p> <p>I use the latter for all sorts of things such as caching, logging, etc, and it is a very powerful and time saving tool. I also use health monitoring. This is for ...
42,433
<p>I want to copy text files and only text files from <code>src/</code> to <code>dst/</code></p> <pre> groovy:000> "cp src/*.txt dst/".execute().text ===> groovy:000> </pre> <p>You can see the command executes w/out error but the file <code>src/test.txt</code> does not get copied to <code>dst/</code></p> <p...
<p>Wildcard expansion is performed by the shell, not by cp (or groovy). Your first example is trying to copy a file named *. You could make your command "sh -c 'cp ...'"</p>
<p>Wildcard expansion is performed by the shell, not by cp (or groovy). Your first example is trying to copy a file named *. You could make your command "sh -c 'cp ...'"</p>
22,162
<p>The following simple "calculator expression" grammar (BNF) can be easily parsed with the a trivial recursive-descent parser, which is predictive LL(1):</p> <pre><code>&lt;expr&gt; := &lt;term&gt; + &lt;term&gt; | &lt;term&gt; - &lt;term&gt; | &lt;term&gt; &lt;term&gt; := &lt;...
<p>THe problem with </p> <pre><code>&lt;command&gt; := &lt;expr&gt; | &lt;id&gt; = &lt;expr&gt; </code></pre> <p>is that when you "see" <code>&lt;id&gt;</code> you can't tell if it's the beginning of an assignement (second rule) or it's a "<code>&lt;factor&gt;</code>". You will only know when you'll ...
<p><a href="http://www.artima.com/lejava/articles/antlr_3.html" rel="nofollow noreferrer">ANTLR 3</a> uses a "LL(*)" parser as opposed to a LL(k) parser, so it will look ahead until it reaches the end of the input if it has to, without backtracking, using a specially optimized determinstic finite automata (DFA).</p>
15,648
<p>I've been working with code synthesis xsd to generate an xml tree to ensure constinency of the xml output to the original xsd.</p> <p>After initial testing, everything looked ok but when I tried entering invalid values (correct type, but outside the defined range), the values were allowed.</p> <p>Although the xml ...
<p>Try <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html" rel="noreferrer">SimpleDateFormat</a>. You simply set a format such as the one in your example and then call parse on your dateStr.</p>
<h1><em>java.time</em></h1> <p>The <code>java.util</code> Date-Time API and their formatting API, <code>SimpleDateFormat</code> are outdated and error-prone. Since <code>java.sql.Timestamp</code> extends <code>java.util.Date</code>, it has got the same problems. It is recommended to stop using them completely and switc...
28,069
<p>I've got a potentially rather large list of objects I'd like to bind to a ListBox in WPF. However, I'd like to have the List load itself incrementally. How can I bind a ListBox to an IEnumerable that loads itself on-demand in such a way that the listbox only tries to enumerate as much as it needs for the display?...
<p>WPF ListBox's use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingstackpanel.aspx" rel="nofollow noreferrer">VirtualizingStackPanel</a> as the layout control for its items. You can set the VirtualizingStackPanel to only load items as needed with the following XAML:</p> <pre><c...
<p>With winform, "virtual mode" - but AFAIK, this isn't the same in WPF. You could see <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/6d8e6f19-538a-4808-a5b0-4f6969041129/" rel="nofollow noreferrer">this MSDN forum</a> post.</p> <p>I largely agree with Drew Marsh - let the user filter the data, rath...
45,476
<p>Say I have a sql query </p> <pre><code>SELECT fname, lname, dob, ssn, address1, address2, zip, phone,state from users </code></pre> <p>Now say the records are now either in dictionary base or a strongly typed collection.</p> <p>I have a grid view control and i want to bind it to my collection but I only want to d...
<p>Perhaps LINQ and an anonymous class could do the trick for you.</p> <pre><code>from user in UserCollection select new { FirstName=user.fname, LastName=user.lname, Dob=user.dob, SSN=user.ssn } </code></pre>
<p>You can use linq to return an anonymous type (AKA tuple). That tuple would contain only the properties you are looking for. Then you can bind your grid to that collection. Google anonymous types or tuples in C# to see what I mean.</p>
36,746
<p>How can you get the version information from a <code>.dll</code> or <code>.exe</code> file in PowerShell?</p> <p>I am specifically interested in <code>File Version</code>, though other version information (that is, <code>Company</code>, <code>Language</code>, <code>Product Name</code>, etc.) would be helpful as wel...
<p>Since PowerShell can call <a href="https://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> classes, you could do the following:</p> <pre><code>[System.Diagnostics.FileVersionInfo]::GetVersionInfo("somefilepath").FileVersion </code></pre> <p>Or as <a href="https://web.archive.org/web/20081004113553/...
<p>Here an alternative method. It uses Get-WmiObject CIM_DATAFILE to select the version.</p> <pre><code>(Get-WmiObject -Class CIM_DataFile -Filter "Name='C:\\Windows\\explorer.exe'" | Select-Object Version).Version </code></pre>
5,055
<p>When using <a href="http://log4perl.sourceforge.net/" rel="nofollow noreferrer">log4perl</a>, the debug log layout that I'm using is :</p> <pre><code>log4perl.appender.D10.layout=PatternLayout log4perl.appender.D10.layout.ConversionPattern=%d [pid=%P] %p %F{1} (%L) %M %m%n log4perl.appender.D10.Filter = DebugAndUp ...
<p>You can pad the single fields that make up your entries. For example [pid=%5P] will always give you at least 5 characters for the PID. </p> <p>The <a href="http://search.cpan.org/~mschilli/Log-Log4perl-1.19/lib/Log/Log4perl/Layout/PatternLayout.pm#Quantify_placeholders" rel="noreferrer">"Quantify Placeholders" sect...
<p>There are a couple of ways to go with this, although you have to figure out which one works better for your situation:</p> <ol> <li><p>Use a different appender if you are working live. Have that appender use a pattern that shows only the information you want. If you're working in a single process, for instance, you...
41,435
<p>If you are sending work/progress reports to the project lead on a daily or weekly basis, I wondered if you would consider using <a href="http://twitter.com" rel="nofollow noreferrer">Twitter</a> or similar services for these updates.</p> <p>Say if you're working remotely or with a distributed team and the project l...
<p>Try <a href="http://laconi.ca/" rel="nofollow noreferrer">Laconica</a>: An open source Twitter-like system you could run on your own servers.</p>
<p>The <a href="http://en.blog.wordpress.com/2008/01/28/introducing-prologue/" rel="nofollow noreferrer">Prologue theme</a> for WordPress was designed with this in mind.</p>
7,472
<p>In this particular situation, there are 9 automated steps in a process that take varying lengths of time. We currently have a number showing percentage in the center of a progress bar, but it suffers from the common stop-and-go problem of racing up to 33%, waiting a long time, racing up to 55%, waiting an even longe...
<p>If it really takes a long time, AJAX type of animation is probably not a good idea. I'd go with checklist of items.</p>
<p>I had almost the exact same problem. We also had 9 steps, so the bar would go 11%, 22% 33% etc. and also with some steps taking longer than others.</p> <p>I decided to make two of the longer steps count as two, so we how had 11 steps, so it wasn't as obvious, and the jumps weren't always even: 9%, 18%, 36%, 45%, ...
22,180
<p>I am building Java web applications, and I hate the traditional "code-compile-deploy-test" cycle. I want to type in one tiny change, then see the result INSTANTLY, without having to compile and deploy.</p> <p>Fortunately, <a href="http://www.mortbay.org/jetty/" rel="noreferrer">Jetty</a> is great for this. It is a ...
<p>Jetty uses memory-mapped files to buffer static content, which causes the file-locking in Windows. Try setting <code>useFileMappedBuffer</code> for <code>DefaultServlet</code> to <code>false</code>.</p> <p><a href="http://www.eclipse.org/jetty/documentation/current/troubleshooting-locked-files-on-windows.html" rel="...
<p>It is probably the browser that is holding on to it.</p> <p>inside I.E : Tools | Internet Options | Temporary Internet Files > Settings, click the Radio button "Every visit to the page". press OK.</p> <p>Before you do that, Delete all the temporary internet files.</p>
22,288
<p>Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption </p> <pre><code>DataRow exercise = _exerciseDataSet.Exercise.FindB...
<p>A SQL float is a double according to <a href="http://msdn.microsoft.com/en-us/library/system.data.sqldbtype.aspx#Mtps_DropDownFilterText" rel="noreferrer"> the documentation for SQLDbType</a>.</p>
<p>I think the main question has been answered here but I feel compelled to add something for the section of the question that states that this works.</p> <blockquote> <p>_AccelLimit = (float)(double)exercise["DefaultAccelLimit"];</p> </blockquote> <p>The reason this "works" and the reason it "doesn't feel right" i...
14,902
<p>If I change the url in the web.config file will the change be reflected in the .disco, .discomap, and .wsdl files that are in the WebReferences folder?</p> <p>[Edit]</p> <p>I'm using asp.net 2005</p>
<p>The change will not, as far as I'm aware, be reflected in all the other files. However, if you change the URL in web.config, your application will call the web service from the new URL at run-time. Check out this <a href="https://web.archive.org/web/20200808124012/http://geekswithblogs.net/ranganh/archive/2006/10/10...
<p>As I can remember <strong>WSDL</strong> file contains the <strong>binding</strong>(s) (URL mappings) of your WS. So if you change the URL on your machine (in WSDL, Disco, etc.) that's enough.</p> <p>On the other hand don't forget to <strong>regenerate client proxies</strong>. They have to reflect WSDL changes.</p>
32,786
<p>How would I go about setting different authentication tags for different parts of my web app? Say I have:</p> <pre><code>/ /folder1/ /folder2/ </code></pre> <p>Would it be possible to specify different <code>&lt;authentication/&gt;</code> tags for each folder?</p> <p>I want folder1 to use Windows authentication ...
<p>You can only have <code>&lt;authentication /&gt;</code> on the top level <code>web.config</code>. You may have to create multiple applications. ie you can create an application within an application and use different authentication modes in each one.</p>
<p>I think you can set the forms authentication authorization on folder1 to </p> <pre><code>&lt;allow users="*" /&gt; </code></pre> <p>then control the windows access via setting windows permissions on the folder.</p> <p>I haven't tried it, but I can't think of why that wouldn't work.</p>
41,214
<p>How would you design a content voting mechanism that could be applied polymorphically to multiple models / classes. (in a ruby on rails context preferably, but others are fine)</p> <p>Given that instances of these classes can be voted on: - Article - Question - Product</p> <p>Voters should not be required to regis...
<p>I'd suggest starting with Single Table Inheritance for a 'votable' interface and derive any votable classes from there. Starting details for STI: <a href="http://wiki.rubyonrails.org/rails/pages/singletableinheritance" rel="nofollow noreferrer">http://wiki.rubyonrails.org/rails/pages/singletableinheritance</a></p>
<p>Thanks for the answers guys. Yup, creating a polymorphic votable model is the way to go, however I was attempting to extract a more complete answer.</p> <p>For example here's what I'm thinking so far. A voteable class which can be tied to multiple classes (Article, Question, Product) in this scenario.</p> <p>Votes...
32,808
<p>I bought some heating block cotton to insulate the exposed surface of my hot end. I thought the yellow as double-sticky but it appears to be Kapton.</p> <p>What can I use to attach it to the extruder?</p> <p><a href="https://i.stack.imgur.com/9FFOY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.co...
<p>Kapton tape would be the logical material. It's unfortunate that your vendor did not supply that as a separate item, rather than sticking it to the "cotton" (I'm guessing not actually cotton, as things might get a bit scorching for cotton, so I'm assuming some type of ceramic fiber or the like.)</p>
<p>Not quite the answer to the question but closely related, so I venture. I use ordinary wool thread to insulate the hot end. I just wrap it carefully so it is covered everywhere. Very low cost, very effective. Wool can handle even the hottest extrusion temperatures easily.</p>
641
<p>I'm brand new to jQuery and have some experience using Prototype. In Prototype, there is a method to "flash" an element &mdash; ie. briefly highlight it in another color and have it fade back to normal so that the user's eye is drawn to it. Is there such a method in jQuery? I see fadeIn, fadeOut, and animate, but I ...
<p>My way is .fadein, .fadeout .fadein, .fadeout ......</p> <pre><code>$("#someElement").fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100); </code></pre> <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="sn...
<p>You can use this cool library to make any kind of animated effect on your element: <a href="http://daneden.github.io/animate.css/" rel="nofollow">http://daneden.github.io/animate.css/</a></p>
34,782
<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>
<p>Yes, you should add these processes to the supervision heirarchy as you want them to be correctly/gracefully shutdown when your application is stopped. (Otherwise you end up leaking connections that will fail as the application infrastructure they depend on been shutdown).</p> <p>You could create a <code>simple_one...
<p>If you expect these processes to be many, it could be a good idea to add a supervisor under your main supervisor as to separate responsibility (and maybe use the <code>simple_one_for_one</code> setting to make things simpler, maybe even simpler than your current case).</p> <p>The thing is, if you need to control th...
18,429