Imagining a Zettabyte

03.26.15

Posted by Diddly

Last night I watched a news story which mentioned a Zettabyte.  I know these terms can be confusing, and even I wasn't sure of the size of a Zettabyte.  So let's start small and work our way up with some easy to remember comparisons.  Every step up is 1000x bigger than the previous step.

A byte can be thought of (typically) as a single character.  This is the "base" unit for comparison.

1000 bytes is a kilobyte.  That's roughly the length of a joke or very short story.

1000 kilobytes is a megabyte.  You can think of that as a small novel, or if you're old enough to remember, about the capacity of a 3.5" floppy disk.

1000 megabytes is a gigabyte.  That's the size of a movie from Netflix.

1000 gigabytes is a terabyte.  That's a thousand movies!  Ten terabytes could hold the entire U.S. Library of Congress.

1000 terabytes is a petabyte.  That could hold over 13 years of HD video.  50 of these would hold the entire written works of mankind from the beginning of recorded history, in all languages!

1000 petabytes is an exabyte.  It's hard to imagine that much information, but it's believed that 5 of these could hold all the words ever spoken by human beings.

1000 exabytes is one Zettabyte.  According to the story I watched last night, this is how much surveillance data the NSA supposedly collected last year.

Seriously?  I knew they gathered a lot of information, but that is stunning!  Also, the congressional committee for intelligence said this was not an invasion of privacy, since nobody knew they were being surveilled, and thus did not complain.

I notice some sources say the NSA data centers can hold one Yottabyte.  That's 1000 zettabytes, and about the size of the entire internet.  Over a high speed connection, it would take about 11 trillion years to download that much information.  

Why I prefer iOS

03.26.15

Posted by Diddly

Brand loyalty isn't much of a motivator for me.  I don't owe product companies anything beyond the sale price of their wares.  Sure, particularly dickish companies can make me brand disloyal, but the only way to earn my dollars is by producing something I like or want or need.

In this post I want to discuss a particularly polarizing topic.  iOS vs Android.  These are the two gorillas in the smartphone and tablet market space.  As soon as someone identifies what type of device they have, they are immediately dismissed as having a bias towards their device.  Well, I have both Android tablets and Apple tablets.  Yes, plural, for both.

A common pitfall in any discussion is to play the "spec" war.  Every month there's a new better device with better specifications announced.  Somehow the mere announcement invalidates any argument against that particular line, so I'm throwing specs out the window.  They're a red herring.  More storage / resolution / ram / Ghz / mWh doesn't make one device better than another, unless you specifically need that attribute to be happy.  In which case, this post isn't for you.

I'm going to talk about what a mobile device needs to make me happy, beyond just being useful.  It's only 2 things, and only one vendor (to my limited experience) gets them both right.  I welcome counter-arguments on these points.

1) Battery Life
I like my mobile devices to be able to hold a charge for a long time.  Ideally, I'd like to measure that in weeks, but will settle for days.  Definitely not hours.  If I can't put your device to sleep and a week later pick it up and use it, you lose.  Note that I specify "sleep", not "power off".  Mobile devices need to be instantly ready to use, not two minutes after it boots.

2) Software shouldn't dictate model
This is essentially an argument against "fragmentation".  If I buy a modern device, I want to know I can run anything from the software store on that device.  The device is useless without software, and it just sucks to discover incompatibilities with something you really wanted to use.

2b) Jailbreaking / Rooting does not excuse 2)
Not all devices. from either line, can be Jailbroken or Rooted.  Even if it can be hacked in such a manner, it means sacrificing the continued support from the manufacturer.  And even then, it still doesn't guarantee you'll be able to run the desired software.

Fragmentation was actually the motivation for this post.  I found this excellent analysis of Android fragmentation and discovered it was even worse than I thought.  link

In the following images, taken from that article, you can see just how many different makes and models of android devices there are in use today.  In fact, there are more than 11,000.  Every piece of software in the Google store runs on some subset of those devices.  The odds of a device you purchased being able to run a given app decreases with every segmentation between your device, and the device is was written for.  As you can see, there's a lot of divisions.

Even if you take the hardware out of the equation and just look at the operating system version, there is still a lot more incompatibility with Android.  The pie chart shows the predominance of different versions in the wild.

Because of these two factors, I currently choose iOS as my mobile platform of choice.  This could change if something comes along and does a better job with either of my two points while still being useful.

Chromebook Remote Desktop to Linux

03.26.15

Posted by Diddly

Here's how I set up my Samsung Chromebook (which uses an ARM cpu) to connect to a linux (specifically Lubuntu 12.04) host over RDP using an SSH tunnel, without resorting to Developer Mode.  I suspect I'm not the only person who wants to be able to do this.

The Server
On your linux host, install the excellent X11RDP-o-Matic script.  link  Note, this only works on Debian based linux, like Ubuntu.

I literally used these three steps:
1. sudo apt-get install git;
2. cd ~ && git clone https://github.com/scarygliders/X11RDP-o-Matic.git && cd X11RDP-o-Matic;
3. sudo ./X11rdp-o-matic.sh –justdoit && ./RDPsesconfig.sh;

Now I can log into my linux work PC using Microsoft's Remote Desktop Protocol.

I'm going to assume you already have an SSH server on your LAN that you can access from the internet for the purposes of tunnelling.  If not, a Google search can help you: link

The Client
On your Chromebook, install the Ericom AccessToGo software.  It's free in the web store.

Hit Ctrl+Alt+T to get the Chrosh shell.  Then enter ssh to get the secure shell client.  Once there, enter the appropriate parameters:
ssh> forward 8000:x.x.x.x:3389
ssh> host y.y.y.y
ssh> user your-ssh-username
ssh> connect

where x.x.x.x is the ip-address or name of your host PC on your LAN, and y.y.y.y is the ip-address or name of your ssh server on the internet.

Finally, launch the AccessToGo app.  Enter localhost:8000 as your host, and the username and password to log into your linux desktop.  That's it!

I Can IClone

03.26.15

Posted by Diddly

For an upcoming project I had to start working with a 3D animation tool called iClone 4.  Now, before tonight, I really had no clue how to make a 3D movie.  I probably still don't.  But I can make some pretty cool stuff in iClone!  I just wanted to share what I was able to put together in just one evening of using this software.

View a dialup friendly video here: link  Yes, that's me in the video.


Learning Lua - Part 2

03.26.15

Posted by Diddly

Corona implements a Box2D physics engine. Using it, you can make some very impressive interactions. Just take a look at their sample code for Simple Pool and you'll see how easy it is to have objects moving, spinning, and colliding.

For Mobile Zombies I was mainly interested in the Collision detection. I was hoping to throw in some brick walls, and have the zombies alter their course when they encountered the obstacle. This technique worked well for Zombie Slaughter 3 (which never progressed beyond a tech demo), but required the ability to "look ahead". I would calculate the next position, see if it would collide with something, then alter accordingly. This gave the effect of zombies rushing past barricades like streams of water.

Unfortunately once we inject a proper physics engine into the mix, the Zombies get a little crazy. They start bouncing off things and spinning. Neither of which is an effect I desire.

Here's what I've learned so far about physics in Corona:

  • Always start the physics before setting gravity. Since Zombies is a top down view, I wanted to set gravity to 0, but Corona would abort as soon as it hit that command. Gravity may be a property, but physics needs to be running before it can be updated.
  • dynamic, kinematic, and static collision restrictions. A dynamic body type can collide with another dynamic body, or even a static, but no collision is registered when it encounters a kinematic object. Similarly, kinematic does not collide with static objects.
  • You can use getLinearVelocity() for self-propelled objects, to see if any additional force is required to keep moving. I don't know this is the best way to do things though, since I'm not quite happy with the motion of my Zombies yet.
  • zombie:applyForce( xspeed, yspeed, zombie.x, zombie.y ) will move the zombie straight. If you use different x and y coordinates for the center of your force, is gets calculated as spin. Boy did those zombies twirl when I tried the center of the screen!
  • A handy function for calculating your vectors is something that returns either 1 or -1 depending on the sign of the input.
    function sign(x)
    return (x<0 and -1) or 1
    end

    Here's an example usage, to throttle the maximum force applied horizontally.
    local xspeed = zombie.destx - zombie.x
    xspeed = sign(xspeed) * math.min( zombie.maxSpeed, math.abs( xspeed ) )



Learning Lua - Part 1

03.26.15

Posted by Diddly

I've started a new project (but don't worry, I haven't abandoned Everwar). I've just purchased the Corona SDK, which lets you quickly and easily write mobile applications for Android, iPhone/iPod Touch, and iPad. Corona uses the language Lua as a base, which it then compiles to run on any of the devices. I'm a big fan of the "write once, run anywhere" approach.

Lua is a high performance interpreted language used in many games already. I believe it's usually used for AI in a game, but Corona has extended it to a complete solution. I've never used Lua before, and I've toyed with the idea of writing mobile games, so this seems like an excellent learning opportunity.

This series of posts will be about the lessons I learn writing in Lua for the first time, as it relates to using the Corona SDK. The project? A mobile version of Zombie Slaughter.

First Stab
In just under an hour, I was able to figure out how to draw a background, animate a single zombie, move that zombie, and then create lots more zombies. The code has been surprisingly straightforward. The only surprise I had was scaling the background to fit whatever screen resolution the device offered. The SDK api documentation suggests to me that if you write:
local background = display.newImage( "background.jpg", true )

it should auto scale it to match the screen resolution. It didn't. Perhaps it's just because the Game edition of the SDK is still in Alpha, but all it took was doing the scaling manually.
background:scale( display.contentWidth/background.stageWidth, display.contentHeight/background.stageHeight )


So here's the entire code for my first Mobile Zombie Slaughter demo:
-- Zombies Mobile Take 1

require "sprite"
display.setStatusBar( display.HiddenStatusBar)
math.randomseed(os.time())

-- load the background
local background = display.newImage( "background.jpg")
background:scale( display.contentWidth/background.stageWidth, display.contentHeight/background.stageHeight )
-- reposition background since scaling puts origin in middle of image
background.x = background.stageWidth/2
background.y = background.stageHeight/2

-- load the zombie
local zombieSheet = sprite.newSpriteSheet( "zombie_anim.png", 32, 38 )

local zombieAnimation = sprite.newSpriteSet( zombieSheet, 1, 4 ) -- startFrame 1, 4 frames
sprite.add( zombieAnimation, "zombie", 1, 4, 1000, 0 ) -- start frame 1, 4 frames every 1000 ms, loop forever

-- init the zombie pool
local zombiePool = {}

local function addZombieToPool()
     local zombie = sprite.newSprite( zombieAnimation )
     zombie.x = display.contentWidth + 32
     zombie.y = math.random (32, display.contentHeight - 32)
     zombie.dx = 0.02
     zombie:prepare("zombie")
     zombie:play()
     zombiePool[#zombiePool+1] = zombie
end
     
-- a per-frame event to move the zombies
local tPrevious = system.getTimer()
local maxZombies = 500
local zombieIncrement = 5000
local lastZombieAdded = tPrevious
local function move(event)
     local tDelta = event.time - tPrevious
     tPrevious = event.time
     
     local xOffset = ( 0.2 * tDelta )
     -- iterate through each zombie and move it
     local i
     for i = 1, #zombiePool, 1 do
          zombiePool[i].x = zombiePool[i].x - zombiePool[i].dx * tDelta
          if (zombiePool[i].x + zombiePool[i].stageWidth) < 0 then
               zombiePool[i].x = display.contentWidth + 32
          end
     end
     
     -- see if it's time to add a new Zombie
     if #zombiePool < maxZombies then
          if (event.time - lastZombieAdded) > zombieIncrement then
               addZombieToPool()
               lastZombieAdded = event.time
          end
     end     
end

-- Seed the pool with a starter zombie
addZombieToPool()

-- kick it all off
Runtime:addEventListener( "enterFrame", move );


And the Winner is...

03.26.15

Posted by Diddly

Cliffhangers have long been a device for generating suspense, and hooking the reader/viewer into continuing to pay attention. The desire to know what happens next out weighs their frustration at not being told up front. In the hands of a master, this technique can drive a reader to stay awake all night till they finish the book, or stir the viewer into frothy anticipation for the next episode. But more and more I'm seeing terrible abuse of this tool and it's no longer suspenseful... it's just cruel teasing.

I was watching an episode of BBQ Pit Masters today at lunch, and they dragged out the reading of the winner's name off the card over one commercial break and half a segment between commercials. As annoying as it was, it still wasn't as bad as an acapella competition I saw which actually dragged it out over two commercial breaks. Now when I mean "dragged out", I start counting from when the host has the card in their hand and have uttered the phrase "And the winner is..." till the time at which we actually find out the name that completes that sentence.

I used to think this counted as False Suspense, but it's not. Not unless they were announcing who was being eliminated, and then after much ado revealed that nobody has to leave. That's false suspense. This is just needless time wasting.

But it's not just reality tv game shows that are laying it on a bit thick. Series dramas are going over the edge with their cliffhangers as well. Let's take the popular show True Blood for example. The main heroine in the show is Sookie Stackhouse. Apparently she's got more than just mind reading powers. The big question is, "What is she?" The writers "keep the suspense" by keeping it a secret from the viewer, even though the characters are finding out.

I think, if you end the majority of your scenes with the lead up to a big reveal, then cut away to some other thing, you're just being mean. Far more potent in my opinion is delivering the reveal and leaving the audience in awe over the implications.

The Secret Powers of Women

03.26.15

Posted by Diddly

Women have secret powers. It's true. They won't tell us men about them, but sometimes it slips. Like when they know what we're thinking even if we don't. But they know we already know about that power. They read it in our minds. So now they just admit they have to be mind readers to understand us.

I'm talking about a different power this time though. I've suspected it for some time, but it dawned on me as I scrubbed the bath tub. They can see things we men can't. My brothers, there's a colour, out of our visual range, that glows like a beacon to women. They call it "dirt". I imagine it must be some kind of glowing evil brown. Whatever it is, I can't spot it like a woman can.

When she tells me "The bath tub needs cleaning," I take her word for it. I scrub every inch of that thing, because I know if I miss a spot, she'll be able to see it like a radiant blemish. It doesn't matter that it looks the same to me after I finish. I apparently can't see that colour. But hopefully I did a good job in washing it away so she doesn't have to see it.

Past Articles