Thunderbird 3 mailbox ate my whole hard drive

by Craig Mayhew on Feb.28, 2010, under Guides/Fixes

Thunderbird 3 is awesome, I’ve only had one issue with it and that’s when it used up all the space on my primary drive. I thought it was odd but moved my thunderbird profile to it’s own drive. I realised the sent items just kept getting bigger literally as the minutes past. I opened my sent items to find it had duplicated every email about 25 times (and was still duplicating them) this gave me a sent items box that was fast approachiung 30GBs! I downloaded the thunderbird deduplication addon which is available here https://addons.mozilla.org/en-US/thunderbird/addon/956. It removed the duplicate emails but even after running a compact my sent items didn’t change size on disk. In the end I renamed the sent item files “Sent” and “Sent.msf” to “sent.damaged” and “Sent.msf.damaged” and Thunderbird downloaded a fresh copy. Then once I was sure the emails hadn’t been wiped out, I deleted the broken files completely.

So far, I haven’t had a repeat of this issue and I do not know what caused it. At a guess my Sent Items were corrupted somehow.

Leave a Comment : more...

phpuk2010

by Craig Mayhew on Feb.27, 2010, under Code, General/Techie

Back from phpuk2010 and feeling like I really want to contribute to some open source projects! I’ll summarize the main points I took away from each of the talks I attended.

Josh Holmes – Keynote talk – The Lost Art of Simplicity:

Josh talked about how overcomplicating things seems to happen all to often and grave a great example of a man simply trying to pluck an apple from a tree. He introduced me to “the truck factor” which I knew by a different name but this one has a much better ing to it :)

Stefan Priebsch – AntiPHPatterns:

I took alot away from this talk. Stefan had some great usage cases where singletons are bad and I have come across similar problems in my own code. I still think are cases where it makes sense and they are great for chucking an example together, but for production code and unit testing they are a bit of a nightmare.

He also pointed out that using global within a class is a real pain for unit testing too and ideally you should use the class __construct() function to get any required arrays/objects from outside the class (dependencies).

cakePHP took a bit of bashing during the talk due to it’s insanely high number of globals. CakePHP wasn’t alone either it seems a great many open source PHP projects are taking steps to fix there high use of globals and singletons.

Remo Biagioni – Database Optimization:

This was a story about how a small side projected grew into a multi server nightmare in just a few short years. He gave some good examples of how not to manage your databases and some equelly good examples of how to speed up different aspects of the database server. In short:

  1. Reduce the number of queries as much as possible by merging them together.
  2. INSERT IGNORES are faster than a SELECT query and then a possible a INSERT query.
  3. Move the queue to memory
  4. Use LOW_PRIORITY on DELETEs that don’t matter.
  5. memcached is awesome, if your not using memcached or something like it then you really should.
  6. If possible, avoid; LIKE, GROUP BY, DISTINCT as these are all slow.
  7. Use something like beanstalked to manage the queue.
  8. They used an MD5 hash (calculated in php) as a primary/unique row key. This is faster than using AUTO_INCREMENT to manage the primary keys. Note: you could use sha1() for even less chance of a duplicate key.

HA Proxy, Google’s  MMM, NoSQL and CouchDB all got a mention near the end and during question time.

Kore Nordmann – CouchDB & PHPillow:

This talk introduced a completely new concept to me and got me excited about a new kind of database. CouchDB is different, very different to relational databases such a MySQL. Firstly it uses http to connect to it! This opens up immediate possibilities and new security concerns but means you can make a database connection within javascript in the users browser! There is no schema in CouchDB as the “rows” are infact JSON objects. This means each row doesn’t have to follow any kind of set rules, they could have a different number of “columns” or have very different data in each “column” such as a another object or multi dimensional array. Your probably thinking the same thing I was at this point, “do we have indexes in CouchDB? and how the hell would they work”. Well, there are indexes in CouchDB and they are very flexible, but they are harder to implemenet than in say MySQL. Indexes in CouchDB are called views. These views exist as code that is run to create e.g. a btree index. The great part is, you write the code for the view! and you can write it in javascript (or other languages with the help of plugins). This gives you far more direct control of your indexes and should result in you having a far better understanding of your databases internal workings. PHPillow is the framework for implementing coucheDB within PHP.

Juliette Folmer – Regex-fu:

Although there’s not alot to blog about from the regex talk, you really had to be there… Two things I did pick up was that PCRE is faster than POSIX and the php documentation for it is here http://php.net/manual/en/book.pcre.php. Also the built in and blindingly fast PHP Filter extension is often forgotten or not known about and the documentation is here http://www.php.net/manual/en/intro.filter.php.

Damien Seguy – PHP Code Audits:

Damien gave a good talk on security in PHP, he covered the usual stuff about REGISTER_GLOBALS being a terrible idea on any system, production or development. But went into far more detail on how he searches for security issues in a short space of time so that you can quickly audit your own code. The bottom line is search the php code with the help of a tokenizer for php injection in places that use backticks require/include etc and eval. Search the codes notes for swearing and keywords such as “todo”.

A good tip for finding redundent code he gave was search for variables that only appear once. Some of these will be global variables but some of them may well lead you to old or troubling code.

Tools he recommended were Groogle, Reviewboard, Rietvold and Smartbear.

Leave a Comment :, , , , more...

Greasemonkey scripts won’t update on Ubuntu

by Craig Mayhew on Feb.07, 2010, under Guides/Fixes, Linux/Ubuntu

The usual reason for not being able to update the scripts is that your permissions are wrong in your Firefox folder. Your Grease Monkey scripts will be in your firefox folder. The default place for this is (please substitute {username} for your actual Ubuntu user name):

cd /home/{username}/.mozilla/firefox/gm_scripts/

You need to make sure you are the owner of this folder. This command will make sure you are. Again please substitute whats inside the {} brackets.

chown -R {username}:{usergroup} /home/{username}/.mozilla/firefox/gm_scripts

If that still fails to fix the problem, then you also need to make sure you have write permissions on your firefox settings folder.

chmod -R 755 /home/{username}/.mozilla/firefox/gm_scripts
Leave a Comment :, , , more...

Prevent second life “auto log out” after idle

by Craig Mayhew on Feb.05, 2010, under Guides/Fixes

The seond life viewer has “File, Edit, View, World, Tools and Help.” along the top.

If you can’t see Advanced, press Ctrl, Alt and D together – that will bring up the Advanced option.

Click on Advanced. Click ‘Character’. From the next sub-menu, click on ‘Character Tests’. Finally, click on ‘Go Away/AFK When Idle’. Make sure this doesn;t have an X next to it.

Leave a Comment : more...

Fix Google Earth Error: ./libstdc++.so.6: version `GLIBCXX_3.4.9′ not found (required by ./libgoogleearth_lib.so)

by Craig Mayhew on Jan.26, 2010, under Guides/Fixes

After upgrading to Google Earth 5.1 I now get the following error when starting from command line. Error: ./libstdc++.so.6: version `GLIBCXX_3.4.9′ not found (required by ./libgoogleearth_lib.so).

It’s also worth noting that if I click the Google Earth icon it just sits there with no errors.

To fix this simply remove or rename libstdc++.so.6 and libgcc_s.so.1 in the installation directory.

For some people this will be:

cd /opt/google-earth/

For others (me included) this will be:

cd ~/google-earth/

To rename the files:

sudo mv libstdc++.so.6 libstdc++.so.6.orig
sudo mv libgcc_s.so.1 libgcc_s.so.1.orig

Now Google Earth should start without the error!

Leave a Comment :, more...

Fusion Power

by Craig Mayhew on Jan.21, 2010, under General

Fusion power should finally fulfill the promise of cheap and abundant electricity. Current worldwide energy supplies (stuff we haven’t yet pulled out of the ground) are like so:

Oil: 43 years
Uranium: ~150 years
Gas: 167 years
Coal: 417 years

This is not great, coal fuel is the longest lasting but also the dirtiest fuel. It’s also worth noting that these fossil fuels can be in very unstable countries. Only 1% of the worlds oil is located within Europe for instance. What we need is fusion, a completely different kind of power source.

So what does a fusion reactor need as fuel?

You need some Deuterium and some Tritium. Deuterium can be harvested from sea water and tritium is made from Lithium. When heated to 150 million degrees, the fusion of Deuterium and Tritium gives us Helium, a Neutron and loads of energy. That spare neutron can then be fused with Lithium to make more Tritium. So the main fuels are Deuterium and Lithium, with a little tritium to get the whole process started.

We have enough Lithium on Earth to support the entire human races energy needs for 30 million years.

What progress have we made so far? JET has been running since 1983, ITER will be functional in 2018 and DEMO will begin pumping energy into the grid some time in the 2030’s.

What can the average man do to make this technology happen faster?

Learn more about and teach others about the merits of fusion technology. There is a common misconception that fusion will create hazardous waste like our current nuclear reactors. It will create some but there will be far less of it and it will become harmless within decades as opposed to the hundreds of years for current nuclear power stations. I can’t stress enough that fusion reactors are completely different to the fission reactors that people are used to, in the way they work, safety and the waste they would produce.

For an example of misinformation, here is a Greenpeace article on the matter that doesn’t cite any sources http://www.greenpeace.org/international/press/releases/ITERprojectFrance. They state “Fusion energy – if it would ever operate – would create a serious waste problem, would emit large amounts of radioactive material and could be used to produce materials for nuclear weapons”. I usually have a lot of respect for Greenpeace and the good they do, but they really dropped the ball on this one.

Sources:
Steven Cowley on TED.com
ITER website
ITER Presentation on Nuclear Waste
ITER and beyond
Fossil Fuels – Oil
Fossil Fuels – Natural Gas
Fossil Fuels – Coal

1 Comment :, , more...

The Environmental Impact of Inefficient HTML Code

by Craig Mayhew on Jan.18, 2010, under General/Techie

These factors can be used to show the environmental and financial impact of inefficient HTML.

  1. A core 2 duo e6600 uses ~30 watts more when under single core heavy load than when it is idle. 30 watts = 0.03 kWh.
  2. Assuming 10p/kWh then 1 computer second costs 0.00008333 pence.
  3. Assuming 0.54055 Kg of CO2 emissions per kWh for the average UK grid electricity then 1 second of additional computer processing time creates 0.0045g of CO2
  4. 3600 seconds in an hour

Financial Cost = (pencePerkWh/3600) * 0.03 * renderSecondsPerPageView * pageViews

Examples: (using 1 million page views, each taking 0.25 seconds)

Financial Cost = (10/3600) * 0.03 * 0.25 * 1000000 = 20 pence
CO2 Emmissions = (0.54055/3600) * 0.03 * 0.25 * 1000000 = 1.12Kg of CO2

Leave a Comment :, more...

Speed up Failed Virgin Media DNS lookups

by Craig Mayhew on Jan.15, 2010, under General

As a Virgin Media customer I’m not a fan of the new page that now appears when I misspell a domain name. This is mostly because it takes longer to load the Virgin Media branded Google results page than a simple “Server not found” error. In a quest to rid myself of the slower page I found the opt-out page:

https://my.virginmedia.com/advancederrorsearch/settings

Simply select “No – I would not like to use the advanced network error search” and your back to the faster error pages!

Leave a Comment more...

Ubuntu 9.10 – There was an error during the CUPS operation: ‘httpConnectionEncrypt failed’.

by Craig Mayhew on Jan.07, 2010, under General

CUPS had me chasing around for a while to fix this issue. Whenever I tried to print I realized there were no printers and going to “System -> Administration -> Printing” caused the error “There was an error during the CUPS operation: ‘httpConnectionEncrypt failed’” when I tried to connect to the local CUPS service. The “/etc/init.d/cups” file had completely disappeared and reinstalling the cups package didn’t fix it! In the end I marked the cups package for “complete removal” which also removes the configuration files. After this I then reinstalled CUPS, “/etc/init.d/cups” reappeared and it worked once again. Unfortunately I had to reinstall my printers on this machine.

Steps were:

  1. Complete removal of CUPS package including the configuration files
  2. Reinstall the CUPS package.
  3. Start the CUPS service with “sudo /etc/init.d/cups restart” in the terminal.
  4. Reinstall your printers
  5. Print stuff!
1 Comment :, , more...

Ubuntu CPU/GPU Temperature Sensor

by Craig Mayhew on Jan.01, 2010, under General

Run this code to install the sensor package and the applet.

sudo apt-get install libsensors3 sensors-applet

Then run:

sudo sensors-detect

This will prob your hardware for sensors.

Next, add the applet to your ubuntu bar by right clicking on the bar and clicking “Add to Panel”. Finally add the applet called “Computer Temperature Monitor”.

You should now have a temperature indicator in your ubuntu bar! There are further options if you right click on the indicator and edit “preferences”.

Leave a Comment more...

Visit our friends!

A few highly recommended friends...