code-reuse

Re-usable android layouts

I was wondering how everyone re-uses android layouts and components? Do you do the old copy/paste the existing code into the project, or is there a way to include the layouts and components into a jar file for re-use? EDIT: For example if I have a list view, maybe I have another view that I am using for each list item in the listview, ...

CakePHP: reusing models, controllers, configuration but not views and routes

Hi guys, Our website is going to work as follows: There's a central site www.example.org where everybody can register, change information, manage their 'business card'. Also, everybody will have companyname.example.org. Here users can publish a simple site based on information they change in the main site. This site is being built o...

reusable application for django site wide announcements that displays a message only once per user.

I want to show various messages to registered users only once in my django application. I found django-announcements which seemed to do what I want - but I found in testing it marks messages as read by using a session variable, which disappears if the user logs out. This means a message is shown again to a user if they dismiss it when l...

Cross language development problem

I'm working on a project that involves a database (My SQL), website (PHP) and a custom high performance server application (C++). The C++ application (and its accompanying client application) make up the main bulk of the project, with the database storing long term data for it. The website is primarily for displaying various statistics, ...

C++ internal code reuse: compile everything or share the library / dynamic library?

General question: For unmanaged C++, what's better for internal code sharing? Reuse code by sharing the actual source code? OR Reuse code by sharing the library / dynamic library (+ all the header files) Whichever it is: what's your strategy for reducing duplicate code (copy-paste syndrome), code bloat? Specific example: Here's ...

Merge catch blocks with exactly the same code?

Hi I want to merge the catch blocks in the following code for code reuse reasons: try { DoSomeInputOutput(); } catch (InvalidOperationException ex) { HandleKnownException1(ex); } catch (InvalidDataException ex) { HandleKnownException1(ex); } catch (ArgumentNullException ex) { HandleKnownException1(ex); } catch (Argument...

Legal text for tranferring ownership of code

I worked on a small prototype for a client. As part of the delivery I need to transfer copyright and full rights to reuse and redistribute the code that I have written. I found some text to transfer ownership of images and videos on Google, but I need something specific to code written. The work was produced in New Hampshire, United S...

Building a code asset library

I have been thinking about setting up some sort of library for all our internally developed software at my organisation. I would like collect any ideas the good SO folk may have on this topic. I figure, what is the point in instilling into developers the benefits of writing reusable code, if on the next project the first thing develope...

Android: Custom Clock widget Service work-around?

I was interested in developing a clock widget for the homescreen and upon reading Home Screen Widgets tutorial, I wondered if there is a pre-existing Service I could reference for updating the current time rather than re-inventing the wheel? I download the Retro Clock application on my android phone and noticed that when I click it, it ...

Storing class files in dll and using the dll for multiple websites in asp.ne

Hi, I want to create a class file in VS2005 and be able to use it in other websites on my computer / production server. How do I create this dll and store it in a common place where I can reference it while developing and also on the production server ? Thanks & regards Sanjish ...

How can I reuse HTML/JSP within a page?

I'm new to JSP, and I'm trying to reduce a massive amount of cut-and-pasted code. On each page in the project, there are around 25 lines of mixed JSP,Struts tags,JSTL tags, and HTML, which have been cut and pasted at various points in the page. These ~25 lines of re-used code are not even remotely similar from page to page (and there ~25...

How do I deal with multiple common user interfaces?

I'm working on a python application that runs on 2 different platforms, namely regular desktop linux and Maemo 4. We use PyGTK on both platforms but on Maemo there are a bunch of little tweaks to make it look nice which are implemented as follows: if util.platform.MAEMO: # do something fancy for maemo else: # regular pygtk The...

How to try reusable django apps that don't provide templates inside?

Many of the reusable django apps don't include default templates inside. James Bennett says in his presentation Reusable Apps that providing truly portable default templates is very hard. He adds that most of the bug reports in the first release of his registration app were related to default templates. This is a valid point. But withou...

General frameworks for preparing training data?

As a student of computational linguistics, I frequently do machine learning experiments where I have to prepare training data from all kinds of different resources like raw or annotated text corpora or syntactic tree banks. For every new task and every new experiment I write programs (normally in Python and sometimes Java) to extract the...

Does a library to prevent duplicate form submissions exist for django?

I am trying to find a way to prevent users from double-submitting my forms. I have javascript that disables the submit button, but there is still an occasional user who finds a way to double-submit. I have a vision of a re-usable library that I could create to protect from this. In my ideal library, the code block would look somethi...

Can ASP.NET MVC Views be re-used across different projects?

This is a follow-up question to this question. It's a nice solution to sharing common Views across many projects using source control. However I have a couple of questions, specific to Subversion I think. Subversion Externals allows you to include a folder from a separate repository in your working copy, so you could define an "Externa...

Same code on browser/server

I'm writing a web app using PHP, and running into several situations where I need similar code on the server and browser. For example: I want to validate user input, and generate the same error messages on both sides. I want to format data using certain rules (e.g. if a given field is less than 1, show it with two decimal places, other...

SSIS and re-using C#

Hi, I'm a newbie to SSIS / C# (I'm generally a Java developer) so apologies if this is a really stupid question. Essentially the problem is this: I have two Data Flow tasks which load data up and export them to a legacy flat file format. The formatting is done by a Script Task (C#). What I'd like to do is share some common code between...

Code reuse tools

Hi, I usually maintain code snippets that I can resuse in a Wikidpad personal wiki with a small index page that can take me to any code that I want. I want to share these snippets with my team and am looking for easy ways to do it. Are there any tools that would help me setup such a repository? Or should I simply install a wiki and po...

Does rails3 provide any hooks for dropping in pluggable, re-usable components?

What efforts have been made in rails 3 to encourage code re-use? Is there anything akin to merb slices / engines built into the framework that would allow me to drop in a configurable component such as a 'blog' engine? If so, what is considered best practice? ...