jump to navigation

Learning CSS – Some Resources August 31, 2006

Posted by deltawing in Uncategorized.
comments closed

CSS Page Layout
This site is immensely useful for learning by example, how to position a website entirely using CSS. No tables will be used to layout. Strictly none!
http://www.glish.com/css/

CSS Navigation Bar
Go to the Adobe homepage and look at their top horizontal navigation menu. That is not Flash, nor is it displayed using a table, and utilizes NO images tags. It is pure CSS, using unordered lists to display the menu elements and subelements. Adobe, the leader of print and web graphic products uses CSS for its website layout. 😀

To make your own CSS navigation bar, this is a suitable place to learn:
http://www.webcredible.co.uk/user-friendly-resources/css/css-navigation-menu.shtml

Dealing With Files & Directories with Java August 30, 2006

Posted by deltawing in Java.
2 comments

Short post:

Had a lab today where one of the exercises was to write a simple application that finds a file in the specified directory. I didn’t know how to deal with files and directories so I went searching online.

A very useful resource that I came across:

http://javaalmanac.com/egs/java.io/TraverseTree.html?l=rel

The almanac has tons of useful resources, just search! 🙂

Live Internet Coverage Of Space Shuttle Mission To The ISS August 27, 2006

Posted by deltawing in non-computing.
add a comment

Hello again 🙂 Ok, this blog is suppose to focus on my Uni subjects, but from time to time something very interesting and worthwhile really needs mentioning!

The live internet coverage of space shuttle Atlantis’ mission would be one of those things. If you have an interest in flight and/or spaceflight … definately check this out.

Live internet coverage of STS-115 (Audio and Video):

http://www.nasa.gov/multimedia/nasatv/live_tv.html or
http://cosmos.bcst.yahoo.com/scp_v3/viewer/index.php?pid=16128&rn=549228&cl=549229

If you missed the live coverage of the previous shuttle mission, then don’t miss this one 🙂

For adventurous programmers 🙂

  • HAL/S is the programming language used for the computers onboard the space shuttles.
  • For the really enthusiastic, here are guides on how to program in HAL/S

Stacks, and how they work August 26, 2006

Posted by deltawing in Computer Science.
add a comment

What is a Stack? It is a type of data structure. Just think of a deck of playing cards or a pile of bricks. With a Stack, you must follow LIFO (Last-In-First-Out). This means that if you stack a pile of bricks and want to take one off, you must take the one at the top, i.e. the last one you put on. With this example it’s probably better to say (Last-On-First-Off), but then that wouldn’t be proper terminology :). Anyway, just think of each brick as an object and there you have it.

Stacks have the functions push and pop. Push means that an element is added to the top of the Stack, and Pop means an element is taken off the top of the stack and the element returned. If you want to see an element without popping it, just use the peek function. You can’t remove or insert elements from the middle of a Stack.
Stacks are useful for applications such as calculators that use Reverse Polish Notation (RPN).
For instance, take the familiar expression 8 * (5+4). This is translated to RPN as 5 4 + 8 *
Read the RPN from left to right.

  1. push 5 onto the Stack
  2. push 4 onto the Stack
  3. Hah I see a + sign! Therefore now I add 5 and 4 and then push 9 onto the Stack.
  4. push 8 onto the stack. (ok a little update 🙂 we now have 9 and 8 on the Stack.
  5. There is a * sign! Therefore now I multiply the last 2 items on the stack which is 9 and 8.
  6. We come to a grand total of 72 🙂

Also you can check Palindromes with Stacks too. The idea is that you add items to the Stack and when you remove them one by one you get them in the reverse order that you put them on. Now all you need to do is compare to see if they are the same. 🙂

Stacks can be implemented in several ways with Java – Vectors, ArrayLists and LinkedLists:

http://www.faqs.org/docs/javap/c12/ex-12-1-answer.html

Chinese BASIC August 25, 2006

Posted by deltawing in Uncategorized.
add a comment

Well it’s Friday and I’m kind of bored. So here’s some interesting stuff I found on Wikipedia. Apparently there’s a Chinese version of BASIC:) If below, you see squares instead of Chinese characters you may need to install Chinese on your system (if you can be bothered :P)

From http://en.wikipedia.org/wiki/Chinese_BASIC:

Chinese BASIC
commands are printed in blue
  Applesoft BASIC
10 卜=0   10 Y=0
20 水, 火   20 INPUT E, F
30 日 = 水   30 FOR A = E TO F
40 卜 = 卜+對數(日)   40 Y = Y + LOG (A)
50 下一   50 NEXT A
60   60 PRINT Y

These characters actually do mean something. Take these 3 lines for example:

20 水, 火   20 INPUT E, F
30 日 = 水   30 FOR A = E TO F

50 下一   50 NEXT A

入 = enter/input

水 = water

火 = fire

從 = from

到 = to/arrive

日 = day/date/sun

下 = next/under (in this context it definately means next)

一 = special grammatic operation (sorry I don't know the linguistic term for it) [ 一 usually means one ]

下一 日 = next day

So in direct translation from Chinese to English these 2 lines would read:
20 Enter water, fire

30 From day = water to fire

50 Next day

Interesting huh? The variables in the above example are natural elements 😛 Well, if Chinese BASIC doesn’t interest you, not to worry! There are plenty other languages: http://en.wikipedia.org/wiki/Non_English_based_programming_languages

Making A New Website? – start with a styleguide August 23, 2006

Posted by deltawing in Uncategorized.
1 comment so far

Starting a new website using CSS? here’s what I think is a very useful article:http://www.willjessup.com/?p=25

I’ll try to use the technique for the upcoming assignment for Internet Technologies. The assignment is interesting, because in the past I’ve overused HTML for layout and styling. The point of this assignment is to use (X)HTML for the content, and CSS for the layout.

The seperation of content and presentation, I think, is a very good concept. It’s also known as “semantic web”.

Advantages:

  • Change your design without affecting content
  • Change your content without affecting your design
  • Allows you to focus on content once finished with the design – isn’t content what’s most important?
  • For accessability – a browser with a “refreshable braille display” will ignore the layout and just focus on the content.
  • Easier to maintain a consistent website.
  • Allow user created design (a CSS file) to be applied to your webpage (well, this could be a disadvatage if you want your website to be the way you made it)

Any more advantages, disadvantages?

Example of a site that seperates content from presentation. I like it.
CSS Zen Garden

Example of a LinkedList August 23, 2006

Posted by deltawing in Computer Science, Java.
2 comments

Here is a very simple example of a LinkedList to get started with:

import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;

public class LinkedListTest
{

public static void main(String[] args)
{

//create a new LinkedList
List list = new LinkedList();

//adding elements to the list. We are adding Strings.
list.add(“i”);
list.add(“like”);
list.add(“to”);
list.add(“code with”);
list.add(“Java 5”);

//the list object calls the iterator() method of the LinkedList to obtain the iterator
Iterator iter = list.iterator();
while(iter.hasNext())
{
System.out.println(iter.next());
}

}

}

—————————————————————————————–

LinkedLists are:

  • Very efficient for inserting and removing elements.
  • Not so fast when accessing elements in order (though not slower than a normal ArrayList)
  • Slow when randomly accessing elements
  • Java 1.5 version supports Autboxing
  • Uses an Iterator object to traverse through the elements
  • Comes in more flavours – Doubley Linked Lists and Circular Linked Lists.

Please, corrections if mistakes have been made!

Recursion in Programming August 21, 2006

Posted by deltawing in Uncategorized.
add a comment

This is a program in Java that I did for a lab exercise. The basic structure was already laid out for us (i.e some code and comments were already written for us), but still, it’s fun. It’s a small Java implementation that uses recursion to check if an entered word or sentence is a palindrome. Nifty! 🙂

I was confused with what was going on with the substring() method, but in the end got it all figured out, so all good.

According to my lecturer recursion is not widely used in industry because first of all, it’s not that frequently needed and secondly it’s difficult to understand and makes code harder to maintain.

————————————————————————————————————————-

// Palindrome
import java.lang.Character;
import java.util.Scanner;

// This program determines if a string is a palindrome.

public class Palindrome {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(“Enter text (return to quit): “);
String theString = sc.nextLine();

while (theString.length() > 0)
{
if (isPalindrome(theString.toLowerCase()))
System.out.println(theString + ” is a palindrome”);
else
System.out.println(theString + ” is not a palindrome”);
System.out.print(“Please enter text (return to quit): “);
theString = sc.nextLine();
}

System.out.println(“Please enter text (return to quit): “);
}

// Returns true if String s is a palindrome
public static boolean isPalindrome(String s) {
// If recursion continuation condition applies,

char first = Character.toLowerCase(s.charAt(0));
char last = Character.toLowerCase(s.charAt(s.length() – 1));

if(s.length() <= 1)
return true;

// If the first character of string is not a letter,
else if(!Character.isLetter(first))
// return isPalindrome(string without the 1st character
return isPalindrome(s.substring(1, s.length()) );

// Otherwise, if the last character of string is not a letter,
else if(!Character.isLetter(last))
// return isPalindrome(string without the last character)
return isPalindrome(s.substring(0, s.length() – 1 ));

// If both 1st and last characters are letters
else {
// Check to see if the first and last char are the same.
if(s.charAt(0) == s.charAt(s.length() – 1))
// If they are, return isPalindrome(rest of string).
return isPalindrome(s.substring(1, s.length() -1 ));
// If not, it’s not a palindrome.
else
return false;
}
}
}

What Does That Word Mean?! August 20, 2006

Posted by deltawing in Uncategorized.
add a comment

I’ve just been reading the lecture notes for the Game Principles subject and the word paradigm has popped up 100 times. It’s sooo irritating because I have no idea what it means. So they say, in Uni one of the important things is to build up your vocab. And my year 10 teacher always said, “Word is power!”

Sometimes I get that feeling whenever I learn a new word I forget an old one because my brain’s running out of memory 😛 I’m just being pessimistic. In addition to being bilingual (other language being Chinese-Mandarin), I have to try and retain programming languages Java, C++, Javascript etc lol. Well, it’s definately a lot less to remember than medical school or law students anyway :P.

From www.dictionary.com 

par·a·digm    ( P )  Pronunciation Key  (pr-dm, -dm)
n.

  1. One that serves as a pattern or model.
  2. A set or list of all the inflectional forms of a word or of one of its grammatical categories: the paradigm of an irregular verb.
  3. A set of assumptions, concepts, values, and practices that constitutes a way of viewing reality for the community that shares them, especially in an intellectual discipline.

From www.dictionary.com:

“…really established a new paradigm for our understanding of the causation of cancer.”

From lecture notes:

“… create a meaningful alteration in the existing game play paradigm of the original game.

A themed partial conversion works to create a meaningful alteration in the existing dramatic paradigm of the original game

A new addition to my vocab…and yours too if you are reading 🙂

Homework For This Weekend August 19, 2006

Posted by deltawing in Uncategorized.
add a comment

Well I just came back from hanging around 7-11 with a friend. It’s Saturday afternoon and I’ve still got to start my homework. This is what I need to do:

  • Write a user profile for the User Experience Design subject. (A user profile is a typical profile of a particular type of computer user). Anyway, it’s too exciting boring to go into. It’s the sort of subject that teaches team building, what good interface design is etc etc. I tend to think that sometimes, the issue is not that programmers don’t understand good interface design, just that it’s difficult for beginner programmers to technically implement good looking stuff. Oh well, my 2 cents I’m only an ignorant student 😛
  • Write a 500 word report on the Unreal Engine’s gametypes, mutators and mods.

To be honest, I honestly disklike the gameplay of Unreal Tournament. It’s just the music, robot voices and wide range of movement and colours tend not to appeal to me. Oh and most importantly, the characters move too fast and everything seems like a blur. It’s just too hardcore and intense for me. 😛 But of course, lots of people love that sort of gameplay and that’s cool. 😉

However, it’s not Unreal Tournament that’s at show here. It’s the Unreal Engine, and I know that’s a different matter. If you’ve ever played America’s Army, you’ll know that the gameplay is so extremely different from Unreal Tournament. I think the game plays great and it’s the sort of gameplay I love! Yet, the game’s made in the Unreal Engine!

Ugh, back to work.