FAQ Database Discussion Community


Which pattern to use?

java,pdf,design-patterns,plugins,code-reuse
Problem: I have to fill up PDF forms. The same fields have to be filled up using different formats for the value. For example there can be a date field like @[email protected] or @[email protected] Similary @[email protected] or @[email protected] Then there comes times frequently where requests come for more formats for...

reusable parameters/ variables for svg graphic

svg,code-reuse,reusability
For a study project I'm asked to write an easy customizable svg graphic. Is there any concept of variables? The best I came up with so far is the following: <g id="box"> <rect x="0" y="0" width="25" height="20" rx="3" ry="3" style="fill:transparent;stroke-width:1;stroke:rgb(0,0,0)"> </g> <g id="month"> <!-- first row --> <g transform="translate(50 40)">...

How to reuse an Xcode project into a new project? Static library, Framework, Targets?

ios,objective-c,iphone,xcode,code-reuse
I built an iOS project (actually workspace because of Pods) that is 100% functional, with its logic and UI (Storyboard and xibs). Now I would like to reuse this app/project as a "core" for future apps. I've been searching about it and there are several solutions like Static libraries, Frameworks...

In C++, how to reuse the code when object relationship isn't intuitive?

c++,inheritance,composition,code-reuse
Apologies if this is sort of vague, but I don't know how to go about code reuse in the following situation. I'm using C++. The program is a simple simulation and it has a few different things in play. struct StupidBug; struct SmartBug; struct Plant; struct Mammal; Each of these...

Integration of different parts of code

java,ruby,software-engineering,code-reuse
I am working on a small project on metadata extraction from documents and have run into, eh a dilemma. I have some libraries in Java which work well with document-handling for information retrieval, like Apache Tika, POI etc and some more tools in other languages like Ruby(pdf-extract) and a script...

Android: Define a view and its children once and reuse it anywhere

android,xml,code-reuse
I want to define the following xml once, and then reuse it any activity. I just read that I can use styles, but the examples here only style a single View with no children. I know I can inflate this, but is it possible to do this purely in xml?...

How to add global variables used by all tests in Javascript?

javascript,testing,code-reuse,base-class,code-duplication
I could not find how to remove code duplication in Javascript (basically what I would achieve in Java with base classes). The concrete example is (at least) the following code, which is common to all spec files (and potentially page objects, since I am testing with that pattern in protractor):...

How to request a c++ feature?

c++,inheritance,standards,composition,code-reuse
How could I request a C++ feature ? Who do I have to write to ? The feature I would like to request is a mere syntax commodity : When using composition, we need a better syntax in order to provide method forwarding. Something like what follows : class Object{...

Passing pointers to different variable types to a function and reuse them later for assignmet

c++,variables,templates,pointers,code-reuse
In a GUI based project I need Page1 to mark a variable to be changed and call Page2, Page2 reads user's input and updates the marked variable with the new value. The variable type is always different and all the variables are held by an external linked library. How to...

Choosing function over another function Clojure

design-patterns,clojure,code-reuse
I have set of function like these, (defn nmf-kernel [a b]) (defn lin-kernel [a b]) (defn log-kernel [a b]) Then another set of initialization function like these, (defn fill-random ([a b] "filling matrix random") ([a b c] "filling matrix random with another setting parameter")) Ok, and i have a scenario...

Reusing a UITableViewCell's IBOutlets with two different UITableViewControllers

swift,uitableview,code-reuse,iboutlet,tableviewcell
I'm creating a coffee timer as a learning exercise and I want to have a different menu based on the brewing method selected. I'm storing my settings in NSUserDefaults and populating my tables with two separate arrays that look like this: var aero = ([ "Cool Down Time Enabled" :...