So you did change your namespace

Again why? will sometime you just don’t like the namespace anymore :-) , so you did change the namespace to  project , this project use Entity Framework , after rebuild and run it oooopppsss :

“ schema specified is not valid. errors the entitycontainer name must be unique “

what ?!! here’s why will sometime visual studio is not that smart ,  when you rename the namespace and rebuild the project the old DLL that have the old namespace still there , because of that your EF was load both of assemblies the new one and the old one , if you read the Rest of the Error :

“ An EntityContainer with the name 'xxxxx' is already defined.”

so how you cane solved ? really !! how about deleting the old DLL !!



Take your User Management to the next level

Hi, so you start your day at work  as usual checking your email Wishing that someone did send a gift or invitation to dinner , oohhh yaaaah in your dream my friend !! , what you find is a new request from your boss asking you to start development those SRD ..

So you start work in those SRD and after couple of days you starting to notice that you are rewriting the same code over and over for user management for each system !! and then you get all  those question in your mind about user management and how the client will suffering  from it , Because they are separated from each, so if he wants to add user ( xxx ) to system ( x ) he will need to login into x and add that user, and same thing will happen with all of them  .

So what I’m trying to say here it’s in this image :
1

in the image above each system will has his own user management , what if we can merge all those UMS in one place !! Like that :
2
so in the future if you have new system why building the UMS !! Just use what do you have !! just add the new system to UMS and boooom your ready to go just like that !!
4
So what’s the benefit of doing that ?  On place to do everything ,  to add users for each system you have , One place to mange the roles and reset password , unlooked users or remove user from role , if you have 10 Developer none of them should care about UM at all !!

How we can Developing something like that ? will for sure I will use the Membership Provider for that , so the first approach come in my mind this one :
ddd
One General Bug Huge Data Base for all my users , But after a few minutes I start realize several thing:
  1. security issues
Put everything in one bug, Huge Data Base and then give every developer in my team or  Developer out side of the Organization access to UMS Data Base hmmmm I don’t thing that’s a  good I deal !! 

2. More complicated than necessary
if you know how membership work immediately you will know when user “ALGHABBAN” get looked in system X he will get looked in everything , Of course you can do some magic in the code to handle that but Why !!    
3- Stability
what if the server that host UMS database get down !! or the connection get lost , than all of your system will stop work at all !!
So what I came up with after tow days of thinking and try allot if shit  , is this approach :
5
In this approach UMS will be just an Interface to work with User Management with all system , what UMS do is just register the connection string for each system and then using Membership provider you can create users or delete one or do what ever you want with it , Get users, unlooked user reset password delete user add user to roles or remove it from one for any system in one place .

and the Developer will get to manage his user in the test Environment by just give him access to UMS so from there he can add users or delete one.

So in this approach all off your developer will use Membership  and you will need to make sure of that, before you adding the new system to your list including UMS will have his owns Membership Tables , Here’s My data base Design  for UMS :
6
the user membership table will be only to manage UMS users , and Users In Systems table to save  that user x have access to system x , when I  want to create new user in system x I just create a new membership provider with system X connection string and then use membership.createUser() to create the user : –) .

so why do I need User in Systems table?  here’s the thing when you update the password for system x and for a user and that user have access to many Systems you will make sure that you did update his password in all of the systems he have access on .

The only big issue you will face drawing development is how to change the connection string for membership provider in the run time ? , the only thing you can do about that is create a new class that inheritance from SQLMemberShipProvider class and in the Initialize method you need to pass the new connection string that you saved in the systems table
   1: namespace MyNamespace  
   2: {  
   3:         public class MyMembershipProvider : SqlMembershipProvider  
   4:         {  
   5:                 public static string ConnectionString { get; set; }
   6:                 public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)  
   7:                 {  
   8:                         base.Initialize(name, config);  
   9:                         
  10:                         FieldInfo connectionStringField = GetType().BaseType.GetField("ConnectionStringInWebConfigFile", BindingFlags.Instance | BindingFlags.NonPublic); 
  11:                         connectionStringField.SetValue(this, ConnectionString);  
  12:                 }  
  13:         }  
don’t forget to add new Provider into your web config like that :
   1:  
   2:                     <membership defaultProvider="MyMembershipProvider">  
   3:                             <providers> 
   4:                                     <clear /> 
   5:                                     <add name="MyMembershipProvider" 
   6:                                               type="MyNamespace.MyMembershipProvider, MyAssembly" 
   7:                                               connectionStringName=""
   8:                                               applicationName="MyApp"   
   9:                                               enablePasswordRetrieval="false"                                                 enablePasswordReset="true"   
  10:                                               requiresQuestionAndAnswer="false"   
  11:                                               requiresUniqueEmail="false"   
  12:                                               minRequiredNonalphanumericCharacters="0"   
  13:                                               passwordFormat="Hashed" /> 
  14:                             </providers> 
  15:                     </membership> 

Then you can use this class like that :
   1: MyMembershipProvider provider = (MyMembershipProvider)Membership.Providers["MyMembershipProvider"];
   2: providers.GetAllUsers();
   3: provider.GetUserByName("ALGHABBAN");
The same thing you will do with Role Provider , And then you can use single sign-on ideal when you deploy all those system in one domain as in this article. , what do you think ? 


Done  :- )


changing your religion from Java loser to .Net Ninja

Hi, many people ask me how to move from java to .Net world and for the past two week one of my colleagues keep asking me about that, so for all those awesome Developer how stuck with Java for long time and want to try for fun or move to new and greater  Platform called .net , this guide will help you to do that easily and without pain.

The beginning of the adventure

for Java People you should go with C# Because  it’s almost the same syntax as Java , here’s the best book you will ever read about that it called the yellow book which explains to you allot  if you are coming from Java to C# . 

after you read the yellow book you may need to take a look at c# fundamentals pluralsight Part 1 and Part 2 ( you can find it online torrent ).

See visual studio is completely different than any IDE You ever work with in Java , if you ever did use office before the VS will not be an issue for you :- ) ,  Just to get familiar with it .

Once you are done ok whit C# and visual studio then are ready to the next chapter reading about .Net framework just like Java where there’s web platform and Desktop and Mobile in .Net web have that two so there’s asp.net , and asp.net MVC as web plat form  , windows form and WPF and windows 8 app as Desktop Platform.

Moving to Advanced  Topic

Once you get the basic caver you will need to read about Application Lifecycle Management with TFS , and Style Cop Tools for standard C# code  and SQL Server, ADO.Net , LINQ , Entity Frame , all of those options are related to the Data base stuff and how to work with deferent Data Base  ( Oracle , IBM , MY SQL , MongoDB , CashBase, … ) .

and all of the above title has been caver by pluralsight  :- ) so go back to thepriatebay.se and search for it .

Resource to .Net and C#

.Net have Larger community then Java or even Oracle , that's not my opinion, that’s a fact, so you will never have that feeling that you are lost for Example if you are  facing  issue with oracle data base you will get a number of that Error, it’s like oracle tell you  “ hay here’s the error number go fuck yourself “ <-- the problem is  you will never know how !! –> see every solution you will found in the internet will not work for you , but in .Net it’s a deferent you will get a clear message you will know where to go and you will find so many Developer and resource to solved such as :

http://codeplex.com .

http://CodeProject.com .

http://Stackoverflow.com  .

http://www.exciton.cs.rice.edu/netResources/

https://www.microsoft.com/net/

http://programmers.stackexchange.com/

http://www.csharp-station.com/

http://msdn.microsoft.com/en-us

Finally

Why Java Sucks and C# Rocks

Comparison of Java and C Sharp



Upgrading to everything 2012

for the past two days I was working hard to upgrade all my PCs and Server to 2012 , After 48h I did it :- ) .. Upgrade two server from windows server 2008 to windows server 2012 .

and Moving from windows 7 to windows 8 ( I know what you will say ) but installing windows 8 in my PCs it does not mean that I like it , I’m developer and I have to go forward whether I like it or not.

And also I install Visual studio 2012 and SQL server 2012 and SQL management studio, here’s some issues I face drowning those upgrade:
  • after installing windows server 2012 and try install SQL server 2012 I face the NetFx issues which  it can be solved by installing .Net Framework 3 using the windows server manager and Adding .Net Framework 3.
  • in SQL Server 2008 I used to just install and run , for SQL Server 2012 you have to do some configuration enabling TCP and allow port 1433 in the firewall .
  • in visual studio 2010 < we used to get SQL Server just running after the installing for visual studio , however in 2012 you have to install SQL server separately.
  • you face the same shit about NetFx so you will need to install .net Framework 3 in windows 8. 
Everything get harder than we used to,  so after the installation process was take only 15m , now it take 2h to install SQL Server, visual studio, .Net framework, and SQL MNGMNT .

But is it worth , No :- ( .. it' sucks everything Everything has to do with windows 8 sucks. 


بناء Data Provider: خطوات عمليات التطوير

كما تحدث في المقالة السابقة فإن هذه السلسة هدفها تقديم محتوي تطبيقي بعيد عن المحتوى النظري , سنتحدث في اول مقالة عن الخطوات الرئيسية المتبعة في تطوير التطبيقات او ما يسمى بـ development cycle life  , تترجم العديد من الكتب العربية development cycle life بـ دائرة حياة التطبيقات !! وهو تعريب ليس له اي علاقة بالواقع ( كعادة طبعا ) , من وجهة نظري ربما تكون صحيحة او خاطئة يمكن تعريب الجملة السابقة بشكل افضل إلى مسار عملية التطوير , الصورة :

596px-SDLC_-_Software_Development_Life_Cycle

Requirement Analysis , كتابة المتطلبات :

للأسف و على الرغم من كون هذه الخطوة هيا الاهم على الطلاق إلى ان العديد من المنظمات و فرق التطوير لا يولون هذه الخطوة هذه الدرجة من الاهمية , بل تصل درجة الحماقة في بعض المنظمات و بعض المطورين بأن يقوموا بكتابة المتطلبات بأنفسهم !! إن فكرة ان تقوم بعمل شيء هو ليس من مجال تخصصك بحذ ذاته حمقاء كمطور ليست مهمتك ابدا تجميع المعلومات او التواصل مع العميل بأي شكل من الاشكل , هناك اشخاص كرسو الكثير من حياتهم و وقتهم و جهدهم لدراسة علوم تحليل النظم و من غير الصحيح ان تلقي بكل هذا الكم من الجهد المبذول من قبلهم عرض الحائط فقط كونك تريد توفير بعض المال على المنظمة .

ان محلل النظم هو اهم شخص في سلسلة تطوير التطبيقات , لما يتمتع به هذا الشخص من اسلوب منطقي يمكنه من فهم العميل و تحليل متطلباته و كتابة ملفات المتطلبات و فق تنظيم معين متفق عليه بحيث يستطع اي مطور قراءة هذا الملف و فهم ماذا يريد العميل ان يفعل , و على الرغم من اهمية هذا الشخص إلى انه في الحقيقة أكثر الاشخاص حظوظا اقل في العثور على العمل و على راتب مناسب لحجم المهمات التي تقع عليه . ان محلل النظم يوفر عليك الكثير من الجهد و الوقت المبذول لحل مشاكل عدم التوافق و المقصود هنا عدم توافق المنتج النهائي مع متطلبات العميل .

يقوم محلل النظم بإعداد ملفين أول هو business requirements document و يعرف اختصارا بـ BRD  , حيث يحدد هذا الملف المتطلبات الرئيسية الأولى و الخطوط العريضة و الافكار العامة دون الخوض في تفاصيل كيف تتم هذه النقاط و من اين يتم تجميع او الحصول او نوع المعلومات المقدمة او كميتها . بعد كتابة ملف BRD  يقوم بكتابة ملف يختصر بـ SRD  و هو specific requirements document حيث يتولى هذا الاخير تحديد متطلبات المشروع التفصيليه الواردة في ملف BRD متطلب متطلب بما في ذلك المتطلبات الفرعية لكل متطلب رئيسي و يحدد في هذا الملف مسار تدفق البيانات و كيفية معاجلتها و من اين يتم الحصول عليها و كمياتها و المستخدمين المخولين بالحصول عليها و مستوى الصلاحيات الممنوحة لهم و هكذا من هذه التفاصيل .

ان محلل النظم ليس مطورا , انما هو شخص متمرس على اساليب الحوار و بالعادة شخص اجتماعي و قادر على خلق الحوار مع العميل و الخروج بأدق التفاصيل الممكنة عن التطبيق الذي امامi , وهو نقيط شخصية المطور في العادة التي تتمتع بالانطوائية و الانعزال .

Design 

بعد حصولك على ملف BRD  و الـ SRD من BA  او Business analysis  تأتي خطوت التصميم للمشروع , هي خطوة اخرى مظلومة من قبل المطورين و لا تولى اهمية تذكر لا من قريب و لا من بعيد , لا اقصد بالتصميم هنا الواجهات و خلافه بل ما اقصده هو التخطيط ماذا تريد ان تفعل !! إن القفز مباشرة إلى الشفرة و بدء بكتابة الاكود سينتح عنه عواقب وخيمة لاحقا اول هذه العواقب عدم التوثيق و بالتالي الصعوبة في تنقيح و صيانة الشفرة او تطويرها و تغير المتطلبات لاحقا و تحديث المشاريع إلى مشاريع اكبر ,  " هناك خرافة تقول بأن على المطور توثيق تطبيقاته بعد كتابتها و هذا غير صحيح فأنت لا ترسم مخطط البناية السكنية بعد الانتهاء من بنائها ايها الاحمق !! " ريتشد ستولمن الاب الروحي للمصادر الحرة .

لا يمكن تشيد السفن بدون المخططات المسبقة , شخصيا لا اعلم حقا لماذا يرفض المطورين هذه الخطوة !! و يقفزون مباشرة إلى بناء سفينة موجوده في مخيلتهم و لا يستطيع ان يراها احد سواهم حتى ينتهي هذا التابعي الجليل من المشروع .

ان عملية تصميم المشروع يجب ان تأخذ بعين الاعتبار البيانات التالية :

  • المدة المتوقعة  للإصدار التجريبي للمشروع .
  • تصميم قاعدة البيانات .
  • تحديد مداخل و مخارج البيانات في التطبيق .
  • الواجهة التجريبية .
  • تحديد خصائص المتعلقة بالمشروع .
  • تحديد المصادر الخارجية التي ربما تحتجها اثناء عملية التطوير .

لنتحدث الأن عن كل خطوة على حدة :

المدة المتوقعة للإصدار التجريبي

الاصدار التجريبي هو النسخة الأولى من التطبيق التي يراجعها العميل لتأكد من تحقق جميع المتطلبات المطلوبة في ملف BRD , يجب عليك اثناء تحديد المدة التجريبية ان تأخذ بعين الاعتبار النقاط التالية :

  • تحديد النقاط التي تعتبر مبهمة نوعا ما لديك : بمعنى اخر تحديد النقاط التي لم تسبق العمل بها من قبل و تحتاج منك أن تتعلم تقنية جديدة او لغة جديدة , و في هذه الحالة عليك ان تقيم نفسك كم من الزمن تحتاج حتى تنهي هذه النقاط .
  • تحديد النقاط التي تعتبر بسيطة : و المقصود بها النقاط التي يمكن ان تنجزها مجتمعة خلال فترة زمنية بسيطة .
  • يجب عليك ايضا اضافة المدة الزمنية المتوقعة لتوفير متطلبات قد يحتاجها تطبيقك مثل موارد خارجية او اجهزة جديد او سيرفرات بنظام معين او مشابه و هذا التقييم يختلف من منظمة إلى خر كلا على حسب سرعة توفير هذه الموارد .

تصميم قاعدة البيانات

حيث تسرد في هذه النقطة تصورك لقاعدة البيانات و هو تصور النهائي طبعا  للعلاقة الكائنات بعضها ببعض و كيف ترابطها في النظام .

تحديد مداخل و مخارج البيانات في التطبيق

في هذه النقطة يتم تحديد نقطة البداية للمشروع و مسار البيانات كلا على حده و علاقات كل كائن بأخر او ما يسمى بـ Data Flow  , هناك هدف اخر من هذ الخطوة وهو حماية التطبيق و زيادة الأمان ! , فعندما تعرف كم نافذة في منزلك و كم باب و نافذة لجهاز التكيف , تستطيع عندها ان تحدد المناطق التي من الممكن ان يتسلل منها الصوص لمنزلك و بتالي تقوم بحمايتها .

الواجهة التجريبية

او ما يعرف بـ prototype  , هناك تقوم بإنشاء واجهات تجريبية و عادة ما يتم انشاء بعض الاحداث المختلقة لكي يعرف المستخدم شكل الواجهة و كيفية التعامل و شكل التطبيق بشكل عام , من شأن هذه الخطوة ان ترسم الملامح العامة لشكل البرنامج في ذهنك و بالتالي تسهل عليك عملية بناء التطبيق بشكل اكبر كون اصبح لديك تصور مسبق لما تريد بنائه .

تحديد الخصائص المتعلقة بالمشروع

و هنا يتم تحديد اعدادات التطبيق العامة و كيفية الوصول لها و امكان الملفات و تواجدها و صيغتها و انواع المعالجات التي تتم عليها , من شان هذه الخطوة توفير الوقت و الجهد لمن يتولى التطبيق من بعدك فعوضا عن البحث من اين تم تحميل هذه البيانات او هذا الملف او اين يتم حفظ هذا المجلد و ما إلى ذلك يستطيع المطور القادم مباشرة العمل , او ربما انت مستقبلا .

تحديد المصادر الخارجية للمشروع

و هنا تقوم بسرد كل references التي اعتمدت عليها من الخارج وتحدد رقم الاصدار و الشركة و تاريخ الاصدار و نبده مختصرة على عنها و طريقة عمليها و كيف تعمل و تقوم بكتابة الشفرات التجريبية لطريقة استخدامها .

Implementation , عملية التطوير :

بعد الانتهاء و تحديدك للمدة المتوقعه لإنجاز المشروع و كتابتك لمخططات التطبيق كاملة و تقوم بعملية كتابة الشفرة مع المحافظة على التوثيق في كل جزء و التقيد التام لمخطط الموضوع و كتابة التعليقات و تحديث المخطط ان احتجت إلى ذلك , يصاحب عملية التطوير خطوة اخرى و هو عملية integrated test و هو الاختبار الذي يقوم المطور بعملية لتأكد من أكل شيء يعمل حسب المطلوب .

Testing  , الاختبار :

 

314926_243313742384178_1956684952_n

وهو يختلف تمام عن الاختبار الخاص بالمطور , و يحرم على المطور القيام به بأي شكل من الاشكال و يجب ان لا تتم عملية الاختبار نهائية على جهاز المطور او  على اي جهاز تتواجد بيه مكونات بيئية تطوير و ان يحاكي جهاز الاختبار قدر المستطاع بيئة العميل , و يجب ان يخصص له فريق مستقل بذاته , و يجب على هذا الفريق ان يكون مقسما إلى شخصين على الاقل :

المستخدم العادي :

حيث تولى له مهمة كتابة التعليقات على الواجهات و التأكد من ان  الروابط و الازرار تعمل و دقة صور التقيد تصميم و ما الى ذلك و التأكد من النتائج سواء المدخلة او المخرجة , يجب ان لا يتمتع هذا الشخص بأي معرفة تقنية تذكر و ان تكون حدود معرفته مقصورة على استخدم الحاسب الألى و بالتالي ستحصل على اكثر النتائج تقيما خصوصا فيما يتعلق بقابلية الاستخدام.

مسؤول الأمان :

يتولى هذا الشخص تحديد مدى تقيد التطبيق بمستويات الامان المطلوبة منه , و تقديم تقارير بالثغرات الممكنة في التطبيق , مع طريقة معالجتها .

اخيرا عملية الانتاج

لا علاقة لك كمطور بهذه الخطوة بأي شكل من الاشكال , و يجب ان يتم تثبيت التطبيق او نشهره على IIS من قبل فريق اخر و الهدف من كونه فريق اخر هو حماية التطبيق نفسه منك ! خصوصا اذا كان التطبيق يتعامل مع بيانات حساسه .

ثم تعود مجددا إلى الخطوة رقم واحد اذا اراد العميل تغير متطلب معين , فعليك العودة من جديد كتابة BRD  تقديم المدة , تصميم ثم التطوير و اخيرا الاختبار , المقالة القادمة سوف يقوم بكتابها BA  و ليس مطور , و الهدف هو التعرف كيف تتم كتابة ملفات الـ BRD  و غيرها و كيف تتم عملية المناقشة بين العميل و الـ BA .