Archive

Archive for November, 2021

Arduino: IDE and Coding

November 25, 2021 3 comments

Learning : Arduino Projects, Arduino Coding, Electronic Circutes
Subject: First Application, Light the LED

[NOTE:
W
e are working on Electronic Devices, Voltage, Resistors and other Electronic Parts that may Become HOT due to un-stable current or Wrong Wire Connections..
PLEASE BE CAUTIOUS AND TAKE SAFETY NEEDED PROCEDURES.]



IDE: IDE is the place or the editor that we can write the code in. Arduino has one that can be Downloaded from [ www.arduino.cc] then from the menu > Software.

Coding: The coding rules and best practes:

  • Essentially consist of Two Main Functions: void setup() and void loop().
  • Each Code line MUST end with Semicolon ;
  • Code block Must be between two Curly-Brackets { }
  • Declaration: if we have variavbles we need to declare them before we use them. Best-Practice: we put them at the top of our code page.
    Sample:
    int x ;
    int y = 50;
    const int t = 250
  • Our Functions: Best-Practice: Put them between the void setup() and void loop().
    SAMPLE:
    void led_on ( )
    {
    digitalWrite(12, HIGH);
    }
  • To put a comments in the code we use double front-slash // use it for one line comments. Best-Practice: Use comments to describe your codes and Functions.
  • To Comments several lines we use /*
    /* all the lines
    between it will be
    as comments.*/
  • IF Statment: if (int x > 10) { your code }
  • For-loop: for(int x = 0; x < 5; x++) { your code }


So, I think this is the most important things we have to know to start coding our Arduino. With each practice and project we will work on we will describe coding-lines and commends we use.


I am not sure if i will continue in this way or say “New Learning Curve”, The Coding and Commanding an Electronic-Bord to Work as my Application says .. THIS PART WAS WHAT LIT THE FUSE IN MY BRAIN.

:: ARDUINO PROJECTS LIST ::

3 First Project: Coming Soon..
2 Code Editor, coding Blocks, learn Coding
1 Arduino, The Story, Components, Parts and What we will Do?

To Download the ARDUINO Project [Code and Diagram] files Click-Here



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

By: Ali Radwani

Python Project: Properties Maintenance System P8

November 21, 2021 4 comments

Subject: Writing a Full Application for Properties Maintenance System [Property: Delete a Record]
Learning : Python, Math, SQL, Logeic

[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 we will write a Function to Delete a record from the database, first we will call the def show_property(inside) to display all the records on the screen and ask the user to Select [enter] the ID of the Property to be Deleted. Next we will Display the Record again on the screen and ask the user to Confirm the Deleting by entering [Y] and any things else will be as [Don’t Delete]. Here is the code ..

python project Properties Maintenance System code by ali radwani doha qatar


.. End of Part 8 ..

NOTE: If you Download this Part you MUST Run the Option 82 (82. Delete the Data-Base and Start Again.) from the Main Menu to do the following Updates:

  • Update the properties_t Table (Adding the number of BathRooms)
  • Update on create_tables Function.
  • Update on insert_zero_records Function.

If you did this in last part (6) then you don’t need to do it again


In Part-9 In the Next Part, we will write the Function to Edit a record of a selected Property.



:: PMS Parts ::

Part 1 Part 2 Part 3 Part 4
Part 5 Part 6 Part 7 Part 8



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

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



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

By: Ali Radwani

Daily Sketch challenge..

November 18, 2021 Leave a comment

This sketch back to last week, but I am trying to keep myself in the challenge of “A Sketch A Day ” as far as I can. Here is a sketch and I color it using Autodesk sketchbook Application.

Arduino Projects: The Story

November 16, 2021 3 comments

Learning : Arduino, Arduino Coding, Electronic Circutes
Subject: The Story and Orders

[NOTE:
W
e are working on Electronic Devices, Voltage, Resistors and other Electronic Parts that may Become HOT due to un-stable current or Wrong Wire Connections..
PLEASE BE CAUTIOUS AND TAKE SAFETY NEEDED PROCEDURES.]

The Story: Last month i was searching the net for something, Someway, Some projects make my Kids love Math and Science Subjects, I went through several pages … then I fond classes teaching the young students how to build simple circuits, using Led’s and 9V Batteries.. I start reading more in this subject then I found the ARDUINO Chip, were the students can write a code to switch on/off some LED’s. This thing Triggered the Passion of learning and trying new things. So I spend two/three days reading about it, and decide to give it a try.

What I Need: This is my first time reading about Electrical Circuits, I have some ides, but I Don’t have any Equepments to start. So from there I start submitting orders to buy things that I will need, i got the list from tutorial youtube. Here is the list of my orders:

ali radwani ARDUINO Projects


I am not sure if i will continue in this way or say “New Learning Curve”, The Coding and Commanding an Electronic-Bord to Work as my Application says .. THIS PART WAS WHAT LIT THE FUSE IN MY BRAIN.

.. NEXT POST .. In Next post I will write about ARDUINO [simple information as far I know 🙂 ] How it Works, and Firs simple Project [without coding].

:: ARDUINO PROJECTS LIST ::

2 Code Editor, coding Blocks, learn Coding
1 Arduino, The Story, Components, Parts and What we will Do?

To Download the ARDUINO Project [Code and Diagram] files Click-Here



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

By: Ali Radwani

Python Project: Properties Maintenance System P7

November 14, 2021 5 comments

Subject: Writing a Full Application for Properties Maintenance System [Property: Showing the Records in Main property Table]
Learning : Python, Math, SQL, Logeic

[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.]


After adding Records to the Main Property Table, we need to display the records on the screen. So now in this part (Part -7) we will write a function to display all the records. The Function name will be def show_property() the function is not taking any attribute and is Not returning any things. First we will print-out the Table-Header then we will run an [SQL: select * from table-name] command to fetch all the records, then will [for loop] and test-format to print all the records on the screen. Here is the Code ..

python project Properties Maintenance System code by ali radwani doha qatar

After i display the records, I notes that the Address-Column needs more than one row (in some cases), and it miss the line formating, so I wrote a function and call it def warp_text(tex,warp_on,nl_space) the function takes three arguments,
the test: it the text/string you want to print.
warp_on: is a number of character before the new-line.
nl_space: is the number of white-character in the new-line.
Here is the Code ..

 # Function to warp 

def warp_text(tex,worp_on,nl_space) :
    c = 0
    
    for t in range (len(tex)) :
        print(tex[t],end="")
        c += 1
        if c == worp_on :
            print('\n', ' '*nl_space, end="")
            c = 0 



Check all the codes in the Download Page..
End of Part 7

NOTE: If you Download this Part you MUST Run the Option 82 (82. Delete the Data-Base and Start Again.) from the Main Menu to do the following Updates:

  • Update the properties_t Table (Adding the number of BathRooms)
  • Update on create_tables Function.
  • Update on insert_zero_records Function.

If you did this in last part (6) then you don’t need to do it again


In Part-8 In the Next Part, after adding and showing the records we will write the Function to Delete a record from the Table.



:: PMS Parts ::

Part 1 Part 2 Part 3 Part 4
Part 5 Part 6 Part 7 Part 8



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

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



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

By: Ali Radwani

Park-Side: Nikon S9900 shot – 18

November 10, 2021 Leave a comment


Subject: Photo with 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: This is a shot across my car window next to the Kids School, a photo of a tree in a park. I am using Nikon S9900.

…Click Image to Enlarge…
ali radwani ahradwani.com photo photography Nikon coolpix camera s9900 lens
Camera in Hand, F: 4.8, ISO: 125, Shutter: 1/1250s, Focal-Point: 13mm



::.. 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 Project: Properties Maintenance System P6

November 8, 2021 6 comments

Subject: Writing a Full Application for Properties Maintenance System [Add New Property Functions]
Learning : Python, Math, SQL, Logeic

[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.]


This is Part-6 of an Application to Manage Properties Maintenance in this part we will writ a Function to Add New Property to our System.

Add New Property:
This May be the longest Function in our system, we will ask the user to Enter the Data for a New Property and then saving it to the DataBase.

Simple Validation:
In this Function we will do a very simple check on the user inputs, and will keep this as simple as we can so the code will not be long. Sample on this Validation will be if the user enter [E or e] we will exit the process and stop the Function.

Code Part Sample:
In asking the user to select the property Type were we are using a look-up table for the Property Types, we will use the Function def get_lookup_values(tname,t_id,key_id): were we passing the table-name, the ID column name and the ID of the data we want to retrieve. Another code part we may see is checking the user input of the p_type_id (MUST BE NUMERIC)

if (p_type_id.isalpha()):
input(‘\n You Must Enter a Numeric Value. Press any key to Try Again .. > ‘)
.
Also we can see the part of the code that will make sure that the user did not enter the [E to Exit] (if the user enter E we will display a message then will return to the Menu-Page)
p_bedrooms = input(‘\n Enter the Number of Bedrooms in the Property. [E to Exit] > ‘)
if p_bedrooms in [‘e’,’E’] :
input (‘\n You Select to Exit .. Press any Key. >’)
return



Saving the Record:
After the user Enter all the data we need we will display it on the screen and asking for a confirmation to Save the record, If the user Enter [Y] as Yes, we will use the “INSERT INTO properties_t …” SQL command to save the Record to the dataBase.
Here is a screen-shot of the all code of the Function,

python project Properties Maintenance System code by ali radwani doha qatar



NOTE: If you Download this Part you MUST Run the Option 82 (82. Delete the Data-Base and Start Again.) from the Main Menu to do the following Updates:

  • Update the properties_t Table (Adding the number of BathRooms)
  • Update on create_tables Function.
  • Update on insert_zero_records Function.


In Part-7 In the Next Part we will write the Function to Display/Show all the Records of the Main-Property-Table on the screen.



:: PMS Parts ::

Part 1 Part 2 Part 3 Part 4
Part 5 Part 6 Part 7 Part 8



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

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



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

By: Ali Radwani

Grey Time: Nikon S9900 shot – 17

November 4, 2021 Leave a comment


Subject: The Grey Time Exhibition with 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: In the way to Home back from Kids School, I take this shot using Nikon S9900 from my car waiting for the trafic-light. Grey Time Exhibition Poster showing the Date and Time for an Exhibition Event in this building. [Grey / Gray are the same and are correct spilling, Grey is used is a British English and Gray is an American English]

…Click Image to Enlarge…
ali radwani photography photo nikon camera s9900 doha qatar ahradwani.com
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 Project: Properties Maintenance System P5

November 2, 2021 7 comments

Subject: Writing a Full Application for Properties Maintenance System [Maintenance Job List]
Learning : Python, Math, SQL, Logeic

[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 Part-5 We will writing the Functions to Manage the Maintenance Job List Functions. Maintenance Job List is a list of things that the Customer/ Renter may ask to repair [if Damage]
such as the AC, TV, Lights or water-system in the property. In this Part, we will write three Function so we can Add, Edit and Delete from this list. So let’s start with Adding to Maintenance Job List.

Adding to Maintenance Job List:
Once the user select this option from the Menu, then the prompit will ask to enter a New Maintenance Job to the List and the SQL [INSERT INTO] command the Database will be updated with one record. Here is the code ..

python project Properties Maintenance System code by ali radwani doha qatar AHRADWANI.COM


Edit Maintenance Job List:
In this Function the user will see all the Maintenance Jobs we have in the DataBase and will be asked to select one to be Edited [by selecting it’s ID], we will check the availability of the ID then will waite to Enter the correct one. Here is the code that will Update one of the Jobs item.

python project Properties Maintenance System code by ali radwani doha qatar AHRADWANI.COM


Delete from Maintenance Job List:
Last Function today will be to Delete from the list. Here also we will list all the Maintenance Jobs we have in the DataBase and will be asked to select one to be Deleted [by selecting it’s ID], we will check the availability of the ID then will ask the user to confirm Deleting. Code is here ..

python project Properties Maintenance System code by ali radwani doha qatar AHRADWANI.COM



End of Part-5, this was the last Function in this post, Now we have all Functions to works with the look-up tables in our application.


In Part-6 In coming post we will continue writing Functions that will Add records to the system.



:: PMS Parts ::

Part 1 Part 2 Part 3 Part 4
Part 5 Part 6 Part 7 Part 8



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

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



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

By: Ali Radwani