Fixing ESPN FantasyCast being broken in Chrome

This is the 2nd year in a row that ESPN has had a bug in their Fantasy Cast website so it does not render properly in Chrome. If your page looks like this, it’s broken. The good news is it’s easy to fix with a simple bookmarklet.



Simply create a bookmark with this as the url

javascript:(function(){$('#real .progame-list').css("width", "101%");})()

and click on it to fix the page. Once clicked the page will look like this, which is much more user friendly.


Creating a bookmarklet to log a user in

As someone who is continually logging into an internal website while writing code I knew there had to be a better way than entering my username and password 100 times a day. To complicate this I’m also alternating between users with different admin rights, access, etc and remembering multiple usernames and passwords can be tedious. The solution? Create a bookmarklet that fills out the elements on the screen and clicks the submit button. I wouldn’t recommend you use this for anything other than an internal only application, but if you want to store your password in plain text in your bookmarks that are probably synced between computers go right ahead :).

You’ll need to inspect the DOM and get the ID values of the username, password and form to make this work. What you do is set the dcoument into a variable get your element by the ID and set the value to your username. The same goes for the password. If you’re having trouble getting this to work make sure your input fields have ID and you have the case typed in correctly.

  var d=document;

Simple copy and paste the above code into the url field of a bookmark and you’ll be saving multiple seconds daily.

Showing all hidden elements on a page using jQuery

I’ve been working on a large browser compatibilty project which involves also giving the page a facelift to bootstrap. We’re mostly modifying XML which creates the markup and there are a few pages with a lot of rules that hide element based on certain scenarios and hitting those scenarios became very tedious when we were already 98% sure the page would work. The divs are hidden on the page and aren’t just not generated server side. The elements are hidden both by adding a class of hidden and by using display:none.

I ended up writing a bookmarklet that runs through all the elements in the DOM and removes the style attribute and removes the hidden class from all elements. This isn’t being used anywhere other than on a developers machine, so efficiency wasn’t the goal here. The goal was to show all hidden elements to make sure they’re being styled correctly. They’re being styled with classes, so that’s why removing the style attribute was an easier option.

Here’s the jQuery code

$(function() {
  $("body *").each(function() {

Here’s the bookmarklet. You can simply create a new bookmark with this as the URL and click it to show the hidden elements.

javascript:(function(){$(function(){$("body *").each(function(){$(this).removeAttr("style"),$(this).removeClass("hidden")})})})()

Add, edit or delete sudo users using putty/bash

To add, edit or delete sudo users in putty/bash do the following

  1. Type visudo and press enter.
  2. Navigate using the arrow keys to where you want to edit.
  3. Press insert to enter edit mode.
  4. Make your changes. It is very important that you use tabs and spaces correctly.
  5. Press esc to exit edit mode.
  6. Type :wq and press enter. I remember this command as “write quit”

This is a pretty simple process, but very easy to forget when you only make changes sporadically.

Cross browser compatible numbers only textbox

While working on a browser compatibility project recently I ran into an issue where using an onkeypress attribute on an input field was firing when using the left and right arrows keys and the delete button. This functionality differs from how IE and Chrome work, so the old code that used to be IE only compatible wouldn’t let a user do anything except type numbers (Good!) and use the backspace (Bad!). The users needed to be able to use arrow keys and the delete button in Firefox.

Since we’re only supporting the latest browsers, IE 11, Chrome, Safari and Firefox, We thought using an input with type=”number” was a good solution, but it adds awful looking up/down arrow buttons in the field and it actually doesn’t do anything to prevent letters from being entered, so that was obviously out.

We tried countless regEx patterns but finally settled on the following which lets you use all arrow keys and the delete key, but still only allows you to enter numbers into the text field. Big thanks to Scott Busche for coming up with the correct regEx

$('.numbersOnly').keyup(function() {
var pattern = new RegExp(/\D/);
var validString = $(this).val().replace(pattern, '');
if ($(this).val() !== validString) {

Rather than calling a function on key press however we decided to add a specific class to these fields and handle the result with a jQuery selector. The downside to this function is that you are actually allowed to type letters and special characters and they will show up for a millisecond, but they will be removed from the input box.

If anyone has anything that works better and is compatible on all the latest browsers I’d love to hear your solution.

Websphere unable to check if application exists

I’m still fairly new to Websphere, but this seemed like a pretty common problem someone would have and I couldn’t find anything that properly explained the issue to me. I was running into an issue where WebSphere kept saying it was unable to check if application exists when it was being deployed. I thought initially this was a permissions problem, so I fooled around with permissions but had the same issue. If you scroll down a ways on the stack trace it says

insufficient or empty credentials

I double checked my configuration in Hudson/Jenkins and testing the connection worked fine, so I continued searching for other solutions. There are literally 3 search results on google for “unable to check if application exists” and 0 results on bing. Most of the other articles I found offered no help. Eventually I circled back around and decided to look at the access level my user had in WebSphere. Turns out it wasn’t listed as a user! I’m still not sure how testing the connection in Hudson worked but I wasn’t listed as a user in WebSphere. I checked this half a dozen times just to make sure I wasn’t mistaken.

To add a user in WebSphere

  1. Users and Groups
  2. Administrative user roles
  3. Select the Administrator role
  4. Enter the user to search for
  5. Use the arrow to move the user to the Mapped to role box
  6. Click OK
  7. Click Save

Step 7 is super important because it requires an additional save than most programs do and I find myself forgetting to do the second confirmation too often. After you’ve added the appropriate permissions redeploy your ear and you should be all set.

Full stack trace of the error I was getting

[INFO] No custom module-to-server mappings found -- using default configuration.
com.insertcompanynamehere.websphere.deployment.client.DeploymentException: Unable to check if application exists 'NewBusiness'
at com.insertcompanynamehere.websphere.deployment.client.was61.DeploymentManager.applicationExists(
at com.insertcompanynamehere.websphere.deployment.WebsphereDeploymentTask.execute(
at com.insertcompanynamehere.hudson.plugin.WebSphereDeploymentBuilder.perform(
at hudson.tasks.BuildStepMonitor$3.perform(
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(
at hudson.model.Build$BuildExecution.post2(
at hudson.model.AbstractBuild$
at hudson.model.Run.execute(
at hudson.model.ResourceController.execute(
Caused by:
at com.insertcompanynamehere.websphere.deployment.client.was61.DeploymentManager.applicationExists(
... 11 more
Caused by: ADMN0022E: Access is denied for the checkIfAppExists operation on AppManagement MBean because of insufficient or empty credentials.
at $Proxy43.invoke(Unknown Source)
... 13 more
Build step 'IBM WebSphere v8.0 Deployment' changed build result to FAILURE
Finished: FAILURE

Enabling offline mode in Google Chrome

In April and May I was traveling every other week for work and to keep myself occupied I would open a bunch of articles in chrome on my phone to read them on the plane. Much to my chagrin the first time I did this about half the articles were automatically reloaded by chrome and I wasn’t able to read them because I didn’t have an internet connection. I started trying to fix this by looking for a way to disable the setting that would reload tabs, but was unsuccessful. What I did find was an option to reload an article from the cache if you were offline.

Simply type chrome://flags into your address bar and find the Enable Show Saved Copy Button setting.

Enable Show Saved Copy Button Mac, Windows, Linux, Chrome OS, Android setting.
When a page fails to load, if a stale copy of the page exists in the browser cache, a button will be presented to allow the user to load that stale copy. The primary enabling choice puts the button in the most salient position on the error page; the secondary enabling choice puts it secondary to the reload button. #show-saved-copy

You can enable this setting as a primary or secondary button. Primary will enable this setting as the most noticeable option when you’re offline and secondary will make it the secondary option to reloading the page.

Before I found this setting I stumbled upon Pocket which is a much better option for saving articles overall, but won’t help you recall a webpage you visited earlier. The other downside to pocket is it’s much easier to forget about than an open tab and you’ll probably let articles sit in their forever before you read them.

Hard refreshing in Google Chrome

All of us are probably familiar with ctrl + F5 to hard refresh a page but I ran into a cool feature in Chrome today that will save you a second or two if your hand is already on the mouse. If you have the console open and long press on the refresh button you’re given three options

  1. Normal Reload
  2. Hard Reload
  3. Empty Cache and Hard Reload

You can already disable cache while the console is open but this option will empty the entire cache and re-download everything on the current page. The difference is if the current website has content loaded through a CDN this will force a re-download of that content.


Aligning monitors vertically in Windows

At work I have dual monitors but with my docking station can also use my laptop as a 3rd monitor which is great. The thing that always annoyed me was my laptop was my third monitor and was located all the way to the right, so to get to it I had to mouse all the way to the right. A minor annoyance for the convenience of having 3 monitors. I mentioned something to someone about this the other day and they asked why I didn’t position my laptop monitor as below the dual monitors and I said “I would if I could”. Then I opened up the monitor control panel and tried to drag the monitor below and lo and behold it worked! I’m not sure why I never thought of this before as it seems so obvious now.

This would also work if you have one external monitor positioned directly above your laptop. Rather than scrolling to the right to get to the 2nd screen you can scroll verticallywhich is a lot more intuitive. This works with the Intel Control Panel and also with the GeForce Experience Control Panel.

3 monitors 1 below


Groovy, Grails and Responsive Web Design Stack Overflow

I’ve taken inspiration from Stephen Moretti and his CFOverflow twitter account and started twitter accounts for Groovy, Grails and Responsive Web Design that post the latest questions on each topic from Stack Overflow. For Groovy it posts the latest questions tagged Groovy and the same goes for Grails. I originally set these up as just one feed, but the questions coming in to the two feeds don’t really overlap as much as I thought they might so I decided to split them into two accounts.

For the Responsive Web Design account the latest Stack Overflow posts tagged “media queries” or “responsive design” are posted.

Stephen said he added some filters to prevent duplicates from posting, but I haven’t done that yet. If duplicates start showing up in the feeds I will take a look at the filters.

If anyone thinks other feeds should be added to these accounts let me know and I can get them added. Any feedback at all in appreciated

Groovy questions
Grails questions
Responsive Web Design questions