The Mac Taketh Away, but Giveth Back (Almost)

Nothing is perfect. Not even my Macbook Pro. Yes, I know, that is hard to believe. It has taken me several hours to just get used to the idea.

I got a music CD for Valentine’s. I put it in to rip it. The CD spins a few times and then ejects. WHen this happens, it gets a huge straight scratch along one side.

Now I already do not like or trust slot loading CD/DVD players in computers. Even in my Mac it seems to be the cheapest part of the who thing. My car, my Wii both have the same technology, but seem to excel where the Mac just barely meets standard.

Ok, so my CD has this huge scratch, which will not just wipe off. It skips in the player now. And I am not too happy.

So I put it back in, put ‘error correction on’ and started the import. what I got was better than nothing, but not perfect.

Tracks 1-4 were hit the hardest, and are not all there. The rest, however, was imported flawlessly. So iTunes was able to save 60% of what the slot loader took from me.

Not back. Not good, but not bad.

the CD is great, btw.

The Culture of the Book

From an interview with Larry Mc with Chronicle books editor Fritz Lanham:

Q: What will you talk about at Rice?
A: The end of the culture of the book. I’m pessimistic. Mainly it’s the flow of people into my bookshop in Archer City. They’re almost always people over 40.

I don’t see kids, and I don’t see kids reading. I think little kids love to have stories read to them, but when they get to 10 or 11 or 12, they run into this tsunami of technology: iPod, iPhone, Blackberries.

They don’t resist it, and it’s normal that they wouldn’t; it’s their culture. I’m not so sure they ever come back to reading. Some will, but most won’t.

My comments and thoughts:

Book culture’? When was that? When was this mystical time period that human beings read?

Since the invention of writing, it has been an exclusionary thing. Then comes gutenberg, makes it so the mass can get books, right?

Right?

So they get excited, sometimes. (Harry Potter, I am looking at you) Still books are seen as a ‘learnin’ thing. The average person was not so much a reader. Bible? On Sunday?

Sure.

And yes, there were riots for Dickens novels, there was the unprecidented popularity of Jack London, all the way through the Beats getting challenged on the first amendment all the way to the Supreme Court.

But in the end, you would never fill a stadium for a poetry reading. As a culture, books have always been in the back ground behind things like movies, TV, sports.

College kids read. Dorky kids read. Smart people read. See what I mean?

So are we reading less? Ask JK Rowling or Stephanie Meyer. Indeed I would say that now we are reading more than we ever were. That now, today, we as a species are producing, distributing and reading more works of prose/poetry/non-fiction due to the internet, due to print on demand, due many things.

So maybe we aren’t all sitting around reading high literature all day, but keep in mind, most of ‘high literature’ at the time was just pop culture (I’m looking at you Shakespeare).

End of the book culture? I don’t think so.

Using PHPiCalendar with a Database

On this site I have set up phpicalendar to work with a database. Here is how I did it.

The first requirement I put on myself was simple: no modifications to PHPiCalendar. Why? Because I am lazy. I want to write this once and be done with it, not have to tweek it every time there is a PHPIC update. So instead of trying to make PHPIC read from a database, I made the ICS file be generated from a database.

See how that works? As long as PHPIC reads ical files (which I would think is always, since it is in the name…) this is going to work. So, how do we generate ICS files?

For that I used a AJAX trick. See in AJAX, you can’t use an XML file from a different server for security reasons. So what they do is generate it through PHP instead. And I did the same thing.

I made a php file which pulls the information from a database. Because I am using PHP, I can also just have one file and pull multiple calendars from it, using the old ?cal=this_one trick. So I can call holidays by saying ical.php?calendar=holiday, but readings by inputing ical.php?calendar=readings. Same file, all the calendars.

So then all you really need to do is generate a form that fills in the database. More information for ICS can be found here. I merely used the following parts, wanting to just work with the basics.

DTSTART, DTEND, SUMMARY, DESCRIPTION, UID, SEQUENCE, DTSTAMP, AMOUNTTIME, CATEGORY, ID, UPDATED, URL, LOCATION

I did also want to, as an admin of the site, be able to approve or dissapprove items. So I put in another field called APPROVED into the database. If the even is marked as unapproved, then it does not show up in the ICS file. Just a person between forms and data on the front page of my site. seemed a good idea, no?

This, of course added in another form, an admin form that would let me approve or dissapprove anything submitted. This was a basic form, really since only I was going to be seeing it. I simply change the DB variable of APPROVED from NO to YES. Then when the ical.php file pulls the information, the check code will keep it from, or now allow it to be published.

There was one issue with this whole adventure. Seems that PHPIC wouldn’t read the file being generated. Why? because it was a .php file. So I violated the first (and really only) rule of this little adventure and dug into the PHPIC code.

Now I figure this is probably some sort of security hole. I am just not entirely sure how.

A better solution would be to have the php file simply generate the ICS file each time the database is updated, rather than generate it on the fly. While there is a certain bit of safety with that, there is a certain bit of elegance with the single php file being able to provide all the desired calendars.

PS. The PHP file worked in iCal as well.