Sunday, December 31, 2017

Goodbye 2017!

It was a year of changes.

New work, new environments.

With so many new beginnings, it was a turbulent year.

All I can hope for is that 2018 will be a year where things start to settle down, and all those new beginnings start to bear fruit, no matter how small.

For a good year ahead. 🙏

Monday, December 25, 2017

Merry Christmas 2017

Wishing everyone a Merry Christmas!


I hope Santa visited and left you with the presents you wished for!

Tuesday, December 19, 2017

My prediction on what is going to happen

Just my own thoughts.

The GOP needs him to pass the tax cut bill. So they will keep him around until the bill is signed. And then, they are going to talk about impeaching him. He will then resign. The GOP will then say they are satisfied with the resignation, and call off the special counsel.

That way, everyone gets their tax cuts (some more than others), and no one goes to jail.

Just my own thoughts on what's going to happen. But it won't be happening before Christmas, so for those expecting a Christmas miracle, I think they will be disappointed.

Monday, December 18, 2017

Who is Snoke (spoiler)

(Spoiler alert: do not read on if you have not watched The Last Jedi)









So who is Snoke? Is Snoke really dead? At first, when Kylo Ren killed Snoke in The Last Jedi, I thought it was quite weird too. I mean, Snoke is supposed to be the main villain, and he dies in Episode 8? Then who is going to be the bad guy in Episode 9? But watching the above video, I think he may not be dead after all.

Here is what I think.

Snoke is actually the person who created the Jedi in the first place. And he also created the Sith to balance the Jedi. This can be seen from the symbol, which is light and dark, a balance, like the yin-yang symbol. He may even be the one who brought about Anakin, and Rey, to bring balance to the force.

Like in the video, it could be that Kylo killed a Force projection of Snoke instead of the actual Snoke. I mean, Luke can do a Force projection, so Snoke, who is powerful enough to use the Force to link up Kylo and Rey, must be able to do it too. In fact, he might even have anticipated Kylo betraying him (after all, that's what Siths are supposed to do... the apprentice kills the master to become the next master). That might have been what he meant in Episode 7 about "it is time to complete his (Kylo's) training."

Also, Episodes 7 and 8, seem to have some mirror-like link to Episodes 4 and 5. Since Emperor Palpatine only died in Episode 6, I think it is safe to assume Snoke, who seems to be Palpatine's equivalent in this trilogy, should only die in Episode 9.

Back to Snoke being the one who created both Jedi and Sith. With Palpatine and Vader both gone after Episode 6, there is an imbalance in the Force, with only Jedi (Luke) remaining. That may be why Snoke came back, to bring the Dark side back so as to balance the Light by corrupting Kylo. But at the same time, to maintain that balance, he made sure to create Rey as Kylo's counterpart.

So maybe, Snoke will return in Episode 9 to show everyone his role as the creator, who helps to maintain a balance in the Force. He is neither good nor evil; he trains whoever is weaker to help balance the stronger. He brought in Rey to make sure she confronts Kylo and grows stronger in the process. Episode 9 will likely be about how that balance is maintained, with the Resistance having to grow stronger, together with Rey, to balance the might of the First Order. I think we may see Rey and Kylo going their own ways at the end of Episode 9, each to further grow the Light and Dark sides respectively to maintain that balance. And Snoke will then go into the shadows, once a balance has been struck.

What will it actually be? We will all know in 2019!

Saturday, December 16, 2017

After watching Star Wars: The Last Jedi


Okay, not going to talk a lot about this since many have yet to watch it. I watched Star Wars: The Last Jedi yesterday when it opened in the theaters here.

It is a stunningly well made movie with great effects (what else can you expect from ILM?), although at two and a half hours, it is a bit long, with the pace of the movie slowing down quite a bit at some points. Still, a wonderful movie for Star Wars fans.

Like Star Wars: The Force Awakens, there were many scenes which basically reenacted scenes from Episodes 4 to 6. I won't talk about which scenes; that would be giving spoilers. It gave me mixed feelings. On one hand, it is honoring the past episodes by reenacting them, saying that they are masterpieces worthy of being copied and hard to surpass. On the other hand, there is always the hope that sequels will bring in something new, instead of reusing the old success formula.

The balance in the Force, between Light and Dark. That seems to be the underlying theme in 7 and 8. Still, we have to wait for Episode 9 before we know what this trilogy is really about. Meanwhile, fans can look forward to the next movie on Han Solo.


ASUS G550 rebooted

My ASUS G550 has been given a new lease on life with a SSD and the following Linux command:
dd if=/dev/sda of=/dev/sdc bs=64K conv=noerror,sync status=progress

The old HDD has been removed, the new SSD placed in, and everything seems to be working fine. Next is to delete the stuff on the old HDD and use it as a portable external disk.

Saturday, December 09, 2017

Bad buzz is better than no buzz

I think it is about TV coverage.

The media is going to cover news. But the truth is, there isn't really a lot to cover; good things take time to happen. So the way to get media coverage is to create your own stories for the media to pick up. Talk and talk, and the media will be forced to check and check, and point out what is not true. But the effect is, you get air time. Whether they are showing the fake stuff being said, or pointing out the fake stuff, the end result is the fake stuff gets shown on TV, gets printed in the news.

And that's what is important. Because once something gets covered by the media, it reaches a wider audience. Bad buzz is better than no buzz. And sometimes, even the worst of buzz can get the right supporters if it reaches the right audience. And the media offers that kind of reach. It is the media that is inadvertently helping to spread that support.

The simple way to deal with a liar seeking attention is this. When he tells the truth, print it on the front page. When he does something that benefits people, print it on the front page. When he tells lies, print them in a small corner hidden deep in the papers. Just say "he said this, but the truth is this." Short and simple. Call him out, but don't go after him. Because going after him gives him more coverage than he deserves.

Friday, December 08, 2017

Please show the proper respect on the anniversary of the attack on Pearl Harbor

Donald Trump To Veterans: Pearl Harbor Was A Pretty Wild Scene | The 11th Hour | MSNBC

How hard can it be to pay proper respect to the people who died serving their country? How can he even get it wrong? These are people who fought in the war for their country. That guy can't be fifty; he served in a war that took place more than 70 years ago. And don't imply they are only worth alive while you are the President.

😠

Where is Ivanka?

Ivanka has disappeared.

She is supposed to be fighting for the rights of women. But amid all these recent events about politicians and sexual harassment, she has only spoke up on the issue once, at the very beginning, and has gone silent ever since.

I guess making sure she receives her inheritance is more important to her than making sure women receives their rights.

😞

Thursday, December 07, 2017

If the people are divided, they cannot fight back

Trump recognizes Jerusalem as Israel's capital

Coupled with tweets showing the wall prototypes being built, pushing the GOP to pass the tax cuts, pulling out from the Paris Accord, release national monuments in Utah back for development, and all the other stuff, I think he is just trying to save his skin.

Trying to show people that he can get things down, so that they will continue to keep him in office instead of removing him over the controversy. I mean, look at the news. He is so shrouded in controversy, the only way to get people away from him is to keep dividing the people. As long as people are divided, they cannot get together to oust him out. And that seems to be his strategy, if he even has one.

Who will have the moral strength to do the right thing?

Tuesday, December 05, 2017

Weird dream

Had a weird dream last night.

I dreamt I was retaking my GCE 'O' Levels at this ripe age, passed it, and got posted to a JC (not the one I actually attended). Given that I didn't have a school uniform, I had to make one (some weird design, blue on top and white below). Before reporting to the JC, I bumped into an ex-classmate. Seemed like she retook her exams at this ripe age too, but even though she passed, she chose not to go to a school. She decided to go on with life to do what she wants.

Then I went to the JC, there was some orientation talk at the lecture theatre, but I did not go in. Wandered around. Then I called my mother, told her I am not attending the school, and walked out.

And then I woke up from the dream.

I wonder if there is any meaning to this dream...

Monday, December 04, 2017

Time to end the nonsense

Every time I read his tweets, I only shake my head more and more.

There has never been a leader more divisive.

And it is now time to end this nonsense.

The way to do this is to downplay the party line. In fact, do not even let it seem like it is a face off between the two parties. Appeal to the good senses of the people elected by the people to do the right thing for the people. Appeal to them to ask themselves: is this the person they really want to be representing them on the global stage?

Look into our hearts. We all know what it is. Vote with your heart, not with your party. Because this is no longer about party policy. It is about a person who does not care about his party in the first place, doing things against his own party, openly going against his own party, openly criticizing his own party. The party owes him nothing. The party owes it to the people, and to the party, to do the right thing, before things get even worse.

It is not about which party is in power. It is about doing good for the people.

It is time to end this nonsense.

Sunday, December 03, 2017

Shrouded in controversy... karma?

Shrouded in controversy.

Obama's administration was shrouded with the question about his birth, created by the very vocal Donald Trump. But Obama had his birth certificate to prove the allegations to be false. Of course, when you have truth on your side, you don't really need to worry.

Now, Trump's own administration is shrouded in controversy, with the allegations of collusion with Russia. Some would call it karma. And like Obama, the only way to push away those allegations is with the truth. I just hope he has the truth on his side.

Because the truth will eventually come to light. And the longer you keep the truth hidden, the bigger the impact when it comes to light.

Sometimes, it is better to cut losses... but that's probably not going to be easy for someone who only admits defeat when he goes bankrupt.

Saturday, December 02, 2017

Slowly, step by step, one by one

As he circles around, watching.
Rounding them up, one by one.

The prey knows the predator is looking. The predator is waiting. The predator is slowly making his move. But the prey doesn't know when he will strike. And that strikes fear.

And fear can be a paralyzing force...

Waiting for Mueller to make his next move...

Friday, December 01, 2017

Congressman pledges vote to impeach Trump

Looks like it is going to happen.

House Dem pledges vote to impeach Trump next week

As Russell Peters would say, "Be a man, do the right thing."

Thursday, November 16, 2017

Gamespot video about The Elder Scrolls series


Just a quick note to share this video by Gamespot about The Elder Scrolls series, one of my favorite CRPGs. I started with Daggerfall, then Morrowind. Subsequently discovered Arena when it was made free for download. Then got both Oblivion and Skyrim when I got The Elder Scrolls Anthology.

Enjoy the video! 😄

Tuesday, November 14, 2017

App to manage books

I was thinking of making an application (desktop or Android) to help manage the books I have. One that can scan ISBN bar codes, then automatically fetch the details about each book from the Internet, plus allow for manual entries if the details cannot be found.

While doing a bit of background research into the tools for creating such a program, I instead found some Android apps that can already do this. A more promising one is Book Catalogue, which seems to be able to fulfill my needs. Although it seems to lack Japanese and Chinese support, which is a downside since I have books in English, Chinese, and Japanese. Still, will be giving it a try.

What attracts me is the project is actually open source. You can get the source code here from GitHub. Which means I can try tweaking it to query Japanese and Chinese sources if I can find the appropriate APIs. But that is something I will be putting off for a while. First, let me try the app... 😅

Wednesday, November 08, 2017

Self-driving cars and learning to drive on the other side of the road

Waymo now testing its self-driving cars on public roads with no one at the wheel

So now, cars have learnt to drive on public roads in the United States.

The question, though, is how easy it willl be to train these cars, originally trained to drive on the right side of the road in the United States, to drive on the left side of the road. Do we need to repeat the entire training process, this time with videos of driving on the left, and actual time spent on roads driving on the left? Or can the process be a simpler one?

At present, I would think the answer is probably closer to the former. But I hope someone can look into this to see how we can find an answer to perform the latter. Because the latter is closer to human intelligence. I learnt driving, and obtain my driving licence driving on the left side of the road. But when I had to drive in the United States, I did not retake my driving lessons to learn how to drive on the right side of the road. I just drove a bit more cautiously for the first hour or so to get used to driving on the right. Will we be able to achieve this in a machine?

Thursday, November 02, 2017

The Trumpette is in Japan

Smurf. Smurfette.
Bachelor. Bachelorette.

Well, the Trumpette is here in Japan. Let's see how good she is at blowing her trumpet.

😄

Friday, October 20, 2017

"Ever Onward" IBM song

Just a short post.

For those nostalgic about the 1980s and wish to hear the IBM song "Ever Onward" running on BASIC, you can find it on YouTube!

"Ever Onward" - The IBM Song (in GW-BASIC)

And if you are looking for the source code in BASIC, I found it in the archive of a forum post.
The link given is here, which leads to a ZIP file containing many BASIC programs.
http://www.baudband.net/downloads/xt_games.zip
IBMSONG.BAS is under the GAMES directory of the ZIP file.

Enjoy!
 
Update March 31, 2022: I managed to use this program called bascat to extract the BASIC listing.
 
4  WIDTH 80
5  ON ERROR GOTO 9500
6  PLAY ("P64")
10  GOSUB 9000
30  B$=CHR$(2)
40  DIM N$(165)
50  DIM L$(15)
60  DIM B%(253)
70  X% = 165
80  FOR I% = 1 TO X%
90  READ N$(I%)
100  NEXT I%
110  RESTORE 790
120  FOR I% = 1 TO 15
130  READ L$(I%)
140  NEXT I%
150  RESTORE 960
160  FOR I% = 1 TO 253
170  READ B%(I%)
180  NEXT I%
181  PRINT "(Press any key to begin.)";
183  IF INKEY$ = "" THEN 183
190  CLS
200  FOR I% = 1 TO 9
210  PRINT : PRINT L$(I%)
220  NEXT I%
230  R% = 1
240  S% = 1
250  B1% = 0
260  FOR I% = S% TO 165
270  C% = B%(I%+B1%)
280  IF C% > 0 THEN GOTO 310
290  C% = -C%
300  R% = R% + 2
310  LOCATE R%,C%
320  PRINT B$
330  PLAY N$(I%)
340  LOCATE  R%,C%
350  PRINT " "
360  NEXT I%
370  IF B1% = 0 THEN 380
371  LOCATE 21,1
372  PRINT "Transcription of music and lyrics from a copy of a copy... of 'Ever Onward,'"
373  PRINT "and program written by Alden B. Johnson."
374  RUN "MENU"
380  B1% = 88
390  S% = 78
400  CLS
410  COLOR 0,7
420  LOCATE 1,30
430  PRINT "Second Chorus"
440  COLOR 7,0
450  LOCATE 3,1
460  FOR I% = 10 TO 15
470  PRINT L$(I%)
480  PRINT
490  NEXT I%
500  R% = 2
510  GOTO 260
520  END
530  DATA MF T170 L8 MN O3 B4,B8,O4 D4,D8,O3 G4,G8,B4,B8,E4,E8,E4,E8
540  DATA ML E4.E4 MN P64,E8,F#4,E8,D4,E8,F#4,G8,A4,A#8,ML B4.B4.B4. MN P64
550  DATA D4.,B4,B8,O4 D4,D8,O3 G4,G8,B4,B8,E4,E8,E4,E8,ML E4.E4 MN P64
570  DATA F8,F#4,E8,D4,E8,F#4,G8,A4,B8,ML G4.P64,G4.P64,G4.G4 P64 MN,G8
590  DATA F#4,F#8,A4,A8,O4 D4,D8,O3 A4,A8,F#4,F#8,A4,A8,ML O4 D4.D4 P64 MN,D8
610  DATA D4,D8,D4,D8,D4,D8,D4,D8,D4,C8,O3 A4,F#8,D4.
630  DATA O3 D4.,E4.,F#4.,G4.,F#4.,G4.,G#4.,A4.,G4,A8,B4,G8
650  DATA A4,B8,A4,G8,E4.,ML E4.E4 P64 MN,E8,D#4,E8,G4,F#8,F#4,F8
670  DATA F#4.,F4,F#8,A4,G8,G4,F#8,G4.,F#4,G8,B4,A8,A4,G#8
690  DATA A4,E8,F#4,G8,A4.,ML A4.A4 P64 MN,D8,C#4,D8,G4.,G4.
710  DATA ML G4.G4 P64 MN,D8,E4.,F4.,ML G4.G4 P64 MN,G#8,A4,A8,A4,B8
730  DATA O4 C#4,C#8,O3 B4,A8,O4 ML D4.D4.D4 P64 MN,C8,O3 A4,F#8,D4.,E4.,F#4.,G4.
750  DATA F#4,F#8,G4,G8,G#4,G#8,A8,G#8,A8,B4,O4 C8,D4,E8,O3 B4.,A4.
770  DATA ML G4.G4.G4 MN
790  DATA"There's a feel-ing ev'ry where of big-ger things in store. Of new hor-i-zons"
800  DATA"com-ing in-to view. Our aim is clear: To make each year ex-ceed the one be-fore"
810  DATA"Stay-ing in the lead in ev'ry-thing we do. The will to win is built right in."
820  DATA"It will not be de-nied. And we will go a-head we know by work-ing side by side."
830  DATA"Ev-er On-ward, Ev-er On-ward That's the spir-it that has brought us fame."
840  DATA"We're big but big-ger we will be. We can't fail for all can see that to serve"
850  DATA"hu-man-i-ty has been our aim; Our pro-ducts now are known in ev'ry zone."
860  DATA"Our rep-u-ta-tion spark-les like a gem, We've fought our way thru and new"
870  DATA"Fields we're sure to con-quer too for the Ev-er On-ward  I B M"
880  DATA"Ev-er On-ward, Ev-er On-ward We're bound for the top to nev-er fall."
890  DATA"Right here and now we thank-ful-ly pledge sin-cer-est loy-al-ty to the"
900  DATA"cor-por-a-tion that's the best of all. Our lead-ers we re-vere,"
910  DATA"and while we're here, Let's show the world just what we think of them!"
920  DATA"So let us sing men, sing men, once or twice then sing a-gain for the"
930  DATA"                              Ev-er On-ward  I B M"
960  DATA 3,9,12,17,21,23,28,32,36,39,45,50,55,60,64,68,71,74
980  DATA -2,6,9,12,17,22,26,29,34,39,43,48,53,57,61,66,70,73,78
1000  DATA -2,3,7,10,14,18,22,26,28,32,37,40,45,49,53,57,60,65,71,75
1020  DATA -1,6,10,13,16,20,26,29,33,37,40,43,47,51,55,59,64,68,72,77
1040  DATA -1,4,7,11,16,19,22,26,32,38,43,46,50,55,61,66,70,70
1060  DATA -3,8,12,16,20,23,27,31,35,40,45,50,54,58,62,66,70,75
1080  DATA -1,5,8,10,14,18,23,27,27,32,36,40,46,50,55,59,63,65,70
1100  DATA -2,6,9,11,15,21,26,30,34,37,43,49,55,59,63,68,72
1120  DATA -3,10,15,19,23,27,32,36,40,44,46,49,53,58,60,62
1140  DATA 1,4,7,11,16,19,22,26,32,38,43,47,51,54,58,61,66,66
1160  DATA -3,8,13,17,20,25,30,33,38,44,48,52,56,59,62,65,69
1180  DATA -2,6,9,12,18,24,28,32,36,36,41,46,50,53,56,60
1200  DATA -2,7,13,18,24,30,35,40,45,50,54,59,63,68
1220  DATA -1,5,8,12,17,22,27,32,36,41,46,51,55,58,63,67
1240  DATA -31,34,37,41,46,48,50
1250  END
9000  COLOR 7,0
9010  KEY OFF
9020  CLS
9030  DIM H$(9)
9040  H$(1)="In the legend of IBM, there are tales of a ritual frequently performed"
9050  H$(2)="long, long ago in sales meetings, far, far away.  This ritual involved"
9060  H$(3)="young salesmen and centered around a small book of chants, or songs.  It is"
9070  H$(4)="said that these songs were a source of great inspiration to the salesforce"
9080  H$(5)="as it prepared to go out into the world. Although this ritual is no longer"
9090  H$(6)="practiced, one of the songs has nevertheless survived, being copied and"
9100  H$(7)="passed down through generation after generation of IBMers."
9110  H$(8)="The IBM Philharmonic Computer presents:"
9120  FOR I% = 1 TO 8
9130  PRINT H$(I%)
9140  NEXT I%
9150  COLOR 0,7
9160  LOCATE 9,25
9170  PRINT CHR$(201);:FOR I% = 1 TO 30:PRINT CHR$(205);:NEXT I%:PRINT CHR$(187)
9180  L$ = CHR$(186)
9190  L1$ = L$ + SPACE$(30) + L$
9200  LOCATE 10,25:PRINT L$+"       IBM Rally Song         "+L$
9210  LOCATE 11,25:PRINT L1$
9220  LOCATE 12,25:PRINT L$+"         ";
9230  COLOR 15,0:PRINT"EVER ONWARD";:COLOR 0,7
9240  PRINT "          "+L$
9250  FOR I% = 13 TO 20: LOCATE I%,25: PRINT L1$: NEXT I%
9260  LOCATE 21,25:PRINT L$+"    Written especially for    "+L$
9270  LOCATE 22,25:PRINT L$+"       IBM Corporation        "+L$
9280  LOCATE 23,25
9290  PRINT CHR$(200);:FOR I% = 1 TO 30:PRINT CHR$(205);:NEXT I%:PRINT CHR$(188)
9300  COLOR 7,0
9340  RETURN
9500  CLS
9510  PRINT "This program requires ADVANCED BASIC; Please reload, using BASICA"
9520  END

Thursday, October 19, 2017

Computers teaching themselves to do something

And so we have come to this.

First, DeepMind managed to get a computer to learn how to walk.
Producing flexible behaviours in simulated environments

Now, it has gotten a computer to learn to play Go from scratch, and gotten so good at it, it beats everyone and everything else in the world.
AlphaGo Zero: Learning from scratch

It begs the question: What is intelligence?
Is intelligence the ability to learn something on one's own? If so, monkeys learning to use a stick as a tool for digging out ants from an anthill would qualify as intelligence, right? A shark learning to hunt for fish is intelligence too, right? But if intelligence is something that equates to being human, then we need to better define intelligence. And then see how it applies to AI.

And the other question: What is life?
Is life defined by the ability to replicate itself? If so, computer viruses, so good at replicating themselves, are alive.

At the end of the day, what does it mean to be human? Will there be a day when computers ponder about the meaning of their existence?

Tuesday, October 17, 2017

Popular ≠ Good

A good leader is effective and popular.
A popular leader, however, may not necessarily be good or effective.

A good show will have good ratings.
But a show with good ratings may not necessarily be a good show.

I just hope people making decisions remember this.

Monday, October 16, 2017

Will it snow?

The weather, so cold.
It is raining, behold.
Will it snow?
I don't know.

* It is really cold today, for mid October (which is supposed to be autumn here in Japan). The temperature is closer to winter, and it is drizzling with a breeze.

Saturday, October 14, 2017

MAGA by going back to 2008

I think Trump's idea of a great United States is 2008.

Because he is getting rid of everything Obama has done from 2009 to 2016. Resetting the U.S. back to 2008.

"Making America Great Again" should be appended with "Going Back to 2008."

Can someone please hit the reset button and put us back to 2016...

Wednesday, October 11, 2017

1980s Usborne computer books made free for download!

Wow! I actually missed out on this story, but Usborne has made their 1980s computer books for kids free. You can download them here.


The books were written at a time when computers came loaded with BASIC, with each computer having their flavor of BASIC. A good bet if you want to run the programs in these books would be to find something that can run BBC BASIC, or a BBC Micro emulator. Or if you own one of these machines like the Apple II or Commodore 64, you can dig it out from the storeroom and see if it boots.

If you want to run BBS BASIC on a modern day machine, try BBC BASIC for SDL 2.0 or BBC BASIC for Windows.
If you want to run these programs on a BBC Micro emulator, give JSBeeb a try. You can find its code at GitHub which includes instructions on how to run a local copy.

Try searching the Internet for emulators of other machines such as the ZX Spectrum, the Commodore 64, the Apple II, and the TRS-80.

Ignore childish remarks

The best way to deal with childish behavior is to ignore it.

If the media keeps publicizing it, he will only enjoy the media attention, and keep on doing it. But if the media ignores it, he will sooner or later realize that throwing childish remarks will not get him the media attention that he craves.

So please, ignore the childish remarks. Focus on the real issues. Show what is happening in Puerto Rico. Talk about the tax reform plan. Look at the details of healthcare proposals. Talk about gun control laws. Don't get sidetracked by childish remarks meant to divert attention away from the real issues.

Don't lose the forest for the trees. Don't lose the war just to win a battle.

Sunday, October 08, 2017

Trump and North Korea

At this point in time, I seriously believe Trump is going to lead the U.S. into a war with North Korea.

Why?

Trump has made remarks about North Korea and its leader. He has made known his belief that past diplomatic efforts were "failures," and that he "will not fail." His remarks and tweets only help to reaffirm my belief that he is serious about his thoughts.

Couple this with the recent issues with Secretary of State Rex Tillerson. Trump has openly gone against Tillerson's diplomatic efforts (through Twitter, for that matter). And the report that Tillerson called Trump a "moron." Trump was reported to be very mad about this. And he is likely to want to prove that he is not a moron. He will need to show that he is better than Tillerson. He needs to show that he is right, and Tillerson is wrong. And one way to show that is to attack North Korea, to show that his talk about tough measures is the right way, while Tillerson's diplomatic method is wrong.

This is a slippery road. Here, war is being used not as an extension of policy by other means. It is being used in place of policy, when there are other methods available. It is being used for personal egoistic purposes.

I just hope Secretary of Defense Mattis and COS Kelly can find tactful ways to prevent rash action. I hope they are not blinded by military loyalty and can see beyond the immediate.

I guess the best we can all do, in the meantime, is pray.

Wednesday, October 04, 2017

Advanced Tactical Fighters and ATF: NATO Fighters

"Get down to Waypoint Bravo, descend to angels six."

Back in the 90s, the Jane's name meant realistic military simulations. Following U.S. Navy Fighters and Marine Fighters, Jane's Combat Simulations: Advanced Tactical Fighters was added to the series. This was followed by an expansion, ATF: NATO Fighters.

Like the predecessors, this game and its expansion featured fictitious campaigns in different parts of the world, allowing the player to fly some of the most advanced military aircraft (including the B-2 Spirit). You may be flying combat air patrols, escort missions, ground attacks against tanks, etc. You can also create your own quick missions if you just want a quick dogfight, or design more complex pro missions. The in-game library also features extensive information about the various aircraft and other military assets in the game.

Although the graphics may not look anything as impressive as modern games, this old game has good graphics and gameplay for its time. The models are realistic enough that the game is still enjoyable for combat flight simulation fans today. If you are looking to just fly the F-22, FlightGear may be a better bet. But if you want to fly the F-22 and shoot down Sukhois, ATF is still a good choice today.

Wednesday, September 27, 2017

One more year, and different again

Yet another year has gone by.

This past year was one with changes again. I guess change is a constant.

Hopefully, things will change for the better!

Thursday, September 21, 2017

U.S. Navy Fighters and Marine Fighters

I used to love playing flight simulations, and U.S. Navy Fighters, and the subsequent expansion Marine Fighters were favorites. They were packaged together as a single U.S. Navy Fighters Gold (still running under DOS), and remade into Jane's U.S. Navy Fighters '97 for Windows.

The original game featured a fictitious campaign in Ukraine flying mainly the F-14 Tomcat, while the Marine Fighters expansion added a campaign in the Kurile Islands and VSTOL aircraft such as the AV-8B Harrier II. The Windows version added a Vietnam campaign.

The flight models were highly authentic (for those days) and the graphics were good. Flying without a joystick was possible but not as enjoyable. And since not every player is a trained fighter pilot, the game throws in various "cheat" options to make the game easier to play.

I used to spend hours on end "flying" these missions, and now, with DOSBox, I get to relive those days again!

Thursday, August 31, 2017

A viable alternative

Just a thought as I look at Japan, the US, and my own country Singapore.

The opposition always has something to say about the ruling party. But whatever the flaws of the ruling party, it is still in power. Why?

I guess this has to do with the opposition, actually. Not the voters being fooled by the ruling party or anything. While there may be some irrational voters, at the end of the day, most voters are rational and will vote for whichever party they see as providing best to their needs. And when everything looks bad, they will pick the lesser of two evils.

So if the opposition really wants to come into power, it needs to provide a viable alternative, one that can work. They must be able to provide a solution that is better than what the ruling party is or aims to provide. Otherwise, why bother to have a token opposition representation in parliament? That token opposition will not be big enough to do anything. In a crude way of putting things, it is like masturbation. You feel good, but it is not the real thing.

Any political party that wants to come into power needs to provide a working solution that is better than all other options out there. Simple. Else no one will vote for you, since it is not going to really matter. Voicing disagreement without the power to do anything is meaningless.

Wednesday, August 23, 2017

Back to Afghanistan

The U.S. is going back to Afghanistan. Instead of leaving.

In the words of someone, this is "so sad."

History has shown that if you let the generals fight a war, you are going to end up in trouble. Because war is not just about military action, but is a national effort that combines military might with economic, political, diplomatic, and even cultural efforts. It is a comprehensive package, and it cannot be just about "killing terrorists."

Killing terrorists alone will not end terrorism. It will only breed more terrorists to take their places. A proper strategy to eliminate the reason for their fight needs to be adopted in order to settle this issue for the long term. Yes, killing terrorists will rid them for the time being. But that is only until the next batch of them can be trained. Then you have the whole cycle again. And again. And again.

But if you can rid the reason for their fight, you stop the recruitment flow. That breaks the cycle.

By all means, listen to the generals. But also find people who can help you think up of a comprehensive strategy that will take care of the issue in the long term, rather than win the current fight. Don't win the battle but lose the war. That's what happened in Vietnam.

Monday, August 21, 2017

Another collision?!?!

10 US Navy sailors missing after destroyer collides with merchant ship

Not again?!

This is unbelievable. Four accidents in 2017, and we still have more than three months to go before the end of 2017.

One incident may be poor luck, two may be bad judgment, but when you have four, then it is more likely a systemic issue that needs to be thoroughly studied to know what is the root cause (or causes). And then a proper system put in place to right it.

As an ex-naval officer with experience in navigating congested waters and working in safety- and training-related posts, reading such news is painful to me. Such accidents don't have to happen. Things can be done to properly train people so that they don't even get into anything near such circumstances. The key is not to train people to respond to such situations. It is to train them so they don't even get into such situations.

I hope the US Navy gets its act together soon, before more have to die or get injured. Let me know if you need help. Being based in Yokohama now, I can easily get down to Yokosuka and talk with the people at 7th Fleet.

Wednesday, August 09, 2017

Happy 52nd Birthday, Singapore!

Happy Birthday, Singapore!

52 years of independence. And many more to come!

Plus, this year marks the 50th year of National Service! NS50!

Sunday, August 06, 2017

72 years since Hiroshima

72 years have gone by.

72 years since human history changed forever. 72 years since the first atomic bomb was dropped on Hiroshima.

I hope we continue to remember this day. And may it never happen again.

Wednesday, August 02, 2017

Conning America

Someone really should write a book on Trump and how he is conning America.

Conning, in both senses of the word "con."

To con a ship means to be at the helm and to steer it. Which is befitting Trump since as the president, he is the man in charge of steering America.

There is another meaning for "con" for which Trump appears to be doing, with his campaign promises and what he has delivered to date.

So "Conning America" is going to make a great title for a book about Trump's presidency. You can even add in "The truth about the Trump presidency" as a sub title for the book.

All we need now is someone to pick up on this, do the research, write the book, and get it published.

Maybe Stephen Colbert or Trevor Noah?

#ConningAmerica #StephenColbert #TrevorNoah

Thursday, July 27, 2017

Horrified by tweet

The morning started with this horrifying set of tweets.

 
I don't know what medical costs he is talking about, but I don't think being transgender affects how decisive a person is. And opening serving as transgender takes a lot more courage than what most people have.

If you want decisive and overwhelming victory, you should be looking at how to attract the best people and how to keep them, rather than worry about what's between their legs. Kristin Beck is transgender, but that did not stop her from being one of the best military personnel, making it to serve on the Navy SEALs. There are many more serving now who are just as effective as any other trained military personnel, and the least the top guy can do is not distract them from their duties.

If it is about medical costs, well, there are a lot of other conditions that require medical attention. Does that mean all these people are banned from serving too? According to some sources, transgender people serving in the US military may cost the military up to 8.4 million USD annually. Compare this with the 41 million USD spent annually on Viagra.

So when will people wake up and do the right thing to save the US. I hope it is soon, before it is too late and there is nothing left to save.

Monday, July 10, 2017

A new industry of fact checkers

Ever since Trump has entered the news running for president, there has been a whole new industry of fact checkers. No doubt there had been fact checkers in the past. It is a part and parcel of democracy for people to check if what someone said is true, and to expose any untruths. That is what free speech is about too. And therefore, people do check what they say beforehand so that they don't risk having someone come out and saying "that's not true."

But ever since Trump came into the picture, with so many twists and turns and what have you, it seems the usual number of fact checkers just can't keep up. Mainstream media has to get teams of fact checkers to run through everything just to make sure what they report are factually correct. And people are taking to social media to bring out any untruths too, bypassing the mainstream media (which, no matter how hard they work, is still limited by the size of their budgets). We now have YouTube channels dedicated (almost) to exposing such untruths.

If anything, he has provided employment for some people: fact checkers. But fact checking is not productive work; it doesn't produce anything new. It will be better for society if such resources are channeled into other areas. But I guess as long as people are not as truthful as they should be, or as thorough in their own checks before speaking out, fact checkers will continue to be necessary, and this industry's size will depend on how prominent (or how large the scale) of such behaviour.

Friday, June 30, 2017

My simple answer to the grandest staircase problem

For those who have heard of the_grandest_staircase_of_them_all problem, this is my simple solution. However, it is not my final solution. My final solution is an optimized version of this. The bigger the value of n, the longer this version will take, since it is recursive and the recursions become deeper and wider when n gets bigger.

def answer(n):
    def times(x, y):
        count = 1
        for k in range(x + 1, y // 2 + 1):
            if k < y - k:
                count = count +
times(k, y - k)
            else:
                return count
        return count

    counter = 0
    for i in range (1, n):
        if i < n-i:
            counter = counter +
times(i, n-i)
        else:
            return counter
    return counter

Friday, June 09, 2017

Hope is hope... not!

When my boss tells me, "I hope to see the report tomorrow," I take it to mean that I better make sure the report is on his desk tomorrow or I will find myself without a desk soon.

When the mafia boss tells his underlings, "I hope that pesky reporter has an accident," his underlings are not going to walk away and drink beer. They are going to go and fix something up to make it look like an accident.

When wife tells husband, "I hope to have ___ for my birthday," boy, he better get ___ for her for her birthday.

Hope is hope only when there is no power relationship between two persons.

Tuesday, June 06, 2017

Japan offers to work with China on Silk Road initiative

Abe offers conditional cooperation with China's Silk Road initiative

China is probably laughing at this.

The Silk Road Economic Belt and the 21st-century Maritime Silk Road, also called The Belt and The Road in short, uses the name "Silk Road" because of its historic significance. The Silk Road linked China to India and Europe in the past. This led to the flourishing of trade and culture along the route. And historically, China has held influence (big or small, depending on China's domestic situation at each point in history) over states along the route. China had always sought to maintain security along the route, for the benefit of the trade and its positive effects on China's economy.

So naming this new initiative "Silk Road" is a blatant way of saying that it is for China's benefit, and it is going to be a way for China to influence nations along the route (actually, two routes; one land, one maritime). And in the past, states not directly on the route could still benefit indirectly if they bowed down to China. Japan was no exception; when relations were fine with China, Japan was able to obtain goods from Europe and India that came through the Silk Road to China.

Make no mistake: the new initiative is for China's benefit. Not solely; if you happen to be along the route, you will benefit too. But if you are not on the route, and you want in, you will only be included if it is to China's benefit. That is to say, you can only get in if you bring something to the table that China wants (like in the old days, when vassal states brought tribute to the Chinese emperor). So unless Japan can bring something that China can't resist (maybe some of the rare metals that they just found off Chiba)... well, China will just look at Japan and laugh.

Monday, June 05, 2017

PowerPoint makes us lazy

Or at least, that's what I think.

Because in PowerPoint, we usually write in point-form, and not full sentences. And we usually only write in the key points, without filling in the details on how we arrive at them, or how they link or lead to each other. All those details are usually verbally explained during the presentation (if there is one) or simply left for the reader to figure out (if there isn't an actual presentation and only the slides are sent out.)

This is not a problem if the slides are created based on a full document, properly written with all the details on how things were arrived at, and how they link to each other, etc. The slides are a summary of the key items, and readers can (and should) always refer to the full document to get a comprehensive idea of the issue being talked about.

But it is a problem if the writer starts right from PowerPoint, generating just the slides. While the key points are there, the writer might not have fully developed the idea, might miss out important (or non-critical but important) factors or aspects that would have been explored if he had started by writing the issue out as a document (be it essay, proposal, research paper, or even just as an email). Because grammar forces us to consider the relationship between objects and subjects, think about time (past tense, present tense, etc.), and how to link things together.

Long story short: use slides for what they were meant for, as a summary of a document. Don't be lazy, write the document, then develop the slides to help others better understand the document.

Friday, June 02, 2017

U.S. leaving the Paris Climate Agreement

And there you have it.

Trump has announced that the U.S. will be leaving the Paris Climate Agreement. All because it will cause the U.S. to lose jobs.

If jobs are lost because companies are not environmentally-friendly, I think the onus should be on the companies to comply with climate rules even as they take on production. Change their methods of production, look into what they are using for raw material, you know, make an effort. It may be a bit more costly, but in everything we do, there is a cost. That's the basics of economics. Companies either bear the monetary cost of environmentally-friendly production, or society will have to bear the social cost of pollution.

Personally, I think these rules are good. They force companies to think about the environment, so that they bear the monetary cost of production, rather than passing it on as social cost to society as a whole. Companies will find ways to be profitable no matter what the rules--necessity is the mother of invention. Instead of allowing companies to grow lazy and still reap profits at the expense of the environment, we should keep these rules to protect our environment, since companies will find ways to profit anyway.

Oh well, I am not the leader of any country, so I guess what I think or say doesn't really matter. Time will tell if decisions are sound. I just hope we still have an Earth by that time.

Monday, May 29, 2017

Generalists and specialists

As artificial intelligence develops to become even better at learning what humans can do, I think it is even more important for us humans to think about what we should do. What are the things that humans are good at, and what are the things that will eventually become things left to machines?

First, the success of AI in learning single tasks, and the greater difficulties with integrating things from a wider range of fields mean that humans will probably continue to have to be the generalists that binds together different fields of specializations to achieve an overall bigger objective. So we probably will continue to need managers with people management skills able to bring together a team of people with different talents to work on a project.

But how about specialists, people who are good at doing certain things? Well, the recent success of deep learning has shown that machines can now be trained to do certain things much much better than humans. That's because people get better at these things by doing them, and machines are able to devote a lot more time to doing this things repetitively to become better at them than humans. So machines are likely to replace cucumber sorters, since they can learn to do this offline (by training on pictures of cucumbers, which requires a lot less time than actually finding cucumbers to look at and sort), and once trained, they can be put to the actual sorting task for hours and hours without having to worry about labor laws about working hours. Compared to humans, they take less time to train, and can work for much longer hours.

However, we will probably still need specialists in which ability is not just gained by repetitive learning, but also requires some form of creativity. Although there is on-going work to teach machines creativity, based on deep learning techniques, these are still limited to training using a big dataset to try and generate something from it. It is evolutionary, not revolutionary. For that revolutionary break, we still need human creativity, and that is where humans will continue to find a niche for them to specialize in.

In short, as computer become better and better at mimicking humans, through advances in AI, humans will need to find a place for themselves. These could be as generalists, where AI is still unable to adequately mimic, or as specialists in fields requiring human creativity.

Wednesday, May 17, 2017

Two types of wargames

Recently, I have been reading a book about Japan's defeat in WWII. It led me to think about wargames in general.

To me, there are two types of wargames.

One is the confidence building type. The training type. Where the enemy behaves in much the way that current intelligence assesses he may behave. It is about executing a plan against a known enemy, to test the effectiveness of the plan, build confidence in the plan, and train people in how to carry out that plan.

It is the "winning" type of wargame. Where the good guys (the friendly side) is supposed to win. The enemy behaves like how we think he will behave (which may be close, or way off, depending on how good our intelligence and assessments are).

The other type of wargame is the "losing" type. This is when the enemy does what he can do, given the resources available to him. The difference is between can and may. "May" is about probability, about what he is likely to do. "Can" is about possibility, no matter how small, and is about what he is able to do. Here, the goal is to try to beat the good guys, to make the friendly side lose. This is to expose the weaknesses in existing plans, to expose areas which have not been considered in planning or were not answered. Here, consideration must be given beyond the military to bring in economic and politic aspects of war, since war is not a standalone condition and is part of a bigger grand strategy.

It is about identifying risks, military or otherwise, so that they can be dealt with.

But nobody likes to lose. Nobody likes to be shown his weaknesses. And it can be bad for morale too. So this type of wargame is rarely conducted. Yet it is just as important as the "winning" type. Only with both will you be able to be fully prepared for this dangerous feat known as war.

So I think what is important is that in a wargame, we must not be afraid of losing. Because losing helps to make the plan better. And it is better to lose in a wargame so that we can improve the plan, rather than lose in an actual war, by which time we won't have the luxury of time to improve the plan.

Wednesday, May 10, 2017

Facebook's grammar is...

Just when Facebook announced this new phase in their machine translation research...

A novel approach to neural machine translation

This came up in my Facebook feed.






"Rain is forecast."

Somehow, it doesn't seem right to me. I would think it should be "Rain is in the forecast" or "Forecast is rain"... I mean, we say "sky is blue" but not "blue is sky", right?

Then it got me thinking. Maybe Facebook got their forecast for Yokohama from a Japanese source (which only makes sense, right?). Which means it was in Japanese. Which means it was then translated automatically by Facebook's machine translation software into English to put this on my feed. Which means this shows the current state of Facebook's state-of-the-art machine translation for Japanese to English.

I guess I still have time to earn a living as a translator.

Monday, May 08, 2017

We need fats to give birth to the next generation

A thought that came to mind a while ago.

Humans and companies are quite alike in a certain way. Both need fats in order to be able to give birth to the next generation.

For humans, females need a certain level of body fat in order to have normal reproductive functions. When there is not enough fat, reproductive functions cease, which means they cannot give birth to the next generation.

Similarly, companies need fats (not the oily kind, but as in having some form of abundance or excess of something) so that they can devote part of their resources towards training and education to nurture their next generation of people. If companies are so caught up in the day-to-day work that they have no time or money to put into nurturing their people, they will not be able to sustain their operations.

While this is a simple analogy, I think it shows how important having some form of abundance is. This even shows itself in artificial societies. In the Sugarscape model, agents need to gather a certain amount of resources before they can "reproduce". This is the "excess/abundance" that we see in the real world, whether biological or financial. A good reminder for myself in any future research into artificial societies.

Thursday, May 04, 2017

Star Wars Day - 40th anniversary

Today is Star Wars Day!

This year marks the 40th anniversary of Star Wars. Wow! 40 years!

May the Force be with you!

#Maytheforcebewithyou #StarWarsDay

Sunday, April 23, 2017

Beauty and the Beast (2017 film)

An incredible story. An amazing story. A story that has continued to capture my heart since the day I first saw it in 1991. The live remake of the 1991 animated film adds to the story by trying to clarify Belle's and the Beast's childhoods, although I felt that these parts weren't really necessary since it was already a great story to begin with.

What really captures me is the story, about not being afraid to live life as you are (even if you are the only girl in the village who can read) and to look beyond appearances ("for who could learn to love a beast?"). Both the animated film and this new remake combines a great story with great visuals and amazing music.

Yet another great work by Disney that will touch your hearts and bring tears to your eyes.

#BeautyandtheBeast

Tuesday, April 18, 2017

Some thoughts on artificial intelligence

Enabling Continual Learning in Neural Networks

This is an article about a month ago from DeepMind. It does seem that we are getting a bit closer to being able to use artificial neural networks (ANN) to replicate the learning that takes place in the human brain.

And I think that is where the problem lies.

We are trying to replicate the human brain, but is the human brain the best model for learning?

An example. My eight-year-old son and I both watch the same Star Wars movie together. Yet he can recall a lot more details (the scenes, the people, even the music) about the movie compared to what I can recall.

If what DeepMind is doing is a hint, it may mean that our brains are also trying to optimize the limited synapses (although the number of synapses in the brain is way beyond what any ANN has now) in the brain. Which means that once we have used our brains to learn a certain amount of things, any additional learning is going to mean readjusting the connections (weakening our memories in some areas) to learn those new things.

Going down this road, it suggests that making machines think and learn like humans may not be optimal, as the way our brains learn has a serious flaw--it needs to weaken our ability to recall what we have already learnt, in order for us to learn new things.

If only there is some other way to learn things without having to forget what we have learnt. Well, for our mortal brains, that may not be an option, but it is something that we can try in our attempts at giving intelligence to machines. And I think that is the Holy Grail of artificial intelligence--to arrive at a model for machine learning that surpasses the human brain.

#DeepMind #AI

Friday, April 14, 2017

Pay and productivity

OECD urges Japan to promote labor reforms; calls wage growth 'muted'

Just wondering.
Maybe the Japanese work overtime because of poor pay. I mean, if they are productive and finish work within office hours, they actually earn less money than if they were unproductive, work overtime, and clock overtime pay doing the same work.

Maybe, just maybe, raising wages will both improve productivity and reduce overtime.

U.S drops "mother of all bomb" on Afghanistan

U.S drops "mother of all bombs" on ISIS caves in Afghanistan

Yet another move by the Trump administration. But again, what is the overall strategy? We all know that military strikes alone don't work. If they did, it would have worked long ago. What is the overall strategy that Trump has to deal with ISIS? Does he even have a strategy, beyond "blow them when I feel like it"?

Sunday, April 02, 2017

A simple solution to a scrolling text window in wxPython

This is a very simple solution I found to implement a scrolling text window in wxPython.

The problem is trying to set a StaticText widget to fit into some form of scrolling widget so that a large amount of text can be displayed in a scrolling text window. After trying out many methods, not getting the results that I want, I managed to find a solution. Which is to use a read-only multi-line TextCtrl.

self.textpanel = wx.TextCtrl(panel, 
                    style=wx.TE_MULTILINE|wx.TE_READONLY)

Then, to set the text, just use:
self.textpanel.SetValue(s)

That's all! Just two lines of code.

No need to mess with ScrolledPanel or ScrolledWindow. I tried those, they do work, but it is a bit more complicated.

Wednesday, March 29, 2017

There goes another one, as the Earth goes out to applause

Trump signs order dismantling Obama-era climate policies

Goodbye Earth. It was nice knowing you.

And you should know that the end started with people clapping.

Using PyInstaller

The other day, I wrote about using Cython to create an executable file. Well, as expected, it does create a smaller executable file, but it depends on the user having the required DLLs already installed on the system.

Which may not be an option for end-users who are not that computer savvy.

In my search for a good way to package software for distribution to end-users, I came across PyInstaller. It is actually one of the easiest ways to package Python code for distribution.

Simply install PyInstaller using pip.
pip install pyinstaller

Then, use PyInstaller to package the Python script into a Windows executable file. I prefer to make this a single standalone exe file for easy distribution, which is easily done with the -F option. And you can even embed an icon for your exe file, using the -i option.
pyinstaller -F -i my_icon.ico my_script.py

This creates my_script.exe which contains the required DLLs together with your Python code, and end-users can easily run the file by typing:
my_script

Oh, and if it is a non-console program, just add the -w option to get rid of the console window.
pyinstaller -F -w -i my_icon.ico my_script.py

To make use of the embedded icon, add
        if sys.platform == 'win32':
            exeName = sys.executable
            icon = wx.Icon(exeName, wx.BITMAP_TYPE_ICO)
            self.SetIcon(icon)

to the __init__() method of your wx.Frame class.

Easy, single line way to package Python code for distribution to end-users. But of course, the exe file can be quite big since it contains the DLLs (including python.dll to run your Python code). And it doesn't protect your code, people can still reverse the process to get to your code. Still, it is a simple and fast way to get code out to people who just want to use them.

Tuesday, March 28, 2017

Trump's legacy?

Just penning it down, in case it really happens. Haha.

I think eventually, Trump's legacy will be: put up many many bills, but none of what he promised will go through, and so he is unable to keep any of his election promises. The U.S. just continues to run as it has, based on existing policies (that's what the bureaucracy is for, to keep things moving). And at the end of four years, with no promise kept, he will just blame everyone else for not passing the bills he put up. It is not his fault, but the people who refused to work with him to make the changes that he is proposing.

He won't question why the people won't cooperate with him, he won't doubt his proposals, because those proposals must be great (after all, he signed them). So it has to be everyone else's fault for refusing to accept these great proposals.

Oh well, I guess the U.S. can survive the next four years without collapsing. It won't do well, but it probably won't collapse.

Meanwhile, others will be using those four years to get ahead...

Monday, March 27, 2017

My trinity of code optimization

In conservation, there is the trinity "reduce, reuse, recycle".

In code optimization, I also have a trinity: code, data, results. Basically, it is about balancing the reuse of these three.

Reuse code. Your code should be as short as possible, and that means reusing as much as you can. But this should not be at the expense of code readability, unless you really really need that small pinch of extra speed.

Reuse data. Once data has been loaded, reuse it as much as you can so that you maximize the I/O cost of loading that data in the first place. Of course, this must be balanced with the amount of data you keep in memory, with the actual amount of memory that you have. On most modern computers, for most day-to-day tasks, this should not be a problem, but for complex computing problems with large datasets, this may not be as easy as it seems.

Reuse results. There is a computing (and maybe I/O) cost to calculating results. So when possible, results should be kept in memory so that they can be reused when necessary, instead of recomputing them. Again, this needs to be balanced with the amount of memory you have.

So there you have it. My trinity of code optimization, which is basically a balance between reusing code, data, and results. But though it may sound easy, achieving a good balance is actually not an easy thing to do.

The art of negotiating

Trump thinks he is good at negotiating. After all, he thinks he is a successful businessman, and has negotiated many successful deals in the past.

But business deals are not the same as political ones.

In business deals, the main factor is usually about maximising the profits for all stakeholders. And the stakeholders are usually two companies, or in some cases, a handful of them.

But in political deals, the situation is usually a lot more varied. Money is no longer the sole consideration; there are now a thousand and one stakeholders, all having different political aims, ideals, non-monetary interests, and their own opinions on how things should be done. Throw in diplomacy and you have to consider history, cultures, traditions, economic backgrounds, and other national interests.

The things you need to consider for the most difficult business deal pale in comparison to the simplest of political ones.

So while a person may be a successful businessman with many past successes in negotiating business deals, the political arena is a different monster altogether.

The key is in how to apply one's past experience in the business world into the political one. And that really depends on how fast a person can learn and adapt. To learn about his new environment, and adapt his past experiences to that new environment. And it takes a humble person to do this, to be willing to admit that he or she needs to go back to the basics and learn from scratch this new environment.

And being humble is not easy, especially for people who have been successful to date.

So to those who wish to succeed: be humble.

Saturday, March 25, 2017

Compiling Cython output into Windows executable

 I have been playing around with wxPython and trying to work on simple applications. The problem is how to distribute these programs easily to other people. On Windows, that means creating executable exe files. After searching through StackOverflow, and trying out various things on my own, I finally found a few ways. I will talk about one of them, which produces the smallest executable file so far. By the way, PyInstaller is easy to use, but it will generate a much bigger file.

1. First, convert the icon file that the application will be using into Python code using the script img2py.
img2py -i my_icon.ico my_icon.py


2. Copy and paste the contents of my_icon.py into my main wxPython script, which I shall call my_script.py here. Then, add the following to the __init__() method of the script's main wx.Frame() class. By the way, I got this method of doing things from Michael Driscoll's post here.
ico = my_icon.GetIcon()
self.SetIcon(ico)


3. Convert the Python script into C using cython.
cython my_script.py --embed

4. Use cl.exe from Microsoft Visual Studio to compile the C file into an exe executable.
cl.exe /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python36\include -Ic:\Python36\PC /Tcmy_script.c /link /OUT:"test.exe" /SUBSYSTEM:WINDOWS /entry:wmainCRTStartup /MACHINE:X64 /LIBPATH:c:\Python36\libs /LIBPATH:c:\Python36\PCbuild

By the way, the options
/SUBSYSTEM:WINDOWS /entry:wmainCRTStartup
are needed to suppress the console window from showing up. The generated C code may use main() instead, which means you may need to change the options to
/SUBSYSTEM:WINDOWS /entry:mainCRTStartup 
to link it properly.

This should give you a test.exe which you can run.

If your script is a console script, you can just skip steps 1 and 2, and remove the /SUBSYSTEM and /entry options.

The problem with this method is that you will likely need to distribute required DLLs with the executable file.

Meanwhile, I will continue to test out various ways to generate an executable that is fully standalone and yet small in size.

Tuesday, March 14, 2017

My love for programming

I really love programming.

Once I start, I get very engrossed in it. I think it is because to me, writing a program is like solving a problem. And when I have a problem, I try to solve it as best as I can. So when faced with a programming problem, I try to come up with the solution, working on it, troubleshooting bugs, trying to improve the solution (aka program), and before I know it, hours have gone by.

So it will really be a dream come true if I can make programming a career. I mean, it means I will be working at solving problems all the time, in a way that is interesting to me. Because I like to try out different ways to improve my programs.

Any one needs a piece of software developed?

Tuesday, March 07, 2017

People don't like to admit their mistakes

Con Man Don: what behavioral science teaches us

Quite an interesting read on how the campaign was a big scam, and how it continues on. And I guess with all that accusing going on, it is probably true. Although Trump probably never trained as a con-man, or intended to be one, how he ran his campaign, and his presidency, is a good example of the kind of person he is.

And the worst thing is, people don't like to admit their mistakes. Most people don't have the courage to face up to themselves, to admit that they were wrong. Instead, they will defend their decisions (no matter how wrong, or nonsensical) even if they know that they had made a wrong choice.

So now we are stuck with this guy for the next four years. Four years of watching The Apprentice, except that this time, it is on every channel, and there is no way to switch to watching something else if you don't like the show.

Thoughts on "Congress will investigate Trump's wiretap claims"

Congress will investigate Trump's wiretap claims

I do hope the Congress investigation digs up all the skeletons in the closet.

And the American people should realize that every time Congress (or some other public body) goes off investigating any claims made by this person, public funds are being spent. And if it turns out to be a witch hunt, then public funds would have been wasted.




Tuesday, February 28, 2017

Is deep learning about what you train on?

In simple terms, deep learning is about using a series of artificial neural networks in multiple layers to form representations of data. The math behind it is a bit more complex, but it is more or less about adjusting the weights and biases linking the various neurons in the network so that for a given input, the calculated result gives a certain output.

Usually, we use a set of random initial values for the weights and biases, and through training (basically, feeding in many many sets of inputs, comparing the outputs of the network with the expected outputs, and adjusting the weights and biases if the two are not the same), arrive at a network that has a set of weights and biases that can more or less given us an expected output when we feed it an input.

The training data used to train the network is usually a very large set of inputs and their corresponding outputs (aka correct answer). And most of the time, there is no order to this set of data; it is like a huge random collection with no fixed order.

But if you think about it, if these artificial neural networks are trying to simulate our brains, with each layer learning an abstraction of the data, then maybe we should be training these networks in a similar way to how we train our brains.

What I am suggesting is this: start off with a set of simple data (simple pictures that you find in children's books, simple sentences or words, etc.) and allow the network to make big adjustments to the weights and biases as it trains on this set of data. This is like how children learn basic concepts with easily influenced minds.

Next is to slower increase the complexity of the training data, while reducing the amount of changes (learning rate) that can be made to the weights and biases. Eventually, we should be training the network with real-world data. The whole idea is to train the network as we would train our own brains, in increasing level of complexity.

The tedious part here is to segregate existing training data into differing levels of complexity. It may be easier to just create new datasets, but datasets are usually huge and therefore time-consuming to generate anew. But with Amazon Mechanical Turk, it may not be that difficult after all. Maybe some researcher somewhere can pick up on this idea. Hopefully, I myself will be able to work on this idea to test it out (but first, I need to get a better computer, hopefully one with TITAN X).

Wednesday, February 15, 2017

Promoting my blogs

Ever since I started my blogs in 2006, I haven't really been actively promoting them. Instead, my belief was that if my readers find the contents useful, they will share them with others.

But I also started blogging so that I can share my thoughts and experiences with a wider audience. Which also means that I am not meeting my aim if useful contents are not reaching out to people.

So I have decided that I will be a bit more proactive in promoting what I have written (or will write) in my blogs, so that more can benefit from these thoughts and experiences. Of course, I will try to be as selective as I can, so as to avoid spamming people. We all know that it is a thin line that separates advertising from spam.

Saturday, February 11, 2017

On the reopening of the case of Pedra Branca's sovereignty

Reblogged from my Facebook post:

I just went through the application documents on ICJ site, the three documents submitted are not likely to be significant... in fact, I think it is quite a joke.

Document 1: The reference to Horsburgh Light is part of an entire string of references to denote the proposed international passage corridor through the Singapore Strait. From one end to the other. And Horsburgh Light is mentioned because it is used to denote the South China Sea end of the strait. It is hard to see how this links to thinking about sovereignty, but I guess not everyone can understand the Queen's English which was used in the telegram. (sarcasm fully intended)

Document 2: Quite a joke. The entire document does not give specific latitude/longitude position of the ship in question. "Near Horsburgh Light" can mean different things to different people. Near can be 1m, 100m, 1km, 1nm, 5nm, and in any of the 360 degrees of the compass. And all who ply that part of the sea knows the distance between Horsburgh Light to the Malaysian coast is not that far in the first place. Exactly where was Labuan Haji?

Document 3: Seems to be a document on curfews and no fishing zones to protect mainland Singapore from infiltration from Indonesian side. This is during the period when we were seeing Communist activities, and just prior to Konfrontasi. I don't think security forces on Singapore were worried about Horsburgh Light being infiltrated as much as the entire coastline that we have facing south. By the way, the map does not show Pedra Branca in the first place. Maybe it was in another part of the document... we won't know unless we have the whole document in full, instead of just a single page that shows the main island of Singapore.

Thursday, February 02, 2017

Backing up decisions with facts

Since Trump has taken office, an amazing number of presidential orders have been issued within a record period of time.

It is great to have a person who can make decisions and act on them, but one must also remember that any decision made by a person in office needs to be backed up with facts and supporting data, usually obtained through thorough research and background checks.

Orders need to be both legal and lawful. Legal means they are issued in accordance with the existing legal framework. Lawful means they are in accordance with existing laws, rules, and regulations, as well as the gist behind those laws, rules, and regulations. This is because not everything about how a law came into being makes it into the text, but every law in place has something that it was meant to protect, some of it explicitly stated, some implicitly implied, and some simply left to the good judgment of people executing the laws.

So an order to "kill Person A" can be legal, if it was drafted and approved by the correct people within the legal framework. But it is not lawful, if the law says it is illegal to kill someone.

At the amazing rate orders are being churned out, my only (and biggest) worry is whether enough research and background checks have been done to gather the facts and supporting data that led to the decision. Because while the orders may be legal, insufficient supporting information to back up those decisions may well render them unlawful.

Tuesday, January 31, 2017

Personal opinion: The gloom that is the shipping industry

We have all heard about the shipping industry, how freight rates are dropping, and ships are waiting without cargo. Having been in the navy, I have actually seen those ships anchored out in open waters (so that they don't have to pay charges for being in harbour) as they await instructions on where to go.

There really is a lot of excess cargo space.

Simple demand and supply tells us this: if supply is constant, and demand goes up, price increases. If demand goes down, price decreases. And in the shipping market, where it takes a while for supply to change (you can't build a ship overnight), we can safely assume that supply in the short term is a constant. Which means prices will and do fluctuate based on demand, which changes a lot more quickly based on the market needs in different countries.

But that doesn't mean supply doesn't change. It does. When prices go up, shipping companies will want to reap themselves more profits, and so they try to increase their supply of cargo space. Simple math: if I have 200 tons of cargo space being sold at $1000 per ton, and I see that demand is rising, I will want to increase my cargo space, maybe to 300 tons, so that I can earn $300,000 instead of $200,000.

But the problem is, building ships is a long term investment, and there is a life cycle cost to it. So shipping companies usually rely not just on their own ships to meet the market's demands, but also lease additional ships when necessary to meet high demand periods. The good thing about leasing is that the shipping companies do not have to bear the life cycle cost. I mean, it is the same thing as leasing office equipment. You just pay for what you need.

However, things like ships don't disappear just because they are not being leased. They hang around, and for the case of ships, they hang around for quite a while (like 10 to 15 years, if not more). So when global demand for sea freight is high, and shipping companies build ships, and others build ships to lease to shipping companies, the overall supply of cargo space in the world goes up. Which is necessary since that much cargo space is needed to move goods around at that point in time. But global demand does not always remain high. And when demand drops, we are left with ships lying around.

This is not a problem if demand doesn't fluctuate that much. Which is usually the case, since no one doubles or triples their demand for food or oil overnight. Right? Actually, no. There was actually a sudden and huge increase for sea freight demand in the mid 2000s. This drove up prices so high, it attracted many many many people into the shipping market. People started to build a lot more ships, thinking that the demand will continue and hoping to reap profits out of it.

And so when demand suddenly dropped, we were left with many ships (and lots of cargo space) on hand, and many more ships being built in the shipyards (and these ships, when completed, will further add to the cargo space supply, more than those ships being retired and scrapped). And when there is excess supply, with demand more or less the same, prices drop. Simple microeconomics.

And prices may drop so low it goes below operating cost, which means shipping companies are operating at a loss. Those without huge reserves or other forms of income will soon go bankrupt, like what actually happened to some already.

It is not an easy problem to solve. Simple thinking tells us that we have excess supply, which drives down prices. So why can't we just artificially limit the supply? Push down the supply to a level such that it drives prices up to an acceptable level to break even with the operating cost. Simple, right?

Wrong.

One is the practical part. Unlike a cup at home, where you can keep in storage when not in use, ships can't just be stored like that. They need to be regularly maintained even if not in use, else they will rust away (literally). And even finding space to store them is an issue. If you keep them in harbour, you incur wharfage. If you keep them out at sea, you need to put people on them (so that the ship doesn't drift to unknown waters, or worse, drift into something and then you end up having to pay for damages). So there is a cost to keep them lying around.

And no one wants to drastically reduce the number of ships they have. After all, if demand does go up again, they want to have the capacity to meet that demand, and it takes time to build a ship.

Even if one company artificially tries to limit its supply, there is no stopping its competitors from doing otherwise. I mean, let's say a group of shipping companies sat down, and decided, "Okay, let's all sell at $1000." There is nothing stopping one of them (or all of them) from selling at $900 (or less) just so that they can secure more orders. And they can all do this because they have the excess cargo space to take on those additional orders.

So this is what we end up with. We have many ships, no one wants to get rid of them, and no one trusts each other enough to try and sell at a higher price. So until the supply starts to reduce (over time, as ships get scrapped), prices are going to depend mostly (if not fully) on the demand, and with demand as it is now and in the foreseeable future, I think the current situation of low shipping rates will continue for quite a while more. Analysts, especially those in the shipping industry, try to see things in a more complicated, and optimistic, way, but the simple truth is there are too many ships, and no one wants or dares to do anything about them. And since no one likes to bring bad news to the boss, there will always be people trying to give optimistic predictions. But as an outsider, my take is that it will be a long while before prices go up, and good luck to all ship owners until then.

(Why we ended up with so many ships is another issue altogether, brought about by non-traditional players entering the shipping market when prices soared. But it will take another article to fully talk about that issue.)

Monday, January 30, 2017

Where is meritocracy going?

Trump is closing doors to the US for certain groups of immigrants. And adopting economic policies that will put Americans first (which I think is something that every country does, they put their citizens first), but in a way that may limit competition.

If you ask me, competition is the way human beings improve. Fair competition is also what allows meritocracy to survive. If people are not allowed to compete on fair terms, the best will not be rewarded; we are instead rewarding those who may not be as talented or as hardworking.

If we believe that people should be rewarded for how hard they work, and how much they contribute to society, then we need to lower or remove any form of unfair assistance to certain groups of people.

In the long run, by sheltering the American people against fair competition, is Trump helping them to grow, or is he helping them to stay complacent within their own comfort zones? And ultimately stagnating growth?

How do we balance a certain level of assistance so that everyone can survive at a certain acceptable level, yet still provide room and incentive for competition, so that people continue to want to improve?

Friday, January 20, 2017

A common set of experiences

For an education or training institution to be truly great, it must create a set of common experiences that spans generations. So that every generation that passes through the institution has a common set of experiences that they can relate to, which binds them to graduates before and after them, and not just those from the same batch.

This is the binding glue that makes an institution beyond networking with the people who attended it with you. The same common set of experiences allows you to connect with those before and after, greatly expanding the network that you can build beyond your own batch.

And this is what makes a great education/training institution. Because it now is just a place of learning, but a place where you can build strong ties with not just those who attend the course with you, but with all those who have gone before you, and all those who will come after you.

That is the true power of an alumni.