Sunday, 13 July 2025

Updating React Native (my journey)

Upgrading a React Native Project to a newer version

My Journey, in the hopes it will be useful to others. 

So, it turns out that upgrading a react native project is a major task, not the least of which is there the error reporting is literally all over the place.

I have a project currently running in 0.73 and I need to upgrade it to keep Google Playstore happy.

(Min SDK needs to be 35 now).

(Android, Windows environment)

First off all, the upgrade tools have never worked for me. , not even when moving from one version of RN to the next one up.

Also, I did  not write the original version of the project, and I'm not convinced the original author actually understood RN very well.

Patching the project in place never seems to work, so my approach for upgrades is:

Start a new project with the latest RN version:

https://reactnative.dev/docs/getting-started-without-a-framework

(Note: Not using expo, it does not appear suitable for my requirements)

Copy source code from existing project, including assets, but leave android folder alone for the time being.

npx react-native run-android

I took the opportunity to get all dependant packages to the latest version, by just iterating installing each package as it detected it was missing. Sometime iterating is as simple as hitting reload, sometimes you have to "run-android" again. (And sometimes you need to clear all the caches and restart).

Here are some of the packages that needed special handling:

@nozbe/watermelondb

This is an asynchronous wrapper around a native database, typically sqlite. It seems to work tolerably well once you take the time to properly .read the documentation. You do need to install a particular version of babel as watermelondb make extensive use of decorations.
Getting this to run took a while, and the error in question was an unhelpful "n is not a function" message.
After some trial and error, I found that the  @action  decoration was failing during the babel rendering phase. This is because it appears to be obsolete, and by replacing with @reader or @writer  decorations it will now initialise properly. Remember to update your imports.

@nozbe/withobservables

This has moved. Do not install as a separate package as it is now included in @nozbe/watermelondb. Change your imports to:

import { withObservables } from '@nozbe/watermelondb/react';

recompose

The project made considerable use of recompose which is no longer supported, and will crash on startup. The best fix is to not use it at all, but a quick workaround to stop it falling over is:to patch node_modules/recompose/dist/Recompose.cjs.js and replace all references to React.createFactory with a call to:

export function createFactory(type) {
  return React.createElement.bind(null, type);
}

Clearly it is better to rewrite your code to not use recompose, but that is not always straightforward.

react-native-ui-lib

Does not work with version 0.79, and throws an error like: 
Attempt to invoke virtual method 'void com.facebook.react.uimanager.UlManagerModule.onBatchComplete()' on a null object reference
after the keyboard appears in a text input.
Theoretically it can be patched but I just uninstalled the module and removed all references.

debugging

0.79 has changed the debugger and the console output. Hitting "j" in the metro screen should open it, and as a debugger it seems much better at source code handling than prior versions. However, if your project is crashing the debugger can decide it doesn't want to connect.
The trick I found was to close the app on the device, restart, hit reload, and then hit the reconnect button in the debugger window before it has finished loading. That is usually sufficient to get the source maps loaded and to allow you to start putting in breakpoints

missing imports

RN is aggravatingly poor at letting you know that an import has failed to work. For instance:

import {jwt_decode} from 'jwt-decode';
It turns out in the latest version of jwt-decode, the developer changed the import from jwt_decode to jwtDecode. There were no error messages, I just traced it to the point where I was attempting to call jwt_decode(token) and realised it wasn't proceeding past there. So, double check imports, because RN is not very reliable. Sometimes it will tell you there is an issue, sometimes not.

The many ways of restarting 

RN is, lets face it, a Frankenstienian monstrosity. It has a lot of moving parts and many different places you need to look to work out what is going wrong. During development, you need to frequently rebuild.
Here are some of approaches, from simplest to most thorough:
  1. Change your code and save changes: If your project is basically running, RN will pick up any changes and reapply. 
  2. Hit Reload: Hitting "r" on the metro server screen, or the reload button on the error screen on the device should reload any changes.
  3. npx react-native run-android: should rebuild everything, including the underlying android SDK java components. Generally a good idea if you install or uninstall modules, but you can get away with just a reload IF the module is pure javascript/typescript. It's not always easy to tell.
  4. npx react-native start --reset-cache: Do this after the run-android step if something is not working when you think it should be. 
  5. clear caches and reinstall modules: See cleanall.bat below.

cleanall.bat

@echo off
echo Deleting metro cache
rd %localappdata%\Temp\metro-cache /s /q
del %localappdata%\Temp\haste-map*
echo Cleaning build
cd android
call gradlew clean
cd ..
echo Deleting node_modules
rd node_modules /q /s
echo Cleaning npm cache
call npm cache clean --force
echo Installing modules
call npm install --legacy-peer-deps
echo Done

This will clear all the caches and reinstall the modules. This will sometimes sort out strange behaviours.

Reconnecting

Sometimes the device loses track of where the metro server is, and vice-versa.
adb reverse tcp:8081 tcp:8081

should map the ports appropriately. Look up adb parameters to manage more than one device.

Once this is done, close and restart the app on the device for a clean reconnect.

Patching

npm modules get out of date with the current version of RN and need to be tweaked or modified to get your project to run.
Fortunately, there is a way of tweaking a module in your own project without having to go for a full scale fork in git.
patch-package https://www.npmjs.com/package/patch-package creates a patch file from your changes and reapplies the change when you do a fresh install.
Note: It  does require git to be available from the command line to run properly


 





Saturday, 7 June 2025

Myob v14 error 20000 was encountered when opening the m-powered service center

 Putting this here because this error drove me nuts.

Yes, Myob V14 is very old and no longer supported, but IF you get this error it is because the m-powered service center plugin is trying to run a very old version of java runtime. (SE 1.4)

On SOME windows 10 or 11 machines the java runtime will just stop running without giving an error message. I believe this is related to anti virus software, but can't prove it.

TO FIX:

Install the latest Java Runtime for 32 bit computers:

(currently) https://www.java.com/en/download/manual.jsp

In regedit go to:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\MYOB Technology\AU\MSC\2.0

and set JavaHome to point to a more up to date JRE (Java Runtime)

(At time of writing this was  C:\Program Files (x86)\Java\jre1.8.0_451 but this will probably be different as new versions come out. Just find a valid jre* folder in Program Files (x86)\Java)

Then restart Myob.

Hope that's of some help to someone

  

Monday, 4 April 2022

Tips on Charging your EV (Specifically a Nissan Leaf)

 I've been driving my Nissan Leaf for about a month now, and I love it.

  • Better for the environment (yes, absolutely, in spite of some bodgy reports floating around)
  • Much MUCH cheaper than petrol.
  • Truly amazing performance... huge torque, no delay shifting gears... really fun to drive.
  • And MUCH lower maintenance cost ... 
    • no sump means no oil or oil filters, 
    • no radiator, 
    • no transmission, 
    • most braking is done electrically so you brake pads hardly get used.
    • Just tyres and windscreen washing fluid. 
But, yes, range. The current generation of EV does not go as far on a refill as an ICE (Internal Combustion Engine) vehicle. 
For city driving (at which EVs do REALLY well and are really efficient, if only because you aren't burning fuel sitting in traffic) you just plug into a normal wall socket overnight.
For longer trips, there are charging stations.... in Australia there's a decent enough network already if you stick to the coast, and more coming every day.

When you use a fast charger, you need to look at the plug type. My 2018 Leaf has a CHAdeMO fand a type 2. The type 2 (sometimes referred to as a J1772 or Mennekes) is generally used for charging at home or from smaller charging stations (ie, Ikea).
The CHAdeMO is used for fast charging.
The key (apart from plug type) is to look at charging rates.

EV batteries are surprisingly efficient. So, if a charger says it will do 50KW (which is the max my leaf can take) it will put 50kwh worth of charge into you battery per hour, at least up to about 80% charge ... you get rapidly diminishing returns after 80%, but on my 40kwh Leaf I only need about 20-30 mins for a useful top-up. (I have yet to finish my coffee before wanting to disconnect).

Common sizes are 50, 25, 22, 7. A 7kwh charger is nice for a top up, and will get you perhaps 43km range per hour, but while that is better than nothing, I would not rely on it for long trips.

General wisdom to top up to 80% unless you know you've got a lot of travelling to do. If you really want to charge to 100%, you are better off trickle charging at home.

As a rough rule of thumb, 1kwh = 6km, depending on driving conditions.

Actually Charging

Plugging is not complicated, but there are a few traps for young players. Instructions below are for my Leaf, I can't speak to others.
  • Turn car OFF before attempting to charge (my Leaf won't even let you pop the charge port if the car is still on)
  • Make sure you haven't left any timers set, OR you hit the timer override button.
  •  You can set your Type  2 port to unlocked, locked, or auto, from the car. 
    • IMPORTANT: The Type 2 locking is controlled entirely from the car. The CHAdeMO is NOT. It is not unheard of for charging plugs to get stuck, and for the charging station support to have to cycle the charger to get it to unlock. MAKE SURE THEY UNDERSTAND WHAT PLUG YOU ARE USING)
  • The CHAdeMO port will lock once it has started charging, and will unlock when done.
    • All the CHAdeMO plugs I have used have a red light at the base of the handle to tell you it is charging. That has to be off before you try to unplug.
    • On all versions of that plug I have used, you press a thumb button to get it to release.
    • How you start and stop the charge session depends on the provider. NRMA stations just need you to press the start and stop button. All others you have to stuff about with phone apps.
    • Make sure the red light is off before attempting to unplug... while not common, I've had the experience of the thumb-switch sticking. In the end, NRMA knew of the problem and a couple of sharp taps freed it up, but it took a while to resolve
Handy hint: you can sit at a fast charger and run the air conditioner while charging (once you've got the session started, anyway). At full whack it will consume about 3KW, so not worth doing on a hot day on a 7kw charger, but quite a pleasant option on larger ones.

Australia and EVs

We have 240v electricity, which means plugging in at home is entirely viable. Places with 120v generally need to break down and install special charging stations, or at least a special plug.
In theory, batteries perform less well in cold temperatures, but the cold temps they are talking about are significantly below freezing. There aren't a lot of places in Australia that happens on a regular basis.
The biggest issues I have noticed (apart from a noticeable range hit by using the air conditioner on hot days) is that long climbs at highway speeds can have a significant impact on range. For example, on a recent trip from Sydney to Canberra, the estimated range was tracking pretty closely to actual range covered (and in fact, slightly better) until we got to the hills approaching Mittagong, which it started dropping sharply. So perhaps lost 20km from the estimated total range in the last half hour of the trip. Still had plenty left when I got to my planned charging stop.

Charging Networks

There are a number of Charging networks popping up in Australia. Here are the ones I've used:
  • NRMA - has set up a network of 50x 50kw charges around NSW. These are currently free to use and by far the easiest to operate. (Eventually they will only be free for NRMA members... this I feel is still good value)
  • Chargefox - good sized network. with a fairly good app and decent enough price (typically 40c/kwh, with a 20%  discount for NRMA members). Support did let me down badly the one time I had issues, though.
  • Evie - does not offer the same NRMA discount, otherwise the one I used was also 40c/kwh. App is not as nice as the Chargefox one, but it worked OK.
  • Jolt - some 25kw chargers scattered around Sydney. Setting up the app was a bit of a pain, and then I had to ring support. Having said that, support was helpful and got me going. Cost is also 40c/kwh, but you get the first 7kwh of the day for free. I got a free charge anyway because of having to ring support.
  • EO: generally smaller chargers. They manage Ikea chargers. I found the app to be fiddly, but at least the Ikea chargers were free. I was very much just trying them out, so really did not do serious charging from them.


Sunday, 11 April 2021

Sam's Song: The Return

When did singing "Sam's Song" at the closing ceremonies become a tradition?

From Val Housden:

I remember "Sam's Song" being sung at Decadence, the 10th UK filkcon, in 1998 during the closing ceremony.
I don't remember  it being sung before that year  during the closing ceremony, though Zanda did sing it at VIbraphone, the 6th filkcon in 1994, when the filk awards (as the Sams were then known) and "Sam's Song" won the equivalent of what is now known as Filk Gold.
But I think that was before the closing ceremony. I'm pretty certain the singing of "Sam's Song" became tradition after Decadence. I think Van Der Filk in 2010 was the filkcon where we didn't sing "Sam's Song", and I was told at the time that that was at the request of the UK GoH.
Since then I think "Sam's Song" has been sung more times than not at our closing ceremonies, but honestly after all this time, they all merge together in my failing memory.
"Sam's Song" had been sung at the UK filkcons before 1994, I remember Pat Silver singing it at Con2bile in 1990, and Zanda must have sung it sometime when they were GoH at Treble in 1991.

Cliff's Notes #3 

From Sam Armitage:

Part 3 while I remember

The last "verse" was partly mine, and is closer to my own experiences.
The Library was where Zan and I would have liked to have been; with the time to write, and the the reference materials we needed.  h'Ellen and Jet were my main two characters I wrote about at the time, the one a Space princess (based closely on someone I knew (and still know)), and Jet being a spaceship racing pilot drawn, as I said, from the Wings song.

Kirk is James T, the Seven were Blakes' Seven (BBC SF series) -- Zan had pastiched them in stories, and was working the Nyrond-verse into it since ways.  The Nyronds -- they are conmen, so they ought never to be lacking readies.  I had friends, I had foes -- I wanted to be able to meet with them in neutral, as it were.

The Hill is in the Lake District and the image was of going there to die (or to translate) and stepping from the top into thin air that would then be firm air and a foothold into my personal world.  And Zander, i think  had a similar dream, to go and be with his creations.  Which God Willing he now is.

The oldest book was a dream of being published, but it also reflects that fact that early influences last a LONG time and dig in deeply; my bed was where I slept and dreamed.  The last bit is Zander telling me that however alienated I felt I was in fact within a supportive community of fen, who would "see me through".

And Hunter was and is still Hunter and he has come home from the hill, but he still remembers what it is like walking the high moors, and tracing the stream in the valley.

Friday, 2 April 2021

Still More on Sam's Song

Cliff's Notes #2

 From Sam Armitage:

The photon torpedo I first heard of (again) from Chris Chivers.  It is lethally strong, and I have distinct recall of a young (well, she was then) lady crawling up to me at a dead-dog party announcing she'd had seven and where was her 8th?

But having a litre would probably kill your ,liver in about 5 minutes.,

And Hunter (it's capitalised) was my fictional identity at the time beyond Soren

Verse two:  if you don't knoiw what a Nyrond is, read Zander's oeuvre (it's available on Lulu for reasonable prices); the Nyrond stuff is credited as co-authored with me;

The warpdrive, Nyrond smallships don't use, but it made the song explicable to Star Trek fen (which a lot of the London Mob were)

The Vigilante were the Intergalactic Police of the Sagittarian Era, and used to run in Nyronds on principle.

And, at the time, I was a barrister, and my life was going away from me.

From Philip Alcott:

I think the tradition (of playing the song at the closing ceremonies) started at VIbraphone (1994) when - I need to check - I think it won a UK filk award. Before they were christened "Sams" even.  Which years I couldn't say after that. Has it stopped?  It's up to each year's committee.

According to filk.co.uk, Sam's Song did indeed win the "All time great" award at VIbraphone 1994.

The UK Filk Awards were called "The Sams", after Sam Armitage, the eponymous "Sam" of Sam's Song, from Didgeri-Douze 2000.

Also according to filk.co.uk, Sam's Song was included in "On Filkley Moor" Beccon Publications 1988.


 

Wednesday, 31 March 2021

More on Sam's Song


More on Sam's Song

I've since had a chance to talk to Sam Armitage (Soren). so I have this further snippet to add:
It was written at the start of the 80s, as a result of Zan and I gaining (probably unauthorised) access to a hostel bar, where we could drink Silver Dragons, cider and trop, and where there was a piano on which he could compose (his digs at the time having little musical apart from something like a Pekinese, though later it was to have an infestation of beetles.
(The Pekinese didn't have a direct influence on the beetles -- they came from an inadequately-sterilised convention tribble, and a pack of biscuits. )
And it was about who we were at the time, and how Zan saw me and my life.

Cliffs Notes

Harry's bar was indeed "nicked" from Chris Chivers, who was filking before it was called filking, and created it in Lunaville.


The "evening had just begun", probably because the "hours" would have been Zan's in the bookshop and mine in Chambers.


McIvor was a character of mine; he "nearly fell into the sun" because (stay with me here) McIvor (a journalist) was associated with Jet O'Conor (a space-pilot char of mine); her name came from the Wings song, which was on the album Band on the Run, in which there is reference to the Band nearly falling into the Sun.


The droid and the wookie are (probably) just from Star Wars (which did have a bar in it)

And the 49 bus ran (in those days) from Shepherd's Bush, where I lived, in the Hovel of cursed memory, to Battersea from where I could get another bus (the number of which now escapes me) to Streatham where Zander lived.


Tuesday, 30 March 2021

Sam's Song

Putting this here since I've already expended some effort:

When I was tapped to organize a filk session at a Canberra convention in 2003(?), I reached out to see what new songs were current and worth learning.
The song that immediately popped up was "Sam's Song", by Zanda Myrande and Soren Nyrond.
Sams's Song is not about Sam Gamgee, as I first suspected, but is something of an ode to fandom in general, and missing your friends. Or possible just being happier in a book than in real life, it can be read in a number of ways.

The earliest recording I can find of this song dates from 1993... I've not yet been able to confirm this was when it was written. It was written by Zander Nyrond and Soren Nyrond, but according to the eponymous Sam (Soren is nom-de-plume of Sam Armitage) he was the inspiration rather than a direct contributor.

The trail gets complicated. Zander Nyrond aka Jonathon Waite aka Andrew Lyng aka Zanda Myrande. Zanda transitioned in 2018, so that is how I will refer to her from here on in. Zanda died in 2019, so I never got to ask her about this song. Under various of her names, she wrote books and apparently quite a lot of filk songs over the years.

Sam's Song was more or less the anthem for UK fandom. For many years it was sung at the closing ceremony of every UK SF convention. The UK filker awards are CALLED the Sams in Soren's honour. But the curse of early internet rot appears to have struck, and beyond some random paragraphs here and there's precious little to be found about the history of this apparently quite important song.

Zanda's website is still here, but it has not been updated for a long time and the formatting struggles with modern browsers/screen resolutions, but there's some interesting stuff there.

Absolutely everything I know about Soren Nyrond/Sam Armitage is here:
"Sam Armitage is the creator of the Jet O'Connor mythos. His short story collection Jet, which is also a roman a clef based on London media fandom of its day, was published in 1979 by Barbara Kitson. The zine is now available by download from the British Library. Sam is also Soren Nyrond, co-creator with Jonathan Waite of the Nyrond narrative cosmos and inspiration, if not co-author, of the anthemic filk 'Sam's Song.'

Apparently, Zanda wrote Sam's Song for Soren when he was going through a difficult time. 

Lyrics

Well, it's after hours down in Harry's Bar, and the evening has just begun,
And MacIvor is telling all over again how he nearly fell into the sun,
And the droid in the corner is getting well oiled, and the Wookiee has let down his hair,
And I'm sitting alone on a 49 bus and I'm wishing that I was there...

I'll have one more photon torpedo, Harry, and make it a litre or more,
And if I should happen to fall off my seat, just let me slip to the floor,
'Cause it took me too many years to come, but I'm where I wanted to be;
Home is the Hunter, home from the hill and the sailor, home from the sea...

And it's outward bound on a Nyrond ship, and the warpdrive is coming apart,
And that damn Vigilante is back on our tail, and we've only got five minutes start,
And the planets around here all have us on file and they'll grab us as soon as we land,
And I'm sitting alone at a barrister's desk and I'm watching life slip through my hand...

I'll have one more try at the warpdrive, Zander, and then we'll work out what to say,
And although my life is in deadly danger, I feel that I've lived for this day,
'Cause it took me too many years to come, but I'm where I wanted to be;
Home is the Hunter, home from the hill and the sailor, home from the sea...

(Instrumental break)

Well, it's peaceful down here in the Library, and I'm reading of h'Ellen and Jet,
And Kirk and the Seven are all on their way, and a Nyrond is never in debt,
And my friends are around me and so are my foes, but no-one's for fighting today,
And I'm standing alone on the top of this hill, and it's only inches away...
(I rather like it ending just there, but we did in fact finish it off.)

I'll read one more page of my oldest book, the one that I know and love best,
Then I'm for my bed and my mind for its roaming while everything's lying at rest,
'Cause it took me too many years to come, but I'm where I wanted to be;
Home is the Hunter, home from the hill and the sailor, home from the sea...
Yes, it took me too many years to know that wherever we happen to be
Is home for this Hunter, home from the hill and the sailor's home from the sea...
Home from the sea.

Meaning

From an email from Zanda:
"Harry's Bar derives from an old protofilksong by Chris Chivers, concerning your archetypal spacer's bar in Lunaville. 
MacIver was one of Soren's story characters, a journalist who once (wait for it) nearly fell into the sun. 
A photon torpedo is a moderately lethal drink made with rum, lime juice and advocaat. It doesn't usually come in litres. And the 49 bus used to run from the centre of London out to Shepherd's Bush where Soren used to live.
"Nyronds are immortal space-faring snake oil salesmen whose technology tends to go phut on them at moments of dramatic tension. Vigilantes pursue Nyronds, but have not yet managed to catch one. 
A barrister is the kind of British lawyer who stands up in court (see Rumpole), and Soren used to be one. h'Ellen Mac and Jet O'Conor are story characters of Soren's, and the Library is a safe haven of our own invention."

Recordings

Zanda Myrande, Bandcamp - apparently all of Zanda's discography is available there, but there is some doubt her widow has access to any of the funds from there.

Kathy Mar, from Woad Warrior

And from the Filky Way Youtube Channel

Which is not a lot for a song that's been around for as long as this one has. 


Zanda was part of the band Cosmic Trifle

Updating React Native (my journey)

Upgrading a React Native Project to a newer version My Journey, in the hopes it will be useful to others.  So, it turns out that upgrading a...