code-reuse

Is there a way to remove magic numbers from a XML Schema?

I have a WSDL with some types defined. Some elements accept lists of elements and on the service return I also have elements with list of values (or other elements). As a result I have some magic numbers in the XSD (e.g. minOccurs="10", maxOccurs="250" etc). These values 10, 250 etc are repeated throughout the XSD types. Is there a wa...

Mobile cross-platform classes

Does the fact that different mobile platforms can use similar languages implies that you can reuse classes between these platform ? For example c++ code on iOS, Android and Symbian devices. Or is there some other things to take into account, libraries, etc. ? In the same spirit would it be possible to share C# code between iOS, Android ...

Expression generated based on interface

I'm geting the exception Unable to cast the type 'MySomeTypeThatImplementsISomeInterfaceAndIsPassedAs[T]ToTheClass' to type 'ISomeInterface'. LINQ to Entities only supports casting Entity Data Model primitive types. my repository looks like public interface IRepository<T> { IQueryable<T> Get(System.Linq.Expressions.Expression<Syste...

How to create generic/reusable code with Scrum?

Scrum development is based on listing user stories and implementing them in during sprints. That approach - focusing on actual goals of the end product - definitely has its virtues, but what bugs me is that it doesn't advocate creating any generic/reusable code in the process, and actually I feel like it advocates hacking. For example, i...

Reusing tasks in SSIS

How can a task be reused in SSIS without copy/paste? For example, I'd like to use the tasks I've defined in an event handler for one executable in another executable, but not with all executables in the package. So far, I haven't found any solutions other than writing a complete custom component, which seems like overkill. Any suggestio...

Django / Python, Make database save function re-usable (so that it takes modelname and appname from strings), using contenttypes or some other method?

I want to make some functions that are re-usable by any model so that I can specify the appname and model in string format and then use this to import that model and make calls to it such as creating database fields, updating, deleting, etc... I had thought I could do this using contenttypes in Django but am trying this, as below and am...

How to organize repositories with reusable components

I have the following git repositories: ReusableA ReusableB ReusableC Application1 ReusableB and C both depends on ReusableA. Therefore both repositories include ReusableA as a git submodule. Application1 depends on ReusableB and ReusableC, so it includes both as git submodules. However, this should cause the Application1 repository t...

Python, Django, how to use getattr (or other method) to call object that has multiple attributes?

After trying to get this to work for a while and searching around I am truly stumped so am posting here... I want to make some functions in classes that I am writing for django as generic as possible so I want to use getattr to call functions such as the one below in a generic manner: the way I do it that works (non-generic manner): fr...

How can I share code between Joomla plug-ins and components?

I'm writing a Joomla plug-in that accesses the data stored in a self-written component. How can I access the code of that component? I'm especially interested in the tables and models. Is there an official way for doing that? ...

Splitting classes out into DLLs using VS2008 C++

I've got a VS2008 C++ solution containing one project which is a Win32 console application. I have developed a few classes that I want to re-use in another project. Apart from copying the source files into new projects, what's the correct way to turn my classes into some sort of reusable component? Should I be using a standard DLL, or a...

Library for both iOS and OS X apps?

For a while now I have been killing spare time by creating a 2D game programming toolkit/library. It is written in Objective C, and consists of an OpenGL rendering system and a whole bunch of AI, physics code, a bunch of specialized containers and other game related stuff. Apart from the OpenGL based View mechanism (obviously), most of t...

How to organise large code files?

I am increasingly aware that my code in any single file can often span hundreds of lines quite easily and although I know the implementation might be sound, it still feels messy and unorganised. I understand that there are situations where a lot of code is neccessary, but whats the best way to organise it all? I've thought about separa...

multiple optional Android packages, an AccountManager implemented somewhere among them

I spend most of my time in an environment where I can package code with dependencies that are resolved at install time automatically. That's nice. I can install any item and the library needed to support it is automatically added if it doesn't already exist. In Android, this isn't yet possible, so I need another way to share some reso...

Errors: "INSERT EXEC statement cannot be nested." and "Cannot use the ROLLBACK statement within an INSERT-EXEC statement." How to solve this?

I have three stored procedures Sp1, Sp2 and Sp3. The first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the second one will execute the third one (Sp3) and save data into @tempTB2. If I execute the Sp2 it will work and it will return me all my data from the Sp3, but the problem is in the Sp1, whe...

Executing a Table-Valued Function from a Stored Procedure with multiple Table-Valued Parameters being passed through?

I've got a stored procedure that executes some repetitive code, so I decided to make the redundant code into a table-valued function. The problem that I'm encountering is: Msg 137, Level 16, State 1, Procedure Search, Line 98 Must declare the scalar variable "@myTVP". A simple example of the SQL code that I'm using is: CREATE TYPE [d...

Rules are deprecated, what's instead (TSQL)?

Rules (Transact-SQL)[1] are reusable what permitted to overcome the shortcoming of non-re-usability of check constraints. And now I read [1] that: "This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feat...

Why are system views duplicated to user databases?

Why has SQL Server to duplicate a hundred of system views from model database into each user-defined database instead of keeping them centralised (for example, as it keeps server objects) and using them in specific context of specific database when asked/needed? Aren't they (for example, definitions/script of a system view) common b...

reuse javascript codes(reduce the Duplicate codes)

Hi: When I make some components in my web page,I found there a so many duplicate codes,for example,in my page I want to make two charts. THe biggest difference of them is the data store and the title,however they have many same attributes. I do this by define a new instance of Ext.chart: var chart1=new Ext.chart.LineChart{config1}; ...

How to simplify/reuse this exception handling code

I tend to write code like the following a lot: BufferedWriter w = null; // Or any other object that throws exceptions and needs to be closed try { w = new BufferedWriter(new FileWriter(file)); // Do something with w } catch (IOException e) { e.printStackTrace(); } finally { if (w != null) { try { w.cl...

config file in php

hi all, i want to create a user defined config file,which contains some variables with constant values, now i want to access those values in many pages of my application.how can use those variables using functions..what is the best way to do this without using classes. ...