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 =)

tisdag 30 maj 2017

Delete batches of tags in git

List tags

To list all tags, run
git tag

To list tags matching a pattern, use
git tag -l name_pattern 

For example, to list all tags with a name that begins with Release
git tag -l Release*

Delete tags locally

To delete a single tag
git tag -d name_of_tag

To delete multiple tags
git tag -d name_of_tag1 name_of_tag2

To delete all tags locally
git tag | xargs git tag -d  
(xargs takes the output from the first command and passes it as argument to the next)

To delete all tags that matches a name pattern
git tag -l Release* | xargs git tag -d

Delete tags on the remote

Assuming the remote is named origin and you want to delete all release tags for the 1.x and 2.x releases
git tag -l {Release/1.*,Release/2.*} | xargs git push --delete origin

REMEMBER to make sure that your pattern ONLY matches the tags that you want to delete. Inspect the result from the listing of matched tags before piping them to the next command.

Screenshot tool: Lightshot

Lightshot is a program that you can install for free in Windows (or Mac).

When installed, just press the Print Screen button and then select the area on the screen that you want captured.

When an area has been selected, it is possible to add text, arrows, boxes or freehand forms. When done, it's possible to copy the result to clipboard, save it to disk, print it or search for similar images on Google.

A really handy tool!

Download here


Revert a merge commit using SourceTree

Update 1 (no need to investigate the parents)

The use case I need this for is when a feature branch has been merged to master, and after that something arises that makes us want to remove that feature from the master branch again. In the text below I describe how to find the parents of a merge commit, but since the checked out branch always will become the parent number one when merging in another branch, the investigation of the parents isn't needed. The only command needed is therefore
git revert the_hash_of_the_commit_to_revert -m 1


Update 2 (commands for the commit message editor)

When the commit message editor opens up, just accept and exit by writing 
:q
Or, if you want to change the commit message, press i, write your message and then
<Esc> :wq <Enter>

Revert a "normal" commit

Normally when you want to undo the changes of a commit that has been pushed, you can do a reverse commit inside SourceTree by doing a right click on the commit and choose "Reverse commit..." like in the image below.


But if the commit you're trying to reverse is a merge commit you'll get the message:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=manager-st revert --no-edit 5a1f18d0d344e4ce9f23b02752cf4674c973cdf4
error: Commit 5a1f18d0d344e4ce9f23b02752cf4674c973cdf4 is a merge but no -m option was given.
fatal: revert failed

Completed with errors, see above.

Which means you've got to use the Terminal window.

Revert a merge commit

The case

Suppose we have the state as seen in the image below. Suddenly we realize that the changes made in the demo_branch are wrong and have to be removed from the master branch.



To do this we have to issue the revert command and specify the -m option. The -m option specifies which of the parents that was the mainline that we want the resulting code to be like.

Identify the commit to revert

The commit we want to undo is the commit with id 0c9c102

Find the correct parent

To the right in the button bar in the top of SourceTree window there is a button for opening the Terminal window.


Click on it and you'll see the Terminal window below.


Run the command git log to list the commits. Find the commit we want to revert (when you´ve found your commit, stop the listing with ctrl-z). In the image below we see that commit 0c9c102 is a merge, having two parents with the ids 618383a (parent 1) and b8a9ad7 (parent 2).



In this case we want to use the commit in the master branch as parent, the commit with id 618383a that is. That parent was listed in the log as the first parent, therefore we refer to it as parent 1.


Execute the revert command

To recap, we want to revert the commit 0c9c102 using parent 1 as the index to the -m (mainline) option. Therefore the command to write in the terminal window becomes:

git revert 0c9c102 -m 1



After issuing the command an editor for editing the commit message opens up (see below). To accept the default message and exit the editor, press Esc and then ZZ.


Now a new commit has been added, which reverts the changes introduced by the merge commit.




Done!

Sources

In case you had a hard time following my explanation, maybe the answers in the sources I used can help you.