$parse

What the jebus is this:

$parse(states[i].data.lorryDriverStatus)(model)

It says,

treat the value of ‘states[i].data.lorryDriverStatus‘ as a function and pass it ‘model‘ as a paramter.

Angular, continually making me believe its a pile of steaming shite.

ipconfig, ping and other command / cmd line commands not working

This video helpfully explained that if the command window was opened as an administrator, the commands would work. The fix was to add a ‘Path’ environment variable with the following value: ‘C:\Windows\System32′

Section of Google Map not loading

Symptom: The page I was building had a google map on it. However, part of the Google Map did not load. (Google Maps Javascript API V3)

partially-loaded-google-map

partially loaded google map caused by initially hidden, but loaded, Google Map

Problem: The Google Map on the page was not shown when the page loaded. When a user selected a radio button, the div containing the Google Map was shown. As stated by Michael Geary on Stack Overflow “The Google Map container is hidden or has zero dimensions at the time you create the map”

Solution: 

  • Defer creating the map until the container element is visible and sized properly, or
  • Call google.maps.event.trigger( map, ‘resize’ ) after the map becomes visible or is resized. This event tells the Maps API to readjust its calculations of what’s visible in the map.

My Solution: As I was using angular and bootstrap, I added the ng-if attribute to accompany the ng-show attribute:

<div ng-if=”mypage.whatuserwantstosee == ‘map'” ng-show=”mypage.whatuserwantstosee == ‘map'”>
             <div class=”padded”>
                         <div google-map center=”mypage.center” zoom=”mypage.zoom”
                         markers=”mypage.markers” latitude=”mypage.latitude”
                         longitude=”mypage.longitude”>
                       </div>
             </div>
</div>

Bean Validation Made Simple With JSR 303

http://java.dzone.com/articles/bean-validation-made-simple

 

The URL above explains clearly and concisely how to avoid checking that a value meets a constraint without the need for an if(isStringValueNull?) code block.

Technical Books Which I Have Read and Reccommend

Obviously I have read more than what is listed below. Below are the books I have read and am happy to recommend since this post was published.

  • 97 Things Every Programmer Should Know: Collective Wisdom from the Experts

  • 97 Things Every Software Architect Should Know

  • 24 Deadly Sins of Software Security: Programming Flaws and How to Fix Them

Advice on Technical Hiring from the Employers Perspective

The below is an extract from a chapter from the O’Reilly published 97 Tthings Every Software Architect Should Know:

 

Most people probably agree that finding top-notch developers requires thorough technical interviewing.  But what does thorough mean exactly?  It doesn’t mean requiring candidates to answer difficult questions about obscure technical details.  Screening for specific technical knowledge is definitely part of the process but turning an interview into a certification test will not guarantee success.  You are searching for developers with problem solving skills and passion.  The tools you use are sure to change; you need people who are good at attacking problems regardless of the technologies involved.  Proving someone has the ability to recite every method in an API tells you very little about their aptitude or passion for solving problems.

However, asking someone to explain their approach to diagnosing a performance problem gives you great insight into their methods for problem solving.  If you want to learn about developer’s ability to apply lessons learned, ask what they would change given the chance to start their most recent project anew. Good developers are passionate about their work.  Asking them about past experience will bring out that passion and tell you what correct answers to technical trivia questions cannot….

by Chad LaVigne
This work is licensed under a Creative Commons Attribution 3″

Security Issue for Java and MySQL or SQL

The most basic vulnerability is to leave the database operating on the default port of 3306 with the default user name and password. Ensure that this port is not open to the web.

SQL Injection Vulnerability

To protect against SQL Injection, it is necessary to avoid methods which take an argumenrt which is directly used in an SQL query.

The solution is a two setp process.

  1. First, validate the input argument against a regex or caught parse exception. Therefore you will know, if the method is supposed to accept a String containing a int, or an entire set of digits, you can be sure that this is the case. This ensures you are not using user input to directly query the database without validating it first.
  2. The second prevention step is not to use a direct SQL query. Instead use a prepared statement. This means that you are not using string concatenation or string replacement to query the database. If this were the case, an attacker can pass your method an SQL statement which will then be run against your database.
Follow

Get every new post delivered to your Inbox.