Friday, August 24, 2007

If you ever wondered what does it mean to have a Team Collaborate, take a look at the picture below where Adam Markowitz (ActiveFocus Chief Architect) is debugging some C# code while Jordan Halls (Executive sales manager) is asking for a customer requested feature, in the mean time, Mike Saad is holding the phone for Adam to reply to a customer's support call.  What a Team! :-)

image

Friday, August 24, 2007 9:41:26 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   ActiveFocus | Falafel | Humor  | 
 Tuesday, August 21, 2007

Anonymous delegates are a very neat and useful feature in C# 2.0. The idea of keeping your code tight and simple without having to move all over your code to understand what it is supposed to be doing is always a welcomed feature in today's complex coding endeavors.

Let's take for example a simple class of Mediterranean Food below that just declares a name and description properties:

 
1 public class MediterraneanFood 2 { 3 private string _name; 4 public string Name 5 { 6 get 7 { 8 return _name; 9 } 10 } 11 12 public string Description 13 { 14 get 15 { 16 return _description; 17 } 18 } 19 20 private string _description; 21 22 23 public MediterraneanFood(string name, string description) 24 { 25 _name = name; 26 _description = description; 27 } 28 }

The goal of the code I am going to be writing below is to create a list of Mediterranean foods and then search the list for a specific food.  As you will see the code below, I tried to show how it is done in 3 different ways (Very old, old and Anonymous Delegates way) just to give you an idea of what the difference is and the code changes needed to bring the code to the 21st century :-)

In the first way (Very Old) we just go through the list using foreach to find the specific food we are looking for.  What's the fun in that! :-)

The second way (Old) I declared a delegate called "OldFindFood" and then in the code we pointed to that delegate via a predicate (type of a delegate) and let the delegate do the search for us.  Problem here of course is the meat of what it is supposed to do is far away from where it is being used in the code.

Finally, I used an Anonymous Delegate which does not need any of the previous code.  The anonymous delegate is declared on the fly and implemented right after the declaration making easy and simple to understand what the intent of this code supposed to be doing.

Have fun, let me know if you have questions or if you have a different opinion.

1 private static bool OldFindFood(MediterraneanFood foodToFind) 2 { 3 return ("Kabob" == foodToFind.Name); 4 } 5 6 private static void ShowFood(MediterraneanFood food) 7 { 8 Console.WriteLine("Name: {0} Description: {1}", 9 food.Name, food.Description); 10 } 11 12 static void Main(string[] args) 13 { 14 15 List<MediterraneanFood> mediterraneanFoods = new List<MediterraneanFood>(); 16 mediterraneanFoods.Add(new MediterraneanFood("Falafel", "Made to Order!!")); 17 mediterraneanFoods.Add(new MediterraneanFood("Kabob", "Meat on a skewer")); 18 mediterraneanFoods.Add(new MediterraneanFood("Babaganoush", "Eggplant dip")); 19 mediterraneanFoods.Add(new MediterraneanFood("Dolmas", 20 "Stuffed grape leaves, with meat")); 21 22 23 MediterraneanFood foundFood; 24 25 // -- Very Old -- 26 Console.WriteLine("\nVery old:"); 27 foreach (MediterraneanFood food in mediterraneanFoods) 28 { 29 if (food.Name == "Kabob") 30 { 31 ShowFood(food); 32 } 33 } 34 35 // -- Old -- 36 Console.WriteLine("\nOld:"); 37 38 System.Predicate<MediterraneanFood> myPredicate = 39 new Predicate<MediterraneanFood>(OldFindFood); 40 foundFood = mediterraneanFoods.Find(myPredicate); 41 ShowFood(foundFood); 42 43 // -- Anonymous Delegate -- 44 Console.WriteLine("\nAnonymous Delegate:"); 45 List<MediterraneanFood> foods = 46 mediterraneanFoods.FindAll(delegate(MediterraneanFood foodToFind) 47 { return (foodToFind.Description.ToLower().Contains("meat")); }); 48 foreach (MediterraneanFood food in foods) 49 { 50 Console.WriteLine(food.Description); 51 } 52 53 Console.ReadLine(); 54 } 55 }
Tuesday, August 21, 2007 10:59:15 AM (Pacific Standard Time, UTC-08:00)  #    Comments [2]   ASP.NET | C# | Falafel | Technology  | 

My dear friend Bary Nusz is visiting from Texas these couple of days attending some WPF, Expression Blend and Silverlight training.  He is staying with me these few days and tonight he decided to make a deployment for one of our major customers, but in style :)  I could not help but record his fancy life style while deploying a multi million dollar application from the comfort of my Jacuzzi.

Tuesday, August 21, 2007 3:39:14 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   ASP.NET | Falafel | Life | Technology  | 
 Monday, August 20, 2007

I was trying to use the excellent RSS Toolkit 2.0 to place my company's news on the main site at www.Falafel.com in order to allow me to enter news in one place only which is our support.falafel.com site and aggregate all from one place.

I grabbed the RSS feed from here and it was few minutes till I was able to get the RSS Toolkit 2.0 component to show up on the site with the same exact CSS styling and everything.

One thing that bothered me is the publication dates for the news were coming in as a long DateTime format, for example: Fri, 17 Aug 2007 21:52:35 -0700

I am used to fix these problems in the ASP.NET markup by using something like:

<%# Eval("pubDate", "{0:D}") %>


For some reason, that did not work this time.  As a matter of fact, no matter what I place in the second parameter, no change occurs.  I went back to the XML coming from the RSS feed and noticed that the pubDate is placed inside of a CDATA schema, which really means it is coming in as a string and it is way too late in the game to retrieve it differently.

1 <item>
2 <title>
3 <![CDATA[Steve Tefethen Joins Falafel Software]]>
4 </title>
5 <link><![CDATA[http://support.falafel.com/index.php?_m=news&_a=viewnews&newsid=7&group=default]]>
6 </link>
7 <description><![CDATA[SAN JOSE, Calif. July 5, 2007 -- Blah, blah blah. ]]></description>
8 <unixdate><![CDATA[1187412755]]></unixdate>
9 <pubDate><![CDATA[Fri, 17 Aug 2007 21:52:35 -0700]]></pubDate>
10 </item>


Well, to fix this in your ASP.NET application, the easiest way is to do a double conversion on the fly from String to DateTime back to string in whatever format you desire.

<%# Convert.ToDateTime(Eval("pubDate")).ToLongDateString()%>

Monday, August 20, 2007 3:57:16 AM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   ASP.NET | C# | Falafel | Technology  | 
 Sunday, August 19, 2007

I am sure I am a bit late to the game here, but I am hoping you will be able to help me with your experience in using Virtual PC vs VMWare.

I have a confession to make, I am not a big fan of the concept as I always see applications running pretty slow inside these virtual machines, but we are getting more and more technologies every day and most of them are in Alpha and Beta bits and these virtual machines are starting to make more sense to me.  I understand the cost (Speed) but I would be very happy to get some guidance from the people that read my blog about their experience with either one.  Thanks in advance.

Sunday, August 19, 2007 3:58:21 AM (Pacific Standard Time, UTC-08:00)  #    Comments [6]   Falafel | Technology  | 
 Thursday, August 16, 2007
I am very pleased to see the training courseware Falafel Software developed for Telerik available as on-demand printed material on Lulu.  The course was written by experts in the ASP.NET arena as well as the Telerik product offerings. RadControls for ASP.NET: A Step By Step Learning
Thursday, August 16, 2007 5:26:44 PM (Pacific Standard Time, UTC-08:00)  #    Comments [1]   ASP.NET | Falafel | RadControls | Telerik  | 
 Tuesday, August 14, 2007

Consulting companies, like Falafel Software, during their start up years do everything they can to get as many accounts as possible and fill the pipeline with work for all their developers and architects.  It is a matter of stability and security to know that the pipe is full and work is available and secure for at least 6 months into the future. To ask for more than 6 months of security I always thought is crazy especially in our beloved Software industry in the USA and especially in the Silicon Valley.  We, at Falafel, on the other hand have been very fortunate for the last 5 years.  The company has grown substantially every year while we’re having fun and enjoying the latest and greatest of technologies.
Once a small company reaches a level of maturity and decent number of accounts, I find a lot of them prefer to only handle bigger companies for business.  So you start with the Mom & Pop shops, then you get a couple of SMBs, transition to medium size, and all of a sudden find yourself contracting to Fortune 500 then Fortune 100 with some luck, personality, connections, hard work and quality people.
I remember the days when people used to call and say “Hi Lino, I am Mr. Foo and looking for someone to help me with a bug in my Delphi code, can you help? How much do you charge? How long will t take you to fix it?
I usually replied “I need to know the nature of the problem first”.  Then they said “Sure I will send you everything, I just wanted to know how much and how long it will take to fix it before I send you anything”
I know it might sound funny but it is the truth about consulting with individuals or very small companies. Budget and resources do not come easy and everyone has to watch their pennies.You end up fixing code, cleaning up code, recommending better architecture and all of a sudden the customer is sweating.  “Why did you fix line # 14, I only asked you to look in the first 10 lines of code only?”

Anyway, you get the picture. Life goes on and you find yourself bidding on multi-million dollar projects for fortune 500 companies where you control the project as long as you deliver on milestones and everyone is happy. You end up making a lot of money and the customer is a huge reference for other major projects to other fortune 500 companies.
Soon after getting the company completely saturated with major projects and employees are working on multi projects at the same time because we can’t find enough quality people to hire in time, you get the call from another Mr. Foo, “Hi Lino, can you look into my ASP.NET code and tell me why it is not working?” How much do you charge? How long will it take you to make the code work? :)


My blog here is about a very dangerous and subtle change in any small company that can cause serious consequences:
To Small Business or not to Small Business?
Some senior and very respected members of my team would vote NO on taking this kind of projects and I would totally respect their call on that as we are faced with several dilemmas, first, we have no resources to place on that kind of projects, second, it is not worth the headache, for $1000 probably, this customer will take most of your time for several days by asking for status every 2 hours and questioning why did issue 2 take 1 hour more than issue 1 and stuff like that where it will cost the company more time to reply to these issues than the revenue generated.

Ok, if you read this blog till here you probably already know what my recommendation is about the subject, well, you are wrong! :)

Most of my multi-million dollar deals all started years ago with 2 to 5 hours of consulting authorized via a very small PO.  I did my job right, the customer was happy and thenext project was on its way from same customer. 6 months later we have 2 people full time working with the customer.  5 years later, we have 7 people working full time at customer site that went from start up to a half a billion dollar company.
I remember sitting in the cafeteria in Frankfurt, Germany after a session I gave at the Borland conference in late 90s when a gentleman approached me asking if he can “pick my brain” about a COM+ issue he was having. I accepted of course and ended up having a 2 hour chit-chat and coding fest.  We got the problem solved, he bought me a drink and was very happy. I was happy to help as well.Later that week   I was hired by his company (one of the biggest financial companies in Europe) to help with the architecture of their new .NET based systems.

What I am trying to say, don’t forget how you got to where you are today!
One of the main reasons I have so many of these great accounts today is because when these accounts were small, none of the major consulting firms (big names) would even bother taking the time.
So I say “YES” if you are Microsoft, Hewlett Packard, EarthBound Farms, Accenture, etc… welcome to Falafel Software (All these are customers already :) ) but if you are Mr. Foo and need help making your company the next Microsoft or the next Hewlett Packard, I say “YES” as well, we would love to help you out. Just, please don’t ask me “how much and how long?” before I see your problem :)

Cheers
Lino

Monday, August 13, 2007 11:18:19 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   Business | Falafel | Life  | 
 Sunday, August 12, 2007

My dear friend and Colleague Steve Trefethen pointed me at Windows Live Writer to use for blogging on my new DasBlog engine here.  I find it very easy to use, fast and very enjoyable.  It took about 2 minutes to install and configure to work on our blog settings.  Thanks Steve!  Does anyone else have some cool and nifty little tools that you care to share with me? :)

Sunday, August 12, 2007 3:42:32 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   Technology  | 
 Saturday, August 11, 2007
Did you see the new book from Microsoft Press? It is all about me :)
Just kidding, thought to plug in Marco Russo's book and get people to start looking at LINQ as it will change a lot of lives.
Also, read Charlie Calvert's blogs on C# and LINQ as it comes closer to releasing C# 3.0 in its final form.

I expect to blog a lot going forward on C# 3.0 and LINQ, so comment here with questions on what you would like to learn or get more information about first.

Linq_Lino.jpg
Saturday, August 11, 2007 3:42:32 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]   C# | Humor | LINQ  |