Tuesday, October 13, 2020

Nginx

 
 

Before explain Nginx we have to explain many things , now let us say we want to visit google.com so we will open our browser and type the URL www.google.com and but actually what is happening ?

when we visit any web site we actually visit a computer or a WEB SERVER , so the web server is the computer that has a public ip and domain and it can provides web pages , so any web site that we visit can be a computer (server) or more than on computer (servers) 
 
 
Web server 
    is a computer that can deliver requested web pages , and it has ip address and domain name  
 

now how to make my computer work as web server ?

To make any computer works as a web server we have to do two main things 
     _ Use web server software , which is that software make your computer act as web server , and these software can be (XAMPP , Nginx, microsoft IIS ... etc)
     _ connect your computer to the global network  

 

What is Nginx ?

NGINX is open source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers. (ref)


How to install nginx on ubuntu ?

open your terminal and write down the commands bellow 

       sudo apt-get update

       sudo apt install nginx

 after install it , you can check it by open "localhost" on your browser , and if it open the page on the image above that means it installed successfully 


Create your website with nginx

Default page is placed in /var/www/html/ location. You can place your static pages here, or use virtual host and place it other location


Sunday, September 27, 2020

ASAP


 





what is ASAP

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

Benefits of ASAP

توفير الوقت لكل الوكالات الفدرالية والمستفيدين 
أكثر أمان في نقل الأموال
يقلل من تكلفة ومسؤولية إمتلاك أموال خارج الخزينة
يعمل دون الحاجة إلى تثبيت برنامج جديد
يتيح للوكالات والمؤسسات الحصول على تقارير بالبيانات ذات الصلة بمافي ذلك أرصدة الحسابات وتاريخ وحالة المدفوعات 
دعم العملاء المباشر لكل الوكالات والمستفيدين



Payment Options with ASAP

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

How ASAP works

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

show selection field on webpage

ODOO

 



To explain how to show selection field on your webpage as we did in the image, let us say that we have created web page or we want to show new selection field on our odoo website shop "we add new selection field to our products and we want to show it on shop page"
 
so we can show our field just as below 
 
<select class="form-control" name="category">
      <t t-foreach="product.sale_units_ids" t-as="category">
            <option t-attf-value="#{category.id}"><t t-esc="category.name"/>  </option>
      </t>
</select>

Tuesday, September 22, 2020

Cloud computing

Cloud Computing



What is the cloud computing ?

Cloud Computing : is the delivery of computing services such as "networks, software, databases and storage" over the internet in order to offer many features such as " flexibility, availability, and high performance "

What are the benefits cloud computing ?

  •  reducing costs : using the cloud computing can be lees costs than create your own software or information system or your own applications and baying the need devices to run it for many reasons 
  1. reducing the cost of the system upgrade and the hardware costs 
  2. no need to pay for your IT staff 
  3. reducing your energy costs 
  4. fewer time delays
  • business continuity : Cloud computing can provide the most guarantees of business continuity as it reduces data loss and security problems for the enterprise business information.
  • Automatic access to updates :  Through the cloud computing, updates can be installed automatically in the system, which reduces the time, effort and costs that were consumed in the process of updating
  • Collaboration efficiency : Cloud computing gives you wider and easier options to deal with the external community, customers, suppliers, and everyone you need to communicate with to complete your business
  • Flexibility : Cloud computing allows high levels of flexibility for employees to conduct business, as all that is needed for the employee to do business is to connect to the Internet, so the employee can do business from both home and office

     

     

     

 

 

Saturday, September 19, 2020

Type casting in java

JAVA



in this blog we will explain type casting and ASCII codes in java 

 To explain the type casting let us ask question  , if we have the code this code bellow , what the value will store in the variable num at the end of this code ?

public class test{
    public static void main(String[]args){
        int num;
        num = 7/2;
    }
}

yes , you are right num will contain 3 , but let me ask another two questions , is 7/2 really equals 3 ? and why it's contain 3 , not 3.5 ?

of course it's contain 3 because it's defined as integer variable , and if we want to store a decimal number on it , we have to convert it from integer to double or float , in another words we have to make type casting for it 

So , the Type Casting in java is The process of converting the value of one primitive data type to another data type

so now we can say that "we can change either the value of a variable or it's data type 

And the ASCII is a code for representing English characters as numbers, each letter of english alphabets is assigned a number ranging from 0 to 127

 

Now let us give an example to explain all of this , 

Q: write a java  program in which you define a variable that contain one English letter , then the program must check if the letter is in big case , convert it to small case , and the opposite

 

So the code can be just as : 

public class test{
    public static void main(String[]args){
        char letter = 'A';
        if((int)letter >= 65 && (int)letter < 97){
            letter = (char)((int)letter+32);
            System.out.println("the letter was capital converted to small "+letter);
        }
        if((int)letter <= 129 && (int)letter >= 97){
            letter = (char)((int)letter-32);
            System.out.println("the letter was small converted to capital "+letter);
        }
    }
}

 

and the output will be as bellow 

 





 

Java Code Examples

تعليم البرمجة

Java codes

  •  write a program in java that define a char variable and store a letter in this variable , then if the letter is capital print "Capital Letter" and if it's small print "Small Letter", and the out put must be as bellow 
أكتب برنامجًا في جافا يحدد متغير نصي ويخزن حرفًا في هذا المتغير ، فإذا كان الحرف كبير أطبع
"Capital Letter" 
وإذا كان حرفًا صغيرًا أطبع
"Small Letter" ،
ويجب أن يكون الإخراج كما يلي
 


and the code can be just as 

public class test{
    public static void main(String[]args){
        char st_text = 'A';
        if((int)st_text>64 && (int)st_text<97){
            System.out.println("Capital Letter");
        }
        if((int)st_text>96 && (int)st_text<123){
                    System.out.println("Small Letter");
        }
    }
}



  • write a java program in which you must define 2 integer variables with 2 values , and then switch the values with out using any other variable ,  and the out put must be as bellow 
اكتب برنامج جافا وقم بتحدد متغيرين صحيحين مع قيمتين ،
ثم قم بتبديل القيم بدون استخدام أي متغير آخر ،
ويجب أن يكون الإخراج على النحو التالي
 


so the code can be just as 

public class test{
    public static void main(String[]args){
        int num1 = 10,num2 = 20;
        System.out.println("____________________ Before converting _____________________");
        System.out.println();
        System.out.println();
        System.out.println("the first number is = "+num1);
        System.out.println("the second number is = "+num2);
        System.out.println();
        System.out.println();
        System.out.println("____________________ After converting _____________________");
        System.out.println();
        System.out.println();
        num1 = num1+num2;
        num2 = num1-num2;
        num1 = num1-num2;
        System.out.println("the first number is = "+num1);
        System.out.println("the second number is = "+num2);
        System.out.println();
        System.out.println();
    }
}



  • write a java program that check if a number It is divisible by 3 and 4 , and the out put must be as bellow 
اكتب برنامج جافا للتحقق مما إذا كان الرقم قابلاً للقسمة على 3 و 4 ،
ويجب أن يكون الإخراج على النحو التالي

so the code can be just as 

public class test{
    public static void main(String[]args){
        int num = 29;
        if(num%3 == 0 && num%4 == 0){
            System.out.println("Right number");
        }
        else{
            System.out.println("Wrong number");
        }
    }
}




Wednesday, September 16, 2020

Examples Java Codes

java codes

تعليم البرمجة

Example 1

Q :
 write a program in Java that calculates the ratio of upper and lower case letters in the following text 
"To be or not To be: That Is the Question"
 
so the code will be just as 

public class test{
    public static void main(String[]args){
        String var_string = "To be or not To: That Is the Questtion";
        double big_letters_per ,small_letters_per;
        int big_letters_counter = 0,small_letters_counter = 0;
        for(int index=0;index<var_string.length();index++){
            if ((int)var_string.charAt(index)>=65 && (int)var_string.charAt(index)<=90) {
                big_letters_counter = big_letters_counter+1;
            }
            if ((int)var_string.charAt(index)>=97 && (int)var_string.charAt(index)<=122) {
                small_letters_counter = small_letters_counter+1;
            }
        }
        big_letters_per = big_letters_counter*100/var_string.length();
        small_letters_per = small_letters_counter*100/var_string.length();
        System.out.println("The big letters percentage is "+big_letters_per+" %");
        System.out.println("The small letters percentage is "+small_letters_per+" %");
        System.out.println("The spaces percentage is "+(100-(small_letters_per+big_letters_per))+" %");
    }
}


and the output will be as bellow 



Example2
 
Q:
 If A and B are two arrays with a certain number of integers, write a Java program to alternate the elements of the two arrays symmetrically without using other variables or matrices.
 
so the code will be just as 
 
public class test{
    public static void main(String[]args){
        int [] A = {1,2,3,4,5};
        int [] B = {6,7,8,9,10};

        System.out.println("the items of array A before change are ");
        for (int index=0; index<5; index++) {
            System.out.print(A[index]+" , ");
        }
        System.out.println();
        System.out.println();

        System.out.println("the items of array B before change are ");
        for (int index=0; index<5; index++) {
            System.out.print(B[index]+" , ");
        }
        System.out.println();
        System.out.println();

        for (int index=0; index<5; index++) {
            A[index] = A[index]+B[index];
            B[index] = A[index]-B[index];
            A[index] = A[index]-B[index];
        }

        System.out.println("_________________________________________________");

        System.out.println("the items of array A after change are ");
        for (int index=0; index<5; index++) {
            System.out.print(A[index]+" , ");
        }
        System.out.println();

        System.out.println("the items of array B after change are ");
        for (int index=0; index<5; index++) {
            System.out.print(B[index]+" , ");
        }
        System.out.println();
    }
}

 
and the output will be as 
 

 
 Example 3
 

Q: 
 
 write a Java program to define the class "person".Contains the variable name_id, year of birth, and year, Then define the "student" class to inherit the elements of the first class, and add  the variables "std_id", "dept", and the "prinrSTD" function to print the complete student data Then define the "test" class that contains the main function, and then execute the program with complete data for the student
 
So the code will be just as

public class test{
    public static void main(String[]args){
        student std = new student();
        std.prinrSTD("Omer",1999,216001,"Mobile Computing");
    }
}

public class student extends person{
    int std_id;
    String dept;
    public static void prinrSTD(String p_name,int year,int std_id,String dept){
        System.out.println("name : "+p_name);
        System.out.println("Birth Year : "+year);
        System.out.println("Student ID : "+std_id);
        System.out.println("Department : "+dept);
    }
}

public class person{
    String p_name;
    int year;
}


and the output will be as



*Note : you have to create each class in a different file in the third example

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...