Monday, April 25, 2011

Instant Swap_space


Just a quick one here. Need swap? Not sure why you would if you have an awesome computer, but here's the method anyway. I've just tried this, and my computer crashed. I'm guessing that I don't really need swap, although I was intrigued at the idea that "you need swap if you want to be able to Suspend/Hibernate your computer". Anyways...

This method can be found here.

1) Create an empty file - didn't know you could to that!:
sudo dd if=/dev/zero of=/swap_file bs=1M count=1000
count=1000 can be replaced with whatever filesize you wish. It has also been noted that there is an optimum ratio for RAM/Swap space so don't make it too big as it might just do the opposite of what you want it to do. of= is essentially the location and name of the file, of=/home/person/swap_file is another example.

2) Change permissions so the file is safe from others:
sudo chown root:root /swap_file
sudo chmod 600 /swap_file

3) Tell the computer that you want this file to be swap space:
sudo mkswap /swap_file

4) Turn it on - that's what she said!:
sudo swapon /swap_file

Next is the steps to make it run on bootup. I wouldn't advise this unless you have tested the swap first, and know that it is working nicely with your system.

5) Open up /etc/fstab:
sudo gedit /etc/fstab

6) And whack this on the end:
/swap_file       none            swap    sw              0       0

So I thought that this was a nifty way to add swap space, much easier than partitioning a HDD - wouldn't be so hard if I had some free space on my HDD...I'll test out and see how my system runs. See ya!

Tuesday, April 19, 2011

Installing LibreOffice on Ubuntu 10.10


Making the change from OpenOffice and can't find another word processing (WP) program? Why not try LibreOffice!

It comes as no surprise that LibreOffice was my immediate choice when the last WP program failed to do me any good. Maybe it's my fault. Maybe I was just too ignorant in my installation and forgot something. I guess I can always go back...

What I'd like to quickly outline is how to install LibreOffice using a package downloaded from their site. This is probably the preferred way to do it as the program is not found in the repository and/or repositories suggested (not sure why). So again, this is basically just some reference material for me and anyone who needs a quick HowTo on the topic of today.

1) Download package
So, and you've probably already done this, go to http://www.libreoffice.org/download/ and download the most recent package for your computer. I'm on Ubuntu 10.10 so I downloaded the "Linux x86 (deb)".

Before I start, I'd just like to make a reference to where I got my information from http://ubuntuforums.org/showthread.php?t=1585017. I'm actually reading it as I write this...

2) Remove OpenOffice
Right. So while the ~143M file downloads, remove OpenOffice. It can be done several ways - hopefully you are familiar with those. I actually ran into a wall trying to use apt-get, so instead I just opened up the Synaptic Package Manager and removed it that way.

3) Extract file
Once download is complete. Open up the directory where it is located (Nautilus or bash) and extract it. If using bash enter this to extract files - will be different if the file you downloaded wasn't .tar.gz:

sudo tar -zxvf filename

3a) Rename the extracted folder "libreoffice"
This is not required but simply saves typing later on. Bring up bash and type:

sudo mv filename libreoffice

4) Install.
In bash, just use dpkg to install the packages. And so you don't have to continually re-enter the command for every file, use the wildcard symbol:

sudo dpkg -i ~/Desktop/libreoffice/DEBS/*.deb 

Remember to check your pathway, most likely will be different. This step may take a while, I didn't time it, I just went to sleep.

5) Install the menu icons.
Lastly, if you open up the "libreoffice" folder and then click on "DEBS", there should be another folder name "desktop-integration". There will be one .deb file in here and you simply want to install that. Again, make sure pathways are correct - I'm susceptible to pathway mutations.

sudo dpkg -i ~/Desktop/libreoffice/DEBS/desktop-integration/libreoffice3.3-debian-menus_3.3-9526_all.deb 

Now go check your "Applications" menu and if everything was done right, it should be under "Office"...YAY!

So go play, frolic in the fields of LibreOffice and don't be afraid to venture further, or even Tweet comments, I'm sure they'd like to hear em.

Before I go, I want to emphasis again where I got my information from, thankyou scouser73 on Ubuntuforums.org, thread here. I'd also just like to give some experience on LibreOffice already.

I haven't actually typed anything up yet, but the Zotero extension comes pre-installed (unless it was fetch from my Download folder while I was installing it...). I've tried adding references and there has been no hiccups as yet. Problems I was having with OpenOffice-Write was some weird thing where, if my computer went into stand-by, when I came back and logged in, if I tried to type something into my document (which I usually leave open), then it would crash. Very annoying. I will be testing that today and hopefully it doesn't crash in the lecture hall! Enjoy and post me your experience.

Saturday, April 2, 2011

Wgetting


Lately, I haven't exactly been spending enough time on my AMD laptop, traversing the Brisbane landscape with my trusty Samsung Netbook - what a joy! Not knowing where a power-point is, isn't a major issue now. But unfortunately, I end up spending much of my time on my netbook even when I get home. And the downside is that I just don't have the same processing power to do some real computer stuff - sshing, reading Ubuntu Documents (on a 15" screen is the only way), and listening to the radio!

In this quick blog, I'm just going to demonstrate how to Wget some stuff such that you don't download the same thing twice. Wget is a useful tool which can be used to download files from the web without the use of a browser. If you want to get an idea of it's power, just watch 'Social Network'. Basically it can be used to download whole websites and the number of different files that a website will contain. For example, you can download the files that makeup the Google website - the logo, the html, any animations, any javascript files etc (though I probably wouldn't try download all of Google...).

Wget is a simple program to use and should come with your Ubuntu distribution, if not, just get it from the Ubuntu Software Centre.

Open terminal (I'm assuming you're using a linux distro) and go to the folder where you want to save the downloaded files. Then invoke Wget. Invoking is simple - program url:

Wget http://www.aurl.com

This is without the use of any options. To see the options available, just type:

Wget --help

Now, I won't be going through them all, but I'm just going to detail those that are useful to me.

If my friend has a folder on his server that contains a number of files which I will need for a university assignment, and I want to download that folder to my computer, then I will need to do a recursive download. But I don't want to download anything else on his server, just everything below the folder of choice. So I will need to do a recursive download with 'no parent' - Wget jargon. Do it like this:

Wget -r -np http://www.myfriendsurl.com

All files will be downloaded to the directory that the terminal is currently in and Wget will neatly put them in a folder called 'www.myfriendsurl.com'.

Having fun yet? But you're annoyed that the pathway that it is being saved to, is too long to type aren't you? Well there is a solution! --cut-dirs. That's right!

So, I'm guessing your friend is a space-freak and keeps their server nice and tidy by using some sort of naming hierarchy which doesn't use a date or data genre structure! And now you're download from a site which is longer than 60 characters and looks like http://www.thesaferhaven.com/home/themonolounge/hinduphilosophy/yoyo-sponge-cake. What a nightmare! Well, what you do, is use --cut-dir to rid the extra directory listings that you will never need. Using:

Wget -r -np --cut-dirs=4 http://www.thesaferhaven.com/home/themonolounge/hinduphilosophy/yoyo-sponge-cake

--cut-dirs=4 will cut 4 of the folders off the download saving you clicking time and your sanity.

Now, when you go to the directory where you downloaded all these files, instead of having to click www.thesaferhaven.com > home > themonolounge > hinduphilosophy > yoyo-sponge-cake, you can just click www.thesaferhaven.com, and you will be at the files which you are interested in.

The last option I'd like to tell you about is the 'no clobber' option. All it does is tell Wget that you already have one of the files (which it is trying to download) on your computer, and it will stop Wget from downloading it. Use it like this:

wget -r -np -nc http://www.myfriendsurl.com

Of course, you must be in the same directory otherwise Wget won't see the files!

Too easy! In all honesty, Wget is more useful to those who build websites and want to download whole directories in their entirety. Wget is commonly used to download websites and mirror them from a home server. Something I need to learn more about...

Hope you enjoy this instalment of my Linux knowledge and write back to me on what I should learn next!