reuse

How to re-use ASP.NET .aspx or .ascx files?

Hi all, I know if someone wnats to re-use some classes (not UI), he must gather all of them and put in a Visual Studio Class Library, build it to some dells and distribute thoese dlls. In this approach there just one code, you just update code in one place. But what about ASP.NET's markups? For exmaple you have an .ascx file or a colle...

Using the same CArchive object for archive and un-archive

Following is a sample code: CFile serFile; serFile.Open(_T("Person.ser"), CFile::modeCreate | CFile::modeWrite); CArchive writer(&serFile, CArchive::store); me.Serialize(writer); writer.Close(); serFile.Close(); serFile.Open(_T("Person.ser"), CFile::modeRead); CArchive reader(&serFile, CArchive::load); CPerson clone; clone.Serializ...

Why does reusing arrays increase performance so significantly in c#?

In my code, I perform a large number of tasks, each requiring a large array of memory to temporarily store data. I have about 500 tasks. At the beginning of each task, I allocate memory for an array : double[] tempDoubleArray = new double[M]; M is a large number depending on the precise task, typically around 2000000. Now, I do som...

Reusing an activity by changing elements properties

Lets say we have a main class with 5 buttons, where when each clicked go to an activity that displays information with 2 textviews. The layout for all 5 activities will be the same, so naturally I would want to use one activity and reuse it by changing the text displayed in those 2 textviews for each button pressed. How can I do this? ...

WCF Service Reference generates its own contract interface, won't reuse mine!

Hi, my first question so hope it is suitable - Shared interface assembly - I have a 'shared' assembly which has an interface, let's call it IDocRepository. It's marked with [ServiceContract] and there are several [OperationContract]-marked methods. WCF implementation assemblies - I have two WCF service projects, each referencing the s...

Server-side reuse of a silverlight class that uses .Net RIA Domain Services

Currently I have a working Silverlight application that uses .Net RIA Services. It's structure: Client-side Application.Client.UI.dll (Xamls and basic UI stuff) Application.Client.BL.dll (Contains the Link to RIA and most of the business logic) Server-side Application.Server.Data.dll (Server-side dll that holds the Entity-model a...

Repeated TableViewCells show up when I try to reuse tableviewcells... how do I get the new ones to show?

I am having a problem with my code skipping over the if(cell == nil) after about nine trips through the cellForRowAtIndexPath. Then items in my table start repeating and do so every nine items. When I remove the if(cell == nil) line, the table comes out beautifully, with all the data in the right order. However, if I scroll to the bottom...

Static cell from Nib file is not shown

I have a Nib file containing grouped table view and a cell. The cell is connected to UITableViewController through outlet. In cellForRowAtIndexPath I just return that cell and I can see a single cell in the table view. But when I change the row count of table to 2 and want to show the same cell, then I can see only one, it appears that t...

Reusing expensive UserControls

So we have this legacy code that displays data in a tree format. They pad each node of the tree using spacer images (...yup..ugh) Unfortunately, the use of these images is controlled by an in-house UserControl that we're forced to use (basically just derives from Web.UI.WebControls.Image, though). Well, turns out we have a HUGE tree wi...

Multiple Linq data models with the same table being mapped in each Re-use mapping

I've implemented the repository pattern on the data access layer of our current service layer. We have an object model where the same class "historical notes" is mapped on mutiple objects (currently 6 but soon to be more!) Part of the best practices for the use of linq to sql is not to have one dbml file for every table in the db, but ...

Avoid reinventing the wheel, mental process you use to force yourself not to rewrite existing code.

Need help here, I'm a coder who has always felt the weight of a tremendously strong force pushing him to reinvent the wheel. It was so strong that I was nearly trying to reinvent jQuery lately [Note] and this really made me think. I read also these well written articles, but they don't give any practical suggestions to follow in order...

create Custom Component and re use it

hi all, i am new to ext, i want to create a custom component containing a form and use it by registering it as a xtype, where i want: MyComponent = Ext.extend(Ext.FormPanel, { initComponent: function () { Ext.apply(this, { labelWidth: 50, // label settings here cascade unless overridden items: [{ ...

What is the best way to cache and reuse immutable singleton objects in Java?

Hi, I have a class representing a set of values that will be used as a key in maps. This class is immutable and I want to make it a singleton for every distinct set of values, using the static factory pattern. The goal is to prevent identical objects from being created many (100+) times and to optimize the equals method. I am looking ...

App with embeded GCC-XML parser support

Hi, What should be the right approach to reuse GCC-XML parser utility inside any other Windows C++ native or C# .NET application ? I read that it is used by some libs like pygccxml, PyQt, it is not yet clear how. Please enlighten me. Seems no API documentation is available... Thanks ...

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...

How can I reuse code AND resources in several applications?

How can I reuse code AND resources in several applications? I have a fairly large code base (including resources) that I want to reuse i several applications. How can I do that? I did try to use the Android Library concept (http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject) but never got it to work in Android...

How to reuse / reset an ZipInputStream?

I want to reset the ZipInputStream (ie back to the start position) in order to read certain files in order. How do I do that? I am so stucked... ZipEntry entry; ZipInputStream input = new ZipInputStream(fileStream);//item.getInputStream()); int check =0; while(check!=2){ entry = input.getNextEnt...

Java/.NET - reusing values

Do we reduce memory consumption when storing a String value that we use very frequent ? As far as I know, every time we do a "some string" declaration, a new string is constructed, instead of using the address of an existing one with the same value. Am I correct ? (I am not talking here about improving the code maintainability) ...

How to store CALayers for reuse?

I have a bunch of identical CALayers that I want to reuse. Often, a few of them should disappear, and then get reused in another position within the same superlayer (half a second or so later). What is the best way (performance-wise) to keep them while they have disappeared from the screen? setHidden:YES, or setOpacity:0, or removeFromS...

How to reuse Cucumber step definition with a table for the last parameter?

This code: Then %{I should see the following data in the "Feeds" data grid: | Name | | #{name} |} And this one: Then "I should see the following data in the \"Feeds\" data grid: | Name | | #{name} |" And this: Then "I ...