أرشيف القسم ‘تقني‘

How to restore iPhone 3.1.2 without Update

3 مايو 2010

I have a jailbreaked unlocked iPhone 3.1.2. It suddenly stopped working so I needed to restore it. However when I connect it to the iTunes 8 and click the Restore button, it says Restore and Update which means update to 3.1.3 but there is no jailbreak available yet for this version (there is http://spiritjb.com but there is no unlock available yet). Here is what I did to get the iPhone back to life with 3.1.2.

1. Download 3.1.2 firmware from here:

Download iPhone OS 3.1.2 for iPhone 2G
Download iPhone OS 3.1.2 for iPhone 3G
Download iPhone OS 3.1.2 for iPhone 3GS

2. Find hosts file (in Windows 7, it’s here: C:\windows\system32\drivers\etc\) and add the following line at the end: 74.208.10.249 gs.apple.com.

This is needed because iTunes will need to contact apple to get permission to do the restore and it was refusing for me saying that my device is not illegible for this operation. Thankfully there is a Saurik’s server (has the ip 74.208.10.249) that mimics Apple’s server but is more generous and will let iTunes install the restore. By adding the above line, you are telling the operating system to forward any communication with gs.apple.com to the corresponding port thereby faking Apple’s server.

3. When you connect your iPhone to the computer, iTunes will show the restore screen. Press Shift and click Restore which should open a file browser where you can choose the 3.1.2 firmware you downloaded. Give it the file and everything should run fine. It should restore a fresh copy of the iPhone OS 3.1.2.

4. Now, I used blackra1n as usual to jailbreak the iphone and I also restored my backup which has my mp3 library, apps etc.

Why is Software Engineering so Concerned with Processes and Management

19 أبريل 2009

When we talk about Software Engineering, we can’t go without mentioning the Software Engineering Institute at Carnegie Mellon University (SEI). SEI came up with the Capability Maturity Model (CMM) for software development improvement which has helped many organizations improve their software development processes. I am now pursuing the Master of Software Engineering program at Carnegie Mellon and I have found that software processes and management are one main portion of the program.

The SEI advocates that software development must be engineered and software developers must be trained as software engineers rather than as computer scientists or programmers or whatever.

However, to compare software engineering to other engineering disciplines, I looked at the civil engineering curriculum at Carnegie Mellon and found no single course about management. The only close course is Engineering Economics and it is really not that close.

I have no doubt there are processes that civil engineers are following and that they need management but why isn’t those taught as part of the main catalog?

Shall Software Engineering be “redefined” to be just like any other engineering discipline? i.e. to leave software development processes and management to other specialists and focus on training software engineers to be what they should be: “software engineers”.

كيف تختبر الإجراءات الخاصة (private methods) في لغة جافا؟

15 يونيو 2008

السلام عليكم.

تكلمت في مدونة سابقة بعنوان “التطوير المسير بالإختبار” عن أهمية الإختبارات في البرمجة. فالبرامج المكتوبة بهذه الطريقة غالبا ما تكون مرتبة ترتيباً جيداً وتوزيع المهام بين الوحدات يتم بصورة أفضل وأوضح.

في هذه المدونة سأشرح كيف يتم اختبار الإجراءات الخاصة ((private methods في لغة جافا.

هناك وجهات نظر مختلفة في هذا المجال:

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

رأي آخر يقول أن تعرّف الإجراء ليكون خاصاً بالمجلد وليس بالوحدة التي تحتويه (package private) وبهذه الطريقة تستطيع وحدات الإختبار أن تصل إليها كونها في نفس المجلد إذا اتبعنا الترتيب المقترح في المقال أعلاه. لا أحبذ هذا الرأي لأنه يجبرك على تغيير تصنيف خصوصية الإجراء فقط لأجل الإختبار.

البعض الآخر يقوم بكتابة إجراء آخر مصنف على أنه عام و لا يقوم بعمل أي شيئ غير مناداة الإجراء الخاص.

مثلاً: private double calculateProfit و إجراء آخر public double calculateProftTest والذي يقوم بمناداة الإجراء الأول وهذا الرأي أيضا لا يعجبني لأنه يجعل الوحدة مليئة بإختبرات لايفترض منها وجودها هناك. فالوحدة يجب ألا تعرف أي شيئ عن نوعية أو طريقة الإختبار.

الطريقة الأخيرة و هي التي أستخدمها دائماً في برامج الجافا تعتمد على تصميم الوحدة كما تراه مناسباً حسب إمكانيات اللغة ثم تقوم باستخدام بعض الوحدات الجاهزة التي تستطيع مناداة الإجراءات الخاصة بطريقة غير مباشرة وذلك بفضل خاصية الإنعكاس التي توفرها لغة الجافا Rreflection API)). كالآتي:

PrivilegedAccessor.invokeMehtod(Object obj, String methodName, Object[] args)

بحيث تكون:

obj: هي الوحدة التي تحتوي على الإجراء الخاص

mehtodName: اسم الإجراء

args: المتغيرات التي قد يحتاجها الإجراء.

تستطيع كتابة PrivilegedAccessor بنفسك أو الحصول عليها جاهزة من الموقع التالي:

http://sourceforge.net/projects/privaccessor

وإذا أردت أن تلقي نظرة على PrivilegedAccessor مباشرة على الإنترنت قم بزيارة الرابط: http://www.koders.com/java/fid15C64ACFCAFED5F0D60029CED7287ABF257DC92E.aspx

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

أتمنى لكم اختبارات ممتعة كما يستمتع بها طلاب المدارس هذه الأيام.

البرمجه باستخدام طريقة “التطوير المُسيَّر بالإختبار”

11 يونيو 2008

في هذه التدوينة سوف أشرح ماهي تقنية التطوير المُسيّر بالإختبار Test Driven Development وكيف استفدت منها.

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

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

(more…)

Dependency Injection in JavaServer Faces

10 يونيو 2008

Dependency Injection or Inversion of Control (IoC) is a great concept in software development. It supports decoupling of software components. It simply means you don’t create objects yourself; instead you depend on some other part to “inject” the object when needed. In this article I will explain how to utilize Dependency Injection capabilities provided by JavaServer Faces Technology (JSF).

Let us start with an example. Suppose you have the following classes (more…)

Consistent Look with JavaServer Faces

9 يونيو 2008

Software solutions developed to interface with human beings are of great importance than ever. So much research has taken place to improve this crucial area of Human-Computer Interaction. However several old mistakes still show up in many software solutions nowadays. One of the reasons is the technology used to build these systems. A successful technology should make developing high quality User Interface (UI) easy and the developer should face difficulty if going in the wrong direction. Most often, this is not the case and to overcome this problem developers standardize repetitive tasks. One repetitive task is presenting messages to the user.

In this article I will show how to build consistent messages (Information, Confirmation, and Error) in JavaServer Faces (JSF).

By convention, Java developers write pages supported by backing beans. Most of the time pages are JSP pages and backing beans are normal Java classes or so-called Plain Old Java Objects (POJOs).

In your application, you should have one component responsible for viewing messages supported by one backing bean. This is to make sure consistency is always there and if a change needs to be made it will be in one place not in tens of pages.

The following is an example of one JSP component that you can include in your application. (more…)