Общо показвания

октомври 14, 2011

What Is Wrong About 17259 Lines Of Code, Q&A

Web Reflection: What Is Wrong About 17259 Lines Of Code

I can answer and it is pretty simple and they have answered already by the way, you seem to just failed to read it: They have the resource and the will. Which means they can put 30 or 100 developers into something for months and even years and pay them to do something that might fail epically and still they would not mind! While the smaller companies and single developers cannot invest months into something that might fail or just be useless.

On the 'why' - it is just an experiment. The high expectations are to be the browsers that 'runs it native' and maybe they believe it will give chrome and chromeos some better user acceptance. Or maybe they really believe it is a step forward.

Anyway, just let them be. AFAIK very little number of companies are using the other attempts: GWT, Closure library, Go and so on. If we leave it alone it might become just one more project of them.

октомври 03, 2011

Node madness

I may or main not know - I make living as javaScript developer. As such I invested time and energy even beyond my 8/5 work schedule - I often fund myself involved in on-line activities related to augmenting my skills in the language I support my family with.

This said, it is explicable that I as excited when nodejs came around. I was not exactly one of the first adopters and around he time I tried it there were connect and early form of express and other middle ware and frameworks that ease the server side development. And I was relieved! Because frankly who wants to reinvent the wheel.

Yeah, node promoted itself big time in the JavaScript community, promising you the ability to write your logic once and run it anywhere, the server and the client alike. There are even companies that struggled for almost two years to reveal a large scale product based on node (like nodejitsu and cloud9). Interesting and useful (mind you!) things came to life - Socket alternative (like commet for python) at your disposal that you can code for in the language you already know well, for example. I for one was struggling once with Comet!

This however must come to an end. Why? Well, the thing is node might be great for some subset of application cases, I for one have never had one of those however. Node still does not have great SQL linkage (unlike any other server side language you still cannot reliably use stored procedure in the SQL server and have reliable return values in your JavaScript, I my practice we had to modify the procedures to have only one SELECT to be able to parse the results correct in mysql-node.

And today I read this article that says it well : node js is cancer. Why? Because it is over praised and use for "everything", while its niche is in fact pretty small. The fact that get to use language on the server that you already know might be tempting, but the thing is - it is not necessarily appropriate for everything. And while you applications logic start requiring ultra dynamic server side + client side mix of JavaScript it will never be!  I mention that because there are good projects out there that allow you to call server side JavaScript objects and method and this sounds very tempting to me, as on the server I can rely heavily on standards (V8 for example) this is mostly not the case in browser environments. On the other side this is somewhat simplified work around for cases where server side calls are performed and executed in other languages - i.e. the client side does not need to care about the server side implementation, which IMO makes this somewhat pointless, unless you need to write the server side logic as well.

My disclaimer: I have release exactly one web project completed entirely in node.js environment. And to tell you the truth - very simple one. And I gave it all up. Why? Because this is simply bull shit! I had to re-create in JavaScript functionality that was build and ready to use for years in pretty much any other server side language. And on top of that I had to learn new tools for server side deployment, 'forever', node set-up, npm set up and other things just to get this one web site going. And mind you  - the idea and implementation there was easy! The most simple thing, sending emails, took me a day and a half to start working properly. Not because I don't know the language, just because out of the 8 implementations in npm only one was able to do what it is supposed to to - everything else made the main server dislike us. Try this in any other language, be it java, python or php or really anything server side and you will see - it will just work.

So you see, I am not against node.js. I am against using it as general purpose server implementation.

Yet another thing I have to confess: I use node applications to JSLint my client side code, I use jade executable to compile my client side templates and I use uglify JS to minify my code. I sometimes also use requirejs with node to minify and compile the client side code before deployment. But notice - those are only tools. I would never use those on server side application.

How I see the future? I think most useful it would be to just make node work as library on top of apache like the python interpreter is. And use it only where needed!

октомври 01, 2011

Project shift evaluation (Target: Closure library)

I have given another though on closure library + compiler + templates.

I have downloaded the source, the compiler and template utilities. The source is really well documented.

Unfortunately I have issues with the fact that the compiler understands only certain subset of the JavaScript language, which means that I as developer need to restrain my work to those limitations for the only purpose to be able to compile the code to a usable size once development is completed.

I have tried to compile some of code as it is - it mostly did not work:
if (!window.console.group) {...}
resulted in:
if (!window.console.a){..} 
which is actually pointless. To avoid this I have to write:
if(!window.console['group']){..}
which is then compiler to
if(!window.console.group){...}

I find this exercise to be tedious for the developer; if a statement is valid JavaScript compilation should NOT break it.

I likes the name spaces idea nice, however the module pattern is equally nice to me.

Now about the templates. Our design guys make the prototypes in plain html. It seem fairly easy for a developer to translate this in closure template. However the fact that I need to use it with closure compiler throws it under the bus. Indeed the generated JavaScript is fast and compact, but fast and compact javascript is generate for jade templates also (and probably other templates for the node platform, those can be 'browserified'. The overhead of translating the HTML markup to Jade markup is not that bug as the Jade is fairly simple.

As of the compilation always valid code with minification is produced by uglify.

I was hoping for some more advances when dealing with UI, for example loading the css, the template and the logic of widget on demand. Nothing like that, at least not at first glance was found in Closure.  Seems we will continue handling the css manually and loading the modules with our JavaScript module implementation.

Before anyone gets this personally and start explaining the numerous advantages of Closure, let me tell you, I even went as far as reading "Closure: The definitive guide". I did not found the answer to our problem there. So it might be the greatest of them all, it still relies on coding style, which we do not have and there is no currently plan to port 100000 lines of code to another coding style so that closure compiler can handle it. Maybe one day when it can handle any code we will move on.

Conclusion: The main motivation behind this attempt with closure was the fact it makes maintainability much simpler. For example if we rely on Google to update the core and keep the API, we can assure the longevity of our code.Our code base grew enormous for the last year and we want to support only that, forgetting about browser inconsistencies, we would want to NOT back-port new versions of libraries, we do not like libraries that alter/augment native and host objects and we want either the namespace pattern or the module pattern. We want to be able to minify. Still we have not found all those in one project.

Our current approach is:
  • requirejs for module loading
  • jade for templating
  • css for styling - no processing
  • simple build process that minifies all scripts and then runs the requirejs optimizer. We minify all scripts because most of them are dynamically loaded and the optimizer cannot see them. 
  • documentation is built by an in-house developed script reading the source (comment based as with YUIdoc, however much simpler).
  • development environments are created with scripts that produces the base of the library, the project structures and a test server with local and remote debug server that compiles the templates on the fly.
  • deployment is created with script and is complemented by a build from the development 
  • versioning is done with git flow

септември 27, 2011

Transformers (3)

Най-тъпият филм, който съм гледал, с най-неясните ефекти. Това което виждах на екрана беше онова, което виждам като пусна миксера - нещо метално се върти. Толкова. Нищо друго. Гений на компютърните анимации или болен мозък!?

Второто.

Повече никакви трансформатори!

септември 26, 2011

Домашен сладкиш

Ето какво похапваме за "заслаждане" последните дни с Мартин:

Домашен кейк с домашна глазура
Кексчето е много лесно, разбива се без миксер и може да му се правят вариации с плодове:

1 чаша захар
2 чаши брашно
1 бакпулвер
1 ванилия
1/2 чаша мазнина (олио примерно)

Разбивате с бъркалка и изсипвате в намазнена и поръсена с брашно формичка. Печете на силна фурна, както обикновен кекс.

Тук е момента да спомена, че ползвахме пълнозърнесто ръжено брашно, кафява тръстикова захар и зехтин. Това са вариации по неволя, нямахме друго просто. Стремим се в кухнята ни да няма много изкушения.

Консистенцията на изпечения кейк не е като на традиционния кекс, не е така пухкав и мек, прилича повече на плътен хляб. Ето защо след като изстине го нарязвате по удобен начин, според формата за печене, която сте ползвали и намазвате хубаво със смес от добре изцедено мляко и домашно сладко (ние ползвахме от череши, освен това минахме сладкото малко през миксера и оставихме само няколко цели череши вътре, за украса). Оставяте леко да поеме влага и е готово за хапване.

Докато сме на въпроса с десертите, отцеденото кисело мляко е страхотна основа за всякакви вкусни сладкиши. Ние ползваме 1.5% или 2% мляко и го отцеждаме за няколко часа. Водата ползваме като айран, доста е солена между другото, вероятно купуваме мляко, в което добавят сол, макар да не е означено на етикетите.

След като е отцедено разбиваме млякото с нещо сладко, често това е мед или домашно сладко от ягоди, череши или друг леснодостъпен от село плод. Плътният сладък вкус доста добре подтиска глада за млечен шоколад. Ако пък обичате ядки, може да се добавят в сместа, става доста добре, но аз лично не обичам никакви ядки. Консумирам ги само много фино смлени в мюсли или в смеси като тази.

Освен че има по-малко мазнини от обикновения шоколад (калориите в такава смес са около 2 пъти по-малко от колкото в шоколад със същия грамаж, това разбира се не означава да ядем два пъти повече от млечните смески), по-голяма част от калориите са за сметка на протеина, от колкото в шоколадите. При някои хора поемането на протеини подтиска глада за по-дълго време. Простата истина е, че след определена възраст повечето българи просто приемат твърде много калории. Дори и да спортуват, стегнатите мускули са покрити с мазни слоеве. А колко от нас всъщност спортуват до толкова, че да поемат по 500+ калории на ден над норматива си. Аз не!

септември 16, 2011

what good is youtube

Recent check on my old blog (in livejournal) fir 'music' tagged posts reveals the following: 80% ot the linked YoutTube videos are now gone. So what good is youtuube then - you share something from the site and you cannot know how long it will be there! So it is good only for sharing stupid hoe videos, like the kid after dentist appointment! Fuck youtube!

септември 12, 2011

Смотан педал в ефир

Става дума за Миро в предаването "Гласът на България".
Само за една вечер малоумните му коментари минават всяка граница:

Коментар номер 1: "сигурен съм че това зпълнение направи едни "щастливи" хора още по-щастливи (за песен на Лили Иванова)

Коментар номер 2: (към Марто) Неудобно ли ти стана (след като на сцената танцуваха двама полуголи красавци за "украса" на песента на Lady Gaga.

Сценка (не е коментар но си е номер 3): Какви бяха тия заигравки с девойката, опипвания, въздишки и тн? Горещо му станало. Таратанци.

Мирославе! Гей с гей такъв! Престани да се правиш на мъжкар, че вече всички ни е гнус от поведението ти. Водиш по гнусотия дори пред тая кокошка Мариана с нейното "Ами щом хората го харесваааат... аз нямам коментар". Що нямаш? Щото туркиня изпя българска песен за това ли нямаш? Ами за Александър, който изпя турска имаше ли? Тъпа пача. Много разбира от музика вече. Онзи път когато пя с другите ученици видяхме колко струваш. Най-зле пееше от всичките!

Изобщо в България всички са големи разбирачи и разбират от всичко и смятат че трябва да се покажат колко са ербап по национална телевизия. Аз знам, че Мирослава е тъпа овсъ, достатъчно обикаля педерастките чатове, та е налитала и на мои познати. Ама то бива наглост бива... всичко си има граници!

Decision making and MLM

Recently I was about to attend a presentation by Zepter about their Steam vacuum system.

I decided not to attend and instead take the decision in favour or not or the purchase on my own time and by my own means. What I mean by that is the known fact of decision fatigue: this is, when you are tired of comparing options at the end you just give up and you make no rational decision. Which is exactly what the sales representatives want. Of course this post is not to blame them, as anyone has to make their living and does it by its means. However, knowing about the facts on how we make decisions is very important.

I need to clarify that I do use and I do like Zepter products, I have used several and I am very happy with my purchases, I am using the company just as an example here because of their direct marketing strategy which is working partially by pressing the potential buyer into a purchase, part of the methods used derive from decision taking fatigue.

More about the studies can be found here.

How is this performed for Zepter presentations. First of all you are seated for at least one hour, during this time probably someone is cooking something which will be given to taste at the end of the presentation. During this time you are constantly bombarded with "facts" (I put those in commas because the real name of those is "claims", not facts, for example Zepter claim that during cooking all vitamins are preserved in the food which cannot be physically not chemically true, unless during cooking the food is transferred in a parallel universe where the vitamins are not destroyed by the high temperature, for this to be fact there should be some real measurement done by certified laboratory and the data from the tests as well as how the tests were performed should be available to the buyer, this is never the case! Even if it was the case, how many potential buyers would have the possibility to check on th laboratory credentials in this one hour time frame?)

As the products are described one after another and sometimes marvellous qualities and functions are imagined and described with great confidence you start to think that Zepter is selling everything that you need, and mostly what they sell is what you need indeed. As mentioned in the disclaimer above I do use their products, still I am not in agreement with their methods of selling it! At the end you are presented with the astronomically high prices and you have to make the decision. You are now really hungry,  (see reference link) and you have to choose from so many wonderful things! Now is the time when the consultant/manager/whatever uses its powers over you - to push you into a contract. They know what you came for (usually you are invited by a friend or colleague and they know why you are there) and subtly guide you into purchasing it. The beauty of it is that a day later you know you have spent too much money on something you might not really need, buy you are completely sure you have made the right decision. As to quote from the NYT magazine: "By the end, you could have talked me into anything".

Notice that not "decision" fatigue  is the reason you buy, but the slight guidance from the person who sells you the stuff. Also notice that the less money (i.e. less options you have on purchasing everything you liked on a presentation) the easier is to be pushed into making a certain purchase. This is a well known also, rarely people with lots of money attend those parties, unless they are "in the game". If you have the option to purchase anything you could hardly be rushed into purchasing anything. This comes from the fact that we are constantly bombarded with money decisions and we just do not want more of those. Each time you have to think of money it is a decision making. To purchase this or that!? But the money is not the only object, when you do not have enough to make mistakes (i.e. buy the one you randomly choose at the moment, then decide if you like it or not and possibly purchase another one with similar capabilities/qualities).

If you want to go to a presentation on a MLM - go. Here everything you want to hear, take notes and then go home. And forget about it. After a month re-open the notes taken and check all claims (you could start online - it is cheap and easy). Then compare products! Always compare products. Then check your needs. Often you are lead to believe you need all functions/capabilities of a product - usually you do not! Why would you need 2 vacuum cleaners?! Also be aware of the "additional purchase" - if you are offered to buy an item for 1000EU but if you decide to take a second item with face value of 300EU the whole purchase will be 1100EU. This is an easy way to sell things that are actually much cheaper - for the example with the vacuum cleaned you get an ironing board/ladder. Which is priced at 320EURO!! Excuse me! No thanks, I just want the freaking vacuum machine.

Let me tell you a trick in the marketing. Lets say I am seller 1 and I have an item priced at 100$. Exactly the same item is priced at 95$ at seller 2's shop. Now, you can come to me and say: hey, seller 2 sells it for 95$. I will tell - well, okay tell you what, you could pay 100$ here but you get a second item for free, which otherwise would be 15$. So for 100$ you actually get items for 110$!!

And here is the trick. The item actually costs me and seller 2 60$. If you buy it from seller 2 he gets less but I get nothing. So i am offering a second item, which is often with even bigger earning points: lets say 5$ and I put face value of 15$ on it. In the final calculation I have made bigger profit than seller 2 anyway and you get a completely useless second item (a simple example would be a new PC as item 1  and item 2 would be "stereo speakers" - with awful sound quality which is hard to sell anyway).

Lesson number 1: never, ever make the purchase on place. take your notes at home and check out the competitive products. Compare everything you can think of. Then if you doubt about a certain aspect of the product contact the sales person again. And demand for concrete details, not some vague answer like "Ooh, don't worry, it never happens with our products".

Lesson number 2: always refuse the additional products, no matter the "saving" you get. If they are so eager to sell you the expensive item try to negotiate lower price on it instead of taking the "free item".


Lesson number 3: Do not get involved! If you happen to make the purchase anyway and you happen to like the product do not fanatically start to buy anything the company has to offer! And do NOT recommend it blindly. Instead advise the people seeking recommendation to repeat the same process you just read about. For their case this might not be the right purchase.

Lesson number 4: do not over-think it. If you think about a purchase for longer than 3 months you probably can go without it anyway. Also, consider future possibilities. Simple example in those MLMs is introduction of a new product (same example - Zepter vacuum) - price at introduction - 1500Euro. Price after a month 1950Euro. This is a SIGNIFICANT price difference! If you can wait for 3 or more months for a product you can go without it for a while longer and wait for a better deal on it. And no, the new, better model is not from other space. Think how would you have felt if you bought the old model and a month after that there is a new one! Much better. Nah...

So this is it. I hope you think twice next time on those presentation parties. I still do not understand why they call them parties. No one seem to have fun there...