Tuesday, March 24, 2009

CSS best practice

Inline style is not a good practice if you want to work with styles, as it is difficult to update if you want to make a modification across the site.

So, some WEB-UI developers start making a new framework to use while making their styles without using the inline style, they develop a class for each style, ex: .Width150px { width:150px;} and another one .Red {color:red;} and use it like this class=”Red Width150px”!
For me, using inline style is better as it will be much more faster while developing than using the above way.

The better practice for using CSS is by defining a meaning full name that describes the thing that will take the style, ex: .PageTitle {color:red; width:150px;} and give the DIV class=”PageTitle”, so I can update all the pages titles just by updating the CSS file, not going to each page title and update the class name.

DIVs vs TABLES

Lots of WEB-UI developers are thinking of replacing all the tables with DIVs which in my opinion is not right, they are using DIVs even if they want to render a table saying that it is better in performance.

But the right thing is: use div when you need it and use tables when you need it.
Using DIVs with CSS can make a lot of things that can’t be done by TABLEs, for example it you want to display data in rows and each row or some rows will not be aligned with the others and using TABLEs will make complicated TDs with a lot of COLSPANs, but displaying a form data can be done with TABLEs perfectly.

But it is preferred to use DIVs if you want to work with the page layouts, as you will be able to change the layout just by using the CSS.

Wednesday, March 11, 2009

setAttribute('maxlength', 5);

Setting maxlength with Javascript using the setAttribute() function will not work with IE like this: setAttribute('maxlength', 5);

You have to make it setAttribute('maxLength', 5);

Monday, March 02, 2009

Team Foundation Sidekicks

Team Foundation Sidekicks is a suite of tools for Microsoft Team Foundation Server administrators and advanced users providing Graphic User Interface for administrative and advanced version control tasks in multi-user TFS environments.
Version 2.2 of Team Foundation Sidekicks includes Permission Sidekick, Code Review Sidekick, Shelveset Sidekick, Labels Sidekick, History Sidekick, Workspace Sidekick and Status Sidekick in uniform GUI stand-alone application, and Visual Studio Integraton Package providing VS integration for all sidekicks as well as additional features such as Search Items dialog, dynamic History and Build Type editing support.
Single installation package contains versions of application compatible both with Team Foundation Server 2005 and Team Foundation Server 2008.

Move site collections to a new database (split a content database) (Windows SharePoint Services 3.0)

This is a very usefull article talking about how to move a site collections to a new database

You can also have a look on Microsoft SharePoint Administration Toolkit

Saturday, February 28, 2009

Kid's Corner in Microsoft MSDN

Are you a cool kid who wants to impress your friends and family with your mad skillz? Check out the Kid's Corner for lots of fun, easy to understand lessons on programming!

Wednesday, February 25, 2009

I was asked if I worked before on making a module to allow the users from downloading a document without the direct access to that document, the document (not just images) may be saved in SQL or on MOSS document library with no read access to the user.
Yes I worked before on file types like word files, but general files NO. and I give him the main idea of adding the document stream response and change the response content type.
And after a while I asked him about the output and he sends this code to me:



System.IO.FileInfo fileInfo = new System.IO.FileInfo(@"C:\d\AhmedCV.doc");
System.IO.FileStream fl = fileInfo.OpenRead();
byte[] file = new byte[(int)fl.Length];
fl.Read(file, 0, (int)fl.Length);
fl.Close();
System.IO.MemoryStream mem = new System.IO.MemoryStream(file);
Response.Clear();
Response.ContentType = "application/x-unknown";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
mem.WriteTo(Response.OutputStream);
Response.End();

Saturday, June 23, 2007

التشكيل العربي ... مشكلة قد لا تظهر ولكن موجودة

منذ عدة سنوات و انا اعمل في تطبيقات الويب العربية فقط، و قد لاحظت مرة أن هناك رابط لصفحة ما ، عندما اضغط عليه لا يستطيع المتصفح العثور على هذه الصفحة ، فراجعت العنوان بالرابط فوجدته صحيحا، فراجعت الملف نفسه ان كان موجودا ام لا، فوجدته في مكانه و بنفس الاسم!

استغرق هذا الامر مني بعض الوقت حتى قررت ان أعيد كتابة الرابط من جديد ، فوجدته يعمل بشكل جيد! فقررت الرجوع مرة أخرى و وضعت الرابطين فوق بعض كل واحد منهم في سطر و قارنت بينهم فلم أجد ما هي المشكلة، متطابقين تماما! و احدهم يعمل و الآخر لا يعمل.

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

و منذ ذلك الوقت عندما ادرك اني اكتب بالعربي خطأً اقوم بحذف الكلمة و حرف آخر و اعادة كتابته حتى أتأكد من عدم وجود حروف خفية.

Friday, June 22, 2007

1st

Al salam alikom, this will be my first post, and I would like to start it with:


”وَقُل رَّبِّ زِدْنِي عِلْمًا”