Archive for the “Web Programming” Category

Been working on a new project that will go into previews for selected friends and family later this week and go into general release a few days later, once I've had a chance to fix any issues my preview users find.

One part of the project was to add "Tweet This" links to certain items on the site, where clicking on the link would send the user to Twitter and fill in the suggested text of the tweet for them.

It's actually a lot simpler than you think. The format is: http://twitter.com/?status=[URL encoded tweet text].

Now many of you are asking how you "URL encode" the tweet text. Well, if you're using PHP, you use urlencode('text'); where "text" is the text of your tweet. If you want to do it in JavaScript, the PHP.js library has a javascript equivalent for PHP's urlencode.

But here's a little trick I didn't know about until I made this mistake. Make sure your link goes to twitter.com, not www.twitter.com. If it goes to www.twitter.com, the text doesn't get properly decoded. So, trying to tweet Creating a "Tweet This" Link - http://www.brainhandles.com would look like Creating a %22Tweet This%22 link - http%3A%2F%2Fwww.brainhandles.com, and nobody wants that.

Share

Comments 8 Comments »

So, I had this problem. I have Marc Liyanage's PHP 5.2.4 package installed on my MacBook Pro and use it for local dev tasks. It's supposed to have JSON installed, phpinfo says it has JSON installed, but when I ran a bit of code that used the json_decode() function, I got the "call to undefined function" error.

Read the rest of this entry »

Share

Comments Comments Off

A frame from my ComicScript proof of concept

A few days back, more than one web-comic artist I follow linked to an interactive comic as an example of a cool use of technology to enhance cartooning. The problem for me was that it was in Flash and a little complicated. I wanted to build a tool that any cartoonist could use to create something like that.

So I came up with a utility I call ComicScript. I'm still just at the proof of concept stage, but basically when it's done, any comic artist who wants to build a grid of panels will just fill in a few details about his/her grid and get the JavaScript code and files needed to implement the grid on their site or blog.

Check out my test of an 8 x 2 (8 wide by 2 tall) grid comic (I would have posted it here, but I realized my proof of concept was too wide. Love to hear what you think.

Share

Comments 1 Comment »

So, I was futzing around with the site today and wanted to try out a forum plug-in and a poll plug-in. Forgot to back up beforehand.

Didn't like them, removed them. Then this evening went in to do my manual biweekly backup (I created the database outside of the cPanel structure long ago, so cPanel doesn't include it in the nightly backup), saw some tables related to the poll plugin, marked them, then hit the "drop" command.

Only I hit the one to drop the whole database, not just the marked tables. Clicked yes to the "are you sure" warning, because I thought it was just dropping those tables, then found out I'd dropped the whole database.

MySQL apparently doesn't have a "holy crap" button to immediately undo disastrous mistakes, and in all this time, really doesn't have a method to undo a database drop. You might possibly reconstruct it, but in general you're stuck restoring the database from backups.

Luckily I back up regularly, because I'm relatively paranoid. I lost a few edits to later chapters in the novels. More saddening is that I lost a number of comments posted in the last few days by friends and new readers including a discussion on the use of racially charged language in the early chapters.

So, for those of you who manage your own server... back up, back up, back up, and pay attention to those warning messages. We've gotten so used to them we mindlessly click. But if I'd read the warning message, I'd have known that I was about to kill much more data than I thought and could have stopped before it was too late.

And to those of you who posted comments in the last few days... SOOOORRRRYYYY! Won't happen again.

Share

Comments 2 Comments »

Get an angel for your site An Angel Watches Over This Site