Thursday, August 21, 2014

Ubuntu LTS 12 on VMWare Player Showing Multiple Columns of Identical Screens

Symptoms

After updating to Kernel 3.2.0.67 and reboot, my screen is showing three columns of duplicated desktop. 

Environment: 

  • VMWare Player 6.0.3
  • Ubuntu: 12.04 LTS, Kernel 3.2.0.67 (post upgrade version, I'm not sure what was the version before my upgrade)
  • The VM image was created way back in a very old VMWare Player, started from Ubuntu 10. It has been kept up-to-date by applying Ubuntu patches and eventually to 12.04 LTS. Turn out this probably was the root cause of all the troubles

Solution

After some Google search and reading up on posts, I was eventually lead to the following thread:
Guest display split into identical panes
Flip to page 2, on post 17 from thellstrom, there is the solution that worked for me. I used solution 1b mentioned in the post, and after reboot, everything is back to normal.

Cause

So, based on the article, root cause of the problem is due to VM created on old version of player with virtualHW version 7. I updated the config file from version 7 to 9, and everything appears to be working now.

Thursday, August 14, 2014

Wednesday, August 13, 2014

Lua in Visual Studio 2013


Build Lua for Windows using Visual Studio 2013 is a very straightforward task.

Project to build lua.exe:
  1. Create Project > Visual C++ > Empty Project
  2. Add Existing Item ...
    • Select all files under src except luac.c
  3. Project Property > All Configurations > Configuration Properties > C/C++ > Preprocessor > Preprocess Definitions, add: _CRT_SECURE_NO_WARNINGS

That is it.

To build luac.exe, simply repeat above steps. When selecting files, select all files, except lua.c.

Friday, August 08, 2014

JSmol Widget for ExtJS 5

Live Demo of JSmol Widget for ExtJS 5
Screenshot of the Demo Page Running in Google Chrome

Background

Jmol

Jmol is an open-source viewer for three-dimensional chemical structures, with features for chemicals, crystals, materials and biomolecules. Features include reading a variety of file types and output from quantum chemistry programs, and animation of multi-frame files and computed normal modes from quantum programs.

JSmol

JSmol is a JavaScript framework that allows web developers to create pages that utilize either Java or HTML5 (no Java), at will. This enables Jmol to display interactive 3D molecular structures on devices that do not have Java installed, or for which Java is not available (such as smart phones and some tablet computers, e.g. iPad) or has not been installed because of concerns for Java being a security threat.

I have used Jmol for a few years now. But, over the past few years, due to concerns of security threat? Running Java applet in a browse is getting harder and harder. Shelling out money to buy certificate for open source software is, well, at most a hard sell.

So, JSmol to the rescue, pure JavaScript HTML5 application, works on IE, Firefox, Chrome, and even iPad. What is the catch? At least it does not live well with ExtJS on the same web page. You will get weired error messages like 'Uncaught TypeError: Cannot read property '***' of null'. My guess is JSmol has changed prototype of some basic types.

Problem

  • Jmol:   can no longer be used in any major browser without compiling with a trusted certificate
  • JSmol: not compatible with ExtJS, and I suspect may have problem with a lot of other libraries as well

Solution

iframe! It gives the web page the needed firewall between ExtJS page and JSmol page.

I have implemented a basic ExtJS 5 Widget that will inject an iframe, then inject JSmol code to render molecule models.
Demo page source code:
Widget Source Code:

This widget takes JmolConfig object, and will pass it along to the JSmol app in the iframe. For details of the parameters, please refer to: Jmol JavaScript Object/Info.

One more thing, the component has a "safe" option. Because the code to inject JSmol to iframe does not work in Firefox and IE 9. If "safe" is true, it will simply set iframe src to a pre-existing page that host JSmol library. I used this page: A bare bone JSmol Demo Page. Problem with my page is that it is static and does not honor the JSmolConfig passed to the widget. Now it is up to you to pass along the JSmolConfig to a dynamic page.

Just for fun, below is a screenshot of Jmol's official demo from one of my computers.

Github: mirror master -> gh-pages


  1. Navigate to the project page
  2. To the left of branch dropdown, click "Compare, review, create a pull request";
  3. Select: Base: gh-pages, Compare: master
  4. Create pull request
  5. Merge pull request
  6. Confirm merge
Done!

Tuesday, August 05, 2014

Windows 3 Nostalgia

Must see for Windows 3 nostalgia. :) http://www.michaelv.org/, everything done using HTML, and actually works.
Calculator

Dos Prompt, try DIR

Media Player

Minesweeper, it works too!!

Notepad, you can even save the text file

Finally, where it all begins, Program Manager

Monday, August 04, 2014

Namespace in ActionScript (how to get ObjectProxy's object)

Example, to get raw object of ObjectProxy, your code has to be something like this:

var op:ObjectProxy = new ObjectProxy({a: 1});
var obj:Object = op.object_proxy::object; //get what you wanted 
obj = op.object; //you get undefined here

Actionscript's documentation did not show any namespace qualification. Flash builder's debugger will show correct content in "op.object". All these leads to confusion. So, hopefully this little note can save somebody an hour of head scratching.