Benjamin Lu

everyday is cool

A Menu You Can Use Without a Mouse

Retrospective web development exercise for the 2008 archive. Open a small site and put the mouse aside. Press Tab from the address bar and see where focus goes. If you can open the first menu item but can’t reach the second, check whether it’s a real link or an element … Continue reading →

2007: Looking Back

Written retrospectively for the 2007 archive. Looking back at 2007, I’m thinking about what gets lost when the only copy of a project is the one on my computer right now. I can see the page as it is, but I may have no idea why a particular line was … Continue reading →

A Small Site in Git

Retrospective web development exercise for the 2007 archive. Start a local repository with an HTML file and a stylesheet. Commit the working page, change only the link color, and run git diff. The useful part is seeing the exact decision you made before you save it. Commit the color change … Continue reading →

Enough Time to Listen

He that answereth a matter before he heareth it, it is folly and shame unto him. — Proverbs 18:13 (KJV) I can sometimes hear the beginning of a question and think I know the rest. In a conversation about a computer problem, that might send me looking for the wrong … Continue reading →

2006: Looking Back

Written retrospectively for the 2006 archive. Reading the 2006 entries together, I see how much of learning happened in small experiments. A form keeps what I typed after an error. A redirect sends an old link to the right page. Each gives me a little test I can run again. … Continue reading →

A JSON Endpoint in the PHP 5.2 Era

An early Ajax request might return a fragment of HTML. JSON gives the browser a different option. The server sends named values, and the page decides how to display them. PHP 5.2 is a useful point in the timeline for this exercise because JSON support was bundled and enabled by … Continue reading →

Making Time to Say Thank You

Enter into his gates with thanksgiving, and into his courts with praise: be thankful unto him, and bless his name. — Psalm 100:4 (KJV) It’s easier for me to remember a problem that took an hour than the person who made the hour easier. Maybe they stayed to help me … Continue reading →

Printing an Article with CSS

The navigation that helps you move around a website can take up valuable space on a printed page. Try making a print stylesheet for an article without changing the screen layout. @media print { .site-menu, .sidebar { display: none; } body { color: black; background: white; } .article { width: … Continue reading →

Keeping Site Notes in SQLite

Python 2.5 added sqlite3 to the standard library in September 2006. A small SQLite database is enough to try saving website notes without setting up a separate database server. Use Python 3 for this recreation. import sqlite3 db = sqlite3.connect("notes.db") db.execute("CREATE TABLE IF NOT EXISTS notes (title TEXT)") db.execute("INSERT INTO … Continue reading →

A First jQuery Click Handler

jQuery 1.0 was released in August 2006. One way to understand its appeal is to look at a small interaction. A link or button can find an element on the page and change its visibility without each page having to write the same setup code. Here is a recreation using … Continue reading →