Monday, September 25, 2006

Wandering Off

I tend to wander. Be it in downtown Beijing or just reading a book.

I'm still reading Java for Artists. I made it a couple of pages in several hours. Here's a rundown of the journey.

Chapter 3 talks about the Spiral Development Cycle.


The same 3 steps (plan, code, test) are repeated to build and maintain forward progress. And although the code and testing have peristent artifacts (the code itself), the plan steps are layed out in tables in the book. Somewhere along the line I decided I wanted to be abkle to do everything in text files (Starting from scratch). I'd like continue this process after I'm done with the book, but how can I create structured data in a text file? XML. Damn it! Now I have to go read up on XML again. How many times does this make now? Use it or lose it. A google search on XML turns up a favorite site of mine (w3schools.com). Of Course, I can't just read about XML (since alone it won't really meet my needs). This leads me to tutorials on XML, XPath, XSLT and XSL-FO (that's a new one to me).

I probably shouldn't be watching tv while I'm doing all of this...

So now I'm working on the XML and XSL that I hope will make up my plan list. Java? Yeah, I'll get back to that eventually. At the moment I can't even get the XSL to properly transform the XML. I am Clearly a masochist.

Here's the xml to this point:


<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="RobotRat.xsl"?>

<dev_plan xmlns="http://brian.donoho.com/xml/">
<name>RobotRat</name>
<prog_lang>Java</prog_lang>
<step id="1" phase="1">
<design_consideration>
Program Structure
</design_consideration>
<design_decision>
One class will contain all the functionality
</design_decision>
</step>

<step id="2" phase="1">
<design_consideration>
Creating the Java application class
</design_consideration>
<design_decision>
The class name will be RobotRat. It will contain a “public static void main(String[] args){ }” method.
</design_decision>
</step>

<step id="3" phase="1">
<design_consideration>
constructor method
</design_consideration>
<design_decision>
Write a class constructor that will print a short message to the screen when a RobotRat object is created.
</design_decision>
</step>

<step id="" phase="">
<design_consideration>
</design_consideration>
<design_decision>
</design_decision>
</step>

<step id="" phase="">
<design_consideration>
</design_consideration>
<design_decision>
</design_decision>
</step>

</dev_plan>


And the xsl:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<body>
<h2><xsl:value-of select="dev_plan/name" /> Dev Plan</h2>
<table border="1">
<tr>
<th>Check-Off</th>
<th>Design Consideration</th>
<th>Design Decision</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<xsl:for-each select="dev_plan/step">
<tr>
<td></td>
<td><xsl:value-of select="design_consideration" /></td>
<td><xsl:value-of select="design_decision" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>


After hours of trial and error. I find that removing the xmlns attribute from the dev_plan element makes everything work. Do I go and figure out why it was breaking things or do I move on with what I should be doing? ROFLOL

Before I get back to figuring out what went wrong with the xml, I should mention that I took another side trip to figure out / remember how display code on a web page. Doing a google search for displaying HTML code brought me to the xmp tag which I'd never heard of, but didn't work for me (meaning, just throwing it around the raw code didn't work). Finally I found an online tool to Display HTML sample code. Thank You Christopher Brewer ^_^

After being left unfulfilled by the explaination of XML Namespaces at w3schools (first time for everything), I found this article at xml.com. Interesting, but I still don't quite get it. Several variations on the xml still result in it not making it through the xsl. I know how to make it work, but I want to understand what's going on when it's not working. After reading Ronald Bourret's XML Namespaces FAQ I understand namespaces themselves a bit more, and get the impression that mine is declared properly, but not why the xsl "breaks".

After doing a search for "XML Namespaces breaks xslt xsl transform" I found a link to a thread that explains the problem and the solution (I didn't want). It looks like my options are to remove the default namespace from my xml doc OR prefix everything in both documents.
After a few more unsuccessful tests and in the interst of continuing my java studies I will remove the default xmlns attribute. Fortunitely this R&D won't be wasted as I will be visiting XML in a later study session.

Labels: , ,

Tuesday, September 19, 2006

Java compile error because of text encoding

I have the magical ability to find every possible error in the course of learning about something. Take for example todays exploits. I'm developing on windows XP using Notepad++.

I'm reading "Java For Artists—The Art, Philosophy, and Science of Object-Oriented Programming" and given the simple code below:

-----------------------------------------------------------------------------------------------
Example 2.1: SampleClass.java

package com.pulpfreepress.jfa.chapter1;

import java.util.*;

public class SampleClass {
/**************************************
Class and instance field declarations
***************************************/
public static final int CONST_VAL = 25;
private static int class_variable = 0;
private int instance_variable = 0;

public SampleClass(){
System.out.println("Sample Class Lives!");
}

public static void setClassVariable(int val){
class_variable = val;
}

public static int getClassVariable(){
return class_variable;
}

public void setInstanceVariable(int val){
instance_variable = val;
}

public int getInstanceVariable(){
return instance_variable;
}
}


-----------------------------------------------------------------------------------------------
Example 2.2: ApplicationClass.java

package com.pulpfreepress.jfa.chapter1;

public class ApplicationClass {

public static void main(String args[]){
SampleClass sc = new SampleClass();
System.out.println(SampleClass.CONST_VAL);
System.out.println(SampleClass.getClassVariable());
System.out.println(sc.getInstanceVariable());
SampleClass.setClassVariable(3);
sc.setInstanceVariable(4);
System.out.println(SampleClass.getClassVariable());
System.out.println(sc.getInstanceVariable());

System.out.println(sc.getClassVariable());
}
}
-----------------------------------------------------------------------------------------------

I still got compile errors as such:
[parsing started src\com\pulpfreepress\jfa\chapter1\ApplicationClass.java]
src\com\pulpfreepress\jfa\chapter1\ApplicationClass.java:1: 'class' or 'interface' expected
package com.pulpfreepress.jfa.chapter1;
^
src\com\pulpfreepress\jfa\chapter1\ApplicationClass.java:1: illegal character: \187
package com.pulpfreepress.jfa.chapter1;
^
src\com\pulpfreepress\jfa\chapter1\ApplicationClass.java:1: illegal character: \191
package com.pulpfreepress.jfa.chapter1;
^
[parsing completed 62ms]
[parsing started src\com\pulpfreepress\jfa\chapter1\SampleClass.java]
src\com\pulpfreepress\jfa\chapter1\SampleClass.java:1: 'class' or 'interface' expected
package com.pulpfreepress.jfa.chapter1;
^
src\com\pulpfreepress\jfa\chapter1\SampleClass.java:1: illegal character: \187
package com.pulpfreepress.jfa.chapter1;
^
src\com\pulpfreepress\jfa\chapter1\SampleClass.java:1: illegal character: \191
package com.pulpfreepress.jfa.chapter1;
^
src\com\pulpfreepress\jfa\chapter1\SampleClass.java:2: 'class' or 'interface' expected
import java.util.*;
^
[parsing completed 31ms]
[total 93ms]
7 errors

After hours and several Google searches on 'class' or 'interface' expected, checking syntax, etc with no success, I wondered what the hell this: was.

Turns out, in my efforts to create files that would be usable in Unix and Windows I encoded my text files as UTF-8. Upon changing them back to Ansii they compiled without error.

Time to read up on Unicode.

Labels: ,

Monday, September 18, 2006

The Race by Istiv Studio


All text (typos and opinions) below automatically pulled in after blogging from Google Video.

Incredible, award-winning rotoscoped anime mashup combining footage from over 100 anime movies to create a "Whacky Race." Music by Weezer and Island in the Sun. See http://www.animemusicvideos.org/members/members_videoinfo.php?v=78914 for more.

Here's a list of the anime and music this film draws upon:

Music:

* Weezer Island in the Sun
* Wiseguys Ooh La La !

# Anime:

* Ai Yori Aoshi
* Angelic Layer
* Animatrix, The
* Argento Soma
* BECK, Mongolian Chop Squad
* Berserk
* Bleach
* Boboboubo Boubobo
* Captain Future (Kyaputen Fyuuchaa)
* Captain Tsubasa
* Chobits
* City Hunter (TV)
* Condor Hero
* Cowboy Bebop
* Detective Conan (Case Closed)
* Doraemon
* DragonBall GT
* DragonBall Z
* Eat-Man
* Excel Saga
* Fruits Basket
* Full Metal Panic
* Full Metal Panic: Fumoffu
* Fullmetal Alchemist (TV)
* Gankutsuou
* GANTZ
* Gatekeepers
* GetBackers
* Gokusen
* Great Teacher Onizuka
* Grenadier
* Groove Adventure Rave
* Gundam Seed
* Hanada Shonen-shi
* High School Kimengumi
* Hikaru no Go
* Hunter X Hunter
* Inu Yasha (TV)
* Jungle Wa Itsumo Hale Nochi Guu
* Last Exile
* Love Hina (TV)
* Lunar Legend Tsukihime (Shingetsutan Tsukihime)
* Lupin III: First Contact (2002 Special)
* Monster (TV)
* Mysterious Cities of Gold, The
* Naruto
* Neon Genesis Evangelion
* One Piece
* Otogizoushi
* Paranoia Agent
* Pokémon (TV)
* RahXephon (TV)
* Rurouni Kenshin (TV)
* Saint Seiya
* Saiyuki
* Samurai 7
* Samurai Champloo
* School Rumble
* Scrapped Princess
* Shaman King
* Shingetsutan Tsukihime
* Slam Dunk
* Tenchi Muyo! (OAV)
* Tenjou Tenge
* Tenshi na Konamaiki
* Trigun
* Twelve Kingdoms
* Twin Spica
* UFO Robo Grendizer
* Vision of Escaflowne, The
* Wolf's Rain
* X (TV)
* Yakitate!! Japan (TV)

Here's the producer's summary:

The idea to do such a video came on a discussion with Tyler. We were talking about the numerous scenes of people running in animes. I also had instantly the idea to use this to do a sort of marathon of anime characters. I started so to prospect for concepts to put into this race.

The first difficulty was to find a sort of scenario to this video. As i often say, one of my goal in amvmaking is to do more scenaristic videos, like Vlad did wih "Transcending love" [réf.] or E-ko in "Tainted Donuts" [réf.]. I realy wanted to do something different from "Shounen Bushido" or "Project Love united". So i search for a story that can motivate the characters to participate to the race. I had the idea of a mysterious Great Prize that no one know what it is. So the participants are imagining what they wondering deeply in their own anime story. And one of the stress i put on me was to absolutely not do another "singing" video. Now i have the background of the video, i started to search the characters.

The first character wich came in mind was Spike from Cowboy Bebop since i already saw him running in "Tainted Donuts". To say the true, it is possible that this video indirectly influenced me in making this video. But i really wanted to do something different evan if it was still people running inside. Then i think about Luffy of One Piece on second. Because, every funny thing ou need in AMV, you can be sure Luffy did it. Naruto, Kirua from Hunter X Hunter, and Edward of Full Metal Alchemist came after that. Once i had my main charcters, i started to edit the scenes, and see what can i do with the different piece of anime i had.

After a few minutes of editing i realize that, just putting characters in a race, make them run from a point to an other, should be boring. So i had the idea to put in it some "Chibi Things"-like fighting. Now my race became a fighting race. A sort of "Wacky Race" with participants, tricking, cheating, to win the great prize. I was prepared to do a lot of rotoscoping, but at this point i never imagined how much of cutings i'm going to do, to complete this project. After 1 year of editing, and many stops caused by boringness, world of warcraft or my Ph D. rush ... i finally finish the vid.

I would like to thanks some editors for the help they provided: Kirua for making me discover the song, and for the sequences i lacked of and he sent it to me ; and Laria for reviewing my beta version and tell me where i needed to correct some misshaps. If you have time, go look their videos, and let an opinion ;). I would like to thanks [R]ay and Ayor which are not amvmakers but that helped a lot by providing me some stuff i didn't have in my stock of anime videos.

I hope you'll enjoy the video.

Video Encoding: Divx 5.1.1 - 2pass - 3000 KBps
Audio Encoding: MP3 - 44 KHz - 160 KBps



**************************************************************

Anime USA (Vienna, 2005)
- Viewer's Choice Award
- Upbeat Runner-Up

AC Cubed (Ottawa, 2005)
- Best Overall

Anime Week-end Atlanta XI Pro Contest (Atlanta, 2005)
- Best Fun/Upbeat
- Best Technical
- Best in Show
- Nominated in 3 categories

Connichi AMV Contest (Kassel, 2005)
- Best Fun

Labels:

Path / CLASSPATH Changes

After making changes to the System Path /CLASSPATH environment variables in Windows, close existing command prompts and open a new one for the changes to be reflected.
No comment on how long it took me to figure this out.

Labels: ,

Wednesday, September 06, 2006

A different AAA

Assess, Accept, Adapt

How does one go against the flow (when deemed necessary)? How does one deem such necessity?

I think to some degree it requires knowing who you are and what you want (and don't want). Because no one is an island, our free will is regularly tempered by that of others in our environment. Recognizing this is the first step in peaceful coexistence with the world around us. You do want to coexist peacefully don't you?

Assess
Each of us, through our thoughts and actions, creates, shapes and maintains the world we want to live in. So does everyone else. Before doing (or changing) anything it's a good idea to look around and understand Why things are the way they are. The society / culture in which you exist wasn't formed yesterday. Anything you observe / experience exists for a reason. And though you may not like some of the things going on in your world, seeking to change them without first understanding them more naieve than noble. I'm not really a proponent of tradition for tradition's sake. Times change and time changes, but more on that when I get to adapt. Look att he world around you or the code in front of you and understand that what your seeing is the result / solution to a problem that probably existed before you did. No sense in reinventing the wheel unless you really have a better wheel.

Accept
Regardless of what you think of or how you feel about something, what is is. If you think of progress as a trip, you have your current location and a goal or destination. It's difficult to plan an effective trip without those two points. Without accepting the current state, you're short a point. Think the president is doing a bad job? Think the code in front of you is a mess? Accept it as your starting point. Time spent complaining or rejecting could be spent planning for improvement. If you've done a proper assessment you understand why things are the way they are (for better or worse), you're ready to adapt.

Adapt
Depending on the situation, your going to make changes to yourself, the world around you, or both. With an understanding why and and an understanding of how what is is a result of that why you're ready to make changes to yourself to function in the status quo or make intelligent changes to it. Adaptation is a synchronization between onself and the world around them. Changes happen in both. Some of those changes are in your control, many are not. Because "change is the only constant" this is an ongoing cycle. The question is, are you at the mercy of this cycle, or do you have (greater) control of you destiny? There's only so much any'one' can do, but living without regrets means you've done the best you could with what you had in any given situation.

Labels: