Author: Kenneth

An Honest WFH Experience – the set up

An Honest WFH Experience – the set up

An actual working from home set up! Not some manicured or cleaned up rig. But this is a functional, productive live coding environment.

Not the cleanest or slickest set up – but I really like it!

So the world is in lock down, or at least large parts of it are. Covid-19 has hit and in order to spare a complete meltdown of our health services we are all working from home where possible.

Thankfully developers have the ideal job when required to work from home (WFH). We can do our job from anywhere as long as it has some form of data connection – even that we can do without for a bit!

Location and surrounding don’t matter to dev’s

So getting to the point, what do I do that is different from others? I’m going to break this into two posts.

  1. My physical set up. (this post)
  2. My daily routine, with positives and negatives.

Set Up

Firstly, you may be used to having all your IT equipment paid for and purchased for you by your employer, and as such your home set up may only consist of a single laptop.

This will not cut it! From a personal view point, it will frustrate you, it will get you down, it will slow you down. This will ultimately lead you to become unhappy and stressed. Stress does not lead to good code and will lead you down a path to grey hairs and sleepless nights. 😉


Many screens keep context switching simple

Developers can earn a very good wage and purchasing a few screens or a desktop will not break the bank, think of it as an investment in you and your career. If your employer will pay for something then great! Take it, even the smallest of percentage gains in productivity will more than pay off and keep you happy.
If there is one thing that makes you feel good being a developer, it’s completing a task. The more you get done the better you feel.

It’s to easy to flip from being awesome to banging your head. A good set up will save you entering the painful state so often!

Ultimately a great, comfortable set up will make you more productive, contented, calm and happier, this is a win for all. The Covid-19 lock down is expected to be months, do you really wish to stare and a small 15″ laptop screen for 3-4 (maybe 8+) months!

I really can’t stress this enough – get yourself more visual real estate.

Software

Microsoft mouse without borders – https://www.microsoft.com/en-us/download/details.aspx?id=35460

This is an brilliant piece of software and free! Sure I’d like it to do a wee bit more, but it’s free. So you’ve got your small laptop, but now taken the plunge to get something to handle a few more screens. Can you use both at the same time without the hassle of two keyboards and two mice? YES.

Install Mouse without borders, now you control both machines (it can do more than two as well) without the clutter. But why should you do that? Does it really gain anything?

Two machines

Main One

My main machine (tower pc) is for code, work, emails and all that involves day to day operations. The reason for this is so I can get a powerful graphic card, get one that will drive 3 or 4 monitors. If I had space I’d have 4, but 3 screens is enough 🙂

The actual tower PC doesn’t need to be a powerhouse machine, especially if you remote into a secure remote desktop, which means your machine doesn’t need to do any real processing. Your circumstances may vary, but in all my years I’ve never ‘needed’ a top of the range machine. I may have wanted it, just because, but never needed it!

Machine Two

The laptop, and this is key for collaboration. It is used for communication. Being stuck apart from your colleagues is hard, and when you are working on spec’ing out a system or creating new configuration for which you may not have all the required knowledge, then having someone to speak to and bounce ideas off is invaluable.

So start up a Zoom conference call, stay on it all day if needed, keep the face to face open until you solve the issue. You can screen share on your main machine while being able to see and speak on the dedicated communications machine.

Until you reach a situation where this type of communication is required, this may seem like overkill. But once you understand the value of communication, the easier this is and the more human it can become, the more you’ll understand that it is worth every penny. We are beings that like to communicate, yes even developers 😎 Use technology to make this as natural as possible.

Am I at home or my office?

This part is one where it will be very difficult for most to do if you live in a very built up area, but if you can then you should! In terms of mental state, being able to work effectively and the switch off at the end of the day, this one is a HUGE winner.

You need to be able to leave your house!

What? How on earth can I leave my house, I’m in lock down? Well you need another building on your premises. If you have a few spare square meters then you probably have enough room to build a shed. There are plenty of log cabin kits out there, again not very expensive, depending on what you go for.

A small cabin can set you back less than a £1000

Get one of these set up, get some power and some heat in there, add a bit of insulation and you are good to go!

Is it worth it? 100% it is. You walk out your back door, leave the home behind and you are now at work. The mental separation is so clear, and what’s more – do you have children? Yes, then yes you can close the door, no screaming kids to disturb that all important thought process. What’s more they’ll love it when they can come in.

Then at the end of the day, turn it off, close the door and you are done.

Conclusion

Space and screens

Get those two things right and you will be as productive as being in any office in any part of the world.

Beinn Bhuidhe

Beinn Bhuidhe

Cycle and hike – photos here https://flic.kr/s/aHsmFMyddc

Ideal with a bike as there is roughly a 6km flat section in (and of course back out). There are signs that do ask that you leave your bike after about 4km, but after being on the track I’m not sure why they ask this. My guess is that inconsiderate people leave the gates open when cycling – so don’t do that.

After the main road section beyond the gates, the paths are still great.

Beinn Bhuidhe is a cracking munro, maybe it was the weather, maybe it was the micro brewery at the bottom, or maybe it was the sheer wealth of wildlife that I met on the way up the hill. Certainly one to complete.

If you do aim to complete this hill then if you follow the below then you’ll get more out of it as if you look at the map you could go up either side of the waterfall. But one side is much better to go up and the other to come down.

Look at that long flat path! Great for bikes, and such a joy on the homeward portion.

So which side and why?

Once you reach the point of choice, make sure you take the south side of the route going up the waterfall – why? Well if you don’t then you’ll miss out on this!

Number of pools on the way up
The path on the right of the stream is to far away to see this and its nothing but bracken up to your head height.
The left side of the waterfall had a huge variety of plants and at the same time wildlife. I seen literally 100’s of butterfly’s, probably 1000’s

So why go down the other side, if the left side is so good?

Well, the scenic route up can be a bit steep, which I find fine for going up but I’d rather a gradual slope on the way down. After being at the top and spending ages taking photos on the way up, you just want to get down and hit the micro brewery!!!

Bikes and Munros

Bikes and Munros

Top Munro hikes that are aided by taking your bike!

This page is for my own reference mainly, and of course at the same time if you find it and see it’s helpful great 🙂
Generally when looking for my next little walk up a hill if I see one with a long flat walk in, then I’ll bookmark it here so I remember it as I’m more likely to do a cycle/hike during the summer months.

Disclaimer!
I’m not a biker or a keen cyclist. My bike generally only gets used for those handful of days each year where I take it up a hill. This should give an indication of the level of ability required for these cycle/walks!

Bike walks completed

Bike walks still to do

Verify the checksum of an installer file

Verify the checksum of an installer file

One of those regular items you see when downloading a file.

What’s that checksum, how to I check it?

Quick solution if you are on a Windows machine.

  • Open the folder that you’ve downloaded the file to – probably the download folder
  • Inside the path bar, type cmd, then press enter
Enter cmd into the path bar
  • You will now have a command window open that is already looking in the download folder.
  • Now type the following certutil -hashfile {file name you are checking goes here} {check type, as in MD5 or SHA1 for example}
  • eg certutil -hashfile myDownloadedFile.exe SHA1
  • This will now output something like the below with a SHA-1 check

You can now compare the long number with the number on the download page, if they do not match DO NOT INSTALL.

Other checks you can do depending on what the website is asking for are these –
Hash algorithms: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

React Finland – post conference breakdown

React Finland – post conference breakdown

Time flies on, can’t believe its a month already since I attended the React Finland conference for the second time. Yes a second time, I took a fair amount away from the first one, so when I had the chance to go back again I definitely took that chance.

So why?

Friendly

Programmers and techy folk aren’t exactly the most chatty people, so when you are traveling on your own you’re always wondering how it will go. Will it be a case of turn up, enjoy the various talks then head back to your hotel after speaking with no one?

Nope, not here, at least not from my experience. Of course you need to be willing to speak to people, but the set up was great. Breaks long enough for people to grab a wee snack/drink and also visit the sponsors lounge area to chill.

I’ve been to enough conferences to know this isn’t easy to pull off. For example the ones in say London – complete opposite!

Sponsors chill out area
Sponsors chill out area – look at everyone talking! 😛 (They did actually)

Evening events

So you’ve a super friendly crowd and now they organise evening events.  For example after the workshop day a sizeable number of people headed over to one of the sponsors offices – Reaktor. I met with some great people and discussed lots of ideas, work and non-work topics. Had some friendly banter, food, drink and of course the obligatory Finnish sauna. Top hosting by Reaktor, again this was the same experience I had the previous year as well when I visited the Fraktio offices.

Reakor office chill out area

After day one of the conference, there was a comedy night. Yip comedy, in the same hall as the talks – and you know what it was actually rather good 😊 

Then you have the main after party event on the evening that the conference finished. Nothing too fancy, hall, food, music, drink.  Time to wind down, relax and cement some of the friendships that were made over the previous days.  Of course all these events just make the whole experience very enjoyable. Learning, sharing, and enjoying yourself at the same time.

BONUS

Due to the time it takes to get from Scotland to Finland I turned up a day early, no way I could have turned up on the Wed morning. Couple of weeks before (yes could have been arranged earlier but this wasn’t really part of the official conf) got the announcement that there was going to a pre-conference meet up! Great. It was held in one of the local companies offices, and maybe because it was unexpected, I thoroughly enjoyed it and it contained the talk that matched my company/team/project layout the most which made it the most appropriate. Getting into the mood of learning from others experiences. Only two talks, but both very good, especially the one from Smartly. Think it shows what the overall scene in Helsinki (Finland) is like. Very professional and well set up.

Bonus 2!

The organiser (Juho) had set up a slack channel for those wanting to meet up outside of the conference, to see a bit more of Helsinki if they wished. So on Sat after most people had left and flown home myself and Juho took a stroll around one of Helsinki’s nature reserves. Beautiful, weather really played its part and if anything was a tad hot for my liking – yes really. To hot in Helsinki! Never thought to bring shorts with me.  If you wish to see what it’s like I’ve got an album of just the walk – https://flic.kr/s/aHskQQsHuk. We must have walked 26-28km during the course of the day.

Squirrel

But what about the conference???

Sure, so I enjoyed myself, but that’s not the point of going to the React conference.  Well the conference didn’t disappoint either. The schedule for the two days were split into themes, so that you got back to back talks on say architecture, accessibility, styling, testing etc. Of course not everything will please everyone, so should you have had zero interest in styling/css then you headed out, had a shoulder massage, played some games in the sponsors lounge and had a chat with the sponsors or other attendees. Then you could find out about things like the micro satellite that they (think it was Reaktor) fired into orbit to photograph the forests! 
Think other than one talk, I stayed in and listened to every one of them and I’m glad I did.

Top talks for me –

Now for the ones I’ve not listed, doesn’t mean I didn’t like or didn’t take anything from them. Most were very good, only a couple I wasn’t keen on.  The above were the ones where I took something from and then able to use in my day to day role.

Was anything not so good?

Yes, unfortunately there was.  The workshop I attended wasn’t what I thought it was going to be and it was a super rushed course that finished approx. 1 ½ hours earlier than it was meant to. There was perhaps a reason for this in that the original trainer had to pull out, but the description of the course didn’t quite fit in with my expectation. https://react-finland.fi/workshops/#advanced-performance-tuning-for-react-applications  I was hoping for some performance tuning around the running of the application. Spotting common issues, what’s making items re-render needlessly, what takes up the most processing time, bad and good practice when dispatching events, that sort of thing.  The actual course was around start up time and getting the existing starter app down from say 4MB to a handful of KB’s.  For me, that’s not so much of an issue. Working only with internal customers I’ve never yet heard anyone ask for something to be smaller or faster at loading.  Sure we shouldn’t bloat our apps, but I’m not creating web pages so no one really cares. It did cover lazy loading and Service Workers which was great as well as other topics that I could take away.

So not a bad course and I did learn from it, just not what I expected and definitely too rushed. Unless you were very quick at touch typing, so you could watch the trainers screen and type at the same I don’t think you’d have been able to keep up.

Will I be back?

Sure hope so! I hear that the plan is to have two days of workshops! Sounds good 🙂

React Finland :D

React Finland :D

2nd year at React Finland, almost underway but what a bonus I’ve had so far!
I will be tweeting (@_delp_) live from the event and all going well covering all the best bits – which hopefully will be quite a lot.

It’s almost underway, but even before the conference has started I’ve been to a meet up at Smartly.io where there was a great talk about on Micro front ends. Same thinking as mirco services, but for the front end – makes sense, yes!

Had a workshop day yesterday which quite literally flow past with NikkitaFTW Some great insights into cutting down payloads and start up times. Perhaps best piece of information came in chunk on Service workers.

Service workers are dangerous – yet powerful!


https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#injectmanifest_plugin_1

Reaktor

Yeahhhh, they host a great meet up.
Check out the food on offer. Chatting for many hours to dev’s from all over Finland, Canada, France and even Vietnam!

React Finland ReactJS

And of course it wouldn’t be Finland without have a drink or two in the sauna. They love sauna here – and why not!!! The world needs more of them.

Getting back into my Blog

Getting back into my Blog

Given in the past 3-4 years I’ve only put up around 3 or 4 posts I’m going to try and get back into posting useful information. This may well repeat things others have said, but it will be in my way.

Everyone has there own take on knowledge, so hopefully folk will find this helpful. In the early days of this blog I know it was viewed by many Flex developers. At one point it was pretty popular! But as we all know Flex is dead (still awesome and better in many ways than even the latest JS, but lets not go there…)

What’s my first topic going to be?

Destructuring/Rest/Spread

Why? well as I pick up ES6, I’m seeing many ‘funky’ and neat techniques which takes me a few reads to figure out what is exactly going on.

So if you want to find out more check back and hopefully I’ll have something worth reading!

Here is the first one –
http://www.kennethsutherland.com/tips/clever-code/

[the_ad id=’1311′]

Clever Code

Clever Code

Getting into JS and come across code that many will consider ‘clever’ code. Is this code that is unreadable or is it the features that the language provides? I’m not really going to get into that discussion here – this post will hopefully instead help show and explain what is going on with such code. So should you see it then you’ll be able to understand what is going on and maybe even use it yourself.

const selective = [
    { id: "firstObjectId", ...obj1 },
    { id: "secondObjectId", ...obj2 },
    ...(obj3 ? [{ id: "thirdObjectId", ...obj3 }] : [])
  ];

What’s the aim of this code?

The aim of the above is to inject an ID into every object and at the same time it will only return two items if obj3 does not exist, and 3 if it does.

Why?

You may wish to combine a series of requests and sometimes you expect one of the requests to come back with nothing. If it does then there will be no need to return the 3rd element as an empty object – just drop it.

Explanation

Part 1 – What is { id: “firstObjectId”, …obj1 } doing? It’s taking the values from obj1, spreading them into another object while at the same time including an ID value. So it’s a new object with an ID as well as everything that was inside obj1 to start with.

What about …(obj3 ? [{ id: “thirdObjectId”, …obj3 }] : [])
Well if obj3 exists then it’s the same as the previous lines.
If it doesn’t exist then the line of code is

const selective = […([])]
which is

[…[]]

As the array is empty the spread operator will take nothing out of an empty array which leaves an empty array!
So we combine that with with the other spread objects and we now have a neat means of checking if an object exists and only if it does then include it in a returned item.

Old School

If this were in old school code it would look something like this

const returned = [
{ id: "firstObjectId", ...obj1 },
{ id: "secondObjectId", ...obj2 },
];
if (obj3) {
returned.push({ id: "thirdObjectId", ...obj3 });
}

So you are including an ‘if’ and then pushing the item into the array. Not quite as elegant!

TS1153: let declarations are only available when targeting ECMAScript 6

TS1153: let declarations are only available when targeting ECMAScript 6

Are you using trying out Typescript for the first time and getting the error “TS1153: let declarations are only available when targeting ECMAScript 6” when trying to declare variables with the “let” statement?

Well you need to update to a more recent Typescript version – thankfully its very easy (if you have npm installed) 🙂

1) Open command window and type “npm install -g typescript” (without the quotes). This installs latest stable version.
2) Take note of the install directory which is displayed in the command window
3) Open Intellij settings -> Languages & Frameworks -> Typescript -> compiler version
4) Change that to the lib folder of the typescript install directory.

That’s it 😀

Typescript examples – is there any really good ones?

Typescript examples – is there any really good ones?

Learning something new is never simple – but really doesn’t help when there seems to be a huge lack of good examples.

Anyone have some proper good examples, feel free to put it into the comments.

What I’m meaning is code examples like the below –

var index = 0;
var array = [1, 2, 3];
for( let index = 0; index < array.length; index++ ) {
    console.log( array[index] );
}

console.log( index ); //0

Now while there is nothing wrong in the above, for those wishing to learn Typescript and how to do it properly it should really be this –

var index : number = 0;
var array : Array = [1, 2, 3]; 
//This makes array[0] = "bob"; give a Typescript error as you can't put a string into a number type
var arrayLength : number = array.length;
for( let index : number = 0; index < arrayLength; index++ ) {
    console.log( array[index] );
}

console.log( index ); //0

See – give those var’s types! its the point of Typescript…
I’ve not even seen good examples on the Typescript site!