LIMS Component Editor Video

Posted on August 10, 2011

It’s been a very busy past couple of months – we’re still in the process of moving and setting up our new location in Southwest Florida. It’s been extremely trying on everyone here as well as working out some of the kinks in running 2 different offices at one time.

While all of this has been going on, we’ve managed to stay busy working and the first rebuilt screen has been completed in the LIMS project. You can watch the video to see how things are going.

I’ve added some new effects to the video and I like the way it’s come out. I’m getting better at producing the end result – this one took half the time the other one did!

Post to Twitter Tweet This Post

» Filed Under Uncategorized | 2 Comments

Coding Redevelopment

Posted on June 28, 2011

As programmers, we are often faced with that irritating situation of looking at our work and wondering whether or not to rip the entire thing apart or just make it work with the way it is. More often then not, we tend to use the latter option and soon enough our code becomes unruly and less manageable.

I have always tended to be on the other end of the spectrum. I’ll rip apart my code and not realize (until way too late) that I’ve broken some serious functionality OR that I’ve let so much time get away in “fixing” something that was operational, I’ve used up all my time for doing something really cool.

I am currently working on a new version of the grid objects we use in our application framework. Over the past 4 months, I’ve been sneaking in little things into the present version of our grids to enable more and more functionality and I’ve finally gotten to the point where I’m going to have to rewrite it into a new set of components.

I’ve decided to fork into a new assembly (originally, we used 2 assemblies to house our grid controls – CORE and RESOURCES). I am now adding a completely new assembly called GRID – although even that may change!

The cornerstone of the changes are centered around being able to add functionality, change the basic operation while still giving the same type of interfaces. When undertaking something of this nature – it’s important to understand the scope of what you are doing. In this case, the scope is ginormous but it HAS to be done if the grids are going to go to the next level.

To recode or not recode – THAT is the question!

What do you do? How do you handle rewrites? Do you even bother? Are you afraid to break that code?

Post to Twitter Tweet This Post

» Filed Under Coding | Leave a Comment

Trinity Data Solutions Video #1

Posted on May 9, 2011

We’ve been thinking a long time about making some videos to highlight what are products can do. We’ve always had an issue with producing proper documentation and help files because the code-base changes fairly often and we want to add features. Help is always the last to get updated.

I know from our own use of the Internet that video is much more appealing than reading – especially when we want to show people how good our stuff is. So I’m posting the video here first. Let me know if you like it!

Post to Twitter Tweet This Post

» Filed Under Data Presentation, Grids, Programming, Trinity Data Solutions | Leave a Comment

Coding Perfection

Posted on April 29, 2011

I’ve been extremely busy doing non-programming things these past couple of months. You see, we’ve been moving – actually we’re uprooting our entire lives! We’ve been planning it for a long time and we’re in the midst of doing it and we’re beginning to feel the pain of everything (as well as the financial impact!).

So what does this have to do with coding? A lot actually – you see, I’ve found that coding (or any creative activity for that matter) can be one of two things – a delight or a pain. It’s up to how you approach and what you want to get out of it before you can know what it is. It’s all setting yourself up for the proper mindset to accomplish a task and doing it well.

I’m finally starting to get back into my groove after 6 weeks of closings, moving, unpacking, packing, storage units, cars breaking down, sore muscles and no sleep. It is still difficult to sit down and get code done but that’s where the framework has come in to save me.

I used to think I’d never get to the point where I wasn’t constantly tweaking my lower level coding framework – this is the underpinning of all the stuff that I’ve built over the past five years. But now I see that it’s only now finally coming together. It has saved me over the past 2 weeks because I am able to accomplish 10x the amount of work that I did before – if I was writing from scratch OR even writing on something I had been working on that WASN’T the framework.

“Perfection is expected but excellence will be tolerated” – Joe the UPS guy. Joe is an awesome dude who’s had our route here in Flemington, NJ forever and he was talking to me yesterday about an office across the street that used to have that saying on a plaque. I’m sure if I Google it, I can find the source, but I like not knowing where it came from.

I get a lot of blowback from guys that have worked for me about my framework and my general standards for coding – you see, I’m a big believer in making sure that when I’m working on something, I’m not just trying to get it “done” but to make sure it’s correct. The simplest example I teach all my new hires is this. Let’s say you want to call something and you want to need to quote it – most people use the simple “HeresMyQuotedTextOrParameter” in there code and it stands out in VS as nice clean burgundy text.

But in my world – that’s a major no-no. While 9 times out of 10 you don’t need to get back to that little piece of code, that one time you do, you’ll go ape trying to figure out if you actually had used that in multiple places (which you did because of course being the quick and skilled programmer you are, you cut and pasted it!). So what’s my solution:

From my old days in the Pascal world (and Delphi) I use the top section and declare a constant string with a naming convention so that I can see what it is – usually a “cs_” to represent Constant String. So here’s how it all shapes up:

The Other Guy’s code:

private string Foo(string SomeStringINeed)
{
        return SomeStringINeed + " - Another Part of the String";
}

private void UseFoo()
{
        Console.WriteLine(Foo("Heres a tasty quoted string!"));
}

Here’s My Code:

private const string cs_HeresATastyQuotedString = "Heres a tasty quoted string!";
private const string cs_AnotherPartOfTheString = "Another Part of the string!";
private const string cs_FooOutputString = "{0} - {1}";
private string Foo(string SomeStringINeed)
{
        return String.Format(cs_FooOutputString, SomeStringINeed, cs_AnotherPartOfTheString);
}

private void UseFoo()
{
        Console.WriteLine(Foo(cs_HeresATastyQuotedString));
}

You get it! When you add this type of functionality up over the course of many months of programming, it will invariable save you life on many occasions as well as help in understanding and “knowing” where all your strings are!

Happy Coding!

Post to Twitter Tweet This Post

» Filed Under Coding, Programming | Leave a Comment

The Real Power of the Cloud

Posted on February 14, 2011

I’ve just read an excellent article in this week’s Information Week called “FedEx CIO Explains The Real Power of Cloud“. In the article, Carter talks about the power for FedEx behind the Cloud but it got me thinking and caught my attention with this quote:

“For the first time ever, you can make investments in a whole new class of technology for about the same price as just maintaining the base.” – Rob Carter, FedEx CIO

I think he hit the nail right on the head with that statement but it even applies to smaller businesses (I mean REAL small – 2-10 users even) because the piece that has always been missing to delivering all these opportunities has been what I like to call the Cost of Distance. With the advent of the mobile computing platform and 3/4G access and ridiculous communications speed to the Internet, we can now not eliminate the cost of actually getting to our data as a primary concern.

For small business’ this usually meant that computing power needed to be in proximity to where it was needed – i.e. the office had the files so everything was built around the office. Links would come in and we had internet but we couldn’t function without the hardwire to the office.

All of that has changed now and for the better. Shops like mine, where we used to build networks for our customers are now building our own networks – and letting the customer rent out space in it. For the customer, he doesn’t have to pay for technology he doesn’t need or care to know about and we can run the network the way we always wanted to.

I really love what the future is bringing. Although it will go through it’s up and downs – it will ultimately be a great thing.

Post to Twitter Tweet This Post

» Filed Under Uncategorized | Leave a Comment

Citrix XenApp 6 Fundamentals Installation Issues

Posted on January 21, 2011

“Houston…we have a problem.”

I remember that movie like is was yesterday and I’ve been living it for the past 2 days. I’ve been getting worked up trying to install my new version of XenApp Fundamentals 6.0 on a fresh server. It is the ONLY way you can install it.

I found a great blog entry outlining the whole process – but it has flaws. I did everything right the first time (without referencing the blog) except I ran the windows updates! This could be a serious problem with the installation. Before I read the blog entry, I ran into another problem he references with the cryptic error of not being able to complete the installation and to check the installation log located in the C:\Users\<UserName>\AppData\Local\Citrix\<Citrix Essentials Installation Log>.txt.

This is the WORST installation I have ever had to deal with.

**3 DAYS LATER!!!**

OK – I have a lot to report on. I have found the information that has saved the day. The problem with the error above and the abortion of an install program is found in this post here: Thread: XAF6 Installation Fails on clean machine

The key post in the thread is the one marked as HELPFUL

Steps to Configure Xen App Fundamentals 6

  1. Start with a clean setup of Windows 2008 R2 – load base OS no roles/options.
  2. DO NOT RUN ANY UPDATES!!!! (I can’t stress this enough)
  3. Configure your network connection.
  4. Join domain if you are using a domain (otherwise workgroup is fine but pay attention to Remote Desktop Licensing options when time comes – you can not use domain based licensing/enterprise licensing).
  5. Install the .NET 3.5.1 Feature using the server manager (you can add IIS as it will be needed later).
  6. ***CRITICAL*** Install the Remote Desktop Host services - this is the step not installed causing the error.
  7. Now run the Citrix Xen App 6 Fundamentals Installation – it should be fine now.

At first, I was using a bare-metal installation onto the server but after the third wipe – I moved back to XenServer 5.6. I was then able to snapshot and play around with different things. It took me a couple of days to get this right and all because I missed the middle posting about the REMOTE DESKTOP HOST SERVICES.

That should be somewhere in the Citrix documentation but it’s not. They say in the release notes (which I did read) that you needed to not run updates (ok – I read that AFTER the first installation and I ran into the problem) and you need to install the FEATURE 3.5.1.

I just reapplied my licensing and now I’m off to reconfigure the applications. Please let me know if these directions helped you at all.

Post to Twitter Tweet This Post

» Filed Under Uncategorized | 28 Comments

When Things Go Wrong…They Can Still Go OK

Posted on January 19, 2011

I’ve been working on a wonderful new service that we’ve been planning for months to offer our customers – our new data center. Most resellers/developers/consultants don’t have the luxury of a true data center capabilities but we at Trinity do. The plan was hatched over a year ago between my son, William and myself. We’ve been getting very frustrated by the amount of infrastructure we needed to put it in at our Flemington office. We’d been in there 6 years this December and we were still working off a single T-1 and although that was enough 6 years ago, our options have increased 10 fold.

We also wanted to move more into providing IT solutions and SaaS rather than selling someone else’s offerings. We put our heads together and worked with a local business in NJ that rented out rack space in their data center. We toured the place and we loved it. We purchased our rack from them in September and we moved in some basic equipment over the next 2 months testing the water and setting up the necessary VPN infrastructure.

Data Center #1

Row from our Data Center

Last weekend, we moved all of our production servers over – we lost one in the process (totally my fault). It’s caused me a couple of 45 minute trips (which is the only down side to having a remote data center) but it is extremely nice having unlimited bandwidth and power!

I’ve been rebuilding a couple of VMs and Citrix servers now for the past 2 days and when this little disaster is fixed, we will come out of it much, much better.

While it is deafening in here – I like to spend time here and work. It’s peaceful with all the hum of air conditioning and server fans!

If you’re worried about your servers and you want expert help in managing your information, give us a call (908)788-5303 @ Trinity Data Solutions and we can help you!

Post to Twitter Tweet This Post

» Filed Under Uncategorized | Leave a Comment

Threading/MultiProcessing Part II – BackgroundWorker Example

Posted on January 12, 2011

It’s been a while since my last post but the holidays were busy and vacation right after that – so I’ll have to apologize but other than 5 spam messages, I don’t think anyone was desperately waiting on my posting….however – I wanted to show a couple of key things with the BackgroundWorker object that may not be that self evident. There are a lot of good articles explaining how to use the BW in code but (as with most examples) they are a bit abstract. Meaning – they tend to lend themselves quickly to over simplified examples but as soon as you try to do anything important – you’re a bit hazy applying the same code (at least it was for me but then again, I’ve been known to be a bit daft and/or slow when it comes to coding).

Here are a couple of links I referenced to see the ins and outs:

So what I plan on doing is showing you how I use the BackgroundWorker object:

I have a process whereby I go out and lookup properties of web pages and collect information. I don’t want this process to interfere with my interface or screen while it is going on so I want to move it to a background process. I DO want the user to be aware it’s running and I want some results to be showing up on the screen as it goes through and does it’s thing.

In my scraping utility – I have another flag that actually goes out and does a minor web crawl on the site to see if I can find a contact page/information. I check for page rank and a couple of other extended properties. That means the timing is variable and the screen will update as it find results.

Originally, I built the process to do all the work in chunks and then update the screen when it was done with the process – this caused the application to look like it was doing nothing but waiting – very unpleasing to the eyes.

Background Worker Basics
The BW has 3 basic events and corresponding methods that are important to the operation:

The DoWork event/method has to be implemented because that is where the BW is going to do all the work. You need to remember that there should be no calls to any objects on your GUI screen that were created by the main thread – this will cause an Exception – leave any updating to the screen for the ProgressChanged event.

The RunWorkerCompleted is the signal event that the BW process has completed and you can do any cleanup code you might have left over – usually you’re going to code for the end of the process – like a pop-up dialog box telling your user the process has completed (what a shocker!). You don’t need to implement this method – it’s optional.

The ProgressChanged event – this is the event YOU are going to use to do all your screen updates and messages updates – the biggest thing here to remember is that you have to actually make the object trip the event. If you have no screen updates to do at all – you do NOT need to use this process.

The devil is in the details and the key to the ProgressChanged event is in the arguments class – ProgressChangedEventArgs. We’ll come back to this in a minute.

So here’s the process we’re going to code – real simple:

  1. Create a windows form application.
  2. Drop a text box (textbox1) on the form.
  3. Drop a button on the form.
  4. Drop a BackgroundWorker on the form.

On the properties of the BackgroundWorker – set the WorkerReportsProgress property to TRUE. (This means that we’ll be able to use the progress event). There is another property to support cancel – which kind of works the same way but we’re not going to pay attention to it yet. The other links I gave you up top can show you the basics.

What we want to accomplish is to click the button, have the background worker do something in the background – report an in between progress to the form – then do some more work – then report some progress – then finish up and tell the user we’re done.

We’re going to use the ol’ sleep function to simulate some work is done but I’m going to show you how the key event args are going to work so you can do anything with these bad boys.private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)

Note: I’m adding a reference to System.Threading so I can use the Thread.Sleep(time in milliseconds) function. It is to demonstrate that some time has elapsed. You won’t need it when you’re actually doing work – it’s to simulate that a process is under way.

 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {

      int somePercent = 0; //this will be our percentage marker so we can update a progress bar
      string myText = "We are starting now!"; //this will be our text var to update along the way.

      //initiate the process by reporting to the gui:
     backgroundWorker1.ReportProgress(somePercent, myText);
     Thread.Sleep(10000); //sleep to simulate some work - remember work with gui controls!

     somePercent = 25;
     myText = "Process = {0}% of the way done.";
     backgroundWorker1.ReportProgress(somePercent, myText);

     Thread.Sleep(5000);
     somePercent = 50;
     backgroundWorker1.ReportProgress(somePercent, myText + " - half way home!");

     Thread.Sleep(3000);
     somePercent = 75;
     backgroundWorker1.ReportProgress(somePercent, myText + " - I wish it were done!?!!");

     Thread.Sleep(2000);
     //we're done now - let the Process Complete method take over!

 }

private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
      if (e.UserState is string)
         textBox1.Text = String.Format((string)e.UserState, e.ProgressPercentage);
      //this will update the text box to show whatever we are passing in - pay close attention to the e.UserState OBJECT!
 }

private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
      textBox1.Text = "Finally completed!";
 }

Now run your little app – it should work where that text box get’s filled with our text after each sleep period. The thing I want to draw your attention to is the way we call the progress event:

backgroundWorker1.ReportProgress(somePercent, myText);

The somePercent is an int and that is the value you can use to update a progress bar control somewhere on your form but the more important is the UserState object that is passed next on the argument line. What is the UserState object? It’s anything you want it to be because it is of type object! The key is to make sure you cast properly in the progress delegate method. That’s why I use the if (e.UserState is string) test – that way my cast never generates an exception although you didn’t need to put it in.

The point of this exercise is to show you that you can do anything in your processing block and let the GUI know that you’re doing something by using this object. In addition, you can take it further by adding more elaborate event args by inheriting from the base and creating extensions. A quick idea example is when I wrote my scraping process, I created a class to hold all my information that I collected during the process and then passed it into my UserState object which during the report progress method, it actually writes it to the database and updates a grid on my form – and it works flawlessy.

You can also create the BW on the fly and assign the methods at time of creation (thus not relying on the form creation) and spawning more than 1 BW process – be careful though! You should always be aware of your processing load and the amount memory you are sucking up.

One final point and than I promise to shut up:

You should really know what you are trying to do and why – sometimes you need to have the cursor waiting to let the user know something is going on and it’s always best to think out what has to happen – the use of EVENTS is another topic I’ll cover later on. The EVENT is the single most powerful component when creating applications that don’t follow a straight up linear process but more on that next time…

Post to Twitter Tweet This Post

» Filed Under Coding, Programming, Threading | Leave a Comment

Threading, Multi-Processing or Any Other Way You Call It! (Part I)

Posted on December 7, 2010

I’ve not written in a couple of days – mostly due to the fact that we’ve trying to get our ContactFormPost program working properly. It’s been an incredible couple of days – long hours, loss of sleep and a lot of screaming at each other regarding why things work or don’t work. I’ve had epiphanies and complete meltdowns…up and down and up and down trying to hit that elusive beta data so we could get the code out the door…but it has eluded us all – until now.

There’s a lot of reasons why things like this occur when your developing a program – mostly because you don’t have a solid development outline/plan. I know lot’s of larger shops can afford a project manager, architect, designer, testers and coders – but all we have is a lose bunch of smart-ass hot-shot developers who can cut through a lot of red tape to get stuff done. There is a problem with that though. We kind of fly by the seat of our pants until one of us (usually me) stops everyone in their tracks and tries to comprehend all the different things that people are working on and come up with some strategies on putting together a well thought out and organized intuitive application.

That’s where the fun comes in.

OK – so what does all this have to do with the title? Lots…you’ll see.

We’ve developed a method for posting onto web sites that has contact us form pages. The development of that part of the code was all done in a primitive brute force method but was necessary to understand all the ins-and-outs of the different possibilities that web developers use to try and thwart some of the things we are doing. The positive part of the exercise was that the basic premise and how to get it to work was developed and it worked.

The problem and my part of the application centered around taking that brute force code and creating objects that would be reusable in a full blown GUI. My first mistake was thinking I understood how the poster was actually working. It used a series of form-based timer controls that would kick off different portions of the code. The timers were necessary because the browser document is not fully loaded (even when it reports that it is). So I created delegate events that the timers would kick off when they’re time interval occurred. No problem so far.

I built a custom control to wrap the browser object and the timer objects together. I created a new object (poster) that actually did all the work and created a private instance of the custom browser control hooked to the poster object. This made it easy for the poster object to reference it’s own instance of the internal web browser.

Then I created a new form (we’ll call this my operation screen) in which all the links you wish to work through are located on it in a grid. The idea is that you will select some or all of the links in the grid and the program will go through each one and post your message to each contact page listed. Sounds simple, right? WRONG!

You see, the first thing you’ll want to do is run all this in the background because you don’t want the screen to get hung up. Now there are a bunch of ways of doing the background processing thing in .NET and I looked at them all. I chose to use an implementation of the BackgroundWorker object. It’s very neat and clean and works extremely well with procedural based things you need to do in the background. There are great methods for handling the progress of what you are doing in the DoWork delegate that allows you to paint back to the screen.

The first problem (and at the time I couldn’t see this) was the procedural basis of BackgroundWorker’s DoWork delegate. Because my poster object relied on not a series of steps but a series of timers completing before I could look at things, I couldn’t replicate the actions that would occur if I ran my poster object through the list in the main thread (the main application thread – that is). I didn’t see this until I actually had everything coded and all of a sudden – nothing worked!

I was freaked out. I couldn’t debug anything because I never realized that things were going directly to garbage collection because the DoWork process was completing…basically I realized that while my implementation of the BackgroundWorker process was truly elegant, I had actually outsmarted myself by mis-designing what I really needed to happen.

What I needed to happen was I needed to convert the poster object to a true event driven object. The story of how I did that will be in the next post…

Post to Twitter Tweet This Post

» Filed Under Coding, Programming, Threading | Leave a Comment

Log File Design

Posted on December 1, 2010

We’re working on our SEO tools and one of the things we have to do is fold in a Logging Tool. Logging is as old as the hills and its just as critical for applications now as it was when it was invented a million years before time began. The idea is simple: Create a running text file (or some other format) that has every message in the application stored in it. Sounds simple – but in fact, it is one of the most tedious jobs to do when you are writing an application. Mostly because you want to get to the snazzy code as opposed to the plumbing.

A lot of people are like that – they don’t understand that when they start writing the cool code they need to do something, they forget that they’ll have to eventually (if the program is worth anything) figure out a way to build in all the things we take for granted as we use our software. Today was one of those days.

Log File Sample Illustration

Here's a sample of the latest log file...

We’re working on a form poster for our SEO tools submission library. Everything is going great until we actually had to fold in the libraries of the actual posting robot. The problem is there is very little in the way of screen updates since the idea of the tool is to do everything automatic with no human intervention. The code was all written from test applications that used direct form inputs and had to be recoded into class libraries so that we could use in and out of different form objects.

During the process of converting to truer classes, we had to have a lesson on why we needed logging. The answer came pretty quickly when we found that we thought we had everything working and in fact, found we missed a bunch of conditions. Those conditions were finally caught in the log after we went back and tied together every method implementation. The problem was that because we didn’t think of it in the beginning, we had a lot of work to do. So quick hint: Setup your logging before you actually start to write you class library – it will help.

We at TDS have created several versions of our logger – the newest version we are using in our SEO tools is a complete rewrite of our older logger. The original logger was easier because it was pinned in the back end by SQL. We didn’t have to worry about saving the underlying persistence method – but without a database (per se) to speak of, we needed to write all the ugly code to save the data file, where to save the data file, etc. Now that we have this library, we’ll probably make this more generic and use it more locations than just this application.

Here are my keys to successful logging mechanism:

  1. Log file should be generic to handle errors as well as messages.
  2. Create log severity levels – usually enums that allow you to filter the log file writing mechanism if you don’t want to catch everything. An example would be TRACE, WARNING, ERROR, EXCEPTION and MESSAGE – we use all these in our logs and then some.
  3. Try to create categories so that when you look at your log in Excel or some other database type tool (or LINQ for that matter) you could actually sort and filter using the categories.
  4. Try to have a place for the method you are working within so you can capture the elusive “when”. It’s a really good idea to tag the actual method that is writing a log entry in the process – I use an OPERATION column to store that.
  5. Sometimes its good to separate error messages from messages. I also want to separate EXCEPTIONS from things that I trap for.
  6. Most importantly, you should have some method for either exporting, saving or persisting your log in a simple format that is portable across different operating systems. XML, CSV or text are always good options. We prefer XML.

Post to Twitter Tweet This Post

» Filed Under Coding, Log Files, Programming | Leave a Comment

keep looking »