posts tagged with “code”

MySQL Output Converter

While I’m at work I pretty much always have a terminal window open with a MySQL prompt. Whether it’s helping someone troubleshoot an account problem, looking up stats, or gathering data for reports, I run a lot of queries throughout the day.

Oftentimes I want to make a chart with that data, which requires me switching database servers, looking up the MySQL CSV syntax on morgamic’s blog, and scp’ing the CSVs to my laptop.

I’ve grown tired of doing that, and tonight I finally did something about it: MySQL Output Converter

read the rest of this entry »

Comments are not status updates

Facebook recently changed the way comments appear from this:

How it looked before the change

to this:

How it looks now

You can add this to your userContent.css in Firefox to set it back to having a line break after the person’s name.

@-moz-document url-prefix(http://www.facebook.com/) {
    .commentable_item .comment_box .comment_content .comment_author {
        display: block !important;
    }
    .commentable_item .comment_box .comment_content .comment_actual_text {
        padding-left: 0 !important;
    }
}

Removing Dashcode’s Unwanted List Underline

While using Dashcode to create a dashboard widget, I came across an annoying styling bug that’s not as easy as it could be to fix, although it’s still pretty easy. If you use a list part in your widget, you have the option of rounding the corners. This is what corners rounded with a 10 pixel radius look like:

Before

You may notice that there’s now a horizontal line at the bottom of the list that should have been affected by the corner rounding, but was not. To fix this, open your CSS file and find the .listRowTemplate_template selector. It should look like this:

read the rest of this entry »

comments closed

Getting text without gettext

Last week I made the switch from Windows to a Mac OS X. I’m definitely happy with the change, although one aspect gave me quite a bit of trouble: PHP gettext support. Now that AMO is localized (in 20 languages and growing!), gettext is required for a local installation.

To make a long story (involving MAMP, XAMPP, compiling PHP and Apache multiple times, and then back to MAMP again) short: MAMP should really include PHP compiled with gettext, as many other frustrated people have pointed out. During my battle, I asked others on the team that have been using Macs what they do for development. Some do all of their development in vim on a development server and others use a Linux virtual machine.

I had already written a basic .po string parser for the Localizer Control Panel, so I decided to make my own gettext emulator. The result is faketext, and MAMP + faketext = working Remora installation. It quickly parses .po files and will load a page in a specified language just as if you had the PHP extension installed.

Apparently there’s an inactive project called php-gettext that has the same idea but parses the binary .mo files instead. I didn’t try it because it would require many of the same modifications I made to work with AMO, and wenzel says it’s extremely slow anyway.

AMO faketext – save as config-local.php and drop in site/app/config.
Generic faketext – will probably require slight modification to detect the requested locale, as indicated in the comment at the top.

Site Identity, Part 1

This week I decided I want to work on my site and extensions a bit before I live and breath Mozilla for the next 3 months. Enter the ribbon. It’s something I’ve wanted to do for quite awhile, and it took a bit longer than I expected.

I added what I’m calling a ribbon (unrelated to Office 2007) to the main fligtar.com sites, like this blog. Clicking on it will bring down a menu of other things on fligtar.com.

I wanted to be able to easily modify an existing site to use this style and I wanted to be able to modify the menu content in one place, but I didn’t want to use PHP.

I’m pretty happy with the result (I won’t say “Mission Accomplished”), as including the ribbon without gradient can be done by:

<html>
    <head>
        <link rel="stylesheet" href="http://g.fligtar.com/ribbon.css" type="text/css">
        <script language="JavaScript" type="text/javascript" src="http://g.fligtar.com/jquery.js"></script>
        <script language="JavaScript" type="text/javascript" src="http://g.fligtar.com/ribbon.js"></script>
    </head>
    <body>
        <div id="ribbon_menu" style="display: none;"></div>
        <div id="ribbon"><div id="ribbon_logo"></div></div>
    </body>
</html>

… and the gradient is 2 lines more.

The process I went through to create this reveals why it took longer than expected:

  1. Determine color scheme
  2. Make shiny bar
  3. Place shiny bar
  4. Make 4 versions of logo that I’m not happy with
  5. Make 2 entirely functional menus before deciding I want the ribbon to drop down
  6. Fight with IE
  7. Realize that some sites (blog and LSU map) can’t use the gradient
  8. Separate gradient from shiny bar and redo that area of CSS
  9. Deploy to all sites
  10. Fight with trac’s CSS which did not play nicely with mine
  11. Win!

I called this Part 1, but my current plan is basically:

  1. Implement Ribbon
  2. Profit!