[How-To] Change facebook theme

I’ve seen numerous pages on facebook about changing facebook themes. Unfortunately, no user can change his/her profile theme because this data has to be stored on server. It can only happen if facebook starts supporting themes which I don’t see is a possibility anytime in near future.

Before following this tutorial, keep 1 things in mind:

This change will only be seen by you only on your computer and only on Mozilla Firefox.

This means that its only for people who would like to feel good seeing their own themes. It would not affect the look of your profile on others’ computer ie. other people would not be able to see your theme and instead see the default facebook theme.

Missing alphabet check (is_alpha) in PHP

Well, you might have seen a huge number of variable checks ranging from is_file(), is_array() to is_numeric() and is_int(). While developing a script today I wanted to check for alphabets. I directly used is_alpha() but to my surprise it wasn’t defined.

I researched more into the matter and found ctype_alpha() does precisely the same thing. However, I still believe there should be a standard function having prefix ‘is_’ for alphabets too.

Cheers

[Solved] Unable to update .ICEauthority error on booting

I received this error after installing updates and restarting the computer. It was nothing but a file-permission issue. You can easily fix it.

To solve it, type the follow these instructions:

Go to Application menu->Accessories->Terminal or press Alt+F2 and type gnome-terminal and press enter.

In terminal, type:

sudo chown username:username .ICEauthority

sudo chmod 0644 .ICEauthority

Replace username with your own username.

Restart your computer to check that the problem has been fixed.

Cheers!

[HowTo] Optimize Mozilla Firefox for better performance

Firefox is getting very popular lately, mainly due to its customizability. I use firefox as my main browser and use all sorts of addons which help me in web-development. These addons make my firefox hungry but I can’t do without them. So, instead I tweaked around some settings in firefox which made it much responsive and faster than before.

To tweak those settings, follow the following steps:

1. Type about:config in your address bar and hit enter.

2. In the filter type browser.session
3. Modify browser.sessionhistory.max_entries by double clicking it. This setting sets the number of steps you can go forward or backward on a page. Default is 50 which is just too much. 20 will be more than sufficient for most people.

4. Modify browser.sessionstore.interval by double clicking it. This setting specifies the rate of saving current session. The default is 10000 milliseconds which means that every ten seconds your sessions are stored. So, when your browser crashes you will, at most, lose only tabs since last nine seconds prior to crash. Change it to 30000 or 20000, whatever suits you. 10000 is definitely not required by most of the people.

5. Modify browser.sessionstore.max_tabs_undo. This setting stores the number of tabs you can undo-close by pressing ctrl-shift-t. Default has been set to 10. I set it to 5 which is more than sufficient for me.

6. Modify browser.sessionhistory.max_total_viewers. This setting can vastly improve the performance. It specifies the number of pages to store in memory. When you press back/forward in a browser, pages are instantly displayed. This is because those pages have been stored in the memory and this setting specifies how many pages should be stored. By default, its -1 which means it depends upon the amount of ram. I have 2 GB and I set this setting to 4.

7. Modify network.prefetch-next. This setting specifies if the prefetching should be enabled or not. Prefetching is when a site tells the browser to download a link (which is most likely to be visited) beforehand only. It is useless and only takes up extra bandwidth and memory. Set the value to false.

Lastly, you can try to change some settings yourself and see the results. You can check the mozillazine knowledgebase to know what a particular setting does. For example, for network.prefetch-next you can check out the setting details at http://kb.mozillazine.org/Network.prefetch-next. Similarly, for other settings.

Some more tricks to free up memory usage of firefox:

1. The awesome bar (address/location bar), as you must be knowing is really amazing feature but it may lead to slowdowns if history is too large. Go to Preferences->Privacy, and in ‘Remember my browsing history for atleast’, put minimum history that you ever require. Mine is 30, since I don’t need more than that and putting a less value always speeds up things. In the same dialog box, In ‘When using the location bar, suggest:’ , try an use only one option if you don’t require both. This will further reduce the address bar lag.

2. Remove useless plugins/extensions: Periodically check the list of your extensions and disable those which you haven’t used since a long time. Extensions are the main cause of Firefox’s slowdown.

3. Use a blank pages as your home page. This makes firefox startup a bit faster.

4. Try and use default theme as themes eat up way too much memory. It delays the startup very significantly.

5. Flash is one of the reasons why Firefox eats so much amount of memory. It has been known that memory taken by a flash animation isn’t freed even after closing that tab. They said they improved this memory leak from Firefox v3 onwards but I don’t see much of a difference. The solution is you can replace all your flash animations with a play button using flashblock extensionsand just click the play button to play the required flash animations.
This way you control which flash files are being played, thereby reducing the amount of memory taken.

These settings will definitely make your Firefox blazing fast. Try and implement all of them and see the difference.

Cheers!

Why computer recognizes hard drive size to be less than whats printed on box

Once in a while, everyone must’ve been confused and intrigued about the hard drive sizes. The don’t give what the promise. I still remember when I bought my first 20GB harddisk and was surprised to see only 18.6 GB. I was about to return it back claiming it was damaged when I researched and found out why.

Here’s the explanation.
HDD manufacturers label and make the HDDs using 1000 bytes = 1kb (kilobyte), 1000kb = 1mb (megabyte) and so on. But according to computers 1024 bytes = 1 kb, 1024 kb = 1 mb and so on.
So, computer always will recognize less space due to different measurement values.

Take the analogy of money here. Say, you have a 100 cents, which is 1$ for normal people. Now some crazy guy believes that 120 cents make 1$. For him you won’t have a complete dollar, you’ll have 0.833$. Same is the case with computers. HDD manufacturers are the normal guys, while computer is the crazy one :D. Okay, that was a silly one but you get the drift.

For calculating actual disk space of any size of disk. Do this:
If you have a 40 GB HDD, calculate its equivalent in bytes using 1000 bytes =1 kb concept. As this is used by manufacturers.

40 GB = 40,000 MB = 40,000,000 KB = 40,000,000,000 bytes.

By this we get actual bytes. Now convert it into actual amount of HDD by dividing it with 1024.

40,000,000,000 bytes = 39062500 kb = 38146.97265625 mb = 37.252902984619140625 GB.

So this is the actual amount of GBs we get when buying 40GB HDD.

Same is the case with Flash Pen Drives.

Its not so complex mathematics as it seems. Its just due to huge figures.

[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.

Cheers!

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.

Cheers!

[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:

<?php
 
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
 
define('HTML2FPDF_VERSION','3.0(beta)');
define('RELATIVE_PATH','fpdf/');
define('FPDF_FONTPATH','font/');
 
require_once(RELATIVE_PATH.'fpdf.php');
require_once(RELATIVE_PATH.'htmltoolkit.php');
require_once(RELATIVE_PATH.'html2fpdf.php');
$pdf = new HTML2FPDF();
$pdf->WriteHTML($html);
$name="doc.pdf";
$pdf->Output($name);
 
?>

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:

<?php
 
//Your code
 
....
 
....
 
....
 
// To make a pdf file:
 
$html= "<h1>hello</h1>";  //To add more html code use $html.= yourcode; in the next line
 
define('HTML2FPDF_VERSION','3.0(beta)');
define('RELATIVE_PATH','fpdf/');
define('FPDF_FONTPATH','font/');
 
require_once(RELATIVE_PATH.'fpdf.php');
require_once(RELATIVE_PATH.'htmltoolkit.php');
require_once(RELATIVE_PATH.'html2fpdf.php');
$pdf = new HTML2FPDF();
$pdf->WriteHTML($html);
$name="doc.pdf";
$pdf->Output($name);
 
?>

[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:
https://addons.mozilla.org/en-US/firefox/addon/59

Now, download this file:
http://www.techmindz.com/useragents.xml

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.
Regards

[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