June 29, 2008

4

Some Photos from my office's Desktop

It is Sunday, and I'm checking my old photos... And then, I found my office's desktop photos. You may want to see them. Sometimes, my desk is clean but sometimes, it get horribly messy... This is the average looks of it.


The Serial Data LoggerWhat I see every day
The Rain Gauge PCBMy TableMy Old Circuit Board DesignThe new TS-7260My DesktopThe SBC, PCB and The Black BoxSBC serial /dev/ttyAM1Power Supply And Serial /dev/ttyAM0The TS-ARMTS-7260, Data Logger and GPRS Modem
TS-7260 and Data LoggerRain Gauge Data Logging


Working on these Wireless Rain Gauge development have build up my skills in linux bash programming and I learn a lot on how Single Board computer works. In the beginning, we just create a daughter board and attach it to a hacked LinkSYS WRT45GS board which I've installed OpenWRT so I can embed my bash script inside. But then, we go for TS-7260 board from embeddedarm.com to get more control on the RainGause for version two.

Till now, I'm still upgrading the code for more features and stability. Well, that's all for now. Enjoy what you're doing!!

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy




June 26, 2008

23

Fixing Read More link appear on Blogger Fullpost

Thanks to Paul Escolar who really use my code on 'How to create expandable post summaries in Blogger' and spot a bug on that tutorial.

Hence my code for this blog is already changed for other additional stuff. Sorry for that silly mistakes . As I went to debug my tutorial, I found that whoever follow that tutorial properly will get the same result as Paul's blog. So, here is the explanation and how to fix it.

Please check at the last chunk of code on 'Step #1 - Edit your template code'. The old code should look like this:


<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;more&quot;'>
<a expr:href='data:post.url'>...<b>Read more</b></a>
</b:if>
</b:loop>
</b:if>



where the previous screenshot is this:



What this code do is checking the 'more' label and put that 'Read More' link at the end of your post, regardless you are in fullpost or not. So, to wipe it out when we are in fullpost, you just have to add this two lines of code, before and after that code chunk:


<b:if cond='data:blog.pageType != &quot;item&quot;'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;more&quot;'>
<a expr:href='data:post.url'>...<b>Read more</b></a>
</b:if>
</b:loop>
</b:if>

</b:if>



In blogger layout code, the fullpost page type is called 'item'. So, this 'if statement' is added to check that we are not in 'item' post and only do loop through the labels and add the Read More links then.

That's it, you may save your template now and see the difference. Good Luck!!





Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

June 12, 2008

65

How to create expandable post summaries in Blogger

I've been tweaking my blog template because I've already bored with my old default template that I use previously. While working on this template, I'm thinking that it may be cool to have my long post to be truncated and have the "read more" link.

I found the code from Blogger Help to do this. However, there is one issue with their code where the "read more" link will appear regardless of whether a post has been truncated or not. You can check it out at help.blogger.com on How can I create expandable post summaries?. If you have already read them, you should notice the disadvantages under the Note list which says:

  • Disadvantages: Requires changes to the posts themselves, rather than to the template only. However, the "read more" link is in the template, so it will appear regardless of whether a post has been truncated or not. (Modifying this feature is left as an exercise for the reader.)

Do you think it is a good exercise? So, how many of you have already solve this exercise? I've been browsing through pages of google results and found that currently, I didn't see anybody solve and publish the answer for this exercise with just the blogger layout code and without using other javascript code. I do the search because I'm a lazy coder where I don't wanna spend my precious time to reinvent the wheel. Anyway, after a few minutes of thinking, I got an idea on how to solve this problem. And as usual, I'm happy to share my solution with you.

Let's make it short now, here's the tutorial:

How can I create expandable post summaries that only show the "read more" link if post is truncated?
With this hack, you can choose to display a select amount of text from the beginning of each post as a teaser instead of showing the entire post on the front page of your blog. Then when people want to read the rest of the post, they can click a “read more” link to see the full post. This is very handy if you have lots of long articles all on one page. (Note that you’ll need to have post pages enabled in order to make this feature work.)

Step #1 - Edit your template code
To edit your template code, you have to go to your Layout > Edit HTML tab. Tick the Expand Widget Templates to have all the codes.



It is easier to copy all code and paste it to your text editor. To copy all code, click on the code area once and then press Ctrl+A to Select All. Press Ctrl+C to copy the selected codes, open your text editor and paste it in. Now you have your code ready to edit.

Add this code just before the <b:skin> tag on your template code:


<style>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
span.fullpost {display:inline;}
<b:else/>
span.fullpost {display:none;}
</b:if>
</style>



Here's how it should look. The yellow box in the image below shows your newly added code:



And then you have to find <data:post.body/> tag using Ctrl+F or find function in your text editor and paste this code just before the </p> tag, right after the <data:post.body/> tag:


<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == &quot;more&quot;'>
<a expr:href='data:post.url'>...<b>Read more</b></a>
</b:if>
</b:loop>
</b:if>



And the screenshot. The yellow box shows your newly added code:



My solution here is by checking the label whether it have "more" label. So, in every post that you decided to have the "read more" link, you have to add this label. I'm adding a loop to read the labels for each post and inside the loop, there is an IF statement to check whether it have the "more" label.

You should notice this line with:
<b:if cond='data:label.name == &quot;more&quot;'>
where the word 'more' in bold here is the label name. You can substitute this with any word you like but make sure you will only add that label to the post where you want to have the "read more" link.

And now, you can differentiate the truncated post. After verifying your code, copy it from your text editor and overwrite your HTML template code. Click on Save Template and you are done with the first step. Check your code carefully if Blogger fail to save it. Maybe you have missed any '<' or '>' in your code.

UPDATE!!: Please Read - Fixing Read More link appear on Blogger Fullpost

Step #2 - Add Class Tag in your default Post Template
The next step is optional to keep the class tag handy on every post you would like to have expandable post summaries. To add this, you can just go to Settings > Formatting tab on your blog settings. Scroll to the bottom and you will see the Post Template option. Then, put this code:


<span class="fullpost">

</span>



Here's the screenshot:



After that, click on Save Settings and you are done.

Step #3 - Creating your expandable post
You can now follow the same way like in the blogger help to create your expandable post. When writing your new post, anything you put above the <span class=”fullpost”> tag will be the teaser text. The main body of your post needs to go in between the <span class=”fullpost”> and </span> tags. When you have finish typing your post, make sure you add "more" label in order for the “read more” link to work properly.



Now, you can Publish your post, and see the result. Have fun blogging!!! Don't forget to subscribe my RSS Feed for more coding tricks. Feel free to link my blog on yours too... Heheh.





...Read more

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy




June 10, 2008

1

How to Install .rpm packages in Ubuntu

Ubuntu normally use .deb package for application installer. However, if you have an rpm file for a package you wish to install, and if you cannot find a .deb debian package in any of the Ubuntu repositories or elsewhere, you can use the alien package converter application to install the .rpm file.

Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. If you want to use a package from another distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it.

Despite the large version number, alien is still (and will probably always be) rather experimental software. It has been used by many people for many years, but there are still many bugs and limitations.

Alien should not be used to replace important system packages, like sysvinit, shared libraries, or other things that are essential for the functioning of your system. Many of these packages are set up differently by Debian and Red Hat, and packages from the different distributions cannot be used interchangably. In general, if you can’t uninstall the package without breaking your system, don’t try to replace it with an alien version.

How to Install RPM Files Using Alien

Installing Alien


The alien can be installed from the Ubuntu Universe repository by adding the repository to your list of sources and issuing this commands:
$ sudo apt-get update
$ sudo apt-get install alien


Installing the .rpm file


To install the .rpm file, you have to convert it first to a .deb file which then can be installed on Ubuntu.
Assuming that you downloaded the package to your Desktop (~/Desktop is the directory)
You can convert the .rpm to a .deb by using the following commands:

$ cd ~/Desktop
-This will change the directory to your desktop, where you have the .rpm file.

$ sudo alien -k name-of-rpm-file.rpm
- This will convert the .rpm to a .deb.
- The “-k” will keep the version number. Otherwise alien adds a “1″ to the version number.

$ sudo dpkg -i name-of-deb-file.deb
- This will install the .deb package

Feel free to read the alien manpage for more details on how you can convert other kinds of packages and the options available.

That's all for now, Good Luck!!
via [ubuntu.wordpress]

...Read more

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

June 5, 2008

1

Bash Scripting - Script execution counter

This Linux shell script does nothing than just increasing n value every time it is executed and then keep the value in a file. When the value goes greater than 10, it will drop back to 1. Uhhh... this reminds me to the increasing of the fuel price. But that fuel price will just increase and will never drop back... Lol... Anyway, I wrote this bash script just to make a permanent variable to be used as bash script running counter. With this code, I can count how many time the script have been executed.

Here's the code:

#!/bin/sh

nfilename="./nvalue"

n=0
touch $nfilename
. $nfilename

echo "current n value is $n"

n=$(expr $n + 1)

if [ $n -gt 10 ]; then
n=1
fi

echo "new n value is $n"

echo "n=$n" > $nfilename

Here's the step for testing the script for newbies bash scripter.

1. Create one text file in your home folder. In this example I'm using ncounter as the file name:
apogee@apogee-persiasys:~ gedit ncounter

2. Copy and paste the codes in this file, then save and close it.

3. Change the file permission to executable:
apogee@apogee-persiasys:~ chmod +x ncounter

4. Then you can test it... here's my output example:
apogee@apogee-persiasys:~$ ./ncounter 
current n value is 0
new n value is 1
apogee@apogee-persiasys:~$ ./ncounter
current n value is 1
new n value is 2
apogee@apogee-persiasys:~$ ./ncounter
current n value is 2
new n value is 3
apogee@apogee-persiasys:~$ ./ncounter
current n value is 3
new n value is 4
apogee@apogee-persiasys:~$

Feel free to experiment and change the ./nvalue file location to somewhere else where you have read and write permission. This is just another linux shell script that I haven't used yet... heheh

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy




June 3, 2008

0

PC in a Keyboard

Have you ever wished of having a desktop where your super slim LCD monitor attached to just a keyboard? And nothing else?


If you did, it is worth to have a look at this space saving desktop computer from Cybernet, the Computer in a Keyboard. This company has shrunk the CPU behind a regular sized keyboard and it comes complete with an Intel Core 2 Quad chip, DVD drive, hard disk drive, up to 4GB RAM, a touchpad, memory card slots and standard USB ports.

Even thou it makes the keyboard bulky, it can be a small tradeoff for all the space saving that the PC achieves. You can plug your standard monitor or even your LCD monitors into this Computer in Keyboard. Isn't that great?



As far as I know, the PC in keyboard is fully customizable and will cost around $700 to $1100. Enjoy!! ...Read more

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

June 2, 2008

0

Howto Create .ISO images from CD or DVD in Linux

In Linux computer, we have a simple tool to create CD or DVD .ISO file. This is very helpfull to backup your CD and DVD into ISO images:

To make an ISO from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it.





for dvd:

$ dd if=/dev/dvd of=mydvd.iso

for cdrom:
$ dd if=/dev/cdrom of=mycd.iso

for scsi cdrom:
$ dd if=/dev/scd0 of=mycd.iso


And if you wanna make an ISO from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command.

mkisofs -o /tmp/mycd.iso /tmp/directory/


This results in a file called cd.iso in folder /tmp which contains all the files and directories in /tmp/directory/.

For more info, see the man pages for mkisofs, losetup, and dd, or see the CD-Writing-HOWTO at http://www.tldp.org. Enjoy Linux!!

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy