Tuesday, December 25, 2012

Implementing my Useful Resources Page part 2


This is the second part of my overview of how I implemented the Useful Resources page. This part focuses on the HTML and Javascript portions.

I'm using JQuery to animate the collapsible menus, as well as perform various selection and event handling tasks.

Tuesday, December 18, 2012

Implementing my Useful Resources Page part 1


So I'm going to go over some of how I implemented my Useful Resources page. This time I'm going to focus on the editing portion. This is how I add/remove/modify the structure of links and categories. I use an XML file for this. XML is a great way to represent hierarchical data, and is very easy to modify. I have a MySQL database which keeps track of shared data, for example if I want to use a sub-category's information multiple times. This is mainly done so I don't have to write the description multiple times if I happen to have say a Java sub-category in the Documentations and Manuals section as well as the User Groups section. I won't discuss too much about the MySQL portion this time.

Tuesday, December 11, 2012

SSE2 Vectorization Benchmarking Problem


Recently I was doing some testing into SSE2 vectorization. I was curious as to how it worked syntactically and what kind of performance I can expect.

SSE2 works by providing SIMD operations. This allows a single operation to manipulate lots of data. In the case of SSE2, we can utilize 128-bit registers which can process 4 single-precision floating point numbers at a time. At best in theory this gives a 4x speedup. However, there are other factors such as loading data into the registers and storing out the results which means in practice sse2 vectorization will provide less than 4x speedup.

My initial tests were producing strange results, though. I was getting some speedups pushing 5x and higher. So let's investigate what's going on.

Tuesday, December 4, 2012

EclipseNSIS Plugin


I recently found a plugin for Eclipse which allows me to create NSIS installers for Windows. It's called EclipseNSIS, and so far I've found it quite useful.

To test it out I created a simple installer which would install a registered COM DLL file.

Tuesday, November 27, 2012

Setting up a LEMP Virtual Server part 3


This is the third part of my LEMP virtual server setup. This portion involves installing the NginX web server, MySQL database, and PHP software.

Tuesday, November 20, 2012

Setting up a LEMP Virtual Server part 2


This is the second part of my LEMP virtual server setup. This portion involves configuring various virtual machine settings. I'll also go over the basic setup for SSH and SAMBA access.

Tuesday, November 13, 2012

Setting up a LEMP Virtual Server Part 1


Recently I was in the process of setting up a LEMP virtual server. The idea was to have a private web server that I could play around and test with. Since I didn't have a spare computer to host my server, I decided to go with a virtual server. A LEMP server consists of:

  • Linux Operating System
  • NginX Web Server
  • MySQL Database
  • PHP5 dynamic webpage scripting

For those familiar with the more common LAMP server, the LEMP server is a slight modification. It uses the NginX Web Server instead of the Apache Web Server. There are a few key benefits of using NginX over Apache. The primary claimed benefit is that NginX scales better to large server loads. I haven't verified this claim myself yet, but there are various benchmarks online which seem to back this claim. The great thing about the setup I have is I could easily setup a LAMP server as well and compare the two.

In this part I'm going to go over the various setup required on the host machine and Virtual Box settings, as well as installing the Ubuntu operating system.

Here's a few of the details for the virtual server I'm setting up:

  • Virtual Box for the virtual machine software.
  • Ubuntu 12.04 LTS 64-bit Server OS. Note that at the time of this writing the latest version of Ubuntu is 12.10. I'm not entirely sure what the technical differences between the two are. Ubuntu 12.10 is advertised to have the latest technology, but it isn't a LTS (Long Time Support) version of Ubuntu, which Ubuntu 12.04 is. The LTS versions are supported for 5.5 years vs. the 2.5 years for non-LTS versions. This isn't a major factor for a private test server, but may be a deal breaker for production-quality/public servers.
  • Putty Telnet/SSH client for Windows. Note that for people using a Linux OS or any OS with good SSH support via the terminal you won't need a separate client.
  • MySQL Workbench for managing the MySQL database on my host machine.

Wednesday, November 7, 2012

Blogger Syntax Highlighting


One of the greatest features of any code editor is syntax highlighting. It makes code much easier to read. Luckily, there are several ways to add Syntax Highlighting to webpages, too. Like pretty much anything else on the web, you have two places you can perform the syntax highlighting: On the server, or on the client.

For server-side syntax highlighting there is the GeSHi tool written in PHP. For the client-side, there's Alex Gorbatchev's Syntax Highlighter written in Javascript. Both support a wide variety of languages and are fairly easy to use. There are pros and cons with each option.

A server-side solution obviously requires a server, and the server needs to be able host dynamic content.

A client-side solution doesn't need a server, but it does require the client to run a javascript program in order to get syntax highlighting. For most clients this is fine, but some clients, particularly older mobile clients, this can make your website fairly slow to load.

Because I want to use syntax highlighting with Blogger and I don't have access to the Blogger servers, the only option I have is a client-side solution, so I'll be using Alex Gorbatchev's Syntax Highlighter.

Note: at the time of this writing the latest version of Alex Gorbatchev's Syntax Highlighter is 3.0.83

Tuesday, September 25, 2012

Code Syntax Highlighting Test

This is a test of the code syntax highlighter created by Alex Gorbatchev.

Various Hello World Programs

C++ code

#include <iostream>

int main(void)
    using namespace std;
    cout << "hello world" << endl;

Java code

public class HelloWorld
    public static void main(String[] args)
        System.out.println("hello world");

Matlab code

% print numbers 1 through 10
for i = 1:10
    printf('%d ', i);

More Advanced Features

Different starting lines

if(a % 3 == 0)
    cout << "a is divisible by 0" << endl;

MathJax Test

I'm testing out the new MathJax functionality. This allows me to use TeX, LaTeX or MathML to display math equations. To learn more about MathJax, visit their website: www.mathjax.org

Basic tests

Equation \eqref{relations_ex} shows a basic relationship. \[ a \cdot{x} \le 5 \ge b y \label{relations_ex} \] Equation \eqref{frac_ex} shows an example of using fractions. \begin{equation} \frac{a + 2}{a + 1} \label{frac_ex} \end{equation}

Integrals and differentials

Equation \eqref{int_ex} shows an example using integrals. \[ y(t) = \int_{0}^{\infty} \! x \, \mathrm{d}t \label{int_ex} \] Equation \eqref{ode_ex_n} shows an example using differential equations using Newtons dot notation. \[ \ddot{y} - \dot{y} + p y = q \label{ode_ex_n} \] Equation \eqref{pde_ex_l} shows Leibniz's differential notation for a PDE (Wave Equation). \[ \frac{\partial^2 \! u}{\partial t^2} = c^2 \nabla^2 {u} \label{pde_ex_l} \]


An in-line equation: \(x = 5\). Equation \eqref{color_ex} shows an example with parts of the equation highlighted red. \[ \require{color} {\color{red}{x}} = 5 \label{color_ex} \]