What do Death Grips, Thirdworlds.net and Epic Records have to do with Free Software?

What do Death Grips, Epic Records and Thirdworlds.net all have in common?

My monday evening was just coming to an end when I received a very strange email.  The sender was urgently requesting that I respond with information on my affiliation to Death Grips, Thirdworlds.net and Epic Records.   I was intrigued so I decided to do a bit of investigation before deleting the email.

Who or what are Death Grips?

Well, apparently, I’m out of it – because Death Grips is a musical group from Sacramento, California consisting of vocalist Stefan “MC Ride” Burnett and production team Zach Hill & Andy Morin. Death Grips live performance setup consists of Burnett on vocals, Morin on keyboards/samples and Hill on drums.

Death Grips sophomore release, The Money Store actually made it to Billboard’s top 200 climbing to 130 early in 2012.

Ok so Death Grips are a band on the Epic label… now we understand some of this… but what’s thirdworlds.net all about?

Turns out that’s Death Grip’s web site.

So What’s This Got to Do with Free Software or Mobile Redirection?

For some odd reason, when I browsed on over to thirdworlds.net, I some something very familiar.  
Apparently, whoever authored the thirdworlds.net site is using one of my scripts.  A script I wrote in a tutorial on my blog which was intended to demonstrate how a web site author can redirect incoming visitors to different web pages based on the type of browser or device the visitor is using to view the site.  Here’s a link to the original article.

For more information on exactly what redirection means as it relates to the web, see this link.

So who cares… and why would someone take the time to email me about this?

Well it turns out that Death Grips and Epic Records had some disagreement on how and when their new album should be released… The band tweeted that their label wouldn’t confirm a release date until “some time next year.”

The band later tweeted “The label will be hearing the album for the first time with you”

And so they released it on various channels including Sound Cloud, Youtube and Pitchfork.

Shortly, thereafter, the band tweeted that their site had been taken down… “our sight just got shut down- BASIC AS FUCK”. And this is where a I come in. I’d love to say that I’m this hired gun that Epic reached out to in order to stop the band from further media outburst by wresting the site from the internet… but that’s simply not the case.

Whoever shut the site down, simply configured the web server to stop interpreting the web site’s code and simply display it as plain text. So when you visit thirdworlds.net instead of getting access to the band’s site in full color, you merely get the code in plain text. This effectively stops you from viewing the material that the band had intended you to see but unfortunately, shows the dirty secret the band’s webmaster was using to redirect incoming users to the appropriate version of the site based on the viewers browser. So there for the world to see, in all it’s glory is my silly mobile redirection script, complete with my email address and a link to the original article where the code was published.

To the average Joe viewing the site, it may appear that I have had something to do with downing the site… I can assure, I have nothing to do with downing their site.  This is simply a case of a web site being pantsed revealing all its dirty secrets like the code their leveraging to redirect users to the correct version of their site.

Mystery solved

Whether you choose to believe that this is all contrived bullshit designed to attract attention on the part of the label, or if it was truly the case of a truly badass group of musicians taking control of their music release channel, you have to admit it certainly makes for an interesting story.

So now we know what Death Grips, Epic Records, and thirdworlds.net all have in common… no matter how punk-ass they may be, they still want to be sure that when you’re viewing their content on the web, you’re getting the best possible viewing experience based on your browser or device type… all thanks to a free set of scripts put together by yours truly.

 

Here’s some of the Death Grips new album for your listening pleasure.

Death Grips – Deep Web by deathgrips

 

So now that we’ve cleared that up… what do you think???

Leave a comment below to share your thoughts.
 

Create a custom sidebar for each page or post with this Graceful Sidebar WordPress Plugin

A friend and fellow poker fan recently reached out with a wordpress question… She was looking for a way to customize a client’s sidebar content based on the page or post currently being displayed.  

Well – it seemed logical so I dug in for a few minutes and came up with the Graceful Sidebar Plugin.  The plugin is very simple – but accomplishes the initial goals.  To use the plugin, simply install it, activate it and drag the Graceful Sidebar widget to your theme’s sidebar.  Then, create two custom fields in the post or page whose sidebar you want to customize – “graceful_title” and “graceful_content”… that’s it.

Visit the Graceful Sidebar Plugin page for more information and to download.

Mobile Device Detection and Redirection with PHP

** Updated 04/26/2010 **  Added Google Mobile Crawling Detection
See also http://www.mlynn.org/2010/07/mobile-device-detection-and-redirection-with-perl-and-cgi/ for additional information on Mobile Browser Detection and Redirection using Perl / CGI.

Target Audience

Web Content Publishers, Web Server Administrators and anyone considering preparing and publishing content that may be consumed by users with mobile devices.

Overview

The mobile phone and computing market is exploding. With more and more phones and hand held devices gaining web browsing capability, it only makes sense to ensure that your site is at least viewable by these mobile browsers. In this article, I present one possible solution for detecting and redirecting incoming mobile browsers so you can customize and enhance the mobile users’ experience.

In this article, I’ll discuss an example web site where we want to present customized web content to four distinct types of user based on the browser device their using when they visit the site. I’ll also discuss how to enable the users to specify a preference for one of the other versions of the site. For example, if I’m an iphone user but I really want to see the full site.

Redirecting a user based on the type of device they are using is not rocket science. In fact, it can be accomplished quite simply using an apache redirect in a .htaccess file.

The issue with this approach is that users coming to your site using an iPad will never have the ability to see the other versions of your site. for many, that may be a satisfactory solution. However, if you want users to have the ability to view a version of your site designed specifically for their type of mobile device by default – but have the option to click a link and either view or optionally set a preference for another version of the site, this article is for you.

Examples and Source Code

I know – you’re in a hurry… you’ve read the intro and you know this is what you’re after… well, here you go… The examples for this site are available for demonstration at http://mlynn.org/uatest/ and the code for this is available for download from the following link:

Version 0.3 – Includes PHP and Perl/CGI Examples
[download id=”2″ format=”1″ autop=”false”]

Version 0.2 – Includes only PHP Examples
[download id=”1″ format=”1″ autop=”false”]

10 Tips to Help You Become a Better ExtJS, PHP, MySQL Developer

Before I begin, let me first say that I am not an expert ExtJS, PHP or MySQL developer. I have however, learned over the years from some basic design principles and tips gleaned far smarter and more talented developers than myself. I thought I’d create a post in the hope that you may benefit from what I have learned. Some of these tips will be pretty basic for most skilled developers, but it never hurts to review, right?

Audience – Who is This Article For?

This article was intended for the novice to intermediate web developer who specializes in use of the following technologies:

Tip 1 – Stop Using Print Statements to Debug

Developing solutions using the elegant Javascript framework ExtJS can be a mix of pleasure and pain.  While debugging the Javascript components is made easy with the handy Firefox extension FireBug, getting debug information back from the php side of your app can be tricky.  Especially if you’re expecting to maintain JSON communication with your javascript components. There are basically two methods of debugging the php side of your app.  You can either rely on JSON encoded strings sent back to your javascript components, decode them on the other side and display them either in and alert window, or in the console using console.log, or you can use print statements in your php.

The latter approach will commands will likely cause a javascript interpreter error and force you to reload the page to continue testing. I prefer the latter approach because its simpler.  However, instead of simply using the php echo or print commands, I like to create a logging function which uses file_print_contents to populate a debug log. Here’s my function:

With this function, debugging is as easy as calling your logit() function instead of using print. I typically open another window and execute a tail -f debug.log to maintain a constant view of streamed debug data.

Tip 2 – Centralize your Database Updates

Creating a single reusable function to update your database can save your years of debugging.  It also provides a single place where you can add logging features to your updates.  For example, let’s say you want to create an update_log table for the database your updating.  This table will contain a record of every column, row and table that you’ve updated along with the mechanism used to update it and the date/time it was updated.

If you’ve got your mysql_query code scattered about your project, you’re going to need to add this logic all over the place.  If you’ve centralized your updates into a single function, you merely need to add the update_log logic to your update function.

Tip 3 – Borrow Heavily but Don’t Be A Script-Kiddie

We all do it.  Why re-invent the wheel, right?  I’m referring to the common practice of code-theft.  There are copious examples of many of the required components of most application challenges you’ll come up against.  So why not?  Why not, simply grab the code and slap it into your project?

It makes perfect sense – but you need to understand the code you’re lifting if your project is going to be a successful and supportable one.

A good friend of mine introduced me to a term over 12 years go – Script-kiddie.  A Script-Kiddie is a derogatory term used to describe someone that steals scripts or code, uses them but never fully understands how they work or in some cases, what they even do.  The term is typically used in a security context.

Simply put, don’t be one.

Tip 4 – Buy a Book (or two)

There are great books out there to help you with the PHP/MySQL/ExtJS development paradigm.  Here are a few that I own:

  1. Learning Ext JS
  2. Professional JavaScript Frameworks: Prototype,YUI, ExtJS, Dojo and MooTools (Wrox Programmer to Programmer)
  3. Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)
  4. PHP and MySQL Web Development (4th Edition)
  5. PHP Phrasebook
  6. JavaScript: The Definitive Guide
  7. MySQL (4th Edition)

And here’s one that’s not fully released – but looks to be pretty awesome:

Tip 5 – Use FireBug

Firebug is a fantastic FireFox browser extension that enables you to inspect HTML and javascript, and even modify style and layout in real-time. I simply can’t imagine developing javascript, HTML or CSS based solutions without it.

Here’s a good screencast which explains the basics of getting, installing and using Firebug.

This assumes you can use the fabulous FireFox browser. In some cases, you can’t. For instance – my employer does not permit use of FireFox. In those cases, you can use IE addons to accomplish a minimal amount of the same capabilities as Firebug. Another option is to leverage the ExtJS Debug Console.

Tip 6 – Modularize Your Javascript

The ExtJS development paradigm is one that lends itself to rapid production. You’re madly cutting/pasting or typing in your component syntax and you’re application begins to take on a beautiful life of its own. It’s very easy to simply keep slapping components into your main javascript file, testing, debugging, and slapping more code on. I’m guilty. My first ExtJS application has over 4300 lines in a single javascript file… ugh… I’m embarrassed. Don’t get me wrong – the app works… it’s just nearly impossible to debug.

One way to implement modular code is to leverage iframes. The managed iframe user extension makes this very easy to do. Saki’s Example Page makes use of this extension beautifully. The code to create the main viewport and the layout panels is in one javascript file, but when you click on a link in the navigation tree, the code for the main or center panel is included in an iframe. This permits you to create one main application.js file and another separate javascript code file for each of the options in your tree.

Tip 7 – Use extjs-debug-all.js and extjs-debug-base.js During Development

To use the ExtJS Framework, you simply include the basic Javascript libraries and CSS stylesheet information in your HTML document. Here’s an example:

Tip 8 – Check for Trailing Comma’s

IE is much more picky about trailing comma’s than Firefox or Safari. Since I develop on a Mac, I’m forever missing trailing comma’s. I have an ancient laptop running Windows XP that I keep around for the sole purpose of testing apps in IE. Because javascript is interpreted, not compiled, you don’t get that piece of mind that comes from passing your work through the compiler before placing it in front of the user.

9 times out of 10 when I have an error in IE, it’s because of a trailing comma. ExtJS uses objects configured using JSON like syntax. Here’s an example:

In this example myExample is an object which is configured with a function. The function in turn is configured with a return object which has parameters foo and boo. The syntax for this example is correct. Consider, on the other hand, this example:

See the difference? That one minor, trailing comma after boo: ‘far’ will cause IE to stop interpretation of the entire javascript.

One way to catch this error is to copy and paste the source code of your javascript into JSLINT.

JSLINT will return the following:

Error:

Problem at line 4 character 19: Extra comma.

boo: ‘far’,

Problem at line 5 character 6: Missing semicolon.

}

Tip 9 – Create an Automated Backup Routine for Nightly Backups

There’s nothing worse than after weeks of steady positive progress, you suddenly find yourself unable to figure out what you’ve done to break things. Having a nightly backup strategy can provide valuable insight into the path you took to get where you are now.

For nearly every large scale project, I create a simple script to backup the code and data and ship it offsite somewhere – typically back home to my home development lab.

If you’re able to create a public/private key pair and configure passwordless login between your development environment and your home machine, you can create a simple script which can be executed automatically via cron to securely copy your development work back down to your home machine.

Here’s a link to creating a secure passwordless login scheme with SSH.

Once you have that in place, here’s a little script that you can customize to create backups for your work.

This will create a fully functional copy of your web development area on your local machine. The last line of that script creates a symbolic link to the ExtJS library directory on your local machine. This assumes that you don’t want to copy down the extjs javascript library distribution every night.

Make sure you modify the following variables to customize the script for use on your local machine.

LOCALDIR – this is the local directory on your home development machine.
REMOTEDIR – this is the root directory of your development work on your client or remote machine.
LOCALEXTDIR – this is the full path to the extjs libraries on your local machine.

Once you’ve got all that setup – add your script to cron to kick it off nightly (or even more frequently.)

Tip 10 – Visit ExtJS.com Often

ExtJS.com is frequently updated with new versions, featured implementations and blog posts designed to simplify use of this great framework.

The site is well organized and has several sections specifically designed to help you getting started using the framework. The Learn section is a great place to start.

Bonus Tip – Use an Alert Service To Notify You of Updates on ExtJS.com

Since timely information is very valuable when you’re working on a project with tight deadlines, you may consider using an alerting service to tell you when new information has been added to the extjs.com site. http://www.changedetect.com is one option that offers a free web site modification alerting service.