Source Code in WordPress

Since this is a technical blog, I like to post source code in various forms from time to time.  But, WordPress.com hasn’t been very easy in that regard.

WordPress.com was rather limited — the only thing I found was the [- sourcecode -] tag.  You can read more on that here.

Now that I am on my own site, I am looking to try to improve source code handling with a plugin.

Of cource, the Source Code post mentions that they use the SyntaxHighlighter plugin for WordPress.com. I found another list of plugins, but that just led me back to a different link to the same SyntaxHighlighter.  It does mention a Visual Code Editor that might be interesting.  Apparently, it will work in conjunction with the SyntaxHighlighter. Now, this list looks much more promising: 12 WordPress Plugins to Display and Highlight Code within your Blog

I did a little more looking into the WordPress version (SyntaxHighlighter Plus).  Here is a list of syntaxes supported.  At the bottom, there is some information about how to create your own syntaxes.

This Developer Formatter plugin looks very promising.  The problem is it didn’t work for me.  It seemed to break the editor.

I ran across this thread that talks about adding Code Mirror to the TinyMCE editor.  If I ever get time, I’ll have to try my hand at writing a plugin.

 

LogMeIn VPN; PullMeHairOut on Ubuntu

You would think a stereotypical Linux user would not mind getting his hands dirty in the command-line trying to make a program work.  Well, either this user is not typical or that’s not true.  The LogMeIn Hamagi VPN solution seems to have some cool features, but the Linux client was painful to figure out.  Some documentation or instructions would be nice, but I think a nice basic user interface would also be helpful.  Command-line is cool, but I just need to get connected, and I don’t want to learn yet another networking tool to get where I need to go.

If you are attempting Hamachi, this blog post is your lifesaver:

Eric Lefevre-Ardant on Java & Agile: How to use LogMeIn under Linux

Next task is finding the Linux client.  They don’t have a production one, but they do have a beta version available.  Check out their beta page: LogMeIn Labs & Betas.  This part is awesome once you find it — choose your flavor, deb or rpm, they have it.  The Deb worked great for me on Ubuntu x64 10.04.

After installing, it was like nothing happened.  No new menu items show up in the menu.  Well, don’t worry, it installs a service and a command line program.  Here are the files shown in the package:

Files in the package

When the package installs, it starts the service.  You can see it running here:

Service Running

Now, you have it installed.  You need to use the command-line program to connect.  First, you simply need to connect to the LogMeIn server (everything goes through there server).  Note that you don’t need a user name or any credentials for this part (that will come later).  Here’s the command plain and simple:

sudo hamachi login

Now, if you have an account on LogMeIn, you need to “attach” to it.  If you are connecting to someone else’s network, you can skip this step.

sudo hamachi attach <email_address>

As far as I can tell, the next command just sets a name for your client.  This is the name that will appear in the administration pages online for LogMeIn Hamachi.

sudo hamachi   set-nick <name>

In my case, I set my nickname to “stephen”:

My Nickname Setup

Then, online it will show this name:

Nickname Used

Now, the final step is to connect to the network.  This is where it got really confusing for me.  It was not the command or how to do anything, but the problem was just determining what network ID to use.  So, let me walk you through how to figure out the ID.

The person with the account on LogMeIn who setup the network, will need to login and view the “My Networks” page.  Then, click on the edit link next to the network:

Viewing the Network Settings
Then, here’s where you see the network ID to use in the join command.

Finding the Network ID for the Join command

Once you know this ID, you can simply run the command:

sudo hamachi do-join "<network ID>"

It may ask you the password for the network.  The LogMeIn account holder can optionally setup the password.  If no password was setup, just hit enter, and it will proceed.  Here’s what the configuration looks like when you setup a network:

Network Password Setup

Now, you should be connected.  You should have a new network interface in your network settings:

ham0 network interface

If you need to connect to other machines in the Hamachi network by IP address, you will need the LogMeIn account holder to give you those IP addresses.  You talk to other machines via the IP address for the Hamachi network not the local network.

All in all, once you get it setup, it seems to work well.  I don’t like the fact that you have to run the program as administrator.  For my other VPNs, I don’t need super user access to configure or connect.  I also don’t like having an extra service running in the background.  Why can’t it just use the Network Manager Applet like the other VPNs?

Now, I would be amiss if I didn’t mention the GUI.  I found a Community Thread that points to a front-end called Haiguichi.  It has a Deb package that you can install, and that part worked fine.  It gives you a new menu item under Applications > Internet > Haiguichi.  I couldn’t get it to configure though, and I finally figured out the command-line, so I left it alone.

Great Link: App List for Ubuntu

I ran across this link recently, and I always want to share great lists of applications.  Building your toolbox is always fun.  Or should we say loading the app under the Christmas tree!

Ubuntu Linux Help: More Useful Open Source Applications 2011

PDF Mod is the new app that I picked up right away off the list.  I haven’t had a lot of chance to use it yet, but I think it will come in handy.  Install it with this link: apt:pdfmod.

 

Gizmod for Volume on Mythbuntu

Our remote control has been working fine with my Mythbuntu setup for a while now, but there are a few things I would like to work better. Volume is one of those thing. Lirc controls the volume differently between Hulu Desktop and the built-in video player. It is a little annoying.

So, after a little Googling, this thread sparked my interest in Gizmod.

Installing…

To install it on my system, I followed the Ubuntu directions. That calls for installing via the repositories:

sudo apt-get install gizmod

Next, I had to address the UDev / Security. First, that means creating an “input” group:

sudo groupadd -f input
sudo gpasswd -a username input

Then, I added the following lines to /etc/udev/rules.d/99-input.rules:

KERNEL=="event*",       NAME="input/%k", MODE:="660", GROUP="input"
KERNEL=="js*",          NAME="input/%k", MODE:="664", GROUP="input"

Then, to make the changes take effect, I ran:

sudo service udev restart

Here’s the problem. When I tried to start gizmod, I got this error:

GizmoDaemon v3.4 -=- (c) 2007, Tim Burrell &lt;tim.burrell@gmail.com&gt;=---------=
Unable to Initialize Gizmod :: User Script dir [/usr/etc/gizmod/modules.d] does NOT exist or permissions are wrong!
GizmoDaemon Shut Down.

Recompiling

I found a bug report that seemed to suggest that maybe recompiling from the source might fix the problem. So, here is what I did.

So, I downloaded the latest version from the Download Page. Then, here’s the command to unzip:

tar -xjvf gizmod-3.5.tar.bz2

cd gizmod-3.5/

Installing dependencies

The easiest way to make sure that you have all the dependencies is with apt-get. Otherwise, you need to check the documentation and manually go through the list installing all the programs.

sudo apt-get build-dep gizmod

Then, continuing on, I followed the instructions and ran CMake.

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc ../../gizmod-3.5

make

The make command failed with this error:

skp@gabriel:~/Downloads/gizmod-3.5/build$ make
[ 29%] Built target H
[ 31%] Building CXX object libGizmod/CMakeFiles/Gizmod.dir/CPUUsage.o
/home/skp/Downloads/gizmod-3.5/libGizmod/CPUUsage.cpp: In constructor ‘Gizmod::CPUUsageInfo::CPUUsageInfo()’:
/home/skp/Downloads/gizmod-3.5/libGizmod/CPUUsage.cpp:83: error: ‘memset’ was not declared in this scope
make[2]: *** [libGizmod/CMakeFiles/Gizmod.dir/CPUUsage.o] Error 1
make[1]: *** [libGizmod/CMakeFiles/Gizmod.dir/all] Error 2
make: *** [all] Error 2

I found a fix online. The fix was to add #Include <cstring>:

Then, it worked. Everything compiled with no problem.

Lastly, I finished the compile/install with:

sudo make install

Now, I haven’t used it very much. I think I need to do some configuring and hacking to get it to do what I want it to. Currently, it doesn’t seem to do well with Hulu Desktop.

Taking Cheesy Pictures With Your WebCam

If you have to go to the grocery store, you may as well make it fun.  My son can’t quite read yet, so I like to make picture lists of what we need and I have him go through the list and help me get all of the items.  Usually, I just use Google’s image search to build my list of pictures.  Today, I couldn’t find the right picture, and I decided to try my hand at taking my own pictures.

Here’s where I got lazy.  Why take a picture with my phone or digital camera and then take the time to copy over to my laptop?  I have a camera on my laptop.  Why can’t I use that?

Here’s how to make it work…

Installing Drivers and Software

I found my answers in Ubuntu’s Documentation.  If you need help with the drivers part, you can look there, but my driver was installed by default with the Ubuntu installation.  The part I needed was Cheese.  The Cheese program did exactly what I needed.

Ubuntu Documetation: WebCam

You can either use Ubuntu Software Center to install Cheese like this…

Installing Cheese with Ubuntu Software Center

Or, you can use Synaptic…

Synaptic to Install Cheese

Once installed, you’ll find it under the Sound and Video menu:

Cheese on the Menu

Using Cheese

Taking the picture is as easy as saying Cheese!  Open the program, get your web cam pointed right, and click the take photo button.

Taking the Picture

Note, Cheese has different modes.  You can either take a picture, video, or burst mode.  You can select the mode at the bottom:

Mode Icons

More Info…

Cheese Website

To Watch: Free Software University

I would say Software to Watch, but it’s more learning to watch.  I made it through college.  Do I really want more punishment?  Well, I guess I am a nerd.  Bring it on!  Knowledge is always something I can use more of.  Maybe I will even get the chance to teach.  In any regard, keep an eye on this Free Software University.

Links:

Great Link: How to Become and Amazing Open Source Person

I ran across this the other day:

Open Source.com: How to become an amazing contributor (to an open source project)

I would love to be one of those people in the story.  Being amazing is always a good thing.  Actually, one of the things that stood out to me was that this is a two way street.  The author was lauding these people, but at the same time, they commented on how it was easy to contribute.  They found documentation that helped.  The code was structured in a way that made hacking easier.  I think both the contributor and contributee are amazing.

News: New Skype Version

Seems like it has been a while since we have seen a new version of Skype, but last week, my update manager offered me a new version!  The biggest advantage to me is the improved voice and video quality.  Unfortunately, I haven’t had much of an opportunity to try the voice and video recently.  Skype access is another new feature, but since I have Android tethering, I probably won’t have any need for it.

Download from Here

You can read more details from the blog post.

Here are the new features advertised on the main page:

Skype Access New Feature

Improved Experience

Ubuntu 11.04 Coming Soon; Where’s the Count Down!

I like the count down banners that get us excited about the new version of Ubuntu coming out.  Thanks to ikt, I finally found one!

The Wiki has a page dedicated to the countdown banners.  The sad part is that none of the counters made it to the Community countdown page.  The Facebook and Android ideas sounded cool, but I didn’t go looking for them.

You can check out the Natty Release schedule to see that the release date is April 28th.