Archive | General

General
10 May 2012 2 Comments

An Introduction To Java Web Applications

Introduction

A Web application is an application that is accessed over a network such as the Internet or an intranet. While the earliest websites served only static web pages, dynamic response generation quickly became possible via CGI scripts, JSPs (JavaServer Pages), servlets, ASPs (Active Server Pages), server-side JavaScripts, PHP, or some other server-side technology.

Java has become a popular language for creating dynamic Web applications over the last 15 years, due to the introduction of servlets, JSP, and frameworks such as JSF and Spring. In this post we give an overview of these technologies, and explain the the major differences between them.

Building Blocks

For the sake of simplicity we distinguish three types of Web application building blocks: servlets, JSPs and frameworks

Servlets

In Java, Web applications consist of servlets. A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP. An example of a servlet that takes a request and returns a page with the numbers 1 to 10 is given below.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
 
public

Tags: ear, enterprise edition, framework, , jar, , , , jsp, servlet, standard edition, tomcat,
General
8 August 2011 8 Comments

An Introduction to Hard Disk Geometry

Introduction

This page describes the typical layout of a modern hard drive. You may have heard of file systems such as NTFS, FAT32 or EXT3, which are used by your operating system. Concepts like files and directories are contained in these file systems, so obviously they are very important. But a single physical hard disk can contain multiple filesystems – each on a separate partition. And a hard disk that contains a operating system must contain some elements that play a role in the boot sequence.

Obviously a lot more is going on under the hood. Let’s take a look.

Anatomy of a hard disk

Hard disks have been around since the 1950′s, but the design has not changed much. The general hard disk design is quite simple, consisting of only a few moving parts. In the picture above you can see:

  • Platters: Solid disks with a magnetic coating that contains the data. The platters spin at a constant rate when the hard disk is in operation,  typically at 3600, 5200 or 7200 rounds per minute (rpm).
  • Arms: The head stack assembly holds the arms that hold the read/write heads. The stack is rotated by an actuator which is not displayed in the image, causing the arms to position the heads between
Tags: arm, ATA, ATA-7, BIOS, chs, cylinder, dma, hard disk, head, IDE, lba, logical block addressing, platter, sector, track, udma
General
10 June 2011 1 Comment

A Summary of IP Addressing Types

This is a summary of IP addressing types. We look at unicast, broadcast, multicast and anycast addressing of IP packets, and also describe the destination MAC addresses for each case. Some of the text and all of the images are courtesy of Wikipedia, I just added my comments.

There are four forms of IP addressing, each with its own unique properties:

Unicast

Available in: IPv4 and IPv6.

 

The most common addressing scheme of an IP address is unicast addressing – available in both IPv4 and IPv6. It normally refers to a single sender or a single receiver, and can be used for both sending and receiving. Usually, a unicast address is associated with a single device or host, but it is not a one-to-one correspondence. Some individual PCs have several distinct unicast addresses, each for its own distinct purpose. Sending the same data to multiple unicast addresses requires the sender to send all the data many times over, once for each recipient.

  • Most browsing traffic from your Internet router to your computer will be unicast TCP or UDP traffic; if you do a search at google.com the search results are sent only to your computer.
  • Any application that uses TCP must use unicast IP addressing,
Tags: anycast, , destination IP, , gateway, ip addressing, , , unicast
General
17 February 2011 0 Comments

Two Great Hex Editors, and How to Highlight and Bookmark Bytes

Introduction

“A hex editor (or binary file editor or byte editor) is a type of computer program that allows a user to manipulate the fundamental binary (0 / 1, zero / one) data that makes up computer files.”

In the process of figuring out the format of a Portable Executable at byte-level I tried a lot of different hexadecimal (hex) viewers/editors. I was especially looking for one that supports highlighting: giving the bytes colors is useful to visualize the groups that together have some meaning according to a specification. For example:

//Format of .EXE file header (MS-DOS stub)
char signature[2] = "MZ";// magic number
short lastsize; // # bytes used in last block
short nblocks; // number of 512 byte blocks
....etc...

Coloring these groups is useful to distinguish:

  • the group of two bytes (16 bits) that contains the magic sequence (‘MZ’)
  • the next two bytes (a short is 2 bytes) that describe the number of bytes in the last block.

Using such visualizations can be useful to quickly get a thorough understanding of a file format or specification.

After reviewing every hex editor under the sun, the ones that I enjoyed using most turned out to be HxD and…

Tags: .bt file, 010, 010 editor, binary template, bookmark, byte groups, color, colored bytes, hex, hex editor, highlight, hxd, sweetscape, template
General
5 February 2011 0 Comments

Finding Module Positions in Joomla 1.5 and 1.6

In Joomla you have “content generators” called modules. You stick these generators into a template in certain positions. Sometimes you need to know which module positions are available for your current template. You have two options. One is digging through the template’s PHP files looking for the jdoc:include tags that define these positions.

However a much more intuitive method is to use a visual representation:

The above screenshot is achieved by using the ?tp=1 switch in the URL.You will get boxes in the upperleft of each “template position” with the position name, and empty positions will now be shown too. Very convenient!

Let’s say my blog is at tech-juice.org/techjuice, then the url will become tech-juice.org/techjuice/?tp=1

Note that this method is only enabled by default on Joomla 1.5.

Enabling Template Positions in Joomla 1.6

This feature is turned off by default in Joomla 1.6. You need to enable it in the options.

To enable it go to Template Manager -Options.

Then enable “Preview Module Positions”.…

Tags: 1.5, 1.6, joomla, module position, preview module, preview module positions, template position, tp=1
General
27 December 2010 5 Comments

How To Fix: Strange Characters in PuTTY

When opening an SSH session from a Windows box to a Linux machine using PuTTY I noticed some strange characters. The text looked like this:

warning: format â%dâ expects type âintâ, but argument 2 has type âint *â

I was puzzled, because I had not had experienced this problem before when using PuTTY. Typing echo $LANG in the bash terminal prompt showed that it was using en_US.UTF-8 as the character set . The problem was caused by PuTTY expecting a different character set (One of the Windows ISO-8859 charsets).

To solve this problem, PuTTY must be configured to speak the same language: UTF8. Here’s how:

  1. Open the PuTTY configure dialogue by clicking in the upper left corner of the window and selecting “Change Settings…” from the menu.
  2. Go to “Translation” on the left side tree menu and select “UTF-8” from the pulldown menu to the right.
  3. Apply the settings.

Now the correct output will show:

warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’

Tags: , charset, iso-8859, putty, , translation, utf-8, utf8
General
23 December 2010 3 Comments

Moving the Mini Menu Bar in Fullscreen VirtualBox

Setting up a virtual machine is easy with VirtualBox, but I couldn’t figure out how to hide the annoying menu bar that would pop up at the bottom in fullscreen and block my applications.  It turned out to be very easy:

  1. Make sure your VM is not running
  2. Open the settings for your machine in the VirtualBox
  3. Go to General -Advanced tab
  4. Check Show at top of screen.

Presto, the menu has been moved to the top.…

Tags: fullscreen, menu bar, virtualbox