?

Log in

No account? Create an account
July 24th, 2009 - Sarah's Blog [entries|archive|friends|userinfo]
Sarah

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

July 24th, 2009

America - F*** yeah! [Jul. 24th, 2009|08:08 am]
Sarah
link2 comments|post comment

Distinguishing blue from green in language. [Jul. 24th, 2009|08:32 am]
Sarah
I can't tell the difference between blue and green dots on a holiday calender in work, unless I get up close.

I never realised entire languages had the same problem...

http://www.reddit.com/r/wikipedia/comments/93w6m/distinguishing_blue_from_green_in_language/

http://en.wikipedia.org/wiki/Blue-green_across_cultures
link4 comments|post comment

How does it feel to be gay? [Jul. 24th, 2009|03:09 pm]
Sarah
"Some background: the speaker is Brian McNaught. He's a professional LGBT educator that gets hired by corporations to teach workers how to create an accepting office environment for LGBT people. He has a few more videos on his Youtube page, but this clip is probably the best of them all."



http://www.reddit.com/r/lgbt/comments/941ue/this_is_how_it_feels_to_be_gay/
link2 comments|post comment

Javascript : Many ways of declaring objects... [Jul. 24th, 2009|04:49 pm]
Sarah
Back here I asked about the ways of declaring objects in Javascript.

I got inundated with a reply, from pavelpg. (Yay! You're the automatic winner, what would you like as a prize? I do photo retouching?)

In answer to my own question, I've found five, one of which pavelpg posted.

Here they are:

One: Nested functions, and "this".
function Circle(radius)
   {
   function getArea()
      {
      return (this.radius*this.radius*3.14);
      }

   function getCircumference()
      {
      var diameter = this.radius*2;
      var circumference = diameter*3.14;
      return circumference;
      }

   this.radius = radius;
   this.getArea = getArea;
   this.getCircumference = getCircumference;
   }

Two: Linking external functions and states via "this".
function Circle(radius)
   {
   this.radius = radius;
   this.getArea = getArea;
   this.getCircumference = getCircumference;
   }

function getArea()
   {
   return (this.radius*this.radius*3.14);
   }

function getCircumference()
   {
   var diameter = this.radius*2;
   var circumference = diameter*3.14;
   return circumference;
   }

Three: Creating objects using Literal Notation
Another inline way of defining an object is via literal notation.
Supported in JavaScript1.2 and above, it's a more robust form of creating an
object on the fly:

awesome=
   {
   commonSense:null,
   standardsCompliance:"50%",
   init:function()
      {
      // code
      },

   doStuff:function()
      {
      // code
      },

   doMoreStuff:function()
      {
      // code
      }
   }

Four: Creating objects using new Object()
The simplest way is to use the new operator:

myscript=new Object();
myscript.current=1;
myscript.init=function()
   {
   // some code
   }

myscript.validate=function()
   {
   // some code
   }

Five: Prototyping
Prototype is a type of inheritance in JavaScript. We use it when we would like
an object to inherit a method after it has been defined. Think of prototyping
mentally as "attaching" a method to an object after it's been defined, in which
all object instances then instantly share:

function cat(name)
   {
   this.name = name;
   this.talk = function()
      {
      alert( this.name + " say meeow!" )
      }
   }  

cat.prototype.changeName = function(name)
   {
   this.name = name;
   }

firstCat = new cat("pursur")
firstCat.changeName("Bill")
firstCat.talk() //alerts "Bill says meeow!"

link1 comment|post comment

Victim of fashion. [Jul. 24th, 2009|05:42 pm]
Sarah
link2 comments|post comment

Mirrors are intelligent! [Jul. 24th, 2009|07:23 pm]
Sarah


Stop and think about this for a second...

When you look into a mirror, the left and right sides are reversed, but not the top and bottom!

Freaky eh?

What if you put the mirror on its side?

*Brain asploads*
link3 comments|post comment

Tic-Tac-Toe fractal. [Jul. 24th, 2009|10:51 pm]
Sarah
Every possible move in the game of Tic-Tac-Toe is shown below in a fractal...



"In the largest view of the fractal, shown [above], patterns of yellow and blue can be used in the color[sic] version to indicate wins for O and X, respectively, though the yellow wins in particular are small enough--meaning deep enough in the game--so as to be practically invisible. Were the resolution of our illustration great enough, and our eyes sharp enought[sic], we would be able to see all such wins embedded in the image. Winning strategies, as a matter of fact, could be thought of as spatial movements through the fractal toward those winning games."

Imagine this with Chess!

http://www.sunysb.edu/philosophy/fractal/2Tic.html

Here's a playable version I found, it says "Draw" after the first move in Firefox. =(
http://ted.mielczarek.org/code/ticfractoe.html?boardsize=800&maxdepth=3




To make the smallest complete viewable image, with the smallest board being 9 pixels across (3 pixels across, enough to draw an X or an O) would require an image 59,049 x 59,049 pixels across. (310)

Move 1: 3 pixels per cell, 3 cells = 9 pixels
1: 3 x 3 = 9 123|456|789

Move 2: 9 pixels per cell, 3 cells = 27 pixels
2: 9 x 3 = 27 123 456 789 | 123 456 789 | 123 456 789

Move 3: 27 pixels per cell, 3 cells = 81 pixels...
3: 27 x 3 = 81 123 456 789 | 123 456 789 | 123 456 789- - - -123 456 789 | 123 456 789 | 123 456 789- - - -123 456 789 | 123 456 789 | 123 456 789

4: 81 x 3 = 243

5: 243 x 3 = 729

6: 729 x 3 = 2187

7: 2187 x 3 = 6561

8: 6561 x 3 = 19683

9: 19683 x 3 = 59049

The biggest zoomable stitched image I've made so far is "Outside the Cathedral", which comes in at a relatively tiny 35325 x 15197 pixels, which is 536.8 mega pixels. ( http://www.untamed.co.uk/zoomify/index.htm )

So this tic-tac-toe beast would be 3.5 Gigapixels! (I can't find it on the net)
Now here's a challenge worth doing. =)
linkpost comment

navigation
[ viewing | July 24th, 2009 ]
[ go | Previous Day|Next Day ]