How to write an xorg.conf file for linux
For those who don't know what an 'xorg.conf' file is, it's basically the file in Linux operating systems that tells the system what graphics card, mouse, keyboard you have, and what settings to use for them. There are a few GUIs for making these, but most of them do a terrible job, and add bloat.
My xorg.conf is clean, and therefore, easy to modify/change.
I've used the same xorg.conf for a long time, across 4 different machines (with very minor modifications depending on resolution required etc..)
It'll save a lot of time to just write it once, and reuse it. All I do is install the nvidia driver and copy over my xorg.conf and reboot, and you have a perfect working system.
This file should work for any nVidia graphics card (the names of my monitor and model of graphics card are just labels and don't matter) and will work with just the minor changes mentioned below.
If you have a laptop with nVidia graphics, and would like a perfectly configured xorg.conf for linux, you might want to just cheat and use my custom xorg.conf
Key features:
trackpad with vertical scrolling enabled.
USB connected mice will have forward and back buttons enabled in firefox.
nVidia logo at logon is removed.
Refresh rate is correctly reported as 60Hz instead of 50Hz with
Option "DynamicTwinView" "FALSE"
All required modules for Compiz Fusion to work. (no more borderless windows!)
DPMS adds Energy Star power saving functions for your monitor.
You can use any of the following (put in ServerLayout)
Option "StandbyTime" "10"You'll just have to change your desired resolution and refresh rate (1280x800_60 in mine)
Option "SuspendTime" "20"
Option "OffTime" "30"
Also, note, if you're using a desktop with multiple DVI ports, you'll need to specify (DPF for Digital Flat Panel) under Screen
Option "metamodes" "DFP-1: nvidia-auto-select +0+0"
Anyway, here's my xorg)
# Xorg SyXbiT - Dell XPS m1330 w/ nVidia GeForce 8400M GS
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0"
InputDevice "Mouse0"
InputDevice "Touchpad"
Option "OffTime" "30"
EndSection
Section "Files"
EndSection
Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
EndSection
Section "ServerFlags"
Option "Xinerama" "0"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "Buttons" "7"
Option "ButtonMapping" "1 2 3 6 7"
Option "ZAxisMapping" "4 5"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "SHMConfig" "on"
EndSection
Section "InputDevice"
Identifier "Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizEdgeScroll" "0"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Dell"
ModelName "CMO LED"
HorizSync 30.0 - 75.0
VertRefresh 60.0
#DPMS for Energy Star power saving
Option "DPMS" "TRUE"
#Fix refresh rate bug
Option "DynamicTwinView" "FALSE"
EndSection
Section "Device"
Identifier "8400M GS"
Driver "nvidia"
Option "NoLogo" "true"
VendorName "NVIDIA Corporation"
BoardName "GeForce 8400M GS"
Option "DPMS"
EndSection
Section "Screen"
Identifier "Screen0"
Device "8400M GS"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "1280x800_60 +0+0"
EndSection
my laptop purchasing history
Those of you who know me well, know I'm rather good at getting top of the line stuff (with regards to technology) for cheap.
I've been through my fair share of laptops over the last couple of years.
2 years ago I bought a Dell Inspiron e1505.
I paid about $1200 for it. It had an Intel Core Duo 2.0Ghz. with 2GB of RAM, and a 120GB HD. It had the highest res. screen (1680*1050) and the best wireless card. The specs were very high for the time. There were just two problems:
It had an ATI graphics card (which had/has very bad driver support in Linux) and it was quite bulky (15.4")
I decided I wanted a laptop that was smaller and had an nVidia graphics card. I also wanted a laptop with a pretty good graphics card, so I could also play games.
I ended up getting an Asus A8Jm. It was fantastic.
The chassis wasn't brilliant, and the screen wasn't that bright, but it was brilliant in every other regard. Unfortunately, It was a little more expensive (I paid $1350) and was not as high spec'd as the Dell. It had just 1GB of RAM, a 1.83 Core Duo with 'only' a 100GB hard drive. But, the best part was the graphics card. It had a 512MB nVidia GeForce 7600. Simply unheard of in laptops (especially in 14.1" laptops). Another benefit was the number of ports. It had 5 USB ports, both VGA and DVI out, IR, a card reader and the other normal stuff.
I was very happy with my purchase, and kept it for about a year. I was a little miffed that it wasn't 64bit compatible and I'd considered just buying a Core 2 Duo and replacing it, but Asus never released a BIOS update that enabled support for it.
I sold it, and borrowed an old Apple Powerbook G4 from work while I bought something to replace it.
As luck would have it, I couple of days after selling the Asus, I happened to be browsing a site that posted a bunch of coupon codes and employee-level pricing for IBM (Lenovo) Thinkpads. I was quite quick to the mark, and purchased one.
I, of course, purchased their top of the line model, the Thinkpad T61 (They do offer a T61P with a better video card, but not in the 14.1" widescreen like I wanted).
I'd wanted a Thinkpad for a while, but they were always more expensive than other comparably spec'd machines. This was my chance. They delayed my shipping, as they were in short supply of lots of parts. I got a free 6 cell battery for my suffering :)
It was equiped with the latest chipset from Intel: Santa Rosa, and Intel's new 4965 802.11 a/b/g/n wireless card. I got a slightly larger 160GB hard drive (which was the most available at the time) and 2GB of RAM again. It was just as good as I was hoping. The build quality was impeccable. The chassis was strong, and the keyboard was stiff. It was the perfect business machine.
Unfortunately, because Thinkpad's are aimed at businessmen, it didn't have a card reader, but that really didn't bother me.
I didn't have a desktop at the time, so I bought a dock for it. Also, linux support for Santa Rosa laptops was flakey, so I had to compile all sorts of stuff to get it working. (sound, wireless and 3d acceleration were broken out of the box)
In my haste to purchase the Thinkpad, I'd not realized the implications of only getting an extended battery. I figured I'd want great battery life, and didn't think the added bulk would bother me. It did.
Despite being fairly thin, the extended battery added bulk and weight.
Then, Black Friday came along and I bought all the parts to build myself a desktop.
As I posted before, here and here. Now I didn't really need my laptop to be my only machine, so I figured I should just get something smaller and lighter. The problem is, the smaller the laptop, usually the more expensive.
Before finding an alternative, I put up my Thinkpad for sale on Craigslist, and sold it (for more than i paid, as I'd bought it at employee pricing) and just used my desktop.
Not soon after, I spotted a deal for Dell's latest ultra portable laptop, their XPS (their gaming line) m1330.
I know, I know, I went from a Thinkpad to a Dell, but this Dell is actually manufactured by Samsung. The build quality is surprisingly good.
In all reality, this machine is the machine that people should buy instead of the ridiculously stupid and expensive Apple Macbook Air.
The Macbook Air weighs 3 lbs, which sounds amazing, BUT, Apple has made so many compromises that they should be ashamed of themselves.
How dare they show off for having a thinner laptop, when it has less of EVERYTHING.
It would be like Ford making a car with a 1 cylinder, 1 litre engine with a top speed of 20mph, and then boasting that it was the most fuel efficient care ever. WHO CARES. It's just not practical. Apple should feel dishonest for comparing their thin piece of junk to thicker, more capable laptops.
:)
Anyway, this Dell actually weighs in at under 4 lbs, and also has an LED screen.
So, lets get this straight. I paid under $1000 for it:
It has 4GB of RAM (compared to the Air's 2GB),
a 250GB 5400RPM hard drive (compared to the Air's 80GB, slower 4200RPM),
a dedicated nVidia GeForce 8400 M GS graphics card (compared to the Air's onboard X3100 piece of junk).
Port wise, it has 2 USB ports compared to the Air's 1
An Ethernet port (Air doesn't have one without an extra adaptor)
An HDMI video/audio out port
2 headphone ports (compared to the Air's 1)
Microphone port and, a DVD drive (yep, the Air doesn't have one - that's how it's so thin/light)
An SD/MS card reader (Air has nothing!)
It also has a 2.2Ghz Core2 Duo, compared to the Air's 1.6Ghz)
So, It's better in every respect, costs half the price, and actually has a DVD drive.
Unfortunately, Apple has so many people obsessed with their products that people will just buy them anyway. I'm just waiting for the time I walk into the library and see dozens of them owned by ignorant freshman!
I suppose for the average user, the more compelling reason is to use OS X, which is leaps and bounds beyond the disgrace that is Vista.
Since I run Linux anyway, there seems little point in paying the stupid Apple premium on hardware.
explanation of some optimizations done at compile time
I got a couple of complaints that recent posts have been aimed at techie people.
In my last post, I explained a little about gcc, which is the C compiler used in linux distributions (and some BSD)
I'll give some examples.
I mentioned that if you compile for your CPU, you can include SSE, which are special instruction sets that the CPU has to speed up certain processes. Here's a very basic explanation.
Imagine your CPU does the basic functions. It can add numbers together, subtract, multiply, divide etc..
But what does it do when you need to calculate the square root, or find prime numbers, or find the multiples of a certain number. generally, the compiler will convert such statements (from source code) into something the computer CAN do.
For example, there are many ways to calculate the square root of a number. Some involve doing lots of multiplies and divides, and take a long time. For this reason, if the CPU maker knows that a certain command is likely to be used frequently, they'll build an extra part on the CPU that basically has just that function, and does it extremely quickly.
So, in the case of square root, if Intel knew that certain programs used them all the time, they'd have a special square root instruction that would do square roots.
The problem is, since Microsoft has a monopoly on PCs, and they want Windows do work on old and new CPUs, they can't include any of these special instructions that would work on newer CPUs.
The end result, companies build their binary (the code that a computer runs) using very few optimizations, as that's the safest way, as it will be supported on more hardware.
Imagine Firefox only working on a Core 2 Duo CPU or above....
The benefit of compiling your own programs then, is that it can use all the new fancy things your new CPU has (and not the ones you don't).
Next comes Loop unrolling.
It is very common for computer programs to have loops.
Imagine you need to do something a certain number of times
The source code would look something like this.
for(i=0;i<=10;i++)
{
doSomething();
}
So, you have your current position in the loop declared and instantiated as '0' and you increase by '1' until you reach '10'
This program will run the function 'doSomething()' 10 times
You start out with i=0. you then check that it's equal to or less than 10, increment it, and run the function. You then start over (i will equal 2 on the 2nd loop, and so on). This happens until you check the value of i, and it's greater than 10 (then it will quit out of the loop, and continue after that).
A quicker way of doing this would be to just write it all out.
Obviously in certain situations (like when you're asking for user input) you don't know how many times you want to do something, but in this case, it's a predetermined 10 times.
So, why not write it out like this
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
doSomething();
They're both do the exact same thing. The latter is optimized for speed, and the former is optimized for filesize.
This should explain the previous post about compiling firefox.
can firefox be improved just by recompiling ?
I took an Engineering class a year ago that was all about compilers and Computer Architecture.
Using GCC, (which used to stand for GNU C Compiler, but now stands for GNU Compiler Collection, as it does more than just compile C) a C compiler, you're able to do much more than merely compile.
The most interesting for me, is the optimizations.
When GCC Compiles a C program, depending on the settings you choose, you can optimize for the end binary file size, or for speed. Surprisingly, Mozilla have optimized for size. I don't see why you'd care if you firefox executable was 5MB or 10MB, but apparently, they do.
Mozilla uses "gcc -O"
I chose to use "gcc -O3" and the speed improvements are quite obvious.
From a compiler perspective, speed optimizations include loop unrolling, as well as architecture specific SSE's (among other things).
I wasn't the first one to think of this, however.
If you're running Windows Linux, you can download Swiftfox and those guys have done it for you. You just download the executable based on your CPU. They have versions optimized for AMD, Intel etc..
Also available is swiftweasel
For those who don't know the difference, despite being open source, firefox uses copyrighted images. Since certain linux distributions are against including anything that is not completely open and free some of them -namely debian, recompile the firefox source code, using only free artwork, and rename it iceweasel. So, on linux, you combine both situations. The free artwork, and the speed optimizations, giving you swiftfox.
I'm currently running Firefox 3.0 beta2, and the improvement is quite substantial, and I've yet to have it crash despite it being 'beta.'
I'd recommend anyone using firefox try out one of the aforementioned optimized builds
A guide to help geeks punch
I came across this article that was explaining how to win a fist fight (seems like it was aimed at geeks.
Anyway, it showed 3 pictures that should help you form the correct fist.
I thought it was funny enough to repost.
Isn't it hilarious?
I especially like the middle one.
Bill Gates admits Vista sucks
watch the 10 second clip here
I must say, as much as I hate most microsoft things (except Office), I do like Bill Gates.
It's a shame Steve Ballmer will be taking over.
In the video, he's asked what product in the last 5 years did not receive enough polish (bug fixing).
He very openly replied "Ask me when we launch our next OS, and I'll be more inclined to give you a blunt answer."
He's not only admitting that Vista sucked, but he's also saying that he's not allowed to officially admit their mistake until they have a replacement.
priceless :)
So, if they keep saying Vista is great, and then the very second that they release the next version (currently codenamed Windows 7), they say Vista sucked, what should that do for our trust of Microsoft?
review of Google's Mobile OS: Android
Unless you've been living under a rock, or perhaps, aren't interested in new and cool technologies, you must have heard of the iPhone.
The iPhone is a fantastic piece of technology, that goes FAR beyond microsoft's very slowly improving Windows Mobile OS.
The iPhone hardware is fantastic, and the software is running a Darwin 9 kernel (same as Leopard). The biggest problem is that Apple has become very greedy.
They make AT+T pay them 10% of every iPhone users' bill.
They also have been extremely against anyone customizing, or modifying the interface, or adding apps. Quite ridiculous, when you consider the fact that most of the people who are willing to blow that much money on a tech device want to fiddle with it.
The other problem is that the iPhone is tied down to AT+T, which has a pathetic 3G network (and the iPhone runs on the ancient EDGE network).
In comes Google with its mobile Operating System: Android.
Here's the home screen.
Android has been in the works for at least 2 1/2 years, and runs on the latest 2.6.23 linux kernel.
proof can be seen in the screenshot, where I'm running an emulator, and accessing the Android shell through my terminal.
Also, it uses the open source webkit rendering engine. (same as used by Safari). I've already discussed webkit's origins from Linux's KDE KHTML here Layout Engine
The SDK (Software Development Kit) is pretty good. It lacks some documentation, but has lots of good examples. The fact that it runs linux also helps for those of us who prefer that platform for coding on anyway.
It seems to be almost a blend of the iPhone and Windows Mobile.
The Today Screen is like WM, yet the core aim of the project is more like that of the iPhone.
It has a good contacts list.
It's not fancy with the graphics, but it's perfectly functional, unlike WM, that still requires either an accurately aimed stylus, or a separate application such as PocketCM.
It also, obviously has google Maps, and an email client.
Overall, I think my predictions should be obvious.
It will be an iPhone for the masses.
If you like the iPhone, but are a cheap-skate,
If you like the iPhone but you hate AT+T,
If you like the iPhone, but you hate Apple's greedy/proprietary-ness,
If you love all things Google,
If you love Linux/Open Source stuff,
Then android is for you.
Despite Steve Ballmer, and his useless counter arguments (like actually daring to defend Vista), there is no stopping Google, or Android.
I'm sure by 2009 all the tech guys will be running around with Android. (I personally will have one in mid-2008)
Best thing is, I'll only have to upgrade my phone if I want better hardware. All the software updates will be free, and I'll be able to program my own stuff too, in Java......
Review of Brasero 0.70: gnome burning software
Built on GTK+ 2, the burning program Brasero is now part of the GNOME project.
Upon opening, it gives you a great, unbloated (cough, cough Nero) menu
It easily lets you see past projects, to quickly let you re-burn them.
The program is split into 4 parts.
Audio Project, Data Project, Disc Copy, Burn Image. No junk, and no fluff like PC burning software.
An old version is included in Gutsy, as 0.70 came out last week. It is already available if you are running Hardy (Ubuntu 8.04 LTS)
The easiest way to get it is to just download the source and compile
as usual.
It saves problems if you get the dependencies.
sudo apt-get build-dep brasero
then you just browse to the DIR and do the usual
./configure
make
sudo make install
Just make sure to remove the old version of brasero if you installed it (sudo apt-get remove brasero)
For too long people have recommended using the qt based burning program k3b. Finally now, with latest update do we get a program that does everything most people will need in a clean, efficient program with no bloat. k3b still does extra stuff, but the interface is much more cluttered. All I need is a basic program with an attractive interface.
Now, with 0.70 the windows when you transition between windows everything is readable, and the windows aren't too small.
This is similar to the program I used to like when I used to use windows, CopyToDVD (also a great, efficient burning program)
I'd consider it a must have for anyone running a GNOME desktop.
It even lets you preview sound/video files before you burn them.
how to fix an annoying firefox bug
I know a lot of people who would notice firefox bugs, but, as they aren't coders, don't do anything about it.
There is another way. The beauty of firefox's 'about:config'
Think of it as a windows registry. You can enable/disable and modify many of the browsers features without coding or compiling.
I was having a pretty annoying bug in firefox.
When my mouse in in the bottom left hand of the the screen, a right click would switch page direction. REALLY ANNOYING.
I'm not sure the cause. when you right click, the last option is 'switch page direction,' and it seems to get selected by just right clicking when your cursor is in the bottom right corner.
so, to fix this:
Type "about:config" into the address bar.
In the "Filter:" text box, type "bidi"
double click on the first entry (should be "bidi.browser.ui")
This should change the value to 'false'
the restart firefox, and that option will no longer be available!
It's just an option for right-to-left languages anyway, which most won't need.
There are lots of things you can fix in about:config.
The best thing is, if you screw something up, just delete your profile, and create a new one (although it's probably best to just make a backup of your profile first, as your profile may have useful bookmarks etc..)
While I'm at it, I'll share another cool tip.
Remember how the older versions of firefox had just one close tab button?
I happened to prefer this, rather than separate close buttons on each tab.
to change this
filter:browser.tabs.closeButtons
value 1=default
value 2=no close buttons (funny, as you can close tabs with CTRL-W, and this will confuse people)
value 3=old firefox style.
remove the 'go' button that no one uses anyway
filter:browser.urlbar.hideGoButton
set to true.
Vista SP1 to lie about RAM usage. Deliberately!
Most somewhat techie users know all about Microsoft and their recent Vista disaster.
One of the biggest problems is that they have about 16 different versions of it, and the average users doesn't know which one to get.
They have
Vista Basic
Vista Home Premium
Vista Business
Vista Enterprise
Vista Ultimate
(they also have a starter edition, and 'N' versions that they sell abroad)
That's not all. Each version comes with a choice of either 32 bit, or 64 bit.
Basically 64 bit should be a bit faster, more stable, have improved security and, more importantly, they can address a full 4GB of RAM (and way more than that).
Because of the way binary works, the most RAM an operating system can use is 2^bits.
In a 32bit OS it's 2^32, which ends up being 4GB (although most windows machines max out at around 3GB). Unlike Apple, they've been unable to combine both editions, letting the OS take care of bit problems. Because of this, almost every copy of vista sold is 32bit, which can't use more than about 3.2GB. This used to be fine, but now that RAM is so cheap (I bought 4GB of RAM for my desktop for $80. At that price, does it really make sense to get any less?)
The issue is deeper though. Computer manufacturers want to boast of new machines that are faster and have more memory than their predecessors. The problem is, what good does more memory do you when your OS can't use it.
If you right click on "My Computer" and go to properties, it will show the amount of RAM that your computer can see. This is perfectly fine, but sometimes the ignorant consumer buys 4GB of RAM, and thinks there is a problem when their OS only reports 3GB.
So, what does the richest company in the world do about it?
Fix the problem at the core?
Enforce manufacturers to use 64bit?
nope. They just have their OS lie about it.
Starting next month, with the release of the first Service Pack for Vista, going to the properties of "My Computer" will show you how much RAM is actually installed on your computer, regardless of whether Vista can actually even use it.
Isn't this despicable? Now there will be even more clueless people who will be upgrading without any benefits.
Does Microsoft ever get anything right?
The only good thing ever to come out of Redmond is Office (Office 2007 is great, but I'm just fine using OpenOffice.org)
I personally am running the 64bit version of Ubuntu.
Here's a link detailing some of the other changes Microsoft are planning.
http://www.ghacks.net/2007/12/10/windows-vista-sp1-guides-for-it-professionals/
OpenOffice goes online!
Gael Duval, the creator of Mandriva and now CEO of Ulteo (ironically Ulteo is based on Debian, and not Mandriva, or any other RPM based distro) has taken the open source OOo (OpenOffice.org) and put it online. This takes googledocs (formerly Writely) and takes it several steps further.
All it requires is relatively up to date web browser and a JVM (Java Virtual Machine)
Fortunately, OOo is pretty much identical to its desktop counterpart, which gives it way more features than its competitors, that have built (from the ground up) very limited web based (usually ajax or flash) Office imitations.
you can sign up at www.ulteo.com/home/ooo
It is a shame that Duval chose OOo, as even when running on a local machine, it's a bit bloated. Ideally they could have used Abiword (a very light, yet still good word processor), but I'm sure the fact that OOo has java all over it made this port possible.
In case anyone is wondering why this would be useful...
Imagine you have a laptop, a desktop, a work computer, and you sometimes travel, and use random computers.
This way, you store your documents online, and they're all accessible from anywhere with a web browser. It's kinda similar to how web based email took over from POP and IMAP for most non business users.
MS Vista pirated half as much as Windows XP
It's true, Steve Ballmer (#2 at Microsoft after Bill Gates) has twisted the figures yet again!
Apparently, Vista is being pirated half as much as Windows XP.
Obviously this can be interpreted in one of two ways. Can you guess in which way Steve chose to interpret it?
"..Microsoft claims the sharp dip in piracy is due to Vista's amped up authentication system, which it says is a 'proven and effective way to combat piracy.'.." (taken from engadget.com)
Of course, anyone who knows anything about computers knows that Vista is a complete botch-up, and a disaster 6-7 years in the making (yup, that pile of deuce took over 6 years to make).
There's proof of work being done on it as early as in 2000.
It was originally expected to ship sometime late in 2003. Can you believe it! It was delayed over 3 years. Now, this isn't some po'dunk company with lack of funding, or some actual valid excuse. They just made so many incorrect design decisions, that they had to keep starting over.
So, to answer the question and title of this post, I'll use the best comparison I can think of.
Fords are stolen half as much as Hondas, therefore one can conclude that Ford must have much better anti-theft security.......
Get the point?
Within its first month, 20 million copies of Vista were sold, an increase from the 17 million sales of XP within its first two months in October 2001, five years earlier.
Does this not seem funny? With the massive increase in the number of computers in each household (my household had 1 when XP came out. now it has 7).
It's because of this that I recommend all my friends get a Mac. Sure, they're a little more expensive, but it runs on a Unix derivative BSD kernel that is super stable and secure.
I use a mac at work, and do like it, but I prefer the flexibility of a GNU/Linux system, that'll run on my custom built computers. Still, GNU/Linux is far from being easy enough for me to recommend to your average Joe. Then I'd just be their free tech support for years to come!
My advice. Get a mac. If you need windows, just stick with XP for as long as you can. Despite Microsoft not officially admitting the problem, I'm sure they are aware that at least everyone else hates it, and are probably rushing out the next version codenamed Windows 7. I think the next windows is Microsoft's last shot. If they botch that up, they can kiss goodbye their market dominance, as there will be many more options by 2010. Apple will probably have OS X 10.7, there will be Ubuntu 10.4, Open Solaris: Project Indiana. FreeBSD 9, Fedora 13 etc.. All of which are becoming easier to use. Not to mention the recent gOS and EeePC stuff going on.
And, to end, an actual picture of Bill Gates showing off the latest version of windows in a press conference as it crashes :)
Windows vs Linux Benchmarks with Matlab

I finally got around to getting Matlab 2007b (7.5) to work in Linux.
It's not overly difficult, but it certainly isn't the double-click the .exe we're all used to ;)
For it to work in Ubuntu 7.10 (Gutsy), I had to do the following
sudo mkdir /usr/local/matlab75
sudo cp license.dat /usr/local/matlab75/license.dat
sudo sh /media/cdrom/install
#tell it the location of your matlab dir
/usr/local/matlab75
#select arch and options
sudo sh /usr/local/matlab75/bin/scripts/matlab
#It will now work if you're using the metacity windows manager, but if you're running compiz
gksudo gedit /usr/local/matlab75/bin/matlab
#add the following line directly after the '#!/bin/sh'
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
#note, java-6-sun is a symbolic link for java 1.6.0.03
#add a shortcut that loads the following
/usr/local/matlab75/bin/matlab -desktop
I tested this by installing it on both my desktop (64bit) and laptop (32bit) and it worked perfectly.
Since previously I'd only been running matlab in Windows, I thought it would be a good oportunity to compare some benchmarks.
The built in matlab 'bench' is a terrible benchmark, and gets faster the more times you run it, so i decided to run a benchmark written by Jan Mandel, which tests matlab's speed at LLU (local loop unbundling).
I decided to be fair, to compare my laptop running matlab natively in both Windows and Linux.
I also added my desktops scores for comparison, but it's running different hardware, and the 64bit version of matlab, so we can't compare with windows.
Specs are as follows for my laptop
Thinkpad T61 T7500 C2D 2.2Ghz
3GB 667 RAM
Santa Rosa chipset
Hitachi 5K160 HD
nVidia Quadro NVS 140M 128MB
(the rest of the specs don't matter as they wouldn't affect benchmark scores)
The results are measured in the amount of seconds it takes to complete the operation, so obviously the lower the better
Matlab benchmark
Jan Mandel, December 2000
Last updated August 2004
Matlab version 7.5.0.338 (R2007b)
Linux x86 (32bit) Thinkpad T61
1. large LU: 0.205
2. small LU: 0.506
3. sparse : 0.133
Windows Vista x86 Thinkpad T61
1. large LU: 0.261
2. small LU: 0.664
3. sparse : 0.172
----
Here's my desktop scores
Linux x64
1. large LU: 0.186
2. small LU: 0.507
3. sparse : 0.133
large LLU was 27% faster in linux
small LLU was 31% faster in linux
Sparse was 29% faster in linux
Considering the hardware is identical, that difference is HUGE. And all because of all the screwups Microsoft have made, Vista might well be the biggest! (I should really test Windows XP. I would guess it's about 10-15% faster than Vista, but still 15% or more slower than Linux)
64bit saw marginal improvements of about 10%. Obviously Matlab isn't optimized for 64bit :(
One thing of note is that recently, Mathworks added multi-threading optimisations to Matlab.
They give a hefty improvement on a dual/quad core machine. The improvement is fairly linear, ranging from 50-70% improvement when you double the cores, with my quad core being over 200% faster with multi-threading enabled. Multi-threading is, however, disabled by default because crash recovery is not yet possible, as information would be split across 4 cores and separate L2 caches.
In the screenshot the first benchmark was single, 2nd with quad, and 3rd in dual mode.
The benchmark named "AntonyJMbench.m was a modification I made of the above benchmark. The JMbench was written years ago when computers were much slower. A benchmark can't be accurate when it takes a few hundred miliseconds to run, so I modified it so that the first test take 40 seconds on a decent single core machine.
note, the 3rd test works in an way that cannot be optimized for multiple cores.
below is the code for the benchmark should you want to compare your scores with mine.
% function jmbench
disp('Matlab benchmark')
disp('Jan Mandel, December 2000')
disp('Last updated August 2004')
disp('updated by Antony Williams - December 2007')
disp(['Matlab version ',version])
for iii=1:1
disp(' ')
f='%7.3f\n';
fprintf('1. large LU: ')
n=5000;m=3;
A=ones(n)+eye(n);
tic
for i=1:m,R=chol(A); end
t=toc; fprintf(f,t)
fprintf('2. small LU: ')
n=500;m=3000;
A=ones(n)+eye(n);
tic
for i=1:m,R=chol(A);end
t=toc; fprintf(f,t)
fprintf('3. sparse : ')
n=100000;m=50;k=10;
B=ones(n,2*m+1);
B(:,m+1)=m+1;
d=[-m:m];
tic
A=spdiags(B,d,n,n);
R=chol(A);
R=A-R'*R;
t=toc; fprintf(f,t)
pause(1)
end
disp(' ')
disp('end of jmbench')
Quad core desktop finished!
The last of the parts arrived on Thursday.
The most important thing to do when building a computer is to make sure that it runs cool. Heat is the cause of a large percentage of computer problems.
This is usually fixed by either adding fans, or improving airflow. In the case of the CPU, you have to make sure that the Heatsink (which absorbs heat from the CPU) gets good contact with the CPU. I do this by using a special type or thermal grease made of 99% silver (a very good conductor) called Artic silver 3. You can see in the below picture that I've put a thin layer over the CPU.
I then attached the Heatsink and Fan
Then I put the RAM and Hard Drives in
2x2GB of PC6400 RAM (800Mhz)
2x Western Digital 750GB SATA
Then I put all of it together
Including the DVD drive, and the Memory card reader
And closed it, and connected all the cables to it.
And connected it to all my stuff.
I'm using the same monitor (BenQ FP241W) and speakers (Logitech Z-5500) and mouse (Logitech G7)
Pictured to the left is my Thinkpad T61, that's connected to the monitor via a dock.
EVGA Rebate Disgrace!
Amongst other things, this Black Friday I bought an EVGA nVidia GeForce 6200 256MB.
I bought of because it was free after rebate, and because the card I really wanted, and ordered (GeForce 8800GT 512MB) was out temporarily out of stock, and will ship to me next month.
It was one of those items that you don't really want or need, but you get because it's free. Unlike some of the idiots out there who do that and then forget about the rebate, I'm on top of things when it comes to those scams. i photocopy everything, and never get screwed. imagine my surprise when I started filling out my rebates today.
Check the rebate form to see if you can find the errors.
First, the obvious one, the address they tell you to send the rebate to.... The zip code is clearly not even the right length!. I googled the correct zip code, and it's supposed to be 88554.
Secondly, The rebate lists the card as having 128MB of RAM, yet even in the model number listed on the same form shows 256 (The box shows 256 also, and counting the RAM chips on the actual graphics card concludes that it has 2048 Megabits, or 256 MegaBytes)
I'm sure EVGA would claim some freak accidental typo, but this is absolutely unacceptable. This cannot happen, as I'm sure a large chunk of the buyers (who, lets face it, ONLY bought the card because it was free after rebate) will send the letter to an invalid zip code, and only realise after the rebate period has passed.
Black Friday Extraordinaire
Despite supposedly being on holiday in Las Vegas for Thanksgiving, I still couldn't pass up on some incredible deals.
What's the best thing about Thanksgiving in Vegas......?
Vegas has a Fry's Electronics.
I'd been thinking about building myself a desktop some time in the next little while. I was planning on waiting till Intel's Launch of the desktop Penryn with the Q9450, but there were some deals that were just too good to pass up. (and perhaps I wanted to have my machine to play with over the Christmas break! :) )
Intel Core 2 Quad Q6600 (Kentsfield G0 stepping) $169 (over $100 below retail price!)
ASUS P5K-E/WIFI-AP LGA 775 Intel P35 ATX Motherboard $139
4GB (2x2GB) G.SKILL PC2-6400 DDR2 RAM $79AR (After Rebate)
MSI nVidia 8800GT OC 512mb $202
2X Western Digital Caviar SE16 WD7500AAKS 750GB 7200 RPM SATA 3.0Gb/s $119 each (will put in RAID 0)
LG 18X SATA DVD Burner $30
1000 blank DVD-R 16X discs $80 (no, that wasn't a typo)
I bought the following over the summer. Since they're not really items that are improving much, I figured I'd just pick them up when they were available for very cheap
Antec P180 Mid-Tower case $50AR
Ultra X-Finity 600W Power Supply $FAR (Free after Rebate)
Multi-card reader $FAR
And, providing I haven't overlooked anything (which I haven't) I should have a complete Desktop, ready to build when I get back from my trip! (I already have a Monitor, Speakers and keyboard/mouse)
Now I just have to decide if I should keep around my laptop (Thinkpad T61), as I'm not sure I'll use it too often now that I have a desktop.
It'll be just in time to play Crysis, Unreal Tournament 3, Gears of War and Call of Duty 4 :)
Some of the parts were ordered online (some companies were stupid enough to let you buy their 'door busters' online, so that meant more time spent in other shops!) so I'll post pictures when I get all the parts and put it all together!
Gmail 2.0 launched!
Only a few accounts have received it so far, but it's a minor change on the outside (albeit it has been re-engineered under the hood) The only noticeable changes are its improved speed (it's really fast now, as it caches everything). Interesting to note is that it IS caching that's doing this, and not some other trick. The first time you click a label, it lags a little, but subsequent (in the same session) loads are near instant. The other big improvement is the Contacts section pictured below (and don't even think about spamming me!)
So far it seems a little rough, and crashed on me once, but it's good to see that google isn't pulling a microsoft and pulling the plug development when they get in the lead, vowing only to improve when they have competition (ala IE vs Netscape)
You'll be able to tell if you have it if you see a 'old version' in the top corner like in my pic.
Gmail finally does IMAP
and it's about time, too!
For those of you who use an email client (like Thunderbird) and have been popping off mail, you will have noticed how pop3 is just one way. If you delete an email in thunderbird, you'll still see in in gmail's webmail. This becomes even more annoying if you pop gmail from a desktop client and a phone (like I do). The best you could do was have gmail archive and mark as read when you pop it (at least that way you wouldn't receive the email as unread in webmail.
These problems are now over, as since the 24th of October (and a few days later for you unlucky ones) gmail now supports the IMAP4rev1 protocol.
Google has put up an interesting table that explains how a client can interface with the web. This is because Google uses a different approach to email. Instead of using folders, they use labels. Despite the IMA4rev1 protocol supporting labels, but clients haven't implemented it (Thunderbird 3 will). This can confuse some things, so I'll explain the changes needed for my client of choice (Thunderbird, in case you hadn't guessed).
This hasn't really been well documented on the web, as IMAP has only been available for a few days
By default, Thunderbird has it's own folders for Trash, Sent and Draft.
These should be fixed, as the only way to delete from the server is to put an email into Gmail's Trash.
Fix Sent mail and Drafts
Go to 'Copies & Folders' and set TB to save to the Gmail Sent Mail folder. That will set the internal folder flag. Then, you can turn off the option in TB. The flag will remain set, and it will appear as a Sent folder. (do the same for drafts)
Fix Trash
Make sure Thunderbird is closed and open the file 'prefs.js' located in Thunderbird/*.default/
and find a line that says
user_pref("mail.server.server2.hostname", "imap.gmail.com");
check for the number next to server. This is the server number.
create a new line underneath like this
user_pref("mail.server.server#.trash_folder_name", "[Gmail]/Trash");
replace # with your number
bash script to automate compiling alsa in Ubuntu
Most of the laptops I've owned have had trouble with sound to some degree. The only solution is to compile the latest version of alsa manually, as most GNU/Linux distros have an out of date alsa (even the recently released Ubuntu 7.10 - Gutsy Gibbon)
This wouldn't be a big deal, but every time you get a kernel update, you have to compile alsa again. This can become a bit of a pain, so I wrote a bash script that would do it all for me.
First the script will download all alsa's dependencies. Then it will download:
alsa-driver-1.0.15.tar.bz2
alsa-lib-1.0.15.tar.bz2
alsa-utils-1.0.15.tar.bz2
it will then extract them (whilst deleting the .bz2), move them to /usr/src/alsa and compile them each.
just copy the first block of text to a text file and save as alsa_1.sh, and then the second block to alsa_2.sh and then cd to it in a terminal and type "sudo sh alsa_1.sh"
then reboot, and then type "sudo sh alsa_2.sh"
(make sure the scripts have execute privileges. (by typing "chmod a+x alsa_1.sh")
alsa_1.sh
------------------------
#!/bin/sh
#
#install necessary stuff
apt-get install build-essential ncurses-dev gettext
apt-get install linux-headers-`uname -r`
echo "downloading alsa packages..."
wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.15.tar.bz2
wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.15.tar.bz2
wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.15.tar.bz2
echo "extracting alsa packages..."
tar -xjf alsa-driver*.tar.bz2
tar -xjf alsa-lib*.tar.bz2
tar -xjf alsa-utils*.tar.bz2
rm alsa*.tar.bz2
echo "setting up alsa for compilation"
mkdir -p /usr/src/alsa
mv alsa-* /usr/src/alsa
#alsa-driver
cd /usr/src/alsa/alsa-driver*
./configure --with-cards=hda-intel
make
make install
#alsa-lib
cd /usr/src/alsa/alsa-lib*
./configure
make
make install
#alsa-utils
cd /usr/src/alsa/alsa-utils*
./configure
make
make install
echo "now reboot your machine, and run alsa_2"
#end of alsa_1
alsa_2.sh
------------------------
#!/bin/sh
#for after reboot
cp -v /lib/modules/`uname -r`/kernel/sound/pci/hda/snd-hda-intel.ko /lib/modules/`uname -r`/ubuntu/media/snd-hda-intel/snd-hda-intel.ko
cp -v /usr/src/alsa/alsa-driver*/modules/* /lib/modules/`uname -r`/kernel/sound/
depmod -a
#end of alsa_2
note, in its bare form, this will work in any distro, but my script installs the dependencies using APT (so this will only work for debian based distros - Debian, Ubuntu, LinuxMint, Mepis etc..)
also, alsa_2 is assuming kernel 2.6.22. If you have a different kernel, or several .22 kernels, you'll need to specify. Also, my script compiles the alsa-driver for intel-hda sound cards. This is the most common card for laptops (if you have an intel processor, chances are you have it). If not, replace with your sound cards name
Ubuntu 7.10 released!
Each April and October Canonical releases a new version of Ubuntu, this time code-named Gutsy Gibbon.
A quick background to Ubuntu and linux in general:
Richard Stallman founded GNU (GNU is NOT UNIX) and fought against Microsot's monopolistic view of software. He created the now common GPL (General Public License), a way to allow your code to be freely usable by anyone who won't close source it (AKA, Microsoft). The only restriction is that any modifications you make to the code must stay open source. Sounds fair, right?
It's because of this license that we can all run a linux kernel on our routers, as Linksys uses the GPL'd linux kernel 2.4, and had to open source their firmware.
So, a combination of GNU software, over the linux kernel, combined with a Desktop environment (GNOME, KDE, XFCE etc..) are what we all commonly know as linux. So it's technically correct to call is GNU/Linux, not just Linux.
Ubuntu uses debian as a base, and inherits its fantastic APT (Advanced Packaging Tool), a frontend to Dpkg. This is essentially a brilliant way to install, remove, and provide information about installable packages.
On a Debian system, you generally have the linux kernel with the GNOME Desktop environment, with GNU tools and APT.
Each Ubuntu release is synced with GNOME, and releases about 1 month after GNOME, with the current latest kernel (or .1 older) , current versions of Firefox, OpenOffice, Pidgin etc..
One of the great things about GNU/Linux distributions is that all your software is packaged together, so you run the system wide updater, and it will update EVERYTHING at once. GNU/Linux is all about efficiency. It would be pretty stupid to require each application (even the small ones) to code their own auto updater. The less time application developers have to code stuff unrelated to their program, the more time they spend making their own application stable.
So, back to Ubuntu, Gutsy comes with quite a few (considering it's short release cycle) changes.
A shiny 2.6.22 tickless kernel, GNOME 2.20, x.org 7.3, pidgin 2.21, NTFS read/write support, AppArmor security framework, GUI X config tool, fast user switching, the GIMP 2.4, and Compiz Fusion running by default on capable graphics card (with restricted driver). Also available in the repository is granparadiso (A.K.A. Firefox 3 alpha 8). Firefox 3 will be the first Gecko based browser to pass th Acid2 test. (Opera and Khtml/webkit already pass).
It's hard not to expect more from a GNU/Linux distro, but providing these kinds of improvements keep coming at this rate, the future should be good.
get it here
If you're already running Feisty, just type the following in the terminal "sudo apt-get dist-upgrade"


