Blog about how much you love satellite tv with a satellite tv review!

[Solved] Ubuntu 10.04 – Brasero “MP3 is not suitable” error

To fix this issue simply install the Ubuntu Restricted Extras package, and everything will work as you’d expect.

The reason this isn’t installed by default is because MP3 is proprietary and yucky.

Leave the first comment

How to get Dell Wireless working in Ubuntu Lucid 10.04 / Linux Mint

There are a shed-load of forum posts on the web from people who simply cannot get their wireless working with their lovely new Dell laptop. None of which are particularly helpful or give any clear steps that allowed me to resolve my problems with my Dell Studio 15 and 1397 mini card (which is actually  made by Broadcom).

I tried both the STA and other proprietary wireless drivers that Ubuntu offered me. But none of them would work. Little did I know that the STA driver works fine, it just conflicts with other kernel modules which get loaded before it during boot.

If you are in a similar situation and are close to pulling your hair out, no worries, here is how I got it working:

PRE-STEP: Make sure you have un-installed all proprietary drivers which are related to the wireless hardware in System > Administration > Hardware Driver. (If you have a fresh install of Ubuntu and haven’t been trying to get ndiswrapper etc.. working already none of these should be activated).

If you have previously installed a ndiswrapper driver

If you have installed ndiswrapper and a Windows driver you can un-install this by typing:

$ sudo ndiswrapper -e driver_name_here
$ sudo rm /etc/modprobe.d/ndiswrapper*

Will this work for me?

Open a terminal window (Applications > Accessories > Terminal) and type the following:

$ sudo lspci -nn | grep Broadcom

Enter your password. You should then get a line back describing your Broadcom wireless hardware. Mine looks like this:

$ sudo lspci -nn | grep Broadcom
04:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g [14e4:4315] (rev 01)

If you don’t get anything back, or the line doesn’t describe your wireless card, this tutorial will not work for you. Sorry & best of luck elsewhere! :P

How to get your Dell wireless working in Ubuntu 10.04 (should also work in Linux Mint)

First reboot the machine so you don’t have any pending module changes, then go Applications > Accessories > Terminal. Type the following (ignore the $ at the front, this is to confirm you are typing into the bash shell and not stdin of an app):

$ sudo lsmod

Near the bottom you will probably see a line that starts ssb? If so, your machine thinks ssb and b43 are the correct modules used to control your hardware. These will not work! We now need to disable these. At your Terminal type:

$ sudo gedit /etc/modprobe.d/blacklist-custom.conf

A text editor will appear. Type the following in:

# /etc/modprobe.d/blacklist-custom
blacklist b43
blacklist ssb

Save the file and then close it. These pesky critters can’t be a pain any more as we have just black-listed them from being loaded on boot. Murhaha!

We now need to install the Broadcom STA driver which does work.  Plug an ethernet cable into your computer and go Applications > Administration > Hardware Drivers. You should then be presented with a number of drivers. Activate the Broadcom STA driver and reboot your machine.

You should now have working wifi! :)

Leave the first comment

Calling all VIM, EMACS, NANO, ED, Visual Studios etc.. Geeks! Your Text Editor Needs You!

I’m on the hunt for some text editor gurus to participate in an online video show-down; putting masters of these tools head-to-head to see who performs the best!

On a more serious note..

When I started showing interest in using a “proper” text editor, there was a myriad of flame wars of non-sensical, non-logical arguments which plagued the forums. I understood that using one of these *could* save me time, but there were no videos of amazingly talented people using these editors. I *needed* something to inspire me to spend my time learning it, but I never got it. I just had to take the risk, and now I’m glad I did!

The main aim of the site is to showcase how amazingly useful these tools are, and to inspire more people to use them; under the guise of a competition!

If we can get some sponsors, there might even be prizes for the top-dogs!

Game Rules:

  1. You MUST use a default install (iow. no custom scripts or modifications) of the text editor of your choice
  2. You may use any version of the text editor (vi/vim/gvim/gnu emacs/xemacs/nano/ed/pico etc..), we even welcome users of Notepad, Eclipse, and Visual Studio!!
  3. You may change your text editor at any time, but you may only submit a single entry per challenge
  4. A challenge will be posted on the site, made up of a number of tasks to do to a piece of text; challenges will be vary from general word processing to complex programming tasks
  5. Using a screen recorder (or camcorder), record you performing the challenge
  6. Time starts when the text file is loaded in the editor (eliminating the start-up time of the editor, which could be very hardware dependant)
  7. Upload your video to YouTube and post the URL as a response on our site
  8. Provide a transcript of the shortcuts used to complete the challenge with your URL
  9. Winners will be announced on a real-time leader board
  10. Challenges will remain open indefinitely

Please email me on tom[at]tommed.co.uk if you are interested!

Many Thanks,
tommed

10 comments so far, add yours

How to embed YouTube videos into a Plogger photo gallery

It’s always nice to be able to add videos to your photo gallery. Unfortunately, out of the box, most PHP photo galleries do not support this feature. A while back I used to use Zenphoto and I adapted it so I could embed YouTube videos into a gallery, but Zenphoto didn’t prove very stable and on more than one occasion I simply lost all my photos! :(

I have recently been using Plogger. It’s a great application and the code is pretty straightforward (I understood it and I haven’t written more than 10 lines of PHP in the last 10 years!), so I’d thought I’d document the process of embedding YouTube videos into it.

Caveat: let me just remind you that I am not a PHP developer. The methods I use may not be the fastest or most appropriate and I’m counting on you guys to help me preen the code into a lean piece of logic! Your comments and feedback are always welcome (as long as you’re not trying to sell Viagra!! :) )

  1. First I copied the default theme (you can use any theme as your base theme, but default is the simpliest):

    cp -R /path/to/plogger/plog-content/themes/default \
               /path/to/plogger/plog-content/themes/youtubeenabledtheme

  2. Then I edited the meta.php file inside the theme to give it a name, version, and description which fitted my new theme.
  3. I then opened picture.php and searched for the line: <div id="picture-holder">.Underneath this line (around line 28) is the code to draw the image. We need to wrap this logic so if the description of the image begins with YouTube: we need to embed a video (and hide the description field from the page), otherwise just draw the page as we normally would. My code looks like this:
    <div id="picture-holder">
     <?php $desc = plogger_get_picture_description(); ?>
     <?php if (strlen($desc) > 8 && 0 == substr_compare($desc,"YouTube:",0,8)) : ?>
      <?php $ytcode = substr(plogger_get_picture_description(), 8); ?>
      <a href="http://youtube.com/watch?v=<?php echo $ytcode; ?>" target="_blank">
       <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/<?php echo $ytcode; ?>&hl=en_GB&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/<?php echo $ytcode; ?>&hl=en_GB&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
      </a>
     <?php else : ?>
      <a accesskey="v" href="<?php echo plogger_get_source_picture_url(); ?>">
  4. Now when you have uploaded a video to YouTube, save the thumbnail photo and upload that to plogger. When you are asked for a caption and description; add a caption as usual, but enter YouTube:YTCODE into the description (replacing YTCODE with the code of the YouTube Video)
  5. To get the YouTube code for your video, watch the video in YouTube and copy the address in your browser, something like: http://www.youtube.com/watch?v=a_vJpfDSeCc, the code is the value of the v querystring item. So in this example the value I would put into the description field would be: YouTube:a_vJpfDSeCc

entering the YouTube link into Plogger's admin site

Plogger patched, so it now shows YouTube videos!

Don’t worry about web technology when you can get dishnetwork or hook up directv dvr. Learn the difference between direct tv and dish network and get a dish satellite antenna.
Leave the first comment

How to use Plogger from behind a proxy

Scenario

My main web server is a PPC MacMini running Apache on ArchLinux. The machine is starting to reach it’s limits with the amount of programs and web sites running on it, so I needed to start off-loading some of the sites to another box.

To make these sites available to the outside world, I have chosen to use ReverseProxy (mod_proxy) to proxy the site from the external request onto the new server.

The Problem

Unfortunately, Plogger makes heavy use of $_SERVER['PHP_SELF'], so when you run Plogger through ReverseProxy, you get redirected to an incorrect path and 404s start appearing everywhere.

Solution

  1. Make sure the second server (now known as server2) has a static IP address on your internal network
  2. Open the hosts file in your text editor on the main web server (server1 – the one that is being used as the reverse proxy)
  3. Enter the static IP address of server2 followed by a unique name (recommended servername.external-url-to-plogger.com
  4. Configure Apache on server2 to listen out for this name and provide Plogger as a VirtualHost, then restart the Apache daemon
  5. Open links (or another web browser) on server1 and make sure calling the url you entered into your hosts file correctly loads Plogger
  6. Enter the following configuration into Apache’s config file on server1:
    <VirtualHost *:80>
      ServerName www.external-url-to-plogger.com
      DocumentRoot /srv/http/dummydir
      <Location />
        ProxyPass URL_IN_YOUR_HOSTS_FILE_FOR_SERVER2
        ProxyPassReverse URL_IN_YOUR_HOSTS_FILE_FOR_SERVER2
      </Location>
    </VirtualHost>
  7. Restart Apache on server1
  8. Open /path/to/plogger/plog-includes/plog-functions.php and edit the switch statement near line 1456 to read:
    switch($level) {
            // Admin section for generate_url
            case 'admin':
                    $rv = '/plog-admin/plog-'.$id.'.php?'.substr($args, 5);
                    break;
            // Front end section for generate_url
            case 'collection':
                    $rv = '?level=collection&amp;id='.$id.$args;
                    break;
            case 'album':
                    $rv = '?level=album&amp;id='.$id.$args;
                    break;
            case 'picture':
                    $rv = '?level=picture&amp;id='.$id;
                    break;
            case 'search':
                    $rv = '?level=search'.$args;
                    break;
            case 'collections':
            default:
                    $rv = 'index.php';
                    if ($query != '?' || !empty($args)) {
                            // remove & from the end of $query...
    
                            $query = str_replace('&', '', $query);
                            // remove & from the beginning of $args if no previous query set
                            if ($query == '?') {
                                    $args = substr($args, 5);
                            }
                            // append the $query or $args
                            $rv .= $query.$args;
                    }
                    break;
    }

Now Plogger should work from the internet! Feedback welcome!!

Leave the first comment

How to determine if a particular bit in a binary block is set

I was recently working with the Arduino and an 8×8 LED matrix and attempting to figure out an easy and clean way to convert co-ordinates into matrix positions. I decided that as each LED in the matrix can only have two positions, that I could create an array of 8 binary blocks each with 8 bits.

So if I gave a row the binary data: 01010101, I would see every other LED turned on.

My problem came when I attempted write the code that takes the binary block and figures out which LEDs need to be turned on in the matrix. Back to old-school programming I guess!

The trick is to shift to the correct column and then mask the value using the and-bitwise operator:

The following code is written in ruby to help explain the technique clearly..

binary = 0b010101
columnInterestedIn = 1 /* first column from left to right */
isSwitchedOn = (binary >> columnInterestedIn) & 1 == 1

Simple eh?! The actual C++ code that ended up on the Arduino looks like this:

int bitData = (data[columnIndex] >> rowIndex) & 1);
if (bitData == 1) digitialWrite(rowPins[rowIndex], HIGH);
Leave the first comment

Creating a Twitter client using Google Go

Google Go Logo

Google Go was announced just a few days ago and I’ve been trying to figure out how to write a Twitter client since then (Think of it as the 21st Centry version of Hello World! :P ).

My biggest stumbling block was that currently Google Go was unable to send http requests with an Authorization header using the current http package implementation. After looking through the code I realised that the logic I needed was there, it just wasn’t exposed (as the library is still in early stages of development).

func send(request *Request) (response *Response, err os.Error) { ... }

The function send shown above was just what I needed! So I replaced all occurrences of send with Send (which makes it public) and was able to call it from my own Go code using http.Send(...). Hurray!

The client is now complete and even includes a command line interface. I will hopefully add a web UI later on (probably when the Google Go team have finished implementing cookie handling).

Once built, you can use the command line client like so:

$ # update your status
$ ./twitter-client -u myusername -p mypassword -s "This #GoogleGo #Twitter client created by @tmedhurst is fab!"
$ # check your direct messages
$ ./twitter-client -u myusername -p mypassword -dm
$ # check your main timeline (similar to the home screen on the Twitter web site)
$ ./twitter-client -u myusername -p mypassword -f
$ # show my recent posts
$ ./twitter-client -u myusername -p mypassword -t

go twitter client in action

I will eventually allow you to point to a file (which you can chmod 600 to make secure) which contains your username and password (just like a passwd file) to save you entering this information in each time.

The client is only available for x86/x64 intel macs and x86/x64 intel and arm Linux machines (as that’s all that Google Go supports at the moment). The Windows version will be available when Google Go is made available to Windows. (I’ve tried building it in Cygwin.. but no luck I’m afraid :’( ).

The client/package is available on GitHub here.

It is licensed under GPL so you can do what you like with it as long as you adhere to this license.
If you wish to use this in a commercial platform; commercial licenses can be purchased, please contact me for more details.

Get Code from GitHub...

Donations

If you would like to make a donation to this project, please consider donating £3 or whatever you wish for beer money! Many Thanks!! :)


Leave the first comment

How to Blue Screen windows remotely with Python

A Windows 7 box being blue screened remotely by a python script!

Easily blue screen any Windows Vista, 2008, and 7 box which has SMB allowed through the Firewall (All but Windows 7 have this turned on by default!).

Here is the script:
download bluescreen_windows.py

Leave the first comment

Create a CKEditor v3 Plugin

CKEditor is a fantastic open-source WYSIWYG editor. However, it is unfortunately quite difficult to extend as there is very little documentation ready for CKEditor (the available stuff is for the older version: FCKEditor, which is very different).

But fear not my fellow readers; for I have managed to figure out how to create an iframe-based plugin (perfect if you want to use your old dialog-based fckeditor plugins in ckeditor)!!

The first step is to add your plugin into the toolbar settings. In the example below, my new plugin is called uploader and will be a replacement for the rubbish image uploader that comes with ckeditor:

ckeditor/config.js

CKEDITOR.editorConfig = function( config )
{
	// Define changes to default configuration here. For example:
	// config.language = 'fr';
	// config.uiColor = '#AADC6E';

	config.toolbar = 'MyToolbarSet'

	config.toolbar_MyToolbarSet =
	[
	    ['Cut','Copy','Paste','PasteFromWord','-','SpellChecker'],
	    ['Undo','Redo','-','Find','Replace'],
	    ['NumberedList','BulletedList','Outdent','Indent','Blockquote','RemoveFormat','Source'],
	    ['Link','Unlink'],
	    ['uploader','Table','HorizontalRule','SpecialChar'],
	    '/',
	    ['Bold','Italic','StrikeThrough','-','Subscript','Superscript'],
	    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
	    ['Format','FontSize'],
	    ['FitWindow','ShowBlocks']
	]
};

As you can see, I have placed my ‘uploader’ plugin next to the ‘Table’ button.

The next stage is to create a folder for you plugin. This folder needs to be called the same as the plugin name (in this instance we must call it ‘uploader’). You will then need a file called plugin.js inside this folder and a folder called dialogs, where all your dialog pages go.

For this example we will reference a dialog page called upload.html, which also requries a script file called upload.js. I have also added a PNG icon which will appear on the toolbar as the button to launch my dialog.

ckeditor
    -- dialogs
        -- upload.html
        -- upload.js
    -- images
        -- icon.png
    -- plugin.js

Now to put some content in the plugin.js file in your plugin folder…

plugin.js

CKEDITOR.plugins.add('uploader',{
    requires: ['iframedialog'],
    init:function(a){
        CKEDITOR.dialog.addIframe('upload_dialog', 'Image Uploader','path/to/ckeditor/plugins/uploader/dialogs/upload.html',550,400,function(){/*oniframeload*/})
        var cmd = a.addCommand('uploader', {exec:uploader_onclick})
        cmd.modes={wysiwyg:1,source:1}
        cmd.canUndo=false
        a.ui.addButton('uploader',{ label:'Upload an Image..', command:'uploader', icon:this.path+'images/icon.png' })
    }
})

function uploader_onclick(e)
{
    // run when custom button is clicked
    CKEDITOR.instances.editor1.openDialog('upload_dialog')
}

I guess some explanation is required for this…

There is a plugin called ‘iframedialog’ which does all the difficult(!) work in registering a dialog. We need to reference it to be able to use it (hence the requires:['iframedialog']).

“CKEDITOR.dialog.addIframe” registers an iframe using the plugin ‘iframedialog’ take a the following parameters:

  1. name
  2. window title
  3. url
  4. width
  5. height
  6. on_iframe_loaded callback function

Once you have registered the iframe dialog, you can add a new command which calls a function (uploader_onclick) which then opens the registered iframe. Simple really!!

The only thing you need to do now is to instruct CKEditor to load the plugin.js file from your folder. To do that open the file “ckeditor.js” and do a search for the phrase ‘about,
This should take you to the part of the script which lists all the plugins. Add your plugin name to this comma-separated list and tryout your new plugin! :)

how to create a ckeditor plugin

UPDATE: Handling the OK Button

Many thanks to Lee for extending my tutorial to handle to OK button (something a lot of you have been asking about).

Add the following to the page in the iframe…

var CKEDITOR = window.parent.CKEDITOR;

var okListener = function(ev) {
   this._.editor.insertHtml('<p>Text Here</p>');
   CKEDITOR.dialog.getCurrent().removeListener("ok", okListener);
};

CKEDITOR.dialog.getCurrent().on("ok", okListener);
Plug in your dishnetwork tv and get the dish hd channel list from dish network direct tv for thebest satellite tv experience around!
3 comments so far, add yours

Unix date stamp files using yyyymmdd format

This is more of a personal note, as I only use this occasionally and is not one of those things I generally remember. (may be my head is too full of vim shortcuts to remember this..?)

The following command returns the date in year-month-day format, which is perfect for time-stamping files.

date +%Y%m%d

Example

So say for example you were tar-ing a directory up as part of an automated backup routine. To time stamp the tar file would probably look something like this:

tar cvvf backup-`date +%y%m%d`.tar /path/of/target/directory
Leave the first comment