I figured I’d share my solution for Long Repeat on Checkio. I got up this morning and had a few moments to solve. Did some research and found the groupby method from Itertools… there was an example online on how to use so I drew largely from that.
As you well know, I started out rolling my own blog and couldn’t finish due to being an extreme n00b. Now that I’ve made fairly significant progress with my FlaskCasts site I am slightly considering transferring all of this over to a strictly Python blog….but….IDK. We will see.
I got hung up on a couple of things tonight trying to get my flask casts site up off of the ground. First off I really got hung up on name vs id in my form fields. Apparently Flasks Request isn’t too fond of having both a name and an ID…and playing around with Bootstrap the ID tag was automatically placed so I was stuck for several minutes…about an hour..kind of sucked. Again…SOMETHING SMALL! But…I just wrote about it…so all the while I kept telling myself IT HAS TO BE SOMETHING SMALL AND STUPID….ALWAYS IS.
Then I ran into an issue trying to update by post…I forgot the $set (loss for a word here) and ran into some issues…luckily solved em all.
Next up…the create method. This one will be a little tricky because Ive designed the site to show posts by the slug for SEO reasons…so I won’t be able to have duplicate slugs in the database. The slugs are generated with the object/Post itself based on the title….however…I’m leaving myself the option of changing the title/content if need be. This is a simple site so…a lot of common functionality really isn’t required but its fun to think through the possibilities.
Lets do some Checkio…
30 minutes later
and it beat me…lol
working on it,…..
Basically all I am doing is focusing on my future, by learning new skills in the present. It’s easy to get sidetracked and think of new and interesting ideas, but staying focused is the key. One of the things I have been doing is browsing Upwork projects to see what people are looking for in developers/projects. I figure if I can sift through the postings and do my best to learn as much as I can about the technologies people are paying for, my chances of being successful when I am ready to bid. When will that be? I plan on trying to roll out several of my own projects as portfolio pieces and build up a solid amount of content and once I can find a project that I am 100% confident I can fit into my schedule and accomplish I will bid. My goal is 1 year.
I’ve also had a few mobile app ideas float through my head, so learning about REST-ful API’s is on the agenda in the coming months.
As far as my FlaskCasts site…I made a few minor adjustments today. Found a couple of minor bugs I need to work out once I get a minute. Plan to work on it quite a bit tomorrow evening.
Thanks for reading!
I tinkered with the site a little here and there but nothing ground breaking today. I am just slowly piecing it together and hope to release: 9/6/17 with a couple of videos.
I love py.checkio.org, it’s a cool site that provides you with puzzles to solve in Python. Great learning tool. I embarked on The Angles of a Triangle today. https://py.checkio.org/mission/triangle-angles/
Never was all that great at trig but I love learning python so I tackled this one. Had help from this site: https://www.mathsisfun.com/algebra/trig-solving-sss-triangles.html
And a library I found called Triangle Solver… https://pypi.python.org/pypi/trianglesolver
Checkio doesn’t support external packages but I was able to dig through the code and pull out what I needed to solve this one. Here is my solution:
One of the beautiful things about Flask is the freedom to do whatever the hell you want. Unfortunately, for me as a novice, this can be a huge disadvantage at the same time. Not knowing all of the best practices can cause some unnecessary headache. Lucky for me there are a lot of blog entries out there to help get this off the ground.
Blueprints is a flask feature that allows you to organize your app in a modular way. Each “section” will act almost as if it is it’s own application. I took a screenshot of my current directory structure to show you what it looks like. So the project itself would be considered a repository,
and will end up on github at some point as I make more solid plans.
Right now I just wanted to get something running even if it is technically just a simple and basic “Hello World.”
Currently the run.py file contains:
When ran, it then goes to the flaskcasts directory since it is a module and runs the code in __init__.py:
This will go to the home blueprint and execute that code:
The only other file is config.py and it basically holds the DEBUG=True boolean only.
Structurally, for a very basic application that is only going to feed videos from a YouTube or similar service, this should suffice.