-  [WT]  [PS]  [Home] [Manage]

  1.   (new thread)
  2. [ No File]
  3. (for post and file deletion)
/pr/ - Programming
  • Supported file types are: C, CSS, DOC, DOCX, GIF, H, JAVA, JPG, PDF, PNG, SVG, SWF, TXT
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 484 unique user posts. View catalog

  • Blotter updated: 2011-01-12 Show/Hide Show All

Movies & TV 24/7 via Channel7: Web Player, .m3u file. Music via Radio7: Web Player, .m3u file.

WebM support has been added on a trial basis. Please check this thread for more info.

Nattajerk 11/09/07(Wed)10:31 No. 6 [Reply] [First 100 posts] [Last 50 posts] Stickied

File Structure_and_Interpretation_of_Computer_Programs.pdf - (2.21MB , Structure and Interpretation of Computer Programs.pdf )

I heart /pr/

lets start with a book thread. I have some cached learning.

110 posts and 87 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/08/10(Sun)04:57 No. 4553

It might be, but..
Well said.

Newbie Thread patchouli!!SyAQpmZGyw 13/05/26(Sun)19:31 No. 3818 [Reply] Stickied

File 136958949722.jpg - (25.15KB , 293x324 , bjarne2.jpg )

What's this? Just a compiled list of resources silly!
(Also, check out the book thread, lots of lovely stuff)
Ask newbie/where to begin questions in this thread!

Language Agnostic:

http://www.codeblocks.org/ (great IDE for C/C++ and supports many libraries, cross platform)
http://notepad-plus-plus.org/ (good for scripting languages)
http://www.gnu.org/software/emacs/ (great editor with large learning curve)
Message too long. Click here to view the full text.

19 posts and 2 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/04/28(Mon)02:31 No. 4426

private static synchronized void initRNG() {
if (randomNumberGenerator == null)
randomNumberGenerator = new Random();


public double nextDouble() {
return (((long)(next(26)) << 27) + next(27))
/ (double)(1L << 53);
Message too long. Click here to view the full text.

3,5 Bucket Problem Noah Fischel 14/06/21(Sat)03:09 No. 4492 [Reply]

So I'm in the running to get an internship with Zappos, and the guy I interviewed with said that I had to write a program (ANY CODING LANGUAGE) to solve a problem (that I can't even solve on paper). It's sort of like the 3,5 Bucket problem. But there's more to it. Instead of getting 4 gallons in the 5 gallon bucket, I have to get 31 in the 86, 41 in the 75, and 59 in the 309. Theres only 3 legal moves:
Fill the Bucket
Empty the Bucket
Pour Bucket X into Y.

Could anyone maybe help me figure out this problem?

here's the link to the website that describes it, along with the prompt at the bottom.


Neckbearded Basement Dweller 14/06/21(Sat)10:13 No. 4493

Why do you want a job you're not qualified to perform?

By the way, I find this degree of sophistication surprising for a website about fucking shoes.

Neckbearded Basement Dweller 14/06/21(Sat)10:31 No. 4494


Yes, we could help you figure out this problem.

You start with the fact that there is no solution in this particular case, because none of the three buckets end up being empty nor full in the end, which means that “magic happens” and magic is not allowed.

Now you simply have to write something that will prove it. And no, no code; you are required to write that one and it would be a disservice to do that for you.

Neckbearded Basement Dweller 14/08/23(Sat)04:33 No. 4567

Couple of hints :
You can only produce volumes that follow the form n*gcd(v1,v2) where v1 and v2 are the bucket volumes.
This means that target volume must be
t_v mod gcd(v1,v2) = 0.
From there the only moves that make sense are filling B1 up if it's empty, emptying B2 if it's filled and if none of the above transfering B1->B2.
Same thing for the other route(B2->B1)
Run both cycles alternatively until one of them hits the solution and you've got it in O(2*short path).

I know this is outdated as hell but someone could use the reference.

Java Beginner Lamoa 14/08/06(Wed)06:17 No. 4541 [Reply]

File 140729862373.jpg - (72.60KB , 500x500 , Front.jpg )

Hi guys, I just discovered /pr/ and I think this is really great. Im a first year I.T. student,and right now we're at Netbeans Java in our programming class. Im really a beginner and before taking college I have no idea about programming but I really like it.
Can you give any tips and advice on how to be a great programmer and how can I improve my logic skills.

Not+A+Douche 14/08/06(Wed)06:33 No. 4542

Do yourself the biggest favor and jump all into programming!
Think of real world objects as classes and do little write-ups of the code that would be necessary to use those objects in a program.
Subscribe to a legitimate programming site where people actually go to discuss their problems like www.dreamincode.net.
Also start on projects that you and the people around you need. An example is my wife wanted a desktop application that would tell her when to go to bed if she wanted to wake up at a certain time. Even if there are already pieces of software that do an idea. WRITE IT YOURSELF!
Read over source code, see what methodology people use to solve problems. It will help you when you run into a similar problem.
Above all believe in yourself, this is one of the few professions where all of the skills can be learned, the only thing you need to bring to the table is your intellect and your imagination.
Above everything learn what the different languages are good at. They all have different strengths and weaknesses. There is no silver bullet language that is good at everything.
Happy Coding. And watch out for the bugs!

Neckbearded Basement Dweller 14/08/18(Mon)03:42 No. 4566


I was in almost exactly the same position as you, OP. Barely finished my BSc.

Now I'm finally going all into it.

Neckbearded Basement Dweller 13/10/11(Fri)23:41 No. 4156 [Reply]

File 138152768546.jpg - (85.38KB , 587x551 , 138119478561.jpg )

Is... is it ok if I just skip C and move right on to C++?
I... seem to find it easier reading cpp code than C, without all those enums, links, arrow operators, and shit.

19 posts and 2 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/08/15(Fri)17:52 No. 4563

Well, two of those aren't programming languages, one of those doesn't run in the client, and all existing JavaScript implementations require at least the existence of a C compiler for the platform.

What the hell am I even arguing? What would it even mean to "make web pages in C"? You have your web server which sends to the client... what, exactly? C sources? Binaries? That's really what we need to clarify before we can talk about "cross-platforminess".

Neckbearded Basement Dweller 14/08/16(Sat)00:45 No. 4564

Well the only think that changes using C is the code that runs in server side, the response is a html document

Neckbearded Basement Dweller 14/08/16(Sat)07:55 No. 4565

OP here. Been a while since I started this, didn't think itnstill dxisted lol.
Anyway I learned both. Of course I didn't *really* learn them, I'm in the process. But I learnedn the basics of both and I'm using them both (though mostly c++) so I actually *learn*

Colorscheme jerker 14/07/29(Tue)07:18 No. 4534 [Reply]

File 140661111262.png - (252.31KB , 1366x768 , 2014-07-28-231738_1366x768_scrot.png )

Which looks better?

Also, Colorscheme thread.

5 posts and 2 images omitted. Click Reply to view.
ice!.RAPE.curg 14/08/12(Tue)15:43 No. 4554

left, mainly becuase pink and red are bad for prolonged reading
also, the left has more contrast between background and foreground

also if you want a different font, i suggest looking into the different Lucidia ones

CodeNoob 14/08/13(Wed)06:34 No. 4557

does it not support ctrl+arrow keys? i thought that was a windows global thing

Neckbearded Basement Dweller 14/08/13(Wed)08:22 No. 4558

Doesn't work on rxvt either. It could be bash's fault, though.

I Before E Except After C Algorithm(Python) Neckbearded Basement Dweller 13/12/28(Sat)23:47 No. 4261 [Reply]

File 138827083071.jpg - (68.80KB , 620x880 , wrong ie.jpg )

So I was challenged today to prove this graphic I shared on Facebook and ended up disproving it by a lot with a simple python program. As with any good scientist, I would like some people to:
1. Try it with different (>100000 words) wordlists to see if my results hold up that when "I" and "E" are both in a word the I before E rule is followed roughly 75% of the time.
2. Make sure the algorithm is correct.
SOURCE: https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnxoYXNlcmVubGFuZXNoZXJzdHVkaW9zfGd4OjUyM2YxYzU0YjZmYWE2N2U

3 posts omitted. Click Reply to view.
Neckbearded Basement Dweller 14/01/18(Sat)10:42 No. 4277

Another big problem is that the rule only describes words where the "ei"/"ie" spell the sound "ee" as in "bee". There really are very few exceptions.

Neckbearded Basement Dweller 14/04/20(Sun)15:05 No. 4412

We almost wrote the same pieces of code.

(use (srfi 1 13)) (let ((words (string-split (with-input-from-file "en_US.txt" read-string)))) (map (lambda (pattern) (cons pattern (fold (lambda (h t) (if (string-contains-ci h pattern) (add1 t) t)) 0 words))) '("ei" "ie" "cei" "cie")))

Neckbearded Basement Dweller 14/08/09(Sat)06:53 No. 4548

So the 'except after C' part IS bullshit?

Implement Progressbar Neckbearded Basement Dweller 14/07/17(Thu)04:32 No. 4522 [Reply]

File 140556434123.jpg - (623.29KB , 2556x1767 , 1405550878260.jpg )

Hello, I come here in desperation to ask if anyone can help implementing a progressbar into my code. Before you post a link to a google search link, please keep in mind that I already tried that. I can easily put the bar, but the real challenge is making it so that it updates perfectly, and since the percentages are not ints, its hard to add an x amount of progressbar fill, eg: '#' if the percentages are not ints. Please Help, Im using python3 btw.

my code:

info about code:
its a program that downloads all the images from a set of given 4chan thread links, and its my goal to fill the progressbar based on the images downloaded / total images percentage, while making it so that it the fill never goes over the bar itself.

6 posts and 2 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/07/22(Tue)08:11 No. 4532

Yeah, I know the terminal widht, and also, I laughed at the 'wrap it with Python' string.
This looks promising since I was aiming to make something like this, but ended up writing two or more functions that gave no good results, anyways, thanks for the help, I'm off to incorporating it in my code.
Thanks for the recommendation, I'll look into it.

Neckbearded Basement Dweller 14/07/28(Mon)06:44 No. 4533

You'll need to add a if () console cmd

John+Smith 14/08/08(Fri)08:21 No. 4545

I'm sure TKinter should have some method of implementing a progress bar.
Find out how many images have been downloaded out of the total number of images, and make use it to control a TKinter bar.

Terminology and ranger i need halp 14/08/08(Fri)03:09 No. 4544 [Reply]

File 140746015548.png - (35.14KB , 1366x768 , 2014-08-07-190518_1366x768_scrot.png )

Hey guys, I have a problem and I know is not /pr/ related but I have nnowhere else to go to.

The problem is that my file manager ranger won't display images on my terminal called Terminology, even though i set it in the rc.conf to preview images.
w3m-img does work in Terminology as show in pic related, I don't know what is the problem even though it works in other w3m-img friendly terminals like xterm, xvt, kterm, etc.

Please halp.

sage sage 14/08/14(Thu)04:56 No. 4561

go back to niggertits, /g/ would love to help you

C++ Input Data Neckbearded Basement Dweller 14/05/04(Sun)07:47 No. 4436 [Reply]

File 139918243382.jpg - (46.20KB , 600x586 , CHILI.jpg )

I'm a newfaggot programmer more or less. I'm writing a simple guessing game. The user guesses a random number within a range. The only problem I have is accepting multiple data types. The user needs to guess an integer, but I want them to also be able to be able to submit characters such as '?' or 'EOF' into cin to do something like bring up a help menu or quit guessing. Anyone here who can/wants to teach me which method I should use to accomplish this?

I'm not sure if this is a shitpost here or not so if it is, tell me to fuck off, thanks in advance.

3 posts omitted. Click Reply to view.
Neckbearded Basement Dweller 14/05/11(Sun)08:42 No. 4449

what anon says. pretty simple, methinks.

Nattajerk 14/05/17(Sat)11:05 No. 4454

For your purposes you can use stringstreams to play with the data types. Managing strings with C++ can be a major pain at times, even for simple things. stringstreams will give you the ability to accept multiple data types by converting them on the fly.


alternatively, you could use C's atoi function. I think recent versions of C++ also have better string support? I'm not positive.

Neckbearded Basement Dweller 14/08/01(Fri)13:43 No. 4540

if not ? or EOF in string then parse string as int

Delete post []
Report post