Lazy Loading a Laravel Model relationship through a repository

If your Laravel Model needs access to repository for pulling relationship data, think again.

It’s the wrong way round, don’t do it. Your models need access to data without any N+1 issues from using Lazy load. So if you need to merge some data streams and return a collection, rather than use a repo call to access each stream object; Create a view table which `Union ALL`’s the data various models. Then the model can have lazy load access to all the things you need, and the laravel commands, `->with()` or `->load()` can work without slowing it all down

Paying the Mac “Tax”

Paying the Mac Tax, or “should I buy our developer macs?”.

Often the idea of buying people Apple Mac’s for work seems like a poor business decision. It’s expensive and surely nothing more than “pretty thing”. Doesn’t everything work on Windows anyway right? You can hear it in your mind saying, “how much! Just use a PC, all you want to do is look fancy for an extra £grand”

And that’s fair enough because on the surface the “Mac tax” doesn’t seem worth it for a shiny computer that no one really knows how to use right?

mac-or-pc-

However think of it like. For your accountants, they work best in a full Microsoft Office Excel package or Sage Accounting right? If when they joined you gave them a spreadsheet you once made, a keyboard with Arabic numbers in a different order and an abacus on the side, would you expect them to work at their full capacity? Would you expect Quality output? Would you expect them to enjoy their work? Nope. Nope, you wouldn’t, and it doesn’t make business sense.

..put them on a Windows PC you’re already giving them compatability issues (and devs have enough trouble with that already :P)

I’m afraid, this situation is the same as not buying a Mac for your staff. A lot of the work they’re probably going to be doing for LAMP stack will be Linux based, but to put them on a Windows PC you’re already giving them compatability issues. But if you put them in the same Operating system ecosphere you start to reap actual benefits of coding in the same environment. Mac apps have access to a multitude of our “menu reduced” development solutions. A lot of the apps are exceptionally cheap (like iOS App Store prices), a lot of the apps are more often than not, free to use and open source… built on Linux (not Windows). Also, be honest with yourself, how often you have to start restart your Windows device? Honestly your Mac doesn’t need that, once a month if that.

You are effectively paying to slow your staff down #falseEconomy

I know you may feel more comfortable and productive with Windows, but be brave. You wouldn’t give your new accountant an abacus, don’t give your new devs a Windows PC.

It’s slightly ironic, because Apple are massive Tax Dodgers. But this is more to do with should we get our dev a Mac or Windows?

First thoughts on Amy (x dot aiiiii)

Last week I was part of the lucky few to get onto Amy’s good list. I made it to the automated personal assistant free account and she happily just set about handling her first meeting.

https://x.ai/

So how’d it go? Over-all it was great, and sooooo close…… The on-boarding was real easy. The instructions are REALLY clear and the start of the process was easy. Also, the real test, both participants made it to the meeting.

But right near the event, here’s where it went slightly off the rails. My colleague. helpfully emailed over his phone number, just in-case I got lost or needed a hand. Amy however, she auto-resent out a new invite to everyone updating the meeting from a “Meet in person” to a “Call” eeek.

Screen_Shot_2017-05-08_at_11_57_16_1.png

Because I’m not a total truster of new tech I only let Amy book up a simple meeting with one person who I know, however if this was for a few people and in the last minute it tried to re-arrange something that could have been a problem.

I wonder if Amy could have a “1 hour to meeting *lock*”, where the ususal flurry of emails from anyone but the organiser will ask permission to change the details rather than straight away sending out 10 new invites and changing the scope of the meet. That or improved understanding of people sending their phone number just to be helper.

Now I know it’s naughty only posting stuff when it doesn’t work, but I hope you’ll see from this that I really like x.ai so far, and a tweak would make it less panicy.

Thoughts on Labour in #GE17

Here’s a dump of thoughts on Labour right now. I’ve taken my first step on being active to help out, but thought I’d write up my thoughts quickly on the state of play. More notes for myself than useful

  1. Crap. We didn’t get the Midlands. I helped, and apparently didn’t help enough. We’ve all had a “dry run” and whoops, we didn’t do well. How can we mobilise more Labour peeps to do stuff? The “sign up to a campaign near you” is a bit heavy for some of us. Not everyone feels comfortable in social situations. Not everyone feels prepared to sell Labour on the door steps. Can someone make a list of actions please for Labour introverts… My leafleting was pretty good for that…

2. Labour’s #GE17 policies are being knocked out the park, well done. But there’s a quad-partide of things to balance here.

  1. How will the party action / manage #Brexit? What plan / result do we have?
  2. What awesome GE policies do you have?
  3. Can someone take the micky out of Corbyn leaving please, he’s not. But for charity he needs to pretend to do something so it moves the conversation on.
  4. MONEY. How do we sell trusting Labour with cash cash cash.

4. Using cool tech to grab attention and skip showing what the news channels only want to show.

  • Can we get Corbyn into the hands of the people? Can we attach a BlippAr thing to our leaflets please, so a bit like Leia in StarWars, leaflet openers get to see Corbyn talking and pumped up. Explaining to people why he’s awesome. We skip the news channels then, and get Corbyn into the hands of the people using a fun tech.
  • Can we re-record the same thing to get Corbyn into a 360 video on YT?
  • Can we re-record it and get him in a Google Cardboard thing talking?
  • Can he do a day in the life of Corbyn Instagram Stories thing, I’d love to see people chatting with him and him selling the good stuff

Anyway, it’s just thoughts. Comment and trash away 😀

gitlab CI fail 128 and how to solve it

If you are seeing this, then it means an earlier test has spannered out so bad that it’s now preventing other tests from working.

This quickest way to un-block it is… ssh into the runner and delete the .git/index.lock! Then re-run and it should all clear out.

HTH

fatal: Unable to create '/home/admin/tmp/builds/runner-XXX/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

Build failed with exit status 128]

2 new Laravel things I’m using

Just wanted to share these two simple things I’ve recently found for Laravel 5.3

1. Repository Generator

https://github.com/andersao/l5-repository

This packages just removed about half a day of setting up the backend CRUD per. Model / Entity. A few commands, follow the instructions and then boom, you’ve got a fully functional repository class.

Sure, I’d need to write my on Tests around it performing as “expected”, however, I now have a basic Interface and Abstract which I can use across different Models.

2. Laravel Collective “Custom Components”

https://laravelcollective.com/docs/5.2/html#custom-components

Laravel Collective packages have been staple Laravel components for a while now, however I’ve never quite got to down all the docs (just whizzed on with the bits I need).

I’ve found the Custom Components part method. Before I’ve been creating a new “HTML Components” service class and linking up blade template files with that, however, now I can just keep it within the HTML Facade without any trouble. Much cleaner!

Strengths Finder 2.0 – Gallup

Strengths Finder 2.0 – Gallup

My Personal Strengths @dancourse

> 1 Strategic
> 2 Ideation
> 3 Relator
> 4 Includer
> 5 Significance

The book, Strengths Finder 2.0

We all like a good personality quiz, c’mon you’ve been tempted by a few Quizzes on your Facebook profile and Buzzfeed right? You hope they may reveal some insight and reflect some personal characteristics back at you whilst making you accept you may be more Hufflepuff than Gryffindor.

Well the Strengths Finder 2.0 by Gallup is a professional version of horoscopes / Buzzfeed questionaries for your working life. It offers you insight into your strengths, personality traits and supplies action plans.

The main drive for this “Strengths only approach” is the theory that your Effort multiplied by your Strengths will give you bigger gains than working tirelessly on your weaknesses for minimal gain.

Strengths X Effort = Maximum results

So ignore the weaknesses, multiply your talent and boss it.

I’ve done DISC profiles before with Inge, and I’ve had nearly a similar benefit from this. You get reaffirmation of your values back to you, but with this, it comes with dropping the baggage of your weaknesses and only aiming to take action on your Strengths.

The book, Strengths Finder 2.0