HNHacker News
TopNewBestAskShowJobs

dalu

20 karma · joined May 27, 2016

submissionscomments
dalu··on The Brazen Bootlegging of a Multibillion-Dollar Sports Network
All the football live streams on Facebook alone and no one is doing anything (at least it feels like it) to remove them. And they're all with arab text scrolling on the bottom. When a game is on, our visitor numbers drop by a large % (almost completely). When a game is on I can be sure our ad revenue is down by at least 70%, because those games are so widely accessible via Facebook.
dalu··on How I write Go HTTP services after seven years
I've been doing it a bit differently. Lately I've written 2 generators. Gen1 works using the Go language a := Api("shop") a.Root("/home/dalu/go/src/dalu/shop") mProduct := Model("Product") mProduct.Field("Id",Identifier,true) // (true=optional) mProduct.Field("Name",String,false) mProduct.Field("User",ReferenceId, false) // etc a.Model(mProduct) a.Render()

this creates a "cobra init; cobra add api" app, - handlers - route definitions - data repositories - the models - angular service files

https://github.com/dalu/reforum

next step would be to extend it with a full featured adminUI in angular using some kind of datagrid. I was never big on testing so I'm not generating tests.

version 2 of this generator you write your models and they get inspected and from those models essentially the same thing is generated, only in v1 I wrote it all with fmt.Sprintf and now I'm working on the text templates. I can't really say which one is better. In v1, adding a new type means rummaging through all the instances where a typecheck is done. In v2, it's the same but in text templates. Both feel like they're sub-optimal solutions.

The layout of the handler in v1 is type Handler struct { userRepo productRepo } etc, and a single repo for every model. So if I need data from 2 or more repos it's done in the handler.

But in v2 I have 1 handler that gets passed 1 repo. And the repo is initialized with the various options for dbname dbcollection. Yes it's all MongoDB.

In v1 I have an unintuitive way to query the db. Let's say there's a ProductRepo, I have a ProductParams type when I had to set true to "Name" if I wanted to query the name attrib of that model, then set NameQuery to be a new instance and if I wanted a equal query "name = 'hello'" I'd set the NameQuery.Type = "eq" and NameQuery.Query = "hello".

In v2 I got rid of the "Name = true" thing. And I'm json, then base64 encoding the query for GET queries. This way I can have a more convenient/intuitive and slim Params structure.

I'm currently thinking about doing this, but everything should be server side rendered, aka no angular. But I'm not sure... it's the old problem I faced as a PHP dev. How to create re-usable components, programmatically.

You need to construct your data model and from this model you should be able to deal with ToMany, ManyTo, ToOne, OneTo and the rendering of those Forms and input validation and you need lazy loading for related models.

Qor does something like this in their adminui building blocks. And I've seen something similar in PHP's Symfony.

dalu··on EU's Mandatory Copyright Content Filter Is the Zombie That Just Never Dies
This is essentially the barrier for one-guy developers being able to start their own crowd-contributed platform. This is so much in favor of the big players that I'll call this a lobby sponsored regulation. It needs to go away. Or I'll have to move my stuff outside of the EU.
dalu··on China is now home to some of the world’s most powerful supercomputers
OT: When ever I read "cyber" I think "2 guys pretending to be girls doing cybersex in a MMORPG" ¯\_(ツ)_/¯
dalu··on What Does It Mean to Be Poor in Germany?
Yeah I thought it was ham burger as burger with ham
dalu··on Show HN: Run your own OAuth2/OpenID Connect provider
You're doing OIDC but OIDC requires JWT. Well sorry but if you're not using JWT then this isn't OIDC. The whole point of OIDC is token verification, you provide an identity and that identity can be verified.
dalu··on Cellphone-Cancer Link Found in Government Study
> But we have hundreds of detailed studies of Radio and Health, and no reproducible link has ever been found.

What about http://www.bioinitiative.org/

← PreviousPage 4 of 4