Thursday, September 6, 2012

MY hard drive situation :(

About six months ago I lost my primary hard drive. Usually not a big deal however this happened right smack in the middle of the hard drive crisis. There was not a $100 hard drive to be found anywhere. The least expensive options where low end undesirable drives at around $400 at the time and I just refused to do it. The solution was to buy a 120 Gig SSD which was at least monetarily less costly about $220. This was a more desirable drive and I convinced myself that it would be enough as I still have secondary drives with mass storage to save large programs etc. Well it is enough kind of, I generally have about 16 to 30 gigs free at any given time. I have to maintain the drive like crazy moving things off into the secondary storage device to stop it from filling up. I don't like seeing theses low numbers and it drives me nuts. So just a fair suggestion to anyone out there reading this buy at least the 250 SSD gig and save yourself a few headaches!

Wednesday, September 5, 2012

java script tags

<tr> = table row
<td> = table cell
<td> rowspan = #   = specifies the number of rows a cell should span

java Script Initalation notes

On load, run function when window is initlized.
<window.onload = function1();function2,...,functionN>

Java Script Events

simple mouse events:
<onclick = function1();function2,...,functionN>

Simple mouse event with a button

<button onclick = function1();function2,...,functionN>

Sunday, September 2, 2012


The other day I purchased a copy of the Hunger Games on Blue Ray. I could not for the life of me get the sound to work correctly on my PC. I remembered having Sound issues years ago with DVD movies. The problem in the past had to do with 5.1,6.1 ect sound systems and DTS drivers. The solution back then was just to upgrade my whole computer sound system.

So I thought to myself does this apply in today world, well for me probably as I have just been using the on board sound that came with my Asus m/b ever since I burnt up my last sound card. The sound could have always been better but never me any real problems. Now that I am older and don't really play video games and less dependant on my PC for entertainment the solution was fine. Long past the day that I spent thousands of dollars every year keeping my Power of Tower god like.

So after doing some research, the bottom line is that sound has taken a major leap forward with 3-d sound and other features and my on board sound system just was not up to challenge. So I broke down and purchased a Sound Blaster Recon (the cheap version) it was about $100. I have to tell you guys that this card makes such a huge difference not only can I now watch my Blue ray's on my PC but everything else sounds 100 time better.

I am sure there are many of you out there that have just let your sound system go, but this is an upgrade worth doing, I love it to death.

Saturday, August 25, 2012

Multi Threadinging in Java

The Basics

to create a thread-able  program you need the following
  Runnable interface                -> Runnable Object
  Requires a Thread Manager (in main) -> Thinking to use hash-map to handle this
  Requires Thread Launch -> Start method;


**********************ugly class notes ignore this is for me only***************

Runnable Object ->(Starter Method) an object that is runnable (multi thread)

public void run() -->launch 2ND thread

Runnable Object is an Object that implements an interface Runnable which contains a single method

Creator of Threads: how to create a thread manager Object

Java Support
Thread (Manager) ||  Runnable

uggg explanation is a mess but here is the a code example

public class Message implements Runnable  {                                                            
private String message;                                                                                     
public Message (String msg)                                                                             
message = msg;                                                                                     
public void run()                                                                                            
for (int i = 0 ; i < 100; i++)                                                                       
       //Thread.yield()// TODO Auto-generated method stub                               

public class Main {

public static void main(String[] args)
//create Runnable objects
Message m1 = new Message("X");
Message m2 = new Message("Y");
Message m3 = new Message("Z");
//Create Thread manager objects
Thread t1 = new Thread (m1);
Thread t2 = new Thread (m2);
Thread t3 = new Thread (m3);
//start threads
for (int i = 0 ; i < 1000; i++)
// System.out.println(m1);

Tuesday, August 21, 2012

JAVASCRIPT == or ===

In JavaScript we have loosely defined vars so this means that if you have

a = "5"
b = 5

that using (a==5) will return true even though they are not the same var (object) type. This can be annoying and can lead to errors. On the more realistic side who compares strings to ints without first parsing anyway. Well being a loose var system I guess it could happens to anyone. So the solution is to use === which will test for both value and object type to be equal.

Now the question comes up, what about comparing properties in polymorphic objects. At first thought we you might think that === will cause the comparison to fail when comparing two objects that are of different sibling types of a common parent. However this is not an issue as when doing this comparison we are actually only test each var that was extracted from those objects and not the object themselves. In other words the var type of the property becomes the comparable object which requires us to revert to using the === anyways.

So to answer the unanswered question: who compares strings to ints without parsing first well the answer would JavaScript programmers :)


Finally figuring this out, JAVASCRIPT API or at least the standards guide follows ECMASCRIP requirements. So Finlay an actually resource that actually means something. This is so important.

also see the following book
Event Processing in Action
Authors:Opher Etzion
Peter Nibblett

book 2: This is the best Java Script book I have to date, the best part is it actually has a real API in it, I have been looking for this for weeks now I found it. This book is key to learning JavaScript correctly.

Java Script : The Definitive Guide , 6th edition or higher
By:David Flanagan  publisher: O'REILEY

Monday, August 20, 2012

Event Handdling in General

Ever get frustrated while programing your event handling: mouse, keyboard,buttons etc. I have found this missing link, I ran across this book call Event Processing in Action. I was curious and was frustrated programming my mouse in JavaScript so I bought it. I read the first three chapters so far and it's a wonderful book. It teaches event handling from a theoretical point of view so it might not help you with whatever language your working with, however it will improve your understanding of what is really happening in the background. Armed with this knowledge you will be able to turn your self in a Event Handling Guru. So just to share with whoever is interested in the topic I thought this book should be brought to light.

The book :
Event Processing in Action
Authors: Opher Etzion & Peter Niblett

Friday, August 17, 2012

JAVA SCRIPT: arguments variable


this is a key word var in javascript it holds all vars past to a function regardless if the constructor could assign them or not. So in short this allows you to create functions with an arbitrary number of functions.


Today I learned about JSLINT. Js Lint is a program to which you can run your javascript through to check for errors, coding style and various conventions. As javascript has very loose rules it difficult to debug. Following the JSLINT conventions and rules will hopefully help you produce better, more reusable and sharable code. JSLINT was a developed by Yahoo's top developers.

you can get JSLINT and documentation at:

also see the videos by Douglas Crockford at

Douglas Crockford: The JavaScript Programming Language

Why learn JavaScript & some great video footage

Watch these videos (sorry have to use youtube) since the normal hosting site is a joke!

I have update this link, will make it easier to locate all 3 movies!

I'm always reading about creating fast and usable websites

Ever wounder why people refuse to use  or abandon websites: I have started a list of examples of such sites.

1.) # just try to down load the HD videos have fun, or you an opt for the alternative and watch the embedded one which will give you a total headache in minuets because of the poor sound and video quality.

Thursday, August 16, 2012

javaScript: Nested Functions

Another Intresting concept that poped up in JavaScript
:nested functions inside of other functions : This provides a way to make a function private. If you want these be accessable there must be a accessor method in the outfunction otherwise they will be unreachable outside of the outter function

Here is an Example of what this looks like.

<!DOCTYPE html>
    <title>Nested Functions</title>
    <script type="text/javascript">
          function initiateMadness() {
            var sparta = {
                name : "Sparta"
            function madness() {
                alert("THIS. IS. " + + ".");
            document.onclick = makeAMessenger(madness, sparta);
//access the content of the inner function
   function makeAMessenger(func, context)
<script type="text/javascript">
<h1> Heading 1 </h1>
<p> THis is my program </p>

Java Script : Array of functions

Another intersting concept that I came across:
Java Script allows you to create an array of functions, took me a while to make this work but I finally got it. Here is example of how to do this:

<!DOCTYPE html>
    <title>Array of functions</title>
<script type="text/javascript">
function transform(array)
         function makeFunction(value)
             {return function()
                    return value;
       var output = new Array();
       for(var i = 0; i < array.length; ++i)
              output[i] = makeFunction(array[i]);
       return output;
<script type="text/javascript">
myArray = [1,2,3,4,5];
myArray = transform(myArray);
for(var i =0 ; i < myArray.length; ++i)
    alert( myArray[i]());


MY WorkSpace

After college light reading

Now that I'm out of college I can fianlly take the time to leaen how software is built in the real world :)

Tuesday, August 14, 2012


Java Script Notes + html

      <!--   script goes here  //--> #this format will hide the script from the user

action   =[url] #Specifies where to send the form-data when a form is submitted 

  boxes # pops up a box for the user to interact with
          alert #alert("sometext");  use to alter user they missed something
          confirm#comfirm("some text"); use to confirm something
          prompt#prompt("some text",defaultValue)
                example# var userName=prompt("Please enter your name","Harry Potter");

  Break in line #<br /> #add a line break

 button # creates a button user can interact with
   Sub Types
             #<button type="button" onclick="myFunction()">

button methods # used to program the button
       #<button type="button" onclick="myFunction()">

   document  #javascript class with many function
                  .getElementById   #access html element
                         #document.getElementById("demo").innerHTML="My First JavaScript";
                   .write # write directly into the html document
                         #document.write("<p>My First JavaScript</p>");


<form> Creates a form for the user to enter data

 function <function name> #design your own java Script function f
     #function myFunction(){code goes here}


id " " id html element
    #<p id="demo">My First Paragraph</p>

input type = "type goes here "#create a moduel the user can interact with

   return #used to return a value at end of a function

 scr = "scriptname.js" # points and loads external java script file
 <script> Insert Java Script

 <script type =" script type">

<ul> #unordered list
    #followed by several <li> # list item

value # assign a value to a button (value is usally a string of text)

var  [var name] # declare a variable

Saturday, August 11, 2012

Notes on Git / GIT HUB

Git add # add file to the stage
  [file name] add file to stage
  . # add all file and sub directories to stage
  -all #add all file in current directory

Git commit # commit staged files
   -m  add a message# " message goes here "

git remote
  add # add a remote to remote list
  rm # delete a remote from the remote list

git remote add #example
     git remote add origin

git init # create a Git repository for current project

git push remote  # pushes code to remote site
    Master (or any branch) send code to stated branch

git pull remote # pulls data from remote and updates local data
    Master(or any Branch) grabs data from stated branch

How to start a new repsoitory
1) Declare the depository on your git site in my case git hub
2) in the root directory of your project issue command ->git init
3) issue-> git add .
4)issue ->git commit -m "inital commit"
5) create remote ie ->git remote add origin
6) git pull origin master
7) git push origin master
That's it your done :)

Music That I listen to while coding

I have been listening to theses groups lately

Aphex Twins
Massive attack
Thievery Corp

WebSites That I have joined or use as a resource

General /tools #programmers blog site and much much more # Code storage and sharing site  # monitors web site performance and helps improve it # where I keep my programming notes :) # Launching site to test my web programs # resume and serves as a central hub to my professional info /projects  # Where I can display some of my more graphical programming projects

HardWare/ Supplies / Books / software # where I get most my programming books and spend most my money # they take what ever money is left over ->preferred hardware shop # Great place to get compilers and other software at academic pricing

API/DOCS #deocs on java script #api for JQuery # api for ruby #api for java # docs for git # has docs / api /tutorial for many languages

Ruby Rails: switches

Rails new:
-T #do not generate a test Directory; do this to replace test with Rspec also need to install Rspec $rails generate rspec:install


<%=link_to 'link name', .... > create a link

<body> This is core html coding area: contains all data and interaction with the user
<br> single line break #has not end tag

<h#> HTML header # documented to only be (1-6)?
<head> container for the head elements # see
<HTML>  root element also lets browser know that this is a HTML document

<p> paragraph tag, start a new paragraph #adds spaing and formating to document text


<tr> define a row
<th>header cell
<td>standatd cell
<table> create a table
<title> Create a title # this is a required <head> element

using Json in Java: non file output

I had to write some java code that used JSON format for the final out but did so with out using files:
Here was the soulition to make this happen

while(counter < numOfTags)
if(outList[counter].getType() == 0)
String outputString = mySon.toJson(temp);

int counter;
Device[] outList;
Gson mySon = new Gson();
JsonObject temp = new JsonObject();
int numOfTags;

pushing to HeroKu : ERROR sqlite3

I have not really got to the source of the problem, I even read somewhere that heroku does not allow sqlite for security reason: who know the really story of why this does not work. Regardless here is the fix/

Add this code to the ruby gem file and commit it to your project and then you will be able to upload to heroku.

group :production do
 gem 'pg', '0.12.2'
 group :development do
 gem 'sqlite3', '1.3.4'

Ruby programming !sort

I was searching for a quick way to sort objects in Ruby and I found this ingenious method online.
deviceArray.sort! {|a,b| a.getName.downcase <=> b.getName.downcase}

deviceArray : an array of objects of type device
downcase : only needed if sorting alpa numerically or can use upcase

GIT HUB: Error while pushing

Error : did you run git update server....
 1. I fixed this by updating my remote: the problem is that the url is case sensitive\

Error: files out of Sync
 1. to fix this use git pull [remote name] [branch name] #branch name usally master

Error: No branch specified : add brach at end of push or pull comde