-
- The Ally transfer processed. I don’t see it in my BOA account yet, but I should get a large deposit notification soon. I also had $0.02 left in my Ally account so I just submitted a req for that as well.
- Went through some practice interview questions for js-specific roles (which I’m not applying to). I could answer about half, which I’m satisfied with. After studying, I’ll be able to get most. In any case, I’m seeking a full stack position.
- Read the tesla 2019Q2 report: https://ir.tesla.com/static-files/1e70a30c-20a7-48b3-a1f6-696a7c517959.
- Capex = capital expenditure (like overhead). Profit = revenue – capex.
- GAAP = generally accepted accounting principles.
- UrthBox was firm on “no” when I requested that they cancel the mistaken order (3mo subscription renewal), which was already shady. I pretended to enjoy their business, threatening the loss of future orders, making the decision to refund me lot easier for them. The agent spoke with his manager and magically found a way to cancel 2/3 of the order. This is a good strategy for dealing with cancellations/fees/etc. Paint the picture as a financial long-term strategy for them, rather than something subjective or political.
- Make sure to thank them after, even if you don’t plan on continuing being a customer of theirs. Pay it forward, ensure this model continues working. If you ghost them, the threats lose value on the macroscale over time.
- app.use() requires a middleware function. You do this for express.Router(), but not for something like your models. You just require() those (import them, don’t add them to the express app).
- 204 = no content. You might get some pending requests on an empty db.
- Always forget. lsb_release. Then use -h, or directly show version with -d.
- MERN.
- One of the reason my devtools network request was not responding (and I couldn’t find logs) was because the service wasn’t started (heh). I had begun the backend app days ago and had not restarted it once I had finished with the frontend. nodemon app.js.
- Moving on to the redux and state portion.
- Wrapped the app component in both a router and a redux provider, which has a store that contains reducers. Then you basically tell it that the state is all the articles, have it connect to the db, map the redux state to react props, then display the props (articles, blog posts) in the react component.
- There was another part completely missing from the tutorial lol: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/. You need to have mongo both installed and running before it can obviously serve a localhost db, otherwise no data is being saved. Surprisingly …….. no errors from express when starting the app and trying to connect. At least not directly presented to the user in the cli. Yikes.
- Yup, that was totally why everything was busted. As I suspected above, the hanging requests were due to the backend waiting for db connections that … didn’t exist because there was no db. 1000% times better now, fast, clearer logs, everything.
- Finished the tutorial, got the baseline working. Now on to customization for my own purposes.
- Created a proper git repo for the blog and customized it.
- Remember, onsubmit is an event, the js function that executes when a form is submitted. onload is the same for when the page has loaded.
- … in js is the spread operator. If you have an object with multiple properties, and you want to create a second object with 99% the same properties, just changing a few of them, define the second one with the spread operator on the first object. obj2 = {…obj1, changedProp: x}
- Mongo
- Add key, add apt source, apt-get mongodb-org, sudo service mongod start.
- Then remember, you can check logs with journalctl -u <servicename>, or look in /var/log
- 27017 is the default mongo port.
- Enter shell with `mongo`. Just type `help`. Pretty similar to psql and postgres in general. Don’t need to terminate statements like psql.
- In the shell, show dbs, use <db>, show collections, <db>.<collection>.find()
- use <db> the db.dropDatabase() to delete one.
- moment.js is a great library for datetime manipulation, such as converting db timestamps into something relative to now, like “17 minutes ago”.
- Backticks in javascript are template literals. You can execute code inside of them, to insert expressions (like variables, or math) into strings.
- If you’re running the webpack dev server, you’ll see “wds live reloading enabled” in the browser console.
- React: be careful when using arrays, and assign each element a unique key. This applies to situations where you might be mapping an arbitrary-length list from db.find(), and rendering a <div> row for each or something. React uses keys to make it more efficient about what changed and what needs re-rendering. For all child elements in a component that has a list, give each one a unique id. https://reactjs.org/docs/reconciliation.html#keys. This is usually pretty easy, since the raw data has a db id in most cases that you can just pass through.
- These tattoos made to look like patches are incredible: https://tattooblend.com/hyperrealistic-patch-tattoos-by-duda-lozano/. Would be so cool to get one of a mission patch. This is my official copyright on that idea.
- npm prune remove unnecessary packages.
- Went through all the redux docs and took notes (in a google doc). Makes much more sense in the context of the simple MERN app I just built.
- Remember the react tab of chrome devtools to help debug and should the whole react virtual dom and everything.
- In javascript, `new` will execute the constructor when creating an object.
-
- Final closure on my ally account, realized gain: 6k. Basis was 10k started over 10 years ago to practice a little bit of private investment at the end of high school, got 60% overall.
- The ach from ally is on hold until tomorrow.
- Urthbox charged me another $90 for another 3 month subscription of snacks delivered to Eric’s house. I never wanted this, it was a one-time gift. Their fine print is bullshit and I emailed their support team.
- cprofile is a good profiler for python. @profile is a built-in decorator for memory profiling.
- numpy.ndarray can only hold one datatype, so it’s mucccccch more efficient than the generic python list (which has to allocate for flexible data types in every element).
- index.js are kinda like __init__.py files in python, spread through the project dirs to organize code and import/export availability within subpackages.
- In js, you can specify one and only one export as “default”, which means that imports can call it namelessly. Otherwise, you name your exports and import them by name.
- form-control is bootstrap. my-3 is a spacing example for bootstrap, which sets margin top and bottom (y-axis) to 3.
- Dayum. Finasteride, propecia, antibaldness drug can can impotence and anxiety: https://elemental.medium.com/my-life-has-been-ruined-by-an-anti-baldness-propecia-finasteride-side-effects-ed8b2fcd1e90.
- Police have had facial recognition database for a while. They can identify from mug shots, videos of crimes, etc. https://onezero.medium.com/california-police-are-sharing-facial-recognition-databases-to-id-suspects-3317726d31ad.
- While most are scared of technology like this, I’m a huge proponent. The more data, the better, even if private. This is an accountability problem, not a morality problem. 23andme genetic data, facial data, crime data, advertising data – take it all. I don’t have anything to hide, and data connections enable so many useful functionalities.
- MERN:
- High level index.js which does the ReactDOM.render().
- That imports components from other clean files, like a jsx that defines a Switch and a Route inside of a class or hook and exports it.
- AmEx anticipates vacations based on travel purchases, inferring that you’ll be away during certain dates and allowing transactions while there. Pretty cool, and not that hard.
- Placed fresh order.
- Morgan is the js library for request logging with node express apps.
- Axios is a library (wrapped around ajax using xml http requests) that allows you to make promise-based requests from the frontend or backend.
- Smoked chicken breast for softball. Tenderization is so important. I used a valentina bottle to pound them flat lol. Bought an actual tenderizer online. Going to try the 48 blade puncture tenderizer instead of the mallet variety.
- NFL is back!! Preaseason week 1 tonight, TNF, broncos vs falcons.
- Trichinella dies at 137F. Salmonella dies at a higher temp, and it takes a bit longer. Getting it above 160 is fine, 165 is even safer.
-
- Robinhood: Bought beyond from my interdigital sales. Also sold seagate today.
- Ally: Cleared final holdings, microsoft and tesla. I’ll reup msft in robinhood.
- Paid rent while the money was moving around.
- It might be worth getting a stackoverflow account and starting to provide answers. The clout is a good bonus. Even better benefits: paying it forward + open source mentality.
- Brake fade is due to heat. Over long applications (braking all the way from like 200mph, or going downhill) the braking power decreases. Gas builds up.
- A strong thought I had today, and have had before: Convenience is the enemy of healthy eating, not flavor. It’s so much easier to grab a granola bar or cereal, a sandwich or snacks. Healthy foods are usually ingredients which require some sort of effort to transform from their raw state into a usual meal. This is what makes good nutrition difficult. We have enough distraction and exhaustion throughout the rest of our days; to add more in a neverending task like meal prep is hard.
- To fight against this, I do as much prep beforehand.
- My morning meals have always been a shake. Instead of getting out the teaspoons and measuring 10 different powders every morning, I do it in a batch of 10 jars. Then breakfast is just pouring a jar into water in a bottle.
- I have a veggie smoothie every day. Instead of cutting and apportioning all the kale and tyogurt and carrots and all every time, I batch it all at once. Then a smoothie is just grabbing 5 items from the fridge, rinsing with water, then throwing in a blender and drinking.
- Same goes for carrots/beets for juicing.
- Same goes for bell peppers for hummus/snacks.
- Abstract route logic into other functions, then have your route definitions (decorations) be as simple as possible. This is called route middleware: http://expressjs.com/2x/guide.html#route-middleware. The middleware can be responsible for looking up a user in the database, requiring that someone is an admin, or much more. Then once the middleware accomplishes what it wants, pass to next().
- Read through the express 4 api docs.
- app.use(path, callback)
- If nothing is passed to the first argument for path, it defaults to the home route /, so applies to everything.
- This is exactly where you put your middleware logic, and then mount it.
- Pretty similar to flask all around.
- Read through the mongoose 5 api docs, the mongo shim for node.
- All around similar to sqlalchemy. Define the schema, connect to the db, validate against models, etc.
- Worked with briley for a minute on the hydra angular frontend.
- npm:
- sudo chown -R $USER ~/.npm again.
- -D is the same as –save-dev
- Webpack:
- Pip.
- webpack.config.js provides mores configuration for the package, extending package.json. Both are similar to setup.py. The webpack config allows specification of entry points, resolvers, loaders, much more.
- Can also be used to build your client app or start development (webpack-dev-server).
- Defines the main template to load, the js to run on it (react render, etc).
- Simple MERN blog app:
- Created the client react app, refreshed on the express/mongo backend and server app. Compiled with webpack dev, almost done.
- Webpack config has the entry point defined, which is /src/index.js. This is like main. It loads react and all the components + stylesheets.
-
- Sick special model of the 2019 panigale v4 to honor the 25 year anniversary of the 916: https://www.ducati.com/us/en/bikes/panigale/panigale-v4-25-anniversario-916.
- Remember CORS = cross origin resource sharing.
- JS has a standard lib just like python, of course. For example, process.env.PATH is sys.path.
- === is strict equality, where it checks type and value. 3 == ‘3’ would return True but 3 === ‘3’ would not.
- Remember for permission denied errors, make sure you’re the owner. sudo chown -R $USER <path>
- Just like python, if you sudo npm i -g it’s going to install it into your system packages with root perms, so subsequent global installs without sudo will fail on permission issues.
- Stack overflow offline for maintenance a little today.
- MERN app.
- Express is pretty similar to flask. Instantiate an app, then add everything to it: models, routes, csrf, cors, session, whatever.
- Again, nodemon is the library to have an auto restarting express app. Just like flask debug=True and autoreloader=True.
- Kinda like blueprints, you can abstract all your views to another file using another package Router.
- .param is a way of specifying information about a request, kinda like running a preroute to look up info in the db and then attaching it to the g object in flask. The param itself is defined in a separate function and then any route can use it with :param.
- Remember .then and .catch for a function call (.catch = except: and .then = else: although you usually just put the after-success logic at the bottom of the try clause).
- RAID, parity bits, redundancy across drives.
- const { property_name } = obj is the syntax for destructuring in es6. You can redefine object attribute(s) to new variables.
-
- Remember that staticmethod and classmethod are the same in that they both operate on the class itself instead of an instance of the class, but a classmethod gets the class passed as an object so it can access other pieces of the class. A staticmethod receives no arguments.
- Wifiphisher can basically jam a network and present a user with a fake update screen where they have to reenter their password to reconnect. It then shows you the password. Social hacking!
- It was privacy badger, not adblockplus or ublock origin, that was prevented some of the image content on medium. Disabling it for those domains worked perfectly.
- Sold all my IDCC shares (interdigital, wireless company) at a loss. Once the funds are settle (can take up to 3 business days), I’ll turn it into BYND. I expect it to rise and fall just like btc, just I’ll ride it for about a week.
- Fasting has some interesting cleansing properties. When deprived of external sustenance, the body turns to itself for stores. This can benefit much: https://elemental.medium.com/why-fasting-diets-of-the-future-may-be-even-more-extreme-bf8db9befa70.
- IRS is going after a lot of crypto evasion: https://blog.cointracker.io/irs-sends-letter-6173-6174-6174-a-cryptocurrency-warnings-what-to-do/. I’m fine, I claimed all my losses (lol).
-
- React for bmahlstedt.com.
- Modified to use hooks instead of class syntax, added my images after making svg and transparent backgrounds.
- Read about how to serve a dockerized react app. Changed bmahlstedt.com to use this instead of my static flask app. https://github.com/brianmahlstedt/bmahlstedt.com/issues/1.
- That `serve` tool is pretty cool, but remember it’s for static sites. This is fine for bmahlstedt.com in its current state, but the supercontest would need node/express as the dynamic framework to serve it properly (can still use nginx and docker, node/express just replace flask).
- Remember, my nginx reverse proxy expects every prod container to serve its content on 8080. The dev container just forwards 5000 child to 5000 host.
- Had to restart the docker service because of that shimd issue. Had to rm the containers (kept the images, networks, and volumes), then docker-compose up on all of them.
- Added the react devtools extension to chrome.
- Productionized it. Set up a multistage docker build. First, it creates a container with my src and then builds a bundle with webpack from it (npm run build, which is built into create-react-app). Then, it copies the build output dir (and ONLY that) to a new container and serves it, deleting the intermediate previous container.
- React for southbaysupercontest.com.
- Trying to integrate react with an existing flask app.
- Did some exploration but decided that I don’t need to have react in the supercontest app at this moment.
- One thing I’m still not sure about. You can have react routes served with express. You can have content rendered and returned by flask. When you use them together, it seems to get a little gray. Why have two apps, two servers? I guess the more common case is that the react frontend is bundled then simply served by flask, rather than having two concurrent applications, one on frontend and one on backend.
- Remember, react router is the module that allows you to have multiple routes (in what would otherwise be a SPA). You can have separate bookmarkable urls within your domain.
- You can even have nested subroutes.
- Shareworks has had internal errors in serving documents (tax docs, shareholder notices, etc) for days now.
- YouTube started as a dating app lol.
- HN was pretty underwhelming this week.
- Python 3.8 comes with the walrus operator := which is a conditional assignment.
- Vectorization is almost required for web images. Looks so much cleaner unless the image is superrrrrr high resolution.
- “Github pages” is a pretty cool tool. You can serve static content directly from a repo. You can have a website built automatically from the react app or whatever is in the repo. https://help.github.com/en/articles/what-is-github-pages.
- The new corvette (c8) is actually sick. It doesn’t look like the classic corvettes, it’s much closer to a regular supercar frame. It is also allegedly selling for under 60k.
- Restarted the droplet for the first time (ever, I think).
- FYI, the letsencrypt docker composition I use for cert takes about 30 seconds once the containers are spun up for the first time until the certs are created and recognized.
- An Orioles OUTFIELDER pitched in the 16th inning of a 6 hour game and won it lol. He was throwing 50-60mph the whole time.
- Marshmallow is a python package that allows serialization/deserialization between complex datatypes (like full objects) and standard python datatypes. flask-marshmallow is a shim that allows use in the web framework, making it easier to hook up to sqlalchemy, etc.
- HATEOAS = hypermedia as the engine of application state.
-
- array.map(function) – apply the func to every element and return a new array with the values returned.
- array.filter(function) – this function should return a boolean based on a condition, and a whole new array is returned with only the original values that met the condition.
- Sim port attack: An attacker collects enough information about you (dob, etc) to convince your cell provider that they’re you. They then request that your sim card (your phone number) be transferred to a device they own. Since almost everyone uses their phone for 2FA, they then initiate a password reset for your google account (which is basically everyone’s main email). Once they have your google account, they can do a lot. Saved passwords, google auth with other sites, etc. They can issue bank transfers, empty your crypto accounts, etc.
- Jewish law is extremely strict. There are many activities which are not allowed on shabbat (friday evening to saturday night), which orthodox jew observe: https://en.wikipedia.org/wiki/Activities_prohibited_on_Shabbat.
- An example: you can’t carry things to other places. To get around this, orthodox jewish communities will construct a wire or fence around the district (an eruv). This means if you take an umbrella to a friend’s house, you’re not carrying it to another place, it’s all one private domain and you were just walking within it.
- Kosher(ing) salt is qualified by larger crystals because it is (was) used to extract the impurities (blood) from meat.
- Kosher does not mean it was blessed by a rabbi.
- For my smoking purposes, this larger crystal size just helps retain more water when rubbed on the meat.
- Trichinosis – disease caused by eating raw pork which contains trichinella (roundworms). These parasites die at 158F.
- Netflix is getting a lot of bad publicity lately. Disney+ is coming out, and Netflix is losing a lot of content. I still disagree with the media licensing regime in the first place. It’s going to become so fragmented.
- Good comparison of being a swe at amazon vs uber: https://medium.com/swlh/amazon-to-uber-from-the-lens-of-a-software-engineer-e5bd1c38caba. Neither jump out solely from this limited information.
- Rust is continuing to gain popularity. Syntactically like c++, but better at memory management.
- Tartiflette is a graphql server in python 3: https://tartiflette.io/.
- Remember, most uses of babel refer to the js compiler. But the flask library babel is for i18n l10n.
- Jon jones just got charged with battery from an incident with a stripper back in April. He allegedly slapped her.
- Every group of friends/coworkers/families has a “prestige economy” that drives actions. This is a popular concept in social science. For some, like common teenage male friend groups, it’s athletics or comedy. Decisions are made to increase fitness or humor. That’s what establishes the hierarchy in the group; that’s what earns brownie points among your peers. One that’s very popular among newer generations: virtue signaling. Showing some exhibition of justice to your friends, in an outward way.
- AT&T merged with Time Warner a while back. DirecTV prices have now increased instead of decreasing as promised. Many subscriptions were lost.
- Gatsby (https://www.gatsbyjs.org/) is kinda like create-react-app but it prerenders everything static beforehand, which means it’s faster (but can’t do dynamic stuff).
- Progressive web apps (PWAs) are mobile apps that are intentionally built to run in the browser. They’re html/css/js. They don’t need an app/play store to install, and they’re inherently cross-platform.
- Web
- sudo npm i -g npm@latest && sudo npm i -g npx@latest
- “serve” is a great npm package for running a static page. Just `serve -s <dir>` on a folder like the build output of create-react-app’s `npm run build`. You can also just run `npx serve` in that directory.
- react-scripts is a great package that gives the majority of standard commands (like those from pip or sx-setuptools) – start, build, test, etc.
- Played with create-react-app for quite a bit.
- Lol to apply a stylesheet in a react app, just import the css file into the js of the app. It’s not like html where you specify this sheet directly, but it does compile down to that.
- Goodnight y’all:
-
