Monday, April 11, 2022

Curry Day at the Exit!

We're doing a Curry Day at the Exit Inn, 2a Avenida Sur #22, Antigua Guatemala on Wednesday the 20th of April. A complete curry meal made up of chicken madras, rice, saag aloo, raita and naan bread. We'll also do a vegetarian option with chickpea madras in place of the chicken, or fully vegan which as well has kachumba and a chapati in place of the raita and naan. The whole meal for Q100. Here's a video of the team in action!








Tuesday, August 21, 2018

More on tsconfig paths with Jest

In my last post I explain how you can manually update your jest configuration to reflect paths that you may have setup in tsconfig.json.

I found this utility called tsconfig-paths-jest, that will do that automatically for you. To use this, you will need to set up a jest.config.js file so that you can assign values dynamically at test runtime, and if you have jest configuration info in package.json you should remove that when you set up your jest.config.js file. Please see the tsconfig-paths-jest project for full instructions.

One other pointer there - be careful if like me you have copied the tsconfig.json file from somewhere on the internet. The utility uses JSON.parse, and the implementation is strict and doesn't like trailing commas at the end of arrays and objects.

So something like this:

"paths": {
"@assets/*": [ "src/assets/*" ],
"@source/*": [ "src/*" ],
}

Should be changed to:

"paths": {
"@assets/*": [ "src/assets/*" ],
"@source/*": [ "src/*" ]
}

Wednesday, August 1, 2018

Configuring unit testing path aliases with Jest, Typescript and React-native


Update: 21/8/2018: This post describes how to set up tsconfig.json paths manually for jest. In the next post I describe how to do that automatically.

I ran into some nasty problems recently (well the latest set of them anyway) trying to run tests with the Jest setup in a react-native project. A while ago I had seen a nice Typescript feature where you can set up an alias for a path in your source code (details of that in this post and others). Having been round the block a few times over the years with "../../../../" relative paths, these path aliases felt like something of a solution.

A while after that, I started setting up some Jest unit tests, and while some worked just fine, others would fail on imports. The reason is that Jest has no clue about these path aliases that Typescript is using (although there might be an argument that something like ts-jest should relay that information). I'm not a fan of having these nice features, and then finding that you need to set them up in more than one place, but the only way I have found to fix the issue so far is using the moduleNameMapper configuration for Jest.


As an example, let's say we have an assets directory path set up in tsconfig.json as per the following snippet:

"paths":  
{  
    "@assets/*": [ "src/assets/*" ],  
},  

And remembering that we need an extra package.json file in the assets directory with the following configuration:

{ "name": "@assets" }

Then we can tell Jest about that in the jest config in our main package.json (or in jest.config.js if you went that way):

"moduleNameMapper": 
{  
    "@assets/(.*)$": "<rootDir>/src/assets/$1"  
},  

Which essentially says "for anything that begins with @assets/ substitute with the root directory of the project then src/assets and then whatever comes after" so:

@assets/images/icons/icon1.png

becomes something like

/users/example/react-native-projects/my-app/src/assets/images/icons/icon1.png

This is documented on the ts-jest github docs. You will save a lot of time and potentially major frustration by carefully reading  the information there that pertains to your project before you start using ts-jest.

Tuesday, June 26, 2018

Fuego Volcano Disaster in Guatemala

Golf players here in Guatemala have been raising money for some caddies who lost family, homes and livelihoods during the recent volcano disaster. The golf course where they were working near the villages that were hit was essentially destroyed as well during the event, and so they're out of work now on top of everything else… (Good thing was none of the ones working that day died, as the golf course had good emergency procedures in place.) The golf course had a policy of employing local people, so most of the caddies were kids from very poor local families, the same families whose villages drew the brunt of the pyroclastic flow that came down the volcano.



A funding page to raise money for the effort has been set up, specifically aimed at (but not exclusive to) people in the UK. I know the people involved and every penny raised will go directly to affected families. If you know of someone who plays golf and would be up for helping, please pass on the link below: https://www.gofundme.com/jn4cwz-houses-for-caddies?sharetype=teams&member=321576&rcid=r01-152995344496-d3860daf68a1407b&pc=ot_co_campmgmt_m. Of course... you don't have to be a golfer to help out!


Wednesday, November 19, 2014

Las Manos Festival 2014

If you are in or near Antigua Guatemala on the 6th of December 2014, you won't want to miss this:


Saturday, March 30, 2013

AMFPHP with the Flash Vector class

The AMFPHP (1.9 beta) did not support vectors (vector arrays) either inbound or outbound from Flash. My colleagues and I have made this work for our team, but with PHP 5.4 and a rather modified version of AMFPHP for our sole purposes.

There is a new version of AMFPHP from Silex Labs. I cannot say how much better it is than the 1.9 version, but I would advise that you check that first. I'm not sure though that it includes code for serializing and deserializing vectors, and for that reason, I have posted the code from our adaptation of the 1.9 version so that its potentially available to anybody, new version or old.

I have created a google code project and included the updates to AMFSerializer and AMFDeserializer there. These are the the .php files, not patches, so you will need to know what you're doing to update your code. If there really is enough interest, I will create patches and tidy this up a bit. There is also a class for AMFVector, this is so that the serializer knows that we want to send a vector back (and not an array). It also defines constants for the serializer and deserializer.

Vectors are cast to arrays for incoming vectors to PHP. Arrays wrapped in the AMFVector class will be vectors when they get back to flash. All the vectors in the spec cast back correctly, but please note the Vector.<Boolean> and Vector.<String> get cast to Vector.<Object> by Flash on the swing-back for some reason. I found that casting them using the static Vector.<String> or Vector.<Boolean> function call addressed the issue (ie: without the "new"). 

Please be warned, this was made for PHP 5.4 - it is not backwards compatible with other versions of PHP, and there is no intention on my part to make it so. Also, there are no guarantees, you use this at your own risk.

At the same time, as far as I can see this conforms the AMF spec for vectors, and works for vector-int, vector-uint (with the PHP caveats), vector-float and vector-object.


Thursday, April 12, 2012

Borders around Graphics and Frames in LibreOffice

Its has been a bit of struggle trying to work this out. I was trying to stop LibreOffice (version 3.4.3)  showing borders around graphics. At first I thought these were real borders (either around the graphic or the frame), but then realised that they are just "view" borders and do not print. Even so, I wanted to get rid of them, but there is not option in the "view" menu.

On the Mac I discovered that in Preferences->LibreOffice->Appearance there is a check on "Object Boundaries", un-checking this does the trick. In Windows this is in Tools->Options->LibreOffice->Appearance