reusable-code

Reusable code / class Repositories

I've got several modules containing functions, classes and templates that I keep in a directory called (hah!) 'reuse'. I know the content reasonably well, so to find a particular class or bit of code doesn't take too long, but it is slowly growing in size and I need some sensible method to store them for easy search & retrieval. How sho...

How do you make code reusable?

Any code can be reused in a way or an other, at least if you modify the code. Random code is not very reusable as such. When I read some books, they usually say that you should explicitly make the code reusable by taking into account other situations of code usage too. But certain code should not be an omnipotent all doing class either. ...

Simple / reusable CRUD in PHP (NO famework or big classes)

I'm working on a PHP CMS like project and I'm trying to find out what's the most convenient way of dealing with the CRUD functionality in PHP. The CMS is programmed completely in procedural PHP (no OOP - I know that many of you will not agree with this...) and was designed keeping everything as simple and light as possible, as well as c...

What reusable code should every developer have in their toolbox?

I'm trying to build up a library of reusable code to use from project to project. As I write code snippets and components, I'm trying to decide which libraries I will get the most use out of long term VS will I really use this again? What code or components do you reuse that should every developer have? I'm primarily interested in .net...

How do you reuse html/js/server side code between asp.net projects?

We have a blog system that we sold to a number of different customers (included in many different projects). This system includes a number of different files – a few aspx pages, one or two ascx controls, one css file, one javascript file and some codebehind/vb.net utility files. In general 90+% of this module is the same between custom...

How to re-use a reusable app in Django

Hello Django experts I am trying to create my first site in Django and as I'm looking for example apps out there to draw inspiration from, I constantly stumble upon a term called "reusable apps". I understand the concept of an app that is reusable easy enough, but the means of reusing an app in Django are quite lost for me. Few questi...

Recursively parsing XML in Actionscript 2

I'm looking for an efficient and reusable way to parse xml into an object in actionscript2. The xml structure itself might change so it's important that im able to parse the xml with out 'hard coding' specific nodes, etc. I normally use As3 and wouldn't need something like this since the XML class is easy to drill down into. Below is AS...

Multiple representations of the same entity

Thinking about avoiding code replication, I got a question that catches me every time I start developing a new system: Let's say we have a system where I have a customer, have to CRUD it in a repository and show it as a resource in a webservice. Thinking about the classes related to the customer, we would have (Okay, I will never use ...

Reusing a Control in another Windows Forms Project

I've got lots of web experience but am a total novice when it comes to Windows Forms so this might be easy to answer: I have Project1 which I've added a reusable control to which allows filtering and searching of data and presenting results. I now want to use the same control in another Project. When I open Project1 and select my form...

Reusable Content Box Data In ASP.NET MVC?

If I create a PartialView for a box that holds a header, image and content what is the best way to store the content without using a database? Example: TurboTax I doubt the content for the boxes in the sidebar are stored in a database but to make reusable code it would be beneficial to create the structure in a PartialView and populate...

Set django-notification to be opt in rather than the default of opt out.

I'm using django-notification to allow my users to opt out of certain alerts I generate in my web-application. By default when I create a new notice type it is enabled rather than disabled In the users notification interface (checked) I'd like to make some alerts opt-in rather than the default of opt out. I've looked through the docs ...

django reusable template code

So as I am architecting my project, I'm thinking I must be doing something wrong. Some pieces of template code are reusable that makes me want to extract the code out of the template, but I can't find a good way. For example, some buttons are the same design all throughout the website. What's the best way to extract it out of the page...

Android Layout: Is reusable component UI possible?

I'll preface this with, I've just started learning Android so be gentle. I come from an ASP.NET / Silverlight background so I was looking for something along the lines of controls. I want to reuse a layout (a ListView item template) in other layouts. Such that in my other layouts I can just add <myListItem /> to show it. Is this, or a...

In house reusable libraries - reuse as dll or as projects?

We have quite a bit of reusable code at work (a good thing). Whenever I create a new project that use them I am used to include their projects as part of my solution, and I was wondering if I should instead reuse them as published dll's instead. The reason (or excuse) I include the project is that if I find a bug in one of them I can bra...

How to make reusable components/classes from existing iPhone project ?

Hello all, I on the doorstep of a new learning curve . I want to make reusable components / classes from my completed iphone project and with the mention of the following questions , If anyone want to redirect me to some useful reusable components or classes it will be useful to me . And Also tell me which is the best way to make reus...

a reusable query with modifications?

i'm using this mysql query alongwith php to search for multiple keywords: $query = "SELECT cQuotes, vAuthor, cArabic, vReference FROM ".$table." WHERE ("; $countFields = count($arrayFields); while ($a < $countFields) { while ($b < $countSearch) { $query = $query."$arrayFields[$a] LIKE '%$arraySearch[$b]%'"; $b+...

Vimrc: how to reuse code and definitions for differnt file types?

I have defined my own file types using vim. For example I have: .classNotes .reportJotNotes .homework These file types are defined in .vim files: ~/.vim/syntax/homework.vim ~/.vim/syntax/reportJotNotes.vim ~/.vim/syntax/homework.vim Many of these things have several of the same code in them. Ie they all have this for titles: sy...

Simple C/C++ library for triangle-intersection acceleration structure

I'm raytracing and would like to speed it up via some acceleration structure (kd-tree, BVH, whatever). I don't want to code it up myself. What I've tried so far: Yanking the kd-tree out of pbrt. There are so many intra-dependencies that I couldn't succeed at this without pulling all of pbrt into my code. CGAL's AABB tree. Frustratingly...

How to write a reusable code in cakePHP????

hello friends Can any one provide me some tips to write reusable code in PHP / CakePHP thanks in advance ...

How can I make this application re-usable?

I made a .NET Windows form that allows users to view a particular document and sign it. I want to make it re-usable for future applications. The challenges are: The text to be signed requires parameters. Before the user signs it, the text is just a query - not saved anywhere When the user signs it, the text he/she signed must be sto...