My Journey Through Code Debris

Today after watching Uri Lavi and Ade Oshineye's informal talk at GDD11 event in Tel-Aviv, i've thought that it is an incredible idea if people from the community will share a post about how they started out their journey. What made them choose this path, what helped them, what excited them and what didn't.

In this post I'm going to write about few situations that i faced through my journey and what i learned from them.


I read quite a few posts on how people got into programming and many start with "My father brough a PDP from work...", well my Mother holds a Masters degree in Computer Science and back at the day she worked in a nearby college as an operator, but "In Soviet Russia you don't bring a computer home, you bring yourself to a computer" because they were freaking huge even at the late 80's. In fact the first computer that we got was Pentium 500Mhz in year 2000. Neverless, the view of wardrobe sized computers and a room filled with terminals ignited my interest.

You don't need a computer to program, but a good imagination. For years i was writing and running snippets in my head and tried them on a computer when i had a chance. Being able to code anywhere is a good training for your mind.


Mainframecomputer

 

I learnt actual programming at 6th grade. My computers teacher Sergei Lukin(who had a huge impact on me) at that time was writing a book called "Turbo Pascal 7.0 a guide for beginners" and he happily agreed to teach me and few other students the basics of programming. We were meeting after school hours at the computer lab and learning using the draft of his book, doing all excercise and getting helpful tips from him, the group quickly reduced to 2 people, but he still kept spending time with us at the evening for what i'm very thankful.

This experience taught me that there's always people who are willing to share and spend their time to help you increase your knowledge. If you can't find one then you're not looking hard enough.

When I was 14 I've spent almost a year in Mumbay with my father who had some business there. I went to a "IT college" to study C/C++ and that was the first time I faced the realities of software industry. People that I met there didn't care about the craft and didn't find it exciting at all, they took 24 different courses starting from C and ending with sql and had skills of below avarage in each of the subjects they learnt. As a kid i never thought of this craft as a source of income and this experience shocked me and still does.

There's a lot of programmers in the world, even more than we need, but there's not a lot good programmers. You can't get good at something without being passionate about it.

 

The-matrix

 

At one point i got into MUDs and decided to figure out how they work. I got my hands on a code base called CircleMUD that was written by Jeremy Elson. My mind was blown off. I hacked through it for a few weeks modifying and adding new functionality which was extremely fun. I ended up borrowing some coding style and loads of new useful techniques that I still apply in my code.

Reading other peoples code will greatly improve your skills especially if the person who wrote it is much more experienced than you. Reading advanced code could be very difficult, but the benefits of not giving up to understand it are worth any time that you will spend.

When I got an internet connection at home I naturally decided to use it to improve my programming skills. The problem was that at that time there weren't many resources in Hebrew or Russian that you could find about the topic so i was forced to read material in english which i knew on a very basic level. The solution came from Freenode irc where I stumbled on a room with guys from around the globe who were as excited about programming as mee and didn't mind my broken english. In a very short time my english and programming skills were greatly improved.

Find a group of likeminded people who share your passion and dive right in. Don't be afraid if their skills are surpassing yours, because frequent communication and involvement will quickly bring you to their level.

 

Mind-set-people

 

I went through a long road before turning my hobby into a proffession, and even now i'm still excited about it. The above list is incomplete and there's much more lessons that i learnt through the years, but this post is already to long and i'll leave it for some other time or you always can contact me on twitter or in person.

Azure is Not Genuine?

I wonder what's up with that. How hard is to get genuine copies of your own product?

Notsogenuine

Why Resharper 6 is annoying

First of all I want to make it clear that I simply love Resharper and Jetbrains support. It made my life so much easier and allowed me to stop worrying about the less interesting things that happen in my code.

Resharper6

At work I use both C# and VB.net, but until recently I had a C# edition of R#. Ever since I have installed Resharper 6 Beta weird things started to happen in VB code. First the intellisense started to disapear at random times and visual studio simply refused to fire it up and it felt like i'm coding in a notepad with some basic highlighting. I tried to disable R# and it helped to solve the issue at times and at times not. Ofcourse after i've mentioned it on twitter a R# dev got back to me, but he was unable to reproduce the problem.

I thought ok, it's a beta and it's only natural for it to have a fuck or two. In the release version it didn't get any better, so few days ago i've decided to upgrade to the full version of R#. It was awesome, finally I could play with VB code like I did with C#, but not.... Suddenly it refused to autocomplete any field names in the class and for some unknown reason after property names I started to see red VS underscores that suggested me to generate a stub/field/etc. WTH

 

Let's sum it up with a short list of annoying stuff that i've noticed:

  1. Autocomplete dies in VB if you have only a C# version
  2. Prevents any realtime error checks in VB and you must compile to discover them (C# version)
  3. Refusal to autocomplete property names that were declared in the same class
  4. Red VS underscores after property names that suggest to create a stub/field
  5. In Web forms in aspx pages disapeared autocomplete for tags with asp prefix
  6. In Webforms properties in aspx which you declared in code behind are for some weird reason coloured in red suggesting that they don't exist

That's only a small list of annoying things that i've found in R#6 and somehow all of them are related to VB.net. One might think that I could have a problem with my VS, but that bahaviour is observed on two different computers, so just in case that -BOTH- of my computers are broken i'd love to hear from other R# users if they had the same problems.

Now where do I submit a patch? :-)

 

Useless Tests

So i was browsing on github through projects to see how people write tests and I stumbled upon some weirdness. For example in Holman's Boom! project tests he continuosly tests for Item/List name even that he just set it up. What he actually tests here?

Is it a test to see that the costructor parameters are assigned to the correct properties? For some reason this looks to me useless and not very expressive. Correct me if i'm wrong.

Another weirdness is this little test

What's the point of asserting a list on being empty at the very start of the test? It is going to be empty if you set it in the setup. Ofcourse it might be a way to draw attention to the emptiness of the list in this particular situation. How would you handle such situation?

Got some real WTF tests(not like mine). Send them to me and i will include them in the post.

New fonts on the blog

I was playing a bit with my Posterous theme today and I've noticed a new option available in advanced themes, called "Typekit". Now, I do have a typkit account for some time now, but for some reason I have never thought of using it on my blog. Anyhow, I've quickly updated my fonts to "Myriad-pro" (Adobe fonts rock!) and I think that it all looks really awesome and shiny. Compare the changes and tell me what do you think! I'm also available on twitter as @stageev.

Before

Roomd_old_fonts

After

Roomd_typekit_fonts

Model Binding Collections on Postback in ASP.NET MVC3

For some of you this topic might sound very obvious, but for me it wasn't and made me burn few hours. Usually you have a predefined view model like this:

Then you build a view and declare it to be of the above type so that the model binder will do all the hard work and bind it to the correct type and properties on postback:

and action code:

Perfect! it does the job and gives you the data in an easy to handle format. Now let's say that you have a poll with question and user typed answers and you want to get it's data as a nice collection after postback. My first failed attempt looked like this:

This resulted in null result in the veariable. Bummer! After some investigation I have figured out that the above code produces input names with which the model binder just doesn't know how to deal. Every kind of input got the same name which is cool when you attempt to build a radio button list. After more detailed investigation I came to a realization that the model binder expects names which resemble the full path to the variable it's about to bind. For example if you want to bind user.credentials.name you'll have to supply credentials.name as the input name. Following this logic if you want to bind a collection you should work with arrays(THE HORROR) and input names in our case should look like this: [0].Answer, [1].Answer and so on... Fortunately built in html helpers will serialize names correctly if you will provide it in your linq code like this:

Now everything works as expected. Good luck with further coding.

Cleaning remote images from taint for use with html5 canvas

Few days ago i bought a kindle version of pro html5 programming book, and the first thing that caught my attention was a complete failure of my Kindle for mac to download my new purchase or do anything else useful. Moreover, it seems like Kindle app configs got screwed up for no apparent reason and forced me to delete them out of rage, which in turn fixed the shit up.

Anyways, after reading the first part of the book (which consisted mainly out of annoying repetitive phrases and boring facts) and playing a bit with the canvas element, I have managed to reproduce author's example and to feel a bit of the power which canvas element brings to our lives.

Future now seems all pink and filled with ponies, rainbows and developers 40+ who get instantly hired, or not. Through the first chapter authors continuously referred to the black magic we now use to make our applications interactive and dynamic, and how html5/css3 changes everything. While a lot of things which were a pain in the foot became very straightforward using html5 and css3, new functionality introduced it's own pains and limitations.

One of the more useful and powerful canvas features is manipulation of it's contents by getting direct access to pixel data. Feature which renders useless when you use an image which you fetched from a source other than your own domain. Once you used an external image in your canvas element, it becomes tainted and on every attempt to read data from it it throws a security exception. This behavior is explained as a security measure which seems valid from the first glance, but feels like a total rip off especially now when XHR level 2 gets cross-domain requests.

In a real world, hosting images on the very same domain as the application is problematic. From one side there's a limitation for amount of requests allowed to be executed in parallel for every domain. From other side there's an IO overhead when hosting everything on the same box. One might argue that it's easy to set up nginx to fetch media files from a different server, but this still voids out any usage of cdn and all the advantages it brings.

After some research into the topic I came up with fetching images through xhr requests, xhr 2 to be more specific. The new standard promises us a way to fetch binary data and make cross-domain requests. This is what i came up with:

This seems to do the trick and strip the image from any origin indicators! I know that the example uses a local file, but it should work equally well with a remote image if the remote host will include in his response header "Access-Control-Allow-Origin: foo.com" where foo.com is your domain. I did test it on an actual server and it worked like a charm. On the server hosting the image i had to add Access-Control-Allow-Origin: mydomain.com" in order to allow cross-origin xhr requests. If you could make your cdn provider add such values to the response header it will do the job(CDN providers usualy allow you to set custom header values or like in case with my cdn provider maxcdn, they honour any headers passed from the origin).

Kittens

This code should work in latest FF, Chrome and Safari, but will fail in IE. For IE there's few work arounds that anyone should be able to do easily(It involves using VBscript and similar porn)

Somewhere over the rainbow, way up high

The most annoying thing ever is when a service/product provider/vendor is ripping off his clients by selling them overpriced service/product by using trendy words which have little to no relation to the solution itself. Just off the top of my head I can recall when people were selling software labeled as made in "Object Oriented" language, or overcharging for site development by claiming that it's using "Web 2.0 technology". The one that makes me laugh every single time is when I see someone offering "SEO Hosting", which is based on anecdotal assumptions, outdated and incorrect technical explanations, and plays on sometimes a maniacal wish to be on the first page of Google.

Cloud computing is a relatively new field from a natural evolution of distributed computing and virtualization. Like every new field with growing popularity and excessive coverage in various print and digital media resources, its name is used as a "brand" to tag services and products by companies who care more about making quick profit than delivering the actual solution.

So what is a cloud platform? In essence, a cloud based infrastructure is built on top of virtual machines, with emulators that emulate computer functionality that allow it to run operation systems usually run on physical machines. While it may seem like a huge resource trade off, in reality when it is implemented correctly, such an abstraction introduces nearly limitless resource growth which is extremely hard to accomplish otherwise. Cloud infrastructure providers usually provide their clients with an API access to resource management which allows them to automate the process of resource allocation or deallocation. Some providers automate resource allocation by detecting the demands of an application at any given point of its life cycle.

Some advantages of using a cloud infrastructure approach are:

  • Eliminating the need to purchase, install, upgrade, and troubleshoot hardware
  • You pay only for the resources you allocated and stop paying once you are done using them
  • Easy to automate
  • Quick and easy to deploy
  • Reduces the need to maintain a huge staff


Another type of cloud based hosting is provided by software vendors. Over the last few years, many startups started to build their business around cloud infrastructure for its obvious advantages and attractive prices. Most of them are providing their software solutions as a service running on a cloud infrastructure which is also managed by them. This kind of service is known as software as a service or SaaS. You, as a user, only need to select a plan then a system is deployed in a few minutes, if not instantly.

Some advantages of SaaS include:

  • Instant availability
  • No need to maintain an infrastructure
  • Eliminates any IT troubles
  • Extra resources on demand
  • Considerably cheap
Technology has undergone a long and exciting evolution process in the past 20 years and cloud computing is one of the more exciting of the recent additions. As much as it's exciting to see new powerful and useful advancements, it is also very hard for most people to follow and educate themselves about them. This fact is exploited very cleverly by a lot of companies in an attempt to sell you their product or service. If you are ever offered a product which is tagged as "cloud based" but does not fall into one of the above descriptions, then it is most likely a scam.

New blog for not so new domain

So I bought this domain name some time ago, and it kept being unused for anything useful but emails. It's not after I begun overusing twitter, that I came up with a thought that it could be convenient to be able to sometimes post messages longer than 140 characters. So here I sit, with a newly created blog and zero motivation to write anything useful(before I get to sleep at least few hours).

In future posts; I will be talking about things that matter to me. Which mostly are things related in some way to programming, cloud computing or cool online services/startups. If you want me to talk about a specific topic of your interest, then you're welcome to contact me on twitter or by email.

Good ni..*yawn*..ght everybody.