In upgrading to 15.04 the install broke on installing clamav.
It didn’t affect the upgrade but clamav was no longer installed. On running it manually I got the following error
error /var/lib/dpkg/info/clamav-daemon.postinst: 626: /var/lib/dpkg/info/clamav-daemon.postinst: cannot create : Directory nonexistent
It seems that there is a typo in the file /var/lib/dpkg/info/clamav-daemon.postinst.
On line 626 replace $DEBCONFILE with $DEBCONFFILE
Save and re-run apt-get install clamav
Posted in Linux | Leave a comment
Ever start the dd command and sit there wondering if it is still working?
An easy way to see the progress is to push ctrl+t
Posted in Linux, Mac | Leave a comment
After this my fiance said we need one at our wedding. But being me, I decided to try make one rather than hire one.
The question then came what sort of case should I make for it. I thought of lots of ideas and saw a number of good ones other people had made. While looking for ideas I saw some cool digital photo frames, which is when it hit me, the photo booth in the frame itself.
The idea behind this is rather than being just a static picture on the wall, it can be a dynamic and interactive photo frame. Users take photos which then get added to the slideshow.
This allows it to be useful when it is not being used. It may also get more people to use it by seeing the photos others have taken.
- Raspberry Pi B+
- Raspberry Pi Camera
- 7″ LCD with HDMI
- Push Button
- A4 Photo Frame ( Box Style )
The current photo booth/frame I built is a prototype. It needs to be all mounted internally better and I need the photo frame mat to be cut using a CNC machine. Doing it by hand turned out terribly.
The photo booth I used at the wedding had a touch screen. I had ideas that I would have these interactive elements on the screen, add all these other functions. So I went with a touchscreen. However it turned out that just the push button itself was enough. Adding anymore to it would make it harder for people to use.
This will make the finished version easier. I no longer need to cut a hole in the mat of the frame for touch. I think I will end up using a clear piece of plastic and mount the screen behind it. It will be much easier than getting the plastic machined.
Internally building the system is just a matter of connecting the camera to the Raspberry Pi, and a push button to the gpio pins.
You will have to play around a bit getting everything to fit inside the frame. Using an A4 box frame was just big enough. The biggest problem is the depth and mounting the components.
The screen takes away a lot of the depth and the ethernet port is rather tall.
In the next one I may remove the ethernet and use wireless to save space.
In terms of mounting the components, I resorted to a hot glue gun, double sided tape, and some acetate plastic my fiancé had laying around to prevent shorts. I put the plastic between the Pi and the back of the screen.
Once the hardware was done, it was time for the software side.
When a user presses the button connected to the Raspberry Pi GPIO pin ( Default 18 ), it switches from slideshow mode to the photo taking sequence.
The photo taking sequence is as follows
- Switches the camera to preview mode so users can see themselves and allow for auto focus
- Starts a countdown until the photo is taken
- This process is run 4 times to take 4 different photos of the user
- The 4 photos are then resized and combined onto a 4×6″ photo. This photo has space for a watermark. Replace blank.jpg with your default image to easily customise the watermark for different events.
- If enabled, the photo is then sent to the default printer installed on the Raspberry Pi
- Preview of the combined image is displayed to the user
- After a timeout the system switches back to a random slideshow
One issue I am having at the moment is my printer is very slow when printing photos. It could prevent a huge backlog at an event if everyone is printing. At the moment I have printing disabled. This can be turned on and off by a flag in the photobooth.py code.
Line 44: printPhoto = False
- Escape – Close application
- F – Toggle between Full Screen and Windowed Mode.
Finished example of the frame
Sample Photo Printout
Source Code: https://code.google.com/p/pi-photo-booth/
Direct link to the code https://code.google.com/p/pi-photo-booth/source/browse/photobooth.py
Posted in Linux | Tagged digital photo frame, photo, photo booth, photo frame, python, raspberry pi | Leave a comment
If you ever have issues with weird characters appearing in PDF documents it is most likely a character encoding issue.
This often occurs when someone does a copy and paste from Microsoft Word, or similar. Things like quotes get converted into characters that are not properly displayed unless character encoding is kept consistent all the way.
Two places the UTF-8 charset is often missed, is in the <html> body, and the load_html() tag. Often the entire <html> body is missed and only the pdf content is passed. This body tag is required to ensure dompdf knows the encoding of the document it is rendering.
A quick example:
$pdf_content = "some pdf content here"; $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>' . $pdf_content . '</body></html>'; require 'dompdf/dompdf_config.inc.php'; $dompdf = new DOMPDF(); $dompdf->load_html($html,'UTF-8'); $dompdf->render(); $pdfFile = $dompdf->output(); header('Content-Type: application/pdf'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Pragma: public'); header('Content-Length: ' . mb_strlen($pdfFile, '8bit')); echo $pdfFile
Posted in General, Programming | Leave a comment
Sometimes you need to give automatic scripts access to another box for things like RSYNC. These will usually fail asking for a password unless you do a bit of extra work.
To setup passwordless login you need to do the following, under the user account that you want password-less login from. Eg. If you are running cron scripts as root ( which isn’t usually advisable, you would need to do this from the root account )
Generating public/private rsa key pair
Enter file in which to save the key (/home/username/.ssh/id_rsa): << Accept default which should be your home dir.
Enter passphrase ( empty for no passphrase ): << Make sure you don’t set a password here or it will prompt for a password which defeats the purpose of what we are doing
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is: …
Next you need to copy this key to the server you want to connect to. When you run this command make sure you connect using the account you want to use as password-less login.
Eg, due to the security risks of having password-less login, you may want a highly restricted account to be the only one with access like this
:~$ ssh-copy-id remoteusername@servername
Now try logging into the machine, with “ssh ‘remoteusername@servername'”, and check in:
to make sure we haven’t added extra keys that you weren’t expecting.
After you have done this, you should be able to do things like
It should log you in without asking for a password. This becomes really useful when you want to do automatic RSYNC commands.
One example of usage is, I have a Raspberry Pi monitoring my Solar Inverter. This constantly logs to CSV files on the Pi. My main server then does an RSYNC every few minutes to get the latest data for graphing.
Posted in Computers, Linux | Tagged linux, password, rsync, ssh | Leave a comment
Over the years I have been involved in fixing numerous websites that are performing slow. The PHP execution time on some were insane, into the many minutes.
Nearly every time it has been down to the getimagesize() function.
This function is terribly slow and should only be used if absolutely necessary.
One thing people seem to like doing is, say in a gallery, loop through every single image getting the properties of the image using getimagesize then generating thumbnails, or even worse, just setting the HTML width and height of images.
Setting the width and height of images in HTML means the huge images are sent to the browser, then resized by the browser. It adds lots of load time and bandwidth usage.
If you are doing something like this, and need to get the image size, do it once, when the image is uploaded and create thumbnails. This way you are only delayed once when adding the images, and your visitors are not delayed.
I should also add that I have seen people recommend using alternative methods such as reading in the first 32bytes of the image, then creating an image from that data, then reading that as the size.
In my testing, this was actually slower, and has issues with different file types.
It may work in some situations, but I recommend doing some speed testing to see if it will suit your situation.
Posted in Programming | Tagged images, PHP, speed | Leave a comment
Coming from a long background of Windows starting at Windows 3.1, Mac always seemed foreign and pointless. Over the years I had the occasional use of Mac but it was always met with frustration and wonder why anyone bothered with it.
It was around Windows XP I started getting frustrated with things on Windows. I started using Linux on a few PC’s and servers.
Windows Vista was released and I shelled out $400+ for the Pro version only to be met with the plague of Vista issues. It was terrible. After 3 or so months with it, I gave up and began using Linux as my main PC.
Linux just made sense and there was no turning back to Windows.
But what does this have to do with Mac OS? More than you may think, and more than I thought.
It was a few years after getting into Linux that I found out that Mac OS version 10 and later, was based on BSD, part of the *nix family. This had me intrigued. I decided to get a Mac Mini.
It was good, but it was still just another foreign OS with nothing to really draw me to it.
It wasn’t until last year that I decided to get a MacBook Air that it really hit me. I stopped using Mac OS as a Mac, and started using it as a *nix operating system.
Install Total Terminal ( http://totalterminal.binaryage.com ). This gives you a Quake style drop down terminal accessible via a shortcut for quick command line options.
Also install Brew ( http://brew.sh ). This gives you a Linux style package manager on Mac OS.
With these two pieces of software, I feel my Mac is like running any Linux distro, but with a different interface, eg KDE vs Gnome. The desktop is just a layer on top of the underlying BSD OS.
A few other things I have done to use Mac OS effectively relate to the GUI itself
- Enable all the gestures, especially 3 fingers app swipe switching
- Full screen all apps, then use 3 finger app swipe switching
- Enable tap to click rather than push to click
If you get a Mac Laptop, do yourself a favour and buy a Apple TV. The Mac will find any Apple TV on the network automatically and give you an option at the top of the screen to connect to it. When you connect to the Apple TV, you can use it as a second screen in dual screen or mirror mode.
It takes seconds to get say a Youtube video up on the TV using this. I have Youtube clients built into many other devices such as the TV itself, Apple TV, and the PS3. But nothing makes it as easy as just switching the Apple TV as a second screen.
The audio also switches to the Apple TV so you get the sound coming from your surround sound system. This is also good for listening to music from your Laptop.
The applications I use on Mac
- PHPStorm – Cross platform ( Mac,Linux,Windows) PHP IDE http://www.jetbrains.com/phpstorm/
- Mac Mail – Better than any existing Linux Mail Client
- Spotify – Music streaming
- Skype – IM
- XCode – Mac OS & iOS Development
- Qt Creator – Cross platform C++ development
- Arduino – IDE for Arduino boards
- Dropbox – Cloud storage
- GIMP – Cross platform image editor, similar to Photoshop
- HandBrake – Video conversion
- Microsoft Remote Desktop
- Numbers – Excel-like application
- Pages – Wordprocessor
- Pencil – Diagramming tool
- Q Cache Grind – Profiling of cache grind files. Important to see where code is performing slow.
- ApplePi Baker – SD Card ISO imaging tool designed for Raspberry Pi ISO’s
- Steam – Games
- Sublime Text – Advanced text editor
- Total Terminal – Quake style drop down menu showing the systems terminal
- VLC – Cross platform video player with a huge list of file type support
- Yummy FTP
Posted in Linux, Mac | Leave a comment
This is a video from a few years ago.
A friend didn’t believe me that you could explode a Beer Bottle, just by hitting the top of it when its filled almost to the top with water. Here are the results..
To do this trick get an empty Beer Bottle, one filled with beer won’t work.
Fill it almost to the top leaving about half a cm of room.
Then with the palm of your hand hit the opening of the neck as hard as you can.
This will cause the bottom to explode off.
According to things I have read, this apparently occurs due to micro bubbles forming in the bottom of the bottle. These bubbles are a vacuum. They form then rapidly pull the water back down to the bottom of the bottle causing enough force to break it off.
Posted in Around the House, Entertainment | Leave a comment
Cars are not my usual topic of discussion but after the weird thing I experienced, and it turning out to be computer related I thought I should post incase it helps others.
My Ford Focus had a weird issue where it would randomly surge when accelerating.
I would try to take off slowly. Slowly increasing the pressure on the accelerator would do nothing. I would keep increasing it gradually until it suddenly kicks in and the wheels spin.
I thought it was just me, and I needed to get used to the car but. I got my dad to drive the car, he wasn’t sure but said something didn’t seem right.
I decided to take it back to the service centre. They knew exactly what I was talking about and said it was a common fault.
A software update later and the car is now fine. I never thought I would see the day where a software update fixes an issue with a cars accelerator.
Posted in General | Tagged cars | Leave a comment
I finally got around to building this small water feature on the weekend.
It only took a few hours ( + silicon drying time ) and was rather cheap.
What you need
- Pot of your choice
- Storage container that is wider than the base of the pot on all sides so the water can flow into it
- Mesh that is small enough to prevent the stones from going through it
- Water pump
- Pipe that fits the water pump outlet
- Silicon sealer
- Wire ( I used an old coat hanger )
- Bricks, pavers, anything that can go in to the water to support the weight of the pot.
Start by feeding the pipe through the hole in the bottom of the pot. Make sure you leave enough out the bottom to reach the pump in the container. I recommend pulling enough through the hole so it reaches past the top of the pot. You can cut this back later.
Silicon the pipe into the hole of pot and set it aside to dry.
Place your storage container on the ground in the area you want the water feature and mark out the size of the container on the ground.
Dig out the hole so the storage container fits inside, make it slightly lower than the surrounding ground so water can flow into it easily.
Place the storage container into the hole and back fill to support it properly.
Next you need to place the bricks into the storage container in a way so they can support the pot, while allowing the pipe to run out the bottom. I used 3 bricks. One flat, then two on their side on top of the flat one. The pipe easily fit between the two on their side, and ran down to the pump.
Lay your wire mesh over the hole, and cut to size. You will want to allow a bit of overhang so it doesn’t fall in, or let things fall into the storage container.
Cut a hole in the centre of the mesh to line up with the pipe.
Feed the pipe through the mesh and connect it to the pipe.
Fill the storage container and pot to the top with water and switch the system on.
The water should start spilling over the top of the pot and flow back into the storage container. At this stage you should make sure it is as level as possible so the water spills over all sides. I had to put bits of random “things” under some sides of the pot to make it level.
Once you are happy that it is level cut the pipe coming out of the top of the pot, so it is level with the top of the water.
Next use the wire to support the pipe so it sprays up directly in the middle of the pot.
I did this by finding the middle of the wire and looping it around the pipe. I then bent down either end of the wire to make a triangle shape slightly larger than the sides of the pot. These then jammed in fixing it solid. You will need to play around with this and it will be harder with a round pot. You may be able to come up with alternative methods to hold it in the centre. I just found this was the easiest with the style pot I used.
The last step is to cover the mesh with stones. I started with a more coarse stone, before covering with the finer decorative stones.
Last step is to sit back and enjoy the sound of the water.
Posted in Around the House | Tagged fountain, water feature | Leave a comment
← Older posts