James Crisp

Software dev, tech, mind hacks and the occasional personal bit

Talk: Credit cards / Gateways

Tune in to the next Sydney ALT.NET meetup on Tuesday (30 Dec)! I’ll be giving a talk from around 6pm.

Accept credit cards: Gateways, architectures, code, and… money!

Have you been thinking to accept credit card payments for your new clever MVP, startup, or maybe even in your day job? Well, you’re in luck! James will give you a primer on how to do it simply and securely, based on his recent journey to the Gateway jungle.

Please RSVP on meetup and join the Twitch stream for some fun!

“Authentic Gravitas” by Rebecca Newton

I read this book a while back and have been meaning to write about it. I found it contained some interesting points, especially on being intentional (and comparing your actual impact with what you were aiming for) and working appropriately with different communication styles/personalities.

Here’s my favourite parts:

  • “The reality is, we all have a gap between our intention, our action, and our actual impact. To have gravitas, be clear about your convictions (what really matters in a given situation), be clear about your intention (how you want to show up and impact the situation and the people in it), be disciplined in checking that your impact is lining up with your intention (through your own observations and seeking feedback), and be committed to continually adapting your style.”
  • “On being intentional, ask yourself, What footprint do I want to leave very day? How would I want other people to describe me?
  • “People who are regarded as having high levels of authentic gravitas may look confident, but actually they are choose to be courageous.” “They feel fear and do it anyway. They choose courage.”
  • Ask more open questions in meetings to find out what is actually driving the other person’s thinking and decision-making. Eg, “What are you excited about right now”, “What’s your biggest concern?”, “What matters most to you at the moment?”, “How do you feel about what’s happening?”, “What is the main thing stopping you from making progress?”, “What are the forces at play in this issue?”.
  • If people ask for help, give them your full attention or ask them to come back later. Eg, “Yes, I’ve got 10 minutes – will that work?” “Or we can have a longer chat later today at 2pm?”
  • Script the opening of a talk carefully to engage and hold the room – verbally and nonverbally – from the outset before rushing into the details. Eg, open with “Thank you Angela. [pause] Good morning, all. It’s great to have you with us today. It’s a critical time in our industry. We’re currently facing uncertain market conditions, unexpected legislative changes and rapid technological development. Navigating this environment seems more challenging than ever. I’d like to share with you…”. Script the finish also. The middle can be looser. Telling personal stories helps connect with the audience.
  • IMPACT preparation for a meeting: What do you believe about this situation/possibility? What do you want them (the people you engage with) to think, feel and potentially act differently as a result of this encounter with you? What is motivating them (acquire, bond, comprehend, or defend)? What is their perception of this situation and of you right now (and what do you want it to be)? If nothing else, what would you want them to remember and pass on (max 3)? How should you open and close? What stories would be relevant and support your message? And finally, think about your technique.
  • Avoid the “face freeze”: Put your hands into fists and roll your knuckles in circles around and around in your cheeks. It loosens your face and you become more conscious of your facial muscles, enabling you to feel the tension in them and make the choice to relax them.
  • Even if people don’t give you positive non-verbal/verbal affirmation, “Choose to give everyone equal energy and attention.. [remember they have a gap between intention and impact too]”. With big audience, look at a back corner of the room and slowly use your eyes to follow an “S” pattern down through the group to the front row. After a minute, go back up to the opposite corner and find down again following an inverted “S”. In a small meeting, be mindful from the outset of your decision to give everyone eye contact.
  • Opportunity mind-set rather than a threat mind-set. You’re most likely nervous because this situation matters. And it matters because it’s an opportunity that could lead to positive outcomes. Don’t get anxious, get excited!
  • “When working with people who tend to be optimistic and big-picture oriented, it’s important to respond with energy if they are sharing an idea. Explain why you like the ideas (be authentic and only communicate what you genuinely feel positively about), or comment on how much work they’ve clearly put into it, or the interesting nature of the project or topic. And share that with energy.. not over the top.. but at least some energy.” Immediately critiquing a new idea will deflate them and close their ears. Instead, after initial positively, ask something like “Would it help if I went through the technical details and came up with a list of things for us to look at? I want to make sure it’s all smooth when you take it to market.”
  • Prepare a short causal response to the “How are you?” type question in case of casual coffee machine conversations at work. Eg, “Oh, hi Chip. I’m well thanks. We’re busy with a new project around sustainability. We think this can really drive some positive change. We’re seeing a lot of interest from clients. How are things with you?”. Make brief encounters matter.
  • Remember the wide variety of influencing techniques available: rational persuasion, legitimating (because X says so), favours and exchange (Can I ask you a favour?), inspirational appeals (emotions and values), ingratiation (I don’t how to do it!! reply: I know you can. You you’ll be good at this because [reasons why]) and consulting (ask their help/feedback to increase buy-in).

Lockdown with Kids – Take 2

It’s coming up to the second month of lockdown in Sydney with my energetic primary school age sons and lovely (and patient) wife. Since this is the second time around, I thought I’d share some ideas which we have been using which have worked for us. Your mileage my vary!

First of all, let us reframe the lockdown as an epic cruise through space-time, towards normal life.

With this framing in mind, think about the entertainments and events and plan for a long voyage on a ship, to stave off boredom and keep the crew happy and productive.

  • Decide and family routine together and publish it on the fridge. Stick to it to give structure to the day. Make sure it includes recess and lunch similar to school – these are also when the family gets together from their separate activities during the work/school day.
  • Have a guessing competition on the number of covid cases for the day (new cases & number in community) and a prize draw at recess (eg, a chocolate for the winner). Everyone records their guess at breakfast.
  • Make use of every room in the house, balconies, porches, gardens etc to give more opportunity for privacy and space.
  • Celebrate the end of the work/school week by ordering delivery food for dinner on Friday. This delineates the week from the weekend, and gives parents a break from cooking and everyone something to look forward to.
  • Have international food nights once a week: choose a few countries for the first few, then when you run out, play pin the tail on the country with a map! Research the food, order appropriate ingredients and cook. Dress up if you feel like it. Make it a highlight of the week.
  • Family kareoke nights if that’s your thing. I think dancing could work too though we haven’t tried it yet.
  • Get kids involved in cooking whenever you can, they love it and learn too.
  • Get lots of outdoor activity gear such as basket ball hoops, soccer balls, pull up bars, bikes, kites, etc to provide variety.
  • Exercise every day to get out the the house (and usual exercise benefits). Choose a mix of quiet activity by yourself to get some space (eg, running) and with kids (eg, bicycling) and go with what you feel like on the day. Calisthenics is good in a park where kids can play while you work out.
  • Make computer game playing time for kids a currency that they earn. For example, our kids earn:
    • 50% of the time they spend on extra study outside of school for game playing.
    • I review their school work at the end of the day and award game time based on amount and quality of work they have done during the day (in range 15 min – 1 hour).
    • Chores like taking out the garbage/compost earn 5 minutes.
    • Repeatedly doing something we’ve asked them not to do (or not doing something they are meant to do) leads to a fine of 1 or 5 minutes of game time.
    • Ask kids to do a written accounting of their time before they use their game time, to check the amount of time and to give them practice presenting tabular data and doing calculations.
  • Remember that work done at home by the kids for home schooling does not need to be perfect and fixed by parents before submission. The teacher can correct kids’ work during the day. Sure, there are times when the boys need help, and that is OK too, but you don’t need to sit with them every minute. Home schooling does give you the possibility of getting more involved yourself, but I like to have the boys work as independently as possible during the day and go over things with them after school “finishes”. This also allows me to get more of my work done during the day.
  • For school work, if possible, ensure each child has their own device with a camera for submitting hand-written work, to avoid having lots of logging in and out to switch accounts, and fights over the device.
  • Make an effort to stay in touch with friends via video calls (at least one call a week).
  • Get good noise cancellation headphones for when you are working. For me this is vital.

I hope you find some of these ideas useful as we cruise on towards freedom.

“The Visual MBA” by Jason Barron

I’ve been wondering for a while what you learn from a MBA. When I came across “The Visual MBA” by Jason Barron, promising “A quick guide to everything you’ll learn in two years of Business School”, I thought it’d be worth the time to have a read and find out.

The book is as promised, visual. On each topic it is about 50/50 writing and relevant diagram. It was based on the author’s notes doing his MBA. The book is generally easy to understand – there’s a few places where I wanted a bit more depth to understand the message, but in most places it was sufficient to communicate the concept.

Here are the most memorable points from the book for me:

  • The value of money now vs. the value of the promise/prediction of money in the future, and a way to calculate it using the Present Value formula. It can be used to work out how much money you would need now to equal an amount in the future, or to take the risk into account as a discounting rate on a future prediction.
  • Who are your customers and who are not? You can’t build a product to suit everyone as it will suit nobody well. Instead segment and target the most valuable potential customers and build a relevant, exception product for them.
  • Laddering – what sells is not the product features, it is the personal value. “Ask your biggest fans what they like (a particular feature), why they like it (product benefit), why that matters (personal benefit) and how that connects to a high level personal value”. Eg, fast car – feature: speed, product benefit: get places quickly, personal benefit: makes me feel young, personal value: youthfulness. “Position your marketing materials through the love group’s eyes while targeting the swing group to gain new customers.. Don’t waste time on the haters.” Sale is usually based on emotion evoked (eg, makes me feel cool, youthful etc) rather than the features.
  • When branding, think about what we do (eg, “we bring kids happiness”), then how we do it (“by making toys”) and then why we do it (“because children are our future and each one deserves to smile in a darkening world”). “People care about the WHY we do what we do… that becomes our brand mantra…” and should be used to guide decisions.
  • For people in general, “logic is like a man riding an elephant (emotion). Guess who decides where to go?”. Appeal to peoples’ emotions.
  • “How can we get young people signing up… why? .. because our revenue is going down.. OK maybe the right question should be why is our revenue going down?”. Make an issue tree (like a decision tree on why the problem is happening) and test each branch to see if it is the cause.
  • Advice from Churchill: “Success is going from failure to failure without loss of enthusiasm”! Ponder then act decisively.

“Selling the Invisible” by Harry Beckwith

Billed as “a field guide to modern marketing”, I found this book a highly interesting read, especially the second half. It is a guide to marketing services (“the invisible”). Some of the stand outs points for me were:

  • “Forget looking like the superior choice. Make yourself an excellent choice. Then eliminate anything that might make you a bad choice.” Ie, address any risks in peoples’ minds, rather than trying to show you are better than all other options. It is very hard to tell if a service was the best, but it is easy to tell if it was bad. Eliminate the fear.
  • “Setting your price is like setting a screw. A little resistance is a good sign.” Beckwith argues that 10% of people will always complain about the price. Resistance in about 10% more (total 20%) is about right. “When it [resistance] starts exceeding 25%, scale back.”
  • Often you are competing against apathy (doing nothing) or the person themselves doing the work.. not another firm.
  • “Don’t assume that logical pricing is smart pricing. Maybe your price, which makes you like like a good value, actually makes you look second-rate”.
  • “The premium service and the low-cost provider occupy nice niches all by themselves. If you are priced in between, however, you are competing with almost everyone”.
  • “Don’t start by positioning your service. Instead leverage the position you have.” eg, Avis ads repeated for years “We’re Number Two. We try harder.”
  • “In positioning, don’t try to hide your small size. Make it work by stressing its advantages, such as responsiveness and individual attention.”
  • “If you’re selling a service, you’re selling a relationship.. before you try to satisfy ‘the client’, understand and satisfy the person.. In large part, service marketing is a popularity content.. be personable.”
  • “A brand is more than a symbol. In the public’s eye, a brand is a warranty. It is a promise that the service carrying that brand will live up to its name, and perform.. a service is a promise, and building a brand builds your promise.. Invest in and religiously preach integrity. It is the heart of your brand… Brands are decision-making shortcuts [for busy people].. Make selling easier, faster and cheaper. Build a brand… A brand is money.”
  • “Selling a service involved personal risks [rejection etc].. risk yourself.”
  • “Saying many things usually communicates nothing.. Meet your market’s very first need: Give it one good reason… After you say one thing, repeat it again and again. Watch and perfect the visual clues you send.. repeat yourself visually, too.. Give your marketing a human face.”
  • Be genuine and honest, show your passion.
  • “Take advantage of the Recency Effect. Follow up brilliantly.”
  • “Execute passionately. Marginal tactics executed passionately almost always will outperform brilliant tactics executed marginally.”
  • “Above all, sell hope.”
  • “Your parents were right. Say thank you. Often.”

Rails ActiveModel, with nested objects and validation

So maybe you have a model that is not backed by a database table? ActiveModel is meant to cover this scenario and give you the usual ActiveRecord goodness and validation.

But the story gets much harder if you want to have nested objects. In a normal ActiveRecord::Base backed model, you can simply say:

accepts_nested_attributes_for :order_lines

and Rails will manage form submitted nested parameters for you.

Life is not so simple, or documented with nested objects on ActiveModel. accepts_nested_attributes_for is not available. But some of the underpinnings are.

So enough talk, how do you make it work? I’ll show you with an Order / OrderLines example.

Note the very special name: order_lines_attributes=. This hooks into the Rails handling of nested form parameters. Also the valid? method propagates the child errors up to the parent object, so that they show up at the top of the form.

Now how do you do the nested form? It’s similar to normal database backed nested records.

Hope this helps, it is not documented anywhere I could find, and worked out mainly though reading the Rails source.

Rails: Removing error divs around labels

Rails makes it very easy to style fields with errors on your form. Unfortunately, the same error DIV with class ‘.field_with_errors’ is applied around labels, as well as inputs/checkboxes/selects. This tends to mess up the layout and double up on error display. To fix this, you can configure the field_error_proc in your application.rb to ignore labels. The code below calls the original error decoration proc for all types of tags except for labels.

The Lane Cove River

The Lane Cove River is the closest major waterway to my place. Over several trips, I have run and kayaked from the source to its mouth, where it joins the Parramatta River/Sydney Harbour.

The Lane Cove River has many beautiful spots. It is divided in two by a weir in the Lane Cove National Park. Above the weir is fresh, below is tidal and briny.

Fifty years ago, it was a much healthier river, which had beautiful swimming spots and even an amusement park called Fairyland above the weir.

Water begins to trickle from among the rocks near Thornleigh
By Wahroonga it is the size of a creek
It grows with multiple little creeks joining, until it becomes passable by kayak under the Ryde Rd Bridge
A pretty waterhole
The remains of Fairyland in Lane Cove National Park (an amusement park until the late 1960s)
The weir
Chatswood West
Near Lane Cove River Kayakers Club
From Riverview, you can just see the Harbour Bridge
Nice houses along the river near Woolwich
The mouth of the Lane Cover River where it joins the Parramatta River/harbour

As well as the beautiful spots, there is a lot of pollution, especially above the weir. Anything in the water above the weir like sticks, trunks or rubbish gets coated with a layer of brown algae.

Orange gunk going into the river from a little side creek
Junk floating in the water
Opaque and milky water above the weir
Lots of invasive weeds along the shoreline and rubbish caught in overhanging trees

There is a multi-council initiative to make the Parramatta River swimmable again by 2025. As someone who sails on the Parramatta River, I love this.

Unfortunately, the Lane Cover River does not have as much support, but there are some groups which are working hard to improve it. Ones I have found so far are:

  • Lane Cove Rivercare – kayakers who meet every 2 months to remove garbage from the river. I joined in early August and we removed piles of rubbish, especially towards the weir.
  • Stringybark Creek Streamwatch – volunteers who do sampling on a creek that is a tributary of the river.
  • Sydney Water faults ([email protected]) – if you smell or spot any leaking sewer pipes or hatches, you can report the location (GPS/Google maps) and they will send a crew out to repair it. I’ve reported in one spot that is always smelly on the edge of the river, and you can see traces of overflow near the hatch. A crew went out to investigate it quite quickly and gave me a call to ask for details. They checked for blockages but couldn’t do anything about overflows. When there is too much water going into the sewage system due to rain, it overflows at low points, near the river. This leads to raw sewage going into the river. To fix it would require serious & expensive work to decrease rainwater getting in or handling overflows better. I’m not sure how to lobby further for this to happen, but please comment if you have any ideas.

Lightning Talks at Sydney ALT.NET (30 June)

At next Sydney ALT.NET meetup (30 June), I’ll be giving a couple of short talks from around 7pm:

Building a Rust microservice, dockerising and deploying on Google Kubernetes Engine
Walk through of a little side project, showing you how this tech works and fits together.

Terminal COVID-19 tracker in your postcode
Brought to you in one line, with a little investigation in the Chrome inspector, and some simple terminal commands piped together.

Feel free to tune in on the Twitch stream for some fun!


Now available to watch on YouTube.
You can check out the repo for Rust & k8 on Github.
And the one liner for COVID-19 tracking is:

curl https://nswdac-covid-19-postcode-heatmap.azurewebsites.net/datafiles/data_Cases2.json |ruby -e 'puts STDIN.gets.gsub("},", "},\n")' | grep <your postcode>

Importing Excel 365 CSVs with Ruby on OSX

Up until 2016, Excel for the Mac provided a handy CSV export format called “Windows CSV”, which used iso-8859-1/Windows-1252 encoding. It was reliable, handled simple extended characters like degree signs, and could be read in Ruby with code like:

CSV.foreach(file, encoding:'iso-8859-1', headers:true, skip_blanks:true) do |row|
    ....
end

Unfortunately, support for this format was dropped in Excel 365. Many RiskAssess data files were in this format, as the earlier versions of Excel did not properly export to valid UTF-8.

Excel 365 now has a Save As option of “CSV UTF-8 (Comma-delimited)”. This is UTF-8.. with a few twists! Sometimes it includes a UTF-8 format first character, and sometimes not. Sometimes it includes the UTF-8 format first character plus a BOM (byte order mark), another invisible character. According to Wikipedia “The Unicode Standard permits the BOM in UTF-8 but does not require or recommend its use”. This makes it trickier to import. Code like this:

CSV.foreach(file, encoding:'UTF-8', headers:true, skip_blanks:true) do |row|
    ....
end

will handle the first 2 possibilities, but not the BOM. The BOM ends up as an invisible character in the data, causing trouble. It is possible to import with encoding ‘bom|utf-8’ which will handle this case. Another option is to run data through the dos2unix command (easily installed with brew) which does general tidying including removing the unnecessary BOM.

Also to watch out for, “Windows CSV” format previously used “\r” to denote new lines inside of cells. The new UTF-8 export uses “\n” for new lines inside of cells.

Page 1 of 19

Powered by WordPress & Theme by Anders Norén