Hello worldssss

47 days ago

hello world

this is some testing text

Archayl Wizzpunk

Comment

Adding js and css syntax highlighting to page

181 days ago

I’d like to try to add a syntax highlighting feature to this site. I recall some js and css works that do just that. The feature’s purpose is to clarify the information on the site, making codes obvious and easy to digest, pretty to the eyes. Code is not always boring, it might as well be colourful!

As a result of digging around the web, I’ve found a couple of method to do this. I take the simplest and fastest to implement on this site, which is prettify by mikesamuel. This snippet is really simple and easy to use. Just needed some additional lines in the template code.

Download, upload, and link and looks more or less like this in your template HTML head section.

<script type="text/javascript" src="prettify/prettify.js"></script>
<link rel="stylesheet" type="text/css" href="prettify/prettify.css" />

That’s for the linking part. Now on to loading part. Modify your body opening tag so it look like this.

<body onload="prettyPrint()">

Done for the prettify section. On to the next problem.

I dont want to modify my published article just for the sake of adding prettyprint class to each of pre tags. To resolve this problem, I decided to use jQuery. Following the same process like prettify, download, upload, and link. In the head section:

<script type="text/javascript" src="jquery.js"></script>

and add new snippet of code somewhere in the head after the above link statement.

<script type="text/javascript">
    $(document).ready(function() {
        $("pre").addClass("prettyprint");
    });

What that snippet does is append prettyprint class to every pre tags in the current page, enabling prettify to capture and prettify them. All this without changing the source data.

Nice and easy, thanks prettify and jQuery developers!

Archayl Wizzpunk

Web design, Web development

Comment

Digging command history in BASH

184 days ago

I’ve been checking my server for the status of wget that I’ve left running. To my surprise, it was halted. Frustrated by the long url which I’ve entered previously, I go for some bash magic research.

I found out that bash has a neat feature which allows us to retrieve what’s been entered previously, and not just by pressing the up arrow on the keyboard. It can be done in multiple ways, but I prefer the generic one which utilizes grep command.

In my case, to find previous wget command entry line:

history | grep -i "wget"

Nice and simple. The -i following the grep is for case insensitive search. This command will results in a list of command history. Pick the number of history that we are interested in which is on the leftmost column, and append it to a !, like so:

!1999

There you go, the command will be executed instantly! Congrats.

If it happens that you want to get the command and modify it, append :p to the recall line

!1999:p

press Enter and press up arrow. Neat.

Archayl Wizzpunk

Admin, Ubuntu

Comment

Syncing Nokia C6 with Banshee

185 days ago

Banshee is default player for Ubuntu 11.04. This neat player have the sync feature intended for use with media devices. My Nokia C6 doesn’t appear on the sidebar of banshee. It makes me wonder why would my phone doesn’t recognized as media device. Off to search I go…

After some searching, it appears that there is a way to make storage device appears as a media device to Banshee. The only thing that needed to be done is simply creating a new file named .is_audio_player in the root folder of the device with the some definition inside such as this.

name="Nokia C6"
audio_folders=Sounds/Digital/
output_formats=audio/mpeg,audio/aac,audio/x-ms-wma

The name parameter will appear in Banshee device name, put it anything you like. Name with space will have to be in double quotes.

audio_folder is the path on the device which stores audio files.

The last one is the definition of the output formats that your device supports which on my Nokia C6 are MP3, AAC and MP3.

There are other parameters that can be defined, but those that I don’t need. You can find it at the HAL documentation page.

To complete the requirement of transcoding to some proprietary formats, proceed with the installation of package gstreamer0.10-plugins-bad-multiverse which can be found in the repository (provided that you enable the multiverse repository).

That’s it. Now I can manage my music on the device with Banshee… with ease.

Archayl Wizzpunk

Media, Ubuntu

Comment