-
- SC
- Moved the js files around so they’re only loaded on the pages that need them.
- Did the same for css files. Much easier to keep the templates/stylesheets/scripts separate for their various views, consistently named and applied.
- Added function for get_team_abv for the 3-letter code.
- Styled the all-picks table. Vertical text was nontrivial.
- My repo has functional structure currently – an alternative design is divisional structure, where there’s a subdir for each route and the static files (templates/js/css) are all alongside it.
- Closed the blueprint ticket for the next milestone, doing it for the week/picks view nesting. Learned quite a bit here. Reorganized for blueprints.
- Added a url_value_preprocessor to determine requested_week and available_weeks before passing that information on to the routes in the week blueprint that need it. You’re basically just taking it out of the native ‘values’ dict and putting it into the g object for your own use. Then you don’t have to type week<week> in all the routes, and add the week arg to all functions, etc.
- Added url_defaults as well so that it queries the db for the most recent week on the site’s homepage.
- Organized all the weekX/picks subpages, and added the links for them.
- Created ticket for the “don’t show all picks till sunday” enforcement, to be done at the beginning of next year.
- Started the LB work.
-
- The template extensions are relative to the template root dir, not local (you have to prepend main/ etc).
- You can use a <th> tag in place of <td> to get header formatting outside of the header row, like for a left bold column.
- Stack overflow was offline tonight for maintenance (<1hr).
- .replace is JS is only for the first occurrence. It’s dumb. To replace all, change the first string (the one to change from) “example” to /example/g. You have to remove the quotes, which introduces further dumb requirements. If your string contains special characters, you need to escape them. For example, to remove all periods from an email, you’d do email.replace(/./g, ”).
- jquery selectors for ID can’t have special characters like periods and such.
- SC
- Worked on #30, the pick view. Moved templates around to generalize the week header dropdown.
- Got the pick view basically done. I was surprised how nontrivial it was to handle the table. One of the biggest takeaways: give IDs to all cells in the table, named after the variables (x and y axis headers) passed through jinja. Then jquery can select them easily, rather than trying to find them on the fly.
- Remaining: some styling, and then generic abstraction of the static content. I basically had views/templates/js for the main table of a week’s matchups, but now i need to separate all that for another table so that each has the appropriate scope.
-
- Flask servers persist (or restart after) ubuntu suspension, fyi. If you close your laptop with the app running, it will continue when you reopen.
- You can have branches in alembic (just like git) for when multiple people are working on changes that modify the models. I accidentally created a branchpoint a while back on the production server. To resolve, you merge the versions (just like git). This creates a new version and migration script (mine was empty, as expected). Then you can migrate and upgrade as usual.
- For future reference – my net worth exceeded 1m at around age 28. Vested and exercised. Probably age 26 unexercised. The biggest hindrance? Taxes on illiquid assets. AMT traps are real. I paid hundreds of thousands of dollars before even seeing a cent of it. IRC 83(i) will help considerably, but the finance department shucked this novelty due to a clause where purchase offers make employees ineligible. Even…when the purchase offers are inconsistent (nondeterministic schedule), limited (you are severely capped in share sales), unknown (you have no idea when your trap hits), and infrequent (gaps longer than a year apart).
- The pycharm db browser is buggy if you start manually modifying data.
- HN
- Ya, the cookies warnings need to stop.
- “communicate in the language of options, not demands or preferences” https://news.ycombinator.com/item?id=19349676. I agree. This applies outside the workplace as well. Social issues like racism and other political debates largely stem from personal bias. A withdrawn, impartial view of options and their pros/cons would serve everyone well.
- This is really cool – basically a sed alternative for find/replace, but with machine learning. https://github.com/Inventitech/strans.
- The median age of Google/Amazon employees (software in general) is 30. The median age of american workers is 42.
- Error handlers are pretty easy in Flask. If the exception (or other code, or custom handler) is to be reached in an ajax call, however, you must do something different.
- SC
- Removed the backref from the picks table (to users). Left the FK constraint.
- Removed the points col. This will be a separate table.
- Added utilities.add_user for easy creation of new users (for testing). This obviously must be invoked from a db context (python manage.py shell), not just any old python console.
- Created and few users and made sure they were distinct.
- Moved some test dbs to backups. Merged an old db version, migrated, then upgraded my local dev db.
- Played with moving html <script> tags around to the proper template to avoid Undefined Variable errors.
- Did the ajax/flask error handling. If any of the common pick mistakes occur serverside (>5, started game, etc), it will return the traceback and flash the client! All are grouped in the InvalidPicks exception class within the view.
- Added clientside verification of “game already started” and “can only pick wed-sat”. Changed the allowable pick back from status=F to P (the proper one, pregame).
- Closed ticket #4, created #30 for the last items in the mvp: the pick view and the leaderboard view (then back population from last season’s data).
- Moved the logic for coloring to js (from html). Only applies to picks now, not all.
- Added an 18th week to the db so that people can play with the pick interface before next season.
-
- PW
- Watched another tutorial on hidden API manipulation. You really can do some deep inspection with just chrome alone. Adding x-csrf-token headers, scraping for routes, etc. Remember, just run a single get in the same session to grab the token before adding it to headers in subsequent requests. https://www.youtube.com/watch?v=6zge0N962aw.
- Single page applications, server side rendering, and nuxt.js (for universal vue apps) – https://scotch.io/tutorials/building-a-universal-application-with-nuxtjs-and-django. next.js is React’s framework for this.
- Few small improvements to my bbq game. Ordered a spice dispenser for even rubs, as well as 24″ butcher paper for single-sheet wrapping (it was leaking through my separate 12″ sheets). Also going to try using the coffee grinder next time for pepper – the hand crank is way too slow.
- You can access jinja template variables within javascript if you use the html rendering as a proxy. Put this in your template: <script>const myVar = ‘{{ my_var }}’;</script>. This doesn’t work if you put it in a separate javascript file, because that isn’t rendered.
- Continued Altered Carbon. While a great show, I still don’t like this genre. It’s unsatisfying as a viewer to not be able to trust any scene you’re presented. It’s a deus ex machina on steroids, favoring the show instead of the audience. It’s a complexity which hurts the viewer experience rather than adding depth and substance to its plot. Climaxes and resolutions in such worlds aren’t clever; they’re easy.
- Template variables are cast into objects (not just strings). This can cause complications between python datatypes and javascript datatypes. Strings are easy. For lists, use the tojson filter {{var|tojson}}. For others, look it up.
- Multiple elements within the same DOM cannot have the same ID. Use classes to group different elements together, if desired (even if there’s no associated styling).
- SC
- Worked on commit_picks, parsing the data from the request all the way through writing it to the db.
- Updated the descriptions on some existing tickets based off new realizations.
- Serverside and clientside verification of all picks.
- Emails the user upon pick submission (optionally). Checks and balances, baby. At least until people trust the interface.
- Changed the table to use classes to group matchup rows and identify the specific columns. Previously, I was using js to find the header and do string matching, or explicitly stating column index. Ridiculous.
- Handled the submit button logic. Disappears during the ajax call, and reappears if any changes to the picks are made. The user is notified if the picks were committed successfully.
-
- Blogger’s editor uses <br> and <div> tags instead of <p>, hence all the inconsistent formatting in these posts. Sometimes it will inject a newlines at the beginning of a post, sometimes at the end, and sometimes both. It changes all the time, even for a single post that hasn’t been edited. Oh well, I can live with this. I’ve been happy with the other functionality.
- FW, MD.
- Registered for the Oct 5 Sonoma tough mudder with Eric!
- Even if the piece of info is as simple as a single variable, a (hidden) form is still the canonical way to send data to the server. You can do it through ajax, alternatively.
- If you are using ajax, and you’re using flask-wtf csrf protection, you have to send the token (or exempt that route). Incredible help from Martijn Pieters: https://stackoverflow.com/a/22929593.
- Started watching altered carbon in the background.
- Supercontest
- Lots of work on the picks. Played with different methods of sending the pick array to the service. Ultimately went with ajax.
- Added the csrf token as metadata to the clientside.
-
- Back from Havasu.
- Smoked a 10lb pork butt.
- Verified mileage on all three motorcycles for AAA.
- Returned Amazon package at Kohl’s.
- Booked Seattle trip with the companion pass for Allie’s bday.
- HN
- Much better CLI prompts in Python: https://github.com/Mckinsey666/bullet
- Crunchbase is a cool site that shows lots of internal information about a company. For example, all of SpaceX’ funding rounds: https://www.crunchbase.com/organization/space-exploration-technologies/funding_rounds/funding_rounds_list#section-funding-rounds.
-
- Stanford Aero/Astro is starting an alumni newsletter now. There are 17 people in the new aero/astro undergraduate program already! Per Enge died 🙁
- I wonder how hard it would be to write a program that parses Ryan’s footage to extract stats like catches and hits. Amazon’s Rekognition tool can do action detection and pathing and such. That would work.
- Blogger is wayyyy less resource-consuming in chrome than Drive.
- Caught up on new season of Brooklyn 99. Didn’t know it started back up again!
- Talked to 24 yesterday (Luis). He said that I get a free month but you still have to pay for two months. I assumed that meant that the first month was free, then I could just cancel before paying anything. Sneakily, it meant that you pay for the first and last month, and the middle month is free. I should have pressed harder.
- Netflix has a heavy ML and experimentation platform. There’s a large team working on data science and research. I read their tech blog post about it.
- To discover private or hidden APIs on a website, just use the network tab of chrome devtools. It will tell you the url routes, the http method, and the data. Then just use it for you own purposes in whatever custom way you want! requests.post(url, data). It can get more complicated with cookies and auth, but you can copy that as well because devtools shows it!
- A shortcut – just right click the request in devtools and copy it as cURL, or convert it to python, or whatever you want. Very easy export method to repeat requests.
- sudo apt install gnome-tweaks to get more settings. Removed trash icon, added battery percentage, and a few more small improvements.