[Solved] ‘Public key is not available’ error on apt-get update in Ubuntu

I came across this error while doing sudo apt-get update

W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 5A9BF3BB4E5E19B8
W: GPG error: http://ppa.launchpad.net karmic Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9ABD05E22847688C

This made me do some hunting on the web. I tried quite a few solutions out of which the following worked.

Run the following command in terminal:

gpg --keyserver subkeys.pgp.net --recv 5A9BF3BB4E5E19B8
gpg --export --armor 5A9BF3BB4E5E19B8 | sudo apt-key add –

Replace 5A9BF3BB4E5E19B8 with your own key. This solved the error. I repeated the procedure for second key and I stopped getting error messages.

On the first command, sometimes the server maybe down. In that case you can try the following servers.


To use these servers just replace subkeys.pgp.net with any of the server above. For eg;

gpg --keyserver http://keys.gnupg.net --recv 5A9BF3BB4E5E19B8



[HowTo] Playing wmv files in Ubuntu

I had many wmv files but I wasn’t able to play them.
Ubuntu by default doesn’t support wmv files due to legal reasons. You can, however, make them play.

In terminal, type:
sudo apt-get install ubuntu-restricted-extras

Or, you can go to synaptic package manager and install ubuntu-restricted-extras.

After installation, you will be able to play wmv files.


Auto mounting partitions at start-up in Ubuntu

System -> Administration -> Synaptic Package Manager

Search for pysdm and click on the square and click on ‘Mark for installation’ and click apply. The package will be installed.

Alternatively you can go to Applications->Accessories->Terminal and type ‘sudo apt-get install pysdm‘. It will ask the password, enter it and pysdm will be installed.

Once installed,  type sudo pysdm in terminal to launch the application. After that, its pretty easy to configure the application to auto mount the partitions on startup.

Select the partition from the left panel, browse its mountpoint and in options, defaults will do. Defaults already have the auto mount option. Otherwise you can click on assistant to check the options you want. Do the same with all the partition and click on Apply and close.

Done. Simple, isn’t it?

There are other ways which require modification of configuration files but I found this method to be the easiest.


[HowTo] Convert HTML to PDF using PHP

In a recent project, I had to output to a PDF file as well as to the browser. For this purpose first I downloaded the library from here. Then this code:

ob_start();  //Start buffering the output
//your coding starts here
//Coding ends here
$html = ob_get_contents(); //dumb the buffer as a string in variable $html
ob_flush();  //Output the buffer to browser
//Start outputting to PDF
$pdf = new HTML2FPDF();

When you run this script, you’ll get a pdf file “doc.pdf” in your script directory with the output of the current script.

For outputting something else other than the current script:

//Your code
// To make a pdf file:
$html= "<h1>hello</h1>";  //To add more html code use $html.= yourcode; in the next line
$pdf = new HTML2FPDF();

[HowTo] A trick to get access to protected sites.

Sometimes, when you search in google for something, you find very nice results but when you visit those sites, they seem to be protected i.e; you need to either sign-up or maybe you need to pay for it. So, here’s a way to get access to it without paying or even signing up.

Mostly people want their exclusive content to be protected. Since it is exclusive, they would want people to know about it so that more people join the site. That is why they let search engines to access their protected content so that it gets listed in their results and site gets traffic for that. Now search engines are similar to people. Websites only have one way to differentiate between them – User agents. All the search engines have user agents which makes them differentiate from humans.

As we all know, Google is the greatest and largest search engine (hope Bing will capture the market too).
Its user-agent is “Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)”.

With this information, we can get access to protected sites which is freely available only to search engines.

We need Mozilla Firefox for the purpose. Download it from here if you don’t have it.

Now, get this user agent switcher addon for firefox:

Now, download this file:

Now, import the user-agent strings into the add-on by:
In Mozilla Firefox:
Tools -> User Agent Switcher -> Options -> Options -> User agents -> Import
Select the file you just downloaded.

When accessing the protected site, goto Tools -> User agent switcher -> Googlebot 2.1 (New Version)

You will get access to its contents.

Any queries will be answered here.

[HowTo] Remove almost any kind of viruses from Windows

Being attacked by many viruses in the recent times, I thought why not make people learn from my experience. Having faced about a dozen of different viruses in past 2 weeks, I have experience enough to write this guide. I faced trojans, trojan downloaders, rootkits and what not. So here’s my little guide which will help you get rid of your virus.

We’ve got a huge amount of viruses floating over the internet. New viruses are being made by evil programmers daily. Due to this innocent computer users are being infected and suffering from infected system which results in compromising of private data, destruction of data, unusability of computer etc. For non techy people virus removal is a tough task. Fortunately, for tech-savvy people its not so difficult.

I am writing this guide so as to help people from removal of viruses from their computer.

A brief introduction about viruses. A virus is generally a malicious software which tries to steal personal information from your computer or uses your computer for other malicious activities like spamming, used as proxy from illegal activities, spreading malware etc.

Computer can be infected from virus through many means. You can get infected from a mail you opened from unknown person, some software installation, a friends pen-drive which you just inserted in your computer etc.

Until now, only Microsoft Windows have been known to be infected by viruses. Linux and Mac OS remains unaffected. There are only few known viruses for them. Windows on other hand has thousands of viruses with new viruses being produced everyday.

To protect yourself from viruses you will need to have good combination of security tools.
Tools required:

1. Sysinternals Process Explorer.
2. Good anti-virus software (preferably Kaspersky, NOD32, or Norton).
3. Malwarebytes Anti-Malware
4. Registry Fix.
5. Task Manager Fix.
6. UnHackMe.
7. Lavasoft Ad-Aware latest 2009 version. (Older version has many drawbacks)
8. HijackThis
9. Spybot S&D. (Optional)

Most of the viruses won’t let you know when they install themselves on your computer. You won’t even notice them unless they do something noticable like use internet extensively which draws your attention etc.

When you get infected by a virus and you are sure about it:
You know that you have been infected by a virus and you don’t know what to do. Just bear with me and you will find quick solutions to your answers.

To check if virus is using the internet:

1. First of all check if it is using internet. Go to Start Menu-> Run -> Type “cmd” without quotes and enter.
2. Then type “netstat -b” without quotes in the console and press enter.
3. On the left hand side, you will see a list of executables and right to that, you will see the sites it is connecting to. If you see any unknown executable connecting to any unknown site. It means that it is using your internet. In this case, I recommend disconnecting from internet to protect yourself.

Checking if the virus is running as a process:

1. Download the Process Explorer from Sysinternals from here.
2. Run it and see under the Explorer.exe. If you find some unknown executable running there, it means the virus is running as a process. Double click it and check the TCP/IP tab. This way you can confirm if it is using the internet. Click OK to exit the properties.
3. Right the process and click “Kill Process Tree”. Click yes when asked for confirmation.

Warning: Do not kill any process under “System”. It may crash your system.

Scanning for Malware using Malwarebytes:

1. Download Malwarebytes Anti-Malware from here.
2. Run the setup and install it.
3. Run the software and update its database.
4. Do a quick scan and delete all the entries which it finds. After quick scanning, do a full scan. I believe quick scan will remove majority of the malware and full scan will remove any leftovers. Restart if it asks you to.

Scanning for viruses using your anti-virus software

1. Whichever AV you are using. Install it and update it.
2. Perform a scan and delete/quarantine all infected files.
3. Restart if it asks you to.

Scanning using Lavasoft Ad-Aware:

1. Download the latest Ad-Aware version from here. Its free.
2. Install and update. Restart after installation.
3. Run a full scan and delete all the files it detects.

You may also use Spybot S&D to scan your computer, though it is not advised as its reliability and accuracy has gone very bad.

Re-enabling your taskmanager and registry editor in case they have been disabled.

1. If you see an error on pressing CTRL+ALT+DEL saying that “It has been disabled by Administrator”, it means that virus has disabled it.
2. Similarly regedit may also have been disabled by the virus.
3. To fix these, download:
Download – Taskmanager fix
Download – Registry fix.

Some viruses also modify the existing windows installed files. To restore them:

1. Start Menu -> Run -> Type “Sfc /scannow”.
2. Note that you will need Windows XP cd for this. It will check all the system files and will replace them if they have been tampered.

You must’ve your system cleansed thoroughly by now. There is no security application which gives you complete security. You have to use them together to protect your computer. That is why so many scans are required.
Ad-aware which had gone bad in the past few years have made a come back with their latest AE edition which provides very good security. Recommended to everyone.

For removing rootkits

1. Rootkits are probably the worst kind of infection anyone could have. They go undetectable by every other tool mentioned above. Those tools simply fail to discover it. Rootkits hide themselves under critical system files, run as hidden processes and are undetectable by any means.
2. Its impossible to detect their presence. You will only know that they are on your system if you see some weird behaviour like internet being used by itself etc.
3. To remove rootkits, install UnHackMe from here.
4. Install the software and follow the instructions. You will need to restart your computer for making this program check for rootkits. It will check the boot process for infected files.
5. Delete the files which you think are rootkits and are not part of any legit software.
6. Restart to make the changes.

Note: Please install security programs from their vendor’s site. Do not use warez or torrents to download as they themselves mostly contain viruses.

If you are still unable to remove the virus, please repeat all the above steps in safe mode.

If still, you are unable to get rid of it, please post a hijackthis log on this board. I’ll try to help you get rid of it.
Download it from here .
Scan and save the log and post it on this board for us to examine it.

Disclaimer: I am not responsible for any damages caused if you fail to follow the instructions carefully.

This guide may not be published/reproduced without my permission.

This is my tutorial originally posted on my forum here: http://www.techmindz.com/index.php?topic=361.0

[HowTo] Extend phpmyadmin session expiration time

Recently, I got frustrated being logged out every few minutes (24 minutes, to be precise) from phpmyadmin on my localhost. I make some db changes, write some code and when I get back to phpmyadmin, I would see my session had expired. To fix this, I changed the configuration so that my session would expire only after 24 hours of inactivity.

Steps to follow:

  • Copy the following code at the end of /etc/phpmyadmin/config.inc.php:

    $cfg['LoginCookieValidity'] = 60*60*24;
    ini_set('session.gc_maxlifetime', $cfg['LoginCookieValidity']);

This will let your session expire only after 60*60*24 seconds, that is one day.


[Solved] “is not co-installable with” errors on Ubuntu

I installed 32bit wine on 64bit Kubuntu but for some reason it didn’t install properly so I tried reinstalling wine 64 bit and got the following error:

dpkg: error processing /var/cache/apt/archives/wine1.2_1.2.3-0ubuntu1~ppa1_amd64.deb (–unpack):
wine1.2: 1.2.3-0ubuntu1~ppa1 (Multi-Arch: no) is not co-installable with wine1.2:i386 1.2.3-0ubuntu1~ppa1 (Multi-Arch: no) which is currently installed

You can’t simply remove 32bit wine using apt-get remove wine1.2. To fix the issue suffix the package name with ‘:i386’.

Therefore, I solved the problem by:

sudo dpkg -r wine1.2:i386

[How-To] Disable CPU cores in Linux

Although there’s no reason to do this, but some of you might have problem with apps not running well in multi-core environment or maybe looking to save some power (although disabling cores on sandy-bridge CPUs won’t save much power), I’ve written this simple tutorial to disable CPU cores in Linux.

I have i7 2630QM process which has 4 physical cores and 4 logical cores. I’ll show you how to make it act like a dual core machine instead.

Method 1:
This method is dynamic and doesn’t require a reboot. You can just open a terminal and try this out:

  • sudo sh -c "echo 0 > /sys/devices/system/cpu7/online"
    sudo sh -c "echo 0 > /sys/devices/system/cpu6/online"

    Repeat the above steps for cpu2 to cpu7 and it’ll leave you with cpu0 and cpu1 active which is essentially what we’re trying to achieve.

Method 2:
This method will make the linux boot with 2 cores which might make kernel more optimized for dual core environment than the method above.

  • Add maxcpus=2 to GRUB command line by doing the following:
    gksu gedit /etc/default/grub



    and change it to

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash maxcpus=2"
  • Then run:
    sudo update-grub

    When you reboot, linux will run on 2 cores.

[Solved] Unadjustable brightness on laptops having i915 kernel module

I recently purchased a new laptop HP DV6121tx and installed linux on it. Apart from the muxless switchable graphics and openGL (HP will release a BIOS update to fix it soon), and brightness control, everything worked. I couldn’t change the brightness using the Fn Hotkeys. They displayed the brightness applet on pressing but nothing happened.

After scavenging, what seemed like the whole WWW, I finally found a modified kernel by Kamal Mostafa which fixed the issue. You can see the bug reports and patch here.

The issue seemed to be with i915 kernel module and how it handled brightness on certain laptops which had different ACPI implementation.
Only install this kernel if you are using i915 kernel module. You can check if its active by executing:

lsmod | grep i915

If it gives you output, it means you’re using the i915 kernel module and you can proceed further. If it doesn’t give any output, you should leave this page.

Fix the brightness issue by installing kernel debs provided in Kamal’s PPA.

sudo add-apt-repository ppa:kamalmostafa/linux-kamal-mjgbacklight
sudo apt-get update
sudo apt-get dist-upgrade

This will install the modified kernel. Alternatively, you could do (not recommended):

sudo add-apt-repository ppa:kamalmostafa/linux-kamal-mjgbacklight
sudo apt-get update
sudo apt-get install linux-headers-2.6.38-10 linux-headers-2.6.38-10-generic linux-image-2.6.38-10-generic linux-libc-dev

Reboot into the modified kernel to confirm the brightness keys work. Cheers!

[Solved] Disqus causing admin panel issues in wordpress

Disqus comment system was causing javascript errors, which in chrome console looked something like this:

Uncaught Syntax error, unrecognized expression: [href=edit-comments.php?page=disqus]

It caused unmovable widgets, screen-options didn’t open and other related javascript issues in admin panel.

After some researching it turns out, there’s a simple fix.

In /wp-content/plugins/disqus-comment-system/disqus.php, find:


and replace it with: