Linux
NVIDIA Cuda and VirtualGL
by admin on Aug.08, 2010, under Linux, My Life
(Update: I’ve written the Wiki now and you can find it here.)
So I’ve been playing around with NVIDIA’s CUDA Toolkit and SDK and reading this book that just came out “CUDA by Example”. (See this Linux Journal article for some general back ground on CUDA.)
This is pretty interesting (and fun) stuff. So far I’ve gotten the toolkit installed and compiled the sample code projects in the SDK. I have to use my workstation at work as (sadly) my ancient ass NVIDIA card at home is not CUDA capable and my system is so old it is really just a type writer at this point.
Running just the sample CUDA projects is pretty impressive though. My old school GeForce 8800 at work has a meager 32 cores. (The card I just ordered has 96, and the most recent Fermi architecture ones have 448 and 6GB – yea, holy crap.) However, with only 32 cores it renders the particle, smoke and other samples quite nicely. These are rendered in 3D, allowing you to change perspective, and sometimes alter the particle density, light source, etc. They are just examples showing how to run general purpose code (and render results in OpenGL) on the GPU.
So then I thought – I would like to forward the rendered OpenGL images to my workstation at home. Alas, SSH, VNC, et. al all actually send the OpenGL to the client to be rendered. Enter VirtualGL, which does just what you would think – it attaches a loadable module to an executable which intercepts OpenGL requests and send them to the local GPU for rendering, putting the results into a pixel buffer which then gets sent to the client. Wow. You can run your rendering in a data center and forward the results anywhere. That’s nifty!
Here is a picture of the CUDA smoke particles sample, being rendered at work, and forwarded via SSH X Forwarding with rendering handled by VirtualGL. (I think Geek Level just dinged.)
I’m going to write up a wiki on this stuff, but if you have any recent NVIDIA card (8800 or newer) , even a mobile one, you likely have the capability to run CUDA. If you are interested you can download the Toolkit and SDK and have at it. (Update: I’ve actually written the Wiki now and you can find it here.
After testing the CUDA waters I have to say I am very impressed. I can easily see CUDA being integrated into many applications in the near future. There are already plugins to offload MS Excel formulas onto the GPU, run Mathmatica on it, etc. The integration of multi core CPUs, in even consumer class hardware, combined with the capabilities of GPUs very well might make things go from a “multi core revolution” in consumer computers and into a “massively parallel revolution”. In fact, it’s already happened. Massively parallel computing is now capable on your notebook, it just has not been fully exploited yet. (Think of the cryptographic fun you could have.) Of course once Apple catches on, it will be called iMassive.
This is just all pretty fascinating to me. My first computers had 4Mhz Motorola CPUs, 32K of memory, etc. and now I just bought a 98 core GPU which I can write code in CUDA C and run general purpose computations on. Wow. And I’m getting ready to get an i7 too – it’s all just a bit dizzying. But very fun.
If you have not checked out CUDA, I highly recommend it. It’s a good opportunity to learn more about massively parallel computing, which I think we are going to be seeing a whole lot more of. You can easily find the book “CUDA by Example” It requires basic to intermed iate C skills, but not OpenGL or other graphics languages at all – you learn CUDA C as you go and start writing parallel code very quickly.(Amazingly, the run time just integrates the GPU device code and host code, and you can invoke code to run on the GPU as easily as any C function. It is some hot stuff behind the scenes, but surprisingly easy to code.)
HP C309g Wireless Linux Printing & HPLIP
by admin on Jul.17, 2010, under Linux, My Life
We have wanted a wireless printer for our home, and I’ve been waiting for the prices to become reasonable. Then last weekend we scored on a refurbished Photosmart Premium C309g-m at CompUSA. Normally $199, we got it with a -$120 instant savings for a total of $79 at the register. For a 802.11g + Bluetooth enabled, reasonable quality photo printer and scanner, $79 just was a damn good deal. Especially considering it uses separate CMYK cartridges – it’s exactly what we were looking for. Best. Price. Ever.
But the best thing about it really is the fantastic Linux drivers HP provides via the HP Linux Imaging and Printing (HPLIP) software. You can download the latest version at the official HPLIP site, but you might very well find it is already installed in your Linux distro, it commonly is these days. Just check to see if you have commands such as hp-setup, hp-wirelessconfig or hp-toolbox already. If not, see if hplip is available in your distors repository, or download it using the above link.
Once installed you will have an HP icon in your systray for quick access to your printer settings:
I first used HPLIP about two years ago at work and was delighted to see how complete it was. It provides a full set of tools to interface with HP devices from Linux and provides a delightful user experience.
On my device, which is a relatively new product, nearly all functions are supported: Wireless printing of course, photo printing (see tips below) and even wireless scanning – which really surprised me. Overall, using this printer in Linux- like many other HP products – is very well supported. Way to go HP!
I did however run into a few little issues which had to be worked though, and you may encounter the same. So here are some notes on what I did to resolve the snags I encountered.
Arduino E-aster Egg
by admin on Apr.18, 2010, under Linux, My Life
My Arduino arrived just a few days before Easter, and though I’ve been busy with work and school I couldn’t wait to dive into playing around with it. The whole concept of the Arduino, being able to write little programs in C, compile them, then upload then to this little programmable prototyping board – it’s just so cool.
I decided to start by following the great introductory tutorials at the Adafruit.com site, they are so well written and so fun. One of them consists of learning how to program three different LEDs to cycle on and off. By having more than one on at a time, and through using a box to diffuse the light, you can mix the colors to get yellow, purple ect.
Well, that looked like fun, and as I was constructing it I realized that it would be a perfect Easter Egg, the colors diffusing and illuminating it. I wired up the schematic, modified the sample source code to blink and mix as I wanted it to, compiled it and uploaded it to the Arduino. I made a little paper box and filled it with tissue as shown on the adafruit.com site. As I made the box I drew some easter egg style symbols, and some other stuff, on each face of the cube. Once fixed up it worked pretty darn good and I presented it to Syd as her E-aster Egg!
Here is a little ogg video of the finished project:
(If that does not work here it is in mpeg4 too)
If you would like to learn more about the Ardunio, see this wiki article which has some information on getting started and links to some great resources.
Syd really liked her digital colored egg. I’ll have to come up with some more projects to make for her, but I sure it won’t be too difficult to come up with ideas, the Arduino is a remarkably versatile little gadget.
Debugging KDE4 Plasmoids
by admin on Mar.12, 2010, under Linux
So you have downloaded that spiffy new plasmoid for KDE4 and installed it. Then all manner of interesting things begin to occur. Perhaps the new plasmoid itself simply does not function correctly, or perhaps the next time you login the plasma desktop fails to start. Or, in my most recent case, configuring the plasmoid caused a seg fault which then crashed the entire plasma desktop. Ahh, such pleasant surprises. I’ve never really taken on learning the first thing about plasmoids really – it’s been on the list, but pretty low. However, this most recent situation of a crashing desktop on login inspired me to at least dip my toe.
While there is certainly much more to know, and while I am not a developer, I thought it might be helpful to point out a few things that may help others with crashing plasmoids. I’ll add to this as I learn more, but this should at least point you in the right direction. I was suprised that googeling for debugging plasmoids returned rather dismal results, and no guide appears readily available, so if you have landed here, good luck and please add your own hints.
Okay – so first off, some basics. If your KDE desktop has crashed, don’t panic. You can actually restart it easily enough. First, try alt tabbing to see if your windows are sill running despite the inhospitable and otherwise completely black screen. Start Konsole using Krunner (alt-f2) and once at the command line simple restart the process:
paracelsus@Callandor:~> plasma-desktop
That should re-initiate your desktop. (If your X server was killed as well, then the issue is not as likely with the plasmoid, and you may have other things going on. If X dies and dumps you to the shell you can usually restart it by running startx If X is still running, but you can’t start Krunner and Konsole, simply go out to a virtual terminal (ctrl-alt-f1) and restart plasma-desktop )
Of course, if you have a buggy plasmoid that is crashing, it may very well just crash again. If you just installed the faulty plasmoid and know which one it is you can remove it with:
paracelsus@Callandor:~>plasmapkg -r buggyPlasmoid
(If you don’t know the exact name, try plasmapkg –list)
One other very fine tool is plasmoidviewer. Using this you can run a buggy plasmoid in a more contained environment. This makes it a bit easier to capture output and if it crashes, it likely will not take down the plasma desktop process.
paracelsus@Callandor:~>plasmoidviewer buggyPlasmoid
Now, if that does not work, and your desktop is still crashing, you can try a more drastic fix which is to simple move your KDE user profile. Do so with:
paracelsus@Callandor:~>mv ~/.kde ~./kde-broken
Then, restart X (crtl-alt-backspace) and log in again. This will create a new, default profile. You can then continue troubleshooting the old one, etc.
Also, if you have encountered a buggy plasmoid, please take the time to submit your findings to the author, perhaps at kde-look.org or wherever else you obtained the plasmoid from. Supply the output obtained by running the plasmoid with plasmoidviewer as well as your distro version, kernel, and KDE version as a minimum.
Good luck and if you have any other basic plama / plasmoid trouble shooting tips, please feel free to add them.
PHPChain Password Manager
by admin on Feb.19, 2010, under Linux, My Life
PHPChain is a great little app which helps you organize passwords. It uses a web interface, encrypts the passwords in a MySQL database, and supports multiple users, each with their own account. Passwords are organized in user defined groups, and are easy to edit. It automatically alphabetizes entries, helping to organize them further. The interface is extremely easy to use, and it makes storing and organizing you many passwords very easy. You can try a demo of it here.
I opted for this as a solution to store my passwords at home. It provided the added benefit of having access to my passwords from anywhere over an SSL web site. While there may be some slight risk in this, lets be honest — it is a hell of a lot better than the open office document I was using before. And of course you can further protect it by only opening the port it listens on when needed, and even place it behind an .htaccess, etc. You can be as paranoid as you like.
The one thing is that this application does not appear to have been updated in a while, and if you install it today you may run into a situation where PHP does not read some of the scripts as the author used php short tags <? in some places and full tags <?php in others. It is easy to fix of course, just modify your php.ini to use short tags, or change the scripts. As many versions of PHP these days do not support short tags by default though you will likely need to do one or othe other to get this to work.
Here are some notes that might help you with your install.
First of course you will need to install apache with the necessary php and ssl packages, as well as php5-mcrypt installed. You will also need to generate a self signed SSL certificate and set up a vhost that will accept SSL connection. You certainly want to use SSL, even if you intend to only access this on you local network as otherwise all traffic will be sent clear text, which would be bad. Setting up apache to use a self signed SSL is pretty straight forward and there are lots of sites for your distro to guide you in this.
At a minimum you will need things like:
apache2-2.2.13-2.3.1.i586
apache2-mod_php5-5.3.0-2.4.3.i586
openssl-0.9.8k-3.4.i586
apache2-mod_php5-5.3.0-2.4.3.i586
php5-mcrypt installed
php5-mysql-5.3.0-2.4.3.i586
Once you download PHPChain, simply extract it in your web document root and create and empty MySQL database, them import the .sql file into it. See the README.txt for details. If you access it now, you will likely see lots of messages as some scripts are not being parsed correctly due to the short tags being used. Find which ones this are by:
Callandor:/srv/www/htdocs/phpchain # grep -R “<?” ./*
./cat.php:<?
./inc/menu.php:<?
./inc/db.php:<?
./inc/cookie.php:<?
./inc/header.php:<?
./inc/header.php:PHPChain <SPAN> – Powered by <A HREF=”http://www.globalmegacorp.org/PHPChain”>PHPChain <? echo C_VERSION; ?></A></SPAN>
./inc/header.php:<?
./inc/header.php:<?
./inc/header.php:<?
./inc/header.php:<?
./inc/crypt.php:<?
./inc/form.php:<?
./index.php:<?
./login.php:<?
./logout.php:<?
./newlogin.php:<?
./password.php:<?
./settings.php:<?
Change all instances of the <? php short tag to the full <?php tag. You can use a bit of bash magic for this, perhaps something like:
Callandor:/srv/www/htdocs/phpchain # sed “s/<?/<?php/g” *.php >> testchange; sed “s/<?/<?php/g” ./inc/*.php >> testchange
To virst view the changes in each file, and then if it looks good replace with:
Callandor:/srv/www/htdocs/phpchain # sed -i “s/<?/<?php/g”; sed -i “s/<?/<?php/g” ./inc/*.php
Or, to be even fancier with it . . .
Callandor:/srv/www/htdocs/phpchain # for i in `grep -R “<?p” ./* | cut -d : -f 1`; do sed -i “s/<?/<?php/g” $i; done
Now, the php should work correctly, but you will likely have some warnings dispalyed at the top of the page regarding some constant variable declarations. You can disable php warning by setting the error_reporting level on a per script basis. Turn off errors and warnings in index.php (before the include statements) by adding:
error_reporting(0);
Or set the error reporting level in you php.ini
That should do it, you an now start using PHPChain to manage your passwords in a more secure way. Do ensure to use SSL, and if you connect without SSL PHPChain conspicuously warns you of the danger of this.





