Playing Video Files on Your TV with minidlna

Playing Video Files on Your TV with minidlna

One of my presents from Christmas a few years back was a Sony smart blu-ray player. It was marketed as something that easily streams files from your computer. That is absolutely true for anyone that runs Windows, just point and click. With Ubuntu, it’s a bit more complicated. Enter minidlna.


First thing, install minidlna. Open a terminal (Ctrl-Alt-t) and type this in:

sudo apt-get install minidlna

If you’d rather use the package manager, just search for minidlna.


The configuration file is editable by running this in the terminal:

sudo gedit /etc/minidlna.conf

There are 2 settings to note: media_dir and friendly_name. The names used are pretty explanatory. Here’s an example of what to update:

# Path to the directory you want scanned for media files.

# Name that the DLNA server presents to clients.

Save and close the file. On the terminal run this to refresh minidlna:

sudo service minidlna restart

That’s it! minidlna is all setup to server the files and folders in your media_dir.

ssh: Remember each host’s settings

ssh: Remember each host’s settings

When you start using ssh to connect to other linux-based computers, you’re probably only going to a handful of machines. Easy enough to remember the username and hostname, but this won’t do when you’re working on 5 or more servers, especially if some offer ssh on a non-default port.


In this file, you can set all the options for each host, including the username, host or ip, port, even which key to use. Here’s an example:

#Contents of $HOME/.ssh/config
Host dev
User dev-deploy
Port 2222
IdentityFile ~/.ssh/id_rsa.deploy.key

Host prod
User prod555deploy
Port 5899

User admin123
Port 5899

It’s that easy! To use this config information, simply ssh:

ssh prod

Happy Computing!

Facebook Cover Photos

Personalizing your Facebook Cover Photo is easy, once you know how to search for one. Here’s a quick guide to help you find exactly what you want:

  1. Go to Google Image Search
  2. Search for something, for instance: Fringe
  3. On the left, click ‘Exactly…’ under Any Size
  4. Enter a width of 851
  5. Enter a height of 316
  6. Now all the images in your results are the perfect size for your Facebook Cover.
  7. Keep on searching to find something uniquely you!

Now, if there’s a watermark/logo, you can remove it in Gimp or Photoshop. Or you can just pick an image without a mark in it.

Happy Facebook-Stalking! j/k lol

What you should know about memory leaks

Have you ever noticed that your browser slows down after running for a while? Heck, most times the whole computer slows down after running for a while. This is primarily because a program requested a chunk of memory and not releasing that chunk when said program is done. This is called a memory leak.

When I speak of memory, I’m speaking of RAM, not the hard drive. RAM forgets everything when the computer turns off. The hard drive stores the programs, music, e-mails, etc. while the computer is off. At least until the hard drive fails, and it will one day. Reason #1 to Make Backups!

Every program uses RAM. It’s impossible to run a program without copying it to RAM first. On top of that, when a program needs more RAM, it requests it from the operating system. Once the program exits, the OS should release that RAM so another program can use it. Sadly, this is not always the case.

Checking for Leaks

It’s quite easy to check for memory leaks for a specific program. If you’re running Windows:

  1. Right click on the task bar and select task manager
  2. Click on the Processes tab
  3. Select Options -> Select Columns…
  4. Check the VM Size and Mem Usage
  5. Click OK
  6. Run the program, if its not already running
  7. Keep a watch on it’s statistics
  8. If the VM Size and/or Mem Usage keeps going up and not going down, that program has a memory leak!

Note: Once you do steps 3-5, you won’t have to do them again on that computer.

Using Linux or MacOS:

  1. Open a command prompt
  2. Run: top
  3. The columns to watch at Virt(ual Memory) and  Res(idual Memory)
  4. Run the program, if its not already running
  5. Keep a watch on it’s statistics
  6. If Virt and/or Res keeps going up and not going down, that program has a memory leak!

Note: Press h for help while running top.

Most Leaks Occur in the Browser

Sadly, tons websites have memory leaks. To check for this:

  1. Do steps 1-5 above or run top
  2. Load up your browser
  3. Go directly to Leaks There!)
  4. Check the VM Size and Mem Usage
  5. Go to a site that regularly slows your browser down
  6. Check the numbers, they should have gone up
  7. Go back to
  8. Check the numbers again

If they don’t go down at all, you can almost guarantee that that website has at least one memory leak. I’ve noticed this is especially true for Cafe World and Frontierville on Facebook, but almost all flash-based game will have memory leaks because flash has memory leaks. That is why the newer versions of Firefox runs flash as a separate program.

Luckily, all you have to do is restart your browser and those numbers will be reset. Setting your homepage to something simple that doesn’t leak, about:blank is good, can help too.

Memory Leaks Are NOT Dangerous

These leaks are not dangerous, just frustrating and annoying. Restarting the program or computer will speed things back up. That’s not a permanent solution, but it is usually the easiest fix.

Another option is to call tech support, but most of the time they can’t do anything for you except forward your complaint to the proper department and tell you to restart your computer or the program. If you choose this option, make sure to have all your number written down before you even call.

Sometimes, the best solution is to just stop using that program or website. Find an alternative that doesn’t have memory leaks. You might even find a gem in the rough.

XFS PVR/DVR maintenance

Last year, I purchased an HDTV tuner card and started using my computer as a Personal Video Recorder, or PVR. Basically, a small program records a tv show to the hard drive. This did quite well until March when it would stop recording after 5 seconds to 15 minutes for no apparent reason.

After about a month of research, I had ruled out just about everything under the sun. Then, it hit me … the file system might need defraging. The file system I am using is XFS, and they can get fragmented over time, especially if you have big files (HD-MPEGs) and little free space.

The command to defrag all mounted (and keeps them read-write) XFS filesystems is:

xfs_fsr -v

After running this, shows started recording better, but still stopped. So, I wanted to see just how fragmented everything was. I found this command:

xfs_db -r /dev/sda3

That starts an interactive XFS debug session for sda3, my XFS partition. Three useful commands are freesp, frag and quit. frag reported over 15% fragmentation and freesp reported a lot of small blocks and very few large blocks.

Finally, I got to the heart of the matter: defrag programs do not operate efficiently with less than a certain amount of free space. My drive had 20GB free out of 250GB total. I deleted a few HD shows to bring it up to 45GB free and ran the defrag command again.

Voila! Less than 6% fragmentation and plenty of free big blocks. My recordings are almost flawless now. At least they don’t stop for no reason. So, if you’ve got an XFS file system:

  • make sure to run the xfs_fsr command regularly
  • if you’re filesystem is still fragmented, burn/remove some junk and repeat

GCC 4.5

Over the last week, I’ve been updating my eeePC’s Gentoo linux to run GCC 4.5 and recompiling every package. The main reason is that now almost all my software is fully optimized for the Intel Atom processor. With only 1 relatively small hack, the rebuild went fairly smooth and my CFLAGS now contain “-march=atom -mtune=atom” !

The one small hack was placing a sed command inside the gcc 4.5 ebuild. It will build the first time without the command, but all subsequent builds will fail with an error that stage 2 and stage 3 are different. Here’s the line added to the src_unpack part of the ebuild: (Note: wrapping added)

[[ ${CFLAGS} == *-march=atom* ]] && sed -i 
    -e 's/(INSN_P/(NONDEBUG_INSN_P/g' 
    -e 's/!INSN_P/!NONDEBUG_INSN_P/g' 

To keep it safe, the line check if you $CFLAGS has -march=atom in it. If so, then it runs the following sed command. Originally issued as a patch for gcc for all of us running an Atom processor(s), I swapped it around to a sed command, as a few forum posts pointed out.

Beyond making the ‘overlay ebuild’, there was only 1 other snag, and that was binutils. Using the new gcc, binutils just wouldn’t compile. The error was about the movbe instruction. Upgrading from 2.18 to 2.19 using the old gcc compiler did the trick. After that it was just a matter of waiting for all the packages to recompile.

If anyone is thinking about upgrading to gcc 4.5 on gentoo, it’s not all that bad. Make sure to read the Gentoo GCC Upgrading Guide before you do anything. Also, run a “cat /proc/cpuinfo” to get the model of atom processor and make sure your CFLAGS are set properly.

Cool Drag & Drops

If you´ve been working with computers for a bit, you know that you can drag and drop files from folder to folder. What you may now know is that there are plenty more uses for drag and drop. Here´s a 3 very useful drag and drops:

  1. Drag a program from the start menu to the desktop.
    This is great if you use something all the time, but the program did not install a desktop icon. Note: Putting freecell on your desktop may be hazardous to your productivity.
  2. Drag a folder/file/program to the start menu.
    You can´t just drop it anywhere on the start menu, as parts of it were written in stone.
  3. Drag a tab in Firefox to the Bookmark menu.
    This makes bookmarks super easy. You can even drag the tab to the bookmark toolbar.

Pointer Clues

When you drag and drop, your mouse pointer will change. If you are not allowed to drop something somewhere, you will have a no sign (like no smoking). If you are allowed to drop something there, you will have a normal pointer with a dashed box. Usually, a black line will show where the item will drop.

Right-Click Drag and Drop

If you use the right mouse button instead of the left, when you drop the item you will see a little menu. This will ask if you want to copy, move, create a shortcut, or cancel. Most of the time, Windows will move the item. Sometimes a copy is made. If you right-drag it, you can decide.


Sadly, the scroll wheel, sometimes called the middle button, does not drag and drop. It does have some pretty cool uses though, including opening a link in a new tab.

One Final Clickity Note

Always use the left mouse button, unless told specifically to use another button.

Are Games Moving to Legal Torrents?

Thursday, 1/21/2010, someone uploaded Mass Effects 2 to a torrent site. Between then and today, it has bounded to the top of The Pirate Bay’s PC Games category and #4 in the overall top 100. Today, the official game release date, the 14.35GB download has 1,877 seeders and 28,448 leechers according to TPB.

The retail version of this game comes with access to downloadable content. While this additional content can be purchased for $15 if the game comes second hand, that doesn’t help those that download the game illegally. The retail PC version can be found for at little as $43.

My theory is simple: This game was leaked by BioWare. They want to see how many people buy the game vs how many download it, when buying the game comes with extra content. The leak is just like an old school demo; the ones where you got the whole game, but just one level.

The business model makes perfect sense. The more people that download via BitTorrent, the more money saved from manufacturing. On top of that, removing retailers from the financial pyramid makes products cheaper for the consumer and more revenue directly to the producer.

Could we be returning to these earlier days? Could this be the future? Game makers releasing a low content version via BitTorrent and charging for additional content?

Cafe World Cheat #2

UPDATE 3/18/2010: I have created some tools to help at Included are a cooking suggestion tool, more cheats and tricks, a forum, even a spice tool.

I’ve got another cheat for all you cafe world fans.

If you turn your stove toward a wall or table or another stove, you will not have to walk to the stove. Ever. In fact, the only place your character will walk to is a serving table.

Bonus Tip

Max your buzz rating to 105.0 by making sure no customer leaves without food. Following my original Cafe World post, will almost ensure this.

Once your employees are boxed in, if anyone leaves without food, (re)move the table/chair where that person was sitting.