News for hackers. Stuff that matters.

chris12321

Re: on Saturday September 27, 2025 @01:19PM (#45397648)
A majority of people in North West England has Irish ancestry. Are those people not British?
After German reunification the states of East Germany and West Germany ceased to be. Was that two genocides?
No state has the right to exist, that thought terminating cliche makes no sense legally or philosophically. States are recognised by other states, with no legal rights involved. Also claiming that a call for the end of a state is a call for genocide is ludicrous, if that was the case then every revolution in world history would be a genocide.
> It's almost like if bureaucrats who are writing regulations are experienced in writing regulations in such a way they can't be circumvented.

Americans often seem to have the view that lawmakers are bumbling buffoons who just make up laws on the spot with no thought given to loop holes or consequences. That might be how they do it over there, but it's not really how it works here.

Re:Ditching Obsidian and building my own on Sunday May 18, 2025 @04:51PM (#44024232)
You can also set up DNS records pointing to your home server's VPN IP, which, with Tailscale, I've found to be pretty static and then a reverse proxy on your home server. So I have my home network apps running on app1.my-domiain.com app2.my-domain.com, app3.my-domain.com etc, which only work when I'm connected to the VPN.

The downsides are that I need to be connected to the VPN at home to use the domain and I currently don't have SSL set up on the domains, so browsers complain when I connect to them. The second problem I could fix, but I'm not sure if there's a solution for the first.

Re:Fandom Sells Giant Bomb to Independent Creators on Sunday May 11, 2025 @04:15PM (#43956782)
That's certainly not a criticism that could be levelled at Giantbomb, considering it was started when its founder, Jeff Gerstman, was fired from his job at GameSpot for giving a game a low review score while the developer of the game was doing a big marketing campaign on the site.
Thanks, I'll let my team know.

Sorry I meant to say "I've been thinking about building a Once style project" I've just got a couple of not very well fleshed out ideas at the moment.

In terms of licencing it's interesting, I suppose you could have the app phone home periodically, but since it's source available, someone could just remove that call. I guess the main idea is just that it's software for businesses and legitimate businesses generally aren't going to break licence agreements.

It's simply not true that "regular AR calls are painfully slow." In the context of a web request, the time spent instantiating Active Record objects is negligible. For example, on my laptop:

Customer.limit(1000).to_a

completes in about 10ms, whereas:

Customer.last(1000).pluck(:id, :name, :tenant_id, :owner_id, :created_at, :updated_at)

runs in around 7ms.

Active Record methods are defined at application boot time as part of the class, they're not rebuilt each time an instance is created. So in a typical web app, there's virtually no performance penalty for working with Active Record objects.

And when you do need raw data without object overhead, .pluck and similar methods are available. It’s just a matter of understanding your use case and choosing the right tool for the job.

It's been widely understood in the Ruby community for some time now that metaprogramming—like in the example above—should generally be limited to framework or library code, and avoided in regular application code.

Dynamically generated methods can provide amazing DX when used appropriately. A classic example from Rails is belongs_to, which dynamically defines methods based on the arguments provided:

class Post < ApplicationRecord belongs_to :user end

This generates methods like:

post.user - retrieves the associated user

post.user=(user) - sets the associated user

post.user_changed? - returns true if the user foreign key has changed.

This is an interesting project! I'm going to recommend it to my team at work, since we've been moving to try to self-host more of our services.

I've been about building a Once-style project myself, how do you deal with tracking the licences, do you have the ability to revoke them if someone breaks the licence?

I recently read The Ministry for the Future by Kim Stanley Robinson, and one of the ideas in it that I thought was very good was replacing our cargo ships with wind-powered ships, basically giant sailing ships. In the book, they were incredibly slow, with shipments taking months to complete, but if supply lines were set up correctly, that wouldn't matter for a lot of cargo. Cargo ships are a massive CO2 contributor, and it was interesting that a solution could be to return to sailing ships.

I know there are probably huge engineering problems preventing this from happening, so feel free to tell me why it's impossible.

Re:Ruby not dead it seems on Monday March 03, 2025 @07:58AM (#43241302)
As a long time Ruby developer the only thing about Ruby that I wish would die is people declaring 'Is Ruby dead?/Ruby is dead/Ruby isn't dead'!
Re:Tiny JITs for a Faster FFI on Wednesday February 12, 2025 @07:21PM (#43031351)
Ruby will probably never again be the most popular language in the world, and it doesn't need to be for the people who enjoy it to be excited about the recent improvements in performance, documentation, tooling, ecosystem, and community.
Re:Tiny JITs for a Faster FFI on Wednesday February 12, 2025 @06:05PM (#43030746)
Between Rails At Scale and byroot's blogs, it's currently a fantastic time to be interested in in-depth discussions around Ruby internals and performance! And with all the recent improvements in Ruby and Rails, it's a great time to be a Rubyist in general!
Re:Bypass DeepSeek censorship by speaking in hex on Friday January 31, 2025 @03:49PM (#42891800)
ChatGPT won't tell you how to do anything illegal, for example, it won't tell you how to make drugs.
Re:Deploying Rails on Docker: Kamal Alternative on Friday January 24, 2025 @06:50PM (#42818079)
I know of a bunch of apps that deploy to multiple servers behind a load balancer using Kamal. Here's an article explaining the process https://guillaumebriday.fr/how-to-deploy-and-scale-your-rail...
Re:Most Influential Papers in Computer Science History on Thursday January 23, 2025 @04:30AM (#42802338)
How does a modern goto differ from a traditional goto?
This was written by the recently deceased Noah Gibbs. The site is now under the control of his widow. It's a great course and I'd encourage people to check it out.
Re:Optimizing Ruby's JSON, Part 4 on Friday January 03, 2025 @11:55AM (#42587255)
I think it's a combination of a lot of things over the last 2ish years:

1. Ruby 3.0 and YJIT have provided huge performance gains for the language with further improvements still left to be implemented.

2. Ruby releases new versions every year on Christmas day, so you're more likely to get new content around this time of year.

2. Large Rails shops like Github and Shopify have redoubled their commitment to Ruby/Rails and invested a lot of resources into improving the developer experience with ruby-lsp.

3. Prism, the new Ruby parser has been developed and merged into Ruby, from my understanding, it's a lot more user-friendly and fault-tolerant, allowing for the creation of more/better development tools.

4. Rails 7/8 released a ton of exciting new features such as Hotwire, Solid suite, auth generation and others. Promising a simpler way to make high-fidelity applications.

5. The Rails Foundation was created and has focused on improving documentation, organising Rails World and pushing the message of Rails being 'a one person framework' that can get you 'from hello world to IPO'.

6. A growing dissatisfaction with the needless complexity of the Javascript ecosystem and cloud providers, pushing people towards the simple but powerful solutions Rails provides.

All these individual contributions seem to have produced a snowball effect. As a long-time Rails developer, seeing there be a new Ruby and/or Rails post on the front page of HN nearly every day recently has been really exciting.

Re:Ruby-refrigerator: Freeze all core Ruby classes on Tuesday December 31, 2024 @09:25AM (#42558861)
I didn't mean to imply you didn't know that stuff, I just tend to write comments from the basics for anyone unfamiliar who may be reading. Yup I would expect it to have an (extremely small) boot time impact. Though I don't think it would have a runtime impact, since surely ruby has to check the frozen flag on mutation whether the flag has been set to true or not? Also by including the gem you preclude mutating the class objects anyway, since it raises an error.
Re:Ruby-refrigerator: Freeze all core Ruby classes on Tuesday December 31, 2024 @08:12AM (#42558494)
The gem isn't freezing instances of the objects, but rather the classes themselves. In Ruby (nearly) everything is an object, so for example Array is an object of type Class. Classes are also open by defualt, allowing them to be altered at run time. There's nothing stopping me doing the following in my app:

  irb(main):001* class Array
  irb(main):002*   def hello
  irb(main):003*     puts "hello"
  irb(main):004*   end
  irb(main):005> end
  => :hello
  irb(main):006> [].hello
  hello
This sort of monkey patching is used a lot in the ActiveSupport gem to give convenient methods such as:

  irb(main):001:0> 3.days.ago
  => Sat, 28 Dec 2024 13:10:24.562785251 GMT +00:00
Integer is extented with the `days` method making date maths very intuative.

This gem freezes the core classes, essentially closing them, so doing the above raises an error:

  irb(main):007> require 'refrigerator'
  => true
  irb(main):008> Refrigerator.freeze_core
  => nil
  irb(main):009* class Array
  irb(main):010*   def hello
  irb(main):011*     puts "hello"
  irb(main):012*   end
  irb(main):013> end
  (irb):10:in `<class:Array>': can't modify frozen class: Array (FrozenError)
Looking at the code in the gem, all it's doing is calling https://apidock.com/ruby/Object/freeze on all call modules. The frozen flag is an inbuilt part of the language and as far as I'm aware has a performance benefit. In fact the major verison of Ruby will have all string instances frozen by default.
Re:A Vanilla Rails Stack Is Plenty on Tuesday December 24, 2024 @05:44PM (#42505484)
The new getting started guide is great. Chris Oliver is a great teacher. Afterwards, if you want a 102-style tutorial, I'm a big fan of https://www.hotrails.dev/. It goes step by step and explains how Hotwire works and how to use it.
Re:Hotwire Spark: live reloading for Rails applications on Wednesday December 18, 2024 @11:11AM (#42451728)
This rapid feedback seems like it will be especially useful when iterating on CSS designs
Re:Ruby Video – On a mission to index all Ruby conferences on Tuesday December 17, 2024 @10:29AM (#42442125)
Since Rails 7.1 we've had https://www.rubydoc.info/github/rails/rails/ActiveRecord%2FR... which actaully does run queries in parallel.

There's also Rails' russian doll caching, which can actaully results in pages with n+1 queries running quicker than ones with preloaded queries. https://rossta.net/blog/n-1-is-a-rails-feature.html

Re:Rewrite it in Rails on Monday November 04, 2024 @07:07PM (#42047422)
I find that a 6-month-old JS project will often not even boot since its exhaustive dependency list will be out of date and now mutually incompatible. You have to feed a JS project with updates every couple of hours, or it will die like a Tamagotchi.
Re:How I Animate 3Blue1Brown on Saturday October 19, 2024 @10:10AM (#41887853)
In languages I'm most familiar with, you can't access variables defined outside of the function within the function unless the variable is a class or global variable. So for example in Python you can do:

  >>> x = "hello"
  >>> def test():
  ...     print(x)
  ...
  >>> test()
  hello
which seems very odd to me. In Ruby you get:

  irb(main):001> x = "hello"
  => "hello"
  irb(main):002\* def test
  irb(main):003\*   puts x
  irb(main):004> end
  => :test
  irb(main):005> test
  (irb):3:in `test': undefined local variable or method `x' for main:Object (NameError)
This makes much more sense to me, since x is defined outside of the scope of test, so why should test have access to it?
This made me think of this recent tweet from Nate Berkopec, a developer well-known in the Rails community as a specialist in performance and scaling. https://x.com/nateberkopec/status/1846429195670552635

    If you're starting a new Rails app and live in the EU, the optimal strategy is pretty clear:
    
    Get a 64-thread box on Hetzner for 250 euro a month, allocate 20% of it to the DB, 40% to web, 40% to bg, then  just forget about scaling until you're making money hand over fist.
At a certain point, self-hosting is so much cheaper than PaaS that you can way overprovision your server and not worry about it until you're making serious money.
Re:How I Animate 3Blue1Brown on Saturday October 12, 2024 @04:41PM (#41822373)
Now think about how our society is set up to allocate resources to people like Musk rather than people like Sanderson.
Re:How I Animate 3Blue1Brown on Saturday October 12, 2024 @04:40PM (#41822367)
Manim is incredibly cool, but my biggest takeaway from the video is how insane it is that Python apparently lets you reference a variable in a function that was defined outside the scope of the function.

Older »