instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am trying to write a test which, in it's fixtures Setup, it backs up a file and deletes the original, runs the test without the original present, then in the teardown, restores the original from the backup. The file is located in my %ProgramFiles% folder. I get an UnauthorizedAccessException on the fileInfo.Dele...
<p>Not really a solution, but I'd consider fixing this problem from a different angle.</p> <p>You could perhaps consider changing the directory to %AppData% (you might need to make this change for you main application also).</p> <p>It might solve your problem and also will see you well when you move to Vista, since U...
<p>It is possible that ReSharper is running its Test Runner as a separate process, and that separate process is not using your Windows identity but, instead, another one with lower privileges.</p> <p>You might be able to verify this opening Task Manager and checking Show processes from all users.</p>
12,527
<p>I'm using CodeSynthesis XSD C++/Tree Mapping utility to convert an existing xsd into c++ code we can populate the values in. This was we always make sure we follow the schema.</p> <p>After doing the conversion, I'm trying to get it to work so I can test it. Problem is, I'm not used to doing this in c++ and it's m...
<p>I've been bitten by this before. If the line:</p> <pre><code>::xml_schema::time t(); </code></pre> <p>is exactly as it appears in your code (that is, with the parens) then the problem is that you didn't actually instantiate an object like you think.</p> <p>To instantiate an object you would use</p> <pre><code>:...
<p>Asked around the office, and it appears my problem wasn't creating the ABSTRACTNETWORKMODEL, but it was actually the ::xml_schema::time.</p> <p>I find it odd that the instantiation of time didn't cause an error, given that it doesn't have any default constructors or why it wasn't accepted even though the template a...
19,858
<p>I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written three types of generators, including the Sieve...
<p>The 'badarity' error means that you're trying to call a 'fun' with the wrong number of arguments. In this case...</p> <p>%%L = for(1,N, fun() -> spawn(fun(I) -> wait(I,N) end) end),</p> <p>The for/3 function expects a fun of arity 1, and the spawn/1 function expects a fun of arity 0. Try this instead:</p> <pre><c...
<p>I love Project Euler.</p> <p>On the subject of prime generators, I am a big fan of the Sieve of Eratosthenes.</p> <p>For the purposes of the numbers under 2,000,000 you might try a simple isPrime check implementation. I don't know how you'd do it in erlang, but the logic is simple.</p> <pre><code>For Each NUMBER ...
11,518
<p>I'm revisiting som old code of mine and have stumbled upon a method for getting the title of a website based on its url. It's not really what you would call a stable method as it often fails to produce a result and sometimes even produces incorrect results. Also, sometimes it fails to show some of the characters fro...
<p>A simpler way to get the content:</p> <pre><code>WebClient x = new WebClient(); string source = x.DownloadString("http://www.singingeels.com/"); </code></pre> <p>A simpler, more reliable way to get the title:</p> <pre><code>string title = Regex.Match(source, @"\&lt;title\b[^&gt;]*\&gt;\s*(?&lt;Title&gt;[\s\S]*?)\...
<p>Inorder to accomplish this you are going to need to do a couple of things.</p> <ul> <li>Make your app threaded, so that you can process multiple requests at the time and maximize the number of HTTP requests that are being made.</li> <li>Durring the async request, download only the amount of data you want to pull ba...
42,672
<p>I am using Visual Studio 2005 to make an install. The application has a dependency on a DLL that was built with MFC 7.1 (from Visual Studio 2003).</p> <p>Are there merge modules for MFC 7.1 or other redistributables like there are for MFC 8? Where could they be found?</p>
<p>These merge modules are usually located in <code>%ProgramFiles%\Common Files\Merge Modules.</code></p> <p>Look for these files:</p> <ul> <li><code>vc_user_crt71_rtl_x86_---.msm</code> (has msvcr71.dll)</li> <li><code>vc_user_mfc71_rtl_x86_---.msm</code> (has mfc71.dll)</li> <li><code>vc_user_stl71_rtl_x86_---.msm<...
<p>I would expect the merge modules for MFC 7.1 to be in <code>%ProgramFiles%\Microsoft Visual Studio .NET 2003\redist</code>, assuming that you have Visual Studio 2003 installed. (However, I can't verify that because I don't have Visual Studio on this PC.)</p>
24,234
<p>I've spent most of the day making what are basically some housekeeping changes to the codebase of one of our projects (replacing all <code>System.out.println()</code> calls with log4j).</p> <p>I'm kind of curious how many lines of code I've updated with this set of changes.</p> <p>Is there anyway with <code>cvs di...
<p>Filter out extra lines from the diff output and then count the lines.</p> <p>For example, grep only lines starting with &lt; or ></p> <pre><code>cvs diff -b -B -R | egrep '^&lt;|&gt;' | wc -l </code></pre>
<p>What about verify that you've changed all instances with something like:</p> <pre><code>find . | egrep -v -e '(CVS|&lt;other patterns you don't want&gt;)' | \ xargs egrep -e 'System\.out\.println[(][)]' | wc -l </code></pre> <p>that should give you zero.</p> <p>Then replacing the regex in the second egrep wit...
28,112
<p>My application contains a piece of code that executes inside of Component Services, so we need to register our business rules layer (and its dependencies) in the GAC. One of those dependencies is FooCore.dll, which contains classes and services visible to the entire app.</p> <p>Everything was working fine, until I ...
<p>Further research turned up <a href="http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7491db9-4b1c-46b8-800c-9b35d2691c8b/" rel="nofollow noreferrer">this forum thread on this issue</a>, in which someone suggests this might be caused by VS2008's Performance Analysis feature holding onto a stale version...
<p>In my case I had two the same (almost) assemblies with different locations. The tested project was referenced to the first assembly and the UnitTest project was referenced to the second one (they were absolutely the same). </p> <p>So check carefully all of the project references. </p>
24,770
<p>I am trying to get <a href="http://selenium-rc.openqa.org/tutorial.html" rel="nofollow noreferrer">Selenium RC</a> working with Firefox 3 on Linux with PHP/Apache but am experiencing problems. Here's what I've done:</p> <ul> <li>I have installed the Firefox Selenium-IDE extension.</li> <li>On the web server (which...
<p>I'm not sure of the etiquette of answering your own question... but having experimented in a trial-and-error way, here's how I've managed to get Selenium working with PHP/Firefox3 on Ubuntu.</p> <ol> <li>I downloaded RC and copied the php client directory to /usr/share/php as 'Selenium'</li> <li>I navigated to the ...
<p>I use phpunit, selenium RC php api to run my testcases. My testcase looks like </p> <pre><code> 1235$Deepan@Newton~/selenium/ide_scripts$ cat mytest.php 'FF on linux', 'browser' => '*firefox', 'host' => '10.211.55.8', 'port' => 4444, 'timeout' => 30000, ), array( 'name'...
20,158
<p>It seems that the following piece of HTML is ignored in IE7 but works ok in IE6/FF. It supposes to override all the html links to be opened in the desired frame</p> <pre><code>&lt;HEAD&gt; &lt;title&gt;LeftPane&lt;/title&gt; &lt;base target="rightFrame"&gt; &lt;/HEAD&gt; </code></pre> <p>The above code i...
<p>The <code>href=""</code> attibute is <a href="http://www.w3schools.com/TAGS/tag_base.asp" rel="nofollow noreferrer">mandatory on the base tag</a> - that's one possible explanation. You don't say what doctype you're using, but <a href="http://www.devguru.com/Technologies/xhtml/quickref/xhtml_base.html" rel="nofollow...
<p>Honestly, I know this isn't what you're asking but <strong>PLEASE</strong> don't use frames. They're already on their way out of the HTML/XHTML DTD's, are butt ugly and cause all kinds of issues browser-to-browser.</p> <p>If you're looking for an easy to manage template system then I'd suggest just use simple <a h...
32,429
<p>I remember seeing the code for a Highpass filter a few days back somewhere in the samples, however I can't find it anywhere now! Could someone remember me where the Highpass filter implementation code was?</p> <p>Or better yet post the algorithm?</p> <p>Thanks!</p>
<p><a href="http://idevkit.com/forums/tutorials-code-samples-sdk/171-accelerometer-high-pass-filter-incorrect-apple-code.html" rel="nofollow noreferrer">From the idevkit.com forums:</a></p> <pre><code>#define kFilteringFactor 0.1 static UIAccelerationValue rollingX=0, rollingY=0, rollingZ=0; - (void)accelerometer:(U...
<p>Here's the link, i was looking for this one too. This is an example for adaptive / non adaptive highpass and lowpass filter: <a href="https://developer.apple.com/library/ios/samplecode/AccelerometerGraph/Introduction/Intro.html" rel="nofollow">Apple iOS Reference Library - AccelerometerGraph Example</a></p>
17,270
<p>I'm trying to create a template class to insulate the users from a data type. I would have preferred to use an adapter class, but the function signatures needed to change requiring a template.</p> <p>In the code sample below(not the actual project just a simplified version to illustrate the problem), while in the ...
<p><code>dumpOuter</code> fails because <code>IntAdapter</code> needs to be qualified (as in the referenced question). <code>dumpOuterFailsAsWell</code> fails because GCC does parsing of this code,even though it's not complete, and so it needs to know it's a type that you mean:</p> <pre><code>void dumpOuterWorks(const...
<p><code>StructWrapper</code> is inheriting from the primary class template (ie the least specialized), which does not define IntWrapper, so it cannot be used in this class. I'm not sure if instantiating a <code>StructWrapper</code> with one of the more specialized types will allow it to work, or if it fails on compili...
33,506
<p>I've been experimenting with fulltext search lately and am curious about the meaning of the Score value. For example I have the following query:</p> <pre><code>SELECT table. * , MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Term1)' ) AS Score FROM table WHERE MATCH ( col1, col2, col3 ) AGAINST ( '+(Term1) +(Ter...
<p>Generally relevance is based on how many matches each row has to the words given to the search. The exact value will depend on many things, but it really only matters for comparing to other relevance values in the same query.</p> <p>If you really want the math behind it, you can find it at the <a href="https://dev...
<p>Generally relevance is based on how many matches each row has to the words given to the search. The exact value will depend on many things, but it really only matters for comparing to other relevance values in the same query.</p> <p>If you really want the math behind it, you can find it at the <a href="https://dev...
28,489
<p>What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the network.</p> <p>There was a small Perl whic...
<p>Have you considered using an EXE maker? For example, you can code in Python and use <a href="http://www.py2exe.org" rel="noreferrer">py2exe</a> to create a standalone EXE that runs anywhere (it actually packages Python into the exe, so you don't have to install the runtime).</p>
<p>Did you consider <a href="http://www.autoitscript.com/autoit3/" rel="nofollow noreferrer">AutoIt</a> ?</p> <p>It is a scripting language, and you can quickly transform a script into an exe...</p>
10,498
<p>Here is an example of polymorphism from <a href="http://www.cplusplus.com/doc/tutorial/polymorphism.html" rel="noreferrer">http://www.cplusplus.com/doc/tutorial/polymorphism.html</a> (edited for readability):</p> <pre><code>// abstract base class #include &lt;iostream&gt; using namespace std; class Polygon { p...
<p>Each object (that belongs to a class with at least one virtual function) has a pointer, called a <code>vptr</code>. It points to the <code>vtbl</code> of its actual class (which each class with virtual functions has at least one of; possibly more than one for some multiple-inheritance scenarios).</p> <p>The <code>v...
<p>To answer the second part of your question: that address probably won't have a v-table in the right place, and madness will ensue. Also, it's undefined according to the standard.</p>
24,847
<h2>Update below</h2> <p>Printed 650 of these tokens, no problem. Then all of a sudden I can't get them to stick and the first layer looks wavy and weird.</p> <p><a href="https://i.stack.imgur.com/BYuDc.jpg" rel="nofollow noreferrer" title="Closeup"><img src="https://i.stack.imgur.com/BYuDc.jpg" alt="Closeup" title="Cl...
<p>A new day, a new nozzle, an old result!</p> <p><a href="https://i.stack.imgur.com/nGdyx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nGdyx.jpg" alt="Success"></a></p> <h2>EDIT</h2> <p>The success was a one off. The problem remains!<br> Heat on the heated bed seems to differ a lot in differen...
<p>Okay so I am not an expert but I think I can help.</p> <ul> <li><p>First off, your <strong>nozzle is too close to your bed</strong>. Take it up, I guess, to like between -0.75 to -0.6&nbsp;mm. Play around there.</p></li> <li><p>For not sticking part, see whether it sticks with <strong>higher bed and nozzle temperat...
1,520
<p>I am about to define an interface in my application that plug-in writers can implement to provide user-defined "export" capabilities. It'll look something like this:</p> <pre><code>public interface IFooExporter { void ExportFoo(Foo foo, string path); } </code></pre> <p>However, I need to let the plug-in writer...
<p>Regarding <a href="https://stackoverflow.com/a/322650/2750743">Pax' solution</a>: it doesn't work if user clicks more than one button intentionally or accidentally. Don't ask me how I know :-(.</p> <p>The correct code should be like that:</p> <pre><code>var mouseDown = 0; document.body.onmousedown = function() { ...
<p>Well, you can't check if it's down after the event, but you can check if it's Up... If it's up.. it means that no longer is down :P lol</p> <p>So the user presses the button down (onMouseDown event) ... and after that, you check if is up (onMouseUp). While it's not up, you can do what you need.</p>
41,730
<pre><code>$output = preg_replace("|(/D)(/s+)(/d+)(;)|", "//1,//3;", $output); </code></pre> <p>I'm trying to replace all alphabetical character followed by one or more whitespace characters (tabs and/or spaces) followed by one or more numerical characters followed by a semicolon with the alphabetical character follow...
<p>The two <code>|</code> at the start and end probably are incorrect - and should both be forward-slashes.</p> <p>All other forward slashes should be backward slashes (and need escaping).</p> <p>And since PHP 4.04 <code>$n</code> is the preferred way of referring to a capture group.</p> <pre><code>$output = preg_re...
<p>You want backslashes in the regular expression, not forward slashes. The starting and ending pipes <strong>are</strong> needed (or another delimiter for the regex)</p> <pre><code>$x = "hello world 1007;"; echo preg_replace('|(\D)(\s+)(\d+)(;)|','$1,$3',$x); echo preg_replace('/(\D)(\s+)(\d+)(;)/','$1,$3',...
7,754
<p>I am looking for an enhancement to JSON that will also serialize methods. I have an object that acts as a collection of objects, and would like to serialize the methods of the collection object as well. So far I've located <a href="http://www.thomasfrank.se/classier_json.html" rel="nofollow noreferrer">ClassyJSON<...
<p>Try to get away without serializing javascript code. That way lies a world of pain. Debugging will be much easier if code can only come from static files, not from a database. Instead, walk your JSON responses after you receive them and pass the appropriate data to the appropriate object constructors.</p> <p>If you...
<p>If you use WCF framework to develop RESTful web service, that is very easy to achieve. Simply create your data structure classes with your desired collection with DataContract, DataMember attributes.</p> <pre><code>[DataContract] public class Foo { [DataMember] public string FooName {get;set;} [DataMem...
13,499
<p>I'm working on some Silverlight controls and I would like to explicitly handle the way they appear in Blend. Specifically, these controls have dependencies that are initialized at runtime, and thus throw exceptions in the designer. But even in the absence of the exception, I would like to make them appear a certain ...
<p>There is an extremely detailed post on <a href="http://silverlight.net/blogs/justinangel/archive/2008/11/17/silverlight-design-time-extensibility.aspx" rel="nofollow noreferrer">how to deal with design time extensibility here</a>. There you will find out how to do the Visual Studio and Blend design time stuff for Si...
<p>The specific attribute to check is <code>DesignerProperties</code>:</p> <pre><code>using System.ComponentModel.DesignerProperties if (DesignerProperties.GetIsInDesignMode(this)) { } </code></pre> <p>where <code>this</code> is a <code>DependencyObject</code> (any visual element).</p>
38,452
<p>This is probably a beginner question, but how do you set a recordset to a string variable? </p> <p>Here is my code: </p> <pre><code>Function getOffice (strname, uname) strEmail = uname WScript.Echo "email: " &amp; strEmail Dim objRoot : Set objRoot = GetObject("LDAP://RootDSE") Dim objDomain : Set objDomain = G...
<p>Set is only used for objects, it cannot be used on simple variables like strings.<br> Try this: (it also makes sure the recordset is not empty)</p> <pre><code> If objRS.RecordCount &lt;&gt; 0 Then getOffice = CStr(objRS.Fields(0)) Else getOffice = "" End If </code></pre>
<pre><code>Cstr(objRS.Fields(0)) </code></pre>
39,023
<p>I am new to java so excuse my lame questions:)</p> <p>I am trying to build a web service in Java NetBeans 6.1 , but I have some troubles with configuration parameters ( like .settings in .net).</p> <p>What is the right way to save and access such settings in a java web service.</p> <p>Is there a way to read cont...
<p>If you are using servlets, you can configure parameters in web.xml:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;jsp&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.jasper.servlet.JspServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;fork&lt;/param-name&gt; &lt;param-v...
<p>I think the correct answer is ... as always ... "It depends". If you are just running a small implementation with a single server then it depend much on the WS technology you want to use. Some make the servlet context and the context-params easy to access, others don't, in which case accessing properties from a prop...
15,309
<p>I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this:</p> <pre><code>import unittest l = [[&quot;foo&quot;, &quot;a&quot;, &quot;a&quot;,], [&quot;bar&quot;, &quot;a&quot;, &quot;b&quot;], [&quot;lee&quot;, &quot;b&quot;, &quot;b&quot;]] class TestSequenc...
<p>This is called &quot;parametrization&quot;.</p> <p>There are several tools that support this approach. E.g.:</p> <ul> <li><a href="https://docs.pytest.org/en/latest/parametrize.html" rel="noreferrer">pytest's decorator</a></li> <li><a href="https://github.com/wolever/parameterized" rel="noreferrer">parameterized</a>...
<p>Besides using setattr, we can use <em>load_tests</em> with Python 3.2 and later.</p> <pre><code>class Test(unittest.TestCase): pass def _test(self, file_name): open(file_name, 'r') as f: self.assertEqual('test result',f.read()) def _generate_test(file_name): def test(self): _test(self, ...
5,290
<p>I have a constructor like as follows:</p> <pre><code>public Agent(){ this.name = "John"; this.id = 9; this.setTopWorldAgent(this, "Top_World_Agent", true); } </code></pre> <p>I'm getting a null pointer exception here in the method call. It appears to be because I'm using 'this' as an argument in the ...
<p><s>You can pass this to methods, but setTopWorldAgent() cannot be abstract. You can't make a virtual call in the constructor.</s></p> <p><s>In the constructor of an object, you can call methods defined in that object or base classes, but you cannot expect to call something that will be provided by a derived class,...
<p><code>this</code> is not null, that much is sure. It's been allocated.</p> <p>That said, there's no need to pass <code>this</code> into the method, it's automatically available in all instance methods. If the method's static, you may want refactor it into an instance method.</p>
15,479
<p>I want to place a combobox inside one column of a Xtragrid. I can bind the combobox to array values but how do you bind the combobox to the column? </p>
<p>Use the ColumnEdit property of the column to asign a lookupedit control (new). The lookupedit control is the combo box you need.</p>
<p>You can use ColumnEdit and put the proper repository. Then you can do the bindings to that repository.</p>
22,351
<p>I'm working on a Perl script. How can I pass command line parameters to it?</p> <p>Example:</p> <pre><code>script.pl "string1" "string2" </code></pre>
<p>Depends on what you want to do. If you want to use the two arguments as input files, you can just pass them in and then use <code>&lt;&gt;</code> to read their contents.</p> <p>If they have a different meaning, you can use <code>GetOpt::Std</code> and <code>GetOpt::Long</code> to process them easily. <code>GetOpt::...
<p>If you just want some values, you can just use the @ARGV array. But if you are looking for something more powerful in order to do some command line options processing, you should use <a href="http://perldoc.perl.org/Getopt/Long.html" rel="nofollow noreferrer">Getopt::Long</a>.</p>
47,215
<p>I'm attempting to create a Wizard type control in VB6 and have run into a stumbling block.</p> <p>I'd like to allow users of the control to be able to add and manage CWizardPage(s) to the design time control using a property page.</p> <p>The first approach I used was to add the Wizard pages to the OCX directly usi...
<p>You can dynamically add controls to a form or other container (such as a UserControl) using the <code>Add</code> method of the container's <code>Controls</code> collection. For example, to add a TextBox named <code>myTextBox</code> to a form called frmMyForm, you could do this:</p> <p><code>frmMyForm.Controls.Add "...
<blockquote> <p>...VB6 seems very limited in it's ability to instantiate controls at run time...</p> </blockquote> <p>Nothing could be further from the truth. Instantiating controls at run time in VB6 is trivial.</p> <ol> <li>At design time, set the Index property of the control to 0. This turns the control i...
37,411
<p>So, I am seeing a curious problem. If I have a function</p> <pre><code>// counter wraps around to beginning eventually, omitted for clarity. var counter; cycleCharts(chartId) { // chartId should be undefined when called from setInterval console.log('chartId: ' + chartId); if(typeof chartId == 'undefine...
<p>setInterval is feeding cycleCharts actual timing data ( so one can work out the actual time it ran and use to produce a less stilted response, mostly practical in animation )</p> <p>you want </p> <pre><code> var cycleId = setInterval(function(){ cycleCharts(); }, 10000); </code></pre> <p>( this behavior may not ...
<p>var cycleId = setInterval(cycleCharts, 10000, 4242);</p> <p>From the third parameter and onwards - they get passed into the function so in my example you send 4242 as the chartId. I know it might not be the answer to the question you posed, but it might the the solution to your problem? I think the value it gets is...
11,178
<p>How do I generate an audio sine or square wave of a given frequency?</p> <p>I am hoping to do this to calibrate equipment, so how precise would these waves be?</p>
<p>You can use <a href="http://codeplex.com/naudio" rel="noreferrer">NAudio</a> and create a derived WaveStream that outputs sine or square waves which you could output to the soundcard or write to a <a href="http://en.wikipedia.org/wiki/WAV" rel="noreferrer">WAV</a> file. If you used 32-bit floating point samples you ...
<p>Using <em>Math.NET Numerics</em> </p> <p><a href="https://numerics.mathdotnet.com/Generate.html" rel="nofollow noreferrer">https://numerics.mathdotnet.com/Generate.html</a></p> <blockquote> <p><strong>Sinusoidal</strong></p> <p>Generates a Sine wave array of the given length. This is equivalent to applyin...
24,943
<p>I need to flip an image so that a character faces in the right direction. This needs to be done "on the fly' as they say. </p> <p>The issue I am having is that with Gif images, I seem to lose the transparency. (The background goes white)</p> <p>Below is the code: (Alternatively someone could send me to a good exam...
<p>Shouldn't this:</p> <pre><code>imagecolortransparent($img, imagecolorallocate($img, 0, 0, 0)); imagealphablending($img, false); imagesavealpha($img, true); </code></pre> <p>...be this:</p> <pre><code>imagecolortransparent($temp, imagecolorallocate($img, 0, 0, 0)); imagealphablending($temp, false); imagesavealpha(...
<p>If you can guarantee the presence of ImageMagick, you can use their <code>mogrify -flop</code> command. It preserves transparency.</p>
9,203
<p>Suppose you have a method that should create and return an array of some sort. What if the array doesn't get populated. Do you return an empty array or null/nothing?</p>
<p>In .NET it's better to return an empty array than null because it saves the caller having to write a null check and/or risking a <code>NullReferenceException</code>; you'll see this is a common pattern in the base class libraries. The only case in which you wouldn't do this is in the unlikely scenario that an empty ...
<p>Unless for some reason there is a differance in meaning in your code for a result being a null array verses a plain old blank one, I would return a blank one. This also might be a language specific thing. In some languages, you may only have one option.</p>
43,036
<p>How can I take full advantage of 64-bit architecture in my .NET 2.0 Web Applications and Console/Forms Applications?</p>
<p>I think there is not too much you can optimize in your managed .NET code regarding 32bit vs. 64bit architectures. This is because most of the differences and optimizatinons are most likely already implemented by the underlying VM. As mentioned in <a href="https://stackoverflow.com/questions/280327/programming-for-th...
<p>The best gain of 64 bit platform is an amount of memory yours application can address. This means what you web application can support a larger amount of active sessions or/and longer sessions. Also you can store more data in the application cache. So keeping this in mind you can re architect you app.</p>
37,205
<p>Firefox 3 stores the bookmarks in a sqlite database. There are several hacked sqlite java libraries available. Is there a way to hack the sqlite database in java(not using libraries) to read bookmarks reliably? Does someone know how the sqlite DB is stored and access programmatically (from java)?</p>
<p>You need the <a href="http://www.zentus.com/sqlitejdbc/" rel="noreferrer">SQLite JDBC driver</a> (this page explains how to run queries on a SQLite database using that driver from within Java).</p>
<p>I don't know why you need NOT to use a JDBC driver, but there's another possible "solution" depending on your software requirements. In FF3, type in the address bar about:config</p> <p>Alter the value of property: browser.bookmarks.autoExportHTML to true.</p> <p>This will export your bookmarks in an HTML whenever ...
10,669
<p>I've often used pointers to const objects, like so...</p> <pre><code>const int *p; </code></pre> <p>That simply means that you can't change the integer that <code>p</code> is pointing at through <code>p</code>. But I've also seen reference to const pointers, declared like this...</p> <pre><code>int* const p; </co...
<p>When you're designing C programs for embedded systems, or special purpose programs that need to refer to the same memory (multi-processor applications sharing memory) then you need constant pointers.</p> <p>For instance, I have a <a href="http://flickr.com/photos/adavis/2945502665/" rel="noreferrer">32 bit MIPs pro...
<p>always think of a pointer as an int. this means that</p> <pre><code>object* var; </code></pre> <p>actually can be thought of as</p> <pre><code>int var; </code></pre> <p>so, a const pointer simply means that:</p> <pre><code>const object* var; </code></pre> <p>becomes</p> <pre><code>const int var; </code></pre>...
27,073
<p>I'm trying to find something, preferably F/OSS, that can generate a Google Maps overlay from KML and/or KMZ data.</p> <p>We've got an event site we're working on that needed to accommodate ~16,000 place markers last year and will likely have at least that many again this year. Last year, the company that had done t...
<p>You may want to look into something like <a href="http://geoserver.org/display/GEOS/Welcome" rel="nofollow noreferrer">Geoserver</a> or <a href="http://mapserver.gis.umn.edu/" rel="nofollow noreferrer">Mapserver</a>. They are Google map clones, and a lot more. </p> <p>You could generate an overlay that you like, an...
<p>This is a tough one. You can use <a href="http://code.google.com/apis/maps/documentation/overlays.html#Tile_Overlays" rel="nofollow noreferrer">custom tilesets with Google Maps</a>, but you still need some way to generate the tiles (other than manually).</p> <p>I'm afraid that's all I've got =/</p>
21,038
<p>Can anyone send me a c code to divide 2 64bit numbers. My compiler only supports 32/32 division.</p> <p>Thanx &amp; Regards</p> <p>Mani</p>
<p>Are you positive your compiler doesn't support 64-bit division? If your C compiler supports C99, this should work:</p> <pre><code>#include &lt;stdint.h&gt; #include &lt;stdio.h&gt; int main(void) { int64_t numerator = 123; int64_t denominator = 10; int64_t quotient = numerator / denominator printf(...
<p>More than likely, the division limitation stems from the fact that you're compiling for 32-bit instead of 64-bit.</p> <p>I don't recall seeing an integer division instruction that handles 64 bit for x86. It would multiply 2 32-bit integers, and split the results across 2 registers, but not division as far as I reca...
47,812
<p>Since the Google App Engine Datastore is based on <a href="http://research.google.com/archive/bigtable.html" rel="noreferrer">Bigtable</a> and we know that's not a relational database, how do you design a <strong><em>database schema</em>/<em>data model</em></strong> for applications that use this type of database sy...
<p>Designing a bigtable schema is an open process, and basically requires you to think about:</p> <ul> <li>The access patterns you will be using and how often each will be used</li> <li>The relationships between your types</li> <li>What indices you are going to need</li> <li>The write patterns you will be using (in or...
<p>As GAE builds on how data is managed in Django there is a lot of info on how to address similar questions in the Django documentation (for example see <a href="http://www.djangobook.com/en/1.0/chapter05/" rel="nofollow noreferrer">here</a>, scroll down to 'Your first model').</p> <p>In short you design you db model...
10,524
<p>It seems almost magical. What is the traceroute command doing in order to map out the entire path to some other node on the Internet?</p>
<p>Traceroute transmits packets with small TTL (Time To Live) values. The TTL is an IP header field that is used to prevent packets from running into endless loops. When a router that handles the packet subtracts one from the packet's TTL. The packet expires and it's discarded when the TTL reaches zero.</p> <p>Tracero...
<p>traceroute sets the TTL (Time To LIve) field to 1 and increments it for every hop. the routers receiving the message decrement this value and when it reaches 0 they reply a message that the TTL has reached zero. With this reply the client knowns who's in between. do this iteratively until your destination and you go...
25,954
<p>How do I create a file-like object (same duck type as File) with the contents of a string?</p>
<p>For Python 2.x, use the <a href="https://docs.python.org/2/library/stringio.html" rel="noreferrer">StringIO</a> module. For example:</p> <pre><code>&gt;&gt;&gt; from cStringIO import StringIO &gt;&gt;&gt; f = StringIO('foo') &gt;&gt;&gt; f.read() 'foo' </code></pre> <p>I use cStringIO (which is faster), but note ...
<p>If your file-like object is expected to contain bytes, the string should first be encoded as bytes, and then a <a href="https://docs.python.org/3/library/io.html#text-i-o" rel="noreferrer">BytesIO</a> object can be used instead. In Python 3:</p> <pre><code>from io import BytesIO string_repr_of_file = 'header\n byl...
17,092
<p>I am using log4net in a C# project, in the production environment, I want to disable all the logging, but when some fatal error occures it should log all the previous 512 messages in to a file.I have successfully configured this, and it is working fine. It logs the messages in to a file when some fatal error occure...
<p>Remove the <a href="http://logging.apache.org/log4net/release/sdk/log4net.Config.BasicConfigurator.Configure_overload_1.html" rel="noreferrer">BasicConfigurator.Configure()</a> line. That's what that line does -- adds a ConsoleAppender pointing to Console.Out.</p>
<p>Do you still see the messages in Visual Studio if the application is compiled in release mode? It's possible that log4net uses Debug.Write to show the errors anyway. If that's the case then those messages shouldn't appear in release mode.</p>
15,446
<p>A while ago, I set up my company's local (non-internet) client database on my domain server, using Apache and PHP/MySQL.</p> <p>I recently decided to set it up to use an SSL connection rather than a standard HTTP connection. (I know, I should have from the beginning, but that's another matter).</p> <p>I've set up ...
<p>Installing the SSL certificate via the Website is definitely not possible and that's a good thing.</p> <p>If you're PCs are structured in a Domain, then you can probably do this via a Group Policy, 'though.</p>
<p>In my opinion, it would be cheaper for you to buy a signed cert than script something up to add your certificate to all the trusted computers (in terms of time spent on doing it). </p> <p>They're a paltry $30/year on GoDaddy... </p>
48,902
<p>I have a very strange problem, when I try to <code>var_dump</code> (or <code>print_r</code>) a Doctrine Object, my Apache responses with an empty blank page (200 OK header). I can <code>var_dump</code> a normal php var like:</p> <pre><code>$dummy = array("a" =&gt; 1, "b" =&gt;2); </code></pre> <p>And it works fine...
<p>Lazy load proxies always contain an instance of Doctrine’s EntityManager and all its dependencies.</p> <p>Therefore a <code>var_dump</code> will possibly dump a very large recursive structure which is impossible to render and read. You have to use <code>\Doctrine\Common\Util\Debug::dump()</code> to restrict the dum...
<p>You can use toArray if you are sure the object is an instance of Doctrine_Collection. Xdebug does not help with doctrine records.</p> <p>The way I suggest is implementing a custom recursive function to print object, that use Doctrine_Record::toArray() when neeeded</p> <pre><code>function var_dump_improved() { f...
26,604
<p>For a developer in the Java eco-system, there is a handful of choices when it comes to UI design. The best known are:</p> <ul> <li>Swing (preferred when used with Netbeans and its GUI builder)</li> <li>Eclipse's SWT (mostly preferred for Eclipse plug-ins)</li> </ul> <p>Now, are there any frameworks or design alter...
<p>Not exactly UI design, but you could try <a href="http://groovy.codehaus.org/Griffon" rel="noreferrer">Griffon</a>.</p>
<p>I think the two most mature frameworks for Jruby are Monkeybars (<a href="http://monkeybars.rubyforge.org/" rel="nofollow noreferrer">http://monkeybars.rubyforge.org/</a>) and Limelight (<a href="http://limelight.8thlight.com/" rel="nofollow noreferrer">http://limelight.8thlight.com/</a>).</p> <p>Monkeybars is a fu...
12,160
<p>As the title says, I'm starting one project right now, and trying to layout the infrastructure for the project (SVN, Email, Bug tracking, Online Forums, etc...)</p> <p>So, Bugzilla or Mantis?</p>
<p>I like mantis. It's simple and it gets the job done.</p>
<p>Another vote for Trac -- dead simple to get going, nice web-based view into your repository, etc. </p>
41,862
<p>Following on from <a href="https://stackoverflow.com/questions/367966/how-to-intercept-debugging-information-debugview-style-in-c">this question</a> I now have code that can attach to a process using the Mdbg API.</p> <p>The problem is that I can't detach from the process if I need to. When I call <strong>mgProces...
<p>It transpires that Mdbg will not allow you to do anything <a href="http://blogs.msdn.com/jmstall/archive/2006/03/22/att-macros.aspx" rel="nofollow noreferrer">while the debugee is running</a>.</p> <pre><code> MgProcess.CorProcess.Stop(0); MgProcess.Detach(); </code></pre> <p>Appears to be the way forward.</p>
<p>Try this:</p> <pre><code>proc.AsyncStop(); proc.Detach(); </code></pre> <p>or</p> <pre><code>Proc.CorProcess.Stop(0); Proc.Detach(); </code></pre>
49,537
<p>I used the command line "arp -s IP MAC" command to set a static ARP entry on Windows Server 2003. When I ran "arp -a" it was there as a "static" entry. When I restart, it is gone. Is there some file somewhere like lmhosts where I can make this absolutely permanent? Thanks!</p>
<p>I don't think there is already support for persistent configuration of ARP entries. However, you should be able to create a boot script that does that every time.</p> <p>In Group Policy, go to Computer Configuration\Windows Settings\Scripts, add a startup script.</p>
<p>I had a Windows Server 2003 which wasn't in a domain, so the above answer didn't apply to me, although it does work for a box in an AD. The below Autoexecnt.bat script worked for me (and works in XP, too):</p> <p><a href="http://support.microsoft.com/kb/243486" rel="nofollow noreferrer">http://support.microsoft.com...
31,904
<p>I have this code in my aspx page;</p> <pre><code>&lt;a href="javascript:void(0);" onclick=&lt;% Print(); %&gt; title="Print listings"&gt;Print&lt;/a&gt; </code></pre> <p>which presents a link to print a listings to a pdf when the user clicks on it; as you can note the script calls a function from the behind code.<...
<p>You want to use a HyperlinkControl and wire up the OnClick event handler to your code behind Print method. When the user then clicks on the link, the page will post back and the OnClick event gets raised. From there you can print your PDF.</p> <p>In your example the Print() function is getting evaluated when the pa...
<p>Its a bit hard to tell exactly what is happening from your code snippet, but I would assume that you are outputting the pdf file to the response stream as part of the print() function. This is will display the pdf on load because the code behind is evaluated at render time (just before it sends the code to the brows...
36,773
<p>We are using Maven for a large build process (> 100 modules). We have been storing our external dependencies in source control, and using that to update a local repo.</p> <p>However, we are ready to graduate to a local repo that can cache central so that we don't have to proactively download all 3rd parties (but we...
<p>I don't know about Artifactory but here are my reasons for using Nexus:</p> <ul> <li>Dead simple install (and since 1.2, dead simple upgrade, too)</li> <li>Very good web UI</li> <li>Easy to maintain, almost no administrative overhead</li> <li>Provides you with RSS feeds of recently installed, broken artifacts and e...
<p>Both Artifactory and Nexus have more or less similar feature set but Artifactory's LDAP support makes it more attractive over Nexus. Though Nexus also have LDAP support but in paid version :-(</p>
47,616
<p>I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).</p> <p>I have implemented <code>QueryPerformanceCounter</code> by giving the uSeconds since the process start up: </p> <pre><code>BOOL QueryPerformanceCounter(LARGE_INTEGER* pe...
<p>Maybe. But you have bigger problems. <code>gettimeofday()</code> can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a "normal" linux, though, I believe the resolution of <code>gettimeofday()</code> is 10us. It can jump forward and backward and time, consequentl...
<p>From my experience, and from what I've read across the internet, the answer is "No," it is not guaranteed. It depends on CPU speed, operating system, flavor of Linux, etc.</p>
2,252
<p>I am currently working on a program to immediately clear the list of previously-run-commands which appears in the Windows <em>Start</em> -> <em>Run</em> dialog. The procedure for clearing this list by removing the <em>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU</em> key is <a href="h...
<p>Have you tried ccleaner?</p> <p><a href="http://www.ccleaner.com/" rel="nofollow noreferrer">http://www.ccleaner.com/</a></p>
<p>HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Explorer\ RunMRU\</p>
16,317
<p>I have an application that creates, and destroys thousands of objects. Is it worth caching and reusing objects, or is Delphi's memory manager fast enough that creating and destroying objects multiple times is not that great an overhead (as opposed to keeping track of a cache) When I say worth it, of course I'm looki...
<p>From recent testing - if object creation is not expensive (i.e. doesn't depend on external resources - accessing files, registry, database ...) then you'll have a hard time beating Delphi's memory manager. It is that fast.</p> <p>That of course holds if you're using a recent Delphi - if not, get FastMM4 from <a hre...
<p>Often the only way to tell - is to try it.</p> <p>If current performance is adequate then you don't have much call to try and increase it. However, if you have performance issues, then some caching (or indeed some other strategies) may help.</p>
32,124
<p>I have been given a requirement where I need to support multiple databases in the same instance, to support multi-tenancy. Each DB has an identical schema. The user logs into a specific database by choosing from a list, and all subsequent calls will go to that DB until they log out.</p> <p>I want to hot swap the se...
<p>If all the databases are identical, then I can suggest using a single SessionFactory and providing your own implementations for the DataSource and Cache that are actually "tenant-aware". (Implementing these is fairly trivial: just maintain a map of tenant id -> real cache/real datasource and then delegate all calls ...
<p>You could also take a look at the Hibernate Shards project:</p> <p><a href="http://www.hibernate.org/414.html" rel="nofollow noreferrer">http://www.hibernate.org/414.html</a></p> <p>... which is focused on adding support for horizontal partitioning to the Hibernate Core. It does not yet cover the full Hibernate AP...
14,595
<p>Does anyone know of a good example implementation of the Service Location Protocol that can be build/ran on a windows box?</p>
<p><a href="http://www.openslp.org/" rel="nofollow noreferrer">OpenSLP</a> is said to compile fine on Windows.</p>
<p>OpenSLP referenced above is the code base that Novell uses for its SLP implementation for eDirectory now a days. Not too many things really use SLP for real these days. Usually more of a half hearted implementation </p>
15,851
<p>I have a collection of Boost unit tests I want to run as a console application.</p> <p>When I'm working on the project and I run the tests I would like to be able to debug the tests, and I would like to have the console stay open after the tests run.</p> <p>I see that if I run in release mode the console window st...
<p>Try to run the application with the <kbd>Ctrl</kbd> + <kbd>F5</kbd> combination.</p>
<p>Do a readline at the end (it's the "forma cochina", like we say in Colombia, but it works):</p> <pre><code>static void Main(string[] args) { . . . String temp = Console.ReadLine(); } </code></pre>
23,514
<p>Can anyone suggest which of the Redmine or Tracd would be a better option for project management? Currently I am planning to deploy it on a one project setup but plan to use it across multiple projects in the fututre. Which of the two is easier to deploy? I use windows. Any other software which is web based and come...
<p>If you plan to do multi-project management in the future, choose redmine. With trac you can have multi-project setups as well (having a separate environment for each project), but in the end it's a workaround. Redmine has builtin support for multi-project environments.</p> <p>I previously used trac to manage my pro...
<p>TRAC doesn't have time management support, while redmine does. So I think that Redmine would be a better options for the project management. Redmine allow you to annotate tickets with the estimated effort, the percent of completion and you can tell that an issue depends from another to be solved. Then you can create...
31,581
<p>I have a simple class that essentially just holds some values. I have overridden the <code>ToString()</code> method to return a nice string representation.</p> <p>Now, I want to create a <code>ToXml()</code> method, that will return something like this:</p> <pre><code>&lt;Song&gt; &lt;Artist&gt;Bla&lt;/Artist&...
<p>I would recommend to use XDoc and XElement of System.Xml.Linq instead of XmlDocument stuff. This would be better and you will be able to make use of the LINQ power in querying and parsing your XML:</p> <p>Using XElement, your ToXml() method will look like the following:</p> <pre><code>public XElement ToXml() { ...
<pre><code>XmlDocumnt xdoc = new XmlDocument; XmlNode songNode = xdoc.CreateNode(XmlNodeType.Element, "Song", schema) xdoc.AppendChild..... </code></pre>
26,487
<p>I know that <a href="http://en.wikipedia.org/wiki/Buffer_overflow" rel="nofollow noreferrer">buffer overruns</a> are one potential hazard to using C-style strings (char arrays). If I know my data will fit in my buffer, is it okay to use them anyway? Are there other drawbacks inherent to C-style strings that I need...
<p>C strings lack the following aspects of their C++ counterparts:</p> <ul> <li>Automatic memory management: you have to allocate and free their memory manually.</li> <li>Extra capacity for concatenation efficiency: C++ strings often have a capacity greater than their size. This allows increasing the size without many...
<p>c strings have opportunities for misuse, due to the fact that that one has to scan the string to determine where it ends.</p> <p><strong>strlen</strong> - to find the length, scan the string, until you hit the NUL, or access protected memory</p> <p><strong>strcat</strong> - has to scan to find the NUL, in order to...
40,286
<p>So if I have a method of parsing a text file and returning a <strong>list</strong> <em>of a</em> <strong>list</strong> <em>of</em> <strong>key value pairs</strong>, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?</p> <p>The first met...
<p>Take a deep look at the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" rel="nofollow noreferrer">XmlSerializer</a>. Even if you are constrained to not use XML on-disk, you might want to copy some of its features. This could then look like this:</p> <pre><code>public cl...
<p>@David:<br> I already have the parser (and most of these will be hand written, so I decided against XML). But that looks like I really nice way of doing it; I'll have to check it out. Excellent point about versioning too. </p> <p>@Argelbargel:<br> That looks good too. :')</p>
7,238
<p>In C++, can member function pointers be used to point to derived (or even base) class members? </p> <p>EDIT: Perhaps an example will help. Suppose we have a hierarchy of three classes <code>X</code>, <code>Y</code>, <code>Z</code> in order of inheritance. <code>Y</code> therefore has a base class <code>X</code> a...
<p>C++03 std, <a href="http://www.open-std.org/jtc1/sc22/WG21/docs/wp/html/nov97-2/conv.html#conv.mem" rel="noreferrer">§4.11 2 Pointer to member conversions</a>:</p> <blockquote> <p>An rvalue of type “pointer to member of B of type <i>cv</i> T,” where B is a class type, can be converted to an rvalue of type “pointe...
<p>Here is an example of what works. You can override a method in derived class, and another method of base class that uses pointer to this overridden method indeed calls the derived class's method.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; class A { public: virtual vo...
8,477
<p>I'm having a test hang in our rails app can't figure out which one (since it hangs and doesn't get to the failure report). I found this blog post <a href="http://bmorearty.wordpress.com/2008/06/18/find-tests-more-easily-in-your-testlog/" rel="noreferrer">http://bmorearty.wordpress.com/2008/06/18/find-tests-more-eas...
<p>If you run test using rake it will work:</p> <pre><code>rake test:units TESTOPTS="-v" </code></pre>
<p>What test framework are you using? Test/Unit?</p> <p>I would take a look at RSpec which would provide a little more context for your tests. You can also get a nice HTML report that looks like this:</p> <p><a href="http://myskitch.com/robbyrussell/rspec_results-20070801-233809.jpg" rel="nofollow noreferrer">RSpec...
19,090
<p>I've come across an issue where some images on a site load under https but do not load under http.</p> <p>For example if you go to <a href="https://www.mydomain.com/myimage.gif" rel="nofollow noreferrer">https://www.mydomain.com/myimage.gif</a>, the image appears fine, but if you go to <a href="http://www.mydomain....
<p>Problem solved. It turns out that the https site was created using a physical copy of the actual site under the SSL port, this means there were 2 versions of the site being served under the same domain name, one under port 80 and one under port 443.</p> <p>The issue appeared because someone updated the port 443 si...
<p>Moving a comment out to answer in the hopes it'll get a response:</p> <blockquote> <p>Is this behavior consistent across browsers and/or PCs/Macs?</p> </blockquote>
43,891
<p>I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?</p>
<p>new Date().time returns the time in milliseconds.</p> <pre><code>var nStart:Number = new Date().time; // Some time passes var nMillisElapsed:Number = new Date().time - nStart; var strTime:String = Math.floor(nMillisElapsed / (1000 * 60 * 60)) + "::" + (Math.floor(nMillisElapsed / (1000 * 60)) % 60) + "::" + ...
<pre><code>var countdown:Timer = new Timer(1000); countdown.addEventListener(TimerEvent.TIMER, timerHandler); countdown.start(); function timerHandler(e:TimerEvent):void { var minute = Math.floor(countdown.currentCount / 60); if(minute &lt; 10) minute = '0'+minute; var second = countdo...
12,000
<p>I'm thinking of choosing Adobe AIR as the client-side implementation technology for an upcoming project. (The previous choice was C# and WPF, but I've been really impressed with Flash/Flex/AIR lately.)</p> <p>But one of the most important features of my product will be its plugin architecture, allowing third party ...
<p>Luca Tettamanti gave good answers to your specific questions already, so I'll just offer some additional info on the general subject:</p> <p>I've implemented a simple plugin API for a Flex app using the <a href="http://livedocs.adobe.com/flex/3/langref/mx/modules/ModuleManager.html" rel="nofollow noreferrer"><code>...
<p>Responding to the statement regarding Java as a possible plug-in architecture:</p> <p>It turns out Java has been used to devise plug-in architecture systems for many years. As to to client-side, the Equinox OSGi module management frameworks is probably the best well known. At one point the Eclipse IDE refactored th...
44,839
<p>I've got a maintenance plan that executes weekly in the off hours. It's always reporting success, but the old backups don't get deleted. I don't want the drive filling up.</p> <p>DB Server info: SQL Server Standard Edition 9.00.3042.00 </p> <p>There is a "Maintenance Cleanup Task" set to </p> <p>"Search folder an...
<p>If you make your backups in subfolders, you have to specify the exact subfolder for deleting.</p> <p>For example:</p> <p>You make the backup by choosing the option that says something like "Make one backup file for each database" and check the box that says "Create subfolder for each database". (I work with a Germ...
<p>Make sure your maintenance plan does not have any errors associated it with. You can check the error log under the SQL Server Agent area in the SQL Server Management Studio. If there are errors during your maintenance plans, then it is probably quitting before it starts to delete the outdated backups. </p>
40,612
<p>In a Qt application, is there an equivalent to <code>QApplication::setFont</code> that sets the applications default cursor, to be overwritten by setting one on a specific widget? </p> <p><code>QApplication::setOverrideCursor</code> overrides all widget specific ones, I want local ones to take precidene over this o...
<p>A QWidget either uses the cursor specified with QWidget::setCursor or falls-back it's parents' cursor setting. So, simply setting the cursor for your main windows should do the trick.</p> <p>New top level windows and dialogs will need to have the cursor set when created since their is no parent from which to inheri...
<p>Thats pretty close to what I need, however it doesn't seem to get inherited by other windows. I guess there is just no equivelent to setFont though, so I'll have to handle a the others separately. </p>
45,630
<p>When writing GUIs, I've frequently come over the following problem: Assume you have a model and a controller. The controller has a widget <code>W</code> that is used to show a property <code>X</code> of the model.</p> <p>Because the model might be changed from outside the controller (there might be other controller...
<p>The standard QT way of dealing with this and also the one suggested in their very useful tutorial is to make the change to the value in the controller only if the new value is different from the current value.<br> This is way signals have the semantics of <code>valueChanged()</code></p> <p><a href="http://doc.troll...
<p>Flags to indicate updaing work. You can wrap them in methods like BeginUpdate and EndUpdate.</p>
15,168
<p>I'm writing my first Windows CE app using the .NET Compact Framework v3.5.<br> I need the app to be able to do an HTTP POST to a URL.<br> It appears that the .NET CF does not have System.Web.<br> So, I could use some guidence on how to accomplish and HTTP Posts using the .Net CF. Thanks, Greg</p>
<p>Does this satisfy your needs?</p> <p>You need to import<br> System.IO<br> System.Net<br> System.Net.HttpWebRequest<p></p> <pre><code>Try Dim Request As HttpWebRequest = CType(WebRequest.Create("&lt;The server&gt;"), HttpWebRequest) Request.AllowWriteStreamBuffering = True Request.KeepAlive = Fal...
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest_members.aspx" rel="nofollow noreferrer">HTTPWebRequest class</a> exists in the CF and can be used for posting and scraping the response. A quick search found several promising desktop articles on using them for doing POSTs, many of which...
35,784
<p>I'm building an XML DOM document in C++. My problem is this: I execute an XPATH query from an Element in my Document, which I know will return another Element. The elementPtr->selectSingleNode call returns an IXMLDOMNode. How can I gain access to the attributes of this node?</p> <p>Part of me wants to downcast the...
<p>I don't see anything wrong with what you have written.</p> <p>The smart com pointers will help you convert if they can, you don't have to write the query interface yourself.</p> <pre><code>MSXML2::IXMLDOMNodePtr pParentNode = pParameterElement-&gt;selectSingleNode("parent"); MSXML2::IXMLDOMElementPtr pParentElemen...
<p><code>CComPtr</code> is necessary for <code>IXMLDOMNamedNodeMap</code>, otherwise there would be a exception:</p> <p>object of abstract class type <code>IXMLDOMNamedNodeMap</code> is not allowed</p>
36,722
<p>I am trying to run a SQL Server Reporting Services where the data for the report is on a SQL Server database that's on a different server. Integrated Authentication is turned on for both the Report Server and the report. I have confirmed that Kerberos delegation is working fine by using Internet Explorer to run th...
<p>Kerberos requires a port 88 connection to the KDC, in this case, most likely your DC.</p> <p>What you probably want to look at is HTTPS + Basic Authentication + Protocol Transition to take the Basic Authentication and translate it into a DC based Kerberos Ticket for delegation and back end authentication.</p> <ul>...
<p>I'm not really in a position to tell you why kerberos isn't working for you, but did have a alternative suggestion for your configuration. You can use ISA services to expose the reporting server rather than simply poking a hole in your firewall. This is something our company has done successfully - it republishes th...
11,432
<p>I have a tabbed series of grids on a data preview page. I now need to import the data from each grid into its own sheet in an Excel workbook.</p> <p>How could I do this?</p> <p>BTW, this is on a Mac or a PC.</p>
<p><a href="http://java.sun.com/javase/6/docs/api/java/util/List.html#addAll(java.util.Collection)" rel="noreferrer"><code>List.addAll()</code></a></p>
<pre><code>List finalist = a + b </code></pre> <p>Example:</p> <pre><code>List a = [1,4] List b = [2,3] List c = a+b </code></pre> <p>Result:</p> <pre><code>c = [1, 4, 2, 3] </code></pre>
48,995
<p>I have seen arguments for using explicit interfaces as a method of locking a classes usage to that interface. The argument seems to be that by forcing others to program to the interface you can ensure better decoupling of the classes and allow easier testing.</p> <p>Example:</p> <pre><code>public interface ICut {...
<p>To quote GoF chapter 1:</p> <ul> <li>"Program to an interface, not an implementation".</li> <li>"Favor object composition over class inheritance".</li> </ul> <p>As C# does not have multiple inheritance, object composition and programming to interfaces are the way to go.</p> <p>ETA: And you should never use multip...
<p>If the client code doesn't care about anything other than the fact that it can use the object to <code>Cut()</code> things, then use <code>ICut</code>. </p>
21,553
<p>Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications.</p> <p>What's the best way to create a "user control library", so that you can use the same control implementation in the 2 applications, withuot having to duplicate code?<...
<p>You would need to create composite controls instead of .ASCX controls if you wanted to be able to use them in separate projects.</p>
<p>I use StarTeam here and it allows you to "share" objects (files, change requests, requirements etc) across multiple folders. Not sure if Subversion (SVN) has that feature. If it doesn't, here's another trick you can use: create a junction from the primary location of the controls to a location in the other projects....
4,772
<p>A while a go I had to developed a music site that allowed audio files to be uploaded to a site and then converted in to various formats using ffmpeg, people would then download the uploaded audio files after purchasing them and a tmp file would be created and placed at the download location and was only valid for ea...
<p>See this earlier StackOverflow question <a href="https://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay">Storing images in a database, Yea or nay?</a>.</p> <p>I know you mentioned images and video, however this question has relevance to all large binary content media files.</p> <p>The consensus s...
<p>I asked a <a href="https://stackoverflow.com/questions/62876/whats-the-best-way-to-save-and-retrieve-binary-files-with-oracle-10g">similar question using Oracle</a> as the backend for a Windows Forms application.</p> <p>The answer really boils down to your requirements for backing up and restoring the files. If tha...
22,596
<p>I'm using AS3 (Flash) to <strong>read SVG files</strong> and <strong>display</strong> them. The problem is correctly displaying a <strong>linear/radial gradient.</strong></p> <p>Following is an example of a simple <strong>linear gradient</strong> from <strong>Red</strong> to <strong>Blue</strong>, in SVG.</p> <pre><...
<h2>How to draw a linear gradient using the 2 gradient points</h2> <ol> <li><strong>x1,y1 and x2,y2</strong> are the 2 points on the <strong>screen coordinate space</strong>, that the gradient is to be drawn from, to.</li> <li>Use the <strong>transformation matrix</strong> supplied by SVG to <strong>offset the x1,y1 a...
<h2>SVG rendering engine!</h2> <p>Maybe there are some answers <a href="https://stackoverflow.com/questions/58910/converting-svg-to-png-using-c#58912">here</a> that can help. </p>
44,267
<p>We're at the beginning of a new ERP-ish client-server application, developed as a Python rich client. We're currently evaluating Dabo as our main framework and it looks quite nice and easy to use, but I was wondering, has anyone used it for medium-to-big sized projects?<br> Thanks for your time!</p>
<p>I'm one of the authors of the Dabo framework. One of our users pointed out to me the extremely negative answer you received, and so I thought I had better chime in and clear up some of the incorrect assumptions in the first reply.</p> <p>Dabo is indeed well-known in the Python community. I have presented it at 3 of...
<p>I have no Dabo experience at all but this question is on the top of the list fo such a long time that I decided to give it a shot:</p> <h2>Framework selection</h2> <h2>Assumptions:</h2> <ol> <li>medium-to-big project: we're talking about a team of more than 20 people working on something for about a year for the ...
8,034
<p>I have two unrelated processes that use .NET assemblies as plugins. However, either process can be started/stopped at any time. I can't rely on a particular process being the server. In fact, there may be multiple copies running of one of the processes, but only one of the other.</p> <p>I initially implemented a so...
<p>Using shared memory is tougher because you'll have to manage the size of the shared memory buffer (or just pre-allocate enough). You'll also have to manually manage the data structures that you put in there. Once you have it tested and working though, it will be easier to use and test because of its simplicity.</p...
<p>Why not host the server and the client on both sides, and whoever comes up first gets to be the server? And if the server drops out, the client that is still active switches roles.</p>
6,461
<p>I have a swing gui with a tabbed pane in the north. Several key events are added to its input map:</p> <pre><code>InputMap paneInputMap = pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); paneInputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_E, KeyEvent.CTRL_MASK ), "finish"); paneInputMap.put( KeySt...
<p>So that this gets an answer, here's the solution copied from your edit in the question. ;-)</p> <blockquote> <p>The ToolTipManager registeres the Key <kbd>Ctrl</kbd>+<kbd>F1</kbd> to display the tooltip text if the key combination is pressed. So if a button with a tooltip is focused, <kbd>Ctrl</kbd>+<kbd>...
<p>May be the OS retargets the <kbd>F1</kbd> key? Install a key listener and see what events are handled.</p> <p>BTW: It would help if you could edit your question and insert some testable code.</p>
16,776
<p>Looking for a bit of regex help. I'd like to design an expression that matches a string with "<em>foo</em>" OR "<em>bar</em>", but not both "<em>foo</em>" AND "<em>bar</em>"</p> <p>If I do something like...</p> <pre><code>/((foo)|(bar))/ </code></pre> <p>It'll match "<em>foobar</em>". Not what I'm looking for. So...
<p>This is what I use:</p> <pre><code>/^(foo|bar){1}$/ </code></pre> <p>See: <a href="http://www.regular-expressions.info/quickstart.html" rel="noreferrer">http://www.regular-expressions.info/quickstart.html</a> under repetition </p>
<p>I'd use something like this. It just checks for space around the words, but you could use the <code>\b</code> or <code>\B</code> to check for a border if you use <code>\w</code>. This would match " foo " or " bar ", so obviously you'd have to replace the whitespace as well, just in case. (Assuming you're replacin...
30,700
<p>I want to debug a piece of code written in C++. The problem is that the dll is mixed - it contains both C++ and CLI (managed C++). The environment is VS 2005.</p> <p>My entry point is a very simple executable project, written in C++ that just starts the code in the mixed dll. </p> <p>The problem is that: </p> <ol...
<p>Also, try setting your debugger to Mixed. This will allow debugging of both managed and unmanaged code.</p>
<p>You sure you enabled all the debugging options? I have seen this happen when 'forgetting' some when trying to navigate the maze of C++ options.</p>
43,308
<p>I'm running PHP 5.2.3 on Windows 2000 Server with IIS 5. I'm trying to get cURL working, so in my <strong>php.ini</strong> file, I have this line:</p> <blockquote> <p>extension_dir ="F:\PHP\ext"</p> </blockquote> <p>And later, I have:</p> <blockquote> <p>extension=php_curl.dll</p> </blockquote> <p>The file ...
<p>Problem solved!</p> <p>Although the error message said <strong>The specified module could not be found</strong>, this is a little misleading -- it's not that it couldn't find <code>php_curl.dll</code>, but rather it couldn't find a module that <code>php_curl.dll</code> required. The 2 DLLs it requires are <code>li...
<p>In your case just add &quot;F:\PHP\ext&quot; to Environment Variable &quot;path&quot;.</p>
3,340
<p>I have a stub Qt application and I keep getting compiler errors</p> <pre><code>#include &lt;QApplication&gt; int main(int argc, char *argv[]) { return 0; } </code></pre> <p>I used <code>qmake -project</code> and <code>qmake</code> commands and as far as I can tell they did their job correctly. When I subse...
<p>Well I had similar problem before when I was installing MingW downloaded from the web, but in the other hand while installing Qt it will ask you to download the version of MingW which is compatible with Qt. So have you tried installing it when the Qt installer asked you?</p>
<p>Based on the later response from the questioner, not the original question.</p> <p>From the MSYS prompt run "ls /mingw/lib/libmsimg32.a" and see if you have that file. My installation does (MinGW GCC 3.4.5). If you have that file you may need to add -L/mingw/lib. If you don't have the file you may have missed in...
24,268
<p>We have a two-screen DirectX application that previously ran at a consistent 60 FPS (the monitors' sync rate) using a NVIDIA 8400GS (256MB). However, when we swapped out the card for one with 512 MB of RAM the frame rate struggles to get above 40 FPS. (It only gets this high because we're using triple-buffering.) Th...
<p>Are the cards exactly the same (both GeForce 8400GS), and only the memory size differ? Quite often with different memory sizes come slightly different clock rates (i.e. your card with more memory might use slower memory!).</p> <p>So the first thing to check would be GPU core &amp; memory clock rates, using somethin...
<p>It's an easy test to see if the surface lock is the problem, just comment out the texture update and see if the framerate returns to 60hz. Unfortunately, writing to a locked surface and updating the resource kills perfomance, always has. Are you using mipmaps with the textures? I know DX9 added automatic generatio...
8,035
<p>I'm curious as to if there are any best practices relating to JQuery when constructing encapsulated code blocks.</p> <p>Generally, when I construct a page I like to encapsulate the functions used within that page inside an object. This allows me some encapsulation when building applications. There's nothing I hate ...
<p>Since I've been working with jQuery for a while now, I've decided on a standard pattern that works well for me.</p> <p><strike>It's a combination of the YUI module pattern with a bit of jQuery plugin pattern mixed in.</strike>. We ended up using the self executing closure pattern. This is beneficial in a few ways:<...
<p>I usually follow the prototype pattern:</p> <pre><code>MyFunction = function(param1, param2) { this.property1 = param1; // etc. } MyFunction.prototype = { memberOne: function(param1) { // ... }, memberTwo: function(param2) { } } </code></pre> <p>You get something a "construct...
22,876
<p>I've got a Perl script that needs to execute another Perl script. This second script can be executed directly on the command line, but I need to execute it from within my first program. I'll need to pass it a few parameters that would normally be passed in when it's run standalone (the first script runs periodically...
<p>The location of your current perl interpreter can be found in the special variable <code>$^X</code>. This is important if perl is not in your path, or if you have multiple perl versions available but which to make sure you're using the same one across the board.</p> <p>When executing external commands, including o...
<p>I wanted to do something like this to offload non-subroutines into an external file to make editing easier. I actually made this into a subroutine. The advantage of this way is that those "my" variables in the external file get declared in the main namespace. If you use 'do' they apparently don't migrate to the m...
47,625
<p>I have always used <code>||</code> (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: <code>|</code>. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?</p>
<p>Just like the <code>&amp;</code> and <code>&amp;&amp;</code> operator, the double Operator is a "short-circuit" operator.</p> <p>For example:</p> <pre><code>if(condition1 || condition2 || condition3) </code></pre> <p>If condition1 is true, condition 2 and 3 will NOT be checked.</p> <pre><code>if(condition1 | con...
<p>The | operator performs a bitwise OR of its two operands (meaning both sides must evaluate to false for it to return false) while the || operator will only evaluate the second operator if it needs to.</p> <p><a href="http://msdn.microsoft.com/en-us/library/kxszd0kx(VS.71).aspx" rel="nofollow noreferrer">http://msdn...
5,574
<p>When asking about <a href="https://stackoverflow.com/questions/98340/what-are-the-common-undefinedunspecified-behavior-for-c-that-you-run-into">common undefined behavior in C</a>, people sometimes refer to the strict aliasing rule.<br> What are they talking about?</p>
<p>A typical situation where you encounter strict aliasing problems is when overlaying a struct (like a device/network msg) onto a buffer of the word size of your system (like a pointer to <code>uint32_t</code>s or <code>uint16_t</code>s). When you overlay a struct onto such a buffer, or a buffer onto such a struct thr...
<p>Technically in C++, the strict aliasing rule is probably never applicable.</p> <p>Note the definition of indirection (<a href="http://eel.is/c++draft/expr.unary.op#def:indirection" rel="nofollow noreferrer">* operator</a>):</p> <blockquote> <p>The unary * operator performs indirection: the expression to which it...
12,399
<p>What is the correct way to setup a named pipe in C# across a network?</p> <p>Currently I have two machines, 'client' and 'server'.</p> <p>Server sets up its pipe in the following manner:</p> <pre><code>NamedPipeServerStream pipeServer = new NamedPipeServerStream( "pipe", PipeDirection.InOut, 10, P...
<p>You need to set permissions on the NamedPipeServerStream so that the client will have permissions to access the pipe. </p> <p>I would look at the SetAccessControl method of your NamedPipeServerStream.</p>
<p>It is not possible to used named pipes between machines.</p> <p>"The WCF-NetNamedPipe adapter provides cross-process communication on the <strong>same computer</strong>"</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb226493.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb226493...
30,299
<p>I like how SQLite library can be included into an application and the application has a full-fledged database to use.</p> <p>Similarly, is there an open source versioning library that I can include into my application so that I can save versions of files as well as do diffs and merges?</p>
<p>SVN doesn't require any prerequisites on end user machine. You can embed SVN right into you app. To learn more on subversion integration, visit "<a href="http://www.svnforum.org/2017/viewforum.php?f=17&amp;sid=643adb11d5f8edd09544aa435b6f5732" rel="nofollow noreferrer">Application Integration/Embedding</a>" thread o...
<p>In my opinion <a href="http://www.firebirdsql.org/" rel="nofollow noreferrer">Firebird</a> is one of the best choices for embedded DB scenarios.<br> Also <a href="http://www.microsoft.com/sql/editions/compact/default.mspx" rel="nofollow noreferrer">Microsoft SQL Server Compact</a> (closed source, but free) might be ...
6,956
<p>Trying to avoid the .net WebBrowser control (I don't need to navigate to a url, print rendered html or any of the other inbuilt goodies). Wrapping the IE dll seems a bit heavyweight.</p> <p>I simply require something that can display basic html marked up text - an html equivalent of <a href="http://msdn.microsoft....
<p>I developed this <a href="http://www.modeltext.com/html/" rel="noreferrer">HTML control for .NET</a>, which does what you were asking: i.e. display basic html marked up text.</p> <p>It doesn't use IE or any other unmanaged code (except for the .NET framework itself).</p>
<p>While it takes a bit of effort, you can disable almost all of the 'extra' functionality of the built in WebBrowser control.</p> <p>If the built in web browser provides all the functionality you need why look elsewhere?</p>
3,851
<p>Is there a way to tell SQL Server to not cache certain types of plans? For example, if you have a large number of users queries coming from SQL Server Management Studio, is there a way to tell these to not be cached in the plan cache, thus taking up memory and other resources? Are there other behavioral tweaks tha...
<p>I don't know of any ... but, in general, I think that in most high-performance situations where you'd be worried about this level of detail, you'd probably want a production database that is protected from user-submitted queries in the first place. In production, it's not the little bit of memory for these query pla...
<p>I think it's probably unnecessary to worry about restricting this, but <a href="http://www.sqlteam.com/article/what-query-plans-are-in-sql-server-memory" rel="nofollow noreferrer">you can start here</a> and the discussion <a href="http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=86803" rel="nofollow noreferrer">link...
38,009
<p>Does anyone know of any code or tools that can strip literal values out of SQL statements?</p> <p>The reason for asking is I want to correctly judge the SQL workload in our database and I'm worried I might miss out on bad statements whose resource usage get masked because they are displayed as separate statements. ...
<p><a href="http://search.cpan.org/perldoc?SQL::Statement" rel="nofollow noreferrer">SQL::Statement</a>, in particular the <a href="http://search.cpan.org/perldoc?SQL::Statement::Structure" rel="nofollow noreferrer">SQL::Statement::Structure</a> module, will let you parse and manipulate SQL statements. The subset of S...
<p>I think I would use <code>sed</code> to solve this. Something like this</p> <pre><code>$ cat sql.txt SELECT * FROM USER WHERE USERID = 123 OR USERNAME LIKE 'Name1%' SELECT * FROM USER WHERE USERID = 124 OR USERNAME LIKE 'Name2%' SELECT * FROM USER WHERE USERID = 125 OR USERNAME LIKE 'Name3%' SELECT * FROM USER WHER...
26,489
<p>I need a way to determine from Wise Install Script if SQL Server Management Studio Express 2005 is installed on computer. Does someone know a Registry entry or something that will be present when SSMSE is installed?</p>
<p>Most reliable way to detect it would be to use the MSI database to detect the state of SQL Server Management Studio.</p> <p>There is a COM object you can use to query the MSI database:</p> <blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/aa369432.aspx" rel="nofollow noreferrer">http://msdn.micros...
<p>You could try this:</p> <pre><code>HKEY_LOCAL_MACHINE\Software\MSSQLServer\MSSQLServer\CurrentVersion </code></pre> <p>Get the value of CurrentVersion key and compare it with the version of SQL Server Management Studio Express 2005.</p>
43,528
<p>I want to embed an .asp page on an html page. I cannot use an iframe. I tried:</p> <pre><code>&lt;object width="100%" height="1500" type="text/html" data="url.asp"&gt; alt : &lt;a href="url.asp"&gt;url&lt;/a&gt; &lt;/object&gt;" </code></pre> <p>works great in ff but not ie7. Any ideas? Is it possible to use th...
<p>I've solved it in the past using Javascript and XMLHttp. It can get a bit hacky depending on the circumstances. In particular, you have to watch out for the inner page failing and how it affects/downgrades the outer one (hopefully you can keep it downgrading elegantly).</p> <p>Search for XMLHttp (or check <a href="...
<p>Well, after searching around and testing I don't think it is possible. It looks to me like IE does not allow the object tag access to a resource that is not on the same domain as the parent. It would have worked for me if the content I was trying to pull in was on same domain but it wasn't. If anyone could confir...
7,646
<p>What is the benefit of using the servletContext as opposed the request in order to obtain a requestDispatcher?</p> <pre><code>servletContext.getRequestDispatcher(dispatchPath) </code></pre> <p>and using </p> <pre><code>argRequest.getRequestDispatcher(dispatchPath) </code></pre>
<p>It's there in the javadocs in black and white</p> <p><a href="http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)" rel="nofollow noreferrer">http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)</a></...
<p>When you call <code>getRequestDispatcher</code> from <code>ServletContext</code>, you need to provide an absolute path, but for <code>ServletRequest</code> objects, you need to provide a relative path.</p>
19,086
<pre><code>&lt;div&gt; &lt;h1&gt;Title&lt;/h1&gt; &lt;table&gt; ... &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Now, the</p> <pre><code>&lt;h1&gt; </code></pre> <p>has a margin: 0; so it is at the top of the div. The height of the div is 300px.</p> <p>However I'd like the table to be placed at the bottom of the di...
<p>Try this: <a href="http://jsbin.com/emoce" rel="nofollow noreferrer">http://jsbin.com/emoce</a></p> <p>Though it's similar to Darryl's solution. Except I'm not using position:absolute on the wrapping div, but rather position: relative to make the table's position absolute to that.</p>
<p>What about this:</p> <pre><code>&lt;style type="text/css"&gt; #container { position: absolute; margin: 0; height:300px; border:1px solid #000; } #container h1 { margin:0; } #tableContainer { position: absolute; bottom:0; } &lt;/style&gt; &lt;div id="container"&gt; &lt;h1&gt;Titl...
28,364
<p>I need to implement an audit trail for Add/Edit/Delete on my objects,I'm using an ORM (XPO) for defining my objects etc. I implemented an audit trail object that is triggered on </p> <ol> <li>OnSaving </li> <li>OnDeleting</li> </ol> <p>Of the base object, and I store the changes in Audit-AuditTrail (Mast-Det) tabl...
<p>Database triggers are the preferred way to go here, if you can.</p> <p>However, recently I had to do this in client-side code and I ended up writing a class that created a deep (value) copy of the object when it was opened for editing, compared the two objects at save time (using ToString() only) and wrote any chan...
<p>I know this doesn't answer your question, but for the record, I prefer to handle this type of auditing logic in the database.</p>
17,869
<p>We primarily use an ASP.NET environment at work. Right now I'm building an application which uses "Modules", which is just a UserControl, with its' Javascript right in the control, and a link element to the stylesheet for that control. I want to keep it modular, and would like the style of this control to be indepen...
<p>It sounds like you're rolling your own theme engine... why not use ASP.NET Themes?</p> <p>If you're determined to do it yourself, here's some code from the <a href="http://www.codeplex.com/cssfriendly" rel="nofollow noreferrer">CssFriendly project</a> that may be of interest to you. (I think it should be ok to post...
<p>It depends on how big your app is, and whether or not it's dependent on Themes elsewhere, IMHO.</p> <p>If you're using a .skin file, or if the majority of the app is also plugged into the theme, you might as well go with the theme. </p> <p>But if it's just a few styles you need, you're better off to set the styles...
29,092
<p>I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter.</p> <p>The following code works for the test cases I've tried:</p> <pre> private static string ConvertUriToPath(string fileName) { fileName ...
<p>Try looking at the <a href="http://msdn.microsoft.com/en-us/library/system.uri.localpath.aspx" rel="noreferrer">Uri.LocalPath</a> property.</p> <pre><code>private static string ConvertUriToPath(string fileName) { Uri uri = new Uri(fileName); return uri.LocalPath; // Some people have indicated that uri.Loc...
<p>Can you just use <code>Assembly.Location</code>?</p>
35,203
<p>This line in YUI's <a href="http://developer.yahoo.com/yui/reset/" rel="nofollow noreferrer">Reset CSS</a> is causing trouble for me:</p> <pre class="lang-css prettyprint-override"><code>address,caption,cite,code,dfn,em,strong,th,var { font-style: normal; font-weight: normal; } </code></pre> <p>It makes my...
<p>If your strong declaration comes after YUI's yours should override it. You can force it like this:</p> <pre><code>strong, b, strong *, b * { font-weight: bold; } em, i, em *, i * { font-style: italic; } </code></pre> <p>If you still support IE7 you'll need to add <code>!important</code>.</p> <pre><code>strong, b,...
<p>I thought I had an ideal solution:</p> <pre><code>strong, b { font-weight: bold; font-style: inherit; } em, i { font-style: italic; font-weight: inherit; } </code></pre> <p>Unfortunately, Internet Explorer doesn't support "inherit." :-(</p>
4,046
<p>I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest .NET...
<p>You may need to modify the query to include the owner if there's more than one in the database.</p> <pre class="lang-sql prettyprint-override"><code>DECLARE @cmd varchar(4000) DECLARE cmds CURSOR FOR SELECT 'drop table [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'prefix%' OPEN cmds...
<p>Try following code:</p> <pre><code>declare @TableLst table(TblNames nvarchar(500)) insert into @TableLst (TblNames) SELECT 'DROP TABLE [' + Table_Name + ']' FROM INFORMATION_SCHEMA.TABLES WHERE Table_Name LIKE 'yourFilter%' WHILE ((select COUNT(*) as CntTables from @TableLst) &gt; 0) BEGIN declare @ForExecCms nv...
2,641
<p>Do you do automated testing on a complex workflow system like K2?</p> <p>We are building a system with extensive integration between Sharepoint 2007 and K2. I can't even imagine where to start with automated testing as the workflow involves multiple users interacting with Sharepoint, K2 workflows and custom web pag...
<p>I'm having a similar problem testing workflow-heavy MOSS-based application. Workflows in our case are based on WWF.</p> <p>My idea is to mock pretty much everything that you can't control from unit tests - documents storage, authentication, user rights and actions, sharepoint-specific parts of workflows for sharepo...
<p>We've just today written an application that monitors our K2 worklist, picks up certain tasks from it, fills in some data and submits the tasks for completion. This is allowing us to perform automated testing, find regressions, and run through as many different paths of the workflow in a fraction of the time that it...
17,296