Archive
Batteries
We’re witnessing our civilization undergo another significant revolution. We’re departing from extracting energy from fossil fuels in favor of harvesting energy from renewable sources. Majority of “clean energy” solutions rely on storing energy in batteries.
Car manufacturers are slowly transitioning to electric cars. Yet a few biggest ships create more pollution than all the cars in the world. To remedy this, Rolls-Royce (the engine company, not the luxury car company) announced a new battery system for ships. Eventually, in a few decades, we will produce a few orders of magnitude more batteries than today to store energy in cars, ships and houses.
The transition to electric engines and renewable energy is great for our planet, still one problems remains to be solved: batteries have limited lifetime. What is going to happen with all the mountains of batteries we will produce to replace dirty combustion engines?
One researcher developed a way to recycle used Li-Ion batteries. Reportedly around 97% of Li-Ion batteries end up piling up in landfills, which would become a huge problem in a few decades.
Should the cost of recycling batteries be included in the price of new products?
Nanotechnology may be near
If you’ve heard the term “nanotechnology” you may have heard it used incorrectly as a marketing buzzword. The term leads back to K. Eric Drexler, who wrote in 1986 in his book “Engines of Creation” how nanotechnology will revolutionize our civilization by giving us the ability to construct materials and entire products molecule by molecule.
Scientists from The University of Manchester reportedly finally built a molecular robot which has such capability.
On the plus side, that may be the most profound breakthrough of the 21st century. Not only will it revolutionize our lives along with 3D printing and machine learning, but it may also help us better understand the nanoscale world leading to improvements in medicine and other areas.
C type system strikes back
Today is one of those days when C++ surprises me. Here is a snippet:
#include <stdint.h> #include <stdio.h> int main() { const int64_t a = 3; if (a < -0x80000000) printf("%lld is negative\n", a); return 0; }
This time the surprise comes from the intricacies of the C type system.
Hint: -0x80000000 is mathematically INT_MIN.
In case you’re wondering, it is not about improving the above snippet. It is about actually seeing a piece of code like this in the wild. It looks correct. But it is incorrect.
Learn Polish
If you have some spare time and want to learn another language, I recommend Polish. Polish is a lot of fun! For a start, here are a few words in Polish and their meaning in English:
Polish word | Meaning in English |
---|---|
no | yes |
do | to |
to | this |
go | him |
pies | dog |
much | flies |
bat | whip |
paw | peacock |
but | shoe |
wanna | bath tub |
pan | mister |
baby | women |
was | you (plural) |
my | we |
we | on (a day) |
on | he |
one | they (women) |
ten | this one |
grab | hornbeam |
bark | shoulder |
jest | is |
fart | luck |
Enjoy!
New Year’s Resolution
One of my New Year’s resolutions is to keep this blog more active. While my activity has been low during the year 2015, I have not abandoned the blog. I was simply spending most of my free time working on my personal project. In the mean time I’ve gathered several ideas for new posts, it will be great if these posts finally see the daylight this year!
Hopefully my personal project will also reach a publishable state this year. Here’s an interesting detail about this project.
C++ has been the primary programming language for me in my professional career. Over the years, I’ve used many programming paradigms provided by this versatile language. However, to the surprise of many, my new project is currently written in pure C!
Why C? Out of admiration for a coworker, who writes programs in C, which are of high quality, and which are readable, maintainable and extensible. And also as a personal challenge. Writing *good* quality software in C requires more skills than in C++, because the language is much simpler and doesn’t have mechanisms provided by C++, which help avoid certain classes of bugs. To be fair, I’ve seen a lot of bad C++ source code which fails to use these mechanisms, but that’s another story.
So here are my impressions about going back to C so far. First of all, RAII, which is the cornerstone of C++, is not available. This makes cleanup more tedious. Again to be fair, C++98 without lambdas also makes cleanup more tedious by requiring you to write or use classes just for the purpose of cleanup, which makes the code scattered or complicated. Secondly, handling error conditions in C is more tedious. Exceptions in C++ can provide a great way of signaling exceptional errors, if used carefully(!), together with RAII, which makes returning from functions easier without the need to babysit allocated resources. Mildly missed are classes, which can help to logically organize functions, although in many C++ programs they are abused by implementing unnecessary OO designs, which lead to too much boiler plate code and eventually hamper readability. One of the most missed features are container templates, which greatly simplify memory management in C++.
On the bright side, some of the advantages include better portability due to unencumbered linkage. Because the language is so simple, it also leads to simpler code, which can in turn be easier to read, maintain and extend, contingent on the type of program and the way in which it is written, of course!
Surprisingly, it is possible to write readable code in C without drowning it in macros! Many C projects I’ve seen overflow with macros, which impact readability. But this can be said about C++ projects, too.
Now back to the editor. Let us see what the New Year brings!
Interview question: Which browser do you use?
Big Data says, that employees who use a non-default browser, such as Firefox or Chrome, stay with the job 15% longer than those using a default browser, such as IE or Safari.
Well, if Big Data says it, it must be true!
(There – I finally said it. 😉
Job interview question idea
I doubt that everybody realizes, that job interviews are for both the company trying to fill in an open position as well as the potential employee trying to find a job. A usually small, but important part of an interview is when the person being interviewed asks the questions.
This idea is for those who have the chance to speak to their potential future manager. How do you know if a particular manager will be right for you?
The question to ask your future manager is: Do you prefer cats or dogs?
The explanation follows.
Dogs are followers, they need their master to tell them want to do, to give them direction. Cats on the other hand are soloists. They do what they want, whenever they want. If they want to be tapped, they come to you.
Of course, this is an approximation, a generalization.
Similarly, there are two groups of employees. Ones which need to be told what to do, and the others, who don’t need and don’t like encouragement, but rather pursue tasks on their own. This is universal regardless of the job type. Obviously, the first kind can be compared to dogs, while the other to cats.
Before going to a job interview, you need to ask yourself honestly, whether you are a follower and need to be told exactly what to do, or whether you like taking complete control over what you are doing. This has nothing to do with whether to like cats or dogs, it is completely orthogonal.
If you are more like a dog, probably a manager who prefers dogs would be better for you. Similarly, if you are more like a cat, a cat-person would manage you better.
It’s just a theory. As silly as it sounds, I wonder if there exists any statistical data which would help test it.
Cursing
We’re trying to avoid cursing at home as much as possible and so far our children did not pick up any curse words.
But for some time now our three-year old son has been using the word “poop” quite often. He finds it very amusing. I think it all started when our kids were practicing joking and this word was said in an innocuous, funny context. He picked it up and it stuck.
Now he’s using it often at numerous occasions. Sometimes to get attention. Sometimes to make people laugh. And sometimes when he’s angry. Especially when he has to do something he does not want to or when he’s punished. Then he repeats or exclaims it multiple times, or says “you are a poop!”.
Because he hasn’t been exposed to cursing before, I think he invented cursing on his own. Cursing is apparently natural and as some studies indicate, brings relief in some situations, e.g. reduces pain.
Interestingly we’ve never had such problem with our daughter. This is one of the many examples we’ve noticed of the differences between males and females.
Bad UI
User interface is the most important feature of all devices (and software). It exposes all device functions to the user. Without user interface, all features of the device would be useless.
Apparently companies who have been around for tens or even hundreds of years are still making mistakes in user interface design. Here are two examples.
The compartment under the center armrest in a very popular car looks like this:
The compartment has two levels. Hence there are two levers under the armrest. One of them opens the top, flat compartment, the other one opens the bottom, big compartment. Unfortunately I am not able to memorize which lever opens which compartment.
I used to keep a box of kleenex/tissue in the bottom compartment. Whenever I wanted to take one tissue out, I had to guess which lever to pull to open the right compartment. And somehow I always guessed wrong. Very annoying, esp. during driving.
Cars are known for very well-thought user interfaces, which don’t get in the way. But in this case – they blew it.
Here is another example of a bad user interface. This company making all kinds of appliances and house equipment has been around for more than 100 years. One of their stoves:
This is a standard piece of equipment and a standard user interface solution. Well – nothing less annoying. The flaw here is almost the same as in the case of the dual compartment above. There are two knobs, one for each burner. Unfortunately the burners are aligned vertically, while the knobs are aligned horizontally, giving you no clue (without taking a closer look) which knob is for which burner.
In order to tell which knob is for which burner, I have to bend. Often I don’t want to bend, I just want to turn the burner on. When I don’t bend and look at the pictures which decipher the knob-to-burner assignment, I always choose the wrong knob and turn the wrong burner on. Like in the dual compartment case, it is not possible to memorize which knob is for which burner. Maybe because the pair of knobs on the other side for the two remaining burners is swapped. Well, at least they left a visual clue for the people who are not too lazy and actually bend or take a step back to determine which knob to turn. Please note, that when you’re close to the stove and e.g. putting a kettle on the back burner, you don’t see the icons over the knobs and you either have to bend down or back or you have to take a step back.
As innocuous as they may seem, these can be quite annoying.
How many broken UI designs can you spot around you?
Unenforceable law
A few years ago California introduced a law which bans texting or talking over the phone while driving. The problem is, that this law is unenforceable.
Every day I see many people clicking on their smartphones when waiting on the red light and often even when driving. Not only they risk their and other drivers’ lives, but they also show disrespect to other people. It always makes me angry when I am waiting on the red light behind somebody, the red light turns in to green and I am waiting multiple seconds before the clicker in front of me notices the green light. Often I have to honk to draw that person’s attention, the person starts driving lazily and keeps clicking.
The problem is so widespread that the police has no way of catching the clickers and enforcing the law. Maybe in 10 years we will have technology which blocks the phone when it is inside a car, maybe phones will automatically detect that they are inside the car and will lock their UI. Also self-driving cars will probably also take over when they detect that the driver is not paying attention or is drunk. Until then, the anti-texting law should probably be repealed, for it makes no sense.
What do you think? Do clickers annoy you when they are blocking your driving, do they offend you, or are you OK waiting for someone whose mind is somewhere else and not on the road?