RSS Feed Subscribe to RSS Feed

 

Testing private methods in .Net

Feeling the need to test private methods is usually a sign that your code needs refactoring. The recommended approach is that you test your code via it’s public interface. Since your private methods are only accessible via those public methods, it goes that if you have thoroughly testing via the public interface, your private methods will have been tested too.

Still, there can be times testing private methods can be useful. For example, while dealing with either legacy code or when using it as a temporary step while refactoring.

How do you do this in .Net?

(more…)

Tags: ,

Docker talk at SVCC’15

Some short notes from a talk from Ted Young on the Docker ecosystem. Slides available here.

BusyBox – a number of use linux tools packaged up in to a single file. “The Swiss Army knife of Embedded Linux”

CoreOS and Red Hat’s Atomic are particularly suited for running containers, work well with (and I think even come preinstalled with) Docker.

VM vs Container. VMs ofter have multiple apps running in them (e.g. a tomcat with multiple apps running it int). With containers it is typically 1 app per container. Containers typically run within a VM (although can run on “raw metal” too). Multiple containers per VM? – I’m not so clear on!

Cgroups may be used to limit and control resource usage.

12 Factor apps – Good practices for building “cloud native” or software-as-a-service apps.

 

Tags: , , , ,

Git talk at SVCC’15

Some short notes from a talk on “Everything you wanted to know about Git…” by Lenny Markus. Slides available here.

Tips:

Use autocomplete

Use the latest git tool, not the apple default

As part of the demo, he used watch to monitor a directory by running a command every few secs.

Covered git init, staging, reset and rebasing.

 

 

 

Tags: , ,

RESTful Microservices at Silicon Valley Code Camp ’15

Thanks to everyone who came to my RESTful Microservices talk at Silicon Valley Code Camp today. Great turnout and lots of good follow up questions.

You can find the complete slides on slideshare.

Tags: , , , , , , , , ,

Java vs .Net Accessor Modifiers

I’ve been looking at some .Net code recently, and I wanted to do some comparisons on Java access modifiers vs .Net to help me better understand the code.

(more…)

Tags: , , ,

Versioning APIs

I have blogged in the past about microservices, and the advantages that architectural style can bring. These small, focussed and, most importantly, autonomous services commonly expose their functionality via a REST interface.

Inevitably there will come a time when you need to change that interface. Yes, in an ideal world, you will come up with a perfect API first time round and it will never need to change, but requirements change or new users come on board, and we must adapt. Read on to find some approaches to dealing with changing interfaces without breaking clients.

(more…)

Tags: , , , , , , , , ,

Using Butler shortcuts to enter commonly used text

Is there a piece of text that you find yourself typing again and again? Want a keyboard shortcut to enter it? For example, pressing Alt-E to enter your email address anywhere.

The solution I use is Butler. It is an extremely versatile tool.

  • With Butler running, go to Configuration
  • Right click on Hidden Items
  • Smart Item -> Text
  • Under Triggers, specify your ‘Hot Key’ keyboard shortcut
  • Under Text, specify your frequently entered text e.g. email address

Done! The next time you press Alt-E anywhere, your email address will show up.

Notes:

  • You are probably wise to choose a more obscure shortcut the Alt-E to avoid clashes with other apps, but the principle remains.
  • I use LastPass to automate filling in entire forms (name, address, email), but the approach I describe here can be used anywhere (in a document, IM window, whatever).

 

Tags: , , ,

alternative to tail -f that allows scrolling: less +F

You can use less +F to start less in its “forward forever” mode. In this mode, less will behave like tail -f, ignoring the ends of files and providing a steady stream of text.

When you want to scroll, press Ctrl-c. To re-enter forward forever mode, press F.

From http://unix.stackexchange.com/questions/81628/is-there-an-alternative-to-tail-f-that-has-convenient-scrolling

Tags: , , ,

Rest and Microservices talk at the Las Vegas .Net Group

Thanks to Richard Rosenheim for inviting me to talk on REST and Microservice at the Las Vegas .Net Group today.

If you came along, thanks for attending!

You can find my slides here.

You can also check out my blog posts that the talk is based on:

Tags: , , , , , , , ,

sed

sed (stream editor) is an simple but incredibly versatile command line tool that parses and transforms text. It is line-oriented in that it reads the text line by line, transforms it, and outputs the result.

For example, this sed command would replace all occurrences of the text “white” with “black”:

sed s/white/black/g

sed reads text on a line by line basis and performs an operation on it, usually extracting or replacing text snippets. In this case, the s prefix means substitute, and the g suffix means global. Other example usages include:

(more…)

Tags: , , ,