Sorry, website is down for a bit. -Sha

Archive for the ‘Website’ Category

Website notes

Wednesday, May 20th, 2009

The website updating has been coming along, and I thought I’d just give some information on hacks/modifications I’ve done to WordPress, as well as some other website-related news.

  1. When I imported my old entries from Movable Type, I noticed that not all of the line breaks were preserved, which left all of my entries looking squished. I found this support forum post which detailed some changes you could make to the Movable Type import code to insert line breaks on empty lines, which will preserve breaks between paragraphs. I made these changes and re-imported the entries, and it all seemed to work great, until I noticed that my auto-generated excerpts (which are the first 55 words of an entry) stopped working. I started poking around in the function that displays these breaks, and realized that the change to the import code must have inserted an ‘\n’ character into the empty excerpt field. Since the excerpt was now technically non-empty, WordPress would show that instead of auto-generating one. In order to fix this, I edited wp-includes/formatting.php, line 1483 (in function wp_trim_excerpt) and changed:

    if ( '' == $text) {

    to

    if ( '' == trim($text)) {

    So now WordPress considers the ‘\n’ as empty, and auto-generates the excerpt.

  2. I installed the Configurable Tag Cloud which is similar to the built-in Tag Cloud widget, but is more…configurable. I did notice one weird behavior, which was that my long tags were breaking out of their containing div:

    tag-cloud-unwrapped

    I looked through the widget code, and noticed that for some reason, all spaces in tags were being converted to non-broken spaces (tag-cloud.php, line 202):

    $tag = str_replace(' ', ' ', wp_specialchars( $tag ));

    So I just commented that line out, and everything was happy:

    tag-cloud-wrapped

  3. I was looking for all my entries related to my marathon training, and couldn’t find them, and then I remembered that I had made them in a separate running blog. So I went ahead and exported them from Movable Type and imported them to WordPress. You can find most of them by clicking on the national AIDS marathon training program tag, or by browsing the Fitness catagory.
  4. Finally, I changed the favicon to match the new look of the site: favicon. You will probably need to clear your browser cache to see it.
Tags: , , ,

Debugging CSS?

Tuesday, May 19th, 2009

This is a question for all of you webmonkeys out there (Chris, I’m looking in your direction): are there any tools to assist in CSS debugging? By ‘debugging’ I mean knowing which styles are affecting a particular part of the page, knowing the bounds of a particular element, etc. My usual method is to edit a style to have a border or background color so I can more easily see what’s going on, and this is inefficient, at best. Other times, I have no clue what is making a particular element look the way it does (e.g. having some offset), so I just hack around with negative margins and things like that until it looks right.

If there aren’t any tools, what are your strategies for editing and debugging stylesheets?

Tags: ,

Facebook sharing from WordPress

Sunday, May 17th, 2009

I just added a “Share on Facebook” link to each entry on my site. It’s more so I can easily post my entries to Facebook from my iPhone (no copy/paste…yet), but if you feel so inclined, you (my gentle readers) are free to use it as well.

When I was adding them, I discovered that the examples on the Facebook site don’t work quite right on WordPress index pages, because they rely on location.href and document.title, so any time you had a share link from an index page, it would link back to that index page rather than the individual entry you wanted. I fixed this by having the Javascript function take in the URL and title parameters, rather than grab them from the current page:

function fbs_click1(url, title)
{
    window.open('http://www.facebook.com/sharer.php?u='+url+'&t='+title,'sharer','toolbar=0,status=0,width=626,height=436');
    return false;
}

The link then becomes this in your index page or individual entry template:

<a title="Share this post on Facebook" onclick="return fbs_click1('<?php the_permalink();?>','<?php the_title();?>');" href="http://www.facebook.com/share.php?u=<?php the_permalink();?>" target="_blank">[link text or image]</a>

As I understand it, the reason why it’s better to put the popup code in the onclick attribute (rather than in the href attribute, e.g. <a href=”javascript:fbs_click1(…)”>) is so that browsers that do not have Javascript enabled can still use the link; it will just not be in a nice popup window.

This is all very simple, but was frustrating to do because I made a couple typos, and had to just stare at the code until I saw the problem (missing closing quote…boo). Is it even possible to debug Javascript?

Tags: , ,

Great success

Friday, May 15th, 2009

I finished importing all of my old entries, and thanks to some clever URL redirecting, there shouldn’t be too many broken links. I know there is a bit of weirdness with all of the photos posted from Flickr, and unfortunately I think I might need to edit those by hand. But otherwise, I’m pretty impressed by how easy it was to import all the entries, including the infamous Tom Delonge post, with all 504 of its glorious comments.

Edit: Amazing; my site has been up for less than one day, and I just got my first comment spam.

Tags:

Hooray!

Thursday, May 14th, 2009

If you’re reading this, WordPress installed correctly. Woo! Soon I’ll be importing all the old entries (and picking a better theme), but for now, I decided to just get this up and running now.

Please join me in welcoming sha v 4.0! I was rather fond of The Green Machine, but I was getting a little tired of Movable Type, and I installed WordPress on my photography site (no, still not finished, stop looking) and really liked it, so I decided to switch my main site to it, too.

I’ll probably be messing with themes and layouts for a little while, so please excuse any visual weirdness you might see. Any weirdness in content, though, is all on me.

Tags:

I am Iron Man

Tuesday, May 6th, 2008

Actually, I’m slightly iron deficient. But I did see Iron Man over the weekend with Rahul and Buddy, and I enjoyed it quite a bit. Robert Downey Jr. really carried the movie well, and the vfx were really nice. I didn’t think it was the second coming of Jesus in movie form like some people, but it’s definitely worth seeing.

I’ve been thinking about launching an official photography/portfolio site, and I’m sort of against the idea (at least for now) of paying somebody else lots of $$$ to put together the site for me, so I’ve been looking into a couple scripts to present my photos in a non-crappy way. I found a nice one called Lightbox that uses Javascript, so I wrote some php code to go through a directory of images and set up the lightbox links for them. I think it might load too slowly to be practical, but you can check out my test here. There’s also a flash-based one called SimpleViewer that looks nice. I figure if I actually want to try to start booking some real gigs, I should have a nice site to point people to.

Tags: , , ,

Broked

Thursday, April 17th, 2008

Most of you have probably noticed that all of my neat Amazon links over yonder <— are broken. This is because Amazon recently upgraded their web services, and the plugins I use to generate those links only work with the old version.

I took a quick look at the plugin code and Amazon’s website about migrating to the new version, and I’m pretty sure I can get things working again. At least it should be a nice little lesson in cgi and perl.

Edit, 4/21/08: It’s fixed!

Tags:

How The Time Flies

Thursday, January 4th, 2007

Astute readers will notice that the year on the calendar over yonder –> is broken. This is because, when making lil’ .gif files for this particular site redesign in 2002, I never thought I’d still be going on with it in 2007. So please bear with the broken image for a bit until I remember what the name of the font I used is. (I think it’s this one.)

84758

Monday, April 24th, 2006

I’ve been getting unreal amounts of comment spam recently, so I re-enabled the “Type this number” thing in the comments form. I hope y’all don’t find it super annoying.

Tags:

Scam, Scam, Scam, Eggs and Scam

Wednesday, April 12th, 2006

Monday I got an e-mail from my hosting provider saying that they had temporarily suspended my account because one of the directories was being used to run a PayPal scam. Apparently I had accidentally made the directory world-writable, so some poohead uploaded some files used to scam people’s PayPal accounts into it. I sorted it out with my host and changed the permissions, so if you were unable to access my site over the weekend, well you know why. People suck.

In other non-scammy news, I spent the weekend in Seattle. Amanda was there visiting a friend, and since I’d never been to Seattle, I decided to tag along. Her friend has a ridiculously cute 15-month-old daughter (I was in full Shaparazzi mode, and got some nice pics of her), so we worked our schedule around hers, but still managed to do a lot. We went to Pike Place Market, The Seattle Center, The Fremont Flea Market, saw Thank You For Smoking, re-watched 40 Year Old Virgin, watched a few eps of Six Feet Under: Season 5, went running, walked around the neighborhood, and played with the baby.

I was surprised that despite being the birthplace of Starbucks, Seattle didn’t seem to have any more Starbucks locations than any other city. If anything, it seemed to have fewer. It did, however, live up to its rainy reputation, and drizzled every day. However, it was still a really nice trip, and lots of fun. Thank you so much to Laura and Peter and Sadie for having me for the weekend. Hope to see you again soon!

Tags: ,