continue reading hover preload topbar hover preload widget hover preload

Validating Startup Ideas

Categories: Startup, Web Development  |   No Comments

About 2 months ago, an article came across Hacker News about how to quickly validate startup ideas. The idea is basically as follows:

  • Identify a potential problem you’d like to solve
  • Create a landing page that states the problem and that you have the solution
  • Give little or no insight in to your solution, just that it works
  • Collect email addresses on your landing page
  • Run ads tailored to your idea and landing page
  • Tweak as needed to get conversions (sign-ups)

Ubuntu, Node and Heroku

Categories: Node.js, Open Source, Software, Web Development  |   No Comments

I recently started playing with Node.js, and while I can play locally just fine, I wanted to make sure I had a place to host once I had something worth hosting. Enter Heroku. Why? Because it’s free to host until you draw some real traffic, it has a really cool addon service and I knew other people using it so I could turn to them if I had problems.

In order to get your application on their service, you need to install their command line tool, which requires Ruby. No problem, just install it all with apt-get and you’re good to go, right? Short answer, yes. Long answer, No. You’ll be using an unsupported version (the version of ruby in the Ubuntu repos is aged), so while it might work now, it may not in the future. If you do like I did, you’ll also end up with 1.8 and 1.9 on your machine, and while that didn’t cause any problems, it seemed silly.

Poking around, I found this article which lays out how to use RVM to both install a newer version of Ruby as well as easily update it in the future. So, here’s the whole shebang:

Serving Files in Internet Explorer over HTTPS

Categories: Computers & Technology, PHP, Software, Web Development  |   No Comments

I recently came across a problem where serving a file to Internet Explorer would result in the following error message.

This affected IE6, IE7 and IE8 in my testing. The way I was serving the file was through PHP via readfile. Before sending the contents of the file, I was, of course, setting some header parameters so that the browser would handle the file and the user wouldn’t just see some binary garbage on their screen. In my case, I was serving a PDF file that was being generated server-side and sent to the client. The basic header parameters are as follows:

// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called your_file.pdf
header('Content-Disposition: attachment; filename="your_file.pdf"');
// declare Files Size here (for the sake of peoples sanity, please add this
header('Content-Length: '.filesize($filename));

This works just fine in most situations, but once you introduce a secure connection, IE fails with the above error. Of course, like most IE problems, this doesn’t happen in any other browser. Ugh.

Asynchronous PHP

Categories: PHP, Software, Web Development  |   No Comments

I needed to “asynchronous PHP” recently and it took me a little while to find the solution. What my script basically does is generate a PDF file for the user to download based on some parameters they have chosen. The problem was, the PDF generate take a while and during that time I needed to show the user a screen explaining that the file was being generated, which would also show the download link once the generation was complete. My setup is as follows:

generate.php

This script is where the user is sent when they click “download” on the parameter choice page. This is where the asynchronous magic has to happen. From here, the user is immediately sent to download.php.

download.php

This script gives the user either a “please wait” message of a “click here to download” message, depending on where the target PDF has been generated yet.

My problem was, even though was added the header redirect code (shown below) to generate.php, the browser would still wait for the PDF to be generated before sending the user to download.php. In other words, it was only synchronous PHP, which didn’t help me at all.

header("Location: download.php");

Thanks to this comment on php.net, I was able to make it work! Basically, you need to tell the browser that you are done sending it data, even though the PHP script will keep executing. Code below:

//redirects the browser to the new url, but continues processing in the background
function redirect_and_continue($sURL) {
header( "Location: ".$sURL );
ob_end_clean();
header("Connection: close");
ignore_user_abort();
ob_start();
header("Content-Length: 0");
ob_end_flush();
flush();
session_write_close();
}

So, the user is sent to generate.php, which immediately calls redirect_and_continue(‘download.php’), redirecting the user to download.php while still continuing to execute generate.php (and make the PDF file). Once the user is at download.php, the script checks for the existence of the generated PDF file (as indicated by the filename sent through the session) and uses a meta refresh tag in the HTML to keep reloading download.php. Once the PDF file exists, it provides the user with a link to the PDF file for download.

Building a Better CAPTCHA

Categories: Computers & Technology, Software, Usability, Web Development  |   No Comments

CAPTCHAs can be good for stopping SPAM, but the last thing most of them are are usable. Don’t take my word for it, it’s a fact. One of the coolest ideas I ever saw was a HotOrNot mashup where you had to pick the three best looking ladies to prove you are a human. It was both usable and easy for a normal person, like my Grandparents, to use. That’s pretty unique and hard to come by, and that’s why I liked it.

One of the other easier CAPTCHAs I’ve used at work is a little dynamic images that asks you to do a little simple math. It’s an idea I saw on another site so I thought I would give it a try and it’s been extremely effective despite it’s ease of being broken. Surprisingly, it has completely stopped all SPAM coming through our contact form.

Another one I tried, much less effectively, is a colored word and a dropdown with a number of colors to choose from. It literally asks “What color is this text?” and offers a number of possibilities. This, however, was not effective for more than a week or so. The form still sees about one or two SPAM messages a day, which is especially strange because it’s a site that sees far less traffic. I think if I added more colors that weren’t even valid selections and changed the order it might be more effective, but I still need to find something better.

I’m thinking a system that would show three images and ask which one doesn’t belong could be usable, but it’s a little more difficult to implement; where do I get the images, how do I randomize the data, etc. I really like the HotOrNot CAPTCHA because the images always change and all of the images and data are crowdsourced, nothing for you to manage.

So, what can one do? Sadly, I don’t have an answer, but there is a lot of work being done on the topic. I think I need to just keep looking and mull this all over for a bit. We’ll see what I can find or come up with.

Drupal’s On Hold

Categories: CodeIgniter, Drupal, Open Source, PHP, Software, Symfony, Web Development  |   No Comments

I know I said before that I would be replacing WordPress with Drupal around here, and I did start working on that. However, the more I read about Drupal, the harder it seems to do custom things. Actually, it’s more a problem of poor documentation than it is a lack of flexibility. Still, if I don’t know what I’m doing, it’s hard to learn anything.

Granted, I could easily replace WordPress for the sake of my blog here (and probably still will at some point), but that’s not why I was planning to learn it. I wanted something that would allow me to crank out new pages quickly without constantly restarting from scratch. I do have a very weak framework I’ve written to try to achieve this, but every time I start a new site, I feel compelled to re-do at least part of it, so in the end I don’t save any time. In fact, I lose time because I have to re-learn the changes I made for each site when I need to maintain them.

Farewell WordPress

Categories: Drupal, Open Source, PHP, Site News, Software, Symfony, Web Development  |   No Comments

In an effort to save time when I put together sites for people, I’ve been working on a universal engine I can use. It is modeled loosely off the MercuryBoard code and, for the most part, has served me pretty well. Recently, I’ve tried to revamp it with more object oriented code, integrating PEAR and a few other niceties. Still, the more and more I use it, the more I realize it saves me very little time. In fact, it actually costs me time when I have to go back and update the sites. It seems, sadly, the idea of a flexible CMS or framework is just too abstract for my skills.

I’ve spent some time reading about Symfony, which looks like an amazing project. I’m positive I can make it do anything I would need, but the learning curve is pretty steep and I’m worried that the time I’d take to learn it wouldn’t really pay off in the end. I like a lot of the concepts, but I’m just not completely sold on it.

So what does that have to do with WordPress? Well, I’ve recently revisited a project that I spent some time with in the past but never really did much with. That project is Drupal.

My History of Coding and Computers

Categories: Computers & Technology, Software, Web Development  |   No Comments

Apparently one of the people Aaron works with called him out on his programming and computer use history and he posted his response on his blog. In that blog, he took the liberty of calling out a few of his friends, myself included. I put off responding because my computer crapped out on me again. Now that I’m back up and running, here is my response. Enjoy.

Mootools, I Choose You

Categories: Javascript, MooTools, Open Source, Software, Web Development  |   No Comments

I’ve always been a “do it yourself” kind of web developer, but after reinventing the wheel time and time again and struggling to make my code work in the various different browsers out there, I’ve come to appreciate that I can save a TON of time through different libraries and toolkits. I’m no Javascript pro (though I am the resident guru at work), but I find the language interesting. Ever since Google came along and showed the world that Javascript can be used for more than just popups and other web annoyances, I’ve been enthralled with some of the cool things people have done with Javascript. From AJAX to Comet, simple DHTML to animations, it’s simply been an amazing evolution.

About a year ago, Aaron tipped me off to the magic of Javascript toolkits, specifically Dojo. For a while, I was a proponent of it, opting to use it exclusively to drive an internal application that I had written from the ground up at work. It’s an extremely powerful toolkit which has been steadily adding more functionality as it ages to that point that it’s arguably the most powerful toolkit on the market. Unfortunately, I’ve also found it to be one of the most poorly documented toolkits available as well, which I’m sure was due in part to my lackluster understanding of some of the more advanced Javascript concepts. Still, looking at some of the more advanced Dojo examples I’ve seen from Aaron and other sources online, most of the syntax escapes me completely, even as I continue to learn more and more about Javascript.

Valid XHTML and Opening Links in New Windows

Categories: Javascript, Site News, Software, Web Development  |   No Comments

Well, as you can plainly see (assuming you’ve been here before), the site has gotten a facelift. Now that Aaron has his blog up and his looking really nice, I felt compelled to try and jazz up mine a little too. It’s not done, but it’s nicer than it was. I’ll probably add a touch of color to the theme, but it’ll work for now. BTW, it’s based off the Milc 3.5 theme. The code isn’t super pretty, but it was a good start.

While I was working with the design, I realized that I needed to send over my old bit of code that opened links in new windows. As anyone trying to make valid XHML pages can tell you, the target attribute is no longer valid, so if you want pages to open in a new window and you still want your design to validate properly, you have to do a little scripting. I actually found this script a couple years ago to make MediaWiki links open in new windows and it’s served me quite well ever since.