Showing posts with label home. Show all posts
Showing posts with label home. Show all posts

Sunday, 29 March 2020

Working from Home – Aiden’s Top 10 Tips

About a year ago I began to work from home fairly regularly, spending at least 1 or 2 days at home. Since October, I had been working from home 3 days a week and commuting to the office the other two days. Since Coronavirus struck, like near everyone else in the country, I’ve been working from home full time.

The following article looks at how I have transitioned to working from home and my top 10 tips for staying sane and productive whilst maintaining a work life balance.

1.   “Commute” to work

We first tried this in October when we moved home. We found a local walking route of about 10 – 15 minutes long. The morning walk helps get your brain into the work mindset, start thinking about what you need to do that day and gives a change of scenery instead of being stuck in the same room(s) all day every day.

An added benefit is that it also means you will already have accomplished top tip 2.

2.   Get dressed for work (in something comfortable)

I’ve sat in my pyjamas for work many a times and by about midday I always start to feel lethargic and unmotivated. Getting up and getting dressed helps to switch to ‘work’ mode. There’s no need to wear a suit but wear something appropriate – to help mentally separate work from not working and for any video calls you might have. But, make sure you are comfortable.

3.   If you don’t have an office – ‘prepare your workspace’

Not everyone has an office at home – I don’t either. For me, I work at the kitchen table. However, when I am working at the table, it doesn’t feel like I’m at ‘home’ and when I’m eating at the table it doesn’t feel like I’m at ‘work’.

For example, for me, to separate the two, I transform the kitchen table into ‘work’. I move the table mats and the vase that normally rests there and swap it for my laptop, whiteboard and tea. This again allows me to switch to ‘work’ mode.

I typically try to avoid the sofa as a workspace, in a previous house I ended up turning it on a couple of times and have sucked hours out of my day from productivity which I had to make up later. There’s time for TV after work. If you can though, I would 100% recommend buying a radio as it helps to recreate that background chatter of the office and has the additional benefit of reducing the feeling of loneliness that can build when working from home alone.

4.   Be consistent with lunch

This one is nice and simple. Try and keep a routine; same start time, same lunch time, same finish time. The primary one is to be consistent with lunch time. It helps keep the brain ticking over, gives you a deadline to work towards and gives a good structure to the day. 

Just like at work, I would say that lunch shouldn’t be eaten at the desk, if you do, it makes you think you should carry on working – even if you have good intentions to take a break. Go sit on the sofa, or if the weather is nice, out in the garden/balcony which gives the brain a welcome break from work.

5.   Clock off at your pre-defined time

Its key to ensure you finish at the time you have set yourself. If you work 8 hours a day and start at 9, make sure you finish at 5. I’ve always found an implicit guilt that I haven’t done enough work throughout the day and need to work a little bit more. Even though I know it’s not true (I’m actually more productive at home) I always hang on a few extra minutes. 

This doesn’t give the brain enough time to rest from day to day or allow you to think about the work tasks that needs your brain whirring – which most will do in their down time. So, shut off the laptop sharpish when work finishes. 

6.   Happy scenery setting

I’m a firm believer that there are four key things that make a workspace a good place to work. 
1.     A Plant
2.     Natural Light – preferably so you can see out of a window
3.     Desk items / wall decorations – somewhere to jot notes, a picture or even a calendar
4.     Access to good tea/coffee

7.   Communication is key

Where the home office differs mainly from a collective office is the ability to talk to your colleagues – and other humans in general. There are a lot of interactions you miss at home; the hubbub of the office, picking up on nuggets of knowledge from background noise, project specific conversations and the water cooler conversations about home and personal life.

As I mentioned before, a radio can help recreate the ‘hubbub’ or office noise, but it’s important to setup conversation channels on your conversation application of choice (e.g. slack) for different purposes and to encourage input to them. These might be:
·      A project channel – say what you’re doing on the project, why you are doing it, what help you might need or any nuggets of information you have discovered
·      General chat – this might be with for your project team, organisation team or even the whole company just to discuss the geographical news, big stories of the day, funny articles or something to inspire
·      Can the slack chat be a meeting? – it’s worth asking if you can make a couple of your one on one conversations a phone call just to get that human verbal interaction. Tone and emotion can be lost online so it’s good to talk over the phone.

8.   Take breaks

Short and simple – take regular breaks. 5 minutes between meetings, ten minutes to make a tea and call a colleague, 5 minutes after finishing a difficult task to unwind. Whatever you do, take regular breaks.

9.   Limbering up

For anyone who has watched Zombieland, the importance of staying limber is already obvious. For everyone else, getting up, stretching, moving about during the day helps reduce the risk of bodily niggles. It’s good for the body, and if it’s good for the body, it’s good for the mind.

A good one to do is to join calls on the phone if you don’t need to see the screen and walk around the house. Not much space? Doing stretches on the hour every hour can be done stood at your desk or even whilst the kettle is boiling.

10.        Task list

For my ‘office’ I have a little whiteboard. It has my long-term goals on it, my side projects (like articles or code), my day to day tasks and things I need to do for the house (although, that does mean that I’m reminded daily that I still haven’t rung a window cleaner). 

These keep my deliverables in focus, allow me to keep refocusing my priorities and means I can quickly answer the ‘what is on your plate now’ when the project manager calls me. This also means I can accept or reject new tasks based on how busy the whiteboard says I am.

This means you aren’t taking too much on, aren’t having to consistently work late and thus allows you to understand what needs to be done to plan your work and home tasks for life balance.

Conclusion


So, these are Aiden’s Top 10 Tips for working from home. I hope it gives you some good ideas for how to stay happy when working at home. Any tips of your own you want to share? Let me know

Tuesday, 26 September 2017

Using twitters user timeline API in Node JS

Having continued to create my dashboard that allows me to access information thats useful to me in a single, easy to access location, I began to think about how I could get my twitter timeline to display on screen (messages that I post and messages people I follow post).

Normally I like to try to just do a curl GET of the webpage I'm looking to use but twitter requires an oauth key to do even a get on your own profile. *sigh*.

Since I've started developing Twitter have changed their entire web based content to a flash new website, a few new APIs and a new "feel".
New Twitter Site

The first thing we need to become a twitter developer is to create an application on https://apps.twitter.com which requires a login and for your account to have a linked mobile number. You'll need to give the application a name and a website address where the application will later ve accessible (this doesn't have to be real and can be changed later).

You will then be given application settings information complete with access token, and security keys, specifically within the "Keys and access tokens" tab.
Application Settings
-----------------------------------------------------
What I specifically wanted to do in my dashboard was display a few of the latest tweets from my home timeline which was surprisingly difficult to figure out as most use cases seem to be around mass production of tweets and making "bots" and a lot of the documentation for node module implementation on node js didn't really describe what was happening.

It's worth noting that when thinking about how I wanted to achieve this I had to consider twitters rate limiting for per access token usage. Which comes to 15 calls per application/access token per 15 minute window, meaning realistically we could make one call a minute.

Initially I just wanted to get set up and the easiest way to do so seemed to be with an existing node module called (wait for it...) twitter npm. https://www.npmjs.com/package/twitter. Following their instructions I took a plain old Node Js application and added the following code using the oauth tokens we get in our application settings:
var Twitter = require('twitter');
var client = new Twitter({
      consumer_key: 'XXX',
      consumer_secret: 'XXX',
      access_token_key: 'XXX',
      access_token_secret: 'XXX'
    });
At this point there are two options for receiving tweets from our timeline and this is to use the Stream API or GET API.

STREAM: Creates a single connection that receives data as it is pushed from twitter, this allows us to process the data in real time and not make continuous calls to twitter.

GET: Consists of standard HTTPS GET calls as and when we want to get information from twitter.

Whilst streaming gives us the most up to date data from twitter, it comes with additional complexity of having an open connection between your server and twitter that must be secured and kept alive which will generally require a bit more thought than an evenings coding. GET on the other hand suits my purpose well and allows me to call and handle data as and when I want.

For fullness I will show how to implement both:
----------------------------------------------------------------------------------------------------------
STREAM User Timeline:
client.stream('user', {track: 'GallagherAiden'}, function(stream) {
      stream.on('data', function(tweet) {
        console.log("got the following twitter message: " + JSON.stringify(tweet));
        var createdTime = tweet.created_at;
        createdTime = createdTime.substring(0,16);
        var tweetStream = createdTime + " " + tweet.user.name + " : " + tweet.text;
      });
      stream.on('error', function(error) {
        if(error){
          log.dashErr(error);
        }
         console.err("Could not get any twitter feeds");
        });
      });
    });
Here we use the twitter npm ".stream" functionality with the client defining that we want a "user"s stream and that that users handle is "GallagherAiden".

We then use "stream.on" to handle the incoming data which I then stringify and make suitable for my needs. i.e. in the following format:
Tue Sep 26 19:04 Gary Lineker - Gorgeous finish from @GarethBale11 gives Real Madrid the lead in Dortmund.
----------------------------------------------------------------------------------------------------------
GET User Timeline:
client.get('statuses/home_timeline', function(error, tweets, response) {
      if(error){
       console.log(error);
      }
var thisTweet = tweets[0];
var createdTime = thisTweet.created_at;
createdTime = createdTime.substring(0,16);
var tweetGet = createdTime + " " + thisTweet.user.name + " - " + thisTweet.text;
console.log(tweetGet);

Here we use 'statuses/home_timeline' which responds either with the tweets, an error or the response. This relates directly to the home timeline of the user who is linked to the application. There is no way to alter this.
The above code would give the same output as the stream in terms of formatting.
----------------------------------------------------------------------------------------------------------

The output of a single tweet is extremely large! 
{
    "created_at": "Mon Sep 25 06:22:53 +0000 2017",
    "id": 912200715552124900,
    "id_str": "912200715552124928",
    "text": "Photographing the Peak District in autumn \u2013 in pictures https://t.co/mHSVxMpNt2",
    "truncated": false,
    "entities": {
      "hashtags": [],
      "symbols": [],
      "user_mentions": [],
      "urls": [
        {
          "url": "https://t.co/mHSVxMpNt2",
          "expanded_url": "https://trib.al/hCIqP6P",
          "display_url": "trib.al/hCIqP6P",
          "indices": [
            56,
            79
          ]
        }
      ]
    },
    "source": "<a href=\"http://www.socialflow.com\" rel=\"nofollow\">SocialFlow</a>",
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "user": {
      "id": 87818409,
      "id_str": "87818409",
      "name": "The Guardian",
      "screen_name": "guardian",
      "location": "London",
      "description": "The need for independent journalism has never been greater. Become a Guardian supporter: https://t.co/EWg9aqA7PQ",
      "url": "https://t.co/c53pnmnuIT",
      "entities": {
        "url": {
          "urls": [
            {
              "url": "https://t.co/c53pnmnuIT",
              "expanded_url": "https://www.theguardian.com",
              "display_url": "theguardian.com",
              "indices": [
                0,
                23
              ]
            }
          ]
        },
        "description": {
          "urls": [
            {
              "url": "https://t.co/EWg9aqA7PQ",
              "expanded_url": "http://gu.com/supporter/twitter",
              "display_url": "gu.com/supporter/twit\u2026",
              "indices": [
                89,
                112
              ]
            }
          ]
        }
      },
      "protected": false,
      "followers_count": 6791634,
      "friends_count": 1113,
      "listed_count": 54290,
      "created_at": "Thu Nov 05 23:49:19 +0000 2009",
      "favourites_count": 152,
      "utc_offset": 3600,
      "time_zone": "London",
      "geo_enabled": false,
      "verified": true,
      "statuses_count": 378671,
      "lang": "en",
      "contributors_enabled": false,
      "is_translator": false,
      "is_translation_enabled": true,
      "profile_background_color": "FFFFFF",
      "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/704160749/ff996aa3bc2009a2f9b97cdd43e8b5b7.png",
      "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/704160749/ff996aa3bc2009a2f9b97cdd43e8b5b7.png",
      "profile_background_tile": false,
      "profile_image_url": "http://pbs.twimg.com/profile_images/877153924637175809/deHwf3Qu_normal.jpg",
      "profile_image_url_https": "https://pbs.twimg.com/profile_images/877153924637175809/deHwf3Qu_normal.jpg",
      "profile_banner_url": "https://pbs.twimg.com/profile_banners/87818409/1491899430",
      "profile_link_color": "005789",
      "profile_sidebar_border_color": "FFFFFF",
      "profile_sidebar_fill_color": "CAE3F3",
      "profile_text_color": "333333",
      "profile_use_background_image": false,
      "has_extended_profile": false,
      "default_profile": false,
      "default_profile_image": false,
      "following": true,
      "follow_request_sent": false,
      "notifications": false,
      "translator_type": "regular"
    },
    "geo": null,
    "coordinates": null,
    "place": null,
    "contributors": null,
    "is_quote_status": false,
    "retweet_count": 1,
    "favorite_count": 3,
    "favorited": false,
    "retweeted": false,
    "possibly_sensitive": false,
    "possibly_sensitive_appealable": false,
    "lang": "en"
  }
 ----------------------------------------------------------------------------------------------------------
I have implemented this in a way that calls from the server using a "setInterval" ever 60 seconds which keeps me within my rate limit:
setInterval(function(){
  getTwitterFeed();
}, 60000);
I then do a web client GET of this data in order to populate my dashboard. I'm currently working with the last five tweets and will probably post how I'm doing that in a later post.

For now. Adieu. I hope you enjoyed reading, feel free to tell me where I'm wrong and how I can improve. you can email me at aiden.g@live.co.uk  or leave me a comment.

Twitter Feed on my dashboard, reloading every sixty seconds