Archive

Archive for August, 2021

The Corridor: Nikon S9900 shot – 10

August 31, 2021 Leave a comment


Subject: Nikon S9900 Macro shot

In 2016 I bought Nikon Coolpix S9900, I have Nikon D90, and Nikon 7100 both are DX (crop sensor), but S9900 is my first Coolpix (point & shoot) camera from Nikon, I use to have Sony T100. [:. Read more about my cameras and lenses Here .:]

This Shot: Taken on 27-7-2021, A Black and White shot using Nikon S9900 for the corridor between car parking and the Door of Main Qatar Post Ofice.

…Click Image to Enlarge…
Ali radwani photo Photography camera Nikon s9900
Camera in Hand, F:3.7, ISO:125, Shutter:1/1000s



::.. To see all my Nikon S9900 Photos Click-Here
::.. To see all my Nikon D7100 Photos Click-Here
::.. To see all my Nikon D90 Photos Click-Here




ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Python: Coffee Consumption – P5

August 29, 2021 5 comments

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]

[ IF THE IS FIRST TIME DOWNLOADING THE CODE FILE, SELECT OPTION 7 FROM MAIN-MENU TO CREATE THE DATABASE]


In this part (Part-5) of Coffee Consumption App, we will write all three Function to manage the Coffee Size (Mug Size).

  • Create Function: Add New Coffee Size.
  • Create Function: Edit a Coffee Size.
  • Create Function: Delete a Coffee Size.

Beginning with adding new Coffee Size, we will ask the user to enter a New Coffee Size, then we simply added to the databasde using SQL Insert command. … Here is the Code ..

python project sql coffee consumption code ali radwani


The second Function in this part is to Edit a selected Coffee Size, so we will list-down all Sizes we have in the database, the user will select one (ID) then we will ask to enter the new one and update the database. Here is the code..

python project sql coffee consumption code ali radwani

Last Function in this part will be to Delete a selected Coffee Size, so again we will list all Coffee Sizes we have and will ask the user to select the one to be Deleted, then we execute the SQL command to Delete the record from the database… here is the code..

python project sql coffee consumption code ali radwani




What’s Coming: In Part-6 we will Start writing the Main Function to Add a Record of Coffee Consumption using the lookup tables data.


..:: Have Fun with Coding ::.. 🙂


Part 1 Part 2 Part 3 Part 4 Part 5
Part 6 Part – Part – Part – Part –


To Download my Python code (.py) files Click-Here



ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Python: Coffee Consumption – P4

August 26, 2021 6 comments

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]

[ IF THE IS FIRST TIME DOWNLOADING THE CODE FILE, SELECT OPTION 7 FROM MAIN-MENU TO CREATE THE DATABASE]


In this part (Part-4) of Coffee Consumption App, we will write all three Function to manage the Coffee types.

  • Create Function: Add New Coffee Type.
  • Create Function: Edit a Coffee Type.
  • Create Function: Delete a Coffee Type.

Beginning with adding new Coffee Type, we will ask the user to enter a new Coffee Type, then we simply added to the databasde. … Here is the Code ..

python project code coffee consumption ali radwani



Tip: To Capitalize user input we are using one line code
# Capitalize user input
user_input = ” “.join([word.capitalize() for word in user_input.split(” “)])

The second Function in this part is to Edit a selected Coffee Type, so we will list-down all Types we have in the database, the user will select one (ID) then we will ask to enter the new one and update the database. Here is the code..

python project code coffee consumption ali radwani

Last Function in this part will be to Delete a selected Coffee Type, so again we will list all Coffee Types we have and will ask the user to select the one to be Deleted, then we execute the SQL command to Delete the record from the database… Here is the code..

python project code coffee consumption ali radwani




What’s Coming: In Part-5 we will do the Follwing:

Writing three Function to Manage the Coffee Size, Functions are: Add New Coffee Size, Edit Coffee Size and Delete a Coffee Size.


..:: Have Fun with Coding ::.. 🙂



::.Coffee Consumption Parts.::

Part 1 Part 2 Part 3 Part 4 Part 5
Part 6 Part – Part – Part – Part –


To Download my Python code (.py) files Click-Here



ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Nikon S9900 shot – 8

August 24, 2021 Leave a comment


Subject: Photo From Qatar using Nikon S9900

In 2016 I bought Nikon Coolpix S9900, I have Nikon D90, and Nikon 7100 both are DX (crop sensor), but S9900 is my first Coolpix (point & shoot) camera from Nikon, I use to have Sony T100. [:. Read more about my cameras and lenses Here .:]

This Shot: A Photo from Qatar is a Tag i use for all photos i take for a Place or a Landmark of my country QATAR, in this photo; I was just finish shopping in a Grocery were i see this Mosque from the car parking, I use Nikon S9900 to take the shot then add the Black and white filter in my Tablet.

…Click Image to Enlarge…
ali radwani photo nikon nikor cmera coolpix s9900
Camera in Hand, F: 4.5, ISO: 125, Shutter: 1/1600s
Focal-Point: 11mm



::.. To see all my Nikon S9900 Photos Click-Here
::.. To see all my Nikon D7100 Photos Click-Here
::.. To see all my Nikon D90 Photos Click-Here




ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Python: Coffee Consumption – P3

August 22, 2021 7 comments

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]


[ IF THE IS FIRST TIME DOWNLOADING THE CODE FILE, SELECT OPTION 7 FROM MAIN-MENU TO CREATE THE DATABASE. ]


In this part (Part-3) of Coffee Consumption App, we will fill in some code into selected Functions. We will do the following:

  • Create Function: Show list.
  • Create Function: is_available.
  • Create Function: Manager Menu.
  • Create Manager Coffee Name Functions: Add, Edit, Delete

So, let’s start with writing the Manager Menu Function and a while loop to take the user selection and trigger the corresponding Function… Here is the Code ..

python project sql code coffee consumption ali radwani

We have two functions to help us in this application, one of them called def show_list(dt,d_id) is to Display the Data we have in the Lookup Tables based on the user selection function. The Function will take two arguments:
dt: data-table (Coffee Name, Coffee Type, Coffee Size)
d_id: id column name, and returning nothing.

Fisrt, let’s look at this Function:

python project sql code coffee consumption ali radwani


The second Function will be used to check if the user selection is available in the database, we will call it def is_available (dt, d_id, check_id) this Function is to check if the passed ID available in the data-set or not. The Function will take three Arguments as:
dt: Data-Table, d_id : Name of id column, check_id : The id we want to search for, and it will Return the data-set. After return, if dataset is empty that’s mean selected id is not available.

Now let’s see the function code..



Now we will start writing first three functions to manage the Coffee Name, and will start with Adding New Coffee Name to the lookup Table.
In coming code first we will call the header then show_list(‘coffee_name’,’cn_id’) passing Table Name:’coffee_name’ and id column:’cn_id’ to display the Coffee Names we have on the sccreen. Then we will ask the user to enter the New Name to be added to the database. Here is the Full code..

python project sql sqlite code coffee consumption ali radwani



Next we will write the Edit Function, and again after the header and show_list(‘coffee_name’,’cn_id’) we will ask the user to enter the ID of the Coffee Name to be change, here we will do a simple validation on user input. After that we will update the record that the user select. Here is the code..

python project sql code coffee consumption ali radwani



Last Function in this part is to Delete a selected Coffee Name by selection it’s ID, as in the Edit Fnction, the user will select an Id, we will check the availability the will execute the Delete command. Here is the code..


What’s Coming: In Part-4 we will do the Follwing:

Writing three Function to Manage the Coffee Type, Functions are: Add New Coffee Type, Edit Coffee Type and Delete a Coffee Type.


..:: Have Fun with Coding ::.. 🙂


Part 1 Part 2 Part 3 Part 4 Part 5
Part 6 Part – Part – Part – Part –


To Download my Python code (.py) files Click-Here



ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Nikon S9900 shot – 7

August 19, 2021 Leave a comment


Subject: Nikon S9900 – Fruit Basket Shot

In 2016 I bought Nikon Coolpix S9900, I have Nikon D90, and Nikon 7100 both are DX (crop sensor), but S9900 is my first Coolpix (point & shoot) camera from Nikon, I use to have Sony T100. [:. Read more about my cameras and lenses Here .:]

This Shot: A Fruit Basket, using Nikon S9900, camera in hand anu using normal room lights.

…Click Image to Enlarge…

Furit basket nikon S9900 camera by Ali radwani, sample image

Camera in Hand, F:…, ISO:…, Shutter:…



::.. To see all my Nikon S9900 Photos Click-Here
::.. To see all my Nikon D7100 Photos Click-Here
::.. To see all my Nikon D90 Photos Click-Here




ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Python: Coffee Consumption – P2

August 17, 2021 8 comments

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]


In this part (Part-2) of Coffee Consumption App, we will fill in some code into selected Functions. We will do the following:

  • Calling the Main-Menu Function.
  • Create header function.
  • Create the DataBase.
  • Create the Tables.
    • Insert the Zero records.
    • Insert data into Lookups Table.

So, let’s start with writing the main application body and calling the Main-Menu to trigger a Function based on the user selection. This section will be a calling the main_menu() in a while loop .. here is the code ..

# Main application body

while True :
    user_select = main_menu()

    if user_select == '1' :
        new_data() 

    if user_select == '2' :
        edit_record()

    if user_select == '3' :
        delete_record() 

    if user_select == '4' :
        #delete_record()
        pass 
        
    if user_select == '6' :
        c_name_type_size_manager() 
         
    if user_select == '7' :
        create_data_base()
    
    if user_select == '99' :
        input('\n\n   Thank you for using this Appliation. Press Enter.. > ')
        break



If we run the application now, we will see the main-menu but nothing will work because we still did not write any real Functions in the application.

Tables and Zero records:
Now we will write tha function to create the Tables and inserting the Zero record in each of them. All the codes will be in a function called: def create_data_base () : here are the name of the tables we will create:
coffee_con
coffee_name
coffee_type
coffee_size

and here is the full code in the function, in first part we will create the tables, second part will insert the zero record, last we will insert data in the lookup tables (coffee_name, coffee_type and coffee_size)

# def create_data_base () 

def create_data_base () :
    os.system('clear')
    
    line2 ="Create Data Base"
    header(line2,3,11)
    
    print('\n     All the data in the Data-Base will be removed, and can''t be retrieved. ')
    
    if input('\n     Press [Y] to Continue, anything else will Stop and Exite.  > ') not in ['y','Y'] :
        input('\n     You Select to stop and Exit. Press any Key .. >  ')
        return 
    
    # Part 1: CREATE TABLE:
    sql_coffee_con_t = "CREATE TABLE if not exists coffee_con (c_id INTEGER PRIMARY KEY AUTOINCREMENT, date_t,cn_id int, ct_id int, cs_id int, sex text, rank int )" 
    sql_coffee_name_t = "CREATE TABLE if not exists coffee_name (cn_id INTEGER PRIMARY KEY AUTOINCREMENT, c_name text )" 
    sql_coffee_type_t = "CREATE TABLE if not exists coffee_type (ct_id INTEGER PRIMARY KEY AUTOINCREMENT, c_type text )" 
    sql_coffee_size_t = "CREATE TABLE if not exists coffee_size (cs_id INTEGER PRIMARY KEY AUTOINCREMENT, c_size text )" 
    
    
    # Execute the commands
    c.execute(sql_coffee_con_t) 
    db_conn.commit() 
    c.execute(sql_coffee_name_t)
    db_conn.commit()
    c.execute(sql_coffee_type_t)
    db_conn.commit()
    c.execute(sql_coffee_size_t)
    db_conn.commit()
    
    
    # Part 2: Inserting ZERO records. 
    c.execute ("INSERT INTO coffee_con (date_t , cn_id, ct_id, cs_id, sex, rank) VALUES(:date_t , :cn_id, :ct_id, :cs_id, :sex, :rank)",{'date_t':'0' ,'cn_id' :0,'ct_id' :0,'cs_id' :0,'sex' :'0','rank' :0}) 
    db_conn.commit()
    c.execute ("INSERT INTO coffee_name (c_name) VALUES(:c_name )",{"c_name":'0'})         
    db_conn.commit() 
    c.execute ("INSERT INTO coffee_type (c_type) VALUES(:c_type )",{"c_type":'0'}) 
    db_conn.commit() 
    c.execute ("INSERT INTO coffee_size (c_size) VALUES(:c_size )",{"c_size":'0'}) 
    db_conn.commit() 
    
    
    
    # Part 3: Inserting Basic Information 
    coffee_Name_list = ['Black','Latte','Espresso','Americano','Cappuccino','Mocha', 
                     'Lungo', 'Flat white', 'Irish', 'Macchiato','Ristretto','Iced coffee']
        
    coffeeType_list = ['3n1' ,'Pods','Grounded']
    
    coffeeSize_list = ['Samll', 'Medium', 'Large', 'Venti']
    
    for each in coffeeName_list:
        c.execute ("INSERT INTO coffee_name (c_name) VALUES(:c_name )",{"c_name":each}) 
        db_conn.commit() 

    for each in coffeeType_list:
        c.execute ("INSERT INTO coffee_type (c_type) VALUES(:c_type )",{"c_type":each}) 
        db_conn.commit() 
    
    for each in coffeeSize_list:
        c.execute ("INSERT INTO coffee_size (c_size) VALUES(:c_size )",{"c_size":each}) 
        db_conn.commit() 

    input('\n\n     Data-Base Created, Basic Information Inserted. press any key to continue. > ')

[ The Full Code is Available in Download Page. ]

Last Function in this part is the header, it’s just a Title that will bee displayed in a box at the top of each page. Here is the code ..

# Header of the Application

def header(line2,b_l2,a_l2):
    os.system('clear')
    # The Project Name.
    line_1 = "Coffee Consumption"
    stars = 40 
    print('\n',' '*4,'*'*stars)
    print(' '*5,'***',' '*5,line_1,' '*7,'***')  
    print(' '*5,'***',' '*(stars - 8),'***')
    print(' '*5,'***',' '*b_l2,line2,' '*a_l2,'***')
    print(' '*5,'***',' '*(stars - 8),'***')
    print(' '*5,'*'* stars,'\n')


What’s Coming: In Part-3 we will do the Follwing:

  • Writing a function show_list.
  • Writing the function to Add New Coffee Name.
  • Writing the function to Edit a Coffee Name.
  • Writing the function to Delete a Coffee Name.


..:: Have Fun with Coding ::.. 🙂


Part 1 Part 2 Part 3 Part 4 Part 5
Part 6 Part – Part – Part – Part –


To Download my Python code (.py) files Click-Here



ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Nikon S9900 photo – 6

August 14, 2021 Leave a comment


Subject: Nikon S9900 Macro shot

In 2016 I bought Nikon Coolpix S9900, I have Nikon D90, and Nikon 7100 both are DX (crop sensor), but S9900 is my first Coolpix (point & shoot) camera from Nikon, I use to have Sony T100. [:. Read more about my cameras and lenses Here .:]

This Shot: A Close up shot on old antique classic numerals clock. using Nikon S9900.

ali radwani nikon s9900 sample photo photography
Camera in Hand, F:…, ISO:600, Shutter:…



.::.. To see all my Nikon S9900 Photos Click-Here
.::.. To see all my Nikon D7100 Photos Click-Here
.::.. To see all my Nikon D90 Photos Click-Here




ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani

Python: Coffee Consumption Part-1

August 12, 2021 9 comments

Learning : Python, SQlite3, Dataset, Pandas,
Subject: Create Coffee Consumption Application.

[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]

Last week I post an articale about generating Fake Data-Set about Coffee Consumption, and using that dataset in ML and DeepLearning. [Read the Story]. I’ve got a request from someone asking to build a reall Full Application that can be used in a Coffee Shop and collect/track his Coffee orders (consumption). So here is the application.

Road Map

Brain Storming
In this python project will collent some informatin based on a friend requerment. Our Task is:

  • Data Gathering.
  • Designing the Database and Tables.
  • Writing python Functions to do the Following:
    • Create the Main-Menu. [Add, Edit, Delete for main Table]
    • Create the Manager Menu. [Add, Edit, Delete for each lookup Tables]
    • Create the database and the tables:
      • Main: coffee_con.
      • Lookup: coffee_name.
      • Lookup: coffee_type.
      • Lookup: coffee_size.
    • Inserting Zero record.
    • Inserting Basic Data in all Lookup tables.
    • Creating all Functions we need such as:
      • Add, Edit, Delete Coffee Names.
      • Add, Edit, Delete Coffee Types.
      • Add, Edit, Delete Coffee Sizes.

    ..:: In Part -1 ::..
    In this part, we will create a python file, and will write all the functions header [we think we may need] so late we can add the codes inside, of course we may add other functions later [if we miss it here].
    So, starting from the Main-Menu, we will have
    – Add New Order.
    – Edit an Order.
    – Delete an Order.
    – Show Orders.
    [… SETTING …]
    – Coffee Names, Type and Size Manager.
    – Create the database.
    – Back-up Data. (as CSV)
    – Exit.

    Here is just a sample of the code, in this part no much coding of the Functoins, as we said only Functions Names, the full code is available in the Download Page.[ Click Here ]

    # Sample of Functions Names in our Application 
    
    import os
    import sqlite3
    
    
    def header():
        pass
    
    def create_data_base () :
        pass
            
    def main_menu():
        pass    
    
    def new_record():
        pass
                
    def edit_record():
        pass
        
    def delete_record():
        pass
            
    def backup_dataset():
        pass
    
    
    

    … The above are just a sample of Functions that we may have in the application, you can download and read the Project file.

    What’s Coming: In Part-2 we will do the Follwing:

    • Writing the Main Menu Function.
    • Creating the DataBase.
    • Writing the Function to Create the Tables.
    • Inserting the Zero Records.

    ..:: Have Fun with Coding ::.. 🙂

    Part 1 Part 2 Part 3 Part 4

    To Download my Python code (.py) files Click-Here



    ali radwani ahradwani.com python projects codeFollow me on Twitter..

    By: Ali Radwani

Nikon S9900 shots – 2

August 10, 2021 Leave a comment


Subject: Nikon S9900 Cold Coffee shot

In 2016 I bought Nikon Coolpix S9900, I have Nikon D90, and Nikon 7100 both are DX (crop sensor), but S9900 is my first Coolpix (point & shoot) camera from Nikon, I use to have Sony T100. [:. Read more about my cameras and lenses Here .:]

This Shot: Cold Coffee, using Nikon S9900.


Camera in Hand, F: 3.7, ISO: 400, Shutter: 1/15s




ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani