Sunday, May 20, 2018

WebAssembly (WASM) with Go

This is the first time that I've tried to compile the Go compiler so I figure that I'll document it here for others who might be wanting to try WASM with Go before the official Go release in August.

The next release of Go (1.11) is scheduled for Aug and it will be first time WebAssembly (WASM) will be supported.  WASM will be a build target much like how one builds a binary for other machine and operating systems except that in this case the machine is a "virtual" machine that runs inside the browser.

I've been very excited for WASM and I've been eagerly waiting for the time when I can use Go to write WASM.  The branch for the 1.11 release has is now locked for only bug fixes so I figured that it might be a good time to try writing a WASM code with Go.

Note that this first release for WASM isn't going to be "production" ready.  I don't think it'll be very optimized and WASM itself is only at its MVP release it doesn't allow WASM code direct access to the DOM or the browser APIs so all calls is still going through JavaScript.

Unfortunately, as of this writing, the code in the Go repo doesn't work for WASM.  The work on WASM for Go is primarily being done by Richard Musiol (neelance), the author of GopherJS, so I decided to get the version Go from this GitHub repo.

First, you will need a version of Go on your system to compile the source.  The easiest way is to download and install the binary distribution from the main Go website.

Next, grab Go from neelance's GitHub repo and check out the wasm-wip branch.

git clone https://github.com/neelance/go.git
cd go
git checkout wasm-wip
Once you have the source, it's time to compile it.

cd src
./all.bash
If everything is built correctly then there will be a new "go" binary in ../bin.  Also, there are two files to help you get started with loading future WASM files in ../misc/wasm.

Create a test.go file:

package main

func main() {
    println("hello, wasm")
}
Compile to WASM with:

GOOS=js GOARCH=wasm go build -o test.wasm test.go
Make sure you're running the go command that you've just built and not the version that you installed originally.

In the same directory with your test.wasm file, copy over wasm_exec.html and wasm_exec.js from misc/wasm.

The browser will expect the test.wasm file to be served with a MIME of application/wasm so you'll need to add the following to your /etc/mime.types file:

application/wasm wasm
To run it in your browser, you'll need to have a web server.  Creating one with Go is easy, but you can also use Python with the following command.

python -m SimpleHTTPServer

Point your browser to your web server and load wasm_exec.html.  Click on the button and you should see "hello, wasm" appear in the browser's console.

Monday, April 16, 2018

Second ChromeOS tablet

Following Acer's announcement of the first ChromeOS tablet, HP followed with their version called Chromebook X2.  I've always believed that Chromebook makes for excellent laptops for the vast majority of use cases and ChromeOS might actually be a better OS for tablets rather then Android.  Of course now that ChromeOS can run Android apps I feel that's more true then ever.

I like that the Chromebook X2 can detach the keyboard versus what the Pixelbook does, although likely for my next tablet, I'm more likely to go with the Acer simply because I don't need the keyboard and the Acer is cheaper because of it.

Sunday, April 1, 2018

Looking forward to ChromeOS tablets

When it comes to Android vs iOS, I'm firmly in the Android camp.  Just like iOS, Android is used to power both phones and tablets, but I believe that ChromeOS might be a better OS for tablets which is why I'm very excited by Acer's announcement of the first ChromeOS tablet.  Even though Google touts Chromebook tablets as ideal for education, it's really ideal for general use of tablets.

Chrome has become a powerful platform for developing web applications and ChromeOS' performance, stability and security is perfect for a device that is used much longer then phone.  With the emergence of web assembly, I can see developers being more effective writing web applications and directing tablet users to those same applications as desktop users.

For me personally, I spent most of my time on the tablet using the Chrome browser.  Many of the Android app that I use are basically just the web application wrapped into an Android app, but for those time that only a native Android app is available ChromeOS can now run Android apps alongside web apps.

I think my next tablet might very well be a ChromeOS tablet and I hope to see ChromeOS replace Android in this space.  I also hope to see developers move towards web assembly and build more powerful web apps using languages such as Go (web assembly currently being worked on).

Saturday, March 3, 2018

Shadow of the Colossus Impressions

Shadow of the Colossus was originally released on the PS2, then on the PS3, and then remade for the PS4 to take full advantage of modern graphics.  I missed it on the PS2 and I pretty much missed all of the PS3 generation so I thought I should try it now on the PS4.


Did I miss out when I didn't play it on the PS2 or PS3?  I give my impressions here.

Wednesday, February 21, 2018

Persona 5 Impressions

Following Horizon: Zero Dawn, I decided to play Persona 5.  While not an open world game it still has a strong story narrative.  Although JRPG is often viewed as being a niche among gamers in the United States, Persona 5 seemed to have won over many US fans and is often named among the top contenders for Game of the Year.


Saturday, February 3, 2018

Accessories For Console Controllers

To keep things organized, I got some stands for holding the various game controllers that I have for the PS4, XBox and Switch.  There are many options out there, but these are the ones I got for myself because I thought they provided better organization and presentation.  I've been using all these in my set up and like each of them.

PlayStation 4


I have two black DualShock 4 controllers.  These have built-in batteries so they need a dock that can charge them.  Most of the ones I saw held the controller upside down to charge which I didn't like the look of so I bought the official charging station that is sold in Japan.

Unlike a lot of third party stations, this uses the port on the bottom of the controller to charge so the controller are sitting upwards.  It's a nicer look that matches how my other controllers are held.  Note that this is just for the DualShock 4.  There is one that can support both DualShock 3 and 4 but it doesn't hold it upright and requires an adapter.

Xbox One S


The Xbox One S controller have removable batteries so I use rechargeable ones that I swap in when power runs low.  For these controllers, I don't need it to be a charging dock.  I got the Gear controller stand in white that matches the controller colors I have.  Each stand holds one controller.


Nintendo Switch


The Switch is interesting because it has two types of controllers:  Joy-Cons and Pro.  Two of the Joy-Cons normally connects to the Switch itself so they don't necessarily need a separate stand.  I have the Switch in a protective case so taking out the Joy-Cons can be a troublesome so I got a second pair of Joy-Cons for my kids as well as a Pro controller that I normally use.  Thus, I needed a stand that can hold 1 Pro controller and a pair of Joy-Cons.

Fortunately, Power A came out with Joy-Con & Pro Controller Charging Doc for Switch that exactly fits my needs.

This charging stand has a built in connector that plugs into the USB port on the Switch's dock and the top of the unit has lights that indicates that it's charging and when each controller is charged.

Wednesday, January 31, 2018

Horizon: Zero Dawn Impressions

I'm playing a game with a strong female protagonist in an apocalyptical open world where humanity faces an uncertain future while fighting a horde of mysterious machine controlled by an unknown force that threatened its existence.  Nier:Automata Horizon: Zero Dawn has been consistently rated as the top game for the PS4 in 2017 if not the top video game for 2017 overall.



My SO told that it was time for me to move pass Nier:Automata and 2B so I looked for another game.  Horizon: Zero Dawn has been on my list for while so that's what I chose to play following Nier and while I was obviously poking fun that I went from one game to what might seem to be another similar game I just want to clarify that these two are completely different games that's only superficially similar in that it uses the post-apocalyptical world as a setting. 

Comparing PS4 Pro and Xbox One S

I got a Playstation 4 Pro this past holidays and after a few  months of playing I thought that I'd compare it to my XBox One S.

I was initially attracted to the XBox One S for it's hardware.  It supported 4K and 4K Blu-Ray and it had an HDMI-pass through input option.  The price was a bit cheaper then the PS4 Pro and there were enough games on it that I was interested in even if they weren't exclusives to the console (sports games like Madden, Tomb Raider, Final Fantasy XV, etc.).  I don't use consoles as a media hub even though that is a feature that Microsoft has touted about the Xbox One.  What I wanted was a gaming system for someone like me:  a casual gamer but one who grew up with video gaming.  While I was overall content with the Xbox One S, I wasn't always so motivated to play it.  Start-up time was slow especially for some of the games.  It doesn't support CEC-HDMI so I had to always find the remote to turn on the TV and speakers which is surprise given this is suppose to be a media and entertainment hub for both hardware and digital content.

Sunday, January 14, 2018

Nier:Automata Is a Great Game

I finished Nier:Automata (PS4) early this morning, but it isn't a game that one can just finish and immediately put away.  Its haunting story, characters and music stays with you even after you are done.  It wouldn't be a surprise if you went on Youtube afterwards to find out more about it because you don't feel ready to walk away from the world that Nier creator, Yoko Taro, has presented so beautifully.

Wednesday, January 10, 2018

Intel NUC from CES 2018

As I try to get over a cold at home, I'm glancing at the different products people are talking about at the 2018 Consumer Electronics Show.  One item that caught my eye is Intel's new NUC named Hades Canyon which will include AMD graphics rather then integrated graphics.

It's being touted as a VR-capable computer, but that's not what I'm looking for in a PC nor do I plan to do much gaming on it.  Instead, I look for small form factor PCs that can last many years, drive dual 4K monitor setups and have dual gigabit Ethernet.  The max memory is limited to 32GB which is one downside.  I would prefer it supporting 64GB and I don't know how loud the unit is.

It's something I'll be watching for when it goes on sale in the spring.