tomo's blog

10-minute Lua Tutorial: The Unique Points in a Nutshell

Lua is a simple language to learn, but with plenty of power. It is object-oriented, and supports functional programming, and supports multi-threaded programming. Lua was not designed to be run alone though, and you should have in mind some other program which uses Lua already when learning Lua. It was created to be embedded in other programs, to provide a scripting environment to glue and interact with the mother program (Example: Renoise, as well as many games and game engines). You have a reason for wanting to learn Lua already so let's jump in.

Control keywords


OpenShift (RedHat) PaaS and VPS options

Web developers need a server to host their websites or web apps. Shared hosting is a bad idea due to non-standard arbitrary limits, hosting companies messing with your files without asking, and lack of ssh access or any other ports. Cheap virtual private servers from DigitalOcean or Linode are good for anyone familiar enough with Linux (or FreeBSD with D.O.). But another option is the Platform-as-a-Service (PaaS).

OpenShift is a PaaS from RedHat. It is not a VPS, but also not a shared host. It is like Heroku or Google App Engine. You don't own the server and not even a virtual...

Choosing Shell script vs Python vs Node.js vs PHP for Server-side Command Line Scripting

After decades of improvements in graphical user interfaces, the Unix command line interface still remains the most powerful way to get things done for a lot of workflows. This is due to many reasons: the difficulty of quickly and precisely moving the mouse cursor compared to the ability of touch typists to select exactly what they want (even when it's via hotkey combinations), but mainly (IMO) the expressive power of composing separate Unix commands into one pipe-separated command operating on standardized files (usually text).

It's also easy to write your own Unix commands which...

Write PHP Code in English only: Unicode/UTF-8 and the BOM

First, a general introduction to the choices of human natural language within computer programming languages.

Since the beginning of time, programming languages supported the English language and only the English language, the English version of the alphabet, encoded as ascii characters [ok, not since the beginning of time but standard since consumer Internet support had solidified]. By ASCII I am referring to the lower 7-bit American character set. Even when foreign countries were using computers and began programming them, they would still use English programming languages, even...

The Conference vs. The Unconference

Unconference is a made up word which flips the structure of a conference to produce something better.

In the past week I went to 4 organized events, each a distinct style: 1) a hackathon, 2) a film festival, 3) a conference, and 4) a BarCamp. All events were related to technology, but the style of organization and level of participation varied as well as the objectives of te organizers. The hackathon was organized by my designer friend Vi (Studio BCA) and was for startups to get design makeovers from graphic designers. I mentored at this event. The film festival, the Bitfilm...

PhantomJS vs Selenium for scraping and automated testing

Now that I have a bit of experience with both PhantomJS and Selenium (for Selenium, mostly in its scripting contexts) here are some things I can share. All of this assumes we can use Selenium's WebDriver and script it to be comparable to PhantomJS because PhantomJS is a out-of-the-browser Javascript module (like Node.js) without a web UI shell like Selenium (in the case of Selenium IDE). WebDriver can be controlled from many scripting languages (and even compiled languages) like Python and even JavaScript. Assume that anything about PhantomJS also applies to CasperJS which is a wrapper for...

JavaScript variable scoping compared to C

For the most part, JavaScript looks like a C-like language in syntax. Lines end (optionally) with semicolons, conditional expressions are in parentheses (e.g. if (a == 1)), and blocks are surrounded by braces. But there are some huge differences in both syntax and behavior. JavaScript is weakly typed, and its object oriented programming is prototype-based, much different from C++/Java. And for someone who understands how memory for C variables is allocated, JavaScript has a number of surprises in its variables and variable scoping.

  1. There's no block-level scoping,
  2. ...

Adding Facebook sharing/liking buttons to Drupal 7 content

Drupal 7 Facebook Sharing Widget Module Decision Workflow:

  1. Do you just want Facebook or do you want every social media service under the sun (Twitter, Pinterest, Reddit, Google+, LinkedIn, etc.). There are a number of smaller services which are like Facebook for a niche. Some countries have their own, especially China. Other major social networks like YouTube or Instagram aren't places to share general blog content.
  2. Do you want to add a Like button or a Share button? People tend to Like things more than they Share. Likes across Facebook are aggregated/added
  3. ...

CSS is not Turing Complete

As more and more abilities are shoved into CSS (or into various preprocessors of CSS like Sass/SCSS | Less) you wonder how far CSS3 is from being its own programming language. The answer is: it's still not a programming language. And in fact it's not even a really crappy one, as it is not shown to itself be Turing complete. (Except for some variants of Internet Explorer which allow you to use expressions as CSS values, but this is not supported and highly recommended against for performance reasons.)

You may recall from theoretical computer science classes that Alan Turing (you may...

Selenium IDE vs Selenium Webdriver vs CasperJS

Or more specifically: Selenium IDE (Firefox plugin) vs Selenium Webdriver (Python and other languages) vs CasperJS (and PhantomJS or SlimerJS)

Selenium allows you, a programmer or non-programmer, to control a web browser and make it do things that you would otherwise do manually. With that ability, you can test your website over and over (and automatically from cron), similate users, or visit any number of web pages and read data (web scraping) on them and save to a file for processing.

If you go to the Selenium website you will...

tomo's blog | TECH.SAIGONIST.COM



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /home/tomo/web/ in drupal_send_headers() (line 1486 of /home/tomo/web/
  • Error: Class 'CToolsCssCache' not found in _cache_get_object() (line 32 of /home/tomo/web/
The website encountered an unexpected error. Please try again later.