[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: 120390146_p0.jpg (287 KB, 578x818)
287 KB
287 KB JPG
Old thread: >>101403054

What are you working on, /g/?
>>
>>101433089
>touhou
millenial goyslop thread
disengage
>>
>>101433496
Bullet hell games are so dumb
>>
>>101433089
>what are you working on?
killing myself
then working on a tool for my job
>>
>>101433099
>it is implemented the same way in the kernel
wrong, read() in linux doesnt ask for a page alignment requirement so it simply isnt.
>if you aren't loading files that aren't being accessed
>nt nt
am i the one loading files... from userspace?

I think you are hallucinating brother.

>>that is slow because you are copying the memory! + kernel functions are heckkin slow!
i wanted to ignore this but FUCK you are actually hallucinating, i think you should go to bed.
>>
>>101433089
Fucked around with an arduino

Then I went out with family, now I somehow have found the will to do real work (because i got so bored lmao)
>>
how can I make this python function more understandable/better?

def skip_conditions(model, display_template):
skip = skip_file_download = skip_text_file = False

# Read the lines from the log file and store them in a list for faster lookup
parsed_urls = store_text(parsed_models_log)
parsed_urls_images = store_text(parsed_images_log)

image_parsed = set(parsed_urls_images) & set(model.version_images)

if model.version_downloadUrl in parsed_urls:
if image_parsed:
print(f"{display_template} model and image has already been parsed, skipping.")
skip = True
else:
printCyan(f"{display_template} model has already been parsed, skipping model download only.")
skip_file_download = skip_text_file = True
elif model.version_earlyAccess is not None:
if image_parsed:
printYellow(f"{display_template} is early access and image has already been parsed, skipping.")
skip = True
else:
printYellow(f"{display_template} is early access, skipping model download only.\nearlyAccessDeadline: {model.version_earlyAccess}")
skip_file_download = True

return skip, skip_file_download, skip_text_file
>>
>>101434139
The memory used by the memory mapped files is the same memory used by kernel file functions, the only difference is that memory mapped files need to be mapped to userspace and kernel functions just copy the memory to userspace.
I told you I don't care about the technical details, I worded it wrong, but I only care about benchmarks (I posted a benchmark).
I think memory mapped files have a use and purpose, but if you use it in places where it doesn't make sense, you aren't going to benefit from it.
I could probably investigate and understand why memory mapped files aren't faster, but I don't really care, I personally prefer researching why things are fast, not slow.
>>
>>101434331
Look, I dont like fiends who take Me for a retard. The problem here is that you are fucking larping, not only as if you understood anything about my post (in which i kindly explained why the things you said are retarded) but also as if the way you are conversing now is the one you usually do.
>>
>>101434331
>I personally prefer researching why things are fast, not slow.
*I mean I prefer when there is an actual difference, like of course if something is slower, something else is faster.
>>
tldr you are a baiting retard and that was my last ((You)) for the night.
>>
>>101434397
I spent 10 years making game engines in C++ with no games so I am quite autistic and understand you quite a bit.
>>
File: algopyle.png (603 KB, 3000x1920)
603 KB
603 KB PNG
A C# program that procedurally generates C source for for an encryption algorithm vault. Uses a huge library of functions and dictionaries. Next step is to add name obfuscation. I fucking hate Python but have been experimenting with models and am wildly curious about making a portable model that could add an additional layer of randomization and obfuscation to the final source code.

Think .zip folder with a password on steroids and pervitin. It's probably crackable but the lack of standardization will make it a pain each time.
>>
>>101434491
this is real metaprogramming.
Fucking rad.
>>
>>101434491
noice
>>
>>101434417
yea i saw that like a second too late
it's on account of the monolithic architecture of gcc vs library tooling oriented design of clang and llvm
what i don't understand is why GNU's not bothered at least trying to write a multi-target dispatcher over the their toolchains
>>
>>101434491
Obscurity through security.
>>
h-haskell!
>>
>A loose-source-route option is similar to the strict source route, but it is more relaxed. Each router in the
list must be visited, but the datagram can visit other routers as well. Figure 4-9 shows the format of the
loose source route option.
if only people knew that linux does this with routers in washington...
Yes, this is why your internet got slower after switching from windows
>>
I started a new job a month ago, and here's the situation:

>It's all C# web applications, mostly MVC Core, with a few old Web Forms.
>Massive solutions with multiple apps—around 25 projects in a single solution.
>The main branch is deprecated; everyone pushes changes to DEV, which is what gets deployed.
>Hundreds of commits without any messages.
>Everything is done using AJAX requests to serialize objects and web methods
>The entire business logic is in the database.
>This means there are hundreds of stored procedures, none of which are versioned.
>Some things have to be entered directly into the database, like new menus.
>>
>>101435110
>The entire business logic is in the database.
>This means there are hundreds of stored procedures, none of which are versioned.
Oh, that's the real red flag. Company's skating on real thin ice there.
>>
if my input is a signal, so a stream of values with a timestamp / fixed step between values, is there some algorithm I can use to determine if a sin wave is contained in it or a square wave?
>>
>>101434417
GNU Compiler >Collection
>>
>>101433089
>What are you working on, /g/?
Touhou clone
>>
>>101435491
I imagine the solution involves a Fourier transform and checking the peaks, but my signal processing knowledge is very basic.
>>
>>101435611
You also need to clip the range of frequencies after the fourier transform so that you don't pick up the ass-load of noise from the sampling frequency itself. Yes, that means you can't detect a sine wave with too high a frequency, but picking that up with standard sampling wasn't going to happen anyway.
>>
>>101433089
You just reminded me today is indeed Touhou Tuesday.
>>
>>101434909
Can I use banana brackets (| |) with -XArrows to curry f where
f :: a (x,y,z,w) r
>>
File: maxima-moment-ratio.jpg (40 KB, 704x378)
40 KB
40 KB JPG
>>101435491
RMS/peak=1 for the square wave and it's less for sine.
No need to do a Fourier transform, but maybe you'll need
it for other wave forms.
>>
File: most common words.png (77 KB, 772x1307)
77 KB
77 KB PNG
is this a good solution? i'm a beginner
>>
>>101436298
You could make your solution a lot shorter by using a Set<Integer> rather than a List<Word>.
>>
>>101433089
Are there any websites out there that let you search/filter a list of programming languages based on their features? Basically like an akinator for programming languages where you can filter by things like static vs dynamic typing, garbage collection vs manual memory management, 0-based vs 1-based indexing, etc.
Kinda in the mood to try a new language this weekend, but I'm too lazy to actually do a bunch of research. I was honestly surprised that I couldn't seem to find such a site no matter where I looked for it.
>>
>>101436298
No, you want to get rid of that double for loop Anon. Use a hashmap instead of a list to hold the words, that way you don't have to search through the whole list each time to see if the word is in there.
>>
>>101436298
this is like 5 lines in C#, surely it could be shorter in Java than this?
>>
>>101435110
That's nightmare fuel dude. If possible, rewrite everything from scratch using a framework of your choice, securing your position as the new lead programmer. If it's too much content for you to do that, quit and find a new job.
>>
>>101436499
There aren't that many languages worth learning.
Haskell has a Data.Dynamic, garbage collection,
malloc/free, array has any start index, so it checks
all the boxes.
>>
>>101433089
>>101423429
If I implement the following having set it to my porn folder, will I brick my PC?
```
while($true){ Invoke-Item $(Get-Random -InputObject $([System.IO.Directory]::GetFiles("C:\dir\dir\dir")))}

```
Will there be endless porn pop-ups forever?
I only want there to be five porn pop ups at a time. Any one know how?
>>
>>101434325
Put the conditional inside the print statement since it's the only thing that changes between if and elif. Set the flags to a condition. Say,
flag = op.is_faggot()
# instead of
if op.is_faggot():
flag = True
else:
flag = False

You should be able to solve this in three (3) lines.
>>
>>101433089
What does tranime have to do with programming?
>>
>on 32 bit arm, "v(number)" indicates an alias name for some general purpose register
>on 64 bit arm, "v(number)" indicates a vector register
wtf couldn't they have at least picked a different letter
>>
>>101433089
Nkds remilia
>>
>>101434521
>this is real metaprogramming.
No, that's real code generation...
>>
>>101434325
You can't. It's utterly straightforward already. Don't waste your time.

>>101437419
>Put the conditional inside the print statement since it's the only thing that changes between if and elif. Set the flags to a condition.
And then he needs to do some extra thing when a condition occurs and has to change it back. Low IQ take.
>>
File: output.png (4 KB, 762x146)
4 KB
4 KB PNG
Maybe I should use a struct for this...
>>
>>101436298
This is fine for a beginner. If you haven't yet learned about more advanced data structures like hash tables, that's the way to do it. The main source of inefficiency in your algorithm is that you have to scan through `wordList` every time, whereas with a hash table, you could find the entry for a word by its string much faster.
>>
>>101439532
>Maybe I should use a struct for this...
Clearly. Imagine trying to remember the arguments for this function without tooling...
>>
>>101439566
Honestly, with C, I don't really seem to have all that many issues with that compared to some other languages.
Maybe you're kind of forced to be looking at the documentation a bit more (or I just have the header file open), compared to things where you just try to autocomplete to the solution.
>>
I contracted Lua brainrot and now I want to turn everything into a table in every language help. It's just so nice to be able to add new fields and capabilities to "objects" dynamically. Makes composition a breeze.
>>
>>101436499
>in the mood to try a new language this weekend
>only wants one that contain the specific list of features that he is comfortable and familiar with
>>
>>101440343
>It's just so nice to be able to add new fields and capabilities to "objects" dynamically.
No, it isn't. Imagine doing this in a serious project.
>>
>>101440350
I won't pretend that it's a good practice, but it's so convenient. What issues do you foresee?
>>
>>101440374
>What issues do you foresee?
Besides the obvious one that it's unclear what member variables and methods your objects are supposed to have?
>>
>>101436298
4chan's /g/ board supports code snippets via code tags: https://www.4chan.org/rules#g4.

public class MostCommonWords {
public static void main(String[] args) throws Exception {
// Print the N most common strings in a given list of strings.
List<String> list = Arrays.asList("apple", "orange", "banana", "pear", "apple", "orange", "banana", "apple", "orange", "apple");

printMostCommonWords(list, 3);
}

static void printMostCommonWords(List<String> list, int limit) throws Exception {
List<Word> wordList = new ArrayList<>();

for(String string : list) {
boolean wordFound = false;

for(Word word : wordList) {
if(string == word.getString()) {
word.raiseQuantity();

wordFound = true;

break;
}
}

if(!wordFound) {
Word newWord = new Word();

newWord.setString(string);
newWord.setQuantity(1);
wordList.add(newWord);
}
}

Collections.sort(wordList);

int wordsPrinted = 0;

for(Word word : wordList) {
System.out.println(word.getString() + ": " word.getQuantity());

wordsPrinted += 1;

if(wordsPrinted == limit) {
break;
}
}
}
};

class Word implements Comparable<Word> {
String string;
Integer quantity;

String getString() {
return string;
}

public void setString(String string) {
this.string = string;
}

public Integer getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}

void raiseQuantity() {
quantity += 1;
}

@Override
public int ComapreTo(Word other) {
return -Integer.compare(this.quantity, other.getQuantity());
}
}
>>
>>101436298
>>101440397
And now for comments:

- Are the "throws Exception" really necessary?
- Qualify private members with "private"; otherwise they're package-internal.
- Multiple top-level types in a file?
- Declare initial capacity of the array list (I've set my IDE to always show me this as a warning).
- Comparing strings by reference is a dangerous game: Use
Object::equals
unless you're REALLY sure you want to compare by location in memory.
- Write a test suite (use JUnit Jupiter)
- Use Lombok
- If you really need to use
System.out::println
, try using it as close to the main method as possible.
- Use int over Integer unless you want to make use of null.
-
quantity++;
will do the same as
quantity += 1;


Book recommendation: Effective Java (3rd edition) by Joshua Bloch
>>
>>101440391
Not ideal, but if a given object has lots and lots of possible variants, you have to check which optional addons it is configured to have in any case, at which point you're on equal footing with tables, no?
>>
>>101440436
>Not ideal
It's not workable. You'll find out why when you come back to this code in 4 months.

>you have to check which optional addons it is configured to have in any case, at which point you're on equal footing with tables, no?
No, because normally you'd have usage idioms that distinguish between fields that all objects are supposed to have, and dynamic components as an artifact of having to implement some kind of component system instead of directly fucking with the core objects.
>>
>>101440492
>It's not workable. You'll find out why when you come back to this code in 4 months.
Sounds likely lmao. I always discover something, overuse it, and then regret my life choices. Warning appreciated.
>>
>>101440518
A general issue with dynamically typed languages is that you end up with a bunch of functions that give no indication what kind of arguments they expect, and it's hard to determine locally when it's not fresh in your memory and not explicitly documented. Messing with object fields dynamically makes it that much worse.
>>
>>101436499
Thats a good idea for a portfolio project, ima go steal It.
>>
>>101436508
Definitely.

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.counting;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;

public class CommonWordPrinter {
public static void main(String[] args) {
// Print the N most common strings in a given list of strings.
List<String> list = Arrays.asList(
"apple", "orange", "banana", "pear",
"apple", "orange", "banana",
"apple", "orange",
"apple"
);

for(String word : getMostCommonWordsIn(list, 3))
System.out.println(word);
}

static List<String> getMostCommonWordsIn(List<String> list, int limit) {
return list.stream()
.collect(groupingBy(identity(), counting()))
.entrySet()
.stream()
.sorted((a, b) -> -Long.compare(a.getValue(), b.getValue()))
.limit(limit)
.map(Map.Entry::getKey)
.collect(toList());
}
}


with a test:
import java.util.Arrays;
import static java.util.stream.Collectors.joining;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

public class CommonWordPrinterTest {
@ParameterizedTest
@CsvSource({
"'apple,orange,banana,pear,apple,orange,banana,apple,orange,apple', 3, 'apple,orange,banana'"
})
public void shouldGetMostCommonWords(String intialCsv, int limit, String expectedCsv) {
assertEquals(
expectedCsv,
CommonWordPrinter.getMostCommonWordsIn(Arrays.asList(intialCsv.split(",")), limit)
.stream()
.collect(joining(","))
);
}
}


but for beginner code, his is not too shabby.
>>
>>101440421
Thank you mr sir durgasoft
>>
File: remi.webm (180 KB, 800x450)
180 KB
180 KB WEBM
>>101437831
Post your coding arms.
>>
>>101439532
In sepples the rule of thumb is to not go over 4 parameters.
>>
File: 1718551786317638.gif (151 KB, 849x458)
151 KB
151 KB GIF
>>101440652
All in a day's work.
>>
>>101440712
>1100 Indians in the same room
Imagine the smell.
>>
>>101440647
Inefficient.
>>
>>101440391
you can't into abstraction.
>>
>>101440893
Your narcissistic mental illness and IQ of 80 makes you unable to learn what the words you use actually mean.
>>
File: wordswordswords.png (34 KB, 890x515)
34 KB
34 KB PNG
>>101436508
it can be short on the JVM
>>
>>101440920
I am serious, you cant into abstraction:
As a solution to your "problem" all you need is a tree with each layer having its own protocol which additions (branches) or the layer respect

In an actually good program these structures can be inserted by the user and then accessed by other programs

Sorry that you are a coping brainlet, not my problem though

Your level of stupidity is why linux failed by the way
>>
>>101440999
Your narcissistic mental illness and IQ of 80 makes you unable to learn what the words you use actually mean. When this is pointed out to you, you devolve into psychosis and start shitting out schizo word salad.
>>
>>101441092
>he couldnt even comprehend what i said
topkek

(You) may be a psychologist, but psychologisst are evil jews and i dont care what you say, by the way.
>>
>>101441131
Your narcissistic mental illness and IQ of 80 makes you unable to learn what the words you use actually mean. When this is pointed out to you, you devolve into psychosis and start shitting out schizo word salad.
>>
File: Yes, and.png (24 KB, 175x175)
24 KB
24 KB PNG
>>101440343
>I want to turn everything into a table
https://www.youtube.com/watch?v=XtAhISkoJZc

>>101440766
Pic related.
How would you like to optimise it?
By memory footprint? By CPU cycles?
I am curious, how you'd approach it.
>>
>>101440343
f <- function(pos, opt=2, opt2=opt+3, ...) { g(...); h(within(pos, x <- 5*x)) }
in R environments/tables/lists
are more first-class. The psychologist seems to be asking
us to narrate: it's not enough to transform key-value data,
the protocols have to be stated separately at the beginning.
>>
>>101441145
>How would you like to optimise it?
>By memory footprint? By CPU cycles?
>I am curious, how you'd approach it.
For starters, there is no need to sort anything.
>>
>>101441414
just have the struct be like a header containing only the two size fields, then have methods to get the pointers to the data fields based on the "this" pointer. Something like this:
https://godbolt.org/z/cvE6aojv1
>>
>entire day of class refactoring
kill me
>>
>>101440343
https://www.youtube.com/watch?v=aSEQfqNYNAc
>>
>>101441556
talk is cheap, show code
>>
>>101441761
Are you the same poster? You sound literally retarded. He sounded normal.
>>
>>101441646
Refactoring is great though.
>>
>>101441613
i phrased it extremely poorly, it was about getting the type of the member at compile time and then just doing offset math
something like this just works
struct mine{
int len_one;
int array_one;
int len_two;
int array_two; //type that will change in the future
};

//6 directories apart

int func(mine * m){
using arraytwo_member = decltype(mine.array_two*);
arraytwo_member * something = m->len_one + m->len_one*sizeof(m->array_one*);
//etcetc
}
>>
sizeof(m->len_one) *
>>
whatever i am fucking fried
>>
>>101441802
yeah but not when the code is dogshit to begin with
>>
File: 1702486281946032.png (14 KB, 800x600)
14 KB
14 KB PNG
>>101433089
/g/hu??????



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