[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 25
File: maxresdefault (1).jpg (97 KB, 1920x1080) Image search: [Google]
maxresdefault (1).jpg
97 KB, 1920x1080
old thread >>54165965

what are you working on /dpt/?
>>
Can anyone explain

 throw 


in JS ? ELI5 mode ?
>>
File: 1442017894229.png (160 KB, 600x839) Image search: [Google]
1442017894229.png
160 KB, 600x839
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.
>>
File: vomiting-guy.jpg (39 KB, 600x450) Image search: [Google]
vomiting-guy.jpg
39 KB, 600x450
>>54169625
>C++
>>
File: 2000px-Bloom_filter.svg.png (83 KB, 2000x718) Image search: [Google]
2000px-Bloom_filter.svg.png
83 KB, 2000x718
>>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.
>>
File: Capture.png (8 KB, 864x140) Image search: [Google]
Capture.png
8 KB, 864x140
>>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
>>
File: 1455297682398.gif (4 MB, 444x250) Image search: [Google]
1455297682398.gif
4 MB, 444x250
>>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.
>>
File: Kumiko as Programmed in Java.jpg (43 KB, 796x804) Image search: [Google]
Kumiko as Programmed in Java.jpg
43 KB, 796x804
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
>>
File: flat_1000x1000_075_f.u5.jpg (162 KB, 937x1000) Image search: [Google]
flat_1000x1000_075_f.u5.jpg
162 KB, 937x1000
>>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.
>>
File: 2016-04-22_11-47-26.png (76 KB, 1920x1080) Image search: [Google]
2016-04-22_11-47-26.png
76 KB, 1920x1080
>>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
>>
File: haskelel.jpg (99 KB, 529x598) Image search: [Google]
haskelel.jpg
99 KB, 529x598
>>54157886
>>
File: Selection_007.png (188 KB, 1272x416) Image search: [Google]
Selection_007.png
188 KB, 1272x416
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?
>>
>>54172249
int average(int a, int b) {
return (a >> 1) + (b >> 1) + (a & b & 0x1);
>>
>>54172320
}
>>
>>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 this

int main (int argc, char *argv[])

which can also be written as
int 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 as
void insert (int key, node **n)

but won't this technically yield an array of nodes, as it does with
char**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 this

assert(buffers != NULL);


when its the same as
assert(buffers);

?

maybe for clarity?

the same goes when iterating in a linked list


while (node->next !=NULL) {
// code here
}

instead of
while (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
>>
File: [tilting increases].png (27 KB, 500x500) Image search: [Google]
[tilting increases].png
27 KB, 500x500
>>54172585
>>
>>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...
>>
File: 1436395501380.jpg (98 KB, 378x485) Image search: [Google]
1436395501380.jpg
98 KB, 378x485
>>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 is
 function foo() : String 

the norm in all the new statically typed languages for functions/methods instead of just
 String 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.
>>
File: android-sdk.jpg (21 KB, 300x280) Image search: [Google]
android-sdk.jpg
21 KB, 300x280
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
>>
>>54172480
>>54172480

bump
>>
>>54174196
see
>>54173659
>>
>>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 made
void 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.
>>
>>54174522
 if ( 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?

1
val m: Map[Id, Coord]  = xs.map { case (x, y, z) => x -> Coord(y, z) }(collection.breakOut)


2
val m = xs.map { case (x, y, z) => x -> Coord(y, z) }.toMap


3
val m: Map[Id, Coord] = xs.map(e => e._1 -> Coord(e._2, e._3))(collection.breakOut)


4
val 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?
Thread replies: 255
Thread images: 25

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.