Opinion

It’s all in your head: thoughts on 15 books

September 22, 2019 Book Reviews, Career, Opinion, Personal 3 comments

Metacognition. Seeing with your tongue. Implanting fabricated memories. Superintelligence. Immortality. Dataism as religion. Lobsters and your social status. Number anchoring when negotiating your salary. Amoral deception. Illusion of choice and of free will.

Are you intrigued? You should be. I definitely was impressed by some of the new knowledge gained and ideas covered in few books read recently. This post is a set of short one-four paragraph book reviews. Some books I do recommend and some I don’t though still mention them for my personal record and for entertainment reasons and also to prevent you from reading them. Since this is covering 15 books the post is going to be relatively long. Please bear with me.

Learn better

Key idea: Learning is a skill and you can teach yourself to be better in it.

The author advises 6 steps: value – make learning more valuable by associating it to things you appreciate, target – set learning goals, develop – practice with audience or teach, extend – constantly improve understanding of existing knowledge, relate – create relationship between concepts, and rethink – don’t get overconfident and dive deep to understand ever better.

Quote: “The act of writing is a good example of metacognition because when we think about composing sentences and paragraphs, we’re often asking ourselves crucial metacognitive questions: Who will be reading this? Will they understand me? What things do I need to explain? This is why writing is often such an effective way to organize one’s thoughts. It forces us to evaluate our arguments and think about ideas.”

At times I regret how I was studying at university – I could have been much more efficient had I known that the key is to retrieve the knowledge instead of repeatedly consuming information. My interpretation is that the brain works in such a way that when we consume information it is transmitted towards its storage destination igniting complex neural paths in one direction but to retrieve the information the path has to be ignited in the opposite direction as well or otherwise we risk “forgetting”. This brings us to the next book:

The Brain: The Story of You

The book if full of all kinds of absolutely fascinating facts about inner workings of our brain. Sometimes even slightly creepy. For instance, read this quote below:

Quote: “So not only was it possible to implant false new memories in the brain, but people embraced and embellished them, unknowingly weaving fantasy into the fabric of their identity.”

Disregard if you believe someone can implant fake memories, this book is totally absorbing and exciting read if you are new to neuroscience and psychology and want good introduction. You would get to learn about extreme adaptive capabilities of the brain and other things. As I understand it, effectively the brain is a powerful interpretation machine taking electrical signals as input (from your ears, eyes, tongue, nostrils, skin) and translating them into flow of bioelectric processing that could cause certain chain reactions resulting in physical actions and/or secretion of chemical substances (hormones) by glands effectively making us alive. Since the brain is such a powerful interpreting machine we can work on providing it with other inputs and teaching it to handle those as well. In this way a guy has learned to see with his tongue and even climb using Brainport. This is a real product for people with disabilities consisting of a camera on outside, a pad put on tongue towards which an electric picture is projected. To extend on this, there is nothing that could prevent us from extending capacity of human body.

Or, maybe, instead we can build artificial general- or super- intelligence to help us out?

Life 3.0: Being Human in the Age of Artificial Intelligence

Let’s do versions first: 1.0 – biological when hardware and software evolved, 2.0 – cultural when software is designed and hardware is how it was, 3.0 – technological when both hardware and software are designed. Here “hardware” is human body and “software” is our cognitive abilities to process information.

This book reads almost as science fiction and somehow involuntarily reminds me of movies where robots and humans exist together. The book brings questions of how the society will exist when Artificial General Intelligence becomes a reality. Would we no longer need to work? Would machines try to exterminate us as in Terminator movies or harvest for energy as in The Matrix? I liked be book for bringing all of these interesting questions, entertaining on all kinds of possibilities, and exploring potential solutions to new problems we would eventually have to face and at same time not actually being a fiction.

Can we become super-humans or even gods without the help of AI? Let’s look what the next book says:

Homo Deus: A Brief History of Tomorrow

The key idea is that we eventually become god-like and gain ability to control life and environment and Homo Sapiens goes extinct. We might eventually lose our carbon-based existence and just become information.

I really like the structure of this book taking your slowly from understanding how much progress humanity has made by overcoming such horrible things as plagues, famines, and wars. Then the book sets next goals for humanity such as immortality and eternal happiness. The author then projects his historical knowledge and recent achievements in medicine and technology into what future might bring us.

We believed in gods, science, liberalism, other things. Humanism being the main “religion” of 21th century when we celebrate our own intelligence and experiences, but the final and the last one could be Dataism. You can translate everything into data! Everything. Many people measure their pulse, sleep, etc. People with diabetes wear devices that measure blood sugar levels and inject insulin as needed. People post pics on facebook, instagram nonstop, and tweet like crazy. When I run I measure speed, pace, etc and compare to earlier myself and other runners. Oh… and I write this post. Let’s go further: wondering how good sex with your partner is – easy put data sensors that measure, duration, intensity of orgasm, analyses sweat contents and put it on a plot over period of time and you know all you desire to know and, maybe, even compare to results of others. Sounds weird? I bet, but some real companies produce products like this. Now, let’s put even crazier proposition: Do you even exist if you are not connected to net and there is no digital trace of you? Right now, you would think that you do, but maybe in future ubiquitous data stream of human life becomes their life in itself?

Quote: “Senses and emotions are biochemical data-processing algorithms”

Speaking of biochemistry:

12 Rules for life

Serotonin is natural hormone associated with feeling of happiness. It is antidepressant you can get prescribed if you’ve got depression. In lobsters serotonin is regulating posture – the more serotonin – the more open lobsters posture is – the higher lobster is in its dominance hierarchy. Let’s call them alpha-lobsters (AL). Other male lobsters would know AL are tough ones and would not take on them and female ones would be attracted to AL. Female ALs would also be the ones with all the mating choices. Lobsters existed since 350M years ago (and if you recall 65M for dinos and some 200-300K for homo sapiens). Now the interesting part: the process of regulating posture and social status is embedded in humans the same way as it is in lobsters. Yeah it is very deep inside us, but, damn, crap, no! So the first rule is “Stand straight with your shoulders back”.

I didn’t like the book, though. Except of the very first rule others are not so fascinating and exciting. Not too sure what exactly to make of the first rule or what other rules are teaching us, but the book is quite popular and the author is very interesting personality (Canadian clinical psychologist with strong views), so instead of reading I would recommend to watch this first: https://www.youtube.com/watch?v=-5RCmu-HuTg (start at 3:40) and if you still want to read all 50 shades of grey in the lobster world – go ahead.

10% Happier

Another book I cannot really recommend. Listing here mostly for myself as not to forget. I read it and, yes, it is quite interesting as a story, but not much more. The book is like a memoir of one of the journalists who discovered his way to practicing mindfulness through his personal struggles of finding himself while building his career, reporting at war, craving for drugs (adrenalin, cocaine, whatever), and interviewing notable people, such as Dalai Lama. The only learning form this book is that celebrated people are often deceiving, they are hiding things and are driven by crazy things. The author didn’t motivate me to start meditating – I still think it is not gonna work for me. Somewhat fun read though, waste of time otherwise.

Speaking of deception:

The 48 Laws of Power

Let’s start with a disclaimer: I do NOT praise this book.

This book effectively teaches you how to deceive others and how to work your way to gain power the evil way. Wikipedia says it is a bestseller popular with prison inmates and celebrities. Description on goodread has this “This amoral, cunning, ruthless, and instructive book synthesizes the philosophies of Machiavelli, Sun Tzu, and Carl Von Clausewitz with the historical legacies of statesmen, warriors, seducers, and con men throughout the ages.”

If you want to understand how amoral this is read the quotes here: https://www.goodreads.com/author/quotes/865.Robert_Greene I don’t even want to repost them here.

Key learning: bad people exist and they could intentionally be manipulating you in psychopathic ways just to get what they want no matter what the price or method. It is good to be aware of such things and try to recognize and distinguish between people with genuinely good intentions and those who are evil. Never be a victim.

The subtle art of not Giving a F*ck

One thing that I like about this one is that the author says it is ok to not try being positive all the time. At times people are overplaying it and it is weird when they pretend to be happy. Acceptance of some of the negative experiences is a positive experience in itself.

The book is an easy and extremely entertaining read, especially if you are feeling a bit stressed and worry about too many things. Definite fun. Most of us like fun, so if you are going to read/listen to it do it mostly for that reason.

Algorithms to live by

Fun book for software engineers on how you can incorporate computer algorithms into your everyday life. Just go and read. Super easy reading and wonderful way of spending your time.

Wondering how to sort your clothes and stuff in the most effective way? Like maybe sorting them by type? Nope. Wrong answer. The best way is to introduce Least Recently Used cache, making sure stuff you need the most often is always most accessible.

Go ahead and apply game theory towards making your decisions and design mechanisms for decisions instead of relying on good intentions.

Never split the difference

Ok, finally back to slightly more serious books, and I would go as far as to say that this book is a “must read” before your next job offer negation. The book is written by former FBI agent who worked as hostage negotiator.

It is also probably one of the most practically useful books for people who have office carriers like me and would like to apply negotiation techniques in almost any discussion. More often than not, “No” means “wait” or it means there is something the other side doesn’t want to reveal. Your job is to work through what the other side really wants.

Louder than words

This is a book on nonverbal intelligence. I remember it being intriguing when listening to. We humans are very interested in knowing what others think. They say body language conveys 55% of communication. If this is true then we should benefit from learning to be better at understanding nonverbal messages.

Principles: Life and Work

This is really good perspective on how you can structure your life and work around set of principles. I like the emphasis on always getting all the way to truth by overcoming your emotions, ego, and blind spots.

One of the great and unique notions introduced in the book is idea meritocracy that can be applied at workplace based on the following: radical truth – no filter on what you’re thinking, radical transparency – being super open for entire organization, thoughtful disagreement, believability-weighted decision making.

If you don’t have time for the book just want this great video on how economics works and then look at the principles for success videos. These two should be worth one hour of your leisure time. I really appreciate how Ray Dalio is trying to leave some legacy after him.

Extreme Ownership

This book is written by former US Navy-Seals who fought in Iraq and in essence is partially memoir and partially book on leadership covering 12 principles towards becoming extreme owner and a real leader. The most memorable are the first and the last. The first one is extreme ownership: always take full responsibility for your own and your team’s results, never blame anyone.

Quote: “Implementing Extreme Ownership requires checking your ego and operating with a high degree of humility. Admitting mistakes, taking ownership, and developing a plan to overcome challenges are integral to any successful team.”

The last principle one is discipline equals freedom: conquer your weaknesses, procrastination since being disciplined means being fee. This brings us to another book:

The Power of Habit

Key learning: most of our lives are structured on top of numerous habits and building right habits could propel you really far forward.

Habits have the following structure: Cue (stimuli) + Response (actions) => Reward (resulting sensations). To build a new habit you need to identify the response – which is the core of what you want to be doing, then you need to come up with cues that would repeat and eventually create craving (same timing, same location, same triggers), and then you need to make sure you get the reward or punishment. Once this is done: repeat-repeat-repeat and at one point you won’t be able to resist.

Quote: “Habits are most malleable when the Golden Rule of habit change is applied: If we keep the same cue and the same reward, a new routine can be inserted.”

Thinking Fast and Slow

This one is written by Nobel price winner and is probably based on more research done by author himself than any other book in this list. Not an easy read. I definitely recommend the book, but probably don’t listen to it like I did. Get yourself kindle or paper version.

This is a book on how we think about things in realm of two systems: system 1 – fast processing, lazy, and emotional, automatic, and impulsive; system 2 – slow processing, rational, aware, conscious, and considerate. Although the author didn’t give these parallels I tend to think about system 1 as subconsciousness or based on subconsciousness and about system 2 as that of consciousness.

Default rule. Let me give you one example: I lived in Austria for some 6 years. Had I died in car incident I would have been donor of my organs, same is the case for 99% of drivers in Austria. Now, this number is only 12% in neighboring and culturally similar Germany. This is simply because Austria uses opt-out and Germany uses opt-in system when collecting consent. System 2 needs to put consideration in case of opt-in, while system 1 is happy to skip in case of opt-out.

Loss aversion. We are more afraid to loose something than we are eager on getting more of it. Authors provide numerous examples of loose/gain propositions with exactly same statistical outcomes and demonstrate how people choose option that sounds more safe. Unfortunately in real situations what sounds safer could be irrational and more often than not people actually make the wrong decisions. This is especially important when you make money decisions.

There are many other concepts introduced in the book all backed up by research, evaluation and phrases for remembering in the end of each chapter. Just going over all of these concepts is worth your time as it might help you make better decisions. I am considering rereading kindle version of the book after some time.

Conclusion

Personally I find this kind of books very fascinating and engaging as they provoke profound thoughts on our existence and provide guides towards enhancing our future well being.

Hopefully these short reviews are useful to you and will help you pick your next read.

Thank you.

Would be happy to receive quick recommendations on similar books in comments!


3 comments


Do not misuse or over abstract AutoMapper

November 27, 2016 AutoMapper, Opinion 15 comments

AutoMapper is a great little library every .NET project is using (well, lots of them). I used it for the first time in 2010 and wrote a blog post about it.

Since that time I observed few things:

  • Almost every project I worked on, that needed some kind of object mapping, was using this lib. In rare cases there was some pet library or manual mapping in place.
  • Almost every project had some abstraction over the library like if it was going to be replaced or like different implementation for mapping would be needed.
  • Basic API of the library didn’t change at all. CreateMap and Map are still there and work the same. At the same time performance, testability, exception handling, and feature richness got improved significantly. Last one, in my opinion, is not such a good thing as it leads to the next point.
  • In many of those projects AutoMapper was simply misused as code placed in AfterMap or in different kinds of resolvers would simply start containg crazy things. In worst of those cases actual business logic was written in resolvers.

I have always been of an opinion:

Less Code – Less Bugs; Simple Code – Good Code.

Having seen this trend with the library, I would like to suggest simplifying its usage by limiting ourselves. Simply:

  • Use AutoMapper only for simple mapping. Basically, one property to one property. Preferably, majority of property mapping is done by the same name. If you find yourself in situation when over half of your mappings are specified explicitly in ForMember method it may be the case for doing it manually (at least for the specific type) – it will be cleaner and less confusing.
  • If you have some logic to add to you mapping, do not add it via AutoMapper. Write a separate interface/class and use it (via DI) where your logic has to be applied. You will also be able to test it nicely in this way.
  • Do not abstract AutoMapper behind interfaces/implementations. I’ve seen abstracting this in a way that you need to create a class (empty in many cases) for each mapping type pair and somewhere there would be custom reflection code that initializes all of the mappings. Instead, use built-in AutoMapper Profile class and Mapper.Initialize method. If you still want to have at least some abstraction to avoid referencing AutoMapper everywhere make it simple.

Here is how I’m using AutoMapper these days:

Somewhere in CommonAssembly a very-very simple abstraction (optional):

Somewhere in BusinessLogicAssembly and any other where you want to define mappings (can be split in as many profiles as needed):

Somewhere in startup code in BootstrappingAssembly (Global.asax etc):

And here is the usage:

That’s it. I do not understand why some simple things are made complex.

There is also another advantage of keeping it minimalistic – maintainability. I’m working on a relatively new project that was created from a company’s template, as a result it had older version of AutoMapper abstracted. To upgrade it and keep all old interfaces would mean some work as abstraction used some of the APIs that did change. Instead I threw away all of these abstractions and upgraded the lib. Next time upgrading there simply will be way less code to worry about.

Please let me know if you share the same opinion.


15 comments


Single Git Repository for Microservices

November 14, 2016 Opinion No comments

Just recently I joined a team. We write intranet web application. There is nothing too special about it, except that it was designed to be implemented as micro-services and as de-facto at the moment it is a classical single .NET MVC application. This happened for a simple reason: meeting first release deadline.

The design was reflected in how source control was set up: one git repository per each service. Unfortunately this caused a number of required maneuvers to be in synch and to push changes as team was making scattering changes in multiple repositories. This also made it more difficult to consolidate NuGet packages and other dependencies as all of them were in different repositories.

I think that microservices and corresponding hard reflection of their boundaries in form of source code repositories should evolve naturally. Starting with a single repository sounds more reasonable. If you keep the idea of microservices in you head and nicely decouple your code nothing stops you creating new repositories as you service boundaries start to make shape.

Taking this into account we merged repositories into one. There was only question of keeping source code history. Turns out the history can be easily preserved by employing git subtree command and placing all of the service repositories as subdirectories of a new single repository.

As a result, team is working much more effectively as we do not waste time on routine synch and checking who did what where. 

Conclusion: Theoretically micro-services should be implemented in their own repositories. That’s true, but in practice for relatively small and new project, with only one team working on it, single repository wins.


No comments


Running Challenge Completed. Health, Motivation, and Other Aspects Of Running

October 2, 2016 Opinion No comments

Are you bent by scoliosis programmer? Do you spend too much time sitting? Maybe you look a bit flabby? Super tired at and after work? High chances are that some of these are true for you. Some certainly are true for me. This year I tried to improve my situation by running. Here are my thoughts and humble recommendations.

Dirty Running Shoes

Running and its impact on your Health

“Being physically active reduces the risk of heart disease, cancer and other diseases, potentially extending longevity.” – many studies show accordingly to this article. Probably one of the most accessible forms of exercising is running. All you need to start is just pair of shoes. This research paper is a good resource on learning about impact of running and other exercises on chronic diseases and general mortality.

So why running? – Because it is easy to start with and because we are made for it. “Humans can outrun nearly every other animal on the planet over long distances.” – says this article. Funnily enough there is yearly Human vs. Horse marathon competition.

If you ask yourself how you want your last two decades before death look like, most likely you would picture a healthy, mobile, and socially active person. Also you would prefer those two decades better be 80’s and 90’s. Right? Light running for as little as 1 hour a week could add as much as 6 years to your life. This long-term study showed that “the age-adjusted increase in survival with jogging was 6.2 years in men and 5.6 years in women.” (For those who are pedantic and want to know net win: (2 hrs/wk * 52 wks a year * 50 years) / 16 day hours = 325 days lost to running still gives you net 5 years).

Motivation

At my age I do not think about the death that much. My main motivation for running is improvement of my health. I know that for many people extra weight is motivating factor. For me it is not as instead of loosing weight I gained some 2-3 kg. Likely I’m so skinny there is no way to loose fat, though there is room for leg muscles growth. Unfortunately running is often boring and it is very hard to get yourself outside and go for a run on that nasty cold day. Here are few things that helped me running this year:

Run different routes

Always running at same location taking same path is boring. If you travel somewhere, just take your shoes with yourself and have a run at new place. Not only you get to have another run, but you explore the location. I ran in five different countries this year and could tell that those runs are more interesting than usual next to home ones.

Running in Ireland Gap Of Dunloe

Join friends or running club

I was going for runs rather rarely at the beginning of the year, but later as I started running with friends I started to run more frequently. It is always much more pleasant to have a conversation and learn few new things from friends, especially if areas of your interest overlap more than just running.

Running With Friends

Sign up for a challenge

Sports are competitive by nature. You can have friendly competition with your fellow runners, or you can take a virtual challenge. That works great because the clock is ticking and you want to have it done. This September I took it to the next level by signing up to Strava monthly challenges. I have completed all of them. See Trophy Case below:

Strava September Running Challenge

Be careful and avoid injury

You don’t want to walk with a cane when old because you were too stupid and run too much and too hard when young. I’m sick of running because of this September challenge. I completed it, but last two runs I ran through the pain being injured. I’m recovering now using RICE recovery technique. From now on I will take it easier. Suggesting the same for you.

RICE Recovery - Icing an Ankle

You can do it

I’m not a good runner. At the beginning of the year I could barely run 5km, I didn’t know how I will complete my planned 40 runs as it was so hard. Running 40 times was my main year goal. I did not expect that I will ran for around 50 times totaling 320 km. And it is not the end of the year yet. I also ran a Half-Marathon distance running a top Kahlenberg hill next to Vienna. If I can do it – you can!

Conclusion

I completely agree with research and studies that “for majority of people the benefits of running overweight the risks” and at the same time I voluntarily ran through the injury just to complete my challenge. Motivation is an important factor, but runners have to be careful and moderate their exercising. This is especially true if you run for the health reasons. Just try to make your runs more interesting and enjoy your life… longer.

Running under Speed sign


No comments


Working with Excel files using EPPlus and XLSX.JS

February 29, 2016 C#, JavaScript, Opinion, QuickTip, Tools 1 comment

Need to quickly generate an Excel file on the server (.NET) with no headache or need to import  another Excel file in your JS client?

I can recommend two libraries for their simplicity and ease of use.

XLSX.JS

To smooth transitioning from Excel files to electronic handling of data we offered our users possibility of importing data. As our application is web based it meant some JS library to work with Excel files. A bit of complication was that our users over time developed a habit of having all kinds of modifications in their “custom” Excel files. So something that would allow us easily work with different formats was a preference.

XLSX.JS library available on GitHub proved to be a good choice. I could only imagine how much better it is over some monsters that would only work in IE. I think starting documentation is fairly good, so I will just go through some bits and pieces from our use case.

Setting up XLSX.JS and reading files is straight forward: npm or bower, include of file and you are ready to write XLSX.readFile('test.xlsx') or App.XLSX.read(excelBinaryContents, {type: 'binary'}).

Reading as binary is probably a better bet as it will work in IE, though you will have to write some code to implement FileReader.prototype.readAsBinaryString() in IE. You can have a look at our implementation of file-select component on gist.

Using XLSX in your JavaScript is fairly easy, though there might be some hiccups with parsing dates. See this gist.

EPPlus

We also have two use cases where we need to generate Excel file on the server. One was to generate some documentation for business rules so we can have it up to date and share with our users at all times. It was implemented as part of CI that would save a file to a file system. The other use case was downloading of business related data via web interface. These two were super easy to do with open source library called EPPlus.

You just add EPPlus through NuGet and start using (var excelPackage = new ExcelPackage(newFileInfo)). See the gist below. First file demonstrates how to operate with cells and the other one just shows how you can use streams to make file downloadable.

These two libraries really helped me to efficiently implement some of the Excel file business use cases.

Next time I will have to generate Excel file on server or read it on client I will most certainly use these two again.


1 comment


Beauty of Open Source in Practice

December 20, 2015 Opinion 2 comments

We found a bug in Internet Explorer. It was acknowledged as such in two months of exhausting e-mail communication and no fix was promised.

We found a bug in open source library. It got fixed over weekend after we raised an issue.

This summarises everything I wanted to share in this post. I have more, so continue reading.

As a disclaimer, I want to say that I don’t attempt to have a comprehensive look at open source versus closed source. This is just an example of what happened in my project.

Closed source code case with Internet Explorer

We use Microsoft technologies wherever possible unless there is no sensible solution to a problem we need to solve. Application we implemented is a large offline capable single page application with tons of controls rendered at once. We noticed that IE crashes after prolonged usage of the app, though we were not experiencing the same in other bowsers. It took us a while to realise that there was a legitimate memory leak in IE. More details on how we tried to troubleshoot the issue are here. Afterwards we started long and boring communication with Microsoft, which ended in them acknowledging a bug in IE. Actually, it was a known bug. They said that attempts to fix this bug caused them more troubles, so it is unlikely that the fix will appear in any of IE11 updates or in Edge browser. We got an approval for our users to use Chrome as it doesn’t have this memory issues and in general is much faster.

Open source code case with Jurassic

The app has plenty of shared logic that we want to execute both on client and server. We decided that we want it to be written in JavaScript. As our backend is .NET we used Jurassic library to compile JavaScript code on the server and then to execute it whenever we needed it. We also tried to use Edge.js, but at the moment we are not happy about its stability when run under IIS.

We stumbled upon an interesting bug. IL code emitted by Jurassic library was causing System.InvalidProgramException on some environments. We narrowed it down to a continue statement used in for loop. We noticed that this was only used in moment.js library. We modified the code of moment.js to avoid using continue statements. This fixed the issue so were already covered by open source since we could modify it. Of course, we didn’t stop there and posted a bug on Jurassic’s forum. The guy had a look over weekend and fixed the issue for us.

Conclusion

Of course, this is just one example where using open source proved to be a nice way to go. It doesn’t always work like that and at times it is a wrong choice. I mainly wanted to share this as it was such a striking and contrasting difference for me personally.


2 comments


Backup and Restore. Story and thoughts

April 7, 2014 HowTo, Opinion No comments

Usually when I have some adventures with backing-up and restoring I don’t write a blog post about that. But this time it was bit special. I unintentionally repartitioned external drive where I kept all of my system backups and large media files. This made me rethink my backup/restore strategy.

The story

I will begin with the story of my adventures. Currently I’m running Windows 8.1. The other evening I decided I want to play old game from my school days. Since I couldn’t find it I decided to play newer version still relatively old – released in 2006. As usual with old games and current OSs it wouldn’t start. As it is normal for programmer I didn’t give up. First of all there was something with DirectX. It was complaining that I need newer version, which I of course had, but it was way too new for the game to understand. After fixing it game still wouldn’t start because of other problems. I have changed few files in system32. It still didn’t help. Then I decided on other approach – installing WinXP on virtual machine and run it there. I did it with VirtualBox and it didn’t work because of some other issues. Then I found Win7 virtual machine I used before for VMware, but that VM didn’t want to start.

At this point I decided to give up with that game. So to compensate I started looking for small game I played in university. Unfortunately the other game also didn’t want to start by freezing my PC. After reboot… ah… actually there was no reboot since my Windows made its mind not to boot any longer!

Now I had to restore. Thankfully my Dell laptop had recovery boot partition and I was able to quickly restore to previous point in time. Not sure why Windows didn’t boot if recovery wasn’t pain at all.

After that happened I decided that I need additional restoring power. So I ran program by Dell called “Backup and Recovery” to create yet another backup of the system. Program asked me for drive and I found one free on my external HDD where I keep system images. Unfortunately I didn’t pay attention to care about what that special backup might do. It created bootable partition and of course repartitioned entire drive. I pulled USB cable when I realized what it started to do!

I had to recover again, but now files on repartitioned drive. If you look online there are some good programs that allow you to restore your deleted files and even find lost partitions. One of such is EaseUS, but it costs money and I didn’t want to pay for one time. Thus I found one free called “Find And Mount” that allows to find lost partition and mount it as another drive so I can copy files over. That’s good but for some reason speed of recovery was only 512Kbit/s so you can imagine how much time it would take to recover 2TB of stuff. I proceeded with restoring only the most important stuff. Maybe in total restoring took like 30+ hours.

Bit more on this story. Since I needed to restore so much stuff I didn’t have space for it. My laptop is only 256Gb SSD and my wife’s laptop (formerly mine) also has only that much. But I had 512 HDD left aside. So I just bought HDD external drive case for some 13 EUR and thus got some additional space.

So that was end of story. Now I want to document what I do and want to start doing in addition to be on the safe side.

Backup strategy

What’s are the top most important files not to lose? – These are photos and other things that are strongly personal. I’m pretty sure if you have some work projects they are already under source control or handled by other parties and responsible people. So work stuff is therefor less critical.

My idea is that your most important things should be just spread as much as possible. This is true for photos I have. They are just on every hard drive I ever had. At least 5 in Ukraine and 4 here in Austria. Older photos are also on multiple DVDs and CDs. Some photos are in Picasa – I’m still running old offer from Google 20Gb just for 4$ per year. All phone photos are automatically uploaded to OneDrive with 8Gb there. Also I used to have 100Gb on DropBox but then I found it too expensive so stopped keeping photos there.

All my personal projects and things I created on my own are treated almost the same as photos, only they are not so public, often encrypted.

So roughly backup strategy:

  • Photos and personal – as many copies as possible and at as many physical places as possible, including cloud storages
  • System  and all other – System Images and bootable drive, including usage of “File History” feature in Windows 8.1

I started to think if I want to buy NAS and some more Cloud. For now will see if I can get myself into a trouble again and what it would cost if it happens.

On the image below Disk 0 is my laptop’s disk. Disk 1 is where I now have complete images of 2 laptops at home, complete copy of Disk 2 and also Media junk. Disk 2 is another drive with Windows installed, which will now be used regularly for backups and for “File History”.

image_thumb-25255B11-25255D

Now some links and how-to info:

  1. Find and Mount application for restoring partitions
  2. EaseUS application with lots of recovery options, but costs money
  3. Enabling “File History” and creating System Image in Win8.1 can be done from here: Control PanelSystem and SecurityFile History
  4. External USB 3.0 HDD 2.5’’ Case I bought
  5. Total Commander has features to find duplicate files, synchronize dirs and many other which come handy when handling mess after spreading too many copies around

This was just a story to share with you but it emphasises one more time that backups are important.

P.S. I finally managed to play newer version of 2nd game :)


No comments


Not attending NDC2014 in Oslo

March 24, 2014 Conferences, Opinion No comments

What a silly title for the post. What if everyone wrote about what they are NOT doing?

image

Well, I write this blog post partially to convince myself that decision on not attending NDC2014 is right and partially to share my thoughts on such aspects of attending conferences as price and return of investment.

I always wanted to visit some big developer’s conference. One of the conferences that I definitely like is NDC (either in Oslo or London). I think it has best mix of technologies that match my interests and at the same time has big names in it.

I wanted to go there for 4 times. First time I just asked my company in Ukraine, but it would be too expensive for them and I don’t know if they ever sent people to such conferences. Second time I asked company here in Austria, but I was new employee to send me somewhere – I didn’t have a chance to prove that I worth it. Third time I just couldn’t do that because my daughter was about to be born. And this summer I’m not going to allow myself to attend it on my own.

Reason is simple – price. I’ve calculated that it would cost me around 2600 Euro (~3600$) to attend it. This includes tickets for the conference and flights, hotel, food and 3 working days. Organizers wouldn’t give me a discount.

image

Being self-employed makes you really consider such things as conferences from manager’s or company’s perspective. You start to think about return of investment and how to justify conference attendance. Real question is if money spent on conference will benefit you correspondingly.

NDC videos are available online shortly after conference. It is not a secret that what people get from conferences is not content of presentations but possibility to establish relations with gurus who are at the top in the industry. I heard this so many times. One of my old friends said that conference really starts when presentations are over and people get together at lunch or dinner or at party.

Taking this into account it is very hard for me to believe that I could establish good connections at any conference. I’m usually shy, especially when it comes to social events and new connections. I don’t think that I’m only one who has this problem. Probably most of developers to some extend have similar issues. I found some articles on how you can attend conferences as yourself. But point that I’m trying to make is that usually it is company that pays for their employees therefor developers are not that much concerned about the price and of course they are happy to attend. I would also be happy if someone paid for me. Some say that conferences are often just a reward for best developers for being loyal to their companies.

I concluded for myself that from learning perspective I would not gain much from this conference and from networking perspective it doesn’t worth so much money. Of course there is tiny chance that I’m overlooking some big opportunity.

I believe that if I spend just half of those money on small conferences and tools/learning I will get more in return.

This beginner’s guide to attending conferences is quite useful. I think I will use some of the provided hints when I’ll be attending smaller conferences.

One last thing, probably ultimate goal for any attendee of any conference is to grow to the level when you are invited as one of key speakers.


No comments


Micro Agile for Managing Your Work. Pomodoro New Way

January 22, 2014 Agile, Opinion 3 comments

This is a blog post about combination of pomodoro technique with simple todo list and result commitment that shapes a way of managing time into micro scrum.
Pomodoro
When I realize that I’m losing focus on work I often switch to pomodoro technique. In case you don’t know, pomodoro technique is basically working on something during 25 minutes completely focused and avoiding any of external distractions. At your disposal there are plenty of pomodoro timers available. I like the most simplest ones – those that don’t distract on their own. At the moment I’m using one that just shows time, and except of start/stop has task recording. That’s it. I put it somewhere at the top of screen in the corner.

image

Micro Agile
I also track my tasks in notepad. Yes, in notepad. Simple TXT file does almost all I need. It is very simple and having only few groups and bit of formatting you can quickly work with it. When using it together with pomodoro technique I started to break tasks to smaller ones, so that they can be completed in 25 minutes. I decided to take one step further by making sure that I commit my code before this 25 minutes elapse (or +5 min penalty). This promise of committing your code is just awesome. Being limited in time forces you to come up with anything but to finish your task. You can even come up with workarounds. Whatever it is you always get a solution! For software engineers challenges are common and problems often seem unresolvable. But “before you quit, first try”. Break some task or project into approx. 25 min chunks and be committed to solve them within time limit. Imagine that in the end of 25 min you have to show your work to your boss/user/manager/god/whoever you admire. You should have feeling that if you are not done you have nothing to show.
I realized that this is basically agile. Agile or scrum in particular is all about iterations and delivery. Isn’t it? So by organizing your work in such a way you can be very productive and focused.

Here is how top of my working tasks list looked like in the end of a day:
clip_image001
I’ve got nice count of 10 commit items awaiting to be pushed to the server.
clip_image001[4]

Time bought and fulfilment of work being done

Have you noticed number 10? Why 10? And what should it mean?

One of my personal problems is spending too much time at work. Also very often I don’t feel like I did much during the day. Sometimes because there were too many distractions, sometimes there was tough task, sometimes day was just filled with so many things that you don’t even know what you worked on. When I come home after such day I’m exhausted and even depressed because there is no time for other things.
When I started using this micro-scrum I didn’t have number 10, but I quickly realized that even if I do only 4-5 pomodoros such days are frequently more productive than other days.
I’ve been thinking about this and though that all this approach can be taken even one more step further. A motivational step. It often happens to people that they have plenty of work and it doesn’t give them free time. What if you could limit number of pomodoros you do per day and once you done with that number you are done for the day!
I came up with number 10. In pure time it is (25min + 5min break)X10=5hrs. Would you say that it is too little for 8hrs day? Well, no. It is hard to fit these 5 pure hours in 8 hours. There are plenty of things that come up, so planning for more 25-min tasks would be dangerous. Other option could be to count all meetings/collaboration/e-mailing/etc in pomodoros and add them to your count. In such case 15 should be largest number you can think about completing in a day.

10 a day is my limit at the moment!
What if something new pops up?
There is one special rule: You can always interrupt to add task to your list. Apparently when you work on task some items pop-up, if you address everything at that moment you won’t be able to complete your main pomodoro. Instead what you can always do is to switch screen type task and again switch to your work.
What if new big stuff comes up on your way?

What if you need to work on a big task? At first I tried to split such tasks on small tasks of 25 minutes, so I would get list of like 30 or more tasks. It is manageable to do this, but unfortunately after you are done with 5-10 items you realize that rest of items are no longer valid. Other way of doing it would be to perform 1 or 2 starting pomodoros. This way you get rough idea about what obstacles there could be. Then you break task into number of items enough to occupy you for the day. In the end of a day you already will be able to break everything into small chunks. But don’t hurry to break down everything. Next morning just break into tasks enough to fulfil your day.

How many personal pomodoros there should be?

I’ve been trying hard to spread this technique on my personal activities. First I wanted to work on personal activities exclusively when at home, but this didn’t work well. I’m having hard time to actually work on anything at home.
I then started to squeeze some of my personal activities in between of working items. In sense that after each 3 or 4 pomodoros I work on one of personal.

How to stick to this technique?

I don’t know. What I’ve described above worked quite well for me for few weeks and could work good now if I continue using it. But for some reason I unnoticeably manage to slowly return to usual way of working on stuff, which is not bad as long as you can keep yourself focused.
Because of recent events in Ukraine I’m massively distracted for the news and this technique helped me to at least accomplish some work.
To summarize
  • Break your tasks into 25 minutes activities
  • If it is big task break only for the day
  • Reorganize your tasks accordingly (best done in the morning)
  • At any point of time you can add items to your list
  • Never distract for anything else
  • Completion is your main goal and to make it certain set some done barrier, like having code commit in the end
  • Buy time by limiting number of pomodoros you have for the day
  • Squeeze your personal pomodoros or leave them for the end of a day
  • Always complete min number of pomodoros per day
  • Force yourself to use this technique when you are distracted from work


3 comments


Application Fabric Cache – an easy, but solid start

July 4, 2012 .NET, DistributedCache, Errors, HowTo, Opinion 1 comment

I would like to share some experiences of working with Microsoft AppFabric Cache for Windows Server.

AppFabricCache is distributed cache solution from Microsoft. It has very simple API and would take you 10-20 minutes to start playing with. As I worked with it for about one month I would say that product itself is very good, but probably not enough mature. There are couple of common problems and I would like to share those. But before let’s get started!

If distributed cache concept is something new for you, don’t be scary. It is quite simple. For example, you’ve got some data in your database, and you have web service on top of it which is frequently accessed. Under high load you would decide to run many web instances of your project to scale up. But at some point of time database will become your bottleneck, so as solution you will add caching mechanism on the back-end of those services. You would want same cached objects to be available on each of the web instances for that you might want to copy them to different servers for short latency & high availability. So that’s it, you came up with distributed cache solution. Instead of writing your own you can leverage one of the existing.

Install

You can easily download AppFabricCache from here. Or install it with Web Platform Installer.

Installation process is straight forward. If you installing it to just try, I wouldn’t even go for SQL server provider, but rather use XML provider and choose some local shared folder for it. (Provider is underlying persistent storage as far as I understand it.)

After installation you should get additional PowerShell console called “Caching Administration Windows PowerShell”.

So you can start your cache using: “Start-CacheCluster” command.

Alternatively you can install AppFabric Caching Amin Tool from CodePlex, which would allow you easily do lot of things though the UI. It will show PowerShell output, so you can learn commands from there as well.

image

Usually you would want to create named cache. I created NamedCacheForBlog, as can be seen above.

Simple Application

Let’s now create simple application. You would need to add couple of references:

image

Add some configuration to your app/web.config

  <section name="dataCacheClient" type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere"/>
  
<!-- and then somewhere in configuration... -->
  
  <dataCacheClient requestTimeout="5000" channelOpenTimeout="10000" maxConnectionsToServer="20">
    <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
    <hosts>
      <!--Local app fabric cache-->
      <host name="localhost" cachePort="22233"/>
      <!-- In real world it could be something like this:
      <host name="service1" cachePort="22233"/>
      <host name="service2" cachePort="22233"/>
      <host name="service3" cachePort="22233"/>
      -->
    </hosts>
    <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456"
                       maxBufferSize="134217728" maxOutputDelay="2" channelInitializationTimeout="60000"
                       receiveTimeout="600000"/>
  </dataCacheClient>

Note, that above configuration is not the minimal one, but rather more realistic and sensible. If you are about to use AppFabric Cache in production I definitely recommend you to read this MSDN page carefully.

Now you need to get DataCache object and use it. Minimalistic, but wrong, way of doing it would be:

public DataCache GetDataCacheMinimalistic()
{
    var factory = new DataCacheFactory();
    return factory.GetCache("NamedCacheForBlog");
}

Above code would read configuration from config and return you DataCache object.

Using DataCache is extremely easy:

object blogPostGoesToCache;
string blogPostId;
dataCache.Add(blogPostId, blogPostGoesToCache);
var blogPostFromCache = dataCache.Get(blogPostId);
object updatedBlogPost;
dataCache.Put(blogPostId, updatedBlogPost);

DataCache Wrapper/Utility

In real world you would probably write some wrapper over DataCache or create some Utility class. There are couple of reasons for this. First of all DataCacheFactory instance creation is very expensive, so it is better to keep one. Another obvious reason is much more flexibility over what you can do in case of failures and in general. And this is very important. Turns out that AppFabricCache is not extremely stable and can be easily impacted. One of the workarounds is to write some “re-try” mechanism, so if your wrapping method fails you retry (immediately or after X ms).

Here is how I would write initialization code:

private DataCacheFactory _dataCacheFactory;
private DataCache _dataCache;
private DataCache DataCache
{
    get
    {
        if (_dataCache == null)
        {
            InitDataCache();
        }
        return _dataCache;
    }
    set
    {
        _dataCache = value;
    }
}

private bool InitDataCache()
{
    try
    {
        // We try to avoid creating many DataCacheFactory-ies
        if (_dataCacheFactory == null)
        {
            // Disable tracing to avoid informational/verbose messages
            DataCacheClientLogManager.ChangeLogLevel(TraceLevel.Off);
            // Use configuration from the application configuration file
            _dataCacheFactory = new DataCacheFactory();
        }

        DataCache = _dataCacheFactory.GetCache("NamedCacheForBlog");

        return true;
    }
    catch (DataCacheException)
    {
        _dataCache = null;
        throw;
    }
}

DataCache property is not exposed, instead it is used in wrapping methods:

public void Put(string key, object value, TimeSpan ttl)
{
    try
    {
        DataCache.Put(key, value, ttl);
    }
    catch (DataCacheException ex)
    {
        ReTryDataCacheOperation(() => DataCache.Put(key, value, ttl), ex);
    }
}

ReTryDataCacheOperation performs retry logic I mentioned before:

private object ReTryDataCacheOperation(Func<object> dataCacheOperation, DataCacheException prevException)
{
    try
    {
        // We add retry, as it may happen,
        // that AppFabric cache is temporary unavailable:
        // See: http://msdn.microsoft.com/en-us/library/ff637716.aspx
        // Maybe adding more checks like: prevException.ErrorCode == DataCacheErrorCode.RetryLater

        // This ensures that once we access prop DataCache, new client will be generated
        _dataCache = null;

        Thread.Sleep(100);
        var result = dataCacheOperation.Invoke();

        //We can add some logging here, notifying that retry succeeded
        return result;
    }
    catch (DataCacheException)
    {
        _dataCache = null;
        throw;
    }
}

You can go further and improve retry logic to allow for many retries and different intervals between retries and then put all that stuff into configuration.

RetryLater

So, why the hell all this retry logic is needed?

Well, when you open MSDN page for AppFabric Common Exceptions be sure RetryLater is the most common one. To know what exactly happened you need to verify ErrorCode.

So far I’ve see this sub-errors of the RetryLater:

There was a contention on the store. – This one is quite frequent one. Could happen when someone is playing some concurrent mess with cache. Problem is that any client can affect the whole cluster.

The connection was terminated, possibly due to server or network problems or serialized Object size is greater than MaxBufferSize on server. Result of the request is unknown. – This usually has nothing to do with object size. Even if configuration is correct and you save small objects you can still get this error. Retry mechanism is good for this one.

One or more specified cache servers are unavailable, which could be caused by busy network or servers. – Have no idea how frequent this one could be, but it can happen.

No specific SubStatus. – Amazing one!

Conclusion

AppFabricCache is very nice distributed cache solution from Microsoft. It has a lot of features. Of course not described here, as you can read it elsewhere, say here. But to be able to go live with it you should be ready for AppFabricCache not being extremely stable & reliable, so you better put some retry mechanisms in place.

To be honest if I was one to make decision if to use this dcache, I would go for another one. But who knows, maybe other are not much better… I’ve never tried other distributed caches.

Links

Thank you, and hope this is of some help.


1 comment