Sunday, 28 June 2009

Java FX: A new cool platform for developing rich web applications

It is a while that Java FX platform is available. Already it was part of the NetBeans IDE bundle downloads until it became gradually independent, though one can download it with a NetBeans IDE attached independently designated for developing Java FX or as a plug-in into the newer versions of NetBeans. Now the platform is on its feet and can be used as a platform for its own. I liked this new tool since

  • I could learn its basic lessons in a morning
  • I need only a day to learn advanced features such as animation. Actually this feature is the only part that a Java programmer needs to concentrate.
  • The language takes me back to all memories of C programming days as I notice structure and enumeration and unions have had a comeback from java to C grand-parents.
  • Ease of using is similar to using Basic programming at its first emergence after horrible punch card programming era.
  • NetBeans IDE allows me to exploit all the java capabilities, besides the new elegant Java FX.
  • Events handling Listeners and Adapters are more friendly in FX than Java programming. That is the case with implementing Abstract classes too.

Still, I could not find documentations of classes for Java FX. Also in java projects that one is doing in NetBeans IDE, the IDE does not show the Java classes documents neither for pure Java nor for Java FX. I believe gradually I will use the Java FX platform for most of my work. That animation experience makes it more desirable and faster to be used.

Saturday, 27 June 2009

Creating Partition on Virtual Box

After finishing on creating partition, it is a good idea to roam around “Debian” and become used to its environment. Just enter “ls”  to get a list of facilities that I got on the root. if I enter “ls /sbin” I’ll get a list of loads of utilities available for me. One is “mke2fs” that creates Ext2 file system for Linux partition. I can remember that I liked to install permanently a GParted on an extended logical partition at the beginning of my hard disk. I enter “mke2fs –L GParted /dev/hda6” at the command prompt. It does its job and creates a Linux partition on my hda6 logical device. I use option “–L GParted” to have a volume label for my partition, besides. I notice always to keep the required blank spaces. before and after that option in the command and after “L”. Now I run an “–pfv e2fsck /dev/hda6” to have some expert information about my logical device. Again those switches help me to keep things under control and unattended. I should plan everything ahead and leave them to be done without having  been around to watch them. At the end I can read the report or any log file to find out what has gone. So “unattended but verbose” is desired. Now it is time to “mount” the logical partition on a directory. I can create any directory that I like, but already there is a directory in “Debian” for that: it is “/mnt” directory on the root. I enter “mount /dev/hda6 /mnt”. At times it is necessary to use “mount –t ext2 /dev/hda6 /mnt” to explicitly guide the commands to the type of mounted partition. Now, everything is fresh and clean and I do not need to do that. I have the device mounted now I start to install my own image and directories. I follow advise of GParted site. I should decompress GParted.zip into the root of “/mnt”. I should find the place of “unzip” command and gparted .zip on the CD image that right now I have live on the RAM disk space. If I enter just “ls” I see a “live” folder in the list. I enter “cd live” that takes my inside the “live” directory. There I have two folders: “cow” and “image” I enter “cd image” Here is the list of all files and folders that I put when I was creating my custom GParted CD ROM. Among them now I need gparted.zip and “unzip”. They are here. Now I follow GParted website command but I should have all paths in commands. Alternatively I can copy these two files to the root of “Debian live RAM” I enter “/live/image/unzip /live/image/gparted.zip –d /mnt”. I note that I should repeat the complete path for each file and folder and unzip is completely case sensitive. Switch “ – d” shows the directory of installation. I did whatever GParted advised. From here, or at the root I check “ls /mnt” and find out every thing is as it should. I have “COPYING” file at the root. From now on it works on the hard disk but now I am in a logical partition and have other plans hence I need a “GRUB” for loading this device from “XOSL” I go into the root and enter “mkdir /mnt/boot” That creates the required “/boot” directory for installing “GRUB”. Then I enter “/sbin/grub-install ––no-floppy ––root-directory=/mnt /dev/hda6 ” Switch –no-floppy shows that I do not use a floppy for loading “—root-directory=/mnt is the place that “GRUB” finds its “/boot” directory as already created and ready and at the end we have installing device. Usually “GRUB” gives a warning about “device.map” that should be ignored. I can inspect “ls /mnt/boot/grub” for installed folders. It is better to sort out things by invoking GRUB command environment by entering “sudo grub” There at the “grub>” prompt, I enter  “find /bbot/grub/stage1” It replies “(hd0,5)” It is in the brackets and I know that it means the partition number 6 (5+1) on the device number 1 (=0+1). Grub counts from zero rather than one. Then at the “grub>” prompt I enter “root (hd0,5)” It replies “file system type is ext2fs, partition type ex83” both have the same meaning. Then I enter “setup (hd0,5)” It gives few lines of message and news of successful installation. Then I enter “quit” and back to “Debian” command prompt. So far so good. Now remains to edit the “menu.lst” of GRUbB and a nice splash for it.

Saturday, 20 June 2009

Creating Partitions on Virtual Disks

After those calculations, I have better idea of what going on in hypothetical geometry of hard disks. Now I open my xVM virtualBox. I create a “New” machine. For operating system I select “Other.” For the Version, I select “other,” for version. I select a new virtual hard disk for it as much as 16Gb. I mount my custom made GParted.iso as CD on the “Other” machine and then I start the machine. It boots from GParted.iso.  I select the second row from the GParted menu, to be able to un-mount the CD if I opt to. Then I select the default key map of GParted. And finally I select the language from the language menu. After that a menu loads that ask me for three options: [0], [1], and [2]. I select [2] to take me to the GParted “Debian” command. Then I type “fdisk /dev/hda” at the prompt and then “enter.” It gives number of cylinders C=33288, and usual Linux warning on exceeding C=1024 and then subcommands for “fdisk” comes as “command (m for help).” If I type “m” and then “enter” a list of available commands and at the bottom “x” for expert commands. I type “x” and “enter.” A sub-subcommand comes for expert commands. In this if I type “m” and “enter” another list comes for available expert sub-subcommands. Now I type “c” to change number of cylinders and “enter.” A prompt offers me possible number of cylinders from 1 to 33288. I type 2088 as my previous calculations show. It accepts. Then I type “s” to confirm number of sectors. I can change it for adventure but not for work. I select the default S=63 without any change by typing 63 at the prompt and “enter.” Then I type “h” and “enter” to change heads. It offers me from one to 255 and default 16. I type 255 for H=255 and “enter.” At the next prompt I type “r” to go back to “fdisk” non-expert subcommand prompt. To do my partitions I type “n” and “enter.” It asks me with a help menu “type e for extended” and “type p for primary.” I enter “e” Then it asks me for partition number (1-4). Here I adventure to put the extended partition at the beginning of the disk contrary to usual practice that puts it at the end. I enter “1” Then it asks me for the size. It asks me for beginning cylinder by offering (1 to 2088). Here I get confirmation that my calculated scheme is under way. I enter “1”  and then for the end of extended partition I enter “40” I leave 2048 cylinder for two XP side by side. Then again I enter “n” This time it offers me “l for logical partition” since we cannot have any more extended partition but we can have only logical partitions inside the extended partition. I enter “p” and it asks me for partition number (2 to 4). I select “2” This time it offers 41 for beginning of partition as default that I accept by entering for the end of partition I type 1064 (=40+1024) I confine number of cylinder to its maximum of 1024. I repeat the procedure for the last partition from 1065 to 2088. Then again I enter “n” - what for this time? to create logical partitions inside extended partition. At the next menu, I enter “l” for logical partition. It offers me to select a number (5 and greater) since logical partitions at any situation begin from 5. I enter “5” Then It asks for the beginning that I enter default cylinder “1” and for the end I enter “3” This is my XOSL partition, 24Mb. I cannot have less than this. I repeat the procedure for second logical partition that keeps my customized GParted from cylinder 4 to cylinder 40 in partition “6”. Now I have four partitions ready. I type “a” at the “fdisk” subcommand to make GParted partition bootable. It asks me for the partition number (1 to 6). I enter “6”. To be sure of my operation I enter “p” It gives a list of my partition with their number of cylinders as “/dev/hda1” –the extended partition, “/dev/hda2” – the first primary, “/dev/hda3”, as the other primary,  “/dev/hda5” first logical and at last “/dev/hda6” the other logical partition. I can see a “*” is next to “/dev/hda6” showing that it is bootable. I enter “w” to save the partition table and come out of the “fdisk” subcommand.

Tuesday, 16 June 2009

Installing GParted and XOSL

In xVM virtual Box I mount the enhanced GParted.iso I prepared as I explained here, and then I start the machine. It loads GParted from ISO image. I continue on defaults of GParted, but for the last stage when it gives me a choice of command line, as choice [2]. After loading the "Debian" commandline, at the prompt I type "fdisk" and then "return". It gives a usage of "fdisk" command. I type "fdisk /dev/hda". It finds the virtual hard disk and describes its specifications. It gives usual warning of Linux regarding violation of 1024 cylinders limit. For this writting I selected a virtual hard disk of some 16Gb. "fdisk" recognizes a default H=16, S=63 and number of cylinders C=33288. This creates later problems for me if I do not correct them. Each cylinder now contains 1008 blocks, each block 512 bytes gives a total of 0.5Mb capacity for each cylinder. I should have an 8Mb capacity for each cylinder. If I keep S=63 and increase H to H=255 then number of cylinders will be 33288/(255/16) or 33288x16/255 which is roughly C=2088 and each cylinder contains SxHx512=63x255x512=8225280 bytes or some 8Mb of data.

Sunday, 14 June 2009

Geometry of Hard Disk

Two weeks I did not write in this Blog. I am preparing a website here. I needed to become used to the Microsoft Office Live tools and editing the files and uploading and changing backgrounds. Now I am smoothly on the track. Hopefully that site includes very interesting pieces regarding hardware and assembly codes and this Blog remains for general tuning of computer and similar ideas. I was talking about the structure of hard disk. Their technology constantly is changing to reduce the size, to reduce access time for retrieving each piece of data, or in other words to increase the speed of data retrieve. At the same time it is desirable to increase the amount of data that one can put on a hard disk. There are also other goals such as reducing the noise created by hard disk and improve its mechanical features such as ambient compatibility and positioning of a working hard disk in different orientations. BIOS of computer and operating system talk with the embedded software of the hard disk and from that point on we do not know how that software handles data that I give to my computer to be saved. Hard disk takes my data and with all honesty keep them and gives them back to me. For that software all of my data are in form of bytes next to each other. It is like the RAM of computer: there is no cylinder or head or anything. From the time of corporate mainframe computers with their stacks of disks we have data organization in form of a three dimensional space. At each point "head" should stop, read the data and after passing certain time move to another point. While moving it cannot read anything. Normally people understand that a cylinder is a solid object. This is not meaning of a cylinder. A cylinder is only the outer surface of a solid cylinder similar to a pipe with no pith. A solid cylinder object is like many pipes, thousands, smaller inside the larger. I can address each pipe or cylinder by counting from the most outer and larger pipe to the most inner narrower pipe. Each disk in our imaginary stack of disks has two sides for putting data: top and bottom. On each side we have an imaginary head. Actually a real hard disk has two disks, called platter with four heads, but these are not our concern. For partitioning practice I assume that I have 128 disks each two heads (two sides), a total of 256 heads. I further assume that the most bottom disk has not a bottom disk and therefore no head. that reduces heads to 255 at the end. Hence, H=255. That gives address to find one side of an imaginary disk. cylinders on each disk can be seen as circular track of a CD ROM. Then I should navigate around over that side. I divide that similar to a pizza or a pie. Normally, you do it by make it half and then half again and further until you get small portions. For hard disk, small portions are called "sector." It is standard to continue to make half until we get 64 sectors; six times halving, one after the other. They are counted from "zero" to 63 included, 64 all together. Hence, S=63. One does not change this default, except to commit him to some adventures not utilizing partitions for daily work. the last thing remains for me to decide that on a specific sector on a specific head how many cylinders, inside each other, I need. With the scheme that I have had so far each of my cylinders contain roughly 8Mb of data. From that I can decide for number of cylinders. For safe experience I never exceed C=1024 cylinder, or around 8Gb. But for real works, I do not care much about these things and allow GParted or Windows or Solaris or other software manage these tasks.