BogusRed's Sketchblog

Random musings from the PaperDemon admin.

This is my personal blog. The views expressed on these pages are mine alone and not those of my employer. This site is not associated with Google, Inc.

Healthy Oil?

Aug 9, 2008 6:15 am by BogusRed

It's 7:15am on a Saturday. I should be sleeping in. Especially after the crazy week I had at work. Unfortunately, I'm sitting here with some of the worst heart burn ever, chewing tums and drinking milk for the past hour (been up since around 6am).

Last night I got sick. I have this chronic digestive problem that I usually don't like to talk about much. The details are rather embarrassing. But lets just say its unlike anything my doctors have ever heard of and they are classifying it as irritable bowel syndrome since they can't figure out what the heck I have. My symptoms are not classic IBS.

The severity of my IBS problems peaked during the spring and summer of 2007 and then they went away for a while. I've only gotten a little sick every few months or so since then. Yesterday I got sick again. I used to keep a food log and I couldn't find any correlation between the foods I ate and the times of my attacks. I think 2007 was just a really unlucky year for me. But I do recognize that there are some foods that do make me sick sometimes.

At my work we have free breakfast, lunch, and dinner (woo hoo). But they sometimes try and make the unhealthy foods healther. I've discovered that any time I eat something deap fried like an egg roll or a corn dog (and they RARELY serve those at work) then I get the most horrendous heart burn. Yesterday I had 2 egg rolls and ended up getting sick in more ways than just heart burn. I asked one of the chefs a year ago what they use to fry it and they told me they always use rice bran oil, supposedly a healthy oil, for frying. This has to be the culprit.

It's my own stupid fault for not remembering that I get sick from the oil but in my defence I've only had eggrolls/corndogs like 3-4 times in the 2 years I've worked there. I consider this event confirmation that rice bran oil makes me ill. Ironic that supposedly the "world's healthiest frying oil" makes me sick to my stomach while the less healthy oils don't.

| Permalink | Comments (0) | Post a comment

Exportability on PaperDemon

Aug 7, 2008 10:30 pm by BogusRed

I have plans to rewrite much of the PHP code on PaperDemon to be more exportable. By this I mean I want to make it easier for me to reuse my code in other projects. Sure I could just copy paste but then when I make customized edits to the copied version, then I can't easily update the copied site with the new features from the first site.

So I'm working on restructuring my PHP classes to be more layered. I haven't read any articles on specifics of how to do this so I'm just sort of figuring things out for myself (if you have some links please send them my way!) I did read once though that a great way to do this is to have a class and then other classes that extend it. I also read that data gathering, data manipulation, and presentation should all be separate layers in any application. This makes a whole lot of sense to me so I'm going to try and apply this concept wherever I can.

So to experiment with this process I thought I'd start with something simple that I know would already be needed multiple instances within PD. And that's the commenting system. Art, Comics, and Writing all have almost identical commenting infrastructure. So I started to create one generic class for handling commenting, then have 3 PHP class layers (for art, comics, and writing) that sort of wrap around the main comments class to add custom functionality. So it would go something like this:

// generic class
class Comments{

    function get_comments(){
        // do database call and stuff
    }
}

And then I have a class that extends this that has custom functionality for Art comment stuff:

// art layer for comments
class ArtComments extends Comments{

   
    function get_comments_extended(){
        // custom stuff

        // call the generic method
        $this->get_comments()

        // custom stuff
       
    }

}


I thought since i'm at it, I might as well make some improvements to the Comments system instead of just backend stuff. So I'm making it AJAX and adding navigation to comments. There will come a day when there are more than 50 comment threads on an artwork submission and I don't want to hammer the database with having to retrieve all those comments when its not necessary. So instead its just going to load the latest 20 and you can just click nav buttons to see earlier comments via AJAX. Also, it will only draw the parent threads. If the parent comment has replies, a button will appear which you can click and it will load the children comments.

I'm also adding another element to make things more exportable. After I pull the data from the database, I transform it into XML data and then apply an XSL file to it to transform it. This way I have a separate presentation layer. The current live comment system uses phplib templates. I use it because it's nice to keep the html separate from the PHP. However you can't apply any sort of logic to the presentation when using phplib templates, which means I end up making presentation decisions on the PHP end. that means i end up with messy code. i want the presentation completely separate from the data gathering and data manipulation. At a later time, I can even cache this xml data into either the database or xml files and then just pull from that to avoid load on the database. But I probably wont do that since most art submission pages don't get viewed all the time so their content gets generated only every once in a while (except for newer submissions wich have more traffic). Probably the ideal situation would be to have all the data of the artwork submission (not just comments) in a cached xml file and then use xslt to transform it into html.

But I digress... I'm very close to being finished with the Comments class. I have run into some problems with some people's signatures having malformed html and it causes the xsl transformation to fail. I'll need to resolve that. I also need to make a lot of the comment administration/posting ajaxified so that the stuff doesn't come in the form of pop-ups like it currently does. My plans also include revamping the inbox area and the way members manage comments they receive on their artwork.

I also have some ideas in mind for revamping the Members Portal. I would love to make it a customizable page that has the latest and greatest stuff on PD that the user elects to have. Also it would be good to have all of the subscription notices ajaxified as in you just click a little x next to a notice and it deletes it.

The user interface for dealing with art, writing, and comics needs some revamping as well.

Anyway, I have a lot of great ideas. It's just finding the time to do it all. But I'll try to work on it, even if its just an hour here and there.

| Permalink | Comments (0) | Post a comment

BogusRed

View Profile

Ads by Google