:::: MENU ::::
Browsing posts in: Code

Title Capitalization in SublimeText

I’ve been working on a lot of documentation lately and was recently tasked with converting a bunch of heading tags that were originally written using sentence style capitalization to use the more proper title capitalization. This is not a huge task in and of itself, but with a few hundred headings to change out, I figured there was probably a tool out there that could help me out. A few google clicks later, I found Sublime-TitleCase, a really handy plugin for SublimeText that applies smart title capitalization to a selection of text. It’s smart in that it doesn’t just capitalize every word in the selection (like the Title Case function that ships with SublimeText does), but rather applies a set of rules that figures out which words to capitalize and which should be left lower case.

After I got the plugin installed, I added a user shortcut to more quickly apply the command, and the rest was easy. To setup the user shortcut in SublimeText 3, click SublimeText -> Preferences -> Key Bindings User, and add the following line to the file

A quick restart of SublimeText and you should be up and running! Happy Capitalizing!

Getting to Know Respoke: Endpoints

One thing I found to be a bit confusing when I first started using Respoke was the concept of Endpoints, or to be more specific: how endpoints function within the Respoke platform. First let’s start with defining what an Endpoint is. At its most basic level, an Endpoint represents a user within the Respoke system. That being said, a “user” could be any number of things: a person connecting from their browser or mobile device, a server, a SIP phone, or even a Robot Chicken (if we could just get the good Doctor to add WebRTC support!). Basically anything with the ability to establish a connection with the Respoke framework can become an Endpoint.

Robot Chicken

So now that we know what an Endpoint is, the next thing to figure out is how to communicate with them. When connecting a user of your application with Respoke, it will be up to you to supply an Endpoint Identifier that will be used to identify the Endpoint through which that user can be reached. The Endpoint Identifier is essentially the ID of the user within the Respoke framework, and can be anything you want: an email address, a generic user id, or whatever other method you might use to track your users.

One thing to keep in mind is that a user might connect to Respoke multiple times with the same Endpoint Identifier, but not to worry, Respoke automatically maps all of these Connections to a single Endpoint. The advantage of this is that you don’t have to worry about tracking all the locations where your users are connected. Respoke will take care of sending any messages or calls to all of the Connections for an Endpoint. In the example below, Joe sends a message to Endpoint with ID foo@bar.com. Joe only sends the message once, but it will be distributed out to all the places where foo@bar.com is connected to Respoke (in this case a laptop, cell phone, and toaster!).


One last tip: You can get a reference to an Endpoint regardless of whether or not the “user” whom that Endpoint represents is currently connected to Respoke. I know this may seem a bit confusing at first, but stay with me! Imagine you’ve built an application that allows users to send messages to one another. You have a database full of users that are signed up for your app, and you want to be able to get notifications for when a user comes online. When the app launches, it pulls down the information about your users, and creates an Endpoint for each one. Now, not everyone is going to be signed into the app, but you can still create an Endpoint for them as follows:

So now that we have an Endpoint for user “foo@bar.com”, we can call methods like Endpoint.getPresence() to find out if they are currently online or not. The really cool part of this is if the user is not online, we can still create an endpoint for them, and when they do come online, Respoke will automatically connect them to the Endpoint instance that we have already created!

So that’s a brief introduction to Endpoints in Respoke. If you still have any questions, feel free to leave me a comment below, or head over to the Respoke Community Forums and post your question there. You can also find more information about Respoke Endpoints in the Respoke Docs.

Chrome Blocking Flash Plugin – Flash PPAPI to the Rescue

plugin blocked

A recent update to the Google Chrome browser has introduced a step towards the removal of support for the The Netscape Plug-in API (NPAPI). The result is that any pages that utilize a plugin using the NPAPI (such as Flash, Silverlight, etc.) will be disabled, you will receive a “Plug-in Blocked” notification, and any object on the page utilizing the plugin will display the beloved “missing plugin” image.

From here you have the option of individually enabling the plugin on a per-domain basis (this is done by clicking the “Plug-in blocked” notification, and selecting the option to allow plugins for this domain). This is a fast, but rather annoying workaround that will only work for the next few months until Google permanently disables NPAPI support (at which point, this option will no longer be available).

The Solution:

Unfortunately, the solution is to replace any plugins that use the NPAPI with new versions written using alternative (and still supported) methods. One example of this is the Adobe Flash Player plugin which now offers a version written using the Chromium Pepper Plugin API (PPAPI). This version will be supported going forward, and will allow you to run content requiring the Flash Plugin in new versions of Chrome. More information about the Flash Plugin update can be found at http://blogs.adobe.com/flashplayer/2014/12/flash-runtime-16-update-new-ppapi-installers-and-air-news.html and you can download the updated Flash Plugin at http://labs.adobe.com/downloads/flashplayer.html



With Googles decision to back WebRTC and other HTML5 based streaming and real-time communications API’s, I don’t find it the least bit surprising that they have decided to take another step towards shutting down alternative methods of implementing such functionality. While many people have been claiming for years that “Flash is Dead,” and I have finding myself more and more inclined to agree, this does serve as a gentle reminder of just how much content out there still runs on Flash. That being said, let us not forget that on the world wide webs, dead does not mean gone…

Getting Started with Respoke: Part 2 – Connecting to Respoke

This entry is part 2 of 2 in the series Getting Started with Respoke

Welcome to Part 2 of of the Getting Started with Respoke Series! In this section we will be covering creating an instance of the Respoke Client and connecting to Respoke.

In Part 1 of this series, we walked through setting up your Respoke account and creating your first App. If you haven’t done this yet, please take a moment to complete Part 1 now, as you will need these two items to follow along in the rest of the series.

Creating the Respoke Client:

Respoke App Settings

The first thing you will want to do when creating your Application is to create an instance of the Respoke Client. But before you can do this, you will need to get your App ID. The App ID can be found by going to Developer Portal, selecting the “Apps” tab on the left, clicking on the settings icon of the app you are working on, and scrolling down to the App ID section. Continue Reading

Getting Started with Respoke: Part 1 – Signing Up and Creating Your First App

This entry is part 1 of 2 in the series Getting Started with Respoke

This is Part 1 in a series on getting started using the Respoke platform. What is Respoke you ask? Respoke is an extremely easy-to-use platform that allows developers to add live voice, video, messaging, and data features to your websites and applications. Some examples of things you might do with this platform include (but are definitely not limited to):

  • Text Chat / Instant Messaging
  • Audio Calling
  • Video Collaboration
  • Peer-to-Peer Data (think direct file sharing from within your browser)

The examples I am going to cover in this series will use the Respoke Javascript Library which is open-source and available on GitHub at https://github.com/respoke/respoke. SDK’s for iOS and Android are also in the works and should be available early 2015.

Ready to get started? Let’s go!

Continue Reading

Error Establishing Database Connection on WordPress Login – Check Your Auth Settings

I recently downloaded a copy of my wordpress site to my local dev machine using the Duplicator plugin (works great by the way), and everything seemed to be working correctly, until I went to the wp-admin page. When trying to login via wp-admin I was presented with the message “Error establishing database connection.” Like most relatively intelligent individuals, I cracked open my wp-config file and checked, then re-checked, then re-re-checked my DB_USER, DB_PASSWORD, DB_HOST, and DB_NAME properties. As far as I could see they were all correct, yet the issue remained.

Continue Reading

Flashbuilder 4.7 Stops Reporting Compiler Errors

I finally made the upgrade to Adobe Creative Cloud, and thus far I have been extremely pleased with the new product line (the most notable difference being the compilation time and general speed of both Flashbuilder and Flash Professional). But, as with any new Adobe product, there are also a fair amount of really annoying and hard to diagnose bugs. The latest issue to plague me was that Flashbuilder suddenly stopped reporting compilation errors. As always, this resulted in a few frustrating hours consulting Dr. Google without much progress. And, as (almost) always, I finally found a solution.

The Solution (at least this worked for me):
All I had to do to get Flashbuilder to start playing nicely and reporting compiler errors again was to delete the project from my workspace (right-click on the project in the project explorer and choose delete, but select the option to not delete the contents), then re-import the project back into Flashbuilder (right-click in project explorer, choose import, then browse to the folder containing your project). That was all it took for me! Hopefully this will save someone from hours of head banging (at this point my skull is harder than steel!).

Flashbuilder error occurred during Finding occurrences – java.lang.NullPointerException

The other day I started getting plagued by constant pop-ups in Flashbuilder notifying me that “An internal error occurred during: “Finding occurrences””, the details then outline that a “java.lang.NullPointerException” is to blame. The partial stack-trace was as follows:

After a ton of googling on the error, the best solution I could find was to simply try and drag this window somewhere off the screen and ignore it. Unfortunately, this just wasn’t going to work for me; partly because Flashbuilder wouldn’t allow me to drag the window off screen, but mostly because I wanted to find a real fix! After a bunch of trial and error I was finally able to pin this down to a workspace error.

The Solution: For me the solution ended up being pretty simple. I made a backup copy of all the projects in my workspace, then deleted all the files (including the hidden ones) in my workspace. Next I pointed Flashbuilder at the now empty workspace directory (forcing it to recreate all the workspace files). Finally I imported the project folders that I had backed up. That seemed to do the trick for me. Now I’m just hoping that the same error doesn’t resurface in 20 minutes…

Building Robotlegs SWC Using Maven – Failed to launch Flash Player

First, a little backstory on how I got to this error in the first place (bear with me). I recently start a project using Robotlegs 2.0.0. Since this version was just released, a lot of the extensions are still being ported over. In my case, I had need of the RelaxedEventMap extension, which I had used heavily with RL1. Thankfully, CReynders was kind enough to port the existing RL1 source over to an RL2 extension; however, porting the extension also required a few minor tweaks to the RL framework source. What this meant to me is that if I wanted to use the RelaxedEventMap extension, I would need to download the latest Robotlegs source from GitHub which contained the previously mentioned tweaks (i.e. I could no longer use the latest compiled version of the RL2 SWC). I didn’t assume this would be a big deal, that is, until I tried to compile my application using Flash Pro. The compile-time went from about 2 seconds using the compiled RL2 SWC, to upwards of 30 seconds when including the RL2 framework source. All this led me down the path of compiling the RL2 SWC myself for the first time (see, I told you’d I’d get to the point eventually!).

Continue Reading

PhoneGap Android Errors – ANDROID_BIN=”${ANDROID_BIN:=$( which android )}” – GeekGoneNomad

While trying to get PhoneGap setup, I ran into an issue when creating a test android project. I was trying to run the following command to create my android project:

When I ran this command I immediately received an error:

After checking my .bash_profile paths, and a bunch of digging, I finally found the cause of the issue. If you open up the create file (phonegap-2.4.0/lib/android/bin/create), there is a line that lists ANDROID_BIN=”${ANDROID_BIN:=$( which android )}”. The “which android” is the cause of the issue (or at least it seemed to be in my case). If you replace this line with the full path to your android tools (as listed below) it should resolve the issue. My final line looked like this:

There is also another solution that has seemed to work for many people and is (in my opinion) a better and less obtrusive one than what I outlined above. That being said, this next fix did not work for me. If it works for you, I’d suggest you use it, and use the first fix as a fallback in case it does not work for you.

The second fix is to add the Android SDK to your Path environment variables. You can find detailed instructions on how to setup these environment variables for both Windows and Mac OSX in the PhoneGap documentation under sections 3A and 3B.