## mercoledì 22 ottobre 2008

### My first Google App Engine test !!!

This is the link http://0052631578947368421.appspot.com !!! a wiki-like site ( learned in a codelab of GooogleDeveloperDay ) with login!!!
Basically you can create ( in Python ) and deploy a webapp .

## martedì 14 ottobre 2008

### Mandelbrot in Scala

I'm also working on a more complex mandelbrot set program in Scala.
Soon i'll post the source code.
This is the output:

### Esoteric ruby Mandelbrot

play with code in order to create my version of Madelbrot set program in ruby.
This is the code:

( not true, the code is here because the blogger editor didn't work fine when a code contain <

or > )

The code is intentionally obscure.

Is possible to decide: position, zoom factor, number of iterations, and number of lines.
The output should be like this:

## domenica 5 ottobre 2008

### Vedic Math first lesson

the Sutra says: "By one more than the previous one".
With this sutra you can calculate mentally this fraction:

easy, isn't it?
In the next few days i'll give the explanation of this method.

## sabato 4 ottobre 2008

### Code reduction ( obfuscation in ruby code )

This ruby code is equivalent to the code in previous post

N = 13; k = N-1; r = (1..k).to_a ; e = [r.first, r.last];
r.each{a print(r.map{b e.include?(b*a%N)?"1 ":" "},"\n")}

## venerdì 3 ottobre 2008

### My first Ruby program!

This is my first Ruby program!

N = 13
def un( el, en )
[1, en-1].include?(el%en)?re=1:re=" "; return re
end

(N-1).times do a
(1...N-1).to_a.each{b print un((b+1)*(a+1),N), " "}
print "\n"
end
A little obscure, isn't it?
The output is ( as desired ):

1                     1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1

The same program in Scala can be written in this way:
object something {
val un = ( el:Double, en:Double ) =>
if( Array(1,en-1).contains( el%en) ) "1 " else " "

def main(args : Array[String]) : Unit = {
val N = 23
for(i <- 1 to N-1){ new Array(N-1)

.indices.foreach(el => print( un((el+1)*(i),N) ))
println()
}
}
}
and the output with N=23 is:
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1

## giovedì 2 ottobre 2008

### "Eyes follow mouse" in js

here is my interpretation of "eyes follow mouse" in javascript.
Nothing special but works fine.

an important function in this js is this one:

function objMove( obj, xPos, yPos ){
obj.style.left = xPos + "px";
obj.style.top = yPos + "px";
}

is a function that move an object of the page.
the important thing is that works with ie, opera and firefox
an example of this eyes follow mouse at work.

### Missing number

the result has 8 digits and the missing number is ... 8
soon i'll post some of Vedic maths