Category Archives: Projects

PEAR Channel for WordPress

After researching PEAR channels, I’ve come the conclusion that it should be placed in an installer framework.

I will still continue development of the other two in the framework and continue work on building a PEAR channel for WordPress, even if it would use my server instead of the official WordPress server.

I’m thinking it won’t be that difficult. There are some areas that I’m unsure of, but I should discover them when they come up.

Possibly Related Posts:


Web Application Installer/Upgrader

I’ve been contemplating this problem. I think the system should support three methods rated based on the preferred methods.

  1. SVN (version control, preferred method)
  2. PEAR
  3. HTTP

I would prefer Subversion (VC)

This should be the preferred since the version control already has a system in place for downloading, updating (upgrading), and merging based on what changes someone has done. It would only need to get the URL to the subversion and have the location of the Subversion application or by checking if the Subversion extension for PHP is installed.

This wouldn’t require that the installer move the old files to another folder and can assume that subversion can clean up any changes. There might be problems when conflicts occur, but I think for the majority of people that would used this method wouldn’t have problems if they left their files alone.

I think this will be possible without too much trouble. First search for the SVN extension and use it, else search for the SVN application.

If neither exist, then go to the next method.

PEAR

PEAR is an awesome method of installing an application. If I can create a PEAR channel and use that to install WordPress, I can also use it to upgrade WordPress, when it needs to be. This could will need further checking. It needs access to PEAR, either the command line, or PHP extension.

This would most likely require moving any changed files over to a new folder and allow the person to copy over what they changed. I don’t know how PEAR handles these situations, but it is better to be safe than sorry in this type of situation.

If neither exists, then go to the next method.

HTTP

Not the best method as it would require moving existing files in the event that some might have been changed. The other problem is that like the above, it would require that the four methods work of GETting a file work. If any of them fail, then the installer would be broken and have no other fall back.

If None of them Works

However, I do think that for most people at least one of the methods above would work for most people. Those that it doesn’t work for, would have to use the age old FTP method or try to find someone that will do it for them.

It has to just work

This means that for most people it has to just go out there and try to find the most common places where Subversion and PEAR exist, if they are installed. It should also try to use multiple methods of getting a file by URL. It should allow for configuring the locations and methods used instead. An “auto” method for novices or people who just want it to work and a “manual” method for more experienced users or for people who want more control.

If it works out, I will apply it to installing Astrum Futura.

Possibly Related Posts:


Unit Tests for WordPress

I think for as much coverage as possible the following should be done for encompassing the whole of WordPress using tests. The PHPUnit version 3.2.0 should include many new features that should allow for better testing WordPress in environments more true to XP programming techniques. Along with PHPUnit, I have been meaning to build a site for statistics, but I think it will come later when I have more tests done.

  1. Unit Tests and Characterization Tests.
  2. Hook Tests
  3. Database Tests
  4. Acceptance Tests

Unit Tests and Characterization Tests

There aren’t very many functions or library files that allow for true Unit Testing, so I would rather combine the two tests, instead of trying to keep them separate. This would allow for coders writing tests to not worry about whether the function can be unit tested or have characterization tests. Comments should be made for the methods on what is tested to let others know if the test is an unit test or characterization test to the knowledge of the author.

All actions and filters will have to be disabled while running the tests to allow for just testing the functions. Testing the hooks would be done separately. Looking through some of the bug reports, it seems that some hooks are required to test for some obscure bugs. This should be done in the next section.

The unit tests and characterizations tests should be run by themselves, separate in execution from the rest of the tests. I have also been meaning to remove dependencies on my changes. I think that since the last WordPress commit, that is no longer an issue.

Hook Tests

Remove all filters and actions and manually add the hook workflow to test the result. This would require mock functions that duplicate the functions or running the full version of WordPress, except for the output.

Testing the hooks has more to do with regressions and refactoring of hooks, since hooks should work as long as the plugin test passes.

Database Tests

PHPUnit 3.2.0 will include DBUnit which will allow using a snapshot of the database and test output using that instead of a real database. This should be extremely helpful in testing Database Queries.

Acceptance Tests

Test the blog site to make sure that everything appears correctly.

Possibly Related Posts:


Unit Tests For WordPress Bug Hunt

I’ve been focusing on phpDoc for the taxonomy file and I think I’ll take over for the other files. It would probably help other developers. I’ve known a few times where I had to read the function code and it would had been easier if there were documentation to understand what the function intention was and how it was supposed to be used.

Sure the codex is good in the sense that a lot of the code is “documented” for end users. For plugin developers and hackers, you have to be somewhat skilled to understand the flow of the code. Some of the files are documented, a lot of the important files are not. Depending on blogs and the codex, doesn’t seem optimal.

The Bug Hunts

I already have a unit test in place for four of the ~20 files or so. I’m taking care of the easier files, but I’m hoping to have more coverage and better tests before the final 2.3 Release Bug Hunt.

Which means spending more time on the code coverage. I’ve been thinking of “cheating” with the code coverage by calling a single function in each file. This would give me all of the testable files and the total code coverage and not just for the files I’ve already been testing.

Going through the taxonomy API, I think I can provide full code coverage before the final release, which should be useful for testing any future bug reports. It is easier to build a bug report if everything else is tested than before.

Cleaning Up the Unit Tests

At this point, I’m more concern with completing as much code coverage and test coverage as I can. Making it pretty and acceptable can come later.

Gaining Karma

The unit tests has always been a way to further my knowledge of building Unit Tests and doing so quickly. The karma part is applying it to Astrum Futura and Quantum Game Library.

However, it wouldn’t hurt to write documentation and test suite for WordPress. If WordPress lasts a long time, the Unit Tests would be worth it. If WordPress devs had started it two years ago, who knows how different the development might be today. Who knows what might change in the future. If people see how useful Unit Testing is, more people may adopt it later.

Possibly Related Posts:


Stopping WordPress Branch for now

I think I’ll learn more from the base systems as a whole by patching WordPress. I’ll get more feedback and gain further insight into WordPress and how it works for when I get back into the PHP5.2 only Branching. Also, the separation should further help me, because of what my main focus is going to be.

Splitting WordPress into Core and Blog

I’m going to continue my direction of trying to separate major functionality from blog functionality. I know that WordPress MU works along side WordPress, but I want to try to make it easier to extend the Core or Base and work from there.

This would mean that the main feature would be a extremely simple CMS with only page support that allows signing in and an administration panel.

I know that some others are working on an upgrade feature, but I want to work on one for myself and transfer it to another project.

I’m going to unit test all of my code as I go through everything. I also want to try to do acceptance testing at some point, if I can get it working. It will be easier to do the Unit Testing now and when I get the system in place, work on functional testing.

Continuing Splitting Presentation from Business Logic

There are still some areas, I guess since the core developers don’t feel that others should play around with it, that is hard-coded and requires manual modification of presentation. I want to try some other ideas and see how well it goes.

Keeping PHP 4 In Mind

I’m going to test with PHP 4.4.4, and fix issues that come up with the unit tests, but that is pretty much it.

Spending Time

I’m not sure. It depends on how quickly I can move and get stuff done. I have this month to decide on what direction I’m going to take. Once I start school, I won’t have much time. Or at least a lot less time than I have now.

Possibly Related Posts:


Branching WordPress For Fun

I accepted Matt’s challenge for creating a PHP 5.2 WordPress. Well, he didn’t really set up a challenge. He just said that PHP 5 offers nothing for WordPress or did he? Doesn’t matter.

I think it would be fun in the mean time to toss some ideas that I had and apply them to a system that already exists. Applying the same problems with a system that doesn’t exist became difficult because I couldn’t gain perspective of the whole.

It is also really fun to gain some insight to the system that runs this blog. More so than I can get anywhere else. Refactoring WordPress is a lot more fun than perhaps Coppermine, or Gallery2. I think I could learn a lot from Gallery2, it is just that I’m not quite ready to dive into that level of complexity.

I’m not taking this seriously and will most likely only use it for finishing some prototypes and toss it. Hell, WordPress works so far, so why change it? Also, the development is currently at a pace that it would be difficult for me to catch up.

Possibly Related Posts:


Constantly Refactoring

Frequent refactoring can save time and processing in the long run. Once a function, method, or class becomes too long, then it is time to split it up into smaller pieces. By doing so, you create a library which can be reused over and over again, instead of rewriting the same functionality in multiple functions, methods, or classes.

I am finding that there are disadvantages, but I firmly believe that by breaking large components into smaller ones serves the better good. It does increase the time of development and documentation is even more important to keep track of where every piece went. To demonstrate, I’ll discuss recent projects and what I learned.

Read on if you are interested.
Read more »

Possibly Related Posts:


Project Goals

The last post was about Personal Goals and really it is easier to accomplish those goals, except for keeping a girlfriend, I keep forgetting that women are human beings with emotions, thoughts, and get angry frequently when you don’t treat them as such. It is easy, because I live my life every day and need no motivation to wake up, to go to work, and to breath and maintain family relationships. It isn’t like my family is just going to stop being my family. I do have problems maintaining friend relationships, but I’m trying harder. Having friends is healthy and part of being happy.

It is easier to accomplish a task if you don’t feel like it is work, but enjoy doing it. Which is why I keep putting off the Quantum Game Library and Astrum Futura. I’ll leave the excuses out, but the real reasons are that I don’t want to at this point. I lost focus, but Astrum Futura should be a fun project. Quantum Game Library has already been a wonderful time, so I would very much enjoy programming again for it.

However, the fix for the Dijkstra has kept me from doing so. “Holy crap, slope and arc degree math equations! Ahhhhhhh!” I really do think I’m overthinking what might be a really simple problem. Others have done it in as little as a few lines. I just don’t think I understand the algorithm as much as I should. It is coming to me piece by piece, but it is back to the trial and error coding development. That style takes a long time before the expected outcome. Even so, slope isn’t difficult, from what I remember of the equation it is really simple. Tangent and cosine gave me problems doing High School Geometry class, so I’m a little scared going back into it.

It is the challenges of programming that makes it so fun. If it was easy, then you never have something to shout in praise about after you completed it. “Hell yeah! It works! It works! I only spent two months to get it to work!” Good times.

With that said, I’m only going to spend the weekends on the Quantum Game Library and Astrum Futura for this month. Whether I keep to it or not doesn’t matter at this point, because I plan on spending next month doing hardcore coding and focusing my energy on it.

June

  1. PHP Opcode Series (weekdays)
    • Zend Engine case studies
    • PHP Opcode Internals
    • Quantum: Math Library1
  2. Astrum Futura (weekends)

1 – Part of Quantum Game Library, but I’m lumping all of C++ coding in the PHP Opcode Series case studies, since I don’t think I’m going to be working on the extension every day. I’ll discuss “Quantum: Math Library” in a later post. Well, it is taking the suggestions for Quantum Game Extension and implementing it instead.

July

  1. Fix Dijkstra algorithm and implement A*
  2. Other QGL components (if time)

Short Term Goals

I think I should just stop doing long term goals for project development. I had wanted to have Mecha Asylum done, two years ago. Well, it is technically done, in a sense that it works (kind of), but still not where I had imagined it would be at this point.

Planning a year in advance is nice, but that only works when I have a 9 to 5 job, where there is more of push to get the work done. Finding motivation can be difficult, but only because I expect the outcome now and keep forgetting that the journey is the best part.

I have enjoyed QGL development up to this point, but the Dijkstra bug might be more than I can handle at the moment. I think working on the Astrum Futura should be interesting for now.

Possibly Related Posts:


Dijkstra Bug: Deadends and Really Bad Algorithms

I should point out that it isn’t the algorithm for Dijkstra that is wrong, because tests show that the algorithm does what is expected. It is the internals of the Abstract (Ai_Pathfinding_Abstract) which completes both the Dijkstra and, when finished, the A* algorithms. The only reason the first (and only) test was successful was because there were no “deadends” internally.

(Some days I wish I was more intelligent, such solutions would come easier than and such problems would never had existed.)

A deadend is where the algorithm comes across neighbor nodes that had already been checked or have higher fitness than the current node. What is happening is that a deadend is being found after each iteration, which isn’t supposed to happen. The “Solution”, which is wrong by the way, is to rewind back to any available node and start over from there. It explains why the algorithm will “jump” from one point to another, instead of the correct moving along to the next neighbor.

The correct solution has always been to save each node path and then then move back when a dead end was reached until the end was reached and save that and every path that completes. The solution involves a tree data type. The solution before was more a queue which was incorrect.

I’ll have to spend some time testing and developing a tree based solution. Should be fun. Also the internals will also have to be changed, the API won’t change. I’m thinking of breaking the algorithm into three methods, one for the algorithm specific code, one to build the tree, and the last one to traverse the tree and pick the correct path. I’m thinking of keeping all of the completed paths and allowing them to be accessed by the user. What this would allow is choosing the best path instead of the shortest.

Metrics

I need to think about adding metrics to the algorithm, which would help make it more complete. Right now the only metric is the distance between the node and the end node. There needs to also be metrics for depths (3D terrain heuristics), choosing “jumps” (wormholes, portals, etc), and different types of terrain (such as moving through water would be slower or faster for certain types).

My main focus was to first get the algorithms working and then go back and allow “advanced” features to be implemented. Not that I’ll be doing all of the work, or maybe I might, but really to allow others to go in and add their own metrics.

I think if I can get the tree done, I can do a better job of allowing metrics. The API would have to change when I do.

Possibly Related Posts:


AI Dialogue Chatting Web Service

I’ve been thinking about including this feature in the Quantum Game Library package. However, I think it would be better as a standalone web service.

The reason being was that when I was designing it at the beginning, I wanted to have multiple sites interconnect and “talk” with each to share what each other knew. However, something as complex as this would need to reach a larger crowd to be effective. Same thing as Akismet, the service needs as much feedback as possible to “learn.”

However, aside from that, I also want to allow for customization of dialogue for mission based effects. Such as if an player asked about the “Mountain of Doom,” the game would first check how much the character knew about the topic and how much the NPC knew about the topic and choose the dialogue from the “script.” It wouldn’t exactly follow it word for word, but it would use what it knew and could possibly learn more about the subject and update the “script” afterwards for future players.

Actually, it could be anything that the webmaster sets up for which the person can chat and get text for. I want to also include a sort of built in learning mechanism which asking further questions about the topic to build up it’s knowledge base. It could also be applied to the above “scripts” and should eventually expand that to be less predictable.

Well, there are a few issues with this. It would take a long time “training” the AI to get up to the point for which it can intelligently start to choose words that made sense together. It would also take a while to set up the service API that allows for the above. The web interface to set up the scripts. It would also need about a couple of years to gain enough phrases to be seen as intelligent and to expand what the API and service can do for users.

It would be better to start now, but I’ll need to seriously need to further my AI research and see what already exists. I know that there are a few libraries that will help me out already, but just putting them all together will be the difficult part.

There are just some things that are better as a service than something that is bundled with every user. I had another AI service for something else game related, but I forgot what it was. I’m sure it will come to me eventually.

This is probably a Summer or early Fall project. Summer is just around the corner and I still need to catch up on a few other projects.

Possibly Related Posts: