Monthly Archives: August 2013

Having Trouble Viewing Media on Your Sony Bravia TV?

If you’ve got a latish model internet-enabled Sony TV (we have a Sony Bravia KDL40HX750 TV) then you may know it can display media streamed from a compliant DLNA server. If you know this you probably also know that the Sony TV’s can be very picky about what media formats (specifically movies) they will and wont play. I’ve had some luck converting movies to different file formats but even with this solution I’d pretty much given up on watching streamed movies on the TV because it was just all too hard. So I’d been resorting to using my five year old WD Live Media Player with an external HDD plugged into it.

However, I’ve hit on a solution that has allowed me to watch almost any movie in any format on our Sony TV. I’ve setup a DLNA media server and downloaded the great app Bubble UPNP to our Nexus 7 tablet. Once the app is installed it’s just a matter of connecting it to our media server, choosing a movie to play and selecting our Sony TV as a rendering device. Once that is done and I press PLAY in the app by the magic of smoke and mirrors the movie starts playing on the TV. Fabulous.

Turning Your Headless Linux Machine into a DLNA Media Server

We have had a Sony Bravia KDL40HX750 TV for a while now. It’s a great TV and can stream media from a compliant DLNA media server. I was doing this with Windows Media Player from my dev PC but given that my dev machine is usually turned off after 9PM it wasn’t used much. So, given that my My mini-ITX file server had been running nicely for a week or so I figured it could become the new media server for the house. Here’s how I got it working.

1. Mount an External HDD

The first problem was to mount an external USB disk drive to hold the media. And I wanted it to mount to the same point every time it was unplugged and plugged back in. This was fairly simple. Firstly, we need to work out the UUID of the USB drive we want to use. Run:

sudo blkid

And you should see something like that shown below. Our USB drive is on the bottom line,

/dev/md1: UUID="a20f7307-fb20-4c92-95d2-db222778af8f" TYPE="swap"
/dev/md0: UUID="c4c0ea5f-0613-4acc-8fa5-4d5968802771" TYPE="ext4"
/dev/sdc1: UUID="AE884FDE884FA425" TYPE="ntfs"

Once you know the UUID open up /etc/fstab in your text editor of choice and add an entry that looks something like this:

UUID=AE884FDE884FA425 /media/mediadrive ntfs defaults 0 0

Save those changes. Then create a mount point for your mediadrive using something like:

sudo mkdir /media/mediadrive/

Then reboot your machine and you should find that fstab mounts your USB drive to /media/mediadrive

2. Install and configure minidlna

There’s a number of DLNA compliant media servers for Linux. I chose minidlna because it was small and seemed to just work. Install it with:

sudo apt-get install minidlna

Then open the minidlna.conf file with:

sudo nano /etc/minidlna.conf

And configure to suit. I left most settings as is but you’ll need to set the path to your media drive, the network interface, and give your media server a name for devices to use when they connect to it. Here’s what those settings look like:

media_dir=/media/mediadrive
network_interface=p4p1
listening_ip=192.168.2.3
friendly_name=EinsteinJR

I note that there’s a web interface to manage minidlna but I haven’t taken a look at that.

Save the config changes and then restart minidlna with:

sudo service minidlna restart

3. Refresh Your Media LIbrary

By default minidlna refreshes your medial library every 895 seconds (controlled by the notify_interval setting in the conf file). However, if you’re impatient you can force a refresh with:

sudo minidlna -R
sudo service minidlna restart

Alternatively you can force the database refresh using:

sudo service minidlna force-reload

Once your library is refreshed you should see your new server available from your media device and be able to view your movies or listen to your music.

fancontrol Not Working after Resume from Hibernate

I setup fancontrol and lm-sensors on our new mini file server yesterday. I did it by following this fanspeed how-to article. However when I got up this morning after the server running Ubuntu had automatically woken from hibernation the fan was spinning at max RPM. I suspect it had reverted to manual fan control. This was fixed easily enough with:

sudo service fancontrol restart

But I don’t want to be doing that every morning. A bit of Googling suggested that this was a bug of unknown origins. There doesn’t seem to be any real fix so I decided on a work-around. This meant simply running a script when the file server resumed from hibernation. To do this I just created the following script in /etc/pm/sleep.d/20_fancontrol

#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin

case "${1}" in
    resume|thaw)
      service fancontrol restart
      ;;
esac

Then I made the script executable with

sudo chmod +x /etc/pm/sleep.d/20_fancontrol

I quickly tested this with:

sudo rtcwake -u -m disk -t 09:00

And when the computer re-started the fan was spinning at the correct speed.

Building a New Mini File Server

So I completely lost confidence in our Mac Mini after the power surge issues and decided to build a new file server. I wanted something small and quiet built from standard components that would run Ubuntu server. I spent some time looking about and decided on the following build:

Case : Antec Mini ISK110 Vesa
CPU: Intel G2030 Pentium
CPU Cooler: Stock (if possible)
RAM: 4GB Generic
Motherboard: Gigabyte GA-H61N-D2V
Drives: 2x500GB 5400RPM 2.5″ laptop drives

Total cost was around AU$400. I ordered the case from an online vendor, the motherboard from eBay and the rest of the components were sourced from MSY Computers.

Gigabyte GA-H61N-D2V Motherboard

Gigabyte GA-H61N-D2V Motherboard

The mini-ITX format motherboard from Gigabyte (see above) shipped with a back plate and two HDMI cables. It has USB ports via the rear panel, has two RAM slots, 4 on-board SATA3 ports and supports any LGA1155 pin Intel PC. If the installed CPU has a GPU then there’s an available HDMI port too.

Intel G2030 Pentium and Stock Cooler

Intel G2030 Pentium and Stock Cooler

I chose the G2030 Pentium from Intel because it has on-board video, two cores, and a 55W thermal design load. And it was cheap. This is a file server so I didn’t see the need for excess CPU cycles. There’s a mobile version of the G2030 that has a TDP of 35W but that was more expensive and not available locally.

Motherboard with Installed CPU and RAM

Motherboard with Installed CPU and RAM

As I usually do I installed the CPU, fan, and RAM to the motherboard before the board went into the case. No issues here, everything went in smoothly. I was hoping the stock fan would fit in the small Antec case. If not I would have to purchase a low profile HSF unit like this Noctua unit. It turns out the stock fan DID fit and is very quiet at low RPM.

Antec ISK 110 Mini-ITX Case

Antec ISK 110 Mini-ITX Case

Above you can see the Antec case I chose. It comes with a 90W external power supply, has 4 USB2.0 front panel ports, has space for two 2.5″ drives internally and supports the mini-ITX motherboard format. It comes with a desk stand (which you can see on the right) and a VESA bracket so you could bolt it to the back of a monitor or TV. Ideal if you wanted a small format media PC or all-in-on PC solution. The case itself is about the size of a large format paperback novel. Quite a bit bigger than a Mac Mini but still very small.

Antec ISK 110 Mini-ITX Case Internals

Antec ISK 110 Mini-ITX Case Internals

Here’s the guts of the case. The cables on the right are all for the front panel. At the top is the PSU.

Motherboard Installed

Motherboard Installed

The motherboard went into the case without too much trouble. The front panel cables are stiff and impede on the area where the mother board wants to sit. So they need some bending to move them out of the way. Also, the back panel insert needs to be removed to fit the motherboard but it’s easily replaced with the back panel that shipped with the motherboard.

Back Panel

Back Panel

Here’s the back panel. The usual array of connections are available.

HDD Cage

HDD Cage

The cage for the two internal HDD’s is on the back of the case. In this image the cage is in the center of the image and attached by a screw at each corner. It was simply a matter of removing the cage and applying the included adhesive anti-vibration pads. You can see what this looks like below.

HDD Cage with Anti Vibration Pads

HDD Cage with Anti Vibration Pads

My two 2.5″ hard disks then simply screwed into the cage with the screws that were included with the case. The only issue here was to ensure that the drives were aligned correctly so that power cables and SATA cables could be routed easily to the drives.

Hard Drives in Cage

Hard Drives in Cage

Once I’d screwed the cage back to the case and routed the SATA cables and power cables from the front of the setup looked very neat indeed. You can see what it looked like below. My only comment is that you’ll want two SATA cables with 90 degree bends on one end to make the job of connecting up the drives as easy as possible.

Hard Drive Installation Completed

Hard Drive Installation Completed

The final step in the process meant flipping the case back over and finishing off the cabling to the motherboard. The ATX power supply harness was very rigid and needed some work to get it bent to the shape I wanted. Once I’d done that the rest of the cabling was easy enough. I managed to tuck away a lot of the cables in the edge of the case out of sight to neaten things up. You can see the final result below. One comment I would make here is that while the Gigabyte motherboard does have a PCI-E slot I would be dumbfounded if you could fit a card in this case. There just doesn’t seem to be enough clearance.

Cabling Complete

Cabling Complete

And here’s the final product with the sides of the case back on. Lot’s of ventilation means that it can run with the CPU fan idling away silently at 900RPM or so and there hasn’t been a need for a case fan at all. Admittedly it’s winter here and with room temperatures of less than 20 degrees Centigrade the CPU temperature has been sitting at about 40 degrees for several days now. I can wind the fan speeds up during the hotter parts of the year if needed.

Completed Teeny Tiny Computer

Completed Teeny Tiny Computer

I installed Ubuntu Server 13.04 on the machine and setup the disks in a RAID1 configuration. Installation was very smooth and without issue. I even had time to do a few experiments removing the disks to make sure the computer still booted and I could recover data from the degraded array.

Dealing Gracefully with Customer Price Objections

Every day I deal personally with emails from new users of my software, existing users, and prospective users. One topic that comes up from time to time is people complaining about the cost of the software (new users), the cost of upgrades (existing users), and having to pay for on-going technical support (existing users). Just because I don’t really get many emails like this (perhaps 1 a week, perhaps less) doesn’t mean I haven’t spent some time and effort working out the best way of handling them. Not surprisingly, I’m not the only mISV to have this problem as someone has been posting about it over on The Business of Software forum. Some of the advice contained therein is pretty good. Some of it (in my opinion) isn’t.

I thought I’d take a look at the best (and worst) responses in the thread. Thread responses are posted as is (no typos have been fixed).

You don’t owe an a customer a lower price unless you promised it. I’d tell the customer, as nicely as possible, that the price will remain as is, and that there may be other products that would meet that customer’s needs better

I like the first sentence of this response. As an mISV you do not have to honour earlier prices unless the customer has been promised access to the lower price. I do not like the second sentence. It’s basically encouraging the customer to look elsewhere. Effort should be made to retain the customer as every customer is a potential source of on-going revenue.

I would give your customer a discount coupon (say 50%) to make them happy and get the sale. Selling at a lower price is better than not selling at all and this is just a one-off. Your customer will be happy and maybe even recommend your software to others because of it. Plus it’s another person you can charge for upgrades in the future.

This is a decent approach. It makes an effort to keep the customer happy, it gives you an opportunity to secure a sale and cement a relationship with the user. It also suggests on-going intangible benefits such as word-of-mouth marketing. I’ve used this approach many times in the past and while I don’t have any hard statistics it does secure the sale in the majority of cases.

I wouldn’t offer him a discount at all — but I love standing my ground, and there’s nothing like sales being made at the higher price to prove that it’s the right price.

Admirable and pointless. If you’re an mISV then your likely to want every sale you can get. If you’re selling dozens of licenses a day then a few lost sales are not likely to bother you. The only time I’d completely dismiss a potential sale like this is if the customer has proven to have a high cost of ownership and that it would be more cost-effective for you to fire that customer than retain them. Out of the 10,000 odd companies that use my software I’d guess I’ve “fired” a customer perhaps 10 times. So the customer would have to be exceptionally bad to want to write them off.

Never do anything for free.

Ask the user if they would be willing to send you a postcard from or pictures from their location in return for a discount.

I like this suggestion. It hearkens back to the postcard-ware days of software and forces the customer to do something in return for the discount. Thus it forces them to assign a personal value to receiving the discount. My only suggestion is that while making the customer do something is great I do not think that receiving the postcard is something that benefits the business long term.

I think the best way to handle this is just to politely write back the customer and say something like, “The truth is that the product isn’t sustainable at the cheaper price. The revenue does not yet cover the development cost, so I have to make more money. My strategy is both to slowly drive up the value (and price) of the product by adding more features, and to slowly expand the potential market and audience for the product with those additional features. “

There’s a few posts that suggest something along these lines. This is a terrible approach. You do not need to reason with your customers nor provide them with a story about your business. In most cases they simply won’t care. After all, as a business owner you don’t particularly care about why the customer wants your product cheaper so why on earth would they care why you want more for it?

Ask them for a 300 word testimonial about how they use your product and why they find it useful. Ask for permission to publish it on your website along with their name and a link back to their website. If they comply give them access to the old pricing.

Full disclaimer. That’s my response and (not to blow my own trumpet) it’s the best one in the thread. It demands some effort on behalf of the customer to get the discount, it gives the mISV some material that will help build credibility when it is published on their website, and it helps to secure an on-going relationship with the customer. And does it work? Absolutely, I’ve been very forward with with my users in the last 12 months asking for testimonials. And you know what? Almost all of them have been absolutely happy to provide one and allow me to publish it with their full name. It’s by far the best way of handling customer price objections gracefully.

Suspending Ubuntu on a Mac Mini and Automatically Restarting

I want my Mac Mini with Ubuntu 13.04 Server installed on it to automatically suspend and re-start early in the morning. It does nothing all night so I didn’t see the point of it sitting there drawing power the whole time. So, how hard could it be I wondered? We’ll it turns out it was surprisingly easy. Before I did anything I wanted to make sure that the Mac could be suspended successfully. I did this easily enough with pm-is-supported:

pm-is-supported --suspend && echo "suspend is supported" || echo "suspend is not supported"

Happily enough that reported back that suspend is supported. After a bit of Googling and I came up with this page on Ask Ubuntu. I pretty much followed the instructions verbatim by creating the suspend_until script and adding a cron job to trigger it.

The suspend_until script in nano

The suspend_until script in nano

I made two changes to the script (which you can see above). The first was to use to use the -u flag on the rtcwake call because it turns out the real time clock in the Mac uses UTC time. The second was to use the disk rather than the mem suspend option. My reasoning was simply that a disk suspend is recoverable case of an extended power failure while a mem suspend is not. And here’s the CRON entry I made to suspend the Mac at 10:00PM each night and start up again at 6:30AM.

00 22 * * * /root/suspend_until 06:30