User:AndyE: Difference between revisions

From London Hackspace Wiki
mNo edit summary
(threshold)
Line 13: Line 13:
The Landy [[File:AndysLandy.JPG]] is potentially available for interesting vehicle-related projects, or just for moving kit. She's a 1978 Series III with added 2" suspension lift, big wheels and 3.5 V8 engine. Standard towbar ball and electrics.
The Landy [[File:AndysLandy.JPG]] is potentially available for interesting vehicle-related projects, or just for moving kit. She's a 1978 Series III with added 2" suspension lift, big wheels and 3.5 V8 engine. Standard towbar ball and electrics.


''''Project Desk''''
''''Project EngraveAtDifferentDepths''''


Desk 2.0
one
<pre>


[[File:Desk2.JPG]]
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
 
my $q = CGI->new();
 
print $q->header;
print $q->start_html;
 
print $q->p("this is a thing for doing threshholding");
print $q->p("<small>or possibly <i>thresholding</i>?</small>");
 
print $q->start_form( -enctype => "multipart/form-data" );
 
print $q->p("threshhold start? (0-100)");
print $q->textfield('tval');
print $q->p("threshold interval?");
print $q->textfield('tinterval');
print $q->p("file");
print $q->filefield('uploaded_file');
print $q->submit();
 
print $q->end_form;
 
# do we have an upload?
my $filehandle = $q->upload('uploaded_file');
if (defined $filehandle) {
 
    # do shit
    print $q->p("I'm doing shit");
 
    # no, actually do shit
    my $filename = $q->param('uploaded_file');
    my $tempfile = $q->tmpFileName($filename);
 
    my ($tval) = ($q->param('tval') =~ /^(\d+)$/); # only allow digits
    my ($tinterval) = ($q->param('tinterval') =~ /^(\d+)$/); # also only allow digits
 
    for (my $i = $tval; $i <= 100; $i += $tinterval) {
        my @ar = ("gm", "convert", "-threshold", $i."%", $tempfile, "/var/www/threshold_output/$filename".$i);
        system(@ar) == 0 or carp "system call failed: $?"; #safer than passing a string to system()
        print $q->img({src => "/threshold_output/$filename".$i});
    }
}
 
 
print $q->end_html;
 
</pre>
 
 
two
 
 
<pre>
 
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
 
my $q = CGI->new();
 
print $q->header;
print $q->start_html;
 
print $q->p("this is a thing for doing threshholding");
print $q->p("<small>or possibly <i>thresholding</i>?</small>");
 
print $q->start_form( -enctype => "multipart/form-data" );
 
print $q->p("threshhold value? (0-100)");
print $q->textfield('tval');
print $q->p("file");
print $q->filefield('uploaded_file');
print $q->submit();
 
print $q->end_form;
 
# do we have an upload?
my $filehandle = $q->upload('uploaded_file');
if (defined $filehandle) {
 
    # do shit
    print $q->p("I'm doing shit");
 
    # no, actually do shit
    my $filename = $q->param('uploaded_file');
    my $tempfile = $q->tmpFileName($filename);
 
    my ($tval) = ($q->param('tval') =~ /^(\d+)$/); # only allow digits
 
    my @ar = ("gm", "convert", "-threshold", $tval."%", $tempfile, "/var/www/threshold_output/$filename");
    system(@ar) == 0 or carp "system call failed: $?"; #safer than passing a string to system()
 
    print $q->img({src => "/threshold_output/$filename"});
}
 
 
print $q->end_html;
 
 
 
 
 
 
</pre>

Revision as of 19:31, 11 January 2011

TODO: put something decent on this page. :)

Joined October 2010.

Interests include entrepreneurship, Perl, dojo, photography, hi-fi, robotics, old Land Rovers, looking after my 2-year-old.

I'm also a volunteer Scout leader and am always interested in offers of interesting trips, equipment, activities or guest speakers for our Scouts.

Probably won't be able to make it down to the space on Tuesday evenings much, but workdays are possible sometimes.


The Landy AndysLandy.JPG is potentially available for interesting vehicle-related projects, or just for moving kit. She's a 1978 Series III with added 2" suspension lift, big wheels and 3.5 V8 engine. Standard towbar ball and electrics.

'Project EngraveAtDifferentDepths'

one


#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

my $q = CGI->new();

print $q->header;
print $q->start_html;

print $q->p("this is a thing for doing threshholding");
print $q->p("<small>or possibly <i>thresholding</i>?</small>");

print $q->start_form( -enctype => "multipart/form-data" );

print $q->p("threshhold start? (0-100)");
print $q->textfield('tval');
print $q->p("threshold interval?");
print $q->textfield('tinterval');
print $q->p("file");
print $q->filefield('uploaded_file');
print $q->submit();

print $q->end_form;

# do we have an upload?
my $filehandle = $q->upload('uploaded_file');
if (defined $filehandle) {

    # do shit
    print $q->p("I'm doing shit");

    # no, actually do shit
    my $filename = $q->param('uploaded_file');
    my $tempfile = $q->tmpFileName($filename);

    my ($tval) = ($q->param('tval') =~ /^(\d+)$/); # only allow digits
    my ($tinterval) = ($q->param('tinterval') =~ /^(\d+)$/); # also only allow digits

    for (my $i = $tval; $i <= 100; $i += $tinterval) {
        my @ar = ("gm", "convert", "-threshold", $i."%", $tempfile, "/var/www/threshold_output/$filename".$i);
        system(@ar) == 0 or carp "system call failed: $?"; #safer than passing a string to system()
        print $q->img({src => "/threshold_output/$filename".$i});
    }
}


print $q->end_html;


two



#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

my $q = CGI->new();

print $q->header;
print $q->start_html;

print $q->p("this is a thing for doing threshholding");
print $q->p("<small>or possibly <i>thresholding</i>?</small>");

print $q->start_form( -enctype => "multipart/form-data" );

print $q->p("threshhold value? (0-100)");
print $q->textfield('tval');
print $q->p("file");
print $q->filefield('uploaded_file');
print $q->submit();

print $q->end_form;

# do we have an upload?
my $filehandle = $q->upload('uploaded_file');
if (defined $filehandle) {

    # do shit
    print $q->p("I'm doing shit");

    # no, actually do shit
    my $filename = $q->param('uploaded_file');
    my $tempfile = $q->tmpFileName($filename);

    my ($tval) = ($q->param('tval') =~ /^(\d+)$/); # only allow digits

    my @ar = ("gm", "convert", "-threshold", $tval."%", $tempfile, "/var/www/threshold_output/$filename");
    system(@ar) == 0 or carp "system call failed: $?"; #safer than passing a string to system()

    print $q->img({src => "/threshold_output/$filename"});
}


print $q->end_html;