[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 24
File: ayy.jpg (84 KB, 779x732) Image search: [Google]
ayy.jpg
84 KB, 779x732
web devs LITERALLY fuck off to >>>/g/wdg

previous: >>54690291
>>
>>54696352
first for pythonistas
>>
>>54696363
ironic shitposting is still shitposting
>>
File: 1406803019377.jpg (103 KB, 1280x720) Image search: [Google]
1406803019377.jpg
103 KB, 1280x720
>>54696352
Too early. faggot.
Delete this thread and kill yourself.
>>
>>54696352

If you're gonna go out of your way to tell people to "literally fuck off", would you care to tell the class how one would actually complete that action?
>>
>>54696352
<div><span>U MAD FAGET</span></div>
>>
>>54696394
click here: >>54680145
>>
>>54696352
>ayy.jpg
ffffffuuuuuuuuuuuuu cannot unsee
>>
>>54696396
>>54696394
you seem frustrated
thats understandable
now move along peasants
>>
>>54696352
>being this angry
come on op
>>
>>54696422
retarded much
>>
>>54696429
im sorry, what programming language do you know?
>>
>>54696429
>be a web dev
>should i post in the web dev thread
>nah i'll post in the big boy programming thread, pretending to be a programmer
>>
>>54696442
>____ much
>>
>>54696352
I'm working on a package for Atom.
>>
>>54696446
C, C++, Java, Haskell, Racket, Python

Programming for 15 years including emulators, graphics and games

and you???
>>
What should I work on?
>>
>>54696457
Nice quality contribution to the thread there, retard.
>>
>>54696457
It's 2006, don'tcha know?
>>
>>54696446
>im sorry, what programming language do you know?
Stuck in the one language is all you need mentality?
>>
>>54696469
sex with women
>>
>>54696478
shut up fucking retard, you're not any better
>>
>>54696496
that's not a programming language, nor a feat
>>
>>54696473
i hope it doesn't have smooth/kinetic scrolling
>>
>>54696469
>Programming for 15 years including emulators, graphics and games
...aaaand still broke
>>
>>54696497
you seem frustrated
that's understandable
now move along peasant
>>
>>54696504
The property is enabled
>>
>>54696513
kill yourself fag
>>
>>54696508
Nope
>>
>>54696522
net worth <$1M probably
>>
>>54696519
you seem frustrated
that's understandable
now move along peasant
>>
>>54696531
Probably, haven't been keeping track of my properties' values, but still not broke
>>
>>54696543
>repeats his reply verbatim
you seem frustrated
>>
>>54696572
Nice strawman, retard.
>>
>>54696594
>he can't stop replying
>>
File: 1463907771464.jpg (72 KB, 453x604) Image search: [Google]
1463907771464.jpg
72 KB, 453x604
So how about dat dere programming?
>>
>>54696604
This is what happens when OP shitposts in his post.
>>
>>54696603
>he can't stop replying
>>
File: img.png (41 KB, 794x1133) Image search: [Google]
img.png
41 KB, 794x1133
>5 insertions, 27 deletions
>tons of new functionality
good feel
>>
>>54696603
>he can't stop shitposting
>>
>>54696623
>i farted
>>
File: 1458464627315.jpg (634 KB, 2943x2155) Image search: [Google]
1458464627315.jpg
634 KB, 2943x2155
>his text is all emerald quoted
>>
Android studio is complete garbage
>>
>>54696628
>kek
>>
>>54696644
It's not though
>>
>>54696644
anything by intellij is garbage, i can't believe the goddamn shills, apparently if you have the arrogance to make an "ambitious" product like an IDE, programming language or a game engine or whatever you're entitled to jew people out of their money or get bought up by an even bigger jew
>>
>>54696672
s/intellij/jetbrains
>>
>>54696672
>being this retarded
>>
>>54696711
>being this gay
>>
>>54696711
another example of the garbage that they produce is scala, it's a bastardized version of java, they lack any understanding of the qualities of java, scala is complete shit, heck even C# would be more relevant for developers to use
>>
What's the best way to learn about sockets? Are there any good books or tutorials?
>>
>>54696743
British sockets > American sockets
>>
>>54696749
Australia/New Zealand sockets > British sockets
>>
>>54696778
Come on m8.
Who you fooling?
>>
>>54696749
>>54696778
>definition of shitposting
>>54696743
Here's a decent tutorial:
https://www.youtube.com/watch?v=Gbx9p1KQydo
>>
>>54696740
Gave me a hearty chuckle m8.
>>
>>54696793
Thanks, I was gunna watch that but I didn't want to waste my time.
>>
>>54696787
The Aus/NZ plugs are not landmines, as in, the pins do not point up when the plug is dropped.
>>
>>54696796
shill harder
>>
>>54696803
Don't watch that.

Look up beej
>>
>>54696843
shitpost harder
>>
I have a prototype of this web project running
you just have to post in this >>>/qa/527093 thread
precede your comment with a ';'
it only accepts mostly 5 or less character 1-word phrases and you can use parenthesis like take(lamp).
The outpust show up here: http://pastebin.com/3t0WiT2q
>>
>>54696352
I made my first program in C++ yesterday. It's a simple gas calculator. Here is code.

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
//vars
double mpg, gallons, distance, totalCost, pricePerGallon;

//Output
cout << "Enter MPG of Car." << endl;
//Input
cin >> mpg;
cout << "Enter Distance in Miles" << endl;
cin >> distance;
cout << "Enter the Cost of Gasoline at the Current Time" << endl;
cin >> pricePerGallon;

//Arithmetic
gallons = distance/mpg;
totalCost = gallons * pricePerGallon;

//FinalOutPut

cout << "The total cost of your trip is:"<<fixed<< setprecision(2) << totalCost << endl;


return 0;
}

Any pointers on learning it faster? I hate lynda.com its really boring.
>>
Is there a better cleaner way to set up the sprites in setupsprites:

#define MAX 15

Struct Things {
Sprite aliens[MAX];
} Things

main () {
Things things;

setupsprites(Sprites *sprites);
//lots of other shit be here
}

void setupsprites (Sprites *sprites) {
for (unsigned char i = 0; i <= 5; i++) {

init_sprite (&sprite[i], 0+(i*8), 10, 8, 6, ayy);
}

for (unsigned char j = 0; j <= 5; j++) {

init_sprite (&sprite[j+5], 0+(j*8), 16, 8, 6, ayy);
}

for (unsigned char k = 0; k <= 5; k++) {

init_sprite (&sprite[k+10], 0+(k*8), 22, 8, 6, ayy);
}
}


What it does in another function is print out the sprites in the layout of:

xxxxx
xxxxx
xxxxx
>>
>>54697125
we dont give a FUCK
>>
>>54697168
am I too drunk or are you using setupsprites(*sprites) and then using sprite instead of sprites? Does this even compile? Can I possibly drink more and still drive in 8 hours?
>>
>>54697083
and here's the code

http://pastebin.com/SeTBae95
I couldn't do it any better, sorry. The permanent login sessions were just not fucking working because of the way functions are nested.
>>
>>54697188
Get raped and kill yourself, you retarded fucking faggot sack of shit with down syndrome.
>>
>>54697188
>>54697168

Well it's setupsprites(&game->aliens[0]); actually. All you needed to know for the question that it compiles but I want a better solution than 3 for loops.
>>
>>54697125
>Any pointers on learning it faster?
https://docs.oracle.com/javase/tutorial/
>>
Anyone got any book or online resource recommendations for learning C++?
>>
>>54697168
this is fine, you could unroll it by hand I guess its only fifteen iterations but your compiler "might" be doing that already.
>>
>>54697363
cppreference.com
>>
>>54697168
You're going to have to post more code because I have no idea what setupsprites does.

You also have a lot of magic numbers.
>>
>>54697363
why don't you go to class every once in a while?
>>
>>54697171
Well how about this? More advanced for you?
public class PriorityQueueDemo 
{
public static void main(String[] args)
{
PriorityQueue<String> queue1 = new PriorityQueue<>();
queue1.offer("Oklahoma");
queue1.offer("Indiana");
queue1.offer("Georgia");
queue1.offer("Texas");

System.out.println("Priority queue using Comparable:");
while (queue1.size() > 0)
{
System.out.print(queue1.remove() + " ");
}

PriorityQueue<String> queue2 = new PriorityQueue<>(
4, Collections.reverseOrder());
queue2.offer("Oklahoma");
queue2.offer("Indiana");
queue2.offer("Georgia");
queue2.offer("Texas");

System.out.println("\nPriority queue using Comparator:");
while (queue2.size() > 0) {
System.out.print(queue2.remove() + " ");
}
}
}


Just want some recommendations for books and stuff, no need for rudeness.
>>
File: 1434229519851.png (210 KB, 871x900) Image search: [Google]
1434229519851.png
210 KB, 871x900
I'm trying to write an irc bot with unix sockets, but I suck at parsing.
In the function below I expect that, upon finding a a new line (crlf), I copy it to an array of lines, null-terminate it, then do what I want with it (check for commands, print it, etc).
If I do not do this, then strncmp will inevitably miss due to the fact that a command could be truncated between recv() calls with neither call actually receiving the complete command.


int loop(int sfd)
{
int k = 0;
char buf[513], (*message)[513] = malloc(513 * sizeof(char*));

const char *pass = "PASS password\r\n";
const char *nick = "NICK bot\r\n";
const char *user = "USER bot 0 0 :bot\r\n";

send(sfd, pass, strlen(pass), 0);
send(sfd, nick, strlen(nick), 0);
send(sfd, user, strlen(user), 0);

int len = recv(sfd, buf, 512, 0); /* I will check return value after I get it working :P */

for (int i = 0; len != 0; ++i)
{
for (int j = 0; j < 512; ++j)
{
if (buf[j] == '\r' && buf[j + 1] == '\n')
{
strncpy(message[k], buf, j + 1);
message[k][j + 2] = '\0';
printf("%s\n", message[k]);

++k;

if (k == 513)
message = realloc(message, sizeof(message) + 513 * sizeof(char));
}
}
len = recv(sfd, buf, 512, 0);
}

free(message);
return 0;
}
>>
>>54697350
>https://docs.oracle.com/javase/tutorial/
See
>>54697389
>>
>>54697388
Why take an extra class when you can teach yourself? That's what I'll end up doing in class anyway...
>>
>>54697389
what a disgusting piece of spaghetti shit that is in desperate need of some enterprising.
>>
File: 1322945697431.jpg (123 KB, 1680x1050) Image search: [Google]
1322945697431.jpg
123 KB, 1680x1050
/g/, people say math majors get much more than computer science majors

Is that a meme? I thought math degrees were worthless
>>
>>54697418
Teach me senpai.
>>
>>54697400
you should probably just write your IRC bot in perl.
>>
>>54697422
they never were

that being said, it shouldn't matter, programming is fun, and CS concepts are necessary
>>
>>54697422
What do you mean by get much more? Money? Knowledge? Power? Sex?
>>
File: 1437365057798.png (116 KB, 745x814) Image search: [Google]
1437365057798.png
116 KB, 745x814
>>54697400
Holy shit, you have no idea what you're doing.

Consider suicide
>>
>>54697422
Most people I know have both, at least most of the people I go to school with will be finishing dual majors in math and CS. Most of the time a CS major can pick up a Math major for only a bit more work due to some overlap in major requirements, really depends on the school of course.
>>
>>54697454
Jobs have higher wages in general.
>>
>>54697474
Majors are meaningless. That's why the business degree exists. Companies don't care what your degree is because it won't matter: they just want that slip of paper that says
>I'm slightly above the shit they push through high school

>>54697471
Oh man I wish this was true where I'm at then I'd get a CS degree too. I'm not even getting a minor because I refuse to take the babby's versions of courses I've already taken: discrete math I & II.
>>
>>54697387

All the function does is go through 15 sprite initiations. init_sprite (&sprite[i], xPos, yPos, length, height, bitmap); Said functions are from a specific library and the function currently works as intended.

unsigned char ayy[] = {    0b10000001,
0b01000010,
0b01111110,
0b11011011,
0b10000001,
0b10000001};


On the magic numbers side, that is what I wanted to avoid. j*8 is bitmap width j+5 is trying to make sure that it uses the next sprite in sequence.
>>
>>54697400
>int len = recv(sfd, buf, 512, 0);
recv isn't going to null terminate the buffer for you. Also, the proper return type is ssize_t.
ssize_t len = recv(sfd, buf, 512, 0);
buf[len] = '\0';

>for (int i = 0; len != 0; ++i)
>{
>for (int j = 0; j < 512; ++j)
>{
>if (buf[j] == '\r' && buf[j + 1] == '\n')
char *crlf = strstr(buf, "\r\n");
if (crlf == NULL) {
// Handle "line too long" somehow
}

strncpy(message[k], buf, crfl - buf);
...
>>
>>54697507
So you be tellin' me

If I was a history major
but my resume said I was proficient in x number of languages or have expertise in others
or have projects that are somewhat remarkable

Then your major won't matter that much if at all?
>>
>>54697546
Essentially yeah. If you got some facts to back that up it wouldn't matter. I know a few HR type people and they don't really care about what is written on the degree.

I think I should probably say that there is a potential this doesn't apply to the entire US though. SE Texas reporting.
>>
>>54696352
I wrote a smart contract.

I also thought through my design for an ASI some more. Yes, ASI, because AGI is for pajeets who work for Google.
>>
File: 2000px-XMPP_logo.svg.png (152 KB, 2000x2057) Image search: [Google]
2000px-XMPP_logo.svg.png
152 KB, 2000x2057
/dpt/, I need some way of communicating with my laptop over the network (SSH is sadly out of the question, I would use it if I could).
Basically it should be a little bot in the background that receives commands from the server and responds to them.

Requirements:
>Encryption
>Doesn't matter if any ports are closed, it should just connect
>Hopefully file transfer, preferably with encryption
>Light and simple

I'm trying to get XMPP working and it's going pretty well, but I'm not 100% comfortable with it.
Any other suggestions?
>>
Yea this is home work. A micro-controller class using the atmega32u4.

I have a LCD screen I wish to draw to at 20ms intervals using the ISR. If I have a draw function currently operational but it has arguments to call it. Does this mean that I cannot use ISR to call it on the ISR's overflow?
>>
>>54697625
Why is SSH out of the question?
>>
>>54697469
Okay but can you extrapolate a little?
>>
>>54697727
Okay, so you don't want to shoot yourself. If you fuck up, you might just end up a vegetable. I would suggest taping the exhaust of your car to one of your windows and build up CO2 on the inside. It's painless, you'll just fall asleep. Listen to something comfy on the radio, like This American Life.
>>
>>54697703
I want it to work the same on any OS: Windows should work as well as Linux. Without any Cygwin or whatever I need to get a basic sane shell going on Windows.

There are other reasons, and I'd rather write something myself since I've been inactive in programming for quite some time.
>>
>>54697757
I use putty for SSH in windows. It's comfier and not as hacky as cygwin.
>>
>have been in a rut the past few weeks and can't bring myself to work on any of my projects

The worst feel
>>
>>54697774
It's a client, though. If I were to use SSH in my situation I'd do the reverse, which is why I mentioned Cygwin.
>>
>>54697756
No I mean about the code.
I read up pretty well on how to do this but I've never encountered any guidance whatsoever when it comes to parsing the data.
Do people just improvise in that regard or is there a common idiomatic way to do it?
Because if there is an idiom then I've never been able to find it.
But if there really is no standard way to do this, then I'm just retarded compared to everybody else.
>>
>>54697806
Well, from what I've heard, when people write bots, they use languages other than C for them, just because it allows them to define the behavior easily. Someone suggested perl, I don't know how much better it is, but I wouldn't use it.
>>
>>54697823
I've heard that something like Erlang/Elixir would be good for this.
>>
>>54697839
ignore this retarded mongoloid telling you to write a bot in erlang.

You need to use perl.
>>
>>54697469
Consider getting raped and dying in a fire, shit stain.
>>
>>54697806
I'm going to second perl here. It's a pretty good choice for string manipulation. Things like concatenating strings is a little too obnoxious to justify C.
>>
>>54697540
>recv isn't going to null terminate the buffer for you
Oh I know, I don't need it to at the moment.

>crlf - buf
Does this even work?
What does it do?
I tried it before but it just instantly segfaulted.
>>
>>54697936
It segfaulted because "\r\n" is some windows shit. He's using it as a way to find the end of a line, which isn't "\r\n" in real OS's.
>>
>>54697990
>>54697936
Oh nevermind I'm an idiot. You are the one writing some windows shit, so I guess \r\n would be sufficient.
>>
>>54697936
>I tried it before but it just instantly segfaulted.
I didn't test it, so I don't know if it's exactly right, but strstr should return a pointer to the substring which is "\r\n". By subtracting the location of the beginning on the buffer from the location of that substring, you should get the index of the substring.
Say the buffer contains
char buf[] = "abcd\r\nefgh";

strstr should return the value of &buf[4].
So &buf[4] - buf equals 4. Using that, you can copy out all of the characters you want with strncpy.
Your code probably segfualted because strncpy DOESN'T put a null terminator at the end of the string.
>>
if I have a function in C with a variadic signature, how do I express the type of the imported call in Haskell?
>>
>>54698004
It's in rfc1459, irc proto specifies it.
I also specifically said this is unix sockets, in case you couldn't tell from the code which is clearly not winsock.
>>
do you guys know if it is possible to write a scraper in C++ with minimal use of independent libraries (needs sessions, something like regular expressions, ideally a way of navigating an html tree easily, requests, and some way of easily submitting data (like headers and GET requests particularly. need something like a dict). And post commands.)?

I want to write an exe for distribution so people don't have to install java or python or whatnot.
>>
File: functional-right.jpg (512 KB, 1131x1600) Image search: [Google]
functional-right.jpg
512 KB, 1131x1600
>>54697855
ignore this babby and use haskell like a real programmer
>>
>>54698061
Oh that's interesting. I guess it uses \r\n for more compatibility with windows? And I just kind of rolled with your code not thinking about it. I'm starting to suffer from all the world's a 'nix syndrome it seems.
>>
>>54698104
there are tools to turn python into an .exe
>>
File: 1457475652595.jpg (20 KB, 500x313) Image search: [Google]
1457475652595.jpg
20 KB, 500x313
>leave payment app on idle with screen off, wifi on
>phone gets hot as hell
>>
>>54698108
haskell sucks.
>>
>>54698125
my understanding is that they still require installation of python
>>
>>54698138
nope
>>
>>54698143
oh. Well that simplifies things. Is it cross-platform?
>>
>>54698161
think about what you are asking.

The .exe is not going to run on linux.

But you can definitely make it output elf
>>
>>54698270
.exe files are very different from ELFs. An ELF file is a binary file for machine code (and a couple other things). .exe files are more like .tar files than ELFs.

If a python script is being built into an ELF it's being compiled.
>>
>>54698270
I always wondered if it was possible to make cross platform binaries, but I guess the header wouldn't allow for that. Unless it ran off a script or something. It would end up being a waste of space in most cases anyways.
>>
Hey computer people.
If I'm stuck while trying to learn something in C should I look up help from a book, teacher or google?
I feel like if I google too much I won't learn, if I ask teacher he will just give me an specific example and a book might be outdated.
>>
>>54697125
>
using namespace std;
>>
>>54698596
Nigga C hasn't really changed in over 15 years, and I doubt you're using c11 features anyway. Just use a book.
>>
>>54698596
Well, what is it, Anon? Either way books are the way to go.
>>
>>54696352
Is that a python's head sticking out from between those bricks?
>>
what retard stuck a cigar into a brick wall?
>>
>>54696604
stop posting this disgusting down syndrome cunt all over the place
>>
if i have no idea what anything posted in this thread does does this mean im just not cut out for programming and can stop worrying about trying?
>>
>>54698822
Have you tried studying anything before participating in the thread?
>>
>>54698834
no this is the first time i have ever seen any code i just want a good excuse for not trying to learn so people leave me alone
>>
>>54696352
I'm learning assembly. Rate my assembly and post assembly.
        ;returns 1 if rbx is 0 and 0 if rbx isn't 0 without branching
mov rax, 1
cmovz rax, rbx
sub rax, 1
neg rax
ret
>>
File: 3094874.png (13 KB, 980x485) Image search: [Google]
3094874.png
13 KB, 980x485
Huh?
>>
>>54697125
Neat. Now make it pull statistic from the Internet to give you an accurate reading for your area.
>>
>>54698903
false = 0
>>
>>54698903
It's string because it's in quotes. You have been rused.
>>
>>54698903
It's a trick question, the answer is actually String, but then again I don't know how they formatted the previous questions so it might actually be full of shit
>>
>>54698903
Ambiguity of english owned you. The question is not quotation marks to quote but rather to indicate start and end of string. They should have used a block quote and monospace.
>>
>>54698952
>>54698941
>>54698939
Oh, they could at least have explained it after the fact.
>>
>>54696352
>>54696420
guys can you see what's in the pic
>>
>>54698903
>>54698985
>web devs in charge of trying to be educational
>>
>>54699018
Some bricks and a snake
>>
>>54698903
What kind of retard wrote this question?
>>
>>54699117
nathaniel
>>
>>54699095
no snake
>>
>>54697400
char buf[513], (*message)[513] = malloc(513 * sizeof(char*));

What does this line do?
The way I read this
>(*message)[513]
>Must be globalscope message*** dereferenced twice
But that seems a bit, arbitrary..
then later
strncpy(message[k], buf, j + 1);
message[k][j + 2] = '\0';

>use it as a char*

I'm bad at reading this..
>>
For a total completely stupidly beginner what would be a good book or site to start learning python?
>>
>>54698903
That's a char* obviously. So an array of characters.
Array.
>or string
>or boolean assuming the quotes are to be ignored as a way of making clear the ? isn't part of the string
>no colon to make it clear what's the following

They should have written
>What is the data type for the following?:
>"false"
>>
I'm changing a class with only static members (it's a MathUtil class) to a namespace.
But it's currently done in two files.
MathUtil.h
and
MathUtil.cpp
As you'd expect the .h only declares and the cpp defines.
So I can't just change the "class" in the .h file to namespace MathUtil because for some reason defining
MathUtil::Max(a,b){}
in the other file doesn't work?
How do I solve this without merging the two files and keeping the MathUtil:Max(a,b) usage?
>>
>>54698890
I apparently didn't understand cmov so this code didn't work: it happened to work because my last operation primed the zero flag correctly. But none of y'all fags noticed since apparently /dpt/ is a bunch of casuals who don't know assembly.

I found this out only when trying to write a more general version of the above snippet:
        ;returns [a] if rbx is [n] and [b] if rbx isn't [n] without branching
mov r8, [a]
mov rax, 0

mov r9, [b]
sub r9, r8

sub rbx, [n] ;zero flag is 1 if rbx was [n]
cmovnz rax, r9 ;rax is now [b] - [a] if rbx was not [n] else 0
add rax, r8 ;rax is now [b] if rbx was not [n], else [a]

ret
>>
>>54696352
why is python such a bitch to deploy
>>
>>54699548
>What does this line do?
>(*message)[513]
Message is a pointer to a char array with 513 elements. It's a pretty unnecessary way to declare it. "char *message" would have been fine.
Considering the sizeof(char *) in the malloc, I think the original author is confused about that type too (although he uses it correctly in the realloc).
>>
File: botnet_blog_title.jpg (67 KB, 640x420) Image search: [Google]
botnet_blog_title.jpg
67 KB, 640x420
>>54697625
Bump!
>>
>>54699599
>But none of y'all fags noticed since apparently /dpt/ is a bunch of casuals who don't know assembly
Just because people don't reply doesn't mean that they don't know, it means that they don't care.
>>
>>54699869
Given how riled up so many get over minor details in languages like C; I think its fair to say that an error would be called out if the average /dpt/ fag could read x86 assembly.
>>
soo, I have an option to get for free either:
1. VS 2013 professional
2. VS 2015 Enterprise

which to choose?
>>
>>54696352
>>54699018
>>54699095
>>54699135
alright do you want me to reveal what's in the pic

take one good look at it first (spoiler alert)
>>
>>54699955
Oh fuck, a cigar
>>
>>54699954
Neither. I'm not a cuck.
>>
File: 142426016079.jpg (51 KB, 500x500) Image search: [Google]
142426016079.jpg
51 KB, 500x500
>>54699967
correct

i couldn't see it at first and then when it was revealed i was like facepalm
>>
File: gki.webm (3 MB, 1280x720) Image search: [Google]
gki.webm
3 MB, 1280x720
/dpt/-chan, dai suki~.

Ask your much beloved programming literate anything (IAMA).

>>54698890
>>54699599

Conditional moves are slow.

TEST  rbx, rbx
SETZ al
MOVZX eax, al
RET


>>54699554
Are you good at maths ? Then
http://www.composingprograms.com/
If not
http://programarcadegames.com/

>>54698822
If you have no idea what's programming, start here https://code.org/learn

>>54697400
>513 * sizeof(char)
You wouldn't sizeof a char.
Also,
sizeof(type[n])
is more proper than
sizeof(type) * n
>>
>have to parse json
>the company that generates the json that gets served is beyond incompetent
>single entry values have multiple entries
>expect to just read one value
>Woops, that's a JArray
>on a field that's supposed to be a unique object id
>they have different values
Pain
>>
>>54697014
>>55000000
>>
>>54700000
>>
>>54700057
what a cancerous thread
>>
>>54696381
>TFW freshly paved street to shit in
>>
>>54700024
>ever relying on other companies
stay cucked
>>
File: 1463892872593.jpg (71 KB, 437x458) Image search: [Google]
1463892872593.jpg
71 KB, 437x458
Is it ADD if I can't sit through a tutorial without having it on at least x1.25 speed?
>>
>>54700444
i don't think so. if you just want to get to the part of the tutorial that you don't know, then everything leading up to it is superfluous for you. this is why i find video tutorials really obnoxious when a text writeup would be fine. like i understand that most people won't read that, but imagine if a programming language reference document was narrated to you in a youtube video rather than made available as searchable, hyperlinkable text? it'd be excruciating.

i think it's a bad sign if you need all that information and yet you keep getting distracted, though.
>>
help me /g/, i'm pretty sure i'm missing something simple but i can't figure it out. i'm trying to write an object into a file in the home directory of a user :/home/user/.Rbackub/jobFile

String path = System.getProperty("user.home") + File.separator + ".Rbackup/";
File jobFile = new File(path, "jobFile");
FileOutputStream fos= new FileOutputStream(jobFile);
ObjectOutputStream oos= new ObjectOutputStream(fos);
oos.writeObject(listJobs);
fos.close();
oos.close();

it throws me the following
java.io.FileNotFoundException: /home/anon/.Rbackup/jobFile (File or Directory not found)

what am i doing wrong?
i already googled in case anyone wonders
>>
this is a test do not reply to this
>>
It keeps throwing ConcurrentModificationException even tho I don't modify anything, I only want to compare Objects with the equals method, does this count as modification as well?

halp

    public boolean existeUsuario (Usuarios usuario){
boolean resultado = false;
Usuarios temp;
while (it.hasNext()){
temp = it.next();
if (usuario.equals(temp)){
resultado = true;
}

}
return resultado;
}
>>
>>54700601
>existeUsuario
>Usuarios
>resultado

Anon...
>>
Why would anyone ever do this to themselves?
https://balde.rgm.io/
>>
>>54700612
WHAT HAVE YOU SEEN TELL ME IM RETARDED
>>
>>54700638
Name your variables in English.

Don't know a thing about Java, but I guess
it.next()
is your problem, it's not a local variable to that method, so it's modifying a member of that class, isn't it?
>>
File: not so smug now.jpg (35 KB, 385x375) Image search: [Google]
not so smug now.jpg
35 KB, 385x375
Somebody correct me if I'm wrong:

And object is more or less a named blob of stateful variables/functions.

Why on EARTH would I want something like this floating around in my program? Can somebody please explain how this isn't harmful as fuck? State is bad enough as it is; why is it in my interest to obfuscate it further?
>>
>>54700601
>>54700674

Ye, will do next time but I thought the method is too simple to change it to english.

And you are right about
it.next()
it was giving me the error, but the error was because I didn't make the Iterator after adding the objects, silly mistake. My Iterator was inside the main Class and therefore it's useless if you don't have any objects inside the ArrayList before calling the class.
>>
>>54700768
you are wrong.
>>
>>54700786
Correct me then.
>>
>>54700768
dont you have something better to do than post this in every thread?
>>
>>54700768
state isn't bad
it's like you fp fags didn't even read your tarpit manifesto yourselves

redundant state is bad
necessary state is fine
necessary state should be encapsulated to take away invariances users of your API can cause
that's what objects are for, encapsulation
>>
>>54700601
Itsa me, resultado
>>
>>54700796
i am not your professor.
>>
File: 1411598244512.png (190 KB, 580x435) Image search: [Google]
1411598244512.png
190 KB, 580x435
>>54700805
>anime
>anything better to do than shitpost
>>
>>54700768
>grouping state that belongs together is bad
>state is bad
what the fuck am i reading
>>
>>54700812
``encapsulation" is just a buzzword for "out of sight, out of mind"
terrible programming practice desu

>>54700825
shhhh rajeesh. This is above your head
>>
>>54700846
>shhhh rajeesh. This is above your head
come back once you make anything larger than fizzbuzz m8
>>
>>54700768
try to write a useful program without any state
>>
>>54700857
I've written plenty.
>>
>>54698648
>typing std::
>>
>>54700872
well, we're waiting anon
put up or shut up
>>
what should i make
>>
>>54700898
I'm not going to dox myself to win a /g/ argument

You are clinically retarded if you think a program needs state to work
>>
>>54699998
how do i into reversing
>>
I'm a bit overloaded lately, but I'm having a great deal of difficulty with all the terms and semantics of C++. I feel extremely stupid not being able to just throw it all together whether I like it or not, and read through it as necessary. Pointers are especially confusing.

eg:
//tell the compiler to allocate an address in memory as a pointer to an int
int* some_pointer;
//assign pointer the address of the 3rd element in an array
some_pointer = &some_fucking_array[2];
//use that which is pointed to for something
int fucking_variable = *some_pointer;

So what is all of this about "dereferencing"? Nothing is being dereferenced, the pointer is just being used as a means to store and access an address that might be somewhere in the heap, or anywhere. It's a proxy... a gateway... right? The pointer is not being altered by its use?

If this is so, why all the superfluous terminology? This is par for the course in just about any modern anything, but it makes me suspect there's something happening here that I don't understand.
>>
>>54700846
>``encapsulation" is just a buzzword for "out of sight, out of mind"
>terrible programming practice desu
i'm surprised some fp fags love advanced type systems but hate encapsulation
both have the same goal, you reduce invariances by limiting access to things
encapsulation achieves this at runtime while advanced type systems achieve this at compile time
since pretty much all type systems with dependent types are useless at this point, encapsulation is more than good enough to handle the corner cases your type system cannot handle
>>
>>54700911
aaaaand he chose to shut up
fp fags go homu
>>
File: squisioir1h.webm (223 KB, 720x404) Image search: [Google]
squisioir1h.webm
223 KB, 720x404
>>54700915
First, thank you for your question. What kind of reversing ?
>>
>>54698648
>putting 'using' in code tags
>>
>>54700927
>some fp fags love advanced type systems
Well I don't. I use Lisp.
>>
>>54700926
But that's all they do, they just point at things, and allow fast access to objects without the need of copying things. In C++, however, as long as you're not allocating memory, you'd rather stick to references and iterators for such trivial things.
>>
>>54700950
there are different kinds?
basically i want to map the layout of structures and functions used by a program so i can use it for my own purposes
>>
>>54700768
I'm pretty much of the same opinion.
State is bad, and you should spend as much effort minimising it, not trying to hide it.

OOP is inherently flawed.
>>
>>54700994
It seems I'm always trying to work from the bottom up. I don't even know how to pass by reference, and I'm stuck on figuring out how to decompress two image files and align them in memory to minimize cache misses when comparing their data.

Man I don't know how to live.
>>
>https://www.youtube.com/watch?v=vAHXK2wut_I
>Writing assembly code by manipulating sprites in game
How does one reach this level of autism?
>>
File: ee_generic.jpg (90 KB, 729x450) Image search: [Google]
ee_generic.jpg
90 KB, 729x450
>>54701012
You can reverse engineering software, hardware, network protocols, ...

First thing to do is to subscribe to r/ReverseEngineering
start with that book http://beginners.re/RE4B-EN.pdf
train on crackmes
learn the isa that you are targeting.
learn calling conventions.
learn the underlying system API (posix/winapi/...)
learn gdb/ldb/windgb
learn ida pro/x64dgb

for hardware reversing, read http://bunniefoo.com/nostarch/HackingTheXbox_Free.pdf
you will need some electronic engineering and pc architecture knowledge.
>>
>>54701191
thanks man
keep doing gods work
>>
If I code just for myself and for my portfolio, will I miss anything if I use VS community instead of VS enterprise?
>>
Daily reminder Java is pass by reference by default.
>>
>>54701478
java passes by value only. tard.
>>
>>54701325
Nope, VS Community has basically everything.

The only thing I wish it included is the code mapping, but that's a drop in the bucket of the overall feature spread.
>>
>>54701508
Objects are passed by reference. Only primitive types are passed by value by default.
>>
>>54701564
Is MySQL usually used in conjunction with VS, or something else for databases?
>>
partial application is based
>>
>>54701581
based on what?
>>
>>54701579
You can use whatever database you want.

Just make sure you have the ODBC connector installed on your machine for MySQL.
>>
>>54701565
he's arguing semantics (technically, you are passing references to objects by value)
>>
>>54701592
Curries
>>
>>54700911
>a program needs state to work
yep
>>
>>54701595
Okay, but what is the usual combo for building databases and programming? I don't know the right words for it, english isnt my native language, so the sentence might sound strange.
>>
>>54701599
>technically
pass by reference doesn't even exist then
>>
>>54701620
HTML
T
M
L
>>
>>54697125
>using namespace std;

anon...
>>
WHERE DAT BOI AT?
>>
>>54701651
>doesn't know C++
webshit...
>>
>>54701565
the fuck they are.

http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value
>>
>>54701664
They mean that it was declared globally, which is often namespace pollution at best.
>>
>>54701620
It depends on the application.

For example, two of our applications use a SQL Server database, and one of them uses a MySQL database.

I've stood up a data warehouse using SQL Server and the programs I write generally interface with that after it pulls data from the application databases.

Something like MariaDB (based on MySQL) is free, so would cost you nothing to play with.

Or you could use your free Azure credits for a hosted SQL Server database if you're just testing.
>>
>>54701016
>State is bad
no, it's reality
>not trying to hide it
yes, that's what's stupid
>OOP is inherently flawed
agreed
>>
>>54701668
>cuckoverflow
yeah, nice """""citation""""
>>
>>54701696
>no, it's reality
Sure, you can't have zero state, but for the most part: the less state, the better.
>>
>>54699868
>>54697625
I seriously urge you to re-evaluate SSH for your task. It's proven technology, it works and it actually is secure. There are Windows SSH clients and servers. If deploying Windows SSH clients/servers is the problem because they want gazillion DLLs and whatnot, try statically compiling the program. You have its source code, because you aren't going to trust some closed-source piece of shit, aren't you?

If you really must design your own protocol, at least wrap it in an SSH tunnel to make it secure. Look up on libssh.
>>
>>54701677
>this namespace pollution sure is a problem in this 20 line file
>>
>>54701731
>the less state, the better
sounds wasteful
>>
Is there a website explaining all the alternatives to OOP since it is a cancer?
>>
>>54701743
>Windows
>aren't going to trust some closed-source piece of shit, aren't you?
m8...
>>
ive seen this pic but what is it
>>
>>54701744
>Someone is learning C++
>"Hey guys check out my first program."
>Oh, guess I won't point out practices that can screw you over in the long run, nor the reasons that's the case. It's just a 20 line program after all, not like they'll ever be writing anything else!

Please think. They posted their program, they are receiving feedback to accelerate their building of a logical framework. The length of this particular program is irrelevant.
>>
>>54701788
you just need common sense
>>
>>54701788
Procedural programming and/or functional programming is where it's at.
>>
>>54701640
>web development
Web developers are the modern factory workers.
>>
>>54701796
>cargo cult all the things
yeah m8, this """feedback""" sure """teaches""" him a lot >>54701651
>>
>>54701807
>functional programming
meme
>>
>>54701743
Hey, I'm the first guy to wrap some communication in SSH and call it a day, but shit is just no fun.

It also fails to pass my second requirement, since to connect to an SSH server on a laptop I'll have to both know its IP and have a port magically open.

Because this thread failed to suggest alternatives, I guess I'll go with XMPP until I find something better.
I'll keep SSH in mind, thanks.
>>
>>54701841
>object oriented programming
meme
>>
>>54701839
I wasn't that poster, and I actually don't really like compartmentalization and categorization for the sake of it. I'm apt to side with some sense of fluidity and the mental overhead required to not fuck myself up, but nonetheless. These cognitive tools, and the awareness, are good to have.
>>
>>54701869
agreed
>>
>>54701871
>muh blog
>>
>>54701788
Here you go
https://vimeo.com/113588389
Thread replies: 255
Thread images: 24

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.