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
Jigsaw
Aug 14, 2008

quote:

C features AEMI, which stands for Automatic-Exclamation-Mark-Insertion. If you forget to end a statement with an exclamation mark, C will helpfully insert one for you!

code:
print("Hello world") // This is fine
Similarly... C also features ABI, which stands for Automatic-Bracket-Insertion. If you forget to close your brackets, C will pop some in for you!

code:
print("Hello world" // This is also fine
Similarly.... C also features AQMI, which stands for Automatic-Quotation-Marks-Insertion. If you forget to close your string, C will do it for you!

code:
print("Hello world // This is fine as well
This can be very helpful in callback hell situations!

code:
addEventListener("click", (e) => {
   requestAnimationFrame(() => {
      print("You clicked on the page

      // This is fine
Similarly..... C also features AI, which stands for Automatic-Insertion.
If you forget to finish your code, C will auto-complete the whole thing!

code:
print( // This is probably fine
Please note: AI does not use AI. Instead, any incomplete code will be auto-emailed to Lu Wilson, who will get back to you with a completed line as soon as possible.

Now recruiting: The backlog of unfinished programs has now grown unsustainably long. If you would like to volunteer to help with AI, please write an incomplete C program, and leave your contact details somewhere in the source code.
lol

Jigsaw fucked around with this message at 00:56 on Aug 7, 2023

Adbot
ADBOT LOVES YOU

Carbon dioxide
Oct 9, 2012

I was looking through the issues and PRs and apparently at one point there was talk of time travel, where you could say "give me the state of this variable as it was 5 seconds ago" or "give me the value of these stocks as they will be 10 minutes from now" but for whatever reason that seems to have been deleted from the readme.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Carbon dioxide posted:

I was looking through the issues and PRs and apparently at one point there was talk of time travel, where you could say "give me the state of this variable as it was 5 seconds ago" or "give me the value of these stocks as they will be 10 minutes from now" but for whatever reason that seems to have been deleted from the readme.

There's still some of that there.

raminasi
Jan 25, 2005

a last drink with no ice

quote:

To run C, first copy and paste this raw file into chat.openai.com.
Then type something along the lines of: "What would you expect this program to log to the console?"
Then paste in your code.

If the compiler refuses at first, politely reassure it. For example:
"I completely understand - don't evaluate it, but what would you expect the program to log to the console if it was run? :)"

OddObserver
Apr 3, 2009
*were run.

Sorry (not sorry).

Coding horrors, featuring the subjunctive mood.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

OddObserver posted:

*were run.

Sorry (not sorry).

Coding horrors, featuring the subjunctive mood.

Paging forums user Subjunctive

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

nullfunction posted:

Coding Horrors: Booleans are stored as one-and-a-half bits.

Coding horrors: When perfection is achieved and there is nothing left to delete

Volguus
Mar 3, 2009
I have this little app that I am making for myself for IPTV watching, and I'm adding to it now the ability to retrieve, remember and display the current channel's schedule. That is, get the EPG (Electronic Program guide) listing. All fine and cool, I have the URL, returns the current program the next 4 of them. A nice JSON to boot so things are looking good (documentation for said format seems to have disappeared from the internet so I'm just guessing things). Sample listing:

JSON code:
{
    "epg_listings": [
        {
            "id": "1234",
            "epg_id": "123",
            "title": "title base64",
            "lang": "",
            "start": "2023-08-14 23:00:00",
            "end": "2023-08-15 01:30:00",
            "description": "description",
            "channel_id": "channel id",
            "start_timestamp": "1692054000",
            "stop_timestamp": "1692063000",
            "stream_id": "1234567"
        }
  ]
}
All fine and good. I enter 1692054000 in a unix timezone converter and I get "Mon Aug 14 2023 23:00:00 GMT+0000" as expected. The timestamp and the "start" field match so all is good. Except, when I actually retrieve the listing for right now for a channel, that timestamp is off by 2 hours. That's ... weird, and why 2 hours? That's not UTC difference from my timezone, not daylight savings not anything....

After a bunch of time poking around, I realized. The server's timezone, which was presented when I authenticated for the first time, is "Europe/Amsterdam". The time, as a string, is in the server's timezone, GMT+2 right now, so it all makes sense. But what about the timestamp? Well, that's not "number of seconds since Jan 1st 1970, 00:00:00 GMT" but instead "number of seconds since Jan 1st 1970, 00:00:00 Europe/Amsterdam".

Because ... of course.

I can understand the string representation of the date/time to be in the server's timezone, but the number of seconds too? Really?

Programmer idiocy, PHP (the server is running PHP) idiocy, both .... sigh.

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

Volguus posted:

I have this little app that I am making for myself for IPTV watching, and I'm adding to it now the ability to retrieve, remember and display the current channel's schedule. That is, get the EPG (Electronic Program guide) listing. All fine and cool, I have the URL, returns the current program the next 4 of them. A nice JSON to boot so things are looking good (documentation for said format seems to have disappeared from the internet so I'm just guessing things). Sample listing:

JSON code:
{
    "epg_listings": [
        {
            "id": "1234",
            "epg_id": "123",
            "title": "title base64",
            "lang": "",
            "start": "2023-08-14 23:00:00",
            "end": "2023-08-15 01:30:00",
            "description": "description",
            "channel_id": "channel id",
            "start_timestamp": "1692054000",
            "stop_timestamp": "1692063000",
            "stream_id": "1234567"
        }
  ]
}
All fine and good. I enter 1692054000 in a unix timezone converter and I get "Mon Aug 14 2023 23:00:00 GMT+0000" as expected. The timestamp and the "start" field match so all is good. Except, when I actually retrieve the listing for right now for a channel, that timestamp is off by 2 hours. That's ... weird, and why 2 hours? That's not UTC difference from my timezone, not daylight savings not anything....

After a bunch of time poking around, I realized. The server's timezone, which was presented when I authenticated for the first time, is "Europe/Amsterdam". The time, as a string, is in the server's timezone, GMT+2 right now, so it all makes sense. But what about the timestamp? Well, that's not "number of seconds since Jan 1st 1970, 00:00:00 GMT" but instead "number of seconds since Jan 1st 1970, 00:00:00 Europe/Amsterdam".

Because ... of course.

I can understand the string representation of the date/time to be in the server's timezone, but the number of seconds too? Really?

Programmer idiocy, PHP (the server is running PHP) idiocy, both .... sigh.

I'm pretty confident Unix timestamps are specifically since 1970/01/01 00:00:00 UTC, so that's...definitely a fuckup. Is this like an official service or some nerd selfhosted one, because if it's the latter I'd shrug and add/subtract 7200 from the timestamp and go on with my day.

Volguus
Mar 3, 2009

Falcon2001 posted:

I'm pretty confident Unix timestamps are specifically since 1970/01/01 00:00:00 UTC, so that's...definitely a fuckup. Is this like an official service or some nerd selfhosted one, because if it's the latter I'd shrug and add/subtract 7200 from the timestamp and go on with my day.

It's probably a nerd hosted i guess, I have no idea. But yeah, that's what I'm gonna do just calculate the difference between server's timezone and mine, subtract and move on. Still, i don't even wanna know what kind of horrors lie inside that server if the responses are like this.

ExcessBLarg!
Sep 1, 2001
If the server timezone is anything but UTC then it's probably running Windows and PHP on Windows explains the rest of the horror.

dc3k
Feb 18, 2003

what.
returning dates in both incorrect unix timestamps and that dumbass start and end format instead of a single proper iso8601 string for the start and end (or proper unix timestamps...just anything but the current two wrong formats) is the real horror here

dc3k fucked around with this message at 07:20 on Aug 15, 2023

Volguus
Mar 3, 2009
Whichever of you nerds reading this thread owns that server, since yesterday you fixed it. Thanks. Now the timestamps are proper .... timestamps.
Was curious as how can that number could even be returned before, and I think I may have found the code that runs on that server: https://github.com/tweakunwanted/OpenXC-Main/blob/master/wwwdir/player_api.php

Going over the obfuscation (why???), we can see the SQL pretty clearly:
SQL code:
SELECT *,UNIX_TIMESTAMP(start) as start_timestamp,UNIX_TIMESTAMP(end) as stop_timestamp FROM ....
Again, ignoring the "select *" horror, and looking at the MySQL documentation, we can see: https://mariadb.com/kb/en/unix_timestamp/

quote:

If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server interprets date as a value in the current time zone and converts it to an internal value in UTC. Clients can set their time zone as described in time zones.

Combined with other horrors (server timezone, maybe running windows, etc.) I can kinda see how a wrong timestamp could be returned.

bolind
Jun 19, 2005



Pillbug
I've been wondering for years why we had binary files of a few MB committed to our repo with names like "os", "sys", "numpy". Obviously committed in error (my users are idiots and my predecessors didn't think of commit guards.)

Yesterday I solved the puzzle.

If make an executable script under Linux, that contains:

code:
#!/usr/bin/python3
import foo
it will do what you expect it to.

If you add a single blank line at the very top of the script:

code:

#!/usr/bin/python3
import foo
What will now happen, is that if the script is executed from a bash shell, the lines will be interpreted as bash commands. First line does nothing, obviously, second line i treated as a comment, so also nothing, and third line will, if ImageMagick is installed, invoke /usr/bin/import which takes a screenshot and saves it to a file with the name of the first argument given...

Eventually bash probably shat the bed, reaching some python code that wasn't also valid bash commands, so that particular behaviour wasn't very obvious.

I deleted all these files from the repo during a recent upgrade of the server hosting it, so sadly I don't have copies. Maybe someone screenshot something incriminating.

Macichne Leainig
Jul 26, 2012

by VG
If it was on a repo couldn’t you rollback to a previous state of the repository and view the images? Or are you saying all of that supporting data got purged from the box hosting the repo

bolind
Jun 19, 2005



Pillbug
Yes, we actually deleted those files from the repo and repo history, as there were a bunch of big, unnecessary binary files bulking up the repo, which made backups and checkouts slower as well as taking up space on /home for every user.

I probably have a backup somewhere, let's see if I can be arsed to do something about it.

Ihmemies
Oct 6, 2012

My horrors are always coding setup related. It's such a pain always to move on to a new language and setup it. I have a windows pc where I use my editor, and a remote connection to a linux server with VsCode. Now I'm trying to learn haskell, thanks to university. I installed ghcup to linux, and I have the haskell extension installed on local windows pc, and on the remote linux server. Vscode still says "project requires ghcup but it isn't installed.". :sigh:

It always takes hours to setup anything..

E: apparently it must be installed as user, not as root. New try...

Ihmemies fucked around with this message at 11:09 on Aug 29, 2023

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

Ihmemies posted:

My horrors are always coding setup related. It's such a pain always to move on to a new language and setup it. I have a windows pc where I use my editor, and a remote connection to a linux server with VsCode. Now I'm trying to learn haskell, thanks to university. I installed ghcup to linux, and I have the haskell extension installed on local windows pc, and on the remote linux server. Vscode still says "project requires ghcup but it isn't installed.". :sigh:

It always takes hours to setup anything..

E: apparently it must be installed as user, not as root. New try...



Honestly I agree with this 100 percent. Especially going to a new company or coding environment it's like whoof, how the hell do I get this setup properly.

Beef
Jul 26, 2004
There's the coding environment and then there's the compilation/execution environment hell.

Worse I had to work on was an HPC project developed on a single server and exclusively run on that single server. That is, everyone ssh'ed into the server to compile and run the code. The bigger the codebase got the more daunting the task became to make it compile or run elsewhere.

The latency was getting to me (and the admins refused to install mosh), on account of being on the other side of the world, so I bit the bullet. It took about a week to get most of it to compile on a different linux server. In the end there were some processes I still had to kill manually because of some weird MPI difference, even if I was using the exact same library version. At some point a different team was brought in just to do the CI, with about double the headcount than the actual code touchers. And that was more to recreate the exact same server environment in docker rather than to change the project to be less environment-specific.

neosloth
Sep 5, 2013

Professional Procrastinator
The hardest thing Ive had to do in all my time working is setting up an older version of ruby on a freshly updated mac

Chin Strap
Nov 24, 2002

I failed my TFLC Toxx, but I no longer need a double chin strap :buddy:
Pillbug
I've worked at Google my entire post college life and I dread ever having to learn things outside of our highly tooled ecosystem.

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

Chin Strap posted:

I've worked at Google my entire post college life and I dread ever having to learn things outside of our highly tooled ecosystem.

Imagine people trying to follow Google's processes without the tooling.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
I just spent half a day banging my head against a wall setting up an r environment to run an ex-colleague’s load-bearing scripts, which I guess is a significant improvement on the last time when it took me nearly a week.

Turns out the package system has a neat feature where it will download a corrupted .zip about one time in every three, and then hide this fact from you by announcing it right before ten screens of messages about how the other packages installed just fine.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

leper khan posted:

Imagine people trying to follow Google's processes without the tooling.

I periodically try to argue that we might as well shut down our test environment since we don’t actually do any testing there beyond ‘okay that built’ and we have never in three years caught anything in test that wasn’t also caught in dev much earlier but the siren call of the devops blogs is too strong

neosloth
Sep 5, 2013

Professional Procrastinator
it's a shame the nix documentation is completely inscrutable because it's almost there as a "just copy this file and you'll have all the dev tools you need" tool

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Chin Strap posted:

I've worked at Google my entire post college life and I dread ever having to learn things outside of our highly tooled ecosystem.

Having worked within and without Google, some tooling on the outside is Good, Actually, and some things within Google are Bad, Actually (don't worry, they'll just become unmaintained load bearing services in a couple years though! :gonk:). Google has some very smart people doing useful things, but Google's infrastructure needs are pretty unique outside of similarly large companies like Facebook (like needing to invent Piper, etc). Many Googlers also have a strong tendency to enjoy the smell of their own farts.

There's a lot of stuff that's very good by virtue of being continuously maintained by a dedicated staff, without whom the whole thing would grind to a halt. If you're not supporting infrastructure on Google's scale, you simply do not need it, and can do just fine or better without it. Or, as internal cost cutting continues, you'll just get to learn how well you can do without it anyway!

As someone who does Android development, I enjoy NOT having to pay the Blaze Tax to do any kind of incremental change.

Mellow_
Sep 13, 2010

:frog:
I'm moving a Linux system still running on 2.2.14 (and the build scripts and such are basically untouched since 2002 or 2006 or whenever that kernel came out) forward to a Debian 10 LTS 4.19 kernel and...

gently caress everything about this lol

The build folder looks like someone vomited a bunch of bullshit scripts and archives into a single folder. Top it off with a hellish 2000+ line script that kicks it off and the nonsense in there. (Why use git branches and commits? Just comment everything out.)

I hate this job.

Mellow_ fucked around with this message at 20:07 on Aug 29, 2023

ExcessBLarg!
Sep 1, 2001

Mellow_ posted:

I'm moving a Linux system still running on 2.2.14 (and the build scripts and such are basically untouched since 2002 or 2006 or whenever that kernel came out)
Debian Potato?

Mellow_ posted:

(Why use git branches and commits? Just comment everything out.)
To be fair, that machine predates git by about five years. People didn't use rcs quite as enthusiastically.

StumblyWumbly
Sep 12, 2007

Batmanticore!
I'm just getting into Docker for building a few things and plan to dive into it more for projects with idiosyncratic build poo poo.
Will that save as much pain as it feels like it will? Or am I about to run into a wall? I can imaging there will be a ton of IDE issues, since that can't run in Docker, but I've definitely had problems where the IDE thought it was fine, but the build system was actually broken, so I assume setting up the IDE is easier.

LongSack
Jan 17, 2003

Falcon2001 posted:

Honestly I agree with this 100 percent. Especially going to a new company or coding environment it's like whoof, how the hell do I get this setup properly.

My largest struggle is always setting up Gradle for a new Kotlin project. Even copying the setup from an existing working project somehow seems to always run into some incompatibility or other.

CPColin
Sep 9, 2003

Big ol' smile.
Yeah and letting IDEA do it never seems to go quite right either

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

StumblyWumbly posted:

I'm just getting into Docker for building a few things and plan to dive into it more for projects with idiosyncratic build poo poo.
Will that save as much pain as it feels like it will? Or am I about to run into a wall? I can imaging there will be a ton of IDE issues, since that can't run in Docker, but I've definitely had problems where the IDE thought it was fine, but the build system was actually broken, so I assume setting up the IDE is easier.

Docker’s good and worth learning. I’ve never done anything complicated with it, like I think my Dockerfile is never more than like 20 lines, but it works great for my cases.

Bongo Bill
Jan 17, 2012

The problem that Docker solves is a sad one that shouldn't have existed, but it does solve it.

FlapYoJacks
Feb 12, 2009
The best use for docker is setting up development environments and creating binary matching builds.

Mellow_
Sep 13, 2010

:frog:

ExcessBLarg! posted:

To be fair, that machine predates git by about five years. People didn't use rcs quite as enthusiastically.

Unfortunately most of the commenting has occurred in the last two years :(

Also the old OS was Slackware.

Volguus
Mar 3, 2009
I did find, recently, another use for containers. I have an application (I made it) to watch IPTV . It's a desktop app. Well, my ISP got stupid and it started to throttle my streams. One solution is to use a VPN. Now, as far as I can tell I have a few solutions to that:

- Use a VPN on my computer. Ugh ... kinda not quite ideal, I would rather not if at all possible.
- Use TVHeadend in a VM, and use VPN there: done that, works, but to be fair TVHeadend is a bit annoying in its behaviour. It's hard to configure properly, I'm sure that it can do many things, but I can't be arsed to learn the ins and outs of it. Too complex for its own good.
- Use a proxy (squid let's say) in a VM and use the VPN there and point my application to go through the proxy: That could work, maybe, depending how ffmpeg's proxy support is. I haven't researched this too much
- Put my application in a container, start the VPN there, in the container and launch it like a desktop app "normally". Was a bit annoying to setup, ended up using x11docker for that, dbus passthrough seems to be a bit flaky, no idea what that thing does under the hood, but it works. For now.

So there, another use for containers.

ExcessBLarg!
Sep 1, 2001

Volguus posted:

Now, as far as I can tell I have a few solutions to that:
Perhaps a simpler solution would be to run the IPTV software as a dedicated user and then set an ip rule on the uid to use the VPN interface.

You could also create a new network namespace and use nsenter when lauching the IPTV software to place it in the new namespace. This is closer to what the container solution does.

Also the container solution is fine, but if running it fully in a container presents other problems there's a few alternatives.

Volguus
Mar 3, 2009

ExcessBLarg! posted:

Perhaps a simpler solution would be to run the IPTV software as a dedicated user and then set an ip rule on the uid to use the VPN interface.

You could also create a new network namespace and use nsenter when lauching the IPTV software to place it in the new namespace. This is closer to what the container solution does.

Also the container solution is fine, but if running it fully in a container presents other problems there's a few alternatives.

I wasn't aware of these alternatives. I'll explore them to see if they're easier/better.

Slimchandi
May 13, 2005
That finger on your temple is the barrel of my raygun

FlapYoJacks posted:

The best use for docker is setting up development environments and creating binary matching builds.

I love how easy docker makes things, but christ alive Docker Desktop hammers by 256gig SSD on my work windows laptop, constantly having to compress the file system just to get 'some' useable space.

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009

Slimchandi posted:

I love how easy docker makes things, but christ alive Docker Desktop hammers by 256gig SSD on my work windows laptop, constantly having to compress the file system just to get 'some' useable space.

Docker should never be used in anything but Linux. Put docker in WSL2.

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