From Technology

Roland TD-6V Drum Module with Rock Band 3: It works!

I’ve had a Roland TD-6V electronic drum module for a few years now, so when the new MadCatz PS3 MIDI adapter for Rock Band 3 came out, I was excited to try out my set with it. My friend Tim was able to track one of the hard-to-find adapters down, and he brought it over for us to try this past weekend (on a related note, he also got one of the real-string Squier Strats that are sold for RB3 Pro Guitar use, but after some testing, that device clearly fell short of expectations and is getting returned).

I hooked up the module to the MIDI cable provided with the adapter, checked all the options (except Lefty Mode) in the Pro Drum options, and tried out a song, just to see what would happen. I figured that some customization would be necessary (actually, I was pretty certain after our experience with the guitar that it wouldn’t work at all), but to my surprise all 3 extra cymbals worked perfectly without any additional configuration. There was also an option to enable the hi-hat pedal, which I did, but I didn’t really see any difference in sound caused by pressing down on the pedal. Rather, if the hi-hat sounds were muted in the song, that’s how they sounded, even if I lifted the hi-hat pedal up. Still, being able to use actual cymbals instead of 4 pads was an awesome experience.

One thing that is a bit annoying is that the cymbal notes, despite having clearly distinct cymbal shapes, use the same colors as notes played on the regular 4-piece RB3 set. In other words, the green cymbal, which is correctly aliased to the crash cymbal directly above the snare, is represented by a note on the far right of the screen. This takes a little getting used to, but once you do, playing Pro Drums is a truly exciting part of RB3, and a feature that I’ll definitely be making use of more in the future.

I’ll also be connecting my Roland EP-7 electric piano to RB3 to see how it works on Pro Keyboard. I’ll have another review of that once I’ve tried it out.

Save and share results from Chrome’s Developer Tools’ Network panel

Back in late February, Chrome got a new feature that allows users to export the contents of Developer Tools’ Network panel (where you can see each request and how long it takes, etc.). I happened on this by accident, mostly because I was blindly right-clicking on the sort bars in the hopes that they would somehow contain a magic option to save or export the data (they did!). If you right-click as indicated in the screenshot below, you’ll see the Export all to HAR option. It’s not exactly intuitive–once you choose that option, nothing actually happens (at least on my Mac), but the HAR data should now be copied and paste-able.

Once you have the data, you can save and share it by pasting it into a text file. To interpret the data later, you can use this online HAR viewer, which will expand the JSON that comprises the HAR file into the same visual, interactive graphs you’d see in Developer Tools. I had issues with the ‘Validation’ checkbox on the viewer site, but once I unchecked it, everything seemed to work fine. All in all, this is a really useful feature for me, as I often need to share performance data with colleagues in remote locations, and having an easy format for interchange that preserves the raw data (unlike my previous screenshot-sharing method) is invaluable.

Get email addresses for all members in your MailChimp lists

Yesterday at work I needed to quickly get all the members of our various MailChimp lists. I ended up writing this short script that might be helpful to someone else, so here it is:

include_once dirname(__FILE__) . '/MCAPI.class.php';
include_once dirname(__FILE__) . '/config.php'; //contains apikey

$api = new MCAPI($apikey);

//NB: last param is the # of lists to return. If you have more than
//40, make sure this parameter is high enough (max 100 lists)
$lists = $api->lists(null, 0, 40);

foreach($lists['data'] as $list){
	//you can also do 'unsubscribed', 'cleaned', or 'updated' to get those counts
       $members[] = $api->listMembers($list['id'], 'subscribed', null, null, 15000);

foreach($members as $member){
	foreach($member['data'] as $data){
		$emails[] = $data['email'];
//change this to a file path on your system
$fp = fopen('/www/mailchimp/mailchimp_members.csv', 'w');

fputcsv($fp, $emails);


Bugless Beast: first impressions and lessons learned (part 2)

After logging my initial impressions of the Bugless Beast hacked Android OS, I was left with one major issue: the App Market was crashing pretty consistently after installing 1 or 2 apps, which was relatively annoying, but not a showstopper. As an attempt to do away with this error, I upgraded to the newly deployed version of Bugless Beast, The result of this upgrade was, unfortunately, that the App Market began to crash as soon as a I launched it, and no amount of reboots would allow me to access the Market long enough to install even one app.

One of the steps that is always recommended by Peter Alfonso, the creator of Bugless Beast, is that you wipe your data and cache on the phone whenever upgrading the OS. I, like many others, ignored this and attempted to perform the upgrade without clearing my data and cache. For the most part, I can see where the temptation to do this lies…if your phone is working properly before the upgrade, chances are good it will probably continue to work. However, since my Market app obviously had some sort of corruption that had developed along the course of Bugless Beast upgrades performed with no data wipe, upgrading in place did nothing to solve my problem.

After realizing that, without an App Market, I was pretty much at a dead end, I bit the bullet and upgraded the phone to BB while performing a full data and cache wipe. To make a long story short, my phone is working perfectly now. Lesson learned: if in doubt, wipe it out.

Bugless Beast: first impressions and lessons learned (part 1)

A couple of weeks ago I bought an original Motorola Droid from eBay. The seller mentioned that it was running a hacked ROM called ‘Bugless Beast,’ and wondered if I wanted him to flash it back to stock before shipping. I did a little research, saw how easy it was to re-flash the device back to stock, and decided to try Bugless Beast out for myself.

[simage=152,200,n,right,]A new version of the ROM was released while the phone was in transit to me, and when I first tried to use the phone the Android Market app had a tendency to crash after installing a program or two, necessitating a reboot, so my first task was to perform an update. After a little while hunting around on the Web for a how-to on upgrading my ROM, I discovered an app called ROM Manager, which makes the whole process really simple. Basically, you drop the zip file containing the new ROM onto the SD card in the phone, and tell ROM Manager to use that ROM for the upgrade. The app will prompt you as to whether to perform a backup, and then whether to wipe the ‘data and cache’ on the phone. I chose not to wipe the data, but to perform a backup, and went ahead with the upgrade.

The whole process took about 15 minutes, after which the phone automatically rebooted itself and I was able to see all the cool Gingerbread features that have been embedded into v0.6 of Bugless Beast. Unfortunately, the issue with the Market app persisted. All in all, it definitely wasn’t a¬†show-stopper, as the increased performance that you gain from Bugless Beast was well worth the annoyance (BB overclocks the 550MHz CPU on the Droid up to 800MHz, the difference in how the phone performs is quite noticeable). I decided to stick with Bugless Beast and wait for an update to see if it fixed the Market issue.

WPTouch: WordPress theming for mobile devices that just works

[simage=153,288,y,left,]I just installed WPTouch, the WordPress plugin that serves up a clean and simple mobile version of your site to visitors using smartphones and other mobile devices. A couple of years back, I tried to do the same thing with a different WP plugin, but at that point things just weren’t ready (for one thing, there were so many different devices and user agent strings that detection was iffy at best), and I ended up having to remove the plugin. WPTouch, on the other hand, was pretty much ready to go right out of the box.

[simage=154,288,y,right,]Immediately after downloading and installing the plugin, I tried to load the page on my Motorola Droid. Everything looked good without any customization. The layout is nice and clean, and the additional functionality for touchscreen phones is nice. For example, there’s a menu system that allows navigation by tag and category that’s very well suited to a mobile phone screen, and is a nice replacement for the wide and JavaScript-heavy popup navigation on the main version of this site.

[simage=155,288,y,left,]After initial testing, I enabled Google AdSense for Mobile, which was as simple as pasting in my publisher ID. The ads show up fine on a stock Motorola Droid and an iPhone emulator, but failed to appear on my Droid, which is running Bugless Beast 0.6. I’m not too worried about that, though, as I suspect the hacked browser might have an ad-blocker in there, and either way, I don’t see the Bugless Beast user community as being a source of significant ad revenue for me, so I’m holding off on investigating the issue further. For now, I’m just glad that there’s finally a plugin like WPTouch out there, that just works like it claims it does.

Refresh Twitter and Facebook social icons after an Ajax request

I recently found myself dealing with the following problem: I wanted to lazy-load as much of the social networking components of a site as possible, which meant deferring the load of both the Twitter and Facebook JS until after the document finished rendering. This process was relatively straightforward, but in the course of implementing the buttons I discovered something interesting: when you do an Ajax request to refresh a portion of the page, buttons in there are not dynamically refreshed. This makes sense–there’s nothing to re-run the appropriate JS methods to render them–but it’s not good.

My quest on Google first took me to this forum, where the exact same problem I was having was discussed back in Sept-Oct. Since a new version of the Twitter @anywhere API came out today, and doesn’t include a TweetButton, that wasn’t going to be an option either.

Thankfully, I found this post, which outlined the best workaround I’d seen yet for interacting with Twitter’s widgets.js file. It’s worth a quick aside here: the problem is created because the @anywhere API, which has all named functions, does not have a method to create a TweetButton. That is handled instead within widgets.js, which is all wrapped in one big anonymous function. There’s a render() method hiding pitifully inside, but it took someone with JS skills beyond mine to coax it out of hiding.

Both of the examples in the previous link work great, and can be cut-and-paste. In my case, however, I didn’t want to mess with the actual $.get request, which was happening in a completely different script file, and was written years ago. Thankfully, a few quick tweaks resulted in this:

   //re-render the facebook icons (in a div with id of 'content')     

  //re-render twitter icons by calling the render() method on each
     var tweet_button = new twttr.TweetButton( $( this ).get( 0 ) );

Since jQuery lets me bind directly to the ajaxComplete event, I didn’t even need control over the Ajax call, which is good, because it wasn’t an option. Now, maybe Twitter will name the main function in widgets.js and we can just call a single line like for Facebook in the above example.

Tagline Rotator plugin v2.0 is now available

NB: If you are having any problems with taglines not rotating after the upgrade, please de-activate and re-activate the plugin. This is due to WordPress no longer calling the activation hook when you upgrade a plugin through the Dashboard.

As is often the case over the holidays, I had a little free time to update my Tagline Rotator plugin, which was in need of some serious cleaning up. Version 2.0 is now available on the WordPress plugin repository, and includes the following improvements:

  • Entire plugin is now class-based and the code is significantly cleaned up and better organized
  • All the MySQL queries that the plugin used are eliminated. Instead of using a separate table, the plugin now stores its data in the wp_options table
  • If you’re upgrading from a previous version, the plugin will pull your current taglines from the table and save them to the wp_options table. It will not delete the old table (something like wp_tagline_rotator), so your old taglines will still be there. Once you’ve confirmed the taglines are working properly, you can safely delete the table. I’ll be adding an option to delete any tables created by the plugin thru the admin dashboard in a future version.

As always, if you encounter any problems or have any suggestions, please leave a comment on the plugin’s homepage.

502 Bad Gateway with phpMyAdmin and nginx

I recently ran into an issue with phpMyAdmin served via nginx. When I would click on some of the databases on the sidebar in the home phpMyAdmin screen, the main frame would return a 502 Bad Gateway from nginx. The nginx error.log revealed an “upstream sent too big header while reading response header from upstream” error, which led me to this site. By adding the suggested lines into the http {} section of the nginx.conf file, then restarting nginx, I was able to see the table view load correctly in phpMyAdmin. It’s worth noting that I’m using php-cgi, not php-fpm, so the exact directives required may be slightly different if you’re using php-fpm.

Filtering numerically in a log file

I recently needed to filter some log data to find all the entries that exceeded a certain numeric value (in my case, 100). A little Googling yielded the following solution:

less /web/temp/apache_procs.log | awk '{ if( $6 >= 100) print $1 " " $2 " " $6}'

The first half of this command obviously opens the file in the ‘less’ viewer. The ‘awk‘ command, if you’re not familiar with it, is an excellent tool for printing various bits of tab-separated files. One of the things it does is automatically separate each column of the log file output into a numeric variable, so the first column is $1, the second is $2, and so on. In this case, I wanted to see columns 1, 2, and 6 (log date, log time, and number of apache processes running). Awk also allows for simple if statements, in this case ‘if ($6 >= 100)’, a simple check that results in awk printing out only the log entries where the numeric value of column 6 is greater than (or equal to) 100.