Raba - Defend your code RSS 2.0
# Wednesday, February 16, 2011

Nir just finished coding his new module, simple read-only entrance page that renders grid of products with its name underneath, each name links to the relevant product page.
This feature was deployed a week later. After deploying to production we find out a new bug that wasn’t discover during QA phase.
Our team has 5 developers which each of them committed at least one feature for this release. After cursing and blaming I scanned the latest release notes to find the possible features we just deployed I’ve found out that the bug should be part of Nir’s implementation. of course that Nir already started his next feature and need to have an expensive context-switch to resolve this issue. Additional overhead which can’t be avoided in order to understand whether we need to deploy the hotfix right away or we can wait for the next version, not talking about synching between other bug-fixes.

Sounds familiar? Do you release versions too? Try thinking of releasing features.
Think about it, release the feature when it is DONE. don’t wait for others.


   Releasing all features in one planned ahead release, check feature #5 – that will need to be queued till the next release\train


     Releasing a feature when it is done. feature #5 will be released when it is ready – no need to wait for the next train


So, Putting the technical details aside and the context switch we already explained, try to think about your product managers – they’re going to love you.

                 Read more about ideas-code-data 

In Delver we started our journey to continuously deploy to production. Read more here.

Meet Nir Altmark, a good friend of mine and a teammate at Delver he is a gifted developer who knows how to get things Done.
Nir just published two new posts about releasing faster and Building confidence between QA and Dev – well written. Read them to have a better understanding about this process.

Wednesday, February 16, 2011 6:33:27 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
continuous deployment | Software Development | Lean

# Wednesday, January 26, 2011

This is my second post about AppHarbor, I suggest you to read my first impression.

I am reading a lot about continuous deployment lately and AppHarbor provide great implementation for simple web applications deployment.

  1. Source Control – Support Git to host your code
  2. Continuous integration – Check build per commit and run NUnit as part of each build
  3. Deployment Script – Each successful commit can be deploy in one click
  4. Rollback – Even after passing build and tests it can be that you still have bugs, so you can simply check older version and deploy it till you commit a fix

Code and publish is so easy, this is by far this better than using FTP for such things and the option to run tests makes it even more fun.


The option to rollback to previous commit\version is trivial but so important. Moreover, by clicking on “show” you can check the build log and see the tests-run.


You can click the tests link to read more about each test


Tip - UrlParameter does not exist:

When first trying to deploy my code it failed during compilation. I got this output:

  Global.asax.cs(18,67): error CS0103: The name 'UrlParameter' does not exist in the current context

I am not sure why, it could be that I am using early beta (didn’t update for a long time), anyhow I fixed this by changing the global.asax.cs from using UrlParamters.Optional to "". You can read more here: http://haacked.com/archive/2010/02/12/asp-net-mvc-2-optional-url-parameters.aspx

Wednesday, January 26, 2011 11:08:47 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net 3.5 | Asp.net MVC | continuous deployment

# Tuesday, January 25, 2011

Everyone knows Google app engine But what about .net apps? Meet AppHarbor (Thanks Gadi)

So I wanted to give it a chance and after playing for less than an hour:

  • Enable you to build \ host \ deploy web apps
  • Provide both Version control and hosting service
  • Absolutely free (for now)
  • Damn simple

Short tutorial on how to do it:

  1. Create your appharbor account + create new application
  2. Hopefully you have Git installed (msysgit downloads)
  3. Init empty Git repository
        git init test1
  4. Copy your files to this directory (download from here: https://github.com/appharbor/appharbor-splash )
  5. Add files and subdirectories
        git add .
  6. Create your remote repository
        git remote add appharbor https://username@appharbor.com/test-178.git 
  7. Commit your code
        git commit -m 'firstcommit'
  8. Almost forgot, we are working on Git - so don't forget to push...
        git push appharbor master

Till here everything should work but I had a small issue, got this error: error setting certificate verify locations:
I've found out that it is all about versions (git --version) - So check yours and upgrade if needed

Here you can find great cheat sheet for Git commands: http://ionrails.com/2009/08/07/git-commands-adding-and-committing-cheatsheet/

Btw, AppHarbor support Databases and Running unit-testing after successful builds – I will post about those features later on.

Tuesday, January 25, 2011 1:49:00 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net 3.5 | Asp.net MVC | Agile

# Saturday, January 22, 2011

Lately my “find usages” (shift+F12) stopped working.

I tried to restore ReSharper again and again but it fails (ReSharper –> find usages –> General –> restore ReSharper)

I’ve found out that some other shortcuts still working (for example: find usages advanced, CTRL+SHIFT+ALT+F12)


Then I checked the visual studio binding (Tools->Options->Keyboard) and find out that ReSharper.Find binding is missing.
I thought about fixing this manually – but god knows what also is not working.


And then I found out the magical button called RESET -> clicking on this and running the restore ReSharper again solve this issue!



Saturday, January 22, 2011 10:41:55 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
.Net 3.5 | Microsoft Products | Software Development

Following Oren’s post I thought it would be great to post my feedburner too.

subscribe to my new feed - http://feeds.feedburner.com/human-debugger
also changed the Rss-Icons to point to the new feed – so feel free to click them Winking smile


Saturday, January 22, 2011 10:24:05 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
My Site

Finally I’ve found some time to customize my blog with tiny change:

FB:Like Plugin – Whenever you LIKE it – let me know. This will be shared with your friends and help me spread my ideas.

Tip #1 - FB:Like Plugin
If you are using dasblog and you want to add this to your theme use the PermaLinkUrl macro - href=”<%PermalinkUrl%>”

Tip #2 – measure using FB insights
You can track the trends here http://www.facebook.com/insights BUT in order to see it you should add meta-tag your head <meta property="fb:admins" content="user_id" />

Have fun.

Saturday, January 22, 2011 10:17:11 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
My Site

# Tuesday, August 24, 2010

Delver is a “Social Shopping Platform”, You are more than welcome to check our website at www.delver.com

We are still in “closed beta” but, leave me a comment or an email and I will send you an invitation.


We also opened our Blog where we will post about new features, technology and other cool stuff.

Tuesday, August 24, 2010 9:07:42 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback

# Saturday, July 24, 2010

After we understand what video stream is all about and we wrote our first piece of SWFObject in Javascript. let’s try to have this working on our servers, of course that such things tend to fail. But let’s understand why…

First thing we need to understand is whether such failures occur due to my code, file format or server configuration.
let’s have a simple check trying to access the file directly using our browser.


configure your IIS to serve the following files: swf and mp4 using Static Content

<add name="FlashFiles" path="*.swf" verb="*" modules="StaticFileModule" scriptProcessor="" resourceType="File" requireAccess="Script" />
<add name="VideoFiles" path="*.mp4" verb="*" modules="StaticFileModule" scriptProcessor="" resourceType="File" requireAccess="Script" />

Setting handler(s) won’t be good enough, requesting the server again will return “404.3 – mime type missing”.
Don’t worry Adding new  mime type to IIS 7 - is easy:

            <mimeMap fileExtension=".mp4" mimeType="video/mp4" />


While installing the static content on our static servers (apache) – we’ve found out that requesting the files from firefox return with “no content length” and “incorrect mime type”
adding the correct mime type to the /etc/mime.type

video/mp4     mp4

Check the Request\Response we’ve found out that our servers are still returning compressed response , googling it find out that Firefox cann’t handle gzipped video stream,
compression was selectively disabled by adding the following line to /etc/httpd/conf.d/static.d/static.conf:

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|mp4)$ no-gzip dont-vary

Apache solution provided by Tomer G.

Saturday, July 24, 2010 11:01:30 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
IIS7 | Software Development | Web

You can read here my introduction about video streaming.

In order to embed rich media content into web pages and have our code compatible with different browsers we will use the SWFObject 2.2.
The SWFObject will render the right tags for the right browsers.

Here is a short, unobtrusive JS for showing your movie:

   1:  $(function() {
   2:    var videoBase = 'http://static-server/';    
   4:    $('.VideoTeaserArea').click(function() {   
   5:      $(this).openLightBox("<div id='media'></div>");  
   6:      playMovie('intro-movie.swf');   
   7:    });    
   9:    function playMovie(videoFile) {  
  10:      var videoUrl = videoBase + videoFile;  
  11:      var att = { data: videoUrl, width: "640", height: "378", allowfullscreen:true};  
  12:      var params = { flashvars: "autostart=true"};  
  13:      var id = "media";  
  14:      var myObject = swfobject.createSWF(att, params, id);  
  15:    }  
  16:  });


- line 2: Our movie directory, better place such content on static server or even CDNs.
- line 4: VideoTeaserArea is a class name that we spread all over our site - clicking on it will trigger the movie.
- line 5: openLightBox – on our site the movie will be opened in a light box.
- line 11: the videoUrl, will be seen in the configured size. allowfullscreen is false by default. read more here
- line 12: flashVars will be used here in order to have our movie start as our light-box will be opened.
- line 13: The placeholder we want to replace while loading the movie
- line 14: Add reference to the swfObject.js in order to have its instance(read bellow). The createSWF method is a low level API which enable combining with other Javascript libraries.

in order to have this code running we must add script tag:
<script type="text/javascript" src="swfobject.js"></script>

Now, after having embedding SWF to our site  - Let’s understand how to make this work on IIS and Apache.

Saturday, July 24, 2010 10:28:23 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Web |  Ajax |  Javascript

So our mission is to have our website play a short intro movie.


Wiki Definition

Progressive download is a term used to describe the transfer of digital media files from a server to a client, typically using the HTTP protocol when initiated from a computer. The consumer may begin playback of the media before the download is complete. The key difference between streaming media and progressive download is in how the digital media data is received and stored by the end user device that is accessing the digital media.”


Actually the “progressive download” feature implemented in most media players allows them to begin playing the file as soon as enough data received.


File formats: SWF VS. FLV

  • Both are Adobe formats.
  • FLV is a video container, intended to contain only audio\video
  • SWF can contain animations, games, applications and videos
  • SWF uses a lossless compression and is limited to a certain number of frames. Due to it is not compressed some files can be too big for use in the internet.
  • Large websites like Google, Amazon are using the FLV file formats

After this short explanation, we are ready to start:

  1. Create a video file in a common streaming media format (in our case: Camtasia -> SWF, mp4)
  2. Upload the files to your Web Server
  3. Check whether this link is working from common browsers
  4. Link from you Web Pages (HTML tags or JS)

In the next posts we will talk about steps 3 and 4.

For now you can keep reading about step 1 - here

Saturday, July 24, 2010 10:25:34 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Software Development | Web

Area 51 – GIS is a new place supported by the Stack Overflow to post your Qusetions and Answers about Geographic information systems. Part of the questions are talking about interesting issues like: Databases comparisons, Algorithms, New tools, GeoTagging, GeoJson, Kml, Map Caching layers etc.

Public beta will begin in 5 days.

Saturday, July 24, 2010 5:30:00 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback

# Saturday, February 13, 2010

Finally, after a long time I find time to upgrade my blog to the newly 2.3 version.

I had many problems installing this version Go-daddy, Monorail and SecurityException.
The last one was also the funny one, after Google-ing a little bit, I found this post by Gabel one of my co-workers.

What’s new?

So first I created my self a new homepage which you can see here.
Second, you can track my reading-list, my twitter statuses and my projects (will be published later).

homepage  readinglist

Have fun.

Saturday, February 13, 2010 12:49:30 PM (GMT Standard Time, UTC+00:00)  #    Comments [2] - Trackback
My Site

# Saturday, August 01, 2009

Test methods must be written as production code.
While writing your tests you must act the same methods you write for your production code which means:

  1. human-readable (code standard, pattern etc.)
  2. code re-use (copy paste is never acceptable)
  3. etc...

This is a code you will probably find in your test projects

   1: [Test]
   2: public void GetCommentsByQuery_LookFormHmmmText_FindAtLeaseOne()
   3: {
   4:     SvnLogParser parser = new SvnLogParser();
   5:     string textToSearch = "Hmmm...";
   6:     var results = parser.GetCommentsByQuery(comment => comment.Contains(textToSearch));
   7:     CollectionAssertExtensions.IsNotEmpty(results);
   8: }
  10: [Test]
  11: public void GetCommentsByQuery_LookFormBugText_FindAtLeastOne()
  12: {
  13:     SvnLogParser parser = new SvnLogParser();
  14:     string textToSearch = "bug";
  15:     var results = parser.GetCommentsByQuery(comment => comment.Contains(textToSearch));
  16:     CollectionAssertExtensions.IsNotEmpty(results);
  17: }

You can see that the two methods are pretty much the same, the only change is the textToSearch variable.
There are some excuses for such duplication:

  • "We want two different names... to easily understand the failiure reason"
  • "we want it to be easy to read, without context switches..." (method calls and un-needed inheritance complexity)

We, of course, can refactor this code, like this:

   1: [Test]
   2: public void GetCommentsByQuery_LookFormBugText_FindAtLeastOne()
   3: {
   4:     string textToSearch = "bug";
   5:     GetCommentsByQuery_AssertAllItemsStartsWith(textToSearch);
   6: }
   9: [Test]
  10: public void GetCommnentsByQuery_LookForHmmmText_VerifyInsideComment()
  11: {
  12:     string textToSearch = "Hmmm...";
  13:     GetCommentsByQuery_AssertAllItemsStartsWith(textToSearch);
  14: }
  16: public void GetCommentsByQuery_AssertAllItemsStartsWith(string textToSearch)
  17: {
  18:     SvnLogParser parser = new SvnLogParser();
  19:     var results = parser.GetCommentsByQuery(comment => comment.StartsWith(textToSearch));
  21:     CollectionAssertExtensions.AllItemsSatisfy(results, res => res.Comment.StartsWith(textToSearch));
  22: }

This is better when you think of clone detection: less identical rows and the logic was extracted to one method.
But people might say that they can't see the AAA (Arrange, Act, Assert) and they want it in one place,
Moreover, in such code sample, it is harder to find all the input parameters, cause they will be spread all over the TestFixture methods.


NUnit 2.5 added TestCaseAttribute, this can help us write tests that are:

  • more readable
  • shorter test-fixture
  • all-in-one-place tests
   1: [TestCase("Hm...")]
   2: [TestCase("bug")]
2: [TestCase("bug")]
   3: public void GetCommentsByQuery_LookForText_FindAtLeastOne(string textToSearch)
   4: {
   5:     SvnLogParser parser = new SvnLogParser();
   6:     var results = parser.GetCommentsByQuery(comment => comment.Contains(textToSearch));
   7:     CollectionAssertExtensions.IsNotEmpty(results);
   8: }

Here you can avoid the duplication and you won't need to refactor your Tests to more than one method, while you still see them running using the given parameter,
for example when the second parameter will fail you will see this output:

------ Test started: Assembly: App.Tests.dll ------

TestCase 'App.Tests.NewFolder1.SvnLogParserTests.GetCommentsByQuery_LookForText_FindAtLeastOne("Hm...")'
  Expected: True
  But was:  False
    C:\ShaniData\ProjectsByTitle\Delver\App.Tests\NewFolder1\SvnLogParserTests.cs(75,0): at App.Tests.NewFolder1.CollectionAssertExtensions.IsNotEmpty[T]
    C:\ShaniData\ProjectsByTitle\Delver\App.Tests\NewFolder1\SvnLogParserTests.cs(33,0): at App.Tests.NewFolder1.SvnLogParserTests.GetCommentsByQuery_LookForText_Find...

4 passed, 1 failed, 0 skipped, took 0.78 seconds (NUnit 2.5).

The output will point the given method and the parameter used - which will ease finding the error.
You can extend reading about the usage here

Saturday, August 01, 2009 5:20:12 AM (GMT Daylight Time, UTC+01:00)  #    Comments [2] - Trackback
.Net 3.5 | C#3.0 | TDD | NUnit

<February 2011>

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2015
Shani Raba
Sign In
Total Posts: 146
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Pick a theme:
All Content © 2015, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)