Concept: PHP-based snippet library
This is a note-to-self on a tool that I think would be useful, but I don’t have time to explore it right now… so I’m just jotting down some thoughts so I can create it in the future. I’m not aware if software like this already exists. Honestly, I didn’t check. If you know of any, let me know.
I find myself reusing plenty of code and regular expression pattens. I use e-TextEditor, a TextMate-like editor for Windows, so I can feasibly enter all my common code snippets using the bundle management — but what about regular expression or even just notes on best-practice?
A solution I’m rolling around in my head is a blog-like tool that allows posting of code with categorization and tagging. The front end could be public or private, depending on the nature of the snippets.
I would find value in this myself because at the time of this writing e-TextEditor doesn’t have a stored regex feature, so I have to rewrite frequently used regex patterns. These can get quite complicated. Another value-add use for this might be a Apache dev server setup with a large vhosts setup for creating subdomains.
A few notes for myself:
- It should be multi-user from the ground up
- Types: Notes, Snippets, Patterns. A Note could be comparable to a blog post, where Snippets and Patterns can be nested in a Note so that a complete thought could be formed around multiple Snippets or Patterns.
- You should be able to “View” or “Use” a snippet. Viewing is syntax-highlighted for supported languages, Using gives you a form by which you can enter the values of the snippet. On submit the snippet is coppied to the clipboard with the user-defined values.
- The front-end layout should be as compact as possible and allow a “copy to clipboard” button on each snippet from the main overview.
More later… I’ll be open-sourcing this.
Always late to the game…
Just started using BlogJet 2.0 – simple and efficient desktop blog management, and it has yet to bork my code in the WYSIWYG mode. We’ll see how long that lasts. I would love to see a hierarchical Categories view, but that may be indicative of XMLRPC, not the app.
Other than that, it’s pretty nice.
One nice touch over the competition that I’ve used (w.Bloggar and Zoundry) is that links use the more valid rel=”external” attribute vs. the non-xhtml target=”_blank” attribute.
Yet in the same breath it uses “fancy quotes” which I despise. Hm. Well anyway, I’ll see if it’s worth the price tag in the long run or if I’m better off without it.
For all you Pandora lovers… try Musicovery
I just StumbledUpon a new and interesting pandora-like music descovery tool that lets you more finely tune what you’re getting. It’s called Musicovery. Musicovery lets you select your “mood” of music in four quadrants: Dark, Energetic, Positive and Calm in an X/Y pad for a smooth blend between all four. Then you select genres of music you’d like this playlist to be comprized of. Perfect. Right now I’m in a blend of mostly positive calm elacto and jazz music.
This has been making my night of coding much nicer. My regular music list is… eclectic. When you go from the airy ambient sounds of Woob directly to Coal Chamber it tends to throw you off a bit.
Not even Pandora or AudioScrobbler has given me this much musical pleasure. Being a creative person, music deeply affects my stress level while coding. I’ve found that certain blends of music really get me going good, but with today’s genre-bending bands and styles you can’t always rely on a single artist to model after or a tag to give you that nice blend. Musicovery is most comparible to services that allow you to steam by tag, but still works a little more intelligently than tags.
Give it a shot. Especially if you dig Pandora or similar services.
Back to the Future: WordPress 2.5
After kicking the can around with SilverStripe and MODx CMS, I’ve decided that for my needs WordPress will do just fine.
I’ve settled for having several unique sites instead of one “all inclusive” one. The bang I was after on my portfolio was not compatible with a full site, so I just turned it into essentially a web brochure.
Next up: The blog. Anything you want to know about what I’m thinking… so read up, Camacho. And lastly but not least-ly: Shockeye, my solo music project. I haven’t spent any time thinking about how I’ll set that up yet… scratch that, I guess it was “least-ly” after all.
As far as WordPress goes, I seem to be having a more pleasurable time with it this time around as I am only using it as a blog. Another thing that makes WP slightly more joyful this time is the fact that I didn’t previously think to turn off the WYSIWYG editor.
Oh, yeah… they boasted that the new WYSIWYG editor in 2.5 doesn’t bork code on your posts. I had that one proven wrong within 2 minutes of turning it back on.
I won’t write a full diagnosis on WordPress 2.5; honestly, I don’t really care. It works and it was easy to setup. What else do I really need?
PXE network-booting Ubuntu
Suppose you have a laptop which has no CD-ROM, and it does not support USB booting either. It does, however, support network booting. Perhaps you are like me and have had no need for this in the past. Perhaps you installed Ubuntu on this laptop before by swapping harddrives with another laptop, installing it there and swapping them back. Not particularly very graceful, and ended up with some weird problems to sort through on wireless and video.
Further still, you’ve read up a little bit about PXE network booting and found that the information on hand is quite heady and involves more than your attention span or time on hand allows. This is exactly my situation with my “remote control” laptop. Finally, I found a post on Reto’s blog that covered installing Ubuntu via PXE from Windows. So I decided to dive in…
In short it was ridiculously simple.
Download a free TFTP server] for Windows, download one of the Ubuntu distribution’s netboot folders, in my case it was Hardy Heron. i personally downloaded the whole DIR structure because of my lack of experience, I’m sure you only need a handful of files in reality.
Now copy the tftpd32.exe to something like c:\tftp and also copy all your Ubuntu-related files there. Launch the server, and fill out the info in the DHCP section.
I am using the very popular WRT54G router from Linksys, so my settings were as follows:
IP pool starting address: 192.168.1.100 Size of pool: 50 Boot file: pxelinux.0 // boot file path is the relative or absolute // path to pxelinux.0 from the server installation WINS/DNS server: 192.168.1.1 Default router: 192.168.1.1 Subnet mask: 255.255.255.0
Now you can fire up your net booting computer. You may need to specify netboot as your primary boot option in the BIOS. In my case I can select it in a one-time boot menu. This option is available on most Dell computers by pressing F12 at boot.
That was it! It booted just fine* and is now installing as i write this blog.
An important thing to note is that you do not need to download a Ubuntu ISO as the installer will download the appropriate packages for you at install over the net. Another cool thing is that you can install various flavors of Ubuntu from the net installer. So lovers of Kubuntu, Xubuntu, Ubuntu Studio etc. can follow the instructions to the letter and it will prompt you for those flavors later in the installer. Even those who prefer a Ubuntu Server with no graphical interface can install the much leaner CLI-only version of Ubuntu.
* the TFTP server died the first time. I restarted it and tried again and it worked fine. Not sure what the hangup was.
An update: The install went perfectly. Wireless had no problems and video was running with full acceleration out of the box.
SSH, RDP and VPN – Oh My!
I’m definitely no stranger to VM and remoting solutions.
First of all, I need to explain, I have the world’s most craptacular laptop. I bought it knowing full well how crappy it was because my intention was always to use it as a remote control for my more powerful machines. It’s a Pentium III with 512mb RAM. And it runs at a productive speed using Ubuntu as its operating system.
My desktop is much better, an AMD64 with a 1.5gb RAM, and a huge external harddrive. It’s a lot more powerful, but hardly portable.
So, these days I VPN to a server half a continent away for work and run several SSH tunnels to get to the development and production machines I work on. I run Linux as my host operating system on my desktop and laptop, and run Windows XP in a network-bridged VM.
When I work at a coffee shop or somewhere other than home, I SSH to my home machine and run several SeamlessRDP sessions to have a unified experience with my applications on the VM. I use VNC to connect to the main desktop to access mail and run other applications.
This is perfect for me because no matter where I am in the world, so long as I have my laptop and a connection to the net, my development environment stays pretty much the same.
#TODO: Check out MODx CMS
In my never ending search for the best CMS for me and my clients, I’ve been recently raving about SilverStripe. It’s great, but it’s a little heavy-handed, and some features flat out don’t work.
Tonight I tried out MODx CMS. So far, so good. A very similar interface to SilverStripe, with a lot lighter CPU load and smarter caching… and the file manager actually works in MODx — a complaint I have with SilverStripe. Unfortunately I’m not seeing the same MVC style framework in MODx as I would’ve liked, but there is still an extensible framework present to extend functionality.
Some day when I find the time I’ll play with it a little more.
P.S., SilverStripe Rocks… Almost
In the mass of trying out this and that CMS for blogging and content publishing, I settled on SilverStripe. Overall, I’m sorta pleased with it.
I’m very picky about permalinks, SilverStripe has a completely customizable permalink structure which I’m very happy about. The drag-and-drop menu reorganization was really friendly and made it easy to manage a large menu hierarchy. The CMS is also very manageable and infinitely extensible.
SilverStripe ships with it’s own MVC framework which runs the CMS called Sapphire. What this means for me is that when I feel like extending the base functionality, I can do so with concepts ingrained into me from Rails. Very cool! Then I can choose to release my code back to the community as a module.
Of course, there are some features that are, in my opinion, are totally broken and not value-add functions.
The file upload manager is completely unusable. Sometimes it will upload, other times it will stop uploading completely, or even fail to start entirely. The image cropping and resizing tool is a useless feature and it makes images look terrible with every recursive edit. To me, a simple file upload interface would suffice. Something Flickr-like would be nice, but I think what SilverStripe currently has implemented is overcomplicated and completely defeats the purpose of even being in the feature set.
Other than my gripe with file and image management, SilverStripe is quite a nice start. It was a pleasure to get it up and running on my server and it has the advanced features I require. Even with the borked file management, I give SilverStripe 3 out of 5 stars for trying a new approach.
Mix XHTML with HAML
I am a huge fan of HAML for generating templates in Rails.
A feature I was previously unaware of in HAML is that you can mix regular XHTML code in with the HAML code. This is especially useful for inserting an XML prolog to your template layout. I recently saw this exemplified on Robot Has No Heart
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
%html{"xmlns"=>"http://www.w3.org/1999/xhtml", "lang"=>"en"}
%head
%title Layout Example
%body= yield
Cool, huh?
As you may know, adding an XML prolog forces Internet Explorer 6 for Windows into Quirks Mode even though a doctype has been declared, while other browsers remain in Strict Mode. So this can be useful when you need to specify a massively different stylesheet to IE6 in Quirks Mode, while remaining in Strict Mode for your main stylesheet for all other browsers.
Another useful application of this technique is whipping together sites in StaticMatic. Textarea tags give me whitespace headaches in HAML, so now I just write the actual XHTML tag for it. No problems. I use StaticMatic to build page templates that will be ported over to another application. Yes… that’s how much I love HAML.
Code Igniter
After having a lover’s spat with Ruby on Rails, I’ve decided to see all that’s out there as far as rapid development application frameworks for the web. So far, I’ve been more impressed with Rails overall – mostly due to the completeness of features – but several PHP frameworks have really caught my attention.
CakePHP, Zend Framework and now Code Igniter.
I sat down in front of Code Igniter last night, and this morning I have a completely working front-end prototyping tool which modularizes CSS layout logic, color scheme and typography settings. Very cool, and it was deceptively easy.
One thing I really noticed was it’s weight. Code Igniter is FAST! Way faster than Rails, and faster than most of the PHP frameworks I’ve been using too.
I think this may be the start of a beautiful rekindling of my love for PHP.



