Tag Archives: PHP

Eight years

As of today, I’ve been blogging at SanBeiJi.com for eight years. Happy birthday, blog!

The original blog was a hand-rolled PHP/MySQL app, before Michael insisted that I upgrade to WordPress. It was actually a fun little SQL mapping exercise to get my old posts integrated into WordPress’ format, and I’m amazed it worked as well as it did, all things considered.

If you’re wondering what San Bei Ji means, there’s a fine article about it on Wikipedia.

三杯雞好吃!

MySQL App User Privileges

Here is a basic MySQL tip regarding application users:

When building applications that use MySQL, it is a best practice to create a MySQL application user that is dedicated to your app and has privileges to access only the database it is assigned.

With the latest version of phpMyAdmin, you can do this all in one step in the Add New User screen. Look for this fieldset and check the “Create database with same name and grant all privileges” box:

Database for user

You can then retract privileges from the given database, i.e. like if the app is only going to need SELECT and you are uploading tables manually, then you can uncheck everything except the SELECT box. Or maybe the user needs only standard CRUD operations, in which you can assign it SELECT, INSERT, UPDATE, and DELETE. As a best practice, you want your user to only have the minimum amount of privileges it needs for the app to function.

A Class of Objects

I was trying to think of a straightforward explanation of the difference between a class and an object (in OOP terms), and came up with this:

Objects are specific instances of classes. When you create a class, you are literally creating “a class of objects.” For instance, let us create a class of double basses. All objects of class “double bass” have certain properties defined: Maker, city, year, varnish, string length, etc. But this particular bass was made by Carlo Testore in Milan in 1710, has a deep reddish varnish and about a 42″ string length. This Testore double bass is an object of the class “double bass.”

Now I just need a bass player to explain OOP to.

Back to School

This week I took the first steps towards enrolling myself for another masters degree, in computer information systems. My first class starts at the end of this month. I’ve been eyeing school programs now for years, so this has definitley been a long time coming.

Considering my masters is in music performance, I have come quite far in a technology-based career. I’m proud of the fact that I was able to gravitate towards a career in web development instead of schlepping the double bass all over creation, and to take the time, night after night, to train myself in web technologies. And now I see my position as the lead web developer for a major national scientific organization somewhat of a great achievement, considering my background.

Obviously when I tell people I majored in classical music, they do a double take. The inevitable question is: “How did you go from being a musician to being a web geek?” But if you think about it, music is very closely related to science, mathematics, and espeically computer programming. The conventions of western harmony and music notation are as much an abstract programming language as Java or PHP. Music theory contains instructions on how to represent objects such as pitch, melody, harmony, rhythm, orchestration, and so on. Heck, a simple repeat is like a loop in any programming language. Come to think of it, there’s no reason why one couldn’t compose a symphony in C++ instead of music notation. It would be hard, but I think one could use that or most any other programming language to give instructions on which pitches to sound over a given period of time. And of course, if you wanted a human to play it, you’d still have to be able to export in music notation. And as a matter of fact, there is an XML application for notating music called MusicXML. Ha – so there you go.

Science and music have been closely tied together since Pythagoras wrote about the Music of the Spheres driving the heavens. At it’s core, music is a matematical discipline. Rhythm is division: One quarter note can equal two eighth notes, four sixteenth notes, three eighth note triplets, or an endless number of variations. Harmony as taught by Johann Joseph Fux in his treatise on counterpoint called “Gradus ad Parnassum” can be boiled down to an almost purely boolean process. The study of music in early education programs is shown to make students more adept at science and math overall. Even Einstein himself was an avid violinist.

But despite years of professional experience, recognized industry expertise, and results of the highest standards, it remains that most people just don’t get it. I can’t tell you how many times I’ve been turned down for whatever position because of the lack of a technical degree. A simple piece of paper. But usually it’s that music degree that got me in the door in the first place, and it is a masters.

I’m tired of having to defend my education as compared with my career. It shouldn’t matter, but it does. And I’ve always wanted to get a technical masters, if ever a decent and relevant program could be found. So it’s back to school with me. I hope that this will help clear things up when I have these discussions in the future, so that the music degree becomes more of a “wow” bonus on top of the technical degree and not a big fat WTF

The hard part has been identifying a program that is either local or entirely online, can be done part time, and is quality enough from a respectable established university and not some ridiculous thing where you fill out some forms and they print you a diploma. After much research and evaluations of curriculum and such, I have decided to enroll in University of Denver’s online program.

The thing I liked about this program was it’s flexibility. The CIS program has several tracks, including two that interested me: web development and information security. On the web development side, I am already pretty accomplished. So I didn’t want to take all my classes in things that I was already good at. On the security side, I have some very good solid experience, but I have a lot more opportunity for learning new things in this area. I didn’t want to abandon one side or the other really – a combination of the two would be optimal for my needs. And this works out perfectly with their individualized option. They have classes in application security and e-commerce security which directly related to web dev, plus the two core security courses prepare you for CISSP certification on top of everything. The security program there is recognized by the NSA, which helps a lot on the credibility level.

Quality-wise, the classes looked to be on-target. I didn’t want to take a bunch of irrelevant classes just to grab a piece of paper. But these courses include things like a bit of JavaScript, a nice chunk of XML, and some ColdFusion programming. All good stuff that I’ve been trying to dig deeper into lately. I’m looking forward to it!

The end of the infernal daily links

It was cool to have del.icio.us post daily links to my blog, but the experiment is over. I didn’t like the fact that I had no control over the title, or the fact that it was posting daily and not on some more infrequent basis. My blog obviously was beginning to turn into a steady stream of automated link posts, which doesn’t look good. Even if I could make the posts appear less frequently, like once per week, then the problem is that the links become stale. I needed to get my del.icio.us links back into the sidebar, and updated in real time.

If you look over to the right (in the current design) you will see the links over there all bright and shiny now. I did this by using an XSL transformation to convert my del.icio.us RSS feed on the server via PHP. It shows the top ten nodes from that feed with title properties that show the description, dc:subject, and dc:date nodes.

And now I can go back to abusing del.icio.us.