Raba - Defend your code RSS 2.0
# Friday, January 18, 2008

After updating the blog to the 1.9 dasblog version - I hope that now I could write my code better.

int j = 5;
GoGoPowerRangers();
foreach(int i in currentList)
   Console.Write(i);
 
Friday, January 18, 2008 7:49:08 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
My Site
# Wednesday, January 16, 2008

I am not going to explain here nor about MVC neither about the ASP.NET 3.6 (yes it is 3.6, they didn't tell you that?!) I just gonna write a little bit about a sample application I wrote to myself.
Those of you who want to learn more about MVC (the pattern itself) - you can read in Martin Fowler's post or maybe here at wiki anyway there is even a better place to learn this in the Head First - Design Patterns book.
Also you might read about the new asp.net MVC Framework (CTP), you can choose whether to read this (long but very important article) or you can see the intro webcast (damn you lazy programmers)

Microsoft are doing well to cause us work harder just to learn the technology, this asp.net MVC implementation is awesome but It is a huge change for all of you ASP.NET people, I hope I find the time to write more about it, but here is one sample I wrote for myself.


                                       From Request to Response through the MVC Flow

On each request there is a place that the Controller has its constructor calls and this will initiate your logic, I found it very useful to manage this controller creation. In this example I create my own Factory and there I manage to create the controller using another constructor (not the default one), moreover I can also add my own logic such as Security Check (in our sample) or something else useful.

Here is my own Controller Factory logic:

1 public class ShaniControllerFactory : IControllerFactory 2 { 3 #region IControllerFactory Members 4 public bool IsUserExists 5 { 6 get 7 { //Put here your great Logic 8 return false; 9 } 10 } 11 public bool IsUserAuthorizedForEdit 12 { 13 get 14 { //Again Special Logic for Checking Authorization 15 return false; 16 } 17 } 18 19 public IController CreateController(RequestContext context, Type controllerType) 20 { 21 IController controller = null; 22 if (!IsUserExists) 23 { 24 controller = new NotAuthorizedController(); 25 return controller; 26 } 27 28 //Distinct between those two 29 if (!IsUserAuthorizedForEdit) 30 { 31 controller = Activator.CreateInstance(controllerType,(object) false) as IController; 32 } 33 else 34 { 35 controller = Activator.CreateInstance(controllerType, (object)true) as IController; 36 } 37 return controller; 38 } 39 40 #endregion 41 }

You can simply see the CreateController method (lines: 19-38) where I put my logic for the Controls initiation, and I simply prefer creating them using my constructor (the one with the bool parameter) and not using the default one.
But, How will we have this Controller Factory running instead of the generic factory? It is very simple:

1 protected void Application_Start(object sender, EventArgs e) 2 { 3 ControllerBuilder.Current.SetDefaultControllerFactory(typeof(ShaniControllerFactory)); 4 5 RouteTable.Routes.Add(new Route 6 { 7 Url = "[controller]/[action]/[id]", 8 Defaults = new { action = "Index", id = (string)null }, 9 RouteHandler = typeof(ShaniRouteHandler) 10 }); 11 12 RouteTable.Routes.Add(new Route 13 { 14 Url = "Default.aspx", 15 Defaults = new { controller = "Home", action = "Index", id = (string)null }, 16 RouteHandler = typeof(ShaniRouteHandler) 17 }); 18 } 19

You can see at line 3 (within the Global.asax), this is all I had to do for setting my controller factory as the default factory.

You can also think about another good examples on your own, I've found a great post about TDD and Dependency injection with asp.net MVC by Phil Haack - Read the whole post it is a great one, at the end he is creating his own factory for managing the Control creation using Dependency Injection.

Enjoy.

Wednesday, January 16, 2008 12:04:15 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Asp.net MVC
# Tuesday, January 01, 2008

My managers came to me and told me that I must take a vacation for the end of the year. So I found myself yesterday on the night of the new year at the kitchen start cooking a special dinner to my girlfriend (vacation means no work at home too).
I already cooked before but this time I tried Sushi, all you out there it is damn easy (and delicious), try this at home.

Here are some pictures from my first Sushi (pictures taken using my Logitech Quickcam) -

 

Here are some good links (Sushi-Casts) for all of you PC-boys out there (without kitchen experience):

http://www.5min.com/Video/How-to-make-sushi-rice-1498
http://www.5min.com/Video/Making-Tuna-Maki-1435
http://www.5min.com/Video/How-to-Make-California-Roll-Sushi-1283

Sushi & Software development:

Making Sushi (or food) is like coding, first you need to know the language (ingredients), afterward you need a little debugging while cooking or doing your stuff (integrating the ingredients together) and at the end you need to listen to the users, So: I am waiting to you, my friends, to come and taste it.

You also need a prototype for starting, after the first prototype you will probably need to make some changes, this things you can't learn from watching videos or reading books alone, you need to roll up your sleeves and start working.

Special thanks to Nati (the Sushi master).

Tuesday, January 01, 2008 2:36:35 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Life
# Friday, December 21, 2007

The new version of AGX is out, you can found more details in here.

Here are some things I found out:

  • My old tasks works
  • Tab index (inside the tasks) is finally working properly
  • The streaming looks slow - even very slow I'm not sure if this is because of my networks problems or because of ESRI's servers but it was better with the previous version
  • Better handling the outer links (having a bug while opening a site it also opens: "about:blank" empty window near it)
  • More cool icons for instead of the simple pushpins

Still (really) missing

  • Scale bar (on the bottom of the page, or even in task)
  • Simple "Add connection" to Google Maps (servers) & Virtual Earth (servers)
  • SDK for 2008 (The given one fits to 2005 only)

Here is a simple result I make using the new popup window:

Enjoy.

Friday, December 21, 2007 1:42:07 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
GIS | AGX
# Saturday, December 15, 2007

After one year of implementing Scrum at my place, I was asked to give a lecture to a new Team-Leaders, This Wednesday I will have my first Scrum Session, I spent a lot of time for the last few weeks to create a cool Presentation, I've also spent some time reading lots of data (some of them even more than once) about the Agile manifesto and its different methodologies.

I will update later on about the first session (next week). But to my readers I will give one great tip, two books bonus for a better start for your agile development:

Agile Software Development - Alistair CockBurn

This two books are "better together" - While reading them both you will understand:

  1. Why to choose Agile (Or: The Values of the Agile manifesto)
  2. Better Understanding for the problems within methodologies (Not only the non-Scrum ones)
  3. What is agile at all - I've found many people not understanding the meaning of being Agile.
  4. What is the difference between the methodologies (Scrum, XP, Crystal etc.)
  5. Implementation (especially Scrum at Ken Schwaber's book)
  6. and many samples from the experienced writers.

And here are some bonus links to my learning phase for the last year (stories from the last year as a Scrum-Master):

  1. Scrum methodology - the scrum master
  2. Trying to manage the team-pace better (or- Entering to Scrum For TeamSystem Template)
  3. Improve your scrum Environment
  4. Scrum for Team system feature requests

And here is one article I've found while start writing (back in the past while I didn't even know about being Agile)

  1. Acceptance Tests

I hope you will enjoy those books (and links).

Saturday, December 15, 2007 11:31:58 AM (GMT Standard Time, UTC+00:00)  #    Comments [1] - Trackback
Agile | Scrum
# Saturday, December 08, 2007

While trying to run a Windows-application with a private DB (SQL Server 2005 Express Edition) on a client machine (Window Vista), I have regard with a problem entering the master DB.

After a few seconds I've found this one: http://www.microsoft.com/sql/howtobuy/sqlonvista.mspx
Download and Install SQL Server 2005 SP1, that should solve the problems.

Update 1:

  • Pay attention that the sp1\sp2 don't need an SQL Server to be installed - it hold the whole package within.

Update 2:

  • Windows Vista have strict privileges within its program files directory, so while deploying the DB There it holds it as a read-only DB.
    Put your DB in the SQL Server Directory to solve this problem.
Saturday, December 08, 2007 5:34:49 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
SQL Server 2005

Try this out, I might admit I waste half an hour before Google-it-up: http://www.supuzzle.com/supuzzle.html

I hope you will succeed it.

Saturday, December 08, 2007 12:42:23 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Life | Software Development
# Wednesday, November 28, 2007

Here at Doron's post about Object Initializers he raised a question about the IL generated from the compiler while generating Object Initializer.

            //Object Initializer
           GeoPoint point1 = new GeoPoint() { 
                             X=22.555,
                             Y=36.444,
                             CoordinateSystem=GeographicCoordinateSystem.Wgs84 };
            //Associative Init
            GeoPoint point3 = new GeoPoint();
            point3.X = 22.555;
            point3.Y = 36.444;
            point3.CoordinateSystem= GeographicCoordinateSystem.Wgs84;

That two samples are not the same, this is because of not having an atomic assignment possibility at the second piece of code.
you can have further reading at Bart's blog post.

Enjoy.

Wednesday, November 28, 2007 6:08:08 AM (GMT Standard Time, UTC+00:00)  #    Comments [2] - Trackback
.Net 3.5 | C#3.0 | LINQ
Archive
<January 2008>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789
Disclaimer

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

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