-  [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 489 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.

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.

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.

109 posts and 87 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/05/20(Tue)01:46 No. 4455

now that's what I'm talking about!

Neckbearded Basement Dweller 14/07/03(Thu)05:32 No. 4501 [Reply]

File 140435837030.png - (141.51KB , 1178x583 , SDFDSFSDFSDF.png )

This author is really starting to piss me off. I paid 15 dollars for this shit, and I think I have picked out two huge errors he has made. Book is Java 7 for Absolute Beginners, by Jay Bryant.

First example:
On page 79, he says that

int a = 0;
int b = 1;
String s = "s";
String sToo = "s";
System.out.println(a == b);
System.out.println(s == sToo);

will generate the results "true" and "false" respectively. Eclipse begs to differ. Here's what it says:

Message too long. Click here to view the full text.

5 posts and 3 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/07/04(Fri)16:31 No. 4508

His description of the ^ and | operators are literally the same. Read again.

daoluong 14/07/10(Thu)00:20 No. 4509

that book for Absolute Beginners
Absolute Beginners are some kind of retard never read the entire contents
like >>4506 said anyone can write a book
who know if writer is an elementary teacher

you can find another book
or code it yourself like you did
all I see are few typo, writer mixed from other books without checked

Neckbearded Basement Dweller 14/07/30(Wed)21:48 No. 4539

I don't know what was going through his head when he said that 1==0 would return true.

But s=sToo should also return false by conventional wisdom. It was that way when I learned java a few years ago. However, that appears to have changed. There's some sort of behind-the-scenes stuff going on that makes Strings of the same value refer to the same thing. Doesn't work with explicitly declared new Strings though.

And it works on very long Strings. And Strings in separate methods. Can't be arsed to make a new class, but it probably works there too. It'd be awful if it wasn't consistently doing this. Personally, I'd say to just stick with x.equals(y) unless you find a source for the exact new behavior.

Here's my code:
public static void main(String[] args) {
String f = "dicks";
String d = "donger";
int a = 0;
int b = 1;
String s = "s";
String sToo = "s";
Message too long. Click here to view the full text.

Neckbearded Basement Dweller 14/05/11(Sun)08:56 No. 4451 [Reply]

File 13997913875.jpg - (37.79KB , 418x467 , qt_kitty.jpg )

What would be the best resource to learn Javascript, /pr/?

MDN didn't work for me. Opera has taken their dev pages down. Codeacademy is ok, but it gets really annoying and tedious at times.

So far, I've found jQuery's "Javascript 101" section most helpful. So I was hoping you guys could direct me to something like that. thx

5 posts omitted. Click Reply to view.
Neckbearded Basement Dweller 14/07/15(Tue)06:37 No. 4517

File 140539907679.jpg - (64.62KB , 500x256 , dennisritchie.jpg )

C should not have had more functionality that was none of its job to implement. It was meant to replace Assembly where possible, not Java. If it tried to implement everything under the Sun that bloated mess would have failed, and deservedly so.

Neckbearded Basement Dweller 14/07/30(Wed)18:26 No. 4538

ive been looking for jon duckett javascript and jquery but no torrents for that book , i would say his books are the best at teaching this stuff

Python/Raspberry Pi Neckbearded Basement Dweller 13/06/20(Thu)21:56 No. 3905 [Reply]

File 137175820336.jpg - (34.97KB , 580x358 , raspberry-pi-python-1-580x358.jpg )

Hello /pr/, I am here for the first time as I am interested in programming. I didn't know where to start, if you guys find this thread cancerous or anything then please say.

Anyway, I'm 13 and I really want to get into Programming. I got a Raspberry Pi (as a gift) and I was wondering what could I do it with - perhaps turn it into a CCTV? Anyway, I would love to get to learn programming with Python (as it seems to be a very easy/friendly language), and to test my skills out on the Pi.I tried codeacademy but I always get disrupted while learning, and the longest streak I ever had was 2 days. What keeps you guys motivated and not bored/discouraged when coding?

Also, I made a game in JavaScript ages ago, and barely anyone ever tested it out. The link for the game is here: https://mega.co.nz/#!DcligIQb!MiMA2DcKi9Q83sgl0M4LC0O3CBgscoyvOEcGkK6aTh8 (It's a HTML File, about 1Kb)

3 posts omitted. Click Reply to view.
Neckbearded Basement Dweller 13/07/01(Mon)17:10 No. 3937

Python, a slow language, when ran on a slow budget-computer, is a VERY SLOW language

Nattajerk 13/07/02(Tue)03:05 No. 3939

for big projects perhaps, but ive yet to have any issues.

Not+A+Douche 14/07/30(Wed)08:59 No. 4537

I am kind of tired of hearing that Python, Java ect is a slow language. I concede the point that it is not the fastest language that does not override the fact that Python is an excellent language for learning how to program, which is the point of the entire Raspberry Pi Project. The Raspberry Pi project is aimed at getting young people into the Computer Science program of study. The OP at 13 is the target audience for this project. The Raspberry Pi is a remarkable piece of hardware for its price. OP program whatever you can on your Raspberry and above all share. The other languages are not going anywhere. Besides I don't see Boy Scouts automating R/C tanks with C++.

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.

O.o 14/07/29(Tue)10:52 No. 4535

Text looks better on the right, however i prefer a darker background. The background on the left is too... green? imo

Neckbearded Basement Dweller 14/07/29(Tue)22:17 No. 4536

You mean on the right.
How about now for the one on the right.
Also, this is unrelated, but does anyone know what the little laptop in the second pic is called?

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.

5 posts and 2 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/07/20(Sun)05:27 No. 4528

What exactly is your problem? When doing what you want to do(I assume it's keeping the progress bar to one line, since you rejected >>4523 's solution)
you need to know the Terminal window width, then you work with a min of 1 and max of width - 1(because you are a civilized person and put your neat progress bar between neat brackets). I assume you don't know how to that? Well, neither do I(under Windows).
wget uses this http://msdn.microsoft.com/en-us/library/windows/desktop/ms683171%28v=vs.85%29.aspx , which isn't really useful for you, but well, it exists. Maybe you can wrap it with Python(sorry, don't actually do that, I just had to make the joke)

There's PDCurses for Windows.

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

C/C++/C# Interactive Learning BobLobLaw 14/07/21(Mon)02:44 No. 4529 [Reply]

File 140590344841.jpg - (4.31KB , 271x186 , images.jpg )

I just want to learn something before my class on C# this fall, but I don't want to stare at a wall of text (which I've tried to do already). Does anything exist for the three languages that's more interactive like, say, http://www.codecademy.com/?

Neckbearded Basement Dweller 14/07/21(Mon)02:48 No. 4530

search for programmr. i think you may have to pay for it after a while, but it's good.

also, my favorite band is anal cunt meets caramelized booty sweat

Neckbearded Basement Dweller 14/07/21(Mon)05:28 No. 4531

>I don't want to stare at a wall of text
Maybe you should do something else then.

Programming, a bad choice. James 14/06/16(Mon)20:28 No. 4468 [Reply]

File 140294329771.jpg - (72.97KB , 558x744 , 6386692301933492643.jpg )

So after 6 years, I've come to the realization I'm actually terrible at programming.

I find there's 3 main types of programmers:

-those who are completely unperceptive of people, takes all information into account before proceeding, always does things the right way the first time, the best programmers, they just get bored implementing.

-Then there's the walking encyclopedia peeps, analyzes data, talks out loud, easily taken advantage of, and will be fine just working..

-and then there's my type -_-, very visual, very perceptive, very fast, shoots from the hip, and doesn't even really know why shit works when it does.

The responsibility that has been given to me is nothing short of, put all the technology & processes in place to turn our company into a Corporation.. many peoples jobs depend on me, and I can't necessarily give up the highest payed job I've ever had. I don't know WTF I'm doing or what's the best most strategic way of doing this is.. Any Advice /pr/ ?

12 posts omitted. Click Reply to view.
Neckbearded Basement Dweller 14/06/29(Sun)06:05 No. 4498

lol i just spent literally 10-11 nonstop hours of sitting with a java book in front of my face. i have the drive, but its actually the amount that i can absorb that is the problem!!!

Neckbearded Basement Dweller 14/07/14(Mon)05:24 No. 4513

Yeap no OP. Firstly I firmly believe that you trying to shoehorn programmers into merely three distinct personality types is fucking stupid and shallow.

>I don't know WTF I'm doing or what's the best most strategic way of doing this is.
This is quite fine, usually. But it's your fucking attitude that makes it not fine. Don't know how something works? Well, you got it working in the first place, don't say fuck it it's done, read it again and try to learn how it works. Google anything you don't know and read about it at least once and us it as a stepping stone to learn something new, you lazy faggot. It's fine to make mistakes, especially if you know you're making them. And finding the 'best' solution to a problem *is* your job as a programmer, not something you read on the internet or recall from memory. Change your perspective and try to understand your position.

>I'm terrible at *
That's a shitty attitude to have no matter what you do.

Neckbearded Basement Dweller 14/07/15(Tue)18:23 No. 4520

Then there are the part timers/hobbyists, who have been assigned to implement something relatively simple and well contained on the basis they are the best there is available in-house.

They stampede around the existing code base like an elephant in a glass store, bash it with wildly inappropriate tools and plenty of search and replace, copy and pasting without time to fully learn the language or the framework, until they have something vaguely working done. With no understanding how much time the job should have taken, they feel their performance at least was sub par, so they hastily wrap it up omitting all code refactoring and usually the proper version management and commit procedures too.

Like so, I'm a welder and have been assigned to fix the company web page. Wont be pretty to look, when the best qualifications are like "I made a home page for my cat in 2003".

Neckbearded Basement Dweller 14/07/15(Tue)03:51 No. 4515 [Reply]

File 140538906987.png - (397.43KB , 1366x768 , 2014-07-14-165211_1366x768_scrot.png )

Hey /pr/, I was wondering if any of you could help me create my fap script in python3. What I basically want is to get a random video from the site xvideos.com, and input it in mpv, I already, can do it by putting the links in a list and inputting in a random link in mpv, but thats inefficient since one has to manually put in links in the list.

here is my code without the large list of links

seen = [] def no_repeat(l): seen.append(l) if len(sys.argv) > 1: if int(sys.argv[1]) > len(links): sys.arv[1] = len(links) if len(sys.argv) > 1: for i in range(int(sys.argv[1])): link = random.choice(links) while 1: if link in seen: link = random.choice(links) else: break no_repeat(link) link = 'mpv '+link os.system(link) else: link = 'mpv '+random.choice(links) os.system(link)

if any can help, it would be appreciated.

Neckbearded Basement Dweller 14/07/15(Tue)06:24 No. 4516

Use the [code][/code] tags. I didn't pay much attention to your code, but "seen" should be a set, not a list. Searching in a list takes O(n), whereas the search on a set should take O(log n). A set uses add to insert elements instead of append.
Also, I don't understand what exactly you want.

Neckbearded Basement Dweller 14/07/15(Tue)08:36 No. 4518

import os, sys, random def no_repeat(l): seen.append(l) if len(sys.argv) > 1: if int(sys.argv[1]) > len(links): sys.arv[1] = len(links) if len(sys.argv) > 1: for i in range(int(sys.argv[1])): link = random.choice(links) while 1: if link in seen: link = random.choice(links) else: break no_repeat(link) link = 'mpv '+link os.system(link) else: link = 'mpv '+random.choice(links) os.system(link)

What I want is to take a random video eg: a video from xvideos.com/tags/<insert tag here>. What I mean by 'take' is get the link for that video since the mpv video player can network stream videos from that site based on links.
So, based on the link xvideos.com/tags/latina,there seems to be links to videos, right? And I get the link for any of those videos eg: http://www.xvideos.com/video10095/alexis_amore_m3m_( a link in latina tag)
And then, I give this link as an argument to mpv, which will network stream the video for me.

Neckbearded Basement Dweller 14/07/15(Tue)08:44 No. 4519

I used the [code][/code] tags, I didn't know what happened, ill just post a pomf late since pomf is down now

Delete post []
Report post