Binary Insert : How to keep an array sorted as you insert data in it ?

With javascript and recursion

Recently I played solving the overlapping rectangles problem. This problem is simple, it is about finding out among a set of rectangles laid out on a surface which are the ones that overlap, with code of course. I will certainly detail my solution later but since it is very big and requires a bit of work and graphics, I prefer starting by sharing small bricks of the solution now.

A brick of the solution involves scanning the x coordinates of each rectangles like you’re moving from left to right reading every x coordinate of a rectangle you encounter, both left and right side. In computing terms, this means you need a structure to put the x coordinates in, and the scanning means the structure needs to be sorted : first x coordinate is the first coordinate you encounter and therefore the smallest one, last x is the largest.

I picked an array as the data structure so I needed this array to be sorted at all times to track the x coordinates. In real life conditions, the rectangles are thrown at you in chaos order and you have to add the x coordinates to your array and keep it sorted. How would you do that? This is the very problem I intend to expose and solve in this article :

How to keep an array sorted as you insert data in it?

My code is in javascript but the reasoning I will describe is totally language agnostic, you can always apply it to your own language.
Continue reading

Posted in Code, Algorithms

Tagged ,

You can’t be just geek, you know

The sentient developer mode

So today I had an interesting conversation at work. They filled me in about a new position they want to open for a front engineer and they would like me to take the role. Obviously the job interests me, but it interests me only for its technical appeal because it’s an architect job – and this is what I want to do. They were pretty confident for the technical part of the job and didn’t even mention it which was reassuring. However, their biggest concern was if I would be motivated enough to learn more about the actual activity of the company in order to create interfaces with all the business logic in mind. In other words I would need to have a pretty sharp knowledge of the business logic to do the job, I would need to interact with non technical teams and such, they said “We want the closest person to the application to know our business the best” – wow. This is new.

Continue reading

Posted in Life, Devsworld

The Infometer Concept : Making information measurable

Introducing the Infometer chrome extension

In this article I will show you what’s missing in the way we process digital content and what we could do to improve that with the concept of “Infometer”. It is the rationale behind the Infometer chrome extension that I also introduce here as an illustration of this concept. Continue reading

So I am a heavy reader. My best rate is one book per week. I read mostly practical books that make me learn something and sometimes novels. My reading is consequently very goal driven : I have to understand and learn. Being rather a practical reader, I have developed some reading techniques that make me read faster, with more focus, so that I learn more efficiently.

Continue reading

Please collect your tickets on the floor

The modern and beautiful cinema Pathe Beaugrenelle

This morning I went to the movies right after my photography class. I love going to this new cinema that recently opened in my neighbourhood, it is so futuristic. It’s very modern, very classy, it has great contemporary design, in fact I think it’s the best movie theater I’ve ever been to, compared to the ones I know from London or the US.

Every time I go there I take the time to observe how they designed the rooms, the furniture, the decoration, it’s really beautiful, it’s like visiting some kind of modern art museum where you can also view movies and eat popcorn, how cool is that. And in the morning the place is empty which makes it even greater, we were just two in the room to watch the movie, perfect. For some reason the place makes me think of Ray Bradbury’s books, it would fit in the future he imagined. I also read it was designed after 2001 a space odyssey, so I really like going there to feel like I’m in the future. Warm feeling.

Continue reading

Why don’t tech people give a full answer?

The hostile tech person always comes in peace

Today I had the impression I was hostile with one of my non-tech co-worker. He asked me something, and instead of giving him a full well-formed answer I redirected him to reading his emails. It’s only later that I realized what I had done because he seemed a bit pissed about it.

Continue reading

Posted in Devsworld

Rings, bells and victory

A debugging story Ep02

This is the story of my investigation on solving a cryptic bug that caused a very mysterious session reset. It involves, https, cookie privacy (httponly, secure), understanding of sessions, understanding of the infrastructure, team work and the obsessive need to understand why, why and why. Continue reading

In this episode I will require you to keep your eyes and sockets open. Follow me !

Continue reading

How does a web session work ?

Finally illustrated with diagrams

Not long ago I had to investigate on a session reset bug that forced me to do some research on sessions. Since I didn’t find the subject well covered, I thought I would share what helped me solve my bug, so that it can also help you in time.

I will describe here sessions in web applications, my area of practice.

Continue reading

Posted in Technical, Wiki


Kate Harff hates the machine

about:kate ♥

This is one of the discoveries of my summer : “about:kate“. It’s a German tv series about a young woman who gets herself in a psychiatric hospital to cure her depression and her only portal to the real world is through the Internet and Facebook. No, wait! Where are you going?! It’s not as bad as it sounds !

Kate Harff

Continue reading

A day on the grill

A debugging story Ep01

Today we had a big deal production release. And guess what, everyone is on holiday ! Happy summer everyone !!!

The release was at 2 pm, and everything on my part was already tested and validated up until our staging environment, the step before production where everything is supposed to be strictly equal to the production environment (according to the great theory of perfect software development). But around 2:30 pm, I got a phone call, an email, an instant message, AND a visit in person, simultaneously, to tell me the same thing : “THE SERVER IS BLEEDING !!! THE WEBSITE IS DYING, DON’T YOU SEE !!! LET’S ALL PANIC TOGETHER, JOIN US – NOW.”

Continue reading

Posted in Life, Stories, Devsworld


My git settings

A good practice to use git in command line

I wish I could port my git settings from one computer to another. But how ? If only there was a guide I could follow for that. So I’ve decided to document it here so my future self can check it anytime.

Here are the settings I use for git.
Continue reading

Posted in Technical, Tools & System