Sunday, 27 July 2014

Patterns

Finally bought myself a patterns book, lots of wow and that is very clever moments and to get the best out of it a number of re-reads is a must. 

Factory, prototype, adapter, chain of responsibility and singleton I can see how they can be useful, they make a lot of sense. Some others will have to be left until I can go through them again




Little bits, looking through pluralsite agile courses the agile manifesto was mentioned which I have signed. 

Doing other reading about collection types, just how easy it is to implement a list, stack, queue, once the concept of a node is understood, I made my own list!

Hopefully this then makes it easy to see that you can add lots of different methods for push, pop, enqueue, dequeue, contains etc.

namespace basicsTests
{
    class Program
    {  
        static void Main(string[] args)
        {
            var firstNode = new aNode<string>("first string");
            var secondNode = new aNode<string>("second string");
            var thirdNode = new aNode<string>("third string");

            var someList = new aList();
            someList.add(firstNode);
            someList.add(secondNode);
            someList.add(thirdNode);

            someList.displayList();
            Console.Read();
        }
    }

    class aNode<T>
    {
        public object stored;
        public aNode<T> nextNode { get; set; }

        public aNode(T objectToHold)
        {
            stored = objectToHold;
        }
    }

    class aList
    {
        aNode<string> headNode = null;
        aNode<string> tail = null;

        public void add( aNode<string> node)
        {
            if (headNode == null)
            {
                headNode = node;
                tail = node;
            }
            else
            {
                tail.nextNode = node;
                tail = node;
            }
        }

        public void displayList()
        {
            var displayNode = headNode;
            while ( displayNode.nextNode != null)
            {
                Console.WriteLine( displayNode.stored);
                displayNode = displayNode.nextNode;
            }
            Console.WriteLine(tail.stored);
        }
    }
}






And apart from that a dragon fly flew into me, they make a decent noise when they take off.



 

Sunday, 20 July 2014

Getting healthy

The healthy programmer

Book with laptop and colourful coder walking away from it

At the moment I have not been able to implement all of the suggestions, new desk and monitor are needed. The only monitor about that meets the auto light adjustment and low blue is the BenQ BL2410PT.

Books website http://healthyprog.com/ 

A few of the main take aways from this book are to not sit for longer than an hour. Get walking, I bought a pedometer I am quite far short of the 10,000 steps per day so walking after lunch this week to see how the stats change.

Don't buy a cheap pedometer, there are lots about for less than £3, they don't count properly in my experience. Tanita 3 axes is working well.

Silver black pedometer with 3 buttons and counter display


Signing up for the yoga class sounds a pain, there are a few classes about, not just fitness centres the local college here offers different courses.  

Little useful things

OnClientClick can be added from the code behind just as an attribute
someButton.Attributes.Add("OnClientClick", "someJS();");

Off by one errors even happen to experienced devs and can produce strange results. 

Browsing stack exchange, there is a good thread on books to read, I have added a lot to the reading list
http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read 

Things for me to think about, I need to address the lack of knowledge with Regx, SQL and XML. When should I start looking at another language to dive into, apparently since I have done more in object orientated languages I should look at functional. Which functional language, f# and erlang look good, then looking at the job boards opportunities are limited. So much to learn!




Sunday, 13 July 2014

New Server!

Purchased a new server to manage back ups and a few bits, and this was on sale, the HP MicroServer N54L, they are the older model but for £130 not bad.

Decided on Linux to run it, ubuntu seeming the the in fashion flavor I went with that, a few hiccups with the install via USB which worked in the end using LinuxLive.

The only problem with ubuntu being graphics drivers, apparently this server has a built in mobility radeon 4500, which caused a black screen of death. 

To actually get into ubuntu was a bit of a faff, mash the shift key while it boots, this gets you into grub, hit e to edit, then after the kernel command add nomodeset. This allows ubuntu to boot properly.

When I get the basics set up, crash plan can go on and will sort it self out with backing up a remote copy of all the files I have.

More about the hardware, I like lots of little touches, the HP logo being red if you do something bad, easy HDD removal, internal USB port, and all the screws you need with their own torx key mounted inside the door. 

computer screen with purple background and dialogue box with scrolling text
black cube server box with white hp logo


server cube black with front door open showing quick release hard drives

server cube with door open and top off for optical drive

black server cube open with top off and quick release drives out


Little things learnt this week, asp button onclientclick will allow the onclick to run if onclientclick returns true.

Paint.net is not really that bad if you take the time, lot of short cuts for cropping images which I have done a bit of this week. 

Just dump zombie code and let svn handle it, so much effort to work around.









Sunday, 6 July 2014

All the little things

Purchases, 

Head first SQL, I read the reviews and liked the idea of the quirky style of learning which does seem to work for a lot of people, just not for me. 

The book just didn't work for me in the way I found it confusing about what I was actually supposed to do and actually a little bit of set up to get everything running. Perhaps for us more visual people picking a db with some sort of GUI would have been a lot of help. 

For next time I would pick a book that would err towards ms SQL, the book in it self was not a complete bust, I can now use select statements well which is helpful for digging out details. 

A4 sized book, picture of a woman surrounded by funny comics

Note: I take pictures of the books to prove I read them, to jog my memory when I review my posts for learning and I am visual thinker, images break up the text.

Things learnt this week, 

ctrl + f5, to do a full refresh of a page, the browser will get new copies of images and does not rely on any caching.

When using selenium IDE, select will work, when brought across to NUnit c# via selenium IDE this will not work, the correct command is SelectElement.

Click before SelectElement works in selenium IDE, in NUnit all this does is end up highlighting the selection in the drop down not selecting the item. 

I often use ctrl + k + f to clean up selected code in visual studio 2013, just use ctrl + k + d and clean up the whole document. Code is often moved around without any formatting applied which makes it harder to understand, especially nesting. 

A c# operator I was not familiar with is the null coalescing operator, I can see how to it could be handy it is new to me so very clunky. The idea is nullable types can be checked for null whilst their value is being assigned, otherwise we can set a default value.

Object someObject = null;
Object anObject = someObject ?? new Object();

The above assignment to anObject reads as if someObject is not null assign anObject the value of someObject else anObject is assigned the value of newObject(). 

Use space bar to pause play any media in ff seems to work in chrome, handy for pluralsite.

Sunday, 29 June 2014

New torch

Purchases, 

New torch needed as the free one from the AA had died, wind up thing, good idea just not durable, they are around on ebay for a few pounds. 

Gave this cheap torch a go from lighting ever, £10 on amazon. The reason this is good is the cree LED, which takes it down to one less than laser eye surgery, it is BRIGHT!

compact black metal torch with box

More than good enough for the car, depending on how durable the torch is I will end buying some for xmas presents. It is metal, the finish is not marvelous, mine arrived with a couple of dings.

Books read,

Thinking fast and slow by Danial Kahneman, this book has been tough going and made me think about how I actually think, WYSIATI ( what you see is all there is ). Regression to the mean and problem solving is actually hard work. 

White covered book with pencil drawing line and book title thinking fast and slow

Apart from that I have been using plural site to look at automated tests and clean code, after seeing some clean code and trying to implement some of the ideas the intent of each section and what to do is so much easier. To that end I have added clean code and the clean coder to the reading list, which I will get too after c# design patterns has been read through.

Sunday, 22 June 2014

Shortcuts

I've been trying to get more in depth with visual studio, because if I can make it do the work, why not?

This led to looking at more shortcuts, well worth looking through them properly more than once, 

http://visualstudioshortcuts.com/
For visual studio 2013, 813 shortcuts!

From that, F10 to run the line of code that is stopped on the break point. 

When throwing an exception in C# in the catch block if you re-throw for example throw ex; you lose the original call stack for the exception. Use throw; and this will retain the original call stack whilst throwing the exception.

Things I should have done ages ago, signed up properly with plural site. Why? Even the videos which weren't very helpful I learn at least one thing per course. Sometimes these are very simple ideas or how to use a tool better.

Purchases, this week it is a computer chair, the old one was looking rather desperate for repair. Looked around and lifehacker have some good reviews. I went with the IKEA Markus, it is actually a good chair and helpful with the recent warm weather, not the cheapest of chairs at £125 but I like it.

Black high back office chair with a webbing back

I have found it difficult to manage my reading list, the easiest way for me has been to add books to amazon wish list which then can be easily reviewed.

Buying books can be expensive, amazon is not always the best option, play is actually very good and can be significantly cheaper than amazon.

Saturday, 14 June 2014

Mostly car stuff

Gone a bit mad with the car stuff this week, bought an impact driver, which will be handy when brake disc retaining screws get stuck. I chose the Halfords impact driver over the draper from amazon because of the lifetime warranty ( for some reason the receipt must be kept ) and comes with more impact bits.  

Halfords impact driver picture shows the driver, bits, box and metal case

Cleaned up my cars headlights, the headlights were rough feeling, dull, and had yellowed, although the pictures do not show the yellowing well. I used the 3M Headlight kit, found a coating called opti-lens which seems to be a permanent solution to UV damage on plastic headlights.

There were a few reviews of the 3M kit not coming with enough tape which you do have to double up on however there was more than enough so much so I didn't even need the roll purchased separately.

left to right 3M headlight kit, pad with syringe of opti-lens and roll of painters tape

The results have been good, driving at night the beam cut off is now visible, brighter and whiter, which will be handy on the unlit country roads of which there are a lot locally.

Green car with nurmerous tools  in front of it, left headlight yellow, right headlight clear with brighter silver backing

Computing this week has mostly been plural site, .net code reviews being quite useful and can now make some suggestions at work. 

I want to start to use more of short cuts and code snippets so a list of those which make sense to me will be put up next time.