måndag 28 augusti 2017

How to show nicely formatted source code in your blogger posts

I haven't dug deep into this, but so far the site below has been enough.

http://codeformatter.blogspot.se/

  • Copy and paste the code you want formatted into the top form
  • Click "Format Source Code" button
  • Copy the generated html code and paste it into your post in html mode

Time to clean up the repo? Commands to list and sort git branches

As a preparation for a future branch cleanup in our git repos at work I googled for and tried a few branch listing and sorting commands that might come in handy.

List branches 
sorted by last commit date
 git for-each-ref --sort=committerdate refs/remotes/ --format='%(committerdate:short) %(refname:short)'  

Example result
 2016-09-05 origin/PBI-0096  
 2016-10-02 origin/PBI-146   
 2016-11-25 origin/PBI-1320  

List branches 
with age and last committer name 
sorted by last commit date
 for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r  

Example result
 2016-10-06 16:17:17 +0200 11 months ago by Harry Potter     origin/PBI-88  
 2016-10-05 14:24:24 +0200 11 months ago by Joe Labero    origin/PBI-146  
 2016-09-02 12:10:17 +0200 12 months ago by Nicola Tesla    origin/PBI-0096  

List branches 
with age and last committer name 
sorted by last committer
 for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --pretty=format:"%Cred %cn %>|(40) %Cblue %ar %>|(80) %Creset" $branch | head -n 1` $branch; done | sort -r  

Example result
 Harry Potter 3 days ago origin/PBI-5124  
 Harry Potter 8 weeks ago origin/PBI-4584  
 Harry Potter 2 days ago origin/PBI-5129  
 Joe Labero 7 weeks ago origin/PBI-4590  
 Joe Labero 6 weeks ago origin/PBI-4742  

onsdag 9 augusti 2017

Anyone else having the same kind of double vision?

I think I've had double vision for a long time, but maybe it has become worse the last five years or maybe it just has started to bug me more than before.

Here are two examples that show how text can appear for me.

Here are some characteristics of the phenomenon:

  1. The duplicate image is less prominent than the original image, it's like a shadow of the original image. The color of the duplicate looks like a washed-out version of the original.
  2. The duplicate image always appear moved upwards compared to the original.
  3. The duplicate appear the same when using both eyes or one eye at a time, regardless of which eye I look with.
  4. The farther away from the original I am, the higher up the duplicate appear.
  5. The duplicate disappears when looking through the top edge of the glasses. Looking through a small hole also makes it disappear.













I've been to an ophthalmologist three times. The first time he suspected an incipient cataract or keratoconus (a bulging cornea). But after my two revisits both those suspicions got depreciated. And no new ideas came up :(
I also have a minor squint, but that can't be the source of the problem since the duplicate appears even when I look with one eye at a time.

I don't know the exact strength of my glasses, but it is around -6 for both eyes. The values for the astigmatism correction I have no clue about, have to check it up...

The double vision really bugs me when:
  • Trying to help someone with his code by sitting beside him and look at the code on his monitor from the side. The duplicate characters make the code unreadable.
  • Meeting persons on the street. Since faces also get distorted by the double vision, it makes it hard to know if it's a person I know or not until coming pretty close.
  • Looking at subtitled movies on the TV
  • Driving in darkness, it's hard to read signs from far away

So, since both the ophthalmologist and the optician are clueless, it would be nice to know if anyone else has experienced this, or even better, if anyone knows what it could be and how to fix it!

onsdag 21 juni 2017

"Software" books that make me wanna start my own business

Here's a short list of books that have been mentioned in the developer podcasts I listen to. I've read two of them, and it started an itch, an itch to try start my own business. Really get the thoughts flowing. Maybe it will for you too?




Developer Hegemony

The Future of Labor
Erik Dietrich

Erik explains what he thinks is wrong with software corporate structure. He divides the employees into three categories, pragmatists (the coders that just want to make a living), idealists (the bosses that live the company culture and put in lots of extra hours to become an opportunist, but never will be) and opportunists (company founders/owners) and uses these categories to describe the work life in companies of today. He wants to see a transformation of software creation and proposes people starting their own single-person businesses and join forces when needed. He want us to become something that he calls efficiencers.

He is a guest in these podcasts and talks about his ideas and his book there:
http://developeronfire.com/podcast/episode-228-erik-dietrich-developer-hegemony
https://www.dotnetrocks.com/?show=1438

He's also a guest in this older episode:
http://developeronfire.com/podcast/episode-127-erik-dietrich-options

His blog:
http://www.daedtech.com/



Soft Skills

The software developer's life manual
John Z. Sonmez

John goes through the important things you as a software developer need to know careerwise. Giving tips about what to think about when working at a company, for starting your own startup, marketing yourself, learning and teaching.

He's been a guest in these podcasts:

Do you see a pattern? :)

His blog:


Escape 9-5, Live Anywhere, and Join the New Rich
Timothy Ferriss

I haven't read this book yet, was just about to, but felt a bit overwhelmed of this "genre" after reading Developer Hegemony. When reading up on it now, it doesn't seem software related either, but my impression is that the tips might fit a developer that are about to start something of his own.

It was interesting listening to him on the podcast anyway (or, well, when searching for the podcast I was sure I had heard him in the first time, I can't no longer find it. He and his book was probably mentioned by some other interesting guest...). 

Here is a recording of Scott Hanselmans interview with him anyway. 

And his blog


onsdag 14 juni 2017

How to activate the detailed scroll bar in Visual Studio

I haven't been using the detailed scroll bar in Visual Studio much and it probably is more shiny than useful. But still, if you have some screen space to spare, you can as well activate it, because suddenly it might come in handy!

So, what does it really do for you? It shows you the code in the active tab... in the scroll bar!!



And...


To activate it, goto Tools > Options > Text Editor
To use it for all languages, proceed with All languages > Scroll Bars > Behavior
  • Select Use map mode for vertical scroll bar
  • Check the Show Preview Tooltip check box to get the preview on hoover.
  • Select the look of the map, Off (to only have the preview tooltip), Narrow, Medium or Wide




Click OK and watch the magic happen! =)

måndag 5 juni 2017

How to edit the Where-clause in "Edit Top 200 Rows" in SQL Server Management Studio

When you want to edit data in a table directly in the table without writing any update queries, you can right-click the table in the SQL Server Management Studio and select "Edit Top 200 Rows" in the menu.



Then you can go from cell to cell and edit the values for the top 200 rows in a view like the one below.



But what if the top 200 rows aren't the rows you want to edit? You would like add a where clause to select the rows you edit. There is a way, when standing in a "Edit Top 200 Rows" view, a few extra icons are added to the toolbar. Locate the one that has the text SQL on it. Click on it to show an SQL pane.



In the SQL pane you can edit the query as you like. 



When you're done with the query editing, locate and click on the "Execute SQL" button to update the content in the editable table view.


Good luck, have fun! :)


söndag 4 juni 2017

"Learn Git Branching", the site that finally made me get a grip on git!

My git journey

Subversion

Sometimes I feel lucky that the first company I worked for as a software developer was using Subversion instead of SourceSafe. As I remember it, Subversion together with the Windows Explorer integrated Subversion client TortoiseSvn, was pretty easy to learn and felt as a great tool. Sure, there were some gotchas, but still, the learning curve felt pretty flat.

When I moved on, from employment to employment, the companies I came to often used SourceSafe. I could cope with that, because I used Subversion on the side. After many years as a Subversion user, I heard about the greatness of git and tried a few times to get a grip on it... but didn't get it. One of the reasons to that was that as a TortoiseSvn user I thought that TortoiseGit would be almost the same experience. The image below is what you meet when trying to get the source code to your computer, lots of checkboxes I didn't have a clue what they did!


I gave up rather fast, but tried again, and gave up, and so on. 

SourceTree

Finally I found the git visual client SourceTree, that was powerful enough to let me do most of the things I needed. Some visual clients was so stripped that it wasn't possible to do anything but the simplest commands. With SourceTree I could finally work with git and began to learn, but the learning curve felt steep, and the fact that I came from Subversion probably made it steeper than if I hadn't had the Subversion thinking. Anyway, now I learned things, but still many things felt really confusing.

Learn Git Branching

One day, I found the site http://learngitbranching.js.org/ Spending some time on that site made a big difference! Suddenly I got a feel for the differences between Subversion and git branches! The two top reasons I find the site so great is that you solve problems using real git commands and that it shows visually what happens with the commits and branches.


Results

Learning git on my own, using SourceTree and the "Learn Git Branching" site, made it possible for me, on my latest employment, to do the migration of the source code from TFVC to git, set up a branching strategy, and to help my collegues get a quick start with git so they didn't have to take the same long journey as me =)