How to get the Hijri Date in Windows 8.1 Accurately?


I was trying to get the Hijri date while developing a windows 8.1 app but it wasn’t an easy task to do so especially when you know that unlike the normal .Net Framework , you can’t access Hirjri Calendar Class here although it is available due to MSDN documentation.


To save your time , at first I used a simple web service that provides Hijri Date as a text and parsed it. The nice thing is that this service is provided by Al-Azhar (Dar Al-Iftaa) so it is credible and accurate and wouldn’t stop after a short time.


I will share with you the code I wrote to get the date from this service

    ConnectionProfile connection = NetworkInformation.GetInternetConnectionProfile();
            bool internet = connection != null && connection.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
            if (internet)
                HttpClient client = new HttpClient();
                string res = await client.GetStringAsync("");
                HtmlDocument doc = new HtmlDocument();

                DateTimeFormatter df = new DateTimeFormatter("longdate", new string[] { "ar-sa" });
                var date = df.Format(DateTime.Now);

                return doc.GetElementbyId("lblDate").InnerText;


To parse the HTML result , I used HTML Agility Library.

Although the previous solution would be accurate , it still needs internet to get the result which would result in a problem if the user’s device isn’t connected to internet all time. So here is another way to get the date if there is no internet connection


      DateTimeFormatter df = new DateTimeFormatter("longdate", new string[] { "ar-sa" });
            var date = df.Format(DateTime.Now);
            return date.ToString();

Combining these two ways should satisfy your user who wants to be aware of the Hijri Date anytime.


Regards ,


Ahmed Kamal


ACM Solution Manual


Today I received some questions from a student in Ahram Canadian University about ACM and how he can join and prepare himself so as a try to answer all these questions, I will write this blog in Q&A style. I hope that all these answers could help people trying to know more about ACM and problem solving in general.

I wrote before a blog about some resources that could help students looking to participate in problem solving contests like ACM, Top Coder and other programming contests so I will not repeat myself and you can check it of course before reading this blog.

So let’s start clip_image001

How could we initiate an ACM branch in our university?

Like other activities (IEEE, MSP Program, GSA Program), ACM has some rules that you need to follow until you would be able to initiate an ACM Student Chapter inside your university.

I guess you could contact with Eng. Mohamed Fouad as he is the one who could help you with this stuff as far as I know especially if you want the chapter to be an official one. However, let us say that having a chapter inside your university is a good step that would help you organize trainings and contests and raise the awareness of students of computer science and problem solving.

Should we initiate a branch inside university before being able to participate in ACM different Competitions?

I guess the answer here is NO. You can participate with any two students from the same university as long as you would be able to cover the cost of registration and transportation.

The coach can also be one of these three students.

To know more about ACM rules, check this website

How can I get the needed training to prepare myself for the competition?

Thanks to god, now many available resources should help you in your journey if you are interested in improving these skills.

1- Arabic Algorithm Series : As its creator describes it, it is “An Arabic Series in Algorithms and Data Structures from competitive programming perspective with emphasize over thinking skills.”

Dozens of videos have been prepared until now and there are more coming I guess.

2- Competitive Programming Book : In my opinion, this book covers all what you need to become a good problem solver. If we added it to the first resource, I think this would be enough at least for the start.

Download it from here if you could not buy it.

3- Offline Trainings: As I mentioned before you could organize a training inside your university if you have a branch. In addition, some trainings are usually held in universities that have branches and always participate in the different programming competitions like Alexandria, GUC and Cairo University. You should try to follow up and communicate with them to be able to attend.

When and where would the next competition be held?

I guess you can get this info through the official Facebook pages or from the official website of ACM ACPC


Ahmed Kamal

How could you master any technology easily ?


When I first heard about Windows 8, I decided that I want to learn how to build apps for this new and promising platform. This was around 2011 and in this time Windows 8 was just a developer preview version. There weren’t any tutorials or videos that could help ! I opened – by the way it wasn’t as rich as it is now – , installed the needed tools and made my ‘Hello World’ application.

Yea , I made it , now let’s dig deeper but actually what came next wasn’t like this good start , frankly everything went wrong ! The code samples were too complex to be understood by a guy who only knows C# programming basics. The support was weak so one couldn’t easily find any help. I remember that I asked a Microsoft employer how I could learn  Metro Style Apps development  (The old name of Windows 8 Store Application ) and where I should start , he didn’t tell me anything except that I should check MSDN. “Again!” said to myself.

I didn’t stop trying, I read some articles and check may be all the tutorials that were available at this time. After some time I figured out that what I really in need to is studying a lot of concepts so as to become ready for developing polished and professional apps.

May be you are asking yourself how some people are able to learn a technology in just few weeks and sometimes in only a week or less. Actually there are two opposite cases :

1- Geeks who already have strong technical foundations and excellent understanding of the main concepts of this technology and then are able to absorb any new features or new releases easily and fast.

2- Beginners who don’t have enough knowledge or experience and all their projects or apps are made with the help of code snippets , tutorials and may be video tutorials that they often don’t truly understand.

So how could you solve this problem if you are a beginner who looks really for mastering a technology not just making some simple and repeated applications ?

1- Focus on learning concepts at first


Concepts are like the basement of any building , The stronger it is , the stronger and taller your building would be.  So don’t be hasty and give as much time as possible to mastering basic concepts stage and even if you face a  feature / option that depends on a concepts or something that you aren’t aware of , face the problem and give your self the enough time to go back and learn this thing before you continue. for example if you are going to learn Android mobile development , make sure that you mastered Java concepts and object oriented concepts and are aware of xml and the basic concepts and problems that any mobile developer should know.

“The formulation of the problem is often more essential than its solution” Albert Einstein

2- Read , Read , Read


Although I recommend video tutorials -if they are available- to learn the basics of any technology , I can’t deny that reading is essential and it is the only thing that could make you aware of the details of anything  and therefore understand it well too. Reading shouldn’t be limited to text books. There are hundreds of blogs that have tons of excellent information that are extremely beneficial. Sites like CodeProject , MSDN , JavaDoc , StackOverflow should be in your bookmarks if you  are serious about learning technology and definitely  you should spend hours reading new things in them,

3- Learn by doing


Watching and reading tutorials is good but isn’t enough at all. There are several skills -Debugging is one of them – which you won’t acquire unless you get your hands dirty in code. Download hands on labs and try to build them on your own , apply what you learnt and make simple projects. This would keep you motivated and would make you better programmer of course.

4- Keep updated


Technology is changing everyday and you should keep up with these changes and continuously update your knowledge if you want to compete in this market. There are many tools and ways that could support you. Subscribing to technology geeks blogs , following them in Twitter and regularly check dev. sites should help a lot. Attending technology related events is indispensable.

Finally, there is an excellent blog about how you could stay on top by Bob Tabor that I recommend reading.

I hope this blog could help you learn to avoid most of the mistakes that beginners commit and use your time wisely too. For non-beginners , I would be happy to hear from you especially if you have other advises or recommendations that you believe should be added to this blog. Good Luck !

Ahmed Kamal

How to register in ACM ?


1- One of the 3 team members will register the team from this link;jsessionid=qztfetiRqTZeSshTzZ+6jg23.undefined

2- Register an account for yourself and complete your own profile (this is important)

Area Of Study :In ex :  “Engineering”

Degree Pursued :In ex : ” Bachelor” 

3- Create a team and choose “The 2012 Egyptian Collegiate Programming Contest >  CAIRO”

3- Ask the other two members to create account  too and then you can add them to the team through “Add Team member”.

4- Assign team members to your team through searching for them using their names. Be sure that the e-mail of him/her is the same as the one he/she registered with to guarantee that he/she  is the right person.

5- Click on “Register Team” button.

6- Don’t forget to make sure that the registration of all the 3 member is completed.

Congratulation 🙂 You have registered your team successfully. Don’t forget to send me the names of the members of your team so I can finish you registration at  & your mail to contact you if there was any problem.


Best Wiches 🙂

Ahmed Kamal

Resources for ACM Competition


I was asked a lot of questions about how one can start learning how to prepare himself  to be able to participate in competitions like ACM. In fact I had the same question so I asked Ahmed Mohamed Kamel. as he was the student coach of the Egyptian team in IOI this year.

He said: “There are a lot of problems varying in difficulty from the very beginning (language newbies) to very advanced in algorithms and techniques.

1- To read articles I recommend wikipedia and TopCoder editorials, also Competitive Programming book (this book has everything about what you need). You can also benefit from our training site

2- To enter online contests and be ranked over the world, join,, and and practice on their problems. There are thousands of problems there.

I asked him do I need to master data structure before start solving the problems but he answered saying”I think there is no need for advanced data structures at the moment.. Just learn the basics and solve!”

I hope all of you can benefit from this post. Thanks 🙂

Ahmed Kamal

ACM Competition


في البداية لو حبينا نسأل نفسنا يا تري ايه الفرق بين جوجل من 5 سنين و النهاردة ؟ فكر كدا شوية .. هل الفرق في الشكل او في لغة البرمجة اللي بيستخدموها ؟

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

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

عشان كدا لما بندور علي الوظائف في شركات زي جوجل , مايكروسوفت , اي بي ام او غيرها بنلاقي انهم دايما بيدوروا علي مبرمج قوي في Algorithms لان الفرق ما بين الكود اللي بيكتبه حد محترف و الكود اللي بيبكتبه حد عادي بيعتمد علي النقطة دي تحديدا و الا تخيل كدا لو البحث بيتم بكفاءة بس بتستني اربع دقايق عشان النتيجة تطلع 🙂 .

طيب احنا بقا اخبارنا ايه في الموضوع دا 🙂 .. عموما هو مش احنا بس اللي كدا تقدر تقول ان كتير من المبرمجين للاسف معندهمش مهارة عالية في الالجوريزمز والرياضيات و عشان كدا مش سهل تلاقي عندنا محرك بحث او موقع زي فيس يوك او كدا لان الحاجات دي شغالة بالجوريزمات قوية جدا و محتاجة النوعية دي من المبرمجين.

في العالم كله الشركات دايما بتدور علي النوع دا من المبرمجين عشان كدا في مسابقات كتيير بتتعمل علي مستوي العالم بين الطلبة و غير الطلبة برضه عشان الناس تتنافس علي حل المشكلات البرمجية دي بحلول متميزة من ناحية السرعة و الكفاءة.

Google Code Jam


IEEE Extreme

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

كمان في منها مسابقات بتبقي عن طريق الانترنت من خلال مواقع زي

و اللي حتلاحظه من المسابقات دي ان الاوائل فيها من مصر بيبقوا شغالين في شركات كبيرة زي جوجل و مايكروسوفت و غيرها و منهم احمد علي (الاول علي مصر) اللي شغال حاليا في جوجل .

في الملف دا احمد علي و بيشرح برضه شوية عن احد المسابقات دي

احنا بقالنا فترة بنحاول ندخل الموضوع دا عندنا هنا في الكلية بس الدنيا حلوة طبعا 🙂 بس الحمد لله لقينا طريقة كويسة نقدر نشترك من خلالها بحيث نبدأ نجهز فرق تشارك في المسابقة و تاخد تدريبات و تطور مهاراتها عشان تنافس و كدا

احنا محتاجين من كل حد مهتم بالموضوع دا انه يشارك في المسابقة المحلية اللي بتبقي في مصر ان شاء الله

بس لازم علي الاقل يكون عارف برمجة بس مش شرط يكون متميز في الالجوريزمات

لو عايز تعرف اكتر عن المسابقة من خلال اللنك دا

و عشان تعرف القواعد بتاعتها من خلال

و لو عايز تشارك في المسابقة

الناس لازم تسجل علي الاقصي قبل يوم السبت و الاسبقية للي يسجل الاول طبعا

  • محدش يقلق من معاد التسجيل المكتوب او معاد المسابقة لانه اتعدل برضه
  • يا ريت كل البيانات تكون كاملة  و كمان تبعت اميل بعد ما تسجل باسماء التيم علي
  • كل فريق بيبقي حوالي 3 من الطلبة و بيبقي فيه كوتش سواء واحد من التلاتة دول او حد من برا
  •  Coach دا ممكن يكون طالب عادي جدا فياريت اي حد من الفريق يبقي  Coach
  • هو ملوش مميزات الا انه بينظم موضوع الاتصالات و كدا Coach
  • الفرق اللي حتسجل في المرحلة دي هي اللي حنشتغل معاها في الفترة الجاية ان شاء الله

الاسئلة :

انا حضيف الاسئلة اللي حتوصلني و ححاول اجاوب عليها هنا

1- انا اللي حختار الفريق بتاعي و لا هما اللي حيختارونا ؟

لا في البداية بس احنا بنختار بعض بس بعد كدا الموضوع حيبقي فيه مسابقة و كدا و نختار الافضل فقط

2- ايه اللي حيحصل بعد ما نسجل ؟

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

3- ازاي ممكن اسجل ؟

البوست دا حيشرحلك كل حاجة بالتفصيل

4- ايه لغات البرمجة اللي ممكن نستخدمها ؟

انت قدامك 3 اختيارات سي بلس بلس او جافا او سي

5- هي المسابقة دي تبع مين ؟

هو عامة الموضوع مش متعلق بمسابقة معينة ان شاء الله بس دي اقوي واحدة موجودة

ACM is like IEEE .. it is an worldwide organization
competition sponsered by IBM

6- هل ينفع يكون اي اعضاء الفريق (3 اعضاء) من خارج جامعة طنطا ؟

لا للاسف بالنسية لينا مش ينفع بس هو ممكن يشوف ايه النظام في جامعته

7- انا عايز اشوف اسئلة شبه الاسئلة اللي بتبقي في المسابقة اعمل ايه ؟

اسئلة ACM مشهورة و موجود علي الانترنت الاسئلة الخاصة بالسنين اللي فاتت كمان تجرب تشوف موقع زي TopCoder او UVA

لو عندك اي استفسارات ممكن تبعتها علي