FerretArmy: A Web Developer's Paradise

Pushing the Web Forward, Since 2007

FerretArmy.com is Anti-SOPA and Anti-PIPA

Today is the great internet blackout day, in protest of the proposed SOPA and PIPA laws winding their way through the US House and Senate respectively. I won’t go too far into detail on my thoughts on these bills other than to say they are destructive to the ability to grow innovative businesses on the internet. They strip due process from copyright infringement claims, which allows entrenched interests (such as the RIAA and MPAA, major backers of this legislation) to censor free speech and destroy fledgling businesses with innovative business models or that take advantage of new technologies. We’ve already seen widespread abuse of the DMCA by these interests, so there is absolutely no reason to believe they will use the new powers granted by SOPA and PIPA in a responsible manner.

I urge you to contact your congressional representatives today to stand in opposition to SOPA and PIPA. Let them know that you oppose these bills!

jsFiddle: The Online Web Editor

I just started playing with jsFiddle, which is an online tool that allows you to test and share HTML/JavaScript fragments. It’s a really neat tool – I’m not entirely sure what it’s boundaries are quite yet, but it’s been pretty amazing so far.

The interface is fairly intuitive – just three panes for HTML, JavaScript, and CSS, and an output pane that displays your rendered content. It also has support for a number of JavaScript frameworks (jQuery, MooTools, etc), and a number of addons for those frameworks. It’s also setup as a collaborative tool – by default, your ‘Fiddles’ are public and accessible by URL. As a quick test of the tool, I ported the code I wrote for my ‘:between‘ jQuery selector – check out the demo here: http://jsfiddle.net/jneal/WmnNJ/.

You can even embed your Fiddles on other websites. Next time I write a post on a coding technique, I’m planning on setting up some examples through jsFiddle. Hopefully it turns out well!

jQuery Templating with .tmpl

Templating of web controls is a valuable technique that allows for code reuse. For example, if you have a repeated list of items with common attributes that need to be displayed on a web page, templating is a great solution. Templating can often be accomplished on the server side through controls such as ASP.NET repeaters. However, with the web of today, asynchronous programming is where it’s at. With AJAX data calls, you often get JSON objects back that must be turned into HTML and displayed on a web page.

There are a few ways of doing so – you could have an asynchronous call return an HTML fragment, for instance (done that). You could also embed placeholders in hidden HTML fragments on a page, and use a combination of jQuery’s clone/replace/append methods to push object data into them (done that too). However, there’s an even better technique available now, as a first-class citizen in the jQuery library – the .tmpl templating API.

jQuery templating is a feature that’s currently in beta (though it is distributed with jQuery as of version 1.4.3), and is based upon an existing templating plugin. I’ve had the pleasure of using the jQuery templating API for a bit of time now, and I admit that it is by far the easiest, most robust templating solution I’ve found. There are template controls for repeaters ({{each}}), conditional statements ({{if}} and {{else}}), templated HTML fragments ({{html}}), and wrapping ({{wrap}}). That’s a lot of functionality out of the box!

By far my favorite part of html templating, however, is the <script type=’text/x-jquery-tmpl’></script> tagging that you can wrap around your template fragments. One thing I’ve disliked with templating is that you have to embed potentially malformed HTML into your page – for instance, you might end up having to template id attributes. Malformed html is not the worst thing in the world, especially in hidden fields, but it certainly doesn’t help with search engine rankings and such. Having a way of clearly saying “I’m a template fragment” is a great thing, both for search engines and general maintainability.

If you haven’t gotten a chance to take a look at jQuery templating, now is certainly a great time to do so. It comes for free with jQuery, and it’s a fast, easy, and robust solution for templating needs.

text/x-jquery-tmpl

Triple MBS Drafting

I’ve been doing a ton of triple Mirrodin Besieged drafting on Magic Online lately, and I’ve been winning my fair share of packs. Triple MBS is a limited-time draft format, so there likely won’t be much strategy written around it. Triple MBS is a great format to draft because it’s a small set (less packs opened) and because it has relatively more money cards than Scars of Mirrodin. Okay, onto some thoughts.

First, I don’t think infect is a very good strategy in triple MBS. The infect cards are spread out across too many colors, so getting a deck together is tough. Second, the best infect cards are also the best cards against infect. Blight Widow and Priests of Norn will be highly picked by everyone, so you’ll end up with the drecks, like Flensermite. Third, infect is a popular (but bad) strategy, so the cards will be that much harder to come by.

Fangren Marauder is first-pickable. I’ve not had any trouble picking up a full playset of these in most of my drafts, and I’ll always splash green to play them. They are the nuts against non-infect decks, and they are even great against infect. Next, anything that gives a -1/-1 counter or does one damage is playable, and probably will be awesome in your deck. Any guaranteed 2-for-1 is playable (even Myr Sire). Sword of Feast and Famine isn’t nearly as threatening as you think – it’s a mana sink in the early turns, and every deck should have an answer to it (maindecked, none the less). There are far fewer mana fixing cards to make splashing three colors easy in triple MBS than there are in Scars (no mana Myrs), so Sphere of the Suns is a great pickup, as well as Viridian Emissary.

So, what do I think is the most playable strategy in this format? Red-Green artifact sacrifice. The core of this deck is anything that works with artifact sacrfice – Fangren Marauder, Gnathosaur, Ichor Wellspring, Myr Sire, Kutholda Flamefiend, Myr Turbine, Spine of Ish Sah, and such. Red in general has powerful cards all along the curve, and the synergy that can be put together in with this core of cards is amazing. In general, I’m very open to also splashing white in these colors, for things like Master’s Call, Divine Offering, Priests of Norn, and Choking Fumes. If you happen to open a Spine of Ish Sah, try your hardest to get a Treasure Mage, and pick Gnathosaur high.

I highly recommend triple MBS drafting to anyone that has such an inclination. It’s a great format that won’t be around for long, so enjoy it while you can!

My Zendikar Full Art Lands

One of my more ambitious recent projects was to extend the art of all the full-art versions of all the Magic: The Gathering Zendikar lands. Zendikar lands aren’t particularly valuable, but they do lend themselves very well to having their art extended. In addition, I can always use full art lands – just about every other card in Magic rotates eventually, which was a concern of mine, since I primarily play Standard (for now). In any case, check these out (the pictures aren’t the best, but nobody ever accused me of being a professional photographer):

zen_plains zen_islands zen_swamps zen_mountains zen_forests

I’ve got quite a few other painted cards in my collection, mostly for my cube (still a work in progress). I might add pics of those cards in the future, if people would like me to do so. In case you’re wondering, I don’t currently do any for-hire card painting. The paints I use are Citadel model paints from Games Workshop, which are pretty widely available.

Cube

I’ve always been a gamer at heart, be it video games or board games, or my absolute favorite genre, collectible card games. This month marks nearly a year into my refound romance with the card game Magic: the Gathering. A bit of background here: I used to play Magic back in 1995 or so as a teen, in the ‘Revised’ era. After finding some cards at my mom’s house over Thanksgiving last year, I got the itch for it yet again. I’m taking my hobby a bit more seriously nowadays (though it’s still just a hobby – I still try to find some balance in my life!) – I’ve take the opportunity to go to try a few professional tournaments in the area, and I’ve built up a decent collection of cards over the past ten or so months.

The one thing that has been bugging me lately is how to bridge the gap between my friends who know how to play Magic, but aren’t into playing competitively like I am. To some extent, I’m sure I could convince a few friends to get together and draft, but nothing more than that, and even then on rare occasions. As a group, we are far more likely to play a good game of Smallworld, Power Grid, or any other board game than we are to do anything Magic-related. Being the problem-solver I am, I decided fairly recently to create a Cube.

Cube is an informal Magic format that is similar to Draft. Essentially, you create ‘packs’ of fifteen cards out of an available pool of 500 or so cards, and you hold a draft tournament using those cards. I won’t go into the specifics of drafting, but essentially all the cards you need to play are going to be provided to you at the outset, though winning requires a fair amount of skill and familiarity with the rules of Magic.

Creating a cube is a very time consuming effort. I’m currently in the acquisition stage of my cube – I still can’t play with my cube, though it is roughly half-complete. Having a theme for your cube is somewhat essential in creating it – in my case, I’ve decided upon a hybrid of a powerful-game-state cube and a good-limited-cards cube. This means that I want to add to my cube some of the most powerful cards available in Magic, as well as to add cards that are particularly powerful in draft format. I’ve been tracking my progress in a Google Docs spreadsheet. I’ve picked out a good portion of the cards I want in the cube, though I haven’t acquired them all to this point. My one additional caveat to this story is that I want my cube to be primarily foil cards (say 95%+ foil, and almost no non-foil-non-promo cards – if I have to put a non-foil Primeval Titan into my cube I will, but not without some regret).

Normally, a cube is actually surprisingly cheap to put together – were it not for the foil cards restriction I’ve self-imposed, I would be fairly near completion of my cube. I’ve been trading and buying cards at a pretty furious pace in order to get where I am now, which is about 180 cards in, with an additional 100 or so picked out but not yet acquired. Feel free to comment on my pics if you so desire, and by all means, challenge me to a cube draft when I’m complete. I’m very energized to complete this project, so I can play with some of these amazing new cards that I’ve acquired over the preceding few months!

Extending jQuery Selectors: ‘between’

There are a ton of jQuery selectors to get at just about any data imaginable on a page. Between actual selectors (such as ID and attribute selectors) and pseudo-selectors (such as :first and :checked), the bulk of HTML element selection is trivial. There are, however, a few selectors I’ve had a need for but aren’t in jQuery currently – for instance, there is a next adjacent selector, but there is no analogous ‘previous adjacent’ selector baked in. How does one get around this? Let’s find out, after the jump.

[Read the rest of this entry...]

Who does a Non-Neutral Internet Benefit?

One of the greatest fights over the past few years has been over net neutrality, the fight over whether it’s okay for broadband providers to charge content providers extra for the fastest lanes on their networks. I’ll not espouse too much about the issue itself – just check Wikipedia for a primer. The question I’m pondering is this: in the event of a non-neutral internet, who stands to win in the long run?

Current broadband providers (Time Warner, Rogers, AT&T, etc.) believe that they can open a revenue stream by effectively charging content providers for access to the fastest pipes – basically, squeezing extra of money out of planned network upgrades by offering the fastest lane exclusively to the websites that will pay for it. This strategy assumes a few things, most notably that there is little interest in new parties entering the market. What if there were someone entering the market that didn’t rely solely on selling broadband as it’s business model?

There is a notable content provider who is beginning to experiment with broadband providership – Google. The Google of today provides boatloads of services that consume massive amounts of bandwidth. Google has the most to lose with a non-neutral internet – that is, unless they can tip the scales in their favor. Google could enter the broadband market very simply – have themselves be their their own best customer. Under a non-neutral internet, Google would have an incentive to provide cheap, high speed networks across the US (and, even more so in the developing world). On top of offering competitive broadband, they could offer the fastest access to Gmail and YouTube, just to name a few. By owning the network that they distribute their content over, Google would be less beholden to ransoming broadband providers, and significantly undermine them at the same time through competition.

What would a current broadband provider be able to do to compete against that? They would have to offer some other type of content (on an aging network, probably) – that would be cost prohibitive, amongst other things. The real inequity in the broadband market is that there is a lack of competition, which has significantly contributed to the idea that net neutrality is even remotely a possibility. However, a non-neutral internet could very well backfire on those that want it most. Share your thoughts!

Ech, WordPress Hackery!

WordPress is a great platform – it’s easy to use, fast, reliable, and very popular. Unfortunately, that also makes it a big target for hackers.
A few weeks ago, FerretArmy.com got hacked – essentially, it was serving malicious content from an injected iFrame. In addition, the administrative panel was intentionally broken in an effort to make it harder to fix. The hack directly targeted the WordPress platform – there are millions of WordPress users, so it was likely an automated attack looking for a known vulnerability. I’m still unsure of the attack vector, though I believe it was most likely either through a plugin, or through a (hopefully patched) security hole in the framework itself.

In order to get the site back up and running, I had to physically comb through all the files in my site and remove all the bad code. It’s very apparent that the hack was scripted – it effectively added a single malicious line to every PHP file in the site. It was all reversible damage (with no data loss, thank goodness), but it still left me pretty upset.

In the end, I changed my passwords and made sure that everything was up to date (site and plugins), and the site has not suffered any similar misfortune since. Being hacked really sucks, and I have absolutely no respect for someone that would do such a thing. FerretArmy is a small fish in a big pond, but I try my hardest to deliver worthwhile content to my visitors. Having someone exploit this (for no real gain, let’s be serious here) is inexcusable.

jQuery Image Overlay 1.3 Released

There have been a distinct lack of updates recently on FerretArmy.com – chock it up to having to do a lot of work-induced overtime over the past few months. Either way, in order to usher in some fresher content, I’ve updated my Image Overlay plugin to version 1.3. Changes are that you no longer need to specify image width and height, as well as being able to specify different animation speeds for the ‘in’ and ‘out’ animations. Hope you enjoy!