[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 / qa] [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]


[Advertise on 4chan]


File: FROG_GLOCK.jpg (751 KB, 2048x2048)
751 KB
751 KB JPG
What are you working on, /g/?
>>
Trying to port linux on a noname android tv box. Does writing dts files count as programming?
>>
>>101560108
it is 'coding', somewhat close
>>
File: 1717997084583835.jpg (171 KB, 1024x1024)
171 KB
171 KB JPG
>>101560081
What's the best way to develop and distribute an app for linux distros?
>>
Fuck I'm going to learn all this stuff and never be able to get a job.
>>
how do i escape tutorial hell?
feels like i'm not really learning anything new but anything i actually want to do seems overwhelming
>>
>>101560641
I was like you back when i started my learning journey, the answer is literally the boomer answer, start a project and apply what you've learned
>>
File: rust_everywhere.jpg (662 KB, 2118x1440)
662 KB
662 KB JPG
>>101560081
Why doesn't Rust has a random number generator?
>>
>>101560081
Your mom
>>
>>101560797
randomness is a side effect
>>
>>101560338
The trick is to not distribute your program at all, and just make it so it's easy to build, and that'll trick people into distributing it for you. Most of that can be done by not using a shit build system and not circumvent the defaults by doing weird shit.
Maybe write an AUR package if you really don't want to do nothing.

All of that containerisation crap is the distributor's problem. Never write your program/build definition to only work in a container or even be aware of containers.
>>
>>101560641
Read a book and then do things and then read another book and repeat
The key part about books is that unlike "tutorial hell' there is no "escaping" "book hell", you just keep reading and learning more
>>
>>101560797
Rust somehow has a bloated but barren standard library at the same time.
>>
>>101560641
As unhelpful as it sounds, try write an actual program.
It'll be shit and nobody but you will use it, and it might not even do anything useful, but that's how you actually get experience.
>>
>>101560934
at a certain point it becomes about "how things are done" and not "what things are done". Give me s number above 10, you chose 125, i chose 26, tough luck kind of deal.
Gotta get into maths
>>
>>101561010
Get a book on math
>>
didn't get a response in /agdg/
I have the code for my basic gameplay down, and now I want to add a bunch of modifiers. Maybe in one level the controls are reversed, or maybe in another level you have infinite ammo, or whatever. How would I code something like that? I don't want to use a whole bunch of if statements, because that would get ugly really fast. I was thinking of using a finite state machine, but I figured there's probably an even better way that I haven't thought of yet.
>>
>>101561245
>directions modifier = 1
>directions modifier= -1
(equation_1)*its_direction_modifier
and make it a macro "dirfix()" or whatever

like literally just add data to the logic
>>
>>101561245
What game engine do you use?
In C# you would simply create a public static class PublicStaticClass in a dedicated script with a bunch of public static variables in it, and then add "using PublicStaticClass" at the start of every subsequent script that uses any of these variables. This would avoid having to write PublicStaticClass.goForwardKey and simply write goForwardKey.
>>
>>101561408
>add "using PublicStaticClass"
Mb, you'd need to add "using static PublicStaticClass" instead.
>>
>>101561408
>What game engine do you use?
my own lol
>>
>>101561427
In what language?
>>
>>101561449
C++
>>
checked

c++ is the ehite man's lang
>>
File: LinuxPepe.jpg (38 KB, 385x390)
38 KB
38 KB JPG
>>101561465
Well, no luck, there are no static classes in C#.
>>
>>101561479
*in C++
>>
>what is a namespace
>>
>>101560338
if minimize dependencies by only depending on "core" libraries and static link as much as possible there is no need for packaging/container
my gui programs only depend on libc and libx11/libwayland, which exist on any linux desktop setup so i just distribute them as a single binary and it just works everywhere
>>
>>101561534
>moron thinks he can declare variables directly in a namespace
>>
In vim is there a way to define a "dead key" or a "leader key" that activates when in insert mode? I have a non-programmable keyboard and need to be able to type in Icelandic. For example, if I want to type þ my thought is I could do leader+p and have vim translate that on the fly into þ. Is this possible? Ideally I wouldn't leave insert mode to do this.
>>
>>101560338
Java, sar.
https://jakewharton.com/using-jlink-to-cross-compile-minimal-jres/
>>
>>101561581
you can tho
>>
Emacs text adventure.
Sent from my Android.
>>
>>101561705
In my config I tried

let mapleader=","
nnoremap <leader>p "þ"


but this doesn't seem to do anything. I've used vim for a long time but have literally never configured anything so I'm very lost. The defaults have always been sufficient until now.
>>
>>101561705
this is dpt, you want sqt
anyways, you can make insert mode maps with imap, or you can use digraphs which are the builti solution for this.
>>
>>101561245
In my game dev experience. I used an input event class which returned things like cursor_event with a position vector, or arrow_key_event. A list of events was consumed during each update call. The effect of the events was then sent to the appropriate game component. Which involved a lot of if statements. But that's they way I like it. Using the above method in your case would involve multiple input modes so the input mode determines how the events are handled.
>>
What the fuck are these async await keywords for? Did Guido left because he could not defend this shit anymore? I was looking at all the major python networking libraries for asyncio, and not only are they few and far between, but their GitHub issues are full of stupid shit sitting there for years with almost no response and multiple unanswered pull requests. Who the fuck is using this when gevent exists? Who is pushing for it? The javascript "developer" cult? The US government?
>>
>>101562087
Javascript popular therefore the words stay.
>>
>>101562087
There are TWO asyncio HTTP client libraries - aiohttp and httpx. The first one had its core maintainer fuck off two years ago to develop some Ukrainian AI scam (he is also the core developer behind asyncio, unsurprisingly). It is at major version 3, approaching 4, and it has been broken for 5 years now (https://github.com/aio-libs/aiobotocore/issues/738). The other one, httpx, is made by retarded monkeys that managed to make it 10 times as slow when using SSL. But it is pushed by the grand hoax funded by big corpos, FastAPI, so i guess it will get patched in the next decade.
The only real redis client library has been DOUBLED in size to support asyncio, and is nothing but duplicate code with the new stupid keywords.
>>
>>101561858
haha lol
>>
>> g++ -o main main.cpp -std=c++17
>Executed in 928.07 millis
>> g++ -o main main.cpp -std=c++20
>Executed in 3.55 secs
why?
>>
File: beck.webm (1.03 MB, 1280x720)
1.03 MB
1.03 MB WEBM
making very good progress on my Clojure/Lisp editor even though I can't spend much time working on it. It's like Lisp and the web were made for each other.

>>101561858
I recommend using emacs via Termux instead
>>
>>101561245
>Maybe in one level the controls are reversed, or maybe in another level you have infinite ammo, or whatever. How would I code something like that?
Factor out aspects that can dynamically change into their own functions/components/systems so you could simply swap them out when you need to.
>>
>>101560641
>how do i escape tutorial hell?
Someone post that huge project list pic for this guy, I don't have it...
>>
Just use gtk2?

Since gnome devs are doing everything they can to destroy gtk should I just use gtk2?
>>
>>101563670
The gnome in the compiler faltered.
>>
>>101560081
Who has drawn this?
>>
File: 1675956772757.png (2.11 MB, 1200x1697)
2.11 MB
2.11 MB PNG
>>101560081
Debugging the VCS implementation for Kurumi MaidCard III. Everything seems to work except merging two branches which crashes Kurumi and garbles my history data. Once merge behaves the VCS part is done.
>>
>>101563773
Nigguh, you for real? Press the 3 dots and search the image.
>>
>>101560338
Like the other anon said, don't make packages for every distro (and architecture) out there, it's futile

Personally I use Appimage and Flatpak a lot. They'll run on almost any distro. Not sure about Appimage but Flatpak deployment isn't that difficult to setup.
>>
>>101563773
bubbacterial on the booru, i like his shit a lot
>>
>>101560081
i have now gotten past the brainwashing and fearmongering and fully understood the nook and crannies of acpi, now for some reason i dont feel like implementing it fully even though it shouldnt be that hard because the only thing i need from aml is a shutdown function which in qemu is just writing to a defined port, i am just gonna get shit running in an emulator and worry about bare hardware later i guess
>>
>>101561874
Three things:
1. Using `let` without a namespace puts you in the local one (l:), when you actually want g:
2. That's a normal mode map, not an insert mode map
3. The RHS of *(nore)map commands shouldn't be quoted. It's a sequence of keys, potentially in <> notation.

let g:mapleader=","
inoremap <leader>p þ

Works on my machine
>>
File: 1668082012599364.jpg (18 KB, 384x404)
18 KB
18 KB JPG
I'm fucking around with writing a GUI library from scratch (very early on so far), and I'm thinking about how I'm going to do layouts.
I don't really know shit about web development, but I've heard about flexboxes, and I was wondering if I should base my thing on the general idea.
Is there anything I might be missing as to why this might be shit for traditional desktop-style stuff?
>>
Am I the only one who always sees "NIGGER" whenever "INTEGER" is written in code? It always makes my heart skip a beat because if I see it out of the corner of my eye it makes me think I forgot to do a "grep nigger" check before committing something into source control and now I'll be in trouble. It's not usually a word that you see written all the way out but there's the one serialization library we're using now that has INTEGER in all caps as an identifier and it's throwing me off. Ends in GER, contains all the right letters, and has "NEGER" if you skip over some letters.
>>
>>101564608
Implement a general constraint solver.
>>
>>101564650
I was googling "gui layout algorithms", and while it may not be fully general, it may end up coming to that. That's where I got the flexbox idea from.
>>
>>101564692
Flexbox is cancer and makes me want to kill myself. What I'm saying is that you should implement a system that lets the user define constraints on GUI element parameters like size and position and have a constraint solver do its best at satisfying them. Then anyone who cares can easily make his own flexbox.
>>
leetcode is driving me to suicide
an hour and a half on this bullshit, and I still feel confused by binary search. 40 minutes just to make my sorted array from the tree.

It's this problem if anyone wants to flex on me
https://leetcode.com/problems/closest-nodes-queries-in-a-binary-search-tree/

Full code here
https://ctxt.io/2/AACYZ_wDEQ

public class Solution {
public IList<IList<int>> ClosestNodes(TreeNode root, IList<int> queries) {

// Convert tree to sorted array
// Do a DFS on the array to get it already sorted.
var list = MakeSortedList(root);

var ans = new List<IList<int>>();
foreach (var n in queries)
{
var insertionPoint = BinarySearch(n, list);
var answer = MakeAnswerList(insertionPoint, n, list);
ans.Add(answer);
}

return ans;
}

public List<int> MakeAnswerList(int insertionPoint, int n, List<int> list)
{
var answer = new List<int>();
if (insertionPoint >= 0 && insertionPoint < list.Count)
{
// SNIP, TOO FAT
return answer;
}

public int BinarySearch(int target, IList<int> arr)
{
var left = 0;
var right = arr.Count - 1;
while (left <= right)
{
var mid = left + (right - left) / 2;
if (arr[mid] == target) return mid;
if (arr[mid] > target) right = mid - 1;
else left = mid + 1;
}

return left;
}

public List<int> MakeSortedList(TreeNode root)
{
var sortedArr = new List<int>();
Dfs(root, sortedArr);
return sortedArr;
}

public void Dfs(TreeNode root, IList<int> result)
{
if (root == null) return;
var left = root.left;
if (left != null) Dfs(left, result);
result.Add(root.val);
var right = root.right;
if (right != null) Dfs(right, result);
}
}
>>
>>101564776
>It's this problem if anyone wants to flex on me
I don't want to flex on you because you understand that you are retarded, and you are reasonably humble. What you should do is delete this post and try again: post a horrible, broken solution and assert that no one can do better because /g/ is a bunch of nocoders.
>>
>>101564711
It's less about the specifics of what flexbox actually are (I don't even know them), and more just specifying some basic things like {min,preferred,max} size, and shuffling shit around, rather than the somewhat strict tree system that other GUI libraries I've seen use.
>>
Is it considered bad practice to use an AI code assistant while learning how to program? I don't use it to complete projects for me, I usually use it as a reference.
>>
>>101564899
Why don't you just use an actual reference?
>>
>>101564899
>Is it considered bad practice to use an AI code assistant while learning how to program?
Extremely bad practice. What you're teaching yourself is how to be dependent on it.
>>
>>101564617
Same, but every time I see the word INTEGER I remember The International Jew in its entirety.
>>
>>101564856
>and more just specifying some basic things like {min,preferred,max} size, and shuffling shit around
each widget just needs to implement a function to calculate its size based on the constraint specified by its parent widget which is determines the layout
the layout can be completely arbitrary as long as it is specified as constraints that children can use
>>
>>101564907
I'm studying C++ so I use cppreference, but I'm a bit of a brainlet and C++ is a big language, so I sometimes need things explained in retardspeak and AI does that pretty well imo

>>101564908
I don't use it to program for me, I mostly use it as a reference and as a way to generate project ideas. Though I am worried that I'll be too dependent on it. Should I just stick to StackOverflow?
>>
>>101560081
>triple nested loop
UNIX is better than any other system ever invented, brainlets like handles because they cant comprehend the alternatives
>>
>>101565299
UNIXes didn't have acceptable multithreading and asynchronous file IO until recently. Tremendous!
>>
>>101560641
It tickles me that this question still gets asked.
>>
>>101564776
I don't know Microsoft Java, so here is Oracle java instead.
import java.util.List;
import java.util.Arrays;
import java.util.OptionalInt;
import java.util.stream.Collectors;

public class Solution {
/* All of the boilerplate that would've been on leetcode's side */

static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode() {}
TreeNode(int val) { this.val = val; }
TreeNode(int val, TreeNode left, TreeNode right) {
this.val = val;
this.left = left;
this.right = right;
}
}

public static void main(String args[]) {
var tree1 =
new TreeNode(6,
new TreeNode(2,
new TreeNode(1),
new TreeNode(4)
),
new TreeNode(13,
new TreeNode(9),
new TreeNode(15,
new TreeNode(14),
null
)
)
);
var query1 = Arrays.asList(2, 5, 16);

printResult(closestNodes(tree1, query1));
}

public static void printResult(List<List<Integer>> result) {
System.out.println("[" + result
.stream()
.map(r -> "[" + r
.stream()
.map(Object::toString)
.collect(Collectors.joining(",")) + "]"
)
.collect(Collectors.joining(",")) + "]"
);
}

/* Actual solution */

public static List<List<Integer>> closestNodes(TreeNode root, List<Integer> queries) {
return queries.stream()
.map(n -> walk(n, root, OptionalInt.empty(), OptionalInt.empty()))
.collect(Collectors.toList());
}

public static List<Integer> walk(int query, TreeNode node, OptionalInt less, OptionalInt greater) {
if (node == null) {
return Arrays.asList(less.orElse(-1), greater.orElse(-1));
} else if (query < node.val) {
return walk(query, node.left, less, OptionalInt.of(node.val));
} else if (query > node.val) {
return walk(query, node.right, OptionalInt.of(node.val), greater);
} else {
return Arrays.asList(query, query);
}
}
}
>>
>>101565417
>unix used to be shit so it will always be shit
lol, europoor mindset
>>
In cpp, why does work?
auto& b = this->foo;
// or, inside a lambda
[&b = this->foo]() -> double { ... };


isn't this->foo a value? how can I capture a reference from a value?
Shouldn't I be doing something like
auto& b = *&this->foo
>>
>>101565794
>isn't this->foo a value?
It's an l-value.
>>
I started making an 8086 vm for fun, and I'm currently thinking about decoding the opcode part using some kind state machine.
Is this a super retarded way of doing this, or am I on the right path?
>>
>>101565442
fuck me sideways, that is beautiful.
thanks anon, I'll study this shit
>>
>>101565803
Thanks, I should probably learn that already
>>
>>101565921
You should because it directly answers such questions.
>>
>>101565442
Jesus. Who can even read this syntactic noise soup?
>>
>>101565441
Something something the best part about freshmen girls is that I get older but they remain the same age
>>
>>101560338
pass --rpath='$ORIGIN' or --rpath='$ORIGIN/../$LIB' to the linker flags
that way it pulls shared libraries from the binary's directory or with the second one with a local setup mimicking the system dirs so you can basically do what windows does and ship local dlls
it seems to work well enough
>>
>>101561245
```Flags[] mapFlags
for Flag in mapFlags
map.setBehavior(flag)```
>>
File: EfXCE01UYAA8csO.jpg (41 KB, 798x644)
41 KB
41 KB JPG
>```
>>
>>101565938
Java's not exactly my favourite language either, but it's probably slightly more helpful to him than if I wrote my solution in C.
The OptionalInts might have been a bit overkill, and I could have just used a nullable reference, but eh.

>>101565880
Walking a tree like that is like 2nd year comp sci stuff.
You should familiarize yourself with recursion and trees. It's very useful.
>>
>>101566078
Sorry im high and forgot. I havent used discord in like 3 years its just muscle memory
>>
>>101566081
>it's probably slightly more helpful to him than if I wrote my solution in C
What's helpful is to give people a useful int. For example: could you solve the task if instead of a BST, you had a sorted array? How can you provide a linear interface to a BST? This illustrates the principles better than Java syntax soup in my extremely humble opinion.
>>
>>101566145
>useful int.
Useful HINT*
>>
>>101565877
please report back, i need ideas for a bytecode thing
>>
>>101560081
thread so dead omg
>>
>>101562087
https://peps.python.org/pep-0492/
>>
File: 1695879893517357.jpg (26 KB, 400x400)
26 KB
26 KB JPG
>>101560081
>https://go.dev/tour/moretypes/18
Gopher bros, why is the module imported in the exercise just printing some text instead of showing an image? How do I convert its output to an image?
>>
>>101566901
You post this in every thread, yid.
>>
>>101567027
>seeing things
>>
File: A Tour of Go.png (109 KB, 1920x1080)
109 KB
109 KB PNG
>>101567007
It returns an image in base64. Browsers can display it. It's inserted into the page like <img src="data:image/png;base64, [base64 string]">
>>
File: 1706962809613753.png (316 KB, 646x687)
316 KB
316 KB PNG
>>101567207
I see, thank you anon. I didn't know this was a format. I'll return to it and try to make a png out of it later.
>>
>>101560338
1) statically link musl, or dynamically link an old version of glibc
2) statically link everything else
3)include a .desktop file and an icon
that's literally it
>>
i'm masturbating to shemales. carla novaes
>>
>>101560338
our process looks like this
>dependencies that aren't a system component (eg libsdl, libglew, libc, etc.) we build ourselves
>place in ./lib
>patch rpaths to point to relative path of libraries
you can also statically link.

You're a developer, you should know how ELF works, what linking is, how ld works, etc. Once you do know that, you don't need to ask these kinds of questions. Please learn how your operating system actually works. It will make you a much better developer.
>>
>sepples b&
programming is over
>>
>>101565442
This is a meh solution. There's no need to traverse the tree separately for every query. You could sort the queries and handle them in batches, like this:

const queries = [...];
const lower = [...];

function lowerBound(node: TreeNode, start: number, end: number) {
if(!node) {
return;
}

const mid = split(queries, node.value);

for(let i = mid; i < end; ++i) {
lower[i] = node.value;
}

lowerBound(node.right, mid, end);
lowerBound(node.left, start, mid);
}


>inb4 you're not allowed to sort the queries
Just sort an array of indices and map the result back to the original locations at the end.
>>
File: dancing-ferris.gif (258 KB, 734x490)
258 KB
258 KB GIF
It's here!
https://blog.rust-lang.org/2024/07/25/Rust-1.80.0.html
https://github.com/rust-lang/rust/blob/master/RELEASES.md

What's in 1.80.0 stable
>`LazyCell` and `LazyLock`
>Checked `cfg` names and values
>Exclusive ranges in patterns
>Add `size_of`, `size_of_val`, `align_of`, and `align_of_val` to the prelude

Stabilized APIs
>impl Default for Rc<CStr>, Rc<str>, Rc<[T]>, Arc<str>, Arc<CStr>, Arc<[T]>
>impl IntoIterator for Box<[T]>
>impl FromIterator<String> for Box<str>
>impl FromIterator<char> for Box<str>
>LazyCell, LazyLock
>Duration::{div_duration_f32, div_duration_f64}
>Option::take_if
>Seek::seek_relative
>BinaryHeap::as_slice
>NonNull::{offset, byte_offset, add, byte_add, sub, byte_sub, offset_from, byte_offset_from, read, read_volatile, read_unaligned, write, write_volatile, write_unaligned, write_bytes, copy_to, copy_to_nonoverlapping, copy_from, copy_from_nonoverlapping, replace, swap, drop_in_place, align_offset}
><[T]>::{split_at_checked, split_at_mut_checked}
>str::{split_at_checked, split_at_mut_checked}
>str::{trim_ascii, trim_ascii_start, trim_ascii_end}
><[u8]>::{trim_ascii, trim_ascii_start, trim_ascii_end}
>Ipv4Addr::{BITS, to_bits, from_bits}
>Ipv6Addr::{BITS, to_bits, from_bits}
>Vec::<[T; N]>::into_flattened
><[[T; N]]>::{as_flattened, as_flattened_mut}

Stable in const
><[T]>::last_chunk
>BinaryHeap::new
>>
>>101569241
Niche trannycorp lang. Don't care.
>>
>>101569241
>lazycel
Do Haskell programmers really need new slurs in 2024?
>>
>>101569257
But that's not C++
>>
>>101569368
Why do Rustroons keep trying to force their shitlang on other people?
>>
>>101565794
Reference is basically a const pointer under the hood. It doesn't "capture" the value, only its address. It can dangle if value gets deleted.
>>
>>101560081
I'm trying to figure out why this old plan9 utility for acme is crashing on startup when started from the program, but not when started from a terminal
For some reason it can't open the master end of the pseudoterminal
>>
File: 1721626770280625.jpg (26 KB, 632x474)
26 KB
26 KB JPG
>spend the day working on tutorials
>"alright, I'm actually absorbing this stuff pretty well"
>decide to start working on an actual project
>freeze up and start procrastinating while questioning my own intelligence
Is this what tutorial hell feels like?
>>
>>101570407
Open notepad and write what you have to do. If you don't know how to do something, well here's good news, you can procrastinate with more tutorials.
>>
>>101570407
Write a program that simulates bouncing balls. Right. Fucking. Now. Do it.
>>
is there some sort of make training course or something, giving me a bunch of projects and asking me to make it compile to learn all the different ways to use the tool? Trying to use it for my own projects sucks since I spend 1% of my time in make and 99% on the project so anything I learn I forget by the time I need it again
>>
>>101570407
The reason projects are recommended is that the act of doing them consolidates what you've learnt from other methods. (Projects are the lite version of using those methods in your job, in case that helps.) Having to struggle to work out how to use things, and getting through that struggle, that's one of the best ways of learning something deeply. Tutorials (and books) tend to just give you shallow learning.
Being an expert means you've got plenty of deep learning. That means every real expert has spent years struggling to learn things properly and to use the learnt things harmoniously with each other. It doesn't happen quickly. It can't really be rushed. It's about wiring your brain up in the right way. It's worth it. Part of that is learning to stop procrastinating and JUST GET ON AND DO IT.
>>
>>101570407
cargo doesn't have this problem
>>
>>101566078
Retarded frogposter (tautological)
>>
my solution to the two sum problem am i indian

    public int[] twoSum(int[] nums, int target) {
int[] answer = new int[2];
for (int i = 0 ; i < nums.length ; i++){
for (int u = i+1 ; u < nums.length ; u++)
if (nums[i] + nums[u] == target){
answer[0] = i;
answer[1] = u;
break;
}
}
return answer;
}
>>
>>101571919
>nesting for loops
you are literally a pigeon
>>
>>101571919
Yeah, off the top of my head I can immediately see an O(n log n) solution to this and I'm sure it's possible to do better than that as well.
>>
>>101571919
What's the time complexity of your solution?
>>
>>101560081
Some guy is writing an alternative to my successful open source project.
He didn't reach out with bug reports or merge requests, he just claims that there are major bugs and doesn't like my approach in a couple spots and says writing it from scratch is easier than fixing what's already there.
I don't have a problem with alternatives, but he fails to consider the thought that any of the deficiencies of my program could come from design decisions with pros and cons. He is not going to change any of these design decisions, but just claims he can do it better. All my decisions he attributes to incompetence and even uncaring.
It feels shitty to have all your hard work and design decisions with real thought and tradeoffs behind them boiled down to "this guy sucks and doesn't know what he's doing" instead of even trying to work together.
If he does make improvements, I'm just going to study what he did and implement them. I really hope that he doesn't gain more of a foothold. It seems wasteful to split development efforts when his work is not going to have any fundamental design differences.
Sorry for blog posting.
>>
>>101572015
Just outwork him? Lol. Make a post saying youll beat his ass into the ground with updatea and theres nothing he can do about it
>>
>>101572015
That's how Lisp works.
>>
>>101572080
>Just outwork him?
I will, but I'm still worried because he's louder than me.
>>
>>101572015
He's not likely to make any real improvements before he gives up and moves on to some other project
>>
based DoD dabbing on the software "engineering" mental illness
https://media.defense.gov/2018/Oct/09/2002049591/-1/-1/0/DIB_DETECTING_AGILE_BS_2018.10.05.PDF
>>
>>101572015
Linus seething in chat?
Your shitty kernel is rotten to the core lmao
>>
>>101572236
thread to job security slain
>>
I just want a language like Java without the verbosity and shitty build systems

Maybe Clojure or Scala is the answer
>>
>>101564608
What's wrong with offering a grid like Qt or GTK do?
>>
>>101572302
My project is nowhere near as big as Linux. If it was that big I would have no fears of being overlooked for a new project.
>>
>>101572425
>i would have no fears of being overlooked by a new project
and that is where you would be wrong.
>>
>>101572236
Based
>>
>>101572236
orange reddit seething at this doc
>>
>>101573111
>brown people
>saying hello
>>
should i focus on reading books and learning backend dev with spring et al. or should i toss around and make games and stuff for personal enjoyment
or should i have a regimen of both
t. neeting around until i start college at a semi-prestigious uni which is a local target for companies with internship programs so no need to jobsmaxx
>>
>>101573529
>should i focus on reading books
yes
>learning backend dev
no
>spring et al
who?
>games
actually this is a worse use of time, stick to only real value generators like backend dev
>>
>>101572341
>shitty build systems
Java literally has the best ecosystem for build systems
>>
File: 1646655701832.jpg (388 KB, 800x1317)
388 KB
388 KB JPG
>"honey come to bed"
>sorry can't, just found out that my hobby project is no longer backwards compatible with gcc 7, I must implement a workaround NOW

how do I stop being like this /g/
>>
File: based_bjarne_2.png (222 KB, 900x879)
222 KB
222 KB PNG
>>101569665
Because they know they're completely irrelevant otherwise.
>>
>>101574480
What are you talking about?
Java build systems are the most retarded and deranged shit I've ever encountered.
One time, I was trying to compile some shaders for Vulkan (lwjgl) with shaderc, and I could never figure out how the fuck you get that shit to work portably, and have a proper dependency between the source file and the output file. It was gradle.

This would've been fairly trivial in any other build system I've encountered.
>>
>>101574481
>how do I stop being like this /g/
Just bundle gcc 7 with your app who cares about the blaot
>>
>>101574481
>GCC 7
I already hard depend on at least GCC 13.
>>
>>101560926
functional programming languages arent real
>>
>>101574548
>compile some shaders for Vulkan (lwjgl)
>another gaymes dev whining because they misuse technology for bing bing wahoo
build real products instead and you'll see you don't have issues
>>
>>101574548
>Java
>Vulkan
redeem the AWT
>>
You dont need comments, you need more function definitions.
>>
>>101560081
Trying to figure out how to talk to a psychopathic devouring mother if at all.

Best plan so far is to always have a time limit.
>>
>>101575106
I think you replied to the wrong thread
>>
>>101575106
>fbi ragebaiting
if real anon, just leave the house
>>
>>101575078
a mix is best. seen people who follow the "code should be self documenting" philosophy and following the call hierarchy can be more confusing at a certain point than if things were just thrown together. also retards end up with function names that are like 20 characters long with 10 arguments
>>
>>101576064
>2 character function names with 10 arguments
that is good, just start doing the macro hierarchy
>>
File: 1697126823078682.gif (85 KB, 290x290)
85 KB
85 KB GIF
>>101560081
Guys am I retarded?
I can't figure out CMake.
>>
>>101574627
>>101574654
It was actually a plugin for another existing program, replacing its renderer.
>>
>>101576290
>Google something about it, results are from like 15 versions ago
>All of the shit you find is the "old" way of doing things
>Even if it has a built-in way of doing something, all of the results are people poorly reimplementing it themselves
>People building shit at configure time, which breaks how this kind of build system is supposed to work
Nah, it's pretty confusing at first and is really shit.
>>
>>101560081
done with the mouse and keyboard, now i must write the windowing system (and document the protocol)
>>
>>101576595
Is there a recommended way of learning about this stuff?
a friend lent me a book on OpenGL with C++ and while i could make a makefile that handles it I also saw this as an opportunity to make something that works on windows too.
>>
>>101576713
anything to do with c/c++ and make/cmake is going to be retarded because it's 40 years of trash piled on top of itself. picking something newer is easier
>>
>>101576741
yes but a lot of the things are still C/C++ and Cmake/make.
That stuff won't just go away.
>>
>>101560338
Electron
>>
>>101576290
Find "Modern CMake" tutorials. Really it mostly revolves around targets, target properties and target_link_libraries.

Or just use autotools... I don't like the syntax so I don't use them but they're still totally adequate if you don't need to build for Windows. The reason why CMake was made in the first place is to allow generating both VS projects and makefiles with one build system

You have to work on a massive cross-platform project to really appreciate CMake.
>>
>>101560081
What C compiler should I download for VS Code?
>>
>>101577221
>vs code
Quit programming in C, we are full.
>>
>>101576290
The developer sells the books about working with CMake, so it's complicated by design.
>>
>>101577120
Autotools is hot garbage. If you're going to recommend someone a build system for C or C++, tell them to use Meson.
>>
>>101577221
There aren't that many mainstream options. Just use gcc or clang.
>>
>>101571983
It can be done in O(n) with hashmaps.
>>
File: 1716081263135261.png (788 KB, 1216x832)
788 KB
788 KB PNG
>>101576955
I'll stick with windows and xaml then
>>
>>101569241
have they improved compile times? I last checked out rust three years ago it was quite slow back then.
>>
>>101561479
huh? that's technically true, but in C++ to simply have a bunch of variables or (non-member!) functions available you can just have a namespace and declare some functions in it. but i think his issue is he has for example a class that handles shooting and ammo depletion etc and he doesn't want `Weaponry::fire(Position pos, Direction dir, Projectile proj)` to also have an if statement checking for some global-variable "isInfiniteAmmoLevel==true" to decide whether to deplete the ammo, along with 20 more checks as he theoretically adds more functionality to his game. nor does he want to add `Level currentLvl` to the function signature and check based off that. and OP to you >>101561245 i'd say you are probably forward optimising too much, expect jank in games since design intertwines with development far more than when making a website or UI or solving some science problem. you can always come back and refactor if you find that shit starts to get clunky, and once you've put in a small handful of these checks you'll have a much better understanding of the pattern of where they crop up and where they might be handled instead. off the top of my head, for ammo, you might like the Gun class to have its own ammo settings (max ammo, clip size, bool infiniteammo) and then its fire() method relies only on itself for the if statement w/r/t decrementing. Then you only have to think about the idea of an "infinite ammo level" when creating a gun, or taking an existing gun from one level to another.
>>
>>101577120
>You have to work on a massive cross-platform project to really appreciate CMake.
Probably true, but I'd say even working on a single platform project, i really REALLY appreciate CMake for handling transitive dependencies via target link libraries public/private. If you end up for some reason needing to add header files from Project C into header files of Project B, or have colleagues/legacy issues that did this, and then have Projects A01-A50 that all depend on Project B or regularly add new projects that depend on B, from a VS perspective this simply isn't possible and requires that you manually (remember to) add Project C to all those A projects, or go back in time and get everyone to forward declare or otherwise simply make the code be more good. This is admittedly an issue downstream of bad decisions, but it's downstream of bad decisions that have made it into projects I've had to work on and caused me a lot of grief
>>
>>101560081
i have no fucking idea why my circuit isnt working and i think i have a grudge against the state of japan.
>>
>>101560081
i hate embedded so fucking much you have no fucking idea, fuck all of these retarded fucking niggers who are so fucking incompetent at fucking documenting things of all things, fucking embarrassing, make hiroshima and nagasaki happen again.
>>
>>101578081
MCUs and sensors have data sheets and I feel that generally the embedded devs actually write documentation unlike other software devs.
Though most firmware devs I have worked with have electronics background.
>>
>>101578389
>data sheets
>where some fat chinkoid mixes up what a byte, bit and word are... for 30 consecutive pages
>>
>>101578407
When you choose your chip and sensors you should check the quality of data sheets and errata before you decide what to use in your product.
Also checking that there is drivers already or reference example that you can use to write your own drivers.
>>
>>101577331
>It can be done in O(n) with hashmaps.
Yeah, that would be the same idea as the O(n log n) one except you sacrifice O(n) space in exchange O(1) lookups instead of O(log n) searches.
>>
The more I learn about programming the more it's an ever expanding circle encompassing every other area of technology
>>
Every programming language besides Lisp is just a badly designed Lisp.
>>
>>101579444
trips checked and true
>>
File: 20220621153856_1.jpg (150 KB, 1920x1080)
150 KB
150 KB JPG
 MyVariable = "this is going to change"
backupOfMyVariable = MyVariable


MyVariable changes and "backupOfMyVariable" changes with it. No no no. It was supposed to be a recorded value so I can compare or revert MyVariable back to it later on.
>>
>>101579910
This is why languages that don't have a strong distinction between references and values in their syntax have immutable strings.
>>
>>101574548
>It was gradle.
FWIW almost everyone uses Maven now
>>
>>101576804
You can help try though by not using it
>>
I'm learning golang, and i want to make shitty websites to scam poor people. What is the Django of golang?
>>
>>101580033
Get out of here scumbag
>>
>>101577693
What framework are you using for Windows? WPF, WinUI, Avalonia, etc.
>>
cool article on floating point math
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
>>
File: lisplogo_warning.png (30 KB, 165x256)
30 KB
30 KB PNG
>>101579444
Lisps are good as high-level programmer-machine interfaces, but there's a reason (actually a lot of reasons) the most impactful software written in a Lisp is a bad text editor from 50 years ago - and even there the heavy lifting is done with another language and Lisp is used just for scripting, in the same exact position where Lua, JS and many other scripting languages are used to the same success.
Yes-yes, the orange leddit runs on a Lisp because a basic bitch website backend really needed the Power of Lisp™, Clojure is used for reeeally thrilling data juggling in banks because it's so amazing and unique and super powerful and not mostly because of job security and it being a Pajeet filter/anti-outsourcing defense exactly just like Scala, and you wrote toy programs for your thesis in a Scheme or CL, which totally couldn't be done with Python or JS just as well if not better/more efficient.
The state of the Lisp ecosystem(s) and tooling is pitiful, until a Lispfag reminds you for the nth time that Lisp has been around since the 50s and it's the second-oldest language still in common use, and then it's just laughable, and alarming - something is really, horribly wrong in the Lispland.
You know that joke about Haskell, "- Haskell programs are guaranteed to have no side effects - ...Because no one will ever run them?" People still get more shit done with Haskell than all Lisps that aren't Clojure combined.
"The most powerful programming language", "beautiful bipolar minds", "God's own language", bla-bla-bla. I'm not sure if Lisp is the cause or a symptom, but the reality is, Lispfags are good only at mental masturbation, autofellating and circlejerking.
>>
How common is inverting a table of lists? Eg, you have a table where the keys are group names and the values are lists of members of those groups and you invert the table so that the keys are members of the groups and the values are lists of groups they belong to
I'm wondering if there's any clever ways of doing this
>>
File: 1721983482376242.png (419 KB, 1010x706)
419 KB
419 KB PNG
im designing parallelism

read some news about another php-dude but presumably woke as he left britain after brexit. krakjoe his name went on fentanyl and other shit. maybe projecting but looks like woke went broke. he also worked on parallelism but with OS threads, thread model.

found a good definition on youtube, youtube AI works great youtube.com/watch?v=r2__Rw8vu1M
>>
>>101577901
C/C++ build systems will never be good or simple or elegant, I've come to accept that. CMake is just what's most popular and least janky, and the good support for it in VS is a massive plus. But it's massively ridiculously bloated because it needs to support every weird possible scenario out there with every generator and every compiler. You can even debug CMake files.

You can even use CMake as kind of a package manager now, even though it already has conan and vcpkg integration
>>
Made a script that runs inside a batch file to change ip addresses saving me a few clicks ironically found it incredibly useful at my job and it puts every shitty project I've done to shame.
>>
>>101580507
You are angry because you're using some 3rd rate lisp wannabe.,
>>
File: seanallen.jpg (139 KB, 2065x1450)
139 KB
139 KB JPG
>>101560081
I want to code something with the iPhone's dynamic island API but I can't find any torrents or places to access to Sean Allen's Live Activities and Dynamic Island course... can any anon please help out a poor tard like me
>>
>>101577700
Is the compiler still written in a language where every object is an heap allocation?
>>
Why the fuck Pyautogui hangs whenever I try to use a mouse input?
pyautogui.press('space') is fine
pyautogui.click() hangs
pyautogui.click(x=100, y=200, button='left') hangs
pyautogui.mouseUp(button='left') hangs
everything fucking hangs
I tried using pydirectinput and i'm getting the same thing.
>>
i'm writing a CLI tool, and currently most of my operations are calling another CLI tool via a subprocess.
Writing the code to do this natively in my own CLI seems 100x harder than simply calling the other tool (even if lib code used by the other tool is available).
Are there any good reasons not to do it the easy way?
>>
>>101581785
Just read the documentation and look at the sample projects.
What is it with zoomers and always needing videos on shit.
>>
>>101582747
if most of your operations are calling another CLI tool then what exactly are you doing that can't be done by a bash script?
>>
>>101580326
>WinUI
This, it's has few bugs though, it'll get an update at the 8th month probably
>>
Microsoft creates a new UI framework more often than I shower
>>
File: OIP (7).jpg (7 KB, 211x211)
7 KB
7 KB JPG
>>101582752
>g-go read the documentation!!
Because Apple documentation is dog shit and doesn't write it in a legible way but in a muh aesthetic way. If only you tried to do real world projects instead of being a hello world or npm start faggot then you'd understand the need for something like this

>g-go look at sample projects!!
>implying 99% of them aren't dogshit

Please stop being a massive faggot on /dpt/. You're more unhelpful than you think you already are.
>>
>>101564608
Flexbox is basically:
>layout items
>distribute (available size) - (sum of all item sizes) among items
It's just a less general table layout where you only have one dimension. Great for a navbar, but desktop normally needs both dimensions.
Anyway, you're writing a library so you'll need >>101564650 sooner or later
>>
>>101582943
Apple docs are good.
Don't you have an e-celeb to be donating your allowance to?
>>
File: 1721462924334688.gif (227 KB, 1000x1000)
227 KB
227 KB GIF
>>101582935
>Microsoft creates a new UI framework more often than I shower
C#:
Winforms
WPF
UWP
WinUI 3
C++:
MFC
WTL
Win32 gdi and hwnd
WinUI 3
Gnu contribution:
Nothing
>>
>>101577700
It wasn't that slow then and it's faster now
>>
>>101583083
GNU is still stuck with ncurses
>>
File: ismage.png (64 KB, 225x225)
64 KB
64 KB PNG
>>101583004
>Apple docs are good
I don't need to read the rest of your retarded troll post. Kys immediately. Right now.
>>
>>101582786
it's not my decision (I already have the bash scripts)
also some cross platform benefits from doing it that way
>>
>>101581726
yeah he must be using common lisp
>>
h-haskell!
>>
>>101560081
overcame the osdev brainwashing in video cards
i am either going to go psychic and write the entire driver tonight or sleep and do it lazily tomorrow

also
>have to unironically use simd registers
>>
>>101560797
ESL reply
>>
>>101584707
haskw
>>
Getting there

public static int[] twoSum(int[] nums, int target) {
Integer firstHalf = null;

int[] answer = new int[2];
HashMap<Integer, Integer> map = new HashMap<>();
for (int i = 0 ; i < nums.length ; i++){
map.put(nums[i], i);
if (nums[i] == target/2){
if (firstHalf != null) {
answer[0] = firstHalf;
answer[1] = i;
return answer;
} else {
firstHalf = i;
}
}
}
for (Integer s : map.keySet()){
Integer searcher = map.get(target-s);
if (searcher != null){
answer[0] = map.get(s);
answer[1] = searcher;
return answer;
}

}
return answer;
}
>>
why would a github issue be deleted altogether (404 page not found) rather than just be closed? i opened issue about a crypto miner getting stopped by windows because it thinks it's a trojan, in my email notifications someone replied and agreed with me that it's an annoying issue but the issue has just disappeared altogether on the github page
>>
now after some time of not running the miner, it's working again without having to remove the thread from quarantine or anything
>>
*threat
>>
File: twosum clojure.jpg (169 KB, 1080x815)
169 KB
169 KB JPG
>>101585954
>>
>>101586058
means it went non-public
>>
>>101585954
Anon what the hell are you trying to do?
>>
You can tell what the output is without running the code, right?
int main()
{
int a = -1;
int dx = 0;
int dy = 1;
if (dy == 0)
if (dx < 0)
a = 0;
else if (dx > 0)
a = 1;
else if (dx == 0)
if (dy < 0)
a = 2;
else if (dy > 0)
a = 3;
return a;
}
>>
>>101586934
-1?
>>
>>101586934
3
>>
>>101586934
It does nothing, the screen shows nothing.
>>
>>101586593
You could just give the code to an AI and ask it
>>
I have a project with an entire meson build system I don't really understand and don't really care to understand for now.
unfortunately, two header files are generated by meson on the fly, without exposing the ready-made files to the file system.
here's the incriminating section:
resources = gnome.compile_resources('ui_resources',
'gresource.xml',
source_dir: '.',
c_name: 'fsearch_ui',
)

resources += gnome.compile_resources('icon_resources',
join_paths(meson.source_root(), 'data', 'gresource.xml'),
source_dir: join_paths(meson.source_root(), 'data'),
c_name: 'fsearch_icons',
)

how do I simply tell meson to build these two files and dump them as normal header files with the directory?
>>
>>101587848
>header files with the directory
into the directory*
>>
>>101574579
Debian's on ver 12 still :(
>>
>>101587848
That should already generate ui_resources.h and icon_resources.h at the build root I think.
You just have to make sure the resources array is included in the sources of your executable.
>>
>>101587876
By the time I actually finish any of my projects, and care about distribution, I'm sure Debian would've caught up.
>>
>tfw 10 years of experience as a script kiddie programmer
>finally start studying formal computer science
>realize that I have only been pushing shit code without really understanding what i am doing
feels bad
>>
File: images (1).jpg (39 KB, 480x640)
39 KB
39 KB JPG
I am currently developing Power Bi reports using Power Automate to integrate it into Microsoft Teams.
It is the only way my massive corp will let me develop my own tools without using a 3rd party developer
>>
>>101560081
spamming convnet training
>>
>>101589214
The difference between script kiddies and real programmers is the humility to admit your own ignorance and the ambition to self-improve
>>
>>101589214
Be careful of the academic side of things, too. A lot of ideas that seem very clever turn out to be utterly impractical.
>>
where should i invest my time and money as a 4-month old newbie java programmer
>>
File: redeem.png (127 KB, 1044x1008)
127 KB
127 KB PNG
I work at a FAGMAN and make over $100k btw :)
>>
HOW IN THE FUCK DO YOU WRITE A STRING TO A BINARY FILE AND THEN READ IT BACK LIKE A NON-NIGGER IN C++
FUCK FUCK FUCK FUCK FUCK FUCK ITS BEEN 5 FUCKING HOURS AND EVERY OTHER STACKOVERFLOW PAJEET HAS A DIFFERENT WAY TO CAUSE A SEGFAULT
>>
>>101589822
>type annotations in python
Get outta here, poser.
>>
>>101589827
1. mmap the file, memset the string to it, done.
2. mmap the file, allocate enough memory, memcpy mapped file to the allocated memory, done.
Don't forget about the null terminator.
>>
>>101586934
I thought there was going to be some kind of neat obfuscation demonstration but instead its just a genz kid who doesnt know what language grammar is mindblown by if/else blocks that don't have braces.
>>
>>101589478
Yeah, true
It is hard to juggle everything with my day job but I have already seen improvements. There is nowhere to go but up.
>>101589782
On the positive side, since my experience is all practical I have an easy time remembering things that I could have done better, had I chosen a more appropriate data structure or algo.
>>
File: 1621618013559.gif (41 KB, 128x128)
41 KB
41 KB GIF
>>101589878
>>
>>101560081
Working on a pure TypeScript website because frameworks are bloatware. Yes it's taking me longer but the native feel is worth it.
>>
>>101589898
Weird cope, just admit that it tricked you
>>
>>101590004
The fact that you even think this is a possibility is baffling
>>
>>101586934
3?
>>
>>101589214
when you start a big boy project that needs hardening you spontaneously learn all of the best practices
>check the fucking return
>wrap this scary nonsense
>macro
>macro
>>
>>101589889
>memset the string to it
larper
>>
>>101560081
I ended up with a weird bug. I was trying to render a simple triangle in my program but it ended up drawing it on my screen instead. Its rendering the triangle directly on the screen, not with a transparent window.
>>
>>101590193
>explicitly running on root and writing to the framebuffer, surprised when he writes to the framebuffer
???
>>
>>101590193
>vscode web browser instead of a real text editor
>shitty window manager instead of a real desktop environment
not gonna make it
>>
>>101589827
for a string you want a custom format. You can write the size first and then the string data. To write the string:
int32_t size = str.size();
fwrite(&size, 1, sizeof(size), file);
fwrite(str.data(), 1, size, file);

to read the string:
int32_t size = 0;
fread(&size, 1, sizeof(size), file);

std::string str;
str.resize(size);
fread(&str[0], 1, size, file);
>>
>>101590193
I'm guessing this is X11 and you're targeting the root window rather than your own program's window.
>>
>>101590220
it's not running as root (neither is xorg) and im not writing to the framebuffer owned by xorg either
>>
>>101590235
This code is unsafe.
>>
>>101590238
nah its targeting my own window and im also not writing to the windows framebuffer, im writing to a framebuffer that i created. Im outputting the framebuffer value and it's not 0
>>
>>101590239
Is it just that your program doesn't have any window decorations and it simply looks like you're drawing onto X11s root window?
>>
>>101570542
(function() {
let size = x = y = 50;
let dx = dy = 2;
const canvas = document.createElement('canvas');
canvas.id = 'screenSaver';
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
function frame() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'red';
ctx.fillRect(x, y, size, size);
if (x + size > canvas.width || x < 0) {
dx = -dx;
}
if (y + size > canvas.height || y < 0) {
dy = -dy;
}
x += dx;
y += dy;
requestAnimationFrame(frame);
}
const style = document.createElement('style');
style.innerHTML = `
#screenSaver {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
`;
document.head.appendChild(style);
frame();
})();
>>
>>101590241
only if you know what youre doing
>>
>>101590257
nope, im also not running with a compositor so it cant have a transparent background. If i remove the glBindFramebuffer call then it will not draw on the screen
>>
>>101590257
based Xlib enjoyer or at least tolerater
>>
>} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
>unintuive name
at least shit is there
>>
Checkmate 'switch' users

num = 0
a = 1

if a == 1:
x = 100
elif (a == 2) and (num > 0):
x = 200
elif a == 2:
x = 300
else:
x = 400
>>
>>101560081
(C)hads, help me, what am I doing wrong
>>
>>101591212
I can't tell if this is facetious or not.
>>
>>101590309
I've never actually written any Xlib code outside of setting up xcb for using OpenGL.
>>
>>101591128
int num = 0;
int a = 1;
int x;

switch (a) {
case 1:
x = 100;
break;
case 2:
x = num > 0 ? 200 : 300;
break;
default:
x = 400;
break;
}
>>
>>101591212
>int main(void)
Get on with the times, grandpa, the new correct syntax is "auto main() -> int".
>string answer
Same as above, today the correct syntax is "auto answer = ..."
>printf (answer);
Same as above, today the correct syntax is "std::cout << answer << std::endl;"
>>
>>101588902
good to know :)
>>
File: 1716955152240037.png (23 KB, 600x211)
23 KB
23 KB PNG
toylang progress, iter keyword. the iter body captures the current iteration inside the local variables idx/key/val. I can't iterate on the default pair (the _:"other" ) because the key is typeless, plus I'm not even sure it'd make sense to begin with. that $ at the start of the body is just a print(...).
>>
>>101588885
the files aren't generated, though. I compile the project and find for them afterwards, but they're nowhere to be found
>>
   public static String getKey(String key) {
switch (key) {
case "Capacity", "Cap", "CAP", "cap", "CAPACITY", "capacity":
return "Capacity";
case "Level", "level", "lvl":
return "Level";
}
}


in java is there any way to return first case?
>>
>>101591256
I think I used a wrong example. Imagine the second '2' case is gone, if the first one doesn't match you want 'else' to trigger. What then
>>
I want to build AI chatbot but zuck's llama-3 needs a request and might be censored, what other language model is comparable to llama-3 and have no restrictions?
>>
>>101591212
>>101591257
In Rust, this is just
#![feature(allocator_api)]

use std::io::BufRead;
use std::io::Write;
use std::os::unix::ffi::OsStringExt;

fn main() -> Result<(), std::io::Error> {
let query: std::borrow::Cow<std::ffi::OsStr> = std::borrow::Cow::Borrowed(std::ffi::OsStr::new("what's your name? "));
{
let stdout: std::io::Stdout = std::io::stdout();
let mut handle: std::io::StdoutLock = stdout.lock();
handle.write_all(query.as_encoded_bytes())?;
handle.flush()?;
}
let answer: std::borrow::Cow<std::ffi::OsStr> = {
let mut buf: std::vec::Vec<std::primitive::u8, std::alloc::Global> = std::vec::Vec::new_in(std::alloc::Global);
let stdin: std::io::Stdin = std::io::stdin();
let mut handle: std::io::StdinLock = stdin.lock();
handle.read_until(b'\n', &mut buf)?;
std::borrow::Cow::Owned(std::ffi::OsString::from_vec(buf))
};
{
let stdout: std::io::Stdout = std::io::stdout();
let mut handle: std::io::StdoutLock = stdout.lock();
handle.write_all(answer.as_encoded_bytes())?;
handle.flush()?;
}
std::result::Result::Ok(())
}
>>
>>101591555
sis, your type inference
>>
>>101591432
You mean "Title Case"? I don't believe there is a standard function for that.
>>
>>101591451
That would just be an inappropriate use of a switch.
>>
>>101560081
thanks for the utani fren
>>
I am a c enjoyer but am disenfranchised with gtk and qt. Should I just stick to cli?
>>
>>101590258
Very nice. Now make it 20 balls and have them bounce off of each other.
>>
>>101591451
int num = 0;
int a = 1;
int x;

switch (a) {
case 1:
x = 100;
break;
case 2:
x = num > 0 ? 200 : 400;
break;
default:
x = 400;
break;
}
>>
>>101590241
m8 if you copy and paste code on 4chinz without knowing exactly what you're doing then you deserve precisely what you get.
>>
system("rm -rf");
>>
>>101590241
>t. ranny
>>
>>101591660
Now say there's other cases after 2, like 3, 4, 5. You can't simply use the default.
Point is imo switches can easily turn into a situation where you need conditionals, might as well use 'if' for everything.
>>
>>101591772
> You can't simply use the default.
int num = 0;
int a = 1;
int x;

function useDefault() {
x = 400;
}

switch (a) {
case 1:
x = 100;
break;
case 2:
if(num > 0) {
x = 200;
}else {
useDefault();
}
break;
default:
useDefault();
break;
}
>>
>>101591772
Also:
int num = 0;
int a = 1;
int x = 400;

switch (a) {
case 1:
x = 100;
break;
case 2:
if(num > 0) {
x = 200;
break;
}
>>
>>101591212
problem?
>>
>>101590239
>neither is xorg)
oh how nice to be so naive...
how do you think xorg can load its own drivers if it is not running as root? the kernel is not that encompassing you know...
>>
daily reminder that root programs on linux can access the internet
>>
>>101566145
This entire leetcode phenomenon can be summed up with this.

People are trying to implement a BST walk without even knowing what a fucking tree is, or big O notation, why we would even use a tree, etc. Not to mention 99% of people don't need to manipulate data structures in this way, they're just using degenerate "design patterns" in a C# enterprise solution.
>>
>>101592039
systemd provides a service called logind, which allows unprivileged display servers to access privileged resources (The GPU and input devices), and has its own access control. Things other than logind exist that do that too (e.g. consolekit2), but logind is the one that everyone actually uses.
>load its own drivers
The X server is not loading modules into the kernel. Either the kernel itself does it simply by the hardware being present, or some more systemd stuff is involved.
Also, userspace drivers of anything really just operate using a bunch of ioctls and ioctls aren't fundamentally restricted to root. It's just the kernel maybe adding those restrictions where it thinks they're needed.
>>
>>101591873
>void main
Yes.
>>
>>101592139
What's your point? What do leetcode problems have to do with your complaint about the abysmal state of "programmers"? If anything, trying and failing to solve these problems encourages people to learn those things.
>>
>>101592177
I got sidetracked there. My point is that you should think about the problem without involving any coding first before banging your head on a wall in an editor. It's a computer science question, not a programming one.
>>
>>101592199
>you should think about the problem without involving any coding first
What is it about leetcode that contradicts this principle?
>>
I'm at my cousin's house visiting and using his laptop to remote into home. I'm recognizing how important it is for my workflow to have a lot of horizontal resolution since I typically use 3 vertical columns in my editor but that's not practical on lower res.
>>
>>101592262
The way people use it. Sure it's nothing inherent about the website itself, I'll give you that. Just the whole culture around it is absurd to look at from the outside.
>>
>>101592330
I dunno. Sounds like a jeet problem. Funny how no one ITT posted a good solution. Jeet thread.
>>
>>101589822
>list
You should be yielding instead
>>
>>101592330
Yeah, the whole "grind leetcode to get a job" meme is so fucking stupid.
>>
>>101592394
>Yeah, the whole "grind leetcode to get a job" meme is so fucking stupid.
Why?
>>
>>101592425
Because it's just a bunch of retards falling for marketing crap.
>>
>>101592437
Getting good at solving algorithmic problems will help you get a job that involves solving algorithmic problems, surely.
>>
>>101592457
It's developed into a cult of soibois thinking and propagating that you MUST do it; specifically leetcode, nothing else.
I suppose I have to praise leetcode's marketing team for getting the job done, but I hate to see that kind of shit work.
>>
>>101592481
>it was real in my mind
>>
leetcode-doer starter pack:
>macbook
>vscode
>most interactions are entirely feigned positivity
>copilot
>python
>javascript
>has a blog made with <3
>most visited url is an article introducing dynamic programming, and it was generated by an indian
>webshitter turned data scientist turned ai expert
>thinks 100ms+ of input lag is normal and acceptable
>jetbrains mono
>posts trivial projects to hackernews, like "cat with syntax highlighting" or "TUI tool to play fart sounds at the terminal, written in javascript"
>>
>>101592612
>seething because you don't understand binary trees or something
>>
>>101592354
For all my grandstanding I doubt I could even do it in under an hour. Learned all this shit in school using SICP and scheme kek, then never had to revisit it at an actual job.

Anyway for something more on topic; I can't figure out how to find the .NET version used for an arbitrary dll. I'm just entirely getting lost in the .NET soup on MSDN, this shit is enormous.

I create an instance of ICLRMetaHost which literally has a GetVersionFromFile method yet it only ever comes back with 0x8007000b as an error code. Googling it everyone keeps repeating it's a 32/64bit incompatibility error but I've tried just about every fucking configuration. When I point the method to some random mp4 file it still throws that error so clearly that's not it.



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