Saturday, September 28, 2013

Tagged under: , ,

How to turn on a computer through LAN

Yesterday I used my laptop and wanted to get some files on my desktop which was at the next room. Both are connected to the same router and they have shared folders which I can use to transfer files between them. All I need to do is to push the power button to turn on the desktop. That's ok if I am near it but I often "travel" everywhere at home and sometimes the door is closed. Here's what I do to turn it on remotely.

First, make sure that your mainboard supports something like "Wake on LAN" or "Power on by PCI devices" by press Del repeatedly (it can be some other keys, just notice the line "Press <somekey> to enter setup..." when you turn on your computer) when your computer is booting in order to enter the BIOS settings, then check the Power Management part and enable them. Because the menu is different between types of mainboards, I can't point the names exactly but the function is the same.

When this function is enable, here's how "Wake on LAN" works:
When your computer is off, if you don't unplug the electric cable, the mainboard still has power and so do everything on it (PCI cards, onboard LAN...). So if your mainboard has "Wake on LAN", all you have to do is giving it a "magic packet" through LAN cable and the computer will be turned on!

I use a free software named WakeMeOnLan:


You can download it here:
http://www.nirsoft.net/utils/wake_on_lan.html

Just press the "play icon" to scan all the computers in your network, right click on the one you want to wake and choose "Wake up Selected Computers", it will send the packet for you. Good luck!

Wednesday, September 4, 2013

Tagged under: , , , ,

How to set default file manager in Ubuntu


















Sometimes you have a better file manager and want to set it default. You can do it by change a line of text in a file called defaults.list in Ubuntu.

Open the terminal by Ctrl + Alt + Del

Edit defaults.list file (I use VIM) with root permission:
sudo vim /usr/share/applications/defaults.list

Search the line:
inode/directory=<file-manager-name>.desktop
<file-manager-name> is your preferred file manager name

For example:
Dolphin: kde4/dolphin.desktop
Thunar: Thunar.desktop

Save the file

Note: because of the read-only attribute, you must force to save the file. In VIM, I use :w!

Saturday, August 31, 2013

Tagged under: , , ,

Hotkey to close Chrome Download Bar

If you're using Chrome, after any download completes, Download Bar will appear at the bottom of your browser. It sticks at there and occupies a space until you press X to close it.








It's very annoying. Google doesn't support any official hotkey to close it but here's the tricky way:

Press Ctrl + J (open Downloads tab)
then Press Ctrl + W (to close it)
and the Download Bar will go away!

Tuesday, August 27, 2013

Tagged under: , , , ,

Common commands in Ubuntu

Manage software packages:

Update package list (you should do this before running all commands below):
sudo apt-get-update
Install: sudo apt-get install <name>
Remove: sudo apt-get remove <name>
Remove and remove configuration files:
sudo apt-get remove <name> --purge
Search: apt-cache search <name>
List installed packages: sudo dpkg --get-selections



Wednesday, August 21, 2013

Tagged under: , ,

How to overcome the Facebook security check of identifying friends by their photo

Whether you created a real Facebook account or a fake one, sometimes you may be encounter a kind of Facebook security check that requires you to identify your friends by their photo or Facebook won't let you to access your account. Here's how I overcome it.

First thing to say is I don't know exactly the rules that Facebook staff use to identify fake account. But I think if you make friend with some people regularly day by day, someday Facebook will think your account is fake and it requires you to pass its check to continue to use your account.

The most difficult thing here is the check only available in a specific amount of time. If it takes you too much time to identify your friends, you will be failed and you must wait an hour to try again!

Ok, and this is how I overcome it.

When Facebook shows me first 3 random photos of someone in my friend list and a auto-complete textfield to enter his/her name, I use this textfield to get all the names in my friend list. I type A, and the textfield will suggest me all the names begin with A. Just do like this until Z and I will get my friend list.

After that, I use another Facebook account to search every friend, check their public photos (Facebook always uses public photos in the check) and remember every face of them. For more convenience, I save one of their photos and name the file with their name. Finally, I wait an hour and do the check again.

I know this way take time and effort much but so far it's may be the only way to solve my problem.

Tuesday, August 20, 2013

Tagged under: , , , , ,

How to enable Apache2 URL Rewrite in Ubuntu

URL Rewite makes your website's URLs easier to read, to remember and more friendly to search engines. I'm using Drupal and if I want to use Clean URLs function, I have to enable URL Rewrite in Apache2. Here's how I did.

Firstly, I switch to root account:
sudo su

Then I enable the rewrite module in Apache2 with:
a2enmod rewrite

I check to see if the module worked by running:
apache2ctl -M
If you see rewrite_module on the list, it's ok

Go to the folder /etc/apache2/sites-available/, and find the file which is named similarly to your website name (Ex: business.dev). If there's not such file, use the file named default.
Open the file by an editor and look for Directory code block which contains the path to your website, leave other Directory code blocks untouched. Change:
AllowOverride None to  AllowOverride All

This action allows .htaccess files (like Drupal's) override the settings of Apache and makes URL Rewrite function work.

Restart Apache:
service apache2 restart

Done!
Tagged under: , , , ,

How to create Apache virtual hosts in Ubuntu

Virtual host system help you to develop and manage your local websites easily by mapping them to friendly names like mybusiness.dev or myclient.com instead of localhost/mybusiness or localhost/myclient. With these names, your websites will run like real websites on the Internet, but remember, these names only work locally on your computer. Here's how to do it.

Go to the Apache folder named /etc/apache2/sites-available
You'll see a file named default, create a copy of it and name the copy with your website name (Ex: company.dev).

Open this file and change all existing domain names and paths here to the domain name you've just choose and the path to the folder contain your website.

Finally, you have to active this virtual host by running this command in terminal:
sudo a2ensite company.dev

Add this line to the file /etc/hosts to map the name to localhost, not to the Internet:
127.0.0.1 example.dev

Restart Apache and test
service apache2 restart

Notice that in some browser like Chrome, may be you have to type "http://compnay.dev", not just "company.dev". Chrome can misunderstand and think it an address on the Internet.

Monday, August 19, 2013

Tagged under: , ,

How to refresh favicon of Blogger

You're using Blogger and you've just uploaded your own favicon, but nothing changes? Here's how to refresh it!

Firstly, try to use Ctrl + F5 (or Cmd + F5 on Mac) on your browser to refresh. If it does not work, go to next fix.

Go to this address: yourblog.blogspot.com/favicon.ico
If you see the B icon of Blogger, use Ctrl + F5 (or Cmd + F5 on Mac). It will be refreshed and you will see your icon. After that, go to your blog (yourblog.blogspot.com) and use the same hotkey to refresh it. Done!

Another solution is clearing all the browser caches. Use Ctrl + Shift + Delete to open the cache clearing dialog box, check all the options, choose the time to clear from the beginning and press Clear or something like that and then refresh your blog.

Friday, July 26, 2013

Tagged under: , , , ,

How to install LAMP on Ubuntu

LAMP stands for Linux, Apache, MySQL and PHP. This tutorial show you how to install all of them separately

Reference: http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-13.04-lamp

Run terminal, get root permission: sudo su

Install MySQL: apt-get install mysql-server mysql-client (set password for root account when you're asked)

Install Apache: apt-get install apache2
Test apache by going to localhost (or 127.0.0.1)
Websites will be stored at /var/www and Apache folder is /etc/apache2

Installing PHP (with Apache PHP module): apt-get install php5 libapache2-mod-php5

Restart Apache: /etc/init.d/apache2 restart
or: service apache2 restart

Install a module of PHP to connect to MySQL: apt-get install php5-mysql
or you can search for more modules you need and install them at once: apt-cache search php5
with this command: apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Restart Apache: /etc/init.d/apache2 restart

Install Xcache for PHP caching and optimizing:

Restart Apache: /etc/init.d/apache2 restart

Install phpMyAdmin:apt-get install phpmyadmin
When asked, choose apache2 for websever, and No for dbconfig-common
Test phpMyAdmin by going to localhost/phpmyadmin

Done!

NOTE: If phpMyAdmin does not work, that is because you have not included a config file of phpMyAmdin into Apache yet
There're 2 ways, one is create a copy of it in conf.d folder (Apache will automatically include all files exist in this folder):
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
or insert a command into apache2.conf to include the file you need
Include /etc/phpmyadmin/apache.conf

Tagged under: , , ,

How to mount partitions in Ubuntu

Before using a device in Linux, you must mount it first. This tutorial show you how to mount partitions.

Get root permission
sudo su

Create a folder to mount on
mkdir <somewhere>

Get list of partitions
fdisk -l
Look at Blocks column (disk capacity) to guess the Device (partition name)

Mount partition (Ex: /dev/sda5) on the folder
mount /dev/sda5 <somewhere>

Unmount:
unmount /dev/sda5

For automatically mounting after boot, check this for more:
http://linuxexpresso.wordpress.com/2010/03/14/mount-partitions-in-terminal-fstab/