This time of year always brings two new versions of Linux that I watch, Fedora and Ubuntu. Ubuntu usually lands first and they have this handy countdown counter…
October 23, 2009
October 22, 2009
Picked up Win7 @ lunch. Anyth…
Picked up Win7 @ lunch. Anything has to be better than Vista. Hope it performs well in a Linux VM or they are banished for good!
August 2, 2009
Burning a Blu-ray in Linux
I’ve had a blu-ray burner in my Linux system for quite a while. Since about Fedora 8, I’ve been using commands to burn backups onto single-layer BD-RE media. I gleaned those commands out of a posting about dvd+/-rw tools (google cache). Here are the basics…
Ad-Hoc Burning
growisofs -Z /dev/dvd -R -J /path/to/files
- later -
growisofs -M /dev/dvd -R -J /more/files
- to finalize -
growisofs -M /dev/dvd=/dev/zero
Writing an ISO
growisofs -dvd-compat -Z /dev/dvd=/path/image.iso
Erase the Disk
growisofs -Z /dev/dvd=/dev/zero
Format
dvd+rw-format -ssa=1G /dev/dvd
I’ve recently been trying to do some new things and I thought I would post that as of Fedora 11, Brasero can recognize and write files to my BD-RE media and also erase the disk to do it again. K3b is still at 1.0.5 (not a KDE 4 compatible version) on Fedora and does not recognize the disk correctly for type and capacity, nor does it allow burning.
My recent searches pull up the same results from 2007 and 2008 as before where people were unsure, etc. This is the current state of my world though.
July 27, 2009
Using SOAP (non-REST) web services with CakePHP
I recently had a need to support a complex SOAP web service from CakePHP. Cake provides some built-in support for REST based web services; however, this situation required more. This post should show how to set this up on your own projects and still utilize all your normal controller and model goodness without too much screwing around.
Pleas see this attachment for the source code described in this article.
The method I will outline here requires the php-soap module.
First, the WSDL. For my project, I started with a WSDL created in another tool. My WSDL specifies a slightly different object set than my CakePHP application. I’m sure with PHP5 and some finessing of the Model classes, you could probably use the same set; however, it was easy enough to just create some really vanilla objects to house the transport objects and use those to communicate with the webservice. Both the WSDL and the receiving controller are present in the attachment.
What you will notice is that the *DTO objects defined in the controller file reciprocate the structure of the objects in the WSDL and the methods also are represented in the controller. I put them in the controller file because it wasn’t really obvious to me where in Cake’s structure “outside code” should really go. I have a separate configs.inc.php I pull in up the class hierarchy, but that’s about as non-conventional as I want to get. Also, this controller is dedicated to just handling webservice requests and I only need these *DTO objects in that case, so locality wins and they are here. No real engineering genius here, their structure mimics what is defined in the WSDL file.
The real magic is in the controller. The controller’s remote() method is what handles the POST from the web via the port binding in the WSDL file. The remote() function sets up some of the basic stuff for SoapServer and is easily identified in the PHP manual. It’s even pretty easy to deduce we’re going to need to use SoapServer->setClass() somewhere and plug the name of our Controller in. However, there was one tidbit in the comments section of the manual regarding SoapServer->setObject(). It wasn’t documented (at the time), but after experimenting and looking at the PHP source, it does exactly what we need here, sets the handling class to an instantiated (aka existing) class object instead of trying to spawn a new one. Because we are already inside the CakePHP framework and running the remote() function, we already have the variables we want from beforeFilter(), we have our models loaded up, we may even have a user context from mod_auth_something. Perfect!!! So, we tell SoapServer to use our instantiated Controller. Once the *DTO classes are mapped and SoapServer is configured, it’s as simple as having it handle STDIN to tickle the rest of the methods in your Controller with the parameters populated. Two more tricks/problems remain: debug level & autoRender.
First, debug level. There’s bound to be a way around it; however, since I test with a web service client, when I do have a problem, I have to debug with lots of $this->log() calls. Turning up debugging to 1 or 2 is problematic because then CakePHP doesn’t spit back properly formed XML to the web service client and usually the client takes a SoapFault when that happens. I stick to debug level of 0 during development and deployment wrt the web service stuff.
Second, autoRender. Because SoapServer does the actual outputting of XML response to the client, I set the layout in the Controller to Ajax and also explicitly call exit() at the end of the remote() method. This ensures that CakePHP doesn’t send back a “Missing View”, half rendered $layout, or any other kind of automatic goodies.
I hope this article is helpful for anybody who might want/need to integrate a more elegant/esoteric webservice into their CakePHP architectures. I’m sure there are probably cleaner ways to put this into custom View classes, utilize Components, etc… however, this was a straightforward approach I found has been working really well for one of my applications.
July 21, 2009
Announcing release of HadoopDB…
Announcing release of HadoopDB – PostgreSQL + Hadoop.. http://tinyurl.com/le2fen
July 16, 2009
My CakePHP fork was in the wro…
My CakePHP fork was in the wrong place. I’m straight now and it’s here: http://bit.ly/vkn32
July 15, 2009
Have my own CakePHP fork for m…
Have my own CakePHP fork for minor patches, potential fixes and following the main line. http://tiny.cc/8ALCm
June 18, 2009
CodeWeavers Announces CrossOve…
CodeWeavers Announces CrossOver 8.0 for Linux.. http://tinyurl.com/mhgc25
May 26, 2009
Video Editing On Linux: Things…
Video Editing On Linux: Things are looking up!.. http://tinyurl.com/ojbjrk
May 20, 2009
Avoid common querying mistakes…
Avoid common querying mistakes with better Django models .. http://tinyurl.com/pv354k