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

SOUND CARDS

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
 requires
  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;                                                                                     
                                                                                                               
}                                                                                                                        
                                                                                                                         
@Override                                                                                                       
public void run()                                                                                            
                                                                                                                       
{                                                                                                                      
 while(true)                                                                                                   
 {                                                                                                                  
for (int i = 0 ; i < 100; i++)                                                                       
    System.out.print(message);                                                                       
       //Thread.yield()// TODO Auto-generated method stub                               
                                                                                                                  
   System.out.println();                                                                                      
Thread.yield();                                                                                         
 }                                                                                                                     
}                                                                                                                    
                                                                                                                              
}                                                                                                                              



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
t1.start();
t2.start();
t3.start();
for (int i = 0 ; i < 1000; i++)
    System.out.print("M");
// System.out.println(m1);
//System.out.println(m2);
//System.out.println(m3);
}
}



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 :)

JAVASCRIPT : ECMASCRIPT STANDARDS and GREAT RESOURCES

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.


http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

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

arguments

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.

JAVASCRIPT:JS-LINT

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:
http://www.jslint.com/

also see the videos by Douglas Crockford at
http://www.youtube.com/results?search_query=Douglas+Crockford&oq=Douglas+Crockford&gs_l=youtube.3..35i39j0l9.5610.7677.0.8340.5.5.0.0.0.0.208.775.0j4j1.5.0...0.0...1ac.RCxFWzyRivM

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!
http://www.youtube.com/playlist?list=PL5586336C26BDB324&feature=plcp

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.) http://www.yuiblog.com/blog/2010/02/03/video-crockonjs-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>
<html>
<head>
    <title>Nested Functions</title>
    <script type="text/javascript">
          function initiateMadness() {
            var sparta = {
                name : "Sparta"
            };
            function madness() {
                alert("THIS. IS. " + this.name.toUpperCase() + ".");
            }
            document.onclick = makeAMessenger(madness, sparta);
        }
       
//access the content of the inner function
   function makeAMessenger(func, context)
        {  
            window.name = context.name;
            func();
        }
        initiateMadness();
    </script>
</head>
<body>
<script type="text/javascript">
</script>
<h1> Heading 1 </h1>
<p> THis is my program </p>
    
</body>
</html>

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>
<html>
<head>
    <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>
</head>
<body>
<script type="text/javascript">
myArray = [1,2,3,4,5];
myArray = transform(myArray);
for(var i =0 ; i < myArray.length; ++i)
{
    alert( myArray[i]());
}
</script>

</body>
</html>

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

THE HTML DOM

http://www.w3schools.com/htmldom/dom_methods.asp
http://www.w3schools.com/htmldom/dom_nodes_access.asp

Java Script Notes + html

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


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

B
  boxes # pops up a box for the user to interact with
     types
          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
             #<button type="button" onclick="myFunction()">



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

D
  
   document  #javascript class with many function
       functions
                  .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>");



F

<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}



I

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

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

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



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

 <script type =" script type">
     #text/javascript


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

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 https://github.com/DanielHaro/my_project.git


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 https://github.com/DanielHaro/my_project.git
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
Orbital
Zero_Seven
Thievery Corp
OSunLade