Monday, January 30, 2012

Tonight

Okay.  So I've gotta go.  This'll be quick.  I've got lasagna that's probably all ready cold and garlic bread that probably all ready sucks.  I tried to debug some code tonight but with no real success.  Tomorrow I've got to do more useless shit for work which I will do because I need to build up my nest egg and keep going until a VC comes along and decides to fund me. But that won't happen until I get my product up and running and get some revenue actually flowing which will probably be in June or so.  So let me get to eating and then get to bed and wake up tomorrow morning and get back to work.  And then hit my hotel tomorrow night and get back to work debugging and working.  

I want to get this JSON verification done so badly that it's annoying me.  I'm almost there. If I can just get through two more small steps I'll be there and can get back to programming in JQuery and taking the next steps for this site.  The SQL, the Inserts, the phone and email AJAX data checks, removing some of these damned alerts which helped me in debugging, adding the session object, and then punching someone. 

I realized I am an engineer.  I hate when things don't work.  I curse.  And I want to punch something regularly.  I am eager to get GFM built so I can release it, build a large business, sell it for billions, send a bunch of poor black kids to schools and move on to my next conquest.


Onto cold lasagna. 

Sunday, January 29, 2012

Productivity

I feel like I had a pretty productive weekend.  It was good.  I did some solid work on GFM and feel like I generally had a productive weekend.  I have to stop messing with girls that are no good.  I want my kid to have a good mom and I must be more careful if that's going to happen.  Now what else?  Well, I did some good work on the application, not as much as I'd like but generally it was really good.  

I feel like I was productive and am in a good place.

Routing Number (371) Sum Check Algo in PHP

Routing Number Check Sum Algorithm in PHP (371 371 371).  Check it out.


<?php


    function routingNumberCheckSum($routingNumber)
    {
       
       
        $routingArray = array();
        $total = 0;
        $i = 0;
       
        for($i = 0; $i < strlen($routingNumber); $i++)
                    {
                      
                           if (!isset($routingArray[$i])) {$routingArray[$i] = 0;}
                      
                        $routingArray[$i] = intval(substr($routingNumber,$i,1));
                      
                          
                          
                        if ( $i % 3 == 0 )
                        { 
                            $routingArray[$i] = $routingArray[$i] * 3;
                          
                              
                        }
                        elseif ($i % 3 == 1)
                        {
                          
                            $routingArray[$i] = $routingArray[$i] * 7;
                          
                        }
  
                          
                        $total = $total + $routingArray[$i];
                    }
                  
                   
                  
                    if ($total % 10 === 0)
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }
                }
   
   



?>

Luhn Algorithm in PHP

Here's the Luhn in PHP.  Check it out.

<?php
    function luhnCheckSum($accountNumber)
                   { 
              
                                         
                    $accountArray = array();
                    $total = 0;
                    $i = 0;
                  
                   
                   
                    for($i = 0; $i < strlen($accountNumber) - 1; $i++)
                    {
                      
                      
                        if (!isset($accountArray[$i])) {$accountArray[$i] = 0;}
                      
                        $accountArray[$i] = intval(substr($accountNumber, $i,1));
                      
                       
                      
                        if ( ($accountArray[$i] > 9)  && ($i%2 == 1) )
                        {
                            $accountArray[$i] = 1 + $accountArray[$i] % 10;
                          
                              
                        }
                          
                        $total = $total + $accountArray[$i];
                    }
                  
                    $total *= 9;
                  
                    $lastDigit = 0;
                  
                    $lastDigit = $total % 10;
                  
                    $checkSumDigit = 0;
                  
                    $checkSumDigit = intval(substr($accountNumber, 9, 1));
                  
                    if ($lastDigit === $checkSumDigit)
                    {
                        return true; 
                    }
                    else
                    {
                        return false;
                    }
                  
                }


?>

Power Rule 1: Always have something they need

Tonight I was helping someone close to me with their business challenges.  I like helping people I love with their challenges.  I want to see them succeed.  There was someone else that I told a price for a service they were asking for and they pretty much told me to screw off.  I obliged and went on my way, confident that if I held out (if I completely forgot about their request and was perfectly willing to walk away) that I would win, that they would crumble and come back.  Well sure enough that's what happened.


Today I was watching Meet the Press and lo and behold that person came back and increased her price by 33%.  


Always have something they need.


I have seen this lesson rear it's pretty little head time and time again.  People are willing to throw other people away easily.  As much as we'd all like to think we're indispensable we are not.  Most of us are completely dispensable.  And people will dispense with you as soon as they can if they do not have an emotional connection to you.  Unfortunately, emotional connections are tenuous and complicated at best and are whimsical, able to turn on a dime like a tornado.  However, having someone by the short and curlies, having something someone else needs at a time that they need it gives you incalculable power.  The playing field shifts.  And when it does exploit it.  Exploit it for everything it's worth if this person does not mean anything to you.  If they do mean something to you press your advantage at some level.  People do not respect others who do not display a killer instinct, especially among women.  


A guy might see it as loyalty that you did not exploit him and he'll be grateful for it.  He very well may feel an obligation in the future to pay you back for the good you did him, especially if you bookmark it in his mind by telling him "you owe me one."  He'll remember and unless he is a total douchebag he'll repay.  But a woman is a different story.  If you don't exploit her she'll disrespect your killer instinct and you'll permanently be in the friend zone.  If she is a family member simply extract a fair price, some form of compensation, i.e. a meal or something just so their is recognition of your work.  If you do not force some material recognition of your work she will devalue it in her mind and treat it, and thus you, flippantly.  


I have used this lesson time and again in my life.  With an employer I have a skill that they desperately need.  For a time it makes me indispensable.  In that case at that particular moment ask for a raise.  Never let this opportunity slip away.  They will surely exploit you if they get the chance therefore make sure they never do.  


With women if they need a place to stay or they need a shoulder to cry on or to be reassured, press your advantage in some means.  If you do not they will not respect your virility.  


Always make sure you have a skill that someone needs and is willing to pay dearly for.  Increase your advantage, financially or otherwise until you put yourself in a position that you can own the enterprise.  Then you have something everyone needs:  a paycheck.  


Are you planning to ignore this rule?  The alternative is graveling, begging, kissing ass and losing your dignity.  As sad as it makes me this is can be a dog eat dog world.  Be noble.  Be regal.  Treat people well.  But in order to do all of those things you must be the lead dog.

Things to do for GFM

Things to do for GFM:

1.  On server side in JSON validation script check on:

     a.  "Send Check" option: address actually exists within Google Maps API.
     b.   "Pay Pal" option:  use PayPal API to do some validation on this option.
     c.   "Money Gram":  program the Money Gram front end to make sure all the information exists.

That's it for now. 

Saturday, January 28, 2012

The Challenge

Today I woke up at 6:00 am and immediately started working on GFM.  Unfortunately (and fortunately) for me a friend called, said she wanted to come by and we spent some time together.  Unfortunately that time included gin and now it's four o'clock.  I so want to get up and just write off the day.  But the gin wore off two hours ago.  I started my day ultra-motivated but now I am having to force myself to focus when I started off like a laser.  

Thus the title of this blog post, The Challenge.  It is easy to simply give up and stop programming and go find something else to do.  But that'd hurt me in two ways: I'd lose momentum and I'd lose some self-confidence.  Confidence in yourself just like confidence in anyone else must be earned.  I know I'll regret it come Monday when I forced to work on some beat ass project that I let this weekend flit away.


Today I simply want to get two things done:  

1.  JSON Validation on the Server Side


2.  JSON-based notification on the client side with highlighting of fields that need work.


3.  JSON DB Upload (SQL)


4.  AJAX confirmation that the phone number is not in the DB before it submits.


That's what I want to get done.  Okay.  Maybe it's four things.


Back to work.

Thursday, January 26, 2012

Sticktoitivness

Yesterday I realized that playing music and writing books would make me happier in the short term.  But I have started a project with GFM.  I have other projects that I'd like to start, websites I'd like to run, services I'd like to provide and not doing them would be a real blow to my own self-esteem, to my own sense of self worth.  While sometimes when I'm working on a technical task I'd rather do something that is pure fun (programming is fun but I'm in that learning/growing stage which usually isn't the most fun ... the most fun for me is the mastery stage where you can do whatever you want in a medium at will) I know that this would be a huge mistake.

I'll be losing out on all the wonderful things that I could be doing.  Keep going.  That is a mantra to live by.  See it through.  That is another mantra.  So rather than put things to the side today I am going to press on.  

Today I am going to do a couple of things:

1.  Build JSON validation tool in PHP.

2.  Build SQL Insert statements in PHP.

3.  Place Session object onto client.

4.  Put logic in place for error data.
     a.  Send back the name of the error fields in a string format
     b.  Build a pop string algorithm in JQuery that sends back an array of values
     c.  Build functionality that changes the border color to red for any values that didn't pass the test.

5.   Put positive logic in place that sends back a no error message field and moves along.


Tomorrow:


1.  Build out the initial layout for button two.

2.  Watch three Linux videos.


3.  Read Linux book, Apache book, and Sendmail book.


3.  Watch three Linux videos.


WEEKEND UPDATE



So here's what I got done this weekend.  75% of number one.  It took a lot more time than I expected due to the following:

1.  Having to build a separate script (reappropriated from JQuery code).


2.  Having to look into JSON technical issues.


3.  Having to build a "stringify" function which basically allows a JSON object to be turned into strings before being sent to PHP.  It's very important to do this.


Tomorrow

What I plan to do tomorrow is:

1.  Finish the JSON validation.

2.  Modify DB Tables Accordingly


3.  Build SQL Insert Statements

Tuesday

1.  Build Throwback validation data 


2. Place a session object onto the table.


3.  Build functionality that changes the border color to red for any values that didn't pass the test.

4. Put positive logic in place that sends back a no error message field and moves along.

Wednesday, January 11, 2012

Debugging Tips

1.  Put in checkpoints.  alerts in Javascript or MsgBox in VB/VBA.  This will help you pinpoint where the breakdown actually occurs.


2.  Remove functions and complexities.  Unit test each part at a fundamental level.


3.  Remove variables!  Simplify your code.  It'll run faster and cleaner and your problem should reveal itself.

4.  PHP: In PHP check for semi-colons.  Annoying!

5.  Check that variable names are exact matches.  Use the CTRL+F.  It'll help.


6.  Javascript/AJAX:  Variables take time to change.  Make sure if you're using alert keys that you take the Asynchronous nature of AJAX into account.

Monday, January 9, 2012

Work

Today all I got done was work for my job.  It was cool but terrible.  Cool because it's always kind of cool to hone your programming skills no matter what the language is.  It kind of sucks though because it's not where I want to be honing my skills.  I need to be working on my other shit as opposed to this.  Tomorrow what I want to get done is to work on getting that information to display on the screen on click of the event.  I'll have to work on that.  After that I'll have a bit of similar work to do on some other JQuery screens.  But I should be about done after that and looking into building the PHP to check the script on the back end and to move forward.

Nice. Nice.  Nice.  Also I'll have to design the database but because I've designed so many in the past that shouldn't be too difficult.  The goal of that business is to drive it at minimal cost to make it earn 1,000 dollars a week.  That's the first goal.  The second year goal is to have it make 250,000 dollars a year and then a million in the third year.  But I'll have to work to solidify that. 

Work.  Work.  Work.

A New Pedia

What if there was a very simple way to leverage a large business without really doing anything except gathering data?  What if it was possible to create a website completely and totally based on another website? What if I took a certain website, made it actionable, and drove my revenue model that way in total. 

It feels like I might have just stumbled onto something that's huge.

Sunday, January 8, 2012

Agnostic Users

I just made a discovery.  I typed google into my browser but I must've transposed some letters because I eneded up at another search engine.  Someone clever bought the name that was closest to google's.  

But then something funny happened.  I decided that I didn't need Google per say but I just needed any search engine.  I used the search engine and while it didn't get it right I used it again to try.  I say all of that to say this.

Buying the 'neighbors' of a search engine is really smart if you have a service you're trying to offer that is very similar to the company you're trying to move on.  It seems very smart indeed.

Friday, January 6, 2012

Verify Routing Number Code (JavaScript)

Hi,

I used JQuery here.  You might want to use it if you're going to use this code to verify routing numbers according to a very simple algorithm that simply uses the 371 371 371 checksum.

function confirmRoutingNumber(strRoutingNumber)
                {
                   
                    var routingArray = new Array();
                    var total = 0;
                    var i = 0;
                   
                    //alert("Inside confirmRoutingNumber function");
                   
                    for(i = 0; i < strRoutingNumber.length ; i++)
                    {
                       
                   
                       
                        routingArray[i] = Number(strRoutingNumber.charAt(i))
                       
                        //alert("I: " + i + " Digit: " + routingArray[i]);
                       
                        //alert("I: " + i + " Digit: " + accountArray[i]);
                       
                       
                       
                        if ( i % 3 == 0 )
                        {
                            routingArray[i] = routingArray[i] * 3;
                           
                               
                        }
                        else if (i % 3 == 1)
                        {
                           
                            routingArray[i] = routingArray[i] * 7;
                           
                        }
   
                           
                        total = total + routingArray[i];
                    }
                   
                    //alert("Routing Number Total: " + total);
                   
                    if (total % 10 === 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }

Luhn Algorithm Implemented in JS code

Hi,

Here's my Javascript code for the Luhn Algorithm.  Check it out.  Just let me know you've used it. It'll make me happy.  :D

    function luhnCheckSum(strAccountNumber)
                {         
               
                    //alert("Inside confirmAccountNumber function");                      
                    var accountArray = new Array();
                    var total = 0;
                    var i = 0;
                   
                    for(i = 0; i < strAccountNumber.length - 1; i++)
                    {
                       
                       
                   
                       
                        accountArray[i] = Number(strAccountNumber.charAt(i));
                       
                        //alert("I: " + i + " Digit: " + accountArray[i]);
                       
                        if ( (accountArray[i] > 9)  && (i%2 == 1) )
                        {
                            accountArray[i] = 1 + accountArray[i] % 10;
                           
                               
                        }
                           
                        total = total + accountArray[i];
                    }
                   
                    total *= 9;
                   
                    var lastDigit = 0;
                   
                    lastDigit = total % 10;
                   
                    var checkSumDigit = 0;
                   
                    checkSumDigit = Number(strAccountNumber.charAt(9));
                   
                    //alert("Checksum According to Calculation: " + lastDigit + " CheckSum Digit" + checkSumDigit);
                   
                    if (lastDigit === checkSumDigit)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                   
                }



Monday, January 2, 2012

Distractions

No one's still reading my blog.  This is awesome.  Now onto the next one.


So I spoke to my sister before the New Year.  We spoke about some of our goals for the New Year.  It was funny because a lot of her goals had a lot to do with work for me.  But to be honest I'm not really that interested in her goals.  Her goals are all in show business.  And to me show business is a shaky business.  It's not the type of business that I want my future company based on.  Sure, it adds some pizazz and it's fun.  But it's tremendously unstable.  And to do the things that I want to do I can not have massive amounts of unstability.  Yet the allure is appealing.  But I must reject it.  I must learn to say no to her a lot more often despite her disdain.  


I don't really care for her life or her lifestyle.  I enjoy some of her freedom but her well being is mostly based on likability.  I don't think likability is something to build a future on.  I think likability is like a suited pair in poker, a nice to have but not necessary (or even sufficient) to win.  Computers alone are like a pair of Queens but mixed with math their like a pair of Kings.  After I add my other creative talents to them it'll be like a pair of Aces.  I'm just uncomfortable with the paths she's aligned.   I'll have to communicate this with her at the right time.  Next weekend we're supposed to work together on a project. :-/  I'd rather work on my own projects. But nonetheless we're supposed to work together on a project.  I'll work with her on that one and then deliver the news that I will be busy for the foreseeable future.  I am finding her ideas and her timelines to be a distraction.  I am not really that into it.


Next, this week I worked on programming GFM.  It did not go as quickly as planned.  I ran into some snags with an overall understanding of the LAMP stack and it's relationship to Aptana.  


Aptana is primarily a front end software development tool.  It can edit PHP but it can not run it and the PHP compiler is not included with Aptana.  Therefore you must first install PHP.  Then you must install Apache with is the container for PHP.  Aptana does a good job of integrating with MySQL but it is quite a bit of thinking and configuring to get Aptana, PHP, and Apache to work together seamlessly if you're not familiar with the architecture.  Fortunately for me I am now.  


I also learned quite a bit about the $.getJSON and the JSON data structure.  I still have more the learn.  But I am confident of this: I can now leverage the skills that I have learned with PHP into faster and more significant development.  I am eager to move forward.  I have a lot to learn though specifically about LAMP stack especially about the configurations.  There is quite a bit to know.