instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows ?</p>
<p>Right-click on the working directory in windows explorer, and select "Properties" (Not TortoiseSVN->Properties). You will see the Properties dialog, which will have a tab called "Subversion". Click on it, and you will see the version number, and other info.</p>
<p><a href="https://stackoverflow.com/questions/89741/can-i-see-the-currently-checked-out-revision-number-in-tortoise-svn#89754">nice one</a> John Sheehan. I always just right clicked on the root folder and selected tortoise-svn | view log .</p>
11,520
<p>Ever since I started using .NET, I've just been creating Helper classes or Partial classes to keep code located and contained in their own little containers, etc. </p> <p>What I'm looking to know is the best practices for making ones code as clean and polished as it possibly could be.</p> <p>Obviously clean code i...
<p>A real eye-opener to me was <a href="https://rads.stackoverflow.com/amzn/click/com/0201485672" rel="noreferrer" rel="nofollow noreferrer">Refactoring: Improving the Design of Existing Code</a>:</p> <blockquote> <p>With proper training a skilled system designer can take a bad design and rework it into well-des...
<p>I just got a copy of Code Complete, and found that there was a section on this. </p> <p>Although I will still be reading the accepted answer's book, what Code Complete has taught me has dramatically improved the way I think about designing classes.</p> <p>Before today, I didn't know what an ADT was (abstract data ...
19,588
<p>Is it possible to perform a named-group match in Perl's regex syntax as with Python's? I always bind the <code>$n</code> values to proper names after matching, so I'd find it more convenient to do it in the regex itself if it's possible.</p> <p>Python does it like so:</p> <pre><code>&gt;&gt;&gt; import re &gt;&gt;...
<p>Perl uses <code>(?&lt;NAME&gt;pattern)</code> to specify names captures. You have to use the <code>%+</code> hash to retrieve them.</p> <pre><code>$variable =~ /(?&lt;count&gt;\d+)/; print "Count is $+{count}"; </code></pre> <p>This is only supported on Perl 5.10 and higher though.</p>
<p>I use the <a href="https://perldoc.perl.org/perlvar#%25%7B%5ECAPTURE%7D" rel="nofollow noreferrer"><code>%{^CAPTURE}</code></a> hash (for readability).</p> <p>It is <a href="https://perldoc.perl.org/English" rel="nofollow noreferrer">English</a> version for <code>%+</code> as mentioned above by Leon Timmermans.</p> ...
36,788
<p>I looked it up in Wikipedia, and there is only one line there. Anyone have a more detailed description for it? Ubuntu releases their OS with this notation, but I was unable to find a detailed description over what it means/includes. I've already read the Ubuntu notation but need a more general description, not how U...
<p>In the Linux World, LTS and similar terms mean that the distribution stays stable. That means: You will not get any major functional upgrades (at least none that break compatibility in any way), but you will get security enhancements. One example of this is Red Hat Enterprise Server or CentOS, which only had PHP 5.1...
<p>I don't believe "LTS" has any general definition, so any answer will have to focus on what Ubuntu mean by "Long Term Support"</p> <p>But, just to add xsl's answer, using the <a href="http://wiki.ubuntu.com/LTS" rel="nofollow noreferrer">LTS</a> versions on servers allows you to have some confidence you can deploy s...
36,880
<p>How do I make an activeX control in a C# library project and then reference it in another ASP.NET wet site project?</p>
<p>Is the ActiveX for the client, or for the server?</p> <p>If for the server, just use a direct reference to the managed assembly (no need for COM).</p> <p>Re the client, frankly I'm not sure it is a good idea to be writing ActiveX controls - most browsers won't love them. You'd do better with AJAX and DHTML, or Sil...
<p>If you're using C#/.NET to build your control and consuming it from ASP.NET you would get better performance (and cause yourself much less pain) by referencing it as a standard .NET assembly, bypassing ActiveX altogether. Hope this helps!</p> <p>Adam</p>
34,460
<p>I read about Java's type erasure <a href="https://docs.oracle.com/javase/tutorial/java/generics/erasure.html" rel="noreferrer">on Oracle's website</a>.</p> <p><strong>When does type erasure occur?</strong> At compile time or runtime? When the class is loaded? When the class is instantiated?</p> <p>A lot of sites (...
<p>Type erasure applies to the <em>use</em> of generics. There's definitely metadata in the class file to say whether or not a method/type <em>is</em> generic, and what the constraints are etc. But when generics are <em>used</em>, they're converted into compile-time checks and execution-time casts. So this code:</p> <...
<p>I've encountered with type erasure in Android. In production we use gradle with minify option. After minification I've got fatal exception. I've made simple function to show inheritance chain of my object:</p> <pre><code>public static void printSuperclasses(Class clazz) { Type superClass = clazz.getGenericSuper...
44,117
<p>I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with):</p> <pre><code>&lt;style&gt; #outer { text-align: center; } #inner { text-align: left; margin: 0 auto; } .t { float: left; } tab...
<p>If it was me - I would do with the table something like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;style type="text/css" media="screen"&gt; table { ...
<p>I have provided two solutions. Pick up which one best suits for you. </p> <p><strong>Solution#1:</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt...
45,142
<p>Is there any reason to prefer a <code>CharBuffer</code> to a <code>char[]</code> in the following:</p> <pre><code>CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while( in.read(buf) &gt;= 0 ) { out.append( buf.flip() ); buf.clear(); } </code></pre> <p>vs.</p> <pre><code>char[] buf = new char[DEFAUL...
<p>No, there's really no reason to prefer a <code>CharBuffer</code> in this case.</p> <p>In general, though, <code>CharBuffer</code> (and <code>ByteBuffer</code>) can really simplify APIs and encourage correct processing. If you were designing a public API, it's definitely worth considering a buffer-oriented API.</p>
<p>The CharBuffer version is slightly less complicated (one less variable), encapsulates buffer size handling and makes use of a standard API. Generally I would prefer this.</p> <p>However there is still one good reason to prefer the array version, in some cases at least. CharBuffer was only introduced in Java 1.4 so i...
37,578
<p>There is the button control in silverlight application . Can I send a mouse click event to it programmatically?</p>
<p>If you still want to do that. You can now upgrade to Silverlight version 3.0 or later versions and do the following:</p> <p>You can use the button automation peer from System.Windows.Automation.Peers to accomplish what you want.</p> <pre><code>if (button is Button) { ButtonAutomationPeer peer = new ButtonAutom...
<p>I've not used Silverlight but I assume it's the same process as Windows.Forms and WebControls. You'll just need to call the button's <code>.Click(Object o, EventArgs e)</code> method.</p>
22,576
<p>So I'm working on a Rails app to get the feeling for the whole thing. I've got a <code>Product</code> model that's a standard ActiveRecord model. However, I also want to get some additional product info from Amazon ECS. So my complete model gets some of its info from the database and some from the web service. My qu...
<p>As with most things: it depends. Each of your ideas have merit. If it were me, I'd start out this way: </p> <pre><code> class Product &lt; ActiveRecord::Base has_one :aws_item end class AWSItem belongs_to :product end </code></pre> <p>The key questions you want to ask yourself are: </p> <p><str...
<p>You can use the <code>composed_of</code> relationship in ActiveRecord. You make a regular class with all the attributes that you manage through AWS and specify that your Product-class is composed_of this class. ActiveRecord will handle the delegation of the mapped attributes to and from this class.</p> <p>See <a hr...
9,578
<p>I have Widget.title, Widget.publish_ at, and Widget.unpublish_ at. It's a rails app with thinking_sphinx running, indexing once a night. I want to find all Widgets that have 'foo' in the title, and are published (publish _at &lt; Time.now, unpublish _at > Time.now). </p> <p>To get pagination to work properly, I rea...
<p>Yep, easily possible, just make sure you're covering the times in your indexes:</p> <pre><code>class Widget &lt; ActiveRecord::Base define_index do indexes title has publish_at has unpublish_at ... end </code></pre> <p>To pull it based purely off the dates, a small amount of trickery is require...
<p>I haven't used sphinx with rails yet. But this is possible by the Sphinx API. What you need to do is to set a datetime attribute at your sphinx.conf. And don't forget to use UNIX_TIMESTAMP(publish_at), UNIX_TIMESTAMP(unpublish_at) at your index select.</p>
46,402
<p>Anyone know a QR decoder that works on mac or that might be online? I just need to decode one single image.</p>
<p>Using brew, it is easy to install zbar, a QR code reader.</p> <pre><code>brew install zbar </code></pre> <p>Then a QR code can be read by calling:</p> <pre><code>zbarimg qrcode_file.png </code></pre> <p>Also @jm666, <a href="https://stackoverflow.com/q/46066903/8524178">brew can be used to install opencv</a>.</p...
<p>There is an open-source <a href="https://github.com/mchehab/zbar" rel="nofollow noreferrer">command line tool named ZBar</a>. It takes a photo as an argument and extracts the information out of any QRCode that it detects in the image.</p> <p>The open-source project <a href="https://github.com/FrederikRogalski/QR-Rea...
25,833
<p>How is it possible to check if MOSS Standard or MOSS Enterprise is installed?</p>
<p>This link should sort you out...</p> <p><a href="http://weblogs.asp.net/danlewis/archive/2008/09/06/determine-which-version-of-sharepoint-is-installed.aspx" rel="nofollow noreferrer">Determining sharepoint versions</a></p> <p>Edit: The article has now disappeared, so see Dan's answer below</p>
<p>Check this article on "How to check if SharePoint Standard or SharePoint Enterprise is installed?"</p> <blockquote> <p>The SKU key is nothing but a GUID as you can see in the above table, so we can easily retrieve this information using the below code, use a visual webpart and add this Render method in your UserC...
45,462
<p>I want to learn MSBuild, was wondering if someone could get me started with a simple build script to filter out my vs.net 2008 project of all files with the .cs extension.</p> <ol> <li>how do I run the build?</li> <li>where do you usually store the build also?</li> </ol>
<p>You typically run an MSBuild script from the command line using the following syntax:</p> <pre><code>MSBuild &lt;scriptfilename&gt; /t:targetname </code></pre> <p>You can get more information here: <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/e...
<pre><code>C:\projects\_Play\SimpleIpService&gt;type \\sysrdswbld1\public\bin\mrb-vs2008.cmd @echo off call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" echo %0 %* echo %0 %* &gt;&gt; %MrB-LOG% cd if not ""=="%~dp1" pushd %~dp1 cd if exist %~nx1 ( echo VS2008 build of '%~nx1'. echo ...
27,344
<p>I need to know the maximum length of a textbox in ssrs. How much data can it accomodate?</p>
<p>The max length is 32k.</p>
<p>The Maximum Length of the textbox in SSRS 2012 is 4680 Characters.</p>
24,950
<p>if i decide to use the 'publish' option for my ASP.NET website, instead of a Web Deployment Project, can i do custom msbuild things? Or do i need to stick with WDP's if i want to do custom msbuild stuff during compile/deployment.</p>
<p>I think of the publish option as a part of the VS.NET toolset for developers to use to publish web sites on dev machines. It isn't really built to be a real deployment.</p> <p>If you need custom actions, a Web Deployment Project would be more suited to a real deployment that multiple people other than the develope...
<p>It looks like you can customize the Publish task through the _CopyWebApplication MSBuild target. Or you can at least create a batch file that will call that target, which you can customize.</p> <p>More details <a href="http://forums.asp.net/t/1063636.aspx" rel="nofollow noreferrer">here</a> and <a href="http://www....
32,572
<p>What are the guidelines for when to create a new exception type instead of using one of the built-in exceptions in .Net?</p> <p>The problem that got me thinking is this. I have a WCF service, which is a basic input-output service. If the service is unable to create an output, because the input is invalid, I want to...
<p>Avoid throwing <code>System.Exception</code> or <code>System.ApplicationException</code> yourself, as they are too general.</p> <p>For WCF services there are Fault Contracts - a generic exception that you can tell subscibers to handle.</p> <p>Flag the interface with:</p> <pre><code>[FaultContract( typeof( LogInFa...
<p>Always create a new exception type (or use a standard type if it suits you).</p> <p>In that case you can handle the exceptions as a group.</p>
24,033
<p>I've noticed slight spacing differences in HTML rendering between these versions in Windows XP.</p> <p>Is the box-model interpreted in a slight different manner?</p>
<p>Might as well check it at <a href="http://www.quirksmode.org/" rel="nofollow noreferrer">http://www.quirksmode.org/</a></p>
<p>The differences you noticed are the differences you’re looking for.</p>
49,425
<p>I need to run a JNDI provider without the overhead of a J2EE container. I've tried to follow the directions in this <a href="http://www.javaworld.com/javaworld/jw-04-2002/jw-0419-jndi.html" rel="noreferrer">article</a>, which describes (on page 3) exactly what I want to do. Unfortunately, these directions fail. I...
<p><a href="http://activemq.apache.org/" rel="noreferrer">Apache ActiveMQ</a> already comes with an integrated lightweight JNDI provider. See <a href="http://activemq.apache.org/jndi-support.html" rel="noreferrer">these instructions on using it</a>. </p> <p>Basically you just add the jndi.properties file to the classp...
<p>The JBoss JMQ can also be run with just the MicroKernel and a very minimal set of libraries. The JBoss AS installer has options for "profiles" one of which is for a standalone JMQ. It also allows you to pick and choose components (though it doesn't help you with dependencies too much). Have you tried running the ...
23,418
<p>I get a "UUID mismatch" warning at the console when I try to build and run my app on my iPhone.</p> <blockquote> <p>warning: UUID mismatch detected with the loaded library - on disk is: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/liblockdown.dylib =uuid-mismatch-with-loaded...
<p>Uninstalling and reinstalling both the iOS on the device and the SDK did not fix this for me. The only way I was able to get around this issue was by deleting the DeviceSupport files for the 4.2.1 iOS version, which can be found at:</p> <pre><code>/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ </code></pre> ...
<p>I don't think this is necessarily benign as suggested and the selected answer doesn't address how to stop the warning. The following should stop the warning:</p> <ol> <li>Unplugging iPhone or iPad from Mac</li> <li>Quit Xcode</li> <li>Delete Builds directory</li> <li>Launch Xcode, plug in iPhone and try again</li> ...
26,457
<p>Is there anyway to make it possible to use .net 3.0 namespaces in a .net 2.0 application? I'm specifically looking to use the System.Windows.Media.Media3D namespace.</p> <p>Edit: I am looking to use the actual assemblies, not just the namespaces. Poor wording on my part.</p>
<p>Are you trying to use the namespaces or the code? You can use the namespaces for whatever you want, so long as you don't import the applicable DLLs. That would cause a spaghetti code nightmare, but you can do it.</p> <p>As I'm sure you figured out, no you cannot use the 3.0 code... or you'd have to call it a ".Ne...
<p>Are you trying to use the namespaces or the code? You can use the namespaces for whatever you want, so long as you don't import the applicable DLLs. That would cause a spaghetti code nightmare, but you can do it.</p> <p>As I'm sure you figured out, no you cannot use the 3.0 code... or you'd have to call it a ".Ne...
46,581
<p>I have a DataSet consisting of XML data, I can easily output this to a file:</p> <pre><code>DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); ds.Load(reader, LoadOption.PreserveChanges, ds.Tables[0]); ds.WriteXml("C:\\test.xml"); </code></pre> <p>However what I want to do is compress t...
<p>I've managed to compress a DataSet's XML stream using .NET 2.0's gzip compression.</p> <p>Here's the blog post I made a few years ago about it:</p> <p><a href="http://www.madprops.org/blog/saving-datasets-locally-with-compression" rel="noreferrer">Saving DataSets Locally With Compression</a></p> <p>... and here's...
<p><a href="http://dotnetzip.codeplex.com" rel="nofollow noreferrer">DotNetZip</a> does zip compression, via streams, but does not do multi-part zip files. :(</p> <p><strong>EDIT</strong>: as of September 2009, DotNetZip can do multi-part zip files.</p>
27,631
<p>Okay this question is coming from someone who has never written any code beyond CSS, HTML and some php...</p> <p>Pretty much I'm using Word all day and constantly needing to refer to just a couple of sites and resources on the web.</p> <p>I would like to create a little add-in to go in the Ribbon in Word.</p> <p>...
<p>Yes, it is possible, check <a href="http://msdn.microsoft.com/en-us/office/aa905533.aspx" rel="nofollow noreferrer">VSTO</a>.</p>
<p>You can definitly do this as a word add-in (the auto-login part may be tricky...). Here are some ressources:</p> <ul> <li><a href="http://download.microsoft.com/download/a/6/1/a61dd5df-f52c-42d5-a95c-7a7fb7a6a466/ExtendedRibbon.wmv" rel="nofollow noreferrer">http://download.microsoft.com/download/a/6/1/a61dd5df-f5...
13,997
<p>The below HTML/CSS/Javascript (jQuery) code displays the <code>#makes</code> select box. Selecting an option displays the <code>#models</code> select box with relevant options. The <code>#makes</code> select box sits off-center and the <code>#models</code> select box fills the empty space when it is displayed. </p> ...
<p>It's not entirely clear from your question what layout you're trying to achieve, but judging by that fact that you have applied "float:left" to the select elements, it looks like you want the select elements to appear side by side. If this is the case, you can achieve this by doing the following:</p> <ul> <li>To ce...
<p>Floating the select boxes changes their display properties to "block". If you have no reason to float them, simply remove the "float: left" declaration, and add "text-align: center" to #makes and #models.</p>
8,605
<p>I've created a batch job that running in 32bit mode as it using 32bit COM objectes, this need to connect to SharePoint to make updates to list. It works in my development environment as it is full 32bit. But in my test and prodution environment we use 64bit SharePoint and this is what I get from SPSite:</p> <pre><c...
<p>You simply need to run your batch job in a 64-bit process. The problem is that SharePoint has many COM objects under the hood which are compiled for 64-bit in your test and production environment. The SPSite and SPWeb objects actually wrap the COM objects which is why they fail in your 32-bit process. </p> <p>One w...
<p>I don't think this is a 32/64bit issue as I am in the same situation as far as developing on 32bit and deploying to 64bit. (Actually, we are running a 32bit and 64bit WFE'S) </p> <p>Since the exception is being thrown from the SPSite constructor, I would investigate further, as to whether the machine you are runni...
31,142
<p>I recently discovered the org-mode in emacs and it works very well for me. I also like www.RememberTheMilk.com. I would like to be able to sync my org-mode file and RTM list. I know that RTM has its API exposed as web services. I am currently looking for a HTTP library that I could use to write my script. I found a ...
<p>Emacs ships with url.el and url-http.el. Although http-get.el, http-post.el and http-cookies.el are in vogue today. Here's the GitHub link where you can get it from.</p> <p><a href="http://github.com/wfarr/dotfiles/tree/master/.elisp" rel="nofollow noreferrer">http://github.com/wfarr/dotfiles/tree/master/.elisp</a><...
<p>If I were to work on this, I'd use <a href="http://pymacs.progiciels-bpi.ca/" rel="nofollow noreferrer">Pymacs</a> to interface Emacs to Python and then use the existing <a href="http://repo.or.cz/w/pyrtm.git" rel="nofollow noreferrer">Python API kit</a> for Remember the Milk. Why re-implement all the HTTP crud your...
2,747
<p>How do you get the current time (not date AND time)?</p> <p>Example: 5:42:12 PM</p>
<p><code>DateTime.Now.TimeOfDay</code> gives it to you as a <code>TimeSpan</code> (from midnight).</p> <p><code>DateTime.Now.ToString("h:mm:ss tt")</code> gives it to you as a <em>string</em>.</p> <p>DateTime reference: <a href="https://msdn.microsoft.com/en-us/library/system.datetime" rel="noreferrer">https://msdn.m...
<p>Try this one. Its working for me in 3tier Architecture Web Application.</p> <pre><code>"'" + DateTime.Now.ToString() + "'" </code></pre> <p>Please remember the Single Quotes in the insert Query. </p> <p>For example:</p> <pre><code>string Command = @"Insert Into CONFIG_USERS(smallint_empID,smallint_userID,str_use...
37,974
<p>This question is similar to my earlier question.</p> <p>I have used ASP .Net in Visual Studio 2005 about 4 years ago. How long would it take to get back up to speed with the latest versions?</p>
<p>Not very long. The major addition to VS 2008 is support for Linq, but you don't have to use this (or any of the new features).</p> <p>The IDE is extremely similar to VS 2005.</p> <p>Essentially, 2005 targets the 3.0 framework, and 2008 target the 3.5 framework, but these are both just expansions of the 2.0 framewo...
<p>If you were already proficient in it earlier, then you'll be able to jump into it very quickly again. The core concepts haven't changed much, so you should feel right at home.</p>
22,072
<p>I'm trying to write a chat client in C# and have run into a problem.</p> <p>How it works is that the client polls the server every 1 second to see if there are any new actions to take (for example display a message in a channel, or whatever). The polling is done in a thread of its own.</p> <p>Now, I want the polli...
<p>Make the polling thread call back to the main form using <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.invoke.aspx" rel="nofollow noreferrer">Control.Invoke</a> or <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx" rel="nofollow noreferrer"...
<p>You should invoke the function from your main window:</p> <pre><code> void MyWorkerThread() { while (Connected) { Thread.Sleep(1000); if (NewMessage) { ShowNewForm(); } } } void ShowNewForm() { if (this.InvokeRequired) { // this...
48,984
<p><em>(see <a href="https://stackoverflow.com/questions/53316/hibernate-crops-clob-values-oddly">here</a> for the problem I'm trying to solve)</em></p> <p>How do you get hibernate to log clob values it's going to insert. It is logging other value types, such as Integer etc.</p> <p>I have the following in my log4j co...
<p>Try using:</p> <pre><code>log4j.logger.net.sf.hibernate=DEBUG log4j.logger.org.hibernate=DEBUG </code></pre> <p>That's the finest level you'll get. If it does not show the information you want, then it's not possible.</p>
<p>Try to set log4j.logger.org.hibernate.type=TRACE and see if that helps.</p>
7,678
<p>I'm looking for a way to configure the color used for line numbering (as in: <code>:set nu</code>) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I would <em>like</em> to color the line numbers a dim gray; somewhere in the vicinity of <code>#555</code>. ...
<p>Try:</p> <pre><code>help hl-LineNr </code></pre> <p>I found this through:</p> <pre><code>help 'number' </code></pre> <p>which is the way to get help on the <code>'number'</code> option, instead of the <code>:number</code> command.</p> <p>To actually change the displayed colour:</p> <pre><code>:highlight LineNr...
<p>I didn't like the colors provided by the selected color scheme so I modified the color of the line numbers this way:</p> <pre><code>colorscheme trivial256 " for light background hi LineNr term=bold cterm=bold ctermfg=2 guifg=Grey guibg=Grey90 </code></pre>
29,367
<p>In python, you can have a function return multiple values. Here's a contrived example:</p> <pre><code>def divide(x, y): quotient = x/y remainder = x % y return quotient, remainder (q, r) = divide(22, 7) </code></pre> <p>This seems very useful, but it looks like it can also be abused ("Well..functio...
<p>Absolutely (for the example you provided).</p> <h3>Tuples are first class citizens in Python</h3> <p>There is a builtin function <a href="https://docs.python.org/3/library/functions.html#divmod" rel="noreferrer"><code>divmod()</code></a> that does exactly that.</p> <pre><code>q, r = divmod(x, y) # ((x - x%y)/y, x...
<p>It's fine to return multiple values using a tuple for simple functions such as <code>divmod</code>. If it makes the code readable, it's Pythonic.</p> <p>If the return value starts to become confusing, check whether the function is doing too much and split it if it is. If a big tuple is being used like an object, ma...
8,682
<p>I have a Spring MVC web app which uses Spring Security. I want to know the username of the currently logged in user. I'm using the code snippet given below . Is this the accepted way? </p> <p>I don't like having a call to a static method inside this controller - that defeats the whole purpose of Spring, IMHO. ...
<p>If you are using <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-arguments" rel="noreferrer">Spring 3</a>, the easiest way is:</p> <pre><code> @RequestMapping(method = RequestMethod.GET) public ModelAndView showResults(final HttpServletRe...
<p>I like to share my way of supporting user details on freemarker page. Everything is very simple and working perfectly!</p> <p>You just have to place Authentication rerequest on <code>default-target-url</code> (page after form-login) This is my Controler method for that page:</p> <pre><code>@RequestMapping(value = ...
30,888
<p>I have a Visual Studio 2005 Solution workspace which in turn has 8 projects included in it. I want to profile the complete code(all the projects) and get some measure about the absolute cycles taken by each function to execute, or at least percentage cycle consumptions.</p> <p>I checked out help for VS 2005, and al...
<p>I guess the inbuilt profiler of Visual Studio 2005 comes onyl with the Developer Edition and Team Edition. I have a Professional edition which, it seems doesnot have the inbuilt profiler tool.</p> <p>-AD</p>
<p>Red-gate's <a href="http://www.red-gate.com/products/ants_profiler/index.htm" rel="nofollow noreferrer">Profiler</a> is great for this.</p>
6,775
<p>I'm writing a Web application that needs to store JSON data in a small, fixed-size server-side cache via AJAX (think: <a href="http://code.google.com/apis/opensocial/articles/persistence-0.8.html#restrictions-quotas" rel="noreferrer">Opensocial quotas</a>). I do not have control over the server.</p> <p>I need to re...
<p><strong>Edit</strong> There appears to be a better LZW solution that handles Unicode strings correctly at <a href="http://pieroxy.net/blog/pages/lz-string/index.html" rel="noreferrer">http://pieroxy.net/blog/pages/lz-string/index.html</a> (Thanks to pieroxy in the comments).</p> <hr> <p>I don't know of any gzip im...
<p>Most browsers can decompress gzip on the fly. That might be a better option than a javascript implementation.</p>
37,569
<p>I have a stored procedure that returns multiple tables. How can I execute and read both tables?</p> <p>I have something like this:</p> <pre> <code> SqlConnection conn = new SqlConnection(CONNECTION_STRING); SqlCommand cmd = new SqlCommand("sp_mult_tables",conn); cmd.CommandType = CommandType.StoredProcedure); IDa...
<p>Adapted from <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter(VS.71).aspx" rel="noreferrer">MSDN</a>:</p> <pre><code>using (SqlConnection conn = new SqlConnection(connection)) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand(query, ...
<p>If you want to read the results into a DataSet, you'd be better using a DataAdapter.</p> <p>But with a DataReader, first iterate through the first result set, then call NextResult to advance to the second result set.</p>
20,565
<p>My platform: Visual C# 2008 Express Edition with NUnit 2.2.7</p> <p>I have a solution with my code in one project and my NUnit unit tests in a different project in the same solution.</p> <p>I have been struggling hard to debug and single-step through the NUnit tests. I found some references online that suggested ...
<p>Since you're using an Express version of Visual Studio, you cannot use the free TestDriven.NET add-in. That's unfortunate, because that really is the best tool I've used to debug unit tests.</p> <p>The <code>Runner</code> class can be found in the <em>nunit-console-runner.dll</em> assembly, so be sure to add a refe...
<p>At my shop, we're doing it exactly as you do. On the downside, this means that setup might not be exactly as NUnit does it. On the upside, it is quite simple to do and allows one to create a minimal environment to reproduce the bug.</p>
34,597
<p>i've been tasked with re-organizing a pure HTML site into a CMS. if all goes well, the new site will eventually become the main URL, and the old domain will be phased out. the old domain has a decent enough page rank, and the company wishes to mitigate any loss of page rank for that. in looking over the options avai...
<p>If you really truly want to ensure that page rank is not lost, you will want to replace the old content with something that performs a proper 301 redirect to the new location. With a 301 redirect the search spiders will know that the content is moved and the page rank typically carries over. It also helps external...
<p>You can make a handler for HTML files and map the old pages to the new structure with a 301 redirect.</p>
23,405
<p>I have an linux app that uses cups for printing, but I've noticed that if I print and then quit my app right away my printout never appears. So I assume that my app has to wait for it to actually come out of the printer before quitting, so does anyone know how to tell when it's finished printing??</p> <p>I'm using ...
<p>As soon as your CUPS web interface (localhost:631) or some other thing to look at what CUPS sees shows you that CUPS received the job, you can quit the application.</p>
<p>Your app likely hadn't finished printing yet when you quit it. If you're using evince to print a PDF or other document, this is a known bug--there is no visual confirmation that the printing operation is underway. If the print job has been submitted, a printer icon will appear in your system tray until the actual ...
10,227
<p>In my application, originally built with Delphi 7, I use the SPHelpIntegration code to enable CHM help via the F1 interface. I figured that this wasn't needed in Delphi 2007, so I removed the units and built my app. I then press F1 and get a message that no help interface is installed. The online help doesn't tell m...
<p>Add HTMLHelpViewer to your uses clause to handle CHM files. There is an issue in using them is they must exist on the local system (not a network share) to view properly. There is a registry hack to change this behavior, but I have found it easier to just install the help files locally on the system. </p> <p>Lat...
<p>Yes, you need to <a href="http://www.helpscribble.com/delphi-bcb.html" rel="nofollow noreferrer">include a help viewer in the uses clause</a>.</p>
36,468
<p>I'm not sure how familiar people are with the hobbit monitoring system - <a href="http://hobbitmon.sourceforge.net/" rel="nofollow noreferrer">http://hobbitmon.sourceforge.net/</a> - but I've got a tricky question.</p> <p>I've got a custom test, which returns two NCV values. One value normally returns ~300 millisec...
<p>When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect that when this is part of a larger Expression, the expression interpreter will complain (which seems like what you are describing).</p> <p>However, I suspect that you might be able to break it down a bit...
<p>That worked like a charm. The SQL statment generated by <strong>CustomersWithActiveContracts</strong> looked fine to me.</p> <pre><code>{SELECT [t0].[CustomerID], [t0].[cFirstName], [t0].[cLastName] FROM [dbo].[Customers] AS [t0] WHERE (( SELECT COUNT(*) FROM [dbo].[Contracts] AS [t1] WHERE (([t1].[Con...
23,120
<p>In IIS 6, I can use the Web Service Extensions folder in Inetmgr to allow/prohibit isapi filters, such as ASP.net. I want to be able to do this programmatically (in particular, from an installer script/exe).</p> <p><img src="https://i56.photobucket.com/albums/g192/assaflavie/misc/iis.png?t=1222681203" alt="alt text...
<p>You should use the wonderful <a href="http://midimick.com/magicknet/" rel="nofollow noreferrer">ImageMagick</a> library. It has .NET bindings so no problem there.</p> <p>Have fun! :)</p>
<p>The way that springs to mind is using the Drawing packages to draw a rectangle over the picture in a given colour (you can set alpha). It's not very efficient but, with caching, it wouldn't do any harm, even on a busy server.</p>
17,844
<p>I'd like to bold the text for a tab page under certain conditions (not, necessarily, GotFocus). Is it true the only 'er easiest way to do this is by overriding the DrawItem event for the tab control?</p> <p><a href="http://www.vbforums.com/showthread.php?t=355093" rel="noreferrer">http://www.vbforums.com/showthrea...
<p>When you set the Font property on a TabPage, you are setting the default font for all controls on that tab page. You are not setting it for the header, however.</p> <p>When you execute the following code:</p> <pre><code>tabControl.TabPages(index).Font = New Font(Me.Font, FontStyle.Bold) </code></pre> <p>Any contr...
<pre class="lang-cs prettyprint-override"><code>private void tabControl1_DrawItem(object sender, DrawItemEventArgs e) { Font BoldFont = new Font(tabControl1.Font, FontStyle.Bold); e.Graphics.DrawString(tabControl1.TabPages[e.Index].Text, BoldFont, Brushes.Black, e.Bounds); } private void Form1_Paint(object sen...
21,785
<p>What is the best way to download all of the WSDL files exposed by a WCF service?</p> <p>For example, the root WSDL file references the following other WSDL files:</p> <pre><code>&lt;xsd:import schemaLocation="http://localhost:80/?xsd=xsd0" namespace="http://tempuri.com"/&gt; &lt;xsd:import schemaLocation="http://l...
<p>Meanwhile, disco.exe is considered obsolete technology by Microsoft.</p> <p>You can use <code>svcutil.exe /t:metadata</code> to achieve the same in the WCF age. Additional benefits are support for additional features, eg WS-Policy.</p> <p>Save schema from URL: </p> <p><code>svcutil /t:metadata http://host/pathto...
<p>There is a simple code snippet that makes it possible downloading a WSDL and all the belonging XSD files for offline use (for example for code generation).</p> <p><strong>Update</strong></p> <p>The blog where the code snippet was shown is not available anymore. Luckily, Pablo Diez created a small project based on ...
36,445
<p>What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as <code>:</code>? For example: </p> <ul> <li><code>this</code> - okay</li> <li><code>there:is</code> - not okay because of <code>:</code></li> </u...
<p>I'm still not sure whether you just wanted to detect if the Xpath contains a namespace, or whether you want to remove the references to the namespace. So here's some sample code (in C#) that does both.</p> <pre><code>class Program { static void Main(string[] args) { string withNamespace = @"//foo/ns...
<p>I dont know regex syntax very well but could you not do:</p> <p><code>[any alpha numeric]\*:[any alphanumeric]\*</code></p> <p>I think something like that should work no?</p>
3,140
<p>I am using Google Apps for domain to host the email from my domain and I've setup the MX records on my site according to the Google documentation. Can I also use a "sendmail" server to send additional emails from my webserver without there being a conflict with Google APPS?</p> <p>Specific questions: 1) I want to ...
<p>MX records only affect <em>receiving</em> mail. Off-site servers trying to send email to your domain use MX records to determine which host(s) to send the mail to. You can set up a sendmail host to <em>send</em> mail without it having any effect at all on your MX records or your receiving mail. (SPF records do af...
<blockquote> <p>Can I also use a "sendmail" server to send additional emails from my webserver without there being a conflict with Google APPS?</p> </blockquote> <p>Yes</p> <blockquote> <p>I want to add MX records for my sendmail server to my webhost to avoid getting mail sent from my sendmail server marked as SP...
45,730
<p>I have a webpage that pulls information from a database, converts it to .csv format, and writes the file to the HTTPResponse. </p> <pre><code>string csv = GetCSV(); Response.Clear(); Response.ContentType = "text/csv"; Response.Write(csv); </code></pre> <p>This works fine, and the file is sent to the client with n...
<p>I believe this will work for you.</p> <pre><code>Response.AddHeader("content-disposition", "attachment; filename=NewFileName.csv"); </code></pre>
<p>Add a "Content-Disposition" header with the value "attachment; filename=filename.csv".</p>
20,310
<p>How do I smooth 3D printed objects? What is the best / common method to do this?</p>
<p>From a general point of view, there are a few things to consider.</p> <p><strong>If you buy a kit</strong>:</p> <p>Pros:</p> <ul> <li>You get some insurance that <em>you have all the parts that you need</em> to get a functional printer - all the electronics, structure, bolts, nuts, screws, washers, wires and so o...
<p>Three great answers have already been posted, and it has been extremely interesting to read them. I shall try not to repeated what has already been said.</p> <p>I have sourced the parts <em>separately</em> for three different printers:</p> <ul> <li>P3Steel (the frame was a kit, mind: <a href="https://3dprinting.stac...
173
<p>I have the following code in one of my aspx pages:</p> <pre><code>&lt;% foreach (Dependency dep in this.Common.GetDependencies(this.Request.QueryString["Name"])) { %&gt; &lt;ctl:DependencyEditor DependencyKey='&lt;%= dep.Key %&gt;' runat="server" /&gt; &lt;% } %&gt; </code></pre> <p>When I run it, I get...
<p>The key property of the Dependency object may be a Guid, but is the DependencyKey Property of the DependencyEditor a Guid too? If not it should be, otherwise the correct TypeConverter won't be invoked upon assignment. </p> <p>If I'm not mistaken, you could also use dep.Key.ToString() also.</p>
<p>is your control taking the value and assuming its a GUID? Have you tried instantiating a GUID with the value? Looks like this is a cast problem</p>
21,040
<p>I'm writing an implementation of the XXTEA encryption algorithm that works on "streams", ie, can be used like: crypt mykey &lt; myfile > output.</p> <p>One of the requisites is that it doesn't have access to the file at all (it only reads an fixed size block until find an EOF). The algorithm needs that the data byt...
<p>Reading the question it looks like the security aspect of this is moot. Simply put, you have an api that expects a multiple of 4 bytes as input, which you dont always have.</p> <p>Appending up to 3 bytes onto any binary stream is dangerous if you can't make guarantees that the binary stream doesn't care. Appending ...
<p>Actually I would expect that a good stream cipher needs no padding at all. RC4 for example needs no padding and is is a very strong stream cipher. However, it can be attacked if the attacker can feed different chosen data to the encryption routine, that always uses the same key, and also has access to the encrypted ...
20,442
<p>I'm using code that I found on the <a href="http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx" rel="nofollow noreferrer">CodeProject.com for a low-level keyboard hook</a>. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thi...
<p><a href="http://www.artoftest.com/webaiifxproduct.aspx" rel="nofollow noreferrer">WebAii</a> can automate FireFox, including setting and retrieving the URL</p>
<p>One Microsoft tool I ran into:</p> <p>UI Automation, as part of .NET 3.5 <a href="http://msdn.microsoft.com/en-us/library/aa348551.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa348551.aspx</a></p> <p>Here's an example: <a href="http://msdn.microsoft.com/en-us/library/ms771286.aspx" rel=...
16,679
<p>What is the right way of initializing a static map? Do we need a static function that will initialize it? </p>
<p>Using C++11:</p> <pre><code>#include &lt;map&gt; using namespace std; map&lt;int, char&gt; m = {{1, 'a'}, {3, 'b'}, {5, 'c'}, {7, 'd'}}; </code></pre> <p>Using <a href="http://www.boost.org/doc/libs/1_36_0/libs/assign/doc/index.html" rel="noreferrer">Boost.Assign</a>:</p> <pre><code>#include &lt;map&gt; #include...
<p>You have some very good answers here, but I'm to me, it looks like a case of "when all you know is a hammer"...</p> <p>The simplest answer of to why there is no standard way to initialise a static map, is there is no good reason to ever use a static map... </p> <p>A map is a structure designed for fast lookup, of ...
16,787
<p>All numbers that divide evenly into x.</p> <p>I put in 4 it returns: 4, 2, 1</p> <p>edit: I know it sounds homeworky. I'm writing a little app to populate some product tables with semi random test data. Two of the properties are ItemMaximum and Item Multiplier. I need to make sure that the multiplier does not c...
<p>pseudocode:</p> <ul> <li>Loop from 1 to the square root of the number, call the index &quot;i&quot;.</li> <li>if number mod i is 0, add i and number / i to the list of factors.</li> </ul> <p>realocode:</p> <pre><code>public List&lt;int&gt; Factor(int number) { var factors = new List&lt;int&gt;(); int max = ...
<p>Linq solution:</p> <pre><code>IEnumerable&lt;int&gt; GetFactors(int n) { Debug.Assert(n &gt;= 1); return from i in Enumerable.Range(1, n) where n % i == 0 select i; } </code></pre>
29,687
<p>What is the C# equivalent to the sql server 2005 real type?</p>
<p>it is a Single</p> <p>see <a href="http://msdn.microsoft.com/en-us/library/ms131092.aspx" rel="noreferrer">here</a> for more info on SQL Server to .Net DataTypes</p>
<p>in my project (acces -> firebird and ms sql -> c#) is real defined like single precission float point number...so I used float and everything is OK</p>
15,751
<p>I am using the ASP.NET <strong>Client-Side</strong> ajax control toolkit in my asp.net MVC application. I see that there is a .js file named "AjaxControlToolkit.ModalPopup.ModalPopupBehavior.js" in the AjaxControlToolkit folder. However, I cannot find any examples on how to use it.<br /><br /> [Edit] - As mentioned,...
<p>Yestarday I had the same need to use the popup extender and here are the js files which you should include first.</p> <pre><code>&lt;script src="javascripts/MicrosoftAjax.js" type="text/javascript" &gt;&lt;/script&gt; &lt;script src="javascripts/AjaxControlToolkit/AjaxControlToolkit.Compat.Timer.Timer.js" type="tex...
<p>Check out the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx" rel="nofollow noreferrer">AJAX Toolkit samples</a>. There are live demos, walkthroughs and documentation.</p>
39,082
<p>I have to read a binary file in a legacy format with Java. </p> <p>In a nutshell the file has a header consisting of several integers, bytes and fixed-length char arrays, followed by a list of records which also consist of integers and chars.</p> <p>In any other language I would create <code>struct</code>s (C/C++)...
<p>To my knowledge, Java forces you to read a file as bytes rather than being able to block read. If you were serializing Java objects, it'd be a different story.</p> <p>The other examples shown use the <a href="http://java.sun.com/javase/6/docs/api/java/io/DataInputStream.html" rel="noreferrer">DataInputStream</a> ...
<p>In the past I used DataInputStream to read data of arbitrary types in a specified order. This will not allow you to easily account for big-endian/little-endian issues.</p> <p>As of 1.4 the java.nio.Buffer family might be the way to go, but it seems that the your code might actually be more complicated. These clas...
35,087
<p>I want to import an oracle dump into a different tablespace.</p> <p>I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command</p> <blockquote> <p>exp a/*** owner=a file=oracledump.DMP log=log.log compress=y</p> </bl...
<p>You've got a couple of issues here.</p> <p><strong>Firstly</strong>, the different versions of Oracle you're using is the reason for the table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files betwe...
<p>---Create new tablespace:</p> <p>CREATE TABLESPACE TABLESPACENAME DATAFILE 'D:\ORACL\ORADATA\XE\TABLESPACEFILENAME.DBF' SIZE 350M AUTOEXTEND ON NEXT 2500M MAXSIZE UNLIMITED LOGGING PERMANENT EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT MANUAL FLASHBACK ON;</p> <p>---and then import...
8,730
<p>I noticed foot arches are already digitized, but custom arch supports are usually expensive. PLA and ABS aren't the best material for printing arch supports, especially if they replace the shoe's innersole. </p> <p>Is there a more flexible material for 3D printing that could be used for making custom orthotics?</p...
<p>The standard choice for this would be TPU, <a href="https://en.wikipedia.org/wiki/Thermoplastic_polyurethane" rel="nofollow noreferrer">thermoplastic polyurethane</a>.</p> <blockquote> <p>TPU is a common filament material for use in fused filament fabrication 3D printing due to the fact that it is an elastic thermop...
<p>Armadillo by Ninjatek is perfect with 100&nbsp;% infill and 6 layers 6 walls and 6 the other thing? As a foot pharmacist I can say the cost is associated with the education as pedorthic modalities are different to each person. Ideally it would be easy to 3D print arch supports, but it would also be easy to "hurt" ...
1,346
<p>How does Z offset (<code>M851</code>) work with an auto leveling sensor? Does it add the Z offset to the offset of the <code>G29</code> mesh? or the <code>G29</code> value replaces the <code>M851</code>?</p> <p>My printer is an Anet A8 with Marlin firmware, I was having issues with the autoleveling sensor and reset ...
<p><code>G28</code> instructs the printer to home itself to the X an Y endstops and the Z sensor determines the homing of the Z axis; i.e. when the sensor triggers, this is not necessarily (and most commonly) not the position where the nozzle is at Z=0.</p> <p><code>G29</code> determines the shape of the bed by probing...
<p>You must use the sequence </p> <pre><code>G28 G29 </code></pre> <p>If you do <code>G28</code> after <code>G29</code> it will reset bed leveling. I guess you don't want that.</p> <p>On my printer deployed z-probe falls 2.3&nbsp;mm lower than nozzle. In printer settings I've therefore stored static Z-offset of -2.3...
882
<p>I have a question that I may be over thinking at this point but here goes...</p> <p>I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups are private -- users will need au...
<pre><code>&lt;style type="text/css"&gt; #watermark { color: #d0d0d0; font-size: 200pt; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); position: absolute; width: 100%; height: 100%; margin: 0; z-index: -1; left:-100px; top:-200px; } &lt;/style&gt; </code></pre> <p>This lets yo...
<p>You could make an image with the watermark and then set the image as the background via css.</p> <p>For example:</p> <pre><code>&lt;style type="text/css"&gt; .watermark{background:url(urltoimage.png);} &lt;/style&gt; &lt;div class="watermark"&gt; &lt;p&gt;this is some text with the watermark as the background.&lt;...
9,408
<p>I use a home-grown system where the application updates itself from a web service. However, I seem to remember something in the original .NET sales pitch about auto-updating of components being a built-in feature of .NET. What are the best practices for having an application update itself and/or the assemblies it ...
<p>You may want to take a look at the Click-Once technology. Some great examples in these references.</p> <p><a href="http://www.codeproject.com/KB/install/QuickClickOnceArticle.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/install/QuickClickOnceArticle.aspx</a></p> <p><a href="http://msdn.microsoft.c...
<p>Will <a href="http://msdn.microsoft.com/en-us/library/142dbbz4.aspx" rel="nofollow noreferrer">ClickOnce</a> do everything you want?</p>
18,197
<p>I have a long running series of operations in a .NET 2.0 <code>BackgroundWorker</code> thread. When I make a call to unmanaged code located in a referenced assembly the UI is frozen until the call completes.</p> <p>Why is this? Should I not be making these calls from the <code>BackgroundWorker</code> thread?</p> ...
<p>You've got the COM tag in the question - are you calling into a COM component? Is it an STA component? If so, it may well be marshalling back to do its work on the UI thread somehow. I'll readily admit I'm a long way from being an expert on COM stuff, but I wouldn't be surprised if that were the problem.</p> <p>Wha...
<p>Yes and also, does this happen with all unmanaged code or just a specific component or API? If a specific one, what is that unmanaged code doing?</p>
35,898
<p>This is probably one of those easy questions.. I'm trying to redirect the user after they've successfully authenticated, or return them back to the login page. But the Success page is on a different route and I can't get the redirection to work..</p> <p>Here are my routes in Globals.asax:</p> <pre><code>routes.Ma...
<p>Could it be that your Stuff route has exactly the same form as the default one, so when you call</p> <pre><code>Return RedirectToRoute("Stuff"); </code></pre> <p>the resulting url has the form: {controller}/{action}/{id}, e.g. Login/Authenticate again, since you are inside Login-controller's Authenticate action.</...
<p>I fail to see where you are setting the authentication cookie or marking the user as having been authenticated in any way. Is that in the code that you have omitted?</p>
29,437
<p>I've seen quite a few posts on changes in .NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running .NET 3.5 RTM).</p> <pre><code>[XmlRoot("foo")] public cla...
<p>In SP1 does the foo.Bar property get properly deserialized?</p> <p>In pre SP1 you wouldn't be able to deserialize the object because the set method of the Bar property is private so the XmlSerializer doesn't have a way to set that value. I'm not sure how SP1 is pulling it off.</p> <p>You could try adding this to ...
<p>I rather like this new (?) behavior because the XML document doesn't have any mention of Bar in it, so the deserializer should not even be attempting to set it.</p>
5,532
<p>If you had to make a case to a business about adopting or moving to an agile development methodology (like SCRUM or XP etc) what case would you make (how do you sell the concept)? </p> <p>e.g. <li>How would you describe the concepts and benefits to a non-technical person?</li> <li>If you have successfully done so...
<p>Non-technical people are interested in projects done on time and within budget with good quality and which would satisfy their requirements at the time of the delivery. You should focus on how Agile helps to deliver those qualities.</p> <hr> <p>It's sometimes quite difficult to sell Agile to a non-technical person...
<p>In my experience, the one thing that instantly sells Scrum to non-technical management is the burndown chart. The idea that there is a paper chart - available for all to see and readily understand - that shows daily progress is an instant winner. It clearly shows very early on whether a project is on schedule.</p> ...
24,481
<p>I'm currently trying to read in an XML file, make some minor changes (alter the value of some attributes), and write it back out again.</p> <p>I have intended to use a StAX parser (<code>javax.xml.stream.XMLStreamReader</code>) to read in each event, see if it was one I wanted to change, and then pass it straight o...
<p>StAX works pretty well and is very fast. I used it in a project to parse XML files which are up to 20MB. I don't have a thorough analysis, but it was definitely faster than SAX. </p> <p>As for your question: The difference between streaming and event-handling, AFAIK is control. With the streaming API you can walk t...
<p>After a bit of mucking around, the answer seems to be to use the Event reader/writer versions rather than the Stream versions.</p> <p>(i.e. javax.xml.stream.XMLEventReader and javax.xml.stream.XMLEventWriter)</p> <p>See also <a href="http://www.devx.com/tips/Tip/37795" rel="nofollow noreferrer">http://www.devx.com...
3,177
<p>I've encountered a very strange bug in VBA and wondered if anyone could shed some light?</p> <p>I'm calling a worksheet function like this: </p> <pre><code>Dim lMyRow As Long lMyRow = WorksheetFunction.Match(vItemID, rngMyRange.Columns(1), 0) </code></pre> <p>This is intended to get the row of the item I pass in...
<p>The only difference between the immediate window and normal code run is the scope. Code in the immediate window runs in the current application scope. If nothing is currently running this means a global scope. The code when put in a VBA function is restricted to the function scope.</p> <p>So my guess is that one of...
<p>I cannot reproduce the problem with Excel 2007.</p> <p>This was the code I used:</p> <pre><code>Sub test() Dim vItemID As Variant Dim lMyRow As Long Dim rngMyRange As Range Set rngMyRange = ActiveWorkbook.Sheets(1).Range("A1:Z256") vItemID = 8 lMyRow = WorksheetFunction.Match(vItemID, rngMyRange.Col...
45,580
<p>Given a string of keywords, such as "Python best practices", I would like to obtain the first 10 Stack Overflow questions that contain that keywords, sorted by relevance (?), say from a Python script. My goal is to end up with a list of tuples (title, URL).</p> <p>How can I accomplish this? Would you consider query...
<pre><code>&gt;&gt;&gt; from urllib import urlencode &gt;&gt;&gt; params = urlencode({'q': 'python best practices', 'sort': 'relevance'}) &gt;&gt;&gt; params 'q=python+best+practices&amp;sort=relevance' &gt;&gt;&gt; from urllib2 import urlopen &gt;&gt;&gt; html = urlopen("http://stackoverflow.com/search?%s" % params).r...
<p>I would just use Pycurl to concatenate the search terms onto the query uri.</p>
23,909
<p>Does anyone know if it's possible to setup dev/random when running the OS within a VM (VMWare in this case)?</p>
<p>What do you mean by "setup"? /dev/random will be available in the VM, and work just fine.</p>
<p>Tis is not an answer but a workaround: When I had the same problem I generated the keys on a physical machine and copied it.</p>
33,294
<p>I have a basic ajax application, which will not work, instead the php code is displayed in the browser. The javascript and html seem fine. I have copied the code verbatim from here:</p> <p><a href="http://arief.aeroven.com/2008/07/30/first-ajax-script-tutorial-connecting-ajax-contain-pure-htmlphpand-javascript-to-m...
<p>Perhaps you don't have php short tags enabled? The full php on tag is <code>"&lt;?php"</code> Is the file extension one that is setup to be parsed by php?</p>
<p>I would bet on the short tags being the issue</p>
37,816
<p>There are several topics about what questions will be raised in an interview for a programming job, but none actually talk about a small problem that some companies want: an example program.</p> <p>My question is based on my last job application, where I've been asked to <strong>create a simple program</strong> an...
<p>Use the opportunity to show them you know how to treat a client. Start a conversation on what is important, how do they want it delivered, what is the timeline, would they want a documentation and so on.</p> <p>If they don't want to give you any particular problem to solve, try to write a program related to the dom...
<p>Simple programs that would be my suggestion:</p> <p>1) Look at the example given in Refactoring about a movie rental example involving customers, movies and rentals that one could specify out to some length to show what they can do.</p> <p>2) FizzBuzz is another simple program idea that is talked about in various ...
39,655
<p>I'm quite new to programming, and I was wondering if there is a good source of well-programmed non-standard C code and libraries.</p> <p>I Googled and didn't find anything. I was a bit surprised by this, especially because I used to search for many Python examples and libraries and never had trouble finding anythi...
<p>there is no "centralized" source for C libraries... at least nothing along the lines of CPAN for Perl or the Python Package Index for Python.</p> <p>Since C is sort of the "default" language for systems programming, it's often unstated that libraries are written for C. You may want to try Freshmeat.net's <a href="...
<p>You might also consider the book <a href="http://www.nr.com/" rel="nofollow noreferrer">Numerical Recipes in C++</a> or the older Numerical Recipes in C (it might be out of print, though), depending on your algorithmic needs.</p> <p>[EDIT] I didn't originally see this, but I found a link to the older book <a href="...
25,902
<p>I have 150+ SQL queries in separate text files that I need to analyze (just the actual SQL code, not the data results) in order to identify all column names and table names used. Preferably with the number of times each column and table makes an appearance. Writing a brand new SQL parsing program is trickier than is...
<p>I actually ended up using a tool called <a href="http://www.dpriver.com/pp/sqlformat.htm" rel="noreferrer">SQL Pretty Printer</a>. You can purchase a desktop version, but I just used the free online application. Just copy the query into the text box, set the Output to "List DB Object" and click the Format SQL butto...
<p>Please go with antlr... Write a grammar n follow the steps..which is given in antlr site..eventually you will get AST(abstract syntax tree). For the given query... we can traverse through this and bring all table ,column which is present in the query..</p>
8,069
<p>OK, this might sound a bit confusing and complicated, so bear with me.</p> <p>We've written a framework that allows us to define friendly URLs. If you surf to any arbitrary URL, IIS tries to display a 404 error (or, in some cases, 403;14 or 405). However, IIS is set up so that anything directed to those specific er...
<p>Microsoft released a hotfix for this : </p> <p><a href="http://support.microsoft.com/default.aspx/kb/956578" rel="nofollow noreferrer"><a href="http://support.microsoft.com/default.aspx/kb/956578" rel="nofollow noreferrer">http://support.microsoft.com/default.aspx/kb/956578</a></a></p>
<p>Just a guess: the handler specified in IIS7's %windir%\system32\inetsrv\config\applicationhost.config which is handling your request is not allowing the POST verb to get through at all, and it is evaluating that rule before determining whether the URL doesn't exist.</p>
12,844
<p>Is there a way to substring in JSP files, using struts2 technologies? I mean, struts2 has its own taglib and also uses ognl. How can I get a substring from a stacked value or bean value?</p>
<p><a href="http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html" rel="nofollow noreferrer">http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html</a></p> <p>Look for fn:substring and its variants.</p> <p>I've used Struts 1, but not 2.</p>
<p>Watch out for the functions library in certain situations, especially when using Websphere to deploy! The company I work for deploys to Websphere 6.0 version 11, which does not support the functions library properly (it does not function properly when placed inside a tag body). I remember somewhere that they fixed...
9,044
<p>How do I dump the data, and only the data, not the schema, of some SQLite3 tables of a database (not all the tables)? The dump should be in SQL format, as it should be easily re-entered into the database later and should be done from the command line. Something like</p> <pre><code>sqlite3 db .dump </code></pre> <p...
<p>You're not saying what you wish to do with the dumped file.</p> <p>To get a CSV file (which can be imported into almost everything)</p> <pre><code>.mode csv -- use '.separator SOME_STRING' for something other than a comma. .headers on .out file.csv select * from MyTable; </code></pre> <p>To get an SQL file (which...
<p>You could do a select on the tables inserting commas after each field to produce a csv, or use a GUI tool to return all the data and save it to a csv.</p>
10,126
<p>I am trying to monitor a tcp flow using flow monitor. attach-fmon wants link object which is not available in wireless connections. How can I solve this problem ? Are there any other solutions ?</p> <p>My code is here <a href="http://pastebin.com/f59241692" rel="nofollow noreferrer">http://pastebin.com/f59241692</a...
<p>Wireshark (<a href="http://wireshark.org" rel="nofollow">http://wireshark.org</a>) replaced ethereal in 2006, and is a free, open-source network protocol analyser. It can capture, and analyse data from pretty much any network interface, and will allow you to filter on the communication path of interest by filtering ...
<p><a href="http://www.ethereal.com/" rel="nofollow noreferrer">Ethereal</a> is an open source network protocol analyzer. It should be able to analyze and display the communication flow of your application.</p>
33,343
<p>My users are having an intermittent error when using a Windows Forms application built in VB.NET 3.5. Apparently when they click on the form and the form re-paints, a red 'X' will be painted over the MenuStrip control and the app will crash with the following error. </p> <p>Has anyone seen this before? Can someone ...
<p>First rule of working with Visual Studio:</p> <ul> <li><strong>Install <a href="http://www.jetbrains.com/resharper/" rel="noreferrer">ReSharper</a></strong></li> </ul>
<p>I have a tip regarding the "Track Active Item" option mentioned above, for when working with big projects. It's posted here:</p> <p><a href="https://stackoverflow.com/questions/31163/forcing-the-solution-explorer-to-select-the-file-in-the-editor-in-visual-studio#46193">Forcing the Solution Explorer to select the fi...
6,794
<p>I am using ubuntu 8.04 and windows xp. I mount the fat32 disk which contains eclipse workspace to ubuntu. but I find I could not use the workspace, maybe I have no right to use it.</p> <p>the fat32 disk I mounted has the 755 right,I try to use chmod to change it to 777 but failed. I try to mount it to 777 mode, but...
<p>Instead of trying to share the raw workspace data between two different systems, I suggest to do it like in typical big software development projects. Use a version control system to store your code and commit/update to and from that version control system instead of sharing files.</p> <p>This may not be the answer...
<p>I agree with <em>bananeweizen.myopenid</em>, and have the following tip to add:</p> <p>When creating your build path entries, reference all outside resources (eg, jarfiles) using classpath variables. This will allow you to move the .classpath file between environments (or even check it into source control, <em>if y...
44,296
<p>I'm wanting a method called same_url? that will return true if the passed in URLs are equal. The passed in URLs might be either params options hash or strings.</p> <pre><code>same_url?({:controller =&gt; :foo, :action =&gt; :bar}, "http://www.example.com/foo/bar") # =&gt; true </code></pre> <p>The Rails Framework ...
<p>Here's the method (bung it in /lib and require it in environment.rb):</p> <pre><code>def same_page?(a, b, params_to_exclude = {}) if a.respond_to?(:except) &amp;&amp; b.respond_to?(:except) url_for(a.except(params_to_exclude)) == url_for(b.except(params_to_exclude)) else url_for(a) == url_for(b) end e...
<pre><code>def all_urls_same_as_current? *params_for_urls params_for_urls.map do |a_url_hash| url_for a_url_hash.except(*exclude_keys) end.all? do |a_url_str| a_url_str == request.request_uri end end </code></pre> <p>Wherein:</p> <ul> <li><code>params_for_urls</code> is an array of hashes of url parame...
15,365
<p>Occasionally while attempting to save a Crystal Report that I'm working on in VS2008, a dialog titled "File Save Failed" pops up saying "The document could not be saved in C:\Users\Phillip\AppData\Local\Temp{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.rpt. It has been saved in C:\Users\Phillip\AppData\Local\Temp\~zzz{YYY...
<p>Copernic Desktop Search sometimes locks files so that they can't be written. Closing the program resolves the problem. Perhaps the same problem occurs with other search engines too.</p>
<p>sounds like a job for process moniter. you should be able use process moniter to see what's really hapening and why. </p> <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx</a></p> <p>Or you could insta...
5,085
<p>I have a table of 155K records. I can scroll only 65K records in combo box of a form having recordsource with query or sql, selecting three fields from that table. Why it does not list all 155K records even the query, which I am using as recordsource, shows all records outside of the form.</p>
<p>perhaps the item index is a 16-bit integer</p> <p>a better question would be, do you really expect the user to scroll through 155 thousand items in a combobox?</p>
<p>65536 is indeed the limit for the number of combobox items.</p> <p>I would suggest using a text box with a search button to find someone from the list rather than using a combo box in this case.</p> <p>As alternative you could load the items dynamically dependent from the text inserted.</p> <p>You could also try ...
35,259
<p>FxCops is something new to me, but as always I would like to get to know the new things.. From what I've read, FxCops is already included in VS2008. I guess it's the "Code Analysis" function. Whenever I try to run it though, it seems to start a rebuild and end in the "Finished Rebuilding" state.<br> I checked the ou...
<p>Yes, Code Analysis is the nice friendly name for FxCop. However, I'm not aware of a friendly window beyond the errors / warning list where they should appear, prefixed <code>CA</code>. </p> <p>On the project properties screen there is a Code analysis tab where you can treat warnings as errors to enforce the rules y...
<p>An alternative to FxCop would be to use the tool NDepend that lets write <a href="http://www.ndepend.com/Features.aspx#CQL" rel="nofollow noreferrer">Code Rules over C# LINQ Queries (namely CQLinq)</a>. NDepend is integrated in VS 2012, 2010 and 2008. <em>Disclaimer: I am one of the developers of the tool</em></p> ...
49,404
<p>Per man pages, snprintf is returning number of bytes written from glibc version 2.2 onwards. But on lower versions of libc2.2 and HP-UX, it returns a positive integer, which could lead to a buffer overflow.</p> <p>How can one overcome this and write portable code?</p> <p>Edit : For want of more clarity</p> <p>Thi...
<p>you could create a snprintf wrapper that returns -1 for each case when there is not enough space in the buffer.</p> <p>See the <a href="http://linux.die.net/man/3/snprintf" rel="nofollow noreferrer">man page</a> for more docs. It has also an example which threats all the cases.</p> <pre><code> while (1) { /...
<p>I have found one portable way to predict and/or limit the number of characters returned by sprintf and related functions, but it's inefficient and many consider it inelegant.</p> <p>What you do is create a temporary file with tmpfile(), fprintf() to that (which reliably returns the number of bytes written), then re...
12,620
<p>I have two databases, one is an MS Access file, the other is a SQL Server database. I need to create a SELECT command that filters data from the SQL Server database based on the data in the Access database. What is the best way to accomplish this with ADO.NET?</p> <p>Can I pull the required data from each database ...
<p>You don't want to pull both datasets across if you don't have to do that. You are also going to have trouble implementing Tomalak's solution since the file location may change and might not even be readily available to the server itself.</p> <p>My guess is that your users set up an Access database with the people/p...
<p>First you need to do something on the server - reference the Access DB as a "Linked Server".</p> <p>Then you will be able to query it from within the SQL server, pulling out or stuffing in data however you like. This web page gives a nice overview on how to do it.</p> <p><a href="http://blogs.meetandplay.com/WTilt...
29,706
<p>I'm using django and when users go to www.website.com/ I want to point them to the index view.</p> <p>Right now I'm doing this:</p> <pre><code>(r'^$', 'ideas.idea.views.index'), </code></pre> <p>However, it's not working. I'm assuming my regular expression is wrong. Can anyone help me out? I've looked at python r...
<p>What you have should work (it does for me). Make sure it's in the top <code>urls.py</code>, and it should also be at the top of the list.</p>
<p>Is there any way you can just use a generic view and go straight to template for your index page?:</p> <pre><code>urlpatterns += patterns('django.views.generic.simple', (r'', 'direct_to_template', {'template': 'index.html'}), ) </code></pre>
37,604
<p><strong>The Situation</strong></p> <p>I have an area of the screen that can be shown and hidden via JavaScript (something like "show/hide advanced search options"). Inside this area there are form elements (select, checkbox, etc). For users using assistive technology like a screen-reader (in this case JAWS), we nee...
<p>Give items the aria-hidden="true" attribute, and it should be hidden from the screenreader.</p>
<p>Did you try this?</p> <pre><code>&lt;div id="placeholder" style="display:none;"&gt; &lt;select title="Month" style="speak:none;"&gt; &lt;option&gt;January&lt;/option&gt; &lt;option&gt;February&lt;/option&gt; ... &lt;/select&gt; &lt;/div&gt; </code></pre> <p>This has worked for me in the past when I...
30,207
<p>When I call</p> <pre><code>help(Mod.Cls.f) </code></pre> <p>(Mod is a C extension module), I get the output</p> <pre>Help on method_descriptor: f(...) doc_string</pre> <p>What do I need to do so that the help output is of the form</p> <pre>Help on method f in module Mod: f(x, y, z) doc_string</pre> <...
<p>You cannot. The inspect module, which is what 'pydoc' and 'help()' use, has no way of figuring out what the exact signature of a C function is. The best you can do is what the builtin functions do: include the signature in the first line of the docstring:</p> <pre><code>&gt;&gt;&gt; help(range) Help on built-in fun...
<p>Thomas's answer is right on, of course.</p> <p>I would simply add that many C extension modules have a Python "wrapper" around them so that they can support standard function signatures and other dynamic-language features (such as the descriptor protocol).</p>
18,490
<p>I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authentication so you don't ever need a passw...
<p>These are usually referred to as client side certificates.</p> <p>I've not actually used it but a modified version of restful-authentication can be found here <a href="http://github.com/labria/restful-authentication/tree/master" rel="noreferrer">here</a> that looks like what your after.</p> <p>I found this via <a ...
<p>I've been working on a solution to this problem. I wanted to do the same thing and I know lots of other website owners want this feature, with or without a third party provider. </p> <p>I created the necessary server setup and a firefox plugin to handle the certificate-based authentication. Go to mypassfree.com ...
4,822
<p>What's the best way to convert NetBeans (Matisse) .form files into .java files, without using the NetBeans IDE itself? Ideally I'd like to package the .form files along with my source code, and generate the .java files at build time. This will prevent developers from "accidentally" adding code to the generated .java...
<p>Well, actually having to fight with "accidental" addition of codes is more a problem of process rather than a problem with technology. My steps would be:</p> <ol> <li>Prevent committing the generated .java files in the CVS/SVN repository </li> <li>Embed matisse form generation in a continuous integration project. <...
<ul> <li>Copy the code from <em>Netbeans</em> and paste it into <em>JCREATOR</em>.</li> <li>save the file.</li> <li>if it requires any name then write the name of your class which you make in <em>Netbean</em>.</li> <li>save it.</li> <li>run the code in <em>JCREATOR</em>.</li> <li>automatically it convert your file to <...
33,060
<p>I'm importing Brazilian stock market data to a SQL Server database. Right now I have a table with price information from three kind of assets: stocks, options and forwards. I'm still in 2006 data and the table has over half million records. I have more 12 years of data to import so the table will exceed a million re...
<ol> <li>At 1 million records, I wouldn't consider this a particularly large table needing unusual optimization techniques such as splitting the table up, denormalizing, etc. But those decisions will come when you've tried all the normal means that don't affect your ability to use standard query techniques.</li> </ol> ...
<p>The execution plan shows it's using the clustered index quite fine, but I forgot an extremely important fact, I'm still inserting data! The insert is probably locking the table too often. There is a way we can see this bottleneck? </p> <p>The execution plan doesn't seems to show anything about lock issues. </p> <p...
43,830
<p>I have a website laid out in tables. (a long mortgage form)</p> <p>in each table cell is one HTML object. (text box, radio buttons, etc)</p> <p>What can I do so when each table cell is "tabbed" into it highlights the cell with a very light red (not to be obtrusive, but tell the user where they are)?</p>
<p>Use jQuery to make your life easier, and you can do something like this:</p> <pre><code>$('#mytableid input').focus( function() { $(this).addClass('highlight'); }).blur( function() { $(this).removeClass('highlight'); }); </code></pre> <p>This is basically saying when any input element in your table is u...
<p>Possibly:</p> <pre><code>&lt;script type="text/javascript"&gt; //getParent(startElement,"tagName"); function getParent(elm,tN){ var parElm = elm.parentNode; while(parElm.tagName.toLowerCase() != tN.toLowerCase()) parElm = parElm.parentNode; return parElm; } &lt;/script&gt; &lt;tr&gt;&lt;td&gt;&lt;input t...
18,156
<p>How do I best convert a System.Data.DbType enumeration value to the corresponding (or at least one of the possible corresponding) System.Type values?</p> <p>For example:</p> <pre><code>DbType.StringFixedLength -&gt; System.String DbType.String -&gt; System.String DbType.Int32 -&gt; System.Int32 </code></pre> <p>...
<p>AFAIK there is no built-in converter in .NET for converting a SqlDbType to a System.Type. But knowing the mapping you can easily roll your own converter ranging from a simple dictionary to more advanced (XML based for extensability) solutions.</p> <p>The mapping can be found here: <a href="http://www.carlprothman.n...
<p>System.Data.SqlClient objects use the MetaType component to translate DbType and SqlDbType to .NET CLR Types. Using reflection, you could leverage this ability if needed:</p> <pre><code>var dbType = DbType.Currency; Type metaClrType = Type.GetType( "System.Data.SqlClient.MetaType, System.Data, Version=4.0.0.0...
11,648
<p>A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array,...
<p>This should do it:</p> <pre><code>&lt;?php function array_depth(array $array) { $max_depth = 1; foreach ($array as $value) { if (is_array($value)) { $depth = array_depth($value) + 1; if ($depth &gt; $max_depth) { $max_depth = $depth; } }...
<p>A quicker way: </p> <pre><code>max(array_map('count', $array)); </code></pre>
32,906
<p>I am trying to design a 4-bit adder subtracter in verilog. This is only the second thing I have ever written in verilog, and I don't know all the correct syntax yet. This is the module I have so far:</p> <pre><code>module Question3(carryin, X, Y, Z, S, carryout, overflow); parameter n = 4; input carryin, Z;...
<pre><code>reg [n-1:0] Y_compl; always @( Z, Y, X, carryin ) begin Y_ = ( ~Y + 4'b0001 ); if ( Z == 1'b0 ) begin {carryout, S} = X + Y_compl + carryin; overflow = carryout ^ X[n-1] ^ Y_compl[n-1] ^ S[n-1]; end else begin {carryout, S} = X + Y + carryin; overflow = carryout ^ X[n-1] ^ Y[n-1] ^ S...
<p>put the if statement within an initial block<br> <a href="http://www.asic-world.com/verilog/vbehave1.html" rel="nofollow noreferrer">http://www.asic-world.com/verilog/vbehave1.html</a></p>
29,550
<p>I'm investigating the differences between using log4net and <code>System.Diagnostics.Trace</code> for logging, and I'm curious about the performance differences I've observed.</p> <p>I created a test application to compare the performance of both logging methods in several scenarios, and I'm finding that log4net is...
<p>yes log4xxx is slower than trace, since trace is normally a near kernel tool, while log4xxx is a much more powerful tool. Personally I prefer log4xxx because of it's fexibility, but if you want something that doesn't impact as much, and you don't really need logs for production,say in debug only trace should be enou...
<p>Have just run a test comparing sequental writing to a simple file compared to using Log4Net for the same task.Log4Net is about 400 times slower comparet to a StreamWriter.So <strong>I consider Log4Net not usable if You are writing to huge logfiles</strong>. But I find it <strong>very usefull for small amounts of log...
24,581
<p>The ampoule project uses some tags in docstring, like the javadoc ones. </p> <p>For example from <a href="http://bazaar.launchpad.net/~dialtone/ampoule/main/annotate/26?file_id=pool.py-20080501191749-jqawtxogk4i0quu3-12" rel="noreferrer">pool.py</a> line 86:</p> <pre><code>def start(self, ampChild=None): """ ...
<p>Markup for a documentation tool, probably <a href="http://epydoc.sourceforge.net/" rel="noreferrer">epydoc</a>.</p>
<p>Just for fun I'll note that the Python standard library is using Sphinx/reStructuredText, whose <a href="http://sphinx-doc.org/domains.html" rel="nofollow noreferrer">info field lists</a> are similar.</p> <pre><code>def start(self, ampChild=None): """Starts the ProcessPool with a given child protocol. :par...
49,698
<p>I am using ASP.NET ajax to dynamically add/remove controls from a page without using full postbacks. The UI is very complicated. Under certain scenarios, when a control on the page causes a full postback, after changing the controls via async postbacks, I get this error:</p> <p><a href="https://stackoverflow.com/...
<p>If you have a WYSIWYG input text box or a textbox expecting HTML, then you have to disable validation or do some JavaScript hack.</p> <p>The catch is that you will need to provide thorough validation to prevent XSS and such.</p>
<p>It may not directly answer your question, or seem relevant...</p> <p>However, if your UI is very complicated, there's probably something wrong with it. Following KISS is a good idea for obvious reasons.</p> <p>If your UI is complicated, then the chances are you don't understand it, so you'll get more problems, al...
45,590
<p>Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with...
<p>You have to manually do this generating .resources from LocBaml and then merging the Resx and BAML resources using the Assembly linker. </p> <p>The process looks something like this:</p> <pre><code>LocBaml.exe /generate ..\obj\WpfLocalization.g.en-US.resources /trans:Res\de.csv /out:de /culture:de RE...
<p>Googled around a bit and found this page describing a few ways to use LocBaml which iuncludes a very detailed descripion on how to merge the resources.resx and locbaml generated resources into a single file (using al.exe). </p> <p><a href="http://www.codeproject.com/KB/WPF/WPFUsingLocbaml.aspx#link_29" rel="nofollo...
35,114
<p>I am currently creating a master ddl for our database. Historically we have used backup/restore to version our database, and not maintained any ddl scripts. The schema is quite large.</p> <p>My current thinking:</p> <ul> <li><p>Break script into parts (possibly in separate scripts):</p> <ol> <li>table creation<...
<p>I think the basic idea is good. </p> <p>The nice thing about building all the tables first and then building all the constraints, is that the tables can be created in any order. When I've done this I had one file per table, which I put in a directory called "Tables" and then a script which executed all the files ...
<p>I previously organised my DDL code organised by one file per entity and made a tool that combined this into a single DDL script.</p> <p>My former employer used a scheme where all table DDL was in one file (stored in oracle syntax), indicies in another, constraints in a third and static data in a fourth. A change sc...
2,697