admin

This user hasn't shared any biographical information

Homepage: http://www.robertcasto.com

Jabber/GTalk: casto.robert@gmail.com


Posts by admin

Rebuilding a computer is not like it used to be

Over the holidays I decided to take the opportunity to rebuild my computer. I replaced the boot drives with SSD's and installed some bigger drives since the old ones were a few years old. I'm always scared to do this because there are inevitably problems you don't anticipate. This rebuild did not disappoint on the negative side, but it also surprised me on the positive side.

Surprise #1 – SATA drive happiness

The new SATA drives I got were smaller physically than the old ones but had more capacity. Also, the SSD's were the tiny 2.5" ones. The surprise is better air flow around the drives and everything running cooler. Cable management also improved a bit because I had a chance to put the drives in the holders in order with the ports. The one true happy surprise was how easy it was to go back to my old OS by just swapping out the cables and power connectors. These new SATA connectors are great but you have to make sure they lock in properly. More than once I had cables coming loose causing a boot to fail.

Surprise # 2 – The Internet Rocks

Normally when I rebuild a computer I spent a huge amount of time installing software, configuring it, getting settings right, and all that mess. This time I just brought up Chrome, installed a few choice extensions such as Xmarks, session manager, and a couple developer tools. Then I was up and running with most of the tools I use all the time. Using these Internet sites instead of installing software and dealing with all the management of it saved a bunch of time. Any more our computers are becoming access points to services on the Internet. That is good in many ways and bad in some, but it sure helped eliminate a huge time waster for me this time around.

Surprise #3 – I was able to access everything

I use a password database called KeePass which is a Password Safe program. I find it impossible to live without. I keep a lot more than just passwords in it. I keep server addresses, configuration settings, logins and passwords of course, and any other kind of information I need to remember but will obviously forget. I keep the database file for it in Dropbox so that it is available to me on any computer I use and my Android. A couple of times I had to go to my phone to look up some information I needed to provide for a login, configuration key, subscription id, etc. I also learned of a couple things I forgot to put in. But overall I had 95% of the information I needed and so the rebuild process went much smoother than normal.

Surprise #4 – Always ask for hardware help

During the process of installing Windows 7, I had a problem that was causing the install to be very slow. Incredibly slow. Slower than watching grass grow in Siberia. After finally reaching a high level of exasperation, I called up my brother-in-law. He thought it was bad memory and had me try a few things including running memtest86+ which didn't find an error, but stalled while testing the 4th ram stick. Pulling it resolved the problem which wasn't apparent before because Windows XP never made use of that stick. I had 8 GB installed and just kept putting off the rebuild. It is my main computer after all and my livelihood so having it down for 2-3 days is a real problem. Getting his help put everything on the fast track so the idea here is to enlist the help of someone else who has a broader view of the situation and can probably see something you won't. I would rather have my machine running properly than to feel stupid for asking someone a dumb question.

Surprise #5 – Seeing the world through cleaned windows

I have enjoyed Windows XP for a VERY LONG TIME. It has been a very stable platform on which to do software development. It has its quirks of course, but over the years I have grown quite adept at dealing with it and being productive with the OS. Now that I have Windows 7 installed its as if I have emerged from a tunnel. Many of the problems my machine had are now working properly. The machine goes to sleep and wakes up properly. It boots extremely fast and doesn't spend 5 minutes after boot loading drivers, startup programs, and all kinds of other junk. And having a clean machine free of 100's of test installed, trial programs, and clean drives as well feels very liberating. I have drive space again, a small list of programs installed, and browsers that don't stall or need restarting all the time. It is amazing how much cruft can accumulate over the years and its affect on the OS.

So if you are postponing a rebuild my vote would be to go for it and just take the pain. Once you come out the other side it will all feel worth it. Just make sure you allow lots of extra time to deal with the problems that will pop up. I had a number of them but in the end I was able to get past them. Now I just have to tell myself not to try out every program I see or better, I should take the old drives and setup a machine where I can try out all kinds of things and not mess up my freshly build development machine.

Stop calculating dates for your queries in MySQL

Recently I was working on a couple reports that were running slow. I was looking for indexes that could be created or modified in order to speed them up and provide a quicker response on my SellersToolbox.com website. I was able to find a couple but then the issue of dates popup up. I provide monthly, quarterly, and yearly reports and trying to select the right dates is very important. I have some logic there that determines the right range to be put into my queries.

What I learned recently though is that using functions such as YEAR(), MONTH(), and DAY() defeat the use of indexes and primary keys most of the time. Because these functions have to be performed on the date value, each record in the table is usually processed. This slows the query down greatly and causes a lot of needless computation to result.

What I found was the BETWEEN option in MySQL. Using this allows the query optimizer to utilize indexes fully, and eliminates the need for many date computations which can be expensive.

An added benefit I found was how to handle the beginning and end dates for my queries. Instead of calculating what the end date was, I could use the INTERVAL term and let MySQL figure it out for me. This also allowed me to use the same query for my monthly, quarterly, and yearly time ranges very simply. All I had to do was take the date and the interval such as the 3 examples below.

    BETWEEN '2011-10-01' AND '2011-10-01' + INTERVAL 1 MONTH
    BETWEEN '2011-10-01' AND '2011-10-01' + INTERVAL 3 MONTH
    BETWEEN '2011-10-01' AND '2011-10-01' + INTERVAL 1 YEAR

In this way I didn't have to do any extra work in my application, and I was assured that MySQL would choose records in the correct date range and take advantage of my indexes and primary keys. In this case, trying to do some performance improvements taught me a better way to write my SQL and resulted in less code which was easier to understand.

As you can see, modifying the query with the right amount of time is quite trivial. I have dropdown values in the SELECT on my web pages and all I have to do is append "-01" and then append the interval the user has chosen. Its great when code can be made simpler and more powerful at the same time.

If you do DataTables extensively, learn to use fnServerData

Recently I have been rebuilding my website sellerstoolbox.com with some help from Mike Christoff who is a graphical designer in Columbus Ohio. I use tables extensively to present information about sales, inventory, and many other eCommerce related reports For this rebuild I have decided to use DataTables more extensively. It is very powerful, provides lots of great features, all while using the browser to do the work instead of the server. One of the great things about it is being able to populate the table with JSON retrieved from my server using AJAX.

The problem though is what to do once the table gets this data. I want to modify some of the cells to add color, links, and other features based on the data there. Unfortunately the normal sAjaxSource value doesn't provide a hook where I can do these things after the data is retrieved. That is where fnServerData comes into play. I learned that by proving a function to this attribute, I can do just about anything after the JSON is returned. An example looks something like the following.

 

"fnServerData": function(sSource, aoData, fnCallback) {
    $.getJSON( sSource, aoData, function (json) {
        fnCallback(json);
        oTable.fnAdjustColumnSizing();
        hideWaiting();
     } );
}

 

The code above will be called when ever JSON data is being retrieved for the table. In this case I call the fnCallback function to process the JSON data that was returned. Then I am fixing the header and table column alignment on the table, and then I am hiding the DIV that is being used as a waiting graphic while the data is being retrieved. I could just as easily called a method to update the table cells, calculate a sum or average, or any other task once the data has been loaded and put into the table.

In my case being able to hide the DIV being shown while waiting was my main reason for learning about fnServerData. But now I use it just about everywhere since I always have some cleanup or post processing I want to do to the table. This is much easier than trying to do that work and pass it back through the JSON data. I also appreciate that the work is done using the browser instead of my server so performance for my system is enhanced by having less work to do.

Getting new logo – 99designs.com review

I recently wanted a new logo for my website SellersToolbox.com. I was worried that I would hire someone, it take a long time, and spends lots of money doing it. I was told about 99designs.com and decided to give it a try. I have never used these outsourcing sites but the prospect of hiring someone close by who could do the job as cheaply wasn't looking good.

I emailed them to ask a number of questions. I got answers to all of them from a person there who wasn't pushy or eager to make a sale. I wasn't ready to start the project right then and he didn't pressure me to do so. About 3 weeks later I created a contest and waited for things to happen. I got a few designs initially and provided a little feedback. Things didn't take off until around the middle of the week and then near the end a few really good designers jumped in. I ended up liking 2 of the designs so much I bought both of them. I can use one for a mobile phone button while the other one is being used for the website logo.

I highly recommend choosing a company to work with based on their support, feedback, and ability to deliver. There were other options, a number of them cheaper, but I feel like I got my money's worth and then some. It was a good experience and has opened me up to outsourcing more work. There are only so many hours and when there is a ton to do, and getting good help now seems like a definite possibility.