instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I need to determine the ID of a form field from within an action handler. The field is a part of a included facelets component and so the form will vary.</p> <p><strong>included.xhtml</strong> </p> <pre><code>&lt;ui:component&gt; &lt;h:inputText id="contained_field"/&gt; &lt;h:commandButton actionListener="#{b...
<p>Bind the button to your backing bean, then use getParent() until you find the nearest form.</p>
<p>Programmatically I would use jsight's method. You can know the id of your elements (unless you let JSF create them, I don't know the means for numbering in the ids) by looking at it. h:form is a naming container so as long as you don't have it wrapped in another naming container it will be containingForm:contained...
14,971
<p>I have an application that was developed for Linux x86 32 bits. There are lots of floating-point operations and a lot of tests depending on the results. Now we are porting it to x86_64, but the test results are different in this architecture. We don't want to keep a separate set of results for each architecture.</p>...
<p>I'd say you need to fix your tests. You're generally setting yourself up for disappointment if you assume floating point math to be accurate. Instead of testing for <em>exact</em> equality, test whether it's close enough to the expected result. What you've found isn't a bug, after all, so if your tests report errors...
<p>SSE floating point and 387 floating point use entirely different instructions, and so there's no way to convince SSE fp instructions to use the 387. Probably the best way to deal with this is resign your test suite to getting slightly different results, and not depend on results being the same to the last bit.</p>
41,777
<p>I'm trying to be responsible with my "DOM" references in this little Flash 8/AS2 project.</p> <p>What has become increasingly frustrating is obtaining references to other movie clips and objects. For example, currently my code to access the submit button of a form looks something like this</p> <pre><code>var b:Bu...
<p>If the MovieClip was placed on the stage in the Flash IDE, you can give it a proper instance name in the properties panel.</p> <p>If it was dynamically added, you can also give it a name, and additionally store a reference:</p> <pre><code>var my_MC=createEmptyMovieClip("instanceName", depth); </code></pre> <p>In ...
<p>You could just write it yourself (code not tested but you get the idea):</p> <pre><code>MovieClip.prototype.getElementByName = function(name : String) : Object { var s : String; var mc : Movieclip = null; for( s in this ) { if( this[s] instanceof MovieClip ) { if( s == n...
33,373
<p>I'm trying to design some tables to store some data, which has to be converted to different languages later. Can anybody provide some "best practices" or guidelines for this?</p> <p>Thanks</p>
<p>Let's say you have a products table that looks like this:</p> <pre><code>Products ---------- id price Products_Translations ---------------------- product_id locale name description </code></pre> <p>Then you just join on product_id = product.id and where locale='en-US'</p> <p>of course this has an impact on perf...
<p>I beleve that more information on what you are doing would be helpful. CAn you give some samples of the data? And what do you mean by dynamic? That there will be lots of data inserted over time and lots of changes to the data or that the data only needs to be available for a small period of time.</p>
16,138
<p>I want to accomplish the following scenario in Drupal:</p> <p>You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons.</p> <p>Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be r...
<p>The <a href="http://drupal.org/project/popups_reference" rel="nofollow noreferrer">Popups: Add and Reference</a> module has recently been improved and I think it might do what you are looking to do.</p>
<p>I have looked into this, and it doesnt seem to be possible. I have looked at the reference_create module, and searched and posted stuff on drupal.org, and nobody have a nice solution.</p> <p>So what I just rebuilt the whole thing in Django in about 3 hours; so, tomorrow I will try to convince my employer to go the ...
48,215
<p>Is there a pretty printing function in Clojure that would output data-structures like lists and structs in a human-readable way?</p>
<p>clojure-contrib now has a pprint function. </p> <p>The API documentation is at <a href="http://richhickey.github.com/clojure-contrib/pprint-api.html" rel="noreferrer">http://richhickey.github.com/clojure-contrib/pprint-api.html</a></p>
<p>As the others have said, planned but incomplete. When clojure.contrib.pprint is moved into clojure itself, an update will be posted to its <a href="http://www.assembla.com/spaces/clojure/tickets/20" rel="nofollow noreferrer">ticket</a>.</p>
37,761
<p>I would like to add a simple Gantt chart to my development, was wondering if you could recommend any that seem good to you. I don’t need anything really flash (I’m not trying to reproduce MS Project) just need to plot a number of projects over a 24/7 timeframe. Would appreciate your comments</p>
<p><a href="http://www.aditus.nu/jpgraph/features.php" rel="nofollow noreferrer">JpGraph</a> rocks. And it has a Gantt chart module.</p>
<p>Hi there is a good control named jSGantt purely written in javascript ,CSS,HTML and can be integrated with any language There is good tutorial based on ASP.net languge here <a href="http://codeglobe.blogspot.com/2009/04/creating-gantt-chart-in-aspnet.html" rel="nofollow noreferrer">CodeGlobe</a></p> <p>Or you can l...
47,564
<p>I need to add a row to a spreadsheet using VBScript on a PC that does not have Microsoft Office installed.</p> <p>I tried [<code>Set objExcel = CreateObject("Excel.Application")</code>]</p> <p>Since Excel does not exist on the PC I cannot create this object.</p> <p>Is there a way to modify a spreadsheet without E...
<p>To use the code below, create an Excel workbook named "Test.xls" in the same folder as the vbscript file.</p> <p>In Test.xls, enter the following data in cells A1 thru B4:</p> <pre><code>First Last Joe Smith Mary Jones Sam Nelson </code></pre> <p>Paste the vbscript code below into a .vbs file:</p> <...
<p>I believe the simple answer to your question is no because you need the Excel COM object which is only installed when Excel is installed. This used to be one of the real drawbacks of writing an Office app--the need for the entire application (Excel, Word or whatever) in order for an end-user to use it.</p>
31,585
<p>Is it possible to select column data using the ordinal_position for a table column? I know using ordinal positions is a bad practice but for a one-off data import process I need to be able to use the ordinal position to get the column data.</p> <p>So for example </p> <pre><code>create table Test( Col1 int, ...
<p>You'd have to do something like </p> <pre><code>declare @col1 as varchar(128) declare @col2 as varchar(128) declare @sq1 as varchar(8000) select @col1 = column_name from information_schema.columns where table_name = 'tablename' and ordinal_position = @position select @col2 = column_name from information_schema.c...
<p>If you are using MS SQL 2005 you can use the ROW_NUMBER function.</p> <p>SELECT Col1, Col2, ROW_NUMBER() OVER(ORDER BY Col1) FROM Test WHERE ROW_NUMBER() Over(Order BY Col1) Between @Position AND @Position</p> <p>That should get you the desired results if I am reading the question correctly.</p>
48,112
<p>I know there is a function somewhere that will accept a client rect and it will convert it into a window rect for you. I just can't find / remember it!</p> <p>Does anyone know what it is?</p> <p>It will do something similar to:</p> <pre><code>const CRect client(0, 0, 200, 200); const CRect window = ClientRectToWi...
<p>You're probably thinking of <a href="http://msdn.microsoft.com/en-us/library/ms632667(VS.85).aspx" rel="noreferrer"><code>AdjustWindowRectEx()</code></a>. Keep in mind, this is intended for use when <em>creating</em> a window - there's no guarantee that it will produce an accurate set of window dimensions for an exi...
<p>Is this what you are looking for?</p> <p>ClientToScreen</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms532670(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms532670(VS.85).aspx</a></p>
16,976
<p>So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly:</p> <pre><code>from decimal import Decimal &gt;&...
<p>Changing the decimal working precision to 2 digits is <em>not</em> a good idea, unless you absolutely only are going to perform a single operation.</p> <p>You should always perform calculations at higher precision than the level of significance, and only round the final result. If you perform a long sequence of cal...
<p>If I undertand Decimal correctly, the "precision" is the number of digits after the decimal point in <em>decimal notation</em>.</p> <p>You seem to want something else: the number of significant digits. That is one more than the number of digits after the decimal point in <em>scientific notation</em>.</p> <p>I woul...
17,394
<p>In a Windows program, what is the canonical way to parse the command line obtained from GetCommandLine into multiple arguments, similar to the argv array in Unix? It seems that CommandLineToArgvW does this for a Unicode command line, but I can't find a non-Unicode equivalent. Should I be using Unicode or not? If ...
<p>Apparently you can use <a href="https://learn.microsoft.com/lt-lt/cpp/c-runtime-library/argc-argv-wargv?view=msvc-160" rel="nofollow noreferrer"><code>__argv</code></a> outside <code>main()</code> to access the pre-parsed argument vector...</p>
<p>The following is about the simplest way I can think of to obtain an old-fashioned argc/argv pair at the top of WinMain. Assuming that the command-line really was ANSI text, you don't actually need any conversions fancier than this.</p> <pre><code>int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPS...
37,167
<p>I am trying to find out how to use usercontrols in asp.net mvc. I know how to add a usercontrol to a view and how to pass data to it. What I haven't been able to figure out is how do you do this without having to retrieve and pass the data in every single controller?</p> <p>For example, if I have a user control t...
<p>There are multiple ways to do it. </p> <p>The basic approach is </p> <ul> <li>Populate the data for the view in the BaseController (OnActionExecuting event)</li> <li>Writing a custom action filter</li> <li>Writing an Application Controller (the eg. is in the below links).</li> </ul> <p>An example of OnActionExec...
<p>Refactor the code that obtains the view data for this user control into it's own method, maybe even it's own model (class). Call this method from each controller that needs to populate the control and pass the results in the ViewData with a well-known key. You might even want to pass the type of the current contro...
42,363
<p>I have a C++ program that when run, by default, displays the X in the upper right corner. Clicking X, minimizes the program. I've added code using the SHInitDialog function to change the X to OK, so that clicking OK exits the program.</p> <p>My question: Is there a better method that applies to the window, since SH...
<p>With Windows Mobile 5.0 and higher, using the CreateWindowEx function passing it WS_EX_CAPTIONOKBTN for the extended style works.</p> <p>@ctacke SHDoneButton may have also worked but I wanted to change the main window without handling it like a dialogbox, which is basically what SHInitDialog is doing.</p>
<p>Not sure how it's done in C++, but in .NET if you set the MinimizeBox property to false, you get an OK button. Since .NET Windows code is fancy wrapper code, there should be a C++ equivalent</p>
10,037
<p>In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g.</p> <pre><code>for ( int i=0; i &lt; vecVector.size(); i++ ) { .. } </code></pre> <p>Can anyone tell me why and in what cases I should use...
<p>Note that the usually implementation of vector won't use an &quot;int&quot; as the type of the index/size. So your code will at the very least provoke compiler warnings.</p> <h3>Genericity</h3> <p>Iterators increase the genericity of your code.</p> <p>For example:</p> <pre><code>typedef std::vector&lt;int&gt; Contai...
<p>Well, for one thing the above will no longer work if you turn that vector into a list.</p> <p>Iterators allow you to create function templates that don't need to know the type of container they work on. You can even do the following:</p> <pre><code>#include &lt;algorithm&gt; void printvalue(double s) { // Do ...
21,575
<p>Given a stylesheet with a fully qualified reference to an image resource on another server, is there a good way to handle promotions through different environments that require a different base URL?</p> <blockquote> <p>background-image: url (evironmentSpecificURL/resourceName.foo);</p> </blockquote> <p>The env...
<p>The resources that you reference should really be at a relative level to your css file, that way its just a "..\resourceName.foo" away from working.</p> <p>Of cource you could also look into build tools that auto-generate the environment specific areas of your site, so all properties such as css file, .properties f...
<p>My idea:</p> <p>Develop a handler/etc locally on the web application to pull in the image and handle the change in base URL in configuration files:</p> <blockquote> <p>background-image: url (localHandler.ashx(aspx)/resourceName.foo);</p> </blockquote> <p>Where the localHandler calls the destination resource a...
22,394
<p>I have a ListView which sometimes I need to put around 10000 items in. ListViews don't really handle this well, and they lock up for a couple of seconds while they sort the items and draw them. If you add the items in individually, it's even worse, locking up for nearly a minute.</p> <p>To get around this, I though...
<p>You need to use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.virtualmode.aspx" rel="nofollow noreferrer">VirtualMode</a>.</p>
<p>Well. If you just want to load the content in the background you could try a thread to populate the ListView, which will let the form load. </p> <p>I don't think you will get the pause if you put an Application.DoEvents(); when you are loading the items (which allows the form to redraw and receive events). </p> <p...
15,951
<p>Kind of a newbie question, but I am having problems using SNVKit. </p> <p>I am using SVNKit in an application to commit changes to files. I have it successfully adding the files and folders to the working copy, but I am having problems committing it to the respository.</p> <p>The command I am trying to run is 'com...
<p>If you have both a directory and its child added, but neither is not committed, I believe you get this message if you try to commit just the child. You need to commit the parent directory first.</p>
<p>It's not entirely clear because you've inconsistently replaced them, but it looks like you're getting repository paths/URLs confused with working copy paths. If you're adding or committing files, always use the working copy paths. Try playing around with the command-line svn before trying to use SVNKit.</p>
16,932
<p>Does anybody know if it is possible <strong>to choose the order of the fields</strong> in Dynamic Data (of course, without customizing the templates of each table) ?</p> <p>Thanks !</p>
<p>In .NET 4.0, using the 4.0 release of the Dynamic Data dll, you can set data annotations like so:</p> <pre><code>[Display(Name = " Mission Statement", Order = 30)] public object MissionStatement { get; set; } [Display(Name = "Last Mod", Order = 40)] public object DateModified { get; private set; } </code></pre>
<p>You can do this by modifying the order of the public properties in your LINQ to SQL file. </p> <p>For example, I went into Northwind.designer.cs which was my auto-generated LINQ to SQL file and moved the public property named Products above the public property CategoryName in the public partial class Category. Then...
41,668
<p>Is it possible to query the Crystal CMS database and get meaningful data back? The data appears to be encrypted.</p> <p>I am running Business Objects Crystal Report Server version 11.5</p>
<p>Actually what I discovered I needed to do was use the administration tools available from the Administration Launchpad. I was not responsible for installing Crystal and did not even realise this existed. The query builder and also the "Report Datasources" feature that were available from here was exactly what I ne...
<p>My experience is that the data is not encrypted but that it is not really readable. Your best option is to use the Auditor Universes to build you some reports. You can also check out the SQL that the auditor Universes are uses as a baseline for constructing additional reporting.</p>
9,471
<p>I'm looking for a container that keeps all its items in order. I looked at SortedList, but that requires a separate key, and does not allow duplicate keys. I could also just use an unsorted container and explicitly sort it after each insert.</p> <p>Usage:</p> <ul> <li>Occasional insert</li> <li>Frequent traversa...
<p>You might want to take a look at the <a href="http://www.codeplex.com/PowerCollections" rel="noreferrer">Wintellect Power Collections</a>. It is available on CodePlex and contains quite a few collections that are very helpful. The OrderedBag collection in the project is exactly what you are looking for. It essent...
<p>If the key is also an attribute of the object, you might try the <code>System.Collections.ObjectModel.KeyedCollection&lt;TKey, TItem></code>. It's an abstract class, but if your key is just a property of the item then it's real simple to derive from.</p>
23,874
<p>Is there a down side? I feel almost dependent on it now. Whenever a project gets past a certain size almost feel an allergic reaction to standard patterns and immediately re-wire it with a Dependency Injection framework.</p> <p>The largest issue I've found is it can be confusing for other developers who are just le...
<p>I've taken a stab at describing some of the possible downsides in a blog post here: <a href="http://kevin-berridge.blogspot.com/2008/06/ioc-and-di-complexity.html" rel="noreferrer">http://kevin-berridge.blogspot.com/2008/06/ioc-and-di-complexity.html</a></p>
<p>@Blorgbeard: <a href="http://www.martinfowler.com/articles/injection.html" rel="nofollow noreferrer">http://www.martinfowler.com/articles/injection.html</a> is probably one of the best articles on the subject</p>
6,426
<p>I'm trying to figure out a way to add a self-update feature to a Java/Swing application I'm working on.</p> <p>Basically I've got a bunch of jar files with extra functionality to be re-deployed to the installed users when they change. Nothing complicated, just check if a new version has been released, download them...
<p>I did the exact same thing. But that was long back so there are probably better tools today.</p> <p>What I found out I needed was a loader. The loader main program did not have the app jars in classpath. It first downloaded an update if required and then created a custom classloader with the app jars in class path ...
<p>I believe you should look again at Java WebStart, or at least detail the "funky classloading" which you think is going to cause problems (as it might also cause problems with any solution proposed here).</p> <p>IIRC, you can set command line parameters using Java WebStart ( <a href="http://java.sun.com/j2se/1.5.0/d...
25,433
<p>I need debug some old code that uses a Hashtable to store response from various threads.</p> <p>I need a way to go through the entire Hashtable and print out both keys and the data in the Hastable.</p> <p>How can this be done?</p>
<pre><code>foreach(string key in hashTable.Keys) { Console.WriteLine(String.Format("{0}: {1}", key, hashTable[key])); } </code></pre>
<p>This should work for pretty much every version of the framework...</p> <pre><code>foreach (string HashKey in TargetHash.Keys) { Console.WriteLine("Key: " + HashKey + " Value: " + TargetHash[HashKey]); } </code></pre> <p>The trick is that you can get a list/collection of the keys (or the values) of a given hash ...
5,525
<p><a href="http://www.w3.org/TR/REC-html40/interact/scripts.html" rel="noreferrer"><strong>According to spec</strong></a>, only the <code>BODY</code> and <code>FRAMESET</code> elements provide an "onload" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in J...
<p>UPDATE: For anyone interested in it, here is the implementation I finally used:</p> <pre><code>function isInDOMTree(node) { // If the farthest-back ancestor of our node has a "body" // property (that node would be the document itself), // we assume it is in the page's DOM tree. return !!(findUltimateAn...
<p>Neither of <strong>DOMNodeInserted</strong> or <strong>DOMNodeInsertedIntoDocument</strong> events is supported in IE. Another missing from IE [only] feature of DOM is <strong>compareDocumentPosition</strong> function that is designed to do what its name suggests. </p> <p>As for the suggested solution, I think ther...
27,111
<p>In my web app, I submit some form fields with jQuery's <code>$.getJSON()</code> method. I am having some problems with the encoding. The character-set of my app is <code>charset=ISO-8859-1</code>, but I think these fields are submitted with <code>UTF-8</code>. </p> <p>How I can set encoding used in <code>$.getJSON<...
<p>I think that you'll probably have to use <a href="http://docs.jquery.com/Ajax/jQuery.ajax#options" rel="noreferrer"><code>$.ajax()</code></a> if you want to change the encoding, see the <code>contentType</code> param below (the <code>success</code> and <code>error</code> callbacks assume you have <code>&lt;div id="s...
<p>Use this function to regain the utf-8 characters</p> <pre><code>function decode_utf8(s) { return decodeURIComponent(escape(s)); } </code></pre> <p>Example: var new_Str=decode_utf8(str);</p>
4,617
<p>I'm using the ProgressBar control in a WPF application and I'm getting this old, Windows 3.1 Progress<em>Blocks</em> thing. In VB6, there was a property to show a <em>smooth</em> ProgressBar. Is there such a thing for WPF?</p>
<p><a href="http://support.microsoft.com/kb/323116" rel="nofollow noreferrer">This</a> KB article seems to explain what you are looking for... there is a link to a VB version of the article too.</p>
<p>I am not sure what you want to do. If you simply want a progress bar that "sweeps" from side to side like on starting Vista you could use: IsIndetermined = true.</p> <p>If you actually want to go from 0% to 100% you have to either animate over the value as shown in this example on msdn: <a href="http://msdn.microso...
10,808
<p>I am not familiar with this website but I am desperately seeking help with the website I am building. I'm sorry if I'm not in the right place or asking my question incorrectly, so please tell me if I do something wrong!</p> <p>I have built a simple website, consisting of four pages (index.html plus three others). I...
<p>Why don't you put the sidebar div into the page div?</p>
<p>You currently have: </p> <pre><code>&lt;div id=page&gt; &lt;div id=content&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id=sidebar&gt;&lt;/div&gt; </code></pre> <p>I think:</p> <pre><code>&lt;div id=page&gt; &lt;div id=sidebar&gt;&lt;/div&gt; &lt;div id=content&gt;&lt;/div&gt; &lt;/div&gt; </code></p...
40,521
<p>What is the best way to sync up two lists each of which may contain items not in the other? As shown the lists are not sorted - although if necessary sorting them first would not be an issue.</p> <pre><code>List 1 = a,b,c,e List 2 = b,e,c,d </code></pre> <p>Using the lists above, I'm looking for a solution that w...
<p>Here are some notes on using a disconnected recordset.</p> <pre><code>Const adVarChar = 200 'the SQL datatype is varchar 'Create arrays fron the lists asL1 = Split("a,b,c,", ",") asL2 = Split("b,e,c,d", ",") 'Create a disconnected recordset Set rs = CreateObject("ADODB.RECORDSET") rs.Fields.append "Srt", adVarCh...
<p>Another option is Collections. This doesn't sort the output alphabetically, but you can sort the lists first if you need to. Note this will also give you a unique list,stripping out duplicates. The code assumes your lists are in string arrays L1 and L2.</p> <pre><code>Dim C As New Collection,i As Long, j As Long Re...
28,080
<p>I keep seeing the phrase "duck typing" bandied about, and even ran across a code example or two. I am way too <strike>lazy</strike> busy to do my own research, can someone tell me, briefly:</p> <ul> <li>the difference between a 'duck type' and an old-skool 'variant type', and </li> <li>provide an example of where I...
<p>The simple answer is variant is weakly typed while duck typing is strongly typed. </p> <p>Duck typing can be summed up nicely as "if it walks like a duck, looks like a duck, acts like a duck, then it's a duck." It computer science terms consider duck to be the following interface.</p> <pre><code>interface IDuck ...
<p>Everything you can do with duck-typing you can also do with interfaces. Duck-typing is fast and comfortable, but some argue it can lead to errors (if two distinct methods/properties are named alike). Interfaces are safe and explicit, but people might say "why state the obvious?". Rest is a flame. Everyone chooses wh...
36,818
<p>The following works in Firefox, but breaks in IE7 &amp; 8:</p> <pre><code>$("#my-first-div, #my-second-div").hide(); </code></pre> <p>so I have to do this:</p> <pre><code>$("#my-first-div").hide(); $("#my-second-div").hide(); </code></pre> <p>Is this normal?</p> <p>EDIT: ok, my actual real-life code is this:</...
<p>The location you specify states:</p> <pre><code>Message: 'nodeName' is null or not an object Line: 19 Char: 150 Code: 0 URI: http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js </code></pre> <p>That particular piece of jquery is:</p> <pre><code>nodeName:function(elem,name){ return elem.nod...
<p>Have you tried it without a space after the comma? <a href="http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN" rel="nofollow noreferrer">The examples given in the specification have no space.</a></p>
22,620
<p>Things like <code>$log$</code> and <code>$version$</code> which add data upon check-in to the file. I'm interested in seeing the other ones and what information they can provide, but I can't get much info unless I know what they are called.</p>
<p>Both Subversion and CVS call them <code>Keywords</code>.</p> <p><a href="http://svnbook.red-bean.com/en/1.0/ch07s02.html#svn-ch-7-sect-2.3" rel="nofollow noreferrer">Have a look in the SVN manual here</a> (scroll down to <strong>svn:keywords</strong>) or <a href="http://badgertronics.com/writings/cvs/keywords.html"...
<p>These are Keyword substitutions. The link to SVNBook 1.8 is here: <a href="http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.keywords.html" rel="nofollow noreferrer" title="Subversion Keywords">http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.keywords.html</a>.</p> <p>Subversion's built-in ...
6,092
<p>In firefox, the error messages display as should. Just to the right of the element being validated. In IE. No matter what I do with the sizing of the labels/elements/errors, the error is always posted below the element, causing every other element to be pushed down.</p> <pre><code>&lt;p&gt; &lt;label for="han...
<p>One approach for Oracle:</p> <pre><code>SELECT val FROM myTable UNION ALL SELECT 'DEFAULT' FROM dual WHERE NOT EXISTS (SELECT * FROM myTable) </code></pre> <p>Or alternatively in Oracle:</p> <pre><code>SELECT NVL(MIN(val), 'DEFAULT') FROM myTable </code></pre> <p>Or alternatively in SqlServer:</p> <pre><code>SE...
<p>Insert your default values into a table variable, then update this tableVar's single row with a match from your actual table. If a row is found, tableVar will be updated; if not, the default value remains. Return the table variable.</p> <pre><code> ---=== The table &amp; its data CREATE TABLE dbo.Rates ( ...
36,280
<p>Emacs puts backup files named <code>foo~</code> everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points to the backup when I'm done editing, and that's confusing and awful. How can I either eliminate these ba...
<p>If you've ever been saved by an Emacs backup file, you probably want more of them, not less of them. It is annoying that they go in the same directory as the file you're editing, but that is easy to change. You can make all backup files go into a directory by putting something like the following in your <code>.ema...
<p><code>(setq delete-auto-save-files t)</code></p> <p>deletes buffer's auto save file when it is saved or when killed with no changes in it. thus you still get some of the safety of auto save files, since they are only left around when a buffer is killed with unsaved changes or if emacs exits unexpectedly. if you want...
18,316
<p>Has anybody seen such a thing? Small self-sufficient modules are preferred.</p>
<p>The <a href="http://docs.python.org/library/fractions.html" rel="nofollow noreferrer">fractions module</a> from 2.6 can be ripped out if necessary. Grab fractions.py, numbers.py, and abc.py; all pure python modules. </p> <p>You can get the single files from here (2.6 branch, 2.7 does not work): <a href="http://h...
<p>One more thing to try is <a href="http://svn.python.org/view/python/branches/release25-maint/Demo/classes/Rat.py?rev=51333&amp;view=markup" rel="nofollow noreferrer">Rat.py</a> from demo folder in Python 2.5 maintenance branch. If i understand correctly, it is the daddy of 2.6 <code>fractions</code>. It's a single m...
42,674
<p>I have a structure in C#:</p> <pre><code>public struct UserInfo { public string str1 { get; set; } public string str2 { get; set; } } </code></pre> <p>The only rule is that <code>UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA"))</code></p> <p>How to o...
<p><a href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" rel="noreferrer">MSDN</a>:</p> <p>A hash function must have the following properties:</p> <blockquote> <ul> <li>If two objects compare as equal, the <code>GetHashCode</code> method for each object must return the same value. Howev...
<p>Too complicated, and forgets nulls, etc. This is used for things like bucketing, so you can get away with something like</p> <pre><code>if (null != str1) { return str1.GetHashCode(); } if (null != str2) { return str2.GetHashCode(); } //Not sure what you would put here, some constant value will do return 0;...
9,566
<p>Is it possible to replace the standard broken image via CSS or using another technique? All my images are the same size and my have transparency.</p> <p>I've tried to wrap all images with a div's background:</p> <pre><code>&lt;div class="no_broken"&gt; &lt;img src="http://www.web.com/found.gif"/&gt; &lt;/div&gt;...
<p>This works without CSS:</p> <pre><code>&lt;img src="some.jpg" onerror="this.src='alternative.jpg';"&gt; </code></pre> <p>It seems to even work when Javascript is disabled.</p>
<p>As far as I know, there is no CSS property that controls the display of broken images. Maybe there are browser-specific properties? You may have to resort to Javascript to iterate the images on the page, and replace their src if they are broken.</p>
32,726
<p>I have been using Ruby for a while now and I find, for bigger projects, it can take up a fair amount of memory. What are some best practices for reducing memory usage in Ruby?</p> <ul> <li>Please, let each answer have one "best practice" and let the community vote it up.</li> </ul>
<p>Don't abuse symbols.</p> <p>Each time you create a symbol, ruby puts an entry in it's symbol table. The symbol table is a global hash which <em>never</em> gets emptied.<br> This is not technically a memory leak, but it behaves like one. Symbols don't take up much memory so you don't need to be too paranoid, but it ...
<p><strong>Measure and detect which parts of your code are creating objects that cause memory usage to go up</strong>. Improve and modify your code then measure again. Sometimes, you're using gems or libraries that use up a lot of memory and creating a lot of objects as well.</p> <p>There are many tools out there such...
21,895
<p>A .net desktop application will send information to a central server, there will be potentially thousands and thousands of deskop apps sending info to my server(s).</p> <p>The data will be small in size.</p> <p>Would .net web services be good for this scenerio or would WCF be better suited?</p> <p>What are the pr...
<p>the possibilities for throttling, concurrency, etc. are far more developed within wcf. its a little bit more work in the beginning, but i guess that it's better suited for scenarios where you need to have full control over your bindings.</p>
<p>ASMX is like remoting, it's still around because it shipped with 1.0, but you shouldn't use it anymore if you are starting a new project. WCF will give you many more features and better tooling support.</p>
25,581
<p>The Python list comprehension syntax makes it easy to filter values within a comprehension. For example:</p> <pre><code>result = [x**2 for x in mylist if type(x) is int] </code></pre> <p>Will return a list of the squares of integers in mylist. However, what if the test involves some (costly) computation and you ...
<p>If the calculations are already nicely bundled into functions, how about using <code>filter</code> and <code>map</code>?</p> <pre><code>result = filter (None, map (expensive, mylist)) </code></pre> <p>You can use <code>itertools.imap</code> if the list is very large.</p>
<p>There is the plain old use of a <code>for</code> loop to append to a list, too:</p> <pre><code>result = [] for x in mylist: expense = expensive(x) if expense: result.append(expense) </code></pre>
15,817
<p>Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. </p>
<p>Ok, I found some free time finally.<br> Here we go: </p> <pre><code>class TreeNode { public string Value { get; set;} public List&lt;TreeNode&gt; Nodes { get; set;} public TreeNode() { Nodes = new List&lt;TreeNode&gt;(); } } Action&lt;TreeNode&gt; traverse = null; traverse = (n) =&g...
<p>Assuming a mythical object TreeItem, that conatins a Children collection to represent your hierarchy.</p> <pre><code> public void HandleTreeItems(Action&lt;TreeItem&gt; item, TreeItem parent) { if (parent.Children.Count &gt; 0) { foreach (TreeItem ti in parent.Children) ...
8,625
<p>Is there anyway to have items in an ASP.NET DropDownList have either their Text or Value bound to a method on the source rather than a property? </p>
<p>This is my solution:</p> <pre><code>&lt;asp:DropDownList ID="dropDownList" runat="server" DataSourceID="dataSource" DataValueField="DataValueField" DataTextField="DataTextField" /&gt; &lt;asp:ObjectDataSource ID="dataSource" runat="server" SelectMethod="SelectForDataSource" TypeName="CategoryDao" /&gt; public IEnu...
<p>Declaratively:</p> <pre><code>&lt;asp:DropDownList ID="ddlType" runat="server" Width="250px" AppendDataBoundItems="true" DataSourceID="dsTypeList" DataTextField="Description" DataValueField="ID"&gt; &lt;asp:ListItem Value="0"&gt;All Categories&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;&lt;br /&gt; &lt;asp:O...
16,314
<p>What is the best approach in stripping leading and trailing spaces in C?</p>
<p>Here is how linux kernel does the trimming, called strstrip():</p> <pre><code>char *strstrip(char *s) { size_t size; char *end; size = strlen(s); if (!size) return s; end = s + size - 1; while (end &gt;= s &amp;&amp; isspace(*end)) end--; *(end + 1) = '\0'; while ...
<pre><code>int i = strlen(s) - 1; while (isspace(s[i])) s[i--] = '\0'; while (isspace(*s)) s++; </code></pre> <p>That should take care of the problem as long as you don't care about mangling up the string like crazy and if you don't care about memory leaks!</p>
45,844
<p>On the UNIX bash shell (specifically Mac OS X Leopard) what would be the simplest way to copy every file having a specific extension from a folder hierarchy (including subdirectories) to the same destination folder (without subfolders)?</p> <p>Obviously there is the problem of having duplicates in the source hierar...
<p>In bash:</p> <pre><code>find /foo -iname '*.txt' -exec cp \{\} /dest/ \; </code></pre> <p><code>find</code> will find all the files under the path <code>/foo</code> matching the wildcard <code>*.txt</code>, case insensitively (That's what <code>-iname</code> means). For each file, <code>find</code> will execute <c...
<p>As far as the man page for cp on a FreeBSD box goes, there's no need for a -t switch. cp will assume the last argument on the command line to be the target directory if more than two names are passed.</p>
4,726
<p>I've just come across a property setter that catches exceptions (all Exceptions; I know that's bad, but it's not relevant here), and <em>only</em> logs them. First of all, I think it should through them again as well; why wait for a crash and a log study when you can know something is wrong right away?</p> <p>Howe...
<p>Exceptions should be thrown whenever the method or class member is unable to complete whatever task it is designed to accomplish.</p> <p>So for a property setter, if the setter is unable to set the property, then it should throw an exception. </p> <p>As to whether you should catch it and rethrow it, the answer is...
<p>Catching and rethrowing is the worst thing to do. Its expensive to TRY, if youre just going to rethrow what the point? You can <a href="http://www.west-wind.com/WebLog/posts/1393.aspx" rel="nofollow noreferrer">catch unhandled exceptions with the global.asax</a> for example if you need to log them.</p> <p>In terms ...
33,707
<p>We have a number of Excel-based membership rosters for a non-profit organization and we need to merge these into one master MS Access table. From time to time, we receive updated copies of the Excel-based membership rosters and I need to synchronize these with the master MS Access table.</p> <p>I'm looking for the...
<p>You haven't said how big the membership lists are.</p> <p>If they aren't too massive, and if you aren't doing anything too complex, then simply linking the Excel files to the Access database would allow you to replace the Excel files with new ones (with the same names) and then the database would use the new data a...
<p>Typically, what I've done in the past was import the excel file into a staging table, and then pruned out duplicated, and then copied the resulting list into the master table.</p> <p>You might have to cull ex-members from the your master table, in which case, maybe it's easier to delete all the members that came fr...
34,691
<p>I have done a little Django development, but it has all been in a text editor. I was curious what more advanced development tools others are using in their Django development.</p> <p>I am used to using Visual Studio for development and really like the <a href="https://en.wikipedia.org/wiki/Intelligent_code_completi...
<p>I use Eclipse and a plain vanilla <a href="https://en.wikipedia.org/wiki/PyDev" rel="nofollow noreferrer">PyDev</a>. There isn't any specific Django functionality. The best I came up with was setting up a run profile to run the development web server.</p> <p>If you add the web tools project (WTP), you'll get syntax ...
<p>I have consistently used Vim or Kate, but I would prefer a full-blown IDE. Given it is not as heavy as Visual Studio.</p>
21,103
<p>If the C++ runtime msvcr80.dll is missing from a compiled library, is there any way to determine which version was used to create the library or to get it to run on a later version of msvcr80.dll?</p>
<p>The VC80 SP1 CRT redistributable package will install both the RTM and SP1 versions of the C runtime into <code>%SystemRoot%\WinSxS</code> (assuming you're using Windows XP or Vista; Windows 2000 doesn't support side-by-side assemblies). If you have VC8 installed, the CRT redistributable package is in <code>%Program...
<p>If you're authoring and distributing the mentioned DLL, consider using a merge module for Visual C++ 8.0 CRT as part of your installer.</p> <p>I noticed that there is a new mt.exe tool and new Visual C++ CRT in Windows SDK 6.1. I use the merge module as a prerequisite in the InstallShield 12 installer with great s...
26,706
<p>Does the SDK provide any way to change the brightness of the backlight, or turn it off temporarily? </p>
<p>I'm trying to do the same thing. As it happens there are a number posts out there in the internets with "solutions" for this.</p> <p>The most detailed is <a href="http://idevkit.com/forums/tutorials-code-samples-toolchain/14-controlling-brightness.html?t-14.html=" rel="nofollow noreferrer">here</a> This one is more...
<pre><code>-(void)changeLight{ GSEventSetBacklightLevel(float number);//number between 0.0 - 1.0 } </code></pre> <p>call the above method using </p> <pre><code>[self performSelector:@selector(changeLight) withObject:nil afterDelay:0.0]; </code></pre> <p>you can add the private framework by just drag and drop t...
47,886
<p>I need to copy an entire database from a SQL Server 2005 on my server over to my local SQL Express in order to run my application for a presentation. What is the fastest/easiest way to get this done?</p> <p>EDIT: I have very limited access to my server so I don't think I can access the backup file that I could cr...
<p>If the database is not too big, you could use the Database Publishing Wizard.</p> <p>This is a free tool from Microsoft which creates a complete SQL script of a database for you (not only the tables and stuff, but all data as well).</p> <p>You can install the tool on your machine, connect to a remote server and le...
<p>If you can login to both servers (the Express and the 05 Server) using SQL Server Management Studio then you can do a DB Restore from one database to the other. No need for backup files at all.</p>
30,178
<p>in a web application I am building I need to upload photos without using a form, otherwise it will come up with form embedded in an outer from which is not permitted in XHTML.</p> <p>I think uploading files is what jQuery.post should be able to do, but I currently can't figure out how to do this using jQuery.</p>
<p>take a look at <a href="http://swfupload.org/" rel="nofollow noreferrer">swfupload</a>, it's a pretty nifty little app that should accomplish what you want. otherwise, you could separate out the forms, and just use css/javascript to reposition them if necessary.</p>
<p>Have you check out the fieldset element? Why not wrap your input elements in that, then use jQuery to dynamically assign 'submit' functionality, as opposed to trying to attach it to the overall form element?</p>
23,556
<p>In my database, in one of the table I have a GUID column with allow nulls. I have a method with a Guid? parameter that inserts a new data row in the table. However when I say myNewRow.myGuidColumn = myGuid I get the following error: "Cannot implicitly convert type 'System.Guid?' to 'System.Guid'." </p>
<p>The ADO.NET API has some problems when it comes to handling nullable value types (i.e. it simply doesn't work correctly). We've had no end of issues with it, and so have arrived at the conclusion that it's best to manually set the value to null, e.g.</p> <pre><code>myNewRow.myGuidColumn = myGuid == null ? (object)D...
<pre><code>Guid? _field = null; if (myValue!="")//test if myValue has value { _field = Guid.Parse(myValue) } </code></pre>
25,980
<p>As part of a project at work I have to calculate the centroid of a set of points in 3D space. Right now I'm doing it in a way that seems simple but naive -- by taking the average of each set of points, as in:</p> <pre><code>centroid = average(x), average(y), average(z) </code></pre> <p>where <code>x</code>, <code>...
<p>Contrary to the common refrain here, there are different ways to define (and calculate) a center of a point cloud. The first and most common solution has been suggested by you already and I will <strong>not</strong> argue that there is anything wrong with this:</p> <p><code>centroid = average(x), average(y), averag...
<p>You got it. What you are calculating is the centroid, or the mean vector.</p>
10,336
<p>I have built a RepRap Prusa i2 a while back. It worked for a while, but then I moved the printer from place to place and after a while I noticed that the printer's bed is not heating anymore. The thermistor shows the temperature (room temperature), but the bed is not heating. The wires are connected and the heated ...
<h1>diagnosing a heated bed</h1> <p>Switch the hot end and the heater bed wires on the board. See if there is a difference. (Note that it will not reach a thermal limit when plugged in this way! So don't leave it on too long!)</p> <p>After that, if you see that your heat increases with the hot end's wires and the hot e...
<p>It's probably a fuse or the MOSFET fried? Try checking for continuity on the fuse and voltage on the MOSFET.</p>
386
<p>I'm working on several distinct but related projects in different programming languages. Some of these projects need to parse filenames written by other projects, and expect a certain filename pattern.</p> <p>This pattern is now hardcoded in several places and in several languages, making it a maintenance bomb. It ...
<p>Creating a Domain Specific Language, then compile that into the code for each of the target languages that you are using would be the best solution (and most elegant). </p> <p>Its not difficult to make a DSL - wither embed it in something (like inside Ruby since its the 'in' thing right now, or another language lik...
<p>Put the pattern in a database - the easiest and comfortable way could be using XML database. This database will be accessible by all the projects and they will read the pattern from there</p>
13,880
<p>Does anyone know of a method to determine when a file copy completes in VBScript? I'm using the following to copy:</p> <pre><code>set sa = CreateObject("Shell.Application") set zip = sa.NameSpace(saveFile) set Fol = sa.NameSpace(folderToZip) zip.copyHere (Fol.items) </code></pre>
<pre><code>Do Until zip.Items.Count = Fol.Items.Count WScript.Sleep 300 Loop </code></pre> <p>When the loop finishes your copy is finished.</p> <p>But if you only want to copy and not zip, FSO or WMI is better.</p> <p>If you are zipping and want them in a file you have to create the zip-file yourself, with the r...
<pre><code>Const FOF_CREATEPROGRESSDLG = &amp;H0&amp; Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set fso = CreateObject("Scripting.FileSystemObject") strSource = " " ' Source folder path of log files strTarget = " .zip" ' backup path where file will be created AddFilesToZip strSource,strTarget Function ...
18,068
<p>When I try to create a a new snapshot in SQL Server Reporting Services 2005, i get the message: "report history may not be created because the credentials used to run the report are not stored, the report is using user-defined parameter values, default report parameter values are missing, or if a linked report, the ...
<p>setting a data source to use "credentials stored securely in the report server" is required when you want to use Reporting Services features like Subscriptions and Report Snapshots. You only have to do this on the data sources, so assuming you have not created a new data source for each and every report (and they ar...
<p>Agree with everything Nathan said. Make sure the credentials you use have at least dbdatareader access to the reportserver, reportservertemp, and any other db's you use.</p>
48,096
<p>I was wondering, what's the best approach in creating users authentication for my asp.net-mvc web application.</p> <p>Should I use the Forms authentication using a custom MembershipProvider ? Or should I implement my own login and registration mechanism for my users? </p>
<p>Seems silly to reinvent the wheel if you don't have a pressing business need to do so. I'd go with forms authentication with a custom provider (if necessary)</p>
<p>Unless you have some special needs, its always best to use the out-of-the-box solution. So perhaps you should describe what considerations makes you consider rolling your own? (And add that information to the original question - this will help people provide useful answers).</p>
23,576
<p>I'm using a large open-source control and I can't seem to find the code that handles a double-click event. Could I perhaps have the debugger break when a double-click occurs or otherwise learn what code is associated with that event?</p>
<p>It's not cp, it's tar. You are passing it -v, which makes it print the names of the files.</p>
<p>As others pointed out, the -v (verbose) option to tar is kicking out the file names to STDERR. You can also make your script more efficient by having tar write the compressed file stream to STDOUT:</p> <pre><code>tar zcf - file1 file2 file3 </code></pre> <p>In this example, the "-" option passed as the filename m...
34,065
<p>I have a large xml document that needs to be processed 100 records at a time</p> <p>It is being done within a Windows Service written in c#. </p> <p>The structure is as follows :</p> <pre><code>&lt;docket xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="docket.xsd"&gt; &lt;...
<p>Another naive solution; this time for .NET 2.0. It should give you an idea of how to go about what you want. Uses Xpath expressions instead of Linq to XML. Chunks a 100 order docket into 10 dockets in under a second on my devbox.</p> <pre><code> public List&lt;XmlDocument&gt; ChunkDocket(XmlDocument docket, int chu...
<p>If the reason to process 100 orders at a time is for performance purposes, e.g. taking too much time and resource to open a big file, You can utilize XmlReader to process order element one at a time without degrading the performance.</p> <pre><code>XmlReader reader = XmlReader.Create(@"c:\foo\Doket.xml") while( rea...
30,983
<p>I'm trying to export a Crystal Report to an HTML file, but when I call the Export method, I immediately get this error:</p> <blockquote> <p><strong>Source</strong>: Crystal Reports ActiveX Designer </p> <p><strong>Description</strong>: Failed to export the report.</p> </blockquote> <p>I have tried both crEF...
<p>I'm not sure what you have in the <code>[...]</code> section but your code should include a call to open the report with an instance of the CRAXDRT Application.</p> <pre><code>Dim objCRReport As CRAXDRT.Report '*********************************** Dim objCRApp As New CRAXDRT.Application objCRReport = objCRApp.Open...
<p>Try setting the <code>HTMLFileName</code> option instead:</p> <pre><code>objCRReport.ExportOptions.HTMLFileName = "C:\reportInHtmlFormat.html" </code></pre>
31,208
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2213205/configure-eclipse-to-use-vs-net-shortcuts">Configure Eclipse to use VS.Net shortcuts?</a> </p> </blockquote> <p>I mostly work in VS2008 but I need to do some java work in Eclipse. Is there an easy and f...
<p>How are the Eclipse settings saved? Perhaps you could simply adapt <a href="http://xona.com/2005/08/02.html" rel="nofollow noreferrer">this macro</a> and load the resulting file into Eclipse?</p>
<p>Doesn't Eclipse have a predefined keyboard setup for Visual Studio?</p>
3,740
<p>I have an application installed on my computer. How do I find out if it was compiled in DEBUG mode or not?</p> <p>I've tried to use <a href="http://en.wikipedia.org/wiki/.NET_Reflector" rel="noreferrer">.NET Reflector</a>, but it does not show anything specific. Here is what I see:</p> <pre><code>// Assembly APPLI...
<p>I <a href="http://chillijam.co.uk/?p=134" rel="noreferrer">blogged</a> this a long time ago, and I don't know if it still valid or not, but the code is something like...</p> <pre><code>private void testfile(string file) { if(isAssemblyDebugBuild(file)) { MessageBox.Show(String.Format("{0} seems to b...
<p>How about using Jeff Key's <a href="http://www.sliver.com/dotnet/IsDebug/" rel="nofollow noreferrer">IsDebug</a> utility? It is a little dated, but since you have Reflector you can decompile it and recompile it in any version of the framework. I did.</p>
23,649
<p>Can it be done or the only way is to configure it on IIS?</p>
<p>You edit generally the Global.asax file's Session_Start method and set <a href="http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout.aspx" rel="noreferrer">Session.TimeOut</a> to whatever you want. You can do this anywhere else in your code too.</p>
<p>If your in a hosted environment and your not allowed to override IIS default session timeout (as others have mentioned in the comments), you can trick IIS into keeping the session alive for longer by using an iframe that refreshes the session over and over (kind of like a keep alive ping) for whatever interval of ti...
29,097
<p>With the XML below, I would like to know how to get the value of text in the case_id node as an attribute for the hidden input tag in the xsl sheet below. Is this possible?</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;?xml-stylesheet type="text/xsl" href="data.xsl"?&gt; &lt;NewDataSet&gt; &lt;Cas...
<p>Just change your XSLT to this, this assumes that you do only have 1 case_id, otherwise, you will need to go with a more specific template match, and remove some of the path in the XPATH value I used as an example.</p> <pre><code>&lt;input type="hidden" name="case-num"&gt; &lt;xsl:attribute name="value"&gt; ...
<p>I changed it to:</p> <pre><code>&lt;input type="hidden" name="case-num"&gt; &lt;xsl:attribute name="value"&gt; &lt;xsl:value-of select="case_id" /&gt; &lt;/xsl:attribute&gt; &lt;/input&gt; </code></pre> <p>as it's in a foreach loop. Thanks guys, that worked a treat!</p>
43,350
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyversionattribute.aspx" rel="nofollow noreferrer">AssemblyVersion</a> and <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyfileversionattribute.aspx" rel="nofollow noreferrer">AssemblyFileVersion</a> attributes ar...
<p>On my current project, we use the Subversion revision number as the least significant (build) part of the version number, and we use a Nant script to create the project AssemblyInfo file. We use the same version number for both the AssemblyVersion and AssemblyFileVersion attributes. (The other three parts are majo...
<p>The AssemblyVersionAttribute is part of an assembly's identity. Changing that means it is a different assembly and programs linking to that assembly need to be recompiled/linked or a version policy need to be applied. We didn't find that apealing so we choose to only increase the AssemblyFileVersion for each hotfix ...
21,133
<p>I have let's say 2 (but they'll become more in the future) fully decoupled systems: system A and system B.</p> <p>Let's say every piece of information on each system has an informationID. There's nothing stopping the informationID to be the same on different systems. What univocally identifies a piece of informatio...
<p>This problem has been addressed by EAI (Enterprise Application Integration) vendors like <a href="http://tibco.com/" rel="nofollow noreferrer">Tibco</a> and <a href="http://www.softwareag.com/Corporate/products/wm/default.asp" rel="nofollow noreferrer">webMethods</a> (now part of Software AG). I've never used Tibco...
<p>Unless there is some specific limitation in the system design preventing this, I'd suggest factoring out the shared/sharable information into a separate DB that the other two can either reference or just replicate locally. Then you don't need the dual-element key nor any elaborate ESB contraption...</p>
48,256
<p>When creating a database structure, what are good guidelines to follow or good ways to determine how far a database should be normalized? Should you create an un-normalized database and split it apart as the project progresses? Should you create it fully normalized and combine tables as needed for performance?</p>
<p>You want to start designing a normalized database up to 3rd normal form. As you develop the business logic layer you may decide you have to denormalize a bit but <em>never, never</em> go below the 3rd form. Always, keep 1st and 2nd form compliant. You want to denormalize for simplicity of code, not for performance. ...
<p>Often if you normalize as far as your other software will let you, you'll be done.</p> <p>For example, when using Object-Relational mapping technology, you'll have a rich set of semantics for various many-to-one and many-to-many relationships. Under the hood that'll provide join tables with effectively 2 primary ...
6,999
<p>For technical reasons, I can't use ClickOnce to auto-update my .NET application and its assemblies. What is the best way to handle auto-updating in .NET?</p>
<p>I think the <a href="http://msdn.microsoft.com/en-us/library/ms978574.aspx" rel="nofollow noreferrer">Updater Application Block</a> was something of a precursor to ClickOnce. Might be worth investigating. Looking at its source code might be enough to spark some ideas.</p>
<p>Write your own.</p> <p>I have heard that they are somewhat difficult to write the first time, but after that it gets simple.</p> <p>Since I haven't written one yet (although its on my list), I can give you some of the things that I have thought of. Maintain accurate dll versions, as this is important for self upd...
18,202
<p>I would like to know exactly how the "Is" command works in Linux and Unix.</p> <p>As far as I know, ls forks &amp; exec to the Linux/Unix shell and then gets the output (of the current file tree. eg./home/ankit/). I need a more detailed explanation, as I am not sure about what happens after calling fork.</p> <p>C...
<p>ls doesn't fork. The shell forks and execs in order to run any command that isn't built in, and one of the commands it can run is ls.</p> <p>ls uses opendir() and readdir() to step through all the files in the directory. If it needs more information about one of them it calls stat().</p>
<p>This is a old thread , but still I am commenting because I believe the answer which was upvoted and accepted is partially incorrect. @Mark says that ls is built into shell so shell doesn't exec and fork. When I studied the tldp document on bash(I have attached the link) "<strong>ls</strong>" is not listed as a buil...
24,986
<p>I asked the question: <a href="https://stackoverflow.com/questions/373818/whats-with-those-do-not-use-javascript-people">What's with those Do-Not-Use Javascript People</a> and many people said that Javascript allows security exploits through client-side attacks. </p> <p>So I need to follow up and understand the how...
<p>Hmm... <a href="http://www.milw0rm.com/exploits/7477" rel="nofollow noreferrer">Can 0wn you</a>. I mean literally can own the whole computer, install a trojan.</p> <p>I've seen and done so many XSS attacks successful which caused to steal administration's session and control the whole application. I've seen and don...
<p>An injection attack on a vulnerable input script on a client site caused a trojan-loading script body to be appended to each and every text field in their database via an automatic MS SQL script. We ended up using the script to negate itself to clean it up, but quite a few people got some sort of infection through ...
49,936
<p>I tried to follow a couple of googled up tutorials on setting up mod_python, but failed every time. Do you have a good, step-by step, rock-solid howto?</p> <p>My dev box is OS X, production - Centos.</p>
<p>There are two main ways of running Python on Apache. The simplest would be to use CGI and write normal Python scripts while the second is using a web framework like Django or Pylons.</p> <p>Using CGI is straightforward. Make sure your Apache config file has a cgi-bin set up. If not, follow their documentation (<a h...
<p>The problem for me wasn't in Apache set up, but in understanding how mod_apache actually uses the .py files. Module-level statements (including those in a <code>if __name__=='__main__'</code> section) are <em>not</em> executed--I assumed that the stdout from running the script at the commandline would be what the se...
2,709
<p>Assuming a Read Committed Snapshot transaction isolation setting, is the following statement "atomic" in the sense that you won't ever "lose" a concurrent increment?</p> <pre><code>update mytable set counter = counter + 1 </code></pre> <p>I would assume that in the general case, where this update statement is part...
<p>Read Committed Snapshot only deals with locks on selecting data from tables.</p> <p>In t1 and t2 however, you're UPDATEing the data, which is a different scenario.</p> <p>When you UPDATE the counter you escalate to a write lock (on the row), preventing the other update from occurring. t2 could read, but t2 will bl...
<p>There is at heart only one transaction, the outermost one. The inner transactions are more like checkpoints within a transaction. Isolation levels affect only sibling outermost transactions, not parent/child related transactions.</p> <p>The counter will be incremented by two. The following yields one row with a val...
23,491
<p>Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control.</p> <p>We have licenses for Telerik. I wanted to know if anyone had experience with that or could suggest a better one?</p> <p>Some criteria to be measured by</p> <ul> <li>validation</li> <li>peformance</li> <li>multiple files</li> ...
<p>Personally, if you have the Telerik controls I would give them a shot. I've found that they are very helpful, and the user experience is good. Their upload control is quite nice.</p>
<p>You could try a flash-based solution that allows you to display whatever text, textboxes, buttons, or anything else as part of your own file upload control. These solutions typically put a 1x1 flash movie on the page that acts as a bridge between javascript and flash such that javascript can call flash's file upload...
31,615
<p>In my webpage, I want the website to greet the user, but the username is surrounded by 'single quotations'. Since this isn't to prevent MySQL injection, i just want to remove quotes around my name on the display page.</p> <p>Ex: Welcome 'user'! I'm trying to find the way where i can strip the quotations around the ...
<p>If you're sure that the first and last characters of <code>$login</code> are always a <code>'</code> you can use <a href="http://de3.php.net/manual/en/function.substr.php" rel="noreferrer"><code>substr()</code></a> to do something like</p> <pre><code>$login = substr($_SESSION['login'], 1, -1); // example 1 </code><...
<p>I think the easiest way would be to use the trim() function. It usually trims whitespace characters, but you may pass it a string containing characters you want to be removed:</p> <pre><code>echo 'Welcome ' . trim($login, "'"); </code></pre> <p>See <a href="http://php.net/trim" rel="nofollow noreferrer">http://php...
35,449
<p>How do you access a SQL Server 2005 Express Edition from a application in a network computer?</p> <p>The access I need is both from application (Linq-to-SQL and ODBC) and from Management Studio</p>
<p>See this KB Article. <a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277" rel="noreferrer">How to configure SQL Server 2005 to allow remote connections</a>.<br> Oh, and remember that the SQLServer name will probably be MyMachineName\SQLExpress</p>
<p>If you're running it on a 2k3 box, you need to install all updates for Sql Server and the 2003 server. </p> <p>Check the event logs after you start the Sql Server. It logs everything well, telling you if its being blocked, and where it is listening for connections.</p> <p>From a remote machine, you can use telne...
3,081
<p>I want to raise an event when a popup window is closed, or preferably, just before closing. I'm storing the popup window object as an object, but I don't know of any way to bind to the close event, or an event just before the window is closed.</p> <pre><code>var popupWindow = window.open("/popup.aspx", "popupWindow...
<p>I created a watcher that checks if the window has been closed:</p> <pre><code>var w = window.open("http://www.google.com", "_blank", 'top=442,width=480,height=460,resizable=yes', true); var watchClose = setInterval(function() { if (w.closed) { clearTimeout(watchClose); //Do something here... } },...
<p>Use <a href="http://developer.mozilla.org/en/DOM/window.onunload" rel="nofollow noreferrer">window.onUnload</a></p>
16,957
<p>I just (re-)joined a company to work on some C++ projects. I'm looking at the files and I'm trying to figure out what all the Visual Studio related files are. Many I suspect are orphans from previous versions of the IDE.</p> <p>I've listed all the file extensions below and annotated the ones I think I understand. I...
<p>.dsp - Obsolete<br> .dsw - Obsolete<br> .ncb - for intellisense (should not be in source control)<br> .sln - Solution<br> .suo - Solution user options (should not be in source control)<br> .vcproj - VC++ project file<br> .vcproj.$DOMAIN.$USER.user - Project user options (should not be in source control)<br> .vcproj....
<p>The vsscc and vssscc have to do with Visual Source Safe.</p>
49,134
<p>How do you <a href="http://svnbook.red-bean.com/en/1.8/svn.branchmerge.html" rel="noreferrer">branch and merge</a> with Apache Subversion using the TortoiseSVN client? </p>
<p>My easy click-by-click instructions (<strong>specific to TortoiseSVN</strong>) are in Stack&nbsp;Overflow question <em><a href="https://stackoverflow.com/questions/1461922">What is the simplest way to do branching and merging using TortoiseSVN?</a></em>.</p>
<p>You can also try <em><a href="http://www.codeproject.com/KB/work/XTortoiseSVN.aspx" rel="nofollow noreferrer">Version Control for the Standalone Programmer - Part 1</a></em> or perhaps <em><a href="http://www.kenegozi.com/Blog/2007/07/30/merging-with-tortoisesvn.aspx" rel="nofollow noreferrer">Merging with TortoiseS...
2,253
<p>Our family no longer uses our <a href="http://www.mixman.com/products/dm2.html" rel="nofollow noreferrer">Mixman DM2</a> USB controller for making music. This frees it up for me to use as an auxiliary keyboard with 31 "keys" (and a few "sliders"). I had the crazy idea to use these buttons to send keyboard shortcut...
<p>Haven't heard of it before, but I can't wait to see if you can make it useful!</p> <p>You can assign Visual Studio functions to "chords" of key combinations, right? So maybe you could play shave-and-a-haircut to start a build.</p>
<p>Yeah, I was thinking about doing something similiar to that myself. I'm pretty sure you'd have to write your own driver for it though.</p>
13,284
<p>What serial communication bus would you use in a automotive embedded system if your main selection criteria were: </p> <ul> <li>Electrically robust </li> <li>Slow speed (32 kb/s) </li> <li>Easy to program </li> <li>Easy to interface with microcontrollers </li> </ul> <p>It won't be transferring much data, but ...
<p>You've already chosen the AT90CAN128, whose standout feature compared to other AVR processors is support for the CAN bus. There really is not a better choice than CAN for an automotive application with your data rate and noise immunity requirements. If you march in to an automotive customer with anything other than ...
<p>As others said, CAN is standard, robust, more robust with slow speed etc.</p> <p>And there's even support in Linux kernel for it from version 2.6.15 if you ever need bigger system.</p>
17,436
<p>Does anyone know of an easy way to escape HTML from strings in <a href="http://jquery.com/" rel="noreferrer">jQuery</a>? I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks). I'm sure it's possible to extend jQuery to ...
<p>Since you're using <a href="https://jquery.com/" rel="noreferrer">jQuery</a>, you can just set the element's <a href="http://api.jquery.com/text/" rel="noreferrer"><code>text</code></a> property:</p> <pre><code>// before: // &lt;div class="someClass"&gt;text&lt;/div&gt; var someHtmlString = "&lt;script&gt;alert('hi...
<p><a href="https://stackoverflow.com/a/10825766/819417">This answer</a> provides the jQuery and normal JS methods, but this is shortest without using the DOM:</p> <pre><code>unescape(escape("It's &gt; 20% less complicated this way.")) </code></pre> <p>Escaped string: <code>It%27s%20%3E%2020%25%20less%20complicated%2...
4,445
<p>Is there any need of Virtual Constructors? If so can any one post a scenario?</p>
<p>If you are talking about virtual destructors in C++ (there isn't any such thing as virtual constructors) then they should always be used if you are using your child classes polymorphically.</p> <pre><code>class A { ~A(); } class B : public A { ~B(); } A* pB = new B(); delete pB; // NOTE: WILL NOT CALL B's des...
<p>In C++, all constructors are implicitly virtual (with a little extra). That is, the constructor of the base class is called before that of the derived class. So, it's like they're sort of virtual. Because, in a virtual method, if the derived class implements a method of the same signature, only the method in the der...
9,600
<p>We are trying to repair an Ultimaker Original+. One problem is a missing resistor isolation. The Ultimaker Original+ prints with up to 260 Degree Celcius.</p> <p><strong>Which kind of isolation products are suitable to resist the heat and are fitting on the thin wires of the thermistor?</strong></p>
<p>The most common choice for insulating thermistors is glass fiber sleeving. It tolerates very high temperatures, and is commonly rated for up to 600&nbsp;&deg;C.</p> <p>Teflon is also used but has a rather low upper limit on its working temperature; it shouldn't be used at temperatures exceeding 260&nbsp;&deg;C - wh...
<p>There are many materials you can use one that came to my mind is this High Temperature &amp; Pressure Sealant and also the best way to apply it so it can be removed easy is this . take a kitchen food very thing nylon cover you know the very thin elastic one or cover the parts with some type of release agent (dont us...
489
<p>I have the following code which plays a video clip but when it is finished it does not release the form but instead leaves the last frame of the video. how do I get it to clear when playback ends so that I can see the orignal contents of the form it took over to play the video?</p> <pre><code>_video = new Video("vi...
<p><a href="https://stackoverflow.com/users/13913/daok">Daok</a> pointed me in the correct direction. An event handler on the video ending and then setting the Owner of the Video object to null.</p> <pre><code>_video.Ending += new System.EventHandler(this.video_stopped); private void video_stopped(object sender, Even...
<p>Release the form you mean to close it? You might want to check for an event in your Video object that will raise when the video is done and you will need to use this.close(); to close the form. Is it what you desire?</p>
34,622
<p>I'm working on some production software, using C# on the .NET framework. I really would like to be able to use LINQ on the project. I believe it requires .NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client's work PC. Is it reasonable to assume they h...
<p>I would say that it isn't safe to assume they have .NET 3.5.</p> <p>Where as it is very, very unlikely they will have any problems when upgrading, changing anything always carries a risk. I know I wouldn't mind upgrading, but I am a developer.</p> <p>I think it's one of those things that could go either way, they ...
<p>So long as you know that you don't need to support Windows 2000 or any older versions of Windows then requiring the latest and greatest framework version doesn't feel too onerous. </p> <p>Some less fortunate developers are stuck with older framework versions because they need to support older OS versions.</p>
13,196
<p>I recognize that there's an obvious pattern in the output to this, I just want to know why lispbox's REPL aborts when I try to run anything > 52. Also, any suggestions on improving the code are more than welcome. ^-^</p> <pre><code>(defun count-reduced-fractions (n d sum) (setf g (gcd n d)) (if (equal 1 d) ...
<p>This behaviour hints at a missing tail call optimization, so that your recursion blows the stack. A possible reason is that you have declaimed debugging optimization.</p> <p>By the way, you don't need to make an explicit call to <code>return-from</code>. Since <code>sum</code> is a self-evaluating symbol, you can ...
<p>Probably a Stack Overflow (heh).</p>
46,209
<p>I have an MDI application. When I show a message box using MessageBox.Show(), the entire application disappears behind all of my open windows when I dismiss the message box.</p> <p>The code is not doing anything special. In fact, here is the line that invokes the message box from within an MDI Child form:</p> <pre...
<p>Remove the last parameter, <code>MessageBoxOptions.DefaultDesktopOnly</code>. </p> <p>From <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxoptions(VS.80).aspx" rel="noreferrer">MSDN</a>:</p> <blockquote> <p>DefaultDesktopOnly will cause the application that raised the MessageBox...
<p>These answers are correct, but I wanted to add another point. I came across this question while working with someone else's code. A simple message box was causing the front most window to move to the back:</p> <p>MessageBox.Show("Hello").</p> <p>Turns out, there was a BindingSource.Endedit command before the Messa...
18,872
<p>I need to determine which version of GTK+ is installed on Ubuntu</p> <p>Man does not seem to help</p>
<p><a href="https://stackoverflow.com/a/126145/">This suggestion</a> will tell you which minor version of 2.0 is installed. Different major versions will have different package names because they can co-exist on the system (in order to support applications built with older versions).</p> <p>Even for development files,...
<p>To make the answer more general than Ubuntu (I have Redhat):</p> <p>gtk is usually installed under /usr, but possibly in other locations. This should be visible in environment variables. Check with </p> <pre><code>env | grep gtk </code></pre> <p>Then try to find where your gtk files are stored. For example, use <...
15,340
<pre><code>Open App.Path &amp; "\Folder\" &amp; str(0) For Output </code></pre> <p>Seems to get a path not found however if directly before that I do</p> <pre><code>MsgBox App.Path &amp; "\Folder\" &amp; str(0) </code></pre> <p>It Provides the correct directory/filename that I want</p> <p>and if I replace that str...
<p>You can open a file that doesn't exist. I tried it with:</p> <pre><code> Open "c:\temp\test.txt" &amp; Str(0) For Output As #1 Close #1 </code></pre> <p>When it ran it created c:\temp\test.txt 0</p> <p>Note that I added "As #1" to the Open statement, and taht Str(0) adds a leading space for the optional minus ...
<p>Here something easy i made for you:</p> <pre><code>Function CreateLog(Destination As String, MyMessage As String) Dim PathToCreate, FolderPath, FileName As String 'Check for Unnecessary Spaces Destination = Trim(Destination) FolderStr = Destination 'Gather only FolderPath of Destination Do...
37,443
<p>I have a VB6 COM component which I need to call from my .Net method. I use reflection to create an instance of the COM object and activate it in the following manner:</p> <pre><code>f_oType = Type.GetTypeFromProgID(MyProgId); f_oInstance = Activator.CreateInstance(f_oType); </code></pre> <p>I need to use GetTypeFrom...
<p>JUnit has no such runner at the moment. Addressing the underlying issue, the need to get reasonable assurance from a test suite in a limited amount of time, is our highest development priority for the next release. In the meantime, implementing a Filter that works through annotations seems like it wouldn't be a big ...
<p>You can create suites, although that puts all the configuration in the suite, and not in annotations.</p>
18,521
<p>In my Page_Load event of codebehind file, I am loading data in to a datatable.In my .aspx page I am having some inline coding,I want to display some data from this datatable.But when i am running the program,It is showing an error like "Error 64 Use of unassigned local variable 'dtblChild' " dtblChild is my DataTa...
<p>Inline Code executes during the Render stage.</p> <p>in the <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">lifecycle</a> of a page, Render happens much later than Load</p>
<p>Yes, the page load executes after all of the server controls have been loaded into memory, but you have to ensure that the datatable is repopulated on each refresh if you're going to use it.</p> <p>I think your question indicates some deeper problems with the way you're binding to the page.</p> <p>Can you post som...
30,145
<p>I'm looking to the equivalent of Windows <a href="http://msdn.microsoft.com/fr-fr/library/yeby3zcb.aspx" rel="noreferrer"><code>_wfopen()</code></a> under Mac OS X. Any idea?</p> <p>I need this in order to port a Windows library that uses <code>wchar*</code> for its File interface. As this is intended to be a cross...
<p>POSIX API in Mac OS X are usable with UTF-8 strings. In order to convert a wchar_t string to UTF-8, it is possible to use the CoreFoundation framework from Mac OS X. </p> <p>Here is a class that will wrap an UTF-8 generated string from a wchar_t string.</p> <pre><code>class Utf8 { public: Utf8(const wchar_t* w...
<p>If you're using Cocoa it's fairly easy with NSString. Just load the UTF16 data in using -initWithBytes:length:encoding: (or perhaps -initWithCString:encoding:) and then get a UTF8 version by calling UTF8String on the result. Then, just call fopen with your new UTF8 string as the param.</p> <p>You can definitely ca...
3,337
<p>I am getting very frustrated because I cannot seem to figure out why Collections shuffling is not working properly.</p> <p>Lets say that I am trying to shuffle the <code>randomizer</code> array. </p> <pre><code>int[] randomizer = new int[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(randomizer));...
<p><code>Arrays.asList</code> cannot be used with arrays of primitives. Use this instead:</p> <pre><code>Integer[] randomizer = new Integer[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(randomizer)); </code></pre> <p>The same rule applies to most classes in the collections framework, in that you can'...
<p>Chris' answer is correct.</p> <p>As i said in a comment on Chris' answer, your underlying array will change appropriately unless the arraylist needs to grow, and the list creates a new one and copies items into it.</p> <p>You may want to keep a reference to the list and iterate over that after the Arrays.asList ca...
21,834
<p>My SQL table looks like this:</p> <pre><code>CREATE TABLE Page ( Id int primary key, ParentId int, -- refers to Page.Id Title varchar(255), Content ntext ) </code></pre> <p>and maps to the following class in my ActiveRecord model:</p> <pre><code>[ActiveRecord] public class Page { [PrimaryKey]...
<p>The easiest way to do this is to fetch the entire table, then filter the result. This is pretty easy, if you are using linq.</p> <pre><code>var AllPages = ActiveRecordMediator&lt;Page&gt;.FindAll(); var rootPages = AllPages.Where(p =&gt; p.Parent == null); </code></pre>
<p>Try this:</p> <pre><code>var rootPages = new SimpleQuery&lt;Page&gt;(@"from Page p left join fetch p.Children where p.Parent is null"); return(rootPages.Execute()); </code></pre> <p>This will cause the Children collection of each Page in the result set to be populated out during the initial query, which should red...
35,299
<p>Groovy adds the <code>execute</code> method to <code>String</code> to make executing shells fairly easy;</p> <pre><code>println "ls".execute().text </code></pre> <p>but if an error happens, then there is no resulting output. <strong>Is there an easy way to get both the standard error and standard out?</strong> (...
<p>Ok, solved it myself;</p> <pre><code>def sout = new StringBuilder(), serr = new StringBuilder() def proc = 'ls /badDir'.execute() proc.consumeProcessOutput(sout, serr) proc.waitForOrKill(1000) println &quot;out&gt; $sout\nerr&gt; $serr&quot; </code></pre> <p>displays:</p> <p><code>out&gt; err&gt; ls: cannot access ...
<pre><code>command = "ls *" def execute_state=sh(returnStdout: true, script: command) </code></pre> <p>but if the command failure the process will terminate</p>
19,253
<p>I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is...
<p>No. </p> <p>Your best bet is to write the low level code in C or C++ (where you do have <code>#pragma pack</code>), then expose the interface via COM.</p>
<p>There is not any way to force VB6 to not pad UDT's, similar to the #pragma pack directive available in many C/C++ compilers, but you can do it the other way around.</p> <p>According to Q194609 Visual Basic uses 4 bytes alignment and Visual C++ uses 8 bytes by default.</p> <p>When using VB6 to call out to a C DLL, ...
17,278
<p>I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field?</p>
<p>The answer is <code>SELECT DATEADD(ms, -3, '2008-01-24')</code>, the explanation is below.</p> <p>From <a href="http://musingmarc.blogspot.com/2006/07/more-on-dates-and-sql.html" rel="nofollow noreferrer">Marc's blog</a>:</p> <blockquote> <p>But wait, Marc... you said you like to use <code>BETWEEN</code>, but that q...
<p>I was able to use:</p> <pre><code>select {fn curdate()} + ' 23:59:59.000' </code></pre> <p>or</p> <pre><code>select DATEADD(ss,-1,DATEADD(DAY,1,CAST({fn curdate()} as DATETIME))) </code></pre> <p>to get the end of a day</p>
20,207
<p>I have one <code>JSON</code> that is coming in a <code>string</code> format. I need to store it in a <code>key-pair</code> value or something like that. I am using <code>asp.net 2.0</code> and can not use 3rd party <code>DLL</code> like <code>Newtonsoft.Json.dll</code>. I guess last option will be to use <code>regul...
<p>If you go to <a href="http://www.json.org/" rel="nofollow noreferrer">http://www.json.org/</a> and look towards the bottom of the page there are dozens of json libraries most of them open source, I believe they list 8 for C#. If you can not reference one of these libraries, I think your best bet would be to find one...
<p>You will need to use jscript.net as the code behind language, but other pages of your site should be fine to stay as c# if thats what you prefer.</p> <p>As mentioned in previous comment, you will need to be aware of the security aspects and risks - only use eval if you trust the JSON you're parsing!</p>
12,846
<p>I am thinking about making a website with some fairly intense JavaScript/canvas usage and I have been looking at <a href="http://ejohn.org/blog/processingjs/" rel="nofollow noreferrer">Processing.js</a> and it seems to me that it would make manipulating the canvas significantly easier. Does anyone know any reasons ...
<p>As mentioned, IE is not supported by Processing.js (including IE8 beta). I've also found processing.js to be a bit slow in terms of performance, compared to just using canvas (especially if you're parsing a string with Processing language, instead of using the javascript API).</p> <p>I personally prefer the canvas ...
<p>I'd say use Flash instead. More browsers have Flash installed, than the number of browsers that work with processing.js. In addition, you'll get much better performance from Flash versus using JavaScript (at least for now, though there are projects in the works to speed up JS a lot, but it's still a little ways off)...
20,614