-  [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, WEBM
  • Maximum file size allowed is 10000 KB.
  • Images greater than 200x200 pixels will be thumbnailed.
  • Currently 470 unique user posts. View catalog

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

There's a new /777/ up, it's /selfhelp/ - You're Pathetic, We're Pathetic, We Can Do This! Check it out. Suggest new /777/s here.

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

WebM is now available sitewide! Please check this thread for more info.

java help Neckbearded Basement Dweller 15/01/18(Sun)03:53 No. 4676 [Reply]

need help with a java project. I would like to fill an array with a class that has multiple data types.

for example

class student{
int age;
String firstName;
String lastName;

Then in another class something like

student[] stus=new student[4]{some way to initialize entire array}

let me know if you need any more info
Message too long. Click here to view the full text.

Nattajerk 15/01/18(Sun)14:04 No. 4677

this is nothing too difficult.


i dont have java installed to verify any errors i made, but all you would have to do in this is populate the array, i believe. however you want to do that is up to you.

Neckbearded Basement Dweller 15/01/18(Sun)18:42 No. 4678

I figured out what i needed. I knew how to create the array. i just didnt know how to fill the array without doing like
and so one i wanted to do it all basically inline with the constructor.
what i did was

student[] stus=
{new student("mark","jones",22),
new student("faith","hart",20),
new student("james","johns",22),
new student("spongebob","squarepants",20)};

an array of students filled with the constructor

Neckbearded Basement Dweller 14/12/09(Tue)02:47 No. 4641 [Reply]

File 141808962137.jpg - (81.15KB , 519x533 , 1416624224370.jpg )

What types of data should UDP and TCP handle, respectively, in an MMO server backend?

1 post omitted. Click Reply to view.
Neckbearded Basement Dweller 15/01/02(Fri)06:17 No. 4664

MMO Server by definition is a vague description.
If you're talking about a action mmo game, critical messages (spellcasting, chat, rule validation) should be all TCP. State synchronization such as positioning, rotation, view angle, all should be UDP.
Now, if your mmo server is a turn based game such as a card game, where state sinchronization is not required, TCP will do.

Neckbearded Basement Dweller 15/01/08(Thu)05:43 No. 4665

UDP - shit that doesn't absolutely have to be there
TCP - shit that absolutely has to be there

really, what were you expecting from us?

Neckbearded Basement Dweller 15/01/17(Sat)09:28 No. 4675

UDP - most of the time it's good for streaming data (audio, video) and inter-process communication

TCP - if you need 100% reliability in your data transfer (DB responses, business logic data, etc.. )

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.

26 posts and 2 images omitted. Click Reply to view.
Neckbearded Basement Dweller 15/01/11(Sun)00:58 No. 4666

Haskell is what C++ should have been. Start with that.

Neckbearded Basement Dweller 15/01/11(Sun)16:54 No. 4667

>>4666 yes, start with haskell if you don't like programming and never want to be a programmer but would like to teach at universities.

Neckbearded Basement Dweller 15/01/11(Sun)17:51 No. 4668

>if you don't like programming and never want to be a programmer
All my enthusiastic programmer friends got into Haskell because it's really fun programming in it and because it teaches you to view programming in a completely different way.

Neckbearded Basement Dweller 14/12/27(Sat)08:01 No. 4654 [Reply]

File 4chan.txt - (989B )

Babby's First Program


Please, /pr/, you're my only hope: tell me exactly why this is the most offensive program you have ever looked at.

Neckbearded Basement Dweller 15/01/01(Thu)21:22 No. 4661

for a php script its alright, though it seems to magic number around 4chan's random board, when it could be expanded to download images from any board.

of course I could be just reading it wrong, I've been out of the loop for a while and haven't done regex in ages.

Nattajerk 15/01/01(Thu)22:14 No. 4663

more importantly your variable names should have some description to them, I don't know what dedup is and if ever there came a time to use it in the future, it would be difficult to discern what it does.

generalized variable names are a faulty practice in my opinion, even in small loops - because in the future that small loop could become bigger and our dedups and values can get lost in a sea of "What the fuck does this value do"

anonymous 14/12/30(Tue)12:46 No. 4659 [Reply]

i use devcpp to compile cpp programs but it seems to get some errors. is there someone that suggest me another softwARE?satin nydaym

Nattajerk 14/12/30(Tue)13:27 No. 4660

what errors are you getting? DevCPP is not a compiler but an IDE, it shouldnt be getting problems directly.

What exactly are you trying to do that is giving you an error?

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

4 posts omitted. Click Reply to view.
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?

Neckbearded Basement Dweller 14/12/24(Wed)03:23 No. 4652

>>4548 nah because the wordlist must consist only of words where ie/ei should actually be "ee"

Neckbearded Basement Dweller 14/11/20(Thu)02:39 No. 4621 [Reply]

File 141644754369.jpg - (137.40KB , 1200x1200 , 1416435128698.jpg )


>The Male Programmer Privilege Checklist

Neckbearded Basement Dweller 14/11/22(Sat)16:02 No. 4622

Not nearly as funny as the C+= documentation. They still get points for trying.

Neckbearded Basement Dweller 14/11/26(Wed)04:32 No. 4624

File 141697275325.png - (240.81KB , 1078x871 , linux_for_niggers.png )

Debian, you used to be such a great distro but look at you now... where did it all go wrong? I know you're still bummed for losing that popularity contest to your cousin Ubuntu but you need to get your shit together man.

Neckbearded Basement Dweller 14/12/24(Wed)03:10 No. 4651

probably a false flag to disrupt devs with shitty off-topic discussions.
like the bot/spammer mentioned here:

Neckbearded Basement Dweller 14/02/25(Tue)21:38 No. 4333 [Reply]

File 139336069175.png - (42.26KB , 800x444 , vi-emacs-final.png )

So, programming on GNU/Linux:

Which is best? An IDE, Vim, or Emacs? (Instead of shitposting or flamewarring, you have to give a legitimate reason for your answer and why you like it better than the other options)

21 posts and 3 images omitted. Click Reply to view.
Neckbearded Basement Dweller 14/06/18(Wed)06:36 No. 4480

I use nano and gedit. Vim is too complicated for my needs (basic C++ and other things).

Neckbearded Basement Dweller 14/12/15(Mon)23:23 No. 4644

It's all preference; you can use any text editor with multiple terminals for compiling/running, or you can use a fullblown IDE. If you want something more GUI-oriented, try Geany.

Neckbearded Basement Dweller 14/12/22(Mon)18:32 No. 4649

Emacs for programming and vi for configs and quick edits.

Emacs bindings are through out Linux/unix so you get a bonus extra skill.

The down side is emacs isn't a default install on most systems and is large. Dev is also run by RMS personal army.

Org mode is gdlk.

Both editors have great plugin selection, emacs is elisp which is less ghetto

Either editor is great though and I suggest you try both and learn one really well and be proficent in the other. Fuck nano/pico.

Both editors have parity features in curses and GUI mode so you can edit over SSH

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.

1 post omitted. Click Reply to view.
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.

Not+A+Douche 14/11/15(Sat)19:15 No. 4619

Just caught my wife still using that program. It has been 2 years

Neckbearded Basement Dweller 14/12/08(Mon)21:34 No. 4638

Pratice. Pratice. Pratice.

Getting items from website to app Neckbearded Basement Dweller 14/12/08(Mon)19:08 No. 4637 [Reply]

File 141806210734.jpg - (8.83KB , 843x403 , 164204_10151467305537900_4299705_n.jpg )

Is this a good way to get stuff from a website into your app?

Document doc = Jsoup.parse(html);
List<String> titles = new ArrayList<>();

for( Element element : doc.select("div[class=title]") )

Delete post []
Report post