Saturday, June 28, 2014

Creating a Directory in PERL

http://stackoverflow.com/questions/5959767/creating-folder-using-perl

Moving an Image in PERL

http://perldoc.perl.org/File/Copy.html

Getting Images from a PERL Directory

            $file = "<root library name here>/test/images/$file";
            
            #print MYFILE "URL: $file\t";

            my $length = (stat($file)) [10];

            #print MYFILE "Test Point 1\n";
            
            my $fileContent =  "Content-type: image/jpg\n";

            #print MYFILE "Test Point 2\n";
            
            $fileContent = $fileContent . "Content-length: $length \n\n";
            
            #print MYFILE "Test Point 3\n";
            
            #binmode STDOUT;
            
            open (FH,"<$file") or die "Could not open $file: $!";

            #print MYFILE "Test Point 4\n";
            
            my $buffer = "";
            
            #print MYFILE "Test Point 5\n";
            
            while (read(FH, $buffer, 10240))
            {
                
                $fileContent = $fileContent . $buffer;
            
                #print MYFILE "Test Point 6\n";
            
            }
            
            close(FH);

            #print MYFILE "Test Point 7\n";
            

return $fileContent;

Yahoo API Website

https://code.google.com/p/yahoo-finance-managed/wiki/miscapiImageDownload

Friday, June 20, 2014

Implementing UIScrollView (iOS)

.m file

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    sv.pagingEnabled = YES;
    sv.contentSize = CGSizeMake(sv.frame.size.width,sv.frame.size.height);
    sv.showsHorizontalScrollIndicator = NO;
    sv.showsVerticalScrollIndicator = YES;
    sv.scrollsToTop = NO;
    sv.bounces = YES;
    sv.delegate = self;
    

    [self.view addSubview:sv];

...

- (void)viewDidLayoutSubviews
{
    [sv setContentSize:CGSizeMake(320, 500)];
}


.h file

@interface SandwichViewController : UIViewController <UIScrollViewDelegate>{


IBOutlet UIScrollView* sv;

...

}

@property (nonatomicstrongIBOutlet UIScrollView* sv;

Saturday, June 14, 2014

Perl: Iterating over multiple arrays

my @x = qw( A B C D E F );
my @y = (10, 11, 12, 13, 14, 15);

my $it = each_array( @x, @y );
while ( my ($x, $y) = $it->() ) {
    print "$x = $y\n";
}

Perl Split and Iterate Over an Array Code

my @values = split(',', $data);

  foreach my $val (@values) {
    print "$val\n";
  }