HNHacker News
TopNewBestAskShowJobs

scwoodal

309 karma · joined May 7, 2012

submissionscomments
scwoodal··on DRY is an over-rated programming principle?
I'd consider this a bug and not expected behavior.

  def make_pizza(crust=THIN, toppings=[], cheese=REGULAR, sauce=TOMATO):
    // first call: toppings=["peperoni"]
    // second call: toppings=["peperoni", "sausage"]
    // third call: toppings=["peperoni", "sausage"]

  make_pizza(toppings=["peperoni"])
  make_pizza(toppings=["sausage"])
  make_pizza()
scwoodal··on DRY is an over-rated programming principle?
Subtle bug in that toppings has a mutable default argument [1].

[1] https://docs.python-guide.org/writing/gotchas/

scwoodal··on I'm all-in on server-side SQLite
> According to the conventional wisdom, SQLite has a place in this architecture: as a place to run unit tests.

Be careful with this approach. Frameworks like Django have DB engine specific features[1]. When you start using them in your application you can no longer use a different DB (SQLite) to run your unit tests.

[1] https://docs.djangoproject.com/en/4.0/ref/contrib/postgres/f...

scwoodal··on Postgres Auditing in 150 lines of SQL
Ah yes, I was thinking HSTORE.

https://dbfiddle.uk/?rdbms=postgres_14&fiddle=2f406630f367b5...

scwoodal··on Postgres Auditing in 150 lines of SQL
I didn't see this mentioned in the article but with JSONB you can leverage operators to know what data changed.

  > -- record = {"id": 1, "name": "bar"}, old_record = {"id": 1, "name": "foo"}
  > select record - old_record where id=3;
  name => bar
  >
scwoodal··on PostgreSQL query performance bottlenecks
When releasing a new application (or feature) I've always loaded each table in my development environments database with a few million rows. Tools like Python's Factory Boy [1] or Ruby's Factory Bot [2] help get the data loaded.

After the data is loaded up, start navigating through the application and it will become evident where improvements need to be made. Tools like Django Debug Toolbar [3] help expose where the bad ORM calls are or also by tailing Postgres log files.

[1] https://github.com/FactoryBoy/factory_boy

[2] https://github.com/thoughtbot/factory_bot

[3] https://github.com/jazzband/django-debug-toolbar

scwoodal··on Fix the unit test and open a giant hole everywhere
I prefer the code do any generating of file/directory names. Too many edge cases with user input when working at the OS level for me to sleep at night.

Leverage a lookup that says user input “../../../root” == code generated directory path.

scwoodal··on Ask HN: How to manage a large static HTML site?
I received this zip file this morning and after getting it setup within nginx clicking around appears to be working and in good condition.

There are some server side includes I need to configure but the site looks functional.

scwoodal··on Ask HN: How to manage a large static HTML site?
The hosting of this is the easiest piece. It's when changes are needed to the content is where it becomes difficult and what I'm researching a solution for.
scwoodal··on Ask HN: How to manage a large static HTML site?
There are PDFs, videos, images etc.
scwoodal··on A guide to organizing settings in Django
Can you share an example of what a single settings file looks like that configures the 1 through 17 environments you have listed?
scwoodal··on A guide to organizing settings in Django
With a single settings file how do you handle things that should only ever be configured in a specific environment?

Django debug toolbar for example for a development environment? It needs to be listed as an installed app.

Or something specific to tests when the CI/CD pipeline is running the test suite.

scwoodal··on Amazon has ruined search and Google is in on it
I add “site:reddit.com” to consumer/product related Google searches.

This usually gets me the quality information I’m looking for.

scwoodal··on Turntable.fm is back from the dead – and now there are two
Pebbles [1] was a JavaScript library written by Joe Perla.

It was the first time I’d seen a pjax like library and was as fascinated with it as I was turntable.fm.

[1] https://github.com/jperla/pebbles

scwoodal··on Show HN: kutty, jQuery-free intercooler.js
Size aside, there was a considerable increase in performance after jquery was removed.

https://blog.makandra.com/2019/01/performance-impact-of-remo...

scwoodal··on Show HN: kutty, jQuery-free intercooler.js
Another vote for unpoly, it’s jquery free as well.

I’m currently using it in a project that’s a PWA and its been a pleasure to work with.

scwoodal··on From Mac to Linux – the setup I've grown to love
There’s also tmuxinator[1]. I setup profiles for my different development environments (panes for db/repl/vim).

Just a command away from it setting up the Tmux panes with the right sizes and processes running.

[1] https://github.com/tmuxinator/tmuxinator

scwoodal··on A Beginner’s Introduction to Python Web Frameworks (2018)
If you don't mind a little sysadmin work I've had good experiences with Dokku[1]. I spin up a Digital Ocean droplet or AWS Lightsail instance and it's my own mini Heroku.

It's great for side projects without the limitations of Heroku's free tier. Lots of plugins (Postgres S3 backups, Lets Encrypt certificates) are icing on the cake.

[1] http://dokku.viewdocs.io/dokku/

scwoodal··on PySnooper: Never use print for debugging again
The visual of the entire traceback in the browser and the ability to drop into an interactive shell within a specific frame is (for me) a way better experience than pdb.
scwoodal··on PySnooper: Never use print for debugging again
For my Django projects the development server is werkzeug [1] and anywhere a break point is needed I'll add 1/0 in the code then hit refresh in the browser which pulls up an interactive debugger [2].

[1] https://django-extensions.readthedocs.io/en/latest/runserver...

[2] https://werkzeug.palletsprojects.com/en/0.15.x/debug/#using-...

scwoodal··on Ask HN: What's the best book on modern UI/UX?
The amount of value I got out of reading this PDF will far exceed $79.

I'm mostly a backend guy who does the Bootstrap thing. The techniques and examples in the content are gold for someone like me.

scwoodal··on How to balance full-time work with creative projects
Bonding time with the wife is after the kids go to bed. We both enjoy vegging out on the couch or in bed watching TV together. Chores are done mostly on weekends.
scwoodal··on How to balance full-time work with creative projects
I started doing this a month ago and it's been working well for me.

I'd always end up dozing off if I tried to get anything done after the kids went to bed. Now it's asleep by 8:30PM and up at 4:30-5AM for a few hours of personal work time.

scwoodal··on Fast.com now measures latency and upload speed
The grocery store bought the milk so that’s why the truck is on the highway. The truck (Netflix) wouldn’t be there if the grocery store (customer) didn’t order the milk.
scwoodal··on Simplify Login with Application Load Balancer Built-In Authentication
I wouldn't want to share keys like that. I'd also lose out on being able to modify my test account(s) with different groups/permissions that might not be in production yet.
scwoodal··on Simplify Login with Application Load Balancer Built-In Authentication
How does one go about getting authentication like this working in a development environment?
scwoodal··on How to Find Consulting Clients
I found this site a week ago and submitted my email.

The author wrote back within the hour asking how he could help. There were several emails that followed.

While there is a lot of what you claimed out there I feel this site isn’t one of them and the author is genuine.

scwoodal··on Show HN: Dependabot – Automated Dependency Update PRs for Ruby, JS, Python and PHP
Any future plans to integrate with Gitlab and/or other Git hosting services?
scwoodal··on Beating the bookies – how the online sports betting market is rigged
Link to the code used from the PDF:

https://github.com/Lisandro79/BeatTheBookie

scwoodal··on Hacker News News Feed for the Mac Touch Bar
I had it on for a day and the constant context switching was annoying. I flipped the setting back so that the default toolbar (volume, esc, brightness etc) is always displayed.

I still don't like it at all. I'll sometimes look up while thinking and one of my fingers will accidentally be resting on the brightness dimmer. I'll look back down and my screen is black and I'm like WTF??! Only to realize where my finger was with no feedback I had done so.

I wish the touch bar would go away.

← PreviousPage 2 of 3Next →