Technology & Programming @ 4-ch

Technology & Programming @ 4-ch

Technology, computers and gadgets are the point of discussion.
  • Do you have a small issue or question? Then post it in the Single questions & Help thread instead of making a new thread, otherwise it might get deleted.
  • Don't forget to provide a link (if applicable) to any relative articles.
  • Keep discussion of programming and code over at the Programming discussion board.
Rules · 規則
Board look: Amber Blue Moon Buun Channel4 Futaba Headline Mercury Mittens Pseud0ch Tanasinn Toothpaste

is it possible to have fun programming (19)

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

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).

Post too long. Click to view the whole post or the thread page.

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
Name: Link:
Leave these fields empty (spam trap):
More options...

Javascript and webdev (4)

1 Name: Anonymous Techie : 2021-11-18 16:58 ID:Heaven

I heard it's called "frontend". As opposed to "backend", everything that happens on the server side. But feel free to discuss both.

2 Name: Anonymous Techie : 2021-11-18 17:00 ID:Heaven

>null == undefined


>null === undefined


3 Name: Anonymous Techie : 2021-11-26 08:34 ID:Heaven

Apparently javascript is case sensitive. Don't go calling "Alert" when you need "alert".

4 Name: Anonymous Techie : 2021-11-30 12:45 ID:F5uejfZc

I think it would be difficult to find a language that is case insensitive for function names, SQL perhaps.

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

CSS (6)

1 Name: Anonymous Techie : 2021-11-13 19:17 ID:Heaven

Cascading Style Sheets, the language you use to specify the look of webpages. There should be useful links here, but maybe some other guy will provide them.

2 Name: Anonymous Techie : 2021-11-13 19:22 ID:Heaven

Question, how can I stop links from being wordwrapped? I have this thing:


And each is a link. They wrap like this:


But I want them to wrap like this:


Post too long. Click to view the whole post or the thread page.

4 Name: Anonymous Techie : 2021-11-16 18:47 ID:Heaven


5 Name: Anonymous Techie : 2021-11-19 16:39 ID:Heaven

Putting <wbr> or zero-width space (u+200b) between each link worked, thanks to the /general/ guy.

var space = document.createTextNode("\u200B")
var space = document.createElement("wbr")

6 Name: Anonymous Techie : 2021-11-26 11:15 ID:Heaven

How to make userstyles, they allow you to rewrite css on any page of your choice. It used to be a different extension before, before firefox killed all of its extensions for stupid reasons like all the money they were getting from google, so now everyone uses those.

>Forum has Closed, last admin login was 2 years ago
Name: Link:
Leave these fields empty (spam trap):
More options...

Version Control Systems (git, svn, hg) (7)

1 Name: Anonymous Techie : 2021-11-10 18:37 ID:Heaven

They exist. Let's talk about them, learn them, and maybe even use them.

2 Name: Anonymous Techie : 2021-11-10 18:49 ID:IO6p0omx

Fossil is obviously the best.

THEY don't want you to know about Fossil.

3 Name: Anonymous Techie : 2021-11-10 20:09 ID:Heaven

Interesting. So,
1 developer - svn or just folders,
4-8 developers - fossil or svn
100-200 developers - git or hg

4 Name: Anonymous Techie : 2021-11-11 07:47 ID:Heaven

SSL certificate problem: certificate has expired
Something something Let's Encrypt changed something one month ago.

5 Name: Anonymous Techie : 2021-11-11 18:18 ID:MzpxJcQp

svn's branching kinda sucks compared to git
only used git and svn, haven't bothered with others
the thing I'm more interested about is trying out commit git patches via email as oppose to github, gitlab, etc... merge-request stuff. it was the intended way to use git anyway according to Linus and still how it was used in Linux git repos (no surprise). sourcehut does it that way also

6 Name: Anonymous Techie : 2021-11-11 20:07 ID:Heaven

I wanted to find how to create patch files on windows, and apparently git is the best way there is. Before that I tried to use , but it seems to have some S_ISREG related bug, and I'm too dumb to recompile it myself. Build systems are the worst part of C. I now wonder if it would've worked if I simply renamed patch.exe into ptch.exe, there is some fuckery on windows related to this.

I installed, and apparently that didn't install git itself for me, and redirected me to . Probably should've gone for the latter link first.

7 Name: Anonymous Techie : 2021-11-12 08:59 ID:Heaven

============Look how unxutils patch looks============

diff -ruN --exclude=bin --exclude=obj --exclude=.vs EmuEra-original\Emuera\Emuera.csproj EmuEra-rikaichan\Emuera\Emuera.csproj
--- EmuEra-original\Emuera\Emuera.csproj Mon May 24 19:22:27 2021
+++ EmuEra-rikaichan\Emuera\Emuera.csproj Sun Jul 18 16:27:26 2021
@@ -9,7 +9,7 @@

============And look at how git patch looks============

From 91be5519ebb92cda3ebe866ac9fac6ea8c29fce2 Mon Sep 17 00:00:00 2001
From: doesitmatter <doesitmatter>
Date: Fri, 12 Nov 2021 11:04:11 +0400
Subject: [PATCH] Rikaichan


Post too long. Click to view the whole post or the thread page.
Name: Link:
Leave these fields empty (spam trap):
More options...

Let's learn winapi (6)

1 Name: Anonymous Techie : 2021-11-08 17:25 ID:AiFW8qT6

Learning ancient api sounds quite fitting for people who use ancient sites, don't you think?

msdn library

Visual Studio 2005 has a more complete offline winapi documentation that goes back to windows 95, first link here only goes back to windows 2000.

2 Name: Anonymous Techie : 2021-11-08 17:28 ID:Heaven

I'm surprised that NTFS has a built in compression.
LZOpenFile, LZCopy, and LZClose

3 Name: Anonymous Techie : 2021-11-09 07:45 ID:Heaven

Learned that there are very similar functions in winapi, SetWindowLong and SetWindowLongPtr. SetWindowLong is the older one, but it works only with long (32-bit) numbers, and SetWindowLongPtr works with 32-bit numbers on 32-bit systems and 64-bit numbers on 64-bit systems. Actually, header looks something like that:

#ifdef _WIN64
#define SetWindowLongPtrA SetWindowLongA
#define SetWindowLongPtrW SetWindowLongW

and it is literally an alias on 32bit computers.

I fear that this function alone may cause my program to not work correctly, if I run 32-bit program on 64-bit computer. I have code like this

Post too long. Click to view the whole post or the thread page.

4 Name: Anonymous Techie : 2021-11-24 18:44 ID:Heaven

The edit control in winapi is kind of weird, pressing ctrl-backspace in it results in an empty box appearing in the window (instead of the last word being deleted as I was expecting), and the message WM_CHAR with wParam==VK_F16(0x7f) being sent. You can see this behavior even in the default windows file explorer, when you rename a file, and in various other random places.

This is actually fixable though, again with SetWindowLongPtr GWLP_WNDPROC. And .NET edit control seems to work with ctrl-backspace well out of the box. I plan on getting rid of that control in my program and processing all WM_CHAR and WM_IME_* messages manually, I suspect it will be cleaner in the end.

5 Name: Anonymous Techie : 2021-11-24 21:39 ID:Heaven

edit control wm_settext set cursor position

>If there is no selection, the starting and ending values are both the position of the caret.

SendMessage(hEdit, WM_SETTEXT, (WPARAM)0, (LPARAM)edit_text);
if (edit_text_len != 0) {
SendMessage(hEdit, EM_SETSEL, (WPARAM)edit_text_len, (LPARAM)edit_text_len);

6 Name: Anonymous Techie : 2021-11-27 19:34 ID:Heaven

DirectX 9 SDK
Not quite winapi, but close.

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

Thoughts on Finishing Shiichan? (4)

1 Name: Anonymous Techie : 2021-11-03 20:37 ID:orq8G9iC

I am an average PHP programmer with a lot of free time. I am thinking about downloading the original Shiichan source code to update and standardize it so it is easier to actually use on a server. Has anything like this been done sucessfully and is there any interest in doing it in the first place?

2 Name: Anonymous Techie : 2021-11-04 19:34 ID:Heaven

Tell me more about Shiichan, what kind of software is it? Not a bad idea, but I'd personally rather not do things that don't bring me any money whatsoever.

3 Name: Anonymous Techie : 2021-11-07 17:21 ID:fEnARiop


You weren't around for world4ch ( were you eh? I'm not sure about the Shiichan vs Kareha timeline, but Kareha is a much much better implementation of the same concept. I want to say that may be closer to -- it has a paginated thread list -- but it has nice features that neither kareha nor shiichan has, like backlinking and an API.

4 Name: Anonymous Techie : 2021-11-26 08:57 ID:Heaven

I'm not using google, it's evil. Everything too centralized is evil.

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

[CHAT] Fuck Discord! Matrix FTW! (5)

1 Name: Anonymous Techie : 2021-09-24 07:17 ID:bSKKF4mb

IRC is cool and all but it's 2021. Fork in the road:
Discord OR Matrix.

We currently don't have a proper Matrix server of our own yet, but that doesn't matter because you can just join whatever server you want and then connect to channels, or make channels to share with others. Matrix is like IRC -- channel based, channels are atoms, the admin "owns" their own channel to some degree -- users are free to create new channels, and unlike IRC, permissions management is simple AND real end-to-end encryption is possible.

Unlike Discord, where the "channel group" is created first and then contains its exclusive channels within it (with a shared power structure), Matrix users can also freely create "channel groups" for relevant channels, for private use or social use, to help organize similar channels by concept or intention. This radical inversion of the paradigm is naturally more in line with VIP values and return a more natural, bottom-up sense of vision to this space that corporate entities seek to seize and exploit to maladaptive ends.

Post too long. Click to view the whole post or the thread page.

2 Name: Anonymous Techie : 2021-10-18 15:32 ID:Heaven

Matrix is laggy as hell, websites work well enough for me. If matrix server has many images, they take forever to load.

3 Name: Anonymous Techie : 2021-10-21 20:20 ID:dSofovNq

Matrix isn't meant to replace websites, it's meant to replace Discord, IRCcloud, Slack, etc.

4 Name: Anonymous Techie : 2021-11-06 14:24 ID:zfLNHxHN

Fuck off, IRC is still the best mass communications medium. Jabber is second to it. If you want encryption use Jabber with PGP or PGP encrypted emails. Matrix and Discord suck equally.

5 Name: Anonymous Techie : 2021-11-07 17:12 ID:yn1YbQw4

There are like 3 active users of #4-ch IRC and easily 10 or 15 VIPPER on the VIPPER Matrix. What is IRC "best for"? Clearly, it's not best for our community; Discord has even more people. Even if IRC is best, it's clear that's not where people are going. Better off on Matrix than Discord though.

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

Comfy 4-ch RSS ? OPML! (3)

1 Name: Anonymous Techie : 2021-11-04 18:51 ID:CyTq1+KR

anon-kun ٩(。•́‿•̀。)۶

2 Name: Anonymous Techie : 2021-11-04 19:05 ID:CyTq1+KR

3 Name: Anonymous Techie : 2021-11-10 18:50 ID:Heaven


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

When did you realize that the future is now (9)

1 Name: Anonymous Techie : 2021-04-27 22:39 ID:sPEPe7vz

For me it was a slow gradual shift that began around 2012 when Palmer started the Oculus Kickstarter and today I just now realized that I am officially living in the future

Video related is proof of this
That would have seemed absolutely sci-fi just 10 - 15 years ago.
To create that video you would have needed a ton of money and a sophisticated Hollywood team but now I can create it just goofing around in my room while drunk.

2 Name: : 2021-04-30 08:12 ID:6E8b36j+

Was it made with Free Software?

3 Name: Anonymous Techie : 2021-04-30 15:33 ID:/07PNPes

   ('-' ) pls kill me
i can not walk away
from these feelings

4 Name: Anonymous Techie : 2021-05-02 21:25 ID:hVHoaoNX

I will feel like I am living in the future when they find a reliable cure for cancer. Or when they make a robot girlfriend with a human personality and realistic boobs. Whichever comes first

5 Name: Anonymous Techie : 2021-05-04 06:57 ID:eXCg91gk

the future is now (;´v`)

6 Name: Anonymous Techie : 2021-05-05 01:42 ID:BzN4lPe0

young mawn

7 Name: Anonymous Techie : 2021-09-10 16:04 ID:Heaven

the future has been now for over a decade

8 Name: Anonymous Techie : 2021-09-29 23:27 ID:nGXftQ2j

the future has been now for over a century

9 Name: Anonymous Techie : 2021-11-01 14:26 ID:ocKld+/T

we are living in the past

>>30 what is the future like?

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

I met Stallman on my vacation in Los Angeles (12)

1 Name: #!/usr/bin/anonymous : 2020-01-25 04:01 ID:RI5se2tf This thread was merged from the former /code/ board. You can view the archive here.

>I saw RMS in a store in Los Angeles during my vacation

>I told him how great it was to meet him in person
>but I didn't want to bother him and ask him for a picture
>"I'd just like to interject for a moment"
>that took me by surprise and I could only say "huh?"
>that's when I realized he wasn't buying
>he was camping and had his sleeping bag in a corner
>"I'd just like to interject for a moment"
>he had recently woken up and was looking for water to wash his beard with
>"I'd just like to interject for a moment"
>followed him to his sleeping bag where he pulled a needle from his hobo bag
>"I'd just like to interject for a moment"
>I asked him if it's true that he's a pedophile and that Epstein financed him
Post too long. Click to view the whole post or the thread page.

3 Name: #!/usr/bin/anonymous : 2020-05-02 03:22 ID:s1EGrfKj

what the actual fuck

4 Name: #!/usr/bin/anonymous : 2020-06-25 07:06 ID:fVSKLZW8

what the imaginary fuck

5 Name: #!/usr/bin/anonymous : 2020-07-26 12:42 ID:Heaven

proprietary software is heinously anus

6 Name: Anonymous Techie : 2021-04-06 08:56 ID:sxdmApQx

proprietary software makes frogs gay

7 Name: Anonymous Techie : 2021-04-27 10:21 ID:EU2W3emk

>>6 if you cucks cant draw just burn first

8 Name: Anonymous Techie : 2021-04-27 13:01 ID:Q3KJKCOt

wish you all never existed

wish i never existed

9 Name: Anonymous Techie : 2021-07-17 17:45 ID:I7NN+oyo


10 Name: Anonymous Techie : 2021-09-05 22:46 ID:VrvdCFDd

I'd just like to interject for a moment

11 Name: Anonymous Techie : 2021-09-10 14:39 ID:WcBYKfIE

>followed him to his sleeping bag where he pulled a needle from his hobo bag
>I'd just like to inject for a moment

12 Name: Anonymous Techie : 2021-09-28 05:28 ID:NyKq71en

What a hero he is!

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

New thread

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