old thread >>54165965
what are you working on /dpt/?
Can anyone explainthrow
in JS ? ELI5 mode ?
Any anons here familiar with encryption? I need a helping hand if anyone has the time.
I'm decrypting a byte array and comparing it to the original byte array I use in the beginning of the encryption process. The two arrays match up perfectly until the last 256 bits. From that position onward (array length - 256) they become different.
I was wondering if anyone else ever encountered this problem. I have a hunch that it may be related to padding, but I checked online and the padding being used in the examples I saw doesn't match the one I'm getting .
A fucking anime pic? That's totally irrelevant.
The real thread is here: >>54169474
>>54169492
Exception handling. Lets say you're a shitty developer who leaves errors in their code. You could fix it with better development or you could handle it with a throw exception and leave the program running.
ELI5: you know how something can crash your program at run time? This can allow you to catch that error and leave the program running.
>>54169498
This was first and your picture is even more irrelevant
Is JS a good first language or is Ruby a better choice ? If you had pick 1 of the two ?
>inb4 someone recommends C
>>54169533
>datastructures are totally irrelevant to programming
I bet you're one of those Ruby "rockstars"
>>54169555
Pick C
Yuuko a baka
>>54169555
haskell
>>54169555
if you're for some reason forced to choose one of the shit dynamically typed languages, go with js
ruby is a nicer language but it seems to be dying out
>>54169568
haha your thread got deleted faggot
>>54169555
C++
I would go with c++ then Ruby
Processing 100,000 anime releases for media info.
Just threaded my python program, it's downloading, decoding and analysing around 10-20 episodes per second on a 1gbit line with 8 cores.
Fucking beautiful.
>>54169608
I deleted it myself faggot
I don't want any Ruby "artisans" near my beautiful data structures
>>54169633
Aren't you the guy who analyzes episodes by taking only a small clip? What language are you using to analyze?
>>54169650
why would you use a bloom filter over a hash set? seems like the space efficiency isn't worth the loss of reliability
>>54169693
Say your browser keeps a list of known malicious sites and warns you if you're about to visit one of those. You can make the false positive risk really small (say 0.001%) and still save a lot of space.
>>54169495
What encryption algorithm are you using?
>>54169748
Please go and stay go.
>>54169764
I don't care much for Go.
>>54169748
Nice try NSA
Friendly reminder to filter ALL tripfags (no exceptions). They are one of the many cancers of this board and the easiest to eliminate. Above all, DO NOT RESPOND to them.
>>54169734
> You can make the false positive risk really small
that kind of thinking ruins innocent businesses
>>54169770
Nice try Bjarne but C++ is already obsoleted by Go
>>54169781
How to eliminate /v/?
>>54169734
why the fuck would you use a bloom filter for this
>>54169792
Go obsoletes nothing though.
It's pretty much the most pointless new language i can think I can think of in the last 20 years.
>>54169781
>Above all, DO NOT RESPOND to them.
Please respond, anon.
>>54169666
ffprobe does everything to with analysing.
I just download ~900KB at a time, and throw it into ffprobe with this in python:ffprobe = Popen(['ffprobe', '-v', 'quiet','-print_format', 'json', '-show_format', '-show_streams', '-i', self.TMP_DIR + 'anizb.{}.tmp'.format(os.getpid())], stdout=PIPE)
If it doesn't work, then another 900KB is downloaded, and thrown into ffprobe again (up to like 50MB, normally gets info by 2-3MB).
AMA
>>54169859
how is your tripcode 12 chars?
>>54169859
why did u betray geralt
>>54169792
Go is obsoleted by itself
What would be the pros and cons of taking the smallest allotment of cloud resources I have, spinning up an Ubuntu (any linux works) VM, and using that to hose a database (mySql, MongoDB, maybe postgreSQL), RATHER than hosting the database on the same server that host the rest of my "full stack"?
I'm guessing pros:
-If the "full stack" server goes down, the DB server won't
-This is probably what businesses do so it'd be practice for professional work
Cons:
-two servers means an extra failure point
-delay as packets go over network (can somewhat mitigate with ajax / threading)
-more work to set up an additional server
>>54169734
>>54169784
Yeah, it seems like the best use of a bloom filter is when a false positive is not actually bad. Wikipedia gives the example of figuring out how often a web page has been used. Say you only want to cache popular web pages. A bloom filter solution: every time a web page is hit, store it in a bloom filter. If a web page you're serving is already in the bloom filter (probably, false positives are possible), you know that the web page is somewhat popular. So you can save time in the future by caching the web page in some persistent storage. A false positive just means you cached a web page that didn't need it but who cares? It'll fall out of the cache when it expires anyway.
>>54169868
Typical of a BASIC programmer to have a mind so corrupted it can't even count properly, but succumbs to off-by-one errors that could easily have been avoided through the use of mathematical proofs of program correctness using the concept of invariants
>>54169914
A markov chain trained on Dijkstra?
>>54169914
why has your tripcode changed eddy?
>>54169914
What do you think about goto?
>>54169949
Because the faggot who coded my password manager did it in BASIC and drew penises everywhere
It's fucking useless
>coworkers stand behind you asking what you're making
>I'm making a data analysis program so increase effectiveness of our company
>that's so cool anon, are you using erlang?
>no.. I only know how to use the API provided in c#. I have a c# qualification® from microsoft though!
>their reaction when
>>54169992
is it ever ok to use GOTO, if only for cleanup routines in C?
>>54169990
>>54170015
GOTO hell;
>>54169748
TripleDES
Sorry for the late reply, I was AFK
>>54169901
dont do it over open network/internet, do on same hoster in same datacenter, many hosters offer "inhouse" closed networking so you dont need to expose your db to the interwebs
>>54169770
HAHA FUCK that was funny. I sure didn't see that coming.
Fuckin' tripfaggots are absolute garbage.
>>54170013
wow you are not using the fancy shit, instead you use something you are experienced and comfortable with which can get the task done anyway?
SHAME ON YOU!
w/e dont give a shit about these plebs, use whatever you like, try new things when you want it and only if you consider it worth the time
>>54170118
t. pajeet .net codemonkey
x = min(topLeft.x, topLeft.x + v.x)
y = min(topLeft.y, topLeft.y + v.y)
w = max(bottomRight.x, bottomRight.x + v.x)
h = max(bottomRight.y, bottomRight.y + v.y)if v.x < 0 {
x = topLeft.x + v.x
w = bottomRight.x
} else {
x = topLeft.x
w = bottomRight.x + v.x
}
if v.y < 0 {
y = topLeft.y + v.y
h = bottomRight.y
} else {
y = topLeft.y
h = bottomRight.y + v.y
}
Which one of these is better? The first is significantly more concise but has more branching.
>>54170131
pajeet only use VBA, no c#
>>54170013
>don't use C#
>use erlang instead
mmm
>>54170158
second one only has 2 comparisons, looks faster
but depends on language (and compiler if applicable) i guess
but im only pajeet dont trust me
>>54170025
I'm no expert, but in my past experiences, some encryption algorithms and libraries expect input data to be in a multiple of 256 or 512 bits or what have you, and may not handle other lengths very elegantly.
>>54170162
>>54170184
reminder to filter all shill tripfags
>>54170184
>I'm no expert
No shit. Get the fuck out.
>>54170196
thanks for the reminder.
>>54170196
reminder to yourself?
>>54170221
nice reply box
>>54170234
thanks
>>54170184
That's what the padding is for (I think). When the data gets encrypted it gets enlarged to a multiple of 8, I've seen this myself when I was debugging.
What confuses me is how it's correctly de-encrypting everything except those last few bytes.
>>54170158
#define min(c,v) (c > v ? c : v)
same thing desu
making bullshit assignments in python
>>54170300
But it's 4 branches instead of 2 and 4 additions instead of 2.
>>54170158
>The first is significantly more concise but has more branching.
Have you actually confirmed this? Gcc for example produces code with no branching (as in, conditional jumps that would require jump prediction, it uses cmovs) for the first function, and compiles three conditional jumps in the second function
>>54170385
Also, don't get hung up on branching, for predictable branches (which branches are going to be predicted with better accuracy knows only your cpu) the branching code may be faster than cmovs anyways. So, you can only tell which code is faster by doing actual benchmarks.
>>54170196
filter this, nerd
*unzips cross-platform, open-source .NET dick*
>>54170443
The only branching that I would be worrying about is ordering if else statements in the greatest possibility of being true. Otherwise, branching is one of the last things you should worry for because CPU designers have worked their butts off for optimizing for it.
Cache locality and size are more important, in my opinion, before you get to that point.
Do you try to formulate proofs before programming or do you go with your intuition and develop your understanding along the way?
>Embarcadero C++ builder
Should i bother?
>>54170563
depends on the problem. Often scribbling out how i expect my stuff to work visually on paper helps me see any potential problems or see the best way to write it.
>>54170563
lel, what kind of things are you trying to prove?
>>54170563
would be kind to not post anime in this thread?
thanks a lot, bud!
regars,
bill
>>54170629
Sure thing, dearest familams.
I was watching this video about Source2 and Half Life 3 https://www.youtube.com/watch?v=g2igP0jguSc
In the video, the guy says that from various DLLs packaged with some source2 VR demo they were able to get all sorts of code including variable names. Now perhaps I'm just ignorant, but I didn't think that any sort of dll disassembler would be able to restore variable names or anything like that (unless it's some object string type thing that would translate cleanly). Does anyone know how they go about doing things like this?
>>54170663
Variable names, no. Class names, yes
>>54170663
Maybe they left debugging information embedded.
>>54170955
>>54171022
yeah I'm thinking it was class names for gdb or whatever
Valve also appears to have info like this embedded in their game files that is just plaintext, perhaps just this
>>54171022
no, it's rtti and strings search
>>54171066
For TF2 specifically, I know Valve have their HUD files and some of their weapon files in plaintext as well.
>>54171077
How do you access that info though? I guess there's a whole world of reverse engineering stuff that I just do not know about
>>54171115
Yeah that file is from the TF2 files
atom is not rendering anything other than tabs
has this happened to anyone else?
>>54171129
>How do you access that info though?
Strings are just that: uncompressed plain text embedded in the binary, it can appear if for example you have a code that compares the name of a variable from a config file to a certain const string value - the name can end up as plain text in the binary unless you specifically take precautions against that.
The other thing is the byproduct of enabling rtti: class names with links to their virtual functions tables and some functions names end up in the binary too. Linking the actual disassembled functions to the class it belongs to takes a couple extra steps, but there are scripts that do that, like this one for IDA: http://www.openrce.org/downloads/details/196
why isn't this out yet reee
>>54171541
fuck is a theory
is there a library for theory
>>54171541
>89 didgeridoos for a book
>>54171563
That's cheap compared to some of the books in higher learning these days.
>>54171577
is it even any good though? is the second edition good?
>>54171582
it has mostly positive reviews. Or you could check out if it's good for your own taste/needs yourself, it's on libgen
>>54171662
>libgen
woah i didn't know this was a thing
there's also some sikrit club meme with that kind of stuff that i forgot the name of
>>54170160
>C# is the smarter language
if pajeets love java, what makes you think they can't into C#?
Csharts are literally codemonkeys
>>54172154
Why do people get so jealous over C#? It's not hard to learn.
>To Isabel and Leila, the two most extraordinary people I’ve ever met. May your pixels
never be little squares.
Anyone has the actual solution to averaging two numbers in C? The challenge has been meme-posted since November 2015 and I'm interested now.
>>54172249
Aren't all actual solutions patented?
>>54172249int average(int a, int b) {
return (a >> 1) + (b >> 1) + (a & b & 0x1);
>>54172220
It's just one guy that's been spamming /dpt/ since the last thread. Probably an underage NEET, ignore him.
>>54172220
we're not jealous
it's just that Csharts are so fucking smug and delusional about C# supposedly being better
imo C# is completely pointless except for certain ".NET stack" and CRUD type shit, C# is redundant when you have java and C++
several hours wasted on getting this stupid gif to work in wpf... it works now though
>>54172383
It's always Java programmers. Maybe it's just the same guy who feels the need to spam every month or so.
What's your favourite feature of C# 7.0, /dpt/? Probably pattern matching for me.
>java programmers talking shit about C# programmers
top lel
How do I distinguish between a pointer to an array and a pointer to a pointer?
I.e., I think you're supposed to define main like thisint main (int argc, char *argv[])
which can also be written asint main (int argc, char **argv)
but now that I'm working with binary trees, I need a pointer to a pointer, for working with my insert function for nodes - I've defined it asvoid insert (int key, node **n)
but won't this technically yield an array of nodes, as it does withchar**argv??
>>54172425
>C# programmers talking shit about java programmers
k tard
>>54172436
C# programmers on /dpt/ are pretty polite actually. It's always Java programmers who literally come out of nowhere and start talking shit about C#. I don't talk shit about Java because I have nothing to prove.
>>54171662
well it has a ton of general, basic 3d graphics stuff, which in itself looks alright but for a "physically based rendering" book it's mostly just filler, i was expecting it to be more specific
Question:
why do people do thisassert(buffers != NULL);
when its the same asassert(buffers);
?
maybe for clarity?
the same goes when iterating in a linked list
while (node->next !=NULL) {
// code here
}
instead ofwhile (node->next) {
// code here
}
>>54172404
it most certainly is. Very similar messages. I thought at first that wasn't him since >>54172009
he mentions java somewhat unfavourably here, and that guy seems to adore java and it hurts him that c# is a better designed, more feature-rich and more actively developed language. But his real feelings got through here: >>54172390
>about C# supposedly being better
>when you have java
>>54172456
>C# programmers on /dpt/ are pretty polite actually
says the newfag, there's still the occasional anti-java memeing going on and it used to be much worse, some of it being intentional baiting but still
>>54172498
>>>54172009
>>>54172390 (You)
believe it or not but there's more than one person who writes in lowercase on 4chan
>>54172527
this
it's a pretty common thing
>>54172505
not liking Java is not the same as random only claiming all Java programmers are retarded monkeys, which is what I'm talking about.
Honestly when i say java programmers I think i just mean you personally. Seems like it's just you who keeps freaking out every few weeks here about someone saying they don't like Java.
Compared to a lot of langugaes I like Java. When I need to use it I use it. I prefer C#. I like other langugaes even more.
for (i = 0; i < SIZE; i++)
{
Cout << "Enter input: ";
Cin >> ws;
Cin.getline(dept[i], LENGTH); //here's my issue
Cout << dept[i];
}
How the fuck to use an array with getline? I want to store the entire line including white space into my variables.
>>54172505
>says the newfag
It's true, though. C# is the best language so it has the best users.
>Because binary trees have log (base 2) n layers, the average search time for a binary tree is log (base 2) n. To fill an entire binary tree, sorted, takes roughly log (base 2) n * n.
what did he mean by this?
seriously, why are there no units? I'm missing something fundamental here.
>>54172590
n = number of units, data, whatever
If you have an array of 10 elements, n = 10
if you have a tree with 10 elements, n = 10
so finding an element of a tree takes log2(10) for the worst case
If you have 500 nodes in your tree, you will only have to check log2(500) of them before getting to what you're searching for
>>54172669
must be lonely being literally the only person who thinks Java is better than C# in /dpt/
#include <stdio.h>
#include <math.h>
#define NUM 600851475143
int isPrime(long int n)
{
for(int i = 2; i <= (int) sqrt(n); i += (i % 2) + 1)
{
if(n % i == 0)
{
return 0;
}
}
return 1;
}
int main(int argc, char *argv[])
{
long int max;
for(long int a = 3; a <= NUM / 2; a += 2)
{
if(!isPrime(a))
{
continue;
}
if(NUM % a == 0)
{
max = a;
}
}
printf("%ld\n", max);
return 0;
}
Doing problem 3 on Project Euler, but my solution is slow as fuck. Critique
https://projecteuler.net/problem=3
>>54172585
I LOVE c#. I employ many c# users. They write the best code!
>>54172701
It's gonna be yuge.
>>54172686
stay delusional
>>54172689
try reading and implementing this one, it's simple: https://en.wikipedia.org/wiki/Trial_division
The type provider 'FsXaml.XamlTypeProvider' reported an error: The file exists.
not having a great day in F# land...
>>54172425
>being a java or C# programmer
kek
>>54172689
also, check out hackerrank - they have project euler tasks as a contest, where you can submit and run your code through a bunch of test cases.
>>54172755
this, i hardly even use java any more, just for convenient android cancer, although i think i'll use java during most of the development of my next game for quick prototyping
>>54172820
>i think i'll use java during most of the development of my next game for quick prototyping
but not "enterprise" java, just shit that can easily be rewritten to C++
can this be optimized?import Data.List
pentagons = map (\n -> n * (3*n - 1) / 2) [1..]
pj xs = [(x,y) | x <- xs, y <- xs `after` x, (x + y) `elem` xs, (y - x) `elem` xs ]
where ys `after` y = let Just d = y `elemIndex` ys in drop (d + 1) ys
If formatting a shit, read @ http://0x0.st/ZLx.hs
pj (take 1000 pentagons) take 8.7 seconds
>>54170563
I use TDD
let fact n =
let rec loop accu = function
| 0 -> accu
| n -> loop (n * accu) (pred n) in
loop 1 n
;;
let unit_tests = [
0, 1;
1, 1;
2, 2;
3, 6;
4, 24;
]
;;
type ('a, 'e) result =
| Success of 'a
| Exception of 'e
;;
let test_unit_test (n, expected) =
let result =
try
Success (fact n)
with
| ex -> Exception ex in
match result with
| Success res ->
if res <> expected then
failwith (Printf.sprintf "got %d, but %d expected" res expected)
| Exception ex ->
failwith
(Printf.sprintf "raised execption: %s" (Printexc.to_string ex))
;;
let main () =
List.iter test_unit_test unit_tests
;;
let () = main ();;
>>54172848
Yes. Use C.
>>54169593
This.
Also Nichijuo was as comfy as C#
>>54172985
too obsolete
holy fuck what is up with the topcoder servers. 3.2 gb download just fucking stopped (no resuming for some reason, even though pausing while it's alive works) for the second time with 0.4 gb left. I have a fucking adsl, i don't have time for this shit. I really thought that it was going to be my laziness and ineptness that will stop me from submitting to this contest, not the inability to download the fucking test data. Is anybody maybe seeding this https://www.topcoder.com/contest/problem/DNASequencing/exampletest.zip ?
>>54173026
>C
>obsolete
Haskell will disappear before C
This code loops forever. Can someone explain what's wrong?(defun shuffle (l)
(do* ((old-list (copy-list l) (delete (nth index old-list) old-list))
(new-list nil (push (nth index old-list) new-list))
(len (length old-list) (length old-list))
(index (random len)))
((zerop len) new-list)))
>>54173049
wait I forgot to update the index
for some reason I only noticed it when reading it on here
>>54173047
>Haskell will disappear before C
The only reason this is true is that C was like cancer. It got into everything (malignantly, I might add) even though better languages already existed.
>>54172320
That'll only give you half of the average you fucking mong.
>>54173116
true but haskell is not one of the better languages
>>54173116
No. C is just almost perfect. Most used language in the world. No evolution since the first spec. If it was shit, there would be evolution to fix them. But every choice was correctly made. Two things are missing from C, parametric types and lambda expressions.
>>54171285
>>54171285
Thanks you, this is very interesting to me
>>54170158
>Which one of these is better?
Almost impossible to say just by glancing at the code these days due to compiler optimizations, where the code is executed (udner what pre/post conditions, how often, etc) and what kind of cpu you have/are targeting
Only way to be sure is to measure it under real work loads.
>>54173149
>evolution
C++
java
>>54173149
>C is just almost perfect.
Top funny.
>No evolution since the first spec. If it was shit, there would be evolution to fix them.
There's been no evolution because anything else would ruin legacy code. It's the same reason that Fortran 90 was such a shocker to many -- a very large departure from what Fortran 77 was capable of.
>>54173149
and strings
and booleans
and smart pointers
>>54173187
and constexpr
>>54173129
>knows nothing about haskell
>talks shit about it
I feel like creating a small top-down game using sfml.
Any (e)books on game engine architecture?
>>54173187
>strings
char *
>booleans
int are enough
>smart pointers
pointers are far enough
only code monkeys need smart pointers
>>54173149
>No evolution since the first spec.
Except for structs, unions, floats, short-circuit conditionals, initializer lists, enums, prototypes, const, variadic macros, C89, C99, C11, etc.
>>54173246
Those evolution are just small syntax evolution.
It never change something.
>>54173241
>char *
NOT REAL STRINGS! WILL NEVER BE REAL STRINGS!
>>54173293
char * is perfect. Only code monkeys need something else.
>>54173256
>structs
>unions
>syntax evolution
Yeah, except that Thompson tried to kill himself after attempting to write the early versions of Unix without structs. Ritchie had to cut the rope and carry his fat ass down.
>>54173320
Sorry, my fault. I should have said since C89.
>people unironically program in C#
do they do it to make people laugh?
>>54173149
>If it was shit, there would be evolution to fix them.
How can you call yourself a programmer when you don't even grasp logic.
>>54173416
C++ made terrible design choices. So they have to fix (workaround) them. Move semantics was introduced because calling copy constructor for everything was a stupid design choice. C doesn't need move semantics because it doesn't need it. It was properly designated.
>>54173350
None, I don't sue it.
Why isfunction foo() : String
the norm in all the new statically typed languages for functions/methods instead of justString foo()
?
To me it makes no sense. I thought new languages were trying to get rid of the verbosity.
>>54173410
They do it to get paid.
>>54173464
>le enterprise meme
>>54173440
You're arguing in circles.
>>54173476
That may well be the case, but the fact is that the majority of programming jobs today require use of C# or Java.
Anybody know how I can get a low-level position as an Android developer? I've been hobby coding in Android for over a year, and have a good reputation on Stack Overflow assisting others with it. I chill in the official Android dev IRC and believe I'm at least a decent candidate for a basic position.
Ideas? I've hunted like crazy but can't find a proper position. Looking for a small tech startup or similar.
>>54173491
name all the commercial programs that use c#
>>54173499
self-em-ploy-ment
>>54173502
Unity, for starters. One of the most widely used game engines in the world.
>>54173502
I can't, there's too many.
>>54173485
Yes I should argu with C haters. They suck at programming.
>>54173502
Name all the commercial programs that use C.
>>54173499
have you tried asking in that irc channel? maybe you could team up with someone there
>>54173448
Pascal and related languages do it that way so types can be parsed more easily.
New languages probably do it because Haskell is the cool meme right now.
>>54173521
Almost any embedded devices.
>>54173522
I've considered that sort of thing, but since the IRC is exclusively devs, there aren't likely to be business owners in it looking for new hires.
>>54173540
NO I WANT PROGRAM NAMES, VERSION NUMBERS AND ALL NAMES OF THE DEVELOPERS IN ASCENDING ORDER
>>54173447
use**, rather. But I'd probably not sue them, either.
>>54173515
nice meme
>>54173518
>has a plethorah of options >>>>>>>>>
>can't find one good one
I'm waiting
>>54173526
It comes from operational semantics with type systems
>>54173556
linux 4.5.2
Author: Greg Kroah-Hartman <[email protected]>
Author: Liviu Dudau <[email protected]>
Author: Alan Stern <[email protected]>
Author: Benjamin Tissoires <[email protected]>
Author: Kailang Yang <[email protected]>
Author: Dennis Kadioglu <[email protected]>
Author: Takashi Iwai <[email protected]>
Author: Sven Eckelmann <[email protected]>
Author: Hyungwon Hwang <[email protected]>
Author: Adrian Hunter <[email protected]>
Author: Adrian Hunter <[email protected]>
Author: Yang Shi <[email protected]>
Author: Filipe Manana <[email protected]>
Author: Joerg Roedel <[email protected]>
Author: Theodore Ts'o <[email protected]>
Author: Theodore Ts'o <[email protected]>
Author: Filipe Manana <[email protected]>
Author: Miklos Szeredi <[email protected]>
Author: Miklos Szeredi <[email protected]>
Author: Theodore Ts'o <[email protected]>
Author: Miklos Szeredi <[email protected]>
Author: Miklos Szeredi <[email protected]>
Author: Martin K. Petersen <[email protected]>
Author: Irina Tirdea <[email protected]>
Author: Irina Tirdea <[email protected]>
Author: Irina Tirdea <[email protected]>
Author: Arnd Bergmann <[email protected]>
Author: Irina Tirdea <[email protected]>
Author: Nicolas Pitre <[email protected]>
>>54173569
You asked for all of them. I can't possibly find all of them, because not all of them are publicly available.
>>54173569
>nice meme
undisputed facts are memes now?
>>54173588
>Irina Tirdea has 4 mentions
Truly C plebs can't even implement a unique set data structure.
>>54173588
kek, whole list is 5 people copied multiple times
Working on pset3 of CS50.
We're implementing any O(n^2) sort method and binary search. I got Insertion Sort to work but Binary Search is giving me problems.
Just one little fucking bug until it passes check50. What am I doing wrong?
>>54173605
>unique set data structure.
Not in the requirements.
>>54173623
But anon if you do it like that you're post is gonna overflow my memory banks.
>>54173607
Actual whole list is thousands of names, wouldn't fit in a single 4chan post.
>>54172480
Bc they are dumb cucks
Java is superior to all other programming languages. You are a shit programmer if you disagree with a guy with a phd in computer science. Plebs all of you
>>54173750
A PhD from where, though?
Also, a PhD only means you're educated, not necessarily smart.
>>54173750
>my subjective opinion is objectively true
>>54171558
le devilution
>>54173750
>phd in computer science
>computer science
>java
are you sure you didn't get it in SE and your brain is just full of poo?
im done working for today goodnight desu
>>54173750
Just learn some more languages anon. It's really not that hard. Liking any language this much is pretty retarded.
>>54173828
By 'phd' he means poo-holder DESIGNATED'
>>54173448
Isn't it so that it can be dropped, e.g. for inference support? it's cleaner in that case.
>>54173448
because they are retarded.
>>54174031
Sounds like most PhDs tbqh
>>54173659
this
>>54174238
>>54174218
which one do you prefer?
>>54172480
Because there are languages that don't handle pointer comparisons with boolean logic and the writing style carries over.
>>54174244
whatever you like desu
>>54172480
Not every piece of code you see is the right way
>>54174289
the linux kernel is full of things like this
i think its because of clarity and being maintainable etc etc
>>54172480
For asserts I prefer the former because of the way asserts usually stringify the expression so you see it as != NULL in the log.
But for other code I use the shorthand with automatic conversion to true/false.
>>54172480
because your job is to write neat, readable code and its the compilers job to optimize it. if you can gain readability at no cost then it's an obvious do.
Learning about binary trees in C
The prof's code looks like this:void insert ( int key, node **leaf ) {
if ( *leaf == 0 ) { /* one star next to leaf dereferences it once, sending it to the pointer of the node, without potentially accessing an unitialized node */
/* found an empty node, puts one there */
*leaf = (node) malloc( sizeof(node) );
(*leaf)->left = 0;
(*leaf)->right = 0;
}
else if ( key < (*leaf)->key_value ) {
/* node is already here, recursively moves left because key given for the new node is smaller than the node we're at */
insert( key, &(*leaf)->left ); /* note the use of the address operator next to the pointer *leaf - essentially, it's a double pointer */
}
else if ( key > (*leaf)->key_value ) {
/* node is already here, recursively moves right because key given for the new node is larger than the node we're at */
insert( key, &(*leaf)->right );
}
But I'm wondering, isn't the double pointer unnecessary? There's never a case where something gets double-dereferenced, I don't think.
I experimented with this and madevoid insert ( int key, node *leaf ) {
if ( leaf == 0 ) {
leaf = malloc( sizeof(node) );
(leaf)->right = 0;
(leaf)->left = 0;
}
else if ( key < (leaf)->key ) {
insert( key, (leaf)->left );
} else if ( key >= (leaf)->key ) {
insert( key, (leaf)->right );
}
}
which seems to work just as well, but I'm wondering if I'm actually doing something terribly wrong.
>>54174522if ( leaf == 0 ) {
leaf = malloc( sizeof(node) );
(leaf)->right = (leaf)->left = 0;
}
>>54173612
Can you screenfetch for me? Is thtat XFCE? May I know the theme?
Hey guys I want to make a website to "generate" memes but using a full stack nodeJS or maybe Rails, I'm no JS ninja so I'm still looking at various frameworks to pick the best one I checked the domain memizr .io is free and I'm looking for a partner / another code artisan (you don't need to be a 10x) to join me in this enterprise. anyone interested?
>>54174541
>memes
>JS ninja
>code artisan
kill yourself
>>54174541
You forgot to mention cloud computing, and neural networks.
So I am going to re learn C because I have been learning it in a terrible book and now I got K&R C.
Anything else I should read, I don't know yet how to implement my programs into actual computing.
>>54174522
Yes it's not optimal. Production code is much more lean. I guess he's just trying to teach you about double pointer arithmetic but couldn't find a suitable example.
>>54174541
>"generate"
>memes
>nodeJS
>Rails
>ninja
>code artisan
>10x
>join me
You could have added a lot more stuff. But this is a good effort.
>>54174619
you have 1 minute to implement a single linked list , fill it with random numbers and then remove the element in the middle
>>54174640
Yo, like I said still learning, plus I need to piss lmao
>>54174661
xD
topkek
epik /b/ro
>>54174669
I don't get on /b/ :/
I like this environment because I can see how others learned and what not.
Which NODE.js fork is the most async?
>>54174536
>>54174623
But there's nothing wrong with my version? There isn't some kind of increased chance of accessing memory that hasn't been allocated to the program?
Incidentally, what would be the optimal insert function?
Also, what do you mean by production code?
>>54174686
https://github.com/caolan/async
>>54174522
leaf still points to e.g. nullptr outside the scope of your function, not your prof's.
>>54174537
>>54174781
thanks man!
>>54174557
>people eat obvious bait
ahahaha oh wow
>>54174781
what xfce version do you have ?
>>54174721
>there's nothing wrong
Nah you're good.
>increased chance
Memory isn't allocated by chance.
>what would be the optimal insert function
Not doing your homework, son. Once you're done with the exercise, try to create a completely new test program and design it so that the insert function actually takes the root node only, not subnodes too. Manipulating the tree directly is bad practice.
>production code
Something that won't get you fired if someone quality checks it.
Which is best?
1val m: Map[Id, Coord] = xs.map { case (x, y, z) => x -> Coord(y, z) }(collection.breakOut)
2val m = xs.map { case (x, y, z) => x -> Coord(y, z) }.toMap
3val m: Map[Id, Coord] = xs.map(e => e._1 -> Coord(e._2, e._3))(collection.breakOut)
4val m = xs.map(e => e._1 -> Coord(e._2, e._3)).toMap
>>54174836
the shorter
>>54169459
Which should I read first, SICP or K&R? I have some very limited prior experience with programming, but wouldn't call myself a programmer yet.
>>54174721
>But there's nothing wrong with my version?
Aside from the fact it leaks 100% of allocated memory, no.
>There isn't some kind of increased chance of accessing memory that hasn't been allocated to the program?
No. There is a 100% chance of dereferencing the null pointer though.
>Incidentally, what would be the optimal insert function?
Your prof's.
>Also, what do you mean by production code?
He means he literally can't write a valid fizzbuzz in C.
>>54174993
SICP
Learn to program before learning to code
>>54175015
Thanks.
number = $00 ;32 bit - number to be inverse square-rooted
y = $04 ;32 bit
i = $08 ;32 bit
Q_rsqrt:
;"John Carmack"'s fast inverse square-root algorithm
;Adapted for the 8-bit 6502
;Params: number
;Returns: i = 1/sqrt(number)
lda number+3
sta y+3
lda number+2
sta y+2
lda number+1
sta y+1
lda number+0
sta y+0
lda y+3
lsr
ror y+2
ror y+1
ror y+0
;(evil floating point bit level hacking not necessary)
lda $DF
sec
sbc i+0
lda $59
sbc y+1 ;what the fuck?
sta i+1
lda $37
sbc y+2
sta i+1
lda $5F
sbc y+3
sta i+3
;I'm not writing a 32-bit floating-point multiplication routine
;for a CPU whose ALU doesn't even have multiplication opcodes,
;so no Newton's Method
rts
>>54175029
Don't force yourself to get through all of it before going on to other texts or languages(although it's great if you can). You can always come back and finish it later.
Pajeet here ask me anything
>>54175123
What library/framework should I use for writing GUIs in Java?
Thue interpreter in Nim: https://gist.github.com/anonymous/d8e2487114c9bab593c2401d2a40bf04
>>54175142
JavaFx
>>54175142
The suicide framework. I hear it will make your dev experience into heaven.
>>54175166
What's wrong with Swing?
>>54175123
do you poo in the loo?
>>54175181
JavaFx is newest one and more modern compared to Swing which is more older and a lot of companies are moving over to JavaFx but still a lot use Swing. In all honesty it doesn't really matter same with picking a programming language they are all pretty much the same
I'm starting to learn C and it seems pretty good so far, I'm coming from java and a lot of things seem similar.
>>54175220
Does anyone know any good resources for learning C?
>>54175261
Also fuck everyone who says java is a meme language, at least you don't have to define strings as arrays of characters
>>54175325
>At least I, Pajeet, don't have to think like a computer?
>>54175325
this is the cost of extra speed anon
>>54175325
OK pajeet
>>54175325
Excuse me, it's a null-terminated byte array
You have 10 seconds to post something YOU created that's actually fucking useful (not your 2000 fizzbuzz programs).
Protip: you can't
>>54175364
I don't know if it's worth it, it's painful.
>>54175392
>I swear to god I don't want to copy people's original code and ideas
>>54175392
I wrote a distributed computing system that calculates insurance reserves but I'm not fucking giving it to you
>>54175392
I created a desktop app. It's been downloaded 200,000 times. I charge for commercial use. Just got paid $800 this week for a few licences from one company.
>>54175409
Why would I though? I already have a ton of those (unlike you fags)
>>54175392
Probabilistic Model Checker using a distributed model instead of a monolithic one.
>>54175405
Now you know why C isn't used unless it's absolutely necessary.
>>54175425
Ooh what is it?
>>54175423
>distributed computing system
nice buzzword pajeet, what have you actually written?
>>54175428
Name 3 things you've made
>>54175392
>You have 10 seconds to post something YOU created that's actually fucking useful (not your 2000 fizzbuzz programs).
Uh, it can do math. That's useful, right?
>>54175443
not going to say. It's productivity related.
>>54175441
good goy, more abstraction, less effort for programming, more women and minorities into STEM
>>54175475
>less effort for programming
This is pretty much the goal of all programming langugaes.
>>54175446
What is the problem with java?
>>54175494
Nothing wrong with java, just your pajeet-tier buzzword spouting.
>>54175488
LADIES AND GENTLEMEN, I GIVE YOU PAJEET
>>54175261
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md#c
>>54175509
You know I'm right though.
>>54175494
“Our optics is the most turnkey thing at our company. Do your best to re-imagine it."
>>54175494
verbosity is probably the biggest one imo.
>>54175519
Come back when you can abstract low level development pls
I'm very new to python, so I hope I can explain my problem in the right terms.
I have 20 lists with 8 elements in each list.
I put these 20 lists inside a new list (which I name lista).
I want to create a new variable, which should be one of the lists.
I want user input to choose one of the 20 lists. I ask the user to write one element that is inside one of these 20 lists. If the user's input is inside one of the 20 lists, that is the list that should be selected. If the user write an input which doesn't exist, it should ask the user again for an element.
this is how my code looks atm :
number = len(lista)
inp = input("write an element that's inside one of the lists: ")
for i in lista:
if inp not in i:
number += -1
elif inp in i:
print("bravo!")
new_variable = i
while number < 1:
print("element doesn't exist")
inp = input("write an element that's inside one of the lists: ")
number += len(lista)
I've come up with a dozen of similar codes, but not a single one that works... any ideas what I can do? been stuck for hours.
>>54175502
I didn't really know what else to call it, it distributes work between multiple computers to perform the calculations faster.
Is there a better word for that?
>>54175559
you mean portable assembly?
>>54175494
There are no good VMs, they're all insecure monstrosity. The memory model is absolute dogshit and ends up taking easily 10x+ as much memory as required for a task. It's also verbose as shit and not even consistent. It doesn't support features languages have had for decades but still tries to. It's also way slower than C (which only matters because it sucks at literally everything else), and JNI is a joke.
>>54175546
ATS
>>54175576
Oh well, at least it beats interpreted meme languages and it's nice to use.
>>54175597
The only thing it beats is python. Literally everything else, including fucking javascript and php, is better.
>>54175597
The biggest problem is that C# exists, which is the better option for just about everything you might want to do with Java. Unless there's a specific Java library you need with no good alternative on C#.
>>54169555
Learn Lisp instead. Either Scheme/Racket or Common Lisp.
>>54175392
I made this reference guide for x86 assembly awhile ago, but it's missing a ton of instructions and is generally pretty featureless
Might actually work on it now that I'm thinking about it
new thread >>54175632
>>54175641
Dumbass
>>54175646
Dumbass
>>54175624
What makes C# a better choice?
>>54175392
I wrote an image viewer that can tag your shit and search for it. I think it's useful.
>>54175680
It's basically java without the broken stuff.
Working generics
structs
properties
unsigned integers
pointers
easy interop with native code
Better tooling
lambda's and enums are part of java recently, but have been in C# forever. I believe the Java versions have some caveats that the C# versions don't.
>>54175680
Linq for one. It's nowhere near as memory hungry and is somewhat less verbose. It's also a lot more consistent, where everything's a proper class instead of muh primitive v.s. class shit which is incompatible with generics. It also doesn't do type erasure to the point that generics can't tell whether the argument being passed is actually supported.
Also, C# has shit like properties, actual unsigned, unmanaged segments, properties, and actual meaningful class keywords instead of just the basics.
I'm having a really hard time coming up with project ideas /g/. I was thinking about possible writing my own imageboard software but apart from that I'm honestly at a loss.
Suggestions for good beginner/intermediate projects?
>>54175781
make a game
>>54175760
>>54175750
Ugh I guess I have to learn C# now then as well since it does sound better
>>54175149
I did a thing!
>>54175920
pretty much. What kind of stuff are you trying to make?
C#'s strong points are Windows UI apps, games, databases, web sites and mobile app development. It's good for other shit too, but particularly good at those.
I am currently using my massive Java textbook as a door stopper right now. What do you guys think about this?
>>54175960
Such a waste of good fire starter.
>>54175970
I read through the entire book and done all exercises in it and now it's useless to me
>>54175781
Then do it and keep us updated
>>54175946
I don't have any specific goals or projects in mind, I just want to learn some new languages and expand my skills.
Working on a CRDT[1] library in OCaml (tested with Quickcheck!)
I've already implemented the most basic data types,
both in mutable and immutable versions. They are all
state-based for now.
You can find the code here: https://github.com/ergl/crdt-ml
I'm now fighting with QCheck generators, which seems
to be the most active Quickcheck implementation in OCaml.
It still needs a lot of work so if anyone wants to contribute
I'll be happy to help:
- Implement graphs and sequences, maybe WOOT
- Add deltas
- Add network replication
- Add a javascript-usable version with js_of_ocaml
Feel free to ask any questions
[1]: https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type
>>54176023
I know some of those words
>>54169784
>>54169907
Bloom filters are useful because they tell you with
100% confidence if something is _not_ the set.
If you get a positive, you'll always have to check
the real truth source. They're useful as a proxy for
your real database, and have a lot of latency and
execution time advantages over dbs, even more
so if you have a lot of replicas around your network.
>>54176023
>GPLv3
Change it to LGPL at least, otherwise it's unusable in 99% of cases while not actually helping you in any way in terms of dev contributions.
>>54175920
>Falling for shills memeing on you
>>54176023
>unironically using ocaml
my nigga
>>54176011
I once heard someone say, that to a programmer should know at least one dynamically typed langugaes, one statically typed language and one functional language. And then they'll know all the major programming paradigms. I think that's a pretty good principle to go by when learning new languages to expand your skills. Once you know one of each well, all other languages will be pretty easy to learn after that.
>>54176103
I don't really understand why I would ever need to use a functional language but I'll look into them if I have time whenever I'm done with these
>>54176174
because the good ones save you time. I pretty much exclusively use F# these days for personal stuff.
>>54175802
what's the best language to make a non meme game in anyway?
not java
>>54176195
For indie shit? C#
For AAA shit? C++
>>54176203
how does c# handle something procedural? does it leak memory? i've always heard it's a resource hog
otherwise i am learning c++ so I'm glad to hear that
currently trying to wrap my head around calling functions
all I want to do is make sweet programs for lads
>>54176094
not (in) the set*
>>54176042
The wiki article linked does a pretty good job at explaining, otherwise you can find some papers on the topic on the project readme
>>54176098
you're right, I didn't think too much about it, current license is not set in stone
>>54176100
You know it. I honestly like it more than Haskell, and with modular implicits I'll never miss typeclasses. Multicore is still a problem though
>>54176327
>Multicore is still a problem though
>>54176287
>how does c# handle something procedural?
What do you mean exactly? C# is garbage collected, so it doesn't leak memory ever.
C# is a little slower than C++, but it's perfectly fine for simple indie games.
Bastion, Transistor, Fez and Axiom Verge among others are 100% C# with monogame.
Kerbal space program is mostly C# on top of Unity.
>>54176342
Just use Lwt, Async or even Threads and Unix if you really need to run functions in the background. OCaml is not the only language with bad multicore support, just look at javascript
Have anything else to add but bad memes?
>>54176438
>OCaml is not JavaScript
>Therefor it's good
You hear some of the most illogical nonsense on /dpt/ sometimes.
Didn't ocaml get real multicore support in january? Or did that not work out?
>>54176489
didn't imply that it was good thing, I even acknowledged that it's the main pain point in OCaml right now. But it's not the thing holding back the language that's for sure.
Multicore is still being developed, but has been pushed to the next release
>>54176521
ah i see.... lol
F# still one top then.
>>54176562
no worries, I would use F# in a heartbeat if I had to develop for Windows. Type providers are a really sweet thing
>>54176585
F# is great on linux and mac too these days. You even have a pretty nice MS supported IDE with Visual Studio Code. But emacs and vim have good F# plugins too.
>>54176438
>Have anything else to add but bad memes?
>>54175392
http://www.nask.co
my biggest project... ;_;
>>54176438
Concurrency is not multicore, but anyway the great majority of tasks don't need multicore and there are multicore solutions for ocaml (i.e. multiprocessing or calling to C code).
>>54176596
Does it still perform literally worse than python?
>>54176768
no. That never happened
>>54176846
In 2013, mono literally performed worse than python on average.
>>54176906
bull
>>54169459
Writing a REST api because android can't directly access mysql databases.
>>54176691
>http://www.nask.co
http://nask.co/L/b2Zo6D75rD
Nice project, m8.