Back to a Walking Speed

May 7, 2010

Well the Firefox slow down has finally gotten out of hand.  I’ve installed Swiftfox, which is basically Firefox but supposedly optimized for speed.  If you want to try it then just do a Google search for Swiftfox, and click on just about any link of your choice.

In the previous post I provided a link that showed how to supposedly fix the problem.  More or less what it instructed you to do was disable IPv6 in Firefox.  Well this didn’t work for me (though it might for you so I suggest you try it anyway).  After realizing that this didn’t work I found another site that showed how to disable IPv6 system wide.  Here is what the site says to do;

First check to see if IPv6 is enabled. If the following returns 0 then it is, otherwise it’s not.

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If it is enabled the you need to run the following and then restart your system.

echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf

Just to be safe however, I installed Google Chrome anyway.  My system still freezes every now and then, but it’s no longer as bad as it used to be.  At this point I think that it’s something else (probably flash, who knows).

Another problem I’ve encountered is that Pidgin isn’t as responsive as it was back when I used 8.04.  But that could be due to the Facebook plugin, I’ve experienced this before so fixing it shouldn’t be too difficult.

Well my next post will most likely be about more problems I have with 10.04 (thank god this is a LTS, because it seems like the problems don’t stop).

EDIT: I totally forgot to mention what the tee command does.  It reads from standard in and writes to either standard out or a file.  When used with the -a flag it appends to the end of the designated file(s). Therefore, the following commands will have the same (overall) result.

echo "I can append to a file" >> my_file
echo "I can append to a file" | tee -a my_file

Similarly the same is true of the following.

echo "I can overwrite a file" > my_file
echo "I can overwrite a file" | tee my_file

Advertisements

In the /dev/null Zone

August 13, 2009

If you have read the comment from my post On my first Script, it was suggested that I use nohup firefox >& /dev/null & to solve my infinite loop problem.  Well I read up on the parts of this command and it seems that it should work (I have yet to try it, but should get around to it this weekend).  So it’s time to break it down for those of you who have never seen anything like this before.

Firstly, nohup allows a program to continue to run in the background even if the user logs out (or the terminal is closed).  However, this can cause ‘hanging’.  From what I understand this happens when your program produces some kind of output (standard or error) and you try to close the terminal (or log out I suppose).  But you are unable to because the system is still “working”.  Say you have a program called count which counts to 1,000,000,000.  Needless to say this will take a while and you would want to do other things while waiting for it to finish.  So you run nohup count, but you forget that count prints the numbers to standard output (the screen). Thus when you try to close the terminal you are unable to do so (whoops).

This is where /dev/null comes to the rescue (well partially, but we will get to that later).  /dev/null is basically a file that you can write to but not read, and anything written to it is automatically discarded (aka deleted or destroyed). Thus you could enter nohup count > /dev/null, so now all your numbers will be written to /dev/null and not the screen.

Now this is where things get a little “complicated”, but bear with me.  There are 3 differnet standard I/O streams.  STDIN (used for input, usually the keyboard), STDOUT (standard output to the screen), and STDERR (standard error).  By default the streams are numberd 0, 1, 2 repectively.  So the command 2>&1 will redirect standard error to standard output.  How is this useful at all you ask. Well here’s how.  nohup count > /dev/null 2>&1. The first part as you already know will redirect our output to /dev/null, but the second part makes sure that if there is any standard error that it will be redirected to standard output which is being directed to /dev/null (also knowns as the black hole).  Thus, we can finally let count run and be able to close the terminal with no worries.

I know this might have been a little lengthy, but it is a lot to cover.  I am sure there are things that I left out but the basics are there.


On my First Script

July 15, 2009

Well as promised it is time to explain parts of my script. Well I shall start at the beginning.  The !#/bin/bash tell the OS where the interpretor for the script can be found. The following line is just a place where most of the work will be done.  This should actually be changed to cd ~ if I were planning on sharning this script (which I am).

Now for the more “interesting” aspects.

ls -a | grep “^\.” > temp

This line will first list all the fils found in a directory (ls -a). Then it will find those that begin with a ‘.’ (dot) and print them to a file called temp.  This is done through the use of grep “^\.” grep works with regx, and in the one used here it will match ‘phrases’ that begin with a ‘.’ (dot).  Pretty much grep can do a lot of things (or so I have read) but they rely on regx so needless to say I am currently working on learning regx.  Anyway back to the code. After this I do a search to find a file called .myPw, this is where the password will be stored.  So if the file doesn’t exist we shall create it, along with a password to place into it.

After this I basically use some basic loops to test the user’s input to see if it matches the password.  I won’t talk about the loop structure since 1: this isn’t a tutorial on bash, and 2: it is easy enough to figure out from just reading the code.  I won’t explain what echo does, if you don’t know just click on the man link at the top of this blog and then click on echo.  It’s actually a pretty “simple” command.

One last thing, I would like to point out that after making the file temp I deleted it once I no longer needed it. This turns out to be somewhat optinal (I’ll explain in a moment), but I think it’s just “polite” to delete temporary files you put on someone else’s system.  Now for why this is optional.  The way the code is set up, if there already exist a file called temp it will overwrite it.  If however I had used

ls -a | grep “^\.” >> temp

It would append the output to the end of the file (in which case who knows what was in there before and how much you will have to seach through while looking for .myPw).  So there is a BIG difference between > and >>, both direct output to a file but in differnt fashions.