[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


Janitor applications are now being accepted. Click here to apply.


[Advertise on 4chan]


File: bang.gif (1.09 MB, 500x280)
1.09 MB
1.09 MB GIF
What are you working on, /g/?
Previous: >>106617188
>>
>>106644147
I fixed Lisp using semicolons and curly braces. It looks like a normal, decent programming language now and it's still homoiconic.
>>
>>106644154
>eons
The same would apply to a new at like method for vector
We don't use modules, from what I've tried they work pretty well in MSVC on cmake aside from intellisense errors
>>
>>106644174
Link?
>>106644185
>The same would apply to a new at like method for vector
Because it literally depends on feature that should've existed on day 0 of std::optional
>>
>>106644147
When I was a kid I would move my face away from the screen to avoid a possible explosion from MASM fatal errors.
>>
A chat platform with real-time text i.e. messages appear letter by letter. I had some /g/ people try it out quite a while ago and was sort of a hit.

In action:
https://jot.chat/+AAfyMFDevvwzwM
>>
def get_gallery(url):
html = requests.get(url, cookies=cookies)
bs = BeautifulSoup(html.text, 'lxml')

first_img_url = bs.find('a', href=re.compile('regex'))['href']
img_url = first_img_url
counter = 0

while img_url:
html = requests.get(img_url, cookies=cookies)
bs = BeautifulSoup(html.text, 'lxml')
counter += 1
get_image(img_url, counter)

next_page = bs.find('a', id='next')
if next_page and 'href' in next_page.attrs and next_page['href'] != img_url:
img_url = next_page['href']
else:
img_url = None

# have to figure out how to check for proper file extensions
def get_image(url, page_counter):
html = requests.get(url, cookies=cookies)
bs = BeautifulSoup(html.text, 'lxml')
original_img = bs.find('a', string=lambda t: t and 'Download original' in t)
if original_img:
img_response = requests.get(original_img['href'], cookies=cookies)
with open(f'{page_counter}.png', mode='wb') as file:
file.write(img_response.content)

I'm trying to write a scraper for sadpanda with about a week worth of learning to program. Besides the fact that I'm scraping porn, how fucked is it?
>>
>>106644366
Very.
>>
>>106644267
cool stuff
>>
>>106644366
You should really give up on programming if all you can use it for is scraping porn.
>>
You taunt but when all porn is banned in a few years he's going to be sitting on a gold mine.
>>
>>106644938
He'd have a bigger gem mine if he didn't do stupid shit like
>href=re.compile('regex')
>>
File: apply_padding.png (15 KB, 744x458)
15 KB
15 KB PNG
>>106644147
Making some audio-processing utilities. Right now trying to decide how big my moving window should be for estimating the instantaneous volume of an audio file.
According to https://en.wikipedia.org/wiki/VU_meter the rise and fall times there are 300 ms, so I guess I should try to make my window 300 ms -ish.
>>
With the h1b thing, assuming it sticks, would it be remotely possible for a self taught individual to get a min wage code monkey job in the future?
>>
>>106644949
What's wrong with regex? I'm using it because I can't think of what to do to match the correct link and doing it this way at least works. Maybe I can match text for "Page 1" and use parent method to get its link?
Like I said I haven't been learning long so any advice would be appreciated. Googling what is possible and reading documentations is taking most of my time but it has been fun.
>>
>>106645331
coding is a shit job. unless it pays well, it's not worth doing.
>>
>>106645885
I sort of like it though, even for free. Maybe I'd hate it if I had to do it though.
>>
File: i9oxw3du94371.jpg (411 KB, 1080x810)
411 KB
411 KB JPG
I just remembered that I can link C++ std statically to avoid a lot of bloat while still having exceptions.
>>
>>106645331
No because managers still think AI is going to fill those roles.
>>
>>106646076
AI is better at management and paperwork than it is at programming from my limited experience.
>>
>>106645581
What's wrong is that it's being compiled constantly.
>>
Does anyone here have experience with Gleam? Is it worth a try or should I learn Elixir instead? I just want to try something new and fun.

>>106644366
>1 week worth of learning
At this point the most important thing for you is that it's working.
Also be careful, the admin is a supercunt who will ban you if he sees you scraping. You should add some random sleeps between each request and spoof your user agent.

>>106645270
Wasn't the LUFS standard created just for that? IIRC the reference is 400ms windows
>>
>>106646140
Would this be better? It still works and I think it would work across all galleries
first_img_url = bs.select_one('a[href*="pattern"]')['href']

>>106646168
>You should add some random sleeps between each request and spoof your user agent.
I'll figure out how to do those. I also want to learn how to store progress somewhere so that it skips anything I've scraped in the past but that's probably a distant away.
Thb I don't think I'm going to use this to actually download anything (doesn't consoom porn that often anymore). The reason I picked this site was because a few years ago when I actually wanted to download stuff, a scraper I found didn't work and it's been in the back of my mind to do it since.
>>
>>106646277
Probably, that's why you should read documentation.
But if you use regex, precompile it globally
>>
File: volume_log_scale.png (27 KB, 1413x205)
27 KB
27 KB PNG
>>106646168
>Wasn't the LUFS standard created just for that? IIRC the reference is 400ms windows
Thanks, I hadn't heard of that. I will attempt to use it.
>>
In C++ how do you extend the namespace of a class without directly modifying the class? I'm using a library with some Objects (so I can't modify them) but I want to create the equivalent of some static functions on them so that they can be accessed with and encapsulated under Object::new_function

Equivalent of this but without the redefinition error
class Object { //<-- cannot modify this
public:
static void native_function(Object &o);
};

namespace Object { //<-- want to add this

void extended_function(Object &o);

}
>>
>>106646622
Nobody stops you from patching the library.
>>
File: screenshot.png (25 KB, 774x248)
25 KB
25 KB PNG
>>106646076
2 more weeks
>>
File: Tohru4.jpg (1.86 MB, 2531x3599)
1.86 MB
1.86 MB JPG
>>106644147
I took a break from hard problems and made a Gematria Computer for /x/. I used it to generate 60 gigabytes of Hebrew text.

https://pastebin.com/LDhtN8kf
>>
least schizo jew
>>
>>106644147
What is the state of dotnet in linux nowadays? Is it still mogged by mono; c# has been shilled to me many times and it looks great at a glance
>>
>>106646622
can't be done. also, probably shouldn't be done.
you may try to inherit from Object and add your stuff in the derived class.
any reason why you need extended_function to be in the original class' body?
>>
>>106646983
I don't need it to be in the same class's body, I just want it to be under the same namespace so that Object:: contains every function relevant to object
>>
>>106647004
there's no need for that. jamming too much into a class is bad style anyway.
https://jacobfilipp.com/DrDobbs/articles/CUJ/2000/0002/meyers/meyers.htm
>>
>>106646897
>What is the state of dotnet in linux nowadays?
Aside from proprietary debugger and switching from omnisharp to proprietary C# dev kit (please sign in with Microsoft to enjoy your VS subscription features, Saar!!) which includes AI bullshit that REALLY slows down intellisense speed and consumes a lot of memory, I'd say it can run cli programs and web servers really good. You can also use bindings for Qt and gtk if you want.
The native AOT (aka pre-jit) results in only a megabyte single executable, but has the same mem footprint as the full dotnet assembly.
>Is it still mogged by mono
Mono (for linux/mac) got incorporated into the .net clr especially the FFI mechanism and that resulted in a huge quality improvement for *nix . Mono now only exists for mobile and wasm - meaning dotnet on mobile and wasm is shit, because mono.
You probably already know they don't support linux for UI, but you can't even use it on linux to build mobile apps. If you want UI, use blazor (webshit), sir. The mobile UI support is buggy (because mono), that they officially made a blazor/xamarin hybrid where the ui is in webshit and the C# code is executed as if on 'native'.
>c# has been shilled to me many times and it looks great at a glance
I used to be a C# shill, but getting to know MS changed my view on shilling it.
>>
File: screenshot.png (53 KB, 1365x291)
53 KB
53 KB PNG
C++ super comfy.
>>
Trying to turn a single threaded project into a multithreaded one without introducing circular dependencies is a bit trickier than expected
>>
>>106647214
Use a message queue and the circle is broken.
>>
>>106646869
now make it auto parse top news articles and ads and draw all the relevant links
>>
>>106644147
>What are you working on, /g/?
im messing about with opengl in the context of vidya
i recently realized that one could make a full feature game using only the most basic graphics techniques
namely: billboarding

opengl 101 is pretty much all that is needed to make a strategy game a la dominions/conquest of elysium
one could easily vibecode the graphics engine, its that trivial ( thats what im doing rn. im learning opengl with the assistance of chud gpt, but i will turn my progress into a full fledged game at this rate)
>>
File: file.png (15 KB, 496x448)
15 KB
15 KB PNG
>>106644147
>lookup how to export a void -> int function using haskell
foreign export ccall "func" func :: IO CInt
func :: IO CInt
func = return 3

>wtf
>lookup what "return" is / how it works
>get an 18 hundred words assay on stackoverflow
Can haskell wizards here please explain this shit to a beginner better? What exactly is "return"?
>>
File: Doom maid.jpg (380 KB, 832x1216)
380 KB
380 KB JPG
>>106647253
For Gematria?
>>
>>106647341
I'm surprised you're using FFI before you understand IO, funny enough there is a joke about the huge number of monad tutorials.
Anyway to summarise it, (IO x) represents some sort of impure procedure that performs some side effects and on success produces an x. You can only build up bigger (IO x)s out of (IO x)s, you can't "get the x out" in a pure expression. Kind of like how all statements in C are inside of functions.
Return just turns a pure value into an IO procedure that produces that value.
>>
>>106647420
Yes, I want a real time translator of the secret messages they keep putting in the media.
>>
>>106647341
return was (is) a function of type (Monad m => a -> m a) that exists to put a value inside a wrapper. (\x -> Just x) is return for Maybe, and (\x -> [x]) is return for List.
It was deprecated (made redundant) by pure, in Applicative.
It does NOT do control flow.
main = f

f :: IO String
f = do
print 1
return "a"
print 2
return "b"
print 3
return "c"

Prints 1, 2, 3.
>why does it exist if pure exists
Applicative got introduced in the language after Monad.
>why is it named return if it does not do control flow
Because monads were introduced to do IO.
f = do
lines <- getLinesFromFile "foo.txt"
values <- getValuesFromLines lines
return (sum values)

And return gave the do notation imperative flavor.
>>
>>106647221
That seems to be a way. Am i supposed to hammer everything down to a tagged union to fit in a message queue whenever the problem can be expressed as a multiple producer-single consumer problem, with each message holding its own tag as well for subtypes?
>>
>>106647494
Depends on language you use.
>>
File: Tohru3.jpg (1022 KB, 2800x4000)
1022 KB
1022 KB JPG
>>106647430
For that to be viable you would need a source of Hebrew news and to study Qabalah. Also there is usually no secret messages in Hebrew news because only Jews speak the language anyways so it isn't really needed to hide anything. English news is just fake. It is more like a blunt tool for getting stupid people to believe outrageous things than anything you would put secret messages into.

That being said, if you know a Hebrew news API, I can modify Gematria Computer to change all the words into numbers via Gematria.
>>
>>106647697
there are plenty of cases of gematria codes in the English news
>>
>>106647421
I am new to haskell, not programming. I am not going through a particular order and merely translating some of my old code to haskell.
>Return just turns a pure value into an IO procedure that produces that value.
So it's a function that creates a function that returns it's argument?
-- how to do lambas without params?
return x = (?? -> x)

>>106647449
wtf so it returns a monad, why can't it just be
return :: a -> (nothing -> a)
>>
>>106647896
You don't have to write secret messages on a boxing glove.
>>
>>106648050
Me again.. It's a moan ad because it encapsulates IO.. right?
>>
>>106648050
>So it's a function that creates a function that returns it's argument?
It's a function that given an argument, gives you a procedure that returns that argument. IO is not literally a function*. You needn't be concerned with the implementation, just that it exists. As well as return, you have >>=, which lets you create a bigger procedure that runs the first procedure, determines what procedure to run based on that and gives you that combined procedure (which is what <- in do notation does)
*except as a compiler detail
>>106648073
It's a monad because it has a particular interface (monoid in the category of endofunctors), basically this just means return and >>= exist and follow certain laws. Those operations work on IO, but they're also more general.
>>
>>106648050
>>106648073
>>106648088
So basically you should see (IO x) as a black box or opaque type that represents a likely impure computation that produces x (if it doesn't fail, e.g. throwing an exception or aborting the process). A straw man implementation would be a big expression tree that represents the effects, and operations like return and >>= just build up a bigger expression tree. (In reality the compiler doesn't do this)
Here is an example for a stack DSL where the "side effects" are popping from or pushing to a stack. runStack converts the "stack procedure" type into a function from an initial stack to a final stack and a result. You could also write a function that convers (Stack x a) to an (IORef [x] -> IO a), i.e. a version that actually mutates in place given a mutable reference to a stack.
import Control.Monad

data Stack x a
= Push x (Stack x a)
| Pop (Maybe x -> Stack x a)
| Pure a

-- stack commands
push :: x -> Stack x ()
push x = Push x (Pure ())

pop :: Stack x (Maybe x)
pop = Pop Pure

-- given a stack "procedure"
runStack :: Stack x a -> [x] -> ([x], a)
runStack (Pop g) (x:xs) = runStack (g (Just x)) xs
runStack (Pop g) [] = runStack (g Nothing) []
runStack (Push x g) xs = runStack g (x:xs)
runStack (Pure a) xs = (xs, a)

-- (functor, applicative, )monad interface
instance Functor (Stack x) where
fmap = liftM
instance Applicative (Stack x) where
pure = Pure -- return is an alias for this
(<*>) = ap
instance Monad (Stack x) where
Push x e >>= f = Push x (e >>= f)
Pop g >>= f = Pop (g >=> f)
Pure x >>= f = f x
>>
>>106648206
>>106648088
I have little clue what Pure and Applicative are, but I understand from your post that return is what turned x to IO x, where IO x is the impure computation that can be exported and called later to get x.
>>
>>106648206
And here is a usage example.
>>106648254
pure is return. "return" was chosen as a mneumonic because it makes do blocks look more like C functions. Applicative and Functor are "superclasses" so to speak of Monad, you don't need to know how they work or what they offer to be able to use monads (but they are cool). If you're writing the functor/applicative instance for something that is also a monad, you can use fmap = liftM and (<*>) = ap.
Going back to IO, essentially that is the case, but you never "really call it to get x". Think about this in the same way that in C, you define functions, and you call them.. in other functions. In other words you're building up bigger functions, but you don't actually execute statements at the top level. It's like that, so someone can use your (IO x) in a bigger (IO y), which itself might be used in an even bigger (IO z) which is the entire program's main function. You define main as IO something, and when GHC compiles it, executing your function is the same as running that IO action. This is something people find hard to understand, there is no (safe) function
forall a. IO a -> a
but there ARE safe functions
IO a -> (a -> b) -> IO b
IO a -> (a -> IO b) -> IO b
IO (IO a) -> IO a
I.e. once it is in IO, it stays in IO, but you can work within that IO context without worrying about it.
>>
>>106648254
>>106648316
I meant to attach the usage example but I started writing that other reply.
-- Pop until the stack is empty, giving a list (top element first)
popAll :: Stack a [a]
popAll = do
mx <- pop -- try to get the top element
case mx of -- check if it succeeded
Nothing -> return [] -- stack is empty, return
Just x -> do -- stack has an element at the top
xs <- popAll -- recur for rest of stack
return (x : xs) -- return the element on top of the rest

-- Reverse a list by using the stack procedure
myReverse :: [a] -> [a]
myReverse as =
case runStack reverseStack as of
(as', _) -> as' -- the _ is an ()
where
-- stack procedure that reverses the stack
reverseStack :: Stack a ()
reverseStack = do
xs <- popAll -- pop everything off of the stack (top element comes first)
mapM_ push xs -- push everything back on (first element goes to bottom)

So the point here is just to demonstrate you could create your own little side effect DSL, where you have these things that are like procedures but you specify what they're able to do, and then you can execute or simulate those however you want. In the case of IO, only the runtime actually executes it (the main function which is IO something).
>>
>>106648254
The IO type instances the Monad typeclass and is therefore a monad.
Maybe instances the typeclass too, so does List.
This grants them access to do notation, which is sugared usage of (>>=), of the Monad typeclass.
f :: Maybe Int
f = do
x <- Just 4
if x < 10 then Nothing else Just (x * 20)
return x

g :: [Int]
g = do
x <- [1, 2, 3, 4, 5]
return (x * 2)


>>106648050
f :: a -> (b -> a)
is a function that takes an a, and returns a function that takes a b and returns an a.
g :: a -> b a
is a function that takes an a, and returns a value (b a). In this case b is a type function that takes a type a and yields a type (b a). For example, Maybe.
>>
>>106648577
he's probably confused because I was trying to describe it as similar to a C function
>>
>>106644147
Rewriting some tests to not use a dogshit style that hides what they're really testing.
>>
this many words words words just to have IO for your fizzbuzz
>>
>he doesn't have a paper for IO
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/mark.pdf
>>
>>106648967
My IO fits in one 4chan post, so I don't need a paper...
>>
File: gophero dockero.png (36 KB, 700x700)
36 KB
36 KB PNG
it turns out less is actually better. go is so comfy bros finally writing software instead of thinking about 100 abstractions and 1000 methods to do the same thing
>>
>>106649016
So, what did you write?
>>
did anon actually give up on haskell or is it just the usual psyops
>>
How the FUCK do I build a parallel quadtree?
>>
>>106649120
parallel in what sense? if its immutable you can access it in parallel fine. do you mean build it in parallel? (recurse on each quadrant presumably)
>>
I will not tell you what I'm working on. It is a secret. Publicly, am just learning React and making open source contributions here and there. Real basic and boring stuff to keep my public repos active, to fill up the little green squares on my GitHub while learning new skills and building credentials.

Privately, am cooking up a couple new and interesting things and don't want people stealing my ideas. Not that I can actually hide it from feds and such, but I doubt they care. Can only minimize exposure to a degree. To be honest I think there is value in keeping some code private and not showing everything off on public repos to boost credentials.

Even private companies will post all their code in public repos and then act surprised when it gets stolen. Don't need to share everything to feed the ego and look smart.
>>
>>106649212
>I will not tell you what I'm working on. It is a secret.
nothing is the greatest secret of them all, its what all masons waste their lives being fucked in the ass to discover
>>
an exam asked to use a "fixed payment arortization formula" to get the monthly payment in python code. I didn't know what it meant, so I just sat there for 70 minutes moving my cursor around. Is this built into python somehow? i am uneducated as well
>>
>>106649364
That's economics, you pay Y times over X duration for a total of T money, find out months and how much per month that is. Or numpy.pmt.
>>
>>106644147
What music do you guys listen to while programming? also, does anyone has those old "programming challenges/ideas" pictures? I remember seeing them in this board long ago.
>>
>>106649836
>What music do you guys listen to while programming?
J-core, speedcore, breakcore, MBR
>>
>>106649870
>>
>>106649875
The good thing about music is that you never know what future holds and if it sucks you can just stay with old tracks.
>>
>>106649364
You should have been able to ask the proctor what it meant?
>>
File: 1673437409905053.png (557 KB, 1920x1080)
557 KB
557 KB PNG
>>106649836
Synth or classical depending on the mood
>>
>>106649836
I go from the most brvtal black metal to the cheesiest denpa
>>
File: 1741282380290935.png (773 KB, 1280x720)
773 KB
773 KB PNG
>>106644147
What do you think about this guys?
fmtbgn(p, "$ was in the $ eating $ from his $ $(a)");
cctstr(p, "roberto");
cctstr(p, "bathroom");
cctstr(p, "shit");
cctstr(p, "ass");
fmtend(p);


It can also be written as a single line:
fmtend(cctstr(cctstr(cctstr(cctstr(fmtbgn(p, "$ was in the $ eating $ from his $ $(a)"), "roberto"), "bathroom"), "shit"), "ass"));
>>
>>106650273
awful, to be honest
just rip off Java's StringBuilder and MessageFormat
>>
>>106650313
I can't, C is a very limited language chud.
>>
>>106650323
the language, or just your skills with it?
>>
>>106650273
I don't know what your autistic mind has decided the problem with printf is, by I assure there is a less godawful way to solve it.
>>
>>106649903
Uh, is a relational database really THAT hard?
>>
>>106650733
Yeah, unless you don't mind your requests taking milliseconds instead of microseconds.
>>
>>106650451
>I don't know what your autistic mind has decided the problem with printf is
Dude printf sucks, it's error prone and not safe, and slow-
>>
>>106650970
Subtle Rust propaganda
>>
>>106650970
>it's error prone and not safe
Not with compiler warnings on
>and slow-
not in a way that matters, and I doubt that you can do better than it ayways.
>>
Where I can find good tutorial/introduction/book to windows api?
t. filtered
>>
>>106651125
I already did better than printf, but I use C++ because I'm not a babyducked luddite.
No runtime parsing or inherent allocations, prints in one syscall, supports printing custom types.
I also have specialized function for hyper fast printing when you need to print millions of things and control when the output stream is flushed, but in an explicit way and not with niggertarded "if there's \n then flush now". But let me guess, you need more...?
>>
>>106652236
>windows api
which one? the latest windows app sdk basically allows C++ to natively (no C++/CLI bs) use both win32 and uwp/winrt APIs plus the new WinUI3

find APIs for a specific task:
>https://learn.microsoft.com/en-us/windows/apps/api-reference/
>+LLMs

how to use specific APIs
>link above
>web search for the api name (blogs/SO)
>find users in other programming languages e.g. C# PInvoke / UWP
>ask LLMs
>>
>>106652518
gui. thanks anon, have a (you)
>>
Why did ebussi turn override_font("Monospace 12") into this fucking abortion?
>>
File: screenshot.png (6 KB, 516x74)
6 KB
6 KB PNG
I made C++ exceptions fast :3
>>
ive discovered that a raspberry pi can fit into a 1978 speak and spell under the board between it and the keyboard and expose its network and usb ports on its left side if i rearrange the keyboard wiring. ive already got plans for this specific one, but hypothetically, what fun things would you do with a networked usb-capable speak and spell?
>>
>>106652681
Are we supposed to maintain override_font, override_width, override_align, etc.? Such a function shouldn't have landed in the first place. We support your usecase and many others with the unified API that you showcased in your attachment.
If you feel that strongly about it, write your specialized functions and maintain them yourself.
>>
>>106652720
>maintain
why do faggots pretend this is some herculean task? the function exists. simply don't touch it, ever, and it will be maintained
>>
>>106652681
JS integration ain't free
>>
File: screenshot.png (7 KB, 698x52)
7 KB
7 KB PNG
>>106652720
>>106652737
>Don't touch.
>AI reads code and says pic related.
What do?
>>
>>106652766
tell the AI that it's getting a bit heated and you recommend it to slow down
>>
>>106652737
APIs change all the time. You think that means the API surface, but I am also talking about internals.
My perspective is that of a developer driving a large project and maintaining the public API promises. Yours is that of a consuming nocoder. We are not the same.
>>
>>106652840
>driving a large project
off a cliff?
qt is already on 6th major
gtk is on 4th, is gtk trying to be as insufferably shit as qt?
>>
>>106652966
Version numbers don't represent quality nor progress. Refer to >>106652720 if you feel that strongly about writing four LoCs instead of one. Your complaint is just bike shedding. Go do something productive with your time instead of making inane "it's over" comments about the state of software.
>>
>>106652996
Major version directly represents how shit the project is, the bigger the number, the shittier it is.
This is even true for major version 0, because 0 means that no matter how bad it is, it can be fixed.
But when it was pushed to 1, it's over, legacy bloat and "muh muh cruft of we always did it this way" is set in stone and any major "upgrade" will only be enshittification, because just like sex, first time is the best.
>>
consteval
usize
consteval_strlen(char const* ptr) noexcept
{
usize len = 0;
while (ptr[len] != 0)
{
++len;
}
return len;
}

#define CURRENT_FUNCTION str{std::source_location::current().function_name(), consteval_strlen(std::source_location::current().function_name())}

C++GODS, is there a better solution?
You can assume that
using str = std::string_view; 

technically speaking.
>>
File: avatar.jpg (54 KB, 976x850)
54 KB
54 KB JPG
>>106653049
nvm, figured it out
>>
>>106652776
Thanks anon, this actually helped.
>>
File: chat app.webm (1.49 MB, 1702x842)
1.49 MB
1.49 MB WEBM
>>106644147
>>
File: sad-pepe2.png (146 KB, 917x871)
146 KB
146 KB PNG
what is your reason for programming, bros?
Do you chase after an idea you had in your mind, no matter how stupid, or do you try to makes something with utility?
I thought I needed to write something useful; the thought of writing something, and that code never seeing use makes me sad.
But I've never actually managed to make anything and am struggling to find motivation. So I think I need to just implement some wacky idea.
>>
>>106653633
I pretty much only program because of my assburgers for a certain niche in computing that I was interested in for a long time. Frankly I find people who constantly struggle to find projects and end up putting the 1000th jeetlike thing on github thats only there to pad their resume disgusting. I don't think you should even be programming.

This is a tool, if you have no use for the tool, why are you even handling it? To show off? To play the cool programmer hackerman on 4chan? The very definition of a poser.
>>
>>106653633
>Do you chase after an idea you had in your mind, no matter how stupid
yes
>>
File: 1755645933410608.jpg (324 KB, 1000x1000)
324 KB
324 KB JPG
Redpill me on pic related
>>
>>106653738
It is a book about writing bad code with poor performance with the goal of making it more "readable" to bootcamp grads, H1Bs who lied about their credentials and other people who have no place in the industry.
>>
File: 1708457967930337.jpg (61 KB, 1014x819)
61 KB
61 KB JPG
>>106653649
mi-misunderstanding desu!!
I'm not here to p-p-pose!!
I'm looking for fulfillment in my life!

>why are you even handling it?
To do more programming things, to become more skillful, to find meaning in my life, to have fun.
To do something other than fapping, reading predictable manga, playing games that never satisfy my desires for what a game should be.
Maybe make some money so I don't have to work, but I can only see making games for that. But it is hard to get motivated to do it. Maybe not that enjoyable, especially if making art, or learning a game engine, or preparing pee-en-gees and lining things up.
You know, I didn't have to do all these things when I was making stuff in little big planet; just draw the shape and stick chips onto it ...

>certain niche
what would that be?
>>
>>106653770
dumb frogposter
>>
File: 1757622871581908.jpg (7 KB, 250x205)
7 KB
7 KB JPG
>>106653776
I'm trying to be vulnerable with you...
Why do you have to hurt my feelings like that?
You don't like froge?
Whart about bees?
>>
File: .png (29 KB, 1366x432)
29 KB
29 KB PNG
My print meme is undefeated
inline
void
print_(print_ctx_& ctx, kernel::error const& error) noexcept
{
print_(ctx, error.msg, error.len);
print_(ctx, ": ");
print_(ctx, kernel::error_name(error.err));
print_(ctx, " (");
print_(ctx, error.err);
print_(ctx, "): ");
print_(ctx, kernel::error_info(error.err));
}

no heap allocations, thread safe, only single syscall per high level print, extensible, justworks, simple as.
>>
>>106653747
Performance don't matter tho
>>
File: (You).jpg (45 KB, 449x401)
45 KB
45 KB JPG
>>106653918
Did your wife tell you that?
>>
>>106653950
No his wife did not.
>>
>>106653978
Why is his wife's bvll replying for him?
>>
>>106653987
You replied to me too.
The You is right there.
Maybe next time don't hand out your You's so easily.
Free You for me.
>>
>>106653950
Unemployed people care about performance. Professionals don't have time for something this trivial.
>>
>>106653867
its probably wasting time on duplicate work from lengths of arguments
>>
>>106654053
What do you mean by that?
All lengths are compile-time except for dynamic strings, which also have their length because I'm not cnile.
>>106654049
So true sister, professionals would never try to save 1% RAM.
>>
>>106654072
it doesnt combine the lengths there are probably some operations that would benefit from that
>>
File: screenshot.png (7 KB, 1058x134)
7 KB
7 KB PNG
>>106654090
I don't combine the strings at all, so it's a non-issue.
>>
File: 1749316053595527.png (86 KB, 1919x1028)
86 KB
86 KB PNG
thoughts so far on the UI interface?

wanted to make a file sync app that looked more modern GUI
>>
>>106654315
add drop shadows for modals. making floating elements distinct makes them more obvious to the eye and quicker and more intuitive to interact with.
>>
>>106654103
>so it's a non-issue
Without a proper buffer you will need more calls to "writev", sir.
>>
>>106654333
sorry i thought this was /wdg/
>>
>>106654393
So can you show me where are those "more" calls hidden in my strace?
>>
>>106654333
damn shadows is the one of the things QT bascically can't do with widgets unless I use QML
>>
>>106654407
you could do thicker borders and change the color palettes of windows then. typically lighter colors command more attention, so lowering the gamma of the background could work. or whatever the QT eqivalent is. you might want palettes for windows?
>>
Not using standard library allows better interfaces.
constexpr u8 ip[4] = {127, 0, 0, 1};
constexpr u16 port = 80;

int
main()
{
try
{
net::tcp master{};
io::info("Connecting to ", ip, ":", port, " ...");
master.connect(ip, port);
}
catch (kernel::error const& err)
{
io::fatal(err);
return kernel::failure;
}

return kernel::success;
}

>inb4 muh muh what if I need ipv6
then you're indian
>>
File: SCR.png (62 KB, 481x641)
62 KB
62 KB PNG
>>106644147
I programmed javascript code to reveal names by post number
>>
>>106654910
How come I have 2 different names?
>>
https://lo.calho.st/posts/black-magic-buffer/

just found out about this, refactoring with drastically simpler logic in my container
>>
File: 1748564306778258.png (15 KB, 644x800)
15 KB
15 KB PNG
>>106655057
>black magic
>>
>>106655083
We conjure the spirits of the computer with our spells.
>>
>>106655057
>>106655083
>>106655112
here's non-reddit version: https://web.archive.org/web/20100706051254/http://libh.slashusr.org/source/vrb/src/lib/h/vrb_init.c
>>
>>106644147
I can't the find the talk where a bald-ish guy was bruteforcing the cpu to find special instructions and discovered a way to enable debug mode which has a special instruct set.. I might have jumbled two talks at once, but I am sure they are by the same guy. Anyone here knows what I am referring to?
>>
>>106646874
Why does everyone on 4Chan hate Jews?
>>
I simply have to get a new file browser since none of the existing one's have simply things like per folder sorting or custom sorting options. I wonder if I should hack an existing one or build a new one from the ground up?
>>
>>106654766
Now that's something actually useful. I would love to see your library progress and get some traction. The C++ STD is a cancer generating machine and must be destroyed.
>>106655377
109 countries and you complain about 4chan. fuck off to your echo chamber.
>>
>>106655377
It's a forced meme. Nobody actually cares about jews.
>>106655434
What's the fucking usecase? Just sort it when you need it.
>>
>>106655444
>I would love to see your library progress and get some traction.
It's not a library, it's a message. Libraries are the cancer that kills innovation.
I literally will not generalize. If I make two distinct projects this way, their bases will likely diverge.
>>
Writing a web server in C to hone my low level skills. Never really used C outside of uni, only some small programs, projects and stuff.
>>
>>106655497
I hope you're using io_uring
>>
>>106655512
I went for epoll, still very early, should I make the switch?
>>
File: IQ.jpg (166 KB, 675x499)
166 KB
166 KB JPG
Generalization is a waste of time.
namespace local
{

constexpr u8 ip[4] = {127, 0, 0, 1};
constexpr u16 port = 1337;

void
main()
{
net::tcp client{};
io::info("Connecting to ", ip, ":", port, " ...");
client.connect(ip, port);

#define GET_TORRENTS_INFO "GET /api/v2/torrents/info HTTP/1.1"
io::info(GET_TORRENTS_INFO);
io::print
(
client,
GET_TORRENTS_INFO "\r\n"
"Host: ", ip, ":", port, "\r\n"
"Connection: close\r\n"
"\r\n"
);
}

}

int
main() noexcept
{
try
{
local::main();
}
catch (kernel::error const& err)
{
io::fatal(err);
return kernel::failure;
}

return kernel::success;
}

I have so little to work with, and I'm already sending HTTP requests to my qbittorrent webui, because I want to automate some things.
>>
sepplestards really jerk themselves off over sending an http request?
>>
I don't get why programming attracts the tryharding types so much, I have seen so many meaningless competitions and ego farming
>>
>>106655816
the maladjusted asocial people who spend all day on their computer to programmer pipeline is well established
>>
>>106644366
next time don't mention porn, so you can actually get some useful replies.
>>
File: 1749854761288445.jpg (167 KB, 1176x1172)
167 KB
167 KB JPG
f(print("1"), print("2"))

I'm happy we all agree this could print either 12 or 21
>>
is it actually possible to code in binary? 1 and 0s for the most fastest program ever?
>>
>>106652251
>I already did better than printf, but I use C++
congratulations, you completely missed the point
>>
>>106655993
All information can be expressed in 1s and 0s.
Your post can be expressed in binary
The slowest program can be expressed in binary

So just because you would write it in binary doesn't make it fast
>>
>>106653738
it's how you reintroduce common sense into an enterprise codebase
"this well selling book says so" is a more convincing justification than "it'll just be better that way because i say so" when you need to push down feature requests in favor of refactoring tasks

not very useful for students, NEETs or nocoders, though
>>
>>106655953
erm, actually, I've written f() to clear the terminal and so it prints nothing.
>>
File: proxy-image.jpg (18 KB, 474x316)
18 KB
18 KB JPG
>>106655993
Yes, people entered programs in binary on machines like these (and today you'd use a hex editor), it doesn't make the program faster or slower thoughever
>>
>>106656038
No, I did not, dilate, troon.
>nocoders seething about someone getting shit done
Thank you for validation, I know that I'm doing something right.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.