Programming Confessions Thread
-
I was connected to a small device over SSH, which runs software that does funky things with network configuration. Another device on the network had claimed its IP address and caused it to reconfigure stuff and get a bit weird, so in resolving all that I had the brillant idea to try turning the network interface on and off again.
So I turned off the interface. Over SSH.
-
@kazitor said in Programming Confessions Thread:
I was connected to a small device over SSH, which runs software that does funky things with network configuration. Another device on the network had claimed its IP address and caused it to reconfigure stuff and get a bit weird, so in resolving all that I had the brillant idea to try turning the network interface on and off again.
So I turned off the interface. Over SSH.
Congratulations on becoming a Real Sysadmin!
-
@kazitor said in Programming Confessions Thread:
So I turned off the interface. Over SSH.
BTDT, but on Windows. It's a rite of passage.
-
I CBA to extract a 20-field form into a separate Angular component so it can be reused across two pages, and instead I copy-pasted 700 lines of code and made single-word changes here and there.
-
@Gustav the power of compels you.
-
@Gustav said in Programming Confessions Thread:
I CBA to extract a 20-field form into a separate Angular component so it can be reused across two pages, and instead I copy-pasted 700 lines of code and made single-word changes here and there.
You'll either be vindicated when they diverge or be cursed when they both need to be updated.
-
@boomzilla the latter. They're literally the same data structure. But at least I'm not cursed with refactoring Angular app.
-
@Gustav I briefly looked through the Angular docs, and was left thinking "but where does this actually let you write less code with a lower blunder rate?"
-
@dkf said in Programming Confessions Thread:
where does this actually let you write less code with a lower blunder rate?
You're not familiar with that whole JS thing, I see.
-
@dkf said in Programming Confessions Thread:
@Gustav I briefly looked through the Angular docs, and was left thinking "but where does this actually let you write less code with a lower blunder rate?"
That sounds like some kind of Ruby on Rails promo. What I like about Angular is that it's mostly pretty straightforward. Like anything, there are some gotchas around the way the event loop works, etc. And it doesn't do the React thing where it mixes markup and code.
-
@Zerosquare said in Programming Confessions Thread:
You're not familiar with that whole JS thing, I see.
Very true.
-
@dkf said in Programming Confessions Thread:
@Zerosquare said in Programming Confessions Thread:
You're not familiar with that whole JS thing, I see.
Very true.
I assure you that you should keep it that way. For your sake if nothing else.
-
@boomzilla said in Programming Confessions Thread:
it doesn't do the React thing where it mixes markup and code.
You say that as if it's necessarily a good thing.
-
@Zecc said in Programming Confessions Thread:
@boomzilla said in Programming Confessions Thread:
it doesn't do the React thing where it mixes markup and code.
You say that as if it's necessarily a good thing.
Yes, I do.
-
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)
-
@topspin said in Programming Confessions Thread:
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)Yeah, I'm not entirely certain what point he was trying to make, if any. But I'm happy to re-emphasize that I don't like mixing markup and code.
-
@boomzilla said in Programming Confessions Thread:
I'm not entirely certain what point he was trying to make, if any.
Welcome to TDWTF.
-
@topspin said in Programming Confessions Thread:
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)What I meant was "not mixing code and markup" is not necessarily a good thing. I think it depends. For simpler components I think it's fine.
-
@Zecc said in Programming Confessions Thread:
@topspin said in Programming Confessions Thread:
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)What I meant was "not mixing code and markup" is not necessarily a good thing. I think it depends. For simpler components I think it's fine.
Edit: plus, you can split code and markup but still have it all in the same file; though that's entering splitting hairs territory.
-
Confession: I've used the Quote button instead of the Edit menu option.
-
@Zecc said in Programming Confessions Thread:
Edit: plus, you can split code and markup but still have it all in the same file; though that's entering splitting hairs territory.
Sounds more like you're splitting code and markup than hairs.
-
@Zecc said in Programming Confessions Thread:
Confession: I've used the Quote button instead of the Edit menu option.
Might as well split the post while you're at it.
-
@Zecc said in Programming Confessions Thread:
@Zecc said in Programming Confessions Thread:
@topspin said in Programming Confessions Thread:
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)What I meant was "not mixing code and markup" is not necessarily a good thing. I think it depends. For simpler components I think it's fine.
Edit: plus, you can split code and markup but still have it all in the same file; though that's entering splitting hairs territory.
I have some code that's nominally internally split, but indeed has code in the markup and some markup in the code...
-
@Tsaukpaetra said in Programming Confessions Thread:
@Zecc said in Programming Confessions Thread:
@Zecc said in Programming Confessions Thread:
@topspin said in Programming Confessions Thread:
@boomzilla not sure how @zecc meant it, but it sounds quite obvious to me that not mixing markup and code is the good thing, not the reverse.
(That is, I agree with you, but itâs not obvious to me if he didnât agree too.)What I meant was "not mixing code and markup" is not necessarily a good thing. I think it depends. For simpler components I think it's fine.
Edit: plus, you can split code and markup but still have it all in the same file; though that's entering splitting hairs territory.
I have some code that's nominally internally split, but indeed has code in the markup and some markup in the code...
You can split the code and the markup, but there's always going to be a little bleed-through, because "how things look" is also (somewhat) business logic.
-
I'm using TypeScript, where the enums are just a combined object of name-to-number and number-to-name. The implementation looks vaguely like this:
ServerEnum = { 0: "FirstServer", 1: "SecondServer", "FirstServer": 0, "SecondServer": 1 }
And I'm using an enum as the key in an object. And it's really convenient a lot of the time, because I have one of those enum values hanging around most of the time.
{ [ServerEnum.FirstServer]: {...}, [ServerEnum.SecondServer]: {...} }
It's great, except in two cases:
- Object.keys(), Object.values(), and Object.entries() will all return a string key, so my enum value of 1 gets coerced into "1".
- I also end up sticking that enum into the URL, where it should be the string-value rather than the number-value.
So for 1), I'm using
parseInt(enumThing) as ServerEnum
in my iterators.And for 2), I'm doing a lot of
ServerEnum[enumAsNumber]
andServerEnum[enumAsString]
. I should probably switch from Object to Map, but , and Map's iteration API is a bit uglier.