Abobe officially release the Source Code Pro font for coders

Adobe have officially released their new, free, font for coders – Source Code Pro – just a few days after it  debuted in the Brackets code editor. Unlike the version included with Brackets, SCP is now a complete family with Regular, Bold, Light, Extra Light and Black variants. If you already have the regular version shipped with Brackets installed you won’t notice any difference but, if your editor supports them, the new weights may make the update worthwhile.

 

More:

 

Previously:

Smarterer drops public profile pages

As of 20th September, it seems as if Smarterer has dropped public profiles and badges. A blog post on that date states

 

In support of this shift from external recognition to private validation, we’ve also replaced public profiles with a personal dashboard to house these new learning tools.

 

As a long time Smarterer user, I welcome the change in focus that this post announces but I think that dropping the ability to (optionally) have a public page showing your results is a mistake. The removal of public profile pages also seems to have resulted in the removal of public badges. There is a dashboard section which allows you to share your test scores but this is limited to Facebook, Twitter and LinkedIn, none of which are an adequate substitute for embedding badges on your own site or resume. The ephemeral nature of Facebook posts and Twitter tweets make those options particularly useless.

Hopefully, Smarterer will restore public profiles and badges in the near future but, for now, I have removed the sidebar links to their site.

 

More:

Test run: Adobe’s new font for coders – Source Code Pro

 
UPDATE 25th SEPTEMBER: Adobe have now posted the full Source Code Pro font set (including bold, light and semi-bold faces) to SourceForge so there is no longer any need to extract it from the Brackets source, It can be downloaded from http://sourceforge.net/projects/sourcecodepro.adobe


When building the ideal coding environment there are changes you can make that will radically improve your productivity – a new editor, a good snippet manager, a validator, version control. Once these basics are in place the return from future changes will, almost certainly, decrease but that doesn’t mean that there are no further gains to be made – sometimes in unexpected places. One of these unexpected places is the font you use within your code editor. If you work in your editor 8+ hours a day then your choice of font could be crucial in reducing eye strain and increasing concentration.

At the start of August 2012 Adobe released their first open source type family, Source Sans Pro (SSP), primarily intended for use in their application user interfaces. Attractive those this font is (you can see it in use at brackets.io) it’s lack of monospacing makes it unsuitable for use within an editor. Luckily, at the time of it’s release, Adobe confirmed that they were working on a version of SSP more suited to code editing. This hasn’t yet been officially released but, with the Sprint 14 Build of the open-source code editor Brackets we have access to an early release version of this font, now known as Source Code Pro.

Source Code Pro sample characters

 

I’ve been using the font for the last few days and, so far, have found it more than capable. It’s not a radical change from my previous preferred font – MonteCarlo Fixed – but it’s an enough of an improvement to make me want to stick with it. For me, the ideal coding font should be monospaced, sans serif, loosely kerned, light and airy. In addition, each character must be distinct enough to avoid confusion, for example between 1 and l0 and oSource Code Pro easily meets all of these requirements. With the addition of some extra line padding top and bottom in Sublime Text 2, code becomes very readable and easy on the eye even over long periods of concentration.

Until Adobe officially release Source Code Pro (which they have said will be “soon”) the easiest way to try it out is by downloading the Brackets editor. SCP is used by default in this editor and can be extracted from the source for use within your own editor of choice. Brackets is hosted on GitHub so you can use your favourite Git client to pull the source or, if you don’t use Git, you can download and extract a zip of the source.

Downloading the Brackets source code as a zip file from GitHub

 

Once the source is downloaded (or downloaded and extracted) the True Type formatted font will be found at

    src/styles/fonts/SourceCodePro/SourceCodePro-Regular.ttf

Double-clicking on this font in Windows or OSX will install it, making it available in your editor.

If Source Code Pro doesn’t meet your needs but you think you’d benefit from a change of font, you may like to give Mensch or Inconsolata a try – both are very popular with developers.


More:

3 useful Oracle queries

Yesterday I posted 3 useful MySQL queries that I use almost every day. As I also work with Oracle I have to use the equivalents for that database i.e. I regularly have to create database update scripts – scripts that create tables or add new columns to existing tables or populate new tables with base data. One requirement is that these scripts be re-runnable. For example, if a new table doesn’t exist it should be created, if it does exist then the update script should continue without throwing an error. For these situations I find the following simple queries very useful. Wrap them in functions written in your language of choice and you have an easy way to check the current status of your Oracle database before taking action.

1. Check if a table exists in the current database schema

select table_name
from user_tables
where table_name = '__TABLE_NAME__'
2. Check if a column exists in a table
select column_name as found
from user_tab_cols
where table_name = '__TABLE_NAME__'
and column_name = '__COLUMN_NAME__'
3. Check if a table contains any data
select 1
from __TABLE_NAME__
where rownum = 1
After running each of these queries, simply check if any rows were returned. A non-zero row count indicates the existence of the table, the column or the data as appropriate. These three queries, and a couple of variations on them, can also be found on my Gist page.
An alternative method for checking if a table or column exists before creating it is to just go ahead with your create / alter table and catch any error that comes along. This is not a sensible or correct approach in most situations. The existence of a table or column is a knowable property that is easily checked – throwing an error then scrambling around to determine what caused it by comparing error codes is crude, avoidable and not at all what exception handling is intended for.

 

Previously:

 

3 useful MySQL queries

I regularly have to create database update scripts i.e. scripts that create tables or add new columns to existing tables or populate new tables with base data. One requirement is that these scripts be re-runnable. For example, if a new table doesn’t exist it should be created, if it does exist then the update script should continue without throwing an error. For these situations I find the following simple queries very useful.

Wrap them in functions written in your language of choice and you have an easy way to check the current status of your MySQL database before taking action.

1. Check if a table exists in the current database schema

select table_name as found
from information_schema.tables
where table_schema = SCHEMA()
and table_name = '__table_name__'

2. Check if a column exists in a table

select column_name as found
from information_schema.columns
where table_schema = SCHEMA()
and table_name = '__table_name__'
and column_name = '__column_name__'

3. Check if a table contains any data

select 1
from __table_name__
limit 1

After running each of these queries, simply check if any rows were returned. A non-zero row count indicates the existence of the table, the column or the data as appropriate.

These three queries, and a couple of variations on them, can also be found on my Gist page.

 

jList 1.5.0: Two new functions added

Even though I wrote the original, rather messy, version of jList over five years ago I’ve never had the need for a listContains function i.e. one that searches a list looking for an item which at least partially matches a string. Until now, that is.

Yesterday I pushed jList 1.5.0 to GitHub. This version of the library, which brings ColdFusion-style list handling to Javascript, adds two new functions, bringing the total to twenty-two:

  • listContains
    Determines the index of the first list element that contains a specified substring.. The search is case-sensitive.
  • listContainsNoCase
    Determines the index of the first list element that contains a specified substring. The search is not case-sensitive.

These functions look at each individual element of a list for a specific value.  Where the value being searched for is wholly or partially contained within an element  then the position of that element in the list is returned. Where no match is found, zero is returned.

For example:


jList.listContains("cat,dog,mouse,rabbit,lion", "bit")

would return 4 even though the value itself is not in the list.

All documentation is updated so full details of the new functionality is on the jList GitHub page.

The two new functions have also been added to jsFiddle should you wish to try them out first – listContainslistContainsNoCase.

jList 1.5.o can be downloaded for free from GitHub.

More:

Previously: