You are here


Arithmetic & Logic Gate Algorithm Evaluator (ALGEA)


The algorithm uses the Shunting-Yard algorithm and applies the Reverse Polish Notation to traverse through an array of tokens, essentially a parsed mathematical expression (string).

Queue holds operands, evaluation of expression results, and operators including logical operators.

Stack holds the logical operators.

Interview Questions

These are some of the most common questions I have been asked and ask myself on interviews for LAMP positions. I will update these questions and possibly answer some of them on my spare time.

Something important: If you mention knowing something on your resume, expect to be asked about it.


Note taking questions.

Cross Domain Access to JSON Data Returned by Drupal's Hook Menu

In this article I will talk about how I access JSON data processed by a Drupal Hook Menu's page callback from a remote domain. The idea here is that sometimes we want to take advantage of Drupal powerful Hook Menu (hook_menu) system to register paths and handle the processing of data for that page request.



First, I'll add a menu item so that we can register the path that when access will return an object in JSON format. for this example, I will use the name mymodule to refer to the module where all the code will be saved.

Handle PHP & JavaScript Global Variables in Drupal

Declaring and accessing PHP and JavaScript globals is not as straight forward as I thought it would be. first of all I'm going to go over how I first tried to implement PHP and JavaScript global variables and then what actually worked for me in Drupal 5 and 6.

Handle PHP & JavaScript Global Variables in Drupal

The PHP documentation on global variables - can be found inside the Variable Scope section - implies that if a variable is used within the context of a global variable, then the scope of this variable will span to includes and required files.

cURL vs. getimagesize vs. file_get_contents


The geimagesize() function allows us to determine the dimensions of an image, as well as the file type e.g. JPG, GIF, PNG. and the HTTP Content Type. Though this function is listed under the GD and Image Functions, this function does not require the GD image library.


This function will return an array containing the image information including the HTTP Content Type or MIME type which helps deliver images with a valid content-type header, or FALSE if the image information was not retrieved.

Drupal Node API & Node Load

Node Load3>


Using the node_load function is really cool because it gives you access to all the data associated with a node, but excessive use of this function can be costly. There are several things we must know about what the node_load does.

First, all calls to this function will invoke all the hook_nodeapi functions defined by all modules that have been loaded at that point. The way node_load does this is by invoking the function node_invoke_nodeapi.