Jeff Atwood made an interesting comment on his blog, Coding Horror, about how to take advantage of AJAX to send sort-of heartbeat back to the server to keep the session from expiring. I think this is a great idea. Getting automatically logged out is extremely annoying (unless of course it’s my bank in which case I’m appreciative).

From his post:

As a user, I can say pretty unequivocally that session expiration sucks. Is it really so unreasonable to start doing something in your web browser, walk away for an hour — maybe even for a few hours — then come back and expect things to just work?

As programmers, I think we can do better. It is possible. I am inundated with session timeout messages every day from a variety of sources, but I’ve never once seen a session expiration message from gmail, for example. Here’s what I suggest:

Create a background JavaScript process in the browser that sends regular heartbeats to the server. Regenerate a new cookie with timed expiration, say, every 5 or 10 minutes.

Continue reading ‘Your Session Has Timed Out’…

The Presentation

Without presentation a web page is just text. In the early days of building web sites styles and colors were mixed with JavaScript and large animated gifs. Yes, during those days they were referred to as “web sites,” no one called them “web apps” yet. And to be frank, with all that work that went into it that hurt my feelings. Anyway, today I’m going to go beyond just showing how to get Mako working with your templates, but go as far as show you a better way to structure your templates in a Rails-like fashion.

I’m going to leave explain Mako to the developers, but in exchange I will give you some real examples.

Some of my methods are borrowed for Ruby on Rails. I essentially have 3 parts to my presentation layer — layouts, views, and elements.

Read the rest of this entry »

A checklist to stock investing

27 Apr 2008 In: Investing, Tips

I started investing in stocks and mutual funds back in college (~3 years ago). There were some simple things that went overlooked that I did right, and a whole bunch of things I overlooked that I shouldn’t have.

My portfolio consisted of Chipotle (CHP), Sirius Satellite Radio (SIRI), On Semiconductor Corp (ONNN), and ReGenerex Pharmaceuticals (RGN).

I purchased Chipotle for all the right reasons and the rest of my portfolio for the opposite. Essentially I bought Chipotle because I ate it — a lot. I was their most loyal customer. Chipotle had quality food, at a good price, with a streamlined service queue. And I probably ate it 4 times a week.

The rest of my portfolio was based on tips and hunches, nothing more. I bought RGN on a tip from a friend. I didn’t know their business model, and I definitely didn’t know how much volatility exists in the biopharm industry. And I certainly didn’t know what happened during trial phases.

SIRI seemed like a good buy after just grabbing Howard Stern. However, I failed to look at several factors. XM was a major competitor. They are both losing money (it costs millions to get satellites up). Are there other products that could disrupt the market (e.g. iPod).

About a month ago I started getting into investing again. This time I am determined to do it right. Armed with a realization that there is a lot I don’t know, but more importantly knowing what to look out for, I am prepared to do it again. I started researching for methods by which others value a company. I decided to come up with a checklist for things to look for before buying a stock.

Read the rest of this entry »

About Me

Code. Design. Explore. is the blog of John Brennan, a web developer/designer, entrepreneur, and avid world traveler. I currently live in Brooklyn, NY.

I am the Co-Founder of OpenAction and lead Product Development. We are a open platform social enterprise that helps organizations engage with donors, share knowledge with other non profits and empower the community to get involved to create positive impact on our planet.

This blog will mostly be around building cool things, although I will surely include my travel experiences when I am abroad. Feel free to subscribe to a specific category if that is only what interests you. And please connect with me. I always enjoy meeting new, interesting people!