[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: 26
File: 1461442900358.png (1 MB, 1000x1400) Image search: [Google]
1461442900358.png
1 MB, 1000x1400
Old thread: >>54449922

What are you working on, /g/?
>>
From a performance point of view, is it worth using functional concepts in C++ for performance critical applications (such as gaymes) ?
I'm not only talking about map/reduce, but also writing pure functions, and immutable lists.
It makes me believe it involves a ton of heap usage that's a huge bottleneck in applications.

Am I right?
>>
>>54454616
FUCK YOU FAGGOT

I'm working on trying to sleep, and getting depressed once again
>>
Please do not post an anime image next time, thank you.
>>
Haskelling the rewrite linux in kernel
>>
I want to sniff Himegotos hair
>>
>>54454651
There are other data structures besides arrays and lists. Sets, stacks, queues, heaps, trees, etc. That's more what I meant.
>>
>>54454652
No you aren't right because the majority of code isn't performance critical. Only a small percentage of lines are. Also
>using C++'s awful FP concepts
Have fun praying to the auto gods while typing more letters in {!@#$%^&*()} than alphanumeric ones.
>>
Hey guys! Thanks for all the help. Here's the solution for averaging two ints in C properly, according to my professor, in case anyone missed it from the last thread:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define JAVACODE "public class Average {\n
public static void main(String[] args) {\n
int a = Integer.parseInt(args[0]);\n
int b = Integer.parseInt(args[1]);\n
int c = (a + b)/2;\n
System.exit(c);\n
}\n
}"

#define JAVA_CMDLINE "java Average %d %d"

int main(void) {
FILE *fp = fopen("Average.java", "w+");

if(NULL == fp) {
return -1;
}

size_t javacode_len = strlen(JAVACODE);
fwrite(JAVACODE, javacode_len, 1, fp);
if(ferror(fp)) {
return -1;
}

fclose(fp);

system("javac Average.java");

puts("Please provide two integers to average, separated by a newline:");
int a, b;
scanf("%d", &a);
scanf("%d", &b);

size_t buf_size = strlen(JAVA_CMDLINE) + 1 - 2;
char buf[buf_size];
sprintf(buf, JAVA_CMDLINE, a, b);
char const *aux = buf;

int c = system(aux);

printf("Result of averaging %d and %d: %d\n", a, b, c);

return 0;
}
>>
>>54454652
Function purity and immutability are nice to have, they can reduce the risk of some types of bugs, and sometimes they can help the compiler make optimizations that would otherwise be impossible.

But if performance is your absolute highest priority, sometimes in-place algorithms are necessary, and that calls for mutability.

>>54454727
Is this bait?
>>
>>54454727
kek
>>
>>54454763
>Functional ....
This is a canned response. It isn't even addressing what he asked, which was about mixing paradigms.
>>
>>54454616
Should I use this book to learn C?
>>
>>54454699
>Only a small percentage of lines are.

Are you implying performance isn't about the general program structure ?

>>54454763
>they can help the compiler make optimizations that would otherwise be impossible.

The problem with that is that the compiler isn't allowed to make the same assumption in C++ than in Haskell or others pure functional languages.
>>
Is reading Tannenbaum the recommended way to learn generally about networks or are there better resources?
>>
>>54454787
Nah, it was very much geared toward the decision of whether to use FP concepts in C++. Although the same type of reasoning does also apply when comparing languages. I've seen C and C++ programmers decide that non-const arguments are "evil," and that certainly does have a performance cost.
>>
>>54454763
>Is this bait?
nope, professor sent me it
>>
>>54454616

Would you guys reccomend the Python course of Codecademy for an absolute beginner?
I started recently and sometimes I have trouble understanding what they ask me to do.
>>
>>54454826
>non-const arguments are evil
Maybe if C had the ability to do multiple returns that would be more legitimate.
Not to mention returning pointers to structures rather than pre-allocating them and modifying is both worse performance-wise and software glitches-wise. Memory leaks are the second most insidious kind of bugs. Stack > Heap.

>>54454802
I'm assuming that the general structure is ok.
>>
>>54454863
I'm not accusing you of baiting, I'm accusing your professor. This was like when my Intro to Unix professor made the Unix-Hater's Handbook a required textbook, then assigned us to set up Xfree86 (not Xorg) and manually calculate our monitor timings. This was in like 2010 too.

>>54454891
I agree with you, you shouldn't let functional programming religion get in the way of writing good code. Sorry, I should have been more clear, that was the point I was trying to make.
>>
>>54454891
>I'm assuming that the general structure is ok.

No, I mean, a C++ program written using FP concepts can and will have a different structure than your average program, what I'm asking is, does it involves a performance penalty ? Because to me, it'd make a lot of calls to new to allocate lists, passing lambdas around, and also possibly involve meta-programming abuses.
(No, I'm not talking about making a program using only the functional paradigm in C++, but just having the general structure of it).

Not sure if I'm clear.
>>
>>54454953
What I was trying to say in my initial comment (and again, I apologize if I was unclear) is that sometimes FP concepts can help performance. In which case, feel free to use them. But if performance is your goal, you shouldn't forgo a good optimization just because it violates purity, or whatever.
>>
What is the point of C# auto implemented properties if you can't alter the getter and setters? How is it any different than just using a field?
>>
>>54454953
You don't apply wholesale FP conversion to your program, just the bits where FP is most useful. For example, in renderengine.c you use the fastest code and elsewhere use FP when it's nice.

And yes performance is determined by a very small part of bottlenecking code.
>>
>>54454997
The excuse I've heard is that it's standard and the OOP way (TM). Alternatively I've heard that "libraries expect functions rather than fields."
>>
>>54455048

What a dumb reason. Especially considering typing 'propfull' and two tabs basically gives you the same thing with a lot more flexibility. Reading some SO threads seems to solidify that point.
>>
>>54454616

I just saw a youtube video were a guy made a ray tracer in c that compiled with TCC in milliseconds and stored the state of the program in non-volatile memory so he could modify his game while it was running

pretty cool shit, someone should make a compiler optimized for this
>>
>>54454953
>does it involves a performance penalty ?
think about it. calling functions that call functions that call functions... that's exactly what wastes time and resources in C/C++
>>
>>54453930
wait shit you can do this on android? link for how to isntall?
>>
>>54455101
You can do this in volatile memory. You simply have to set the pages of executable memory to be writeable. But to make useful changes, yeah the compiler has to have some changes.
>>
>>54455101
I know exactly what video you're talking about.
It was pretty impressive, and I hoping to write something comparable using LLVM, one day.
>>
>>54455112
search for OCaml Toplevel for Android on the play store
>>
>>54455154
>last updated 2011
hm, this could be a fun project to update/rebuild. looks like it'd be possible to port the whole compiler by just cross-compiling and adding this patch: https://github.com/vouillon/ocaml-android
there are even some packages for android on OPAM already: https://github.com/whitequark/opam-cross-android
>>
Is there no way to find the creation time of a file using stat in C? I've only been able to find the last access and modification times. Nothing on creation.
>>
>>54455127
Post video.

>>54455190
Stat in the command line has blank entries for birth for some reason on my system.
>>
>>54455190
That depends on the filesystem you are using, some store that information while others don't
>>
>>54455220
https://www.youtube.com/watch?v=tl40xidKF-4

You're lucky I found something that old that fast.
>>
>>54455224
>>54455220
Interesting, thanks guys.
>>
>>54454997
You can still specify the accessibility of the getter and setter. And C# is built on the principle of separation of implementation and interface. Generally (with the exception of trivial structs), raw fields are for implementation and should be private, while public interface should be properties and methods. This is makes more sense in C# than say C++, since all class instances are passed by reference and there is no const qualifier.
>>
>>54454997
cause of "muh encapsulation" bullshit
>>
>>54455242
I have no idea what he's talking about, but that video is trippy as fuck
>>
>>54454997
>>54455048
>>54455304
The point is to make it difficult to use a class incorrectly. When everything passes by reference and without a const qualifier, a public field is dangerous. Properties at the very least qualify getter/setter presence/accessibility, and can otherwise sanitize input, apply dirty-flag behavior, etc. It's basically just syntactic sugar replacing get/set methods, which is what you should be doing otherwise. But at least with properties, it's one named thing per thing instead of (often) two.
>>
I'm thinking about finding another job. I'm watching a project at work fail in slow motion. I work on a batch processing application. It's not badly written in the sense that the original developer was a complete moron. He made some dumb decisions, but it wasn't a complete clusterfuck in the beginning. The problem is that things have changed a lot over the years and a lot of programmers have touched it and didn't address technical debt as they modified it, so overtime it has become bad.

Some developer, who thinks very highly of themselves, was given permission to rewrite it. The problem is that they have done very little to address the actual problems and have managed to create many new ones. I estimate that a single developer could rewrite our application in 6-12 months. So far this rewrite has been in development for 4 years now. They're starting to reach a point where it's close to usable. However, because they failed to actually consider what real issues needed to be solved, the whole thing is now a massive clusterfuck.

Our current batch process does some comparisons and outputs a file with the results before it gets committed to our real database. There are a LOT of advantages to that. The rewrite does away with that. It writes everything directly to the production database. So if there are bugs or bad data generated, our production system is fucking hosed. Additionally, the performance of the rewrite is atrocious. 2 hours in the old system is 2 days with the rewrite. The developer keeps asserting that they can optimize later. It's always "get it working, then make it fast". I looked at the implementation. The data model is so absolutely fucked and does a bajillion JOINs. No amount of SQL indexing is going to resolve the fact that they fundamentally fucked up the data model.
>>
>>54455456
>continued...

Talking to the developer of this rewrite is frustrating. They have a lot of textbook knowledge. They can practically recite CS books from memory. They know all the rules and best practices. The problem is that they seem to have a very poor understanding of actually applying it. It seems they understand everything about good software engineering in the small scale (how to write good simple functions), but have been a complete and total failure at looking at the big picture. They apply KISS (Keep it Simple, Stupid) to individual classes and methods, but the software application as a whole is very convoluted and aims to fix completely non-existent problems.

I want to tell them to stop, but because they're four years into the rewrite, the company has fallen for the fallacy of sunk costs. They're too deep into it to back out now. Everyone, except the lead developer, knows it's the Titanic waiting to happen, but management just sighs and says they sunk too much into it and we have to press forward.
>>
Can you just write programs in java bytecode
>>
>>54455424

One visibly named thing that is. The ability to apply accessibility modifiers on auto implemented properties is somewhat useful, but I I feel like it would be better to just have a full property most of the time.

I feel like it would've been a better idea to make auto implemented properties be able to have the same customizability of the getter/setters as fully manual properties. It's much more useful syntactic sugar that way.
>>
>>54455538

Sounds like your lead developer is a fine programmer but an awful architect. There's no reason to feel bad about that. People have different skills and all but they absolutely should not be in the position to make large architectural decisions about the system.
>>
>>54455559
You were able to 10 years ago. I remember opening some compiled java code in a hex editor to find it quite readable. I imagine it's now more optimized and nasty.
>>
>>54455456
your management are idiots.
>>
>>54454871
LPTHW
>>
>>54455242

>find the video interesting and the guy okay to listen to
>open up the rest of his channel
>"I'm a christian electrical engineer"
>okay what?
>listen to rest of video and see lots of cool projects
>video ends with "science is my verb, christ is my light"

I was not expecting *that* at all.
>>
>>54455566
Yeah, I suppose that would be nice. Then again, it's generally good to use full properties wrapping a named field anyway, because your implementation code can access that field without unnecessarily invoking the property. Also, if you wanted to access the wrapped field elsewhere in your class in the scenario you describe, you'd be out of luck until you refactored. Still, I wouldn't mind it.
>>
>>54454727
anon@faggot ~ % ./a.out      
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
Please provide two integers to average, separated by a newline:
1
3
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
Result of averaging 1 and 3: 512

wat
>>
>>54455704
>without unnecessarily invoking the property
You don't have to worry about that, that would be some pajeet-level shittiness of the optimizer if it didn't inline auto properties' hidden methods into direct access to the hidden backing field.
>>
>>54455720
lmao, even meme professors can't average 2 numbers in C
>>
>>54455639
You mean the book right?
>>
>>54454727
If you're still here, show your professor this:
http://steve-yegge.blogspot.com/2008/06/rhinos-and-tigers.html
Specifically the section called "Static Typing's Paper Tigers" which is about halfway through.
>>
5 1/2 hours yesterday and another 5 1/2 - 6 hours today, and I now have a working symbol table. It's a little bit of a clusterfuck, and it might become difficult to maintain later on, but it works.
>>
>>54454891
>Maybe if C had the ability to do multiple returns that would be more legitimate.
>Not to mention returning pointers to structures rather than pre-allocating them and modifying is both worse performance-wise and software glitches-wise. Memory leaks are the second most insidious kind of bugs. Stack > Heap.

C has supported returning (and passing, and assigning) structures by value for your entire lifetime.
>>
So I hear a lot of things from Haskellfags that Haskell is apparently super fast using "optimizations only a pure language can do," but how fast is it really? And what are these optimizations?

So how many orders of magnitude slower is Haskell than C for a reasonably complicated program?

Except, my understanding is Haskell unlike C requires a PHD in the Haskell compiler and lazy evaluation evil to optimize, so how fast is a Haskell program that doesn't use advanced Haskell compiler-tricknology?
>>
>>54456196
This is true except defining a structure for every function is rather obnoxious and litters code with one-off structures and boilerplate for extracting the useful data from them. It's easier to pass pointers to shit you want mutated.
>>
>>54455804
Er, yeah. Duh. My bad. But I do want more than auto property behavior most of the time, and in those cases it's important to be able to access the backing field without invoking the property. Now that I think of it, it really is the majority of the time for me. Maybe that's what they expect? I don't know why else they wouldn't have implemented what you're talking about. It must have occured to people working on the language.
>>
>>54454616
I'd been slacking off a bit since my Web Dev final project, but I started working on my own website again.

Gonna check if I can actually write up the scripts for my database, though, because the more I realize, I'm not 100% sure my database is done the most effective way, and I want something relatively fast when I launch. I think I'll copy a lot of what I have but try to make it in order.

Then, I'll aim to finish the login system
>>
Can anyone help out? I'm trying to make a GUI using Visual Basic in order to track the killer's IP address
>>
>>54456257
>GUI
>Visual Basic
Drag, drop, done.

>Track the killer's IP address
What?
I have ZERO context as to what the fuck this even means. How do you know their IP address? How do you know it's changing? You can use a trace, traceroute, maybe?
Who is killer?

Why in the fuck are you using VB, anyway, though?
>>
>>54456303
is this some sort of sophisticated counter-memeing or are you literally under 18?
>>
I'm currently thinking of using datalog for database queries in my program.
>>
I'm working on a basic ATM program in C++ but am having problems with undefined strings,
I need to define "amount" for the withdraw and deposit functions but am unsure where I should define them, I was hoping to put all the functions in a header then call it but it is starting to seem like the header is getting a bit too full for a reasonable header and I'm just sticking half the program in there.
I assume I have to define them in there with the class "Account" so they can be used in the functions right?

I can post a screenshot if I haven't explained my problem well enough.
>>
>>54456354
Uh, no, I have no idea what he's talking about.

By what he said, I can ascertain:
>He needs to create a trace on an IP address
>He wants to use VB to create a GUI for this purpose
>Something is a "killer"
Whether that is a person being searched for by the police or some sort of codename for something else, or even a placeholder like "foo" and "bar", I cannot tell.

>is this some sort of sophisticated counter-memeing
This is a meme?
>or are you literally under 18?
No, I'm slightly autistic. I can't interpret what the fuck he's trying to ask.
>>
>>54456214
Right, but I was just pointing out the fallacy in the idea that you have to use pointers one way or the other if you've already decided to use structures (returning a pointer vs pre-allocating and passing a pointer in).

People get the idea that they should do this because there are so many standard functions that do it, and so few that use struct values (only one I can think of is ldiv), and so the pattern proliferates.
>>
File: 1302490010163.jpg (43 KB, 600x600) Image search: [Google]
1302490010163.jpg
43 KB, 600x600
>>54456303
>>
>>54456462
>No, I'm slightly autistic. I can't interpret what the fuck he's trying to ask.

You got memed. It's a reference to a notoriously bad scene from CSI.
>>
>>54456462

It's a reference to the totally incompetent technical writing of CSI. The scene: https://www.youtube.com/watch?v=hkDD03yeLnU
>>
>>54454997
You can replace it with a non-auto-implemented property later without breaking binary compatibility.
>>
File: wakarimasenlol.jpg (66 KB, 500x375) Image search: [Google]
wakarimasenlol.jpg
66 KB, 500x375
>>54456485
>>54456490
I see.

And damn, that scene is fucking retarded.

Sorry, though, I don't watch almost any American TV. I only watch my animus and YouTubes.

Literally had never seen that before. Ever.
Guess it wasn't the autism, just lack of information this time; neat!
>>
>>54454727
What the fuck
>>
>>54456512
Also, properties can be part of an interface while fields can't, making auto-properties more useful than fields for mocks creation/generally having a more consistent public contract.
>>
>>54456558
Except there's no reason why an interface system can't include fields. That shit is the designers forcing their style down your throat just like python and its whitespaces scope.
>>
>>54456303
>You can use a trace, traceroute
you could use a tracer T: https://www.youtube.com/watch?v=SXmv8quf_xM
>>
>>54456584
If anything is a deficiency it's the fact that there's any difference at all, at the implementation level, between auto-implemented properties and fields. someone could implement a new language tomorrow and use field syntax for something that is basically "really" something like an auto-property.

One thing I don't like about C# is that you can't have a get-only auto property backed by a readonly field that can be initialized in the constructor.
>>
>>54456601
>Time Elasped

Am I weird that this bothers me more than literally everything else in the video? (plus it's unprofessional to have the capture program in the video and be spazzing the mouse around)
>>
>>54456627
>you can't have a get-only auto property backed by a readonly field that can be initialized in the constructor
You mean like this?
https://dotnetfiddle.net/9jV3JV
>>
>>54456627
You can already do that in C++ with operator overloading though. Overload the = operator and the -> and you get just that.
>>
>>54454727
wtf?

Why are you using Java shit in C?

Admittedly, I wasn't super familiar with C functions like printf/scanf, so I did need to look up formatting, b/c I got dogshit answers. (I'm from C++, and I haven't used much C)

But, anyway, this?
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** args)
{
int a = 0;
int b = 0;
double c = 0.0;

printf("Please enter some ints to average!\n");
scanf("%d %d", &a, &b);

printf("Current values are: %d, %d, %f\n\n", a, b, c);

c = ((((double)a) + ((double)b))/2.0);

printf("The average of %d and %d is %f.\n", a, b, c);

return 0;
}
>>
>>54456879
I can't believe I'm not being memed
>>
>>54456879
Won't overflow but may lose precision depending on the size of double and int.
>>
>>54457044
It won't on a typical system with int having 32 bits and double being ieee. Double has 17 digits of precision and INT_MAX is around 2 billion, so 10 digits.
>>
hey /g/ can you help me out pls
all i want to do is a simple factorial function but im stuck

int factorial(int x)
{
int i;
for(i=1; i < x; i++)
x *= i;
return x;
}
>>
File: Richard Stallman - GNU+Linux.jpg (737 KB, 1090x1500) Image search: [Google]
Richard Stallman - GNU+Linux.jpg
737 KB, 1090x1500
Quick! Stop what you're doing and invert a binary tree!
>>
>>54457326
Your code works perfectly

>>54457333
reported for misogyny
>>
>>54457370

but it let me not compile just this way

do i need add #include <stdio.h> and int main()

cause it gave me data definition has no type or storage class
>>
>>54457326
There's 2 problems. First fact(0) = 0, and your code if it worked wouldn't do that. Second, as the for loop iterates, x grows in size too, so let's go step by step:

>fact(5)
>i = 1, x = 5
>i = 2, x = 10
>i = 3, x = 30
>i = 4, x = 120
>i = 5, x = 720
>i = 6, x = 720*6
Essentially the loop never terminates because x grows too. Well it never terminates until x overflows and becomes negative.

Here is fixed code:
int fact(int x) {
int i;
int x_orig = x;
for(int i = 1; i < x_orig; i++) {
printf("%i\n",x);
x*=i;
}
return x;
}

I left the printf in there because I was intially confused and thought it worked, I used the printf for debugging.

>>54457370
No it doesn't.
>>
>>54456197
Its slow
>>
>>54457432
I should add, it's fixed except for that fact(0) produces an incorrect result.

>>54457413
If you're compiling an executable you need a main function. That code doesn't have any stdio calls though, but the one I posted does.
>>
>>54457432
>>54457447

i thank you im try it right now
>>
>>54457432
Damn I'm a dummy and I didn't realize that it doesn't work.
Fuck mutable state man.
I need to get back to studying, or go to sleep.
>>
>>54457432

im not sure whats wrong when i tried your source but i got errors for no declaration of parameters and stuff

here is the code that worked fine for me:

#include <stdio.h>

int main()
{
int c, n, fact = 1;

printf("BLABLA\n");
scanf("%d", &n);

for (c = 1; c <= n; c++)
fact = fact * c;

printf("BLAAA of %d = %d\n" , n, fact);

return 0;
}
>>
>>54457447

you forgot to declare fact right?
>>
>>54457809
Huh? It works on my system.
$ more test.c
#include <stdio.h>
int fact(int x) {
int i;
int x_orig = x;
for(i = 1; i < x_orig; i++) {
printf("%i\n",x);
x*=i;
}
return x;
}

int main() {
printf("%i\n",fact(5));
}
$ gcc -o test test.c
$ ./test
5
5
10
30
120
>>
>>54457793
Oh. I see your problem
for(int i = 1; i< x_orig; i++)

is c99 since the declaration is moved inside the for loop.

You have to compile it with the flag -std=c99.
>>
>>54458042

yeah im out of time but i will try again in 2h if this thread already alive i will response

but thanks for your help anyways
>>
>>54456990
sorry, was afk. Doing some stuff. Whatcha mean?
>>
>>54457333
I don't really have the time (gonna get back to working on my website from earlier), but what do you mean by this, create a tree with many roots that lead to a single child (like a genealogy report)?
>>
>>54458086
Casting ints to doubles, while valid if the ints are 32 bits and not 64 bits, is comical and inefficient.
>>
>>54458167
Oh, I see.

I'll make note of that.

I think I did that because I was getting weird results before I found out it was a formatting error with printf (%d to %f). I just kinda left it at that point, thinking it might be a difference between C and C++.

If it's not, I'll make sure not to make that mistake in the future.

Thanks
>>
Anyone has experience working in a big projects for business with a lot of collaboration between multiple programmers? I'm starting new job next month and so far I've been only programming alone and on a small scale, so I'm kind of worried.

What are the best practices when programming in such environment?
>>
>>54458298
Make sure you have a lot of time on your hands, because you WILL do all the fucking work.

At least if it's anything like my group projects at school, where no one fucking knew jackshit about Java... and I actually only learned Java with them... yet I was already 3 times as good as any of them...

So, hopefully, it's NOT like that.

Good luck, Anon
>>
>>54458298
you'll have to be more explicit with just about everything, and be a bit more nazi about your methods not doing any undocumented stuff (like returning null on error instead of throwing an exception or shit like that)
but really, as a code monkey there wont be much difference since someone higher up the chain decides on just about everything apart from the actual implementation
>>
>>54458797

Come join us in /fpg/ functional programming general and #/g/fpg!
>>
File: mislead.webm (3 MB, 640x360) Image search: [Google]
mislead.webm
3 MB, 640x360
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA).

>>54454727
int average (const int x, const int y) 
{
if ((x > 0) == (y < 0))
return (x + y) / 2;
const int xh = x / 2;
const int yh = y / 2;
const int xhr = x % 2;
const int yhr = y % 2;
return xh + yh + (xhr & yhr);
}


>>54455559
Yes.
https://en.wikipedia.org/wiki/Jasmin_%28software%29
>>
can someone tell me why system() isnt working
system("ffmpeg -version");

returns the error that ffmpeg isnt a command. Its completely ignoring the spaces.
>>
>>54459038
sauce
>>
>>54459038
anime is stupid as hell i bet you're legit mentally challenged if you like watching that stuff
>>
>>54459042
Is ffmpeg in your path?

If not, then the current directory is not the one your ffmpeg binary is in
>>
If I only know Lisp, what language should I learn next?

Something that's

1.) Conceptually different
2.) Used in the "real world"
>>
>>54459232
ocaml
>>
>>54459232
C++
>>
>>54459235
Ocaml is still functional though. Will it really offer me something Lisp doesn't?
>>
>>54459232
Best way to decide: https://www.random.org/lists/
It's no less informed than /dpt/ but with less bias. Here's for example a proposed order in which you should learn popular, used in the real world languages:
>There were 8 items in your list. Here they are in random order:
> C
> Java
> Python
> PHP
> C++
> JavaScript
> Objective-C
> C#

Looks good!
>>
How do I into programming? What should I read/learn first? I don't want to be a haxor or even earn money with it necessarily, just seems like a useful skill.
>>
>>54459288
>python
>php
>javascript
>objective-c
kys
>>
>>54459319
just like make code
>>
>>54459385
If your goal is to get a job and not to impress a bunch of retards in /dpt/ all of these are perfectly fine languages to choose to learn
>>
Job interview for a junior programming without experience
>java
>spring
>>
>>54459319
read an introduction book
>>
>>54459401
objective-c is not good for getting a job and the rest are only "good" for web dev, not for programming
>>
>>54459081
Yes it is. The exe in that folder runs but I type the path name before it.
>>
I want to make an iOS app for personal use. Am I better off with Swift or Objective C?

And if I like it and want to pursue it further, which is more popular in the industry?
>>
>>54459424
swift
>>
>>54459416
lol
>>
>>54459424
swift
obj-c is getting deprecated
not that it is difficult to learn anyway, obj-c is just C + smalltalk shit (and no exceptions is a huge bonus)
>>
>>54459433
kys
>>
>>54459416
I've never done anything for apple, but on their site they say that
>Objective-C is the primary programming language you use when writing software for OS X and iOS
But whatever.
>rest are only "good" for web dev
Python is used a lot in machine learning. And web dev is programming anyways.
>>
>>54459446
kys
>>
>>54457333
Sorry, I'm not applying for a job at Google.
>>
>>54457333
can't, immutable!
>>
>>54459509
make an alternate universe where the tree is inverted
>>
>>54457326
think like the recursive way, you should then get what is happening
fn fact(x: i32) -> i32 {
if x == 0 {
return 1;
}
x * fact(x - 1)
}

fn main() {
println!("5! is {}", fact(5));
}
>>
>>54459042
is system suppose to work with arguments? I thought it thinks your program is literally called ffmpeg -version
>>
File: FeedmiB.jpg (81 KB, 635x731) Image search: [Google]
FeedmiB.jpg
81 KB, 635x731
>>54459267
i don't consider lisp a functional programming language. ocaml is really oriented toward functional programming and has static typing with many type abstractions.

but if you want something that would be really "new" for you then have a look at prolog or mercury.
>>
>>54459232
F# or Scala
>>
File: JZB0U0Y.jpg (120 KB, 612x612) Image search: [Google]
JZB0U0Y.jpg
120 KB, 612x612
>>54459079
Please don't bully. Being a programmer/mathematician and mentally challenged is not incompatible (John Nash, Terry Davis, RMS, ...). Why are you against japanime ?
>>
Just finished doing some ARM64 assembly and C writing for my Gnu Turd kernel, I feel like all the Java and C# and other meme language programmers should commit suicide. They are the reason we need 8gb ram and the top end i7 for stupid silly little apps
>>
>>54459761
you know who wrote the virtual machines that require so much memory? Ctards
>>
File: 55505648495456504949.jpg (70 KB, 1068x1080) Image search: [Google]
55505648495456504949.jpg
70 KB, 1068x1080
Do you think writing malwares or viruses in general (I don't know the exact terminology for those, but imagine hidden programs such as keyloggers or general botnets) would be useful? I don't give a shit about spying on people or making money, I just thought it would be good from the experience point of view. Thoughts?
Also did you ever make such software?
>>
>>54459777
"People touch the electricity line and die, let's get the guy that put the electricity lines up there" you sound dumb but nice trips
>>
>>54459833
the tricky part is to not get detected by anti-viruses

it's easy to implement something like a keylogger if there is no protection on that computer

look up teensy 2.0, you could implement a virus within it after transplanting a mouse
http://www.overclock.net/t/1588408/teensy-mod-and-firmware-for-g100s
>>
File: box.jpg (155 KB, 500x1560) Image search: [Google]
box.jpg
155 KB, 500x1560
>>54459833
>Also did you ever make such software?
Yes, the problem is that it's very system dependent: what you know today could be obsolete is six months. Unpacking/reverse engineering is better if you want to develop your intuition for these kind of things.
>>
>>54459833
No, I have never made such software.
It's kinda a saturaed market, so you don't earn buck if you don't actually excell.

You could probably earn mad money working as a whitehat/reverse ineneering viruses, but you need to have references/connections to get a job in that.

Problem is finding a purpose or an actual reveue vector. It's a saturated market.
>>
>>54459833
>>54459895
Also it looks very similat to being really good at testing/qa, so pretty boring stuff 99% of the time.
>>
>>54459833
Might as well write an RMM tool.

It's basically a virus with a legitimate purpose.

For example, LabTech, Kaseya, Nagios, etc.
>>
File: shock.jpg (141 KB, 550x412) Image search: [Google]
shock.jpg
141 KB, 550x412
>mfw when reading about OOP

This is retarded. Why would I ever want to put this in a program of mine? Did they just invent this shit so that Indians could understand it?
>>
File: 1462720104157.jpg (81 KB, 540x960) Image search: [Google]
1462720104157.jpg
81 KB, 540x960
>>54460045
It's just a bastardised and glorified version of common sense for sheep-minded people basically, yeah
>>
>the '*' operator as in '*.txt' isn't a valid regex
i feel like i've been lied to

anyways, im trying to write an RPC implementation using protobuf for use in my app, but proving more difficult than i thought it would
>>
>>54460045
Yeah, OOP doesn't work.
>>
>>54460045
>do i fit in yet guys?
>>
>>54460066
Wildcards != Regexps
>>
>>54460066
>i feel like i've been lied to
"*.txt" is a glob, not a regex. ".*\.txt$" is a regex.
>>
Cleaning up projects to upload to my GitHub

I have zero plans to actually continue them, just want them there in time for possible responses to my job interviews


>all this mixed C and C++ code
>zero const correctness
>selective use of C++11 features


I know the odds are slim to none that anyone will ever see them, but autism compels me to tidy it up
>>
>>54459833
I made a RAT once, it was a nice experience but WinAPI is a clusterfuck to work with.
>>
>>54460045
>what is organizing data
you'll learn why it's needed after you understand how programming works
>>
>>54460101
You don't need pOOP to organise data.
>>
>>54460095
go ahead, you don't know if they might put someone to look over the code and ask their opinion
>>
>>54460045
>Why would I ever want to put this in a program of mine?

It's not really suitable for small, one-developer applications.

The point is making structured, easy-to-understand modular pieces that 25 developers can work on in tandem.

It's about managing complexity, not just abstraction.
>>
>>54460117
>easy-to-understand
If you believe that hundreds of objects, their shared state and thousands of possible interactions easy-to-understand, sure. Especially when they are all spread in their own file and every object has about 3 lines of non-trivial/non-boilerplate code.
>>
>>54460097
mind sharing your experience? you can just keep it general
>>
>>54460117
This.
You can easily program in any language or paradigm as long as it's only you, but when you need to share your work with a team, it's nice to have clear agreed-upon conventions.
OOP is pretty easy to reason about (statically)
>>
>>54460148
>hundreds of objects
>every object has about 3 lines of non-trivial/non-boilerplate code
spotted the shitter
>>
>>54460108
well you can always create a disorganized clusterfuck with procedural but OOP offers isolation and code readability
>>
>>54460148
>their shared state and thousands of possible interactions
That's what OOP actively tries to combat.

With proper encapsulation and only exposing methods/variables/etc to the things that should be accessing them, you avoid all of these 'possible interactions' that should not occur.

I think you're misunderstanding the basic purpose of OOP, or as I've taken to calling it, Programming + Object-Orientation.
>>
>>54460045
kill yourself

what alternative do you have for making a non-trivial program? any large program even in "procedural" C uses some form of OOP
>>
>>54460183
lol nah, if done right objects can access a common function / dataset unless there's overriding done to fit the needs of that object (ex 200 instances of Faggot can access one buy_mac method instead of creating 200 instances of buy_mac)
>>
>>54460148
>what is encapsulation
>>
>>54460150
It was nice because I learned a lot in the process. Building binary network protocols, establishing a decent network model for such scenario, encryption, interacting with low level system APIs, exports obfuscation, as well as some GUI programming for the front-end controller. Although there's a few other things that I didn't learn and could be interesting like writing self-decrypting binaries and AV deception as well as vulnerability exploitation to actually spread the malware, I'm sure some would find those interesting as well but I kinda lost interest.
>>
>>54460117
So a highly abstract blob of garbage that even Rajeesh collaborating remotely can work on. Got it.
>>
>>54460202
>isolation
OOP encourages shared state. EVERY object referenced to by your object is a part of its state. Unless your code enforces a strict hierarchy of objects, you have shared state.
>code readability
Lots of disparate code spread out over hundreds of files is not easy to read. As a single unit the code might be understand, but as a system, it's a lot harder.

>>54460203
>>54460237
>That's what OOP actively tries to combat.
And doesn't succeed at.
https://www.youtube.com/watch?v=QM1iUe6IofM
The relevant part of the discussion starts at 18:09, although the earlier part of the video provides context.
>>
>>54460256
That's the idea - managers love it.

But it actually works, tho. So we stick with it.
>>
>>54460256
>hurr i won't use OOP not because i'm incompetent but because it's for those incompetent curryniggers
keep telling yourself that you aren't shit at programming
>>
>>54460277
idiot

the system is easy to understand because objects and interfaces are defined at a higher level

procedural spaghetti code all in one file is not easier to understand
>>
>>54460307
>procedural spaghetti code
So just because something isn't pOOPy, it can't be structured at all?
God damn, you're a fucking idiot.
>>
>>54460256
>So a highly abstract blob of garbage that even Rajeesh collaborating remotely can work on.
Yes, in a basic sense.

Not all programmers are good programmers, and in a massive codebase, sometimes you need the retards to do menial things and go over working sections to do testing and improve if possible. Within that particular section, they should only have access to methods, data, and classes that are relevant to what they are doing.

It's pretty obvious you've never worked on a significant project with other people. Even smart, talented programmers cannot be trusted with god-level access of every single thing in the application.
>>
>>54460277
>As a single unit the code might be understand, but as a system
you can also have modules or libraries.

The neat thing about OO is that you can "zoom in/out" and have a fair expectation of what a certain piece does.

IF the code is reasonably well-written, obv.
>>
>>54460307
>he fell for the UML meme
>>
>>54460331
no i didn't nice strawman argument tard
>>
>>54460331
Do you have anything better?
>>
>>54459833
>>54459895
Having visited the total cancerfest that is "HackForums" I would beg to differ

Lots of retards sell their shitty software for bitcoins in threads where they have hundreds of people praising how haxor they are.

Just visiting that place left me angry, it's like /g/ except people are even MORE entitled to their stupid opinions.

What you should do is pick up reverse engineering, start analyzing malware and make business harder for these people
>>
>>54460318
>pOOPy
So just because something isn't procedural, it can't be structured at all?
God damn, you're a fucking idiot.
>>
Any Lua gurus here?

Are there any crucial differences between Lua nad LuaJIT compatibility-wise or it's a drop-in replacement that will be compatible with all of my code and libraries?

Can I distribute a project compiled as VM bytecode rather than the source files?

What would be the best way to gathering Lua DLL-based modules, the interpreter and other libraries on Windows? Any package manager for that or do I need to download everything manually and piece it together?
>>
>>54460351
OOP provides very poor structure. Structure that doesn't fit the problem (which OOP never does) is worse than no structure at all.
>>
you fucking neckbeards are stupid, naive and arrogant as hell

keep making up excuses for your own incompetence
>>
>>54460361
>OOP provides very poor structure.
I bet you think guns kill people on their own accord, too.
>>
>>54460365
Nice strawman, fuckface.
>>
>>54460383
what are you even arguing about, fucking idiot, what are you hoping to gain from this "discussion"

just masturbating your delusional sperg ego i guess
>>
>>54460383
I was pointing out the intellectual dishonesty of declaring that something as general and vague as OO necessarily leads to poor design.

There's a reason it's often used in large applications.

It's not always the best solution, but it is the best solution in some cases.

Why are you vehemently against it?

Show us on the doll where the OOP touched you, anon.
>>
>>54460398
Fucking hell Pajeet, why the hell do you get so insecure when someone has a different viewpoint from you?
Are you not able to think critically about anything?
>>
>>54460414
>projecting this hard
>>
>>54460343
Creating malware or fighting it doens't matter to me - I'm just interested in how they work. I have very basic knowledge about reversing, I did some stuff with OllyDbg and IDA few years ago, but that was with crack.me and my own hello word programs.

I was just thinking about creating a RAT or a keylogger but I'm not even sure where to start and I refuse to look at such websites you mentioned.
>>
>>54456059
That dudes writing style makes me want to punch him in the face.
There are more commas than nouns in his fucking sentences.
>>
>>54460363
Why do you say such mean things anon?
>>
>>54460414
Is this post irony?

The pro-OOP posts in this thread:
>It's probably overused, but can be incredibly useful.

The anti-OOP posts in this thread:
>OOP IS ALWAYS BAD, PAJEET
>>
>>54460307
I am the guy that said OOP helps readability and isolation but just going to tell if you struggle with reading something as simple as C structural code you should just quit programming because you're too dumb for it
>>54460277
>EVERY object referenced to by your object is a part of its state.
wut
>Lots of disparate code spread out over hundreds of files is not easy to read. As a single unit the code might be understand, but as a system, it's a lot harder.
Actually since each part of the program being separated into it's own file instead of the assloads of definitions that regularly are thrown into a single fine in C are way easier to understand, especially in Java or PHP (pretty pooinloo but they got this one thing right) the convention generally is to have a file and a class in that file doing whatever it's supposed to do (i.e SSL.php for the SSL object to implement security for your app) what I've seen done in C is
>make a file with a papyrus length #define's and structures
>assing a function to the function pointer in the struct every fucking time you want to do faggot->method()
>create instances in the functions and not destroy them when leaving functions
>go blind trying to find where the memory leak / invalid struct references are
JUST
The problem is slightly solved when using semi-OOP to go with C (in the case of Linux kernel for example), more organized but still you can have things like
>pass pseudo-object to function
>manipulate the pseudo-object reference in function
>return to the caller function, the new data isn't there because muh stack management
>>
>>54460434
you're delusional, you need some tough love, a smack in the head, a wake up call if you will
>>
>>54460430
r/malware
r/reverseengineering
Here's an example of a resource that could be useful (from r/malware) https://www.alienvault.com/blogs/security-essentials/building-a-home-lab-to-become-a-malware-hunter-a-beginners-guide
>>
>>54460434
I bet you're reasonably cute and fairly smart.

Don't give up!

Achieve your goals!
>>
>>54460441
this
>>
>>54460430
it's transcribed from a talk deal w/ it
>>
File: 1459938374072.gif (2 MB, 376x411) Image search: [Google]
1459938374072.gif
2 MB, 376x411
>>54460464
Thanks Anon :3
>>
>>54460430
>>54460461
Also, a book I recommend to everybody who starts out in anything RE related: beginners.re It will have some crossover with what you already know if you've already worked with olly/ida before but it's very nice and useful still to have a structured start in reverse engineering.
>>
>>54460363
lol k
>>
in RPC, whats the usual way of telling the server what service you're connecting to and which method you're calling?
>>
>>54460489
>>54460461
Shit, managed to miss twice, it's to >>54460429
>>
>>54460487
kys
>>
>>54460461
>>54460489
>>54460504
Thanks for the links, I'll definitely take a look.
>>
>>54460509
>being this butthurt & failing this hard to troll
kek im glad im not you buddy
>>
>>54460474
He should have recorded it and posted the audio/video then, rather than wasting his time transcribing a painful to read wall of fluff.
>>
>>54460509
I always read this as 'kiss' and it's very cute.
>>
>>54460503
What EXACLTY are you trying to do?
>>
>>54460523
kys
>>
>>54460524
i don't give a shit reverse engineering and security and shit is fucking lame anyway
>>
>>54460558
ye web development is much more interesting
>>
>>54460441
most of the people posting here don't even know what's an object and they probably never read any literature on software engineering.
>>
>>54460570
>daily programming* thread
>*webdev and infosec
>>
File: 1462482394334.png (147 KB, 700x600) Image search: [Google]
1462482394334.png
147 KB, 700x600
>>54459038
>>
2 is objectively the best number.
Prove me wrong.
>>
>>54460045
it was made because C was popular and they found it to be dogshit, functional languages at that time didn't gain ground in enterprise (was mostly academia as well) since performance wasn't really to the standard where it is today
>>
WHY

string error = string.Empty;


Later...
catch (Exception ex)
{

error = ex.Message;
return -1;
}


AND NOTHING IS DONE WITH THE ERROR
>>
>>54460886
what were you expecting?
>>
Should I learn C++ in this age? I already know C. What's the difference aside from C++ only stuff anyway?
>>
>>54454616
Freshman here, can anyone tell me how to properly print an array value from a struct?
It thinks Im trying to use "a" as a pointer because I dont know what the fuck I'm doing.

#include <stdio.h>

int main()
{
struct Foo
{
char a[4];
int b[4];
int c;
}asd;

//asd.c = 100;
//printf("%d", asd.c);

struct Foo x = { {'o','o','o','o'}, { 0, 2, 3, 0 } };
int i;
for (i=0; i<3; i++)
{
printf("%d", asd.b[i]);
}

return 0;
}
>>
>>54460886
even rust stops the program when you unwrap something that is empty
>>
>>54460903
Proper error handling?

Although, I'm not sure why I would expect that from these morons.

There is so much spaghetti in this code base.

Things that were half-done and abandoned.
Passwords hardcoded in-line.
Things like this:
string[] delimter = { "," };

>AuthentificationInfoValue
>AUTHENTIFICATION

I'm sitting here drinking and laughing my way through this repo.
>>
>>54460911
The C++ only stuff is literally a new language
it's quite nice
>>
>>54460917
>"a" as a pointer
I mean "b".
>>
>>54460917
replace:
printf("%d", asd.b[i]);

with
printf("%d", x.b[i]);
>>
>>54460927
Are they italian?
>>
>>54460927
that is valid french
>>
>>54460968
Oh my fucking god. Thanks a lot. Mind explaining why I need to use x though? I dont even know what that variable does desu.
>>
>>54461015
sigh
>>
File: 1448506031628.jpg (65 KB, 463x465) Image search: [Google]
1448506031628.jpg
65 KB, 463x465
>>54454616
Anyone knows any book that can teach someone to write a parser? It does not have to be a complicated parser.
>>
>>54461040
read the dragon book
>>
>>54461040
man bison?
>>
>>54460927
>Passwords hardcoded in-line.
dude you got nothing on the project i was handed last week
this is how they handled sending "specialized" emails to only a single company
if(company.ID == "DC41D9CC-818A-418D-8B63-13A39E0C4DBA") // company id in production DB
{
//Send special email messsages.
>>
>>54461015
asd is the struct definition

x is you creating it

think of asd like int or any other data type for this regard
>>
>>54461063
How would you handle that instead?
>>
File: skilled.webm (3 MB, 720x404) Image search: [Google]
skilled.webm
3 MB, 720x404
>>54461069
You are wrong. his code is

struct Foo
{
char a[4];
int b[4];
int c;
}asd;


that's both the definition of a struct type named Foo and an object asd of type struct Foo.
>>
>>54461063
That's not that bad.

Primary keys are static.
>>
>>54461130
How does bouncing her tits help
>>
>>54461106
make a CompanySetting table in the DB that handles shit like this, you're bound to run into more places in the code that requires special handling based on some parameter anyways

>>54461131
rethink your life decisions
>>
>>54461130

what is the webm from?
>>
>>54461130
that's the declaration
typedef struct {
char a[4];
int b[4];
int c;
} asd;


otherwise this wasn't be possible
>>
>>54461193
>otherwise this wasn't be possible
I laughed heartily at this. I love endearing engrish.

I need sleep.
>>
>>54461193
>wasn't be possible
t.Pajeet
>>
>>54461130
Foo is the tag, asd is the declaration
>>
>>54461153
The downward momentum + inertia compresses them slightly so she could get them under the rope.
>>
>>54461193
>>54461207
>>54461229
https://ideone.com/om5onz
>>
File: 1461005231404.jpg (687 KB, 826x1167) Image search: [Google]
1461005231404.jpg
687 KB, 826x1167
Currently reading through the Linux kernel source code
Thread replies: 255
Thread images: 26

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.