Archive for the ‘programming’ Category

Choose Authors From Registered Users

Tuesday, July 29th, 2008

I’ve made my first, hopefully useful for public consumption, plugin for WordPress. I’ve made a few other plugins, but none of them seemed to be really useful or customizable to benefit others.

About this plugin

This plugin uses the same data as the WordPress function wp_list_authors();. This function lists all of the authors that have posts associated with their accounts. See the Codex for more information about this function.

Note that you cannot use this function outside the WordPress Loop. There is another plugin that creates a list of authors outside the loop, and it works very well for this purpose.

My plugin, which is a widget that can be used in any widgetized theme, allows you to pick users and list them by inserting the widget into your theme. If you have users with posts who should not be listed, simply do not check their names.

If there is interest, I’ll expand this so that it can be used inside the Loop as well, but it seems to me that it is most practical for sidebars.

Why make this plugin?

This plugin is not an attempt to compete with any of the methods listed above, although certainly it does have some of the same functionality and could easily be expanded to have all of the same functionality. Its difference is that it allows for users with posts to be excluded from the list. There are a couple of situations where this could be useful.

  • You have a blog with a large number of authors, and would like to feature a few of them. Maybe they are more popular, or have more posts, or are more regular posters. You can check these to be included in the list.
  • On the flip side, you could have a blog with certain authors that you do not want to feature. You can simply leave these authors out of the list.
  • You use your user pages to include users that have comments, instead of just users that have posts. The configuration of this plugin shows all users, regardless of whether or not they have posted or are assigned a certain role.

Download

Without further ado, feel free to download and try out this plugin.

Plugin:
Choose Authors From Registered Users (maybe it needs a better name).
Version:
0.5
Download
wp-chooseauthors.zip

JavaScript functions on page load

Thursday, April 17th, 2008

One of the biggest annoyances (for me) about JavaScript is that the famous window.onload = functionname; only works once on a given page.

Over the years, many people have written various solutions to go around this, and cause the page to load multiple functions. Typically, my favorite is this one from Simon Wilson. It’s easy, concise, and works in a myriad of different situations.

The other day, though, I ran into a situation where it didn’t work. I’m still not sure what the issue was, but Internet Explorer 6 (of course) refused to load a couple of the functions I was trying to use. Firefox, IE7, Safari, etc. all loaded them very nicely, but IE6 remained stubborn. I tried everything: rewriting the functions, removing everything else in the page, changing random things that were unrelated, and so on, all to no avail.

Finally, I decided to try jQuery’s load solution:


$(document).ready(function(){
  functionname();
});

This worked perfectly, in every browser. It didn’t occur to me to use this, mainly because the offending functions are not jQuery functions, and that particular page in the site didn’t have any jQuery on it at all. Now, it does.

File this away under: “I’m already using jQuery on a site, and I need to load some non-jQuery functions.”

Reasons for IE8’s Default Behavior

Tuesday, March 4th, 2008

As I’ve been thinking about the new default behavior that Microsoft announced for IE8, it occurs to me that there are a lot of reasons for Microsoft’s decision. In light of these thoughts, I want to look at the reasons that I think are likely possibilities.

Standards as a whole

Microsoft, especially in the last year or two, has made a lot of moves toward standards, web and otherwise. They announced the Interoperability Principles. They announced the ASP.NET MVC Framework, which finally allows programmers to control the HTML generated by ASP.NET. IE8 will pass Acid2, and any number of other things.

While I’m not optimistic that any of this will cause Microsoft to act in any unexpected ways with respect to its attempts to acquire Yahoo, it is clear that a shift is occurring, to whatever extent.

Noise from the web standards community

Advocates of web standards have made a lot of noise about the original decision, and it is clear that Microsoft listened. Many people made logical arguments for why IE8, especially from a long-term perspective, should not default to IE7 behavior, while understanding that the option for IE7 behavior was a good thing.

Legal issues

It’s entirely possible that this is partly related to Microsoft’s various legal troubles, and that they are trying to appear as a better business citizen to help their case.

Future versions of IE

I think one of the most significant benefits, both from the perspective of future versions of IE, as well as future versions of Firefox, Opera, Safari, etc., is that the need for version targeting will probably become much less because IE8 is the default behavior. People who create sites that break in IE8 will, certainly, have the option of targeting IE7, but in order to do that they’ll have to learn that they can.

Most people who will run into the issue will probably not have the interest (or the time, possibly) to find out this kind of solution. The ones who do find out about the solution will find out that Microsoft doesn’t see it as the ideal solution, and will probably feel at least some pressure to learn proper ways of doing things. Thus, in a few years, it is entirely possible that versions of Internet Explorer that follow version 8 will be met with a majority of sites that do not break.

That’s not to say that the majority of sites will follow web standards. I’ve seen innumerable websites that didn’t break when IE7 came out, because they had such disregard for web standards that none of the changes affected them. I suspect we’ll have to deal with this for a long time. But that’s fine with me, as the future of web browsers can continue to look forward.

Microsoft Expands Support for Web Standards

Monday, March 3rd, 2008

See this press release:

“IE8 has been significantly enhanced, and was designed with great support for current Internet standards. This is evidenced by the fact that even in its first beta, IE8 correctly renders the popular test known as ‘Acid2,’ which was created by the Web community to promote real-world interoperability,” said Ray Ozzie, Microsoft chief software architect. “Our initial plan had been to use IE7-compatible behavior as the default setting for IE8, to minimize potential impact on the world’s existing Web sites. We have now decided to make our most current standards-based mode the default in IE8.”

The web standards world has been abuzz for the last few weeks, following the announcement that Internet Explorer 8 (and, presumably, any number of future releases) would have the default behavior of rendering websites in the same way that Internet Explorer 7 does. Causing the browser’s behavior to advance would have required that designers and developers direct it to do so with a meta tag.

Many standards-aware designers and developers were very understanding of the decision to allow websites to target IE7, avoiding issues with badly-programmed websites that break when browsers move forward. However, many of these designers and developers made a lot of noise wishing that Microsoft would allow the default behavior of websites to advance as the browser does, and require those who want to target IE7 to read a little bit and find out about the meta tag.

Apparently, Microsoft listened to the noise. I’m amazed and pleased by this change in strategy. I hope they will be able to spread the word enough, so that websites that will break with IE8’s improved standards support will learn about their options (1. learn how to write standards-compliant code, 2. include a one-line meta tag). I feel pretty confident that this is unrealistic, but I hope that it will happen to the extent that Microsoft doesn’t have to go back on this decision.

Internet Explorer 8 is Acid2 Compliant

Thursday, December 20th, 2007

From the Internet Explorer team blog:

…I’m delighted to tell you that on Wednesday, December 12, Internet Explorer correctly rendered the Acid2 page in IE8 standards mode. While supporting the features tested in Acid2 is important for many reasons, it is just one of several milestones for the interoperability, standards compliance, and backwards compatibility that we’re committed to for this release. We will blog more on these topics.

Wonderful news. Web designers and developers everywhere agree with me that IE6 is the bane of our existence. There’s no need to discuss this further. IE7 is a massive improvement, and in general I’m pleased with the direction that the team seems to be taking for the future.

Acid2 compliance is, for me, an unexpected leap forward. Currently, Opera and Safari are the most widely used browsers that have achieved this milestone. Firefox 2.x does not reach this level, although Firefox 3 (which is in beta and, I’m sure, will be released well before IE 8 is) does.

ASP.NET MVC Framework

Thursday, October 18th, 2007

In light of the project mentioned here, I have been spending a lot of time in the past few weeks thinking about MVC and MVC frameworks. This post indicates that Microsoft will be releasing a new ASP.NET MVC Framework later this year.

I find this exciting. I have not been a fan of ASP.NET, due to the horrible HTML that it generates, and my lack of knowledge about how to separate the various parts of an application to have more control over the HTML. Evidently, this new system will give me that kind of control. I’m totally impressed by that.

As annoying as some of Microsoft’s projects can be with regard to standards and such things, I don’t envy the variety of developers that they have to try to please. They have to try to please the hardcore programmers that don’t care about the front end at all, and they have to try to please the designers who are really picky about the front end. Hopefully, this will help.

Observations from a rushed Ruby on Rails project

Wednesday, October 10th, 2007

Over the last month or so, I’ve been hurriedly attempting to learn Ruby on Rails for a client project. Essentially, this project has involved too many requirements with too little time. So basically, I’ve been a desperate designer seeking a way to program a site with very specific requirements in as little time as possible, with as low a learning curve as possible.

I know PHP fairly well, but I don’t know any of the MVC frameworks that exist for it (Cake, Symfony, etc.) If time ever allows, or a project dictates that I do so, I may try to learn these, but for this one I thought it was wisest to go ahead and dive headfirst into Rails, and learn it as I go. So, I bought a book. This book teaches Rails through designing a social networking site.

Thus, it covers Models, Views, and Controllers in what I would consider to be significant detail. It covers migrations, database access, relationships, and so on. Toward the end, it covers REST and briefly covers scaffolding. I have heard that scaffolding will not be a part of the next full version of Rails, so I have not used it in my client project. For the most part, though, everything else that I learned was essential to the development of this site.

Observations thus far

Essentially, Rails is amazing. At this point, I’m not ready to be posting code examples, but so many things are happening so much faster and easier than they would in PHP, or .NET; which of course is the reason I’m trying it in the first place.

The slogan in the Rails community is “convention over configuration.” In .NET, and more so in Java from what I hear, one has to configure a lot of things in the initial setup of the application. In Rails, there are conventions built in so that one does not have to do this. I love this. Almost everything I have needed to do so far has a convention built into Rails that one can use to do it. My task has been to learn as much Ruby as possible, and learn where these conventions are built so that I can take advantage of them. Brilliant.

The Rails community

In PHP, there is a vibrant community. There are any number of forums where one can find help for almost any issue. Many times, i have received an error for whatever random reason, copied that error exactly, and pasted it into Google only to find out that others have had the same error, and to learn how to resolve it.

Rails isn’t there yet, or my errors aren’t there yet, but the forums have been a lifesaver. Rails Forum and Ruby Forum are full of people that have been so gracious and willing to help.

Moving forward

As this project continues, and after it’s over especially, I hope to continue learning the best practices for Rails, and to continue diving into Ruby as the programming language that powers Rails. There’s something about being on a deadline that forces me to really start learning things…

The hunt for the ideal CMS

Wednesday, August 22nd, 2007

Currently, I’m in the midst of a hunt for a Content Management System (CMS) to use for a client project. Basically, this hunt is occurring in the hopes that I can save time on the project by using something that is already in existence. The system I’m looking for would have to do the following:

  • Create a directory of businesses, with support for international locations and a hook for and/or built in support for the Google Maps API.
  • Allow for different levels of businesses, and also a hook for and/or built in support for ecommerce to create said levels.
  • Allow for these businesses to be filed in categories based on the field of business where they practice.
  • Allow for these businesses to be connected with the kinds of things they do. For example, an auto mechanic might be connected with replacing radiators. These things would have to be connected with the field of business. For example, a lawyer would probably not replace radiators.
  • Allow these businesses to be searched by location, category, and things performed by the business
  • Be secure, including form validation, user access, and blocking of at least the most common vulnerabilities (if I know about it, it should definitely be blocked)
    • I was researching Joomla in the hopes that it might provide such a solution, when the site I was looking at was hacked and taken down as I navigated it.

I feel like such a search may be a pipe dream, and that if I did find such a solution, it would probably have such a high learning curve that I wouldn’t save time over a custom built solution, which is the goal of this search in the first place. However, the search makes me wish I had already had the time to learn Ruby/Rails and Python/Django…

The Underground Railroad

Tuesday, July 3rd, 2007

I haven’t had a chance to post on this yet, but the new version of the Underground Railroad went live last week, just before my wife and I left for Cornerstone (which, I hope to write a couple of posts about).

It’s important to note that this new site isn’t what you would call complete. New features are in the works for both long and short term development, and the site is built in such a way that it is easy to add new features and new content.

About the Underground Railroad

The Underground Railroad is an organization that seeks to network ministries that work with underground and alternative subcultures. At this time, I know of connected ministries in the United States, Canada, and several countries in Europe. I believe there are also ministries in Asia and South America that will be added in the near future.

This illustrates the fact that underground culture is worldwide, and that God is doing things in the underground worldwide. Dissatisfaction with the mainstream is worldwide because something of a mainstream is worldwide, and there’s a unity that can be found in that.

About the website

The website of the Underground Railroad is something I’ve been privileged to be a part of since 2002, when a friend introduced me to it. This new version has been in the works for some time. Over a year, at least. For most of my time in college, I was married, working fulltime, and attending school fulltime, and didn’t have as much time to work on awesome projects like this. Since I finished college in December, my freetime went up a bit and I was able to finish the site.

In any case, I was responsible for the design and development of the new site, as well as some of the new content. Other parts of the new content are still pending, but believe me when I say it’s better that the new site be up with pending content than that the old one have lived through another Cornerstone.

As far as design and front end structure, I feel that there’s a clean, dark look for the most part, and that it’s somewhat minimalistic. Part of this is intentional, and part of it is due to the slowness that often comes with receiving graphical material from so many different sources. I intentionally avoided the use of a lot of generic stock photography, but I do hope to include relevant photos as the site continues to develop and receive input. Front end structure is generated by the back end system, and is written to be valid XHTML 1.1, with valid CSS. I’ve never done a site to the 1.1 specification, and thought I’d give it a try.

The back end is written in PHP 5, with a MySQL 5 database. As much of the PHP is object oriented as my knowledge allows, which I’ve found to be more than I thought it was. While I can’t claim that this is an MVC Content Management System by any means, I feel that it is a cleanly coded system. This is by far the biggest project I’ve done with PHP, and has proven to be quite the learning experience.

What now?

Now, there are several other projects that will begin to require attention. Some are ministry related. One of the most important to me is, again, designing this blog. Let’s hope that begins soon.

Poignant guide to Ruby, and other news

Wednesday, June 6th, 2007

So, I’ve just recently finished a nice freelance project that allowed me to create an admin system from scratch. I used PHP/MySQL, and rather enjoyed myself learning a lot of things I didn’t know about admin systems. I’ve created a couple in the past, but never one this object oriented, or this efficient, or this powerful. So I enjoyed it, and hope it gets approved by the client. Anyway.

As I’ve noted in other posts, I’m fairly close to finishing the Underground Railroad’s redesign, and then I’ll be able to work on other things. The Underground Railroad needs to be done by Cornerstone, at the end of this month. It has a decent amount of work remaining, but I feel pretty confident I can get it done in time. It also is using PHP/MySQL, but is quite a bit more intensive, object oriented, and powerful than the admin system, simply because it’s an entire site from the ground up, rather than just the admin system.

One of the other things I intend to turn to upon finishing this, other than designing a theme for this blog, is learning Ruby/Ruby on Rails. I’ve debated with myself about whether I want to learn Ruby, Python, ColdFusion, or try to learn .net in a better way than I did in college. I feel strongly that I didn’t learn the best way of doing things that .net has to offer… whether that’s wishful thinking or not is yet to be seen. Don’t get me wrong; I don’t feel that it was the fault of the professor so much as the curriculum, as it was evolving after she took it over, and certainly did improve drastically from the point it was before she took it. Anyway. I’m not ready to deal with .net stuff again at the moment, if I ever will be, and ColdFusion is interesting, but I’m not sure where its future will take it. So, my major decision has been between Ruby and Python. I’m still not entirely decided, but I’m leaning toward Ruby.

I’ve found this hilarious guide to Ruby, and it looks like something I could enjoy working through. It has funny language, funny drawings, and appears to be teaching in a way that is easy to follow while actually learning some things about the language. So, I look forward to working through this.