“Thank you sir, may I have another!” (Adobe is a jerkface bully who has lots of money but still dresses poorly.)

Over the past few years I’ve been trying to figure out WTF happened to Adobe. Their software used to be top-notch: feature-rich, stable, with a nice learning curve – you can get started with Photoshop very quickly, and learn as much as you want as fast as you can, and whatever you want to create, some genius at Adobe has already thought of that and put that feature in there, maybe buried three levels deep in menus or panels and various controls. But, it’s in there. I guess that part is still present (the learning curve part).

I have some issues with the following:

Their new SaaS (Software as a Service) model SUCKS – you have to pay monthly so that if you maybe need to use one of their applications, you can do so with (not too much) hassle. Unless you change computers or swap a hard drive or motherboard – then there are many hoops to jump through to get the licensing bullshit resolved so you can get back to work. The SaaS model isn’t COMPLETELY bogus, though, for people who can’t swallow the huge up-front cost of their applications, which is HORRIBLY out-of-line with most other commercial applications these days, but hey, they pretty much have a monopoly on these kinds of apps, so why not take their user base, their bread-and-butter, to the cleaners? Alternatives are coming up. And they have the potential to take away a lot of money from Adobe, and in the process show users how powerful MODERN applications can be and how well they can perform.

The lack of coherency in the application installation and where files are crammed into every dark corner of your filesystem is super annoying. In 2014, the age of drag-and-drop installation of applications with ONE file (on OS X anyway), Adobe still has an installer application. But not only does it have an installer application – this installer application spawns several separate installer applications that supposedly get the task done. And when this convoluted installation process is finished, you’ve got “Adobe” folders everywhere, and sometimes they have apps in them, and sometimes the apps are just floating there next to it, or the apps have their own individual folders. There. Is. No. Consistency. Period.

Don’t get me started about the update ‘system.’ It’s not so much a system as it is a series of annoying apps and control panels – why is Flash in OS X’s System Preferences? For example, Flash tries to keep itself updated, but the process of this goes like this: 1) you stumble across something in your browser that requires Flash, 2) the Flash process starts and in doing so checks to see if there are any updates, 3) if there’s an update, an external application automatically launches asking you if you want to update Flash – for security and stability improvements, which sound like a good thing, so 4) you click the button to start the installation, but instead of running the installation right there, it opens a web page in the browser you just left to interact with the installer, then 5) you need to download the ‘real’ installer application, which, on OS X is a .dmg disk image file, so you need to hunt that down, open (mount) that, then double-click the ‘real’ installer inside there. Ok, so maybe we’re getting somewhere now. But wait, no!!! Now, 6) the installer tells you that you need to close your web browsers (and kindly lists the browsers that need to close and offers to close them for you), but didn’t the first installer take me to a web page, which, if a browser wasn’t running already, launched your browser so it could open that page? Will the madness ever end??? Hyperbole much? Maybe. But this level of annoyance is just unacceptable in 2014. Maybe the process is smoother on Windows, and if that’s the case, Adobe ought to realize how much of its user base uses Macs, and remember which platform allowed them to thrive in the first place (the first Adobe apps were Mac-only or Mac-first).

So… That’s just Flash…

There’s also the main “watcher” app that indicates its presence in the OS X menu bar. At one point this thing was supposedly updated, with a new icon and new interface if you decided to open it, and there was an option to NOT automatically launch this menu item on login, supposedly. So, I thought I set that preference (to not auto-launch), but then the OLD icon showed back up to take the place of the newer one. And when I interact with the resurrected old icon, the new icon ALSO shows up in my menu bar, until I quit that one anyway. WTF IS GOING ON???

Also…

Their UI trend is terrible, especially in dialog windows in apps like Illustrator and Dreamweaver (which I only very rarely use these days – I’ve moved on to more robust IDEs and text editors). It’s becoming a hideous abomination of design. They don’t match any native OS dialogs (in either Windows or OS X), the buttons are janky (to use a technical term), the outlines around all UI elements just clutter things up. Shouldn’t a company who develops design software care at least a little about the visual design of their own applications?

I guess all of this is a product of farming development to developers overseas where labor is cheaper, but just like junky stuff from Indonesia, you totally get what you pay for (what Adobe pays for development, not us as customers – we still get F’d up the A on the price of their software). It also seems like none of their separate product divisions communicate with each other to have SOME kind of consistency, SOME coherence. It’s annoying to say the least.

So, basically, Adobe are (is a) jerk(s). And they don’t care. Because they have a monopoly. And it SUCKS. I don’t have many more viable options now, so I guess I’ll just bend over and say:

“Thank you sir, may I have another!”

Some code snippet updates…

So, I’ve been working with some of the code snippets I’ve posted on here previously, and I’ve got a few updates for them. These are pretty basic, and are written using jQuery, but could easily be done with native JavaScript – jQuery is already in use in the web app I work on, so there’s really no additional overhead (besides the extra 1/100th of a millisecond it takes to run the jQuery stuff, which I guess could be a problem if you’re running these functions millions of times, but if that’s the case, you probably have some other more important problems that need tackling).


This function will make sure an argument you’ve passed to it is a jQuery object, or convert it if it’s not. This is super handy for checking arguments before working with it inside your function:

https://error601.wordpress.com/2014/01/28/make-sure-youve-got-a-jquery-object/

Here’s the code – this now handles cases where you might just want to pass in the ID of a particular element, in which case the proper jQuery selector syntax will be added and a jQuery DOM object will be created and saved to a variable:

function jqObj(el){
    if (!el) { return false }
    var $el = el;
    if (!$el.jquery){
        $el = $(el);
        // if there's not a matching DOM element
        // then it's PROBABLY just an id string
        if (!$el.length){
            $el = $('#'+el);
        }
    }
    return $el;
}

It works like this:

(Note: don’t be a knucklehead – if you’re calling this function, give it an argument.)

a) If the argument is already a jQuery object, copy it to the new $el var, skip the other stuff, and return it.

– or –

b) Try to make it a jQuery DOM object (line 5) then check if there are, in fact, any elements in the DOM that match, but if not…

– then –

c) It’s likely that you’ve just passed a text string that matches an ID of a DOM element on your page. Maybe this is a bold assumption, but if you don’t want the hassle of passing a jQuery DOM object (or maybe this element doesn’t exist in the DOM yet, but you need the function to handle it when it does), then just tell this function the ID value and you’ll be good to go.

– so –

d) If all went well (and you weren’t a knucklehead and forgot to pass in at least SOME kind of argument), you should have a jQuery DOM object that matches an element on the page.


The next update is to this snippet:

https://error601.wordpress.com/2014/02/12/get-the-current-scripts-path/

In using it, I ran into an issue where it couldn’t get a the script file’s path if it was in the same directory as the HTML file where it was included.

Here’s the updated code:

function getScriptDir() {
    var src, path;
    src = $('script[src]').last().attr('src');
    if (src.indexOf('/') !== -1) {
        path = src.split('/');
        path.splice(path.length - 1, 1);
        return path.join('/') + '/';
    }
    else {
        return '';
    }
}

Now you can get the path to the current JavaScript file in case you would need it. I use it to dynamically grab a CSS file that contains styles needed for the current script to function properly and append it to the <head> element, if it’s not already in the DOM before the script is loaded. I’m sure there’s a much “cooler” way to do this using regex, but I guess I’m not that cool (and this works just fine).


I’ve got a few more snippets coming soon (I won’t wait another six months this time)… Stay tuned. 🙂

Get The Current Script’s Path

There were some tricky functions posted on the intarwebs for grabbing the URL of the current script’s directory (not the script itself). Most of them used some wacky RegEx trickery, but I figured there HAD to be a simpler way. So I made this utility function, which DOES use jQuery, but only because it’s SO DARN EASY to grab the DOM element I need to work with (and I’m already using jQuery in my project anyway).

Here it is:

function getScriptDir() {
    var src = $('script[src]').last().attr('src');
    var path = src.split('/');
    path.splice(path.length-1,1);
    return path.join('/')+'/';
}

What it does:

Gets the ‘src’ attribute for the last script on the page (DO NOT RUN THIS FUNCTION AFTER THE DOM LOADS – IT WON’T WORK), which should be the script where you call the function. Then it splits the components at the ‘/’ separators, knocks off the last element in the array (which is the script file itself), and joins it back together with slashes and adds another on the end for ease-of-use.

There you go. Feel free to use it wherever you want (I’m sure tons of people use this exact technique anyway, but whatever). Maybe you can even cut out the jQuery part for a fully-native JavaScript implementation (or maybe I will later).

Don’t Disorient Your Users With Links Used As Buttons

This is an oldie but goodie – a basic technique for preventing the page jumping to the top when clicking an <a> with an href="#" (or class="nolink" if you want to use a real link for accessibility purposes) when used for JavaScript functions (using JavaScript to maybe open a pop-up browser window – not considered ‘best practice’ in 2014, but still useful in some web apps, like if you need to see the whole web page while inputting data into a form in a pop-up window – or to perform a UI function with your <a> acting as a button).

The jQuery way (super easy – smashed onto one line for brevity):

$('body').on('click','a.nolink,a[href="#"]',function(e){e.preventDefault()});

The ‘modern’ browser way (Chrome, Firefox, Safari, IE9+) with native JavaScript, wrapped inside a super-cool IIFE:

(function(){
    var forEach = Array.prototype.forEach;
    var findAll = document.querySelectorAll.bind(document);
    forEach.call(findAll('a.nolink, a[href="#"]'), function(v){
        v.addEventListener('click', function(e){
            e.preventDefault();
        }, false);
    });
})();

(got a little help for that one from good ol’ Stack Overflow)

I know the jQuery way will also work for elements added after initial loading of the DOM, but not sure about the native code.

So there you go. That’s it.

Or… You know you could always use a <button> and style it to look like whatever you want (but I’ve run into problems in the past with browsers handling styles for <button> elements differently, that’s why I usually prefer <a> elements for ‘buttons’ that trigger JavaScript).

Make sure you’ve got a jQuery object

So, I’m writing a function that accepts jQuery DOM objects as arguments and sometimes even I forget that I’m supposed to pass a jQuery object when calling the function and pass only a selector. Here’s a short line of code that will make sure your function is working with a jQuery object:

$element = ($element.jquery) ? $element : $($element) ;

…or, if you’d rather check for falsiness and you don’t mind a single-line if statement maybe just…

if (!$element.jquery) $element = $($element) ;

Yes, it looks completely redundant and the else statement looks weird, but it’s totally cool, man. If you want to make sure your function doesn’t choke because some doofus (like me) forgot to wrap up the selector in $(), or maybe your element’s id has some weird characters in it and you need to pass the good ol’ document.getElementById('my_id') as your argument, it’s a tiny chunk of code for a whole bunch of insurance.

Here’s an example of this in action in a function that shows an alert when clicking a button element:

JavaScript:

function annoyingAlert($btn, msg){
    $btn = ($btn.jquery) ? $btn : $($btn) ;
    $btn.click(function(){
        alert(msg)
    }
}

HTML (and inline JavaScript):

<button id="this_button">Click Me</button>
<script type="text/javascript">
    annoyingAlert('#this_button', 'Good job genius, you clicked the button.');
</script>

Switching to WordPress.com for blog posts (from Tumblr)

Yes, I could set up my own WordPress blog and write my own theme and deal with the hassle of keeping the back end updated… But why? I’ve got a busy life and the most important thing to me right now is sharing what I’m working on and any cool tidbits I come across in the process. This free WordPress.com blog, which is maintained by the fine WordPress folks themselves, lets me insert code with the “code” shortcode (that’s code for putting code in my WordPress post “code” shortcode).

$(function(){
    $('body').append('<blink>Look how cool I am.</blink>');
});

These WordPress posts will be blasted over Teh Intarwebz to Twitter and Tumblr – so, if anyone even cares, you can follow me just about anywhere (except Facebook – why would I share this stuff on Facebook? I’ll stick to sharing my personal Instagram pics there). 😛

“601? What the Devil?”

The link here is where the “601” concept comes from (the original Andromeda Strain movie), and it pretty much describes modern life with the onslaught of information and data spewing from everywhere on the planet!

So, if you’re into web development, follow me for random musings on jQuery/Javascript, HTML, CSS, etc. I’ll try to keep the posts relevant to that, but there may be some random posts ones thrown in to see if anyone’s paying attention!