Taking the next step on the road down which FakeModel is travelling, I decided that offering realistic data would be a good step to take. Initially anyway. After I created the FakeData Library, meant as the next update to FakeModel, I made the decision to release it as a standalone FakeData Library, instead of a FakeModel incorporated feature.
And I did just that.
The FakeData Library is a .Net Library which offers the generation of realistic data for whatever purpose it is required. This could be data for Unit Tests, for the Development Environment or to be used in Client Demo’s.
I created FakeData as I came across a requirement to create a large data set, containing valid data, to be used as an example of an enterprise application’s data for student’s.
However, the application in question contains sensitive data for client’s who would rather even the smallest detail wasn’t made public, as it could offer large analysis rewards to competitors.
Thus, the FakeData Library was born.
Used in conjunction with FakeModel, an entire data set with millions of realistic looking records could be created in less than a minute, after the initial setup was completed.
The FakeData Library consists of a set of static classes containing realistic data ready for assignment. The library can also aid with choosing elements from collections and arrays, choosing Boolean values, and holds some helpful string manipulation methods.
For more information, take a look at the FakeData Library Page.
The page includes examples of usage and installation instructions.
I’ve been working more and more with Sql Server Integration Services in recent times, implementing a Data Warehouse for business analysis. Today I came across the need for an If-Then-Else Derived Column, something I’ve never done before in SSIS, so I thought I’d share my experience.
For those who are unfamilair, SSIS (Sql Server Integration Services) is a component of the Microsoft SQL Database that can be used to automate Extract, Transform, Load (ETL) processes across a range of data sources into a destination. Data can be changed, additional data can be looked up and data from multiple sources can be merged to fill a single destination.
Effectively, as with the purpose of ETL, SSIS allow us to denormalise a data structure, fit for a data warehouse.
SQL IsNumeric Function
Today I have been working on the Extract, Transform and Load process of the latest section of our Data Warehouse implementation. The idea is to move an Ad-Hoc analysis engine created a year ago into the Microsoft Intelligence Stack, allowing greater flexibility, performance and scalability, whilst also easing any maintenance woes.
Whilst there is a lot going on, and more than a finger count of ETL processes within the Integration Package, it isn’t overly complicated.
However, I did hit one issue with one of the data sources I was loading from, a column that will remain anonymous here. The data of the columns looked something like this;
The issue with this data is that, it can be of two data types, held within a varchar field. According to the design and documentation of the system in question it is supposed to be Numeric only, held in a varchar field (I know not why). Numeric is the only data I was looking for, the erroneous values could be ignored without any data issues arising within the Data Warehouse.
Effectively, this column is trying to hold data relating to two separated pieces of information. As if you were using a column to store a Phone Number, unless they didn’t have a phone number, in which case it would store an email address.
I did a bit of research, and found the best way to extract the data that was needed was to employ the SQL IsNumeric function.
This function will check a value to see if it can be considered numeric, returning 1 if it can and 0 if it can’t.
Using the function, I was able to extract only the records required by implementing it as such;
SELECT * FROM TableInQuestion WHERE ISNUMERIC(TableInQuestion.ColumnName) = 1
A Word of Warning
IsNumeric was ideal for my situation today, whilst the data column was confusing it was guaranteed to only contain either a number or a name. However, the SQL IsNumeric function will return 1 for some values that are not numeric, and as such we must be careful in it’s use.
The values include +, -and the valid currency symbols found here.
When I announced Injection V1.0.0 on Monday, I mentioned (I think) I was going to release an article explaining how to setup Injection as a IoC container within MVC.
And here we are.
The first step is to create your MVC application and install Injection, details on how to do so can be found here.
You should also take this opportunity to get familiar with Injection, if you haven’t done so already. This article will assume you are familiar with some of the basic functionality.
Injection V1.0.0 Release
Introducing Injection V1.0.0, My Very Own Inversion of Control Container!
And as promised, yet another project has been released!
What’s The Story?
Well I skimmed over this when announcing the release of MemoryCache V1.1.0, but I’ll elaborate a bit further here.
At the beginning of March I had a chat with one of the Lecturers from Teesside University. He mentioned one of his students who had done exceptionally well, and had created his own Dependency Injection container as part of his project because he decided that the ones available had too much of a learning curve to them.
That conversation got me thinking.
Dependency Injection isn’t a new concept to me, it’s something I’ve been doing for a long time, only always manually. I’ve had a look at IoC containers before, but as I stated, I’ve never used one. I was somewhat curious about them, but stumbled at the first hurdle when I realised I didn’t want to spend the time learning 15 different containers to get a deeper understanding of them, but nor did I know which one to look at individually, as there appears to be advocates of one or the other at every turn.
So I decided there was no better way to learn than by doing.
I did a bit of investigation into IoC containers, but nothing overly in-depth, and set about creating my own, and here we are with Injection V1.0.0.
What Doesn’t It Do
Injection v1.0.0 isn’t feature rich. It is a lightweight, simple and easy to use IoC container.
Injection v1.0.0 will not allow for and does not support the following;
- Custom Lifecycles
- Calling methods upon resolution
These may be introduced in future versions.
What does it do
Injection will allow for;
- Registration of Named dependencies
- Registration of Anonymous dependencies
- Resolution of Named & Anonymous dependencies
- Dependencies as Singleton or Transient lifecycles
- Setting of constructor arguments for dependencies
- Removal of registered dependencies, both Named and Anonymous
The next steps will focus on improving Injection v1.0.0 by adding new features and functionality. As of yet, there is no priority of features to add, that’s just something that will be figured out as I go along.
I’ll consider Auto-registration, Interception, Custom Lifecycles and Method Calling, as well as the release of a MVC specific setup.
I’ve been all about the personal projects lately, and here I am again announcing an Update, this time we are moving to MemoryCache V1.1.0.
As usual, this can be downloaded from the MemoryCache V1.1.0 NuGet Page
So What’s New?
MemoryCache V1.1.0 see’s the addition of built-in automated maintenance.
By default, MemoryCache will run a maintenance task every ten seconds, removing any objects which have passed a set expiry date. The idea is to reduce the size of MemoryCache by removing redundant objects.
It’s easy to use, as is the idea behind each one of my projects, but I’ll dive into an example anyway;
FakeModel V0.0.6 is here!
And it’s been a little bit of a while coming (The last release was back in December!). Well let’s blame Christmas!
Truth is, I’ve been very busy, I have a lot going on right now and it’s been a struggle just to throw some blogs out there, never mind put the time into updates, I didn’t want to rush anything and get it all wrong (So here’s hoping FakeModel V0.0.6 isn’t broken!)
As Promised, MemoryCache
I would like to introduce you to MemoryCache, my newly released NuGet .Net Package, offering easy access to a scalable, multi-threading capable In-Memory storage solution.
Basically, a .Net Cache.
MemoryCache, as with FakeModel, was created to solve a problem domain in something I was working on, ensuring no licensing or ownership issues would arise. I wanted a Lightweight, thread safe In-Memory cache to use, and now I have one. It wouldn’t be fair to keep it all to myself.
I will look to improve MemoryCache as time goes by, but currently I only have one plan for improvement, which is to offer a method of gathering statistics on the current state of MemoryCache.
As always, I’m open to suggestions. If you have any ideas on how I could improve MemoryCache, or even if you just want to know more about it or ask a specific question, feel free to get in touch using the normal channel, over on the Say Hello! page, it’s always nice to hear from you.
Family, Work, Life, Career Prospects, Birthdays, Anniversaries and personal projects.
I have a lot going on right now, so things aren’t getting done as fast as I was hoping. This post isn’t supposed to be happening, it’s supposed to be announcing version 0.0.6 of FakeModel, or version 1.0.0 of MemoryCache.
But alas, I haven’t got everything in place yet and I don’t want to rush anything that isn’t ready, so here’s a peak at what is heading this way.
FakeModel 0.0.6 Sneak Preview
The next update to FakeModel, hopefully not too far away, will see built-in handling for creating collections of fake data objects. This will be done by calling;
There will be more to it than that, a few additional options, but you’ll have to wait until the release for the full story!
MemoryCache Sneak Preview
I’m giving all the secrets away today.
MemoryCache is another personal project I have began working on today, but it’s not a massive project so will be released shortly as well.
A little bit of fine tuning and the creation of some documentation and this In-Memory Data Storage library will be ready to go.
Usage will look a little something like this;
MemoryCache.Store("ObjectKey", Object); MemoryCache.Get("ObjectKey");
But don’t tell anyone yet.
A little side note.
Although it happened back in December, it was nice to see an MVP, Darrel Norton, recommending one of my articles on Donut Caching;
Back on the beaten path
I have a lot going on right now, but I won’t be putting anything on hold, it’s just taking a little longer than I had hoped to get things finished.
Watch This Space!
Test Driven Development, TDD for short, is the concept of using automated tests to drive the design of an application. Test Driven Development relies on very small repetitive cycles of development, a juxtaposition to what is normally expected from development. Using Test Driven Development, we somewhat invert the development process, and we cover the Test part before any Development is done. It may sound whacky, but it works.
Well, they go something like this;
- A suite of unit tests can provide instant feedback as to the state of an application, just from being run
- Scope limitation. If something goes wrong, there is a small area that can be the reason the test is failing
- Once a test passes, and the code has been factored, that code can be considered complete
- Forces better analysis and understanding of a problem domain – A test cannot be created without knowing the desired result, which only comes from analysis and understanding of the problem domain
- Test Driven Development leads to a solid application design that is loosely coupled and easy to maintain.
- Tests act as a safety net and provide regression testing without any effort.*
- Time spent debugging is marginalised. (See *).
* If a bug is found, because this will still happen, a test should be created which replicates the steps taken when the bug occurred. This will reveal the cause of the bug, and production code can be modified to fix the bug. This should be done without causing any of the other unit tests to fail. Each test run then ensures each bug fix applied over the lifecycle of an application are still doing their jobs.