Spiga
Showing posts with label Hacks. Show all posts
Showing posts with label Hacks. Show all posts

Git and FedoraPeople.org

I just started learning to use git a few days ago. Mainly because of the convenient of being able to host a git repository on a dumb http server, and ability to local commit.

However, I had a minor problem pushing a git repository to my fedorapeople.org account through ssh push. "Permission denied when executing post-update hook". Asking at #fedora-admin got me this answer - "home folders are mounted noexec", now, thats explains. Nonetheless, a minor hack by replacing the post-update script with a symlink to git-update-server-info seems to get around it.

Surprisingly, when I woke up today, I saw Jeremy Katz's post : More git support for fedorapeople. FedoraPeople now have a functional GitWeb and gitserve! - eventhough its beta and might go away, still, thanks a lot Jeremy!!.

P/S: OneClickInstall is a misleading name, renamed my python parser for OneClickInstall metadata from yum-oneclickinstall to Chitin (Dead insects trapped in Amber might leave some trace of Chitin after its organic structure disappeared - source). With this new git support in fedorapeople, I moved the code from my play-around-googlecode-svn to this shiny new home at fedorapeople gitweb. Checkout using :

git clone git://fedorapeople.org/~izhar/chitin.git
# or
git clone http://izhar.fedorapeople.org/git/chitin.git
.

OneClickInstall for Yum

Spent the whole day today learning Python ElementTree. And the product, a yum plugin for parsing OpenSuSE's One Click Install metadata, though, its still quite incomplete.

I've always wanted something like OCI, and I've been using RPM MetaPackages for most of my previous use. However, MetaPackages have some limitations, one of which it might conflict with existing RPMs, and if I use a lot of metapackages, I'll end up with a rpm database filled with them and each of them must have a unique name. That is good enough for sysadmins, but it can be a hassle for the so-called 'users' in the long term.

OpenSuSE's implementation looks more suitable for me, so, after waiting for quite some time for someone to implement it on fedora (and nobody has - or I didn't notice it), I decided to jump and write my own. However, the implementation on OpenSuSE is only for YaST (which I guess it beats the purpose of having the XML format multi-distro), so, I need to write my own parser.

I have experience writing yum plugins for adding features into yum for specific purposes, so what I needed is to figure out how to extract data from the XML file and install them. Gladly, ElementTree serve that purpose very well. Python Rocks!!.

For those interested to try it out, the code is here - http://kagesenshi-private.googlecode.com/svn/trunk/yum-oneclickinstall/. It works ok through command line, though for GUI, I guess it'll need some work.

To use, first, install it as you would to install any yum plugin (I won't help here, coz I don't want any 'users' to use it at this moment). Get a OneClickInstall XML file, theres an example in the code folder or write your own (OpenSuSE specification is good) and run:

# to install packages
yum oci-install oneclickinstallxmlfile

# to query metadata for packages
yum oci-query packages oneclickinstallxmlfile

# to query metadata for details
yum oci-query details oneclickinstallxmlfile

# to query metadata for repositories
yum oci-query repositories oneclickinstallxmlfile


(Of course, thats nowhere near being One-click)

Installing packages kindof works, but I'm still working on the ability to install 3rd party repository (the code is there, just need to think of some way to make it safe). Adding 3rd party repo feature is controversially not safe, as mixing repositories might make user end up with dependencies and compatibility problems. So, need to think of a good way to handle that.

Anyway, happy trying it. :D

Exporting Plone3.0 Memberdata and Passwords

I need to export plone accounts from Inigo Intranet to LDAP. To accomplish that, first I need some way to export the data I need. Plone itself does not have such tool for it (that I know of).

Not so long ago, Kaeru pointed me to a zope script for such purpose, however, the script fails to extract passwords from Plone3.0 mainly due to passwords are now managed by the PluggableAuthService - which made getPassword() to return None and _getPassword() to raise NotImplementedError. I don't know whether somebody forgot to implement those functions into PAS or it was purposely done. Googling lead me to this page in plone.org and from there, to this other script. Again, none of them able to extract the password hashes. I lost hope with google, and to the source I went.

After a whole night digging through the plone source, at last, I managed to found the method to extract the hash. So, heres the External Script which I wrote to extract stuff I want.


# Memberdata export script for Plone 3.0
#
# based on:
# http://transcyberia.info/archives/23-howto-sync-mailman-from-plone.html
# http://www.zopelabs.com/cookbook/1140753093
# http://plone.org/documentation/how-to/export-member-data-to-csv
#
# desc:
# None of the scripts above can extract password hashes on Plone3.0,
# BUT THIS ONE CAN!!!
#
# Execute this as normal External Script, and DON'T make it public accessible
# (unless you don't mind people having your hashes). You have been warned.
# Have fun (^,^)
#


from StringIO import StringIO
import csv
import time

def getMembersCSV(self):

request = self.REQUEST
text = StringIO()
writer = csv.writer(text)

# core properties (username/password)
core_properties = ['member_id','password']

# extra portal_memberdata properties
extra_properties = ['fullname',
'email',
'location',
'home_page',
'description']

properties = core_properties + extra_properties

writer.writerow(properties)

membership=self.portal_membership
passwdlist=self.acl_users.source_users._user_passwords

for memberId in membership.listMemberIds():
row = []
for property in properties:
if property == 'member_id':
row.append(memberId)
elif property == 'password':
row.append(passwdlist[memberId])
else:
member = membership.getMemberById(memberId)
row.append(member.getProperty(property))

writer.writerow(row)


request.RESPONSE.setHeader('Content-Type','application/csv')
request.RESPONSE.setHeader('Content-Length',len(text.getvalue()))
request.RESPONSE.setHeader('Content-Disposition',
'inline;filename=members-%s.csv' %
time.strftime("%Y%m%d-%H%M%S",time.localtime()))

return text.getvalue()


Have fun (^.^)

Prism 0.9.0 Static RPM SPEC

Call me impatient of whatever. I've been wanting to use Mozilla Prism. It is not yet packaged in Fedora so I tried my luck to package it properly for Fedora. However, I totally have no idea how Mozilla buildsystem work and how to compile Prism's trunk on Fedora. Trying to follow the Creating XULRunner Apps with the Mozilla Build System lead me nowhere. I got stuck trying to find what package provide the buildsystem and the "client.mk" file, but I given up due to I totally have no clue. In the end, I ended up packaging the official binary tarball released by upstream and make it installed in /opt.

Here is the specfile for those interested to use prism on Fedora: http://izhar.fedorapeople.org/static-specs/prism_static.spec

Like the Static OSS Skype SPEC I made before, just download the corresponding source and invoke rpmbuild with the spec. For those who are not familiar with rpmbuild, the shell commands below will help you


# as root
yum install rpmdevtools

# as user
rpmdev-setuptree
cd ~/rpmbuild/SPEC
wget http://izhar.fedorapeople.org/static-specs/prism_static.spec
spectool -R -g -A prism_static.spec
rpmbuild -bb prism_static.spec

# ... wait ... wait ... wait
# grab the generated RPM
# rpm -ivh (the generated rpm)
# enjoy~

A little hack to get a working Skype RPM with less painful PulseAudio support

This is almost a very old news I presume, nonetheless, I just noticed it today while wasting my time jumping to random Open Source project sites.

It is well known that skype and pulseaudio doesn't play well together. Skype's ALSA implementation doesn't really implement all of the standard ALSA API which caused alsa-plugins-pulse to not work with skype. Fortunately, as stated in PulseAudio Perfect Setup page, the skype static OSS (Open Sound System - another sound standard, different than ALSA) package can be used to work around this issue through padsp.

However, the skype_static-oss package come in a tarball, of which, is ugly/inconvenient to certain people (like me). So, I've hacked together a spec to repackage that binary blob and make Skype almost JustWorks for Fedora. I don't know what Skype's regulation for redistribution of their binaries, so, to be safe, I can only provide you the RPM spec file.

Here is the spec file : skype_static-oss.spec.

Just put the skype_static-oss tarball in your rpmbuild SOURCES directory, and invoke rpmbuild -bb with the spec file. Install the generated rpm and use it as you would normally.

For those who are not familiar with rpmbuild, heres a little script to get you going


# as root
yum install rpmdevtools

# as user
rpmdev-setuptree
cd ~/rpmbuild/SPEC
wget http://izhar.fedorapeople.org/misc/skype_static-oss.spec
spectool -R -g -A skype_static-oss.spec
rpmbuild -bb skype_static-oss.spec

# ... wait ... wait ... wait
# grab the generated RPM
# rpm -ivh (the generated rpm)
# enjoy~



Oh btw, the spec is under WTFPL. Just do wtf you want with it.

12 YUM Tips and Tricks

YUM Update Manager is the default package manager used in Fedora and Fedora derivatives. It is written in Python and have tonnes of features which average Joe might not know about. These additional features helps a lot on maintaining your system, improving your experience using the package manager and become more productive. Granted, yum depsolving and querying is quite slow compared with APT, but the flexibility and power yum grant to its users, its worth it.

To my comrade, Surface, here, as you requested.

Tips 1: Fastest Mirror

This is usually the very first yum plugin I install in a new Fedora deployment. What does it do?, well, the name tell it all. The plugin will time all the servers in the replied mirrorlist from mirrors.fedoraproject.org, and pick the one which is the fastest for you. Everything is done automagically, and considering its a YumCore class of plugin, it works with whatever GUI you use for yum.

To install this plugin, use

yum install yum-fastestmirror

Unlike APT which you had to pick the fastest mirror yourself, yum handles this more elegantly

The plugin, after it has checked which server is the fastest, it will store a metadata in /var/cache/yum/timedhosts.txt . That metadata will expire after some time. However, if somehow, the cached timedhosts are no longer fast, you can easily force yum to recheck for fastestmirror by deleting that file.

Tips 2. Security Only Update

This tips helps a lot for users who can't keep up with Fedora updates. Fedora is well known for its very fast updating "updates" repository. Things get old quite fast in Fedora. Some people however, are afraid of updating their system to the latest updates packages, mainly because sometimes, these updates, suddenly break stuff as Fedora updates are not backport of fixes but rather moving forward to a newer version. One way to get around this overly sized and numbered updates is by only updating the system with security updates. Theres a plugin for yum for this purpose, and you can install it through

yum install yum-security

To use this plugin to update your computer to the latest security fixes, just use

yum --security update

I have a detailed post about this plugin here

Tips 3: Presto

If you are on a budget internet connection with very limited bandwidth, yum-presto is for you. The presto plugin will download deltarpms, which are the changes of the current version installed in your computer and the one on the internet. This will drastically reduce your download size and you can get your updates faster.

Work is being done to integrate Presto to Fedora's base repositories, however, the developers are still facing problem trying to integrate Presto with Koji and Bodhi, the buildsystem and the updates pushing system of Fedora. Therefore you will need to configure Presto after installation by following the details at http://fedorahosted.org/presto/

To install this plugin, use:

yum install yum-presto

Tips 4: Do NOT Mix Repositories!

Mixing repositories .. is BAD. There are a lot of repositories out there for you to choose from if you google enough. However, these repositories doesn't necessarily compatible with Fedora base repositories or between each other. I would only recommend users to install only Livna and small repositories which provide a small number of packages like Adobe Linux flash repository or Google's Apps repositories. Livna is the best because of their packages follow closely with Fedora's Packaging Guideline, so, you can expect that their quality of packages are as good as the real thing.

Good news that Livna, Freshrpms and Dribble are merging to form RPMFusion. Until RPMFusion is launched, just stick with Livna.

Tips 5: Broken dependencies? Skip them

Once you start installing 3rd party repositories, broken dependencies is a risk you will need to take on. This usually happens when the base repository and the 3rd party repository's packages are not in sync with each other. There is a yum plugin to help you automatically skip these broken dependencies together with packages which are affected by it. Its called yum-skipbroken. In rawhide F9, skip-broken have been merged with the core yum. I am not sure about F8.

To use it, just use the --skip-broken option parameter on the command line.

yum --skip-broken update

If the option is not available for your Fedora installation, try installing the plugin through

yum install yum-skipbroken

Tips 6: Using proprietary drivers? lock your Xorg and Kernel version!

This plugin is very useful for users who are using proprietary drivers or kernel modules and would like certain packages to remain as it is to avoid breaking the drivers. I found this useful when I installed Fedora in a friend's computer and he/she needed to use a proprietary driver. I would lock his/her kernel and xorg from upgrading (yes, somehow this approach feels ugly, but it helps preventing them away from updating things which might break the driver)

To install, use:

yum install yum-versionlock

Documentation on how to use it is available in /usr/share/doc/yum-versionlock-%{version}/README

Tips 7: Keep the cache for future use

Yum by default does not keep it cached downloads. You can change this behaviour through editing the yum config and change keepcache=1.

The yum cache directory, /var/cache/yum can be useful if you are going to play around a lot to the point that you might need to reinstall you Fedora installation frequently. It helps saving some time to redownload all those packages all over again. Just copy the rpm packages in that directory out, and you can reuse it later. You can also create a repository out of it using createrepo.

Tips 8: For organizations, create local mirrors!

It easy to create local mirrors for YUM repositories. There are several way of doing it - Rsync, or reposync (provided by yum-utils package). In normal situation I would recommend using rsync, but for poor me who in a college that blocks rsync, I uses reposync. Reposync downloads through http, but a bit harder to use to setup a usable repository.

A documentation on how to start contributing as a mirror is available here: http://fedoraproject.org/wiki/Infrastructure/Mirroring.

After you've get your mirror synced, get yourself a Fedora Account, and register yourself with Fedora's MirrorManager. The beauty here is, from the MirrorManager, you can set, for example, any requests for mirrorlist from your organization's public IP, will be replied with the URL to the mirror in your LAN IP. Your users won't know that they are using a LAN mirror! It JustWorks!. This is something APT won't give you :P. You can also set your mirrors to be available to certain range of IP/countries or not.

Tips 9: Detect problems early. Use package-cleanup

Sometimes, you might get your installation interrupted or some crazy happening which your installed package database goes crazy with duplicate packages or broken dependencies. There is one tool which helps a lot in tracing the problem and its called package-cleanup. This tool is provided by the yum-utils package, so to acquire it,

yum install yum-utils

Several common commands I usually use:

package-cleanup --dupes # list out duplicates
package-cleanup --cleandupes # clean up duplicates
package-cleanup --problems # list out packages with broken dependencies


More options? .. invoke the --help parameter

Tips 10: Download packages for usage later, together with dependencies

Sometime, you might want to download packages with its dependencies but without installing it and you want to have it easily copyable to another computer with exactly the same installed package list with your computer. yumdownloader (provided by yum-utils package) tool is great for this. You can use it to, for example, build reusable packs for a bunch of identical computers, and distribute them. You can also use it for grabbing the source rpm of a package, just in case you want to hack some stuff from the package.

My usual use of yumdownloader:


# download source package
yumdownloader --source packagename

# download a package, together with
# dependencies needed on my computer
yumdownloader --resolve packagename

# download a package, together with
# dependencies needed on a different
# chroot/mounted Fedora install
yumdownloader --resolve packagename --root /path/to/chroot


Theres another trick of using the yumdownloader with chroot, by copying /var/lib/rpm folder, you can make use of the rpm profile to download packages for a friend's computer and pass it in a CD. This concept is what being used in opyum (a similar tool like APTonCD) to build what debarashi call as YumPacks. Opyum is cool, but somehow I feel creating the set manually is more comfortable for me. Telling a user to pass me the /var/lib/rpm folder is much easier and quicker rather than telling them to install opyum and guide them through how to create a profile. Though, that is my personal preference, opyum is still a great tool to use for "users" who don't know how to mess with the CLI tricks.

Tips 11: Clean caches first if somehow yum behave weirdly

Sometimes the files cached in your computer might be broken because of some reason or another (I usually getting this problem in my university, with my hackish Fedora repository mirror - so, the metadata tend to be a crazy broken metadata once in a while). Try cleaning the cache first and retry. Chances are the problem is from there. To clean whatever cached files in your yum cache, use:

yum clean all

Tips 12: When yum fails miserably for everything, fear not, APT and Smart are there to save the day

Fedora have APT too!!!. Those from debian roots who can't seem to get away from APT, just install apt-rpm. You'll get your familiar package manager again~ :D. Another available package manager for Fedora is smart.

One beauty about apt-rpm and smart on Fedora, they all uses the generic repository metadata similar to yum. That means, all yum repositories will work with apt-rpm and smart effortlessly!. Nice eh?. hehe

EOTipsList

Thats all the tips that I can recall during the writing of this post. I might have other tricks behind my head somewhere, but could not recall it at this moment. The only next time I might remember it is when I faced a problem which made me recalled it.

Enjoy with yum. Its a fun, yummy package manager once you get the hang of it. A final tips, not useful for "users", but useful for python hackers, Yum plugins are easy to write, and it can make use any python libraries. If you need a particular special-case feature for your own use, you can get more information how to write your own custom plugin here: http://wiki.linux.duke.edu/WritingYumPlugins. I myself wrote one hackish plugin for people in my university to get to my repository. My university network layout and restrictions sucks bigtime, so, I had to write something to automatically create a tunnel to my repository and let users yum through the tunnel - seamlessly. The users doesn't even need to learn how to tunnel, it JustWorks.

Have Fun~ :D

Hacks: find_changed_rpms.py

Sometimes, we might be facing certain problems which we could not find what might have caused it. One of the annoying cause is a broken file somewhere in the filesystem due to some reason.

My practise, is that I regularly run rpm -Va to verify and list out broken or changed files. Then I would reinstall any rpm which I think have broken files. Now that I'm working, and being on rawhide, its rather tedious and time consuming to do this regularly. So I just wrote a python script for helping out with the extracting changed files list and querying which rpm the file belongs to.

Those who interested to use it, you can grab it here: find_changed_rpms.py


Usage: ./find_changed_rpms.py [OPTIONS]

This script will automatically find for packages which
one or more of its files does not match the information
stored in the RPMdb.

-h : show this menu
-v : be verbose

This script excludes packages which only have its config files
changed and packages which its files only does not match the
stored mtime.


NOTE: Its not bugproof!.

If anybody out there have some cool hacks related to Fedora. How about start sharing them now and help Greg build his Fedora weekend hacks catalog.

Tee'ing Python subprocess.Popen output

A little hack for python coders out there who wanted to have a functionality similar to the unix's tee command for redirecting output to multiple places.


import sys
from subprocess import Popen,PIPE
p = Popen(['put','command','and','arguments','here'],stdout=PIPE)

while True:
o = p.stdout.readline()
if o == '' and p.poll() != None: break
# the 'o' variable stores a line from the command's stdout
# do anything u wish with the 'o' variable here
# this loop will break once theres a blank output
# from stdout and the subprocess have ended

HOWTO: Controlling cpu temperature and scaling using cpuspeed

My beloved R51 which I bought almost 3 years ago is suffering of old-age. It processor heats up quite fast to 80/85 Celsius and sometimes triggered shutdown alarm on 90C. The temperature during idle is around 50C, which is pretty hot. Adding external fan and overriding the speed of the internal fan doesn't help much.

Whenever it goes to 80C, I manually scale down the processor to cool it down. Hassle, but at least it works. However, there is an easier way to control this without any manual interaction, and that is through using the cpuspeed daemon. It should have been installed by default in your computer. If it isn't , you can install it through:

yum install cpuspeed

cpuspeed in Fedora by default only turns on the default scaling governor and didn't do anything else. You will need to configure it through /etc/sysconfig/cpuspeed.

Remember to set the Governor to "userspace" or your cpuspeed will not be started through the init script.

In my setup to ensure that I don't burn my processor too much, I set my UP_THRESHOLD=99 DOWN_THRESHOLD=90, and uncommented the lowest line for the temperature check and set the max temperature as 75. Yes, theres no scientific explanation to explain whether the values I selected is good or not. I simply set in so that my processor will only scale up if its being used 100%, scales down as soon as the processor usage reduce to 90%, and forbid scaling up if the temperature is above 75C.

Once you have configured it, restart cpuspeed

/sbin/service cpuspeed restart

After I applied those above, my processor doesn't gets hot easily anymore :D. Yay~.

Automated tar and dump incremental backup script for FBSD

The recent gmirror failure on Gambit caused us to switch to automated dump and tar instead.

Our requirement was like this: Full backup on Mondays (around 3-5am) with daily incremental backups relative to the Monday backup. Whenever a full backup is being performed, the previous backups must not be overwritten until the full backup is done.

And the results::

inigo-tarball-backups.sh - an incremental tar backup script using FreeBSD's Tar

inigo-disk-dumps.sh - an incremental live dump script using FreeBSD's Dump - now, I wish Linux's Dump have live dump support.

gnu-tar-incremental-backup.sh - an incremental tar backup script using GNU's Tar - I wrote this before the FreeBSD's Tar script on my Fedora laptop, but was surprised that FreeBSD's Tar doesn't have --listed-incremental option (-_-)".


For the scheduling, I just use cron.

Do inform me if you have suggestions to improve the scripts or if you found any risky bug it in.

update: Anybody knows how to properly tar a live directory? (eg: /var/log/).

HOWTO: Making VIM in FreeBSD, Linux-user friendly

The hellish semester have ended, and I just started my 8 month internship with Inigo-Tech. I've also got an access to the company's FreeBSD server. However, one thing annoys me - the VIM acts in a way i'm not familiar with.

A quick hack to resolve this annoyance.

from the linux box
scp /etc/vimrc server.host.com:/path/to/homefolder/.vimrc

done~

Running X applications headless using Xvfb

Sometimes, you might want to run certain X applications as a daemon in the background. For example, in my case, I want to make Ktorrent run in the background on startup while I control the torrents using its WebUI. However, to run Ktorrent , I must have X running and logged in to the desktop. So, how can I do this? , the answer is by using X Virtual Framebuffer Server.

How it works?

Xvfb emulates an X server without outputing it to monitor. Applications connect to it and run under the impression the GUI is there. Its as simple as that!. No modification needed on the applications that going to be run on it.

Read more : http://en.wikipedia.org/wiki/Xvfb

How to do it?

First, make sure you have Xvfb installed. If you dont, install it using your package manager.
In Fedora, use

yum install xorg-x11-server-Xvfb


Then, run Xvfb in any unique/unused display number, in this example, I put 100. Disable access control to the display so that you dont have to go through the hassle of setting access control for it.
Xvfb :100 -ac


Now that you got Xvfb up and running, time to start the app.

Before starting the app, export the DISPLAY environment variable to point to display number 100
export DISPLAY=:100.0


execute the command for the app, and ure good to go :D
ktorrent


Enjoy~

yum-keep-retry plugin

This is my first try to write something useful using python .. so, please tell me if something not right with this plugin ..

Functionality
This plugin add a retry download functionality to yum when download errors happen. Those that got a fast and stable internet seldom get download timeout/checksum/no more mirrors error, but theres a lot of ppl in 3rd world n developing countries have slow/unstable internet and timeouts sometimes occurs too frequently. I wrote this plugin to make yum retry downloading for a few more times before die.

keep-retry.py

JDK 6 RPM messed up with zip mimetype

I installed JDK 6 RPM from Sun's Java SE download page for my Object Oriented Programming course. After installation, I was annoyed by all of my zipfiles and files that uses zip format to be identified as x-java-archive. This change created an annoying "Warning wrong filetype" when opening files that uses zip format but uses different extension - like ODF files. And when I select those files, their icons also changed to java-archive icons.

Being greatly annoyed, I started hunting down the mime-type definition. First, I tried to find the definition by grepping x-java-archive from the jdk rpm

# rpm -ql jdk|grep x-java-archive|grep -v icons
/usr/java/jdk1.6.0/jre/lib/desktop/mime/packages/x-java-archive.xml
Bingo!. Found it.

I fired up vi and edited the definition file and commented out the <magic> tag
<!-- <magic priority="85">
<match type="string" value="PK\003\004" offset="0">
match type="host16" value="0xcafe" offset="40" />
</match>
</magic> -->

Juz to be sure , I tried to locate other x-java-archive definitions and commented out their <magic> tags

# updatedb 
# locate x-java-archive.xml
/usr/java/jdk1.6.0/jre/lib/desktop/mime/packages/x-java-archive.xml
/usr/share/mime/application/x-java-archive.xml
/usr/share/mime/packages/x-java-archive.xml

After editing them, the mime cache need to be updated for things to take effect immediately.
cd /usr/share/mime/
update-mime-database /usr/share/mime/

Finally, relogin to gnome for applying the changes.

Yeah~!, no longer annoying "Warning wrong filetype" messages when double-clicking ODF files and others that uses zip format.

Template broke on IE6 - Fixed

I just noticed that my current template broke on IE6 at the <pre> tag. CSS overflow:auto doesnt work and made the layout haywire on posts that have some long codes I pasted. I found it out when I was using my father's laptop to enter the blog, and that laptop uses IE6.

After some investigation, I got found out that IE6 does not support CSS max-height and overflow:auto does not work with dynamically sized div/pre. Damn IE6

After googling around, I found a hack on how to make it at least wont break the template here. Now my template happily work with IE6 and W3C compliant browsers. Yay~!

btw, this problem doesn't exist on IE7

"Subscribe Feed" Blogger Widget (Update) / Hacking Blogger's widget engine #3

I have modified a little bit of the Subscribe Feed widget which I posted last time. The modification is simply for user-friendliness when adding the widget to your blog and editing the feed URL. Done it by using JavaScript to write the feed url into the links.

To edit the feed url, just adjust the value of

var feed_url = "/feeds/posts/default";
in the code.

To know more about automated widget adding here

You can get the widget using a one-click interface here.

and below is the code
<script type='text/javascript' language='JavaScript'>
// <!--

// use this value to use Blogger's default feed
// or edit it to use other feed's URL
var feed_url = "/feeds/posts/default";

document.write("<a href='http://add.my.yahoo.com/rss?url="+feed_url+"'><img alt='' src='http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif' style='border:0'/></a>");

document.write("<a href='http://www.newsgator.com/ngs/subscriber/subext.aspx?url="+feed_url+"'><img alt='Subscribe in NewsGator Online' src='http://www.newsgator.com/images/ngsub1.gif' style='border:0'/></a>");

document.write("<a href='http://fusion.google.com/add?feedurl="+feed_url+"'><img alt='Add to Google' height='17' src='http://buttons.googlesyndication.com/fusion/add.gif' style='border:0' width='104'/></a>");

document.write("<a href='http://www.rojo.com/add-subscription?resource="+feed_url+"'><img alt='Subscribe in Rojo' src='http://www.rojo.com/corporate/images/add-to-rojo.gif' style='border:0'/></a>");

document.write("<a href='http://www.newsburst.com/Source/?add="+feed_url+"'><img alt='Add to Newsburst from CNET News.com' height='17' src='http://i.i.com.com/cnwk.1d/i/newsbursts/btn/newsburst3.gif' style='border:0'/></a>");

document.write("<a href='http://my.feedlounge.com/external/subscribe?url="+feed_url+"'><img alt='Subscribe in FeedLounge' border='0' src='http://static.feedlounge.com/buttons/subscribe_0.gif' title='Subscribe in FeedLounge'/></a>");

document.write("<a href='http://www.netvibes.com/subscribe.php?url="+feed_url+"'><img alt='Add to netvibes' height='17' src='http://www.netvibes.com/img/add2netvibes.gif' style='border:0'/></a>");

document.write("<a href='http://www.bloglines.com/sub/"+feed_url+"' type='application/rss+xml'><img alt='Subscribe in Bloglines' src='http://www.bloglines.com/images/sub_modern11.gif' style='border:0'/></a>");

document.write("<a href='http://feeds.my.aol.com/add.jsp?url="+feed_url+"'><img alt='Add to My AOL' src='http://myfeeds.aolcdn.com/vis/myaol_cta1.gif' style='border:0'/></a>");
document.write("<br/>");
// -->
</script>

HOWTO: Removing Firefox Menu Toolbar

Yet-another-shrinking-your-UI guide lol~..

Lets go straight to the point. First, to those you a newbie in editing userChrome.css, locate the file using this guide.

Then, just add these lines in userChrome.css.

toolbar#toolbar-menubar {display : none !important}

.toolbarbutton-menubutton-button > .toolbarbutton-box,
.toolbarbutton-1 > .toolbarbutton-box
{
max-width: 16px !important;
text-align: center !important;
}
Done.

(I'm in lazy mode)

Edit: For the Menu button, use the Compact Menu extension.

HOWTO: Making Firefox toolbar and tabs smaller

People with low resolution screens might want to make stuff smaller to save space. Below is a guide to shrink the Firefox toolbar .



Switching to small icons

First we need to use small icons for the toolbars. Just right click at the toolbar, click customize, and select "Use small icons".

Resizing the toolbar

There are no menus to change the toolbar width from within firefox. Therefore, we need to edit the userChrome.css file. The userChrome.css file is located in your Firefox profile folder. The location differs according to the OS. Locate your profile folder by following this guide. After you located the profile folder, find the file at <profile-folder>/chrome/userChrome.css . If it doesn't exist yet, create it.

Now, add this css entry into userChrome.css

toolbar {
max-height:30px !important;
}

This will resize the toolbars width to 30px.

Resizing the tabbrowser

Add this entry into userChrome.css to resize the tabbrowser tab width to 30px and remove any paddings and margins.
.tabbrowser-tabs {
max-height: 30px !important;
padding:0;
margin: 0;
}

Restart firefox, and you're done. Feel free to experiment with various values.

Btw, if you noticed in the screenshot, my menu toolbar has been removed and replaced with a menu button. I'll post a guide to do this when I have time.

HOWTO: Disabling tab scrolling in Firefox2

Firefox 2 introduces tab scrolling feature similar to Epiphany and several other browsers. However, while this feature seems to help stop tabs from becoming too small and hide its title, its considered annoying to some users. Not be able to see all of the tabs in once glance might not be preferable to some.

To disable this, goto about:config and set this

browser.tabs.tabMinWidth = 0
Now your tabs can shrink until 0 pixel!! lolz!!. To read more about the key, visit here

HOWTO: Enabling tab restore previous session in Firefox2

Firefox 2 already have a session saver built-in with the browser. However, it only activates when firefox crashed. Theres no available menu in the firefox preferences to adjust this behaviour, and some of us might want Firefox to restore tabs from our previous session. Fear not, you can still adjust it by editing a key through the about:config interface and enable the built-in restore previous session functionality.

Doing this is easy, just open about:config, and set this

browser.startup.page = 3
You can read here to know more about the key.