Why Google Chrome GPU acceleration does not work for me
The latest Google Chrome browser comes with the GPU accelereation feature.
You may already know that to enable the GPU acceleration, we only need to enable the flag 'GPU Accelerated Compositing' and flag 'GPU Accelerated Canvas 2D' in the tab about:flags.
But it is not that kind of easy. On Linux, the GPU acceleration needs the OpenGL 2.0 support.
By checking with glxinfo.
$ glxinfo | grep -i opengl OpenGL vendor string: DRI R300 Project OpenGL renderer string: Mesa DRI R300 (RV380 5460) 20090101 x86/MMX/SSE2 TCL OpenGL version string: 1.5 Mesa 7.7.1 OpenGL extensions:
My video card only support OpenGL 1.5 so far. This means even though the flag is enabled in the Chrome, still no hardware accelerated for page rendering at all.
The ATI Catalyst driver can give you up to OpenGL 4.0 and better 3D performance. But for my old X300, I can only choose the open source drive xf86-video-ati with OpenGL support by Mesa 3D Graphic Library.
The Mesa 3D Graphic Library can support OpenGL 2.0 by software-only rendering driver. I doubt update Mesa library can bring any help.
So, I just give up the Chrome GPU acceleration.
By the way, the flag 'Web Page Prerendering' is really helpful to imporve the page loading performance.
Change the blog fonts with Google Font API
I changed the default fonts with the Google Font API
I just add a few lines in the <head> and change the CSS accordingly. The 'Droid Sans' font is more eye-candy, isn't it?
Didn't notice too much delay of page loading comparing to the time without Google Font.
I do not have much more to talk about them.
Just follow the simple instructions below and choose your favorite fonts. A piece of cake. :-)
http://code.google.com/apis/webfonts/docs/getting_started.html#Quick_Start
--- update ---
Just added the WebFontLoader Javascript in the <head>. The Google fonts are loaded asynchronosly. I believe you will notice the fonts change with a low speed connection.
Setup a Linux PyS60 development environment
Well, I know that symbian is somehow out of fashion nowadays. Since Nokia just announced their mobile phone will move to windows mobile weeks before.
But since I just have a 5230 on my hand. I'd like to get a little bit fun from this new toy.
The S60 SDK is quite heavy and windows only. The PyS60 is the only choice left for me.
First thing first. The python runtime is needed on the phone itself.
The latest sis package is available on the source forge http://sourceforge.net/projects/pys60/files/pys60/1.4.5/
I just download the S603rd edition sis packages which should support the S60 5th on 5230. Install the python runtim and python shell by the pc suite.
Now python shell is ready on the phone. There is one useful feature that you can remote connect to the python console via bluetooth.
But debug on the phone is not so convenient. The project PyS60 emulation library supports run the S60 python script in a general python runtime environment.
The needed libraries can be found on http://sourceforge.net/projects/pys60-compat/files/pys60-compat/.
Unzip the python libraries and set the PYTHONPATH accordingly. I can run the S60 python script on my laptop.
Let's see what I can do with the PyS60. Maybe try to create a tic-toc-toe for fun.
Maybe I should buy a bluetooth adapter for my old laptop. Then I can connnect to the python console via bluetooth with the minicom. This should be interesting.
I will update you with my findings. ;-)
Add prefix and append suffix to each line of text file
I need to update one text file to add prefix and suffix to each line. For instance, let's say the text file I need to update is like:
line-number-one line-number-two line-number-three
I want the file be updated as below.
prefix line-number-one suffix prefix line-number-two suffix prefix line-number-three suffix
Here are my solutions.
To update with vim:
:%s/.*/prefix & suffix/g
To update with sed:
$ sed 's/\(.*\)/prefix $1 suffix/' sample-file.txt
To update with awk:
$ awk '{ printf( "prefix %s suffix\n", $1 ); }' sample-file.txt
Enable Adobe Flash Player GPU acceleration on Linux
Flash Player uses the OpenGL to support GPU acceleration on Linux.
This feature requires the below features from the OpenGL facilities.
- GL_ARB_multitexture
- GL_EXT_framebuffer_object
- GL_ARB_shader_objects
- GL_ARB_shading_language_100
- GL_ARB_fragment_shader
Flash player automatically checks the video card and driver combination meet the GPU compositing requirement.
However we can ask the Flash player to skip the GPU valiadation by define option OverrideGPUValidation in mms.cfg.
The mms.cfg is a system wild configuration file for policy setting. For Linux, mms.cfg has to be created with the path /etc/adobe.
So, what I need to do to enable the GPU acceleration is :
- Create file /etc/adobe/mms.cfg.
- Add "OverrideGPUValidation = 1" ( without the quotes ) in mms.cfg. 1 is for true, 0 is for false.
Unfortunately, this trick does not work for my ATI X300 card. I didn't notice any improvement. The flash played in a little window still make CPU run over 70%.
After checked with glxinfo, I found only the GL_ARB_multitexture. All the other needed OpenGL features are missing. I thought that is the root cause.
By the way, the option OverrideGPUValidation may need Flash rendering problems or even system crash. You should use it with care.