Sunday, May 21, 2017

Adelaide

This was my second visit to Adelaide. The first one, in 2009 made me think Adelaide was a bit boring compared to Sydney or Brisbane. Primarily, I thought about architecture - driving by car from and to the city centre I could not identify any landmarks, but also culturally, I did not remember many places of interest, except for the Migration Museum. This time, I went on a walking tour of the city with Ryan and a small group of other tourists. Ryan told us that about 6 years ago Adelaide government started working on making the city more appealing. They are copying some ideas off Melbourne, like pedestrian laneways. They paid the cricket club 350 million dollars to open up their CBD stadium for other games and constructed a pedestrian bridge to it, and embarked on other improvements... As a result, I no longer think Adelaide is boring, I actually quite liked it, and I will definitely return.

The infrastructure is improving too. The rail line to Seaford has been electrified:



For railway enthusiasts: track gauges in Australia are a mess. Most of South Australia uses standard gauge track (1435mm), but Adelaide's suburban trains use broad gauge track (1600mm). The carriages are noticeably wider - compared to Gold Coast, which uses narrow gauge track (1067mm), although the seats seem to be the same narrow kind:
Adelaide train (source)

Gold Coast train (source)














As of 2017, though, according to our guide, only 13 thousand people live in the CBD (there are hardly any apartments there) and on weekends some restaurants/coffee shops are closed, major shops close at 5pm, cultural events wind down even earlier, and some places, like the Victoria square seem to be occupied primarily by the homeless. I was asked for small change at least twice that day, and once a pair of bored young boys tried to disrupt Ryan's monologue by shouting obscenities at him. The electrification of the commuter rail has been stalled, and it's strange to see these diesel powered trains in the capital of the renewable energy leader - South Australia:


Photos from the city centre:

Street art

Opposite side

The oldest shopping mall in Australia - The Adelaide Arcade built in 1885.

The Rundle Mall

One of the popular meeting points on the Rundle Mall - the pigs - this one is Oliver.
The other popular meeting point is the balls - two big metal balls stacked one on top of the other.

The west end of the Rundle Mall

A view of the mountains from Adelaide's city centre.
Adelaide is only about 20km wide west-east from the gulf to the mountains and about 100km long north-south.

Photos from Port Adelaide suburb located north-west of the CBD:
Port Adelaide railway stop - reminded me of a prison: everything is vandal-proof and there is no way of escaping, but through the very long ramp down. The feeling was reinforced when, after boarding the train here, I got off at Adelaide (city centre) and there were about 10 police officers watching closely passengers leaving that train.

Port Adelaide - this old house has maybe 40m2 area, but 4 columns!

An old Meat Store - Port Adelaide

Photos from the Aviation Museum:
Jindivik - see below

Australia was making a Jindivik jet drone in the 1950s!

F-111 of the drop and burn fame - it could drop some fuel in flight and then ignite it creating a spectacular display.

The front page of The News from 15 Oct 1953.

7 major nuclear tests have been performed in Australia
Prohibited areas during nuclear testing. Currently, the zone is much smaller.
The British design De Havilland Vampire jet plane, first flown in 1943. This one was built in Australia in 1951.

A beautifully restored Spitfire.
Original condition of the Spitfire above.
Surfers have it harder in Adelaide, as it is located on the shores of St Vincent Gulf, and the waves are miniscule.

Looking south from Glenelg - a picturesque suburb of Adelaide.

Some government residence in Glenelg?

Glenelg Town Hall - in the US people go to Disneyland to see places like this.

Glenelg - last tram stop, almost on the beach.
 Back in Adelaide CBD:
Old and new.

The front yard of the Adelaide airport with a water feature - must be very popular with kids in the summer. This really is the front of the airport - private cars drop off people in back of this photo, buses and taxis have their stops on the left side of this plaza - not visible in the photo.

City centre seen from inside the airport. Adelaide's airport is between the city centre and the gulf.
Trivia:
1. When the Beatles visited Adelaide, they drew a crowd of 350 thousand people, more than the queen and the pope combined. Their picture is permanently on display on the city hall balcony from which they made their appearance.
2. The first Australian Eurovision contestant - Guy Sebastian - is from Adelaide.
3. The first Australians to fly from England to Australia in less than 30 days, were South Australian brothers: Ross and Keith Smith.

Wednesday, May 17, 2017

One word to rule them all - aka Polish is easy

The Polish language is notorious for being hard to learn. Nothing further from the truth. Today, I will show you how you can communicate effectively in Polish using one word only. That magic word is 'pieprzyć', which may mean sprinkling your food with pepper ('pieprz' in Polish) or a sexual intercourse (obviously). The pronunciation is something like 'pie -psh' - the 'pie' pronounced like 'Pie' in the name 'Pierre'. Note: all of these are mildly offensive in Polish, and wouldn't be used in polite conversations. Here we go:

Really? - Nie pieprz.
Don't make me laugh! - Nie pieprz!
You are joking! - Pieprzysz!
Run away! - Spieprzaj!
Leave this room! - Wypieprzaj!
Did you steal it? - Zapieprzyłeś to?
Start now! - Zapieprzaj!
Work hard! - Zapieprzaj!
He messed it up! - On to spieprzył!
Everything goes to hell - Wszystko się pieprzy
They beat us (in a sports game, or physically) - Dopieprzyli nam (w grze, albo fizycznie)
Hit him - Przypieprz mu
I have a hell of a headache - Ale mnie głowa napieprza
What a hectic day it was! - Ale był zapieprz dzisiaj!
Leave me alone! - Odpieprz się!
You are talking nonsense! - Pieprzysz głupoty.

... and my favourite, because it was used by the late Lech Kaczyński and accurately demonstrates the attitude of his Law and Justice (PiS) party towards those who don't agree with them:

Piss off, you old git! - Spieprzaj dziadu!


A new generation of defensive weapons

I'm thinking some weapons that we still make, and take for granted their usefulness, are going to become obsolete in the next big war, such as horses became obsolete by the end of WW2. I'm thinking about tanks, ships, helicopters, maybe even rockets. To make it clear: I hope we are smart enough to not allow the next big war to happen.

For example, how would I neutralise a tank?

A small (5-10cm) flying drone with a small hardened part, finds a tank and lands inside its gun barrel. From here I see two possibilities: it could latch itself to the inside of the gun to prevent firing of the gun or it could wait until the hatch opens and then get inside the turret to neutralise the crew. That's it, either no explosives, just a small, hard part, in a place where it shouldn't be or a small explosive detonated when it would hurt most.

The small size of the drone protects it from being detected and destroyed. It could even fly in a zig-zag fashion like a mosquito or a fly - it does not have to be particularly fast.

How to neutralise a helicopter? Maybe make the drone land on its tail-rotor and either jam it or damage it by a small explosion. In general, use small size and great manoeuvrability to attack where the helicopter is most vulnerable.

How to destroy fast moving objects like airplanes and rockets? By using something that is ultimately fast: laser shoots at 300,000 km/s. Calculating the angles and firing is an ideal job for a radar/computer. How to detect stealth planes? Maybe by creating a virtual net from solar/battery powered radar/camera drones permanently patrolling the sky. If some of them had lasers on board, the system might be even more effective.

Clean Code by Robert C. Martin

Subtitle: A handbook of Agile Software Craftsmanship. First published in 2008.

One of the core programming books. All code examples are in Java.

Functions:

Should do one thing only.

One level of abstraction per function: making the code read like a top-down list of TO instructions is an effective technique to achieve that (the Stepdown Rule):

For example, for a non-configurable dashboard I could write:

"To create a Home Dashboard, get the System Status traffic light, Devices/Users vertical bar chart, and Workflow Pipeline horizontal bar chart."

The ideal number of arguments for a function is zero.

niladic - 0 arguments
monadic - 1 (monads)
dyadic - 2 (dyads)
triadic - 3 (triads)
polyadic - 3+ do not use

Why? More arguments = harder to read, harder to test: lots of combinations.
Flat, output arguments, and flags - ugly, confusing, terrible.
If your function needs to change the state of something, let it be the state of its owning object.

Temporal coupling - when a function can only be called at certain times.

Not having boolean arguments: but a boolean argument could prevent duplication: but the duplication can be solved by creating another function.

Because a function should do only one thing and a function with try/catch is doing error handling, it should only do error handling, i.e. in the try section it should just call one subfunction and in the catch it should handle all possible exceptions.

My argument against exceptions: they are like GOTO of old: arbitrarily move execution somewhere else in code. Also, handling exceptions in separate functions, as recommended, leads to abstraction leakage: the exception may be from many layers down.

My argument against small functions with only one or two arguments: class count and stack depth explosion: lots more classes, lots more layers.

My argument against "comments are always failures": comments are necessary when explaining the path taken: why did we code it this way. The author clarifies that a few pages later: intent comments are good.

Do not return null.

Side effects are evil.

Funny parts:
G25: Replace magic numbers with named constants, except for well known numbers like 5280: "the number 5280 is so very well known and so unique a constant that readers would recognize it even if it stood alone on a page with no context surrounding it." 

Really? If you belong to the 95% of the world population using the metric system (everyone, except the US, Myanmar, and Liberia), 5280 is a magic number to you. It is the number of feet in a mile.

G31: hidden temporal coupling - when functions must be executed in order, but they don't use arguments/return values to show it. Have fun debugging that. :-)