2020-09-15

Interactions (fr)

En science physiques, nous apprenons qu'il existe plusieurs type de forces qui dirigent comment la matière et l'énergie interagissent.

En tant qu'être humains, nous avons une intuition de comment le monde fonctionne à notre échelle, un objet a une présence physique que nous percevons comme permanente. Alors qu'en "réalité" les objects sont fait de molécules, que les molécules sont faites d'atomes et les atomes de protons, neutrons, électrons mais surtout de vide. Quand nous percevons le choc de deux objets (ou de mon genoux contre une table basse) nous ne voyons pas les interactions atomiques entre les atomes de ces deux objects ou combien d'électrons ont sautés d'un objet à l'autre.

C'est pourtant quelque chose que nous essayons très fort d'imaginer avec la COVID-19 où le savoir qu'une charge virale invisible peut se transmettre d'un hôte à l'autre par simple contact, on peut pas les percevoir, mais on peut tomber malade.

Les quatre interactions fondamentales sont:
  1. La gravité
  2. L'électromagnétisme
  3. Les interactions atomiques fortes
  4. Les interactions atomiques faibles
Les interactions 1 & 2 sont visibles à notre échelle dans la vie de tous les jours, comme la pomme qui tombe de l'arbre et la lumière du soleil qui éclaire la terre.
Les interactions 3 & 4 ne sont d'habitude pas directement observables, mais certains de leurs effets peuvent être tester par des experiences qui valident ces theories, par exemple, 3 montre comment les atomes maintiennent leur structure et 4 explique comment la radioactivité fonctionne.

Les interactions les plus fascinantes sont celles qui sautent l'échelle, par example quand un comportment atomique ou quantique peut être observé à l'échelle humaine, comme la supraconductivité, les lasers les transistors ou encore comment un gecko grimpe au plafond.

Supraconductivité

Dans les conducteurs standard, comme le file de cuivre, quand un courant est appliqué il y a une resistance, et cette resistance génère de la chaleur qui conduit a une perte d'énergie. Parfois c'est un effet désiré, comme dans une ampoule ou la chaleur est si intense que le fil se met a luire et produit de la lumière, mais dans la plupart de case ce n'est pas desire, qui veut que son telephone chauffe quand on regarde des videos sur TikTok? Par opposition, un supra conducteur a une resistance nulle, et ne produit pas de chaleur quand un courant est appliqué, ce n'est donc pas une bonne idée d'utiliser un fil supra conducteur dans une ampoule, cela ne produirait aucune lumière! Mais utilisé un supra conducteur dans un téléphone l'empecherait de chauffer et la batterie durerait beaucoup plus longtemps. Le problème et qu'aujourd'hui, les materiaux supra conducteur ne sont disponibles qu'a très basse temperature (-200C) ou des pressions très hautes (des millions d'atmosphere). Malgré ces contraintes, on utilise des supra conducteurs dans des super calculateurs and les lignes électriques pour éviter les pertes en lignes.
La physique quantique est la mieux équipée pour expliquer ces phénomènes car la transition vers un état supra conducteur produit un changement soudain dans les propriétés physiques du matériau, ce qui indique un saut énergétique qui est typique de la physique quantique (la matière et l'énergie ne sont pas aussi continue que notre perception).

Voici une image d'un cable supra conducteur, immersé and de l'azote liquide pour la garder au frais et supra conductif.
 

Laser

Laser est a un acronyme, signifiant  "Light Amplification by Stimulated Emission of Radiation" (Amplification de Lumière par Stimulation d'Emission de Radiation) - en français c'est ALSER ce n'est pas aussi chouette. Un laser émet de lumière quit est dite cohérente ce qui permet d'obtenir un rayon de lumière dans une direction unique, par opposition à une source standard où la lumière est émise dans toutes les directions. La cohérence peut être spatial (un rayon très fin) ou temporelle (un ajustement de la fréquence sur une couleur spécifique, ou sur un temp très court). Les lasers ne sont possible que grace à Einstein et son interpretation de la théorie quantique de la radiation.

On peut utiliser les lasers dans des systèmes d'alarmes come dans le film classique  "entrapment"

2020-07-30

Interactions

In physics we learn that there are multiple forces that direct how matter and energy are interacting together.

As human beings, we have an intuition on how the world is working at our scale, an object has a physicality that we learn to expect to remain the same. Where in "reality" objects are made of molecules and molecules made of atoms, and atoms made of protons, neutrons, electrons and mostly of void. When we perceived a bump between two objects, we don't see the atomic interactions between the atoms of those two objects, how many electrons jumped from one to the next.

This is something we are trying to imagine very hard with COVID-19 or with the knowledge that invisible viral charges and bacterias can change hosts by contact, we can't see those but we can get sick.

The four fundamental interactions are
  1. gravity
  2. electromagnetic forces
  3. strong atomic interactions
  4. weak atomic interactions
1 & 2 effects are visible at our scale in everyday life, eg an apple falling from the tree and the sun shinning its light on earth.
3 & 4 are not directly observable, but their effect can be tested through experimentation  that validates the theories behind them, eg 3 supports how atoms are holding together and 4 supports radioactive decay.

And yet, the more exciting interactions are the one jumping scale, eg an atomic or quantique behavior which can be experienced at human scale such as superconductivity, laser, transistor or how gecko can stick to walls.

Superconductivity

In standard conductor - eg a copper wire, when a current is applied, there is a resistance and this resistance triggers heat which leads to waste of energy. sometimes this is desired effect like in a lightbulb where the heat is so intense that the wire is glowing and produce light, but in most other case, this is not desired  - who wants a phone that heats up when you watch Netflix. By opposition, a superconductor has 0 resistance and as such will not produce heat when a current is applied it would be terrible to use a superconductor in a lightbulb, it will not produce any light! but using a superconductor in a phone would keep it cold and make the battery life much longer. The problem is that today superconductive materials only come by at very low temperatures (-200C) or very high pressure (millions of atmosphere). Still they are used to build computers and transmission lines over long distance without line loss.
Quantum physics is best placed to explain this phenomenon as transition to a superconductive state produce a sudden change in physical properties, indicate of an energy gap which is typical of quantum physics (as in matter and energy are not as continuous as we can perceive)

Here is a picture of a super conducting cable, immersed in liquid nitrogen to keep it cool and superconductive 

Laser

Laser is acronym meaning "Light Amplification by Stimulated Emission of Radiation". A laser is emitting a light which is said to be "coherent" which allows to emit a ray of light as per opposition to say a lightbulb where light is emitted in all directions. The coherence can be both spatial (tightly focused) and temporal (fine tune frequency on a specific color, or very short burst of light). Laser are only possible thanks to Einstein take on the quantum theory of radiation. 

Laser can be used for alarm system like in the classic movie "entrapment"

Transistor

A modern transistor is a "semi conductor", it has 3 legs and act like a virtual switch, if a current is applied to 2 of its legs control the current on the third leg. Those devices work by controlling electron flows between their legs. A semiconductor material falls between a conductor material (eg copper) and an insulator material (eg glass). Current understanding of how a semiconductor works involves quantum physics to explain how electrons are moving from one layer to another.

A classic of a transistor

Gecko Adhesion

Geckos are small lizards and some of them have the amazing ability to adhere to most surfaces, but they are not using liquids, spit or glue to perform this adhesion, it is currently understood that they use the van de Waals' force which is an interaction of type 4 (weak atomic interactions) to performs those acrobatics. It's all about the surface of their feet which is covered by super thin hair (setae, 5 micron meter compared to human hair which is at least 20 micron meter) and each of those has between 100 to a 1000 spatulae (which are 0.2 micro meter) - suffice to say with this amount of stuff on their feet, the actual surface available to stick to the support is immense. It is said that the feet of an adult gecko (70g) could support more than 100kg. People are trying to build artificial gecko feet but this is not a trivial task.

A closeup of a gecko feet, you can see why there is so much surface area.

Those are 4 ways that 1 & 2 show up at our scale with amazing effects that are counter intuitive to our understanding of physics, a bit like the child is amazed at how helium balloon float in the air when everything else is dropping on the ground!


2015-09-03

Using WebCrypto API to generate a KeyPair

The other day, I was using my chromebook and I needed to generate a keypair to get access to a new ssh server. I googled for a solution, but surprisingly I couldn't find one. Though I was pretty sure that the WebCrypto API would allow me to do easily, it turned out it's not as easy as I thought and it took me a couple days to actually figure out how to use the webcrypto API to achieve this specific goal, though this was mostly due to my blissful ignorance of ASN.1 encoding, JWK, base64url and openssh weird public key format.

Of course the first point of reference should be the the actual W3C spec. But this document is a bit too abstract and I found it hard to actually use the API from the spec.

Then I found a WebCrypto live table that tells me if my current browser actually support the API. Since some of those use native libraries, the Chrome on ChromeOS would have different support as the Chrome on other OSes.

We also need to keep in mind that the WebCrypto api is only available from secure locations. Luckily the file url is counted as a secure location, so it makes it easy to experiment from there. And surge.sh does host under https so that will be my provider of choice to host the end result.

On an OS with support for openssh we have the nifty utility ssh-keygen which allows to generate a keypair that can be used with ssh - which is exactly what we need.

So we have to figure out which algorithm to use, then use it with the appropriate parameters, then find a way to expose the public key and the private key. Ideally save the private key to a file and copy the public key.

The WebCrypto api is based on promises for the async work, so you will need to be vaguely familiar with promises to be able to read the code.

I am forever grateful to Converting OpenSSH public Keys for explaining the format used by OpenSSH public keys.

I also had to use a lot of google-fu to find out how to ASN.1 encode the JWK produced for the private key by the WebCrypto API in format that will be accepted by openSSH. Thanks to Lapo Luchini for putting together the awesome ASN.1 online decoder that allowed me debug my code and find out that ASN.1 doesn't like integer that starts with the high bit set (you have to prefix them with 0x00 in this case).

Please note that it is usually a very bad idea to put private keys in a browser, as most thing that are displayed on a web page can be stolen and a private key is probably the worst thing you could think putting on a web page.

But now, equipped with those two string representation of my key pair, I can setup my ssh connection straight from my Chromebook without having to use another OS. I am using the ssh chrome extension.

Live demo at https://js-keygen.surge.sh
Code at https://github.com/PatrickRoumanoff/js-keygen

2015-09-01

My Weekend

At my previous job, we used to have an informal Monday morning catchup where everyone would talk about their week-end activities before going on about their planned work activities for the week.
When I left, quite a few people told they were always looking for my updates to spin their heads about how many km I had to do to drop how many kids where...
So here is an account on my week-end.

It started on Friday afternoon, when we got ready to go to Friday night races organised by Carlisle Swimming center, as four of the kids are in the right groups to register for the races, it's only $12 per family so it's a great deal for us. And it's a lot of fun, you can win medals and get special cards if you get into the first three or achieve a personal best. J2 likes to do the long distance races, 100m freestyle or breathstroke, but all the other contestants are twice her size and finish in half the time, but she still manages to enjoy herself, and everyone clap when she get to the end.

Saturday starts pretty early as my wife is teaching the french horn from 7:30 to 12:30. Beside the usual breakfast, J1 made pancake for everyone which was nice. We left at 8:30 to head to choir which starts at 9:00 in the city. While J1 & J2 went to choir, we took a walk in the new Barangaroo park with E2, V and C, which was very nice, but E2 was wearing his brand new choir rehearsal outfit and had a difficult time stopping himself from rolling in the dirt, going down stair ramps and climbing rocks close to the water. The park is very nice and the weather was awesome.
J1 & J2 didn't like me going to the park as I usually do parent supervision at choir instead and they were pretty horrible all the way to the swimming pool.
Swimming was good with 5 of them in the water it's pretty relaxing time for me - which means no one cried to get into the water. It was a big day for E2 because he got evaluated and he managed to up a level - which is a big issue for me because there is no class for "SuperFish" at 10:30 and this breaks all my Saturday schedule. We manage to find a spot at 9:00 but I can only drop him at 8:30 on my way to choir - we will test  that next week.

After swimming it was time to go register for next Friday night races - and J2 decided for the 100m again - she is certainly persistant. Whereas I have to encourage Violette to do more than 25m (since the figured out she can get as many points out of 25m, 50m or 100m she opted for the less tiring option).
Once home  have to remember everyone to hang up their towel & costume - minor drama here as C lost her goggles and swimming cap - we will probably find them next week. You couldn't believe how many goggles we lost  in the 10 years we have been going to swimming lessons - that's why I only get the "3 for $10" deal from Big W, because at $25 a pop for a pair of swimming googles, I would already be ruined.
We also got a phone call V's birthday party was cancelled because the host was sick - which was a relief because there was no one to drive her or pick her up and we didn't get a present...

Lunch was alright - then it was time to go to French class for C - which means doing the homework first, for once J2 helped C which was a nice change. But this time I had to bring E1 and E2 because they have a special choir rehearsal this afternoon, so after dropping off C at french class, it's back to the city for me. Of course, E1 being 13 she has a go at me by not getting out of the car when I told her I was a hurry to get back to French class to pick up C. I know they were tired, because they both dozed off in the car, but still, I got angry at her - I should know better.
Back to French class, C is super happy - which is a nice change - and she can't stop speaking French to me which I love so much. She's actually the only who will voluntarily speak French to me. We go to Aldi for the weekly shopping - we only have one hour because I have to go back to the city at 5:30 to pick up the E1&E2 form Choir. C was super helpful at Aldi and even helped me with the bags at the cashier. Back home to drop the shopping and C and it's off to the city for me (third time in a day).
I arrive 10m late because of traffic, but apparently they finished early so they have been waiting 30m outside - though Steph was here to supervise them.

Saturday adventures finish here.
Then it's Sunday... J1 wants to do crepes for breakfast which is great but 7am is a bit early for a Sunday. We start off with a bassoon lesson at 9:30 for V, but for once my wife is driving, she enjoys that because she can talk a walk on the beach during the lesson, so it's not too bad. At Noon my wife is off to perform in a concert for most of the afternoon so I will be with the kids by myself. Not much planned today, but kids insist on going to Warringah Aquatic Center, which is always fun because I get to argue with the cashier lady on the merit of a family entry when you have 6 kids. Before we get to leave we have to fold the laundry which has been accumulating on the couch for the pat two days, it's always a struggle to get them to fold the laundry, but going swimming is a good motivator. Cashier lady is very strict, and I have to pay for a family ticket + two kids to gain entry. We have lots of fun, and I manage to convince E2 to dive properly, starting from the sitting position, then crouching position, then standing position. I think we managed to overcome his fear of belly flop - at least he now can dive. V found $4 at the bottom of the pool and she buys some hot chips she shares with everyone.
Back home, we have to get ready for cello lesson, luckily the teacher comes home for this one, and she brings her daughter with her. We have a big afternoon tea - cello start for E1 her exam is next Saturday so she has an extra long lesson, then it's J2 and C's turn. During the lesson I start dinner, I bought some prawn and they need to be peeled, no kids want to try, "it's too disgusting" only the cello teacher daughter manages to peel a couple prawns. I cook them with garlic to go with pasta. Kids won't touch them, they can have cheese & tomato sauce. For dessert I make apple crumble, but in the rush I leave the oven on grill instead of fan forced, and it ends up with slightly burned top - still alright to eat but I had done better. Wife is back from concert to share dinner with us, and we even have the cello daughter who is having pasta & apple crumble.

Then it's time for bed - at least for the kids

2015-08-11

Give me a diagram!

It happens so often.

I read some blog post or a book or a github repository or I talk with someone, and the discussion is veering towards describing a process. Immediately I feel the need for a diagram. I didn't think I was a visual guy, but the more it goes, the more it drives me mad.

Look at gulp, or any of it's plugin, they are all describing a workflow process and there isn't a single diagram in any of the docs or books I am reading on the topic.


2015-08-07

Static Site Hosting

Everyday I found out about a new service provider for static site hosting, it seems that everyone and their dog is providing the service, the latest one, surge.sh seems to be doing everything I have been looking for in such a service. So it's probably time to actually list what features I am looking for in a static site hosting service:

  • command line update
  • Documented CDN
  • No constraints on file types
  • SSL subdomain
  • SSL custom domain
  • Some kind of source control system (integration with a git provider is ok)
  • Online editing (for chromebooks)
  • drag and drop updates (not required, but nice to have)
  • minimal monthly price (free is fine)
Another I looked at recently is cloud9, which originally was only a web IDE, but seems to have evolved to be a full blown vm provider as well where you can run any command you like (a la runnable.com) probably a bit toomuch for what I am after, but interesting none the less.

2015-08-06

2 more static site hosting solutions which are not

Today I realised that using Google Drive or Dropbox for static site hosting is probably no the best idea, as they don't support relative path and needs to hardcode each file dependencies in the html + there is not way to provide a custom a domain - so this should be reserved for the ad-hoc single-page site.