Bootstrap 3.1.1 and Typeahead.js 0.10.2

Additional CSS I needed per discussion on https://github.com/twitter/typeahead.js/issues/378 as of today, using the latest available packages on bower.

.twitter-typeahead {
width: 100%;
position: relative;
}
.twitter-typeahead .tt-input,
.twitter-typeahead .tt-hint {
margin: 0;
width: 100%;
color: #555555;
vertical-align: middle;
background-color: #ffffff;
border: 1px solid #cccccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.has-warning .twitter-typeahead .tt-input,
.has-warning .twitter-typeahead .tt-hint {
border-color: #c09853;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-error .twitter-typeahead .tt-input,
.has-error .twitter-typeahead .tt-hint {
border-color: #b94a48;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-success .twitter-typeahead .tt-input,
.has-success .twitter-typeahead .tt-hint {
border-color: #468847;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.twitter-typeahead .tt-input:focus,
.twitter-typeahead .tt-hint:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.has-warning .twitter-typeahead .tt-input:focus,
.has-warning .twitter-typeahead .tt-hint:focus {
border-color: #a47e3c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
}
.has-error .twitter-typeahead .tt-input:focus,
.has-error .twitter-typeahead .tt-hint:focus {
border-color: #953b39;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
}
.has-success .twitter-typeahead .tt-input:focus,
.has-success .twitter-typeahead .tt-hint:focus {
border-color: #356635;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
}
.twitter-typeahead .tt-hint {
color: #a1a1a1;
z-index: 1;
border: 1px solid transparent;
}
.twitter-typeahead .tt-input {
z-index: 2;
}
.twitter-typeahead .tt-input,
.twitter-typeahead .tt-hint {
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
}
.twitter-typeahead .input-sm.tt-input,
.twitter-typeahead .hint-sm.tt-hint {
border-radius: 3px;
}
.twitter-typeahead .input-lg.tt-input,
.twitter-typeahead .hint-lg.tt-hint {
border-radius: 6px;
}
.input-group .twitter-typeahead:first-child .tt-input,
.input-group .twitter-typeahead:first-child .tt-hint {
border-radius: 4px 0 0 4px !important;
}
.input-group .twitter-typeahead:last-child .tt-input,
.input-group .twitter-typeahead:last-child .tt-hint {
border-radius: 0 4px 4px 0 !important;
}
.input-group.input-group-sm .twitter-typeahead:first-child .tt-input,
.input-group.input-group-sm .twitter-typeahead:first-child .tt-hint {
border-radius: 3px 0 0 3px !important;
}
.input-group.input-group-sm .twitter-typeahead:last-child .tt-input,
.input-group.input-group-sm .twitter-typeahead:last-child .tt-hint {
border-radius: 0 3px 3px 0 !important;
}
.input-sm.tt-input,
.hint-sm.tt-hint,
.input-group.input-group-sm .tt-input,
.input-group.input-group-sm .tt-hint {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
}
.input-group.input-group-lg .twitter-typeahead:first-child .tt-input,
.input-group.input-group-lg .twitter-typeahead:first-child .tt-hint {
border-radius: 6px 0 0 6px !important;
}
.input-group.input-group-lg .twitter-typeahead:last-child .tt-input,
.input-group.input-group-lg .twitter-typeahead:last-child .tt-hint {
border-radius: 0 6px 6px 0 !important;
}
.input-lg.tt-input,
.hint-lg.tt-hint,
.input-group.input-group-lg .tt-input,
.input-group.input-group-lg .tt-hint {
height: 45px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
}
.tt-dropdown-menu {
width: 100%;
min-width: 160px;
margin-top: 2px;
padding: 5px 0;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.tt-suggestion {
display: block;
padding: 3px 20px;
}
.tt-suggestion.tt-cursor {
color: #fff;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=’#ff0088cc’, endColorstr=’#ff0077b3′, GradientType=0);
}
.tt-suggestion.tt-cursor a {
color: #fff;
}
.tt-suggestion p {
margin: 0;
}

.input-group .twitter-typeahead {
display: table-cell !important;
}

 

CAS 3.3.1 to CAS 4.0.0 Upgrade/Migration

CAS 4.0.0 is in the process of being released, and the documentation is not comprehensive. Here are somethings I did to get from CAS 3.3.1 to CAS 4.0.0 in terms of the maven overlay project.  This was mainly to get the fix for CAS-1318.

Overlay pom dependencies

updated cas-server-webapp from 3.3.1 to 4.0.0
added cas-management-webapp 4.0.0
added cas-server-support-generic 4.0.0
added cas-server-support-x509 4.0.0
added cas-server-support-openid 4.0.0
cas-server-support-ldap 4.0.0
removed outdated dependencies from overlay/lib

Files copied over from github https://github.com/Jasig/cas/tree/master/cas-server-webapp

src/main/webapp/WEB-INF/webflow/login/login-webflow.xml
src/main/webapp/WEB-INF/webflow/logout/login-webflow.xml
src/main/webapp/WEB-INF/cas-servlet.xml (too many changes, added my changes after copying over)

Updated files

login-webflow.xml,
uncommented startAuthenticate, changed flow in serviceAuthorizationCheck to transition to startAuthenticate instead.  Note: my project was using x509check, so the commented out code seemed to run the x509check

deployerConfigContext.xml,
added namespace util
modified auditTrailManager bean to point to new class
added healthCheckMonitor bean
added registeredServiceList, modified to fit our services
added monitorsList

xml schema upgrades in overlayed xml files
beans 2 -> beans 3
webflow 1 -> webflow 2

Changed Credentials.class references to Credential.class in custom code in extensions

Relevant Links
http://jasig.github.io/cas/4.0.0/index.html
https://wiki.jasig.org/display/CASUM/Auditing+and+Statistics+Via+Inspektr
https://github.com/UniconLabs/simple-cas-overlay-template
https://github.com/Jasig/cas/blob/master/cas-server-core
https://wiki.jasig.org/display/CASUM/Best+Practice+-+Setting+Up+CAS+Locally+using+the+Maven+WAR+Overlay+Method
https://github.com/leleuj/cas-overlay-demo/blob/master/cas-overlay-server-demo/src/main/webapp/WEB-INF/deployerConfigContext.xml
https://wiki.jasig.org/display/CASUM/Upgrading
https://wiki.jasig.org/display/CASUM/X.509+Certificates
https://github.com/Jasig/cas/blob/master/cas-server-support-x509/src/test/resources/deployerConfigContext.xml
https://github.com/Jasig/cas/blob/master/cas-server-support-x509/src/main/java/org/jasig/cas/adaptors/x509/authentication/handler/support/X509CredentialsAuthenticationHandler.java
http://comments.gmane.org/gmane.comp.java.jasig.cas.user/17466
https://groups.google.com/forum/#!msg/jasig-cas-user/jS2GjedsMd4/o-MGC_Tpn7IJ
https://wiki.jasig.org/display/CASUM/OpenID
https://github.com/leleuj/cas-openid-demo/blob/master/cas-openid-server-demo/src/main/webapp/WEB-INF/cas-servlet.xml
https://groups.google.com/forum/#!msg/jasig-cas-user/jS2GjedsMd4/o-MGC_Tpn7IJ
https://wiki.jasig.org/display/CASUM/Services+Management
http://mmmsoftware.blogspot.com/2008/11/migrating-from-spring-webflow-1-to.html
http://www.jasig.org/upgrading-spring-web-flow-2-cas4
https://github.com/Jasig/cas/wiki/Installation-Guide
https://github.com/Jasig/cas/wiki/CAS4-Documentation-(GitHub-Pages)
https://github.com/Jasig/cas/blob/master/cas-server-webapp/src/main/webapp/WEB-INF/cas-servlet.xml

Each project is different, but I basically just fixed compilation errors and went through the runtime errors.  I didn’t write down the details of each change, but the relevant links should have more information on what the exact changes were.

Good luck!

Google Chrome has crashed, relaunch now? loop

This morning, I was unable to open Google Chrome, and I was stuck in an endless loop of error messages.

The error message read, “Google chrome has crashed, relaunch now?”

I tried deleting/backing up my “%localappdata%/Google/Chrome/User Data” folder and running scans to check for system file corruption with no luck.

My system uses PowerBroker and Enhanced Mitigation Experience Toolkit (EMET), I had to turn off EMET’s configuration for chrome.exe to not call PowerBroker.  In the “caller” column, uncheck the box for chrome.exe

Angular and Browserify

Angular works beautifully with browserify.

I loved what Require JS did for my Marionette project, but I hated the complexity that it added for everyone else.  I had to jump through hoops to write independent modules using Require JS and Marionette JS.

However, browserify is very simple to use and makes independent modules a breeze.  I had to update angular and modify some files to get it working (not checked in yet) but here’s where I plan to check in my prototype forked from another repo.

https://github.com/leedavidr/angular-seed-with-browserify-and-mocha

TinyMCE WYSIWYG editor to PDF and DOCX formats using docx4j

Few steps to get this done after the environment set up.  Basically prep html document, convert to xhtml, add to docx4j document, and generate.

1. (Preparing HTML) Wrap TinyMCE generated HTML in a root element such as div.

2. (Preparing HTML) Replace   with

3. (Preparing HTML) Use regEx to remove height and width attributes from images.  Affected version 2.8.1.  See http://stackoverflow.com/questions/15659076/does-docx4j-convert-xhtml-to-docx-in-memory

4. (Convert to XHTML, Generate) Use XHTMLImporter to convert the html into xhtml.  See http://priasardi.wordpress.com/2012/01/17/convert-html-to-docx-using-docx4j/

* Update – 2.8.1 seems to have trouble with underline and background color.  3.0.0 fixes that.  Both versions have trouble with table border and table caption.  3.0.1 (unreleased) should fix table border.  See http://www.docx4java.org/forums/pdf-output-f27/tabl-caption-and-border-issue-docx4j-3-0-0-t1763.html

 

How to Retain Top Software Developers

I’ve worked with many companies in the Washington, D.C. metropolitan area, and there’s a huge retention problem.  Here are some of my thoughts on how to retain top talent in the software industry in general.  It might be relevant to note that this is from a millennial’s (Generation Y) perspective.

1. Reward top talent according to what they want. Ask them individually how they want to be rewarded, and reward them.  Examples are recognition, financial rewards, promotions, and paid time off.  If you can’t do it, at least show some effort or progress.

2. Ask about their desired career path and guide them.  There are too many cases where management want to keep employees where they are most efficient.  Efficiency is good for the tasks, but it’s also boring for the employees. You could also be missing out on some amazing potential. Guide them towards their goal by building the skills they need.

3. Rotate interesting tasks across developers.  Usually a project comes with many redundant, boring tasks.  Do not let only one developer take all the interesting tasks, it rarely does any good.  If only one developer can tackle such tasks, this is a resource management issue, let other developers shadow or pair with the developer to tackle difficult, interest problems together to fix this problem.

4. Encourage developers to set up one or two meetings a day outside of regular lunch hours to discuss the larger technical scope of the project.  Maybe even have developers present their work.  Doing such would allow developers to keep the big technical goals in mind and it also gets the developers out of their seat increasing physical activity.  Surely this would also improve code quality.  In my world, I would have something like recess or gym class mid-day to refresh the mind.

5. Keep hours flexible, but set core hours.  Developers are more efficient at different times of the day with breaks.  Some days the brain just doesn’t work, and some days it does wonders.  Core hours are not meant to be 7 hours of the day, it should be at most 6 hours but preferably around 5 hours.

6. Give developers a sense of ownership of their code.  If a developer works on the full feature set from top to bottom, they will gain a sense of ownership.  Adding new features and refactoring will be a breeze, and developers could have some pride in their code.  This usually improves efficiency too.

7. Don’t force or encourage developers to take short cuts.  There’s a quick way, and there’s the right way.  In my opinion, usually the right way doesn’t take much longer than the quick way.  There’s no reason to take short cuts when there are so many negatives including hurting morale.

8. Let the bad developers go.  Sometimes there are bad developers.  Not just bad in terms of code quality, but hazardous to the culture and office environment.  Recognize the problem early, and don’t make any extra effort to retain negative talent.

This covers most of the topics I wanted to write about, but every situation is different.  Open communication with the employees is the easiest way to find and resolve issues.  I know there are a ton of recruiters hunting for software developers, but employees would rather stay loyal.