How I almost lost all my source codes.

Now sit down my dear and listen carefully, I’ll tell you a story about how I almost lost all my sources.
A while ago, I decided to give my marvelous Macbook pro mid-2013 an upgrade. I searched online a little bit and at the end I bought an SSD drive, a Corsair Force LE 240GB

“But 240 is not enough!” you might say.  “You’re right”. It’s not enough. 

I was not using the DVD drive at all so after a brief research, I found the right adapter and replaced it with the old 500gb Apple disk , leaving space for my shiny new SSD.

Everything was perfect, El Capitan was lightning fast, everybody was happy. But then came the day that I needed Windows. So Bootcamp joined us and new partitions started to appear.

180GB OSX Extended and 60GB NTFS on the SSD.
450GB OSX Extended and 50GB exFAT on the ol’ Apple disk.

Again, everything was perfect, El Capitan was still lightning fast, Windows 10 was running fine, everybody was happy.

I was running Windows from the SSD and all the programs were installed on the other drive, together with all the source codes. Yes, before you ask, I have a Bitbucket account. Yeah, a Github one too, but Bitbucket gives you private repos for free.

However, after a while, I realized that when Win10 goes to sleep mode some strange misbehavior appears, in the form of weird SMART messages when turning on MacOs.

Long story short, one day I rebooted from Win to MacOs and puff! the partition with all the sources was gone. Disappeared. An empty, dark and cold space.
I almost got an heart attack.

Disk Util, Disk Warrior, mysterious command line tools, I tried everything, nothing worked. After hours of researches and curses, I fired up Windows and did the only thing I had left:

chkdsk e: /f

That saved my day.

Moral of the story? Always backup your source codes, even the most insignificant snippets.

29/09/2016

I married a wonderful woman.

The fact that she’s my high school crush just makes everything more magical.

To be honest, sometimes I feel like I am in a tv show for teens, like Dawson’s Creek or Beverly Hills 90210…

And now I am sitting here, in the house we are still decorating together, while she’s taking care of me ( I got high fever the day after the wedding ) and our pregnant cat meowing at us.

I love you, iLa.

 

Edge Guardian available on Steam!

This time I just want to spread the word about my two good friends Maurizio and Marco from Hypotermic Games, who have finally got the chance to publish their first game on Steam, Edge Guardian !

In a nutshell, it’s an action beat-em-up for the HTC Vive where you’ll find yourself in a cube-based world, forced to punch your way out through thousands of enemies.

I don’t own an HTC Vive, but even if I haven’t had the possibility to try the game, I can easily say that it’s gonna be really addictive. Take a look at the gameplay if you don’t trust me.

Good luck guys!

Recording of Webinar Introduction to React & Typescript available

Last Saturday I had the chance to run my first webinar, thanks to my friend and ex-colleague Lalit Kale and the folks from Indiamentor.

We discussed about React, pros and cons, why should someone use it instead of AngularJS (for example eh, no puns intended) and how to setup the dev environment. Then I showed a small demo of a hello-world-like application made with Typescript using Visual Studio Code.

Later the same day, the Indiamentor team has also uploaded on Youtube the complete recording:

Unfortunately due to some obscure technical reasons, the streaming software decided to stop updating the screenshare after a couple of slides, so in the video you won’t see the second part of the presentation. However, I used Google Presentations to create my deck, so here’s the link 🙂

I had a very good time preparing the slides and talking to the audience, even if I wasn’t actually seeing anyone. I am really starting to think that maybe I could prepare some coding or software architecture lessons and begin running some (online) courses.

Data pagination with NodeJS and React

TL;DR:

here’s the link to the GitHub repo.

Some time ago, in one of my articles I showed a way to paginate your data using WebAPI on the server and AngularJS on client-side. Funnily enough I wrote that post exactly two years ago, I just noticed it while writing this. Well, turns out a lot of people is still searching for it, so now, after two years, I have decided to write another couple of notes but with a different tech stack.

Yes, of course, I could have used the same backend from the old article, but where’s the fun in that?

Enter NodeJS and React!

So, let’s start with the server first. As you can see from the sources, I used Typescript this time. To be honest, I don’t feel “safe” while writing Javascript code, even with lots of unit tests. Having some form of “strongly-typed” language is a little bit of relief, at least for the .NET coder in me.

The architecture is very simple: we have an express application with just one Route ( /api/products/ ) exposing a GET action which reads from a Repository the paged list of available products. Due to the nature of the example, I decided to keep things simple and not add any kind of IoC container, just to avoid to overcomplicate the code.

I have also added two middlewares, one to console.log() all the incoming requests and the other to allow CORS for a specific domain ( eg. our client application ). In case you need to refresh your memory, here’s a nice article about NodeJS middlewares.

The core concept that you can see from the Products API is to return an object that exposes the list of Products along with some infos like the total number of pages, the total Products count and the current page number.

Let’s talk about the client now.

I was definitely not disappointed discovering that the learning curve for React is actually very, very low. Coming from the Angular world, I was expecting more difficulties, but in a matter of hours I have been able to setup my dev env with Typescript ( wanna know how?  ) and start coding my components.

Oh yes, don’t miss my webinar this Saturday! I’ll do a quick introduction about Typescript and React.

Ideally, I could have served the client part directly from the NodeJS application, but I preferred to keep everything separated. Yeah, I had to activate CORS, but it’s not really a big deal. Also, it makes everything more “microservices-oriented“, which is becoming more and more an hype these days. In my mind, for that kind of architecture you should have two servers talking, but bear with me.

In our small demo, the client is using a service to read the products, displays them in a table and renders a pager at the bottom. As you can easily notice, I am using the fetch() polyfill to perform the AJAX request.

Also, to make things more interesting, in this case I am using an IoC container, Inversify, to handle dependencies. However, since Components are instantiated directly by the React engine we cannot use constructor injection but have to revert to property injection….which in this case is handled by the @lazyInject decorator. I’ll write another post about the subject in the upcoming future.

For now, if you enjoy the example, don’t forget to write a comment!

Webinar: introduction to React & Typescript – again!

Due to the huge amount of registrations, me and the folks at Indiamentors have decided to postpone the Introduction to React & Typescript webinar to Saturday September 17th at 6:30 IST .

As I told you before, this webinar is going to be an introduction about React,  how to setup your dev environment and how to write your first piece of React code.
I’ll show you a small demo and at the end we’re going to have a nice Q&A session.

Here’s the agenda:

  • Why React?
  • Let’s get started!
  • React Components
  • Properties and State
  • Webpack
  • Demo

Make sure to register and reserve your seat!

Webinar: Introduction to React and Typescript

Just a quick update: thanks to my good friend Lalit Kale who invited me, I will be running a webinar this Saturday about React and Typescript.

It’s going to be an introduction about how to setup your dev environment and how to write your first piece of React code.  Absolutely no rocket science involved, we’ll discuss about pros and cons, there will be a quick demo and I’m sure it will be fun (at least for me).

It will be at 6:30pm IST . As you may have guessed, most of the audience is in India, also because I’m doing this in partnership with Indiamentor.

Here’s the link for the registration.

Don’t miss it!

© 2016 Davide Guida

Theme by Anders NorenUp ↑