Random page background image

Posted by Adam on September 4th, 2010 under Technology • No Comments

Just for something different, here is a bit of PHP which will cause a random background image to be loaded every time you refresh your page. The image is chosen randomly from a directory making it easy to add or remove new images without needing to update the HTML.

This code should go in place of the <body> tag in your HTML.

<?php
// Set this to the path where your images are stored.
  $bgdir = '/images/backgrounds';

// Test the extension of a file to see if it is an image file.
  function isImageFile($src) { return preg_match('/^.+\.(gif|png|jpe?g|bmp|tif)$/i', $src); }

// Get the list of all files.
  $dirlist = scandir($_SERVER['DOCUMENT_ROOT'] . $bgdir);

// Put all the file names into an array.
  $imgs = array();
  $preload = '';
  foreach($dirlist as $file)
  {
    if(isImageFile($file))
    {
      $preload .= "   <img src=\"".$bgdir.'/'.$file."\" style=\"display:none\" />\r\n";
      $imgs[] = $file;
    }
  }

// Generate a <body> tag with a random background image URL.
  $url = $bgdir . '/' . $imgs[array_rand($imgs)];
  print "<body background=\"$url\">\r\n";

// Pre-load all the other images so subsequent page loads will be fast.
  print $preload;
?>

Comment on this article

Ready to Go

Posted by Adam on August 15th, 2010 under Business, Serial Gadget • No Comments

Hooray, the next batch of boards has arrived after after a bit of an adventure – FedEx delivered them late and to the wrong address!

Fortunately it was a nice old lady down the street who received the boards and she brought them over to me. I now have stock. All you people holding off buying a Bit Rate Converter can place your orders now.


Comment on this article

Sold!

Posted by Adam on August 5th, 2010 under Business, Serial Gadget • No Comments

Remember those new boards I got yesterday? Well, they all sold today. Bam! just like that!

So I guess I’m still out of stock until the next batch arrives :(


Comment on this article

First boards in from China

Posted by Adam on August 4th, 2010 under Business, Serial Gadget • No Comments

A sample batch of boards have arrived today. Hooray!

They all work. Hooray!

Overall I am happy with the boards and as an added bonus they are now RoHS compliant and look a lot neater than the hand-soldered ones.

There were a few downsides with the process though, the main one being the length of time it took to get it all happening. I’ve had delays and issues from just about everyone I have dealt with – DigiKey with their dumb export restrictions, FedEx taking foreeever to deliver stuff, Gold Phoenix for forgetting about the job until I reminded them a few times, PayPal for stuffing up my payments and sitting on my money for two weeks while the Aussie dollar went down and I lost out on the FX conversion… after all was said and done it took almost two months to make this happen and in the meantime I had run out of stock which is always embarassing.

In summary, I definitely think that offshore manufacturing can work for me but I’ll need to take all these delays into account and be organized well in advance the next time around.


Comment on this article

Unsoldering Equipment with Hot Air

Posted by Adam on July 21st, 2010 under Technology, Uncategorized • 1 Comment

I just bought myself a new SMD rework station, it’s a fine tool but I want to share with you a few choice excerpts from the extremely poorly translated manual. I think the Chinese manufacturers put no effort at all into the English translation these days:

“Intelligent system that could alarm, Fault detection automatically”

“Green lines and high-quality silicone body heat good for extend life and save power”

“increased gun handpiece would be insertion and unplug”

and my favourite…

“LED manifestation of tiny electricity computer figures”


1 Comment

Adventures in Outsourcing

Posted by Adam on June 21st, 2010 under Business, Serial Gadget • 1 Comment

I’m currently attempting to get a batch of RS232 Rate Converters made in China, I’ve been getting the PCBs etched in China for months now so this is the logical next step.

The biggest problem so far has been sourcing the parts. I’m getting most of the stuff from DigiKey because they specialize in smaller orders – I don’t have the sales volume to justify making 1000 of these things.

But get this. DigiKey will not deliver microprocessors to China, because of export restrictions, for a microprocessor that was made in China in the first place!

Ah well, I found MCUZONE, a Chinese supplier for the microprocessors thanks to the very excellent alibaba.com so I have all the parts on their way now.

So stay tuned, I’ll post photos when I get the assembled boards back from China.


UPDATE: I have since tried to buy more things through alibaba.com and have been defrauded. MCUZONE are good, but I was lucky to find them because honest sellers seem rare on Alibaba. Don’t trust them!


1 Comment

Overkill or Foresight?

Posted by Adam on February 22nd, 2010 under Business, Serial Gadget, Technology • No Comments

The Serial Bit Rate Converter runs an ARM7 CPU which is complete overkill for the simple job of relaying serial data. I’ve often thought I should redesign it to run a cheaper and less powerful CPU like a PIC or AVR. I originally designed it with an ARM7 simply because I like them and enjoy programming them.

Another reason I never redesigned it for AVR is that the economics are not that great. It would probably take $5 off the price but cost me a couple of weeks of time to redesign the entire thing.

This decision has had an unexpected benefit recently. A customer asked me if I could add an extra function to search-and-replace byte sequences in the data stream. Now I’m really glad to have 50 MIPS on board because a smaller CPU might not have had the grunt to do the job.

So having a way-too-powerful CPU has produced a long-term benefit to enable me to quickly sieze a market opportunity.


Comment on this article

Faster and Faster

Posted by Adam on February 15th, 2010 under Business • No Comments

I haven’t written very much about my goals here. My general long-term goal is to produce a range of for-sale products which might be either hardware, software or a combination of both, but my short-term goal is to simply become faster at designing and implementing stuff and that means:

  1. Being able to learn new technologies quickly
  2. Picking and choosing which design techniques to use to make a good match with my experience and strengths
  3. Remaining focused and managing my time well

I was quite pleased to get the Volume Box product from concept to production in only six weeks – especially since most of that time was spent waiting for suppliers and subcontractors, I probably only spent 10 days of my own time on it.

But of course I’ll have to try to be even quicker next time.

I already know what my next product will be but I am up to my eyeballs in contract work at the moment which, while it does pay the bills, takes up all my available time. So I will have to hold off until I get the contract jobs out of the way, then I can go hard on the next product and see how quick I can do it.


Comment on this article

First Production Volume Box

Posted by Adam on January 21st, 2010 under Serial Gadget, Technology • No Comments

Finally I have all the parts and I spent last night assembling ten boxes to fill my first order. It looks not half bad.

Next I need to set up a web page and finalize pricing so anyone can buy one.

So what is a Volume Box I hear you ask? Well, the Volume Box is a digital stereo volume control. It has no knobs or buttons, it is controlled via serial commands from a PC or home automation system. It is intended to be used as a component in an automated audiovisual setup such as conference centres, classrooms etc.

Features include:

  • Attenuation from 0 to -95dB in 1dB steps
  • 3 way stereo input selector
  • Line level inputs and outputs
  • Optional 7 watt power amplifier
  • Mute function
  • Preset store and recall

Comment on this article

Volume Box is Almost There

Posted by Adam on January 9th, 2010 under Business, Serial Gadget • No Comments

VolumeBoxPlugs-smallI’m getting orders for the Volume Box already. I haven’t even put up a web page for it. But wouldn’t you know it, the plastic case I want is not in stock with any of my regular suppliers (at least, those ones who are not still on extended Christmas holiday) so I’m having to get some cases flown in from England of all places so I can fill the orders. Of course I am going to have to absorb the extra cost of that, I wonder if Sony ever has these kind of supply-chain problems.


Comment on this article