boilerplate

Avoiding Dialog Boilerplate in Delphi and /or C++

I often need to design a dialog in Delphi/C++Builder that allows various properties of an object to be modified, and the code to use it typically looks like this. Dialog.Edit1.Text := MyObject.Username; Dialog.Edit2.Text := MyObject.Password; // ... many more of the same if (Dialog.ShowModal = mrOk) begin MyObject.Username := Dialog...

Howto create software package in Unix/Linux

Hi all, How can we create a software package. So that after extracting our software tar ball user can do the typical steps: $ gunzip < mycode.tar.gz | tar xvf - $ ./configure $ make $ make install ...

Boilerplate licensing for non-FOSS libraries

I have found this list of FOSS licenses. Is there anything similar for non-free/non-open source boilerplate? Barring that, does anyone known of a commercial software library distributed with a license (that I can "borrow") that fits these requirements: I retain all rights to software (i.e., it is not freeware or open source). The dll ...

Abusing type overloading to create boilerplate code in C#

Hi all, In a project I'm currently working on, we've added a wrapper class for accessing the HttpSessionState object. The trouble is that the current solution means you have to write some code to wrap the functionality. I came up with the following solution /// <typeparam name="TKey">Class used for generating key into session state sto...

Password checking boilerplate

I have some server side code that needs to check a username/password pair. I'm looking for something to do this that is nice and simple as in having a text file with username/MD5 hash pairs. I'd love the code use to look like this: if(!PasswordChecker.ValidLogin("passwords.dat", username, password) throw new Exception("Invalid usern...

How do I reduce "uses" boilerplate for new forms?

Every time I add a new form to my project, it drops a big glop of boilerplate in the uses clause. uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; Seriously, who uses the Variants unit on anything resembling a regular basis? I generally end up removing Windows, Messages, Variants, Graphics ...

What is the minimum boilerplate code for a OpenGL 2D View?

What's the minimum boilerplate code required to setup an OpenGL view (with the necessary projections,camera angles etc) for drawing a 2D game? For example, the minimum required to do Quartz 2D drawing in a custom view (and, say, load a background image) is the following: #import <Cocoa/Cocoa.h> @interface MyView : NSView { } @end =...

Is there an existing library of extension methods for C#? or share your own.

Possible Duplicate: Post your extension goodies for C# .Net (codeplex.com/extensionoverflow) I'm fond of C# 3.0. One of my favorite parts is extension methods. I like to think of extension methods as utility functions that can apply to a broad base of classes. I am being warned that this question is subjective and likely to ...

Should I use the Debug class in .net?

I've been reading a lot about the Debug class lately. I'm pretty torn about it personally. I can see it improving the process of creating really tricky algorithms. But it also adds a lot of code to my app that I have to wade through unnecessarily. Having a Debugger should remove the need for boiler plate code, whether it is stripped ...

Alternative to django form processing boilerplate?

The suggested pattern for processing a form in a view seems overly complex and non-DRY to me: def contact(request): if request.method == 'POST': # If the form has been submitted... form = ContactForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass # Process th...

Is this a legitimate alternative to the "traditional" dispose pattern for class hierarchies?

I am not a fan of boilerplate code: copy-paste reuse is potentially error-prone. Even if you use code snippets or smart templates, there is no guarantee the other developer did, which means there's no guarantee they did it right. And, if you have to see the code, you have to understand it and/or maintain it. What I want to know from the...

How to change boilerplate "Sent from my iPhone" text in MFMailViewController message body?

I'm using the MFMailComposeViewController to send an email from within an iPhone v3.0 application. I programmatically create the message body text and display it before showing the picker. At the bottom of my message body text is the string "Sent from my iPhone." Is there anyway to modify this text or prevent it from appearing? A cursor...

ASP.NET: User control with access to the controls that it wraps

I have a bunch of occurrences of this kind of boilerplate code in my ASP.NET project. <div class="inputfield"> <div class="tl"> <span class="tr"><!-- --></span> <span class="ll"><!-- --></span> <div class="lr"> <div class="cntnt"> <asp:TextBox .../> </div> </div> </div> </div> As you may have gu...

Java: Is there support for macros?

I am just curious on how people solve this. I often write the same type of code all the time. For instance: new Thread() { //... //... //... //Change this line //... //... }.start(); I keep changing the line where it says "Change this line" and then starting a thread. This change can be one line or a few lines. How w...

Standard business logic data classes for .NET

There are a lot of "primitive" boiler plate types of data classes that could appear in many different programs. However, I have never seen a class or library set that recognizes the need to combine all these things with common logic required for them such as validation. Example classes ([] brackets correspond to classes also in hypothe...

Can I have Vim ignore a license block at the top of a file?

Is there a way to use folds or some other Vim-script black magic to hide license blocks at the top of files? I don't like that they take up such a large section of my editing pane; I like to get a sense for what a file is doing when I first open it, rather than a face-full of boilerplate. ...

How to prevent boilerplate Java code on parsing a complex XML file?

I have written a XML parser with DocumentBuilderFactory for a complex XML file. Because there are many different node types that there are many boilerplate code. For every node type (NodeName) I have a loop over the children and a switch for the possible children elements. Is it possible only to register the needed code for the differen...

Eliminating boilerplate codes for web applications. Is it rocket science?

Year 2010 and we still have to write boilerplate codes. Lets assume we are building an online application (it doesnt matter wherter it is fancy or not but a funtional one). We first make database design and put some business logic on it (stored procedures, unique or not etc) then we code server side and write most of the business logic o...

Factoring product type assignments in OCaml

I'm generally unsatisfied with writing code like this: let load_record_field cursor gets geti gett a = function | 0x01 -> let c, s = gets () in (a.a_record_uuid <- s; `More_record c) | 0x02 -> let c, s = gets () in (a.a_group <- s; `More_record c) | 0x03 -> let c, s = gets () in (a.a_title <- s; `More_record c) | 0x04 -> let c, ...

understanding syb boilerplate elimination

In the example given in http://web.archive.org/web/20080622204226/http://www.cs.vu.nl/boilerplate/ -- Increase salary by percentage increase :: Float -> Company -> Company increase k = everywhere (mkT (incS k)) -- "interesting" code for increase incS :: Float -> Salary -> Salary incS k (S s) = S (s * (1+k)) how come increase functio...