instruction
stringlengths
0
30k
WCF - Faults / Exceptions versus Messages
|wcf|exception|
We're currently having a debate whether it's better to throw Faults over a WCF channel, versus passing a message indicating the status or the response from a service. Faults come with built in support from WCF where by you can utilize the built in error handlers and react accordingly. This however carries overhead a...
Please bare in mind that some .NET controls will automatically HTML encode the output. For instance setting the .Text property on a TextBox control will automatically encode it, that specifically means converting < into & lt; > into & gt; and & into & amp; (spaces added to prevent encoding, doh!) So be wary of doing th...
I accomplished this in a project a while back. To do it I created a CompositeControl that contains both the TextBox and the CalendarExtender. In the `CreateChildControls` method of the CompositeControl I use code similar to this: TextBox textbox = new TextBox(); textbox.ID = this.ID + "Textbox"; tex...
A quick note regarding Windows Vista as a host for VMware Server, it doesn't work as well with Vista as the host OS compared to Windows XP as the host. The system pretty much locks up while VMware server 'boots' a virtual machine. After that has taken place, it isn't too bad to use. VMware Server 2.0 *should* fix th...
I can't seem to find any basic API for controlling interfaces on MSDN, apart from the RAS API's, but I don't think they apply to non-dialup connections. As you suggest yourself, netsh might be an option, supposedly it also has a programmatic interface: <http://msdn.microsoft.com/en-us/library/ms708353(VS.85).aspx> I...
I use the static analysis built into IntelliJ IDEA. Perfect integration. I use the code coverage built into Intellij IDEA (based on EMMA). Again, perfect integration. This integrated solution is reliable, powerful, and easy-to-use compared to piecing together tools from various vendors.
The realtime clock cannot generate interrupts. It was (maybe still is) coupled with the cmos-ram because it was buffered by the battery. It can only be accessed via the ports 0x70 and 0x71. You can however hook the interrupt of the PIT (programmable interrupt timer). That's interrupt 0x08 (e.g. hardware IRQ0). As fa...
Another way to define "real-time" is by evaluating the capabilities of the many [RTOS][1]s (real-time operating systems). e.g QNX's definition is [here][2]. Notice that they conform to the [POSIX][3] PSE52 Realtime Controller 1003.13-2003 System product standard. Most embedded operating systems will provide similar fun...
Because TFS doesn't natively support patch files, the most common thing I see people do on CodePlex is simply zip the modified files and upload the zip. The project coordinator then does a diff against their own checkout. However since CodePlex also supports TortoiseSVN, more and more people are using that to creat...
Open .NET form in designer mode - get "The path is not of a legal form"
|winforms|c#|vb.net|visual-studio|
I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened?
|c#|visual-studio|winforms|vb.net|
I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened? ---------- *Thanks to all who have answered. This question is a problem I hit a while back, and I struggled with it for a lo...
Use a <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html">ThreadPoolExecutor</a> implementation and call <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html#getActiveCount()">getActiveCount()</a> on it: int getActiveCount() //...
Also check for [database replication][1]. Check the [Master-Remote][2] part too. [1]: http://msdn.microsoft.com/en-us/library/ms151198(SQL.90).aspx [2]: http://msdn.microsoft.com/en-us/library/ms152761(SQL.90).aspx
How do you read JavaDoc?
|javadoc|java|documentation|
What tools/websites do you use to read JavaDocs? I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable. What I would expect from such a tool/website: - Aggregate JavaDocs from...
you could do the following: #!/bin/bash #store the listing of current directory in var mydir=`ls -t` it=1 for file in $mydir do if [ $it -gt 5 ] then echo file $it will be deleted: $file #rm -rf $file fi ...
No you're not crazy. nHibernate is a full OR Mapper, Linq to SQL and Linq to Entities don't implement everything you'd expect from an OR mapper and targeted at a slightly different group of developers. But don't let that put you off linq though. Linq is still a pretty good idea.. Try Linq to nHibernate :-)
If your "web sources" are regular websites using HTML (as opposed to structured XML format like RSS) I would suggest to take a look at [HTMLUnit](http://htmlunit.sourceforge.net/). This library, while targeted for testing, is a really general purpose "Java browser". It is built on a Apache httpclient, Nekohtml pars...
Seems unlikely to me, since there is an impedance mismatch. TAP has no concept for what NUnit calls a test, and what TAP calls a test usually corresponds to an NUnit assertion, but not precisely. So I’m not sure how the thing you’re looking for would work at all. (But maybe a heuristic could work well enough.)
I can't believe nobody has mentioned vi. I'll argue that the less your tool does for you in the beginning the better coder you'll be in the end. For a newbie, give them syntax highlighting and some helpers for dealing with blocks and lines. Something like vi is great, emacs is also fine, or if you absolutely must be...
Dataflow Programming - Patterns and Frameworks
|c++|design-patterns|boost|dataflow|
I just came across the proposed [Boost::Dataflow][1] library. It seems like an interesting approach and I was wondering if there are other such alternative frameworks for C++, and if there are any related design patterns. I have not ruled out Boost::Dataflow, I am just looking into any available alternatives so I ca...
How do you efficiently copy BSTR to wchar_t[] ?
|c++|com|wchar-t|bstr|
I have a BSTR object that I would like to convert to copy to a wchar__t object. The tricky thing is the length of the BSTR object could be anywhere from a few kilobytes to a few hundred kilobytes. Is there an efficient way of copying the data across? I know I could just declare a wchar_t array and alway allocate the ma...
I just use Emacs.
The challenge I think for this to happen would be to find enough developers who are confident writing code without the 'crutch' of the many frameworks that there are out there today. More and more computer science/software engineering academic courses are ignoring the C's of the world in favour of the Java and .NET's (...
How often should Oracle database statistics be run?
|database|performance|oracle-database|statistics|
In your experience, how often should Oracle database statistics be run? Our team of developers recently discovered that statistics hadn't been run our production box in over 2 1/2 months. That sounds like a long time to me, but I'm not a DBA.
This is trivial with a nested set implementation. See here for more details: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html Otherwise, write something like this: def get_subtree(node) if children.size > 0 return children.collect { |n| get_subtree(n) } else ...
Netbeans has gotten some pretty good reviews for its C++ support: http://www.netbeans.org/features/cpp/ I've never used Netbeans or Eclipse for C++ development, but it's worth looking at.
So the code sample is from your button click event? Are you sure you are not rebinding your datasource on postback?
Quartz is part of the standard JBoss 4.2.x distribution. And is a really good library, that without much work you can also define simple workflows.
You can use the VirtualPathUtility.ToAbsolute method like below to convert the app relative url of the .js file to an absolute one that can be written to the page: <script type="text/javascript" src="<%=VirtualPathUtility.ToAbsolute("~/Views/Home/Index.js") %>"></script>
The STL *[transform][1]* function also does something similar. The arguments are (in order): 1. An input iterator designating the beginning of a container 2. An input iterator designating the end of the container 3. An output iterator defining where to put the output (for an in-place transform, similar to ...
gtk-sharp is a pretty nice cross platform toolkit.
If you are doing this inside of a select, you can just piece it together, if your replacement values are columns, using string concatenation.
Hope you forgive me for plugging a solution I wrote on this, using client side JavaScript to hash the password before it's transmitted: <http://blog.asgeirnilsen.com/2005/11/password-authentication-without.html>
Dynamically add CalendarExtender to Textbox subclass server control?
|asp.net-ajax|calendar|textbox|
I'm trying to create a server control, which inherits from TextBox, that will automatically have a [CalendarExtender](http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx) attached to it. Is it possible to do this, or does my new control need to inherit from CompositeControl instead? I've tried the...
|asp.net|asp.net-ajax|calendar|textbox|custom-server-controls|
update MyTable Set RandomFld = CONVERT(varchar(10), NEWID())
When starting new big project, I decided to make it modular. Usually, in big projects not all modules are used by a particular user, so I load them on demand. F.e., if a project would have 50+ modules, the big probability is that user is working only with 10-. Such architecture lets you to have the initial code rel...
How about this: UPDATE TBL SET Field = LEFT( CONVERT(varchar(255), @myid),10)
Log4net with SyslogAppender, 1kb message limit
|log4net|syslog|
Has anyone found a way to get around this? Or a better technique to conglomerate logging from multiple web servers reliably? Any ideas on good log4net log file analysis tools too (plain text not XML) - apart from good 'ol grep of course :)
@ericmayo - cripes. Well, experimenting with VS2005, I can't get an honest leak out of scalar delete on memory that was made by vector new. I guess the compiler behavior is "undefined" here, is about the best defense I can muster. You've got to admit though, it's a really lousy practice to do what the original pos...
|exception|wcf|
We're currently having a debate whether it's better to throw Faults over a WCF channel, versus passing a message indicating the status or the response from a service. Faults come with built in support from WCF where by you can utilize the built in error handlers and react accordingly. This however carries overhead a...
> is not an expression, it is an assignment and thus returns the assigned value. In this case, the size of that value depends on the variable, it has been assigned to. First, it **IS** an expression containing the assignment operator. Second, I'm quite aware of what's happening in my example :) > then the siz...
cvs error on checkin
|cvs|
When trying to commit to cvs I get this error Assertion failed: key != NULL, file hash.c, line 317 Any idea how to fix it so I can check my code in?
|cvs|version-control|
When trying to commit to cvs I get this error Assertion failed: key != NULL, file hash.c, line 317 Any idea how to fix it so I can check my code in? both server and client are Linux there are pre-commits involved
|version-control|cvs|
When trying to commit to cvs after adding a new file I get this error Assertion failed: key != NULL, file hash.c, line 317 Any idea how to fix it so I can check my code in? both server and client are Linux there are pre-commits involved
If you have .NET 3.5 you could use LINQ's Reverse? foreach(var item in obEvtArgs.NewItems.Reverse()) { ... } (Assuming your talking about the generic IList)
Beginning Web Development on Plan 9
|html|web-applications|plan9|
I've been wanting to program for the Plan 9 operating system for a while. I'd really like to play around with a web app there. Of course, the only language I know for Plan 9 is C, and that doesn't seem ideal for web development. I also understand that it doesn't run apache or mysql either. What is the best way to st...
If you haven't gone near NetBeans in a while its catching up with Eclipse very fast and worth a look, especially when starting JEE. Version 6.x installs Tomcat and/or Glassfish for you and then provides wizards to create/deploy/redeploy applications. The initial tutorial on Web Applications is [here][1] and a m...
Serialize Java objects into Java code
|java|
Does somebody know a Java library which serializes a Java object hierarchy into Java code which generates this object hierarchy? Like Object/XML serialization, only that the output format is not binary/XML but Java code.
Sounds like you want to send an [HTTP 301 Moved Permanently](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2) response.
Sounds like you want to send an [HTTP 301 Moved Permanently](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2) response. RewriteCond %{REQUEST_URI} ^URI_TO_REDIRECT RewriteRule redirect=301 NEW_SITE [L] or similar. The `[L]` is to tell it to redirect immediately instead of continuing to r...
Your question is very vague, but in short, you need to ensure that your site meets one of the three levels (A, AA, or AAA) of the [Web Content Accessibility Guidelines][1]. FWIW, in my experience, if you are providing anything other than a purely static HTML site, aim for AA. Trying to follow the WCAG guidelines str...
Your question is very vague, but in short, you need to ensure that your site meets one of the three levels (A, AA, or AAA) of the [Web Content Accessibility Guidelines][1]. FWIW, in my experience, if you are providing anything other than a purely static HTML site, aim for AA. Trying to follow the WCAG guidelines str...
It sounds like your include path - the list of directories that the compiler scans in order to locate files that you #include - is set incorrectly. Which compiler are you using?
Emacs equivalent of Vim's yy10p ?
|emacs|editor|tips-and-tricks|shortcut|
How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once? Any ideas before I go and write my own functions.
Well - you won't be able to do it server-side on post-back as the file will get submitted (uploaded) during the post-back. I think you may be able to do it on the client using JavaScript. Personally, I use a third party component called [radUpload by Telerik][1]. It has a good client-side and server-side API, and ...
int getline(char s[], int lim) { int c, i; i=0; /* While staying withing limit and there is a char in stdin and it's not new line sign */ while (--lim > 0; && (c=getchar()) !=EOF && c !='\n') /* Store char at the current position in array, advance current pos by one */ ...
Other file doesn't recognizes other file's class C++
|class|c++|dont|recognize|
I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp"<br> and I want the file "Load.h" to recognize my classes inside there,so I've added the line<br> #include "Particles.h"<br> and the file doesn't recognizes it,and at the past everything was ok(I havn't made ...
|c++|class|header|
Also- even if you do just look for the apostrophe, you don't want to remove it. You want to _escape_ it. You do that by replacing every apostrophe with two apostrophes. But parameterized queries/stored procedures are so much better.
This is pretty cheesy, but it should get the job done. Assuming you're currently cd'd into the directory containing all of your files: mkdir ../outdir ls | sort -n | while read fname; do mv "$fname" ../outdir/; read; read; read; done The `sort -n` is there assuming your filenames don't all have the same...
|java|documentation|javadoc|
What tools/websites do you use to read JavaDocs? I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable. What I would expect from such a tool/website: - Aggregate JavaDocs from...
If you only need to do this merge operation once (to create a new bigger database), you could create a script/program that will loop all your sqlite databases and then insert the data into your main (big) database.
Although this blog post is for reading / writing Quality Center **requirements**, the code is very similar for **Bugs / Defects**. http://ozgrant.com/2008/05/16/query-and-update-quality-center-requirements-from-c/ TDAPIOLELib.TDConnection connection = new TDAPIOLELib.TDConnection(); connection.InitConne...
Place a static volatile counter on the thread which is updated whenever the thread is activated and deactivated. Also, see the API.
There is a possibility that your IP/host are blocked by the remote host, especially if it thinks you are hitting it too hard.
If you're trying to enumerate the properties in order to write new code against the object, I would recommend using a debugger like Firebug to see them visually. Another handy technique is to use Prototype's Object.toJSON() to serialize the object to JSON, which will show you both property names and values. ...
Why not use the first 10 characters of an md5 checksum of the current timestamp and a random number?
A simple solution is to walk around the edge of the polygon. Given a current edge om the boundary connecting points P0 and P1, the next point on the boundary P2 will be the point with the smallest possible A, where H01 = bearing from P0 to P1 H12 = bearing from P1 to P2 A = fmod( H12-H01+360, 360 ) ...