Ivo Georgiev
Profile

last week

last 3 months

last 6 months

last year

overall

1
notes
2012 May 17

"The principles that I’m applying to the office are the same that made Lady Gaga a star. Or any number of drag queens"

- Michael Scott

Good one, Michael 

#lady gaga #the office #michael scott
3
notes
2012 May 13

Microtemplating vs DOM welding

All web developers are familiar with the concept of microtemplating. However, DOM welding is a relatively new concept. The idea is, we have the entire HTML document represented as a DOM. Which is essentially our tree of elements, parsed, and ready to be modified. So we take a data structure (e.g. JSON) and we directly “bind” it into the DOM, using classes or IDs as identifiers, as follows:

<div class=”post”>

<h1 class=”title”></h1>
<p class=”content”></p> 

</div>



For [{title: “title1”, content: “some content”}, {title: “title2”, content: “another content”}]

Will become:

<div class=”post”>
<h1 class=”title”>title1</h1>
<p class=”content”>some content</p> 
</div>

<div class=”post”>
<h1 class=”title”>title2</h1>
<p class=”content”>another content</p> 
</div> 

So this is DOM welding.

Is it better? People familiar with this technology will probably say yes. The truth is, yes and no.

Conventional microtemplating does not depend on the DOM, it uses raw string manipulation. It just replaces an expression in brackets (e.g. {{ }} in mustache) with it’s corresponding variable.

DOM welding, of course, requires the whole HTML document to be parsed in a DOM.

The speed of execution is probably the most important factor when choosing a template engine. Templating is an essential task and taking a lot of time to execute is not a good idea.

So, which is faster? DOM welding is faster when the DOM is already available, which is most probably the client. On the client, since we must always have our page represented as a document object model, it makes no sense to apply the convertion

DOM tree -> HTML string -> template engine -> HTML string -> DOM tree (microtemplating)

When we can

DOM tree -> template engine -> DOM tree (DOM Welding)

Extracting HTML from the DOM is a lightweight operation, but parsing HTML back into the DOM is slow. So we must avoid that convertion.

On the other, hand, on the server we have no DOM by default, so it would be even more  inefficient to 

HTML string (entire page) -> DOM tree -> template engine -> DOM tree -> HTML string (DOM welding)

When we can:
HTML string -> template engine -> HTML string (microtemplating)

So there it is. DOM welding -> faster on the client, microtemplating -> faster on the server.

Enhanced by Zemanta
#javascript #Web developer #DOM #HTML #Document Object Model #JSON #Programming
7
notes
2012 May 12

Second Life

  • Dwight:

    Second Life is not a game. It is a multi-user, virtual environment. It doesn't have points or scores. It doesn't have winners or losers.

  • Jim:

    Oh, it has losers....

#Second Life #The Office
1
notes
2012 May 11

Crazy comment

Read wast334’s comment- it’s funny how every single paragraph is even more idiotic than the last one.
But… Fuck yeah. This dumbo got put in his place.

#programming #apple #apple cult #objective c
5
notes
2012 May 11

Richard Stallman collapses at a conference

First comment on HackerNews:

This presents an interesting situation. Is Stallman okay with being hooked up to medical computers even though they may not be running free software? What about the privacy issues involved in being checked into a hospital?

Ok, that might be a little harsh, but I had a hard laugh.
#rms #gnu #linux #richard stallman #free sofware
3
notes
2012 May 09

Netherlands the first country with net neutrality

The net neutrality law prohibits internet providers from interfering with the traffic of their users.

Meanwhile, in the US there are laws to ENFORCE providers track their users.

#politics #us #internet #tech #netherlands #neutrality
1
notes
2012 May 07

Stanley (the office s05e01)

Remind you of something?
Yes…

 

#the office #stanley hudson
8
notes
2012 May 05

On Sunday, December 4th, 292,277,026,596 A.D. the 64-bit Unix time stamp will exceed the limit of a 64-bit number.

The 32 bit one, however, expires on 19 January, 2038 A.D, 03:14:08 UTC.

#unix #nerdy #programming #linux
0
notes
2012 May 05

How Robert should go

First of all, I do not hate Robert California, he is a great character. But there is no use explaining - people on Tumblr are obviously too childish *caugh*stupid*caugh* to understand that a good character does not necessarily mean a protagonist.

However, since the actor is leaving, let’s think of what the possible ways Robert leaves the office. Of course, it’s obvious that it will have something to do with David Wallace and Andy, but…

  1. He does his job poorly and is forced to leave. If the screenwriters decide on this, it would be better if that happens because of his personal problems and not incompetence - obviously, Robert is a good leader.
  2. He dies. Of course, it would be too extreme and would never happen, but it  kind-of matches his character. By this I mean, he is an extravagant person. He may die of, let’s say substance abuse.
  3. He is found out to be a serial killer and, instead of being caught, escapes the country and is never found again. That would be so awesome.

All of those, except the first one, are unrealistic for the nature of the show, but think of how awesome would that last one be…

#the office
20
notes
2012 May 03

collegecupofjava:

Nothing better than fearing a velociraptor attack when compiling.

Yep. You all better learn your lesson about goto.

collegecupofjava:

Nothing better than fearing a velociraptor attack when compiling.

Yep. You all better learn your lesson about goto. #programming #velociraptor