Ideas….

a blog for me to record thoughts and ideas

Browsing Posts tagged PHP

Last week Geva Perry wrote a post published on GigaOm called Who Will Build the LAMP Cloud.  In it he speculated on current cloud providers that may be interested in building a PaaS (platform as a service) offering of the traditional LAMP stack.  A few days later James Urquhart responded with his blog post entitled Does Cloud Computing Need LAMP.  In it he questions whether the Linux and Apache piece are really necessary in a PaaS offering.  He then goes on to question the usefulness of P languages (PHP, Perl, Python) and MySQL, using a comment to Geva’s post as a jumping off point.  Geva then comments back with a post on his own blog entitled Who Will Build the LAMP Cloud? And Who Cares? In it he agrees with James’ comments on not caring about the LA in LAMP, but says:

James’ last question: “Is the ‘open sourceness’ of a programming stack even that important anymore?” is a good one, but orthogonal to the discussion about a LAMP/PHP cloud, in my mind.

So why has this conversation gotten me in a tizzy and forced me to write two blog posts in one week?  Well two reasons:

  1. Many web based open source projects are built on the back of P languages (PHP, Perl, and Python)
  2. The cloud exists to make technology easier for the masses.

Now before I go any further I will disclose that the first language I learned was PHP.  The second one was Perl.  While I know there are wars that start on listservs about what languages are better, that is not the purpose of this post, so put it out of your head and don’t say anything about how much you think PHP sucks in the comments.

Web based open source projects are built on the back of P languages

Now I could write something about this, but I like lists.  So here is a brief off the cuff list of what open source projects use P languages:

  1. MediaWiki (PHP)
  2. WordPress (PHP)
  3. Bugzilla (Perl)
  4. Drupal (PHP)
  5. Plone (Python)
  6. Moodle (PHP)
  7. AWStats (Perl)
  8. MovableType (PHP and Perl)
  9. Subversion (Python and C)
  10. Trac (Python)

Now, I’m not going to argue the merits of how good each of these piece of software are. Again that’s not my point.  But they are popular whether you like it or not.  And to just dismiss them would be foolish.

The cloud exists to make technology easier for the masses

Google Docs makes it easier to get to files you need to edit.  Heroku makes it easier to deploy Ruby on Rails apps.  Amazon EC2 makes it easier for you to deploy a server.  The fall out of the cloud is that technology suddenly becomes much easier to create and deploy.

So what happens when my mom wants to write her own blog.  Well, most likely she heads over to WordPress.com and creates a blog for herself.  And if she needs a little more, then she signs up for the WordPress Premium services.  But what if I want my own blog.  Well right now I have my friend hosting my stuff.  But what if I want it hosted elsewhere and I don’t want to maintain servers (since I do that all day long).  My only option right now is to do what my mom is doing, but the reality is, that’s not what I want.  I want something like Heroku but for PHP.  And if I had it, I could install any of the PHP applications listed above.

And I think this conversation is very pertinent given that Google just announced its open source learning management system written in Python and intended to be deployed in Google App Engine.  This could potentially be a big blow to Moodle who doesn’t have a cloud to turn to.

Conclusion

So yes a PHP based cloud does matter.  And yes it should be built because there are lots of people clamoring to use it (or who have already figured out a way).

And yes this blog post could be more coherent.

Moodle Enrollment: Flat Files

1 comment

Currently we are using the LMB Plugin for Moodle to enroll students into our courses.  This works swimmingly, until you have to enroll a large group into a class that really isn’t a class.  Let me explain…no let me sum up.

We have a bunch of placement tests and advising courses and that sort of thing we want our first year students to be enrolled in.  Moodle happens to have a flat file enrollment feature.  Below are the instructions from that enrollment feature:

This method will repeatedly check for and process a specially-formatted text file in the location that you specify. The file is a comma separated file assumed to have four or six fields per line:

*  operation, role, idnumber(user), idnumber(course) [, starttime, endtime]
where:
*  operation        = add | del
*  role             = student | teacher | teacheredit
*  idnumber(user)   = idnumber in the user table NB not id
*  idnumber(course) = idnumber in the course table NB not id
*  starttime        = start time (in seconds since epoch) - optional
*  endtime          = end time (in seconds since epoch) - optional

It could look something like this:

   add, student, 5, CF101
   add, teacher, 6, CF101
   add, teacheredit, 7, CF101
   del, student, 8, CF101
   del, student, 17, CF101
   add, student, 21, CF101, 1091115000, 1091215000

So great, I need to pull a randomly generated number rather than a username in order to enroll students.  So now I need to figure out a way to take a list of usernames in banner and get their corresponding idnumbers in Moodle.

Now if this were a one time thing I would take the lazy man’s way out and I would create a table in the database and do a simple

select table.username, user.idnumber
from table, user
where table.username = user.username;

But I’m going to have to do this every year until we either get rid of Moodle or I leave Wheaton.  Since plans are not in the work for either, I’ll actually do something more substantive.

First I made the decision to use the MySQL select in clause.  For those of you who don’t know, you can do:

select username, idnumber
from user
where username in ('value1', 'value2', 'valueN');

Its pretty useful really.  I can’t really find a MySQL page that talks about the in() clause but I did find a good post in the MySQL lists.  The next thing I had to figure out was how to push a file into a php array.  Again I found a great post on using the file() command to do this.  The only drawback is that when i go to print it’ll just show:

value1 value2 valueN

When that’s not what I want.  I need quotes and commas and crap around it.  So I found another great post that talks about using the implode function to put a php array into an in() clause.  The implode function will allow me to put quotes and what not around each one of the values in the array so it will look like this:

'value1', 'value2', 'valueN'

So now that I have the component parts, all I need to do is create a php page that will let me upload a file, run the query, and retrieve the outfile.  Of course the idea of writing this code makes me tired and since its 5pm I shall just publish this post and write the code tomorrow (hopefully).

UPDATE

I was wrong.  The value is not a randomly generated number, well it is, but its randomly generated by Banner.  In the Banner XML the value is the <sourcedid> for a <person>.

Luckily this randomly generated value is something that we can pull out of Banner using our reporting system.  The value (in our Banner) is gobsrid_sourced_id.  Not sure if it will be the same in your Banner, but hopefully this will put someone on the right track.

My next step is to document how to do all of this in our Moodle Documentation Wiki.  I might do a Jing Video.

I’ve been a bit busy and unable to blog. Right now I’m waiting for other people to do stuff so I thought I would write.

Recently I’ve considered taking an in house app I’m working on and making it an open source app to share with the world. I was thinking this would help me in a couple of ways:

  1. it would improve my code.  admittedly it was the first php code i wrote since taking a 2 year hiatus from writing php code.  right now i go back and think to myself: “what the heck is that?”  hopefully opening up the app to the world would help me improve the code (and the app).  i’m one of those crazy people that believe my code shouldn’t be perfect before releasing it.
  2. it would help other libraries that don’t have a dedicated me to write programs that will collect statistics.  there is another app out there called libstats that does something similar, but not on the individual librarian scale.  i was even considering merging libstats with my app (of course i will need to speak to the owner of said project before actually doing anything of the kind).

All of this got me thinking about what services I should use to share the development of the app.  There are quite a few tools out there that can help me do this.  I’m actually considering doing an environmental scan of the different tools that can be used to develop apps via the cloud.  Maybe look at some of the big open source projects to see what they use while also keeping an eye out for how smaller projects do the same thing.  And just for clarifications sake, I’m not just talking about using AWS or Google App Engine to write the program.  I’m talking about BaseCamp, Google Code, github, etc.; you know, the tools that help you develop the app and organize the project.

The idea I have isn’t just born from my head (I’m not that smart).  I was reading The Tower and the Cloud and in it Ira H. Fuchs talks about the “Challenges and Opportunities of Open Source in Higher Education“.  It seems to me that the inclusion of this article in the book says that the cloud isn’t about just servers without actual hardware, but that its also about how we work together to use the different services available to build open source applications for higher education.

I’ll be sure to share more as I find time to review all the different tools out there.  Maybe one day I’ll have a “How to Develop your App in the Cloud” seminar or something (to go along with my fellowship).