Archive for May 25th, 2009
How to format a disk on linux
by z3n on May.25, 2009, under Linux Happyness
Problem:
So you got that old ass windows disk and want to get rid of windows at once or you just want to format a disk on ext3 since it’s so much better than ntfs/fart32
Solution:
I must say that i wasn’t expecting anything easy as format c: , but this was so much more fun.
First you need to umount the disk you want to format, for me it was a issue, i’m using samba (smb) to share the disk, so i had to stop smb service before umounting it. Make sure you do that first, if you don’t you will fall into funny errors.
Then you need to create new parttitions or remove the old ones using fdisk, if you are familiar with old DOS and windows fdisk CLI this shouldn’t be a problem.
fdisk commands are easy:
p – lists the partittion tables
n – creates a new partittion
d – deletes an partittion
w – write changes (if you don’t write changes before quitting nothing will be changed)
t – file system type
in order you should d all the partittions you don’t want and n a primary or secondary one, depending on your case.
After that you need to choose a file system with t, i like the 8e which is linux LVM, you can also try 83 the default linux one.
Then you do w and quit.
You might see some warnings/notices about kernel only seeing the right partittions after reboot, that’s right, no need to worry.
Now that you created the partittions you need to format the disk with mkfs -t <format> /path/to/dev , format could be a bunch of things, i like ext3.
As recommended by many of the sources i saw, you should do a disk check, it’s importaint, specially when you have an old ass disk that could be broken by windows or time usage.
fsck -f -y /path/to/dev
this will fix and answer yes to all questions.
You should reboot your system in order to kernel regonize the new partittions, however, in my case the partittions i did were the same size just different file system, from fart32 to ext3, for me it worked fine without rebooting.
Sources:
eHow (Warning: spammy site)
Javascript to get the whole document width and height
by z3n on May.25, 2009, under Coding, Tips & Hints
Problem:
How to get document’s height and width, not only the view area or the window size, but the whole thing including the scrolling.
Solution:
There are some variants of this solution, because some browsers take this proprieties in a different way, however, here’s a little function i wrote able to return the right dimensions no matter what:
with (document.documentElement) {
var h=Math.max(clientHeight,scrollHeight);
var w=Math.max(clientWidth,scrollWidth);
}
there’s also the inner values, but they only work on certain browsers, this would be able to get the numbers you need on IE6+ , FF and mostly of the decent browsers, if you must have working on every browser check quirksmode. This will also return the highest value, meaning that if the page itself won’t fill client’s width/height, it will get the biggest value, perfect when you need to do a full page div or something like that.
Sources:
(13) Permission denied: /.htaccess pcfg_openfile: unable to check htaccess file
by z3n on May.25, 2009, under Tips & Hints
Problem:
All pages are 403 (fobidden), no matter what.
Solution:
There’s nothing wrong with apache, the file permissions are wrong, make sure that the folders that apache is trying to access are at least 755 (chmod 755), including the /home/ ones.