[ cyb / tech / λ / layer ] [ zzz / drg / lit / diy / art ] [ w / rpg / r ] [ q ] [ / ] [ popular / ???? / rules / radio / $$ / news ] [ volafile / uboa / sushi / LainTV / lewd ]

λ - programming

/lam/bda /lam/bda duck
Name
Email
Subject
Comment
File
Password (For file deletion.)

BUY LAINCHAN STICKERS HERE

STREAM » LainTV « STREAM

[Return][Go to bottom]

File: 1446921776617.png (368.05 KB, 1899x1593, intent.png) ImgOps iqdb

 No.11658

This is the Beginner's General for beginner's questions.

If you have a simple question and a suitable thread doesn't already exist, just post it here and someone will probably try to answer it for you.

Remember to do some research before asking your question. No one wants to answer a question that a simple search can already resolve.
>>

 No.11723

I'd like to get a good understanding about low level programming and the inner workings of computers, any good books?

>>

 No.11725

Oh fuarrrk the old one died, can someone repost all those links for getting started?

>>

 No.11726

>>11723
I used "Computer Architecture: A Quantitative Approach" in college. It was pretty good.


>>

 No.11747

File: 1447052456690.png (1009.76 KB, 2000x2210, which-programming-language….png) ImgOps iqdb

Running the risk of disrespecting the sticky, what materials and/or guides do you recommend I use when beginning to learn C? I downloaded the gentoomen lib so I have plenty of guides to choose from. I'm just a little overwhelmed and wish to start off on the right foot.

>>

 No.11749

>>11747
K&R C is the classical introduction but it depends on what you are learning C for as K&R is definitely unix oriented

>>

 No.11750

>>11747
This is what I used to give myself a paltry refamiliarization of the language:
https://www.gnu.org/software/gnu-c-manual/

>>

 No.11755

>>11747
It depends on what you want to do, really. Obviously you can get the basics down in about a day or two(variables, functions, control flow, operators, etc). And something like python or a lisp(scheme/racket) will do that just fine without cluttering you up with syntax rules. You probably won't use your first language very much anyway, i didn't.

After that, just pick a path and stick to it. Web development(front end or back end), kernel development, general sysadmin stuff like scripting or pentesting, robotics, iOS or android dev, you get the idea. Once you're into it a little bit you'll see that the language choice is semi-irrelevant, and you'll spend more time learning frameworks or libraries for the language instead of the language itself.

>>

 No.11756

>>11747
Also don't listen to what the chart says about salary. It really depends on where you live. I've seen job postings for PHP devs making oodles of money, and iOS devs making peanuts comparatively.

>>

 No.11767

>>11728
>>11726
thank you kindly

>>

 No.11773

Anyone have a simple tutorial on lambda calculus, Church encoding, and the Y combinator(or anything about combinatorial logic)? Thanks lainons

>>

 No.11774

>>11773
>simple tutorial
What do you mean? From a programming standpoint or more general?

>>

 No.11776

>>11774
Any resources you might have for understanding this complex topic would be appreciated.


>>

 No.11831

File: 1447190867971.jpg (90.83 KB, 491x1024, n3nt9v2.jpg) ImgOps Exif iqdb

How do I find a open source project to contribute to? I know the basics of C but Im scared to jump in and possibly mess up someones project...

Im just not really sure how to go about it.

>>

 No.11833

>>11831
RF was fun this year; too bad about the retards getting the hotel contract cancelled.

>>

 No.11835

>>11831
Basically just do it. They'll have to decide to pull your changes anyways so it's not like you can mess up the project, the worst that can happen is you waste a couple minutes of their time deciding not to include whatever you did.

Most programmers will appreciate any help. soykaf code is 100% better than no code.

>>

 No.11836

>>11831
You could always create your own project first. Getting some experience on your own can't hurt.

>>11835
>soykaf code is 100% better than no code.
I would disagree.

>>

 No.11842

File: 1447200499456.jpg (9.85 KB, 331x333, 1341511348408.jpg) ImgOps Exif iqdb

I have a python project that imports some modules I made. If I want to share this project on something like github, do I need to put the modules into the project directory? How am I supposed to structure this?

>>

 No.11844

>>11831
follow your interests, clone repo, play around with the code, read/help with issues, write documentation. if you actually get to the point where you are submitting pull requests (even if they are quashed) then you are doing well.

you won't get the chance to mess up anyones project so just clone and go nuts.

>>11842
>do I need to put the modules into the project directory?
of course. read the PEP stuff on namespace packaging.

>>

 No.11847

I want to write multiple lines to a binary file in C, on multiple different occasions. But I just keep writing over the same lines. Ive tried using fseek but I keep overwriting the same lines.

Are their any super sekret C library functions that can help with this? Im using C99 btw.

>>

 No.11854

>>11847
Not to be a dick but fseek really does work. If you're getting some unexpected behavior it's not fseek magically not doing anything. Read the documentation on it to make sure you understand all the arguments and look for other possible mistakes.

>>

 No.11878

Do you think someone with zero programming knowledge could learn to program reading The art of computer programming?

>>

 No.11879

>>11878
Absolutely not. That book is not intended for beginners, and isn't about teaching a programming language. It's a computer science book, which means it's about algorithms. It's something you'll want to read eventually but picking it up now would be like trying to read a calculus textbook when you don't know basic arithmetic or algebra.

>>

 No.11884

>>11773
Try the Little Schemer if you haven't already. All of those are covered alongside some other topics (continuations, I think a simple metacircular evaluator is presented in the last chapter but you can skip that). You'll understand lambda calculus after it, and the Y combinator and church encoding are covered as well.

Back when I was learning these topics I thought they were more complicated/mysterious than they actually are; you might too. However I still suggestion the Little Schemer.

>>

 No.11886

>>11854
thanks for the response and no offense taken, I was just asking to make sure I was not hammering a nail with a screwdriver. Im definitley doing something wrong thats for sure! Ill take another look.

>>

 No.11888

>>11886
One thing that struck me as odd was your saying that you're writing a binary file, but continuing to talk about lines, which don't exist in binary files.

>>

 No.11897

File: 1447294479330.jpg (60.93 KB, 245x245, 1445823511080.jpg) ImgOps Exif iqdb

>>11888
pls be kidding

>>

 No.11899

>>11897
I don't know much about C. The languages I use distinguish between binary and character files more.

>>

 No.11933

all files are binary files

>>

 No.11940

>>11933
All programs are machine code.

>>

 No.11945

So uh guys ive had a bit experience with programming and am trying to read some source code but for a big project i am just seem lost.
Any tips for reading source code for bigger git projects?

>>

 No.11962

>>11945
Don't try to read all of it, only read the bits you care about.

>>

 No.12084

>>11831
I've also been at this point for a bit.
I'm decent enough with C now and can make my way through python.
It just seems that every C project I see is either super low level(kernel) or way out of my depth. Or both.

>>

 No.12112

File: 1447884772773.png (145.14 KB, 747x622, Снимок экрана 2015-11-18 в….png) ImgOps iqdb

Wat's wrong with this enumarate function? I don't want to use "count +=1"

>>

 No.12114

>>12112
`enumerate` enumerates the whole list, including the files you don't print. You need to filter the list before the enumeration.

Something like
enumerate([x for x in listdir(".") if ".lst" in x])

>>

 No.12116

>>12114
Thx, i got this.

>>

 No.12131

File: 1447914179470.gif (992.8 KB, 250x250, 1440141651891.gif) ImgOps iqdb

>google "std::map"
>"STD Map Lets You See How Many of Your Neighbors Have the Clap"

>>

 No.12136

>>12084
>kernel
>low level
retardalert.gif

>>

 No.12139

I want to make a simple shader using webgl and I'm not sure where to start.
I started reading basics online but can't find any code to get to know the syntax.
Any good resources lains?
possible to make simple shaders by the end of the week?

>>

 No.12141

Absolutely. It's basically a chain of C-like programs taking standardized inputs and outputs in a way that differs between shader versions.

>>

 No.12186

Where is a good place to start in programming?
I know absolutely nothing about programming, and trying to find the best way in without killing my motivation.
I've heard people suggest Basic as a beginning language, while other sources suggest C or Python.
A little help?

>>

 No.12187

I'm learning C from K&R, and although I understand what I'm reading and could explain how a given feature works if asked, I feel like I lack practial understanding. What are some good open source projects to study and analyse so I can get a better idea of how it would all be implemented in a real situation?

>>

 No.12188

>>12186
I don't really agree with the concept of "beginner" languages. Decide what language you want to learn and stick with it, sure it might be a bit more of a pain to get started but knowing you are pissing about learning a bunch of language specific soykaf you are never going to use because you're going to switch in a few months anyway is more of a demotivator. I'd say just go for a C variant, by the time you get the point where it matters which one you picked you'll know how to program.

>>

 No.12200

>>12188
beginner languages are popular languages. You'll find much more digestible leaning resources on Java or Python than you would on Go or Smalltalk.

>>

 No.12219

>>12200
Which is funny because Smalltalk was made to teach kids.

>>

 No.12291

Why do we use special algorithms for encryption? Why is that preferable to say a simple cipher where each character is represented by 128 more characters. Aren't both of these options nearly impossible to crack with brute-force?


(and also maybe a simplified version of one of these algorithms?)

>>

 No.12295

>>12291
Unless your cipher is as big as the data you're trying to encrypt, breaking your cipher will be really easy.

And really, having a 128-characters long password kinda is like kicking dead whales down the beach , especially if you often make typos. My longest passphrase is 94 characters long and I always have to type it at least twice when I want to decrypt something.

>>

 No.12298

>>12291
You're almost describing one-time pads, which are provably unbreakable when used properly.

All you do is have a random block of data used to encrypt your block of information. Both have to be the same size.
Modular addition encrypts and modular subtraction decrypts.

>>

 No.12300

>>12291
kind of related I want to get into ciphers, encryption and steganography what are some good textbooks to get started with. I've already had a look about but I'd be interested to hear some lains opinions

>>

 No.12302

>>12300
'Applied Cryptography' by Bruce Schneier. It's old and contains lots of dated info, but if you take it with a grain of salt and perhaps peruse Wikipedia along with it for more up-to-date info, you should have a solid base. You can also get it pretty cheap on eBay.

There's also 'Cryptography Engineering' by Ferguson and Schneier, which is supposed be an abridged and updated version of the former. A kind of a reference handbook for the working programmer.

Unless you have a crippling aversion towards math (which you shouldn't in this field), check out 'An Introduction to Mathematical Cryptography' by Hoffstein and Pipher. This one goes more into the theoretical aspects, but not too far. The math is easy, at most at an undergrad level. In my opinion, it would be a great counterpoint to 'Cryptography Engineering', shedding a bit more light on the inner magic. It's a Springer UTM, so it's a tad expensive, but I'm sure you can find a free version on the wired.

>>

 No.12308

>>12291
the problem with that is that you increase the volume of your encrypted files by 128x. Wich is not so good, to put it mildly.
20-50% is considered acceptable.

A modern cipher is much more efficient, it maps an alphabet of 2 charachters (0,1) to another alphabet of 2 characters (0,1 again), but does so in a nonpredictive way, at least until you have the correct key.

>>

 No.12322

>>12291
>where each character is represented by 128 more characters
what?
>Aren't both of these options nearly impossible to crack with brute-force?
If you came up with it then no. That's Schneier's law.
>Why do we use special algorithms for encryption?
Because doing encryption in a way that isn't easily breakable is really fuarrrking hard. All encryption is based on problems that can't be solved, but it's really hard to show that a problem can't be solved because you can never be sure somebody clever enough won't find a way.

>>

 No.12330

>>12322
>All encryption is based on problems that can't be solved
Problems that we *think* are hard to solve, rather. This is true for almost all cryptographic assumptions, including CDH/DDH, discrete logarithm, integer factoring, P/=NP, etc.

>>

 No.12391

what is a good way to start AI programming?

>>

 No.12394

>>12391
Well learn a Lisp, like Common Lisp.

Lisp's use of its symbol datatype makes it much more symbolic than other languages. This in turn allows you to make things more abstract.

This is combined with automatic memory management, simple syntax, and other niceties to allow you to think almost exclusively about the problem you're actually trying to solve and less about the language itself.

>>

 No.12403

How much maths should I know if I want to get into this? I want to be able to read SICP/TAOCP and maybe one day concrete mathematics.

>>

 No.12405

>>11897
He's right though. I mean a binary file can have '\n' and '\r' in it but if it's really a binary file those don't correspond to their ascii representations. For example they could be one byte out of a float value.
>>12394
Lisp is good for genetic programming and things like that, but for more data oriented approaches (i.e. neural nets) it's kind of a pain in the ass.
>>12403
I haven't read any of those but in general it's good to know about addition and multiplication, functions and some graph theory. Continuous stuff like calculus is only rarely useful in specific fields.

>>

 No.12415

The following started out as a simple loop to find some averages of all numbers in some vectors. I kept adding the comments in to try and figure out what is going on. Oddly enough, the program crashes every time "i" reaches exactly "138232". I feel like my noobish status is leaving something blatantly obvious that I'm missing. I don't think it's out of memory. Last line in the console is

Process returned -1 (0xFFFFFFFF) execution time : 23.534s



//Find global averages of seperate colors
///ISSUES HERE=============================================================================
///Compiles fine, causes crash for unknown reasons when "i" reaches 138232
///Last output to stdout is "Inside Loop".
for (unsigned int i = 0; i < image1.size(); i = i + 4)
{
if(logExtraLoud)
std::cout<<std::endl<<"Inside loop"<<std::endl;

GA.red = averager(red1[i],red2[i], GA.red);
GA.green = averager(green1[i + 1],green2[i + 1], GA.green);
GA.blue = averager(blue1[i + 2],blue2[i + 2], GA.blue);
GA.alpha = averager(alpha1[i + 3],alpha2[i + 3], GA.alpha);

if(logExtraLoud)
{
std::cout<<"Good loop. "<< i <<std::endl;
std::cout<< i << ","<< i + 1 <<","<< i + 2 <<"," << i + 3 <<std::endl;
std::cout<<image1.size()<<std::endl;
std::cout<<"Ga.red: "<<GA.red<<std::endl;
std::cout<<"Ga.green: "<<GA.green<<std::endl;
std::cout<<"Ga.blue: "<<GA.blue<<std::endl;
std::cout<<"Ga.alpha: "<<GA.alpha<<std::endl;
}

}

>>

 No.12418

>>12415
>Process returned -1 (0xFFFFFFFF) execution time : 23.534s
That doesn't look like a typical crash message. What OS?
Without seeing the rest of the code my only guess is you're going way off the end of one of the red/green/blue/alpha arrays and happen to hit a page boundary at 138232. However that message makes it sound like it's not really crashing but calling exit(-1) in the averager or image1.size functions.

>>

 No.12420

>>12418
I just figured it out and yes, it was a stupid mistake on my part. The RGBA vectors are derived from a vector that comes from the library that I'm using to read images. The library orders the different elements of the vector that it returns as RGBARGBA. I have a function higher up in the code that reads this and iterates over that first vector, placing each element in either the R,G,B and A vector. This, of course, causes each of the four vectors to be 1/4 the size of the original "image1" that it comes from, meaning that "i" was going way beyond where it should.

>>

 No.12457

I've started learning haskell and would like to learn with someone else. If anyone here would like to learn haskell together and work on small pet projects to become better then it would be great.

I'm working on unix if that helps

Currently I'm the only one learning haskell at uni while the others learn python so I've not been able to compare code or discuss how to approach different problems with anyone on my course. Would have tried the computing society if they were still going but that seems to have disolved last year. Also there isn't any lacturers who know it well enough to teach it here (they mostly do C++, Java, ASM and one does Lisp).



Delete Post [ ]
[ cyb / tech / λ / layer ] [ zzz / drg / lit / diy / art ] [ w / rpg / r ] [ q ] [ / ] [ popular / ???? / rules / radio / $$ / news ] [ volafile / uboa / sushi / LainTV / lewd ]