-
Somewhere Website
Artists Nina Pope & Karen Guthries's 10th Anniversary website: www.somewhere.org.uk
A new site I've designed and built - right down to the logo -, between shifts on Digital Conveience, SHOWstudio miscellany, and working on the development of PostEverything ...
The site has been rush launched so that that can start blogging their new project Sometime Later that I've also go to (finish) building the site for. There are a lot of feature(ettes) and content still to be added to the site.. but the joys of it all being CMS driven mean they can develop the content whilst I develop the functionaltiy for them.
Part of my aim with the site design of the site was to keep the HTML minimal, use CSS, and make something that was quite forward feeling in features whilst degrading nicely. Nina and Karen wanted to keep the 'widrescreen' photographic background idea they had used on their old site, and updated it, so you can see the image gallery they've collected over the years.
The logo concept is a 'punch out' idea, which will be carried through physical materials such as letterheads and business cards, the idea being that 'wherever you are you are always somewhere'... and you can see through onto the postcard behind the landscape you are in. This will all be completed with some 'pathetic fallecy' icons to go with it.
... so keep watching it to see how it develops.
leave a comment -
Server moves...
after 5 years of service, and over 895 (and counting) days since the last reboot.
It's come to the time to retire tao.hosteverything.net for refurbishment, and welcome suith.hosteverything.net into it's place. If you spot anything wrong with this site or any of the others please Let me know.
leave a comment
-
Fairwell trusted companion
After 10 years working together...
... it's time to say bye bye to BBedit and hello to TextMate.
TextMate isn't as mature as BBedit, but then it's not as bloated either. I found BBedit increasingly clunky of late and TextMate answers a lot of those issuses, and has some neat extra features. Check it out if you do a lot of coding on OS X.
leave a comment
-
PHP Validate UPC and EAN13 Barcodes
As I couldn't find any routines to do this...
I hacked these up in Perl an age ago... needed PHP versions so here they are (Ask if you want the Perl versions lazy..)
function validate_UPCABarcode($barcode)
{
// check to see if barcode is 12 digits long
if(!preg_match("/^[0-9]{12}$/",$barcode)) {
return false;
}
$digits = $barcode;
// 1. sum each of the odd numbered digits
$odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10];
// 2. multiply result by three
$odd_sum_three = $odd_sum * 3;
// 3. add the result to the sum of each of the even numbered digits
$even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9];
$total_sum = $odd_sum_three + $even_sum;
// 4. subtract the result from the next highest power of 10
$next_ten = (ceil($total_sum/10))*10;
$check_digit = $next_ten - $total_sum;// if the check digit and the last digit of the barcode are OK return true;
if($check_digit == $digits[11]) {
return true;
}
return false;
}function validate_EAN13Barcode($barcode)
{
// check to see if barcode is 13 digits long
if(!preg_match("/^[0-9]{13}$/",$barcode)) {
return false;
}$digits = $barcode;
// 1. Add the values of the digits in the even-numbered positions: 2, 4, 6, etc.
$even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9] + $digits[11];
// 2. Multiply this result by 3.
$even_sum_three = $even_sum * 3;
// 3. Add the values of the digits in the odd-numbered positions: 1, 3, 5, etc.
$odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10];
// 4. Sum the results of steps 2 and 3.
$total_sum = $even_sum_three + $odd_sum;
// 5. The check character is the smallest number which, when added to the result in step 4, produces a multiple of 10.
$next_ten = (ceil($total_sum/10))*10;
$check_digit = $next_ten - $total_sum;// if the check digit and the last digit of the barcode are OK return true;
if($check_digit == $digits[12]) {
return true;
}return false;
}5 comments
leave a commentanonymous
2007.11.27 00:00 GMT
Looks great. Could you please email me the perl version. Yes, I am lazy.Thanks
anonymous
2007.11.28 00:00 GMT
hopefully these still worksub checkUPCABarcode { my ($barcode) = @_; if ( !($barcode =~ /^[0-9]{12}$/) ) { return 0; } @digits = split(//,$barcode); # -- sum each of the odd numbered digits # remember perl arrays start at zero! $odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10]; # -- multiply result by three $odd_sum_three = $odd_sum * 3; # -- add the result to the sum of each of the even numbered digits $even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9]; $total_sum = $odd_sum_three + $even_sum; # -- subtract the result from the next highest power of 10 $next_ten = (ceil($total_sum/10))*10; $check_digit = $next_ten - $total_sum;
# if the check digit and the last digit of the barcode are OK return true; if ( $check_digit == $digits[11] ) { return 1; }
return 0; }
sub checkEAN13Barcode { my ($barcode) = @_; if ( !($barcode =~ /^[0-9]{13}$/) ) { return 0; } @digits = split(//,$barcode);
# 1. Add the values of the digits in the even-numbered positions: 2, 4, 6, etc. # remember perl arrays start at zero! $even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9] + $digits[11]; # 2. Multiply this result by 3. $even_sum_three = $even_sum * 3; # 3. Add the values of the digits in the odd-numbered positions: 1, 3, 5, etc. $odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10]; # 4. Sum the results of steps 2 and 3. $total_sum = $even_sum_three + $odd_sum; # 5. The check character is the smallest number which, when added to the result in step 4, produces a multiple of 10. $next_ten = (ceil($total_sum/10))*10; $check_digit = $next_ten - $total_sum;
# if the check digit and the last digit of the barcode are OK return true; if ( $check_digit == $digits[12] ) { return 1; }
return 0; }
anonymous
2008.02.20 09:42 GMT
Here is a PostScript routine that calculates the EAN13 check digit%!PS % ------------------------------------------------------------------ % (12-character numeric string) EAN13.CheckDigit -> (checkCharacter) % ------------------------------------------------------------------ /EAN13.CheckDigit { 5 dict begin /inputString exch def /checkDigit 0 def /factor 1 def /s 3 string def 0 1 11 { /i exch def /checkDigit checkDigit inputString i 1 getinterval cvi factor mul add def /factor factor 2 xor def } for /checkDigit checkDigit 10 mod def checkDigit 0 ne { /checkDigit 10 checkDigit sub def } if checkDigit s cvs end } def % ------------------------------------------------------------------
% Test (these are real life EANs) (900310607223) dup == EAN13.CheckDigit == % 1 (900310650559) dup == EAN13.CheckDigit == % 3 (380000110009) dup == EAN13.CheckDigit == % 2 (590471440187) dup == EAN13.CheckDigit == % 8 (380005170002) dup == EAN13.CheckDigit == % 0 (501753491820) dup == EAN13.CheckDigit == % 1 (692098249717) dup == EAN13.CheckDigit == % 6 (544900003309) dup == EAN13.CheckDigit == % 3
hans
2011.01.17 12:08 GMTCan I use this in a gpl-licenced project? https://github.com/HansF/Fridgemagnet
Improved Perl version ("strict" friendly, includes the required POSIX module, slight syntax modifications). Thanks to the original poster.
- Phil
sub UPCACodeIsValid {
use POSIX qw(ceil);
my $barcode = shift;
return 0 if ( !($barcode =~ /^[0-9]{12}$/) );
my @digits = split(//, $barcode);
# -- sum each of the odd numbered digits
# remember perl arrays start at zero!
my $odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10];# -- multiply result by three
my $odd_sum_three = $odd_sum * 3;# -- add the result to the sum of each of the even numbered digits
my $even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9];
my $total_sum = $odd_sum_three + $even_sum;# -- subtract the result from the next highest power of 10
my $next_ten = (ceil($total_sum/10))*10;
my $check_digit = $next_ten - $total_sum;# if the check digit and the last digit of the barcode are OK return true;
return 1 if ( $check_digit == $digits[11] );return 0;
}#################################################
sub EAN13CodeIsValid {
use POSIX qw(ceil);
my $barcode = shift;
return 0 if ( !($barcode =~ /^[0-9]{13}$/) );
my @digits = split(//, $barcode);
# 1. Add the values of the digits in the even-numbered positions: 2, 4, 6, etc.
# remember perl arrays start at zero!
my $even_sum = $digits[1] + $digits[3] + $digits[5] + $digits[7] + $digits[9] + $digits[11];# 2. Multiply this result by 3.
my $even_sum_three = $even_sum * 3;# 3. Add the values of the digits in the odd-numbered positions: 1, 3, 5, etc.
my $odd_sum = $digits[0] + $digits[2] + $digits[4] + $digits[6] + $digits[8] + $digits[10];# 4. Sum the results of steps 2 and 3.
my $total_sum = $even_sum_three + $odd_sum;# 5. The check character is the smallest number which, when added to the result in step 4, produces a multiple of 10.
my $next_ten = (ceil($total_sum/10))*10;
my $check_digit = $next_ten - $total_sum;# if the check digit and the last digit of the barcode are OK return true;
return 1 if ( $check_digit == $digits[12] );return 0;
}leave a comment
-
SHOWstudio
A new site
After many months of planning, and several weeks of very hard work, I'm please to announce that we've finally launchd a new SHOWstudio website. A complete ground up rebuild of a large part of the contextual features of the site, and the addition of a lot of new functionality, all sitting on top of the Critter CMS that I've been using on various sites over the last few years, with HTML and CSS wizardry by Paul Bruty.
... and relax.
(well, until I get back on with Digital Convenience)
leave a comment
-
adammufti.com
Site for film maker Adam Mufti
A small, CMS based, website I made for Adam Mufti, the former Motion Image Director of SHOWstudio who's now making it freelance.
leave a comment
-
WIRE: The Scottish Play: 2004
DVD Development Assistance
A simple little job, helping Colin from WIRE to learn some tricks in DVD Studio Pro for their new DVD "The Scottish Play".
leave a comment
-
Visual Appliance Website
http://www.visualappliance.com
A site I designed and coded last year for my friend Mathew for his company selling a very cool - and specialised - piece of SFX software. The content and some of the functionality have been changed a bit by Matthew - perhaps not the way I would have done it, but overall I'm pleased with the simplicity of what I produced for him.
leave a comment
-
Recent purple visitors
IP to Colour Conversion
This is something I did a while ago and then forgot about/got distracted by other things. It's really simple. It breaks apart the IP address of visitors to the site and uses each of the four value to generate a CMYK colour, which is then converted into an RGB space to be displayed on screen.
I just looked it again after a while and have noticed that recently a lot of visitors seem to have been coming from soemwhere quite purply ... so there is an area of more purple towards the bottom of the list. So I thoguht I would share it.
This is the visitors to my site, the newest at the bottom:
IP/Colours
(warning, heavy HTML page, bit of a kludge, kill some browsers)Your IP colour can be seen here:
IP/Colourleave a comment
-
Dave Gibbons Website
www.davegibbons.co.uk.
A small site I built for my friend Dave's work, on top of my default CMS. Dave is an artist, and as such most of his contents are images - drawings, paintings, or stills from films - so the site has an image orientated structure to it.
leave a comment