Archive

Posts Tagged ‘ahradwani’

Nikon S9900 shots – 5



Subject: Nikon S9900 Milk and Coffee

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: I place my Milk Mug in the sun-light coming from a window, the camera on graound level and i took the shot using BW-color from the camera.

…Click Image to Enlarge…
Nikon s9900 coolpix camera Ali radwani ahradwani.com photo Photography

Camera in Hand, F:4 , ISO:160 , Shutter: 1/30s



::.. 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 Sorting Algorithm – Heap Sorting -P5


Learning : Python, Math, Algorithm
Subject: Sorting Algorithm, Heap Sort P5

[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 Last Parts (2, 3 and 4) we wort the Following Functions:

  • Sections Header.
  • Main Menu Function.
  • Entering/Creating the Array.
  • Print-Out or to Display the Array.
  • Check If Array in Max-Heap.
  • Convert Array to Max-Heap.
  • Add Node to Max-Heap.
  • Delete a Node from a Max-Heap.

In this last part-5 we will write the last main Function to aplay the Heap Sorting Algorithm.

Scope of Work: Deleting a Node from a Max-Heap Array is the main function in sorting an Array using Max-Heap Algorithm, the Deleting is always from the Root Node, So if we delete the most top Node [Root] (and store it in index[0] in a temp_array) then we move the Last Node to it’s position and by doing that we miss the Max-Heap state of the Array, so we convert the array to a Max-heap, then we Delete the Root again until we delete all the elements in the Array.. Here the Algorithm:

Assuming we have a Max-Heap Array:
1. Delete the Root Element, and Store it in index[0] in Temp_array.
2. Move the Last Element in the Array to index[0].
3. If the Array not in Max-Heap then Convert it to a Max-Heap.
4. Repeat Steps 1 to 3 Until length of Array is 0.

In our list of Functions up, we have the three Functions we Need to complete/apply a Max-Heap Sorting:
We Delete a Node using def delete_node(arr,inside):
then in a while loop we call both
def check_if_max_heap (arr,inside): and
def convert_to_max_heap (arr,inside): so let’s see the code..

ali radwani ahradwani.com python project code heap sorting algorithm


We finish Max-Heap Sorting Algorithm, ..

..:: 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

Python: Kadane’s Algorithm


Learning : Python, Algorithm, Math
Subject: Implement the Kadane’s Algorithm

Definition: Kadane’s Algorithm is to search in a one Dimensional Array [integer positive and negative numbers] for a we will largest Sum of contiguous subarray.

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

Algorithm To find the largest subset sum, we apply coming step:
We will use two variables:
current_max: to hold the max sum of thesub-set
start_again: will be as a flag to re-set the current_max

Algorithm:
1. Start from Element in the array index = 1, save it as start_again. Set Current_max to Array Element in index = 0.

2. Do sumation of start_again with the next element index + 1.

3. If current_max < start_again then re-set current_manx = start_again

4. If start_again < 0 then re-set start_again = 0

5. Repeat from 2 to 4 until the end of the array.

6. If we reach end of the Array, then return the current_max

More from Kadane’s Algorithm:
The aim of Kadane’s Algorithm is to return the Maximum sum of sub-set. But in our code here we will return the following:
1. Maximum sum of largest subset
2. The start Index and the End Index of the subset.
3. printing out the subset.

We will have three options in our application, as following:
1. Kadane’s Algorithm – Fast Run.
2. Kadane’s Algorithm – Step By Step.
9. Exit.

As we are doing in our Algorithms coding, we will use a Main-Menu, and a Function to help the user to enter the Array.

Coding
We will start with def create_array(): and will return the Array that the user will enter. here is the code..

Ali radwani python project code Kadane Algorithm



Now, here is the code for the Main-Menu and the Main application body. In Main application body code, we will use the while True : loop and calling the main_menu() function then with if statement we will check on the user_selection

The Main-Menu
Ali radwani python project code Kadane Algorithm
Here is the Main Application body code..

Ali radwani python project code Kadane Algorithm



Last, we will write the Function to get the Kadane’s Sum in a Fast-Run, the details one will be a copy with mode print-out statement to show the steps .. [All code is in Download Page.]
As we mentioned, Our Kadane’s function will return three things, the Grates Sum of a sub-set, and to position of that sub-set as start index and end index. Here is the code ..

Ali radwani python project code Kadane Algorithm
Here is a Run-Time screen ..

Ali radwani python project code Kadane Algorithm



We done with another Algorithm, looking forwards to solve new one in coming days.

..:: 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

Python Project: Disarium Numbers in Range


Learning : python code
Subject: Finding the Disarium number
in a range

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

Definition We call a Number as A Disarium Number if the Sum of it’s Ddigits Powered with their Respective Position is Equal to the Original Number.
So 89 is a Disarium Number, because 8^1 + 9^2 = 8 + 81 = (89 the original number)
and 135 is also a Disarium Number, because 1^1 = 1, 3^2 = 9, 5^3 = 125 and the Total is [1+3+125 = 135 the original number]
we have a previous post to check if a given number is a Disarium Number or not … Read The Post Here .. In this post we will write the Function to print-out all the Disarium Numbers in a given range.

So our application will ask the user to enter two Numbers as a range From and To, then the disarium_n_range(num1,num2) taking two argument will work through a For loop to check each number in the range and if it is a Disarium Number we will store it in a list (disarium_n =[]) .. Let’s start by the asking the user to Input the range numbers..

 # Code to collect the Numbers from the User

print('\n\n   This Project will Print-Out all the Disarium Numbers in a given range.')
num1 = input('\n   Enter the From Number. > ')
num2 = input('\n   Enter the To Number.   > ')




And now let’s see the main Function of the application ..

python project code doha qatar ali radwani


Run-Screen for the range From 10 To 99

python project code doha qatar ali radwani


Another Run for the Range From 100 To 999

python project code doha qatar ali radwani



End of the post ..

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



Follow me on Twitter..

By: Ali Radwani

Sketch of a Swan

April 25, 2021 2 comments

Using a pencil then black pen and a photo from the Net as a reference, here is a sketch of a Swan in a Lake.

Follow me on Twitter @h_ta3kees

ali radwani draw sketch pen pencil swan lake

Flowers in my lens… 9

April 22, 2021 Leave a comment

Some time the Fake is there as well as the real…. Here are some small FAKE pink flowers in a bouquet of flowers. I use a galaxy Note 9 phone to take this photo.

Click here and follow me on Twitter @h_ta3kees

ali radwani doha qatar pink flowers photo galaxy note9

Coffee and Boat

April 20, 2021 Leave a comment

Some time you need a coffee, and some time you need a strong one .. here is a small shot of Turkish Coffee in a small beautiful cup from Holland . Photo taken by galaxy Note 9 .

Click and follow me on Twitter @h_ta3kees

ali radwani Turkish coffee and boat camera galaxy note9

Another sketch challenge: Lion’s Face

April 11, 2021 Leave a comment

This week sketch challenge @1hour1sketch is to Draw a Lino Face, so here is my sketch using pencil, black Pen.

I tried to do my best to draw the hair/mane am sure I can’t do better than this, I need more practice in doing fur drawing.

More Sketches on my Sketch page ..

also follow me on Twitter @h_ta3kees

ali radwani sketchbook sketch lion face pencil black pen

Flowers in my lens..6


Another beautiful flower in taken by Galaxy Note 9. Setup on a table with a coffee Mug. Follow me on Twitter @h_ta3kees

Rhino Sketch


Using a pencil then black pen and a photo from the Net as a reference and after almost 25min I finished this Rhino. 

Follow me on Twitter @h_ta3kees

ali radwani sketchbook sketch rhion animal pencil black ink pen