Thoughts on what's important

Mar 29, 2011
0 comments

Our entire life consists of a series of decisions that we take daily and even hourly. As a children we make decisions based on our own good only. Then we learn to consider additional factors and make decisions based on that. As we grow new factors take place in this decision making process and some factors are faded out. At some point of our life we got to an understanding what is really important. I mean really important.
Not so far ago I came across my own understanding of important things. Today I came across this short speech by Bryan Dyson, a former Coca-Cola CEO which in few words underlines it.

Here it is:

Imagine life as a game in which you are juggling some five balls in the air. You name them - work, family, health, friends and spirit and you’re keeping all of these in the air. You will soon understand that work is a rubber ball. If you drop it, it will bounce back. But the other four balls - family, health, friends and spirit - are made of glass. If you drop one of these, they will be irrevocably scuffed, marked, nicked, damaged or even shattered. They will never be the same.

You must understand that and strive for balance in your life.

Work efficiently during office hours and leave on time.
Give the required time to your family, friends & have proper rest
Value has a value only if its value is value

What else?

- Don’t undermine your worth by comparing yourself with others. It is because we are different that each of us is special.

- Don’t set your goals by what other people deem important. Only you know what is best for you.

- Don’t take for granted the things closest to your heart. Cling to them as they would your life, for without them, life is meaningless.

- Don’t let your life slip through your fingers by living in the past or for the future.

- By living your life one day at a time, you live ALL the days of your life.

Don’t give up when you still have something to give. Nothing is really over until the moment you stop trying.

- Don’t be afraid to admit that you are less than perfect. It is this fragile thread that binds us to each together.

- Don’t be afraid to encounter risks. It is by taking chances that we learn how to be brave.

- Don’t shut love out of your life by saying it’s impossible to find time. The quickest way to receive love is to give; the fastest way to lose love is to hold it too tightly; and the best way to keep love is to give it wings.

- Don’t run through life so fast that you forget not only where you’ve been, but also where you are going.

- Don’t forget, a person’s greatest emotional need is to feel appreciated.

- Don’t be afraid to learn. Knowledge is weightless, a treasure you can always carry easily.

- Don’t use time or words carelessly. Neither can be retrieved.

Life is not a race, but a journey to be savored each step of the way.

LINQ for JavaScript & jQuery

Jan 19, 2011
0 comments

If you are familiar with C#, you probably use LINQ on a daily basis. But did you ever dream using it in your client's code. I use a lot of JavaScript in applications I develop mostly making use of jQuery library and more than once I did wished to be able to use a LINQ on client side.

Today I was facing a dilemma of querying a lot of data in JavaScript and JSON again. I did a little search and find out that there is actually a solution that allows me to use LINQ in my script.

It is called linq.js and resides on Codeplex

This library seems like a serious development effort with a lot of features. Here are some of them.
- Implement all .NET 4.0 methods
- Implement many extra methods inspired by Rx, Ruby and others
- Complete lazy evaluation
- Full IntelliSense support for VisualStudio
- Two versions - linq.js and jquery.linq.js (jQuery plugin)
- Support Windows Script Host
- Binding for Reactive Extensions for JavaScript(RxJS) and IntelliSense Generator

It's almost too good to be true, isn't it. You can see a full reference here

And here are some examples to catch your eye.

A basic one

var jsonArray = [
    { "user": { "id": 100, "screen_name": "d_linq" }, "text": "to objects" },
    { "user": { "id": 130, "screen_name": "c_bill" }, "text": "g" },
    { "user": { "id": 155, "screen_name": "b_mskk" }, "text": "kabushiki kaisha" },
    { "user": { "id": 301, "screen_name": "a_xbox" }, "text": "halo reach" }
]
// ["b_mskk:kabushiki kaisha", "c_bill:g", "d_linq:to objects"]
var queryResult = Enumerable.From(jsonArray)
    .Where(function (x) { return x.user.id < 200 })
    .OrderBy(function (x) { return x.user.screen_name })
    .Select(function (x) { return x.user.screen_name + ':' + x.text })
    .ToArray();
// shortcut! string lambda selector
var queryResult2 = Enumerable.From(jsonArray)
    .Where("$.user.id < 200")
    .OrderBy("$.user.screen_name")
    .Select("$.user.screen_name + ':' + $.text")
    .ToArray();
See how close it is to C#
// C# LINQ (delegate)
Enumerable.Range(1, 10)
    .Where(delegate(int i) { return i % 3 == 0; })
    .Select(delegate(int i) { return i * 10; });
// linq.js - anonymous function
Enumerable.Range(1, 10)
    .Where(function(i) { return i % 3 == 0; })
    .Select(function(i) { return i * 10; });

// C# LINQ (lambda)
Enumerable.Range(1, 10).Where(i => i % 3 == 0).Select(i => i * 10);
// linq.js - lambda expression
Enumerable.Range(1, 10).Where("i => i % 3 == 0").Select("i => i * 10");

// $ is default iterator variable like Scala's "_" or Groovy's "it"
Enumerable.Range(1, 10).Where("$ % 3 == 0").Select("$ * 10");
 // "" is shortcut of "x => x" (identity function)
Enumerable.Range(4, 7).Join(Enumerable.Range(8, 5), "", "", "outer,inner=>outer*inner");

// Enumerable.From is wrap from primitive array, string(to charArray), object(to KeyValuePair[]) etc..
var array = [100, 200, 30, 40, 500, 40, 200];
var ex1 = Enumerable.From(array).Distinct().ToArray(); // [100, 200, 30, 40, 500]
var ex2 = Enumerable.From("foobar").ToArray(); // ["f", "o", "o", "b", "a", "r"];
var ex3 = Enumerable.From({foo:10, bar:20}).ToArray(); // [{Key:"foo",Value:10}, {Key:"bar",Value:20}]

// C# - AnonymousType
array.Select((val, i) => new { Value = val, Index = i });
// linq.js - object literal
Enumerable.From(array).Select("val,i=>{Value:val, Index:i}")
It comes as a jQuery plugin as well. Which seems like a great option to me.
// $.Enumerable
$.Enumerable.Range(1, 10).Where("$%2==0").ForEach("alert($)");

// TojQuery - Enumerable to jQuery
$.Enumerable.Range(1, 10)
    .Select(function (i) { return $("

In overall this looks very good and states on a great new possibilities to those who creates serious applications with a lot of client side coding.
Performance, actual compatibility, convenience and other possible issues should still be checked, but no doubt that for those of us who know and love LINQ in C#, it's awesome that we can have client-side LINQ methods available.

Great job!

HTML5 in a nutshell

Jan 16, 2011
0 comments

Well, a long awaited HTML5 is here and many of developers already taste from its great features. But what about those who don't? There are a couple of things you could hear every time some new technology or technique comes to a market. The most popular beyond them are: "I don't have time to learn it", "I already have things working so why bothering" and so on. Well I have only 4 things to tell you about HTML5 that should make you jump to work on it right now. And the first one is: It is really simple to start working with HTML5 but let's take it one by one.

4 Things about HTML5

1. It's not a one big thing, it is a collection of individual features.

So you can’t detect “HTML5 support,” because that doesn’t make any sense. But you can detect support for individual features, like canvas, video, or geolocation.

2. You don't have to rewrite anything.

HTML5 is build on its predecessor HTML4. If your application worked yesterday, it will continue working on HTML5. What you can actually do is to improve things like extending standard text box element and to distinguish it to different text types like email, search etc. In older browsers it will look just the same, but a modern ones will suddenly appear to behave a lot better. For example mobile browser will show a different keyboard for email.

3. It's really, really easy and fast to get started.

“Upgrading” to HTML5 is as simple as changing your doctype. The doctype should already be on the first line of every HTML page. Previous versions of HTML defined a lot of doctypes, and choosing the right one could be tricky. In HTML5, there is only one doctype:

<!DOCTYPE html>  -  Easy right?

Upgrading to the HTML5 doctype won’t break your existing markup, because there is a backward compatibility in HTML5. It will allow you however to use new semantic elements.

4. It actually already works!

When you will start playing with your first application you'll be nicely surprised that HTML5 is already well-supported by the majority of browsers, including mobile.

A long awaited (by myself) First Post

Jan 13, 2011
0 comments

So, here we are. Hopefully my first post that will start a series of them.
Over the past few years dozens of times I told myself: "Here is the subjects you have to blog on. It is interesting and helpful". Then I thought: "I'll do it tomorrow" and putted it on the shelve along with other not published posts, articles and thoughts.

But today, actually a couple of days ago, I have finally done all the preparations for decent blog and now I am actually writing. What this blog will be about? I guess it will mostly include some technical stuff, tips, tricks and code samples. Some personal thoughts as well. Maybe.

I do promise to stay focused and not putting long hardly readable content.

Okay then, lets get started.

Concepticore Launched!

Sep 24, 2009
1 comments

I am happy to announce the launch of Concepticore!
Here you will be able to find our news, announcements, technical articles or just thoughts, funny things, quotes etc.
If you have any questions, suggestions or want to work with us, please do not hesitate to Contact Us

Good luck Concepticore!