instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We're doing windows mobile development using the WM6 Professional emulator through visual studio 2008 for now. My question is, can you get the emulator image to simulate having a storage card? We run our SQLCE 3.5 database off the removable storage card in our devices and it'd be slick to just have the emulator simu... | <p>Yes, it is possible to setup a storage card for the emulator.</p>
<p>In the emulator window, goto File/Configure. On the General tab there is a setting for Shared Folder. You can point this at a directory on your host machine. The directory will show up as a storage cord on the em.</p>
| <p>As already mentioned, yes the Storage card is emulated. Thought its good to always test on a real hardware device before releasing. I have found that sometimes the Storage Card on the emulator is not 100% consistent with hardware access. Actually, the emulator can be a bit buggy in this regard.</p>
<p>For example, ... | 43,335 |
<p>When writing multi-threaded applications, one of the most common problems experienced are deadlocks. </p>
<p>My questions to the community are:</p>
<ol>
<li><p>What is a deadlock? </p></li>
<li><p>How do you detect them? </p></li>
<li><p>Do you handle them? </p></li>
<li><p>And finally, how do you prevent them f... | <p>A <strong>lock</strong> occurs when multiple processes try to access the same resource at the same time.</p>
<p>One process loses out and must wait for the other to finish.</p>
<p>A <strong>deadlock</strong> occurs when the waiting process is still holding on to another resource that the first needs before it can ... | <p>Mutex in essence is a lock, providing protected access to shared resources. Under Linux, the thread mutex data type is pthread_mutex_t. Before use, initialize it.</p>
<p>To access to shared resources, you have to lock on the mutex. If the mutex already on the lock, the call will block the thread until the mutex is ... | 5,479 |
<p>I want to send an email from my iPhone application. I have heard that the iOS SDK doesn't have an email API. I don't want to use the following code because it will exit my application:</p>
<pre><code>NSString *url = [NSString stringWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from... | <p>On iOS 3.0 and later you should use the <code>MFMailComposeViewController</code> class, and the <code>MFMailComposeViewControllerDelegate</code> protocol, that is tucked away in the MessageUI framework.</p>
<p>First add the <a href="https://developer.apple.com/documentation/messageui" rel="nofollow noreferrer">fram... | <p>I wrote a simple wrapper called KRNSendEmail that simplify sending email to one method call.<br><br>
The KRNSendEmail is well documented and added to CocoaPods.
<br><br>
<a href="https://github.com/ulian-onua/KRNSendEmail" rel="nofollow noreferrer">https://github.com/ulian-onua/KRNSendEmail</a></p>
| 40,068 |
<p>I tried committing files with CRLF-ending lines, but it failed.</p>
<p>I spent a whole work day on my Windows computer trying different strategies and was almost drawn to stop trying to use Git and instead try <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a>.</p>
<p>How to properly han... | <p>Almost four years after asking this question, I have finally
found <strong>an answer that completely satisfies me</strong>!</p>
<p>See the details in <strong>github:help</strong>'s guide to
<a href="https://help.github.com/articles/dealing-with-line-endings/">Dealing with line endings</a>.</p>
<blockquote>
<p>Gi... | <p>This is just a <strong>workaround</strong> solution:</p>
<p>In normal cases, use the solutions that are shipped with git. These work great in most cases. Force to LF if you share the development on Windows and Unix based systems by setting <strong>.gitattributes</strong>.</p>
<p>In my case there were >10 programme... | 20,619 |
<p>I actually have an answer to my question but it is not parallelized so I am interested in ways to improve the algorithm. Anyway it might be useful as-is for some people.</p>
<pre><code>int Until = 20000000;
BitArray PrimeBits = new BitArray(Until, true);
/*
* Sieve of Eratosthenes
* PrimeBits is a simple BitArra... | <p>You might save some time by cross-referencing your bit array with a doubly-linked list, so you can more quickly advance to the next prime.</p>
<p>Also, in eliminating later composites once you hit a new prime p for the first time - the first composite multiple of p remaining will be p*p, since everything before tha... | <pre><code> void PrimeNumber(long number)
{
bool IsprimeNumber = true;
long value = Convert.ToInt32(Math.Sqrt(number));
if (number % 2 == 0)
{
IsprimeNumber = false;
MessageBox.Show("No It is not a Prime NUmber");
return;
}
for ... | 5,073 |
<p>Returning to WinForms in VS2008 after a long time.. Tinkering with a OOD problem in VS2008 Express Edition.</p>
<p>I need some controls to be "display only" widgets. The user should not be able to change the value of these controls... the widgets are updated by a periodic update tick event. I vaguely remember there... | <p>For some typical winforms controls:</p>
<p><a href="http://jquiz.wordpress.com/2007/05/29/c-winforms-readonly-controls/" rel="noreferrer">http://jquiz.wordpress.com/2007/05/29/c-winforms-readonly-controls/</a></p>
<p>This is also a good tip to preserve the appearance:</p>
<pre><code> Color clr = textBox1.BackC... | <p>I was given this same requirement at work yesterday. Except instead of a textbox I had to make an entire form disabled without changing it's color.</p>
<p>So I replaced a call to</p>
<pre><code>form->Enabled = false;
</code></pre>
<p>with</p>
<pre><code>IntPtr hWnd = form->Handle;
HWND window_handle = (HWN... | 31,941 |
<p>I have a binary file - Windows static library (*.lib).<br>
Is there a simple way to find out names of the functions and their interface from that library ?</p>
<p>Something similar to <code>emfar</code> and <code>elfdump</code> utilities (on Linux systems) ?</p>
| <p>Assuming you're talking about a static library, <code>DUMPBIN /SYMBOLS</code> shows the functions and data objects in the library. If you're talking about an import library (a <code>.lib</code> used to refer to symbols exported from a DLL), then you want <code>DUMPBIN /EXPORTS</code>.</p>
<p>Note that for function... | <p>1) Open a Developer Command Prompt for VS 2017 (or whatever version you have on your machine)(It should be located under: Start menu --> All programs --> Visual Studio 2017 (or whatever version you have on your machine) --> Visual Studio Tools
--> Developer Command Prompt for VS 2017.</p>
<p>2) Enter the followin... | 39,257 |
<p>I have a simple message box in a WPF application that is launched as below:</p>
<pre><code>private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Howdy", "Howdy");
}
</code></pre>
<p>I can get <a href="http://www.codeplex.com/white" rel="nofollow noreferrer" title="white">white</a> to cl... | <p>Found it! The window class has a MessageBox method that does the trick:</p>
<pre><code> var app = Application.Launch(@"c:\ApplicationPath.exe");
var window = app.GetWindow("Window1");
var helloButton = window.Get<Button>("Hello");
Assert.IsNotNull(helloButton);
helloButt... | <p>Contained in the White source code are some UI tests projects (to test White itself).</p>
<p>One of the test includes MessageBox tests, which includes a way to obtain the displayed message.</p>
<pre><code>[TestFixture, WinFormCategory, WPFCategory]
public class MessageBoxTest : ControlsActionTest
{
[Test]
... | 17,340 |
<p>Is it acceptable to submit from an http form through https? It seems like it should be secure, but it allows for a man in the middle attack (<a href="http://ask.metafilter.com/48531/are-http-forms-posted-thru-https-secure" rel="noreferrer">here is a good discussion</a>). There are sites like <a href="http://www.mi... | <p>Posting a form from an http page to an https page does encrypt the data in the form when it is transmitted in the most simple terms. If there is a man-in-the-middle attack, the browser will warn you.</p>
<p>However, if the original http form was subjected to man-in-the-middle and the https post-back address was mod... | <p>I think the main consideration of this question has to do with the URL that users know and the protocol scheme (http:)that browsers substitute by default.</p>
<p>In that case, the normal behavior of a site that wants to ensure an encrypted channel is to have the <a href="http://home-page" rel="nofollow noreferrer">... | 34,548 |
<p>Other than <code>self.class.send :method, args...</code>, of course. I'd like to make a rather complex method available at both the class and instance level without duplicating the code.</p>
<hr>
<p><strong>UPDATE:</strong> </p>
<p>@Jonathan Branam: that was my assumption, but I wanted to make sure nobody else ... | <p>Here is a code snippet to go along with the question. Using "private" in a class definition does not apply to class methods. You need to use "private_class_method" as in the following example.</p>
<pre><code>class Foo
def self.private_bar
# Complex logic goes here
puts "hi"
end
private_class_method :p... | <p>Unless I'm misunderstanding, don't you just need something like this:</p>
<pre><code>class Foo
private
def Foo.bar
# Complex logic goes here
puts "hi"
end
public
def bar
Foo.bar
end
end
</code></pre>
<p>Of course you could change the second definition to use your se... | 4,099 |
<p>I've got a tomcat 6 web app running with Apache httpd as the front end. I'm using mod_proxy and mod_proxy_ajp to forward the requests to tomcat. My server is running Ubuntu. Now I'm trying to use mod_rewrite to remove the leading www, so that my canonical website URL is <code>http://example.com</code> rather than <c... | <p><strong>Trying to answer your question</strong>: To debug Apache operation you can adjust the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#loglevel" rel="nofollow noreferrer">LogLevel</a> to a lower level (maybe <code>debug</code>). But even if you put <code>debug</code> if you disable the Log for the mod... | <p>Try increasing the logging level up to 9 (the maximum).<br>
Be sure apache has the proper rights to the log file (although if it created it, it seems likely it could write to it too).<br>
Try a different rewrite rule, with no condition, for example <code>RewriteRule .* www.google.com [RL]</code></p>
| 26,465 |
<p>Can I expose a class from another .net namespace as a class in my namespace? I use a class - antlr.collections.AST - as the return type for a function belonging to a class in my namespace; as a result, the user has to have</p>
<pre><code>using antlr.collections;
using myNamespace;
</code></pre>
<p>at the top of t... | <p>Bear in mind that the consumers of your code won't actually <em>need</em> to have using statements. Those are there to make their lives easier, so they don't have to type antlr.collections.Foo and antlr.collections.Bar all over their source.</p>
<p>The bigger "impact" (if indeed there really is a severe one) is tha... | <p>No, you can't.</p>
<p>The full path to and name of a class is part of its identity.</p>
| 16,793 |
<p>I have an excel file which has more than 65536 rows. However, I can see only first 65536 of them. Is it possible to see all of them in Excel 2007?</p>
| <p>Here is an interesting <a href="http://blogs.msdn.com/excel/archive/2005/09/26/474258.aspx" rel="noreferrer">blog entry about numbers / limitations of Excel 2007</a>. According to the author the new limit is approximately <strong>one million rows</strong>.</p>
<p>Sounds like you have a <strong>pre-Excel 2007 workbo... | <p>Yes, the new limit is approximately 1 million rows.</p>
<p><a href="http://blogs.msdn.com/excel/archive/2005/09/26/474258.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/excel/archive/2005/09/26/474258.aspx</a></p>
| 24,069 |
<p>I was curious what the differences are between the debug and release modes of the .NET compiler and came across these questions about <a href="https://stackoverflow.com/questions/90871/debug-vs-release-in-net">debug vs release in .NET</a> and <a href="https://stackoverflow.com/questions/312312/what-are-some-reasons-... | <p>You're using TDD. You write your test. The test fails. You write the code to pass the test. The code fails. You look at the code you wrote and can't see any obvious reason why it fails. Do you reason some more or start up the test in the debugger (using TestDriven.Net) and step through the test? Maybe I'm jus... | <p>For debugging.</p>
<p>Like tvanfosson said, even if you usually don't use the debugger (I know I don't), sometimes you need to.</p>
| 45,129 |
<p>Is it worth learning the convention or is it a bane to readability and maintainability?</p>
| <p>Considering that most people that use <em>Hungarian Notation</em> is following the misunderstood version of it, I'd say it's pretty pointless.</p>
<p>If you want to use the original definition of it, it might make more sense, but other than that it is mostly syntactic sugar.</p>
<p>If you read the <a href="http://... | <p>I've been working for IBM for the past 6 months and I haven't seen it anywhere (thank god because I hate it.) I see either camelCase or c_style.</p>
<pre><code>thisMethodIsPrettyCool()
this_method_is_pretty_cool()
</code></pre>
| 2,734 |
<p>I need to develop a system for storing large numbers (10's to 100's of thousands) of objects. Each object is email-like - there is a main text body, and several ancillary text fields of limited size. A body will be from a few bytes, to several KB in size. </p>
<p>Each item will have a single unique ID (probably... | <p>Look at <a href="http://www.sqlite.org" rel="nofollow noreferrer">SQLite</a>, it has bindings for many programming languages and environments available and is, like the <a href="http://en.wikipedia.org/wiki/Berkeley_DB" rel="nofollow noreferrer">Berkeley DB</a>, a database on disk without the need for a database eng... | <p>Have a look at <a href="http://webglimpse.net/" rel="nofollow noreferrer">Glimpse</a>.</p>
| 32,619 |
<p>There's an in-house program we use and it's stored on a UNC share so that updates are transparent. I'd like to supply it some command line parameters like so:</p>
<pre><code>\\server\share\in_house_thingy.exe myusername mypassword
</code></pre>
<p>But I can't seem to get it to work in either CMD or PowerShell or ... | <p>You could use:</p>
<pre><code>$app = '\\server\share\in_house_thingy.exe'
$arguments = 'myusername mypassword'
$process = [System.Diagnostics.Process]::Start($app, $arguments)
</code></pre>
<p>The $process object will give you a live process object if you want to get an exit code or other information from that pr... | <p>I just noticed that there's a .CMD file that's copying the file from the share to the temp directory and running it locally.</p>
<p>If y'all could just vote this answer up if there's no better solution, that'll work.</p>
| 38,824 |
<p>I am trying the FDT editor on a project that previously ran successfully in Flash CS3.</p>
<p>FDT builds and runs it successfully but the SWF is blank (white). I've tried a few viewers on the output file and it is actually blank.</p>
<p>One difference is that now my project doesn't seem to include my entry <code>... | <p>The equivalent would be the constructor of the main class. That's the class that you specify for compiling (in principle, the rest of the classes are compiled only if they are referenced in code being compiled, be it the main class or any class reference by it).</p>
<p>In the Flash IDE, it would be the constructor ... | <p>You can ONLY publish fla based content from the Flash IDE, so if you're not going to use that anymore you'll need to publish an assets swf of your graphics, etc.</p>
<p>I presume you're using the MXML compiler? If so check adobe live docs on how to set the stage size etc. </p>
| 28,386 |
<p>I'm using a native DLL (FastImage.dll) in a C# ASP.NET Web Service that sometimes locks (can't delete it---says access denied); this requires stopping IIS to delete the DLL. The inability to delete this DLL in the bin folder of my published Web Service prevents me from publishing successfully (even though it thinks ... | <p>Using the IISReset command line tool will only restart IIS on the local machine, not on a remote server to which you are publishing.</p>
<p>Assuming that you are publishing to a Windows 2003 server, I'd suggest trying the slightly less drastic step of stopping and restarting the IIS AppPool in the web site or virtu... | <p>You could use the IISReset command line tool to stop/restart iis. So you could write a simple batch file to stop iis, copy your files, and then restart iis. I'm not sure how to integrate this with the VS publish feature however.</p>
| 5,594 |
<p>I want To open Table By Sql 2008 Enterprise Manager Interface</p>
<p>As in Sql2005 Enterprise Manager Interface by Right Click then Click open Table.</p>
| <p>Right-click on the table in question and select "Edit Top 200 Rows".</p>
<p>The "200" is configurable from the <strong>Tools\Options</strong> dialog under "<em>SQL Server Object Explorer</em>"</p>
<p>Changing the value for "<em>Value for Edit Top Rows command</em>" to <strong>0</strong> will return all rows for e... | <p>I think this feature has been removed. Try the "Edit top 200 rows" command. It will do the same, but not fetch every row of a (potentially) huge table.</p>
| 48,445 |
<p>I just pasted some generated javadoc into an eclipse project, to discover none of the HTML is compliant.</p>
<p>There is even cases of closing tags that were never opened.</p>
<p>Is there some way to fix this? Maybe a "be compliant" option...</p>
| <p>After some googling, I discovered <a href="http://linux.softpedia.com/get/Documentation/XHTML-Doclet-28836.shtml" rel="noreferrer">
XHTML Doclet 0.4</a>.</p>
<blockquote>
<p>XHTML Doclet is a standards-compliant
alternative to the Javadoc standard
HTML doclet. The project revises the
document structure to e... | <p>The short answer is that JavaDocs predate XHTML.</p>
<p>There was an interesting thread on the Java Posse group about this recently that you might find interesting:
<a href="http://groups.google.com/group/javaposse/browse_thread/thread/107ee3f67e0b7520" rel="nofollow noreferrer">why is javadoc stuck in 1997?</a></p... | 33,500 |
<p>I am working with a legacy ASP Classic solution which is load balanced (via external hardware and has an IIS site the home directory of which is an UNC path. I've been told that the following issues with this setup currently exist: </p>
<ol>
<li>When using an UNC path as home directory, there is an "index" somewher... | <p>Yes, it is possible, but yes, it can cause problems.</p>
<p>When ASP.NET compiles ASPX, ASCX, and other content pages into assemblies, it creates a lot of FileSystemWatchers in order to monitor the dependencies between them so that when files change, it can recompile. These eat up NetBIOS resources.</p>
<p>Additi... | <p>For answer 3 you can change the Network BIOS command limit. Its a pretty easy registry edit fix: <a href="http://support.microsoft.com/kb/810886/en-us" rel="nofollow noreferrer">http://support.microsoft.com/kb/810886/en-us</a></p>
<p>I have run into that particular issue myself.</p>
| 15,037 |
<p>Using VB.NET, how do I toggle the state of Caps Lock? </p>
| <p>From: <a href="http://www.vbforums.com/showthread.php?referrerid=61394&t=537891" rel="noreferrer">http://www.vbforums.com/showthread.php?referrerid=61394&t=537891</a></p>
<pre><code>Imports System.Runtime.InteropServices
Public Class Form2
Private Declare Sub keybd_event Lib "user32" ( _
ByVal... | <p>I use this</p>
<pre><code>Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Private Const KEYEVENTF_EXTENDEDKEY As Integer = &H1
Private Const KEYEVENTF_KEYUP As Integer = &H2
'put this where you want to turn caps lo... | 8,339 |
<p>I'm venturing into web programming for the first time and would like a nice way to display a frequency indicator of some data, in the form of a <a href="http://en.wikipedia.org/wiki/Tag_cloud" rel="nofollow noreferrer">tag cloud</a>.</p>
<p>For example, pretend I have some simple data of three types of pets: Dog, C... | <p>I don't believe this is the answer you're looking for, but there is a Cloud Control for ASP.NET available at CodeProject:</p>
<p><a href="http://www.codeproject.com/KB/aspnet/cloud.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/cloud.aspx</a></p>
<p>It's looks fairly easy to use.</p>
<p>--</... | <p>I hope this would help. </p>
<p><a href="https://web.archive.org/web/20210616112719/https://aspnet.4guysfromrolla.com/articles/102506-1.aspx" rel="nofollow noreferrer">https://web.archive.org/web/20210616112719/https://aspnet.4guysfromrolla.com/articles/102506-1.aspx</a></p>
| 21,635 |
<p>I had an idea for a client-side language other than JavaScript, and I'd like to look into developing a Firefox plugin that would treat includes of this new language in a page, like <script type="newscript" src="path/script.ns" />, just as if it were a natively supported language. The plugin would do all of the la... | <p><a href="https://stackoverflow.com/questions/69982/writing-a-firefox-plugin-for-parsing-a-custom-client-side-language#70239">@Nathan de Vries</a>: no, actually, NPAPI plugins you suggested don't let one implement support for <code><script type=...></code>.</p>
<p>OP: this is not easy, but look for PyDOM and P... | <p>Do you really want to tie your pages to your own custom scripting language? Or are you just looking to write your client-side code in something that's not javascript? If the latter try <a href="http://milescript.org/" rel="nofollow noreferrer">MileScript</a>, <a href="http://haxe.org/" rel="nofollow noreferrer">Haxe... | 9,541 |
<p>I am develop a medium system in ASP.net with MS SQL Server Database and I wonder <strong>what is the best way to create a model layer with LINQ or create own classes that dealing with database?</strong></p>
| <p>The best way is subjective, but I think the easiest is to use <a href="http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx" rel="nofollow noreferrer">LINQ to SQL.</a></p>
| <p>Using the LINQ designer is a great way to build your model in a UI avoiding the need to write any code. You can setup object hierarchy using the inheritance option and also have associated classes which you can access via the datacontext in code. All of the SQL is then handled for you and means you don't have to w... | 37,487 |
<p>Attempting to insert an escape character into a table results in a warning. </p>
<p>For example:</p>
<pre><code>create table EscapeTest (text varchar(50));
insert into EscapeTest (text) values ('This is the first part \n And this is the second');
</code></pre>
<p>Produces the warning:</p>
<pre><code>WARNING: n... | <p>Partially. The text is inserted, but the warning is still generated.</p>
<p>I found a discussion that indicated the text needed to be preceded with 'E', as such:</p>
<pre><code>insert into EscapeTest (text) values (E'This is the first part \n And this is the second');
</code></pre>
<p>This suppressed the warning,... | <p>Really stupid question: Are you sure the string is being truncated, and not just broken at the linebreak you specify (and possibly not showing in your interface)? Ie, do you expect the field to show as</p>
<blockquote>
<p>This will be inserted \n This will not
be</p>
</blockquote>
<p>or</p>
<blockquote>
<p>This will... | 2,336 |
<blockquote>
<p>Note that this question continues from <a href="https://stackoverflow.com/questions/15414/">Is it possible to coax Visual Studio 2008 into using italics for comments?</a></p>
</blockquote>
<p>If the long question title got you, here's the problem:</p>
<blockquote>
<p>How to convert the style prope... | <p>Alright, I've successfully used FontForge to create a copy of Consolas (although this should work with any font) with the bold style actually being italics.</p>
<p>These are the steps that I followed:</p>
<ul>
<li>Install <a href="http://fontforge.sourceforge.net/" rel="noreferrer">FontForge</a>. It's a lot easier... | <p>I did the italics-as-bold trick on Consolas back in July 2007 and posted a <a href="http://damieng.com/blog/2007/07/11/italic-syntax-highlighting-in-visual-studio-2005" rel="nofollow noreferrer">screenshot of it on my blog</a>.</p>
<p>I used FontLab which does a great job but a custom tool to copy and set the header... | 3,814 |
<p>I have a local MINICPAN repository, but I want to remove a specific version of a module, and inject an older version.</p>
<p>This is the steps I've taken.</p>
<pre><code>- create the MINICPAN, not filtering any modules
- use mcpani --add for the module in question
- use mcpani --inject
</code></pre>
<p>At this po... | <p>Filter the modules that you are going to inject. The <a href="http://search.cpan.org/dist/CPAN-Mini" rel="nofollow noreferrer">CPAN::Mini</a> has the documentation for filtering, and I think I had some examples in the resources I pointed you toward earlier. :)</p>
<p>If you already have the minicpan, as you said in... | <p>Another strategy would be to use <a href="https://metacpan.org/pod/Pinto" rel="nofollow">Pinto</a>. Unlike a minicpan, a Pinto repository contains <em>only</em> the distributions you want (and their dependencies), so there is no need for filtering. This results in a much smaller and more manageable pile of files, ... | 33,047 |
<p>Just getting my head around Ruby metaprogramming. The mixin/modules always manage to confuse me. </p>
<ul>
<li><strong>include</strong>: mixes in specified module methods as <strong>instance methods</strong> in the target class</li>
<li><strong>extend</strong>: mixes in specified module methods as <strong>class met... | <p>What you have said is correct. However, there is more to it than that.</p>
<p>If you have a class <code>Klazz</code> and module <code>Mod</code>, including <code>Mod</code> in <code>Klazz</code> gives instances of <code>Klazz</code> access to <code>Mod</code>'s methods. Or you can extend <code>Klazz</code> with <cod... | <p>I came across a very useful <a href="https://dev.to/abbiecoghlan/ruby-modules-include-vs-extend-vs-prepend-4gmc" rel="nofollow noreferrer">article</a> that compares <code>include</code>, <code>extend</code> and <code>prepend</code> methods used <strong>inside a class</strong>:</p>
<p><code>include</code> adds module... | 18,914 |
<p>If i have lots of directory names either as literal strings or contained in variables, what is the easiest way of combining these to make a complete path?</p>
<p>I know of <pre>Path.Combine</pre> but this only takes 2 string parameters, i need a solution that can take any number number of directory parameters.</p>
... | <blockquote>
<p>Does C# support unlimited args in methods?</p>
</blockquote>
<p>Yes, have a look at the params keyword. Will make it easy to write a function that just calls Path.Combine the appropriate number of times, like this (untested):</p>
<pre><code>string CombinePaths(params string[] parts) {
string res... | <p>Try this one:</p>
<pre><code>public static string CreateDirectoryName(string fileName, params string[] folders)
{
if(folders == null || folders.Length <= 0)
{
return fileName;
}
string directory = string.Empty;
foreach(string folder in folders)
{
directory = System.IO.Pat... | 17,420 |
<p>In which cases would you use which? Is there much of a difference? Which I typically used by persistence engines to store booleans?</p>
| <p>A TINYINT is an 8-bit integer value, a BIT field can store between 1 bit, BIT(1), and 64 bits, BIT(64). For a boolean values, BIT(1) is pretty common.</p>
| <p>From my experience I'm telling you that BIT has problems on linux OS types(Ubuntu for ex).
I developped my db on windows and after I deployed everything on linux, I had problems with queries that inserted or selected from tables that had BIT DATA TYPE. </p>
<p>Bit is not safe for now.
I changed to tinyint(1) and w... | 36,986 |
<p>This might be a little hard to explain, but I will try.</p>
<p>I want to display a list of categories (stored in 1 table), and number of domains associated with each category (stored in another table). </p>
<p>The monkey wrench in this case is that each domain has a set of records associated with it (which are sto... | <pre><code>SELECT Categories.Name,count(DISTINCT categories.name) FROM Categories
JOIN Domains ON Categories.ID=Domains.CID
JOIN Records ON Records.DID=Domains.ID
GROUP BY Categories.Name</code></pre>
<p>Tested with following setup:</p>
<pre><code>
CREATE TABLE Categories (Name nvarchar(50), ID int NOT NULL IDENTITY... | <p>Something like this?</p>
<pre><code>SELECT c.name, count(d.id)
FROM categories c
JOIN domains d ON c.id = d.cid
JOIN records r ON r.did = d.id
GROUP BY c.name;
</code></pre>
| 24,934 |
<p>I recently switched my hosting provider and due to the time zone that the server is now in, my code has stopped working. </p>
<p>The hosting server reports in Pacific time, However, my code needs to work with GMT as my site is for the UK market. So, all my displays and searches need to be in the format dd/MM/yyyy</... | <p>In your web.config file add <code><globalization></code> element under <code><system.web></code> node:</p>
<pre><code><system.web>
<globalization culture="en-gb"/>
<!-- ... -->
</system.web>
</code></pre>
| <p>I had this problem which the above answers didn't solve. So maybe this can help someone not to tear all their hair off..</p>
<p>I got NaN-NaN-Nan on the new server in my date-textbox. Found out that the new server had the internet explorer option "Display intranet sites in Compability Mode".
Workaround here was to... | 32,170 |
<p>Does anyone have a good way to build MSI (vdproj) projects using MsBuild or Nant? </p>
<p>I know <a href="http://forums.msdn.microsoft.com/en-US/msbuild/thread/6e213531-9d88-43ef-8262-fe0e4e7f479a/" rel="nofollow noreferrer">one answer</a> was to install Visual Studio on the build server and just use devenv.exe to... | <p>Short of the method you mentioned above (devenv), there is no way to do this with the current version of MSBuild. </p>
<p>The method the Visual Studio team uses to run their MSI builds is with <a href="http://wix.sourceforge.net/" rel="noreferrer">Windows Installer XML</a>. You can learn more about using WiX to dep... | <p>We use <a href="http://wix.sourceforge.net/" rel="nofollow noreferrer">Wix</a> to automate MSI builds for IronPython and IronRuby.</p>
<p>EDIT: to clarify, this probably means starting over from scratch when building your installer. While Wix has a mechanism to create a configuration directly from a preexisting MS... | 4,444 |
<p>I have heard that this is what JavaRebel does but is there any other good way to deploy a new version of an EAR while allowing users to remain active on the previous version? We use JBoss for the application server...</p>
| <p>It's not what JavaRebel does. JavaRebel (according to description) hot-replaces the classes in memory. It's not acceptable in the case of existing connections to the system, since the updated classes may break the client's logic.</p>
<p>Once a company I was working for had a similar problem, and it was solved this ... | <p>I think you might want to look into Spring using OSGI framework.
<a href="http://www.springframework.org/osgi" rel="nofollow noreferrer">http://www.springframework.org/osgi</a></p>
| 27,353 |
<p>I feel like I should know this, but I haven't been able to figure it out...</p>
<p>I want to get the name of a method--which happens to be an integration test--from inside it so it can print out some diagnostic text. I can, of course, just hard-code the method's name in the string, but I'd like to make the test a ... | <p>This seems to be the simplest way using module <code>inspect</code>:</p>
<pre><code>import inspect
def somefunc(a,b,c):
print "My name is: %s" % inspect.stack()[0][3]
</code></pre>
<p>You could generalise this with:</p>
<pre><code>def funcname():
return inspect.stack()[1][3]
def somefunc(a,b,c):
prin... | <p>I think the <a href="http://www.python.org/doc/2.5.2/lib/module-traceback.html" rel="nofollow noreferrer"><code>traceback</code></a> module might have what you're looking for. In particular, the <code>extract_stack</code> function looks like it will do the job.</p>
| 30,426 |
<p>Is there a 4 byte unsigned int data type in MS SQL Server?</p>
<p>Am I forced to use a bigint?</p>
| <p>It doesn't seem so.</p>
<p>Here's an article describing how to create your own rules restricting an <code>int</code> to positive values. But that doesn't grant you positive values above <code>2^31-1</code>.</p>
<p><a href="http://www.julian-kuiters.id.au/article.php/sqlserver2005-unsigned-integer" rel="noreferrer... | <p>I used BINT(11) instead of INT(11), and it acts as UNSIGNED INT(11)</p>
| 39,403 |
<p>Our application commonly used an ActiveX control to download and install our client on IE (XP and prior), however as our user base has drifted towards more Vista boxes with "Protected Mode" on, we are required to investigate.</p>
<p>So going forward, is it worth the headache of trying to use the protected mode API?... | <p>This client, is it a desktop application and not some software that runs inside the browser? In that case, please just supply a regular download installer application. My personal experience with browser-hosted installers is that they are just confusing and the few I have seen seemed to be poorly coded in some way.<... | <p>Have you checked out Microsoft's <a href="http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx" rel="nofollow noreferrer">ClickOnce Deployment</a>?</p>
<p>If I remember correctly you can embed a manifests which would help with dealing with protected modes automatically, saving you those headaches with the A... | 10,381 |
<p>An interface is a 100% abstract class, so we can use an interface for efficient programming. Is there any situation where an abstract class is better than an interface?</p>
| <p>Abstract classes are used when you do intend to create a concrete class,
but want to make sure that there is some <strong>common state</strong> in all the subclasses
or a possible <strong>common implementation</strong> for some operations.</p>
<p>Interfaces cannot contain either.</p>
| <p>In general, interfaces describe the public API that your code should use, whereas abstract base classes are best kept as an implementation detail, where common code or state can be kept, to reduce duplication in any implementing classes.</p>
<p>By using interfaces in your API, it becomes easier for people (includin... | 41,800 |
<p>I'm inserting an img tag into my document with the new Element constructor like this (this works just fine):</p>
<pre><code>$('placeholder').insert(new Element("img", {id:'something', src:myImage}))
</code></pre>
<p>I would like to trigger a function when this image loads, but I can't figure out the correct syntax... | <p>In this case, the best solution is to not use Prototype or at least not exclusively. This works:</p>
<pre><code>var img = new Element('img',{id:'logo',alt:'Hooray!'});
img.onload = function(){ alert(this.alt); };
img.src = 'logo.jpg';
</code></pre>
<p>The key is setting the onload directly instead of letting Proto... | <p>You might have to move the function elsewhere and call it by name</p>
<pre><code>$('placeholder').insert(new Element("img",
{id:'something', src:myImage, onload:"javascript:moo()"}))
function moo() {
alert("MOO");
}
</code></pre>
<p>Of course, because <code>insert</code> returns the element, you could in... | 35,224 |
<p>I realize I'm probably just dumb and missing something big and important, but I can't figure out how to specify a timeout in twisted using reactor.listenUDP. My goal is to be able to specify a timeout, and after said amount of time, if DatagramProtocol.datagramReceived has not been executed, have it execute a callba... | <p>Since Twisted is event driven, you don't need a timeout per se. You simply need to set a state variable (like datagramRecieved) when you receive a datagram and register a <a href="http://twistedmatrix.com/projects/core/documentation/howto/time.html" rel="nofollow noreferrer">looping call</a> that checks the state v... | <p>A better way to do this is with <code>twisted.protocols.policies.TimeoutMixin</code>. It's essentially doing a <code>callLater</code> but abstracted into a <code>Mixin</code>.</p>
| 27,338 |
<p>I have the following character string: </p>
<pre><code>"..1....10..20....30...40....50...80..."
</code></pre>
<p>and I need to extract all numbers from it into array. </p>
<p>What is the best way to do it in C? </p>
| <p>Perhaps the easiest way is to use the <code>strtok()</code> function (or <code>strtok_r()</code> if reentrancy is a concern):</p>
<pre><code>char str[] = "..1...10...20";
char *p = strtok(str, ".");
while (p != NULL) {
printf("%d\n", atoi(p));
p = strtok(NULL, ".");
}
</code></pre>
<p>Once you have the res... | <p>I prefer the use of strtok in a for loop. Makes it feel more natural, though the syntax looks a little weird.</p>
<pre><code>char str[] = "..1....10..20....30...40....50...80..."
for ( char* p = strtok( strtok, "." ); p != NULL; p = strtok( NULL, "." ) )
{
printf( "%d\n", atoi( p ) );
}
</code></pre>
| 23,560 |
<p>I have a C# program which uses a SQL Server database.I am already using it in a country that uses . as decimal separator.
Now I want to use it in another country that uses , as decimal separator.</p>
<p>in C# is there some application level setting that I can change or write some code so that I can use the same da... | <p>If you built the query using string concatenation, use parameters instead.
So instead of writing:</p>
<pre><code> var query = "insert into tblproducts(productId,Price) values('" + article + "','"
+ price + ')';
</code></pre>
<p>use <a href="http://msdn.microsoft.com/library/yy6y35y8.aspx" rel="nofollow norefe... | <p>you can do a couple of things to fix this.</p>
<p>first, if you are taking values in from the interface, then you are casting these values to a decimal. Decimal.parse is a culture dependant function and will use the current culture to parse values. Therefore if the CurrentCulture uses commas as decimal separators t... | 46,047 |
<p>I have to read invoice ascii files that are structured in a really convoluted way, for example:</p>
<pre><code>55651108 3090617.10.0806:46:32101639Example Company Construction Company Example Road. 9 9524 Example City
</code></pre>
<p>There's actually additional stuff in there, bu... | <p>"If the input was somewhat structured and well defined, how would you guard against future changes in its structure. How would you design and implement a reader?"</p>
<p>You must define the layout in a way you can flexibly pick it apart.</p>
<p>Here's a python version</p>
<pre><code>class Field( object ):
def... | <p>I believe that a template describing the entity names and the value types is good one. Something like a "schema" for a text file.</p>
<p>What I would try to do is to separate the reader from the rest of the application as much as possible. So, the question really is, how to define an interface that will be able to ... | 48,524 |
<p>I want my client code to look somewhat like this:</p>
<pre><code> val config:Config = new MyConfig("c:/etc/myConfig.txt")
println(config.param1)
println(config.param2)
println(config.param3)
</code></pre>
<p>Which means that:</p>
<ul>
<li>The Config interface defines the config fields</li>
... | <p>There's nothing preventing you from just making the values abstract. You cannot enforce laziness in the super-trait, but that's ok since lazy-loading is really an implementation detail anyway:</p>
<pre><code>trait Config {
val param1: String
val param2: String
val param3: Int
}
class MyConfig extends Config... | <p>If you just want to simplify it, the "param" fields could be methods...</p>
<pre><code>trait Config {
def param1:String
def param2:String
def param3:Int
}
class MyConfig(fileName:String) extends Config {
lazy val data:Map[String, Any] = readConfig
// some dummy impl here, should read from a file
prote... | 44,990 |
<p>There are a number of obfuscation programs out there for .Net and I've tried one, my exe seems much slower when obfuscated. Do all obfuscation programs have the same effect or have I chosen a bad one? I'm hoping some are better than others, if you know of a fast one let me know.</p>
| <p>Obfuscation <em>shouldn't</em> change the runtime performance of your code. If it is then you've got a bad obfuscator that's doing much more than just obfuscating. All obfuscation should do is make your IL hard to read.</p>
| <p>There are <a href="http://howtoselectguides.com/dotnet/obfuscators/1st#dp_methods" rel="nofollow noreferrer">different obfuscation methods</a> that tools can use. There are the simple rename methods that should not affect performance in any way. Other methods might change the flow of the code. That could have a nega... | 9,010 |
<p>Short version: What is the cleanest and most maintainable technique for consistant presentation and AJAX function across all browsers used by both web developers and web developers' end-users?</p>
<ul>
<li>IE 6, 7, 8</li>
<li>Firefox 2, 3</li>
<li>Safari</li>
<li>Google Chrome</li>
<li>Opera</li>
</ul>
<p>Long ver... | <p>I am in a similar situation, working on a web app that is targeted at IT professionals, and required to support the same set of browsers, minus Opera.</p>
<p>Some general things I've learned so far:</p>
<ul>
<li>Test often, in as many of your target browsers as you can. Make sure you have time for this in your dev... | <p>If your very top priority is exactly consistent presentation on all the browsers listed with no disparities, you should probably be looking at AS3 and Flex.</p>
| 6,707 |
<p>I have an asp.net 2.0 page that contains 2 <code>UpdatePanels</code>.</p>
<p>The first panel contains a <code>TreeView</code> control, when I select a node in the three view control it triggers an update of the second <code>UpdatePanel</code> only. This much is behaving correctly.</p>
<p>There are two buttons on t... | <p>From <a href="http://www.asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx" rel="nofollow noreferrer">UpdatePanel Control Overview [asp.net]</a></p>
<blockquote>
<h3>Controls that Are Not Compatible with UpdatePanel Controls</h3>
<p>The following ASP.NET controls are not compatible with partial-page ... | <p>I think you're right about the AJAX partial page postback that it doesn't update the hidden input __ViewState.</p>
<p>I have the same thing with my update panels when a user navigates back to the pages in my website application form. The normal inputs have updated the viewstate and so their values are repopulated b... | 25,124 |
<p>I know what <code>yield</code> does, and I've seen a few examples, but I can't think of real life applications, have you used it to solve some specific problem?</p>
<p>(Ideally some problem that cannot be solved some other way)</p>
| <p>I realise this is an old question (pre Jon Skeet?) but I have been considering this question myself just lately. Unfortunately the current answers here (in my opinion) don't mention the most obvious advantage of the yield statement.</p>
<p>The biggest benefit of the yield statement is that it allows you to iterate ... | <p>Using yield can prevent downcasting to a concrete type. This is handy to ensure that the consumer of the collection doesn't manipulate it.</p>
| 3,783 |
<p>What is the best way to limit the amount of text that a user can enter into a 'textarea' field on a web page? The application in question is ASP .NET, but a platform agnostic answer is preferred.</p>
<p>I understand that some amount of javascript is likely needed to get this done as I do not wish to actually perfor... | <p>use a RegularExpressionValidator Control in ASP.Net to validate number of character along with with usual validation</p>
| <p>jQuery also provides some <a href="http://www.ajaxray.com/blog/2007/11/09/interactive-character-limit-for-textarea-using-jquery/" rel="nofollow noreferrer">options</a> here. Options, options, and options.</p>
| 49,544 |
<p>I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own OpenID provider, just because it's harder :) How do you do this in Ubuntu?</p>
<p>Edit: Replacing 'server' with the correct term OpenID provider (Identity provider would also be correct according to <a href="http://en.wikipedia.org/wiki... | <p>I personnally used <a href="https://siege.org/phpmyid.html" rel="nofollow noreferrer">phpMyID</a> just for StackOverflow. It's a simple two-files PHP script to put somewhere on a subdomain. Of course, it's not as easy as installing a .deb, but since OpenID relies completely on HTTP, I'm not sure it's advisable to in... | <p>I totally understand where you're coming from with this question. I already had a OpenID at <a href="http://www.myopenid.com" rel="nofollow noreferrer">www.myopenid.com</a> but it feels a bit weird relying on a 3rd party for such an important login (a.k.a my permanent "home" on the internet).</p>
<p>Luckil... | 4,820 |
<p>I am creating a Windows service. When an exception occurrs, I handle it appropriately and create a log. I am using the <a href="http://en.wikipedia.org/wiki/Decorator_pattern" rel="nofollow noreferrer">decorator pattern</a>, as there are many different ways people will be looking at these logs. I have an email logge... | <p>Why don't put it in the actual Windows Event log if logger fails?</p>
| <p>Create separate ping service on a well behaving machine which you trust to be very reliable. If your primary service fails then ping also fails and control service then should send you e-mail with warning.</p>
| 44,975 |
<p>I want to store a very large amount of vector data on a server and only poll the parts I need at a given point...</p>
<p>This shouldn't be a problem.</p>
<p>Is there any way to take a vector file like an svg file and import it into a database? I could always write an svg parser to import it into my database, but i... | <p>I don't think you can call it a standard, but here is an interesting link to an academic paper:</p>
<p><strong><a href="http://www.svgopen.org/2004/papers/ADesignandImplementationofSpatialDatabasebasedonxmlsvg/" rel="nofollow noreferrer">A Design and Implementation of Spatial Database Based on XML-SVG</a></strong><... | <p>I could always put a giant svg document into a database, but I need to be able to look up vertices at lightning fast speed and I already have all the information in an svg document. I just need a rationalized way of implementing the information in a database.</p>
| 37,193 |
<p>I have really strange problem. Thing is that my print (first layer) started ok, not good nor perfect but ok and everything was going well but then all of a sudden, near the end of a print, quality drops drastically. I'm not really sure but I think this happened because of under extrusion. I'm not so good with Englis... | <blockquote>
<p>Do anyone have any ideas? What this can be? How can I fix this?</p>
</blockquote>
<p>At least judging from the pictures, that <em>does</em> seem like under-extrusion. Some ideas for further investigating the issue.</p>
<p><strong>The problem may be due to the gcode being wrong</strong>. In this ca... | <p>You can try to reduce your retractions (try setting it to half what it is now and try again)</p>
<p>If your retraction is too big you can pull hot plastic into the cold area of the hotend and create a partial clog - this happened to me yesterday when I tried to intentionally print with way too much retraction to ma... | 786 |
<p>I have integrated SRM 5.0 into Portal. Most of the iviews are IAC i.e., all are ITS based services.</p>
<p>The issue is that the Portal Theme does not get reflected on these services after integration.</p>
<p>When a BSP or Webdynpro is integrated then the application reflects the Portal Theme when executed from Port... | <p>I think this would depend on how your product was sold to the customer.</p>
<p>If you only sell it in packages...</p>
<pre><code>PACKAGE 1 -> 3 reports, date entry, some other stuff.
PACKAGE 2 -> 6 reports, more stuff
PACKAGE 3 -> 12 reports, almost all the stuff
UBER PACKAGE -> everything
</code></pre... | <p>The key value pair table, but with everything is stored as a string and with another column (if necessary) saying which type should the value be casted to.</p>
<pre><code>CREATE TABLE configKVP(clientId int, key varchar, value varchar, type varchar)
</code></pre>
<p>If the value cannot be casted to the type, then ... | 17,873 |
<p>How do I make <code>diff</code> ignore temporary files like <code>foo.c~</code>? Is there a configuration file that will make ignoring temporaries the default?</p>
<p>More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project by ema... | <p>This doesn't strictly answer your question, but you can avoid the problem by configuring Emacs to use a specific directory to keep the backup files in. There are different implementations for Emacs or XEmacs.</p>
<p>In GNU Emacs</p>
<pre>
(defvar user-temporary-file-directory
(concat temporary-file-direc... | <p>You can create a small sunction/script to it, like:</p>
<pre><code>#!/bin/bash
olddir="/tmp/old"
newdir="/tmp/new"
pushd $newdir
for files in $(find . -name \*.c)
do
diff $olddir/$file $newdir/$file
done
popd
</code></pre>
<p>This is only one way to script this. The simple way. But I think you got the idea.</p>... | 5,304 |
<p>The title pretty much says it all. :-) I have lots of virtual hosts and I want to put a single rewriting block at the top of the httpd.conf file that rewrites URLs no matter which virtual host the request might be directed to. How the heck do I do this?</p>
<p>I found <a href="http://www.webmasterworld.com/forum... | <p>Specify <code>RewriteOptions InheritDown</code> in the parent scope (such as httpd.conf) to get your rules applied in child Virtual Hosts without modifing them.</p>
<p>This will only work on Virtual Hosts where the <code>RewriteEngine</code> directive is set to <code>on</code>:</p>
<blockquote>
<p>Note that rewr... | <p>I've always used a "catch-all" VHost for directives I wanted across the board, like......</p>
<pre><code>Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ErrorLog "/var/log/apache2/error_log"
</VirtualHost>
<VirtualHost *:80>
ServerName alloftherestoftheVHosts.com
DocumentRoot "/ServiceData/...... | 44,821 |
<p>Is there a better, more jQuery-ish way of handling this image substitution?</p>
<pre><code>var image = $(obj).children("img");
if ($(image).attr("src") == "Images/TreeCollapse.gif")
$(image).attr("src", "Images/TreeExpand.gif");
else
$(image).attr("src", "Images/TreeCollapse.gif");
</code></pre>
| <p>Why set a variable when it isn't needed?</p>
<pre><code>$(obj).children("img").toggle(
function(){ $(this).attr("src", "Images/TreeExpand.gif"); },
function(){ $(this).attr("src", "Images/TreeCollapse.gif"); }
);
</code></pre>
| <p>Not really.</p>
<p>I know... extremely helpful answer. What you are doing is pretty succinct and I'm not so sure there would be anything to make it more "jQueryish" as you ask. </p>
<p>now depending on how you are iterating through this if you are doing it to multiple image instances, that is where there might b... | 44,300 |
<p>I'm looking to move some of my lighter weight metaprogramming from Nemerle to Boo and I'm trying to figure out how to define custom operators. For example, I can do the following in Nemerle:</p>
<pre><code>macro @<-(func, v) {
<[ $func($v) ]>
}
</code></pre>
<p>Then these two are equivalent:</p>
<pr... | <p>While Boo supports operator overloading by defining the appropriate static operator function (<code>op_addition</code>), and also supports syntactic macros, it does not support creating custom operators at this time.</p>
| <p>I'm not sure if this is exactly what you need but you can create syntactic macros in Boo. There's some information on the CodeHaus site, <a href="http://boo.codehaus.org/Syntactic+Macros" rel="nofollow noreferrer">http://boo.codehaus.org/Syntactic+Macros</a>, but the syntax has changed in one of the recent releases.... | 23,557 |
<p>Is it possible to use a ".net configuration" file for a .NET console application? </p>
<p>I'm looking for an equivalent to web.config, but specifically for console applications...</p>
<p>I can certainly roll my own, but If I can use .NET's built in configuration reader then I would like to do that...I really just ... | <p>Yes - use app.config.</p>
<p>Exactly the same syntax, options, etc. as web.config, but for console and WinForms applications.</p>
<p>To add one to your project, right-click the project in Solution Explorer, Add..., New Item... and pick "Application Configuration File" from the Templates box.</p>
| <p>Yes, it's possible. You just need to make an app.config file.</p>
| 20,255 |
<p>I need to take any given valid XML schema (XSD) and denormalize it to a simple form containing no refs, no includes, etc. All simple type definitions should be inline, such that when looking at any given element, all declarations are visible without performing another lookup.</p>
<p>I've found some tools that have... | <p>You might find XSD4J helpful:</p>
<p><a href="http://dynvocation.selfip.net/xsd4j/" rel="nofollow noreferrer">http://dynvocation.selfip.net/xsd4j/</a></p>
| <p>Another useful API for XML Schema is <a href="https://xsom.java.net/" rel="nofollow">XSOM</a>.</p>
<p>XSOM is used by <a href="http://docs.oracle.com/javase/6/docs/technotes/tools/share/xjc.html" rel="nofollow">XJC</a>, JAXB schema compiler under the hub so is probably guaranteed to be kept alive.</p>
| 14,198 |
<p>One of my Websites is on a Shared Hosting Provider, running either .net 2.0 or .net 3.0, but not 3.5 SP1.</p>
<p>I wonder if it would be possible to still use 3.5 SP1 by simply deploying all the 3.5 assemblies into the /bin Folder, since technically it's all still the 2.0 CLR.</p>
<p>I know that if my Host ever up... | <p>I'm pretty sure you can't do this, but googling on the following blogs may get you the definitive answer:</p>
<p><a href="http://weblogs.asp.net/Scottgu/" rel="nofollow noreferrer">ScottGu</a>
<a href="http://www.hanselman.com/blog/" rel="nofollow noreferrer">ScottHa</a>
<a href="http://blogs.msdn.com/brada/" rel="... | <p>I've successfully run some EntityFramework websites on hosts that only had .net 3.5 installed. I copied the System.Data.Entity.dll and the System.Web.Entity from Program Files%/Reference Assemblies. I also had to modify my web.config and remove the references to the System.Data.Entity and System.Web.Entity.</p>
<... | 37,582 |
<p>Why is <code>volatile</code> needed in C? What is it used for? What will it do?</p>
| <p><code>volatile</code> tells the compiler not to optimize anything that has to do with the <code>volatile</code> variable.</p>
<p>There are at least three common reasons to use it, all involving situations where the value of the variable can change without action from the visible code:</p>
<ul>
<li>When you interface... | <p>it does not allows compiler to automatic changing values of variables. a volatile variable is for dynamic use.</p>
| 30,539 |
<p>I'm creating an asp.net app with just some lite data access from xml files. However, I need to be able to authenticate administrative users (via forms) to manage that data. I don't want to stand up a sql db just for authentication purposes. I'd like to use xml, but not sure about security with that. Any suggesti... | <p>Try the following: </p>
<pre><code>int number = 0;
while (number != 25)
{
Console.WriteLine("Guess a number between 20 through 25");
number = int.Parse(Console.ReadLine());
if (number != 25)
Console.WriteLine("Keep guessing");
else
Console.WriteLine("Merry Christmas");
}
</code></pr... | <pre><code>int number;
do
{
Console.WriteLine("Guess a number between 20 through 25");
number = int.Parse(Console.ReadLine());
} while (number != 25);
Console.WriteLine("Merry Christmas");
</code></pre>
<p>Would be correct if you want them to be able to enter numbers higher than 25.</p>
| 37,120 |
<p>If you are using ASP.NET MVC how are you doing grid display?
Rolled your own?
Got a library from somewhere?</p>
<p>These are some of the known grid display solutions I have found for ASP.NET MVC</p>
<ul>
<li><a href="http://www.codeproject.com/KB/aspnet/MVCFlexigrid.aspx" rel="noreferrer">ASP.NET MVC Flexgrid </a>... | <p>We have been using <a href="http://www.trirand.com/blog/?page_id=6" rel="noreferrer">jqGrid</a> on a project and have had some good luck with it. Lots of options for inline editing, etc. If that stuff isn't necessary, then we've just used a plain foreach loop like @Hrvoje.</p>
| <p>Try: <a href="http://mvcjqgridcontrol.codeplex.com/" rel="nofollow noreferrer">http://mvcjqgridcontrol.codeplex.com/</a>
It's basically a MVC-compliant jQuery Grid wrapper with full .Net support</p>
| 21,356 |
<p>I am writing a tool to help students learn regular expressions. I will probably be writing it in Java.</p>
<p>The idea is this: the student types in a regular expression and the tool shows which parts of a text will get matched by the regex. Simple enough.</p>
<p>But I want to support several different regex "flav... | <p>Alternatively, you could use <a href="http://jakarta.apache.org/oro/" rel="nofollow noreferrer">Jakarta ORO</a>?</p>
<p>This supports the following regex 'flavors':</p>
<ul>
<li>Perl5 compatible regular expressions</li>
<li>AWK-like regular expressions</li>
<li>glob expressions</li>
</ul>
| <p>if you want your students to learn regex,why not use a freely available tool -- regex Coach -- <a href="http://www.weitz.de/regex-coach/" rel="nofollow noreferrer">http://www.weitz.de/regex-coach/</a> on the net that is pretty good to learn and evaluate regexes ?</p>
<p>look at this SO thread on a similar issue -- ... | 28,157 |
<p>I want to do this: </p>
<blockquote>
<p>//*fu</p>
</blockquote>
<p>which returns all nodes whose name ends in <strong>fu</strong>, such as <code><tarfu /></code> and <code><snafu /></code>, but not <code><fubar /></code></p>
| <p>Do something like:</p>
<pre><code>//*[ends-with(name(), 'fu')]
</code></pre>
<p>For a good XPath reference, check out <a href="http://www.w3schools.com/xml/xsl_functions.asp" rel="noreferrer">W3Schools</a>.</p>
| <p>I struggled with Dimitre Novatchev's answer, it wouldn't return matches. I knew your XPath must have a section telling that "fu" has length 2. </p>
<p>It's advised to have a string-length('fu') to determine what to substring.</p>
<p>For those who aren't able to get results with his answer and they require solution... | 6,815 |
<p>I already know the obvious answer to this question: "just download <insert favorite windows grep or grep-like tool here>". However, I work in an environment with strict controls by the local IT staff as to what we're allowed to have on our computers. Suffice it to say: I have access to Perl on Windows XP. H... | <p>Most of the power of grep is already available on your machine in the Windows application FindStr.exe which is part of all Windows 2000, XP and Vista machines! It offers RegExpr etc.</p>
<p>Far easier than a batch file which in turn calls Perl!</p>
<pre><code>c:\>FindStr /?
Searches for strings in files.
... | <p>You need to do something like this:</p>
<pre><code>@echo off
perl -x -S script.pl %1
</code></pre>
<p>The "%1" will pass the argument to the Perl script. Save it as a .bat file, and you're good to go.</p>
| 13,156 |
<p>There are some tasks, especially the ones that involve deleting folders as SU, that I do thoughtfully and slowly before I press the Enter key. I think if others saw me do these at the careful pace that I do they would cringe. Are there critical programming tasks that you perform that you believe deserve this thought... | <p>Changes to live databases, actually I do a backup first just in case even know I'm extra careful :)</p>
| <p>Common code. I.e. changes to old, shared code which is used in multiple independent programs.</p>
| 32,594 |
<p>I have a method in an objective-C class. It has 2 callback functions written in C. The class pointer i.e. <code>self</code> is passed to these functions as <code>void *</code>. In the C functions I create a pointer of type class and assign the <code>void *</code> parameter.
The first callback function executes succe... | <p>Are your problems specifically with the IOKit callback routines? The problem with the specific example you gave is that the IOServiceMatchingCallback takes only 2 parameters, not 3. You need your RawDeviceAdded() and BulkTestDeviceAdded() callback functions to match the IOServiceMatchingCallback prototype and to a... | <p>This is what Objective-C's selector is for:
<a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/NSInvocationOperation_Class/Reference/Reference.html" rel="nofollow noreferrer"><a href="http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/NSInvocationOperation_Class" re... | 40,920 |
<p>Is there a way run Emacs from a USB drive? I am a Windows user and I would like to be able use it on any PC without an Emacs install.</p>
| <p>Yes, the "normal" Emacs distribution for Windows is precompiled and just runs without having to do any install. Just get <a href="http://ftp.gnu.org/gnu/windows/emacs/" rel="noreferrer">one of the *.zip files from the usual place</a>, unpack it onto a USB disk, and you can use it directly. (The actual binary is insi... | <p>I have ported emacs to portable apps format.</p>
<p><a href="http://esnm.sourceforge.net/download.html" rel="nofollow noreferrer">http://esnm.sourceforge.net/download.html</a></p>
| 45,600 |
<p>I'm about to start testing an intranet web application. Specifically, I've to determine the application's performance.</p>
<p>Please could someone suggest formal/informal standards for how I can judge the application's performance.</p>
| <p>Use some tool for stress and load testing. If you're using Java take a look at <a href="http://jakarta.apache.org/jmeter/" rel="noreferrer">JMeter</a>. It provides different methods to test you application performance. You should focus on:</p>
<ul>
<li><strong>Response time</strong>: How fast your application is ru... | <p>To test the front-end then YSlow is great for getting statistics for how long your pages take to load from a user perspective. It breaks down into stats for each specfic HTTP request, the time it took, etc. Get it at <a href="http://developer.yahoo.com/yslow/" rel="nofollow noreferrer">http://developer.yahoo.com/ysl... | 6,326 |
<p>Please write a list of tasks that a copy constructor and assignment operator need to do in C++ to keep exception safety, avoid memory leaks etc. </p>
| <p>First be sure you really need to support copy. Most of the time it is not the case, and thus disabling both is the way to go.</p>
<p>Sometimes, you'll still need to provide duplication on a class from a polymorphic hierarchy, in that case: disable the assignment operator, write a (protected?) copy constructor, and ... | <p>I have no idea about exception safely here but I go this way. Let's imagine it's a templated array wrapper. Hope it helps :)</p>
<pre><code>Array(const Array& rhs)
{
mData = NULL;
mSize = rhs.size();
*this = rhs;
}
Array& operator=(const Array& rhs)
{
if(... | 26,417 |
<p>I was pointed to SubSonic (www.subsonicproject.com), but then I found WebWidgetry (www.nthpenguin.com) Before I dig into them too much I'm curious to know who's used either and what the pro's and con's might be?</p>
<p>Thanks for the help,
Jim</p>
| <p>I have used SubSonic once before and it was incredibly easy to setup and use. I was actually quite impressed, and for ORM tools it takes a lot to impress me.</p>
| <p>WebWidgetry, seems to be in a release candidate while subsonic is a fairly well known ORM mapper. </p>
<p>WW also seems to be going for a totally different market.
Subsonic is a general purpose ORM which is modelled to be fast and easy to use. </p>
<p>My basic advice if you want to use anything in production wait... | 32,942 |
<p>I'm currently working on a web application which has a page which displays a single chart (a .png image). On another part of this page there are a set of links which, when clicked, the entire page reloads and looks exactly the same as before except for the chart in the middle of the page.</p>
<p>What I want to do ... | <p>I've used something like this to preload an image and then automatically call back to my javascript when the image is finished loading. You want to check complete before you setup the callback because the image may already be cached and it may not call your callback.</p>
<pre><code>function PreloadImage(imgSrc, cal... | <p>@iAn's solution looks good to me. The only thing I'd change is instead of using setTimeout, I'd try and hook into the images 'Load' event. This way, if the image takes longer than 3 seconds to download, you'll still get the spinner.</p>
<p>On the other hand, if it takes less time to download, you'll get the spinn... | 7,441 |
<p>The last time I took on a non-trivial .Net/C# application I used Castle Monorail and, on the whole, enjoyed the experience. Early-access/preview releases of .Net MVC were not yet available. Many "Microsoft shops" will now find the "official" solution more appealing. Has anyone gone from Monorail to .Net MVC. </p>
<... | <p>While I haven't made the switch yet, I have developed on both platforms and have been doing some pre-switch analysis. </p>
<p>It looks like the biggest difference would be the View Engines. Our Monorail stuff uses the Brail view engine while asp.net mvc comes (stock) with a webforms like view engine. There are o... | <p>The ASP.NET MVC team is still making changes before v1.0, so now's a good time to <a href="http://forums.asp.net/1146.aspx" rel="nofollow noreferrer">provide feedback</a>.</p>
<p>Also, be aware that there are more frequent releases on <a href="http://www.codeplex.com/aspnet" rel="nofollow noreferrer">CodePlex</a>, ... | 4,389 |
<p>What is the best way to determine available bandwidth in .NET?</p>
<p>We have users that access business applications from various remote access points, wired and wireless and at times the bandwidth can be very low based on where the user is. When the applications appear to be running slow, the issue could be due ... | <p>Not beyond the obvious of downloading a file of a known size and timing how long it takes. the disadvantage of that is that you'd need to waste a lot of bandwidth to do it. Also, if you wanted to alert when throughput drops below a threshold, you'll have to run the test more-or-less continuously.</p>
<p>IMHO, I'd... | <p>If you're transferring data, simply measure it. You could also download a reference object from somewhere if you want to make it independent of the speed of your server.</p>
| 17,985 |
<p>I have a project that builds fine If I build it manually but it fails with CC.NET.</p>
<p>The error that shows up on CC.NET is basically related to an import that's failing because file was not found; one of the projects (C++ dll) tries to import a dll built by another project. Dll should be in the right place sinc... | <p>Can you change CC to use msbuild instead of devenv? That seems like the optimal solution to me, as it means the build is the same in both situations.</p>
| <p>I wonder if CC.Net is building with different environment variables, such that the necessary library directories aren't properly added to the path.</p>
<p>Is there any specific error message in the CC.Net build log as to why that particular DLL import failed? Could not find file? Permissions? Look in the detailed C... | 34,500 |
<p>I am adding dynamically controls to page by using LoadControl and Controls.Add. I need somehow to wrap Init and Load event handlers of this loaded controls into my code. So it should be such order of events <em>SomeMyCode() -> Control.Init() -> AnotherMyCode()</em> and the same for Load <em>SomeMyCode() -> Control.L... | <p>Usually you can just remove the '>' and it will work. It's a matter of how your CSS and HTML is written. I'd give it a shot. </p>
| <p>You could target them using JavaScript, but that hardly is a real solution since it would require javaScript for something that should be done by CSS. You could also modify your HTML to have specific classes, but that means modifying you HTML. I don't really think there are any 'nice' solutions, I would probably hac... | 48,735 |
<p>Carbon 3d made a 100x faster printer which has a simple and cheap mechanism using a Teflon layer. It appears to have a 20mn in RnD Costs and $7000 mass market production cost.</p>
<p>The only access method for one is a USD$ 161,250 yearly subscription.</p>
<p>Their printer is not available in shapeways... Is there... | <p>I will take the question seriously, and consider reasons why Carbon 3D might choose to offer their technology through a yearly subscription, rather than building a product accessible to the consumer market. These reasons are speculation and do not reflect any specific knowledge about Carbon 3D, the details of their... | <p>It looks like they have only one innovation: their resins. Everything else looks like standard SLA. </p>
<p>All the things Carbon 3D are pitching on their website are more about having a dedicated support team than some fancy printer, and that's what they're selling. </p>
<p>As to why they don't make a home versio... | 667 |
<p>I need to create a user control in either vb.net or c# to search a RightNow CRM database. I have the documentation on their XML API, but I'm not sure how to post to their parser and then catch the return data and display it on the page.</p>
<p>Any sample code would be greatly appreciated!</p>
<p>Link to API: <a hr... | <p>I don't know RightNow CRM, but according to the documentation you can send the XML requests using HTTP post. The simplest way to do this in .NET is using the WebClient class. Alternatively you might want to take a look at the HttpWebRequest/HttpWebResponse classes. Here is some sample code using WebClient:</p>
<pre... | <p>This will Create a Contact in Right now</p>
<pre><code> class Program
{
private RightNowSyncPortClient _Service;
public Program()
{
_Service = new RightNowSyncPortClient();
_Service.ClientCredentials.UserName.UserName = "Rightnow UID";
_Service.ClientCredentials.UserName.Passwo... | 16,945 |
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7ab67d24-6afa-4be6-855e-e260845a47e2/" rel="noreferrer">Tell me it ain't so</a>.</p>
<p>I have a typical windows/file explorer like setup.</p>
<ul>
<li>Left Side I have a TreeView all data bound showing nodes in a hierachy</li>
<li>Right Side I have... | <p>A really simple solution is to bind your "details" UI elements to the SelectedValue property of the TreeView. For example, if your TreeView looked like this:</p>
<pre><code><TreeView Name="CategoryName" ItemsSource="{Binding Source={StaticResource A_Collection}, Path=RootItems}" />
</code></pre>
<p>Then you ... | <p>My solution to this turned out to be pretty tiny.. don't know if it is equivalent to IsSynchronizedWithCurrentItem. ListView refreshes as expected.</p>
<pre><code>// the XAML
<TreeView DockPanel.Dock="Left" x:Name="tvwNodes" ItemsSource="{Binding}" SelectedItemChanged="OnNewNodeSelected"/>
<ListView x:Name... | 48,924 |
<p>I'm using maven 2.0.9 with Eclipse 3.3.2.</p>
<p>I'm used to launching a fresh build once per day by a <code>mvn clean install</code>.
Then, if I refresh my Eclipse project, it will be "polluted" by files from Maven's <em>target</em> directory.</p>
<p>That's very annoying while performing searches, getting resourc... | <p>Right click on the folder you want to ignore, open the "Properties" dialog, chose the "Resource" tab and check the box that says "Derived"</p>
| <p>When Eclipse freezes, looking at the process activity, I can see it browsing all my target, .hg and .git directories. Moreover, those directories are also copied into Eclipse's bin directory. A lot of CPU and disk usage for nothing.</p>
<p>Not cleaning the target directory is not an acceptable solution.</p>
<p>The... | 35,946 |
<p>I tried to use <code>OPTION (MAXRECURSION 0)</code> in a view to generate a list of dates.
This seems to be unsupported. Is there a workaround for this issue?</p>
<p>EDIT to Explain what I actually want to do:</p>
<p>I have 2 tables.</p>
<p>table1: int weekday, bool available</p>
<p>table2: datetime date, bool a... | <p><a href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124653" rel="nofollow noreferrer">No</a> - if you can find a way to do it within 100 levels of recusion (have a table of numbers), which will get you to within 100 recursion levels, you'll be able to do it. But if you have a numbe... | <p>You can use a <a href="http://blog.crowe.co.nz/archive/2007/09/06/Microsoft-SQL-Server-2005---CTE-Example-of-a-simple.aspx" rel="nofollow noreferrer">CTE</a> for hierarchical queries.</p>
| 31,680 |
<p>What is the equivalent of <code>/dev/null</code> on Windows?</p>
| <p>I think you want <code>NUL</code>, at least within a command prompt or batch files.</p>
<p>For example:</p>
<pre><code>type c:\autoexec.bat > NUL
</code></pre>
<p>doesn't create a file.</p>
<p>(I <em>believe</em> the same is true if you try to create a file programmatically, but I haven't tried it.)</p>
<p>I... | <p>You have to use <strong><em>start</em></strong> and <strong><em>$NUL</em></strong> for this in <strong>Windows PowerShell</strong>:</p>
<p>Type in this command assuming <code>mySum</code> is the name of your application and <code>5</code> <code>10</code> are command line arguments you are sending.</p>
<pre><code>s... | 40,360 |
<p>I'm trying to get tags working in my rails application and want to use acts_as_taggable. Firstly I followed the instructions I found in Rails Recipies (a free sample bit online) that used the acts_as_taggable plugin. However, I then found <a href="http://taggable.rubyforge.org/" rel="nofollow noreferrer">this site</... | <p>You could also try <a href="http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids" rel="nofollow noreferrer">acts_as_taggable_on_steroids</a>:</p>
<blockquote>
<p>This plugin is based on acts_as_taggable by DHH but includes extras such as tests, smarter tag assignment, and tag cloud calculations.</p... | <p>Have you tried running something like "gem query -l -n <em>taggable</em>" to check whether it has installed correctly into your local gem repository?</p>
<p>If it has you could use some of the built in checks against it - <a href="http://www.rubygems.org/read/chapter/10" rel="nofollow noreferrer">Gem is good for th... | 28,338 |
<p>Obviously there are security reasons to close a wireless network and it's not fun if someone is stealing your bandwidth. That would be a serious problem?</p>
<p>To address the first concern: Does a device on the same wireless network have any special privileges or access that an other device on the internet has?<b... | <p>Bruce Schneier is famous for running an open wireless network at home (<a href="http://www.schneier.com/blog/archives/2008/01/my_open_wireles.html" rel="noreferrer">see here</a>). He does it for two reasons:</p>
<ol>
<li>To be neighborly (you'd let your neighbor borrow a cup of sugar, wouldn't you? Why not a few me... | <p>@kronoz: I guess it depends on where you live. Only two houses are within reach of my wireless network, excluding my own. So I doubt that small number of people can affect my bandwidth. But if you live in a major metro area, and many people are able to see and get on the network, yeah, it might become a problem.</p>... | 5,295 |
<p>I found <a href="http://www.databaseanswers.org/data_models/" rel="nofollow noreferrer">http://www.databaseanswers.org/data_models/</a> very useful. Any other suggestions?</p>
| <p>If you're just looking for data models, I recommend the following books:</p>
<ul>
<li><a href="https://rads.stackoverflow.com/amzn/click/com/0471380237" rel="nofollow noreferrer" rel="nofollow noreferrer">The Data Model Resource Book, Vol.
1: A Library of Universal Data
Models for All Enterprises</a></li>
<li><a hr... | <p>Microsoft have db samples in <strong>VS2005</strong> and <strong>VS2008</strong>, but you can also download it from here:
<a href="http://msdn.microsoft.com/en-us/library/ms227484.aspx" rel="nofollow noreferrer">Northwind Database</a></p>
| 44,635 |
<p>How do I share state amongst TestMethods in MSTest. These tests would be run as Ordered Tests and in sequence.</p>
<pre><code> private TestContext testContext;
public TestContext TestContext
{
get { return this.testContext; }
set { this.testContext = value;}
}
[TestMethod]
... | <p>Vyas, I agree with Chad that you're still doing it wrong. </p>
<p>That said, you can look into using the TestContext object.</p>
<p>See <a href="http://blogs.msdn.com/vstsqualitytools/archive/2006/01/10/511030.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/vstsqualitytools/archive/2006/01/10/511030.aspx</a... | <p>As Chad had pointed out, it seems that I have no alternative but to use a single test [For once the tool is forcing me to do the right thing ;)] to test the whole flow.</p>
<p>Seems that I could use TestContext.BeginTimer & EndTimer to time each call in the method.</p>
<p>Here's the link to MSDN Forum where I ... | 25,893 |
<p>I can never remember the differences in regular expression syntax used by tools like <a href="http://en.wikipedia.org/wiki/Grep" rel="noreferrer">grep</a> and <a href="http://en.wikipedia.org/wiki/AWK" rel="noreferrer">AWK</a>, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm ... | <p><a href="https://rads.stackoverflow.com/amzn/click/com/0596528124" rel="nofollow noreferrer" rel="nofollow noreferrer">Mastering Regular Expressions</a>, devotes the last four chapters to Java, PHP, Perl, and <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a>. One chapter for e... | <p>I find this site helpful: <a href="http://www.regular-expressions.info/" rel="noreferrer">http://www.regular-expressions.info/</a></p>
<p>Other than that, I use the corresponding documentation extensively and I believe, all said and done, there's no way around that.</p>
| 4,322 |
<p>I am building a blog type page, and I want to load items into the page as the user scrolls down, much like Google Reader, or Soup.io. How would you go about achieving this effect? I've seen some examples which read the height of the page, and have an onScroll even attached to the window so that as the user scrolls d... | <p>Unspace had an article demonstrating this functionality: <a href="https://web.archive.org/web/20071009004156/http://unspace.ca/discover/pageless/" rel="nofollow noreferrer">Endless Pageless: No More Next Page</a>. Their demonstration page is <a href="https://web.archive.org/web/20071009004258/http://unspace.ca/live... | <p>Thy this jquery example <a href="http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/" rel="nofollow">http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/</a></p>
| 22,221 |
<p>Does anyone know how a <code>System.Windows.Forms.Timer</code> affects the host application and the system in general?</p>
<p>A threaded background loop on one hand has a very high CPU usage %, whilst a <code>Timer</code> with a very high tick rate shows no effect in Windows Task Manager.</p>
<p>Does a high tick-r... | <p>Define "high tick rate timer" :).</p>
<p>The problem with timer components relying on WM_TIMER (such as the Windows.Forms one) is manifold:</p>
<ul>
<li>You will <em>not</em> be able to get a resolution better than 50 msec out of it, ever.</li>
<li>If your system is under load (e.g. heavy redrawing, running over R... | <p>Overall I have not noticed many negative downfalls to using a timer component inside my application, they are much more effective, and better on resources than some other methods out there.</p>
<p>I find that this <a href="http://msdn.microsoft.com/en-us/magazine/cc164015.aspx" rel="nofollow noreferrer">Timer Compa... | 43,031 |
<p>In Windows XP:</p>
<p>How do you direct traffic to/from a particular site to a specific NIC?</p>
<p>For Instance: How do I say, all connections to stackoverflow.com should use my wireless connection, while all other sites will use my ethernet?</p>
| <p>I'm not sure if there's an easier way, but one way would be to add a route to the IP(s) of stackoverflow.com that explicitly specifies your wireless connection, using a lower metric (cost) than your default route.</p>
<p>Running nslookup www.stackoverflow.com shows only one IP: 67.199.15.132, so the syntax would be... | <p>you should be able to do it using the route command. Route add (ip address) (netmask) (gateway) metric 1</p>
| 9,923 |
<p>I wonder how can I write a <strong><em>catch'em all</em></strong> exception handler in the application level which will give the user the option to resume the application flow?</p>
| <p>If you are running a Windows Forms application: add a handler to the <code>Application.ThreadException</code> event.</p>
| <p>This just screams bad design all over. Never use exceptions for things like this. Exceptions are ONLY to be used when something the programmer did not intend to occures.</p>
<p>If you want error-handling. dont use exceptions like this, rahter build a system where you save states and can go back to states etc... but... | 43,822 |
<p>I see that in the SQL Server Reporting Services 2005 Report Manager there is the capability to schedule reports for specific times (i.e. every weekday at a particular time). </p>
<p>What I would like though is more control -- i.e. every weekday, but only between certain dates of the year -- for example, getting s... | <p>If you have Enterprise Edition you can create a Data Driven Subscription, whereby you generate a table of the report recipients and parameters and then point the report subscription to the table. You have complete control over how the table gets populated so you can make sure it only gets populated on the days you w... | <ol>
<li><p>I don't think there is a way to customize the Report Manager interface to show the custom schedule because there is a part of it that is managed by SSIS.</p></li>
<li><p>Yes you can remove the Subscription feature for some users. You can do that in SSMS, when connected to your report Server, in the Securit... | 49,059 |
<p>Within an XSLT document, is it possible to loop over a set of files in the current directory?</p>
<p>I have a situation where I have a directory full of xml files that need some analysis done to generate a report. I have my stylesheet operating on a single document fine, but I'd like to extend that without going t... | <p>In XSLT 2.0, and with Saxon, you can do this with the <code>collection()</code> function:</p>
<pre><code><xsl:for-each select="file:///path/to/directory">
<!-- process the documents -->
</xsl:for-each>
</code></pre>
<p>See <a href="http://www.saxonica.com/documentation/sourcedocs/collections.ht... | <p>I don't think XSL is set up to work that way: it's designed to be used by something else on one or more documents, and the something else would be responsible for finding files to which the XSLT should be applied. </p>
<p>If you had one main document and a fixed set of supporting documents, you could possibly use t... | 12,812 |
<p>I want to post an xml document to an <strong>asp</strong> page from an <strong>asp.net</strong> page. If I use WebRequest with content/type text/xml the document never gets to the asp page. How can I do this ?</p>
| <p>Here is a sample without any error handling (do it yourself :) ):</p>
<pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create(targetUri);
string sendString = formParameterName + "=" + HttpUtility.UrlEncode(xmlData);
byte[] byteStream;
byteStream = System.Text.Encoding.UTF8.GetBytes(sendString);
reque... | <p>It's absolutely possible. Make sure that you are writing the XML to the RequestStream.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.getrequeststream.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.getrequeststream.aspx</a></p>
| 23,625 |
<p>One of the frequent causes of memory leaks in .Net are event handlers which are never removed from their source objects. </p>
<p>Will this WCF code cause a memory leak, or will the lambda go out of scope too, allowing both the proxy class and the handler to be GCed?</p>
<pre><code>void AMethod()
{
WCFClient pr... | <p>Here's my test - note the explicit <code>proxy</code> set to <code>null</code> in the lambda - without it the <code>WeakReference</code> lives and therefore a leak is likely:</p>
<pre><code>public class Proxy
{
private bool _isOpen;
public event EventHandler Complete;
public void Close()
{
... | <p>That object will die... it'll be cleaned up.</p>
<p>Don't forget that the lamda isn't doing anything special... it's a compiler trick (so just assume it's a normal += SomeDelegate).</p>
<p>Also, the "Close" method (I don't know why they didn't make it IDisposable) will clean up everything else that was left open.<... | 34,099 |
<p>I'm new to SQL Server Reporting Services, and was wondering the best way to do the following:</p>
<blockquote>
<ul>
<li>Query to get a list of popular IDs</li>
<li>Subquery on each item to get properties from another table</li>
</ul>
</blockquote>
<p>Ideally, the final report columns would look like this:<... | <p>I would recommend using a <a href="http://msdn.microsoft.com/en-us/library/ms160348.aspx" rel="nofollow noreferrer">SubReport</a>. You would place the SubReport in a table cell.</p>
| <p>Simplest method is this:</p>
<pre><code>select *,
(select count(*) from tbl2 t2 where t2.tbl1ID = t1.tbl1ID) as cnt
from tbl1 t1
</code></pre>
<p>here is a workable version (using table variables):</p>
<pre><code>declare @tbl1 table
(
tbl1ID int,
prop1 varchar(1),
prop2 varchar(2)
)
declare @tbl2 table
(
tb... | 4,125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.