When you install WPML and add languages, you will find the flags here to change site language.

Python, Anaconda, WordPress, JSON, JSON-SCHEMA – Messy post with few practices and feedback from my P.O experience.

What’s make a good P.O? A constant curiosity melted with pragmatism, tinged with avidity for success (the Trump most revered value). So, this post is a living proof of this “Constant curiosity melted with pragmatism” even though it looks at first sight as a discordant mixture of successful and abandoned attempts.

Normally, these “explorations” are forgotten as quickly as they appeared. Historically, this is also what awaits us all, sink into oblivion. Except when I decide to wrap the whole stuff with a minimum of work and publish it to keep track of it. This is the purpose of this blog.

You can find the files in my github account More on https://github.com/bflaven/BlogArticlesExamples/tree/master/python_anaconda_worpress_json_json-schema

One more thing, this time again, the content produced is so anarchic that it is almost poetic, beautiful in a sense “as beautiful as the chance encounter of a sewing machine and an umbrella on an operating table”*.

* “beau comme la rencontre fortuite sur une table de dissection d’une machine à coudre et d’un parapluie.”

However, my need was simple. It was basically to build a multifunction JSON structure. This one could be used to display any content in hierarchical list e.g. FAQs, Changelogs, Quotes, TODOs, Shopping list items… etc.

Suddenly, I got interested again in the JSON-Schema, discovered with Postman. Since when you use JSON content, you quickly need to make sure that the content as well as the structure will remain perennial. Davvero Leo!**

** The guy I am working with is called Leo.

I was bound to ramble into random exploratory directions that made me discover the followings:

  • The opportunity to modestly make some Python & install and explore Anaconda for testing purposes in JSON-schema.
  • The Anaconda install was also the opportunity to dig into various librairies such as Tensorflow, Keras (multifunction), NTLK (language), OpenCV (images) and many others. Spearheads of the magic trio: AI, Deep Learning, Machine Learning. Some posts may show up about these subjects in the future.
  • A quick exporation of Pippin Williamson’s WP plugin.
    (https://pippinsplugins.com/).
  • Some Screens Prototypes in Balsamiq.
  • Concepts extracted from reading “UX for Developers
    How to Integrate User-Centered Design Principles Into Your Day-to-Day Development Work “by Westley Knight.
  • Different tests of creation of JSON as well as the different JSON-SCHEMA which are attached to them.

At the end of this “fishing” session, you must, without shame, show your catch as ridiculous as it is and I can draw 2 conclusions from this experience.

  1. Learn-It-All Mindset Beats the Know-It-All Mindset: Exposing the trial and error process to all is essential. In fact, in the knowledge society into which we have entered, opacity and the withholding of information are proof not of knowledge but of ignorance.
  2. An heterodox and iconoclastic approach is not always welcome: It acts like a powerful rigidity gauge measure to detect aversion to change from “expert” people. Even though, these people are skilled and competent, moving out of their comfort zones scared the crap out of them! Exploring does not mean having no method, it means having neither a priori nor a blind eye. It’s as stupid as mixing up agility with simplicity. Scrum is just a practical framework that help to build a product in a series of iterations called sprints that break down big, complex projects into bite-sized pieces. Nothing very new since the Hypothetico-deductive model principles or the maieutic from Socrate! Cf https://en.wikipedia.org/wiki/Socratic_method

Some real souvenirs from the trip!

Here are the elements were gathered during this journey.

1. Python & Anaconda
It is very easy to install Anaconda but also tremendoulsly heavy. It requires a very large amount of space disk so I was force to install it on an external hard drive disk. You can download Anaconda at https://www.anaconda.com/

# install Anaconda and check the installation
conda --version
 
#update conda
conda update -n base -c defaults conda
 
 
# create an environment named myOwnPythonEnv_1
# with Python 3.5 version
conda create --name myOwnPythonEnv_1 python=3.5
 
# create an environment named myOwnPythonEnv_2
# without any specific version of Python
conda create --name myOwnPythonEnv_2
 
 
# start the env and get into the env named myOwnPythonEnv_1
conda activate myOwnPythonEnv_2
 
# get out from an env e.g myOwnPythonEnv_1 or myOwnPythonEnv_2
conda deactivate
 
# check the import
conda install jsonschema
 
# check the import
python
import jsonschema
jsonschema.__version__
exit()
 
 
# installing librairies such as OpenCV3 and Dependencies
conda install numpy
conda install -c menpo opencv3
 
# check the import
python
import cv2
cv2.__version__
exit()
 
# To run a script in python  
python script_in_python.py

As far you have installed in your own environment e.g. myOwnPythonEnv_1 or myOwnPythonEnv_2 with the proper libraries e.g jsonschema, you can test your JSON set against your JSON-SCHEMA.

 
# go to the dir
# be sure to have installed first python-jsonschema
cd /to-your-dir-on-your-computer/
 
# data, schema
# 00_arrays.json, 00_arrays.schema.json
jsonschema -i 00_arrays.json 00_arrays.schema.json
 
# 01_person.json, 01_person.schema.json
jsonschema -i 01_person.json 01_person.schema.json
 
# 02_geographical_location.json, 02_geographical_location.schema.json
jsonschema -i 02_geographical_location.json 02_geographical_location.schema.json
 
# 03_faqs.json, 03_faqs.schema.json
jsonschema -i 03_faqs.json 03_faqs.schema.json

1. Check the conda install in the console
Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

2. Through the Anaconda Navigator
Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.
More on https://docs.anaconda.com/anaconda/navigator/

3. Create your working environment. Mine is called myOwnPythonEnv_2
Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

4. When you have created the working environment e.g. myOwnPythonEnv_2. The environment is available in the Anaconda Navigator and you can install the python-jsonschema librairie in it.
Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

5. You can test your JSON files against JSON-SCHEMA files with the help of jsonschema
Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

This is very very basic usage but using Anaconda will open an infinity of possibilities.

Does the words Deep Learning, Machine Learning ring a bell to you? Anaconda is an easy path to start

  • IA Natural language processing with NTLK for preprocessing text before search indexing, document classification, and text analysis.
  • Deep Learning with Python: Develop Deep Learning Models on Theano and TensorFlow Using Keras.
  • Deep Learning with Python for Computer Vision: Image and Video Classification, Object Detection.

You can start discovering the radical advance of computer vision and natural language processing, two of AI’s most important and useful functions. Functions that are directly related to the creation of artificial neural networks.

In short, an all-new area, but be careful, installing does not mean mastering. It is just the beginning of a long friendship with Python that may turn you into data-scientist for instance. One the most valuable and profitable position for the coming years! Think avidity 🙂

2. WP for fun
As I was looking for JSON, JSON schema and so on. I bumped into this article that was presenting a plugin, not so far from the feature I wanted to have developed for the Backoffice I am dealing with so I have taken it.

Print out in the theme the values from Pippin Williamson’s WP plugin if needed

/*
pwsix_settings[text]
pwsix_settings[label]
pwsix_settings[enabled]
*/
/* show the values on front from pippinsplugins_import_export_feature_3.php */
 
$options = get_option( 'pwsix_settings' );
$pwsix_settings_text = trim(esc_attr($options['text']));
$pwsix_settings_label = trim(esc_attr($options['label']));
$pwsix_settings_enabled = trim(esc_attr($options['enabled']));
 
	print ('<code>');
			print "\n";
			print (''.$pwsix_settings_text.'');
			print "\n";
 
			print (''.$pwsix_settings_label.'');
			print "\n";
 
			print (''.$pwsix_settings_enabled.'');
			print "\n";
 
	print ('</code>');

JSON export from Pippin Williamson’s WP plugin

{"text":"Plugin Text Import 3","label":"Label Text Import 3","enabled":"1"}

You can find the file on my github account. See Pippin Williamson’s WP plugin in pippinsplugins_import_export_feature_3.php. See at More on python_anaconda_worpress_json_json-schema

3. Prototyping
With Balsamiq, as a P.O, you can quickly prototype. I even sometime make video presentation as Balsamiq enables to go full screen and interact with your prototype.

Prototyping is a way in which organizations are able to get an idea of how a feature or product may look and function like without spending a great deal of time and money to create the finished article. It is a time savier.

The more you get closer to the feature and its cinematic, the more you are able to assess the needs of those users when they will be engaged with your interface. With Prototyping, as a P.O, you can even guess what will be the user’s feedback generated. You really put user’s interactions in a middle of your work, and to answering to the user riddle: “What will be the mental, physical, and emotional responses from the user towards the product?”

For sure, in such simple screens, it easy to answer, just check out the spelling mistakes for your FAQs or for the CHANGELOG 🙂 Below, some extract pieces from a prototype, I guess the rest is confidential !

Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

Python, Anaconda, Worpress, JSON, JSON-SCHEMA - Messy post with few practices and feedback from my P.O experience.

Read more