IntelliJ 2017.1 is OUT!!!

Got this from their email announcement:

IntelliJ IDEA 2017.1 is available for download! In addition to many important bug fixes, this massive update brings lots of improvements to supported languages, frameworks, and built-in tools.

  • Java 9: The latest builds of JDK 9 are fully supported, with assisted project import and coding assistance for editing module declarations. Built-in inspections validate module declarations and provide quick-fixes for adjusting project dependencies.

  • Java 8: Quick-fixes that help migrate for loops to Stream API calls have been improved and now support more sophisticated scenarios. We’ve also added a quick-fix that turns Stream API calls back into for loops, which is handy for debugging or exploring code.

  • Async-aware debugger: Async stacktraces is a new feature that substitutes parts of a stack trace related to asynchronous code execution with data captured from where that code is invoked. This helps you focus on what you’re debugging. An improved Smart Step Into also supports asynchronous code and lambda expressions running on other threads.

  • Better VCS: The Log panel for Git and Mercurial has new display options, the Diff dialog gets an option to Ignore imports and formatting, and File History for Git is now faster. We’ve also added Favorite Branches and Speed Search to the Branches popup for Git.

  • Search: The Find in Path dialog, which previously had added a Preview tab, has been reworked from the ground up and now shows instant results in the first place. What is more important, now you can open any selected result in the Editor simply by pressing Enter.

  • Spring: Spring Testing has been updated to support Spring Boot 1.4.3, and the upcoming Spring 5.0. Spring Data tools are updated to version 2.0 (including MongoDB, Redis, Solr, KeyValue, Gemfire, Apache Cassandra, REST, Neo4j, Couchbase, and Elasticsearch). There’s also a new Data tab in the Spring tool window which brings better repository navigation.

  • Gradle: Support for Composite Builds is much improved with the detection of includeBuild in Gradle settings and automatic project configuration.

  • Kotlin 1.1: Among other things, the new version of this JVM language introduces coroutines—the new non-blocking asynchronous API, and fully supports compilation to JavaScript. This means you can use Kotlin strings, collections, sequences, arrays and other core API in your JavaScript apps.

  • JavaScript: We’re bringing first-class support for Vue.js, lots of new code style options for JavaScript and TypeScript, faster and more reliable integrations with Angular, ESLint and TSLint (including language service support and TSLint-powered quick-fixes). Plus, simpler editing of project dependencies in package.json with package names and versions completion and easier running of Mocha and Jest tests with the new Run gutter icon that also displays test state.

  • Database tools: IntelliJ IDEA now allows you to transfer table schemas and data between any two databases (yes, even from MySQL to Microsoft SQL Server and back).

  • Emoji: The editor now supports Unicode emoji characters (handy for writing comments).

  • Android Studio 2.2.2: This update includes all changes from Android Studio 2.2.2.

  • Docker: The Docker plugin now supports Docker for Mac and works via “unix://”.

  • Windows: The 64-bit installer for Windows lets you give IntelliJ IDEA more RAM.

MyBatis, Postgresql, Byte Array and ByteA

 
Spent about an hour or two trying to find the correct TypeHandler and jdbcType combination to be able to retrieve data from a bytea type column in a postgresql table.
 
This is what I got:

 jdbcType="BINARY" typeHandler="org.apache.ibatis.type.ByteArrayTypeHandler"

Hope this helps someone.
For inserting I used this combination:

javaType=byte[], jdbcType=BLOB, typeHandler=org.apache.ibatis.type.BlobTypeHandler

The error I encountered was :
org.postgresql.util.PSQLException: Bad value for type int : \3
 
The error is caused by defaulting to the use of oid when the field was actually stored in the column and not elsewhere.
 
Comment if this was useful!

Grails + Jenkins + GitHub = WIN

Found slides to this very useful talk about Grails + Jenkins + GitHub.
This is very useful because it allows one to approximate the Git-Deploy features one gets accustomed to when deploying in heroku or openshift.

 

GVM becomes SDKMAN

I haven’t been programming in grails lately so this comes as a surprise.
 
I am trying to learn the innards of google cloud compute engine, although we’ve used it as a test server for our previous grails project I wasn’t involved in setting it up (perks of having a geeky CTO).
 
Was happily using GVM since last year and was surprised that it wasn’t working.
it seems the new website for gvm is:

http://sdkman.io/

The new command would either be:

curl -s http://get.sdkman.io | bash

curl  –ipv4- -s http://get.sdkman.io | bash

PS: May post about setting up an instance with ubuntu java grails in google cloud compute

Larry Page, Sergy Brin Are Lousy Coders – Business Insider

It turns out the developers most responsible for building the Google.com that quickly became the Web’s most powerful company are two guys you’ve probably never heard of.
The first is Urs Hözle. According to one early Googler quoted by Edwards, Hözle was “the key” to Google’s early success.
Edwards writes, “Enough engineers sang his praises that this book could have been written entirely as a hagiography of Saint Urs, Keeper of the Blessed Code.”
The second is Jeff Dean. Edwards writes that “Jeff pumped out elegant code like a champagne fountain at a wedding.”
“It seemed to pour from him effortlessly in endless streams that flowed together to form sparkling programs that did remarkable things. He once wrote a two-hundred-thousand-line application to help the Centers for Disease Control manage specialized statistics for epidemiologists. It’s still in use and garners more peer citations than any of the dozens of patented programs he has produced in a decade at Google. He wrote it as a summer intern in high school.”
via Larry Page, Sergy Brin Are Lousy Coders – Business Insider.

The unbearable B-ness of software | Michael O. Church

I’m not Jack Welch’s biggest fan. For one thing, he invented the “rank-and-yank” HR policies that literally decimate companies. I don’t disagree with the idea that companies would improve their health by letting go 5-10 percent of their people per year, but I think the discovery process involved is impossible and often politically toxic. There is, however, one thing he’s said that I think has a lot of value: “A players hire A players; B players hire C players“. His point is that if you have mediocre management, you’ll actually end up with terrible employees. I would say it’s not limited to hiring only. A players make more A players. They teach each other how to be better. Not only that, but they raise the potential for what an A player can do. B players don’t have the foresight or “ownership” mentality to mentor others, and produce non-productive C players.
via The unbearable B-ness of software | Michael O. Church.

Types of Programmers

The Ninja is your team’s MVP, and no one knows it. Like the legendary assassins, you do not know that The Ninja is even in the building or working, but you discover the evidence in the morning. You fire up the source control system and see that at 4 AM, The Ninja checked in code that addresses the problem you planned to spend all week working on, and you did not even know that The Ninja was aware of the project! See, while you were in Yet Another Meeting, The Ninja was working.
Ninjas are so stealthy, you might not even know their name, but you know that every project they’re on seems to go much more smoothly. Tread carefully, though. The Ninja is a lone warrior; don’t try to force him or her to work with rank and file.
via Types of Programmers.

What’s a mid-career software engineer actually worth? Try $779,000 per year as a lower bound. | Michael O. Church

I would argue, even, that programmer salaries are low when taking a historical perspective. The trend is flat, adjusting for inflation, but the jobs are worse. Thirty years ago, programming was an R&D job. Programmers had a lot of autonomy: the kind of autonomy that it takes if one is going to invent C or Unix or the Internet or a new neural network architecture. Programmers controlled how they worked and what they worked on, and either answered to other programmers or to well-read scientists, rather than anti-intellectual businessmen who regard them as cost centers. Historically, companies sincerely committed to their employees’ careers and training. You didn’t have to change jobs every 2 years just to keep getting good projects and stay employable. The nature of the programming job, over the past couple decades, has become more stressful (open-plan offices) and careers have become shorter (ageism). Job volatility (unexpected layoffs and, even, phony “performance-based” firings in lieu of proper layoffs, in order to skimp on severance because that’s “the startup way”) has increased. With all the negatives associated with a programming job in 2014, that just didn’t exist in the 1970s to ’80s, flat performance on the salary curve is disappointing. Finally, salaries in the Bay Area and New York have kept abreast of general inflation, but the costs of living have skyrocketed in those “star cities”, while the economies of the still-affordable second-tier cities have declined. In the 1980s and ’90s, there were more locations in which a person could have a proper career, and that kept housing prices down. In 2014, that $142,000 doesn’t even enable one to buy a house in a place where there are jobs.
via What’s a mid-career software engineer actually worth? Try $779,000 per year as a lower bound. | Michael O. Church.

The trajectory of a software engineer… and where it all goes wrong. | Michael O. Church

The scale I’m about to define comes from one insight about human organizations. Teams, in general, have four categories into which a person’s contribution can fall: dividers, subtracters, adders, and multipliers. Dividers are the cancerous people who have a broad-based negative effect on productivity. This usually results from problems with a person’s attitude or ethics– “benign incompetence” (except in managers, whose job descriptions allow them only to be multipliers or dividers) is rarely enough to have a “divider” effect. This is an “HR issue” (dividers must improve or be fired) but not the scope of this professional-development scale, which assumes good-faith and a wish for progress. Subtracters are people who produce less than they cost, including the time of others who must coach and supervise them. As a temporary state, there’s nothing wrong with being a subtracter– almost every software engineer starts out his career as one, and it’s common to be a subtracter in the first weeks of a new job. Adders are the workhorses: competent individual contributors who deliver most of the actual work. Finally, multipliers are those who, often in tandem with “adder” contributions, make other people more productive. In many industries, being a multiplier is thought to be the province of management alone, but in technology that couldn’t be farther from the truth, because architectural and infrastructural contributions (such as reusable code libraries) have a broad-based impact on the effectiveness of the entire company.
via The trajectory of a software engineer… and where it all goes wrong. | Michael O. Church.

Geek Stuff: ajaxSend ajaxComplete ajaxStart ajaxStop

People who know me professionally that I have a natural aversion to the UI. I used to think that it was a natural aversion to javascript but later on I zeroed in to javascript UI stuff. This is me saying that whenever I can program the backend stuff and have other people do the frontend stuff I usually pull rank and have the junior devs do it.
 
Unfortunately or maybe fortunately sometimes they have trouble with research and have to man up and do some UI trouble shooting.
The main problem is that because the UI stuff are done by the junior devs the quality of code has a large variability in quality, meaning some code are crap.
I had to find a way to reliably determine if ajax request are done and prevent user action whenever it is still loading.
After a bit of reading through the jquery documentation I found these 4 functions, 2 pairs actually that can do the job if all are the requests are done through I believe the jQuery.
ajaxSend ajaxComplete ajaxStart ajaxStop
 
http://api.jquery.com/ajaxStart/
http://api.jquery.com/ajaxStop/
http://api.jquery.com/ajaxSend/
http://api.jquery.com/ajaxComplete/