instruction stringlengths 0 30k ⌀ |
|---|
First: don't loose the TargetInvocationException - it's valuable information when you will want to debug things.
Second: Wrap the TIE as InnerException in your own exception type and put an OriginalException property that links to what you need (and keep the entire callstack intact).
Third: Let the TIE bubble ou... |
I wouldn't put the interfaces into a separate assembly just for the sake of it. However, if the interfaces take part in any form of IPC or extensibility architecture then it often makes sense to give them their own assembly.
If you have projects that need to reference each other, then yes, you will need a separate a... |
If you are using ASP.NET and the System.Net.Mail classes, you are probably sending the mail via the IIS instance on the web server machine (I'm not sure since you didn't specify). There's not a good way to know what's going on with your Mail Transfer Agent (IIS SMTP). It has its own retry logic, and by default, it co... |
Just use Substring to ignore the first character (or assign it to another string);
string o = ",liger, unicorn, snipe";
string s = o.Substring(1);
|
Here's a function I took from an OS/2 port of Emacs. (Yes, I've been using Emacs for a while.)
;; Author: Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
(defun emx-dup-line (arg)
"Duplicate current line.
Set mark to the beginning of the new line.
With argument, do this that many ... |
another way is
raise SystemExit |
.net strings can do Trim() and TrimStart(). Because it takes `params`, you can write:
",liger, unicorn, snipe".TrimStart(',')
and if you have more than one character to trim, you can write:
",liger, unicorn, snipe".TrimStart(",; ".ToCharArray())
|
If you want another way :-)
"ayy this will store the line in buffer a
"ap this will put the contents of buffer a at the cursor.
there are many variations on this.
"a5yy this will store the 5 lines in buffer a
see http://www.vim.org/htmldoc/help.html for more fun |
`perl -d` is your friend:
<pre><code>% perl -de 0</code></pre> |
Qt or Delphi... If you were to choose one over the other? |
|qt|delphi| |
If you had a differential of either venturing into Delphi land or Qt land which would you choose? I know they are not totally comparable. I for one have Windows development experience with Builder C++ (almost Delphi) and MFC (almost Qt), with a bit more time working with Builder C++. Please take out the cross platform ... |
If you had a differential of either venturing into Delphi land or Qt land which would you choose? I know they are not totally comparable. I for one have Windows development experience with Builder C++ (almost Delphi) and MFC (almost Qt), with a bit more time working with Builder C++. Please take out the cross platform ... |
|delphi|qt| |
The suggestions to use ToTitleCase won't work for strings that are all upper case. So you are gonna have to call ToUpper on the first char and ToLower on the remaining characters. |
You can always just drop into the built-in debugger and run commands from there.
perl -d -e 1
|
If you're using the default view engines, then local resources work in the views. However, if you need to grab resource strings within a controller action, you can't get local resources, and have to use global resources.
This makes sense when you think about it because local resources are local to an aspx page and i... |
I don't know if I'd call it a good place to start, but if you want to be future ready, take a look at the [windows presentation foundation][1] which is built entirely for the purpose of programming GUI's for windows
[1]: http://windowsclient.net/ |
Hash tables have a fast insertion and look up. You could write a simple hash function since you know you'd be dealing with only integer pairs as the keys. |
My first experience writing simple GUI applications for Windows was with C# and Visual Studio. The GUI-building interface is a simple drag and drop deal that generates skeleton methods based on potential user actions. I only did fairly basic programming with this, but I imagine it would be an excellent place to start... |
How do I retrieve my MySQL username and password? |
|mysql| |
I lost my MySQL username and password. How do I retrieve it? |
if you are looking .net you can take a look at umbraco, haven't done much with it (company i work for wanted much more functionality so went with something else) but it seemed lightweight. |
if you are looking .net you can take a look at umbraco, haven't done much with it (company i work for wanted much more functionality so went with something else) but it seemed lightweight.
Edit : if the customer wants a tiny CMS with a forum, I would still probably just go Drupal with phpBB, almost positive they can... |
if you are looking .net you can take a look at umbraco, haven't done much with it (company i work for wanted much more functionality so went with something else) but it seemed lightweight.
Edit : if the customer wants a tiny CMS with a forum, I would still probably just go Drupal with phpBB or [simple machines forum... |
You can use the BIF register to give the spawning / parent process a name (an atom) then refer back to the registered name from other processes.
See [Getting Started With Erlang §3.3](http://www.erlang.org/doc/getting_started/conc_prog.html#3.3) and [The Erlang Reference Manual §10.3](http://www.erlang.org/doc/getti... |
You can use the BIF register to give the spawning / parent process a name (an atom) then refer back to the registered name from other processes.
> FUNC() ->
>> %% Do something
>> %% Then send message to parent
>> parent ! MESSAGE.
>
> ...
>
> register(parent, self()),
> spawn(MODULE, FUNC, [ARGS]).
... |
The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.
<pre>; Define functions for running Guile-written tests under the TAP protocol.
; Copyright © 2008 by Omer Zak
; Released under the GNU LGPL 2.1 or (at your option) any later... |
Using recursion, you're incurring the cost of a function call with each "iteration", whereas with a loop, the only thing you usually pay is an increment/decrement. So, if the code for the loop isn't much more complicated than the code for the recursive solution, loop will usually be superior to recursion. |
The greatest feature is how easy it is for new developers to sit down and write "working" scripts and understand the code.
The worst feature is how easy it is for new developers to sit down and write "working" scripts and think they understand the code.
The openness of the community surrounding PHP and the mass... |
The resolution depends on the type of application and environment in which it is running. E.g. on intranet with NT Domain you can use NTLM to pass windows credentials directly to servers in intranet perimeter without any need to duplicate sessions.
The approach how to do this is generally named _single sign-on_ (see... |
I would think in (non tail) recursion there would be a performance hit for allocating a new stack etc every time the function is called (dependent on language of course). |
What I have done in the past is as follows:
1. Make sure all my changes are committed to SVN in the trunk
2. Do a get latest from VSS into my working copy of the SVN trunk
3. Manually merge the changes in my working copy.
4. Commit the merged code into the SVN trunk
5. Do a VSS diff and checkout any files with d... |
What I have done in the past is as follows:
1. Make sure all my changes are committed to svn://trunk
2. Do a get latest from VSS into my working copy.
3. Manually merge the changes in my working copy.
4. Commit the merged code into the svn://trunk
5. Do a VSS diff and checkout any files with differences (without... |
IMHO:
Application service tier -> application logic and validation
Application data tier -> data logic and security
Database -> data consistency
You will be bitten by the sproc approach sooner or later, I have learned this the hard way.
Procs are great for one shot operations that need a lot of performa... |
In C#, how can I rethrow InnerException without loosing stack trace? |
|.net|c#|exception| |
I am calling, through reflection, a method which may cause an exception. How can I pass the exception to my caller without the wrapper reflection puts around it? I am rethrowing the InnerException, but this destroys the stack trace. Example code:
public void test1()
{
// Throw an except... |
In C#, how can I rethrow InnerException without losing stack trace? |
|c#|.net|exception| |
The problem appears to lie in this line:
WidgetHolder(Widget a, Widget b, Widget c, Widget d): A(a), B(b), C(c), D(d){}
As Frank mentioned, your references inside the WidgetHolder class are going to hold invalid references after the constructor returns. Therefore, you should change this to:
WidgetHolde... |
This compiles because although the WidgetHolder is a const object, this const-ness does not automatically apply to objects pointed to (referenced by) the WidgetHolder. Think of it at a machine level - if the WidgetHolder object itself were held in read-only memory, you could still write to things that were pointed to b... |
The login page in my Tapestry application has a property in which the password the user types in is stored, which is then compared against the value from the database. If the user enters a password with multi-byte characters, such as:
áéíóú
...an inspection of the return value of getPassword() (the abstract m... |
I've tried some of these tools in other languages and IMHO they are almost a complete waste of time. Reason? They can't guess at the semantics of a method call in any meaningful way. There's a very good article about this [here][1] -- well worth a read.
[1]: http://blog.objectmentor.com/articles/2008/01/10/ge... |
You can do LINQ to Objects and the use LINQ to calculate the totals:
decimal sumLineTotal = (from od in orderdetailscollection
select od.LineTotal).Sum();
You can also use lambda-expressions to do this, which is a bit "cleaner".
decimal sumLineTotal = orderdetailscollection.Sum(od => od.LineTotal)... |
I was also thinking Blueprint was great until I saw [YAML][1] (Yet Another Multicolumn Layout). There is an [online builder tool][2] which is fantastic. I can get a cool looking multicolumn layout within 5 mins.
[1]: http://www.yaml.de/
[2]: http://builder.yaml.de/ |
If you have Vista and the LiveMesh client installed try [this suggestion](http://weblogs.asp.net/lduveau/archive/2008/06/30/sync-your-visual-studio-settings-with-live-mesh.aspx)
Hope this helps. |
How to get entire chain of Exceptions in Application.ThreadException event handler? |
|.net|winforms|exception| |
I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with [Application.ThreadException][1].
What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. wit... |
I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with [Application.ThreadException][1].
What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. wit... |
A source control system doesn't cares if there's only one developer involved :)
I would reccomend that you use a source control system that you've used before and liked.
<br />If you like vs 2008 integration of the source control system however I would go with <a href="http://msdn.microsoft.com/en-us/tfs2008/defaul... |
A source control system doesn't care if there's only one developer involved :)
I would recommend that you use a source control system that you've used before and liked.
<br />If you like vs 2008 integration of the source control system however I would go with <a href="http://msdn.microsoft.com/en-us/tfs2008/default... |
I would recommend using subversion. Many have recommended using a seperate box as a server, in case your dev machine dies. What happens when the SVN server dies? The answer here is that no matter where you choose to run the server, ensure you always do frequent backups, possibly automated daily to some secondary, pr... |
Do you know of any "best practice" or "what works" vi tutorial for programmers? |
|vim| |
There are thousands of vi tutorials on the web, most of them generically listing all the commands. There are even videos on youtube which show basic functionality. But does anyone know of a vi tutorial which focuses on the needs of programmers? For example when I program in Perl with vi, moving to the "next paragraph"... |
**Context:** While it's true that HTTP overhead is more significant than parsing JS and CSS, ignoring the impact of parsing on browser performance (even if you have less than a meg of JS) is a good way to get yourself in trouble.
YSlow, Fiddler, and Firebug are not the best tools to monitor parsing speed. Unless th... |
Error Running CLR Stored Proc |
|sql-server|sqlclr| |
Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.
Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted... |
Don't the text boxes allow HTML usage? If that is the case, just use HTML to format the text into a table. Otherwise, try adding the text to a datagrid and then adding that to the form. |
As the solution is hackish, I think using your own date/time widget with some JavaScript is more feasible. |
How can I create a site in php and have it generate a static version? |
|php|html| |
For a particular project I have, no server side code is allowed. How can I create the web site in php (with includes, conditionals, etc) and then have that converted into a static html site that I can give to the client? |
|php|html|wget| |
For a particular project I have, no server side code is allowed. How can I create the web site in php (with includes, conditionals, etc) and then have that converted into a static html site that I can give to the client?
Update: Thanks to everyone who suggested wget. That's what I used. I should have specified that ... |
Just set :http_only to true as described in the [changelog][1].
[1]: http://dev.rubyonrails.org/changeset/7525 |
The name of the second form is "query comprehesion syntax", which the compiler translates into the first form.
|
No offense to those who provided clear answers, but many people seem to be answering your question instead of addressing your problem. You want multiple IDs, so you think you could this this:
http://example.com/mypage.aspx?IDs=1234,4321,6789
The problem is that this is a non-robust solution. In the future, if ... |
I don't believe that VBScript as hosted by IIS has any way of executing an external process. If you are using python as an AXscripting engine then you could just use the sys module. If the script you're calling is actually meant to be a cgi script you'll have to mimic all the environment variables that the cgi uses. ... |
The whole point of having a relational DB is keeping your data safe and consistent. The moment you allow users to alter the schema, there goes your data integrity...
If your need is to store heterogeneous data, for example like a CMS scenario, I would suggest storing XML validated by an XSD in a row. Of course you l... |
What is the best OpenGL java binding? |
|java|user-interface|opengl|swt|performance| |
I am trying to achieve better performance for my Java SWT application, and I just found out it is possible to use OpenGL in SWT. It seems there are more than one Java binding for OpenGL. Which one do you prefer?
Note that I have never used OpenGL before, and that the application needs to work on Windows, Linux and M... |
Since the Java code will get compiled to native code with the just-in-time (JIT) compiler, there's really no reason to use JNI to call native code.
Also, you shouldn't cache the results of a method where the input parameters are floating-point real numbers. The gains obtained in time will be very much lost in amoun... |
Just pass valid login parameters to a given URI. Should help you out.
**If you don't have login information you shouldn't be trying to circumvent it.**
<pre>public static string HttpPost( string URI, string Parameters )
{
System.Net.WebRequest req = System.Net.WebRequest.Create( URI );
... |
A nice collection of [vimtips][1].
And the best Vim [cheatsheet][2] around.
[1]: http://rayninfo.co.uk/vimtips.html
[2]: http://www.cheat-sheets.org/saved-copy/vimqrc.pdf |
Slightly off topic, but this is something everyone should know when working with the Money type in SQLServer.
You don't want to use a double, you want to use a decimal.
A Double is a long float, and floating point arithmetic should never be used for financial calculations.
Think of this, the fractions 1/3, 1/3... |
A) I have a similar CMS app and I store an ordinal value with the page for a particular tree and sort on this value -- because lots of my pages appear in completely different sites I have to maintain the ordinal number against a page / tree combination.
B) I too would like a better way to do this. Currently they ... |
I can't find any events that you could use. Perhaps you could subclass ListViewItemCollection, and raise your own event when something is added, with code similar to this.
Public Class MyListViewItemCollection
Inherits ListView.ListViewItemCollection
Public Event ItemAdded(ByVal Item As ... |
If it is complex HTML and Javascript, one possible way is [HTMLComponent][1], a method that uses an iframe over your flash to make it appear like the HTML is in your app. There are a few downsides to this method however - most of them described in detail [at Deitte.com][2].
If this can move offline, you could use Ai... |
If it was me I would look into something like this:
[NetCobol for Windows][1]
It should be fairly easy to wrap your COBOL with an interface that exposes the functionality (if it isn't already written that way) and then call it from a .NET application.
It took us about 15 years to get off of our mainframe, bec... |
The full screen suggestions are quite limited in their effectiveness as the user can always use a second computer or w/ multi monitor a second screen to perform their lookups. In the end it is probably better to just assume the students are going to cheat and then not count online tests for anything important.
If th... |
ASP.NET MVC quick start - a one-stop tutorial? |
|asp.net-mvc|mvc|tutorials| |
There are many ASP.MVC blog post bits and pieces scattered over different web sites, as well as couple of resource questions here - [ASP.NET Model-view-controller (MVC) - where do I start from?][1] and [MVC Learning Resources][2]
I wonder if there was a one-stop tutorial posted yet on getting started with ASP.NET MV... |
There are many ASP.MVC blog post bits and pieces scattered over different web sites, as well as couple of resource questions here - [ASP.NET Model-view-controller (MVC) - where do I start from?][1] and [MVC Learning Resources][2]
I wonder if there was a one-stop tutorial posted yet on getting started with ASP.NET MV... |
|asp.net-mvc|mvc|tutorials|duplicate| |
|asp.net-mvc|mvc|tutorials| |
In SQL Server is it possible to get "id" of a record when Insert is executed? |
|sql-server| |
In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Sele... |
|sql-server|duplicate| |
|sql-server|identity| |
In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Sele... |
How to efficiently SQL select neweset entries from a MySQL database? |
|sql|mysql| |