Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
mystes
May 31, 2006

Protocol7 posted:

It doesn’t return anything for any of the files I’ve been given or generated.

At least strings works on the new firmware file to pull out the human readable strings i saw from the raw hex view.
Yeah, I guess if strings works it's not compressed or anything, and binwalk just searches for recognizable stuff like archives and filesystems, so if the firmware image is literally just a single uncompressed binary there may not be any point to it.

Unfortunately that will probably be much more annoying to mess with than a device running linux or something.

mystes fucked around with this message at 17:11 on Feb 29, 2020

Adbot
ADBOT LOVES YOU

Super-NintendoUser
Jan 16, 2004

COWABUNGERDER COMPADRES
Soiled Meat
I didn't see a specific docker thread offhand, but I have a question that google is failing me on.

I have a flask app, it runs fine, and I have it in docker with Traefik, and it's protected by a whitelist, since it lives on a stack that technically is open on 443. I'd like to use Traefik/Docker to protect it with authentication. I setup digest auth, and all that, so I have a local list of usernames/passwords that I can use, but I was curious if there's a docker container that is a simple auth provider, so I could use traefik's forwardauth middleware and use API keys instead of usernames/passwords since it's mostly automated services that hit my API.

Keetron
Sep 26, 2008

Check out my enormous testicles in my TFLC log!

TraderStav posted:

Is it when a car will fall through the ice and everyone in town bets on it?

Definitely check the trunk of that car before it goes down...

Life turns on a dime, you know

This post made me very happy, it was like a decade ago since I read the book but it is on tv now?

TraderStav
May 19, 2006

It feels like I was standing my entire life and I just sat down

Keetron posted:

This post made me very happy, it was like a decade ago since I read the book but it is on tv now?

It was, not great but still worth a watch. If you haven't listened to the audiobook I HIGHLY recommend that as the narrator is top notch. I still get chills thinking about the numerous times he mentions life turning on a dime. I've listened to that book 3 times over the years, such a great slice of Tales from Americana mixed with apocalyptic time travel.

Sorry for the derail...

The book is 11/22/63 by Stephen King by the way

CampingCarl
Apr 28, 2008




I am looking for a way to code or script (or if an app exists I guess) a way to find out the last time files were modified in folders. The purpose is to try to generate a listing of what folders are no longer actively being used and can probably be archived.

I didn't see a powershell thread which I assume can do this relatively simply but I have really just started with it. I am able to get the modified time of the folder but I don't think that is the same thing as the last modified of the contents.

qsvui
Aug 23, 2003
some crazy thing
Powershell thread is here: https://forums.somethingawful.com/showthread.php?threadid=3286440

Plank Walker
Aug 11, 2005
Quick CSS/HTML question, a div's border appears to be always rendered "inside" its area, is there a way to center the border line on the boundary of the div? I.e. if i have a 10px border, 5px of the line should be inside the div's area and 5px should be outside.

nielsm
Jun 1, 2009



Use the outline property.

Macichne Leainig
Jul 26, 2012

by VG

Plank Walker posted:

Quick CSS/HTML question, a div's border appears to be always rendered "inside" its area, is there a way to center the border line on the boundary of the div? I.e. if i have a 10px border, 5px of the line should be inside the div's area and 5px should be outside.

Use a border and outline?



code:
div {
    border: 10px solid red;
    outline: 10px solid blue;
}
Ah gently caress, three of us going at the same time with the same advice. :v:

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

Plank Walker posted:

Quick CSS/HTML question, a div's border appears to be always rendered "inside" its area, is there a way to center the border line on the boundary of the div? I.e. if i have a 10px border, 5px of the line should be inside the div's area and 5px should be outside.

half in border, half in outline

efb

Plank Walker
Aug 11, 2005
Thanks for the triple replies haha. Hate to change the question after getting answers but, I sort of lied when I said I wanted a 10px line, and instead need a 1px line and apparently half pixels don't exist. I'll probably end up just using 1px outline since it looks better.

Macichne Leainig
Jul 26, 2012

by VG
You can still use outlines, they have an offset property.

https://developer.mozilla.org/en-US/docs/Web/CSS/outline-offset

Might see if an offset of -1px or -0.5px does what you need.

Not sure if values that small are visible without a high-PPI display though.

JawnV6
Jul 4, 2004

So hot ...

Protocol7 posted:

I put the file through r2 and it seemed like it was all good machine code.
1) It.. shouldn't?
2) What is bad machine code, duude

Really there ought to be some data sections that look like really weird code. A bunch of ADD instructions doing the same thing repeatedly. Bad opcodes or otherwise nonsensical sequences.

Macichne Leainig
Jul 26, 2012

by VG

JawnV6 posted:

1) It.. shouldn't?
2) What is bad machine code, duude

Really there ought to be some data sections that look like really weird code. A bunch of ADD instructions doing the same thing repeatedly. Bad opcodes or otherwise nonsensical sequences.

I mean there are those, but I found functions that look like they do substantial things as well when I ran them through the r2dec decompiler.

I found this Medium article and it was helpful since it uses a similar MCU.

https://medium.com/techmaker/reverse-engineering-stm32-firmware-578d53e79b3

Using the same tools and steps I get similar looking results, but I do admit I'm a complete noob in this area.

Ultimately we're just trying to replace a hardcoded IP/domain name so that this device connects to our own server instead of the manufacturer's very lovely, unreliable server.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

CampingCarl posted:

I am looking for a way to code or script (or if an app exists I guess) a way to find out the last time files were modified in folders. The purpose is to try to generate a listing of what folders are no longer actively being used and can probably be archived.

I didn't see a powershell thread which I assume can do this relatively simply but I have really just started with it. I am able to get the modified time of the folder but I don't think that is the same thing as the last modified of the contents.

I wanted to speculate that there are already utilities for this, but couldn't get TreeSize to very clearly do it, so I was staying silent for any tricks that might get you around having to code it out.

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Anyone recommend a particular good intro to learning parsing expression grammars (PEG)? Hoping for some web tutorials etc over a full fledged book.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm looking for experiences people have had with using Entity-Component-Subsystem and similarly decoupled patterns. I'm particularly curious how they managed sequential and temporal problems with stuff having to be ordered linearly or hierarchically. I'm looking at this for a context outside of gamedev where I don't really have to tick these subsystems every frame, but I get other problems in exchange.

peepsalot posted:

Anyone recommend a particular good intro to learning parsing expression grammars (PEG)? Hoping for some web tutorials etc over a full fledged book.

I feel bad you were left hanging with this. My take from the silence is nobody has a good tutorial for general syntax for this. I went down this road a little under a year ago and just mangled around with ANTLR4. That is, learning by doing. I think any particular tool is going to have its own quirks so you might as well not look for PEGs in general but how to write grammars using this or that. If you have even the faintest handle on recursion then you shouldn't have any problem with writing rules like "a statement is stuff followed by possibly more statements."

(Chances are that people will now respond with the parsing tools of their own preference and you'll find more luck from that than a general grammar.)

The grammar for a calculator is going to be the "simplest non-trivial" case you'll find, but you probably want to parse multiple lines. There are various toy projects for that. If your goal is to outright parse and existing language, then there's a nice GitHub project that has ANTLR grammars for various languages. For what I'm doing with Python stuff, I wound up using this one. It has a lot of crap for lexing a space-delimited language. On the other hand, the rules match the syntax of the grammatical rules in Python's own spec.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Rocko Bonaparte posted:

I'm looking for experiences people have had with using Entity-Component-Subsystem and similarly decoupled patterns. I'm particularly curious how they managed sequential and temporal problems with stuff having to be ordered linearly or hierarchically. I'm looking at this for a context outside of gamedev where I don't really have to tick these subsystems every frame, but I get other problems in exchange.


I feel bad you were left hanging with this. My take from the silence is nobody has a good tutorial for general syntax for this. I went down this road a little under a year ago and just mangled around with ANTLR4. That is, learning by doing. I think any particular tool is going to have its own quirks so you might as well not look for PEGs in general but how to write grammars using this or that. If you have even the faintest handle on recursion then you shouldn't have any problem with writing rules like "a statement is stuff followed by possibly more statements."

(Chances are that people will now respond with the parsing tools of their own preference and you'll find more luck from that than a general grammar.)

The grammar for a calculator is going to be the "simplest non-trivial" case you'll find, but you probably want to parse multiple lines. There are various toy projects for that. If your goal is to outright parse and existing language, then there's a nice GitHub project that has ANTLR grammars for various languages. For what I'm doing with Python stuff, I wound up using this one. It has a lot of crap for lexing a space-delimited language. On the other hand, the rules match the syntax of the grammatical rules in Python's own spec.

Try AOL keyword "struct of arrays"

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

leper khan posted:

Try AOL keyword "struct of arrays"

I know this is why people push for ECS in game engines, but I'm not looking at game engines or even a situation where performance is a major problem. I particularly wound up in a situation where composition was a good data model for something, but turning that into an object implementing each section as interfaces wasn't necessarily looking good. So I wound up with an entity-component kind of thing, and it just happens that ECS is how I see it come up any more.

Some of the stuff in that data model represents data that matters during common pre-check, initialization, setup, or cleanup phases. I was generally wondering how the code working on those components (the subsystems) are separated and ordered by the framework in a variety of situations. At the end of the day, I'm trying to conclude how much of a pain it is to maintain something like this--it's probably too much of a pain--using a really synthetic prototype.

Edit: And this is a Rocko doing work thing and not a Rocko's annoying science project thing, if that matters.

Sab669
Sep 24, 2009

I have sort of a complex question... I just started a new job a month and a half ago. The software is still pretty young, 2 years old maybe - we're just starting developing an API.

At a very high level, the problem is that a lot of tables in the database have a UserID that does not allow nulls. But now we need to start exposing stuff for the API, where they won't have a UserID to pass and we're having a hard time trying to figure out how to 'correctly' modify the tables / the architecture for the software to be able to handle requests "internally" or "externally"?

If anyone has advice or knows of some relevant reading materials I'd appreciate it :)

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Why won't your API server have a UserID to pass? Surely you're not planning on exposing your database tables directly?

Sab669
Sep 24, 2009

They'll provide an API key, but that's stored differently. Like we've got an API Key table, a User Table, and for example say a Bill of Materials which requires UserID as a foreign key, and that's kinda enforced all through the ORM the application uses

I suspect I'm not explaining it accurately though =x

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The obvious solution is just to creature a UserID for everyone who uses your api and has been given an api key, and keep that mapping in the same place you keep known api keys.

Sab669
Sep 24, 2009

Thought about that, but my boss doesn't love the idea security implications of creating however many users behind the scenes. I also suggested creating a singular API User that would also be hidden, but that got shot down too :shrug: Maybe I'll try suggesting it again on Monday lol

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

To be clear are you saying everyone who has an API Key doesn't have a user ID already?

Typically, your key belongs to a user and then your views look up the user based on the API key...

Sab669
Sep 24, 2009

I think the current "vision" is that there will be a single user who can grant unlimited number of API keys and give them to whoever they please.

It's enterprise software, not like a "public" service if that makes a difference.

So we log who creates the key, yes, but it's not guaranteed that the person using the key is the person who generated it.

ToxicFrog
Apr 26, 2008


peepsalot posted:

Anyone recommend a particular good intro to learning parsing expression grammars (PEG)? Hoping for some web tutorials etc over a full fledged book.

I learned them by loving around with LPEG, the Lua PEG library. However, this was back in 2007-2008ish when PEGs were still quite new, and also I was already using Lua at the time; if you aren't there may be better choices.

Rocko Bonaparte posted:

Some of the stuff in that data model represents data that matters during common pre-check, initialization, setup, or cleanup phases. I was generally wondering how the code working on those components (the subsystems) are separated and ordered by the framework in a variety of situations. At the end of the day, I'm trying to conclude how much of a pain it is to maintain something like this--it's probably too much of a pain--using a really synthetic prototype.

In my experience -- which is mostly hobbyist and entirely game-oriented, so take that for what it's worth -- there's two main approaches to this:

- have a top-level runSystems() that runs every tick and invokes each system in turn; if necessary it can be made smart enough to skip systems that only need to run every second rather than every frame or whatever
- have each system declare up front what other systems it needs to wait for, what component data it reads and writes, and under what circumstances it can skipped, and then organize the systems into a graph (at compile or startup time, typically) based on that and invoke them in an order that satisfies the dependency graph; this has the advantage that since systems declare all their data dependencies you can automatically invoke systems in parallel when it's safe to do so, at the cost of being considerable more complicated

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

ToxicFrog posted:

- have a top-level runSystems() that runs every tick and invokes each system in turn; if necessary it can be made smart enough to skip systems that only need to run every second rather than every frame or whatever
- have each system declare up front what other systems it needs to wait for, what component data it reads and writes, and under what circumstances it can skipped, and then organize the systems into a graph (at compile or startup time, typically) based on that and invoke them in an order that satisfies the dependency graph; this has the advantage that since systems declare all their data dependencies you can automatically invoke systems in parallel when it's safe to do so, at the cost of being considerable more complicated

Ahh thanks. I had a notion of using a graph for that kind of thing but it was definitely a "let's stop and think about this" kind of moment. Some of the sequential stuff as very specific phases so I was thinking of either having the subsystems report their phase or have the subsystem API have call-ins for each phase or whatever. I haven't gotten that far yet.

The whole thing might be too much for casual use but I think I'll be able to at least demo it with a bunch of stuff printing things to a log.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
The goal of ECS and data-oriented programming is performance.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Suspicious Dish posted:

The goal of ECS and data-oriented programming is performance.

Do you know of other means of composition that mate well with a pretty flexible input configuration format? Real question here. The only real other thing I can think of is dynamically building objects out of interfaces for each section, and I don't know how that would turn out better.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Write some code for it. That's why they hired you, after all.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Suspicious Dish posted:

Write some code for it. That's why they hired you, after all.
I am but I'm checking as I go if these is particularly reasonable and intelligent.

Okay I know I'm driving people nuts, but I literally have nobody I can talk to or think out loud with about this stuff, and the rubber duck doesn't answer these kinds of questions, so I just ask it here. If the answer to asking questions like this in this thread is to just go off and write code then so be it, but I think that's setting a bad example even if you're fed up with me. Is there a better thread for the design/abstraction/hippy stuff?

The reason I explored an ECS kind of thing in the first place was based more on what I remember seeing in a Game Programming Gems book a long time ago that composition like this helps avoid inheritance diamond-of-death situations where you get something that's X and Y but not Z, and lot of the inputs have situations like that. So the subsystem part getting dragged in is to just stick with how people talk about it these days.

dirby
Sep 21, 2004


Helping goons with math

quote:

composition like this helps avoid inheritance diamond-of-death situations
I may be misreading the context, but it might be helpful to just google "Composition over Inheritance" and your language of choice.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

dirby posted:

I may be misreading the context, but it might be helpful to just google "Composition over Inheritance" and your language of choice.

I'm generally just looking for any shared experiences working with and designing frameworks with a heavy bend towards composition. If I were to then get specific, I'm looking for any experiences with dealing with timing dependencies after distributing an architecture that way. I consider that to be a big tradeoff with it and I figure there would be some war stories or something.

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Composition over inheritance is cool and good but you don’t have to use ECS to get the benefits. It’s too heavy of a design pattern if you don’t need the performance benefits imho.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Rocko Bonaparte posted:

The reason I explored an ECS kind of thing in the first place was based more on what I remember seeing in a Game Programming Gems book a long time ago that composition like this helps avoid inheritance diamond-of-death situations where you get something that's X and Y but not Z, and lot of the inputs have situations like that. So the subsystem part getting dragged in is to just stick with how people talk about it these days.

That's entity-component modelling, a related-but-adjacent term to data-oriented programming and ECS describing an older architecture. But it's all confused these days and when I tried to search for entity-component modelling I got a bunch of people saying calling it ECS so maybe I'm the wrong one.

Unity's GameObject is Entity-Component Modelling
Unity's Burst system is Entity-Component-System

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Google even wants to autocomplete "entity component" as "entity component system." It's very prolific now. Something like a decade ago when I first delved into any notion of the concept, Google was more like "what the gently caress are these moonbeams?!"

Spatial
Nov 15, 2007

Bit twiddling question. Is there a trick to expand 4 bits into 4 bytes quickly?

For example:
binary 1111 -> 00000001 00000001 00000001 00000001
binary 1010 -> 00000001 00000000 00000001 00000000

Since there are only 16 possible inputs a lookup table is the obvious solution and that's what I have. But I'd like to get rid of it to keep the code size low since this is on a microcontroller.

nielsm
Jun 1, 2009



32 bit register size?
Best I can think of is something like (x << 21 | x << 14 | x << 7 | x) & 0x01010101

If you don't have 32 bit registers you're probably stuck with a loop shifting one bit left or right at a time and setting one output byte based on current bit.

Adbot
ADBOT LOVES YOU

robostac
Sep 23, 2009
It depends on your cpu (eg Intel BMI2 extensions on allow for this as a single instruction). Most likely on embedded this doesn't exist Quickest is probably your lookup table (would need to benchmark though) , smallest would just be calculating it:
code:
 return ((v << 21)|(v<< 14)|(v << 7)|v) & 0x01010101;

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply