attn: BigWallop - yer binary woes hopefully solved!

Page 3 of 3  

wrote:

Rats! I've been sussed ...
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Thu, 16 Oct 2003 15:22:27 +0100, "Mike Faithfull"
Na-na-na-na-nah! ;)
I always wondered what happened to you. You were one of the good old HP guys (emphasis on old) ;)
I guess you might still be living in the Thames Valley area then. Don't be forgetting that we've got a let's-have-a-pint session going on Nov 4th if you might be interested. Someone'll be along in a minute to remind me where it is.....please.....
PoP
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Witchy wrote:

Why not just do it with 3 gifs; the border with the numbers, On and Off.
--
James...
http://www.jameshart.co.uk /
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, 14 Oct 2003 22:13:38 +0100, "James Hart"

That's exactly how I did it - 3 pngs, the GD graphics library and some PHP glue to do the maths......took me half an hour and I'm by no means a competent PHP programmer :)
cheers
witchy/binarydinosaurs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Looks like each image gets built & d/l one at a time, I got bored when the d/l reached 500kB, nice tho' ;-)
--
fred

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Witchy wrote:

Not a criticism - very neat tool, and nice of you to do it - but rather than generating the images on the fly using GD, which takes a long time and generates many images for download, a more efficient solution would be to use 2 images in total - one for the switch, which you set as the background of an element, and another one representing the on state, which you overlay in the correct position, once for every switch position.
--
Grunff


Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

This is true, but I was going for coding speed, not efficiency :) If this wasn't a one-off it would be a simple task to remove the gd stuff and just build up a load of IMG tags per switch block. - local cacheing should make sure the images were only downloaded once.
In fact I've just done it because I could - http://www.binarydinosaurs.co.uk/binary2.php - much easier to code than using GD too :o)
cheers
witchy/binarydinosaurs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Witchy wrote:

:-)
--
Grunff


Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

An interesting lesson for me, looking at the source, Ta (hope you don't mind).
While we're in optimising mode, short paths & single char filenames get you down to just over 200k, because we can ;-) - not exactly maintainable tho'
--
fred

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Did you view the PHP code or did you view the source of the page in a browser? The code itself is 907 bytes unoptimised:
<pre> <html><head><title>Binary gubbins</title></head> <body> <?php for ( $i=0; strlen($bin) <; ++$i ) { $bin = decbin($i); $output = sprintf("%04d : ", $i); $bin_temp = $bin; while ( strlen($bin_temp) < 10 ) { $bin_temp = "0" . $bin_temp; } $output = $output . "<img src=\"
http://www.binarydinosaurs.co.uk/images/dipon.png \">"; for ( $j=0; $j < strlen($bin_temp); ++$j ) { $digit = substr($bin_temp, $j,1); if ($digit == 0) { $output = $output . "<img src=\"
http://www.binarydinosaurs.co.uk/images/swdown.png \">";      }      elseif ($digit == 1) { $output = $output . "<img src=\"
http://www.binarydinosaurs.co.uk/images/swup.png \">";      }     } $output = $output . "<br />"; print $output; } ?> </body></html> </pre>
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
sonidyranib.co.uk> writes

Oooh no, nice to see that, didn't think I had permissions to read that & so didn't try. I just waited until the whole page appeared on my screen, then did a 'file' > 'save as'. The resulting just looks like html, sample:
<snip> </head> <body> 0000 : <img src="
http://www.binarydinosaurs.co.uk/images/dipon.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <img src="
http://www.binarydinosaurs.co.uk/images/swdown.png "> <mucho snip> (1024x~10lines)
The above was a save from Opera, below is a save from IE, with local paths:
</HEAD> <BODY>0000 : <img src="binary2_php_files/dipon.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png"> <img src="binary2_php_files/swdown.png">
My feeble attempt at saving b/w was just by trimming the LOCAL path and filenames in the html bit:
</HEAD> <BODY>0000 : <IMG src="1.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png"> <IMG src="3.png">
Feeble of course cos to trim your path would require a different shorter named website :-/
Am I right in thinking the php script runs on your provider's server & then the html to display the results is what we download? The download counter on my Opera window reaches about 650k at completion.
Academic now (as you've done it), but is the way for other such things to write an app in javascript to run on the user's m/c, so you just download the script?
Btw, please bear with me at this difficult time, as after being in 'the business' for years and not _needing_ a website I am having my arm twisted to write one for the other half's fledgeling business :-/ ; the tips in the 'usenet names' thread may well save me integrating a contact forms script.
Thanks for the look at your script; off to do some reading . . . .
--
fred

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Yup, the PHP side of the Apache webserver intercepts the code and comes up with the required HTML to render properly on yer browser. Normally the only hint that there's PHP involved is because of the .php file extension but even that can be hidden.

or a URL generated by tinyurl.com of course.....

Yep, see above. In my case it's running on a linux box 3 feet away from where I'm sitting now so I can do what I like to it, but a few providers support the rapidly-becoming-accepted PHP/MySQL backend.

You could do it with Java I think; javascript itself doesn't download to the user's machine in the same way a java applet does - it relies on the browser supporting it instead. The beauty with PHP (and server side includes) is they run on the server so there's less to download for the client.

What I used to do before I got my own webserver was have the contact address as a jpeg or animated gif, but people complained about that because they had to manually fire up their email client and type the address in! Now that I know about encoding the address I could go back to that I suppose, but so many varied people visit my site they're not all running microsloth products and don't all have integrated systems where if they click on a mailto: link in a browser their email client automatically fires up with the correct address in a new message!
Also these days I've got a copyright notice at the bottom of each page, so working out the email address doesn't take rocket science :)
cheers
witchy/binarydinosaurs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Thks
--
fred

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Witchy wrote:

The equivalent technology using Java is "JSP" - Java Server Pages (all part of the J2EE or Java 2 Enterprise Edition architecture). The Java runs inside a "servlet container" on the web server. A servlet container like Tomcat (or a commercial variant like Web sphere) is usually in turn linked to Apache. It gives you much the same sort of capability as using PHP as far as I can tell (not being into PHP yet).
The container runs the JSP pages first and its output is delivered to the user (usually) via the web server. You can also build re-usable classes that can be simply linked and included into your web applications by way of things like "Java beans" and "tag libraries"

I have encoded the mailto links on our site and so far they do not seem to have been harvested....
--
Cheers,

John.

/=================================================================\
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Thu, 16 Oct 2003 23:44:45 +0100, John Rumm

Like most u**x derived stuff it's very C like, right down to syntax, code structure, commands (printf and sprintf for example) and the reliance of semi-colons and braces.

Yarr, similar to PHP and SSI then. All thumbnailing and picture stuff across my websites is done using a single PHP class that I can call from any page using 4 lines of code. All sites have a single header, menubar and footer and all of the design is fully dynamic so adding new content takes no time at all. PHP's just as portable as Java too.
-- cheers,
witchy/binarydinosaurs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

http://www.binarydinosaurs.co.uk/scripts/binary-image.php?string 00000000
http://www.binarydinosaurs.co.uk/scripts/binary-image-rev.php?string 00000000
You are the bestest user in the group !!!!!! I owe you the biggest juiciest thing you can think of. Absolutely Fricking Wonderful !!!! That will definitely do the job to get him started on his own with these. If it means he memorises the basic ones to get the jobs done.
Fricking Marvellous Piece of work them !!!!!
Now edited and printing in three columns on A4 sheets. Don't know how many sheets yet, but don't really care, because you're Wonderful !!!
Thank you Very Very Very Much Witchy.
--
www.basecuritysystems.no-ip.com

Outgoing mail is certified Virus Free.
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Wed, 15 Oct 2003 03:07:43 GMT, "BigWallop"

No problem - I like little challenges like that, and because of Grunff's suggestion in the other thread I came up with an even simpler version that's half the size :o)
Let us know if it helps!
cheers
witchy/binarydinosaurs
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
wrote:

many
I've drawn the layout on to the back of his hand this morning to see if it helps him with a 10 head installation today. Everyone has been told to call me if he phones them for help, and they all know I mean it, so we'll see what happens.
Fantastic bit of coding that. I get lost when it comes to this type thing. In fact, it takes me all my time to compose a letter in the word processor. Many Thanks for that Sir.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Related Threads

    HomeOwnersHub.com is a website for homeowners and building and maintenance pros. It is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.