A Simple Solution

Sometimes, or may be always, it is best to just seek the simpler or even simplest solution.For some time now, I have been plagued by a problem. Plagued is quite appropriate, because this problem was very annoying. I won’t get into the details it is a programming things and will be a bit boring. But, essentially, I had a problem where every time I started a new web application project using JavaScript libraries. I had this fatal error.

The root cause will be boring, so I will put that last if you want to be tortured. But for my rather annoying problem, I tried to code around it. And since it would happen every time I created a new project. Well, I had to dig up the code and run it to fix the problem. This problem is months old for me, may be even a year.

Finally, today I found a very elegant solution. A setting I can put in a file, and I own’t have to deal with it every again for any project. All I had to do was add ‘safecrlf=false’. That was it. I had tried a bunch of other suggestions from time to time and none of them worked.

Lesson, keep it simple. Writing about it now will be the last time I would have to think about how annoying it was.

The root cause for the problem is that developers who are working on windows, would submit files with CRLF ending. CRLF mean ‘carriage-return & line-feed’. Why is that a problem? Well, back in the days of typewriters. Once could do a ‘carriage-return’, which would do two things. Rotate the drum up enough to move to the next line. Here next line really means a new line, and of course slide it over so you can start typing at the beginning of the new line. You could also do a ‘line-feed’, which would just rotate the drum enough for a new line, but it wouldn’t return it to the beginning. This might not seems like something useful. But imagine that you wanted to just travel down the middle of  page after moving the the desired column. Then all you really wanted was ‘line-feed’. Of course you could turn the drum manually too. But never, all that, that is why there is both ‘carriage-return’ and ‘line-feed’.

Ok, so 99.99% of the people or companies who developed an operating system, used ‘carriage-return’ to mean ‘go to the beginning of a new line’. Microsoft, in their infinite wisdom, use not ‘carriage-return’ or ‘line-feed’, but both.  Usually, interchanging documents between systems is not a problem.  A mild annoyance to some non-Windows developers as their text documents have a funny extra character, the ‘line-feed’, at the end of each line. For Windows users, lines won’t wrap as they should, since their system is expecting two characters. But over time, these things became less of a problem, as editors just easily code round the problem.

But code is still being development and submitted or save with either CR or CRLF. Now we are at my problem. JavaScript libraries are distributed in text format. JavaScript doesn’t have a compiled for, not yet anyway. And my version control software, had a setting that said, “don’t save file with CRLF on this system”. I was the idiot who set that. So when I try to version control several dozen libraries, many of which had a line or two edited on a Windows system. The whole versioning things would grind to a halt.

At first, being the programmer I am, I coded around the problem. Something like this, but in Bash:

while (failing to commit); run dos-to-unix util on failed filed; repeat

I would have to run the code from every project. The code did a lot more than the one liner I showed above. It had to, (a) tried to commit a file, (b) see if it failed, (c) extract the file name form the error message, (d) strip out the extra LF character, (e) try to commit again. Repeat until all the files can be checked in without complaints from Git. Phew.

HBaseCon 2015

Today and today only was HBaseCon 2015. This was my first HBaseCon event. Glad I could have attended. There were a number of very nice projects and learning opportunities.

One of the projects I am really excited about is Zen from Pintrest. Unfortunately, I am yet to find it on the net. So they must not have opened sourced it. They built a graph API on top of HBase. They laid out enough of the underlying tables to support the design. I think with a bit of work, one can implement the API. But that will be some work. This is actually a project I can start using soon.

Another project that looks really interesting too is Apache Phoenix. This is an Intel initiated project to do SQL like syntax on HBase. I didn’t get to play with it, but it looks pretty cool.

There was a presentation on tuning the GCG1 for HBase, but I don’t pay too much attention. I was busying updating my cases at work. Then I had to leave early to catch the train.

There were some other projects of interest. But like all conferences, there are sessions that requires you to have a few clones. Without clones, you just have to pick one.

 

Time To Avenge

I showed Ian the first Avenger movie from 2012, and he was so into it. Before showing him, I was hoping he would like it so we can go see the new one as a family. Victory, he was into it when we watched it on Friday night at home. I was so excited to go see “Avenger: Age of Altron” today.

Stacy, Ian, and I decided to go. Desiree as usual, opted to stay at home. I enjoyed the movie. But unfortunately, by mid-movie, Ian lost interest and got restless. Stacy offered to take him outside for a bit. I didn’t see them come back to our seats. But I figured they just decided to sit closer upfront instead of coming up to the back where I was.

It wasn’t until I got out of the theater and saw them in the hall. That I realized they didn’t come back in. The movie was fairly entertaining, so I don’t mind watching it again with Stacy when it hit video.