is it possible to have fun programming (25)

1 Name: Anonymous Techie : 2021-04-27 09:58 ID:JBuDvhrK

i am not making anything good, as usual

i am in love with games and its...environment and making it is supposed to be my lifelong dream but it suddenly looks troublesome

2 Name: Anonymous Techie : 2021-05-05 08:33 ID:1zabstXU

Hard to do things can suddenly become fun when you git gud at it.

3 Name: Anonymous Techie : 2021-06-17 13:12 ID:3fWxxBa/

if you really like games then at least try before you give up because it LOOKS hard. ive never been into making games but thats mostly because i am bad at making things fun. i would say go for it and at least try.

4 Name: Anonymous Techie : 2021-07-02 00:47 ID:wWYGOMei

just be comfortable with ignorance and failure, and work on things you're passionate about. if you can get into the habit of regularly programming, you'll start "getting it" and it will get easier.

5 Name: Anonymous Techie : 2021-07-06 22:26 ID:R8JsK516

drink or do drugs while coding

6 Name: Anonymous Techie : 2021-07-25 05:44 ID:J+XP/MeO

Just pick a game engine and start messing with it, it's always the less troublesome way and will get you to actually making games in no time.
Always try to make mistakes early and often, that way you'll start seeing patterns and will quickly "get" how it all works.

7 Name: Anonymous Techie : 2021-09-03 02:06 ID:aUh7Jn3b

i think so. i recently started coding an imageboard just for practice and while my code is horrendous and incomplete as i'm still adding functions, it does run pretty well so far with what i've added.
it feels really good when i finally get something to work that i've been struggling with.

8 Name: Anonymous Techie : 2021-11-07 18:02 ID:q8O+5sG/

what features does it have?

9 Name: Anonymous Techie : 2021-11-21 06:11 ID:bKAVCz4L

Most of what you'd expect from one. Pages, catalog, bans, reports, image/audio/video expansion, post/file deletion, admin/mod/janitor, but it's a horrible mess. Also has textboard implementation with different theme selection from the imageboards.
It has pretty good no-JS support at least. Captcha and stylesheets work without JS, but can also use JS for better results.
If I were to continue I would probably start it from scratch to be honest because I ironically jokingly humorously pointlessly decided to make the "database" a bunch of files saved on the server. Each reply is a file in a thread folder in a board folder in the database folder. It was more of an exercise than anything serious. I did keep performance in mind for most of it though, so it generates a list of which order the threads should be in and a list of most recent replies in each thread without sorting through every single thread/reply on each page load because I decided against using templates for more no-JS functionality.
Missing some key features like an API to call post-hover from cross-thread/index page and stuff though, it would have been a much easier and quicker implementation if I just used a database query.

For the most part people should just stick to existing code anyways. They are good and if there's something they don't provide people can just fork them and add the code itself, may even get added to the main repository if it's nicely written and/or useful.

10 Name: Anonymous Techie : 2021-11-21 07:12 ID:Heaven

>Each reply is a file in a thread folder in a board folder in the database folder.

That's a pretty good approach actually, if it was one file per thread instead. And even better if it was one file per board/site without any of the new database cancer, and just kept the entire thing in memory for most of the work duration. Could use per thread compression for bonus points. Many site hosters seems to be cucked in the file department, they seem to force you to store files in a database, which I think is absurd.

It could sync memory content with a file once a hour or so.

11 Name: Anonymous Techie : 2021-11-21 09:30 ID:bKAVCz4L


>That's a pretty good approach actually, if it was one file per thread instead. And even better if it was one file per board/site without any of the new database cancer, and just kept the entire thing in memory for most of the work duration

Yes that seems to be the common flatfile implementation, but I didn't want to create one gigantic single file database.
TinyIB for example allows for both database and flatfile implementations, not sure how they do the flatfile stuff though.
With the separate files I chose if there was ever anything corrupted by a shutdown mid-process instead of the possibility of the entire file becoming fucked later I felt like a safer choice would be to separate it a bit, especially if the database were to grow huge. Main issue with separate files for each post is that you use a crapton of inodes in the long term which is bad especially for cheap shared hosting which usually caps out at 125-250k maximum (and a deleted file still counts!). I think a per thread option would be better in hindsight.

>It could sync memory content with a file once a hour or so.

This would have been a much better idea, yeah. I never considered storing things in memory most of the time lol, I like the thought of that a lot though although it definitely has some downsides like lost posts if server shuts down at an inconvenient time (1min before next backup).
My code sucks a lot to be honest, I'm sure it's filled with exploits too. I know of a couple issues that I haven't fixed and don't care too much about, like mod panel doesn't rely on a separate request token, so a third party website could send a request to the moderator panel using the admins login cookie). I also haven't added captcha to reports, but I don't think there's any incentive to attack my little practice project. All things that could be fixed relatively easily though.
One thing I do like is that the post-buttons work very well without JS. It's a bit wasteful in html data though, every option inside it is added as data in every single post as opposed to generating it with JS.

I have zero intention of ever running an imageboard (I don't want to moderate / feel responsibility over whatever, I prefer being a user on other people's boards, like this one) so don't think I'm advertising "my board" now (I don't actually want users), but you can look at some of the code here, and a demo link included for as long as I can bother to keep it online: (notable as well would be includes/functions.php and main.php)
It's so stupid and messy, haven't done anything in a while though been busy, and I have a couple other things I want to try making for practice, but definitely will use functional programming and just generally more standardization for my other ideas. Need to learn more php and js first, been on a bit of a break. Might consider learning a different language though. Something a bit more nichè could be fun, like Haskell? Not sure! Definitely need to learn more JS, most of my JS functions are pretty similarly written because I don't know much.

12 Name: Anonymous Techie : 2021-11-21 15:41 ID:Heaven

You use php, huh. You can't handle binary data in php well, so flatfile approach is probably out of the question there. In C or C++ it is relatively simple though, you allocate a large enough chunk of memory, and store everything there: posts, images, image thumbnails, arrays, vectors, structures. Writing a website in C is a bit scary though, simply because how easy it is to make a mistake that leaves your code open to all kinds of attacks. But if you do write it well, it will be very fast. Golang kind of aims to be good in the webdev area, that's a direction to consider.

The issue with having too many small files is filesystem fragmentation, on spinning media drives needle needs to move all over the place to seek for the next file, unless everything is stored in one file.

You could make "file database" more resistant to errors by having 2 files, and you take turns writing to database1.bin and database2.bin. It's better to keep post database and actual images separate, simply because all your posts may end up as heavy as a single jpg image.

I wonder where you can host your site you wrote in C. Besides your own computer, of course. I think facebook is written in C++, just like all the biggest sites are. I'd be happy to host something because I'm jobless anyway and have shitton of time, but I don't want my ip to get involved in anything, and I don't want to pay.

13 Name: Anonymous Techie : 2021-11-22 06:05 ID:Heaven

You know, imageboard software most imageboards use is such a piece of shit, your imoutoib isn't even that much worse. But making people address each other by numbers >>58349587 >>58349588 >>58349589 instead of >>921 >>922 >>923 is a crime.

14 Name: Anonymous Techie : 2021-11-22 08:57 ID:bKAVCz4L

Yeah, I picked php because it's a pretty basic way to get started with little to no knowledge, just to get a feel for some functions and see if I could at least manage to hack together some code for something that just kinda works, good or bad. Most other languages seem to have a bit more of a barrier for writing lines of code and getting it running on a server, although that might be a good thing since you'd be more committed to doing things the right way.
I will try to read a bit more up on this idea of yours in loading to memory and syncing every now and then (and probably saving a couple backups from time to time).
Probably won't do anything else with my ib code though, it's pretty much reinventing the wheel after all and so messy already, fun first exercise anyways. Will probably find a better way to do things next exercise project, probably gonna give "proper" databases a go so I can learn the basics of building and querying one at least.

I'm also jobless with a shitton of time, a complete shut-in hikikomori just doing this for fun, not like I need a job or money anyways...

I share your view, I was planning on making an option for copying Kareha's post numbering of counting up from OP as 1-san, and replies 2, 3, 4, and so on and having this as default. Didn't really get around to doing it though, a bit boring polishing something that already exists in better versions by other people (after all, why not just fork and change those?). Something more original will be more challenging to make I think, no layouts or existing solutions to rely on.

15 Name: Anonymous Techie : 2021-11-22 10:16 ID:Heaven

>I will try to read a bit more up on this idea of yours in loading to memory

Read this then
Self-Relative Pointers
data oriented programming

Sadly this is C and C++ again, I'm not sure if it is possible in PHP, golang, Java or C#. It's maybe possible to use in golang, maaaybe. I took a look at , and apparently it is possible but you will have to jump through a lot of hoops and it will be ugly and will barely work anyway, so eh.

In most high level languages (higher than C++) you can't even get a substring without allocating space for that substring and creating an independent copy of that substring, can't just reuse that memory.

16 Name: Anonymous Techie : 2021-11-27 13:43 ID:Heaven

Actually it is easier than that. If every post is just a string, merge all posts in the thread in a single string too, and keep offsets in some separate array. Like, post one goes from byte 0 to byte 264, post two goes from byte 265 to 1192, etc. The issue is I don't know how php stores strings and in what codepage. And if getting the length of string that is stored in UCS-2 is trivial (get length in bytes, divide by two), for UTF-8 you have to walk that entire string.

Aaah, fuck it, just use database. Or C/C++.

17 Name: Anonymous Techie : 2021-11-28 08:57 ID:USz7L+eF

it's all greek to me

18 Name: Anonymous Techie : 2021-11-30 06:07 ID:Heaven

Actually just use json_encode. Should be good enough, if you do it only once a hour.

I was thinking about leaving unused holes in the file, to not overwrite the entire file every time, but eh, too complicated.

19 Name: Anonymous Techie : 2021-12-02 18:58 ID:Lj681mQo

>>1 maybe try to play some zachtronics games (in particular, TIS-100, Shenzhen I/O and Exapunks). in the height of depressive work-spiral, they reminded me why I fell in love with writing code in the first place

20 Name: aaaaaaaaaaaaaaaaasdffffffffffffffffffffffffffffffffffffffffff : 2022-01-08 16:15 ID:yDDdVx3W

i liked programming when i was still learning it. Now that its my job i hate it.

21 Name: Anonymous Techie : 2022-01-09 09:21 ID:Heaven

That's usually how it goes. Learning can be fun, but when you already know pretty much everything it just becomes a tedious task. One way to make it fun again would be to have some grand vision of some insane genius idea and build some new innovative tech that could revolutionize the world, something of a passion project that aims for global adoption. A calling of some kind. Of course that would require genius tier intellect usually, but still.

22 Name: Anonymous Techie : 2023-02-19 01:58 ID:uqQlyoK3

prog is like any other creative endeavor because once you introduce money everything goes to shit

23 Name: Anonymous Techie : 2023-05-09 18:26 ID:HFGMNCJI

Try reinventing the wheel. Lots of fun to get things just the way you want them, plenty of available support, teaches you how things work, and it it's compliant with protocols you have usable software tailored to your needs by the end of it.

Shenzhen I/O is great, but it's frustrating that you aren't given all the available information to begin with (hidden commands)

24 Name: Anonymous Techie : 2023-05-15 12:37 ID:P3eyhwL8

TIS-100 comes with a manual in pdf/paper form. It's actually useful while playing the game. It's also great for immersion If you print it out.

25 Name: Anonymous Techie : 2023-05-30 00:50 ID:pEGlVN0o

this rings true to me. the philosophy keeping me going is just treating software as a tool to make something else. if I get too caught up in the details of programming, I quickly lose motivation -- just focusing on a creative project where programming is a means to reach the end goal (ex: building small robots, drone software, even modding games) has maintained my passion for it.

Name: Link:
Leave these fields empty (spam trap):
More options...