Tag Archives: Coding

Little Black Boxes

The refactoring of Ficlatte has begun. I don’t expect this to mean anything to any of you, not even the ones who frequent the site on a regular basis. The work I’m doing right now is 100% completely behind the scenes, hidden by the large curtains that lead to the cold and drafty back rooms of the castle. Let me just put it this way — if I do my job correctly, no one will notice that I’ve even done a thing.

And that’s as it should be. But despite the fact that no one will see the changes, they are necessary ones to make. Right now, it’s a fair comparison to say that all the code that runs Ficlatte, if it was poured into a large, black box, would look like a messy tangle of colored wires looping in and around each other, making snarls here and there, and generally just looking like an entire troop of monkeys got in there and started mucking around with things.

And it gets worse every time one of us on the development team adds a new feature or tweaks a little bit of code. We just keep adding new wires to the box that link existing things together in new and interesting ways and other wires that do new things they’ve never done before. Looking at it right now, for example, you’d probably see a bunch of blue wires in there. Those go to all the authors and users who come to the site. The white wires link to all the stories and interconnect a fair few of them together in long chains of storytelling logic. The green wires are the prompts, there to spark new and creative ideas. And the red wires — well, those are the dangerous ones. You don’t want to go playing with those. No, sir. They lead to the challenges, where some of the heaviest lifting gets done. And somewhere in that tangled mess are these little copper wires. They looks haphazard and random, but they’re really not. They connect some of the most important bits of logic together that keep the site running smoothly. Pull any one of them, and the whole thing comes to a screeching halt. Probably with flames. And smoke.

All that to say, someone has to sort this mess out. The more things we add, the worse the mess gets and the harder it is to maintain. So I’m working on a little project called refactoring, where I take this large, black box of tangled wires and carefully pull it apart — without breaking anything, mind you — and tear it down into several smaller black boxes that are all connected together. The blue wires go into their own box, and I write something like ‘Authors’ or ‘Profiles’ in white Sharpie on the lid. The white wires go into a different box, which gets its own appropriate label. The same goes for the green wires and the red wires. And when I’m all done I should have a separate box for each modular function where the wires inside are all neatly patched together and organized and easy to see where they go and what they do. The copper wires stay in the central box, of course. That’s the beating heart of the whole thing. And all these newer, smaller boxes have new wires that lead back to the primary box, as well, because everything still has to be able to talk to each other. But what that leaves me with is a system that’s clean, neat, and tidy, easier to maintain if something does break, and even easier to add on to as we develop new features for the site.

Fortunately, it’s not overly difficult work. It’s just a matter of doing it, and as I said earlier, I’ve already started on it. In a day or two, the whole refactoring process will be complete and no one but myself and the other two developers on the team will even know I’ve been in here working. But I’m excited about it, because we have some really neat new things planned for Ficlatte, and this refactoring process is going to make it so much easier to implement those features. Some of them are even done already; they just haven’t quite made it down the pipe to the site yet. (And frankly they’re part of the reason why this whole refactoring is even necessary in the first place; we kinda made a little bit of a mess back in these cold, drafty rooms, so now we have to clean up after ourselves a little).

Stay tuned, folks. I love the work we’ve done already for Ficlatte, and I’m excited about what else we have planned. And if you haven’t checked out Ficlatte yet, this is a great time to do so. It looks a little drab and grey around the castle yet, but the interior decorators have already been hard at work to give the place a little more color, I assure you. And it’s a great place to meet some great folks who love words and for you to practice your use of words, as well.

Ficlatte, Code, and Making Use of All This Free Time

For the last three or four weeks, I’ve been coding away feverishly. This, by itself, is notable. I haven’t had the energy or the mental focus to work on any project like this for so long in a very long time. It’s been exciting and fulfilling to finally feel like I’ve reconnected with a part of myself that’s been missing for so long. I’ve also been doing some writing again, micro-fiction of course, but I’ve done more writing since the first of the year than I think I’ve done in the last couple of years combined. And it’s the writing that’s led directly into the coding.

Back in the days when Ficly was still in business, I’d wanted to help contribute to that site’s code base. The site’s owner was the original developer of Ficlets, which was, in turn, owned by AOL. And when AOL effectively all but went the way of the dodo, Kevin migrated Ficlets into the daughter site Ficly. I wasn’t fortunate enough to learn about Ficlets until far too late, but I was an active member of Ficly for a number of years. I wrote quite a few stories during my tenure there, including some really fun collaborative series with a couple of other users.

Active development and maintenance of the site was slim, unfortunately, and for good reason. Kevin had a job, family, and other life responsibilities, and I think Ficly ultimately got relegated to a hobby project and a labor of love for him over time. As a result the code base became somewhat stagnant and outdated, as the Ruby on Rails framework it was built on moved forward and left our little realm of micro-fiction behind. I’d offered at one point to help contribute to the site’s development, knowing I’d have to learn Rails in order to do so. But I ran into technical difficulties setting up a development environment at home, due in no small part to the fact that several of the packages that powered Ficly no longer existed. So the result was that Kevin opted to shutter the site rather than bringing the code up to spec, which would involve basically rebuilding the site from the ground up.

And so we as a community were forced to move on.

There were several of us from that community who made attempts to work up replacements. The one that got off the ground fastest and most completely was Ficlatte. A handful of us from the Ficly community migrated there, but since its inception, Ficlatte has been more of a shell of Ficly. It’s had the basic tools to write stories and interact marginally with other users, but many of the key features that Ficly a community have been missing.

Until recently.

I haven’t particularly enjoyed being unemployed for the better part of a year, but one of the advantages I’ve discovered is that right now I have the opportunity to add to my knowledge and programming skillset. Ficlatte is built on Python and Django. Both are frameworks that would be useful for me to be familiar with, and so a few weeks ago I offered to contribute to Ficlatte’s development and thereby enhance my own skillset.

I’ve plunged in with both feet. Writing code these last three or four weeks has become almost a kind of addiction for me. It’s filled almost all of my free time, supplanting even most of the other hobbies I’ve engaged in the last few months to deal with my anxiety. I’ve always found it thrilling to put together strings of code and watch them come together to do something useful and practical.

I’ve come to love this little community of micro-authors, so it gives me great pleasure to be able to add to the site in this way while developing some new skills that make me more marketable as I search for work.

As always, if you like to write — or think you might like to write — I highly encourage you to visit Ficlatte and check out our little community. All the stories are short, so there’s no pressure to jump straight into writing long fiction. And we now have a development team actively working on new features, so the site is about to change for the better in the coming days.

Learning PHP

I’m sandboxing PHP today (not to be confused with playing with the “Sandbox”:http://plaintxt.org/themes/sandbox theme from the fine folks over at “plaintxt.org”:http://plaintxt.org), working on learning the code so that I can start coding the stuff from scratch, instead of just being able to hack other people’s work. I’ve been wanting to do this for awhile now, and well, I have quite a bit of free time on my hands these days, so this seems like as good a time as any to learn a new skill. I’ve got the PHP tutorial up in a tab, and I’m working through it step by step.

I’ve got at least a couple of plugins I’d like to write for WordPress, things that I haven’t seen anyone else put together yet. Trouble is, I don’t know enough yet to write these plugins myself. I plan to change that. And heck, maybe I’ll even be able to add my own weight to some of the WordPress development somewhere down the road.

Anyway, time’s a-wasting. Back to the tutorial. So far, I’m finding PHP coding to be pretty straightforward. But then again, I learned C Programming several years back. This really isn’t all that much different. It’s fun!

Bit by the Coding Bug

I’m getting my inner geek on – again. I spent the majority of my day today trying to figure out how to crosspost from WordPress to MySpace. I’d found a “hack that looked like it had potential”:http://noumenon.roderickrussell.com/wordpress-to-myspace-auto-crossposting that I messed with for quite a while, but so far I’ve had no success in getting it to run, despite having following the directions to the letter and checked everything over fifthlicate (and then some). I’m still waiting for a reply back on my comment to see if the hack’s author has any idea what’s blocking my attempts.

Ultimately, I gave up on that and started trying to find a way to put a light-weight Twitter badge on to my MySpace profile. I don’t like any of the badges that Twitter produces, so I looked around for other options. But of course, MySpace being the notoriously unfriendly environment that it is, there are no good solutions that are both functional and attractive on the page. So, I’ve given up on that option for the time being, as well.

In the meantime, I plan to learn a little more about the ins-and-outs of PHP coding tomorrow. I’ve got the MyDashboard plugin installed on this blog, but it doesn’t display quite as much information in the dashboard from some of my other behind-the-scenes plugins as I’m used to. So, my intent is to learn out to create a few gadgets that will tap into these plugins and put this information closer to my fingertips. If all goes well, I may even plan to create gadgets for a few other things that I’ve always wanted on the dashboard and never been able to find plugins for.

On that note, I’ve got a few of the plugin pages from the WordPress codex up in my browser. I really would like to get more involved with the development end of WordPress, but it is my sketchy knowledge of PHP that limits how much I can do. Since I have at least a two or three more weeks of down-time while I heal up from surgery, I hope to make some use of that time to learn a little more about how to write plugins for WordPress. I’ve come up with ideas in the past for things I’d love my WordPress installation to be able to do, things that, thus far, no one else has created plugins for. So, I hope to learn and add a few things to the WordPress community myself.

I’ve got other things to work on, as well. I still have plans to create a customized WordPress theme. I’d started work on a minimal theme last week, but that’s been on hiatus due to surgery last week. But now that I’m beginning to feel better and gain some more mobility again, I hope to get back to this project, as well, and try to finish it up. The skeleton I’d managed to build last week will probably undergo an overhaul, though, as I’ve changed my mind about some things in my mind about where I want to go with it. Heck, if I get _really_ ambitious, I might even tailor a new bbPress theme to go with it.

Resetting HTML

I’ve recently discovered the wonderfully marked-up “Sandbox”:http://plaintxt.org/themes/sandbox theme for WordPress and, in so doing, discovered the inspiration to build another theme for myself. But I also discovered rather quickly that there were a few minor problems with things not spreading out to the furthest edges of the browser. So I sought help and found that I needed to reset the margins for the html and body tags. I was also directed to this fabulous CSS entry called “Reset Reloaded”:http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/, which provides global resets for just about everything in a basic web page. I applied these and discovered the beauty of a WordPress theme with absolutely no formatting whatsoever. It’s a wonderful thing.

From there I’ve begun restructuring every element to my satisfaction, building what I need and want. And with Sandbox, this is made all the easier because everything has an id or a class (or multiple classes). All I have to do is look at the page source and see what tags are generated by the built-in code and then build the stylesheet accordingly. I’m working on a single-column, minimalistic theme with very few (if any) frills or flourishes. At this point, I’m thinking that most of the traditional sidebar content will also be shifted to a custom-built page template, but that one I’m going to have to work on a bit and see what comes of it. It’s a work in progress, and I’ll likely finish it up sometime later this week, due to the fact that there will be a brief pause in all coding work while I read the final installment of Harry Potter tomorrow.

If you’re a web coder, do check out Eric Meyer’s “Reset Reloaded.” I think you’ll like what you see and how much it cleans things up for you from the outset.

Code Geek

I am a WordPress god! Ok, not really, but I _am_ enjoying the fact that I can now manipulate a WP theme pretty easily. It’s true – the more you use CSS, the more you play around with web design, the better you get at it.

I host a number of different websites for myself and for friends on my shared account, and I’ve been helping a guy who maintains one of those sites tweak a WP theme to force it to behave. He’s done most of the actual template work, taking an existing one and hacking it pretty heavily to change it to a very different look and feel. I spent a couple of hours IMing with him last night adding additional tweaks to the theme – like adding a navbar at the top of the header, dropping the sidebar completely from the theme (since it’s going to be essentially a static CMS once everything’s in place), and changing a number of other small elements. It was fun to realize once all that was done that it was a lot easier now than it had been the first time I tried to change and manipulate a WP theme back a year or so ago. I’ve gotten a lot more comfortable both with how individual WordPress elements function as well as with CSS itself in being able to position and affect various things on the page.

From the first time I started teaching myself HMTL about 10 years ago until now, I’ve always enjoyed playing around with web page design. I’m pretty much self-taught, which is also why I don’t know nearly as much as I’d like to. I’m pretty well-versed in HTML and CSS now, and I know enough about PHP to be able to hack the code, though I don’t know enough PHP to write pages from scratch, much to my chagrin. But sometimes I don’t wonder if I shouldn’t go into the information technology business. I love playing with server-side utilities, I love hosting websites, and I love just building things out of code. It’s a hobby that I’m pretty passionate about. I’m just afraid that if I ever turned such into a business, I wouldn’t enjoy it as much.

I don’t know if I’ll ever actually step into the IT business – it would probably require me to find both the time and the money to pick up formal training to finish filling in the gaps of my coding knowledge, and that’s not something I’m sure I’ll ever be able to do. But the prospect of being able to go freelance sure is appealing to me. I’ve always wanted to be self-employed. There’s plenty of time, though, so it’s an option that I’ve not completely ruled out yet.

I’m starting to think, though, that it might be time for me to create another WordPress theme. Anyone have any suggestions for layout and features?

FoS Redesigned

I’ve just finished a complete site redesign on “Flashes of Speculation”:http://open-dialogue.com/fs, giving it what is, I hope, a unique and attractive layout.

I built this template – called Speculation (for obvious reasons) – from the ground up, stripping the necessary files down to the bare code to keep WordPress running and then builing everything back up around that. The result is a light-weight, minimalistic theme that serves to display just three categories (four, technically, if you count the announcements field at the top) on the front page in a 3-column format. In this case, I wanted to separate out the three primary genres of fiction that FoS specializes in, give a single-line teaser, and a link to the full post. The archives are structured in a similar manner, albeit in a single column, and the page navigation can be found in the footer.

Unfortunately, this theme will not be offered for public release at this time. Due to the specialized nature of the theme, it’s a beast to configure, and I haven’t the programming knowledge at this point to automate everything in the Dashboard or make the selection of categories and pages in the various places more efficient. That _is_ something I will likely research for a 2.0 release to the public. For the time being, however, simply enjoy the theme on FoS and feel free to let me know of any bugs or glitches you notice.

Tag Filters

I’ve a feature request for all you php ninjas out there, particularly those of you who develop plugins that do strange and wonderful things with tagging:

How about making the ability to tag posts in WordPress a little bit more powerful? For instance, I use “Ultimate Tag Warrior”:http://www.neato.co.nz/ultimate-tag-warrior/ to create a site index here, and it’s nice to be able to click on a particular tag and see all of the entries that fall under it.

Here’s the thing, though – I’d like to see it be possible to filter down still further into those entries. Instead of, for instance, being able to see the entries that fall under speculative fiction only, I’d like to be able to add more tag filters and see all the entries that have been tagged as _both_ speculative fiction and tv shows, or to be able to add still more filters so that I could see all entries that fall under speculative fiction, tv, shows, and heroes, if I wanted to get that specific. It would also be cool to be able to filter by an ‘OR’ command, so that I could sift through all my entries and see all posts that have been tagged as _either_ science fiction _or_ fantasy, for a larger list. I believe that this could easily be done using AJAX to add and remove tags at will. “bbPress”:http://bbpress.org already has something like this in place for individual posts, so I don’t think it would require much effort to modify that script slightly to make it do more and go further.

So, any javascript/php geeks out there looking for a new challenge to expand the functionality of some of useful tools to make them even _more_ useful?


If my previous “aside”:http://open-dialogue.com/blog/?p=247#respond had you a bit confused, I was celebrating my success at _finally_ being able to get a new hack to work. I’ve often had cause to write a quick one-liner, but I hated wasted all that space because once I published it, the metadata takes up more space than does the actual content itself. I hated the way it looked, but I also hated not being able to spiff up my briefer thoughts. So, I found “Matt’s Asides”:http://photomatt.net/2004/05/19/asides/, but I couldn’t get it work. Matt hacked “The Loop”:http://codex.wordpress.org/The_Loop to have it check a specific category and then format it differently when it displayed. This allowed users to take up less space with very short posts while still allowing readers to submit their comments on the content.

The problem was that The Loop in my template’s index was structured differently, rendering Matt’s hacks ineffective when I tried to implement them. In point of fact, trying to put them into my code took my site offline due to syntax errors. Several hours of searching the Web for upgraded hacks yielded nothing helpful, so I resigned myself to not being able to use the hack after all.

The solution came in looking for a reasonable substitute. I’d settled on using a linklog to accomplish a similar function, and in the process I found a plugin called “wp-recent-links”:http://rebelpixel.com/projects/wp-recent-links/. Part of the install process for this plugin involved replacing your templates index with the copy provided in the .zip file. In looking at the code, I realized that The Loop syntax looked very similar to the one that Matt “cited”:http://wiki.wordpress.org/PhotoMatt/index.php in his write-up. So, I tried substituting again Matt’s hack code into The Loop syntax for my new “index”:http://www.open-dialogue.com/blog/files/index.phps file, which actually worked this time. So, I then used a “little snippet of code”:http://www.tamba2.org.uk/wordpress/asides/ ((bottom of the page)) from another source to format the bullet of the aside and hacked my stylesheet to gives my asides a little bit of extra flare.

Since different template authors structure their index files differently, the only problem I had to overcome was finding an index file that was close enough to the original such that it would allow Matt’s Asides hack to actually work. A learning experience, to be sure.

I realize that this has probably bored most of you to tears, and for that I apologize. But in the event that someone else would like to implement this hack and run into similar problems, I share my experience in hopes of reducing the number of headaches that someone else might face. Feel free to “contact”:http://open-dialogue.com/blog/?page_id=220 me if you have any problems or questions.

Learning Style

I am very much a self-taught learner. My preferred learning style is to sit down with the subject at hand, a relevant task, a stack of reference manuals, and plenty of time to just hack my way through until I figure it out. I learn best through the process of trial and error, but I have to have a starting point, which is the reason why I require a specific task to accomplish.

I learned how to write in HTML(hypertext markup language) because I wanted to build my own web page. With the help of internet references and an HTML(hypertext markup language) book, I was able to build my first web site. Granted, it was pretty garish – it had every bell and whistle I could write code for, but I wanted to try everything out. My design sense has matured quite a bit more over the years, and you’ll find that most of my web sites are now much more sensible and a lot less blinding to look at.

I learned how to code in C during my brief sojourn in engineering, and again, I learned best when I was able to get back to my dorm room, sit down at my computer with my textbook, and hack my way through the code to complete each project. I’ve since forgotten pretty much everything I learned from lack of use, but I’m sure that I could probably pick it up pretty quickly again. I’m finding that most programming languages are very similar.

I learned how to use the SPSS statistical software during my graduate assistantship; I needed to be able to crunch some numbers and produce useful conclusions from it, and so many hours were spent just learning how the program handles data. It figures, though, that my favorite way to produce programs was not the point-and-click process but rather through the syntax editor and hardcoding the commands. Can you say ‘geek?’

Now, my job requires me to learn some new software in order to complete some of my projects. I have been working extensively in SPSS’s big brother SAS, which has no point-and-click interface. So, I have been forced to work in the code itself. Not a problem, right? That’s true, insofar as I love working with the code and seeing what the software is actually doing. The trouble comes in when I discover that SAS handles data much differently than does SPSS. My entire morning was spent just in trying to figure out how to get SAS to read from an existing data set without overwriting it with a blank one first. The solution was in figuring how SAS works with libraries, and now I have a very useable, workable program.

I could have asked for help and probably found the solution much more quickly than I did, but I prefer to solve problems myself. For one thing, it is much more satisfying to determine a solution on my own, but for another, I learn better by figuring things out for myself (hence, the reason why I thought I might make a good engineer). All the headache and aggravation of the first half of my day paid off when I was able to solve the problem. And now I’ll remember how to ‘fix’ it should it ever occur again. I’m just a very hands-on learner.

I love my job.