First of all, it’s black history year (I SAID WHAT I SAID), and I am so proud to say that during my lifetime I got to see one of the most influential films for African, African American, and all around the globe history. I just want to say that I know for a fact that I am supposed to live in a place like Wakanda. It was perfect, it was everything and then some, I could understand everything, and most importantly feel like everything in my life had been fixed to perfection after I walked out of that movie theater.
Along with witnessing one of the best films in history, I also made some history of my own. I reached over 100 subscribers on this channel and I just want to thank all of you who have decided to come along. I can already see my awesome journey to building our Wakanda, the Digital Empire, and my innovative brand bringing us together and creating great technology. My mission is to uplift others to seek their true gifts in the world of technology and make some wonderful contributions to it myself.
I was gone for a while after staying on an awesome streak of getting out videos and blog posts and then I ran into “Screen Dance”. Screen Dance was supposed to be the second 3D music visualizer program. While building this project I ran into the problem of integrating the correct module, RPiGL, so that the program would be able to work. RPiGL is a utility function that lightly wraps some GL functionality around your project. There is a more updated version of this called PyOpenGL which is a python binding. A Python binding is code that performs as a wrapper around native code. I needed this module for the spinning cube as well but because there was an issue I found the PyOpenGL alternative and used that to complete that project.
I’m not that experienced at creating in this language but I tried for weeks to see where the issue was between my version of the code and the module’s code. There were many failed attempts, times where I felt like I was getting super close, and then I just decided to gain as much answers from long googling sessions and moved on to the next project. I was taking an excessive amount of time on that specific project and it kept me from continuing to learn. So, one life lesson you can leave here today with (but you’ve probably already heard a million times before…) is to keep going. Even if you can’t figure something out after the fifth of ten millionth time you have tried to fix it, move on to something else and come back to it later.
And that’s exactly what I did... I decided to leave it alone. Move on to the next project in the book and continue learning. I have now made it to Chapter 7 of this book and only have five more chapters left until I have to find another book or course to learn from. This chapter introduces the network capabilities of python. To be honest with you, I did not believe python was THIS versatile. I mean, I’ve heard it was versatile but not this versatile. This chat server demonstrates how python can grab information off of the web as well as utilize IP (Internet Protocol) addresses, hosts, ports, and sockets.
The first version of the project consisted of two different pieces of code. The client side version and the server side version. The server version is able to function primarily because of the socket module.
Socket: objects that connect to a particular port on a particular host, or listen for a connection coming into a particular port. (definition from LPWRP)
So, when this code is run, it is waiting for the connection to come in. It does this by binding the socket module to a port (50,000) on the host (computer). The client version on the other hand establishes the connection. When this code is run it doesn’t create a new socket, instead sends and receives the original one that was created. In a, less technical way... before you call or text someone on the phone you need to be connected to a phone service and then use a specific phone number to reach a desired contact. Without the correct phone number or a service provider you will not reach that contact successfully to communicate. Below is the demonstration of how the code works firsthand when both are run correctly.
Host: a computer that is connected to the network
Port: a connection point or interface between a computer and an external or internal device
The second version of the code took the headache out of running to different pieces of code to get your message sent back and forth. For this one I decided to transfer messages between my MacBook and Raspberry Pi to see if it would send over two different platforms and it did. It should work across any two different platforms as long as the devices are on the same network.
If any of you have ever built a chat server or try out this project please share your experiences here or on my YouTube channel.