Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Due to resource constraints, /g/ and /tg/ will no longer be archived or available. Other archivers continue to archive these boards.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 384 KB, 1024x768, 1384365381216.png [View same] [iqdb] [saucenao] [google] [report]
66383616 No.66383616 [Reply] [Original] [archived.moe] [rbt]

What are you working on /g/?

Prev thread => >>66377074

>> No.66383621

First for anime and C.

>> No.66383634

>>66383610
so you want to specify a set term of recursion? Just keep a counter with your recursion dude

>> No.66383647

>>66383634
or in other words, have your base case be number of 0 for termination

then just input 40m as the argument, taking away 1 from 40m each iteration

>> No.66383665
File: 1.20 MB, 849x1200, monika.png [View same] [iqdb] [saucenao] [google] [report]
66383665

>>66383621
>there are people that haven't learned C for their waifus
>current year

>> No.66383683

>>66383652
How did you get into it?

>> No.66383690

>>66383634
I did that
foreach :: (a -> a) -> a -> Integer -> a
foreach f acc 0 = acc
foreach f acc n = foreach f (f acc) (n-1)

I still have a stack overflow. Unless the problem comes from something else, but I can't pin it down as this is like the only recursion I have in my code.

>> No.66383696

Rust is better C.

>> No.66383702

I'm going to learn HolyC

>> No.66383709

>>66383696
>Rust is better C.
Indeed it has better jsw support, it has more NEETs using it as percantage, and you dont have to be corporate slave in order to use it, you can stay in your mommas basement and live of social! Rust truly is best!

>> No.66383711

>>66383702
I went on a TempleOS/HolyC binge earlier today. Shit's wild.

>> No.66383726
File: 16 KB, 640x480, ebin.png [View same] [iqdb] [saucenao] [google] [report]
66383726

>>66383711
I can't even take the fucking tour without TempleOS crashing lmao, time to hope a clean reinstall solves it

>> No.66383736

>>66383726
Behold the power of Ring 0

>> No.66383774

>>66383736
Downloading from http://www.templeos.org/ instead of http://www.templeos.org/Downloads/ solved it, time to become Terry's templar

>> No.66383799

>>66383690
did you build it or run it in the REPL?

>> No.66383804

finally reached the monoid chapter on the haskell book

currently on the door that leads to the path of Satori bros

>> No.66383854

>>66383690
(f acc)
isn't being evaluted because of lazyness i believe
don't know enough about hasklel to help you beyond that desu

>> No.66383875

Haskell Programming from First Principles is it good?

>> No.66383900

>>66383799
REPL.
Could this make a difference ?

>>66383854
It would somehow just compose f ( f' (f'' acc))) and wait until I've done the 40M iterations before evaluating ?
I thought using and iteration with acc prevents that kind of behavior.

>> No.66383964

>>66383875
reading it, yes it is

it is done btw, just in RC stage since they wanna print it as well

>> No.66383979

Can someone explain this?

char *ptr;

/* write to the shared memory object */
sprintf(ptr,"%s",message_0);
ptr += strlen(message_0);
sprintf(ptr,"%s",message_1);
ptr += strlen(message_1);


Why are they doing ptr += strlen(message_0); and ptr += strlen(message_1);

>> No.66383989

>>66383964
Good there is 1.0RC2 from 2017 version on libgen. Thanks!

>> No.66383996

>>66383900
of course m8, I just compiled your code and it worked fine

but of course I just put in a addition function as the arg

>> No.66384001

>>66383979
ptr is part of some larger buffer. ptr points to the free area of the buffer. Once a message is written into the buffer, ptr is moved so that it points to the area just after the message that was written i.e. into the new free buffer region.

>> No.66384005

>>66383799
Just ran the binary.
No stack overflow exception.
The program just hangs. I find it really hard to believe that it'd be impossible to do something as simple as
int x = 0;
int y = 0;
for(int i=0; i < 40000000; i++) {
x = f(x);
y = g(x);
}
return y;

Do I really need 200 IQ to use hasklel?

>> No.66384027

>>66383996
when I say fine, I do mean it is unoptimized as you would expect

I do remember doing something like this but with concurrency in F# and then later comparing with Big Data integers

>>66384005
I am using a i7 6700k with 16 GB and that code does use lots of ram.

In short, you have to use strict mode for haskell due to the lazy evaluation fucking you over in this case. https://wiki.haskell.org/Performance/Strictness

>> No.66384028

>>66383690
iterate f z !! n

>> No.66384040
File: 8 KB, 960x472, csrlbz.png [View same] [iqdb] [saucenao] [google] [report]
66384040

>>66384028
not that guy but is there a way to force strict evaluation?

>> No.66384045

>>66384040
Data.List.iterate'
' usually marks something as strict

>> No.66384049

>>66383979
>>66384001
If they didn't move the pointer further along the buffer, they would just be overwriting the same spot.
To represent it somewhat graphically
| | | | | | |
^

|a|a|a| | | |
^

|a|a|a| | | |
^

|a|a|a|b|b|b|
^

|a|a|a|b|b|b|
^

>> No.66384074

>>66384045
Not that it's a language thing or anything, just a library thing. ' is a valid token in identifiers.

>> No.66384084

>>66384074
getting parse error with import Data.List.iterate'

or even Data.List (iterate')

even with
import Data.List

asd = iterate' (+1) 1 !! 10

>> No.66384111

this gets me
main :: IO ()
main = putStrLn $ show $! iterate (+1) 1 !! 40000000

> TotalSeconds : 11.8177757


using OpenMP would be better but whatever

>> No.66384232

Can someone explain to me in layman's terms how I can modify positions of models in a 3d space using MonoGame?

So far I lifted the following code from a tutorial
foreach (ModelMesh mesh in model.Meshes) {
foreach (BasicEffect effect in mesh.Effects) {
effect.EnableDefaultLighting();

effect.World = Matrix.Identity;
effect.View = Camera.Instance.ViewMatrix;
effect.Projection = Camera.Instance.ProjectionMatrix;
}

mesh.Draw();
}

But I was wondering what are those World, View and Projection fields?

How would changing them modify the displayed object?
From what I think I believe that World is the position of the object in the 3d space, but what about View and Projection?

I want to build a simple grid-like display system.

I'm using MonoGame for this btw

>> No.66384244

If a thing can either be 1 or 0 and I want to check if it's 1 is there any advantage writing if(thing ==1) or (if thing > 0)?

>> No.66384249

>>66384084
What are you using that's giving you a parse error?
iterate' is a perfectly valid identifier, try it in ghci

>> No.66384251

>>66384084
might have to do with the version of the base package you have. you can just see the implementation of iterate' to see how to add strictness:
iterate' :: (a -> a) -> a -> [a]
iterate' f x =
let x' = f x
in x' `seq` (x : iterate' f x')


this explains it
https://wiki.haskell.org/Seq

>> No.66384253

>>66384244
well technically speaking you should always check only for the thing you want, since everything else is undefined behaviour.

>> No.66384259
File: 145 KB, 1031x876, 1485747552895.jpg [View same] [iqdb] [saucenao] [google] [report]
66384259

>>66384244
>he dosn't use if (thing)

>> No.66384264

>>66384259
well if it's not a boolean...

>> No.66384424

>>66384264
You have been jedi mind tricked to use booleans

>> No.66384426

>>66383610
Just make the function strict on the accumulator
foreach f acc n = seq acc $ if n <= 0 then acc else foreach f (f acc) (n-1)

>> No.66384431

>>66384027
I'm stupid, I'm working with some sort of nested type, therefore just adding strictness by doing
for f (f $! acc) n

or >>66384111 wouldn't work as I need a deepseq.

I guess if I rewrote the function f and do some strict evaluation of its args inside, that could work too maybe.
Anyways, thanks everybody.

>> No.66384435

>>66384232
>https://gamedev.stackexchange.com/questions/23497/how-to-move-a-3d-object-in-3d-coordinate-space
?

>> No.66384514

With risk of sounding retarded.
I'm working on an API and I can connect to it through localhost:8080 in chrome. However, when I try to connect to it from android studio I get ConnectException: Failed to connect to localhost/127.0.01:8080

>> No.66384522

>>66384514
* anyone know what's going on?
Working with Spring boot for the first time.
Launching the server from a jar-file

>> No.66384556

>>66384514
>>66384522
oh my god I just realized
Is it because an android emulator obviously can't connect to localhost?
I'm so fucking retarded someone kill me

>> No.66384698

What is a good resource for learning common algorithms and data structures /dpt/?

>> No.66384718

How to bitwisely cast object in C++?
assuming (sizeof(Foo) == sizeof(Bar)) == true
is this a good way to do it?
Foo foo;
Bar bar;
std::memcpy(&bar, &foo, sizeof(Bar));

>> No.66384721

>>66384698
depends on your language, but usually google.com with the context of your problem

>> No.66384733

>>66384698
sicp

>> No.66384740

>>66384721
>depends on your language
That topic is language independent.

>> No.66384744

>>66384740
>purely functional data structures

>> No.66384767

>>66384744
Your point being?

>> No.66384783

>>66384744
Those data structures aren't "purely functional", these terms can refer only to the programming languages that use them. Purely functional languages make use of immutable persistent data structures, which you can implement just as well in C or python.

>> No.66384807

>>66384783
laziness vs strictness is important in the implementation of data structures

>> No.66384816

>>66384718
as long as both Foo and Bar are TriviallyCopyable
https://en.cppreference.com/w/cpp/string/byte/memcpy

>> No.66384854

Wow. I'm reading SICP online and the way it is written isn't any help at all. I bet only around 10% of /dpt/ managed to get through this book to the end...

>> No.66384871

>>66384854
the usual posters of /dpt/ who have are long gone, like johnson tripfag

>> No.66384880

>>66384854
https://github.com/sarabander

>> No.66384991

>>66384718
uhh probably best if you use a union
just don't use pointer casting

>> No.66384995

Im trying to use pinvoke to use a c++ dll in c#.
In my source.cpp I have
extern "C" __declspec(dllexport) int One(){
return 1;
}

then in the program.cs I have
[DllImport("engine.dll", CallingConvention= CallingConvention.Cdecl)]
public static extern int One();
static void Main()
{
One();
}


But I keep getting the error that the compiler cant find an entry point. Does anyone have any experience with this. Using Visual Studio 2017 if it helps.

>> No.66385002

>>66384995
meant source.h

>> No.66385028
File: 14 KB, 756x350, c.png [View same] [iqdb] [saucenao] [google] [report]
66385028

Do you?

>> No.66385030
File: 1.07 MB, 1280x720, trop.png [View same] [iqdb] [saucenao] [google] [report]
66385030

>>66385028

>> No.66385041

>>66385028
Is it really necessary to cast it?

>> No.66385043

>>66385030
>>66385028
To make sure it's int. You just don't to this?

>> No.66385078

>>66385028
#define let __auto_type
let p = (int*) malloc(sizeof(int[8]));

>> No.66385092

>>66384995
Have you set the C++ to compile as a DLL specifically? Perhaps it's set to compile it as a .exe and expects a main or WinMain.

>> No.66385128

>>66385028
int *i = malloc(sizeof *i * 8);

>> No.66385136

>>66385028
int i[8];

>> No.66385158

>>66383616
I've been coding for a year now and have "learned" six languages and written over 100+ programs (from basic console stuff to java forms to webdev backend stuff).

Still, I don't really feel like I "know" how to program. What's next?

>> No.66385165

>>66385158
learn Haskell

>> No.66385167

>>66385158
>Six languages in a year
That's why you don't know how to program

>> No.66385170

>>66385043
The cast adds absolutely no additional type safety.
It's literally completely useless.

>> No.66385172

>>66385158
start lifting because your problem is your sense of self worth

>> No.66385180

What does /g/ think of Alpaca lang?
https://github.com/alpaca-lang/alpaca

>> No.66385182
File: 1.90 MB, 640x358, satanya laugh.gif [View same] [iqdb] [saucenao] [google] [report]
66385182

>>66384854
>reading a book written for 80' math majors

>> No.66385193

>>66385182
cute debiru.

>> No.66385199

>>66385136
int (*i)[8] = malloc(sizeof(int[8]));

>> No.66385233

Whats a nice scripting language that can actually optimize tail recursion?

>> No.66385236

>>66385028
>>66385030
>>66385041
>>66385043
The only valid purpose for doing this is if you want a (strict) C++ compiler to be able to compile your program. Otherwise it's completely useless.

>> No.66385254

>>66385233
haskell.

>> No.66385260

>>66385233
Guile Scheme.

>> No.66385281

>>66385233
NigScript

>> No.66385304

>>66385281
Bash?

>> No.66385324

what language should i use if im looking to make a roguelike game?

>> No.66385353

>>66385236
>using malloc in C++
literally only one reason to do this

>> No.66385358

>>66385324
haskell

>> No.66385360

>>66385353
malloc > new desu

>> No.66385361

>>66385304
are you blind? I said NigScript. it's the scripting language of the future

>> No.66385373

>>66385353
I use malloc in C++ because I pretty much want to just write C but with classes like I'm in the 80s

>> No.66385434

would it be legal for application to say "enable telemetry or you can't use this program"?

>> No.66385435
File: 45 KB, 400x250, 1526629573447.png [View same] [iqdb] [saucenao] [google] [report]
66385435

>>66383665
Javascript is a better language if your waifu is a trap. It feels kind of like C but is worlds less efficient, just like traps look like cute girls but have weewees.
Imagine programming in a language that looks like C but definitely isn't, while a precious curly headed little femboy that looks like a girl but definitely isn't is wiggling his thicc round ass in your lap and letting you snuggle him and kiss his head while he (((k)))odes.
Even though the two of you are calling it "pair programming" so you don't feel left out, it's just as well that you can't use the keyboard because you need both hands to hold him in your arms and explore his body. After all, programming is a subset of traps. A masculine, normal, reliable, mentally healthy male, cannot be a good programmer. He lacks the requisite "programming socks" and "programming HRT." The highest purpose he can fulfill is provider, of financial, emotional, and physical support and care, for the *real* programmer, to let him do his work without worry.
"But a good programmer would never use JavaScript anyway!" i hear you cry. I beg to differ. A good programmer needs to occasionally use bad languages. Especially if it's because it's a language well suited to traps.
Also it's cute when women, and sufficiently woman-like mentally ill men, use bad languages and still think they're good programmers, because we all secretly know we manly men are actually much better at everything including programming of course but sshhh.

>> No.66385437

>>66385324
Python with libtcod.

>> No.66385460

>>66384995
dumpbin your dll and check if the function exists.

>> No.66385480

>>66385434
i don't see why not?
it's not as if the "or you can't use this program" isn't a choice you're giving them. you're not forcefully invading their privacy, if they don't want your botnet they can just not install it.
i mean windows is legal and they don't even bother to ask. well i mean they do but the options they provide for it don't even work

>> No.66385505

>>66385480
I don't know, my company will do something similar. I find it unethical. I was just wondering if it is legal or not.

The bigger problem is, customers already bought the application. So if they are not able to use it, it is kinda a scam.

>> No.66385526
File: 37 KB, 1127x685, 1509195642647.png [View same] [iqdb] [saucenao] [google] [report]
66385526

Is there anything more boring that OS programming? I sure hope this shit pays off. I could have been learning another language now

>> No.66385534

is going through a code base line by line with the debugger a valid method to understand it?

>> No.66385550

>>66385534
yes

>> No.66385556

>>66385505
>The bigger problem is, customers already bought the application. So if they are not able to use it, it is kinda a scam.
To be safe, you should probably make sure it's completely clear telemetry will be required before you sell the application. Stick something in the EULA about it as well. If customers have already bought the application, and you need them to enable telemetry but failed to make that clear before selling to them, and they don't want to comply, I'd suggest refunding them as reparation for the misunderstanding. That way no one can say it was a scam.

>> No.66385569

>>66385505
The only people who give a shit about ethics are big fat neckbeards more hated than microsoft itself.
Welcome to one of the worst industries.

>> No.66385571

>>66385526
>Is there anything more boring that OS programming?
bootloader programming

>> No.66385580

>>66385526
embeded.

>> No.66385600

>>66385526
>OS programming
As in writing your own OS? No it doesn't pay off, maybe except some specific jobs in embedded development.
>I could have been learning another language now
Most languages in the same paradigm are really similar, better learn a new paradigm.

>> No.66385616

>>66385569
Eh, that is your opinion. I wouldn't work a place is doing things that I find unethical. This current situation is kinda pushing the boundaries of mine and I am not happy with it. The data we collect is not really personal, so it is not that bad but still I believe the users should have a voice in this case.

The saddest part, we will support disabling telemetry altogether. But it can not be disabled by the user, it is only disabled if the user is under 18 years old and we can't legally collect data.

>> No.66386128
File: 231 KB, 700x526, Cherami2_700px.jpg [View same] [iqdb] [saucenao] [google] [report]
66386128

>got a job in fortune 500 company
>2nd year cs

I'm glad I found you autists when I was in high school. Thank you.

>> No.66386405

C declaration syntax is pure shit

if it weren't shit, typedef wouldn't need to exist and you could just use macros instead

>> No.66386450

>>66386405
>types and declaration specifiers aren't always exactly the same thing
Yep, it's shit.

>> No.66386481

>>66386405
I agree, but what can we really do? C has been around for nearly 50 years, it's probably going to be around for another 50. You could write a preprocessor that accepts non-shitty syntax and emits C, but no one would use it.

>> No.66386538

>>66386481
stop writing C.

>> No.66386562

>>66386538
But other languages are bad though.

>> No.66386575

Stop reading memes like SICP and pick up TAOCP.

>> No.66386578

>>66383616
is there a better way to learn C++ then picking basic projects and brute forcing them?

>> No.66386629

>>66386128
Nice meme.

>> No.66386634

>>66385569
Imagine projecting this hard.

>> No.66386674

>>66386450
This is a good thing you retard, if the type weren't split across the declaration specifier and the declarator then you couldn't do cool stuff like this.
int a, b, c, *d, **e, f[26], ***g[4][7];

>> No.66386710

>>66385569
>>66386634
For every person hating M$, there are at least 3 people and a shill wishing for Stallmans' death.

>> No.66386745

>>66386674
There's no use case for "cool stuff like this"

>> No.66386803

>>66386710
But the difference is that the 3 people and shill are wrong.

>> No.66386825 [DELETED] 

>>66386538
I'm pretty sure C has the most native libraries out of any languages in use up to date. I can't just do away with them or use shitty and buggy bindings someone else wrote, or write them myself.

>> No.66386833

>>66386674
at least throw in some function pointers and const for maximum autism

int a, b, c, *d, **e, f[26], ***g[4][7], *(*h)(int *(*), const int*);

>> No.66386848
File: 84 KB, 800x800, e0stFTO.png [View same] [iqdb] [saucenao] [google] [report]
66386848

>>66386745
>There's no use case for declaring variables

>> No.66386853

>>66386833
It didn't have to be this way.
var h func(func() *int, *int) *int

>> No.66386860

>>66386745
Not him but there is one use case: you can put multiple variables of different types in the initializer of the same for loop.

>> No.66386865

>>66386848
There is no use case for declaring variables of different types in a single line. It ruins readability, and you should only declare one per line anyway.

>> No.66386877

I have a C source file. I want all the identifiers, and their scope. How do I do this? I want something like
fun1 static
fun2 extern
fun3 extern
M1 macro
ID macro
var1 static
var2 extern
var3 local
var4 local

>> No.66386889

>>66386865
>>66386860

>> No.66386913

>>66386860
>>66386889
More then one variable in a for loop initializer is unreadable too, and I never found myself needing to do that.

>> No.66386959

>>66386860
If only C had type inference so you could do it for arbitrary types.

>> No.66386961

Are feed (RSS/Atom) to email programs still cool?
I'm looking for a way to manage my feeds. Ideally one that also works on my phone. The easiest solution I can think of is sending each new feed entry by mail.

>> No.66386994

>>66386961
feedly

>> No.66387019

>>66386994
Not open source and I want to write my own (because of boredom).

>> No.66387058
File: 263 KB, 500x554, 1512627174747.png [View same] [iqdb] [saucenao] [google] [report]
66387058

>>66383616
Getting my feet wet with Python and OpenCV to detect the number of still cars in a parking lot space, using a Raspberry Pi with a camera or video files. Still can't quite get it right to eliminate as many false positives as possible, while also not causing false negatives.

>> No.66387283

What kind of data structure would be best for being able to preform a range search over many fields? So for example, say you have customer data for a popular online store. Each customer has various fields: age, name, email, phone, location, etc. You want to be able to search for all customers over 30, with first name mark, email with google in it, located in an certain area, etc. So many search filter options. This is only an example too; my actual use case has far mor fields (around 30-40).

I know of basic range search structures like a kid tree and I read a bit about other R tree structures, but they all seem to be more geared towards lower dimensions.

>> No.66387309

>>66387283
hash table

>> No.66387313

>>66387283
You want to use sql and relatian database or warehouse depending whether its a store oe not. Sql was lteraly designed for that

>> No.66387401

>>66387313
Can sql bases dbs be used with most languages? Are they useful in main mem or only for disk based memory?

>> No.66387416

>>66387401
>Can sql bases dbs be used with most languages?
They can be used with any language, you undereducated idiot

> Are they useful in main mem or only for disk based memory?
SQLite for main memory, others for disk

https://www.google.ru/

>> No.66387422

>>66387401
please educate yourself better. This is baby shit. Use postgresql. It saves to disk but there's caching options.

>> No.66387426

>Make a bogosort implementation in C
>test with data contains 5000 elements unsorted
>completed in 1.32 seconds
And they said bogosort is bogus

>> No.66387442

>>66387283
Maybe a simple array with many sorted/hashed tables of indexes on the side? You're going out of the domain of muh asymptotic complexity of data structures into relational databases. tbf I think you got a bit of tunnel vision from 2 semester of data structures. Use SQLite or PostgreSQL, you'll thank me later

>> No.66387445

>C++ allows overloading of unary ampersand (&) operator for class types.
Why the fuck would you allow that ?

>> No.66387469

>>66387445
probably to implement some "smart pointer" bullshit

use std::addressof if you must

>> No.66387475

>>66387445
Why the fuck not? It may be retarded to use it in wrong cases but its still good to have freedom to do so

>> No.66387555

>>66387416
>>66387422
Assholes.

>> No.66387560

>>66387555
Idiotic cunt american, needing to be spoken to softly instead of harshly. Harshness is what the world of programming needs, to keep the idiots outside. Fuck you.

>> No.66387566

>>66387560
>to keep the women outside.
ftfy.

>> No.66387579

What are some C++ features you can't live without in C?

>> No.66387590

>>66387579
Nothing.

>> No.66387602

>>66387579
templates

>> No.66387608

>>66387442
Relational dbs must still have some kind of internal structure. I’m not implying I’d write my own, but maybe utilizing some of those concepts to fulfill my needs. I just don’t think I need a full on sql type dB.

>> No.66387611

>>66387445
Because in C++, symbols have a life of their own. That's part of the reason this lang suxxes so much, since that's backwards from the natural order of things. In normal reasoning you have concepts, for example trait operations such as pretty printing into an I/O stream or adding, and you create new unambiguous symbols to name them as you go. But in C++ if you're lucky the crippled member functions system is used, or the templates overloading one, but now often than not you have to cram the stuff into existing operators because that's Shitstrup's vision. Furthermore, you have to defend against stuff being crammed into operators in advance by using these retarded unobvious workarounds. Welcome to hell, enjoy your stay.

>> No.66387622

>>66387560
Or you can consider not being an asshole, on top of a thin shelled small dicked loser.

>> No.66387624

>>66387579
RAII

>> No.66387643

>>66387608
That's a good lunge of reasoning. I think they do solve indexing like I describe but basically just use arrays most of the time (although transaction make it more complicated) and above all parallelism a shitton, but that's my uninformed guess

>> No.66387694

>>66387622
You do not understand. Being your friend is not helping you. You must be sad to be a good programmer. If you go in IRC, you learn what I mean. For now? You are some shit, and I hope you will die of cancer. Idiot.

>> No.66387725

>>66387643
they use bitfield indexes among other things. https://www.effectiveperlprogramming.com/2010/10/use-bitfields-to-index-and-search-data/

Applies to other languages than perl too

>> No.66387738

>>66387608
B-trees?

If I were you I'd follow anon's advice and go the path of least resistance and just use a RDBMS. Unless you're on a microcontroller I wouldn't give a damn if anyone think it's bloat to include one or not, because writing fewer lines of code you have to roll by hand means fewer potential bugs and more time to spend shitposting or jacking off to Chinese cartoons.

>> No.66387747
File: 69 KB, 340x372, 1528145753043.jpg [View same] [iqdb] [saucenao] [google] [report]
66387747

>gee, I feel like programming for fun today
>I know, i'll try to write a command line music visualization program on this not-very-popular language!
>first task is header parsing
it's enough to take the wind out of your sails i tells ya

>> No.66387752

How hard would it be to make a web server that simply delivers static pages in C++, something like a very simple nginx ?
I want to do a network related toy-project but i'm scared of chewing more than I can swallow.
I don't know any C++ apart from the basic OOP/classes shit and stuff that's similar to C. I did watch a couple talks and read some blogs mentionning C++, so I understand RAII and smart pointers, I just don't have them internalized (if that makes sense?).

>> No.66387789

>>66387747
Parse what? You want a music visualizer, not a decoder. Get yourself a decoder, an FFT and pretty print the result.

>> No.66387800

>>66387752
super easy

>> No.66387845

>>66387694
I’m sure you’ve come to need the hate to survive. Easier for you to treat others like shit because you know it’s what your own self deserves.

>> No.66387860

>>66387622
fag

>> No.66387877

>>66387643
>>66387738
Ya I’ve been looking into it. SQLite seems like a decent solution. Though I’m not sure how it handles dynamic data that changes as as the application progresses. It seems great for queries on static data that doesn’t change often, but maybe I’m just an idiot.

>> No.66387898

>>66387860
Nigger

>> No.66387902

x = [[0]*10]*10

this creates an array with 10 references to the same list
why is python so shit jesus christ

>> No.66387915

Which is the mosst beautiful code style and program design you have ever seen? And why?

>> No.66387924

>>66387902
>do something stupid
>wow wtf why can I do stupid things shit lang

>> No.66387926

>>66387915
Linux kernel source

Good clean style with little to no typedefs.

>> No.66387938

>>66387924
Tbf, python is more stupid than he is.
Althought anon is really really stupid.

Just sailing.

>> No.66387969
File: 142 KB, 1280x854, 1526506982844.jpg [View same] [iqdb] [saucenao] [google] [report]
66387969

Considering writing a programming language.
>syntax like assembly, but with automatic assignment of intermediate variables (add mul 3, 2, 9) and types
>concept of scope doesn't exist, all variables have to be manually freed, when they do so they lose type
>type inferred from rvalue of variable, which can be a typed (like C's L/LL/UL/ULL suffixes) indeterminate value (_) to initialize without assignment (e.g. mov i, _U64)
>as few operators as possible, everything is a function
>no if statements, replaced with cjmp and cmov
>no for/while/do { ... } while, replaced with the following construct:
mov i, 20; //any integer type large enough to hold 20, can also use C-style 20U if desired
:loop; //label
...
sub i, 1; //if used as rvalue in e.g. ass, does not mutate i
cjmp loop, !!i; //cast i to bool

>advanced turing complete preprocessor

>> No.66387995
File: 380 KB, 678x563, 1528896209753.png [View same] [iqdb] [saucenao] [google] [report]
66387995

How am I supposed to learn coding and C++ by reading 1500 page behemoth

>> No.66387999

>>66387915
Mirai. Easy to read, not overcomplicated, well documented.
SQLite and LuaJIT are considered good examples too.

>> No.66388003

>>66387995
Do the exercises.

>> No.66388021

>>66387995
By wearing programming socks and engineering panties while reading the 1500 page behemoth.

>> No.66388036

>>66387995
>sepples

>> No.66388039

>>66387995
read k&r then the tour book instead of whatever it is you're reading

>> No.66388048
File: 240 KB, 320x320, 1504061252672.gif [View same] [iqdb] [saucenao] [google] [report]
66388048

>NULL pointers are pointers that are said to be invalid/have no value
>however, NULL is defined as 0
>0x0 is a valid address in memory
>so NULL actually represents a value and it's a valid one to boot

>> No.66388078

>>66388048
>>0x0 is a valid address in memory
it's not, I believe it is reserved, for this precise reason.

>> No.66388090

>>66388039
why?

>> No.66388112

>>66388048
Rust doesn't have this problem.

>> No.66388115

>>66388078
Depends on the implementation, and oftentimes you can disable that, or get around it somehow. It's just a crappy bandaid fix.

>> No.66388131

>>66388048
Assigning zero to a pointer doesn't necessarily means the bitpattern making up the address must be all zeroes (in C and C++)

>> No.66388133

>>66388048
theres nothing wrong with this

>> No.66388149

>>66388131
current amd64 implementations only use 48 bits of address space so there are a ton of invalid pointers you could plausibly use for NULL in this way

>> No.66388158

>>66388112
Why not?

>> No.66388168
File: 15 KB, 170x297, images.jpg [View same] [iqdb] [saucenao] [google] [report]
66388168

>>66387694
>You must be sad to be a good programmer.
Don't cut yourself on that edge, kid.

>> No.66388176

>>66388048
>NULL pointers are pointers that are said to be invalid/have no value
Yes.
>however, NULL is defined as 0
No. NULL is defined as (void*)0. NULL can be any value internally, that's just how you generate it. The following isn't guaranteed to be NULL, it's however guaranteed to be 0.
intptr_t n = 0;
void* ptr = (void*) n;

>0x0 is a valid address in memory
No, not on an x86 desktop. The virtual memory will be somewhere else. On microcontrollers, sure.
>so NULL actually represents a value and it's a valid one to boot
Read the spec.

>> No.66388185

>>66388112
Rust has much more problems to worry about

>> No.66388188

>>66388131
>0 is 0 in binary
>except when it isn't
Is this why all "good" programmers are on the spectrum?

>> No.66388211

So why do we do x++ when ++x is usually what we want?

IE return x++; doesn't do what you would naturally expect it to.

>> No.66388220

Null was a mistake.

>> No.66388224

>>66388188
NULL isn't definitionally zero, NULL is definitionally yielded by casting zero to a pointer.

>> No.66388228

>>66388176
>No. NULL is defined as (void*)0.
It can be 0 (and always is in C++).
Literal integer 0 is implicitly converted to the null pointer.
But your example is correct since it's not a literal being assigned to the pointer.

>> No.66388238

>>66388211
x++ looks prettier. desu they should just make it always behave like ++x.

>> No.66388239

>>66388211
++x = yield x after inc
x++ = yield x before inc
>>66388220
No, "women in tech" was.

>> No.66388240

>>66388211
I always thought the opposite.
return ++x; doesn't do what you would naturally expect it to.

>> No.66388245

>>66388176
so (void*)0 seen as a run-time coercion isn't necessarily equal to (void*)0 as a compile-time constant? Did I get it right?

>> No.66388248

>>66388211
I always use prefix ++ simply to be consistent with other unary operators.

>> No.66388261

>>66388211
>>66388240
Think of it like an arrow.
Return -> x++: the arrow hits x first and returns it
Return -> ++x: the arrow has to go through the "++."

>> No.66388264

>>66388240
>use x+=y
>code works

>realize later that you can simplify things so that y is just 1
>x++
>code doesn't work

>> No.66388268
File: 3 KB, 198x83, 1502436834642.png [View same] [iqdb] [saucenao] [google] [report]
66388268

>>66388176
>>66388224
Ummm sweeties...

>> No.66388274

>>66388261
heh this is a nice analogy.

>> No.66388277

>>66388264
You're using it wrong.

>> No.66388325

>>66388188
p = 0 means:
p = int_to_pointer(0)

So of course it doesn't have to be 0 after that.

>> No.66388327

>>66388245
I don't understand what you mean. If you do something like this:
void* np = NULL; //or (void*)0
uint64_t n = UINT64_C(0);

Then memcmp(&n, &np, 8); is not guaranteed to be equal. (void*)0 isn't guaranteed equal to ((void*)1)-1 either.

>> No.66388374

>>66388220
No, they needed pointers to be a Maybe type since passing a boolean value that tells if a pointer is valid is bothersome. Not putting a language construct in place that would stop you from dereferencing NULL at compile time was a mistake, but it's not R&T's fault, concepts like that weren't really explored at that time.

>> No.66388394

>>66388325
Casting to literally any other type doesn't modify the actual bits being referenced, why is pointer a special case?

>> No.66388397

>>66386562
c++

>> No.66388431

>>66388327
I get that but the implication in >>66388176 is that given intptr_t n, n == 0 does not imply (void*)n == (void*)0 which is quite paradoxical if you come from a math background. Care to give the rebuttal that shows why in C this holds nevertheless ?

>> No.66388439

>>66386833
wtf is this
int *(*)

is that a function pointer? sorry brainlet here. i only use c++ version which looks a lot cleaner and easier.
std::function<int()>

>> No.66388443

I should have read into OOP years ago. Why have I been wasting so much time.

>> No.66388451

>>66388394
>Casting to literally any other type doesn't modify the actual bits being referenced
int x = 7;
double y = 7;

Do you think y would have the same bit pattern as x?

>> No.66388460

>>66388394
Any widening conversion will modify the bits, arguably even a narrowing one since it chops the MSBs off.

>> No.66388462

>>66388397
++c

>>66388443
proceduralist?

>> No.66388464

>>66388374
>Not putting a language construct in place that would stop you from dereferencing NULL at compile time was a mistake
GCC has it.
>>66388394
Because it has to provide NULL somehow.
Also, that's not true. Cast signed to unsigned, pointer to number, non-zero number to pointer. All of these might change the bit pattern.

>> No.66388476

>>66388439
I think it's just an int**

>> No.66388478

>>66388443
You mean stuff like the Gang of Four patterns?

>> No.66388481

>>66388431
Because it says so in the spec. Making 0 literal "special" was just the cleanest way to do it. No more explanation needed.

>> No.66388484

>>66388394
These are (implicit) type conversions of values, not cast.
Just like floats/ints.
int x = 1
float f = x
Vastly different bitpatterns.

>> No.66388498

>>66388464
>GCC has it.
Yes, but it's not standard C. I was talking about classic C (the one the second version of Unix was written in) and standard C.

>> No.66388507

>>66388439
#include <stdio.h>

int get_five_print_msg(const char *msg)
{
printf("The message: %s\n", msg);
return 3;
}

int (*get_funcptr())(const char *)
{
return get_five_print_msg;
}

int main()
{
int (*my_funcptr)(const char *);

my_funcptr = get_funcptr();

my_funcptr("Lorem");
my_funcptr("Ipsum");
return 0;
}

>> No.66388508

>>66388481
K thx that's what I wanted to hear

>> No.66388511

>>66388476
Yes, a function pointer needs a parameter list as well.

>> No.66388516

>>66388451
That's not casting, that's comparing two different types.
>>66388460
Only once you try to assign a value to it though, right? If you just cast to a wider type and try to access it you'll either read garbage or segfault.

>> No.66388522

is it worth learning golang? i learned pretty much all the basics of c++ like pointers, lambdas, polymorphism last week but it seems a bit shit desu. i have no idea what to build. i was going to try and optimise a cryptocurrency miner but i feel my understanding of memory isnt good enough to do so. what can i do in go that you wouldnt normally do in c++?

>> No.66388531

>>66388507
God I hate C declaration syntax.

>> No.66388545

>>66388516
>That's not casting, that's comparing two different types.
7 is an integer literal. It gets implicitly cast to double in that example. I don't know where the fuck you got "comparing" from.

>> No.66388554

>>66388522
as long as you dont put it on your cv it is fine

>> No.66388562

>>66386710
Literally not true, most people, even among those who hate Microsoft, don't even know rms exists.

>> No.66388564

>>66388531
And they there call C "simple, clean and elegant".

>> No.66388577

>>66388564
dare*
Idk why my mind slipped like that.

>> No.66388582

>>66388564
Clean no.
Simple? Yes.

Elegant is vague terminology.

>> No.66388588

>>66388507
lol.

>> No.66388595

Guys, how do i make a tic tac toe game in java? Just with the terminal.

>> No.66388613

>>66388554
kek. why?

>> No.66388621

>>66388431
The literal 0 was widely used as the de facto 'invalid pointer', so it was put in as a special case to be implicitly converted to the null pointer.
Conversion between integers and pointers was always implementation defined.
Although in practice I don't think any C implementation would ever implement 0 to pointer and int to pointer differently, they would delegate the 0 case to the general integer case, so the equality would always hold.

>> No.66388624

>>66388522
>what can i do in go that you wouldnt normally do in c++?
Write parallel algorithms really easily. The language's stdlib is better too, since it doesn't have to support weird embedded architectures. There are packages for image manipulation in the stdlib that are format-agnostic for example. You can also write a HTTP server really easily using the net/http package and HTML templates. Writing your own static chan shouldn't be too difficult.

>> No.66388625

>>66388595
create 2d array
then create 3 new lines
then take user input and edit the array
write of if/else statements for when 3 are in a row or diagonal

>> No.66388676

>>66388624
One word:

1 MEGABYTE HELLO WORLD EXECUTABLES

>> No.66388684

>>66388564
Anyone who has actually tried writing a standard-compliant C compiler knows that's a lie. A subset of C could be considered those things, but nothing more.

>> No.66388695

>>66388676
does this happen when you use printf

>> No.66388700

>>66388676
try linking your hello world in C statically and tell me the size.
it's so that applications could be deployed easier.

>> No.66388703

>>66388595
class MainGod{
public static void main(String[] args) throws Exception {
Board board = new Board();
while(!board.getEndStatus){
if(board.getFirstMove(player.getId)){
BoardUtil.move(player, board);
BoardUtil.move(ai, board);
}else if(board.getFirstMove(ai.getId)){
BoardUtil.move(player, board);
BoardUtil.move(ai, board);
}else{
//TODO add try-catch
throw new TicTacToeFirstMoveException();
}
}
}
}

>> No.66388707

where do you host your code?

>> No.66388729
File: 147 KB, 1148x746, 1528324801242.jpg [View same] [iqdb] [saucenao] [google] [report]
66388729

Brainlet here, only done bash scripting but looking to get into python. I really don't get how this shit comes together into a usable program. In a bash script you're basically just giving the computer instructions to execute one at a time, and you can add interactive prompts and logic to decide which instruction to carry out. But in python, you're just asking for values and running logical operations on them. Outside of telling me the length of a string what possible use does this stuff have? How does it come together into something useful? I know this sounds retarded but I feel like I'm completely missing the point.

>> No.66388736

>>66388700
50Kish.
Can trivially be made smaller.
(And Go depends on libc as well)

>> No.66388745

>>66388736
Show me the command line options you used.

>> No.66388765

>>66388707
Github, like any sane person
For apps, I use both Heroku and DigitalOcean
I don't fuck with Azure

>> No.66388776

>>66388736
>And Go depends on libc as well
False. https://stackoverflow.com/questions/41720090/does-golang-depend-on-c-runtime

>> No.66388787

is android development on macos as easy as it easy on win?

>> No.66388795

>>66388707
I keep them on my hard drive.

>> No.66388800

cl /O2 /MT

If your on gnu aids don't use glibc since it's pretty much intentionally designed not go be statically linked, musl will give you around 13K.

>> No.66388821

>>66388745
See >>66388800

>> No.66388826

>>66388729
>In a bash script you're basically just giving the computer instructions to execute one at a time, and you can add interactive prompts and logic to decide which instruction to carry out. But in python, you're just asking for values and running logical operations on them. Outside of telling me the length of a string what possible use does this stuff have?
Some of the stuff tells the computer to do things too. print("asd") is the same as echo "asd" in bash.

>> No.66388850

>>66388787
Actually, Mac OS (or Linux) is much better than Windows for Android development. Everything just work (tm). The only problem I have is ADB shitting itself after ~15 min of debugging on Mac OS.
Source: 7 years of Android development.

>> No.66388855

Mergesort with the separation of the array of [a] and [a+1, .. n] is just an insertion sort

>> No.66388871

I have to learn Fortrans. Should I use a shotgun or OD to kill myself?

>> No.66388874

>>66388855
Oops forgot the
"CHANGE MY MIND"

>> No.66388879
File: 68 KB, 680x622, ___.jpg [View same] [iqdb] [saucenao] [google] [report]
66388879

>>66388800
>>66388821
>Visual Studio
Not a C compiler. I asked for a "hello world" in C. Opinion discarded.

>> No.66388920

>>66388879
clang -O2 -c hello.c
link hello.obj /MT
Gives the same result (obviously, since it's the linker producing the executable, not the compiler)

>> No.66388931
File: 91 KB, 1861x1176, DelugeWithPlugin.png [View same] [iqdb] [saucenao] [google] [report]
66388931

>>66388826
Right, but how do you make, say, a full GUI application out of shit like counting capital letters of a string or finding the modulo of a number or whatever? That's what I'm missing. Like how do you go from

name = "John"
age = 23
if name == "John" and age == 23:
print("Your name is John, and you are also 23 years old.")

if name == "John" or name == "Rick":
print("Your name is either John or Rick.")


to something like pic related?

>> No.66388949

>>66388931
https://python-gtk-3-tutorial.readthedocs.io/en/latest/

>> No.66388960
File: 36 KB, 400x396, 1518548454975.jpg [View same] [iqdb] [saucenao] [google] [report]
66388960

>program compiled just fine
>mom walks in and asks me to do something
>come back
>forget what I was doing
>edit something irrelevant
>compile
>program can't find header file in directory that had no problems before
WHAT THE FUCK

>> No.66388962

>>66388931
You have something like print() that draws text on the screen. You have a function that draws a button. You have a function that hooks up a function to a button, so when you click on it, that function gets called.
It's like lego, even if the individual blocks are simple the constructions as a whole are not.

>> No.66388988

>>66388931
Send signals to the screen to turn pixel on and off based on your business logic. Receive signals from the input devices to let the operator do stuff. There are a lot of details that I left out but that's the skeleton.

>> No.66389017

>>66388960
$ history

>> No.66389048

>>66388920
Use -static in arguments to clang.

>> No.66389050

>>66388920
Are there compilers that produce executables instead of o files or at least bundle their own linker? Is there a benefit in making your own or are there some well tested ones that you have to use?

>> No.66389089

>>66385180
Looks nice but sadly they have a CoC.

>> No.66389115

>>66388729
dumb frog poster.

>> No.66389118

>>66389089
If you care about CoCs you're even more stupid than people who make them.

>> No.66389119

>>66386877
Take a look at ctags.

>> No.66389140

>>66389089
coq > CoC

>> No.66389153

>>66388931
basically your goal is to create an array of pixel data that you push to the screen

>> No.66389163

>>66387969
Interesting.

>> No.66389191

>>66388707
On the server of the IRC channel.
> https://kiwiirc.com/client/irc.rizon.net?channels=#/g/dpt

>> No.66389202

>>66388625
How do i then link it to a text menu that i made in other class?

>> No.66389230

>>66389119
Thanks, that seems to be what I want.

>> No.66389388
File: 415 KB, 1204x2069, interview_simple_problems.png [View same] [iqdb] [saucenao] [google] [report]
66389388

So im learning scheme by going through pic related. Below is my scheme (racket) code for ultra-easy number 5. Is this idiomatic? Could i have done something better? I'm trying to avoid imperative thoughts and i avoided using multiple expression in a function - am i right thinking that is somehow non-functional?
#lang racket

(define (PrintOddness n)
(if (= 0 (modulo n 2))
(string-append (number->string n) "=even,")
(string-append (number->string n) "=odd,")))

(define (PrintOddnessWithoutMod n)
(if (integer? (/ n 2))
(string-append (number->string n) "=even,")
(string-append (number->string n) "=odd,")))

(define oddness '("=even," "=odd,"))
(define (PrintOddnessWithoutConditional n)
(string-append (number->string n) (list-ref oddness (+ 0 (bitwise-and n 1)))))

(define (GetRange from to)
(if (< from to)
(cons from (GetRange (+ from 1) to))
'()))

(define r (GetRange 0 10))
(display (map PrintOddness r))
(display "\n")
(display (map PrintOddnessWithoutMod r))
(display "\n")
(display (map PrintOddnessWithoutConditional r))

>> No.66389478

>>66388931
>>66388988
Rephrasing this without "business logic" (ew):
All computer programs are
>input
>processing
>output
Your platform/libraries provide helper functions for the "processing", but also define what you can input from and output to. Eg you need a graphics library to be able to output graphics, you need a console input function to receive console input. It's all just stuff your platform/libraries give you access to.

>> No.66389513

>>66389388
I don't really know lisp but can't you do

(define (PrintOddness n)
(string-append
(number->string n)
(if (= 0 (modulo n 2))
"=even," "=odd,")
)
)

>> No.66389521

>>66389118
I'm responsible not like you.

>> No.66389564

/sqt/ and /wdg/ failed me, can /dpt/ do better?

Where the hell is a reference doc for Firefox's sessionrestore.json files? There are various keys whose use isn't clear, and using Google on MDN returns zero results. All I found is a page in the Mozilla wiki that's both horribly outdated and incomplete. If their own sites don't know what the fuck the keys do, how the hell can I?
https://wiki.mozilla.org/Firefox/session_restore#The_structure_of_sessionstore.js

>> No.66389572

>>66389513
good point, thanks

>> No.66389581

>>66389564
ask god on #firefox irc.mozilla.org

>> No.66389661

Guys, is this true? I have been really scared of Algorithms because I thought that I needed to be good at math to understand them. However, I found this comment on stackoverflow that gave me some hope.

"A lot of talented programmers understand algorithms before understanding the maths behind them. Maths are only there to help, they are not here to make you understand everything. You will need to spend more time reading about algorithms and complexity, then you might get a sense of how to evaluate them."

I just want to know if this is true, or this dude is just telling me what I want to hear. Thanks in advance!

>> No.66389671

I'm trying to figure this out.
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

int main()
{
pid_t pid;
int childID;

pid = fork();
childID = pid;

if (pid < 0)
{
printf("Fork Failed, ID %d\n", childID);
}
else if (pid == 0)
{
printf("Child succses, ID %d\n", childID);
scanf("d%");
}
else
{
printf("Child Complete, ID %d\n", childID);
scanf("d%");
wait(NULL);
}

return 0;
}

and output is:
Child Complete, ID 4005
Child succses, ID 0
1
1

I don't understand how it prints out both complete and success and then does scanf twice in a row without printing. 1 1 is my input for scanf

>> No.66389719

>>66389661
You need to have a basic intuition about algebra and polynomials and stuff (like late middle school, early high school math) but that's it as a prerequisite for algorithms in general. That's just because people represent the runtime of algorithms using algebraic expressions.

But yes, 90% of algorithm work isn't math related unless the subject of the algorithm itself (the stuff it's processing) is math related, which you probably won't run into. And then the 10% that's left you can learn specifically for algorithms instead of learning broader areas of math (which to be fair might help you, and probably helped me, but isn't strictly necessary).

>> No.66389740

>>66389661
Algorithms can be very varied, not all of them need to be about doing math, though a lot of the brain teaser/CS student exercise types tend to be. And for most common use cases there's plenty of well known algorithms you can implement without even fully understanding what they do, for instance if you need to sort stuff you implement one of the sorting algorithms that already exist rather than having to come up with your own.

>> No.66389782

>>66389740
>>66389719
Thank you for your answers! I have a question though, this might be too much to ask, but is there a course/book/video that refreshes all the algebra, and "polynomials and stuff". Not gonna lie ,I have been avoiding math for the longest time, something I regret. I feel after I have a good base on "Pre-calculus" stuff, I will be able to learn all the tougher stuff a bit easier. Again, thanks in advace!

>> No.66389841

>>66389782
I believe Lang's "Basic Mathematics" is a great refresher and/or place to start math.

>> No.66389851

>>66389782
>Thank you for your answers! I have a question though, this might be too much to ask, but is there a course/book/video that refreshes all the algebra, and "polynomials and stuff". Not gonna lie ,I have been avoiding math for the longest time
Programming is not for you. You are going to fail and make yourself miserable. Please spare yourself the wasted effort and go do something that matches your intellectual capacity better (maybe become a writer, or blogger).

>> No.66389854

>>66389841
>Basic Mathematics
Thank you! Looks great!

>> No.66389865

>>66389851
Life is already pointless, so I might as well waste away my days with something that I want to do/enjoy, instead of just giving up like a little bitch.

>> No.66389883
File: 489 KB, 800x400, file.png [View same] [iqdb] [saucenao] [google] [report]
66389883

Working on adding some system logging.
Pic related

>> No.66389890

why would you have let and let*

>> No.66389893

>>66389671
Well yes, that's what fork() does. What did you expect would happen?

>> No.66389914

>>66389865
You're not going to enjoy it, because you're too dumb to even understand what you're doing. Just go do something else.

>> No.66389933

>>66389914
You don't even know me, and you are already telling me how my whole future is going to unravel. Just because you are a failure because you give up at everything in life, doesn't mean that I have to follow your footsteps.

>> No.66389957

>>66389893
I expected it to print Child succses ask for input then print Child Complete and ask for input.

>> No.66389965

>>66389851
>Programming is not for you.
Even pajeets and women have a place in programming today.

>> No.66389986

>>66389914
Who hurt you my dude?

>>66389671
I'm not sure what you're asking, but that looks okay to me. You aren't synchronizing your parent and child threads so the order of their output is arbitrary (see: race condition).

>> No.66389994

>>66389933
No, I'm not a failure. I'm 100x more competent than you'll ever be, because I'm not so stupid that has to come ask basic ass questions on /dpt/ despite having 1235467890 resources on googlle to answer those very questions.

You're the one who doesn't know me and yet is calling me names. I already know enough about you from your posts to know that you'll never amount to anything.

>>66389965
No, they don't. Just because they can shit out some lowest common denominator app or jsshit doesn't mean they belong here.

>> No.66390004

>>66389957
Well that's not what fork() does. Both processes will execute the same instructions after one another, so they will be more or less parallel.

>> No.66390039
File: 9 KB, 126x101, 1268829353546.jpg [View same] [iqdb] [saucenao] [google] [report]
66390039

>>66389994
Please shitpost elsewhere, you're adding useless noise.

>> No.66390056

What's the most fun you've ever had programming, /g/? I finished the core features of my brainfuck interpreter and now I need some ideas for something to do.

>>66385028
I avoid it, but that's just me.

>>66385580
I like embedded

>> No.66390061
File: 3.85 MB, 280x175, epoy2q.jpg.gif [View same] [iqdb] [saucenao] [google] [report]
66390061

>>66389388
So, like my previous post, i'm hoping someone will take a look at this and tell me if its idiomatic/okay scheme (racket) and what i can improve.
#lang racket

(define (GetRange from to)
(if (<= from to)
(cons from (GetRange (+ from 1) to))
'()))

(map (lambda (x)
(map (lambda (y) (* x y))
(GetRange 1 12)))
(GetRange 1 12))

>> No.66390072

>>66389994
t. kissless virgin white cis male
They bring more value to the company than you ever will.

>> No.66390100

>>66389986
>Who hurt you my dude?
No one hurt me. I'm just mad at the direction programming and computer science are going in. When you go from Dijskra and Tarjan to Pajeet and Stacy, you know your field is going in the wrong dircetion.

This is a matter of self-preservation. We HAVE to fight back against these idiots who want to infiltrate our field and ruin it for us. Think of it like Linus openly insulting people who have nothing of use to contribute to the linux kernel.

>>66390039
I'm not the one shitposting. The one shitposting is the one who comes on /dpt/ to ask whether "algorithms require math" or not. He could get many more answers by googling his question, or even better, by actually doing something proactively, like picking up a programming book. People like him are the kind of people who will contribute nothing to the field except jsshit, because he has no drive to look things up for himself.

Do not encourage this behaviour. Fight back against the people who are actively going to harm us. Idiots.

>> No.66390112

>>66390100
>Dijskra
Dijkstra*, before someone focuses on the wrong details

>>66390072
I'm a gay white whore-tier centrist euro male. I'm not the stereotype you're implying I am.

>> No.66390172

>>66386575
too dense, i can't be fucked to spend hours learning pseudo assembly when i can just read CLRS

>> No.66390296

>>66388703
Why does this look ugly to me?

>> No.66390310

What language has the most elegant lambda syntax?

>> No.66390328

>>66390100
>my field
It's an industry now. With all the jewry this implies.
Forbid access to computers/internet to normies, and it might get back to what it used to be, maybe.

>> No.66390341

>>66390310
Simple untyped lambda calculus.

>> No.66390351

>>66390310
c++
[&](int x){ return x }

>> No.66390354
File: 157 KB, 850x528, 1340809845945.jpg [View same] [iqdb] [saucenao] [google] [report]
66390354

>>66390296
Because it is ugly

>> No.66390360

>>66390341
idk is the dot really necessary

>> No.66390368

>>66390310
It is just meme arrows

>> No.66390417

>>66390310
4chan.

>> No.66390490

You have U64, I64, U32, I32, and so on. Bool is U1. Is void U0 or I0?

>> No.66390532

>>66390490
void is the bottom type since it contains no members

>> No.66390534

>>66390172
>>66386575

First, SICP teaches meta-linguistic abstraction which means exploiting the max amount of high level portability out of your programs. Rewriting functions so that they are merely placeholders that can be dropped in anywhere, and using things like a reduce higher order function to count an array instead of doing it iteratively. That's the goal of that book, teach you to write programs at that level of abstraction to see the potential power much like a book on Abstract Algebra.

TAOCP is completely different, it's the study of computation as a whole. It's not a book about algorithms although it is filled with algorithms and data structures. TAOCP uses a machine language for this as low-level language cost analysis in a machine model represents an almost one-to-one mapping of statements to the instructions of such a machine so it's easier at first to grasp. For higher-level languages, like what is in SICP, this becomes trickier as uncertainties about the cost of automatic memory management, or dispatching OOP shit can't be easily represented with the same kind of analysis modelling but this is also covered in later volumes of TAOCP as it encompasses everything there is to know about programming including some of the abstraction tricks used in SICP. Nobody ever has any time to read TAOCP, it's something you do for deliberate practice like 30mins a day over the span of a few years because once you start reading you get hooked on Knuth's great writing.

>> No.66390554

If I do gcc a.c b.c, does it compile them separately and link, or as a whole?

>> No.66390571

>>66390554
It compiles them as separate compilation units and then links them.

>> No.66390650

Help me with python, please. I need a super simple script that would take the first two values from the .CSV and supply them to the following comand:
curl -s https://api.github.com/repos/{:owner}/{:repository} | jq '.created_at'
and put the result alongside the the two values to the new .CSV

>> No.66390670

new thread >>66390640
>>66390640 new thread >>66390640
new thread new thread >>66390640
>>66390640 new thread >>66390640 >>66390640 new thread

>> No.66390687
File: 46 KB, 288x358, 1488066200298.jpg [View same] [iqdb] [saucenao] [google] [report]
66390687

>>66383616
I'm learning about event driven programming in java and came across this bizarre statement in my text
EventHandler<ActionEvent> eventHandler = e -> {clock.setCurrentTime();}

I wasn't aware you could assign an event handler (or anything) to a lambda expression. Why does this work? What is really going on?

>> No.66390744

>>66383683
Read CS:App
Read any book about systems programming, such as 'Programming Rust' or any Erlang book on failsafe systems
Read an Operating Systems book, use FreeBSD to make your own optimized kernels as it's simple, straight forward architecture which is why places like WhatsApp/Netflix use it for optimization as complexity is low with BSDs
Read an Advanced Operating Systems book, or take a course about it on edx/udacity or find a university graduate page with lecture notes on microkernels.
Install Hurd/Debian VM image, and drop in NetBSD rumpkernels so it runs on your hardware. Reboot, congrats you're now a research OS dev that can work in embedded

>> No.66390780

>>66390687
A lambda expression is syntax sugar for an anonymous class in Java. It automatically creates a class that implements the EventHandler interface/abstract class. The single abstract method which is part of the inherited interface/abstract class is automatically assumed to be the one corresponding to be the one the lambda is implementing.

>> No.66390789

>>66390687

Well, event handlers are methods.
So is a lambda expression. It's an anonymous method.

>> No.66390850

>>66390670
calm your tits, friend

>> No.66390924

>>66390780
>>66390789
Thanks guys!

>> No.66391106

>only the compiler knows what the real return type of a Supplier is
FUG

>> No.66391112

>>66389661
What you need to program is some ineffable set of skills you might call "programming logic". Have you ever met some really intelligent people that however couldn't for the life of them learn, say, calculus, or some branch of philosophy? Similarly, some regular or even dumb people have an easier time learning one or other discipline. I don't mean that some people are incapable of learning calculus, just that they're not going about it in a way that befits their way of absorbing and fixating knowledge, seeing as virtually the entire education establishment worldwide is built upon exposition and repetition, whereas other possible methods (deduction, discussion etc.) are very rare.

With that in mind, if you happen to have no problem with programming knowledge, you're already better off than most, and truth be told, you'll need very little math for general utility programming. You wouldn't believe how many people have trouble grasping the very basics of C, and I'm talking about things like making and calling a function to calculate the square power of a given number.

>> No.66391432

>>66391112
Thanks lad. I wanted to learn Algorithms, because I wanted to take my programming skills to the next level. So my fear was that if I was bad at math, I wouldn't be able to master them.Gonna still give it a shot, though. Anyways, thanks for the kind words, anon.

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action