Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Cat in the Hat - Java to Fast As Light

Just to make it interesting I will play with the process. I often read a book in a lg(n) fashion. It is a type of divide and conquer algorithm that keeps me from being bored. I read the first and last, determine that I am bored with the first and confused by the last. Then I select a topic in the middle and if I am bored, select half of the last and repeat otherwise if I am confused the same is done with the half of the first. It assumes that it is arranged to be sequentially dependent in some rational fashion, which is rarely true.

Since I am lazy, I start with avoiding some typing and do a make or ant XML.


JFLAGS = -g JC = javac .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java CLASSES = $(wildcard *.java) default: classes classes: $(CLASSES:.java=.class) clean: $(RM) *.class

Now I have an easy way to deal with the fact that it takes several tries to get things done when you are impetuous. Now the code. The example is modified from a simple MIT example for beginning java. I use export HTML from the kate editor to produce this.

 

class GravityCalculator { public static void main(String[] arguments) { double gravity = -9.81; // Earth's gravity in m/s^2 double acceleration = 10; // Induced method to be defined double initialVelocity = 0.0; double fallingTime = 0.0; double actionTime = 0.01; double totalTime = 0.0; double initialPosition = 0.0; double finalPosition = 0.0; double newPosition = 0.0; double newVelocity = 0.0; double desiredVelocity = 10.0; double actionSteps = 0.0; newPosition=newPosition+(gravity+acceleration)*actionTime*actionTime*0.5; newVelocity=newVelocity+(gravity+acceleration)*actionTime; totalTime=totalTime+actionTime; actionSteps+=1; while (newVelocity < desiredVelocity){ newPosition=newPosition+(gravity+acceleration)*actionTime*actionTime*0.5; newVelocity=newVelocity+(gravity+acceleration)*actionTime; totalTime=totalTime+actionTime; actionSteps+=1; } System.out.println("The object's position after " + totalTime + " seconds is " + newPosition + " m, Velocity is "+newVelocity +" with "+actionSteps+" steps."); } }

The program output of "java GravityCalculator" is thus:

The object's position after 52.639999999998096 seconds is 0.050008000000004216 m, Velocity is 10.001599999999128 with 5264.0 steps.

The whole thing lead me to an interesting conjecture. Suppose that I could have a device which accelerated the payload which was then accelerated to match velocity by a further mechanism. What I wondered is whether there was a point like the Schwartzchild radius that defined some strange boundary condition which would be entertaining to consider. Since acceleration is in the frame of action, the process would proceed to C in some time. Of course it is not possible in this way as it still requires infinite energy and infinite time. It does have some similarity with possible conditions that might arise in a true singularity. I suppose I will have to let that sink in a bit before it yields any insight. It makes the dull process more able to be tolerated.

In a real situation gravity's effect would vary by altitude and computing this on ever smaller intervals would have a lossy lower limit as well as upper. It makes more sense to have an insertion and extraction point which have known values rather than try to deal with infinities and infinitesimals which tend to bite a person in the ι's , ∞'s and δ's( iotas, infinities and deltas )

openGL compatibility between languages

Something which I just rediscovered today is Rosetta code and I hoped to spend some time looking through that code and today I am looking at the "Knapsack" problem in various languages also as it applies here in a strange way as I need to optimize the speed of the execution of openGL code with a certain number of calls that achieves the same result. This is another weighting that can be used for the automatic code generation and becomes a characteristic of my code.

This is a sample of the Java code that is in LWJGL or Java OpenGL, and as you can see the format is the same and this makes it very easy to create a method on my machine, test it and debug it an then port it to a Java application.

GL11.glPushMatrix(); GL11.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); GL11.glRotatef(view_roty, 0.0f, 1.0f, 0.0f); GL11.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);

Below is the C equivalent of the Java code above and as you can see it simply add the prefix "GL11." and so the process is simple if I maintain some modularity and consider how it will port to Python, Blender, or Java.

glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);

And this is some similar code in Lesson 11 of NeHe fame which I converted to Python. It is even more similar and really only loses the ";" at the end of the line and if I rememeber correctly, Python doesn't care if you add that. AFAIK. It does have indents and that is important.

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) glLoadIdentity() glRotatef( lookupdown, 1.0, 0.0 , 0.0 ) glRotatef( sceneroty, 0.0, 1.0 , 0.0 ) glTranslatef( xtrans, ytrans, ztrans )

The first step is to separate the openGL into modular form based on category type with some idea of how it ports between the languages. I suspect that this will give me greater confidence in my code base, as the port can show some flaws in the code that `javac` will tell me or Python will warn. It adds new places where automatic code generation can be certified.

Java chemistry

Discovered this chemistry resource with Java applets.There is so much information on the web that it makes education easy for a polymath. Chemical kinetic is an area of interest and I hope to extend this to interface with my bioinformatics tools.

Also this YouTube video from Google is way funny and extremely informative for somebody who wants to consider what does the this.java.code really do and why doesn't it do what I expect?

I also watched a Google video from Douglas Hofstadter of GEB fame, about Kurzwell and singularity. He makes some valid points and in my estimation, they are both wrong. They approach the same concept with different perspective, but when these things unfold, they present "things" which have never been observed before and as a result cannot be discussed as they never existed before they "emerged". It becomes an issue of predicting the future and that is not possible. So my opinion is that they look at what could be , consider what it means , and assume that is the end of the story. That is the problem, it is an unfolding of something that never becomes completely unfolded, it is the unknown and as such it may look like what they predict at some point in time, but it reveals new possibilities and new problems. The answer is that there is no final answer. Even in find bugs.

I see many things that could be and they can't all coexist. Things and methods become dominant or fade when new methods appear. A liquid "Terminator" might be the idea of the ultimate terminator, but it is just a passing fanciful concept of that which could be if the story ended there. I want to see a cage match between "Body Snatchers", "Wolverine", "Firestarter", "Carrie", "Scrooge McDuck", "Frankenstein", "Shirley Temple", "Genghis Khan", "The Godfather", "The Borg", "Buffy the Vampire Slayer", "Terminator and T2", "McGuyver", "KGB", "The Q Continuum", "Alien", "Dr Who", "Teenage Mutant Ninja Turtles", "Predator", "Superman", "Godzilla", "Tyrannosaurus Rex", "Harry Potter", "Dirty Harry", "The Goa'uld", "Babe Ruth", "USAF", "Mick Jagger" , "Samurai" and "The Puppet Masters".

Knowing java structure

When WebGL becomes available it will make a radical change in network cooperation as it will allow a type of collaboration that has never been seen before. I can't even guess at what could be layered on top of it. It is probably one of the most important developments I have seen in a while. Strange ants are starting to get in my java OpenGL gears and so I will leave `java` alone for a while.

This is a way to set 'classpath' for Java as an environment variable. I simply wanted to make the process cleaner and refine the targets. Some of these jars do not exist in my environment and I was separating it out so I can test which are required for the tests. At the moment I assume java.library.path must be set at the command line in this case with the -D option as described in `man java`.

CLASSPATH=:res:jar/lwjgl.jar:jar/lwjgl_test.jar:jar/lwjgl_util.jar:\ jar/lwjgl_fmod3.jar:jar/lwjgl_devil.jar:jar/jinput.jar: echo "This is CLASSPATH" $CLASSPATH LD_LIBRARY_PATH=libs/linux echo "This is LD_LIBRARY_PATH" $LD_LIBRARY_PATH java -Djava.library.path=libs/linux org.lwjgl.test.opengl.Gears unset CLASSPATH unset LD_LIBRARY_PATH

The best way for me to understand anything is to do it and then redo it until I understand the nuances of the process. For java you need to know that `ant` is the XML builder and that a ".java" file compiles to ".class" using `javac` and is run by `java` using the Java Virtual Machine. It is great for things that have logic as it can be very predictable and safe, but the problem is the same one that every piece of software has: the interface with the real world and crossing the boundary to something strange.

I have an advantage as I can exclude, apply, or include many things that others would not comprehend for lack of contact with those things. For a list of some: the architecture of a digital machine, library structure, hardware interface, and systems utility and debug. In this case I want to "shotgun" a solution and then identify weaknesses and misunderstandings as the process proceeds. 'lwjgl' is a free opengl for java and others are proprietary and as such have no source, which makes it vastly more difficult to apply and understand and troubleshoot. This example will probably not serve well for others as I take some liberties just to get to the goal and your mileage may vary, in fact, the car may not even start.

# about 10 minutes svn co https://java-game-lib.svn.sourceforge.net/svnroot/java-game-lib/trunk/LWJGL lwjgl cd lwjgl mkdir bin ant generate-all #BUILD SUCCESSFUL #Total time: 23 seconds ant compile #BUILD SUCCESSFUL #Total time: 13 seconds ant compile_native #BUILD SUCCESSFUL #Total time: 20 seconds cp -R bin/org org cp -R bin/lwjgl lwjgl man java java -cp .:res:jar/lwjgl.jar:jar/lwjgl_test.jar:\ jar/lwjgl_util.jar:jar/lwjgl_fmod3.jar:jar/lwjgl_devil.jar:\ jar/jinput.jar: -Djava.library.\ path=libs/linux org.lwjgl.test.WindowCreationTest

And finally the console output of the test program on an X86_64 architecture using fglrx and X11.

#The following keys are available: #ESCAPE: Exit test #ARROW Keys: Move window when in non-fullscreen mode #L: List selectable display modes #0-8: Selection of display modes #F: Toggle fullscreen #SHIFT-F: Toggle fullscreen with Display.destroy()/create() cycle

The biggest problem with using an IDE is that you do not gain the knowledge of how to troubleshoot complex interactions like recursions, machine dependencies and many other things that can interfere. If the machine is exactly the same between users it would be much simpler, but technology constantly changes and there on the edge where I live the rocks are loose and it is easy to fall into the abyss of NULL bits and if you don't have a sonic screwdriver, you probably won't get out.

If you don't speak the language you won't get any information exchanged and even if you do, sometimes all they are saying is IDK.

NetBeans 6.0.1 is available from the debian archives along with other associated software. I installed that also on all architectures and tested. I lose interest with GUIs and eventually write my own interfaces, but for testing and examples it is a good learning tool.

I managed to learn some new things inadvertently about .eps, `inkscape`, XML image editing and origins. In order to solve the puzzle of the universe you need to have a lot of pieces and a convenient way to test their fitness to each other. I also know some new things about ancient Egypt during the time of the Pharaohs. Strange how some things interact. I may be Mae'r blaidd drwg go iawn or maybe Волк времени. There are so many things that become clear on the way to infinity and many have never been seen before and some have will never be seen without the eye that sees them.

Here there are ants and wolves and dragons.

When moving to another machine without the development files on the X86_64 machine I discovered that many dev headers are required for the `ant compile_native` which uses a C generated library. It isn't too difficult to figure out where those headers are located and again I just shotgunned it and installed kdevelop to start.

The lwjgl works well on the 32 bit machine and this is typical of open source. It seems that all the open source software is more usable and of course it is because there are many eyes to look at it and things created in the dark have a tendency to be more like fungus than flowers. It has a problem with full screen modes on the laptop and that it shares with about every other program as there is something odd going on with full screen on that machine. Beyond that it responded to keys and moved about, changed display sizes, and ran flawlessly. I am afraid that fglrx and X86_64 will be the last place it will work, but I have 32 bit partitions on that machine and they work fine. So open source wins again and everybody involved deserves some praise , it works and that is what it is all about.

Java JOGL meltdown or 64bit

Java openGL nbm

Installing nbm's

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f673b0cb330, pid=11267, tid=1080957264
#
# JRE version: 6.0_17-b04
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.3-b01 mixed mode linux-amd64 )
# Problematic frame:
# C  [libc.so.6+0x7c330]  memset+0x60
#
# An error report file with more information is saved as:
# /home/AliceInfinity/NetBeansProjects/SimpleJOGL/hs_err_pid11267.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

I will have to test this across the nfs at 32b. I will update if this is valid for NetBeans and show the process to test. Blame it on the AI.

Latest JOGL, I am testing.

Java man, him like Net Beans

I like Net Beans and though I dislike IDE's in general as being "too" helpful, I think this software finds that sweet spot between leading you where it thinks you should go and the undiscovered country which is creative implementations. I like it and will use it to investigate the many Java applications. Java is another language and many things are only presented in Java, so I must learn. It is like a scholar of ancient works, you have to know Greek, Egyptian, Sanskrit, Chinese, German, Latin, French and all other languages to consider the ideas presented by those speakers and I do see that some ideas are only expressed with Java and that is the gain. No pain, no gain.

The generalized concept of an "^[i][n][f][i][n][e]$" computer is that it operates on infinites and ultimately reaches a certain level of acceptable certainty. I expect to use Net Beans to write a Java program that is an IDE to the ^[i][n][f][i][n][e]$ and then use that IDE to make programs for the device. Moteyalpha, him like recursion what is profitable. I suppose somebody has already chosen the name infine for something else and so I will Google now and I was correct in that assumption. I makes no difference as I am not using it in a commercial context. It describes the idea well and so I shall apply that name in my context.

Though people use names for advertising that are catchy and represent the intent of the sellers, an Infinity car is not likely to have anything to do with infinity at all, as do many advertising symbols. I sure wish I could buy a Quasar that was a real quasar, but they just use the name inappropriately to enhance image and association. I suppose I could call it slime and that would be just as well for me, but the name will be ^[i][n][f][i][n][e]$ as it is descriptive and if it conflicts with copyrights and trademarks, I will refer them to my lawyers at the home world of the Gravity Gilde. I see that virtually every permutation of every word that has any significance whatsoever is applied somewhere on the web. I think I will trademark the name
`cat internet |grep -E '^[i][n][f][i][n][e]$'`
then if anybody uses that regular expression in a shell script, I will Sue! or Shirley or Samantha or any number of girls names starting with the letter S.

In the process of looking around I did find the UNIX Grymoire and that was interesting. Perhaps I could use the Shasum of a file containing ^[i][n][f][i][n][e]$ as the word itself? The cac55d48d8299dbc07a7cbaedf0671857f1d50e9 is an interesting device. As odd as that is, I think it makes sense as I can have unique identifiers for concepts and names that never conflict when I am analyzing something. The clarity of what I express would then not be ambiguous. I would of course have to get used to it. So the new name is
b9c5f2526a24959e253940b5facd738c9099ff166ef
9f3a41a3b0ba0655d8c9507c29dd833a8ef9d0f11ec
fd7ddb30fd7e47b7796c101f202f0b227de71df50e
and it is pronounced
bnglyfindilpoplictoygenwigliteentolim.
or better still
`shasum -a 512 infine>sha.txt;espeak -f sha.txt`

Odd thought, is there a shasum that is 0? I will have to investigate that. Now if only it would tell me what I am intending to do before I got distracted.

Java opengl automatic jogl meta scape

I am creating the shell script and `grep` `sed` framework to have a coherent framework which allows the forward and backward transport of an application in javascript, local GL java, web java GL, WebGL, C, and Python by converting the code and mixing it with a standard template for each language. I have done this by hand and I hope to have a coherent framework which can do NeHe tutorials and RedBook as automatic exports to any and all of these languages by a single script command that detects the format desired and constructs the output code which is either compiled or interpreted.

Along with ImageMagick and some other utilities, I should be able to have a pipe that can "emulate" and code that it sees ( wgets) on the web.

I started jogl yesterday and was not able to complete that as the weather has made it necessary to remove vast amounts of crystallized Hydrogen Hydroxide from the local environment in order to move about. I appreciate Firefox, I was having trouble spelling crystallized and just highlighted it and hit right mouse button over it and there was the choices. Nice!

sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk

/* `javac MoteyCycle.java` `java MoteyDemo` */ class MoteyCycle { int languageType = 0; int codeQuality = 0; void changeLanguage(int newValue) { languageType = newValue; } void changeQuality(int newValue) { codeQuality = newValue; } void printStatus() { System.out.println("Language:"+languageType+" Quality:"+codeQuality); } } class MoteyDemo { public static void main(String[] args) { MoteyCycle motey1 = new MoteyCycle(); MoteyCycle motey2 = new MoteyCycle(); motey1.changeLanguage(3); motey2.changeLanguage(2); motey2.changeQuality(1); motey1.printStatus(); motey2.printStatus(); } }
/* `javac MoteyLang.java` `java Motey` */ enum Think { Infinite, StateWise, Analog, Symbolic } enum Effectiveness { Infinite, StepLike, Variable, Static } class InfiniteLogic { Think languageClass = Think.Infinite; Effectiveness codeQuality = Effectiveness.Infinite; String LangName; String InfLangDesc="Infinity is way more than 64 bits."; void changeLanguageName(String newValue) { LangName = newValue; } void changeLanguage(Think newValue) { languageClass = newValue; } void changeQuality(Effectiveness newValue) { codeQuality = newValue; } void printStatus() { System.out.println("Language: "+LangName+" "+languageClass+" Quality: "+codeQuality); } } class MoteyLogic extends InfiniteLogic { int RemainsInfinite; void printMlStatus() { System.out.println("Language: "+LangName+" "+languageClass+" Quality: "+codeQuality+" "+InfLangDesc); } } class DigitalLogic extends InfiniteLogic { Effectiveness codeQuality=Effectiveness.StepLike ; } class Motey { public static void main(String[] args) { MoteyLogic motey1 = new MoteyLogic(); DigitalLogic motey2 = new DigitalLogic(); String Str= new String("Mote"); motey1.changeLanguage(Think.Infinite); motey1.changeLanguageName(Str); motey2.changeLanguage(Think.StateWise); motey2.changeQuality(Effectiveness.StepLike); motey1.printMlStatus(); motey2.printStatus(); } }

Java meta code generator

class motey { public static void main(String[] args) { System.out.println("H"); } } /* javac h.java java motey (prints the letter H) */

Someone did an ontology of computer languages and defined how they all relate in terms of how the are applied and I passed it once and didn't bookmark it or I imagined it. I don't know where it is , but maybe one day I will find it again. This is so I can test some decision trees in java and perhaps have my program create an AI program written C that writes programs in java. It is not surprising that languages have many of the same features, as they must all run on a computer and they must perform the same logic ultimately. This is about as simple as it gets. `javac` compiles the named file "h.java" and produces "motey.class" `java` runs the compiled code referenced by the name motey by opening "motey.class".

Wed Jan 06 11:11 PM$ strings motey.class Code LineNumberTable main ([Ljava/lang/String;)V SourceFile h.java motey java/lang/Object java/lang/System Ljava/io/PrintStream; java/io/PrintStream println (Ljava/lang/String;)V

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen