Thursday, September 10, 2015

What a line of code

I didn't know this line of code (in any language) will make sense but apparently it does:

auto l = [](){};

Look at all those brackets!

I encountered this when reading this blog ("http://blog.3d-logic.com/2014/12/08/c-async-development-not-only-for-for-c-developers-part-i-lambda-functions/").

It's a C++ lambda function and equivalent to this C# code:

Action l = () => {};

In C#, an Action type is a delegate (a function pointer) that returns null. The pair of empty parentheses means there is no parameter for this function. The empty curly braces means it's not doing any operation at all.

So in summary... it's a piece of code that accepts no parameter, doesn't do anything, and returns nothing. Effectively useless. But nevertheless valid code. And quite beautiful too.


Sunday, September 06, 2015

Google Play Books, Chrome, and the Language Issue

I have this one problem with the Google Play Books website (https://play.google.com/books/reader) in Chrome when I'm already reading a book. No matter what I do my Google Chrome browser doesn't seem to recognize it and change the language of the navigational links.

As an example, I had my settings before in Chrome for my languages set to English and Filipino, the Philippines' native language. Just to make it consistent I wanted to see the navigational links (like "Exit", "Return to page X") in English. But for some reason, no matter what I do (clear my Chrome browser's cache several times, restart my Chrome browser several times too, change my Google profile to English, etc) it always reverts to Filipino ("Lumabas", "Malapit ka na sa dulo", etc).

See sample below:

Google Play Books language issue
Before the fix

Upon investigation (when you look at the source of the returned HTML of the navigational portion of the reader page), it shows the following in the HTML tag: , FIL being the language shorthand for Filipino. So the solution is to somehow change it to .

The problem is: How?

After several hours of wasted time and trial and error, it turns out the solution is relatively easy: pass an additional querystring parameter to the URL such that instead of this:

https://play.google.com/books/reader?

you'll have:

https://play.google.com/books/reader?&hl=en.


The HL=EN parameter does the trick and forces your Google Play Books reader page to render all navigational links in English.

I hope this helps those who have the same issue as I do.

Happy (Google Play Book) reading!


Tuesday, September 28, 2010

Technique: Using Visual Studio Team Foundation Server To Create A Deployment Package

In one of my projects, we have this requirement that every time we need to deploy the application for QA and User Acceptance testing in a separate server, the developers need to create our individual deployment package containing the codes that changed during the development, either to create new features for the application or to fix some bugs. These packages will then be used by the Build Master who will consolidate them to create the final Visual Studio solution with which to build from.


Friday, July 23, 2010

Boy Scout Rule, Bad Code, and Uncle Bob

I saw a portion of Uncle Bob's presentation here on bad code, and the section on the "Boy Scout rule" (whatever that is) on software development, no matter how funny or crazy it sounds, to me is one of the simplest and better ideas on how we can improve software development. The idea, if I can paraphrase Uncle Bob, is to leave the code better than when we found them. And I realize that the obsessive-compulsive in me have been doing this all along for years without knowing it. Now at least I know how to call it and better yet how to communicate it to my team and those willing (or not) to listen.

See for yourself. I have yet to see the entire video myself.

http://www.infoq.com/presentations/Robert-C.-Martin-Bad-Code

Monday, June 14, 2010

Timings using SSD

If you're an ASP.NET developer like myself, you don't want to waste time fiddling with your thumbs while you wait for your compiler to finish its work. We're always on the lookout for things that can help us speed up our work, to give us those extra seconds of performance boost.  And one thing that's been a challenge to us is the fact that our processors may be really fast but the bottleneck kicks in when we are working on a huge project with thousands of files. For additional insight on this, see Scott Guthrie's blog entry ( http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx )

This is where I thought I would be assisted by that new kid on the block: Solid State Drive. 


Tuesday, November 10, 2009

Getting dizzy using the Spec Explorer Modelling Guidance

While creating a sample Spec Explorer application, you have this feeling of being lost. The thing is if you follow the steps of the Modeling Guidance (using the "Author a model from scratch" option), you'll soon get lost since the steps and the sample code are not consistent and continuous.


Spec Explorer - Visual Studio Encountered An Exception

While I was playing around with Spec Explorer and I hit this error:




After this, very simple IDE operations like Copy/Paste are not working. I have to restart Visual Studio 20101 Beta 2. It's getting a little bit frustrating.

And the thing is, once the above error was encountered you have to close Visual Studio 2010 using the Task Manager since closing it using it's own window is of no use since you'll keep on seeing this again and again:


What a line of code

I didn't know this line of code (in any language) will make sense but apparently it does: auto l = [](){}; Look at all those bracke...