[ / / / / / / / / / / / / / ] [ dir / agatha / animu / ausneets / bestemma / leftpol / liberty / omnichan ]

/prog/ - Programming

Programming board

Catalog   Archive

Winner of the 2∞rd Attention-Hungry Games
/liberty/ - Physical removal time, communist swine.

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 16 MB.
Max image dimensions are 15000 x 15000.
You may upload 2 per post.


File: 1439697368517.jpg (179.29 KB, 480x710, 48:71, 9780262019347_0.jpg)

c71b16 No.3034[Reply]

This guide assumes you forgot everything from highschool. No you don't have to learn any of this in order to program you can just start hacking around every .c file in your kernel.org git source clone and see what happens. Why would you want to learn math? Because it will change your thinking. You won't be easily fooled by bullshit, you will have tools to sort through obvious logical fallacies. You will be able to optimize programs and create your own algorithms. You will be able to estimate. Above all, you will be able to solve problems using computation which is what computer science is all about. And least of all, you will get paid more than anybody else without this knowledge so if your goal is shekels then read on. Note: DO THE EXERCISES. You won't learn otherwise. Books instead of video lectures were chosen because they've lasted 30+ years some of them in relevancy in the field, also lectures disappear all the time like when MIT nuked all one prof's Physics OCW lectures because he tried to pickup a student, setting a precedent that at anytime this information can disappear. Read a book nigga.

Math Preliminary

Basic Mathematics by Serge Lang

Buy/Pirate this book (he's dead). It's highschool math, from the perspective of a Mathematician. You will learn up Pre-Calculus and be prepared for rigorous proofs later.

An Introduction to Mathematical Reasoning" by Peter J Eccels

This changes you from rote drilling and being a human calculator in highschool to learning what math actually is, and what proofs do. Excellent, excellent book.

How to Solve It by G. Polya

How to do proofs, written in 1940s and still for sale in every Chapters/B&N bookstore to this day because it's the best proof helper that exists.

Welcome to Proofs

Calculus" by Spivak

Actually, you are learning ANALYSIS, in addition to calculus. Torrent the 3rd edition w/the answer book. This is a fucking hard assed book, you may be bePost too long. Click here to view the full text.

229 posts and 19 image replies omitted. Click reply to view.

bcea5d No.4963

>>4962

>>4960

For this reason OP recommends Sheldon Axler's PreCalculus in the updated guide: https://functionalcs.github.io/curriculum/




File: 1411372549161.jpg (64.52 KB, 447x553, 447:553, 23456456789.jpg)

706e1e No.60[Reply]

Does /prog/ need images?

http://strawpoll.me/2622392

Also you can suggest changes (rules, dashboard).
72 posts and 4 image replies omitted. Click reply to view.

2cf9ec No.4767

more textbrowser-friendly sites will go a long way toward reducing internet cancer levels




6d99f8 No.1351[Reply]

RULES

No advertising.

Stay on-topic.

No questions like "can someone do my homework?".

Use code tags for code and $$ for math.

No shitposting.

Don't do anything that requires to add more rules.


http://8ch.net/prog/rules.html
1 post omitted. Click reply to view.
Post last edited at

6d99f8 No.1359

>>1351
If you want to contact the admin of this board you can send a mail to prog@8chan.co



File: a171655ea2ef1ec⋯.jpg (300.19 KB, 1003x1003, 1:1, lain ascii.jpg)

a86053 No.4951[Reply]

>told I need to learn Git

>make repository for a personal project I'm working on

>fuck something up

>try to revert changes

>somehow fuck it up even more and lose more stuff

>never touch Git again

Well lads I need to learn this crap at some point… Can somebody please explain how to use it? For the sake of simplicity I want to get familiar with it while doing a solo programming project with a local repository (so no Github or any of that crap).

I want to be able to revert back to a previous version in case I mess something up. Do I commit changes every time I'm sure everything is working correctly after implementing something? I would appreciate if somebody did a quick rundown on the development process using Git because all the stuff I find online is confusing and assumes everything is apart of some big project with several people on Github.

e86a98 No.4954

Same way you learn anything. Dig into the implementation, experiment, fuck up a few times, and get iteratively better.

There are different workflows. I make sure my master branch is always functional, and do tons of small commits that get squashed before a push and merged into master when finished and tested. Some people do a master branch of releases, an "edge" branch for unstable and untested work, and feature branches, and merge edge into master when it's ready. Some people do development on master and mark releases with tags or release branches. It's up to the size of your team and what makes you most comfortable to work with. Git makes very few assumptions about how your workflow goes, so you have to figure out how you want to do it yourself. Every commit to a branch will always be reachable for a checkout until you delete that branch out rebase.

Regardless of how you do the rest, you want to do features and bugfixes in their own branches to make working and merging more sane.


a86053 No.4955

>>4954

I don't understand half of what you said, senpai. It totally new to this and am trying to understand the basics.

Are you saying you should have the master branch completely tested/working, and then make a new branch every time you want to change something or build on it? And then merge it to the master branch when you know its working correctly?


144fcf No.4956

Think of it like saving in a video game.

> I've made a project and I want to use git

git init

> I've made changes that I want to save

git commit -am "<your commit message here>"

> I want to go back to the current save I'm at

git reset –hard

> I want to select a different save

'git log' to view them, then 'git checkout <commit hash>' to go there.

I think if you do this and overwrite the current "master" save you'll need to use the –force flag or something. I haven't done it in a while.

There's more, there's a whole lot more, but this will get you pretty far while you actually go and look at the docs.


e86a98 No.4961

>>4955

>I don't understand half of what you said, senpai. It totally new to this and am trying to understand the basics.

That's fine. It just means you haven't fucked up enough yet. You'll get the hang of it. Use man pages, prop up tiny test repositories and fuck with them.

When I say squash, I mean http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

Squashing is useful because as you work, you usually want to make tons of commits to make it easy to backtrack, cherry-pick older things, and keep track of where you are. Before you push to the remote, though, you probably want to "squash" those into a single larger commit, so it's easier to merge and manage on the other side and looks better in your commit history. It also allows you to have a large commit with a large, detailed commit message, which isn't as easy when you are doing 10 commits a day and keeping them as-is. It's not mandatory, but when you're working with other people, they usually appreciate fewer commits grouped into logical chunks. Even when you're working alone, going back and looking through old commits when you need to is easier with larger squashed commits.

> Are you saying you should have the master branch completely tested/working, and then make a new branch every time you want to change something or build on it? And then merge it to the master branch when you know its working correctly?

I'm not saying you should, but that is the way I do it at home (at work we do a "master" release branch and an "edge" target branch for merges. Features and bug-fixes are handled in individual branches created by our issue-tracker and merged through the web interface [because only the project manager is allowed to merge to edge or master, so manual merging and pushing is restricted]). You can divide it up however you want, but you should definitely use branches to organize your work and keep it easy to maintain and manage. They are useful tools, and probably the very most useful feature of gPost too long. Click here to view the full text.




5e5ff7 No.4513[Reply]

Are there jobs for C programmer that don't do embedded stuff?

I started to learn C 20 years ago… I even got hired a couple times to teach C, but I never got a job about coding in C… The closes was coding in Obj-C for iOS a couple times.

So… there are no C jobs except for embedded?

5e5ff7 No.4531

>>4513

I have no idea what you're whining about.

The most fun things to program in C are usually embedded. If you're in a sophisticated OS environment it often feels stupid to write C unless you're doing something that is easier to do in C, but such things are usually even more fun in embedded environments.


5e5ff7 No.4532

I don't think you understand the productivity of writing application software in C as compared to more modern high level languages. I guarantee that you can get more work done in less time in a modern language and this is why you don't see a demand for the C language outside of embedded applications.


5e5ff7 No.4586

I mean you could go to programs that are meant to interface with embedded systems however do a plethora of other things as well. I'd say yeah. You've obviously got operating system development, but also progs like digital audio workstations that allow combination of midi or audio controllers to work with a computer. In other words yeah, but not really off the top of my head.


7a81e7 No.4959

There are operating systems, drivers etc. But stuff that isn't really low level is usually done in C++, as really large C projects usually end up becoming a mess.




File: a64fca2bfc93a21⋯.jpg (146.93 KB, 720x1280, 9:16, C8RIF3PU0AAgvkR.jpg large.jpg)

2e1883 No.4900[Reply]

Why don't you learn Ruby?

.

4 posts and 4 image replies omitted. Click reply to view.

5a0fdf No.4910

Because it makes absolutely no fucking sense at all?

Everyone that writes code in a non-compiled language is a brainless, dickless, soyboi faggot.


ef04a7 No.4935

>>4900

>Why don't you learn Ruby?

RVM was invented to solve a problem. The problem is not solved, and every time I have to deal with the ball of mud that is Ruby and its library versioning hell, I die a little inside.


110fa7 No.4939

>>4900

Red pill me on Ruby lads. I never looked into it, why is it so bad?

Tl;dr pls.


98494e No.4957

>>4939

Yeah I'd love to hear this too. I actually like how the language is written but I'm willing to hear why some people have a huge shitfit about it. I'm slowly going toward Node.js because it's faster and more modern, but I don't think Ruby is the nonsense everyone seems to think it is.


0245a0 No.4958

>>4910

Or, he's a web developer.




File: 497f0148664890c⋯.png (782.51 KB, 710x600, 71:60, Smug Kitty.png)

854c0b No.4934[Reply]

Hey guys I've been wanting to learn about file formats for some time. Mainly interested because of vidya programming. Basically I want to learn how to properly structure data in text files for the purpose of saving/loading game data for any kind of scenario. I've not been able to find any information, nothing I search up brings me the results that I'm looking for. I've been just winging it this whole time, thinking there must be some kind of standard for this stuff. Please send help, thanks.

1 post omitted. Click reply to view.

a1bcc8 No.4942

*UNIX Programming, not "computer programming".


b7588d No.4945

>>4941

>>4942

Thanks Anon-kun, trust me the last thing I want to be is a shitcoder.

>Unix

Got anything that isn't just for Unix though?


dc7499 No.4948

There are many different ways to do it, with many pros and cons:

1. Writing data as text, and reading it in as text

+ Simple, usually easy to do

+ Just works

+ Easy to edit by hand

+ Generally quick to parse

- Breaks very easily, brittle

- Quickly gets unwieldy

- Large file size

- Very difficult to extend and scale

2. Just write it out as binary data, read it in in the same order

most of the same pros and cons as above, except

+ Small file size

+ The quickest parsing possible

- Difficult to edit by hand

- Can break when used on a different computer (endianness)

3. Dump it out as a simple text format that uses a library (like JSON)

+ Usually very fast

+ Easy to work with

+ Easy to understand

+ Easy to edit by hand

- Lack of schema and flexibility of format can make things painful

- Editing by hand is usually easy, but it's also easy to break (by, for instance, forgetting a comma)

4. Dump it out and read it in as a schema format (like Protocol Buffers or Capn Proto)

+ Incredibly fast

+ Very easy interface

+ Schema enforcement

+ Backwards-compatible for easy scaling

- Not hand-editable

- Can be difficult to figure out what has gone wrong when something goes wrong

5. Use something like SQLite as an application file format, and operate on the file as a database

+ Very fast (usually at least as fast as a binary format)

+ Don't have to load into memory while workingPost too long. Click here to view the full text.


b7588d No.4952

>>4948

Thanks for the effort post. What about using XML for data files?


dc7499 No.4953

>>4952

It works, but it's easiest if you do it as part of some serialization framework. Managing XML by hand is often a pain in the ass and way more verbose than other formats. Most everything that XML does, JSON does in a way that's easier to work with, read, and maintain.




File: 5144bf0be5c5022⋯.jpg (3.95 KB, 480x360, 4:3, hqdefault.jpg)

b082e7 No.4896[Reply]

This was posted before, apparently you just play some dumb slots game and get free ethereum you can withdraw. Is this site a scam?

http://ethcombo com/?i=49998

4ec1b5 No.4950

Yes.




File: 361ac4a9621e572⋯.png (71.24 KB, 1232x811, 1232:811, proofs.png)

c29764 No.4943[Reply]

Managed to do this challenge. The way the code works is to make a table of equations describing the FSM to match the numbers, and then algebraically reduces it down to a single term. The regexes it produces are longer than they need to be but they work. Simple solution but took a lot of thinking to get there.

Here it is in action for n = 5:

0 = 0(0) | 2(1)
1 = 0(1) | 3(0)
2 = 1(0) | 3(1)
3 = 1(1) | 4(0)
4 = 2(0) | 4(1)

0 = 0(0) | 2(1)
1 = 0(1) | 3(0)
2 = 1(0) | 3(1)
3 = 1(1) | 4(1*0)
4 = 2(0)

0 = 0(0) | 2(1)
1 = 0(1) | 3(0)
2 = 1(0) | 3(1)
3 = 1(1) | 2(01*0)

0 = 0(0) | 2(1)
1 = 0(1) | 3(0)
2 = 1(0) | 3(1)
3 = 1(1) | 2(01*0)

0 = 0(0) | 2(1)
1 = 0(1) | 1(10) | 2(01*00)
2 = 1((0|11)) | 2(01*01)

0 = 0(0) | 2((01*01)*1)
1 = 0(1) | 2((01*01)*01*00)
2 = 1((10)*(0|11))

0 = 0(0) | 1((10)*(0|11)(01*01)*1)
1 = 0(1) | 1((10)*(0|11)(01*01)*01*00)

0 = 0(0) | 1(((10)*(0|11)(01*01)*01*00)*(10)*(0|11)(01*01)*1)
1 = 0(1)

0 = 0((0|1((10)*(0|11)(01*01)*01*00)*(10)*(0|11)(01*01)*1))

regex: ^(0|1((10)*(0|11)(01*01)*01*00)*(10)*(0|11)(01*01)*1)+$

c77506 No.4946

>>4943

I tried that website and got frustrated by how long it takes to submit a solution. 90% of the time it failed to communicate with the server after waiting about a minute.


c29764 No.4949

>>4946

Works all right for me. Maybe your internet's shit.




File: 1462256813384.jpg (37.2 KB, 486x399, 162:133, stamp_sierpinski.jpg)

be5d46 No.4178[Reply]

Sierpinski thread.


def sierpinski(depth, marks=[' ','X']):
line = []
for i in range(depth):
line += [0]
line = [1] + [line[j] ^ line[j + 1] for j in range(i)]
print(''.join([marks[l] for l in line]))

sierpinski(2 ** 4)
sierpinski(2 ** 5, ['*', '.'])
sierpinski(2 ** 6, ['.', '#'])

20 posts and 14 image replies omitted. Click reply to view.

5c98c3 No.4890

File: 221f8684f3a5a36⋯.png (1.06 MB, 1000x758, 500:379, image.png)

U+2665


5c98c3 No.4892

File: b5c31cdd70cd687⋯.png (42.58 KB, 729x729, 1:1, image.png)

random choice between stamps


5c98c3 No.4895

File: 013e518acc30437⋯.png (1.3 MB, 1296x1296, 1:1, image.png)

fixed cycle of random alternates


5c98c3 No.4911

File: 1017bceb23a50d2⋯.png (1.73 MB, 1296x1296, 1:1, image.png)

text stamp with fill and outline

random choice

U+2601 U+2660 U+2691


f1f910 No.4947

File: 9dbf39f4c0be5a8⋯.png (1.2 MB, 729x729, 1:1, k.png)

fixed rotation cycle




File: ae3a8d34792c8ef⋯.png (120.94 KB, 562x514, 281:257, 1516100147518.png)

33acd2 No.4944[Reply]

This place has been getting real comfy since the last time I visited; I guess now I know where progrider went.



File: 0e54525f51f1a04⋯.png (484.83 KB, 600x595, 120:119, banan.pupper.png)

e98a7b No.4633[Reply]

So lets say you could mod an existing programming language or create your own with a relatively low level of difficulty. What would you create?

I would take C and remove the preprocessor. I would give it a sane way to write modular code without that awful fucking include/header system. I would replace the preprocessor with some kind of LISP.

Essentially you'd be able to do everything and more that you used to be able to do with the preprocessor in LISP so the language isn't gimped. Literally nothing else is changed.

Whatever form of LISP is used it'd have powerful metaprogramming capabilities (because LISP), lambdas, and more. I think it'd be badass.

Literally the only two things that suck about C are the preprocessor with its awful syntax and the incredibly shitty header/include system constantly needing ifdef statements all over the fucking place. Its outdated as fuck and needs to go. If you have a nice language like LISP to replace the preprocessor then you don't lose functionality you actually gain functionality and you can use LISP itself to specify build instructions for your projects or go crazy and make a DSL that the user can use for his programs.

Every new programming langauge out there is compared to C because C is blazing motherfucking fast and portable as fuck. LISP is also powerful and incredibly expressive. Why not upgrade what we already have?

12 posts omitted. Click reply to view.

abc7f7 No.4724

Ocaml but without the mandatory 'then' bullshit after if statements and with f(x) instead of f x. Other than that it's the perfect language.


ba42d8 No.4754

Would you use the (((()()))))))(())()()))))))))))((((((())))))) of Lisp in your new confounded language?

For me, it'd be Python, but Tkinter makes sense and indents aren't as important.


ea96de No.4888

OP here.

To clarify, I'd want a LISP or LISP-like language to do things like runtime introspection and metaprogramming ON TOP of C.

I've moved on to languages like Rebol and Red. They're both homoiconic, meaning that the language is its own data structure. So LISP uses lists and s-expr but everything you write in LISP IS A LIST OR S-EXPR.

This means that LISP is able to do things like introspection relatively easily. Check out Rebol and Red. They're amazing languages that are pretty much exactly what I wanted.


04e284 No.4929

File: aa07494fd17759c⋯.jpg (615.95 KB, 740x740, 1:1, 1494048454308.jpg)

>"I'm a college freshman with an information science major who doesn't understand the basics of language development."

Also you can take your awful memes back to Facebook. You're on 8ch, show some respect.


e12983 No.4940

>>4888

>Red

https://twitter.com/hostilefork

Read through it. The community is just functional Ruby.

>>4754

Python with functional syntax, that would be awesome.




830553 No.4916[Reply]

I'm interested in learning how to program, not for a potential career, but as a hobby. I'm thinking about starting with golang but wanted to ask for advice on that as a beginner's langauge…? Any recommendations (only clean, compiled languages please)?

ffd193 No.4917

Sure, why not. It's a decent language. Which language you pick as a first language really isn't that important.


830553 No.4918

Thanks for the advice, I will start with Go! Out of curiosity, what is your favorite language?


ffd193 No.4919

>>4918

It depends on the task. I most often resort to C++ for general programming since the standard library is pretty good and it's easy to produce reasonably efficient code. Sometimes i use Go as well. If i need to do some scripting just to move/rename some files or whatever I use python. I do mostly academic stuff/competitive programming.


000000 No.4933

Haskell




File: 1445968875001.jpg (28.57 KB, 600x338, 300:169, xtoanhero.jpg)

1d0a50 No.3484[Reply]

Tell me, /prog/, what were the nastiest bugs you ran into?

Mine was when I coded a multithreaded Java project for university. In our group was a girl which we considered incompetent and so we only gave her lowest-tier tasks where no sentinent being should be able to cause any harm. Stuff like putting the debug output calls in comments for the final version.

The result looked like this:


void runThreads() {
while(!done) {
iteration++;

if (iteration%10000 == 0)
//Debug.out("Iteration: " + iteration + ", State: " + state.toString());

/* I'm a huge comment explaining
what the critical section does*/

syncThreads();
doCriticalStuff();
}
};

Needless to say, our debug version sometimes had incorrect output due a data race resulting from the missing synchronization. The really annoying part was that this was part of the proven, extensively tested and seemingly unchanged core program and merged alongside with a large update to peripheral functions, so we spent several days testing the graphing, output, and other stuff before finding where the problem was. And then there was a huge comment in the middle which made it easy to overlook the if-statement when looking at the seemingly important parts.

3 posts omitted. Click reply to view.

8533c7 No.4864

Once I work in a project on the client-side, coding the mobile clients (iOS/Android). I worked with a lazy fatass son of a bitch in the server-side. I had to bust that guy's balls all week to get him finished a single endpoint. When he finished the endpoint the Json payload was some utter bullshit, for example in a response where I was supposed to get an user id, a building id and a section id I got some shit like:

```

{"payload":"userId:buildingId:sectionId"}

```

So I had to juggle that shit on the client-side. To get a list of the buildings I had to hit two different endpoints and merge the data locally on the client-side because some shit that was crashing on the server-side. Luckly I used Rx to do all that shit and It was pretty simple. But man that I hate 40yo old programmers that dont' give a shit about quality coding.


fe3481 No.4899

Literally anytime I get a seg-fault error.

It usually takes me a whole day at the least to figure it out.


d59718 No.4925

>>4899

Learning how to use a debugger is probably the best time investment you can make. You don't have to learn much, just enough to be able to get a backtrace on the core dump. Knowing the line that triggers a segfault sooner you can then read the code that got to that point to see the obvious error or learn how to examine the stack/vars and print the pointers that look off.

The debugger saves time spent on hunting down faults that can be better spent testing and uncovering more segfaults you missed.

I am assuming straight gdb on the CLI. IDE tools make the job orders of magnitude easier.


b6902e No.4928

>>4899

Check out Valgrind. It's good at tracking down memory errors.


000000 No.4932

>>3492

Curious: why do you need `ReaderT FilePath`?




File: 1466473925962.png (525.83 KB, 600x579, 200:193, le-comf-way2.png)

bfe5de No.4294[Reply]

Please try to break my chat software

://Comfy.chat/

bfe5de No.4298

Good job Op

You actually made something that works, I'm impressed.


55d48a No.4924

its kill


000000 No.4931

Shitty




Delete Post [ ]
[]
Previous [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]
| Catalog | Nerve Center | Cancer
[ / / / / / / / / / / / / / ] [ dir / agatha / animu / ausneets / bestemma / leftpol / liberty / omnichan ]