Monday, February 24, 2014

Moving a File in PERL

        my $fileName = $self->{fileName};
        
        my $sentReceiptDirectory = "test/sentReceipts/";

        my $unsentReceiptDirectory = "test/unsentReceipts/";
        
        my $fileMoveSuccessful = 0;
        
        if ($sendEmailAddressReceipt eq 1)
        {
            
            
            move $fileName, $sentReceiptDirectory;
            
            $fileMoveSuccessful = 1;
            
        }
        elsif($sendEmailAddressReceipt eq 0)
        {
            move $fileName, $unsentReceiptDirectory;
        
            $fileMoveSuccessful = 1;

        }

Hunter x Hunter T-Shirt Ideas

Hisoka's evil ghost face (black with red eyes) in Episode 5

Satotz's alarm clock in Episode 3 (beginning of Hunter Race)

Pigs in Episode 6

Feral Artist T-Shirt

Flying Evil Birds (Episode 8 early)

Episode 9: Phantom Spider

Episode 14: Little Gon Hanging Upside Down
-- Three Little Gon Fruits on a shirt

Saturday, February 22, 2014

Adding an Attachment to an Email and Sending It: PERL

        my ($self) = @_;

        my $boundary = 'frontier';
        
        my $emailAddress = $self->{emailAddress};
        
        my $subject = "Door2Door-DryCleaning: Receipt for Order";
    
        my $body = "Please see the attached file for your receipt.  Thank you for using Door2Door Dry Cleaning.  We appreciate your business.
        <br><br>With regards,<br><br>Door2Door-DryCleaning.com<br><br>";
    
        my $smtp = new Net::SMTP::TLS(
        'smtp.gmail.com',
        Port    => 587,
        User    => 'curtis.sumpter@gmail.com',
        Password=> 'gwpkuuqjdlxbwvzl',
        Timeout => 30
        );
        
        my $fileName = $self->{fileName};
        
        my $data_file = "/home/users/web/b2295/ipg.goformecom/test/$fileName";
        
        $smtp->mail('curtis.sumpter@gmail.com');
    
        
#print MYFILE "Check Point 2\n";
        
    #  -- Enter recipient mails addresses below --
        $smtp->recipient($emailAddress);
        
        $smtp->data();
        
        my $msg = MIME::Lite->new(
        From    => 'curtis.sumpter@gmail.com',
        To      => "$emailAddress",
        Subject => $subject,
        Type    => 'multipart/signed'
        );
    
        $msg->attach(
        Type    => 'application/rtf',
        Path    => "$fileName",
        Filename    => "$fileName",
        Disposition => 'attachment'
        );
        
        $msg->attach(
        Type => 'text/html',
        Data => "$body"
        );

        $smtp->datasend($msg->as_string);
        
        $smtp->dataend();
        $smtp->quit;
        
        eval{$smtp->quit};
    
        return 0 if $@;
    

        return 1;

Wednesday, February 19, 2014

Determining an Objective-C Class Type

// STRING TO NUMBER  

   NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
    [f setNumberStyle:NSNumberFormatterDecimalStyle];

if ([[myDict valueForKey:@"faxSent"] isKindOfClass:[NSString class]])
    {
        NSString* hasFaxBeenSent = [myDict valueForKey:@"faxSent"];
        hasFaxBeenSentNumber = [f numberFromString:hasFaxBeenSent];
    }
    else if ([[myDict valueForKey:@"faxSent"] isKindOfClass:[NSNumber class]])
    {
        hasFaxBeenSentNumber = [myDict valueForKey:@"faxSent"];

    }

// NUMBER TO STRING

    if ([[myDict objectForKey:@"emailAddressExists"] isKindOfClass:[NSString class]])
    {
        emailAddressExists = [myDict objectForKey:@"emailAddressExists"];
        
    }
    else if ([[myDict objectForKey:@"emailAddressExists"] isKindOfClass:[NSNumber class]])
    {
        emailAddressExistsNumber = [myDict valueForKey:@"emailAddressExists"];
        emailAddressExists = [emailAddressExistsNumber stringValue];
    

    }

Thursday, February 6, 2014

Creating a Pretty PERL JSON object

        my %query_results;

        my $json_obj = JSON::PP->new->allow_nonref;

        if (index($dbhandle,'SQL Error:') eq -1)
        {
            
            my $sth = '';
            
            $sth = $dbhandle->prepare($sqlQuery);
            
            $sth->execute;
            
            my $json_obj = JSON::PP->new->allow_nonref;
            
            my $numberOfRows = $sth->rows();
  
            if($numberOfRows == 0)
            {
                
                $query_results{addressExists} = "0";
                $query_results{CIDNumber} = $customerID;
                $query_results{addressType} = $addressType;
                
            }
            elsif($numberOfRows == 1)
            {
                $query_results{addressExists} = "1";
                $query_results{addressType} = $addressType;
                $query_results{CIDNumber} = $customerID;
                
            }
            else
            {
                $query_results{addressExists} = "-1";
                $query_results{addressType} = $addressType;
                $query_results{CIDNumber} = $customerID;
                
            }
            
            
            #new line of code
            
            
            #return $json_obj->encode(\%query_results);
            

            return $json_obj->pretty->encode(\%query_results);

Tuesday, January 28, 2014

Cable Cowboy: What I've Learned

Chapters 1 & 2:

John Malone

  • Great dad who taught him things (taught him a way)
  • His dad instilled in him a desire to operate in a certain way and to achieve
  • First class education all the way to a Ph.D.
  • Networked through McKinsey to General Instruments to TCI
Me
  • No dad
  • A step-dad who was disengaged
  • Autodidactic
  • Didn't network ... built
John Malone was classically trained.  I am self taught.  I excel at building an MVP and getting it up and running.  I enjoy building new technologies and then leveraging them to build other new technologies.  And selling them.

At this point I don't think I can learn alot from John Malone.  I think I can learn more from Bob Magness than from John Malone at this point.

What I've Learned
  • Always ask "if not,"  If this doesn't work where does it leave me.
  • Seriously consider selling your first business and using that capital to build something else
  • Know your energy level.  When are you getting exhausted and need some new blood

Thursday, January 23, 2014

Passing an Object backward to a ViewController

        NSArray* viewControllers = self.navigationController.viewControllers;
        
        OrderDetailsViewController* previousVC = [viewControllers objectAtIndex:[viewControllers count] - 2];
        
        self.orderDetails.cashOrCredit = @"cash";
        
        previousVC.orderDetails = self.orderDetails;
        

        [self.navigationController popViewControllerAnimated:YES];