instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Greetings!</p> <p>I have a WebService that contains a WebMethod that does some work and returns a boolean value. The work that it does may or may not take some time, so I'd like to call it asynchronously.</p> <pre><code>[WebService(Namespace = "http://tempuri.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.Ba...
<p><a href="http://msdn.microsoft.com/en-us/magazine/cc163725.aspx" rel="nofollow noreferrer">Asynchronous pages</a> are helpful in scenarios when you need to asynchronously call web service methods.</p>
<p>A Literal in a conditional Update Panel would be fine.</p> <pre><code>&lt;asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Literal ID="litUpdateMe" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
18,552
<p>I have configured Tomcat 6 to serve Perl CGI scripts. That part is <a href="http://tomcat.apache.org/tomcat-6.0-doc/cgi-howto.html" rel="nofollow noreferrer">well documented</a> and works ok for me.</p> <p>But, when a browser requests an image from this CGI dir, Tomcat's CGI servlet refuses to serve the image, dis...
<p>Why do you want to put images inside your CGI directory? Shouldn't they be under the normal document root?</p> <p>If you are constructing relative paths in the output of your script, add a BASE tag to the HTML head, or make the links absolute URLs.</p>
<p>OK, I have written a short how-to on installing Bugzilla on Apache Tomcat 6 (on Ubuntu 10.04 + MysSQL).</p> <p>I was playing around with the BZ instance and it seems to be functioning normally.</p> <p><a href="http://blog.inmite.eu/2010/08/installing-bugzilla-on-the-apache-tomcat-6/" rel="nofollow noreferrer">http...
47,207
<p>We are using PowerDesigner at work for database modelling. But there is a hell of a price tag on that piece of software. And frankly, all I use is physical diagrams for MS SQL, which is about 1% of what PD knows.</p> <p>Are there any good alternatives? I know about Visio and MS SQL Diagrams, but looking for other o...
<p><a href="http://www.sqlpower.ca/page/architect" rel="noreferrer">Power*Architect</a> is the way to go. It's free, open source, and does a really great job helping you build your ERDs. Plus, it works on Windows, Linux, and OSX.</p>
<p>You might want to look at <a href="https://www.xcase.com/demo.php" rel="nofollow noreferrer">https://www.xcase.com/demo.php</a>. It's not free, but it's quite a bit cheaper than PowerDesigner, as far as I can tell. I've used earlier versions, but lately I've had easy access to Visio, so have continued with that inst...
10,199
<p>Given numbers like 499, 73433, 2348 what VBA can I use to round to the nearest 5 or 10? or an arbitrary number?</p> <p>By 5:</p> <pre><code> 499 -&gt; 500 2348 -&gt; 2350 7343 -&gt; 7345 </code></pre> <p>By 10:</p> <pre><code> 499 -&gt; 500 2348 -&gt; 2350 7343 -&gt; 7340 </code></pre> <p>etc.</p>
<p>It's simple math. Given a number X and a rounding factor N, the formula would be:</p> <p>round(X / N)*N</p>
<p>To mimic in Visual Basic the way the round function works in Excel, you just have to use: WorksheetFunction.Round(number, decimals)</p> <p>This way the banking or accounting rounding don't do the rounding.</p>
42,307
<p>I'm currently writing a program to generate really enormous (65536x65536 pixels and above) Mandelbrot images, and I'd like to devise a spectrum and coloring scheme that does them justice. The <a href="http://en.wikipedia.org/wiki/File:Mandel_zoom_00_mandelbrot_set.jpg" rel="noreferrer">wikipedia featured mandelbrot ...
<p><strong>This is the smooth color algorithm:</strong></p> <p>Lets say you start with the complex number <code>z0</code> and iterate <code>n</code> times until it escapes. Let the end point be <code>zn</code>.</p> <p>A smooth value would be </p> <pre><code>nsmooth := n + 1 - Math.log(Math.log(zn.abs()))/Math.log(2)...
<p>here you can find a version with javascript</p> <p>usage :</p> <pre><code>var rgbcol = [] ; var rgbcol = MapColor ( Iteration , Zy2,Zx2 ) ; point ( ctx , iX, iY ,rgbcol[0],rgbcol[1],rgbcol[2] ); </code></pre> <p>function</p> <pre><code>/* * The Mandelbrot Set, in HTML5 canvas and javascript. * https://github...
48,251
<p>We're using interfaces to represent entity classes in our domain model. We have concrete implementations of these by virtue of using LinqToSql. We have added a factory method to each LinqToSql class which our service layer uses to instantiate a new entity (note; as opposed to the controller's DataBind attribute do...
<p>You should be looking at IParameterBinder. take a look at <a href="http://www.kenegozi.com/Blog/2008/09/15/creating-a-custom-parameter-binder-for-monorail-actions-iparameterbinder.aspx" rel="nofollow noreferrer">a post I've written on the subject</a></p>
<p>As Ken pointed, your idea could be implemented with a custom IParameterBinder.</p> <p>A solution would be to use IOC:</p> <ul> <li>resolve concrete instance of the form from it's interface</li> <li>then use IDataBinder to bind the instance to the request params</li> </ul> <p>Another one would be using IDictionary...
39,378
<p>I realize this is a quite general question, but I am wondering about the performance impact of implementing business logic with WF contra imperative code in fairly large enterprise system. I would like to hear others experiences in this regard.</p>
<p>You can check <a href="http://msdn.microsoft.com/en-us/library/aa973808.aspx" rel="noreferrer">Performance Characteristics of Windows Workflow Foundation</a> for key performance considerations and modeling guidelines that are important when developing applications on top of the Windows Workflow Foundation.</p> <p>H...
<p>I once did some benchmark about WF performance. It turns out that "declarative condition" is pretty slow. I believe that it is due to a lot of reflection is done in the process.</p>
25,071
<p><em>Problem:</em> Customer X has requested that pages using XML DataBinding and Databound tables in MSIE be re-factored to work cross-browser.</p> <p><strong>Question:</strong> What is the best-practice way to mimic the <a href="http://www.globalguideline.com/xml/XML_Data_Island.php" rel="nofollow noreferrer">MSIE ...
<p>In order to see the SQL query you can just configure hibernate.show_sql=true in your hibernate.cfg.xml file. Then you should see the queries in the console window during application execution.</p> <p>That's the feature of the hibernate runtime, when Tools provide you with HQL editor, so you can test the queries bef...
<p>In order to see the SQL query you can just configure hibernate.show_sql=true in your hibernate.cfg.xml file. Then you should see the queries in the console window during application execution.</p> <p>That's the feature of the hibernate runtime, when Tools provide you with HQL editor, so you can test the queries bef...
45,794
<p>I have a requirement to install multiple web setup projects (using VS2005 and ASP.Net/C#) into the same virtual folder. The projects share some assembly references (the file systems are all structured to use the same 'bin' folder), making deployment of changes to those assemblies problematic since the MS installer...
<p>I cannot answer all your questions, as I don't have experience with TFS.</p> <p>But I can recommend a better approach to use for updating your AssemblyInfo.cs files than using the AssemblyInfo task. That task appears to just recreate a standard AssemblyInfo file from scratch, and loses any custom portions you may h...
<p>I have written one custome task you can refer the code below. It will create an utility to which you can pass assemblyinfo path Major,minor and build number. you can modify it to get revision number. Since in my case this task was done by developer i used to search it and again replace whole string.</p> <pre><code>...
27,557
<p>I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery) on <a href="http://www.learningjquery.com/2008/05/working-with-events-part-2" rel="nofollow noreferrer">Karl Swedberg's blog</a>, and I became totally puzzled at this part of the code (simplified for brevity)...
<p>As far as i can tell your example will. However your example is not the same as the example on the website you reference.</p> <pre><code>function addItemUnbind() { $('#list6 li.special button') .unbind('click') .bind('click', function() { var $newLi = $('&lt;li class="special"&gt;special and new &l...
<p>The answer is hiding in part of the code you took out. What you've posted is indeed an infinite loop. However, here's a more complete (but still simplified) example, modified from the linked blog post:</p> <pre><code>function addItemUnbind() { bind('click', function() { addItemUnbind(); }); } </code></pre> ...
46,726
<p>I'm expanding my Ruby understanding by coding an equivalent of Kent Beck's xUnit in Ruby. Python (which Kent writes in) has an assert() method in the language which is used extensively. Ruby does not. I think it should be easy to add this but is Kernel the right place to put it?</p> <p>BTW, <em>I know of the exi...
<p>No it's not a best practice. The best analogy to assert() in Ruby is just raising</p> <pre><code> raise "This is wrong" unless expr </code></pre> <p>and you can implement your own exceptions if you want to provide for more specific exception handling</p>
<p>My understanding is that you're writing your own testing suite as a way of becoming more familiar with Ruby. So while Test::Unit might be useful as a guide, it's probably not what you're looking for (because it's already done the job).</p> <p>That said, python's assert is (to me, at least), more analogous to C's <...
17,822
<p>For example, java.io.File is just a concrete class. My replacement for it supports resolving Windows shortcuts. I need to preprocess constructor parameters to resolve possible .lnk files because the FileSystem object that does normalizing/canonicalision/resolving on the abstract paths is not accessible. The need for...
<p>In the specific case you suggest it looks to me like you're better off with a separate factory class that makes the decisions about normalizing/canonicalision/resolving. </p> <p>Then you can just let File be File. Simpler.</p>
<p>If you really want the subclass route, you can cheat the requirement that a call to <code>super()</code> has to be the first line of a subclass constructor by placing your cleanup code outside of your class, or in a static block:</p> <pre><code>public class MyFile extends File { public MyFile(String path) { ...
46,368
<p>For a model that has raised text on it, how do go about painting the very top layer of text, to make it stand out from the background? Lets say I printed the whole model the same color, what type of paint would work well, and not get on the background too?</p> <p>Here's an example of a model that has raised text: <...
<p>You don't provide any dimensions or sizes, but...</p> <p>Assuming that the text is sufficiently elevated from the rest of the model, you could use a firm solid (as opposed to soft and spongey) roller, of an appropriate width.</p> <p>This should enable you to paint just the text without getting paint on the rest of...
<p>The technique you look for is <em>drybrushing</em> and not dependant on a specific type of color, as long as it can be applied with a brush.</p> <p>An alternative technique might be carefully applying glue and leaf metal.</p>
1,513
<p>Been trying to upgrade my subversion installation, but due to (what I believe) are limited rights (I'm using hosted Linux account), I'm not able to properly "./configure" and compile the source code (see posts <a href="https://stackoverflow.com/questions/189906/upgrade-subversion-143-to-152-on-debian-hosted-account"...
<p>You can extract the binaries from the deb package for your architecture (which you can download from <a href="http://packages.debian.org/search?keywords=subversion&amp;exact=1" rel="nofollow noreferrer">here</a>) using <code>dpkg-deb -x</code>.</p> <p>So for example you can do this if you're on i386:</p> <pre> wge...
<p>Look at the Debian list of <a href="http://packages.debian.org/search?keywords=subversion&amp;exact=1" rel="nofollow noreferrer">SVN packages</a>, I would assume the <a href="http://packages.debian.org/etch/subversion" rel="nofollow noreferrer">etch (stable)</a> is the one you need.</p>
35,306
<p>I have noticed jQuery (or is it Firefox) will turn some of my <code>&lt;span class="presentational"&gt;&lt;/span&gt; into &lt;span class="presentational" /&gt;</code></p> <p>Now my question is, is this okay to write my markup like this? Will any browsers choke on it?</p> <p>Personally, I think it looks cleaner to ...
<p>I'm assuming your question has to do with the red trailing slash on self-closing elements when you view source in Firefox. If so, you've stumbled into one of the most vehement, yet simultaneously passive aggressive debates in the browser maker vs. web developer wars. XHTML is NOT just about a document's markup. It...
<p>Generally it's not a problem to use shorthand for empty elements, but there are some exceptions where it can cause problems.</p> <p><code>&lt;script&gt;</code> is an important one that needs to be closed with <code>&lt;/script&gt;</code> to avoid issues.</p> <p>Another is <code>&lt;meta&gt;</code> which works much...
45,374
<p>I'm mainly a C# developer, but I'm currently working on a project in Python.</p> <p>How can I represent the equivalent of an Enum in Python? </p>
<p><a href="https://docs.python.org/3/library/enum.html" rel="noreferrer">Enums</a> have been added to Python 3.4 as described in <a href="http://www.python.org/dev/peps/pep-0435/" rel="noreferrer">PEP 435</a>. It has also been <a href="https://pypi.python.org/pypi/enum34" rel="noreferrer">backported to 3.3, 3.2, 3.1,...
<pre><code>def enum( *names ): ''' Makes enum. Usage: E = enum( 'YOUR', 'KEYS', 'HERE' ) print( E.HERE ) ''' class Enum(): pass for index, name in enumerate( names ): setattr( Enum, name, index ) return Enum </code></pre>
5,755
<p>When I believed in American dream about encapsulation and polymorphism, intrusion of Web Services washed my objects off with RPC calls...</p> <p>When I cherished my resurrected PONOs, ugly army of barbarians called proxy objects conquered my lands...</p> <p>Later, peace seemed to come back with DDD and NHibernate ...
<p>Beware you foolish mortals. The Entity That Is has indeed fed on your polymorphed objects. But this also means that you have inherited the Big Slimy Interface that lurks in the dark. So you can retire your puny barbarians (by proxy if you wish). </p> <p>And yes, thanks to the Entity That Is, your objects got lazy a...
<p>Clearly you haven't take your abstraction pills this morning. Now, take your nice medicine and you'll feel better in a little while...</p>
39,387
<p>I've alluded to this project before, in this question, but the scope of redesign has been slightly tightened, i.e. I can't redesign the whole thing, so I 'd like some general advice on how to structure the existing artefacts in the application as an incremental step in improving the design.</p> <ol> <li><p>The site...
<p>For presentation of reports based upon a database of facts I would investigate one of the tools that has got all the core functionality already implemented, such as BIRT (and I am sure that there are some .NET alternatives). You might think a table of data is good enough for an intelligent person to parse, but down ...
<p>For presentation of reports based upon a database of facts I would investigate one of the tools that has got all the core functionality already implemented, such as BIRT (and I am sure that there are some .NET alternatives). You might think a table of data is good enough for an intelligent person to parse, but down ...
43,253
<p>I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only ...
<p>The <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/join" rel="noreferrer">Array.prototype.join()</a> method:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js la...
<pre><code>var arr = ["Pro1", "Pro2", "Pro3"]; console.log(arr.join());// Pro1,Pro2,Pro3 console.log(arr.join(', '));// Pro1, Pro2, Pro3 </code></pre>
24,641
<p>I'd like to run a subcommand from Perl (or pipe it into a Perl script) and have the script process the command's output immediately, rather than waiting for a timeout, a newline, or a certain number of blocks. For example, let's say I want to surround each chunk of input with square brackets. When I run the script l...
<p>From perlfaq5: <a href="http://perldoc.perl.org/perlfaq5.html#How-can-I-read-a-single-character-from-a-file%3f--From-the-keyboard%3f" rel="nofollow noreferrer">How can I read a single character from a file? From the keyboard?</a>. You probably also want to read <a href="http://perldoc.perl.org/perlfaq5.html#How-can-...
<p>You didn't mention how you are reading input in your Perl script, but you might want to look at the <a href="http://perldoc.perl.org/functions/getc.html" rel="nofollow noreferrer"><code>getc</code></a> function:</p> <pre><code>$|++; # set autoflush on output while ($c = getc(STDIN)) { print $c; } </code></pre>
26,295
<p>I want to install a "pastie" in our local intranet. What are the alternatives to <strong><a href="http://p.ramaze.net" rel="nofollow noreferrer">RaPaste</a></strong> and <a href="http://pastie.org" rel="nofollow noreferrer">pastie.org</a>? (the latter can't even be installed locally b/c it doesn't seem to be open so...
<p>There is for instance <a href="http://dev.pocoo.org/projects/lodgeit/" rel="nofollow noreferrer">LodgeIt</a> by the Pocoo guys.</p>
<p>Your request isn't very clear. Starting by defining what are "pasties" in your mind might help (I knew pasties from deviantART, which are very different beasts...). I had to go to the indicated sites to have an idea.<br> It isn't clear either if it must be Ruby only or not (I see only a tag, no clear requirement).</...
26,852
<p>Ignoring the IE case, are there any other browsers that can't understand the application/xhtml+xml content type? And what about the search engine spiders?</p> <p>I could not find any answers on the web that would not be a few years old and thus possibly inaccurate.</p> <p><strong>Edit:</strong> Somehow related que...
<p>If you ignore 80% of the market (yes, IE) then XHTML is very well supported, and search engines have no problem with it whatsoever (after all, XHTML is a lot simpler to process).</p> <p>Overall, XHTML support isn't really a problem. IE doesn't support it, but as long as it's served as a contenttype it does understa...
<p>Since new browsers are invented at a steady pace, there's no definite value for "any" in "any other browsers".</p> <p>You have to (1) pick some browsers you think you'd like to support, (2) check those specific browsers.</p> <p>Look at a page like <a href="http://browsershots.org/" rel="nofollow noreferrer">Browse...
35,490
<p>Given a string like this:</p> <blockquote> <p>a,"string, with",various,"values, and some",quoted</p> </blockquote> <p>What is a good algorithm to split this based on commas while ignoring the commas inside the quoted sections?</p> <p>The output should be an array:</p> <blockquote> <p>[ "a", "string, with", "...
<p>Looks like you've got some good answers here.</p> <p>For those of you looking to handle your own CSV file parsing, heed the advice from the experts and <a href="http://secretgeek.net/csv_trouble.asp" rel="noreferrer">Don't roll your own CSV parser</a>.</p> <p>Your first thought is, <em>"I need to handle commas ins...
<p>I use this to parse strings, not sure if it helps here; but with some minor modifications perhaps?</p> <pre><code>function getstringbetween($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$en...
2,802
<p>Can someone point me a good step-by-step tutorial to consuming an already running web service in java?</p> <p>PS: I tried creating the classes with <code>wsconsume</code>, but it cries with<br> <code>[ERROR] rpc/encoded wsdls are not supported in JAXWS 2.0.</code> (my web service is rpc/encoded)</p> <p>If I can c...
<p><a href="http://cxf.apache.org/" rel="nofollow noreferrer">Apache CXF</a> is the easiest way to get webservices running. Specifically look at the <a href="http://cwiki.apache.org/CXF20DOC/simple-frontend.html" rel="nofollow noreferrer">Simple Frontend</a>. The simple front end uses reflection to convert the method/d...
<p>If you have the WSDL and XSD files, you can use the <a href="http://ws.apache.org/axis/" rel="nofollow noreferrer">Axis</a> web-services library to create Java classes that will interact with the services they describe. From the stand-point of this library, you are creating a client application.</p>
23,415
<p>What's the best way to load HTML markup for a custom jQuery UI widget?</p> <p>So far, I've seen elements simply created using strings (i.e. <code>$(...).wrap('&lt;div&gt;&lt;/div&gt;')</code>) which is fine for something simple. However, this makes it extremely difficult to modify later for more complex elements.</...
<p>Something which is quite neat to do is this:</p> <pre><code>var newDiv = $("&lt;div&gt;&lt;/div&gt;"); //Create a new element and save a reference newDiv.attr("id","someid").appendTo("body"); </code></pre> <p>That way, you are creating an element, and storing its reference in a variable, for later use.</p>
<p>A popular, efficient method is to output all of your additional markup (whatever you may need later) to the bottom of your page in script tags, so that the markup is not rendered by the browser.</p> <pre><code>&lt;script type="text/template" id="template-example"&gt; &lt;!-- All of your markup here --&gt; &...
46,180
<p>Has anyone out there got a good set of instructions for building/compiling Ruby from source of windows XP ?</p>
<p><a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/184380" rel="nofollow noreferrer">http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/184380</a></p> <p>I normally get a binary installable for windows.. much faster if you just need Ruby installed. But you may be modifying ruby source.. a...
<p>I would agree that the binary distrubtion is your best bet for Ruby on Windows, however, like Gishu mentioned, you may be modifying it a bit. If that's the case I would build it from source with <a href="http://www.cygwin.com/" rel="nofollow noreferrer">Cygwin</a>. This will give you the familiar tool set for buil...
13,273
<p>I have a small form inside a table. POSTing that form creates a new entity. I then want users to see that new entity, but it should open in a new window so that the original view isn't lost.</p> <p>(How) can I open the result of the form submission in a new window?</p>
<pre><code>&lt;form ... target="windowName"&gt; </code></pre> <p>or</p> <pre><code>&lt;form ... target="windowName" onsubmit="window.open(this.action, this.target, '...attributes...');return true;"&gt; </code></pre> <p>...attributes... can consist of the stuff documented at the <a href="https://developer.mozilla.org...
<p>One request, one response. That is the way of the web. </p> <p>If you want a new window after a post, you either need to post the request from the new window in the first place- perhaps opened via javascript- or post your data from that page to the <em>same</em> page and save a token so that when the page re-load...
46,521
<p>I have a Website that is really slow and "feels" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the Page from within IE.</p> <p>In Firefox, I would use Fi...
<p>There is the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=18359" rel="nofollow noreferrer">Internet Explorer Web Developer Toolbar</a>. It isn't as good as Firebug IMHO, but it works.</p> <p>IE8 will ship with one built-in, too.</p>
<p>There's a JS library called firebug light, you need to include it in your site. What it does for you is it enables you to pop up a div in which you can spit text, like in firebug, with the same statements you do it in firebug. MochiKit has something like this too.</p>
14,200
<p>I'm writing a php program that pulls from a database source. Some of the varchars have quotes that are displaying as black diamonds with a question mark in them (�, <a href="http://www.fileformat.info/info/unicode/char/fffd/index.htm" rel="noreferrer">REPLACEMENT CHARACTER</a>, I assume from Microsoft Word text).</p...
<p>If you see that character (� U+FFFD "REPLACEMENT CHARACTER") it usually means that the text itself is encoded in some form of single byte encoding but interpreted in one of the unicode encodings (UTF8 or UTF16).</p> <p>If it were the other way around it would (usually) look something like this: ä.</p> <p>Probably...
<p>Go to your phpmyadmin and select your database and just increase the length/value of that table's field to 500 or 1000 it will solve your problem.</p>
34,708
<p>So i have this local SVN repo that i am using for my dev work on a particular project, and i also have a SVN repo setup on the customers media temple account for a more secure backup. </p> <p>I do all of my development on my laptop so i don't always have an internet connection (hence the local SVN), so i was wonder...
<p>You will probably want to <code>svn merge</code> versions between repositories. </p> <p>There are some good tutorials around how you can do that. Give a look at <a href="http://blog.red-bean.com/sussman/?p=92" rel="nofollow noreferrer">http://blog.red-bean.com/sussman/?p=92</a> or <a href="http://subversion.tigris....
<p>So the solution i came up with is the use the svnadmin dump/load functions. I am mainly using this with a Ruby on Rails project that i am deploying to a media temple account. The idea is that when a new version of the site is ready to be deployed, the code that is checked into my local repository will be dumped to a...
21,134
<p>How do I set the symbol for the <em>angle</em> or <em>annuity</em> operation in LaTeX? Specifically, this is the actuarial <em>a</em> angle <em>s</em> = (1-v<sup>s</sup>)/i.</p>
<p>For a <em>very</em> comprehensive list of LaTeX symbols, see <a href="http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf" rel="nofollow noreferrer">The Comprehensive LaTeX Symbol List</a>. Worth printing out and keeping under your pillow. Page 95 has some code that may do what you want.</p>
<p>\annu<br> A good list of latex symbols can be found here <a href="http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf" rel="nofollow noreferrer">http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf</a> </p>
11,502
<p>At the moment I am working on a project admin application in C# 3.5 on ASP.net. In order to reduce hits to the database, I'm caching a lot of information using static variables. For example, a list of users is kept in memory in a static class. The class reads in all the information from the database on startup, and ...
<p>A pitfall: A static field is scoped per app domain, and increased load will make the server generate more app domains in the pool. This is not necessarily a problem if you only read from the statics, but you will get duplicate data in memory, and you will get a hit every time an app domain is created or recycled.</p...
<p>Hmmm... The "classic" method would be the application cache, but provided you never update the static variables, or understand the locking issues if you do, and you understand that they can disappear at anytime with an appdomain restart then I don't really see the harm in using a static.</p>
18,206
<p>I have designed a xml schema to parse an incoming xml document. The receive location gets xml documents from 2 feeds, one of them has misspelled a node in the document, "Roookie" instead of "Rookie", Is there a way to have my existing xsd parse this document?</p>
<p>You could probably preprocess the wrong XML file, like with this simple XSL stylesheet:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" indent="no"/&gt; &lt;xsl:template match="Roookie"&gt...
<p>You would need to replace the elements in the document or modify the xsd to work with the new document format.</p>
38,979
<p>We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively?</p> <blockquote> <p><a href="http://code.google.com/support/bin/answer.py?answer=65301&amp;topic=10945" rel="noreferrer">Will the Maps API w...
<p>I'd agree with the previous two answers that in this instance it may be better from a usability perspective to split the two functions into separate screens. You really want your users to be focussed on entering complete and accurate credit card information, and having a map on the same screen may be distracting.</p...
<p>I 've just removed the http protocol and it worked!</p> <p>From this:</p> <pre><code>&lt;script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>To this:</p> <pre><code>&lt;script src="//maps.google.com/maps/api/js?sensor=true" type="text/javascript"...
2,556
<p>For a while the proactive caching process successfully sync the OLAP databse and then is starts giving the following error 'Errors in the OLAP storage engine: The attribute key cannot be found:' followed by spesific data related information. I do not however have a problem if I manually process the databse with the ...
<p>Your measure is being rebuilt and there is a key value not found in your dimension table (this is basically a race condition).</p> <p>If data integrity is paramount, then you will need to do a full process of the cube.</p> <p>If you can get away with some aggregates being off temporarily (or assigned to "Unknown" ...
<p>It sounds like a new dimension key was added - and used by your fact table. The dimension key isn't in the cube yet, so it's not found when referenced by the fact...</p> <p>This can happen quite easily, and is only fixed by a full reprocess (or if you're lucky, good timing of proactive caching on dimensions and fa...
22,827
<p><a href="http://www.codinghorror.com/blog/archives/001187.html" rel="nofollow noreferrer">Jeff's recent article</a> linked to a <a href="http://www.ams.org/featurecolumn/archive/bins1.html" rel="nofollow noreferrer">time management example</a> of the <a href="http://en.wikipedia.org/wiki/Bin_packing_problem#Analysis...
<p>I think Hofstadter's Law applies.</p> <blockquote> <p>It always takes longer than you expect, even when you take Hofstadter's Law into account.</p> <p>--Douglas Hofstadter</p> </blockquote> <p>On a more serious note, take a look at <a href="http://en.wikipedia.org/wiki/Critical_chain" rel="noreferrer">Critical Chain...
<p>I am with Bill the Lizard. It ALWAYS takes longer than expected due to very unexpected things or probably things that weren't taken into account.</p>
37,641
<p>I've seen a couple of web pages say that <code>a = b || 'blah'</code> should assign <code>'blah'</code> to <code>a</code> if <code>b</code> is <code>undefined</code> or <code>null</code>. But if I type that into Firebug or use it in code, it complains that <code>b</code> is not defined, at the list on FF3/win. Any...
<p>If b existed, and was false, null, etc, then it works in the way that you would expect. All you'll need to do is on the line above that, put <code>var b = null</code>;</p> <p>This makes sense if you think about it. It basically does something like this...</p> <pre><code>a = function(){ if(b){return b;} else{ retur...
<p><code>||</code> is the short-circuited logical OR operator in JavaScript, much like it is in C, C++, Java, C#, Perl, PHP, etc.</p> <p><a href="http://en.wikipedia.org/wiki/%3F%3F_Operator#JavaScript_implementation" rel="nofollow noreferrer">According to Wikipedia</a>, if you put parentheses around <code>b</code>, it...
38,922
<p>In WindowsForms world you can get a list of available image encoders/decoders with</p> <pre><code>System.Drawing.ImageCodecInfo.GetImageDecoders() / GetImageEncoders() </code></pre> <p>My question is, is there a way to do something analogous for the WPF world that would allow me to get a list of available </p> <p...
<p>You've got to love .NET reflection. I worked on the WPF team and can't quite think of anything better off the top of my head. The following code produces this list on my machine:</p> <pre><code>Bitmap Encoders: System.Windows.Media.Imaging.BmpBitmapEncoder System.Windows.Media.Imaging.GifBitmapEncoder System.Window...
<p>Hopefully someone will correct me if I'm wrong, but I don't think there's anything like that in WPF. But hopefully this is one of the many cases where advances in the technology have rendered obsolete the way we're used to doing things. Like "how do I wind my digital watch?"</p> <p>To my understanding, the reason...
3,578
<p>Where would you write an error log file, say <code>ErrorLog.txt</code>, in Windows? Keep in mind the path would need to be open to basic users for file write permissions.</p> <p>I know the eventlog is a possible location for writing errors, but does it work for "user" level permissions?</p> <p>EDIT: I am targetin...
<p>Have you considered logging the event viewer instead? If you want to write your own log, I suggest the users local app setting directory. Make a product directory under there. It's different on different version of Windows.</p> <p>On Vista, you cannot put files like this under c:\program files. You will run int...
<p>Put it in the directory of the application. The users will need access to the folder to run and execute the application, and you can check write access on application startup.</p> <p>The event log is a pain to use for troubleshooting, but you should still post significant errors there.</p> <p>EDIT - You should loo...
23,268
<p>I have the following problem in my <i>Data Structures and Problem Solving using Java</i> book:</p> <blockquote> <p>Write a routine that uses the Collections API to print out the items in any Collection in reverse order. Do not use a ListIterator.</p> </blockquote> <p>I'm not putting it up here because I want so...
<p>Regardless from the question not making much sense as half of the collections have no gstable ordering of have fixed-ordering (i.e. TreeSet or PriorityQueue), you can use the following statement for printing the contents of a collection in reverse-natural order:</p> <pre><code>List temp = new ArrayList(src); Collec...
<p>Well you could have a routine that delegates to other routines based on the input type, however I'm not sure there is a generic enough collection type that can be encompassed into one argument. I guess you could just use method overloading (having multiple methods with the same name, but accept different args).</p> ...
23,887
<p>Using <a href="http://en.wikipedia.org/wiki/Apache_Ant" rel="nofollow noreferrer">Ant</a> I could unzip an archive before proceeding with the build per-se ... Is this possible using nmake? Could I call an external application? Or even a batch script?</p>
<p>Any variant on make has the ability to perform any task that can be done from the command line. Indeed, most of the build functionality of any makefile is going to depend upon the onvocation of external processes such as the compiler, linker, librarian, etc. The only downside to make is that there are so many vari...
<p>You can call an external application from nmake Makefiles, just as from any other Makefile.</p> <p>However, what to call? You'll need to have WinZip command line tools or something installed, right?</p> <p>I'd recommend looking at <a href="http://www.scons.org/" rel="nofollow noreferrer">SCons</a>. It is a wonderf...
17,892
<p>So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs.</p> <p>The code I have thus far (along with <code>include</code>s for EuCOM itself and parts of Win32lib):</p> <pre><code>glob...
<p>You should use the <code>create_safearray()</code> function. It's documented (hidden?) under Utilities. Basically, put your BSTR pointers into a sequence and pass it to <code>create_safearray()</code>:</p> <pre><code>sequence s, bstrs s = {"A", "B"} bstrs = {} for i = 1 to length(s) do bstrs &amp;= alloc_bstr...
<p>I've been in touch with the Euphoria people via their <a href="http://openeuphoria.org/EUforum/index.cgi?module=forum&amp;action=flat&amp;id=102589#unread" rel="nofollow noreferrer">forum</a>, and have gotten this far. The routine is failing on the the make_variant line. I haven't figured it out any further than tha...
24,334
<p>I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax()</p> <p>To perform the AJAX I'm using:</p> <pre><code>$.ajax({ url: myUrl, cache: false, dataType: "json", success: function(data){ ... }, error: function(e, xhr){ ... } }); </code></pre> <p>And if I re...
<p>Is your server sending data as Content-Type <code>"*/json"</code>? If not, modify the response headers accordingly. Sending <code>"application/json"</code> would be fine, for example.</p>
<p>use</p> <pre><code>$data = yourarray(); json_encode($data) </code></pre> <p>on server side. On client side use ajax with Datatype JSON and be sure your document encoding is not UTF-8 with BOM it has to be UTF-8.</p>
31,048
<p>We are building an enterprise application in which we will incorporate multiple platforms for user interfaces (i.e. ASP.net webapp, Windows Application, and someday, Mobile Apps) and multiple platforms for back-end databases (i.e. SQL Server, XML, Oracle). An additional neccesity is that these back-end DBs either b...
<p>Abstracting the presentation layer is a fairly easy concept once you have the hang of n-tier architecture. Just focus on differentiating &quot;domain logic&quot; from &quot;application logic&quot;. Domain logic is common across your different platforms, and application logic is platform-specific. For example, data v...
<p>I would look at using the provider model to establish the database connections in your application.</p> <p>I would start by looking at the examples and detail provided in the Microsoft Data Application Block, I think it will help get you part of the way there.</p>
29,071
<p>So I am currently learning C++ and decided to make a program that tests my skills I have learned so far. Now in my code I want to check if the value that the user enters is a double, if it is not a double I will put a if loop and ask them to reenter it. The problem I have is how do I go about checking what type of v...
<h2>Safe C++ Way</h2> <p>You can define a function for this using <code>std::istringstream</code>:</p> <pre><code>#include &lt;sstream&gt; bool is_double(std::string const&amp; str) { std::istringstream ss(str); // always keep the scope of variables as close as possible. we see // 'd' only within the ...
<p>I would have to say I just started and don't have the slightest of clue about your code, but I will check out your link. By the way, I haven't learned how to work with templates yet,I am learning about dealing with data, only Chapter 3 in my C++ Primer Plus 5th edition.</p>
43,139
<p>One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. </p> <p>Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it for frameworks such as ...
<p>I've recently started looking for something like this for Ruby. What I've run across so far:</p> <ul> <li><a href="http://saikuro.rubyforge.org/" rel="noreferrer">Saikuro</a></li> <li><a href="http://www.martyandrews.net/blog/2008/09/first_official_release_of_rood.html" rel="noreferrer">Roodi</a></li> <li><a href=...
<p>There is also <a href="https://github.com/simplabs/excellent" rel="nofollow">excellent</a>. I haven't tried it yet, but it too looks promising. </p>
7,902
<p>Is it a good idea to have a factory class using generics to instantiate objects?</p> <p>Let's say I have a class Animal and some subclasses (Cat, Dog, etc):</p> <pre><code>abstract class Animal { public abstract void MakeSound(); } class Cat : Animal { public override void MakeSound() { Consol...
<p>Depends on what you want to do with it. The example you gave is not that helpful, as all it does is simply call new() which is something you can do in your code as well. A factory is more useful if you want to place logic which has to be ran during the object creation process somewhere outside the object to create b...
<p>using generics for your constructor is called the abstract factory pattern. </p> <p>Its good but only if you're using it, in this example you've got some of the defaults in the factory at least.</p> <pre><code>static class AnimalFactory { public static Animal Create&lt;T&gt;() where T : Animal { ret...
47,376
<p>In Visual Studio you can create a template XML document from an existing schema. The new <a href="http://msdn.microsoft.com/en-us/library/cc716766.aspx" rel="noreferrer">XML Schema Explorer</a> in VS2008 SP1 takes this a stage further and can create a sample XML document complete with data. Is there a class library ...
<p>some footwork is involved, but you could load the xsd into a DataSet object, iterate over the Tables and add a few rows in each by calling calling NewRow() on each and then adding those rows back into their respective tables.. then save the DataSet out to a file:</p> <pre><code>DataSet ds = new DataSet(); ds.ReadXm...
<p>Directly, none that I can think of, other than third party add-ons. You could utilize the <a href="http://msdn.microsoft.com/en-us/library/x6c1kb0s(VS.80).aspx" rel="nofollow noreferrer">xsd schema definition tool</a> to take your XSD and create a .NET object/class, once you have that, you could, to quote the linked...
6,304
<p>Can somebody remember what was the command to create an empty file in MSDOS using BAT file?</p>
<pre><code>echo. 2&gt;EmptyFile.txt </code></pre>
<p>The easiest way is:</p> <p><code>echo. &gt; Filename.txt</code></p>
25,797
<p>The TextWrapping property of the TextBox has three possible values:</p> <ul> <li>Wrap</li> <li>NoWrap</li> <li>WrapWithOverflow</li> </ul> <p>I would like to bind to the IsChecked property of a MenuItem. If the MenuItem is checked, I want to set the TextWrapping property of a TextBox to Wrap. If the MenuItem is ...
<p>If you want to do this all in xaml you need to use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.style.aspx" rel="noreferrer">Style</a> and a <a href="http://msdn.microsoft.com/en-us/library/system.windows.datatrigger.aspx" rel="noreferrer">DataTrigger</a>.</p> <pre><code>&lt;StackPanel&gt; ...
<p>I assume you are talking about .NET. I don't think databinding will work here because the values are not of the same type (boolean vs enum). The easiest solution would be to handle the CheckedChanged event of that menu item and adjust the wrap mode of the textbox accordingly.</p>
31,222
<p>In data processing, I frequently need to create a lookup data structure to map one identifier to another. As a concrete example, let's take a structure which holds a 1-to-1 mapping between a country's 2 character code and its full name. In it we would have</p> <pre><code>AD -&gt; Andorra AE -&gt; United Arab Emi...
<p>My vote would be for <code>codeToName</code> in this particular case, and I guess that generalizes. That's not to say that it's the name I would have chosen myself in all cases; that depends a lot on scope, further encapsulation, and so on. But it feels like a good name, that should help make your code readable:</p>...
<p>Another vote for just pluralizing what you're mapping to.</p> <p>eg. <code>country = countries[code]</code></p>
26,744
<p>Is it possible to automount a TrueCrypt volume when logging in to Ubuntu 8.04? It's already storing the wireless network keys using the Seahorse password manager. Could TrueCrypt be made to fetch its volume password from the same keyring? Currently this would seem like the most convenient way to store my source code...
<p>I can't really remember where I found this solution, but it was working for me on Ubuntu Karmic with gdm. You have to edit the <code>/etc/gdm/Init</code> file and add the following:</p> <pre><code>if !(echo `mount` | grep -q "/home/your_username type") then truecrypt /dev/sdaxxx /home/your_username fi </c...
<p>Apparently one solution will be to update to Ubuntu 8.10 which by default supports an encrypted directory for each user, mounted at login. It's not the same as TrueCrypt but has other strengths and weaknesses.</p> <p>There's also a way to <a href="http://blog.littleimpact.de/index.php/2008/07/12/automatic-encryptio...
13,896
<p>I am looking for a free tool to load Excel data sheet into an Oracle database. I tried the Oracle SQL developer, but it keeps throwing a NullPointerException. Any ideas?</p>
<p>Excel -> CSV -> Oracle</p> <p>Save the Excel spreadsheet as file type 'CSV' (Comma-Separated Values).</p> <p>Transfer the .csv file to the Oracle server.</p> <p>Create the Oracle table, using the SQL <code>CREATE TABLE</code> statement to define the table's column lengths and types. </p> <p>Use sqlload to load t...
<p>As you mention you are looking for a tool - you might like to check out this Oracle specific video - you can load data from any source - </p> <p><a href="http://youtu.be/shYiN2pnPbA" rel="nofollow">http://youtu.be/shYiN2pnPbA</a></p>
14,594
<p>We just shifted from VB to C# and I am having some troubles..!</p> <p>Why can't I create a private static const void?? </p> <p>why is it not working?</p> <pre><code> private static const void MyVoid(void void) { try { this.void void = new void(void + void); return this.void; } catch (voi...
<p>C# doesn't let you declare a method to be <code>const</code> whatever its return type is, so your method declaration is incorrect.</p> <p>You can't catch <code>void</code> either - you can only catch exception types.</p> <p>Ditto void parameters etc.</p> <p>Why do you think you need this?</p>
<p>it's because void is actually nothingness :) If you want to send nothing to methods. Do it MyVoid()</p> <p>The same is for other lines in your method</p>
35,950
<p>What are the implications of running a Microsoft Access Database in both 2003 and 2007? </p> <p>Is there some class I forgot to take?</p> <p>The program was originally built in office 2003, and then run in 2007. Issues seem to happen when the machine it is being run on has both 2003 and 2007 on it. The issue would...
<p>Microsoft's official position is that installing multiple office versions on the same pc is not supported and not recommended, and Access 2007 seems to be designed to prove that to us!</p> <p>That said, you can avoid most issues by doing the following:</p> <p>1 - Splitting the db into a back end and front end. Pl...
<p>We have an MS-Acces application, developped with Access 2003 and used on either full or runtime version of Access 2003 and Access 2007 (Access 2007 Runtime being free, we are making a great use of it!). There is no particular issue except the references management. Our code analyses the Office version installed on t...
10,087
<p>I was developing a web page, where I was laying out a board for a Chess-like game, along with a couple of piece trays. It's all done using HTML (with jQuery for dynamic updating as the game is played). Somewhere I'd got the notion that using absolute positioning of elements within a page was considered a bad practic...
<p>For a chess like game such as you are developing, there is nothing inherently wrong with using absolute positioning. As you said, relative positioning and normal flow layout make this sort of task quite difficult. </p> <p>Of course, if you were developing a more standard website, such as a site providing some publ...
<p>IMO, not a bad thing at all. I have recently completed an assignment with AA standards compliance and support for FF2, IE7, IE6 (yes, a pain I know). There were certain layouts which were only achievable because of absolutely positioning! Even certain components like buttons where layering was needed (transparencies...
22,508
<p>How do you go about finding unused icons, images, strings in .resx files that may have become 'orphaned' and are no longer required?</p>
<p>Recently <a href="https://github.com/tom-englert/ResXResourceManager" rel="noreferrer">ResXManager 1.0.0.41</a> added a feature to show the number of references to a string resource.</p> <p><img src="https://i.stack.imgur.com/X3fwm.png" alt="Screenshot showing the new reference column"></p>
<p>I've been considering this myself and I believe I have two options. Both of these rely on the fact that I use a helper method to extract the required resource from the resource files. </p> <ol> <li><p><strong>Logging</strong><br> Add some code to the "getresource" method or methods so that every time a resource is ...
30,514
<p>I've recently initialized OctoPi onto my Raspberry Pi, proceeded to connect it to my local internet, and then connected it to my FlashForge Creator Pro (2014 edition)</p> <p>Everything seemed to be going smoothly until I tried to connect to the printer; the Pi didn't seem to be able to pick up a usable Baudrate (aft...
<p>I got the same problem.<br> Auto-detect baud rate was not working too.<br> So I manually tried every baud-rate and finally found one working, for me it was 115200.<br> Good luck!</p>
<p>Install GPX via command line. To do this, type</p> <p><code>/home/pi/oprint/bin/pip install &quot;https://markwal.github.io/octoprint-download/OctoPrint-GPX.tgz&quot;</code> then go ahead and restart octoprint and try connecting again.</p>
522
<p>I am currently working on an asp.net application in Visual Studio 2005. I would like to upgrade to 2008 to take advantage of some of the new features, but my remote team won't be able to upgrade to it for a while.</p> <p>Is it possible for only a few people on my team to upgrade to Visual Studio 2008, while the res...
<p>Yes, the project files between 2005 and 2008 are compatible. The solutions are not, but those are easy to remake or copy. There is one gotcha with the project files, if you're using Web Applications projects. The two versions reference different MSBuild target files. Steven Harman has <a href="http://stevenharma...
<p>Make copies of your project files and rename the physical copies to "Name2005.proj". Then upgrade the solution you are working on which will upgrade the project and solution files. Finally go back in VS2005 and create a new 2005 solution and stitch up the 2005 projects into it. </p> <p>This gives you two parrall...
19,660
<p>I've run across the following line in a VB6 application.</p> <pre><code>mobjParentWrkBk.ExcelWorkBook.Application.Selection.Insert Shift:=xlToRight </code></pre> <p>Unfortunately Google and other search engines have not been very useful as they seem to omit the := part. </p> <p>What would be a C# equivalent?</p>
<p>This is Visual Basic syntax for optional named parameters. The <code>Insert</code> function has a parameter named <code>Shift</code>, which is being specified.</p> <p>C#, as far as I know, doesn't have an equivalent for optional named parameters. Instead, you'd need to call the <code>Insert</code> method, specifyin...
<p>It's really all about Excel and how it handles inserts. If you select a range of cells and right-click Insert you will be asked which direction to shift the cells. This is from the Excel Help:</p> <p>=======</p> <p>Insert Method on Range Object</p> <p>Inserts a cell or a range of cells into the worksheet or mac...
28,137
<p>I am currently working on a C++/COM project using ArcEngine(From ESRI). Aside from the fact that there is little to no support in terms of documentation (SDK is there.) Anyways, i am wondering if anyone here has had any experience in making the initialization process of ArcEngine faster. Right now it takes 30-35 sec...
<p>It's been almost a decade since I last played with ESRI stuff, so I can't help you with anything specific to ArcEngine.</p> <p>Maybe you can pool instances? In the best case scenario you would be able to reuse ArcEngine instances, and could return an instance back to pool after you're done with it. If that's not po...
<p>Well from my understanding ArcEngine initialization, initializes a special COM environment.</p> <p>You don't ever get any sort of real handle over the initialized environment. Can you somehow store a COM Enviroment and pass it to other programs. My current idea is:</p> <p>Windows Service Running in Background with...
36,955
<p><a href="http://www.stackoverflow.com/questions/61088/hidden-features-of-javascript#61118">Alan Storm's comments</a> in response to my answer regarding the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with" rel="noreferrer"><code>with</code> statement</a> got me thinking. I'v...
<p>Another use occurred to me today, so I searched the web excitedly and found an existing mention of it: <a href="http://web.archive.org/web/20090111183416/http://www.hedgerwow.com/360/dhtml/js_block_scope.html" rel="noreferrer">Defining Variables inside Block Scope</a>.</p> <h3>Background</h3> <p>JavaScript, in spite...
<p>Just wanted to add you can get "with()" functionality with pretty syntax and no ambiguity with your own clever method...</p> <pre><code> //utility function function _with(context){ var ctx=context; this.set=function(obj){ for(x in obj){ //should add hasOwnPro...
8,679
<p>If the Mono project is successful it will pave the way for commercial software on non-Windows platforms.</p> <p>I am interested in the prospect of writing and selling commercial software for the Mono platform along the lines of our existing Smoke Vector Graphics (OCaml) and F# for Visualization (.NET) products. Are...
<p>My figures speak against it, we developed Qide 10 years ago and got 4 or so buys. We got at least a few hundred time more on Windows. The state of tools on Linux can just be named bad. Agreed you have wonderful things there but if you use GPLd software you will drown in their license stuff. There does exist one deb...
<p>Linux people are notoriously thrifty, so I'd consider the ROI.</p> <p>Do you really want to spend your resources to target a group that has less than 10% market adoption, and out of that 10%, only 1% would be interested in your product, and only %0.01 percent would pay for it?</p>
34,668
<p>I'm storing many files of various lengths into a block-oriented medium (fixed-size e.g. 1024 bytes). When reading back the file, each block will either be missing or correct (no bit errors or the like). The missing blocks are random, and there's not necessarily any sequence to the missing blocks. I'd like to be a...
<p>Look into Reed-Solomon codes:</p> <p><a href="http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction</a></p>
<p>Check out Raptor codes (<a href="https://en.wikipedia.org/wiki/Raptor_code" rel="nofollow">https://en.wikipedia.org/wiki/Raptor_code</a>) they're the most advanced fountain codes out there at the moment</p>
38,017
<p>I've long had a desire for an STLish container that I could place into a shared memory segment or a memory mapped file.</p> <p>I've considered the use of a custom allocator and placement new to place a regular STL container into a shared memory segment. (like this ddj <a href="http://www.ddj.com/cpp/184401639;jsess...
<p>The best starting point for this is probably the boost Interprocess libraries. They have a good example of a map in shared memory here: <A href="http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_map" rel="nofollow noreferrer">interprocess map</A></p>...
<p>Try using Qt's QSharedMemory Implementation.</p>
32,889
<p>I have built a simple WCF Service and deployed it to IIS6, and I'm noticing that it works in my Dev and Staging environments, but not Production. Every time I try to hit the service metadata link, I get a 404 page.</p> <p>I've checked IIS config everywhere I can think of and they're identical, so the only differen...
<p>You need to setup wild card mapping on IIS6. This <a href="http://peterkellner.net/2008/08/24/urlrewrite-with-aspnet-urlrewriter-wildcard-mapping-iis6-iis7/" rel="noreferrer">link</a> seems like a good step by step guide.</p> <p>Try reading up on the differences between the integrated pipeline vs classic pipeline o...
<p>For me .svc was already mapped to the aspnet_isapi.dll as per AnthonyWJones answer:</p> <p><a href="https://i.stack.imgur.com/ZmEB6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZmEB6.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/oYSBk.jpg" rel="nofollo...
44,381
<p>I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions.</p> <p>For example, I have a route like this:</p> <pre><code>routes.MapRoute( "TestController-TestAction", "TestController.mvc/TestAction/{paramName}", new { controller = "...
<p>Solution:</p> <pre><code>public ActionResult TestAction(string paramName) { if (!String.IsNullOrEmpty(Request["paramName"])) { return RedirectToAction("TestAction", new { paramName = Request["paramName"]}); } /* ... */ } </code></pre>
<p>In your route, get rid of the {paramName} part of the URL. It should be:</p> <p>TestController.mvc/TestAction</p> <p>As that is the URL you want the request to route to. Your form will then post to that URL. Posted form values are mapped to parameters of an action method automatically, so don't worry about not ha...
2,992
<p>What is a good C/C++ CSS parser? All that I can find is <a href="http://csstidy.sourceforge.net/" rel="noreferrer">CSSTidy</a>, and it seems to be more of an application than a parsing library.</p>
<p>libcss seems also a common google hit and it looks good</p> <p><a href="http://www.netsurf-browser.org/projects/libcss/" rel="nofollow">http://www.netsurf-browser.org/projects/libcss/</a></p>
<p>A pretty good bet would be to read through the Mozilla or Safari code-base. If you need something a little more accessible for another program, there's an ANTLR grammar (which you can use to create C++ code) at <a href="http://www.antlr3.org/grammar/1214945003224/csst3.g" rel="nofollow noreferrer">http://www.antlr3....
47,778
<p>I'm working on a project where I need the following.</p> <ul> <li>WCF service on the server side (.NET 3.5)</li> <li>WPF client for the client side (.NET 3.0)</li> </ul> <p>I have an existing application that I have to use the authentication and authorization from (on the server side). I also need to store some me...
<p>Actually it's possible, but you will need to implement your own binding.</p> <p>Yaron Naveh developed a WCF binding that enables clear text username/password over HTTP. His <a href="http://webservices20.blogspot.com/2008/11/introducing-wcf-clearusernamebinding.html" rel="noreferrer">article</a> includes the code fo...
<p>I don't know the details of your network infrastructure, but if you are in a Windows domain, you should consider using Windows credentials.</p> <p>It is possible to use a Message security without certificates if you use Windows credentials. This is the default behavior of the wsHttpBinding (out of the box).</p> <p...
49,721
<p>Does anybody know any fine open source cube browser?</p> <p>Ideally, it would be something built with plain javascript.</p> <p>Does it even exists?</p> <p>I'm planing to use it with classic asp agains a SQL database.</p>
<p>You can look at <a href="http://mondrian.pentaho.org/" rel="noreferrer">Pentaho Mondrian</a> (including <a href="http://jpivot.sourceforge.net" rel="noreferrer">JPivot</a>), or at <a href="http://eclipse.org/birt" rel="noreferrer">Eclipse BIRT</a></p> <p>With these, you get some kind of flexible reporting tools on ...
<p>if you can, find the sql server 2000 Resource Kit, inside there is a project that is a javascript cube browser. i am not sure of the licensing of this, but it is located at TOOLSANDSAMPLES\ANALYSISSERVICESTHINWEBCLIENT inside the Resource Kit. This resource kit should be available in msdn subscription downloads.</...
49,795
<p>Is there a one line function call that quits the program and displays a message? I know in Perl it's as simple as:</p> <pre><code>die("Message goes here") </code></pre> <p>I'm tired of typing this:</p> <pre><code>puts "Message goes here" exit </code></pre>
<p>The <code>abort</code> function does this. For example:</p> <pre><code>abort("Message goes here") </code></pre> <p>Note: the <code>abort</code> message will be written to <code>STDERR</code> as opposed to <code>puts</code> which will write to <code>STDOUT</code>.</p>
<p>I've never heard of such a function, but it would be trivial enough to implement...</p> <pre><code>def die(msg) puts msg exit end </code></pre> <p>Then, if this is defined in some .rb file that you include in all your scripts, you are golden.... just because it's not built in doesn't mean you can't do it yours...
4,920
<p>OK. This problem is doing my head in. And I don't know if there even IS a definitive answer.</p> <p>We have a website, lets call it <em>mycompany.com</em>. It's a UK-based site, with UK based content. Google knows about it, and we have done a load of SEO on it. All is well.</p> <p><strong>Except</strong>, we are a...
<p>As long as Google can find mycompany.com/uk and mycompany.com/au, it'll index all three versions of the site. Your domain's Google juice should apply to all three URLs just fine if they're on the same domain.</p>
<p>@ross: yes, we have links between the sites. It' just the home page, and which one comes up when someone searches for "my company" in google.</p> <p>Thanks!</p>
5,218
<p>I have some C# code in an ASP.Net application that does this:</p> <p>Bitmap bmp = new Bitmap(1184, 1900);</p> <p>And occasionally it throws an exception "Parameter is not valid". Now i've been googling around and apparently GDI+ is infamous for throwing random exceptions, and lots of people have had this problem, ...
<p>Stop using GDI+ and start using the WPF Imaging classes (.NET 3.0). These are a major cleanup of the GDI+ classes and tuned for performance. Additionally, it sets up a "bitmap chain" that allows you to easily perform multiple actions on the bitmap in an efficient manner.</p> <p>Find more by reading about <a href="h...
<p>I just got a reply from microsoft support. Apparently if you look here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.aspx</a></p> <p>You can see it says "Classes within the System.Drawing namespace are ...
15,885
<p>I am looking for reference documentation for designMode in Firefox 2/3 and IE 6/7/8. Does anyone have links to good references?</p>
<p>Try <a href="https://developer.mozilla.org/En/Rich-Text_Editing_in_Mozilla" rel="nofollow noreferrer">Mozilla's developer reference</a>. (Also indicates IE inconsistencies and omitted commands.)</p>
<p>Try <a href="https://developer.mozilla.org/En/Rich-Text_Editing_in_Mozilla" rel="nofollow noreferrer">Mozilla's developer reference</a>. (Also indicates IE inconsistencies and omitted commands.)</p>
29,024
<p>I have a dict, which I need to pass key/values as keyword arguments.. For example..</p> <pre><code>d_args = {'kw1': 'value1', 'kw2': 'value2'} example(**d_args) </code></pre> <p>This works fine, <em>but</em> if there are values in the d_args dict that are not accepted by the <code>example</code> function, it obvio...
<p>A little nicer than inspecting the code object directly and working out the variables is to use the inspect module.</p> <pre><code>&gt;&gt;&gt; import inspect &gt;&gt;&gt; def func(a,b,c=42, *args, **kwargs): pass &gt;&gt;&gt; inspect.getargspec(func) (['a', 'b', 'c'], 'args', 'kwargs', (42,)) </code></pre> <p>If yo...
<p>Extending DzinX's answer:</p> <pre><code>argnames = example.func_code.co_varnames[:func.func_code.co_argcount] args = dict((key, val) for key,val in d_args.iteritems() if key in argnames) example(**args) </code></pre>
23,939
<p>I just spent half an one our to find out what caused the Error-Message "Ci is not defined" in my JavaScript code. I finally found the reason:</p> <p>It should be (jQuery):</p> <pre><code>$("asd").bla(); </code></pre> <p>It was:</p> <pre><code>("asd").bla(); </code></pre> <p>(Dollar sign gone missing)</p> <p>No...
<p>I don't know which version of FF you are using, but regardless, the message is probably referring to the fact that <code>bla()</code> is not a function available on the String object. Since you were missing the <code>$</code>, which means you were missing a function, <code>("asd")</code> would evaluate to a string, ...
<p>Assuming it's CodeIngiter, it can't find the js file.</p>
33,868
<p>I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. <strong>not UDP</strong>). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, <code>sendto</code> fails unless the client is bound too. ...
<p>I assume that you are running Linux; I don't know if this advice applies to SunOS or any UNIX. </p> <p>First, the answer: after the socket() and before the connect() or first sendto(), try adding this code:</p> <pre><code>struct sockaddr_un me; me.sun_family = AF_UNIX; int result = bind(fd, (void*)&amp;me, sizeof(...
<p>I'm not so sure I understand your question completely, but here is a datagram implementation of an echo server I just wrote. You can see the server is responding to the client on the same IP/PORT it was sent from.</p> <p>Here's the code</p> <p>First, the server (listener)</p> <pre><code>from socket import * impor...
12,019
<p>I'm playing with the routing.rb code in Rails 2.1, and trying to to get it to the point where I can do something useful with the RoutingError exception that is thrown when it can't find the appropriate path.</p> <p>This is a somewhat tricky problem, because there are some class of URLs which are just plain BAD: the...
<p>Nooooo!!! Don't implement method_missing on your controller! And please try to avoid action_missing as well.</p> <p>The frequently touted pattern is to add a route:</p> <pre><code>map.connect '*', :controller =&gt; 'error', :action =&gt; 'not_found' </code></pre> <p>Where you can show an appropriate error.</p> <...
<p>There's the method_missing method. You could implement that in your Application Controller and catch all missing actions, maybe logging those and redirecting to the index action of the relevant controller. This approach would ignore everything that can't be routed to a controller, which is pretty close to what you w...
7,419
<p>I'm using MS SQL Server 2005. Is there a difference, to the SQL engine, between</p> <pre><code>SELECT * FROM MyTable; </code></pre> <p>and</p> <pre><code>SELECT ColA, ColB, ColC FROM MyTable; </code></pre> <p>When ColA, ColB, and ColC represent every column in the table?</p> <p>If they are the same, is there a...
<p>Generally, it's better to be explicit, so <code>Select col1, col2 from Table</code> is better. The reason being that at some point, an extra column may be added to that table, and would cause unneeded data to be brought back from the query.</p> <p>This isn't a hard and fast rule though. </p>
<p>selecting each column is better than just * because in case you add or delete a new row you HAVE to look at the code and take a look what you were doing with the retrieved data.<br> Also, it helps you understand your code better and allows you to use aliases as column names (in case you're performing a join of table...
25,633
<p>I'm looking for a way to delete a file which is locked by another process using C#. I suspect the method must be able to find which process is locking the file (perhaps by tracking the handles, although I'm not sure how to do this in C#) then close that process before being able to complete the file delete using <co...
<p>Killing other processes is not a healthy thing to do. If your scenario involves something like uninstallation, you could use the <a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexa" rel="nofollow noreferrer"><strong><code>MoveFileEx</code></strong> API function</a> to mark the...
<p>Oh, one big hack I employed years ago, is that Windows won't let you <em>delete</em> files, but it does let you <em>move</em> them.</p> <p>Pseudo-sort-of-code:</p> <pre><code>mv %WINDIR%\System32\mfc42.dll %WINDIR\System32\mfc42.dll.old Install new mfc42.dll Tell user to save work and restart applications </code><...
2,345
<p>I want to make a deep copy of a LINQ to XML XElement. The reason I want to do this is there are some nodes in the document that I want to create modified copies of (in the same document). I don't see a method to do this.</p> <p>I could convert the element to an XML string and then reparse it, but I'm wondering if...
<p>There is no need to reparse. One of the constructors of XElement takes another XElement and makes a deep copy of it:</p> <pre><code>XElement original = new XElement("original"); XElement deepCopy = new XElement(original); </code></pre> <p>Here are a couple of unit tests to demonstrate:</p> <pre><code>[TestMethod]...
<p>I do not believe there is an existing mechanism that allows you to perform a deep copy of an XNode style tree. I think you are left with two options.</p> <ol> <li>Do as you suggested an convert to a string and then back into a tree</li> <li>Write on yourself with a visitor pattern</li> </ol> <p>The visitor patter...
25,723
<p>In tomcat 6 i have a servlet running openbluedragon, everything compiles and servers up quik, with the exception of images, they really lag significantly. Any suggestions optimization for image serving?</p> <p>Here is my server.xml:</p> <pre><code> &lt;Service name="Catalina"&gt; &lt;Connector port="800...
<p>Another option is to use apache as a frontend, connecting tomcat with mod_jk. This way you can let apache serve static content (e.g. images, css, javascript) and let tomcat generate the dynamic content. Might leave a bit of work to separate the static content from the dynamic ones, but works great for me.</p> <p>On...
<p>If you have the option, you could add a reverse proxy in advance of your application. At work I have an Apache web server that receives all inbound HTTP connections. Based on the URL, it either forwards the request to another server or serves up the content itself. I've used this approach to accelerate serving up...
13,482
<p>How do you unit test a large MFC UI application?</p> <p>We have a few large MFC applications that have been in development for many years, we use some standard automated QA tools to run basic scripts to check fundamentals, file open etc. These are run by the QA group post the daily build.</p> <p>But we would like ...
<p>It depends on how the App is structured. If logic and GUI code is separated (MVC) then testing the logic is easy. Take a look at Michael Feathers <a href="https://web.archive.org/web/20080509080327/http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf" rel="nofollow noreferrer" title="Humble Dialog B...
<p>Actually we have been using Rational Team Test, then Robot, but in recent discussions with Rational we discovered they have no plans to support Native x64 applications focusing more on .NET, so we decided to switch Automated QA tools. This is great but licensing costs don't allow us to enable it for all developers.<...
13,302
<p>I am invoking a C library via JNI that prints to stdout. How can I redirect this output to System.out?</p>
<p><code>System.out</code> <strong>is</strong> <code>stdout</code>. Is there some more fundamental problem you're having (mixed up output, perhaps?).</p> <p>Since another member has also mentioned that last point - I should explain further:</p> <p><code>System.out</code> and <code>stdout</code> both correspond to fi...
<p>As Alnitak wrote, you should print to stdout. You should note that it can take a while for the message to appear on the screen. In case the timing is important, you should print a timestamp with the message when you print to stdout.</p>
37,073
<p>Is a string literal in C++ created in static memory and destroyed only when the program exits?</p>
<p>Where it's created is an implementation decision by the compiler writer, really. Most likely, string literals will be stored in read-only segments of memory since they never change.</p> <p>In the old compiler days, you used to have static data like these literals, and global but changeable data. These were stored ...
<p>String literals are stored in read-only segments of memory </p>
45,416
<p>In a silverlight application, I want to access the page the silverlight .xap file from an HTTP subdomain, but have the web services access a different subdomain for sensitive information over HTTPS.</p> <p>I set up clientaccesspolicy.xml at the root of the subdomain and it lets the silverlight app access its servic...
<p>Check out:<a href="http://silverlight.net/forums/t/12741.aspx" rel="nofollow noreferrer">http://silverlight.net/forums/t/12741.aspx</a></p> <blockquote> <p>You can either make https calls to the same domain or http cross-domain calls, but not https cross-domain calls.</p> <p>This is described in <a h...
<p>The important thing to note here that is not in the above information clearly is you must have access to the "ROOT" level of the domain request, and the clientaccesspolicy.xml must reside at that level.</p> <p>If for example you have a production environment that your application is behind a load balancer that dire...
9,922
<p>I'm trying to catch a ClassCastException when deserializing an object from xml.</p> <p>So,</p> <pre><code>try { restoredItem = (T) decoder.readObject(); } catch (ClassCastException e){ //don't need to crash at this point, //just let the user know that a wrong file has been passed. } </code></pre> <p>An...
<p>The code in the question should give you an unchecked cast warning. Listen to -Xlint.</p> <p>All the compiler knows about T is its bounds, which it probably doesn't have (other than explicitly extending Object and a super of the null type). So effectively the cast at runtime is (Object) - not very useful.</p> <p>W...
<p>Well, I can't use <code>instanceof</code> operator as the method is a parametrized one:</p> <pre><code>public T restore(String from){ ... restoredItem = (T) decoder.readObject(); ... } </code></pre> <p>And generics in Java are compile-time only.</p>
22,626
<p>I know that JavaScript doesn't support macros (Lisp-style ones) but I was wondering if anyone had a solution to maybe simulate macros? I Googled it, and one of the solutions suggested using <code>eval()</code>, but as he said, would be quite costly.</p> <p>They don't really have to be very fancy. I just want to do s...
<p>You could use <a href="http://common-lisp.net/project/parenscript/" rel="noreferrer">parenscript</a>. That'll give you macros for Javascript.</p>
<p>Javascript is interpreted. Eval isn't any more costly that anything else in Javascript.</p>
23,521
<p>Recently I've been experimenting with TDD while developing a GUI application in Python. I find it very reassuring to have tests that verify the functionality of my code, but it's been tricky to follow some of the recommened practices of TDD. Namely, writing tests first has been hard. And I'm finding it difficult to ...
<p><strong>If you are writing your tests after you've written your code and making them pass, you are not doing TDD</strong> (nor are you getting any benefits of Test-First or Test-Driven development.. check out SO questions for definitive books on TDD)</p> <blockquote> <p>One of the things I've noticed with using...
<p>Unit tests are really useful when you refactor your code (ie. completely rewrite or move a module). As long as you have unit tests before you do the big changes, you'll have confidence that you havent forgotten to move or include something when you finish.</p>
10,480
<p>I am using a codebehind page in ASP.NET to perform a SQL query. The query is loaded into a string, the connection is established (To Oracle), and we get it started by having the connection perform .ExecuteReader into a OleDBDataReader (We'll call it DataRead). I'll try to hammer out an example below. (Consider Dr...
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listitemcollection.add.aspx" rel="nofollow noreferrer">Add</a> function can take a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listitem.aspx" rel="nofollow noreferrer">ListItem</a>, so you can do</p> <pre><...
<p>you'd select a second column into your datareader (such as an IDENTITY field) and then assign do your Item generation like this:</p> <pre><code>Dim item as new listitem item.text = DataRead.Item("SubGroup Of Bunnies") item.value = DataRead.Item("ID") Drop.Items.Add(item) </code></pre> <p>You may also want to look ...
18,572
<p>I have an object instance which I access with the ME as it accesses the instantiated object. I have a method that gets a collection of these objects and I wish to assign the first one to the instantiated object. </p> <p>This is some of the code</p> <pre><code>Dim Books As New BookCollection(True) Books.ListByTheme...
<p>As stated in this <a href="https://stackoverflow.com/questions/176745/circular-references-in-java">SO question</a>, circular reference is well managed.</p> <p>Java does not do reference counting, it does uses <a href="https://en.wikipedia.org/wiki/Tracing_garbage_collection" rel="nofollow noreferrer">tracing garbag...
<p>The JVM operates on the notion of "islands of unreachability". If there is an unreachable 'island' of interconnected objects then that set of objects is eligible for garbage collection in its entirety.</p>
34,151
<p>I am currently calling the following line of code:</p> <pre><code>java.net.URL connection_url = new java.net.URL("http://&lt;ip address&gt;:&lt;port&gt;/path"); </code></pre> <p>and I get the exception above when it executes. Any ideas as to why this is happening?</p>
<p>Your code works perfectly fine for me:</p> <pre><code>public static void main(String[] args) { try { java.net.URL connection_url = new java.net.URL("http://:/path"); System.out.println("Instantiated new URL: " + connection_url); } catch (MalformedURLException e) { e.printStackTra...
<p>I have also had the same exception, but in my case the URL which I was trying to execute had a space appended. After removing the space it worked fine for me. Check that the URL does not have any trailing spaces in your case.</p>
8,457
<p>I'm writing some documentation in Markdown, and creating a separate file for each section of the doc. I would like to be able to convert all the files to HTML in one go, but I can't find anyone else who has tried the same thing. I'm on a Mac, so I would think a simple bash script should be able to handle it, but I...
<p>This is how you would do it in Bash. </p> <pre><code>for i in ./*.markdown; do perl markdown.pl --html4tags $i &gt; $i.html; done; </code></pre> <p>Of course, you need the <a href="http://daringfireball.net/projects/markdown/" rel="noreferrer">Markdown script</a>.</p>
<p>I use this in a .bat file:</p> <pre><code>@echo off for %i in (*.txt) python markdown.py "%i" </code></pre>
3,928
<p>Most sites are either fully released, or in beta.</p> <p>But what happens if you have a large site, and some of the parts are still in Beta, and other parts aren't. </p> <p>How do you effectively communicate this to the customer?</p>
<p>Maybe take a look at how Facebook, Bloglines, Gmail did it?</p> <p>Like "We have this beta thing going on, come on over and see the same site with new stuff, but if it doesnt work, use the old parts"</p> <p>Maybe gmail labs where you can sign up for "beta features"</p>
<p>If there's a certain way you enter the part of the beta site, maybe you can have a modal that pops up that they have to agree to every time. I wouldn't have it on every page since it gets annoying, so I would only use this approach if there is a definitive way to get into that part of the site (e.g. people won't be...
7,459
<p>I have a winforms app and i want to keep track of every time a user clicks certain buttons, etc as well as other actions. What is the best way for me to keep track of this information and then put it together so i can run metrics on most used features, etc.</p> <p>This is a winforms app and I have users around the...
<p>There are 2 big issues your design has to be sure to address</p> <ol> <li><p>Privacy (what Don alluded to) - You must be crystal clear what information you are collecting and sending up to your central server, ideally the users should be able to inspect the exact data you are sending back to the central server (if ...
<p>I'd try something like this:</p> <pre><code> // execute this method once all forms have been created public static void HookButtons() { foreach( Form f in Application.OpenForms ) { EnumerateControls( f.Controls ); } } public static void EnumerateControls(...
37,656
<p>I'm trying to find the best way to speed up the delivery of the static images that compose the design of an mvc site. The images are not gzipped, nor cached in the server or on the client (with content expire). Options are:</p> <ol> <li>Find why images are not cached and gzipped direcly from IIS6</li> <li>Write a ...
<p>Best solution is to let IIS do it.</p> <p><a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true" rel="nofollow noreferrer">IIS6 Compression</a> - most likely you need to <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServ...
<p>There's a nice library up on the MSDN Code Gallery that does this. It's called <a href="http://code.msdn.microsoft.com/fastmvc" rel="nofollow noreferrer">FastMVC</a>.</p>
3,777
<p>Sorry if this is a bit long whinded... consider this:</p> <p>I have a COM+ application in a namespace called <strong>Company</strong> that exposes an object called <strong>Server</strong> which has the following methods:</p> <pre><code>bool Server.Execute(IOptions options) IOptions Server.CreateOptions() </code><...
<p>I going to extrapolate some older experience with DCOM which may or may not be helpful. When you get access denied, you have to look at the DCOM configuration parameters on machine B.</p> <p>On older OS's (Windows 2000) you would run <strong>dcomcnfg</strong>. But in XP, you run Component Services from the Contro...
<p>Try looking at the COM server's remote activation permissions on the remote machine via dcomcnfg.exe (should open up MMC snapin).</p> <p>-Oisin</p>
42,490
<p>The Date object in JavaScript performs differently machine to machine and browser to browser in respect to the function's resolution in milliseconds. I've found most machines have a resolution of about 16 ms on IE, where Chrome or Firefox may have a resolution as good as 1ms.</p> <p>Is there another function avail...
<p>Since you are mentioning Internet Explorer, I assume that you are working on Windows. The 15 ms resolution you are getting may have to do with the Windows system timer resolution.</p> <p>I've also noticed through running Java programs on Windows, that the resolution of the system timer is around 16 ms or so. (Using...
<p>AFAIK, milliseconds is as good as it gets in JavaScript. Here is the <a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Date" rel="nofollow noreferrer">Mozilla.org documentation for the Date object</a>. Nothing in there indicates anything with finer resolution.</p>
15,920
<p>I have a large (700kb) Flex .swf file representing the main file of a site. </p> <p>For performance testing I wanted to try and move it off to Amazon S3 hosting (which i have already done with certain videos and large files). </p> <p>I went ahead and did that, and updated the html page to reference the remote .swf...
<p>Append a slash before your urls, this should load relative to the domain instead of the current folder:</p> <pre><code>foo.load('/like/this/image.jpg') </code></pre> <p>This is a bit quick and dirty, feeding a "relative" url via a querystring (<a href="https://stackoverflow.com/questions/219788/loading-flex-resour...
<p>You could try specifying the <code>base</code> parameter of your SWF's embed/object tags. In theory it defines the base path that will be used to resolve relative paths for loading, but I don't know if it will work if the <code>base</code> value points to a different server from where the SWF is.</p> <p>See the doc...
27,053
<p>What is the most efficient way to enumerate every cell in every sheet in a workbook?</p> <p>The method below seems to work reasonably for a workbook with ~130,000 cells. On my machine it took ~26 seconds to open the file and ~5 seconds to enumerate the cells . However I'm no Excel expert and wanted to validate this...
<p>Excel PIA Interop is really slow when you are doing things cell by cell.</p> <p>You should select the range you want to extract, like you did with the <code>Worksheet.UsedRange</code> property and then read the value of the whole range in one step, by invoking <code>get_Value()</code> (or just simply by reading the...
<p>I think, this is the most efficient way, how do it with PIA. Maybe will littlebit faster using "foreach" insted of "for", but it will not dramatic change.</p> <p>If is efficiency your primary goal, you should work with excel files directly - without excel application.</p>
32,675