HOME

Take

Sort by attributes in nested, polymorphic model relations

Posted on September 30, 2024

//

Tags: rails

This is the relationship i have:

Portfolio.shares.coin.latest_value_snapshot.value_snapshot

I searched for a way when viewing a single portfolio to order shares by their latest value snapshot’s usdt value. This is the query i eventually came up with:

Portfolio
.includes(
{shares: {coin: {latest_value_snapshot: :value_snapshot}}},
{latest_value_snapshot: :value_snapshot},
{shares: {latest_value_snapshot: :value_snapshot}}
)
.joins(shares: {latest_value_snapshot: :value_snapshot})
.where(value_snapshots: {valueable_type: "Share"})
.order("value_snapshots.usdt_satoshis")
.find(params[:id])

For the polymorphic part, the key ingredient is .where(value_snapshots: {snapshotable_type: 'Share'}). This ensures that only the value_snapshots that are associated with Share are considered, filtering out those related to Portfolio or Coin. These have their own value snapshots.

The includes is related to eager loading, preventing N+1 query issues.

The explicit joins method helps creating the SQL join which help focusing the where condition and order method onto the value_snapshots table correctly.

The order method then applies to the usdt_satoshis table. Note that I am using the money gem to handle currencies, with USDT / Satoshis being a custom currency, hence the table name including the _satoshis prefix.

Link

Anthropologist: Environmental care no longer national concern for Estonia

PERMALINK

Posted on July 13, 2024

//

Tags:

“A rapidly changing society failed to recognize the structural and systemic causes of poverty and decline. It was as if the victim was entirely to blame for his or her situation.”

“This allowed us, in Annist’s view, to paint a picture of the opposite of dysfunctional: the individualistic and successful achiever. People held up this imaginary figure as a standard for others, disregarding the fortunate circumstances and supportive environment that typically led these individuals to success.”

“The demonstration attempted to change the situation in which farmers were continually spilling milk. Usually, they only did it on their farms. The demonstration attempted to bring this painful requirement to the public’s attention, but it became bogged down in reflection and interpretation of the action.”

“comparing the success of the 1980s protest to the 2017 action against tree felling for a road repair project in a Tallinn suburb. On the one hand, the wider public debate did not address whether such a road widening was even essential. On the other hand, the demonstrators were mocked for concentrating on the protection of reed. ”The protest was described as a waste of time, for example, because a hard-working citizen cannot be involved in such ‘nonsense,’” Annist explained.”

“Since the 1990s, instead of showing solidarity, Estonians have been comparing themselves with others on the basis of material indicators, she suggested. “It’s as if everyone’s future is being sacrificed for the sake of material success and the approval of the richest. Such blinders did not limit our thinking in the 1980s; today, very few of us are free of them. Unfortunately, it is difficult for us and for those in power to step back and reflect on whether the goals set in the 1990s are all sustainable,” she said.”

Take

The irony

Posted on June 11, 2024

//

Tags: news

The irony that people whose only tools in a debate are deceit, sowing hatred, spreading misinformation and bashing their political opponents are using exactly the same methods when it helps them inside their own party… the irony seems lost on Helme.

This is a good reminder for other parties when planning to go into coalition with whatever comes out of this power struggle.

EKRE Chair Martin Helme calls Henn Põlluaas 'holy war' claims defamatory

Conservative People's Party of Estonia (EKRE) Chair Martin Helme has referred to MP Henn Põlluaas' claims that Mart Helme, EKRE's founder, had praised Russia's so-called "holy war" in Ukraine.

news.err.ee
Take

Yet another example of inadequate reporting

Posted on May 22, 2024

//

Tags:

It’s unfortunate how the article doesn’t try to get a critical view to the comments made by the producer or user side. The directive doesn’t state as its purpose to reduce plastic, but to lower its impact on the environment.

Leaving the producer’s strawman of “more plastic used” and the users anecdotal “i’m inconvenienced in my car” or sheer gutwrenching “I don’t believe the scientifical result of the impact of plastic in the environment” is just another example of EU-bashing and bad journalism.

It’s always a bit sad to see how complex issues (impact of single use products on garbage piles in the sea, complexity of maritime and fishing objectives as a main driver of EU policy, effect of consumer behavior in one part of the EU and their outcome and impact of other parts of the Union) are trivialized instead of explained.

Tethered plastic bottle caps may in fact use more plastic, not less

A recent switch towards plastic bottle caps which remain attached has had almost the reverse effect from that intended – ie. to cut down on the use of plastics – "Aktuaalne kaamera" (AK) reported Sunday.

news.err.ee
Take

Feedback to the architektural competition to redesign Koidu street, Uus Maailm, Tallinn, Estonia

Posted on February 13, 2024

//

Tags: urban

As an inhabitant of Uus Maailm, a father, walker, biker, driver, and someone with an interest in urban issues, I have been eagerly anticipating the results of this competition with high expectations and hopes. The redesign of Koidu Street on this side of the Endla / Suur-Ameerika “maantee” will have a major impact on how we, as citizens, will be able to live in and utilize our neighbourhood, Uus Maailm, far more than any other recent projects or street renovations, and likely for the next couple of decades.

The short version

  1. Thoroughly alter the traffic pattern by
    1. uniting school space and Koidu park,
    2. creating a recognizable Koidu 80 plats with minimal traffic,
    3. breaking up all the residential streets leading into Koidu, allowing pedestrians but restricting cars from passing into or over Koidu,
    4. honoring the ideas of the Liikuvusagentuur T-Model for the Liivalaia-Kristiine tram line.
  2. Avoid artificial branding through material gloss, historicizing street decor, and coerced street branding. Instead, make the space more flexible for the residents to define their own brand through usage patterns and emerging lifestyle and urban culture, then make this coherent through later redesign.

The slightly longer version

When I look at the street, I see three major centers that require special consideration: the Suur Ameerika Entrance, the Koidu 80 plats, and the Humanitaargümnaasium / Koidu Park complex.

These three areas require a fundamental rethinking of how we consider public space. For me, this mainly means pushing further towards a car-free city (car-free not in the often misunderstood sense of forbidding cars, but in the sense of not depending on them).

As I understand, the brief asks for an urban space that prioritizes pedestrians/people above all modes of transport. For this reason, these three areas should go even further and fundamentally alter the traffic pattern by reducing through traffic to pedestrians and small vehicles, particularly in the school/park complex.

But also, to a degree, at the Koidu 80 plats, and (considering the proposed tram stop and the overall atmosphere setting character of an area entry) the Suur Ameerika Entrance. All the necessary functions of the street can be relocated elsewhere in the vicinity (parking, drop-off/pick-up around the school, utility vehicles).

The opportunity to combine school space and park space into one unit, uninterrupted unit by car traffic, is an amazing chance to create a truly free room for people to enjoy, reducing stress and noise.

Videviku can easily be restricted to pedestrian and small vehicle traffic at both ends, ending in Koidu, leaving access for residents, utilities, and emergency vehicles. This will create a real plats around Koidu 80 that can be traversed with vehicles along Koidu but does not become a transit thoroughfare between Luha and Tehnika. This should also be considered for Planeedi, Virmalise, Kiire, Videviku, Saturni, and Komeedi. None of the streets need to be traversable over Koidu.

Regarding the Suur Ameerika Entrance, the proposal from the Liikuvusagentuur T-Model 2022 should form the basis for any long-term considerations of how Koidu gets connected. It reasonably demands the reduction of the crossroads to a city- and human-sized dimension without losing any access opportunities. There is also a long-term vision to establish a good public space with facilities for the residents on the plot of the current gas station, another foundational entrance lighthouse project to mark the urban space as Uus Maailm. One could even dream of a proper connection between Kassisaba and Uus Maailm following this current project, and a further reduction of the Endla/Luise Autobahn.

These three outstanding areas will provide ample opportunity for the residents and the city to give purpose to the newly created urban space. Over time, given a certain flexibility and adaptability of people and administration, the newly emerging use patterns will offer “branding” opportunities for the area. And as we are looking at a decade-long development of urban character, we should reject any kind of preconceived branding that the proposals provide. Uus Maailm does not need marketing decoration or glossed-over historicized lamp posts, etc. Sensible preservation of historical details is, of course, preferable.

We need to be given the opportunity to properly use our urban space, and have an open ear and a long-term participatory vision following the much-welcomed redesign of Koidu Street.

Take

Estonian public life seasons

Posted on January 15, 2024

//

Tags: society

For example, we have TV “seasons” somewhere from about January 10 to Midsummer, or 22 weeks, followed by 11 weeks of summer, then 16 weeks for the fall season, and three weeks of Christmas and New Year.

Paul Rebane: Our actions are dictated by the sun, not the government

We are governed by the sun, not by the government. How this is so can be particularly evident when you look at your TV viewing habits, and there is a whole science behind what we choose to watch and why, Raul Rebane reported in Vikerraadio's daily commentary earlier this week.

news.err.ee
Link

Actions that create opportunities

PERMALINK

Posted on November 10, 2023

//

Tags: business

Here are some ideas on things you can do (now) that will create opportunities for yourself in the future:

  • Podcast

  • Give a talk

  • Write a blog

  • Go to meetups

  • Take a course

  • Learn new skills

  • Get a remote job

  • Join a community

  • Grow your network

  • Promote your work

  • Go to a conference

  • Start a newsletter

  • Publish on YouTube

  • Apply for a new job

  • Create a side-project

  • Explore a new industry

  • Collaborate with a friend

  • Build something in public

  • Become an expert on a topic

  • Ship a free project on the internet

  • Sell a small product on the internet

Link

CORS issue, how to work around it with Nginx Proxy Manager

PERMALINK

Posted on October 27, 2023

//

Tags: software

First comment:

You need to edit proxy settings for uptime kuma, under Custom Locations add a new location with location as / and then enter your scheme/hostname/port for uptime kuma. Then go to the gear icon besides location and enter add_header 'Access-Control-Allow-Origin' *; and then save.

Made static cms work with gitea/forgejo.

Take

Takeaways from Justin Searls' video series about creating a rails app from scratch

Posted on March 15, 2023

//

Tags: rails programming

1st episode

cone of uncertainty

Before thinking the app from top to bottom (fancy well-designed ui and ux) or bottom to top (thought out database model with all attributes and interactions), focus on figuring out if the app can do the most important thing it should do, try that out in some place, like the console and then move on from there.

lib folder

All apps are essentially ETL bodies. We take data from somewhere (api, forms, imported files), do something with it and push it on (api or webhook, html site, etc). The transformation is the thing that is the business logic, the service, the work. That can really start living in a lib module, namespaced. Starting with self.function model functions.

last responsible moment

Have the maximum possibility space by waiting with a decision until the last moment when you have to take it.

The Sequel to Searls After Dark

I started a screencast series last week, and I can call it a series now because there's a second one.

justin․searls․co
Article

Kaffemaschienen Referenz

Posted on January 27, 2023

//

Tags:

Grundsätzliches

Die erste Frage ist Siebträger oder Vollautomat.

Vollautomaten

Ich ignoriere die Vollautomaten, weil:

  • sehr teuer
  • sehr viele verschiedene Teile die sehr oft ordentlich gereinigt und instand gehalten werden müssen
  • noch keine gefunden die guten Kaffee macht

Siebträger

Hier gibt es auch eine große Auswahl. Die wichtigen Kriterien:

  • Budget
  • Vollmetall
  • Einkreis, Zweikreiser, Dualboiler

Vollmetall ist selbsterklährend. Hier sind einfach alle Teile, Rohre, Ventile, etc aus Metall, und dementsprechend langlebiger, aber auch teurer.

Ob Einkreiser, Zweikreise, Dualboiler hängt dann vom Betrieb ab, aber für die ein paar Kaffees am morgen und über den Tag gehen die ersten beiden Versionen. Dualboiler sind da zu teuer. Schlussendlich ist das auch eine Komfortfrage: mit Einkreiser macht man halt erst den Kaffee, und muss dann auf Dampf umschalten und warten, bis Dampfdruck aufgebaut ist. Das macht das Kaffeemachen ein bisschen länger. Bei einem Zweikreiser kann man beides paralell bzw. gleich hintereinander machen.

Um immer gleiche Kaffeequalität zu haben ist eine Kaffemühle daneben schon wichtig. Die kleinen Mühlen mit Messer die viele Leute in der Küche haben sind schwierig, weil das Mahlgut immer anders grob wird. das hängt halt vom Halten und der Dauer ab, ist also eher zufällig.

Erfahrung

Wir haben diese Kombi:

Ich hatte die vor 5 Jahren als Bundle bei www.stoll-espresso.de gekauft, Mühle für 290, Machine für 530. Dazu kam dann noch ein bisschen optionales Zubehör (Milchkann, Reinigungsbürste und Pulver, Edelstahltamper), und eine 5-Jahre extra Garantie. Also mit dem Setup bist du pi mal daumen bei rund 1000 Euro.

Das gute an der Maschiene ist die Wartungsmöglichkeit. Wenn man ein bisschen Geschick und Erfahrung mit Elektrik hat, kann man das Gerät einfach aufschrauben und drinnen ist alles reparier- und ersetztbar, mit nur wenigen Spezialteilen die man einzeln nachbestellen kann. Ich habe von Leuten gelesen, die ihre Silva Jahrzehnte in betrieb hatten.

Ein Problem was ich mit dem Garantieschutz jetzt mal mit Stoll besprechen muss ist der Metallfuss. Im Gegensatz zum Rest der Maschine ist der nicht aus Edelstahl und rostet. Und ich hoffe den ersetzt zu bekommen.

Alternativ

Wenn ich nochmal neu kaufen würde, dann würde ich die gleichen wieder nehmen, aber in der nächsten Version:

Silvia Pro X

Dualboiler, nur um den Kaffee, Schaum, aber auch Kakao oder heißen Saft schneller machen zu können. Aber ist da der doppelte Preis gerechtfertigt? Ist also eher Luxus.

Rancilio Rocky

Der hat einen Dosierhebel. Jetzt wieg ich das Mahlgut, damit immer gleich viel in den Kaffee kommt. Das ist weichtig, weil ein paar Gramm mehr oder weniger schon darüber entscheiden ob entweder braunes Kaffeewasser kommt, oder gar kein Kaffee, weil zu viel Mahlgut im Siebträger ist… Mit so einem Dosierhebel kommt halt immer gleich viel raus.

Sollte das mit dem Budget oder Erwartungen alles überhaupt nicht hinhauen, dann kann ich aus eigener Erfahrung Kapselmaschienen mit wiederverwendbaren Kapseln empfehlen, da aber keine konkrete. Ich hatte mal eine Weile eine Nespresso. Aber da muss dann halt noch ein Milchschäumer dazu, wenn man irgendwelche Milchkaffeeversionen bevorzugt. Aber ich glaube mittlerweile gibt es Maschinen mit Milchschäumer. Das Handling mit den Kapselnachfüllen brauch ein bisschen Übung. Dafür ist die Zubereitung natürlich massiv vereinfacht und viel schneller. Einwegkapseln lehne ich aus Müllgründen jedoch grundsätzlich ab, auch wenn deren Kaffeegeschmack ganz ordentlich ist.

Nachtrag

Ich bin irgendwann auf die Zuriga gestoßen. Das Produkt ist noch mal eine Preisklasse drüber, und es gibt es noch nicht so lange, aber es ist so schön anzusehen.

Link

Poor Millennials

PERMALINK

Posted on November 16, 2020

//

Tags: society

Some ideas here for social change, however, based on US analysis.

  • raise the minimum wage and tie it to inflation

  • roll back anti-union laws to give workers more leverage against companies that treat them as if they’re disposable

  • tilt the tax code away from the wealthy

  • attach benefits to work instead of jobs: For every hour you work, your boss chips in to a fund that pays out when you get sick, pregnant, old or fired. The fund follows you from job to job, and companies have to contribute to it whether you work there a day, a month or a year.

  • construction workers have an “hour bank” that fills up when they’re working and provides benefits even when they’re between jobs

  • Hollywood actors and technical staff have health and pension plans that follow them from movie to movie

  • in low employment / mid to high human resource areas launch a program that simply reimbursed employers for the wages they paid to eligible new hire

  • improve existing poverty fighting programs and handouts over basic income

Link

Copenhagen’s New Public Spaces Are Modular and Can Float

PERMALINK

Posted on May 31, 2020

//

Tags: urban

Architects Marshall Blecher and Magnus Maarbjerg are on a mission to breathe new life into Copenhagen’s old harbour. They’re working on a floating archipelago that will introduce a new type of public space.

Would be interesting to see something like this in Tallinn.

Take

Sure, we should do studies

Posted on April 3, 2020

//

Tags: society

sure, we should do studies, and get more data, and have a full view of the …ah, there goes my dad, who is 74 with heart condition… data. we should also make sure that the we really only shut down the areas of the economy that are actually …ah, now my mom’s dead, cause she has worse chances than the new born with its mum who is 24 and also needs a respirator in a hospital with 15 places…affected by the pandemie. after all, we shouldn’t sacrifice the economy on the altar of public health …and now my grandmum is also dead, along with the 20 others in the nursery home where they still had ‘social visits’ to keep up the spirits.

you know what? who cares. some people (loose couple of scientists/doctors, a handful who have come out in the last couple of days, in a profession of what, maybe 10.000, 15.000 professionals, that just do the actual work?) just think they have eaten it with spoons, the wisdom of how to run a massively complex society of tens of millions of people.

but sure, i’m happy that they come out now and speak up, and ask the “really important questions, that yeah, actually, it makes so much sense when you think about it”. truly. it’s a right to spread your opinion, and i cherish that, really. it also helps me to figure out who i don’t care about when i need to focus on keeping my babies healthy, hope the best for my pensioner parents, and watch the images of stashed away coffins with actual dead people.

Take

Pathogen Resistance

Posted on March 31, 2020

//

Tags: finds

we are not trapped in here with the coronavirus, the virus is trapped in here with us.

Look at it in this way maybe.

Take

Starship Technologies makes redundancies to ‘streamline service’

Posted on March 29, 2020

//

Tags: tech

Robot delivery company Starship Technologies made a large number of redundancies last week after feeling the economic effects of the coronavirus pandemic, website DigiPRO reported.

A company uses an external crisis to restructure their business to the expense of its workers. That is nothing new. That is why other countries have made laws against that kind of behavior towards employees. How is this surprising?

Link

This Furniture Is Bending the Rules of Shared Spaces

PERMALINK

Posted on February 2, 2020

//

Tags: design

Cutwork’s furniture designs are based on their signature metallic tubes that are being laser-cut to allow them to be bendable. This simple solution brings the production close to the end-users and the furniture can be manufactured on demand eradicating additional costs of storage. If production locally is not an option, emissions from shipping are still kept low by flat-packing all pieces and assembling them on site. As the main material — steel — can be also easily recycled, Cutwork is about to become certified as offering all circular products.

logo

Andreas Wagner
2024  •  whysthatso.net