Skip to main content

Posts

Showing posts from April, 2020

Built LAMP on AWS AMI, and update/install Python3.6, pip v20, Apache wsgi and Flask

I got one half day free and I spent it on building a LAMP on AWS AMI. I also wanted to squeeze Flask into Apache. So I also install/update Python 3.6, pip V.20.1, Apache wsgi and Flask. I wrapped up progress for now before I forgot all resources.    On AWS marketplace, everyone can pay for a good suit such as Django. I’m not interested in content creation unless there are interesting topics to resolve. I don’t know what left to do if I bought a solution; and I may get annoyed like everyone else if the solution causes more problems. To build on my own is more realistic and practical. Installing a LAMP (Linux, Apache, MySQL, PHP) was smooth while following AWS tutorial. Tutorial: Install a LAMP Web Server with the Amazon Linux AMI https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html To build Flask is absolutely a different thing….  still failed before I fell asleep... If I choose AWS EC2 Ubuntu instance, most tutorials are based on this Linux version. Unfortunately I oft

Laravel & PHP7 minor test

    Got some time testing on Laravel and PHP7's new feature. Usually, learning basic language is straightforward. Redesigning the sample and studying the difference gain good understanding.     Due to my short time, PHP7 test paused before the anonymous class definition. Not because of technical reasons... I didn't really agree with the sample that defines an anonymous class under the blueprint of a template(interface).... Usually a template exists because different classes may implement it in different ways. When debugging, a developer needs to trace how a class is defined and used. A better developing habit is to put class definitions somewhere easy to identify. According to this example, an anonymous class hid behind an interface... would cause many troubles such as some classes defining the interface in wild or absolutely opposite ways. https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes     Fortunately I got another time

Comments for my Server/Client Web API samples

        Finally, I finished the comments for python/07 and 09 projects. I almost forgot to put the date on source code which is used to note how long it took me. Not precisely in hours….. I didn’t include source code in my previous post. If choosing code-section for this post…… maybe I want to mark out my comment….. (Really?!)          Once my work was developing websites for enterprises, including ERP, CRM or content sites. The sustainability of network and security are important issues. There are 2 methods for HTML Form submission: GET and POST. Submit via POST is secure, compared to GET which piles parameters on URL. RESTful API is mainly using GET.         Yup, even if you have a certification key, if you put the value on the URL, it is visible data. When writing socket-communication, client-server sockets are a pair; both follow the agreement on commands and structures; and there are countless ports for usage. Plain text on the message of socket communication usually wouldn’t be

Sample for client RESTful API, pandas, tqdm, argparse

    Here is a good example for practicing:     DataQuest:  Tutorial: Getting Music Data with the Last.fm API using Python     Why I didn't mention it as "good tutorial" because I encounter several obstacles while working on this example (then it became a project..) Probably  related tools' reversion is the main issue. IT is a fast changing world. Many tutorials I found online are already invalid.  the author was using both programming and terminal. I was mainly on programming because data processing/conversion in advance; Skipping complex  work, ex. temporary storage.      At beginning I expected to complete this exercise in one file. But at the end, to deal with multiple obstacles, It grew to mobilized functions (options/database/REST loading/parsing) , many steps ( at least 7, not including removed tests) and many tests.....      In order to deal with multiple REST querying and its agreement of usage,  I employed SQLite3. At first, I was using saving-files to keep r

Started on RESTful API + Flask + Python

Started experimenting on RESTful API. Actually, I always doubt the necessity of the name 'RESTful API' or microservice... There're already web pages for years. Yes, you read it right, 'WEB PAGE'. If any programmer ever worked on assembling web pages: filling queried results into blank area, and then sending out the whole content, REST API on server side seems to be sending data without decoration....  I didn't mean that modern technique is simple. Decode the structure designed by others is a kind of art. I do respect all designers. I just think passing data between devices is not something new.... Maybe, it's because I wrote network sockets in very early days.... It's kind of difficult for me to choose section of codes that represents REST API... This is an example of server-side web API.  So I chose filter for queried data.. sqlight3 allowed developer to register a processing function to deal with our own data. This technique is not uncommon. Often

Mysterious deployment

Finally, got Flask site deployed on Azure.....  There's probably nothing wrong. The only problem might be my rebellious inner self that giving me a hard time.... A programmer under Mac or Linux OS may prefer to use python and develop under Linux compatible environment; they may choose Visual Studio Code. I developed my Flask under Windows environment (no IDE), using CMD for git version control, or, at the end, I didn't know how to make a simplest webapp work on Azure, trying on Visual Studio Community 2019 for deployment. (only for ASP... too bad...) Finally, I installed Visual Studio Code for deployment.... It worked.... Nothing wrong with my testing code.... Anyway, nothing wrong is a good thing. A fulfilled day!

Flask-- Getting familiar with Python

    Walk through example provided by Flask.  https://flask.palletsprojects.com/en/1.1.x/     After years of software development, "learn a new programming language" became abstract. If a 'language' is specialized, it probably could be taken as a tool/package. What I need to know is its APIs. What it can do, how the procedural goes and where to start are main purpose I should figure out. Learning a tool won't take too much time.      If the language is for general purpose, probably they all seem very similar........     C++, Java, PHP, C#, Python, etc. are little difference to me. Of course each owns its specialty. Just because that they can do almost anything, How well a programmer masters these language might depend on how many packages/extensions the programmer knew. And this could be easily solved by internet. I assumed that, once seeing possible usage, an experienced programmer still not knowing how to use it is impossible.      Or, I'm talented? I'm f