instruction
stringlengths
0
30k
I'd like to do the following and can't find an elegant way: 1) Read an XML template into a System.Xml.XmlDocument 2) Populate it with data from my UI 3) Transform it with an XSLT I've written 4) Apply a CSS Stylesheet 5) Render it to a WebBrowser control I'm currently reading it from a file on disk, ...
What exactly are you trying to do? Of course, there are numerous places to learn about svn pre-commit hooks (e.g. <a href="http://wordaligned.org/articles/a-subversion-pre-commit-hook"> here </a>, <a href="http://www.windley.com/archives/2008/08/using_a_precommit_hook_to_check_puppet_syntax.shtml"> here</a>, and in ...
This error usually indicates a class naming conflict. You are referencing two namespaces or you created a class with the same name in another namespace that you are using. I would start by looking at what that could be.
You can try your luck with [mod_rewrite][1]. Create a script that takes a local static file name as input, through e.g. $_SERVER['QUERY_STRING'] and outputs it in compressed form. Many providers don't allow configuring mod_rewrite with .htaccess files or have it completely disabled though. If you haven't used rew...
I don't see a problem with a straightforward solution: Table for items, table for tags, crosstable for "tagging" Indices on cross table should be enough optimisation. Selecting appropriate items would be SELECT * FROM items WHERE id IN (SELECT DISTINCT item_id FROM item_tag WHERE tag_i...
I don't see a problem with a straightforward solution: Table for items, table for tags, crosstable for "tagging" Indices on cross table should be enough optimisation. Selecting appropriate items would be SELECT * FROM items WHERE id IN (SELECT DISTINCT item_id FROM item_tag WHERE tag_i...
I don't see a problem with a straightforward solution: Table for items, table for tags, crosstable for "tagging" Indices on cross table should be enough optimisation. Selecting appropriate items would be SELECT * FROM items WHERE id IN (SELECT DISTINCT item_id FROM item_tag WHERE tag_i...
There should be VisualSVN log files in your temp folder (somewhat like "C:\Documents and Settings\<username>\Local Settings\Temp\VisualSVN-2007-06-02-00-01-416.log"). Do you see anything in that file that helps?
[Books Online][1] is probably a good place to start (or at least I like it and generally find it useful). SQLMenace and bofe made some good points. Here's my additional two cents: I'd recommend configuring _Database Mail_ rather than _SQL Mail_ (i.e. SMTP vs. MAPI, which I think is deprecated anyway). Once you ...
[Books Online][1] is probably a good place to start (or at least I like it and generally find it useful). SQLMenace and bofe made some good points. Here's my additional two cents: I'd recommend [configuring Database Mail][2] rather than SQL Mail (i.e. SMTP vs. MAPI, which I think is deprecated anyway). Once you...
Also, check out ASP.NET MVC or if you're set on webforms, the new System.Web.Routing namespace in ASP.NET 3.5 SP1
What method on the master page are you accessing the label from? Depending on the stage of the page lifecycle, the label control may not have been loaded yet
Could you be accessing it before it is created? Check the page lifecycle: http://msdn.microsoft.com/en-us/library/ms178472.aspx
It sounds like you just need to integrate your server with [xinetd][1]. This is a server that listens on predefined ports (that you control through config) and forks off processes to handle the actual communication on that port. [1]: http://www.xinetd.org/
I can see the argument for tables for forms, but there is a nicer alternative... you just have to roll up your sleeves and learn CSS. for example: <fieldset> <legend>New Blog Post</legend> <label for="title">Title:</label> <input type="text" name="title" /> <label for="body">Body:</label> <te...
I just found out about this one today -- and I've been working with C# for 5 years! It's the namespace alias qualifier: extern alias YourAliasHere You can use it to load multiple versions of the same type. This can be useful in maintenance or upgrade scenarios where you have an updated version of your ty...
Plug In Design for .NET App
|.net|plugins|interface-design|
I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the system that they use. Presently, this requires...
You should look into [PHPUnit][1], it looks pretty much like nUnit. [1]: http://www.phpunit.de/
If you must use regex, here is a regex to get just the content part: content\s*=\s*['"].*?['"] returns content = "blogger" and content='Worpress.com' respectively. I'm no regex expert, but it gets those when given your examples in [regexpal][1]. Once you get that you can get everything ...
I use to be a fan of the Java (and worse C#) practice of making getters and setters (get set properties) throughout an object. This use to be what I considered object oriented, but really this leads us just to exposing the guts and implementation of the object and not really taking advantage of encapsulation. There a...
You could use [Spread](http://www.spread.org/) to do group communication.
I'd say stick with what works for you. Unless you are having issues with VSS, why switch? Subversion is swell, though a little sticky to begin using it. TFS is far better than VSS, though it is fairly expensive for such a small team. I have not used git so I can't really speak to it.
I once came across a .Net app that was ported from ASP. The .aspx pages were totally blank. To render the UI, the developers used StringBuilders in the code behind and then did a response.write. This would be the wrong way to do it!
I like using Subversion for my personal projects. I could go down the list of features and pretend like it brings a lot to the table that other source control systems don't, but there's tons of good ones out there and the right choices is really a matter of style. If you check in after each small change (i.e. one che...
@Dan again, for more complex situations (immutability comes in mind) the Builder Pattern is a great solution. Also, I agree with you mostly in getters. I believe what you are saying is to mostly follow the "[Tell don't ask][1]" paradigm and I greatly agree. But that is oriented mostly at getters. Lastly, all of t...
How do you display a dialog from a hidden window application?
|winapi|com|
Apologies in advance if I use duff terminology in this question, I'm working at the edge of my understanding of Win32. I have developed a COM component (dll) that implements an Edit() method displaying a WTL modal dialog. The complete interface to this COM component corresponds to a software standard used in the ...
|com|winapi|
Apologies in advance if I use duff terminology in this question, I'm working at the edge of my understanding of Win32. I have developed a COM component (dll) that implements an Edit() method displaying a WTL modal dialog. The complete interface to this COM component corresponds to a software standard used in the ...
If you are running on Java 6 you can use the [supplied monitoring tools][1] [1]: http://java.sun.com/developer/technicalArticles/J2SE/monitoring/
Are you using a parent for the Dialog? e.g. MyDialog dialog(pParent); dialog.DoModal(); If you are, try removing the parent. Especially if the parent is the desktop window.
As I said [here][1], I'd go for [Squeakland][2] and the famous [Drive a Car][3] example (powered by [Squeak][4]). Smalltalk syntax is simple, which is great for children. And later as the child evolves, he can learn more complex and even very advanced concepts that are also in Squeak (eg. programing statefull web...
You can attach a debugger to the running process before triggering the exception. This should give you a better idea what's up with the application.
How do you feel about using the [Observer][1] pattern? If not, you can implement a true callback this way: // This function uses a callback function. function doIt($callback) { $data = "this is my data"; $callback($data); } // This is a sample callback funct...
Are you using the C/C++ Development Tools exclusively?<br><br>The Spellcheck functionality is dependent upon the Java Development Tools being installed also.<br><br>The spelling engine is scheduled to be pushed down from JDT to the Platform,<br>so you can get rid of the Java related bloat soon enough. :)
Inherits="System.Web.Mvc.ViewPage" I'd imagine that this should be pointed at your View codebehind file class, not at the base ViewPage class.
To paraphrase what others have said: the trick isn't in the **schema**, it's in the **query**. The naive schema of Entities/Labels/Tags is the right way to go. But as you've seen, it's not immediately clear how to perform an AND query with a lot of tags. The best way to optimize that query will be platform-depend...
And (apart from the observer pattern) you can also use call_user_func(). If you pass an array(obj, methodname) as first parameter it will invoked as $obj->methodname(). <pre> &lt;?php class Foo { public function bar($x) { echo $x; } } function xyz($cb) { $value = rand(1,100); call_user_func($cb, $v...
What I do: * I place scripts in a `js` and stylesheets in a `css` dir, respectively. * In the Apache configuration, I add directives like so: <Directory /data/www/path/to/some/site/js/> AddHandler application/x-httpd-php .js php_value auto_prepend_file gzip-js.php php_flag zlib.output_compression O...
.NET MVC Ambiguous Type Reference
A decent first-cut might be to write a simple PERL script to parse out dependencies and then pipe that data to [Graphviz][1] for visualization. [1]: http://www.graphviz.org/ "Graphviz"
I'm not familiar with bazaar, but git doesn't track file renames. To git, this looks like a delete and an add. However, git is smart enough to see that the contents of the file already exist in its repository and will track their position in the system. If you split files up or merge them it's smart enough to keep trac...
SimpleTest is a great system. I started out with it about 5 months ago, having never heard of TDD, and SimpleTest is easy to learn but still powerful. As for resources, I'm currently reading *TDD By Example* by Kent Beck, and it's good.
Further to Ross' answer, there is no similar construct for other browsers. For example, you can't write conditional comments that target Firefox, for example, but are ignored by Internet Explorer. The other browsers have chosen not to ignore Internet Explorer's innovation and therefore do not support conditional co...
Further to Ross' answer, you can only target the Internet Explorer rendering engine with conditional comments; there is no similar construct for other browsers. For example, you can't write conditional comments that target Firefox, for example, but are ignored by Internet Explorer. The way I achieve the same effect...
Further to Ross' answer, you can only target the Internet Explorer rendering engine with conditional comments; there is no similar construct for other browsers. For example, you can't write conditional comments that target Firefox, but are ignored by Internet Explorer. The way I achieve the same effect as your exam...
I don't think you can remove the meta data, but you can obfuscate your code if you're looking to protect your IP.
Whatever you do, don't change for the sake of changing. If it's working for you and you're not having problems with it, I don't see any reason to switch.
Send-Q is the amount of data sent by the application, but not yet acknowledged by the other side of the socket. Recv-Q is the amount of data received from the NIC, but not yet consumed by the application. Both of these queues reside in kernel memory. There are [guides][1] to help you tweak these kernel buffers...
I have about 1.5 years worth of experience with the RCP framework, I really liked it. We simply JUnit for testing... It's sort of cliche to say, but if it's not easy to test, maybe the design needs some refactoring? Java and the RCP framework provide great facilities for keeping GUI code and logic code separate. ...
I used to use NUnit, but now tend to use MbUnit, for two key features: 1. The RowTest feature allows you to easily run the same test on different sets of parameters, which is important if you really want thorough coverage. 2. The Rollback feature allows you to run tests against your database while rolling back change...
I'm just guessing here because from your code it's not obvious where do you have definition of IPlugin interface but if you can't cast in your host application then you are probably having IPlugin interface in your host assembly and then at the same time in your plugin assembly. This won't work. The easiest thing is...
I'm just guessing here because from your code it's not obvious where do you have definition of IPlugin interface but if you can't cast in your host application then you are probably having IPlugin interface in your host assembly and then at the same time in your plugin assembly. This won't work. The easiest thing is...
The Dotfuscator will stop your code from being able to be decompiled: <http://www.preemptive.com/dotfuscator.html> **Edit:** I should have mentioned, that's the professional version, the free community version ships with visual studio <http://msdn.microsoft.com/en-us/library/ms227240(VS.80).aspx>
A couple of tips that I've found lately. 1. It's much better to use the TableAdapter FillByDataXXXX() methods instead of GetDataByXXXX() methods because the DataTable passed into the fill method can be interrogated for clues: - DataTable.GetErrors() returns an array of DataRow instances in error - DataRo...
Depending on how the "hidden window" application works, it might not be able to display a window. For example, services don't have a "main message loop", and thus are not able to process messages sent to windows in the process. i.e, the application displaying the window should have something like this: while...
Have a look at this [survey][1] it was done by a Windows Forms Contol Vendor in Australia. Personally i have worked on two commercial projects in the last year that were using WPF to varying degrees. The adoption of WPF is on the rise. Microsoft i believe is putting all their eggs into the wpf basket. [1]: htt...
Absolutely - the adoption is tiny. There was lots of hype but it does not seem to have materialized. I used WPF for one project and I can certainly say it left a very unfinished taste in my mouth. It was far too difficult to acheive simple things and the whole thing had very many rough edges - the reasons behind the...
SWFAddress works in Flash & Javascript projects and lets you create bookmarkable URLs (using the hash method mentioned above) as well as giving you back-button support. http://www.asual.com/swfaddress/
Au Contrare... you'll find C/C++ people flocking to structs a.k.a. value types. An example would be data packets. If you have a large number of data packets to transfer/transmit, you'd use value structs to model your data packets. reason: Turning something into a class adds an overhead of (approx 8-16 Bytes I fo...
Though WPF was introduced few years ago it was too raw to use it in the real world apps. Major problem that stops WPF from wide adoption is a lack of RAD tools and out-of-box components. Currently we have Blend, more or less working Cider, but usable versions of these tools came not so long ago. Another reason is a c...
Though WPF was introduced few years ago it was too raw to use it in the real world apps. Major problem that stops WPF from wide adoption is a lack of RAD tools and out-of-box components. Currently we have Blend, more or less working Cider, but usable versions of these tools came not so long ago. Another reason is a c...
@Darren Kopp Be carefull with BETWEEN, check out [How Does Between Work With Dates In SQL Server?][1] [1]: http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/how-does-between-work-with-dates-in-sql-
Have you checked this out? [Best practices for making web pages fast](http://developer.yahoo.com/performance/) from Yahoo!'s Exceptional Performance team If you really are having trouble at the backend, this won't help. But we used their advice to great effect to make our site faster, and there is still more to d...
I'm in the object oriented architects camp. It's not necessarily a crime to put code in the database, as long as you understand the caveats that go along with that. Here are some: 1. It's not debuggable 2. It's not subject to source control 3. Permissions on your two sets of code will be different 4. It will make...
@Darren Kopp - you can use set @date2 = '20201001' this will let you lose the cast. footndale - you can use date arithmetic to remove the time as well. Something like select dateadd(d, datediff(d, 0, CURRENT_TIMESTAMP), 0) to get today's date (without the time). I believe this is more effic...
I think it's a business logic vs. data logic thing. If there is logic that ensures the consistency of your data, put it in a stored procedure. Same for convenience functions for data retrieval/update. Everything else should go into the code. A friend of mine is developing a host of stored procedures for data anal...
The problem is to make the search engine use the fact that 'subversion' and 'svn' are *very similar* to the point that they mean the same 'thing'. It might be attractive to compute a simple similarity between tags based on frequency: 'subversion' and 'svn' appear very often together, so requesting 'svn' would return...
|asp.net|mvc|
Not entirely sure what's going on here; any help would be appreciated. I'm trying to create a new .NET MVC web app. I was pretty sure I had it set up correctly, but I'm getting the following error: The type 'System.Web.Mvc.ViewPage' is ambiguous: it could come from assembly 'C:\MyProject\bin\System.Web....
|asp.net|asp.net-mvc|mvc|
Are you using a CodeBehind file, I don't see CodeBehind="" attribute where you are specifying the Inherits from? Then you have to point inherits to the class name of the codebehind. Example: <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" I...
I don't think you have much choice other than using an class that implements IEnumerable&lt;T&gt;. Even if the DataSource property was smart enough to take a scalar object, it would probably convert it internally to a vector. I would however consider using a simple array rather than a List&lt;T&gt; as this will resu...
I suppose you named one of your page "ViewPage" is that the case? And like @Jonathan mentioned, this smells: Inherits="System.Web.Mvc.ViewPage" On my MVC application, _all_ the view pages have this instead: Inherits="MySite.Views.Pages.Home" Or something along the line. Your aspx page markup shou...
Stopping the timer doesn't mean that it won't be called again, depending on when you stop the timer, the timer_tick may still be queued on the message loop for the form. What will happen is that you'll get one more tick that you may not be expecting. What you can do is in your timer_tick, check the Enabled property o...
I second superjoe30's suggestion: I had great success with musicplayer. The only (slight) negative is that it's a little older project and not as well skinnable as some of the alternatives (although you have the full source code, so - given some time - you can make it look exactly as you need it to).
In the Singularity project, Microsoft research communicates with the singularity VM through a "loopback" adapter. Maybe that'd help? Running it is easy so it may be something fun to do anyway. :) http://research.microsoft.com/os/Singularity/
The Dotfuscator will stop your code from being able to be decompiled http://www.preemptive.com/dotfuscator.html **Edit:** I should have mentioned, that's the professional version, the free community version ships with visual studio
i used vss for years until switching to svn about two years ago. my biggest complaints about vss were the poor network performance (that problem may be solved now) and the pessimistic locking of files. svn solved both those, is easy to set up (i use collabnet server and tortoisesvn client, although there are two good...
>I once came across a .Net app that was ported from ASP. The .aspx pages were totally blank. To render the UI, the developers used StringBuilders in the code behind and then did a response.write. This would be the wrong way to do it! I've seen it done the other way, the code behind page was blank, except for declara...
Could depend a bit how you obtain those 2 strings. Probably the secure, fireproof way to do that is what is in URI::URL or similar libraries, where all alternatives, including malicious ones, would be considered. Maybe slower, but in some environments faster will be the speed of a bullet going to your own foot. But ...
<ol> <li><p>What is the distinction between 0.0.0.0, 127.0.0.1, and [::]?</p> <ul> <li>0.0.0.0 indicates something that is listening on all interfaces on the machine.</li> <li>127.0.0.1 indicates your own machine.</li> <li>[::] is something I don't have, but my machine does have *:\* which shows th...
I think you are referring to the [Assembly Manifest][1]: > Every assembly, whether static or > dynamic, contains a collection of data > that describes how the elements in the > assembly relate to each other. The > assembly manifest contains this > assembly metadata. An assembly > manifest contains all the meta...
Setting Nameservers - how?
|dns|
I understand how I can change the dns settings for my domains by editing my bind configs, when I run my own nameservers. I know that I can define the nameservers with my registrar via their online control panels. But I have no idea how that part works... How does my registrar store the data about the nameservers? Is...
@Jon Limjap For label : textbox, neither divs nor tables are appropriate: `<dl>`s are
I would recommend you take a look at the Managed Add-In Framework that shipped with .NET 3.5. The <a href="http://blogs.msdn.com/clraddins/">Add-In team</a> has posted some samples and tools at <a href="http://www.codeplex.com/clraddins">CodePlex site</a> as well..
.Net 3.5 has the system.Addin namespace. This thread also has some good information for older versions of the framework: h[ttp://forums.devshed.com/net-development-87/system-plugin-532149.html][1] [1]: http://forums.devshed.com/net-development-87/system-plugin-532149.html
One pattern you could follow is to have an asynchronous service that works on files on a shared file system location: 1. Place the file to be encrypted on a shared location 2. Call the service and tell it to encrypt the file, passing both the location and name of the file, and the addres of a callback service on ...
for the theory take a look at the [plugin pattern][1] in martin fowlers Patterns of Enterprise Application Architecture for an interesting example take a look at this tutorial: [Plugin Architecture using C#][2] [1]: http://www.martinfowler.com/eaaCatalog/plugin.html [2]: http://www.codeproject.com/KB/cs/c_...
The registrar is responsible for setting the Root DNS entry that says, "When someone asks for stackoverflow.com, tell them that the authoritative DNS is xxx.xxx.xxx.xxx". They have an interface that allows them to make changes to the records they own. Then the requester must go to the authoritative DNS (Which is th...
You can do this with a proxy, but I think Will Harris's answer is the best - use a subdomain. Much simpler, and it'll get rid of issues with relative links as well.
@Dave Ward: The use of RunOnce method works perfectly. This solve my problem without having the workaround to check first if handler already exist before attaching to an event. I'll mark your answer as an accepted answer. Thanks again.
There's also JGraph, but I'm not sure if that's only for graphs (i.e. nodes and edges), or if it does charts also.
I'd recommend you stick with PuTTY too. You might find it useful to run Pageant in conjunction with Plink to avoid having to type in the passphrase. But if you want to research alternatives you should review this Wikipedia resource: [http://en.wikipedia.org/wiki/Comparison_of_SSH_clients][1] [1]: http://e...
This is CS101, but since no one else has mentioned it, while loops evaluate their condition before the code block, and do-while evaluates after the code block, so do-while loops are always guaranteed to run their code block at least once, regardless of the condition.