Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!
Software Development Blogs: Programming, Software Testing, Agile Project Management
Subscribe to Methods & Tools
if you are not afraid to read more than one page to be a smarter software developer, software tester or project manager!
Scanning over Alvin Ashcraft’s excellent Morning Dew (a must read for .Net devs as is Chris Alcock’s Morning Brew), I came across a short article from Richard Carr on writing Fixed Width Data Files using C#.
Richard creates a class that inherits from StreamWriter, and all-in it’s just over 50 lines of idiomatic C# code:
using System;
using System.IO;
using System.Text;
public class FixedWidthWriter : StreamWriter
{
public int[] Widths { get; set; }
public char NonDataCharacter { get; set; }
public FixedWidthWriter(
int[] widths, string path, bool append, Encoding encoding)
: base(path, append, encoding)
{
NonDataCharacter = ' ';
Widths = widths;
}
public FixedWidthWriter(int[] widths, string file)
: this(widths, file, false, Encoding.UTF8) { }
public FixedWidthWriter(int[] widths, string file, bool append)
: this(widths, file, append, Encoding.UTF8) { }
public void WriteLine(string[] data)
{
if (data.Length > Widths.Length)
throw new
InvalidOperationException("The data has too many elements.");
for (int i = 0; i < data.Length; i++)
{
WriteField(data[i], Widths[i]);
}
WriteLine();
}
private void WriteField(string datum, int width)
{
char[] characters = datum.ToCharArray();
if (characters.Length > width)
{
Write(characters, 0, width);
}
else
{
Write(characters);
Write(new string(NonDataCharacter, width - characters.Length));
}
}
}
As you’d probably guess the same functionality takes half the lines to express in F#:
open System
open System.IO
open System.Text
type FixedWidthWriter(widths:int[], path:string, append, encoding) =
inherit StreamWriter(path, append, encoding)
member val Widths = widths with get, set
member val NonDataCharacter = ' ' with get, set
new(widths, file) =
new FixedWidthWriter(widths, file, false, Encoding.UTF8)
new(widths, file, append) =
new FixedWidthWriter(widths, file, append, Encoding.UTF8)
member this.WriteLine(data:string[]) =
if data.Length > this.Widths.Length
then invalidOp "The data has too many elements."
for i = 0 to data.Length-1 do
this.WriteField(data.[i], this.Widths.[i])
base.WriteLine()
member private this.WriteField(datum:string, width) =
let xs = datum.ToCharArray()
if xs.Length > width
then base.Write(xs, 0, width)
else
base.Write(xs)
base.Write(String(this.NonDataCharacter, width - xs.Length))
The C# implementation uses classes and inheritance. In F# we’d typically favour composition over inheritance and start with the simplest possible thing that works, which in this case is a function that takes a file path, widths and the lines to write:
let WriteFixedWidth (path:string) (widths:int[]) (lines:string[] seq) =
let pad = ' '
use stream = new StreamWriter(path)
let WriteField (datum:string) width =
let xs = datum.ToCharArray()
if xs.Length > width
then stream.Write(xs, 0, width)
else
stream.Write(xs)
stream.Write(String(pad, width - xs.Length))
for line in lines do
for i = 0 to widths.Length-1 do
WriteField line.[i] widths.[i]
stream.WriteLine()
The function is about half the size again and more closely follows YAGNI. To test it we can simply write:
let widths = [|20; 7; 6|] [ [|"Company"; "Spend"; "Rating"|] [|"Quality Foods Limited"; "1000000"; "Gold"|] [|"The Pieman"; "50000"; "Silver"|] [|"Bill's Fruit and Veg"; "10000"; "Bronze"|] ] |> WriteFixedWidth "c:\\test.txt" widthsDoes the language you chose make a difference?
When writing software we’re working at two levels:
The first part is the easy part, the second part takes a lifetime to master. I read a really great post today pointing out signs that you’re a bad programmer. Whether you’re a bad programmer or just inexperienced, I think the biggest barrier is being able to quickly and accurately visualize code. You need to visualize what the application actually does, what happens at runtime; but all your IDE shows you is the raw, static, source code. From this static view of the world you have to infer the runtime behaviour, you have to infer the actual shape of the application and the patterns of interaction; while closely related, the two are separate. Given just source code, you need to be able to visualize what code does.
What does it mean to visualize code? At the simplest level, it’s understanding what individual statements do.
string a = "Hello": string b = "world"; a = b;
It might sound trivial, but the first necessary step is being able to quickly parse code and mentally step through what will happen. First for basic statements, then for code that iterates:
while (stack.Count() > 1)
{
var operation = stack.Pop() as IOperation;
var result = operation.Execute(stack.Pop(), stack.Pop());
stack.Push(result);
}
Where you need to understand looping mechanics and mentally model what happens overall not just each iteration. Then you need to be able to parse recursive code:
int Depth(ITreeNode node)
{
if (node == null)
return 0;
return 1 + Math.Max(Depth(node.Left), Depth(node.Right));
}
Which is generally harder for inexperienced programmers to understand and reason about; even though once you’ve learned the pattern it can be clearer and more concise.
Once you’ve mastered how to understand what a single method does, you have to understand how methods become composed together. In the OO world, this means understanding classes and interfaces; it means understanding design patterns; you need to understand how code is grouped together into cohesive, loosely coupled units with clear responsibilities.
For example, the visitor pattern has a certain mental structure – it’s about implementing something akin to a virtual method outside of the class hierarchy; in my mind it factors a set of classes into a set of methods.
public interface IAnimal
{
void Accept(IAnimalVisitor visitor);
}
public class Dog : IAnimal { ... }
public class Cat : IAnimal { ... }
public class Fox : IAnimal { ... }
public interface IAnimalVisitor
{
void VisitDog(Dog dog);
void VisitCat(Cat cat);
void VisitFox(Fox fox);
}
The first step in reading code is being able to read something like a visitor pattern (assuming you’d never heard of it before) and understand what it does and develop a mental model of what that shape looks like. Then, you can use the term “visitor” in your code and in discussions with colleagues. This shared language is critical when talking about code: it’s not practical to design a system by looking at individual lines of code, we need to be able to draw boxes on a whiteboard and discuss shapes and patterns. This shared mental model is a key part of team design work; we need a shared language that maps to a shared mental model, both of the existing system and of changes we’d like to make.
In large systems this is where a common language is important: if the implementation uses the same terms the domain uses, it becomes simpler to understand how the parts of the system interact. By giving things proper names, the interactions between classes become logical analogues of real-world things – we don’t need to use technical words or made up words that subsequent readers will need to work to understand or learn, someone familiar with the domain will know what the expected interactions are. This makes it easier to build a mental model of the system.
For example, in an online book store, I might have concepts (classes) such as book, customer, shopping basket, postal address. These are all logical real world things with obvious interactions. If I instead named them PurchasableItem, RegisteredUser, OrderItemList and DeliveryIndicationStringList you’d probably struggle to understand how one related to the other. Naming things is hard, but incredibly important – poor naming will make it that much harder to develop a good mental model of how your system works.
Reading code, the necessary precursor to writing code, is all about building a mental model. We’re trying to visualize something that doesn’t exist, by reading lines of text.
JavaScript is a bubble.
Just like the housing bubble.
Just like the .COM bubble.
And just like any bubble, the JavaScript bubble is bound to pop.
Sure, JavaScript is everywhere. It appears to be growing at a rapid pace. But I’m willing to bet that we are getting close to a complete reversal that will throw JavaScript down from its throne, shattering its JQuery scepter with it.
JavaScript never really made a comebackPart of the problem with JavaScript is that it’s propped up on the back of another technology. See, JavaScript itself was rejected long ago. If JavaScript was a wonderful language to develop in, its wonders would have been praised years ago when it was first introduced. But I remember cursing JavaScript 15 years or so ago. And I wasn’t alone.
Yes, I know it was a dark time, but recall, if you will, your pure hatred for JavaScript. You know, before it was so cool.
Then how did this ugly wart of a language become so popular?
Well, you see, it was this little library called JQuery. JQuery solved a very real and annoying set of problems that wasn’t around when JavaScript was first invented: manipulating the DOM and making Ajax calls.
JQuery was basically designed to make JavaScript possible to work with. Before JQuery, DOM manipulation and Ajax calls were difficult. After JQuery, they were easy.![]()
So JQuery ended up being this big band-aid that covered up all the ugly JavaScript code you didn’t want to write and made doing what you wanted to do much easier.
You may disagree with me on this point, and you are welcome to do so, but even if JQuery isn’t the reason JavaScript is so hot right now, do you honestly think JavaScript would have become so popular if JQuery never existed?
The problem with JavaScriptI want to love JavaScript. I really do.
I know it doesn’t sound like I do, but just like I can’t make myself like sweet potatoes—even though I know how good they are for me—I can’t like JavaScript.![]()
I’ve tried many things. I’ve put some butter and brown sugar on a freshly baked sweet potato. I’ve doused it with hot sauce. I’ve even pretended it was a regular potato and dressed it up like one. But, the fact remains, I just don’t like sweet potatoes. It’s something in their very nature that I despise.
I’ve tried the same thing with JavaScript. I’ve added libraries that make it much sweeter, like JQuery and Backbone.js. I’ve used tools like CoffeeScript and TypeScript to try and pretend it was a more palatable language. But the fact remains, JavaScript has some things that are fundamentally wrong with it that no amount of covering up or pretending will fix.
If JavaScript wasn’t so ugly at heart, then a book called “JavaScript, The Good Parts,” probably wouldn’t be the #1 best-selling book on Amazon for JavaScript, the #3 best-selling book on web development, and the #4 best-selling book on software development, would it? (Go ahead and check it out for yourself if you don’t believe me.)
I don’t really need to tell you again what is wrong with JavaScript. If you use JavaScript, you know. If you don’t use JavaScript, just search for “why JavaScript sucks” on Google and you’ll get plenty of answers.
The point is, unless we are going to be completely disillusioned about it, we can probably all agree that JavaScript is not the greatest programming language that was ever created, and that it has some glaring weaknesses.
My point is not to bash JavaScriptBefore you pitchfork me, I want to clear a few things up.
I don’t hate JavaScript.
I don’t suggest you shun JavaScript and go off with me to a floating island in international waters where we will build a new internet, one that isn’t infected by JavaScript.
I actually use JavaScript.
Not only do I use JavaScript, but I have to use JavaScript and so do you.
And if you are smart and want to have a good career in software development, you’ll take everything I am saying with a grain of salt, knowing that I could be completely wrong.
If you are smart, you won’t just dump JavaScript out the window, betting that it will fail, because it might not. It might grow to become the one universal language that replaces all other programming languages. JSON sempiternus!
But, on the other hand, if you are smart, you won’t put all your eggs in the JavaScript basket either. Even though the world seems bright and cheery for JavaScript developers today, it also seemed equally bright and cheery for Blackberry devs not too long ago. And look how that turned out.
And if you are solely a JavaScript developer or you really like JavaScript, I sincerely don’t mean to offend you, but I offer this piece of advice: You are not the technology you happen to be using.
Trust me, if you’re a good developer, you’ll still be a good developer even if JavaScript goes away.
What is actually awesome about JavaScript has nothing to do with JavaScriptNo one gets up in the morning and says, I want to have bamboo shoots shoved under my fingernails. (Ok, well maybe some people do, but those guys are still writing object-oriented Perl.)
Yet, at the same time so many developers get up in the morning, fire up their IDE—or excuse me, lightweight text editor which has 50 plugins installed to give the capabilities of an IDE, but is not an IDE—and write JavaScript code. Why do they do it, unless they think JavaScript really is awesome?
It’s because all the stuff around JavaScript and built with JavaScript and on top of JavaScript is actually pretty awesome.
As much as I loathe JavaScript itself, frameworks like JQuery, Durandel, Backbone, Angular, Knockout and more are pretty darn cool.
Not only that, but JavaScript is everywhere!
Every browser is a JavaScript interpreter. Every notebook, PC, tablet, and smartphone can run JavaScript.
There are even cool server technologies, like Node.js that are built with JavaScript.
JavaScript runs in the browser, it has plenty of hooks in it for manipulating the DOM, and it has tons of cool libraries that give you the power to do awesome things, what’s not to love?
This is the part where I tell you what is not to loveWhat’s not to love, is that all of that stuff has nothing to do with JavaScript itself.
Take JavaScript away and replace it with another programming language and you don’t really miss anything.
Ever seen a movie star without her makeup? Makes you realize that any halfway decent looking woman could be a movie star, with the proper styling.
The same goes for JavaScript. It is a language that has been dressed up to look like something it is not. What we all love about JavaScript is not the language itself, but all that makeup that has been caked on, a little bit of mysterious seduction it infers, and the stylish clothes it wears.
But, what is starting to happen already, and what I believe will continue to happen, is that people will start to get sick of that caked-on makeup look and high maintenance personality of JavaScript.
All those frameworks were really useful at first, but they are becoming such a huge mental burden. Are you worried about what JavaScript framework you need to master and keeping up with what is the hot one to use on any given day? I am.
You can only build so much on top of something else, before you have to wipe the slate clean and start over.
I don’t know when this will happen with JavaScript, but I am pretty sure it will happen.
It is very likely that a language like Dart, that can do everything JavaScript can do and more, will likely someday dethrone our web development king.
JSON sempiternus!
By the way, check out my new experiment on YouTube, going to release a short video each week. Let me know what you think.
Getting Started With a Programming ProjectFollow @jsonmez
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');![]()
The post Why JavaScript Is Doomed appeared first on Making the Complex Simple.
The key shift with Agile Design is to deliver quickly while handling changes smoothly. Instead of doing long requirements phases, and heavy documentation up front, with Agile Design you focus on incremental and iterative delivery, going from low-fidelity to high-fidelity, while getting feedback and improving your design.
Here are 10 ways to make Agile Design more effective:
The last thing you want to do is throw a solution over the wall, and nobody wants it, or you missed the basic scenarios. That’s why delivering early helps get the risk out, and helps validate your path.
If you’ve ever watched people argue over how they “satisfied the requirements”, but nobody wants to use it, you know exactly what I mean. People don’t always know exactly what they want, or, even if they do, it’s hard to articulate in a way, that everybody gets it. But people are way better at recognizing what they like, and knowing whether or not they like something when they actually use it.
Embrace it.
That’s what Agile Design does – it embraces the reality that people get more clarity over time of what good really looks like.
Creating an early feedback loop also forces you to keep your solution easy to maintain and easy to evolve. Otherwise, it’s very easy to cement your design, and no longer respond to emerging needs. The key to lasting solutions is they are built to change.
It’s a process of continuous learning and continuous delivery.

I have been working on a new version of the Management 3.0 license agreement, with input from the current facilitators and the friends of Happy Melly.
I needed a new agreement because: A) I want to allow other people to create Management 3.0 courseware modules; B) I needed a new pricing model that is more fair; and C) The licensing is taken over by the Happy Melly business network.
Here are 12 reasons why it’s a contract I’m proud of.
If you’re interested in creating content for Management 3.0 or facilitating Management 3.0 workshops or courses, go to the Management 3.0 website and fill out the form.
If you have your own brand and content and you’re looking for a way to adopt a similar licensing approach that is fair, simple, transparent, and scalable, contact me or the Happy Melly team.
Stand up meetings are the easiest Agile practice to adopt and the easiest to get wrong. Stand up meeting are teams gatherings held every day to sync the team, to make plans for the day and get roadblocks on the table. The meeting is designed to be short (15 minutes or less) and participation is limited to the team members only. The discussion among the team members is specifically about issues affecting their work not about collecting status information for outside consumption. The stand up loses effectiveness when it stops being the team’s meeting and becomes the scrum masters meeting.
When the stand-up becomes the scrum master’s meeting to gather status and guide the work we have moved away from self-organization and muddied the lines of communication. When team members begin talking to the scrum masters instead of each other, everyone who is not part of the immediate conversation becomes audience members. An audience will hang in rapt attention, if the dialog they are listening relates to their needs. However, they will check out when the conversation does not apply to them. I use the number of phones that suddenly appear (to do email) as a measure of conversational relevance. A good scrum master will ensure that the stand up meeting conversation is between the members rather making the stand up about herself.
More discussion on LinkedIn about risk, risk management, types of risk, and definitions of risk and opportunity. The "risk management" community in the domains I work is based on Department of Defense, Department of Energy, Department of Homeland Security, NASA, ITIL, AACEI (Association for the Advancement of Cost Engineering International), Nuclear Regulatory Commission, INCOSE (International Council of Systems Engineering), OGC Management of Risk, GAO, and Deloitte's Risk Management Framework.
Several core concepts get confused. So before taking any deep dive into "managing risk," these need to be established.
What is Risk
There are many definitions of risk from a variety of sources. In the end these definitions are all pretty much the same.Â
Here's a good definition that can be used in probably any domain.
Risk refers to the uncertainty that surrounds future events and outcomes. It is the expression of the likelihood (probability of occurrence) and (probability of) impact of an event with the potential to influence the achievement of an organization’s objectives. - Managing Risk in Government: An Introduction to Enterprise Risk Management, IBM Center for The Business of Government.
I've edited this a bit to remove the likelihood measure and replace it with the probability just to keep the math straight. You'll see why below when it comes to ordinal values in the risk matrix - a bad idea.
There is a time honored approach to ranking a risk, by calculating some number. This number is meanigless of course, because it has no scale, it is just a ordinal number. We need cardinal numbers for actual risk management.
Risk = Probability of Occurrence x Impact Â
This is a trick question. The risk matrix approach that results from this calculation treats these numbers as likelihood not probabilities. But in fact they are probabilities. As well they are Ordinal numbers (1, 2, 3, 4, 5 usually) and as such represents the relative ranking of the likelihood of occurrence, not the actual probability of occurrence.
This approach starts with a major problem - a show stopper problem. The two values on either side of the multiplication sign are probability distributions, not real numbers. There is no MULTIPLY operator between two probability distributions. The is the CONVOLUTION  operator, but that is not likely to be of much value to ordinary project management staff. One starting point for a better understanding of the problems with the risk multiplier and risk matrix approach is the work of Tony Cox. Optimal Design of Qualitative Risk Matrices to Classify Quantitative Risks. Tony's source paper provides the basis for this discussion, "What's Wrong with Risk Matricies."
To put it in blunt terms.
The combination of Ordinal Scales and Risk Matricies are Fatally Flawed
In this link, it is stated again, so I'll restate it here
It is a category mistake to multipy ordinal numbers
By category error it means the objects, the categories, do not have the proper properties to work with the operators. For some more discussion of this topic and a bit of counter discussion, see What's Right with Risk Matricies.
Where does risk come from?
Risk comes from uncertainty. There are two kinds of uncertainty.
The critical point here is the reducibility and the irreducibility of these uncertainties.Â
How is Risk Maanged?
We must start with a risk management process. There are several, but they are essentially the same. Here's my favorite, there are others of course, but this one covers all the steps.
Four components of risk
Both Aleatory and Epistemic Uncertainty Create Risk
Time to Revisit The Risk Discussion
When We Say Risk What Do We Really Mean?
Uncertainty is the Source of Risk
The Barriers to Effective Risk Management
Welcome to the Software Process and Measurement Cast 236!
SPaMCAST 236 feature my interview with Peter Taylor, Ron Rosenhead and Vicki James's we discussed their new book, Strategies for Project Sponsorship. Sponsors are not necessarily born to the role and unless we want to take pot luck we better understand what makes a good sponsor.
Vicki James, PMP, CBAP (Seattle, WA, USA)
http://www.project-pro.us
Vicki is passionate about learning and sharing best practices in project management and business analysis. Certified in both project management (Project Management Professional certification from the Project Management Institute since 2005) and business analysis (Certified Business Analysis Professional from the International Institute of Business Analysis in since 2010) provides a broad view to support project governance and processes. Vicki spent 11-years in the public sector successfully delivering projects to support governmental operations. Today she provides private consulting to government and private industry clients in addition to writing and presenting on all things project. Vicki is a contributor to The Complete Project Manager (2012) by Randall Englund and Alfonso Bucero as well as a popular blogger and Tweeter.
Peter Taylor, PMP (Coventry UK)
http://www.thelazyprojectmanager.com/
Peter is a dynamic and commercially astute professional who has achieved notable success in Project Management. His background is in project management across three major business areas over the last 26 years, MRP/ERP systems with various software houses and culminating in his current role with Infor, Business Intelligence (BI) with Cognos, and product lifecycle management (PLM) with Siemens. He has spent the last 7 years leading PMOs and developing project managers and is now focusing on project based services development with Infor. He is a professional speaker as well as the author of ‘The Lazy Project Manager’ (Infinite Ideas) and ‘Leading Successful PMOs’ (Gower) and ‘The Lazy Winner’ (Infinite Ideas).
Previous Appearances:
Lazy Project Manager - SPaMCAST 158
Project From Hell - SPaMCAST 194
Ron Rosenhead (London, UK)
http://www.ronrosenhead.co.uk/
Ron Rosenhead is known for his highly practical approach to life alongside project management. Over 25 years as a trainer and consultant with the last 17 years specializing in helping organisations to increase the probability of project success. He has personally trained,coached over 10,000 people in the project management world; some project managers, others project sponsors. He has worked across sectors: financial services,public sector, engineering, pharmaceuticals, universities, car retailing, It etc. He is a professional speaker and author of Deliver that Project (an e-book), is a regular blogger and tweeter. Ron regularly writes practical project management training materials which are in use all over the world.
Appreared on SPaMCAST 152 talking about project management
Order the book at http://strategies4sponsors.com/
The Daily Process Thoughts is my project designed to deliver a quick daily idea, thought or simple smile to help you become a better change agent. Each day you will get piece of thought provoking text and a picture or hand drawn chart to illustrate the idea being presented. The goal is to deliver every day; rain or shine, in sickness or in health or for better or worse! Check it out at www.tcagley.wordpress.com.
Shameless Ad for my book!
Mastering Software Project Management: Best Practices, Tools and Techniques co-authored by Murali Chematuri and myself and published by J. Ross Publishing. We have received unsolicited reviews like the following: "This book will prove that software projects should not be a tedious process, neither for you or your team."
NOW AVAILABLE IN CHINESE!
Have you bought your copy?
Contact information for the Software Process and Measurement Cast
Email: spamcastinfo@gmail.com
Voicemail: +1-206-888-6111
Website: www.spamcast.net
Twitter: www.twitter.com/tcagley
Facebook: http://bit.ly/16fBWV
One more thing! Help support the SPaMCAST by reviewing and rating the Software Process and Measurement Cast on ITunes! It helps people find the cast.
THe Software Process and Measurement Cast is a proud member of the Tech Podcast Network. Listen to the SPaMCAST and othe great podcasts, like Day In Tech History a podcast on tech hitory 365 days a year at http://www.techpodcasts.com/
Next:
The next Software Process and Measurement Cast will feature an essay on the role of product owners!
One of my mentees was looking for ways to grow her prowess in “Inspiring a Vision.”
Here are some of the ways I shared with her so far:
The key with vision is, when possible –
And, a powerful tool we use at Microsoft is a Vision / Scope document.
Sometimes the best way to do something well, is to know what to avoid. In Ex-Windows Boss Steve Sinofsky: Here's Why I Use An iPhone, Nicholas Carlson shares some tips from Steve Sinofsky on analyzing the competition:
Sinofsky elaborates, and says to use the product deep, and use it over time. Use the product like it was intended by the designers. Wrap yourself around the culture, constraints, resources, and more of a competitor. And, don't take a static view of the world -- the competitor can always update their product based on feedback, or weaknesses you call out.
Recently my wife and I hiked the Jinshangling portion of the Great Wall of China, which was originally built during early in the Ming Dynasty. It was then later restored into what we now recognize as one of the most iconic portion of the Wall under Ming General Qi Jiquang. While the project to build the great wall was not exactly Agile and probably did not foster participatory management, this section of Wall is said to reflect the vision of Qi Jiquang, its product owner, which was different than other sections of the Great Wall. According to guides in the area, Qi Jiquang was based in the area and used his well-fed troops to build the wall (rather than other forms of staffing/servitude elsewhere). Qi Jiquang lived and interacted with his men on a daily basis in other sections of the Wall absentee product owners prevalent. Absentee product owners can’t provide their vision or motivate the team something that the great general knew.
Looking out at the some of the most iconic views of the Great Wall drives home the point that when IT and business work together to achieve a well-crafted vision, great things can happen.
I’ve been using Sublime a bit recently and one thing I wanted to do was put neo4j cypher queries into files with arbitrary extensions and have them recognised as cypher files every time I open them.
I’m using the cypher Sublime plugin to get the syntax highlighting but since I’ve got my cypher in a .haml file it only remembers that it should have cypher highlighting as long as the file is open.
As soon as I close and then re-open the file it goes back to being highlighted as HAML.
I initially thought that the way around this would be to write a plugin which kept track of files that you’d manually assigned a syntax to but then I came across the ApplySyntax plugin which seems even better.
ApplySyntax allows you to assign syntaxes to files based on regular expression matching on the file name or on the first line of the file.
At the moment, the easiest way to detect that a file is a cypher query is that the first line will begin with ‘START’ so I wrote the following in my user settings file:
~/Library/Application Support/Sublime Text 2/Packages/User/ApplySyntax.sublime-settings
{
"reraise_exceptions": false,
"new_file_syntax": false,
"syntaxes": [
{
"name": "Cypher",
"rules": [
{"first_line": "^START"}
]
}
]
}
ApplySyntax is a pretty neat plugin, worth having a look if you have this problem to solve!
I’m a fan of anticipating the future, and creating the future. Even speculation helps dream up what’s possible, and be ready for anything, when it happens. And if you balance that with key trends, you can really stay on top of things.
After all, what’s The Art of the Long View teach us? While we can’t predict the future, we can better prepare for it by playing out the “what if” scenarios and possibilities.
With that in mind, I did a search on Microsoft secret stuff, and found some interesting things. After all, Microsoft spends more on R&D than Google and Apple combined.
Here are some of the more interesting articles I found:
Here are my key take aways …
Kinect Stuff
Touch and Touch Screens
More …
What neat stuff do you see Microsoft working on?