A LENGTHY REBOOT

By Richard Hsu
Latest | Archives | Contact | Others

Einstein's Riddle

A friend emailed me Einstein's riddle. He said it took him 25 mins to solve. That gave me a bit of motivation to give it a try. I was at my son's swimming lesson when I read the email and quickly realised that I wasn't going to beat his time. But, as I started solving it with Google Sheets on the iPhone, the idea of using database tables and Sql to generate cartesian product, followed by a process of filtering out untrue data got me intrigued.

It took me well over an hour but it worked and it was fun. Stop here and go to the riddle page linked above if you want to give it try.

I used a Sqlite database and below Sql to solve it.


/* drink */
insert into drink values('tea')
insert into drink values('coffee')
insert into drink values('milk')
insert into drink values('water')
insert into drink values('beer')

/* house_color */
insert into house_color
    values('red')
insert into house_color
    values('green')
insert into house_color
    values('yellow')
insert into house_color
    values('blue')
insert into house_color
    values('white')

/* house_order */
insert into house_order values(1)
insert into house_order values(2)
insert into house_order values(3)
insert into house_order values(4)
insert into house_order values(5)

/* nationality */
insert into nationality 
    values('brit')
insert into nationality 
    values('swede')
insert into nationality 
    values('dane')
insert into nationality 
    values('norwegian')
insert into nationality 
    values('german')

/* pet */
insert into pet values('dog')
insert into pet values('birds')
insert into pet values('horse')
insert into pet values('cat')
insert into pet values('fish')

/* cigar */
insert into smokes
    values('pall mall');
insert into smokes
    values('dunhill');
insert into smokes
    values('prince');
insert into smokes
    values('blend');
insert into smokes
    values('blue master');

/* create cartesian product of combinations */
/* filter out rows that are untrue */
insert into results
select 
    house_order.Id, nationality.country,
    house_color.color, 
    pet.animal, drink.name, 
    smokes.cigar
from 
    house_order, nationality, 
    house_color, pet, drink, smokes
where 
    pet.animal = 'fish'
    and nationality.country != 'swede'
    and smokes.cigar != 'pall mall'

/* Eliminate more untrue combinations */

/* brit lives in the red house */
delete from results
    where country = 'brit' and color != 'red'
delete from results
    where country != 'brit' and color = 'red'

/* norwegian lives in the 1st house */
delete from results
    where country = 'norwegian' and Id != 1
delete from results
    where country != 'norwegian' and Id = 1

/* Then 2nd house is blue */
delete from results
    where color = 'blue' and Id != 2
delete from results
    where color != 'blue' and Id = 2

/* dane drinks tea */
delete from results
    where country = 'dane' and drink != 'tea'
delete from results
    where country != 'dane' and drink = 'tea'

/* german smokes prince */
delete from results
    where country = 'german' and cigar != 'prince'
delete from results
    where country != 'german' and cigar = 'prince'

/* person in green house drinks coffee */
delete from results
    where color = 'green' and drink != 'coffee'
delete from results
    where color != 'green' and drink = 'coffee'

/* smokes dunhill & lives in the yellow house */
delete from results
    where cigar = 'dunhill' and color != 'yellow'
delete from results
    where cigar != 'dunhill' and color = 'yellow'

/* middle house (id: 3) drinks milk */
delete from results
    where id = 3 and drink != 'milk'
delete from results
    where id != 3 and drink = 'milk'

/* drinks beer smokes blue master */
delete from results
    where drink = 'beer' 
    and cigar != 'blue master'
delete from results
    where drink != 'beer'
    and cigar = 'blue master'

/* green house on the left of the white */
/* 2nd house is blue, */
/* so green, white is 3rd, 4th or 4th, 5th */
delete from results
    where color = 'green' and Id not in (3,4)
delete from results
    where color = 'white' and Id not in (4,5)

/* 15 possibilities left for the fish */
SELECT * from results

Id  country     color   animal  drink   cigar
3   brit        red     fish    milk    blend
4   brit        red     fish    water   blend
5   brit        red     fish    water   blend
4   brit        red     fish    beer    blue master
5   brit        red     fish    beer    blue master
4   dane        yellow  fish    tea     dunhill
5   dane        yellow  fish    tea     dunhill
2   dane        blue    fish    tea     blend
4   dane        white   fish    tea     blend
5   dane        white   fish    tea     blend
1   norwegian   yellow  fish    water   dunhill
4   german      green   fish    coffee  prince
2   german      blue    fish    water   prince
4   german      white   fish    water   prince
5   german      white   fish    water   prince

With my son's help, I created tables with pen & paper, filled one column with one of the possibilities, then filled the blanks using hints. When one of the hints conflicted with what we had filled in, we stopped, and repeated the process with the next one. It got faster as we went through them and the 12th row in the list turned out to be the one.

The hand written table looked like:

1 2 3 4 5
norwegian brit german
water milk coffee
yellow blue red green white
horse fish cat
dunhill blend prince


Minecraft Editions

To celebrate the new Minecraft Earth and 10 years of Minecraft, I wanted to go down memory lane and revisit all the Minecraft items that I bought, downloaded and installed over the years for my son Aiden*.

First came the Minecraft "Pocket Edition" iPad app (2014), then he got an Xbox 360 gaming console (2015) so I had to buy a Minecraft "Xbox 360" game DVD.

That is two different Minecraft items.

At some point in 2017, Aiden wanted to play Minecraft on the Windows PC because it had a keyboard and many features that the Xbox 360 one didn't. When I saw Minecraft "Windows 10" edition was on sale for $15, I didn't waste any time getting it.

The four-year-old iPad 3 was too slow, so we got an iPad Pro. Fortunately, I didn't have to buy yet another Minecraft as the previous iPad app could be restored at no cost.

At the end of 2017, Aiden could play Minecraft on a touchscreen iPad, with a gaming controller on the Xbox, and keyboard on the Windows PC.

In January of 2018, I got tired of my kids fighting over the new iPad, so we bought a Kindle tablet from Amazon. Yes! I bought Minecraft for the Kindle too.

Shortly thereafter, I made the dumbest move yet when I let Aiden play Fortnite on my Windows PC. The PC didn't have enough horsepower to run modern games smoothly. Fortnite worked but under lower graphics settings which bothered me more than him. Xbox 360 was the best gaming device we had but it was three years old so new games like Fortnite wasn't made to work on it. Doubling down on my dumbest move, I got the latest generation Xbox One S gaming console to replace Xbox 360, so he could play Fortnite in all its glory.

Of course, Microsoft didn't bother to make the Minecraft "Xbox 360" game work on the Xbox One. For six months, Fortnite possessed my son completely and he didn't play Minecraft much. When he did play, it was on the Windows PC. It didn't bother him that he couldn't play Minecraft on the Xbox One. Not yet.

So, Minecraft was available on the Windows PC, iPad Pro, and Kindle, but not on the Xbox One.

The Fortnite fever eventually subsided and he started grumbling about not being able to play Minecraft on the Xbox One. Since giving my son every possible Minecraft option on every floor of the house, on all screens was very important to me, I shelled out $30 for Minecraft for Xbox One edition in early 2019.

With that, he could play Minecraft on the iPad, Kindle, Windows PC, and Xbox One (Xbox 360 was packed away but on standby).

Aiden typically plays Minecraft online with his friends and sometimes with his sister Adele. All the above Minecrafts can connect to each other and join the same "world". It seemed like we had it all covered. He was able to play with everyone: school mates, other friends, soccer & hockey buddies, and online "friends".

A few weeks ago, one of his school mates got a Minecraft "Java" edition. The "Java" edition only connects to other "Java" editions. You can install it on Windows 10, but it is different from the "Windows 10" edition that we have! The "Java" edition players connect to a different world than the Xbox/iPad/Kindle/Windows 10 one. My son can't play with him!

The rest of the story is unwritten.

*my daughter Adele plays too but occasionally.


Aquaman Without Coffee

Last night at the movies, after sitting down in theatre 9 to watch Aquaman with the wife, we felt like having coffee. So I went back down to get one. Not being experienced with movie going at the theatres, I wasn't sure if I could exit and re-enter so I asked the guy scanning tickets at the entrance and he said yes, but, he also said, "No, thank you!", "I don't need any coffee". He said it without any expression but I had a laugh and he smiled back :)

I probably will not remember Aquaman but that guy, he was funny. When I came back with the coffee, he said "I told you, I don't need coffee. Thank you"


4K Monitor (Enable DisplayPort 1.2, Disable DDC/CI)

Getting a 4K monitor (Dell UP2414Q) working with Windows 10 took a lot more than I expected. My computer motherboard supports 4K resolution @ 30 Hz via HDMI but most people online say 4K @ 30 Hz will not be smooth. Having used monitors at 60 Hz refresh rate for as long as I can remember, I didn't want to take a chance and got the graphics card (AMD RX 460) that supports 4K @ 60 Hz via DisplayPort.

When I powered up the 4K monitor, I saw the sharp, colour accurate, bright, and "retina" 4K display that I was expecting but it was running at 30 Hz. It was usable, and I didn't notice any lag. Still, I wanted to get the refresh rate to 60 Hz for best results. There was just no way to pick 4K @ 60 Hz.

It didn't take long to find the answer online. The monitor's DisplayPort 1.2 was disabled (default setting). Enabling it via the monitor menu refreshed the available resolutions and refresh rates and I was able to pick 3840 x 2160 (4K) @ 60 Hz. It was noticeably smoother than 30 Hz, so the internet people were right.

Then I ran into another problem: when the monitor powered back on after sleep, the screen would split into two with the left half at a lower resolution and stretched out (the right half was fine). It was not usable at all. This problem took a while to figure out including time wasted trying Dell's customer support.

Again, changing a monitor setting solved it. Only this time, I disabled the setting called DDC/CI.

I still have one unsolved problem, but it is easy to work around. When Windows turns off the monitor to enter sleep mode, it stops sending the signal via the DisplayPort. I can't wake the monitor up using keyboard or mouse. When I power on the monitor, it still doesn't get any display signal from the computer. This thing drove me crazy for about an hour (monitor connected via HDMI doesn't have this problem). I finally gave up trying to make this work. Instead, I don't let Windows power off the monitor. I do it myself by pressing the power button.

What I learnt is a DisplayPort connection between monitor and computer isn't a simple one-way connection like it is with VGA or DVI. DisplayPort is a two-way connection meaning the monitor sends back data about its capabilities to the computer every time it powers up and the computer then figures out what signal to send (much like a USB printer or mouse). When the computer puts the monitor to sleep and wakes it back up, something goes wrong in that connection negotiation and I end up with either a half screen unusable display or completely off monitor.

Having to physically press the power button on the monitor to turn it off and on is something new for me but I don't mind it.

Update: I still get the no-signal or split screen randomly, To fix it, I change Input Source to HDMI, wait, then switch it back to DisplayPort and it works


Chapturkey

My son has two dictionaries: Merriam-Webster's Pocket Dictionary, and The Kid Dictionary. The Kid Dictionary has made up words to describe the indescribable and it is hilarious!

I don't remember him ever using the Merriam-Webster's Pocket Dictionary and I doubt it is still around.

The other night, while reading the story of The Brave Little Tailor (again) to my daughter at bedtime, I was sleepy and skipped a few paragraphs on the last page. My son, who was also in bed but listening, jumped up and told me to pause.

He went to his bookshelf, pulled out The Kid Dictionary, flipped over to page 40, then read out loud: CHAPTURN (verb). "To sneakily skip pages when reading a long children's book to your kid."

Then, turning to page 41, he read: CHAPTURKEY (noun). "A parent who gets caught skipping pages when reading a long children's book to his or her kid".


Fly Hacking and Dragons

Fly hacking is a Minecraft term used to describe cheating by a player in a multi-player online game. I learnt this from my son who goes online into Minecraft worlds and plays games with others. To keep it fun, competitive, and fair, players aren't allowed to fly in the games. Flying gives a player unfair advantages. They are supposed to battle on the ground. But there are players who hack into the Minecraft system and fly. When this happens, someone reports them to the server admin and the cheating player gets kicked out of the game.

In Game of Thrones, Daenerys Targaryen has three fire-breathing dragons that give her the same advantage in battles. When she and her soldiers are surrounded by opponents and there is no way out, in flies her Dragon breathing fire, burning people, scaring the pee out of shocked men. She climbs on it and flies out of, what a few moments ago, was a certain death. The Sons of the Harpy had no option to complain about the unfair advantage of a Dragon.

Air strikes in war, giant-sized Eagles in Lord of the Rings, there are many other examples in fiction and reality where one side has an unfair advantage over another. Unlike Minecraft, there is no way to level the playing field.


Christmas

Christmas is about celebrating the birth of Jesus Christ. It is a time to get together with friends and family, exchange presents, take time off from work, and refresh before the new year.

It is also a time to look back at the year that past, consider how it was spent, memories made, remember those that have pass.

My family brings me joy, meaning, and purpose to my life. But I also miss the family that I am part of but are oceans away: my parents, brothers, and the extended family in India.

This is an immigrant's pain. An immigrant's sacrifice. An immigrant's bargain.

It is the asterisk that has been there for the past 12 years, in all the headlines of my life, reminding me of the family that I left as I embarked on new life in Canada to make my own.

I miss them, wish them well, and pray for them.


Excuse for Not Eating

Adele didn't want to finish her lunch(old news). She wanted to skip to the drink (Sprite). She started with her usual excuses but realised it wasn't working. So she came up with a new one.

She said: In my stomach, the food section is full but the drink section still has space.

It worked!


How to Disney

If you are staying at a Disney Resort hotel and you bought day passes (1 park per day) for all four parks, then the first thing to decide is which park on which day.

Three things to consider:

1) Day specific events
Firework shows don't happen every day. During our visit, the Magic Kingdom fireworks was on Monday, Thursday, Friday, and Saturday only. This is the best fireworks show I have seen so you should not miss it.

2) Extra Magic Hours
On select days, parks are open earlier or close later only for Disney hotel guests. Disney calls this extra time "Extra Magic Hours". During our visit, Animal Kingdom had Extra Magic Hours from 8am-9am on Tuesday. We used that early entry to line up for the very popular Avatar Flight of Passage ride*. As we entered Animal Kingdom, I saw a line of visitors (not staying at Disney hotel) that weren't allowed to get in yet so the one hour head start does make a difference.

3) Arriving and Departure days
On the day you arrive or depart, you will not have a full day so either don't visit a park or pick one that you can enjoy in the shorter day without rushing. We arrived Saturday noon and didn't visit any park. After a leisurely lunch, we spent the afternoon shopping at The Loop outlet. On the day of departure, our bus from hotel to airport was at 5.45pm so we picked Epcot for that shorter day since it seemed the most relaxing**.

Planning help
Please refer to the guide for park hours to find out Fireworks days and Extra Magic hours.

I had three guides in my pocket all the time and used it often. You can get these at the hotel or parks.

  1. Times Guide for all parks. This is a weekly guide for park hours, Extra Magic Hours and times for popular events.
  2. Times Guide for the parks. One per park. This is a two page park specific list of times for popular attractions and events.
  3. Guide map for the parks. One per park. Large well made map of the park, attractions, restaurants, washrooms etc.

They have a mobile app that is very useful but the Wi-Fi in the parks wasn't reliable so we used the paper guide and maps most of the time. We did use our roaming data connection to check wait times for rides.

Next
After selecting the park to visit for each day, next comes selecting three FastPass for each park.

*Still ended up waiting for over an hour for the ride but it was worth it. Due to height restrictions, my daughter couldn't go so the wife stayed with her while my son and I went in. To our pleasant surprise, we got a FastPass that the wife used to get into the ride later without starting at the beginning of the line again. She waited just 30 mins compared to the normal 2 hrs wait.

**After 3 days of rides and shows, Epcot was indeed more relaxing and we didn't wait more than 10 mins for any show or ride thanks to our FastPasses. I wish we had more time to cover all the countries and the variety of food options. I understand now why some say it is their favourite park.


Play

A recent episode of CBC's Now or Never asked listeners to make their own Now or Never list. Its a checklist to help get things done. I decided to give it a try*. First question: "One thing I did as a kid that I’d love to do now is ". I filled in "Play". Few days later, I got an email from the show asking me to expand on that answer. Here it is:

As a child, playing occupied most of my time. When I wasn't playing (school, homework, tuition, chores), I was thinking of playing, or reading about it, or watching a game. Growing up in the 80s & 90s in India, football (soccer) and cricket were the two games I played the most both indoors and outdoors. I also played tops, marbles, flew kites, field hockey, chess, and others. Playing gave me pure joy. Scoring a fluke goal in football (school inter-class game), hitting a "full toss" for a "six", winning my first Chess game for school are some memories I still look back fondly. Of the hundreds of kites that I tried to fly on trespassed rooftops, I just got a handful in the air but it was worth the cuts to the fingers and the yelling I got.

Playing indoors is another memory I cherish because of the fun I had playing with my brothers and cousins. I got yelled at a lot for breaking things but I am grateful to my grandmother and parents for allowing us to play. One time, in an indoor cricket game, I was bowling to my brother Robert who hit the ball towards my father's plants behind me by the windows. One of the plants fell and I instinctively ran to it and caught it. Unfortunately for me, it was a cactus! My father was upset but didn't overreact (something I only truly appreciated after I became a father myself). This is one of my kids' favourite bedtime stories.

I also followed sports regularly on TV and magazines. Tennis (Sampras-era) and Formula 1 (Schumacher-Ferrari era) were the two sports I didn't play but followed regularly (cut-outs of Sampras kissing his Wimbledon trophy is probably still sitting in some scrapbook somewhere).

Watching Romario score a goal for Brazil in the Football World Cup, or Sachin Tendulkar hit a Six against Pakistan in Cricket, or a clean Sampras forehand winner, or Mika Häkkinen overtaking someone in F1 gave me thrills that words cannot describe. A couple of years ago, I rode the go-cart for the first time and I imagined myself in an F1 car trying to find the perfect racing line. It was fun.

The playing stopped around the time I got into university but the following didn't. Then came computers, marriage, immigration to Canada, making a life here, and I stopped following as well (except for the occasional "historic" game like Federer vs Nadal in the 2006 French Open final).

Things changed after my son was born. I started playing again with him (and still do to this day). He plays drop-in soccer at YMCA twice a week, started Shinny hockey last year and I enjoy watching all of it. Hockey is the only sport we both follow regularly and we do it with the same nerdy obsession like I had when I was a growing up. My favourite is the Leafs, followed by Penguins. My son knows all the jersey numbers of Penguins players and he will cheer against the Leafs just to irritate me but he likes the M, N, M (Awesome Mathews, Nylander, Marner). I can't wait for the NHL season to start.

*Online surveys are a pain but this was implemented using Typeform, the most pleasant online form filling system.