Categories
Uncategorized

Notes on Asperger Syndrome and Long-Term Relationships

This is an old read, decided to go through and skim it again to see if any of my thoughts have changed over time – I found that a lot of the things I highlighted from before, no longer apply. Maybe over time, things have just improved.

As I read this, I think about how a lot of the things mentioned about those with mild autism exhibit traits like:

  • Preference for structure
  • Depth over variety
  • Difficulty in social situations

A lot of these things sound like something an introverted person would prefer. Maybe just a correlation there.

The book mostly focuses on marriages between an Aspie and Neurotypical, and reads to the neurotypical. The variation is major, showing scenarios where the AS partner is pretty reasonable, and then having them be very hard to deal with.

Some other takeaways:

  • Aspies tend to stick with their first impression (I find this accurate)
  • Having a home is important for an Aspie, as it serves as a place of comfort.
  • The focusing tendencies of an Aspie makes for a double edged sword – easy to choose a single direction and move forward, but can cause tunnel vision.
  • Aspies don’t have a strong drive for socialization – which leads to a drive for less social activities.
Categories
Book Notes

Book Notes – Predictably Irrational

Pretty good and interesting read overall – mostly touches on some of the repeatable unusual things in human behavior. Definitely worth the read. Some of the notes:

  • We judge value on things based on the context of other things around it – making it difficult to judge the value of something absolutely.
  • Question your repeated behaviors – and make sure they aren’t just happening out of habit (ex. getting a regular coffee, do you need to get it)?
  • Things being free gives the image of not having a loss associated to it, although there is always a cost of owning things.
  • Between market (cash) and social (gift) norms, try to keep social norms as long as possible. Gifts make for a good social lubricant.
  • Avoiding temptation is easier than trying to overcome it.
  • Running around and trying to keep everything open as an option ends up making for a shallow experience. Better to pick a few focuses and stick with them (I’ve read this in a few places).
  • Expectations affect experience (if you are told something will be good/bad before experiencing, you will be biased).
Categories
Book Notes

Book Notes – The Total Money Makeover

Over the last few days, I decided to re-read Dave Ramsey’s The Total Money Makeover just to skim it and go through anything I might have missed. I read this book about 8 years ago when finances were more tight, and a lot of the information is pretty helpful.

The takeaway I got after reading a second time was that this book works well for someone that doesn’t have much of an idea on how to handle finances. For someone without any opinion on how to manage their money, this provides a pretty simple workflow to get yourself on the right track.

However, if you’re someone who has more experience, you’ll probably find this book doesn’t teach anything new. Re-reading it the second time, nothing notable came out to me as something I was missing in my financial management. Another issue is that there are a few somewhat controversial ideas that don’t apply if you have decent discipline (avoiding credit use, paying down a house 100%, or only using 15 year mortgages come to mind) that can end up hurting you in the long run.

A couple major points:

  • The snowball method of paying down debt (paying down lowest balance first) I do think has some merit – although you lose out on some interest paid, I think in the long run you end up more motivated to keep on track.
  • Staying debt-free is promoted as the best way to build wealth, which I think makes sense – avoiding regular payments and using the income provided to build wealth.
  • Valuable to think long term as possible, especially with overall cost of items (think “how much”, not “how much a month?”)
  • Important types of insurance to have:
    • Auto & Home – high deductibles for lower premiums
    • Life – 20 year term equal to about 10x income, don’t place savings in life insurance here
    • Disability – purchase through work if possible
    • Health – high deductibles for lower premiums, alongside use of HSA
    • Long-Term Care Insurance – if >60 years old
  • Large tax return? You need to adjust your withholding to allow use of that money throughout the year.

Categories
Technology

Cleaning up Customer Data in nopCommerce

Going through a nopCommerce project with a 40GB database, I found the majority of the space was allotted to a very large Customer table. To fix this, I decided to delete Customer data with the following criteria:

  • No username, email, and password data
  • Not a system account
  • Doesn’t reference a Shipping and Billing address
  • Last activity recorded a month from today’s date

I considered the customers having shopping cart items as well, but found that most of the junk data had one shopping cart item – I think this comes from a robot regularly adding specific items to a cart to check price.

Here’s the SQL used:

DECLARE @customersToDelete TABLE (id int)

INSERT INTO @customersToDelete (id)
SELECT Id FROM Customer
WHERE
	Username IS NULL
	AND Email IS NULL
	AND Password is NULL
	AND IsSystemAccount = 0
	AND BillingAddress_Id IS NULL
	AND ShippingAddress_Id IS NULL
	AND LastActivityDateUtc < DATEADD(week, -1, GETDATE())

DELETE FROM ShoppingCartItem WHERE CustomerId IN (SELECT * FROM @customersToDelete)

DELETE FROM GenericAttribute WHERE KeyGroup = 'Customer' AND EntityId IN (SELECT * FROM @customersToDelete)

DELETE FROM Customer_CustomerRole_Mapping WHERE Customer_Id IN (SELECT * FROM @customersToDelete)

DELETE FROM Customer WHERE Id IN (SELECT * FROM @customersToDelete)

Once this is done, make sure to shrink the database to reclaim the space gained by clearing out the data.

Categories
Technology

Setting up a SonarQube Server in Azure

To get started with using SonarQube in Azure, do the following.

Create a virtual machine with the Standard B2s (~$30/month) size or larger.

SSH into the server and download all pre-reqs:

sudo apt-get update
sudo apt install openjdk-11-jre-headless unzip -y

Create a non-root user:

sudo adduser sonarqube
sudo usermod -aG sudo sonarqube
sudo su - sonarqube

Download and unzip SonarQube (you can get the wget URL from the Downloads page):

wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.1.0.31237.zip

sudo unzip sonarqube-8.1.0.31237.zip -d /opt/sonarqube

sudo mv /opt/sonarqube/sonarqube-8.1.0.31237/* /opt/sonarqube

sudo chown -R sonarqube /opt/sonarqube

Then start it using the following as the non-root user:

/opt/sonarqube/bin/linux-x86-64/sonar.sh console

Wait for the text SonarQube is up and then verify access at IP_ADDRESS:9000 (you can log in with admin/admin).

Set Up PostgreSQL

Next step is setting up a dedicated database – we will use PostgreSQL to accomplish this.

Install PostgreSQL:

sudo apt-get install postgresql -y

And connect into the server instance and run the following commands:

sudo -u postgres psql postgres

CREATE USER sonarqube WITH PASSWORD 'YOUR_PASSWORD'; CREATE ROLE
CREATE DATABASE sonarqube;
GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonarqube;

Now modify /opt/sonarqube/conf/sonar.properties:

sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
sonar.jdbc.username=sonarqube
sonar.jdbc.password=mypassword

Add the following line to /etc/sysctl.conf:

vm.max_map_count=262144

To finish, restart the server, start up SonarQube again and verify that it can start up successfully, alongside having the “embedded DB” warning removed from the login screen.

Set to Run As A Service On VM Start

Next, we’ll set up the ability to start SonarQube on VM start by running SonarQube as a service.

Add the following file /etc/systemd/system/sonarqube.service:

[Unit]
Description=SonarQube service
After=syslog.target network.target

[Service]
Type=simple
User=sonarqube
Group=sonarqube
PermissionsStartOnly=true
ExecStart=/usr/bin/nohup /usr/bin/java -Xms32m -Xmx32m -Djava.net.preferIPv4Stack=true -jar /opt/sonarqube/lib/sonar-application-8.1.0.31237.jar
StandardOutput=syslog
LimitNOFILE=65536
LimitNPROC=8192
TimeoutStartSec=5
Restart=always
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Then enable and start the service:

sudo systemctl enable sonarqube.service
sudo systemctl start sonarqube.service

Confirm by restarting the server and checking that SonarQube is running.

Setting up Reverse Proxy and HTTPS with Let’s Encrypt

Next step is setting up HTTPS, in this case we’ll use Let’s Encrypt for the certificate. To serve the correct ports, we’ll set up Apache and serve it as a proxy to the built-in Tomcat server that SonarQube provides.

When looking to configure Apache, set up the pre-reqs:

sudo apt install apache2 -y
sudo a2enmod proxy_http proxy_ajp rewrite deflate headers proxy_balancer proxy_connect proxy_html ssl lbmethod_byrequests slotmem_shm proxy

Add these lines to /etc/apache2/sites-enabled/000-default.conf:

ProxyPass / "http://localhost:9000/"
ProxyPassReverse / "http://localhost:9000/"

Restart Apache:

sudo systemctl restart apache2

And check that you can access SonarQube using port 80 (HTTP).

Once port 80 is accessible, you can follow the Certbot steps to enable HTTPS.

Next Steps

Categories
Technology

Installing Redux Into Typescript Create React App

To install Redux into an app created with Create React App that’s using Typescript, run the following to install:

npm install --save redux react-redux @types/react-redux

Optionally, you can also install the following to allow for both:

  • Warning in case of state mutation.
  • Connecting to the app using Redux DevTools.
npm i --save-dev redux-immutable-state-invariant
npm install --save redux-devtools-extension

Categories
Technology

Enable Routing in Typescript Create React App

When working with Create React App using the Typescript configuration, there’s a slight change to be made to set up the ability to perform routing.

Install the following into your project:

npm i -S react-router-dom @types/react-router-dom

After that’s done, use the content in the Example Page in your App.tsx file. You should be able to change between pages using the URL as reference.

Reference:

https://create-react-app.dev/docs/adding-a-router/

Categories
Technology

Formatting Dates in Create React App with MomentJS

While working with React, I found I wanted a way to work with dates similiar to the way Angular uses the DatePipe to handle displaying dates correctly. The answer is in using the momentjs library.

To do so, add the package to your project:

npm i --save moment

Then add the following code to test in one of your .js or .tsx files:

import moment from 'moment';

...

{moment().format()}

You should see an ISO string being displayed. To check on ways you can use the library, check the docs on the page above.

Categories
Book Notes

Book Notes – Hackers & Painters

This is a book written almost 15 years ago that makes some comparison to the workstyle painters has and how it correlates to programming. A case study is shown about Viacom, one of the first pieces of software to be served via server side code.

A lot of the ideas presented in this book talks about the perks of serving applications via the web, which is common today. Also, a lot of promotion towards using Lisp.

A lot of this seems obvious to me now, but it definitely wasn’t at this time. Some of the points including:

  • Programming is more painting or gardening then it is engineering (software is constant work in progress)
  • Outsourcing IT might be a good idea (kind of what happens when using a vendor as opposed to being in house).
  • Get version 1.0 out ASAP, improve in iterative steps, and use your own software.
  • Software is best written in small teams (<10)
  • Always work to have working code.
  • Many new trends fade away – don’t always need to try and adopt everything

Lastly, the book makes a point of promotion dynamic typing, and as someone that prefers static typing, it makes an interesting point. Dynamic typing allows for more flexibility and using tools in ways they may not have been intended.

That makes for someone like TypeScript having a certain appeal. I still think having specific types makes for cleaning up APIs and such, but an interesting viewpoint.

Another interesting idea is the fact that wealth is no longer a zero-sum game. Making software that makes loves better is a form of “creating wealth” per say. Wealth isn’t just money, so there’s definitely some value in that. I think with software, a lot of that comes in automation and saved time.

Categories
Book Notes

Book Notes – Squat Every Day

Wanted to try writing some notes to recap some of the books I’ve been reading as a means to rehash the knowledge and have a means to understand what I read, as well as have a reference if I need to look back later.

Squat Every Day by Matt Perryman provides a training philosophy around frequent training over the standard minimalist high intensity training used by many strength athletes.

His approach looks closer to what I’ve seen in high level weightlifting as opposed to powerlifting.

Training Structure

Base Structure:

  • 5-6 workouts a week
  • 1 hour each
  • 1-2 main lifts (squat, press, etc.)
  • 1-3 assistances (core, arms)

Hit a benchmark “minimum” for each lift, and work past that. Focus on smooth movement over grindy and slow.

When jumping up in lifts, two general styles:

  • Big jumps – good for exercises frequently done (squats)
  • Smaller jumps – provides extra practice at cost of energy & time

Think practice, not working out.

Start using 2-3 back off sets when feeling ready (if in doubt, say no).

Advice

  • Reductionism (act of breaking things down and simplifying) doesn’t always apply in all systems. Too many things going on to explain each detail.
  • Willpower is ultimately finite but can be trained over time.
  • Goal is to reduce emotional intensity – lifting should be level, not up and down. Relaxation is a skill since it conserves emotional energy.
  • Body is a garden, not a factory (use a bottom-up approach for experimentation, not top-down approach (highly planned)). Guiding a process as opposed to managing.
  • Do your best not to have total stoppage in training (better to go very light than to completely take time off). Hurts motivation much more, and falling out of habit is hard to recover from.
  • Focus on the process, not the achievement.