Restore Broken Package DB on Sabayon

System database not found or corrupted, running in safe mode using temporary, empty repository

phoenix jude # equo rescue resurrect
>> ####### ATTENTION: The installed package database will be resurrected, this will take a LOT of time.
>> ####### ATTENTION: Please use this function ONLY if you are using an Entropy-aware distribution.
     Can I continue ? [Yes/No] yes
     Are you REALLY sure ? [Yes/No] yes
     Do you even know what you're doing ? [Yes/No] yes
>>  @@ Creating backup of the previous database, if exists.
>>  @@ Previous database copied to file /var/lib/entropy/client/database/amd64/equo.db.backup.15103
>>   Initializing the new database at /var/lib/entropy/client/database/amd64/equo.db
>>   Database reinitialized correctly at /var/lib/entropy/client/database/amd64/equo.db
>>   Found 420663 files on the system. Assigning packages...
>>   Matching in repository: Sabayon Linux Official Repository
>>   Found 0 packages. Filling database...
>>   Database resurrected successfully.
>>   Now generating reverse dependencies metadata...
>>   Now indexing tables...
>>   Database reinitialized successfully.
>>   Keep in mind that virtual packages couldn't be matched. They don't own any files.
phoenix jude # 

fascinating and too simple!
For one thing, I have no clue why did it say “Found 0 packages.”, because just after this I was successful in doing an equo upgrade and it worked beautifully.
equo has become a teenager…

Easily Sort Your Music Library

Here is a very simple script to sort your whole music library according to their artists,

#!/bin/bash
# sortMusic v0.4
# make sure this script in in the music directory and you execute this script from there
# know issue: will display many errors, but it does it fine, those errors are not to be bothered about
# still needs a workaround
echo "$(ls -l *.mp3 | wc -l) Files will be sorted according to their Artists"
echo "Make sure all your song artists are correct, will wait for 3 seconds..."
sleep 3
for i in ./*; do
	artist=$(mp3info "$i" | sed -n 's/Artist: *//p')
	if [ -d "$artist" ]; then
		mv "$i" "$artist"
	else
		mkdir "$artist"
		mv "$i" "$artist"
	fi
done
# To move all the incorrect id3 artists
mkdir "Z Singles Z"
mv *.mp3 "Z Singles Z"

# That was very simple, wasn't it?

Just make a file called sortMusic-v0.4 in your main music folder, paste the above code into that file, then do $ chmod +x sortMusic-v0.4 and then do a $ ./sortMusic-v0.4 in the music folder. Please download mp3info as this uses that package. Please note that this is very case-sensitive, so if your artists are same but differ in case, it will make a new directory for that one, so please take care until I have a workaround for this.

NON-Standards Compliant C++ with Mumbai University

Mumbai University fails to keep up with the ever-evolving C++ syntax. Making Turbo C/C++ as their prescribed IDE, Turbo C/C++ is ancient and will not compile with the present syntax of C++. Here is the simplest example:

#include <iostream.h>
#include <conio.h>
void main()
{
	cout << "Hello";
}

The above code, when compiled with g++ 4.3.4, will give the following errors, but with Turbo C/C++ will compile and run just fine:

firstApp.cpp:1:22: error: iostream.h: No such file or directory
firstApp.cpp:2:19: error: conio.h: No such file or directory
firstApp.cpp:4: error: '::main' must return 'int'
firstApp.cpp: In function 'int main()':
firstApp.cpp:6: error: 'cout' was not declared in this scope

Here is the same code, but following the correct syntax:

#include <iostream>
using namespace std;
int main()
{
	cout << "Hello";
	return 42;
}

will compile and run just fine.

Argggg!!! This never ends! They even introspect on Valid XHTML and CSS standards!

[HOWTO] Create a hidden loopback device in a .jpg file

Well, I’m sure that you are definitely curious about how do you do this. Let me tell you this, it’s really simple.
Pre-requisites:

  • Image File(any format will do or even any file will do)
  • Linux(I’ve only tested it on this platform but I guess Mac would also do)

Let’s get started, shall we?
First create a standard loopback device.

dd if=/dev/zero of=hiddenimage bs=1M count=10

Let’s see what does this do:
It creates a file called “hiddenimage”, with it’s size as 10MB.
Then, create a filesystem on it.

mkfs.ext4 hiddenimage

mke2fs 1.41.8 (11-July-2009) hiddenimage is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 2560 inodes, 10240 blocks 512 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=10485760 2 block groups 8192 blocks per group, 8192 fragments per group 1280 inodes per group Superblock backups stored on blocks: 8193 Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

Continue reading “[HOWTO] Create a hidden loopback device in a .jpg file”

[HOWTO] Dynamic Plugins for WordPress

Problem: Installed the hemingwayEx theme. Looks great, but the pagination doesn’t work well without the custom hemingwayEx pagination plugin. I got that installed. The hemmingwayEx theme looks cool when it displays two posts per page. The plugin worked well except that for my other two themes, displayed two posts per page. I posted a topic at WordPress Forums. No results.

Solution: Just at the beginning of the hemingwayEx theme, I modified it to create a cookie, like this:

<?php
if(!isset($_COOKIE["wptheme" . COOKIEHASH])) {
		$expire=time()+3600;
		$ctheme="hemingwayEx";
		setcookie("wptheme".COOKIEHASH, stripslashes($ctheme), $expire);
}
?>

Continue reading “[HOWTO] Dynamic Plugins for WordPress”

P&P Lava Lamp nav for your WP Blog

After two days of having intense jolts given to my head, I finally got the lava lamp navigation working! The orignal idea is from G. Marwaha’ Blog and Cory’s Place. By compiling the two articles, I have a clean way to implement it in probably any wordpress theme. I struggled at this one… but where there is a will, there is a way. This has been tested on the wordpress default theme and the subtleflux theme. You can see it live at my developmental theme. This is also for the lazy man, the quick “copy & paste” method.

So let’s get started, shall we?

Download this zip file containing the jQuery files for Lava Lamp Menu Unzip the files in your theme direcrory.

Continue reading “P&P Lava Lamp nav for your WP Blog”

Simple Steganography

Wanna hide that information and private things you don’t want your buddies to see? Here is what is called simple steganography. Steganography is the master of black arts. Nobody can ever suspect that there is a simple, easy-to-find drawer in one of your pictures. This works with .png files as I didn’t try it with any other. If the trick works on other file types, please let me know. All set to go? You need a GNU/Linux terminal or a Mac terminal to do this. Someone please post ways of doing this in Windows!
The Trick:
We have a file called “Secret Song.mp3”. We want to hide this into an image file. Let’s assume that our image file is called “Landscape.png”. First, compress the “Secret Song.mp3” into the .zip type compression. Then type the following in the shell:
Continue reading “Simple Steganography”