Category Archives: Programming

Finally updated Kalin’s PDF Creation Station WordPress plugin after three years

I’ve been saying I wanted to do this for a long time now, particularly as WordPress had classified my plugin as abandoned after three years of no updates and the TCPDF engine I use has been steadily updated. So today I released a new version of Kalin’s PDF Creation Station, version 3.2. I added a couple little new features, like now you can specify which type of name you want with your post_author shortcodes instead of being stuck with the login name. I also added a couple options to the post_thumb shortcode so you can select a size or set it to try to scrape the post and pull out the first image it finds. I wanted it to be a bit more advanced than that, like being able to specify exact sizes instead of just “small”, “medium” etc, but WordPress doesn’t seem to want to let me do that even though it says it can in the documentation. I also wanted to be able to have an option to randomly select an image scraped from the post instead of just the first image, but that would have taken a lot more work and I figured it wasn’t worth the effort.

Most importantly, though, is the upgrade to the TCPDF engine. I’ve been told this new version is much faster, so hopefully it will be more reliable as well and allow you to create much larger documents, as the old version seemed to conk out if you tried to compile more than 100 or so posts into a single PDF. I was hoping it would have better handling of images and fewer of those weird empty spaces in the final PDF. I think it may do better with the empty spaces, but the image support is still spotty. I’m not sure if that’s the fault of TCPDF or WordPress. It seems like both systems have been steadily updated so I’m not sure why this is still a problem.

I was also working on a plugin called Advanced Post List, which is a fork of Kalin’s Post List, but we both seemed to have burnt out on that one for some reason, even though I made the same two shortcode changes to that plugin that I did to Creation Station so I may wind up updating Kalin’s Post List as well. These plugins did always bring in a lot of traffic to my site, even if the visitors aren’t here to read my stories or opinions, it’s nice to have someone coming here for something.

Apple Hates Me

So the other day one of the Apple fan-boys I know said that he likes Apple products because he doesn’t like “tinkering”. He likes things that “just work.”

It’s funny, however, that sentiment is one of the reasons why I do not use Apple products. It almost seems like Apple fans are living in an alternate reality. The things they say just don’t seem to match with the things I’ve experienced.

Just a day or two after hearing this, I was browsing files on my Mac at work, and needed to move up a directory level. Seemingly a simple procedure. Normally I would do a search for the file I was looking for or  memorize where I was then start from a new window, but I thought of this “it just works” sentiment and figured if the Apple fans were right, there must be a simple way to go up a directory level.

So I searched. I did find a page that claimed it was “easy” and then the page went on to say that you must write your own program, use PhotoShop to design a new button, then install that button, along with the app you wrote into your finder window so that you can have an “up” button.

To me, that sounds distinctly like tinkering. On Windows XP “up” was simply a button that could be clicked any time you want. With Windows 7 it’s even more convenient, with every directory level being its own button, allowing you to jump to whatever level you want instantly.

A couple days later a co-worker asked me how to mute the log-off sound that the macs make when you log off. (I think he was trying to make it so he didn’t attract attention to himself on days he was leaving early.) I told him to just mute the computer, but apparently, no. According to him, even if your computer is muted, it still plays the logoff sound. He mentioned later that he had searched and again, found someone saying it’s “easy” to mute the logoff sound. All you need to do is write out and install this app.

…but to me, installing a special app to be able to mute your computer sounds a lot like tinkering to me.

This reminds me a year ago, at a different job, I asked a co-worker how to get the file address of a file in Finder. He told me, of course, that it was “easy”. All I have to do is open Terminal, drag the file into Terminal, then copy the output. Again, this sounds a whole lot like tinkering. In Windows you always have your address available right there at the top and you can copy and paste any time you want. No special programs required.

I started thinking that maybe Apple fans are not seeing the  whole picture. It’s simpler, for sure, perhaps easier to understand at the very beginning, but easier in the long run, I don’t believe so. They are constantly told it’s easier, but how? What specific examples are there of things that work easier on an Apple? People are constantly claiming they are easier to use, but can never seem to point to any real-world examples. But they are constantly told it’s easier, and that, combined with the slick white interface, makes them feel more at home, so they can convince themselves that things are going smoothly.


I have been electrocuted by Apple desktops several hundred times due to their poor static discharge. This has happened to me with half a dozen different Apple desktops over the years. The one I use currently, thankfully, has only electrocuted me four times in the three years that I’ve been using it, so it seems Apple has mostly fixed this issue.

I bought an iPod once, to discover I had to install a special program (iTunes), only to discover that my iPod would not recognize my music files because I did not have perfect track information implanted on them.

I once plugged an external hard drive into a mac and the first thing it did was wipe all the information, formatting it without my permission. I lost all my personal data backups and had to cancel my plans for the evening so I could go home and copy all my files over again to ensure I had a proper backup.

These, to me, are not examples of things “just working”. I understand why some people prefer macs, because they do have a shorter learning curve if you’re doing basic stuff, but to make blanket statements that they are always better, and call people idiots because they don’t use them, as a huge number of Apple fans tend to do, I think is entirely unfair and does not foster a fair playing field for modern technology.

As someone who spends many hours a day on a mac and many hours a day on a PC, and has done so for almost ten years, I can say with confidence that I personally prefer the PC experience.

Thank You and Sorry to My Plugin Users

So in the last six months or so I’ve gotten much worse about answering the frequent comments left on this site regarding my three WordPress plugins, PDF Creation Station, Easy Edit Links and Post List. I want to thank everyone who has left praise for my creations and say that I’m thrilled at the lack of complaints considering what a learning curve they have and the fact that they’ve actually got a fair number of little bugs that I’ve never taken care of because they don’t affect me  when I use them on my own website. I can’t believe Post List and Edit Links are both at a five star rating as of this post.

And I just remembered as I was writing this, that Advanced Post List exists. This is a plugin that someone developed that is based off my Post List code. I remember he contacted me a year or two ago and asked my permission to do this, which of course he didn’t need, but was just being polite. I tried out his version and it didn’t work and I told him that if he got it working and he hadn’t removed any notable features, I’d officially deprecate my Post List plugin and send all my users to his. Then I never heard from him again and figured he’d abandoned the project. Turns out he just did a release earlier this month and has far exceeded my user base and still has nearly a five star rating.

So I need to get my local development version of WordPress up and running so I can install his plugin and make sure it works properly, then replace my plugin with a pointer to his, then I will be done with Post List support forever but the functionality will live on. The best of both worlds. One of the beauties of the open-source arena.

And I know I said I’d get back to working on Creation Station as someone pointed out a bug with disappearing images that I was able to reproduce on my own site, and the PDF engine, TCPDF, has probably come out with updates that need to be added. But frankly, I just have other priorities. I wish someone else would take my Creation Station code and start calling it their own. As far as I know it’s still the best PDF plugin for WordPress and it’s sad that it’s not being developed or actively supported anymore.

And I abandoned Easy Edit Links a long time ago because the WordPress core came out with a solution that solves the same problem… even though Easy Edit Links works better.

So anyway, I’m going back to work on my latest novel, so I’m sorry everyone who has asked a support question and is waiting for a reply. I will probably get back to you at some point, but I may start going through them in batches once a month or so, so I apologize for that.

But I must say, it has been pretty great doing these plugins. Definitely one of the proudest moments of my career, even though I don’t think I made more than two hundred bucks in donations total between all three of them. Most of the code I have written professionally was, in one form or another, designed to get money from people, so it feels good to have supported a community like WordPress.

YourLanguageSucks – TheoryOrg

YourLanguageSucks – TheoryOrg.

Nerd alert! Someone at work showed me this page because we were bitching about problems in different coding languages. My favorite is ActionScript, but for some reason everyone is hating on Flash right now as we transition to HTML5. I have almost entirely transitioned my career away from Flash and into JavaScript now, but every day I fight with JavaScript and wish oh so hard that it had been designed as cleanly and intelligently as ActionScript.

So anyway, read through the 34 problems this page lists about JavaScript, then go down to the ActionScript section. They list a total of 2 problems, one of which is also a JavaScript problem.

And I’m an anarchist, so this makes it extra ironic that I miss ActionScript so much as it’s basically owned by Adobe while JavaScript is totally open, but most programmers just don’t realize how amazingly quick and easy it is to develop Flash, or particularly Flex, projects in comparison to using other development environments.

Flash and ActionScript have such a big list of advantages over HTML5, but unfortunately the few drawbacks are pretty significant for just about anything other than graphics-based online gaming.

It just makes me sad that so many people want Flash dead when the actual development of Flash is so clearly superior to similar technologies. I feel like the internet is taking a step backward.

Wacky Words Facebook Game – My Newest Programming Project

Wacky Words

So this is my newest project: a massive multiplayer text based comedy game I’ve been working on for the last few months in my free time.

The Game:

The idea is a worldwide competition to see who can invent the funniest or wackiest concept or product. You can bet or invest in the ideas you think are the funniest and gain experience points, level up and buy skills either by being funny or deciding what you think is funny. It’s a very bare-bones game currently but eventually it will have a large social element tied to your facebook friends, walls and posts and stuff. Kinda like how the other facebook games utilize wall posts, except that everything in my game will be funny and unique… or at least will try to be.

You start by reading other people’s creations and voting or investing, or you can jump straight into the second tab and start drawing random words which you can then drag to combine into funny phrases and concepts. Write out a description or “sales pitch” for your wacky concept, submit it, and start earning gold and experience points from the votes. Wanna get really intense? Hound your friends to vote for your creation… or if you’re a real dick… hound all your friends to vote against someone else’s idea.


At this point the game has just the basics: ability to create new concepts and write out your sales pitch, with some text formatting. Ability to browse creations, vote up, vote down, invest and gain money. Currently I’m building the leveling system and a set of half a dozen different skills like more votes and investment tokens. Then I intend to add sharing features and hopefully tie the commenting with the Facebook posting system. Maybe I’ll add live chat for all that smack talk. Then it’ll need some friends integration, so you can see your Facebook friends in-game and with that, the ability to challenge each other and hold mini-competitions to see who can get more votes. (At this point the popularity-contest aspect of this game could be very important.) I will hopefully be able to bust out some apps for iPhone and Android, and finally, I plan to create a website that automatically makes a new post every time someone posts to the game so that regular web viewers who would never go to a facebook game or download an app would get to see all the funny crap.

Of course… this is all under the assumption that people actually find this game kinda fun and want to play it. I haven’t had the most success in the past with getting people to play my games, so please follow the link up top and give it a try on your facebook account and send me your feedback.

Nerd Stuff:

You may notice the front-end is built in flex. I debated this decision for quite a while, but finally chose flex over HTML5, mainly because of the ease of development. At this point, HTML and JavaScript just can’t compete with Flex in terms of rapid development and being that I’m only one developer I want to be able to  get this done as quickly and easily as possible. Flex should also allow me to easily create mobile apps for all the major devices. I’m hoping it’ll be just a matter of moving some stuff around to fit on the smaller screen or breaking functionality into smaller screens. Flex is so modular that that should be simple to achieve.

On the other hand… I have to learn JavaScript for my job right now anyway and I may become much more comfortable with it and depending on how the future of Flash unfolds, I may wind up regretting my decision.

For the backend I chose Google App Engine and Python. App Engine was an easy choice. It makes perfect sense because I’m already a fan of Google products and seem to feel more comfortable within their design methodologies than most others. Again, rapid development was most important and App Engine certainly helps with that. No worrying about setting up databases, background processes, security or–god forbid–load balancing. A massive-multiplayer game like this wouldn’t even be possible for a lone programmer like me without all the pre-built systems. Now it’s a piece of cake.

I picked Python to use with App Engine. I wanted to use PHP, since that’s got the biggest programmer base and I’m already comfortable in it, but of course, PHP is not natively supported… why I have no idea… and I’m not gonna trust a third-party App Engine PHP interpreter. So it was between Python and Java. I’ve worked in Java before, a couple years ago when I made my first Android App and… meh… it was okay. It’s no ActionScript, but really, what is? So I did a few Google searches for “Java VS Python” and most people seemed to prefer Python, so that’s what I chose. Maybe not the best way to decide, but there ya go.

Customize or Remove Header and Footer in PDF Creation Station

Occasionally folks have asked me if they can remove or customize the headers and footers in my WordPress plugin, PDF Creation Station. Unfortunately I’m trying to focus more on my fiction writing right now so I’m on a development hiatus and haven’t been adding to this plugin. However, if you can hack some simple PHP, someone left this comment explaining how to do it yourself.

Thanks for the info Luis!

yes you can!, i´ve done it on mine, $objTcpdf->SetPrintHeader(false); $objTcpdf->SetPrintFooter(false);

this lines are to remove the header or footer and have to be written on kalins_pdf_create.php somewhere around lines 218 – 220

or search in the tcpdf.php file for –> public function Footer() { function and there you can add some text or change the black line

for example to add some text on the left side of the footer i add

$textofoot = utf8_decode(‘CONFIDENCIAL: La información aqui contenida,es para la evaluación del cliente.’);


ActionScript Interview Study Notes

About a month ago I lost my job making Flash banner ads, so I had to get out there and look for another ActionScripting job. I updated my portfolio website, uploaded a resume to and the calls and emails started rolling in. I decided to start studying for my job interviews, having been in many ActionScript interviews. I took some notes of the kinds of things most likely to be asked, and thought I’d share them with anyone interested in making themselves look like an ActionScript expert.

I didn’t have time to complete these notes, so there’s some buzzwords and OOP concepts missing and I wanted to write a section about coding methodologies and office tricks like XP, Agile, Scrum, standup meetings, planning poker etc. I wound up finding a job too quickly and didn’t have the need to finish this post.

Describe the event cycles for a mouse event:

(This question seems to be asked in most of the ActionScript interviews I’ve been in, so make certain you brush up on everything relating to events.)

three phases: capturing, target and bubbles. Capturing phase starts at the top-parent movieClip and moves down the display list, firing the mouse events on every clip. Then the target phase is when it fires the event on the inner-most object that was actually clicked. Bubbles then goes back up the stack, firing the mouse event again on each of the parent clips.

by default, addEventListener listens for events in the target or bubble phase. Third parameter, called “useCapture” can tell addEventListener to listen in capture phase. Doing this allows you to call stopPropagation() on the event object to stop the rest of the event phases from firing.

mouseEnabled property on movieClips allows you to turn off the event firing, if for example, you want something in the background to be clickable but it’s being covered by another clip.

Event object properties: type:String, eventPhase:uint, bubbles:Boolean (tells IF this event will bubble, not if it’s currently in that phase), cancelable:Boolean, target:Object (the actual object that was clicked, the one that fires during the target phase), currentTarget:Object (the object that is currently firing the event)

The difference between target and currentTarget is important if you are listening for a button click, for example, but there is another movieClip inside that button. If the internal movieClip is clicked, that will be the target, but if it’s clicked around the outside of the internal clip, the button will be both the target and the currentTarget. Usually you’ll use currentTarget because that’s usually the object you’re actually listening to.

addEventListner params: type:String, listener:Function, useCapture:Boolean, priority:int (priority for multiple listeners attached to same object), useWeakReference:Boolean (usually want to set this to true so garbage collection doesn’t count the function reference, so it can be cleared from memory if you forget to removeEventListener)

more info:



I’ve found that whenever an interviewer wants you to code something on the whiteboard, it’s almost always a simple loop-based puzzle, like ordering items in an array, finding a duplicate item, copying an array, etc. If I had more need of studying, I would search Google for these kind of basic loop puzzles. I suspect that this is a common whiteboard exercise in a lot of different coding language interviews as well as ActionScript.

Buzzwords and OOP concepts:

(In my experience the most important things for an ActionScript interview to have a handle on are the model-view-controller architecture, the concept of encapsulation and abstraction, abstract classes and interfaces.)

Model-View-controller (MVC): view listens for model events and dispatches user events, controller listens for view events and calls methods on the model, model behaves as the central data storage so everything knows where to go to get info

encapsulation: encapsulates the internal workings, like an API or the plastic shell of a VCR

Abstraction: process of generalization – taking a concrete implementation and making it applicable to different, albeit somewhat related, types of data, like a generic database connection class that doesn’t know which database its connecting to

Abstract Class: a class that must be extended in order to be used. Provides common functionality for similar classes

cohesion: how clearly defined something is (strive for high cohesion)

coupling: how dependent a code element is on another (strive for low coupling)

inheritance: classes extending each other. Avoid this. Inflexible

composition: when one code element contains another. more flexible than inheritance. video player may contain a slider for example

aggregation: when one code element references another so the internal one has no knowledge of its ‘parent’, but fires its events and can accept method calls, and may not be destroyed when its ‘parent’ is destroyed

service delegate: a class or something used to interface with an external service, so all service calls can go through this delegate to make code more flexible

command structure: encapsulates a method call or action as an object so it can be stored, reused, undone, etc (most useful for projects requiring undo buttons)

Object Pool: an array or collection of objects that you can grab when needed and return to the pool when you’re done with them. Reduces overhead from needing to recreate the objects each time.

Singleton: If a class is only intended to be created once, add a static function getInstance(), which creates or returns an object of itself, ensuring it never gets accidentally created a second time

Polymorphism: objects of various types define a common interface or set of methods, like how + operator can be used on strings or numbers. they may do different things depending on the type, but will have same methods

Factory: creates objects without specifying the exact class of object that will be created, providing an interface/abstraction for object creation. technically a singleton is a type of factory

Decorator: allows you to add behaviors to an existing object on-the-fly; once class sort of encapsulates another, sometimes passing one class into the other’s constructor. Or conceptually it can be as simple as two different functions that both call a single function, adding their own changes to the result

Adapter or wrapper: translates one class interface into another

Composite: treating groups of objects as a single object, can be used if you find yourself doing the same operations repeatedly on similar objects

Kalin’s Post List version 3.1

Today I released version 3.1 of Kalin’s Post List WordPress Plugin. This, unfortunately, is mostly a cleanup release. I’ve decided to stop forward development on this plugin because I don’t seem to have any problem finding good programming jobs, so I don’t feel the need to expand my portfolio so much anymore and really need to focus on my story writing, which is still my first love. I do, however, intend to continue addressing bugs, maintaining current WordPress compatibility, and answering user questions.

If you have any interest in continuing forward development on this plugin, by all means, feel free. I’ll offer any advice or help I can.

There were a number of little bugs that I had to fix:

  • removed contextual help and added a link to the same help page on my website. this help menu was causing a problem with a small number of users who had XML support issues in their PHP installation. The help page is still available in the plugin source files
  • added [post_content] shortcode back into the documentation after I accidentally deleted it
  • removed global $post object from comments callback. Fixes bug where an extra post was being added to the page when this shortcode was used
  • Did same thing for php_function callback to fix the same issue. using php_function now requires you to pass in the necessary information through the shortcode parameter
  • removed a bunch of orderby options because they had stopped working in recent WordPress core upgrades
There were some features I really wanted to add, but decided not to dedicate the time:
  • custom taxonomy support
  • ability to list by author
  • ability to list comments as though they were posts
  • ability to select post status, so you can list only future posts or exclude private posts, etc.
  • ability to export all your presets to a JSON string or file, so you could save all your presets to your local computer, just in case your WordPress crashed or you needed to transfer them to a new blog.
  • advanced sorting to allow orderby to work for post slug or category
  • multi-level listing, such as ability to list off categories/tags/parents with sub-posts listed below each

When Atheism and Anarchism Coincide (Post List Test)

Today I released the new version 3.0 of Post List, my WordPress plugin that allows you to build presets that you can then refer to by shortcode in your posts, or add to your theme with a PHP snippet. Also, new in version 3.0 is a widget. I’ve added one called “recent posts” to my left sidebar, though I’m not sure if I’m gonna keep it. I’ve also added a bunch of cool features to Kalin’s Post List, like a shortcode to call a custom PHP function, post comments, tags, cats, and parent shortcodes, and a preview feature so you don’t need to make a test post to see what your list will look like.

One other feature I’ve added is the ability to require that all your selected tags or categories be included in every post, as opposed to the default behavior which only requires each post to have one of the selected tags or categories. This makes it so you can make lists of overlapping things, so just as a test to show you, I thought I’d give you a dynamically generated list of my blog posts that fall under both the atheism and anarchism categories.

Thou Shalt Not Lie - 02-23-2014
Faith • Equality • Family - 11-05-2012
Glass Houses Can be a Great Strategy - 10-12-2012
How do I Kill the Negativity? - 04-03-2012
Republican Dominated Florida Legislature Passes Bill Allowing Prayer In School | Addicting Info - 03-03-2012
Why is Breast Cancer not Scary? - 10-06-2010
Crime is not Logical - 09-07-2010
Thoughts on Dual Perspectives and the Hoarders TV Show - 08-08-2010
True Story About Isaac Zamora: Middle Finger Vengeance - 08-02-2010
20 Logical Fallacies - 07-26-2010
Why Most Americans Support Terrorism - 05-23-2010
Everything is OK series - 05-22-2010

Injecting Custom PHP Functions into Kalin’s Post List

In version 3.0 of Kalin’s post List WordPress Plugin, I added a new feature that adds even more customizability, the [php_function] shortcode which you can use to call any user-defined PHP function you have created. In version 3.1 of the plugin, I changed it slightly.

Here’s how to use it.

First, add this line into your wp-config.php file:

define("KALINS_ALLOW_PHP", true);

It will need to go above the line that says “That’s all, stop editing! Happy blogging.” This is for security, just to be on the safe side. I don’t believe there are any major security issues with this, but if I’m wrong, this ensures that no blog will be put at risk without permission.

Next, create your function. I put mine in my wp-config.php file, but you could probably put it in other locations. You can name your function whatever you want, as long as it’s unique. Your function may have one or two parameters. The first one (new in version 3.1) will always be the $post object for the current post in the list. If you can’t get all the necessary information from the $post object, the second parameter will be your optional custom param. If you require more than one custom parameter, you will need to pass it in as a delimited list or JSON string. The parameter will be a string, so if you need numbers or booleans, you will need to run a conversion on them.

Now that your function is ready, you can call it with the shortcode [php_function name=”function_name” param=””]. Replace the ‘name’ parameter with the name of the function. Replace the ‘param’ parameter with the function parameter(s).

As of version 3.1, this function no longer runs in a pseudo wordpress loop, so you cannot use the global $post object, but you now use the first parameter of your function, which should be the correct $post object.

The other option for getting post info is to actually pass it in through the ‘param’ parameter by use of a shortcode within the shortcode. For example, if you wanted a function called ‘myFunction’ to receive the post’s author as its parameter, you would use the shortcode: [php_function name=”myFunction” param=”[post_author]”]. The internal shortcode can even have its own parameters if you want. A shortcode with parameters inside a shortcode parameter that all runs inside a shortcode. 🙂


So here is an example of something simple you can do with this feature. If you copy this code into your wp-config.php, it will output an edit link only if the currently logged in user is the author of the post. You can then refer to this function in your post list with the shortcode: [php_function name=”postListEditLink”].

define("KALINS_ALLOW_PHP", true);
function postListEditLink($post){
	$user = wp_get_current_user();
	$wpurl = get_blogInfo("wpurl");
	if($post->post_author == $user->ID){
		return '<a href="' .$wpurl .'/wp-admin/post.php?post=' .$post->ID .'&action=edit" >edit</a>';
		return "";