Set Builder Notation(Needed to understand Sets and then Markov Models)


S={}: means S is will be a „Set“

R stands for real numbers.

R^2 stands for „real plane“ or „Cartesian Plane“

S={xR^2}: Specifies a Universe of Discourse, meaning the type of elements we are interested in, in the set. For example, integer numbers, words, etc.

^2 means „pairs of which“ so R^2 means „pairs of real numbers“

S={xR2x[0,1]^2}  Specifies the unierse of discourse and then further specifies the members from that universe that we want in our set which are [0,1] meaning all numbers between 0 and 1.

[0,1]^2 means pairs of 0 and 1

and also I think it’s about coordinates on a Cartesian Plane.

| means add another condition or“such that“.

∈ is a symbol that means „in“

I read some of the tutorial in the third link. I feel sick lol.

Language Learning Tool – Hanzify

This simple program allows the user to enter the name of a text file on their desktop(although the path in the code is to my desktop). The code then determines the most common 10 words, translates those words into Chinese, and creates a new txt file with every instance of the most common 10 words replaced with it’s Chinese translation, and also prints it to the python shell, or tries to print it to powershell but fails because utf-8.

The code 1
The code 1
The code 2
The code 2
The code 3
The code 3
Running the program
Running the program

Chinese Translator / Language learning tool (Google translate + excel)

Using google translate and excel to create a spread sheet of Chinese translations of entered phrases.
Using google translate api and excel to create a spread sheet of Chinese translations of entered phrases.

I have ideas for this as a language learning tool such as feeding in a list of card descriptions from a Magic the Gathering website and then sending the result to an .xml file and sending that to a spaced repetition system like Anki.

Running the code

Flask Tutorial Cont…:python vs py, more slqite

so I came back to this import flask error
I did more reading

oh, I got the first markov project to work from the
powershell, yay! it was py instead of python ofcourse

I looked up more stuff and learned that a requirements.txt file could
be makde using pip freeze > -r requirements.txt
so I got that which is one more score for the original project.

Now I learn that since when I try to install flask in the venv it says it
already is installed, but when I try to import it it can’t be found,
I looked closer at where flask is installed and it is in site-packages
which is something the original tutorial says „no– site -packages“ so I’m
thinking maybe it’s not fidning it because it’s too far away
but pip still finds it and says I have it.

wow, this has taken the better part of 4 hours, the solution is that
it calling I need to call: python
if I call with „py“ I am calling python3 but I guess flask was installed
in python2. Holy shit!

Now I’ve worked on the tutorial
for building a basic web app and I realize the tutorial is actually
vague at times and there is very little testing which you would
expect, cause y’know if you just write the whole program and only
test at the end…but that is what seems to be happening here
almost so I decided before getting into the templating I would
test it just to see what I have. I have a main error about not
being able to connect to the db and then a bunch of other errors
or trackbacks or something based off of that.

Installing Flask in 3 hours

I’m still not ready to follow the lyricize tutorial I guess
since the very next step is „through them into a requirements file“
and I’m wondering where the heck do I put it, and where to get the requirements.
So I’m into the tutorials before about setting up flask and
„flask tracking“.
„Flask Track Usage is a very light weight Flask extension to track usage traffic for Flask apps.
This post will give you a brief introduction to the usage and merits.“
inspiring post about python and flask being super powerful.

oh flask is a microframework. What is a microframework?

what is a web application framework?
ok so it has libraries, templating, session management?
It’s a software framework.

What is a software framework?

So I actually have to start on the basic tutorial for using flask
which is :
creating a web app called flaskr

step 0: creating the folers. I don’t know about them but for me
I need to say mkdir to make new folders

step 1: Now I need to know how to make a database with sqlite
because new text file -> change name to schema.sql didn’t work…

wow, I am having issues with this
I can’t even „import“ sqlite let alone create a .sql table file in
a specified location. The net is giving a lot of info that is not really helping
I think once I do get it installed I’ll have to use some kind of sql command
line to create the table? Iunno

I took a break, I just felt physically shity, maybe it was the stonemilled
bread or the swisscheese I had for breakfast. Also working till 10 seems to
affect the quality of my sleep which I felt immediatly on waking up. Either
way I have energy but not like yesterday. SO I decided to lay down and do some
relaxation breathing. I was thinking during this time to because well I just
had a lot of thoughts.

So my thoughts were:
let go of flask and move on to at least using heroku
try to use another database and follow along, like sqalchamemy
it seems just like trying to learn python from a standard tutorial is
slow and ineffective, so is trying to do things the way any tutorial
says I should. I just don’t work that way. I need to do things my own way and be creative.

Another idea I got was to try to use pip install sqlite
another idea is that I can atleast now try the markov program again using py
and see if it works.

omg I tried pip and at least it said collecting before saying it couldn’t
find specified version
Then I googled pip sqlite and got something saying try pip search sqlite and
it generates a huge list

ok, and now a SO forume post has a guy saying he get’s errors
with pip install and the answer is I don’t need to install sqlite3
cause it comes with python2.5 and up…

below it is a guy saying he tried pip install pysqlite (he has py2.7
that worked, it’s downloading. Also I got an AVG threat detected on pip
but I let it go.

so it says completed, but then there is an error missing parenthesis for print
which I guess means pysqlite is trying to install a version below python34
and it’s causeing an error there.

I’ll trying pip install pysqlite3
collecting, retring after timeout…couldnotfind verion
I can also just install and earlier version of python if I’m going to keep
having issues.

ok now I’m following the sqlite tutorial which says download the bindaries etc
in C:

followed all steps (except I just add C:\sqlite not C:\>sqlite)
Then I entered sqlite got error which I expected.
closed and reopened powershell CAUSE I HAVE TO DO THAT after adding a path

and now I got it!

now to create sql file…
oh i guess that didn’t require the sql commandline afterall?
Just need notepad++?
and I’ll use it for creating .py files too I guess

how to exit out of sqlite3
use .help to find out … it’s .quit

ok trying to import flask again says no module found so I’m looking
back at installation of flask.

oh right it’s already installed, I’m just not using it,
I follow this
to activate a virtual environment.

then go: venv\scripts\activate
…“cannot be loaded because the execution of scripts is disabled on this system“.

SO person says set execution policy to unrestricted.
Set-ExecutionPolicy Unrestricted -Force
got another error, more reading says run powershell as admin so I can change it
ok wow it works, and pip install flask now works