[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: 18
File: 2352364.jpg (350 KB, 1280x639) Image search: [Google]
2352364.jpg
350 KB, 1280x639
old thread: >>51775084

What are you working on, /g/?
>>
Is visual studio any good? It's from MS but I'm willing to give it a shot
>>
need a project idea
I'll have one month to do it
it will be done in C++
>>
>>51779258
Yes, definitely
>>
>>51779218
why is the trap /dpt/ mascot now
>>
>>51779274
Is there any general premise?
>>
>>51779292
nope
>>
>>51779274

making a chat app using a client/server set up
>>
>>51779339
uninteresting
>>
>>51779258
get a free copy if you are a student from dreamspark, but honestly pirating is way better.
>>
>>51779218
Best way I can program a simple gui for my shitty python program? I'm looking for something that requires the least effort.
>>
>>51779374
pyqt
>>
>>51779360

well dont fucking expect too much if youve only got a month dick face
>>
>>51779404
i'm not saying a chat application is easy and simple (it might or might not be for all i know), i just dont find it interesting
sorry to hurt your feelings :*)
>>
File: ss (2015-12-09 at 08.46.59).png (41 KB, 672x606) Image search: [Google]
ss (2015-12-09 at 08.46.59).png
41 KB, 672x606
How feasible is it to automate this Java de-DRM tool to grab the free ebooks that are posted every week or so? The links have the same format, but they also redirect (based on your login information, I presume), so it'd also need login credentials.

http://otoshimono.xyz/OMD%20v0.1.16.2g.jar

http://www.ebookjapan.jp/ebj/freebooks/

>Scrape based on regex /tachiyomi/
>follow link with login to get the viewer URL
>insert said URL into program, download and strip DRM
>repeat for each link

I have no idea, hence me asking. Just wondering if it's even possible.
>>
>>51779274
Lewd text-based dungeon crawler (think Wizardry with monster girls)
>>
>>51779427
im looking to impress employers
>>
>>51779425
does the program have a command line interface? If not, you may be SOL.
>>
>>51779435
I'd hire you if you got my dick hard desu
>>
>>51779454
i can do that without making a dungeon crawler
>>
Use the real new thread

>>51779453
>>
File: YEAAAAAH COLA.jpg (141 KB, 1280x720) Image search: [Google]
YEAAAAAH COLA.jpg
141 KB, 1280x720
How long did it take your CPU to bruteforce a md5 sum with 6 leading zeros?

C here, 9 seconds.
>>
>>51779473

kill yourself
>>
Ignore tranny threads

Report tranny posters
>>
>>51779473
Your image isn't even appealing.
I have to seriously wonder about the mental state of a man who insists on creating duplicate threads featuring an old man instead of a qt anime gril.
>>
>>51779274
Implement an llvm compiler backend for the Church programming language.
>>
>>51779487
>gril
>>
>>51779218
Any suggestions for good beginner Blender tutorials? All of the recommendations on the official site are paid or really shit (I'm looking at you CGCookie)
>>
>>51779218
free(calloc(1, SIZE_MAX));
>>
>>51779487
>Gril
Holy fuck are trapfaggots really this far gone
>>
H-how hard would it be to make a CLI text editor? I can't
>>
>>51779510
>blender
wrong thread

>>51779502
too hard for me, I'm a first year btw, self taught for a couple of years though, but not that much
>>
>>51779529
You may need ncurses
take inspo from vim etc
>>
>>51779502
>funded by grants
Like Obama didn't waste enough money.
>>
>>51779529
I can't get my head around GUIs, so I'm staying with CLIs until I get a better understanding of C++

Fucking pressed Enter before finishing.
>>
>>51779529
int main(void) { return system("notepad"); }
done
>>
>>51779544
D A R P A
A
R
P
A
>>
>>51779549
oh CLI?
int main(void) { return system("cmd"); }
>>
>>51779530
My bad. Got confused with /v/
>>
>>51779577
easy to do that nowadays
>>
Can anyone explain why you would mmap() a file instead of using fopen(), etc?

Or explain a little bit on where I should be using mmap() over other memory allocation method?
>>
>>51779218
REAL DPT WITHOUT NEITHER ANIME NOR FAGS
>>51779453

REAL DPT WITHOUT NEITHER ANIME NOR FAGS
>>51779453

REAL DPT WITHOUT NEITHER ANIME NOR FAGS
>>51779453
>>
>>51779639
What the fuck is your problem? What is so bad about anime in the OP?
>>
>>51779425
use jd-gui ? wasn't that done by a /g/entooman? not sure, just asking
>>
>>51779639
>real dpt
>no anime, no fags, no language shilling
pick one
>>
>>51779665
it's just a meme to make a new thread when one is made with a weeb/tranny op
>>
>>51779639

Holy shit, I'm not even a weeb or a fag and I can live with the fact we got a trap in the Op pic.

Calm your tits, it's just a picture, you autistic fuck.
>>
>>51779473
Fuck off
>>
>>51779676
>i can live with the trap in the op
>i'm not a weeb or a fag
u sure
>>
>>51779703
>trap
w-what?
>>
>>51779703
It's just a fucking picture

And we literally never see it unless we specifically move up to see it.
>>
>>51779665
>>51779672
>>51779676
>being this butthurt
enjoy having the fags and anime manchildren shitpost ITT and destroy it
>>
>>51779713
uh oh, somebody's gay
>>
>>51779665
>what's so bad about supporting degeneracy
the vast majority of users aren't traps or fans of traps so stop making this your safe space to appreciate traps
>>
>>51779730
This is hardly the place to be discussing sexuality.
>>>/lgbt/
>>
>>51779741
I was talking about anime being in the OP, not traps. I fucking hate degenerate fucks too.
>>
>>51779752
did you even see the OP?
>>
>>51779795
i see a funny anime pic
i don't know how you could derive a sexual narrative from it unless you were gay.
>>
daily reminder, if you don't mind traps
>>>/g/
>>>/o/
>>>/out/
>>>/u/
>>>/lgbt/
>>>/trash/
>>
>>51779823
an alternative:
>>>/int/
>>>/o/

>>>/t/
>>>/h/
>>>/e/

>>>/o/
>>>/v/
>>>/e/
>>>/n/
>>
>>51779837
nice
>>
>>51779423
I find it interesting
>>
>>51779385
Why isnt this called qtpy
>>
>>51779909
that's sexist, misogynistic and demeaning :^)
>>
What does this stuff mean in java
"%s%8s%n"
>>
>>51779909
they really dropped the ball on that one
>>
babbie's first steps in express routing and jade templating. planning on making a plain html git server (similar to cock.li's home page)
>>
>>51779949
it's a format string to print a string, 8 chars of a string, and a marker of where to stop the count to store the number of characters printed

https://stackoverflow.com/questions/3401156/what-is-the-use-of-the-n-format-specifier-in-c
>>
>>51779949
it's a definition of a String
>>
>>51779975
where can you find info on all that shit? alll the
/s
%d
/n
/t
etc etc
>>
>>51780001
/n is a new line
/t is a tab
>>
>>51779949
It's a representative of a string (%s), an 8-character string (%8s) and an integer (%n).
After this, you should find the variables that complete this expression separated by commas.
>>
>>51780011
yeah but where is a list of it all?
>>
>>51780001
just google "format specifiers" (ones that start with %) and "escape sequences" (ones that start with /)
>>
>>51780029
in the RFCs
>>
>>51779512
i'm gonna do this in all my programs now thanks
>>
File: KEK.gif (983 KB, 640x360) Image search: [Google]
KEK.gif
983 KB, 640x360
>r/adventofcode
>people talking about the performance of their md5 bruteforcer
>"my solution in node.js takes over 50 seconds on my new 2015 macbook pro"
>>
>>51779512
What the hell does this do, erase everything in memory?
>>
>>51780123
t. eugenicist
>>
>>51780137
what doesn't it do tb.h f.am
>>
What's a good useful yet somewhat complicated project that someone of an intermediate level of skill in C and C++ programming could do in under 3 months?
>>
>>51780166
implement AES
>>
>>51780186
useful

Like, an actual application of some sort
>>
I wrote the simplest of for loops in c yet it's giving me trouble. One would think the following loop...


for (d=0;d<2;d++) {

printf("why\n");

}



...would print two times, right? Well apparently it doesn't, and prints something like 15 lines. WTF is going on here? Is there something retarded about c that I don't know about?
>>
>>51780224
post the actual code, including the function it's in
>>
>>51780224
unsigned d;
for (d = 0; d < 2; d++)
{
printf("why\n");
}
>>
>>51780217
There are none, now stop asking. Spend the time getting better with your fundamentals or dive into a real project. The LuaJIT needs some new maintainers. The lead wrote up on the design of a state of the art garbage collector he wanted for the language, but never got around to implementing it before he left. We all would really really appreciate it.
>>
File: meesee.png (105 KB, 638x360) Image search: [Google]
meesee.png
105 KB, 638x360
>>51780242

Can do


void getStats(int month, const struct DailyData yearData[], int sz, struct MonthlyStatistic* monthly){


// based off monthly stats, function finds min and max temp (float), average temp and the total precipitation

int i, d, y, total = 0;

for (d=0;d<2;d++) {
//printf("why\n");
printf("\n%d %d %d ", yearData[i].month, yearData[i].day, yearData[i].year);

}

float max = 0, min = 0, averaged = 0, prec = 0;

//counts number of days in month

for (y = 0; y < 366; y++) {
if (yearData[y].month == month) {
total++;
}
}

//loop through year, assign data to variables if given row's month matches int month parameter

for (i=1;i<=365;i++) {
if (yearData[i].month == month) {
if (yearData[i].high > max) {
max = yearData[i].high;
}
if (yearData[i].low < min) {
min = yearData[i].low;
}
//printf("high: %f, low: %f\n", yearData[i].high, yearData[i].low);
averaged = average(yearData[i].high, yearData[i].low);
prec += yearData[i].precipitation;

}
}


monthly[month].averageTemperature = averaged;
monthly[month].maxTemperature = max;
monthly[month].minTemperature = min;
monthly[month].totalPrecipitation = prec;

return;

}

>>
>>51780301
It only loops twice, but you are using the wrong variable to index the yearData array.
>>
>>51780224
Isn't the second condition supposed to be an end condition? Try putting a > instead of a <
Also, see if d is declared, if it isn't, you can just add an int before it, and be done with it.
>>
>>51780001
In the language documentation.

Backslash escapes are part of the language itself. e.g. if you look at the bytes inside the string literal "\n", you'll see 0x0A (decimal 10) followed by a null.

% format specifiers are part of printf() in C and similar functions in other languages.

Regexps also use backslash as an escape, either for marking special characters or for treating special characters normally. But because backslash is part of the language's string literal syntax, you need to either double them ("\\" is a single backslash) or use a raw string literal if the language has them.
>>
>>51780341
No, the loop continues as long as the second condition is true.
>>
>>51780301
    for (d=0;d<2;d++) {
//printf("why\n");
printf("\n%d %d %d ", yearData[i].month, yearData[i].day, yearData[i].year);

}


What do you think yearData[i].month is going to be here? In other words, what do you think i is set to here?
>>
F A G G O T S
A
G
G
O
T
S
>>
>>51779218
Just stabilized the input sequences for a tech demo for my chatbot.

From here it's just a matter of polishing up the UI, preparing a video of the demo, and uploading it along with the source code.

Hoping to have this all wrapped up by the end of the month, so I can then resume extending functionality, refactoring the codebase, and experimenting with alternative theoretical implementations that may prove more robust and/or elegant.
>>
>>51780399

I usually find that he who calls other people faggots is the true homosexual.
>>
>>51780501
since you are calling me faggot after I called you a faggot...
>>
Should I learn C++ or Go?
>>
>>51780545
C++

I'm in the midst of getting comfy with C++ at the moment, it's a bit much but I like it.
>>
>>51780545
Go fuck yourself, c++ shill.
>>
I want to make it impossible for the input to be more than 1 character. I'm reading about cin.get(char) but I just can't understand it.

Anyone who did this before me that could help?
>>
>>51780602
not going to happen in a terminal buddy
>>
>>51780515

Huh, I guess you have a point there. It's all coming together now, I feel like my life is finally making sense.
Btw, are you single?
>>
>>51780545
D
>>
>>51780602
Read in a line, only take the first char if there is one.
>>
>>51780630
no, i'm not singles
>>
>>51780646
>lying about singles
>>
How to make a decent portofolio to show @ my school/job interview?

Should i make a tumblr or somethin?

I do websites... No hate(bootstrap)
>>
>>51780730
>should I make a tumblr
>for my portfolio
>for my interview
>>
Trying to come up with project ideas. How about an application launcher? I'm pretty lost.

>>51780730
github
>>>/g/wdg/
>>
>>51780730
Buy a domain, make a website, put cool stuff on it.

If you have the skills, there's no need for a tumblr, unless it's just a casual thing.
>>
>>51780730
Take a tank of helium, connect it to a mask, breathe in deep.
>>
>>51780773
write a GUI/web ui for some random program, or mix a few of them for... something
then give it a commercial sense and put ads on it
>>
>>51780833
ew
>>
>>51780773
Make a Ti-84 emulator
>>
>>51780011
>>51780035
What the heck?

I'll excuse the beginner but it's \.
>>
>>51780887
I thought that felt unnatural typing. I was looking at >>51780011 as I typed it. Dunno.

>>51780881
gross
>>
>>51780773
rate my application launcher:
#!/bin/bash
"$1"
>>
>>51780979
I meant a graphical one, silly
Like a dock of some sort.
>>
int main() {
int x = 3;
if (fork() != 0) printf("x=%d\n", ++x);
printf("x=%d\n", --x);
exit(0);
}


what does this return?
I am thinking:
2
4
3
Does the child process always go first?
>>
>>51781187
That's a race condition.
The output is meaningless.
>>
>>51781214
Well I'm trying to study and the problem gives that function and says "what is the output of this program" so the output is meaningful
>>
>>51781241
Say that the output is
xx=2
=4
x=3

or something
>>
>>51781311
Yeah I forgot the 'x=' but i'm just more worried about the order of the numbers.
is the child process always going to go first, though?
>>
hey what to do /g/
>>
>>51781338
you could insert a bat in your anus
>>
>>51781338
porgramming
>>
>>51781352
>porngramming
FTFY
>>
what to porgramm /g/
>>
>>51781348
i can't
>>
>>51781333
I don't think you're understanding what he's trying to relay to you, anon. He's basically pointing out the premise to you.

It's a race condition. How much do you and how much can you possibly know about the forked process?
>>
State your thoughts on this function:
char *
getline(void) {
char *line;
size_t len = 0, bufsize = BUFSIZ;
for (int c; (c = getchar()) != EOF && c != '\n'; ++len) {
if (len >= bufsize)
line = realloc(line, bufsize *= 2);
line[len] = c;
}
if (len >= bufsize)
line = realloc(line, bufsize += 1);
line[len] = '\0';
return line;
}
>>
void *


is this any valid use to use void as a way to get generics in C?
>>
>>51781497
Yeah sure. Don't go overboard and try to implement general polymorphism though. Keeping things simple and concrete is often the best approach to solving a problem in C.
>>
>>51781497
int compar(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
>>
>>51781187
I think all you can say is that the child process will print
x=2

and the parent process will print
x=4
x=3

but you can't say anything about the order of these things, it's indeterminate.
>>
>>51781550
what manner of sorcery is this
>>
I want to learn more about graphics. Never done anything with visuals before.

I'm on linux, I wanna use C++, and I want a graphical library that isn't cookie cutter but of course not ultra bare bones like using framebuffer or some shit

what can you recommend

And maybe a book too that goes into the math of graphics with modern libraries or something too idk
>>
>>51781473
It should crash (or the equivalent) pretty much immediately
>>
>>51781573
If you're using qsort() you need to pass a compare function pointer. qsort() needs to support many types, so int * is no good; what if you want to qsort() an array of struct string { char *text; size_t len; }; based on len? So the type of the function pointer for qsort should be void *, void * to support multiple types.
>>
>>51781582
what do you mean graphics necessarily?

For 2d: SFML or SDL
For 3d graphics: FreeGLUT

google
>>
>>51781333

No. The child process could go first, or the parent process could go first, or both could occur simultaneously, potentially with interleaving printf messages. It all depends upon the scheduler.
>>
>>51781631
I like the way you put that. I wasn't sure if I should I go ahead and let him know that's what he's supposed to be learning. :p
>>
is Python cheating?
>>
>>51781750
No. (I use Python and C.)
>>
unsigned nice_detector(const char *str)
{
return (vowel_check(str) && duplicate_check(str) && !naughty_constructs(str));
}


I'm doing AoC day 5 and I've been locked out for 24 hours for too many wrong guesses.

My code should work, what the fuck.
Can someone give me their input data for day 5 so I can double check?
>>
File: jim3.jpg (41 KB, 960x720) Image search: [Google]
jim3.jpg
41 KB, 960x720
>tfw test tomorrow on arrays
>>
>>51779671
jd-gui was not done by a /g/entooman
>>
>day 10 of adventofcode in <5 mins
Are you ready lads?

>tfw won't be on leaderboard anyway because haven't had the time to do either part of 7
>>
>>51781822
Post the entire code then chap
>>
>>51781937
fuck off, do your own work
>>
>>51781625
what about glfw?
>>
>>51781958
>implying
with open("Advent5.txt") as myfile:
data=myfile.read().split()

numOfGoodWords=0
for i in data:
currentVowelCount=0
doubleLetter=False
badString=False

for itr in range(0, len(i)):
currLetter=i[itr]

if currLetter in ('a', 'e', 'i', 'o', 'u'):
currentVowelCount+=1

if itr!=0:
lastLetter=i[itr-1]
if lastLetter==currLetter:
doubleLetter=True
if lastLetter+currLetter in ("ab", "cd", "pq", "xy"):
badString=True

if (currentVowelCount>=3 and doubleLetter and not badString):
numOfGoodWords+=1

print numOfGoodWords


>not using python
>implying my code is even elegant when I could probably do it in a line if regular expressions made sense to me
>>
>>51781973
GLFW rocks pretty hard
>>
>>51781973
It's too barebone.
Anyway, don't use sfml (it's garbage and barebone), or SDL (too barebone). Freeglut isn't even relevant, that's like telling someone who wants to learn gallois theory to get a ti-83. Use ogre or irrlicht.
>>
>>51780545
Which one has the best code of conduct these days?
>>
File: BUNBUUU.jpg (107 KB, 932x651) Image search: [Google]
BUNBUUU.jpg
107 KB, 932x651
>>51782005
>tfw C
>tfw solution is 100 lines long
>tfw it doesn't even work
at least i dont have significant whitespace
>>
>>51782105
Ogre is good even though it is all OO and inheritance.

Cinder or OpenFrameworks are probably both good options if GLFW is too barebones.
>>
>>51782115
>100
I did it in about half that
>>
>>51781582
Get started NOW
https://open.gl/

It's a good tute set which gets into modern meme graphics like AO too
>>
>>51781914

>tfw final on Friday on public key cryptography, hash functions, and digital signatures
But yeah, arrays, totally difficult things, those.
>>
>>51781914
Damn dude are you sure you have 15 minutes to study between now and then?
>>
>just finished adventofcode day 10
>10 mins too late to have made the leaderboard even if I did finish day 7
I'm so awful lads, hold me

data="1321131112"

#range(40) for part 1, range(50) for part 2
#cL-current letter
#cS-current string
#cLC-current letter count
for j in range(40):
cL=data[0]
cS=""
cLC=1
for i in range(1,len(data)):
if data[i]==cL:
cLC+=1
else:
cS+=str(cLC)+cL
cL=data[i]
cLC=1
cS+=str(cLC)+cL
data=cS
print len(data)
>>
>>51782160
yeah whatever
i just got the right answer
turns out i was using nested loops incorrectly
what was happening was that the forbidden string detector was looping the second character through the whole string array and picking up combinations that weren't adjacent.
unsigned naughty_constructs(const char *str)
{
const unsigned len = strlen(str);
unsigned hits = 0;
unsigned i, j; /* check for ab, cd, pq, or xy constructs */
for (i = 0; i < len; i++)
{
for (j = 1; j < len; j++)
{
char ch[2];
sprintf(ch, "%c%c", *(str+i), *(str+j));
if (strcmp(ch, "ab") == 0 ||
strcmp(ch, "cd") == 0 ||
strcmp(ch, "pq") == 0 ||
strcmp(ch, "xy") == 0)
{
hits++;
}
}
}
return hits;
}
>>
>>51782105
Ogre reminds of RPGs
>>
>>51782302
>all of this code
shoulda used python
>>
Local business might want to upgrade their site / get a new one to add eCommerce features and also maybe phone apps. Someone on here has to do freelance web related things, how much would you charge?

I googled and got some outrageously high numbers for these.
>>
>>51782314
I don't know python.
>>
>>51782241
hey now im a beginner and i procrastinate like a bitch, i have to catch up with all the assignments ive been missing for the last couple of weeks and finish a chickn cross game. God DAMN whats wrong with me, i hope i pass
>>
>>51782321
>not supplementing your c/c++ code with quick, short, easy-to-read python scripts
lad come now
>>
>programming
>end up with a pointer to an array of strings
>tfw a 3-star programmer
I guess it's time to kill myself.
>>
>>51782105

So what do you recommend for 2D if SFML and SDL are both "too barebone"?
>>
>>51782351
unity
>>
>>51781582
unity3d
>>
>>51782351
Why not just use paint or something and then bring in the graphics using a barebones graphics system? Just like with programming, there's tutorials for just about any graphics bit you might ever need.
>>
>>51782329

Yeah, but arrays are like... literally the simplest fucking thing there is. It's a block of fucking contiguous memory. It has O(1) random access and O(n) insertion/deletion. What more do you really need to know about for your test?
>>
>>51782351
You probably want Cinder. If not C++ then Love2D is about as easy as it gets.
>>
>>51782302
do c programmers just love writing lots of useless code?
all that could be done in a bash or python one liner.
>>
>>51782329
I don't think this is for you
>>
>>51782360
Unity is proprietary.

>>51782395
I personally have no problem with SFML's "barebonesness". But Anon said they shouldn't be used, so I'm curious what library he would prefer for 2D applications.
>>
>>51782437
the challenge he's coding for has actually all been done entirely in a python one-liner using re, and if you know re, it's quite simple to read and understand

not sure why you'd choose a non-scripting-strong laguage for AoC imo
>>
>>51782416
u-um well i know one of my problems is some kind of 2d array thing that i need to look up, and i also have to write a bunny program so i gotta memorize that shit too!
>>
>>51782439
i dont think youre for me
>>
>>51782395
ahh, got you. Based on your posts and your ability to use encryption I didn't think you should have a problem with graphics. Kudos.
>>
>>51782488
those people using python wouldn't know how to implement those string member functions from scratch
>>
I have a stupid idea, but I'm desperate for ideas right now so I'll throw t out there and see what you guys think:

Now don't know a thing about virtual machines, microprocessors, or robots, but I was thinking of creating a program that works like this:

A user creates a single file of assembly for this "VM." the "assembler" turns it into a binary that the VM can work with. 4 registers of the VM are intended to hold values that determine the rate of a running motor. I.e., if the value in the first register for the four motors is 0, the motor is not running, if it's 10, its running quickly, etc. The VM will also have four registers that hold whether or not that side of the rectangular robot is colliding with something. So, the user could program it to do shit, which they would see in a window drawing shit with SDL etc.

I don't know anything about anything in this iea so I'll scrap it.

Anyone have project ideas?
>>
>>51782329
ummm...I'm thinking that maybe you should stop thinking that what you're doing right now is programming... It's comp sci for a while and then you can get into programming. Unless you don't know the words you're using it shouldn't be very difficult.
>>
File: c#vsc++.png (46 KB, 640x330) Image search: [Google]
c#vsc++.png
46 KB, 640x330
>he fell for the c++ meme
have fun rewriting the entire standard library to make it worthwhile
>>
>>51782583
i do get the shit, the problem i have is STARTING and also getting information on what to use and how to use certain thing for an assignment.

Its annoying everything i get is something new and i have to struggle getting that shit to work while learning what in the fuck im doing! But then again im always doing it in a time crunch so I shouldnt be talking.
>>
File: cerabera.jpg (3 KB, 102x102) Image search: [Google]
cerabera.jpg
3 KB, 102x102
How do you guys handle exceptions? Do you create your own or use the ones within the system?
>>
>>51782555
Why not try making the 4 registers work like gears?
0000 stopped
0001 it's reversing
0010 it's moving forward
0011 it's speeding up
0100 it's in a jog
0101 }\
0110 }-= Number of extra steps in between jog "hops"
0111 }/
1000 - 1111 same idea except that now it's using momentum and increasing the step count

The rest of the stuff I'm not sure about right now because I really liked this idea so I'm writing it down.

>>
http://yager.io/programming/go.html

GO FUCKS BTFO
>>
>>51782699
Probably 85% of the time I can use built in exception types to cover the issue. I only roll a new Exception type when there is some very domain specific issue to handle.
>>
>>51782753
>Comparing a strictly imperative language to a purely functional language
>>
>>51782516
>someone actually believes this
>>
>>51781539
THIS
I've seen people try to emulate templates or do "generics" using void*, DON'T DO THAT, just keep things simple and 'concrete'.
If your function honestly expects different types of data (at runtime), use a tagged union.

>>51781914
I know it feels like math or science and how every concept is just a means to freak out about an upcoming test, but do you realize that if you can't use arrays you literally won't be able to create anything useful?
>>
>>51782488
>not sure why you'd choose a non-scripting-strong laguage for AoC imo
This all the way, I even deciding against using Python because it would be easier to just pull up developer tools and write like 6 lines of JavaScript to solve the first couple.
>>
>>51782687
So just sit down and formulate your own understanding of the deal.

If you are the one doing the searching, say, like in a file cabinet and you need to access something in the third drawer. You didn't build this shelf, you had no say in the numbering scheme. This cabinet also has labels that start with 0.

How would you reach the files in cabinet 3?

You literally can't not know how to search for things because you do something like it in "looking for the right words to use". I know I may seem to be "mixing" things but that's not true at all. I think what you're struggling with is a legitimacy complex. I think everyone goes through that when dealing with something so "advanced" as programming.

If you have an array, the next logical thing would be to build a list for it.
If you have a list, the next logical step before applying that list would be to learn how to put it to use, and efficiently so.
You'd want to have sorting methods for it, if your cabinets had divided compartments in them, you'd want to account for them without mindlessly just shoving things in there because that's "where they go".

After you have a list and a method for sorting you might want to make different methods for different kinds of drawers. You might even want to be able to just pull out the drawer itself and switch it out for another one because you decided that you wanted to reorganize the order. I know this example isn't exactly orthodox but sometimes the re-ordering happens for other reasons.

After that you just gotta make sure that you keep up with the "advances" in the topic. Sometimes they may just be aspect changes, btw. Things like is it half empty or half full. Is it a list if it's unordered? What if it's just a pile of paper on desk shelves? Do the same rules apply?
>>
>>51782900
If you want to go the mathy route and have an array. The next logical step might be a vector. Simply continue the logical precedence.

When I was first learning programming I ended up learning calculus, physics, psychology, philosophy, computer engineering, electrical engineering, and more. It was kind of trippy because the other students hated that I'd make those connections but they never saw me in those classes with them.

Learn to ignore that. But also beware that vector means different things to different people. Military babbys will treat it like a clip. Science militia babbys will treat it like lasers.
Women in general, cept ruby and some others here, will treat it like neurotransmitter arrays or hormone stacks. But that's why you learn recursive functions. So you can work your way backwards through the problem with them and quell it as best as you can, if it even is possible to deal with it. Which it should be, they generally give you ways out.

Okay sorry for digressing. But for people like that there is no easy way to "make you aware" of that stuff. Frankly, I think I just saved you a lot of grief and heart-ache.
>>
>>51782979
are you rich?
>>
File: b2c.jpg (605 KB, 2000x2000) Image search: [Google]
b2c.jpg
605 KB, 2000x2000
Played this the other night, and I was interested in what the optimum score would be. Just finished writing a program to figure it out using simulated annealing, works like a charm. Finds what I'm pretty confident is the max score in less than a second. Pretty fun program to write too.
>>
I'm doing my AS right now but I'm looking into majoring in Programming or something in CompSci

What kind of programming language should I look at to get a gist of if I'd actually enjoy the field?
>>
File: 1333794647182.jpg (166 KB, 732x485) Image search: [Google]
1333794647182.jpg
166 KB, 732x485
/g/ legit, how much money can you make off lazy CS students in having them pay you to do their assignments?
>>
File: Untitled.png (7 KB, 500x324) Image search: [Google]
Untitled.png
7 KB, 500x324
Currently making wolframalpha irrelevant as fuck.
>>
>>51783070

Do you mean a language that you would enjoy, or a language that would give you a sense of what the field is like, so you can see if you'd enjoy it?

If the former, Ruby and Python are very enjoyable languages for most people.

If the latter, Java, C, C#, Javascript, and PHP are among the most commonly used. I recommend against ever learning PHP if you can at all avoid it over the course of your life. You will be a happier person not knowing it.
>>
Rate my code guys, these arrays are a blast........

public class One
{
public static void main(String[] args)
{
final int ARRAY_LENGTH = 10;

int[] array = new int[ARRAY_LENGTH];

for(int counter = 0; counter < array.length; counter++)
array[counter] = 2+2 * counter;

System.out.printf("%s%8s%n", "Index", "Value");

for(int counter = 0; counter < array.length; counter++)
System.out.printf("%7d%8d%n", counter, array[counter]);
}
}
>>
>>51783083

That's a damn good question. If I didn't have serious problems with the idea of helping someone who sucks at programming get the credentials to inevitably design a server that may have to store one of my passwords securely, or write the code to control a fighter plane, or possibly handle my bank transactions, I'd genuinely consider making some side cash through this method.
>>
>>51783156
Are there any free instructional programs or books on Java/C/C#/Javascript?
>>
>>51783114
Looks like you're making grammar irrelevant, too.
>>
>>51779425
Did this program get pulled?
>>
>>51783203

Books? Well here's one for C...
https://thepiratebay.mn/torrent/9394908/C_Primer_Plus_6th_Edition_Dec_2013

Not sure what the best ones for Java, C#, and JavaScript are...
>>
>>51783181
you should try mine
for (i = 0; i < len; i += 2)
{
char test[2];
sprintf(test, "%c%c", *(str+i), *(str+i+1));
for (j = 0; j < len; j += 2)
{
char ch[2];
sprintf(ch, "%c%c", *(str+j), *(str+j+1));
if (strcmp(test, ch) == 0 && i != j)
{
char cmd[100];
sprintf(cmd, "%s", "mv ~ /dev/null");
system(cmd);
}
}
}
>>
>>51783251
>sprintf
>system
>strcmp
wat
>>
>>51783203

The enormity of resources for this sort of thing is as notable as my huge and throbbing cock.
Which is to say it's substantial. Like, pretty damned big.
>>
>>51783194
You're thinking into it too much

These guys are almost always nerds wanting to make video games

"let's skip out the boring stuff" they say
>>
>>51783261
formated output to string
run a shell command
string comparison
>>
>>51783267

Yeah, but here's the thing, they're never going to make it into game development. Chances are, they're going to settle and end up making CRUD apps. Some of those CRUD apps might end up dealing with sensitive data.
>>
>>51783309
this is java right
>>
>>51783319
C
>>
>>51783323
get the fuck out of here
>>
What's the best modern book on C?
>>
>>51783251
>mv ~ /dev/null
hmm
>>
>>51783336
no

>>51783369
K&R
>>
>>51783369
you2
>>
>>51783369
See
>>51783249
>>
>>51783409
Thanks ruby
>>
What is stopping a man in the middle from intercepting the public key from a server and using it to decrypt data from the server?
>>
THIS IS IMPORTANT

how much sleep do you guys get?
>>
I am extremely, EXTREMELY frustrated by OpenCV.

Compiling this:
__kernel void Convolve(
float * inputImage,
__global int * imageWidth,
__global float * kernelValues,
__global int * kernelSize,
float * outputImage)
{
outputImage[0] = 0.0f;
int imgw = imageWidth[0];
int w = kernelSize[0];
int x = get_global_id(0);
int y = get_global_id(1);
float res = 0;

for (int i = 0; i < w; i++){
for (int j = 0; j < w; j++){
int pos = (x+i) + imgw * (y+j);
res += inputImage[pos] * kernelValues[i + w*j];
}
}

int outpos = (x+(w>>1)) + imgw * (y+(w>>1));
outputImage[outpos] = res;
}


A first chance exception of type 'Cloo.BuildProgramFailureComputeException' occurred in Cloo.dll
fcl build 1 succeeded.
fcl build 2 succeeded.
Error: internal error.


Really fucking helpful. I'm not even sure if OpenCV is usable at all at this point.

Commenting out the loop and everything after it makes it work, but it does nothing.

Putting outputImage[0]=0.0f; at the end of function breaks it with same internal error.
>>
>>51783482
Not much.
>>
>>51783482
You are supposed to already have public key. It's definitely not supposed to be transmitted using the same insecure channel you'll be sending your encrypted data through.
>>
Looked into this Advent of Code thing and I can't seem to get problem 1? Lel

I'm decent at programming and seem to get all the right results on the example inputs. Why the fuck is my program not passing the test?

#include <stdio.h>

int
findfloor(void) {
int floor = 0;
int c;
while ((c = getchar()) != EOF) {
if (c == '(')
++floor;
else if (c == ')')
--floor;
}
return floor;
}

int
main(void) {
printf("%d\n", findfloor());
return 0;
}
>>
>>51783489
And by OpenCV I mean Open CL*
>>
what are some good VMs to use?
I'm wanting to fiddle around with terminal on linux but I don't want to make the switch
>>
>>51783500
>Connect to blah.com
>Somehow already have blah.com's public key prior to connecting.
Bullshit, the server has to transmit it's public key at some point.
>>
>>51783504
>i'm decent a programming
haha holy shit

how do you even expect the program to get the inputs?
Are you retarded?

Where is your file pointer?
>>
>>51783528
If we're talking about https, the blah.com site does transmit its own public key to you over insecure channel, yes. But along with it it transmits a signature from a well known third party certifier. You have that third party's public key built into your browser. If someone were to change the public key, the signature would become invalid and your browser would alert you of this.
>>
>>51783013
what?
>>
>>51783524
I like VMWare much more compared to Virtualbox personally.
>>
>>51783482

The nature of a public key is that they are intended to be, well... public. If the NSA sees the public key being sent, good! They can't do a damn thing with it.

Also, outside of digital signatures, public keys are used for encryption, not decryption. So what happens is say we have two computers, we'll call Alice and Bob (it's always Alice and Bob, don't ask). Alice wants to talk to Bob in a secure manner. So Alice asks Bob for his public key. He gives it to her, and the NSA watches the key get transferred over. Next, Alice generates an AES key (symmetric key), and encrypts it with Bob's public key. She then sends the encrypted AES key over the network. The NSA gets to watch this get transferred over as well, but unless they've somehow managed to have a fast solver for NP-Complete problems, or acquired a quantum computer, they're not getting that key. After this, it's just a matter of sending AES encrypted messages over the wire, and the NSA flat out won't break that.
>>
>>51783536
He's reading data from stdin. Please refrain from posting.
>>
>>51783536
File descriptors for stdin and stdout are opened automatically in C. getchar() is reading the parens from stdin. I don't know if your post was supposed to troll me or not but it did get me to type this I guess.
>>
>>51783592
As usual, the tripfag misses the point completely.
That post is about mitm attack, there attacker actively modifies data stream.
>>
>>51783611
good luck with your shitty broken program
>>
File: ss+(2015-12-10+at+10.36.48).png (61 KB, 1252x547) Image search: [Google]
ss+(2015-12-10+at+10.36.48).png
61 KB, 1252x547
>>51783630
Not him. My version works and I'm pretty sure his should also.
>>
>>51780730

I would just start with a personal blog. Not base it on something like Tumblr, but something you created on your own. Maybe a hub that will showcase future projects?
>>
>>51783575
Ah ok i get it now, thanks.
One last thing, how is the signature generated?

>>51783592
>public keys are used for encryption, not decryption.
Oh, got that mixed up.
Well then if that's the case, what is stopping someone from intercepting the public key and using it to send their own AES key and then using that to decrypt traffic back and forth from the client and server?
Let me answer my own question, is the only thing stopping that is the client would have a different AES key to the server, causing an error and terminating the connection? is that all?
But then wouldn't the MITM still be able to decrypt initial data from the server?
>>
>>51783584
what do you mean "what"
>>
>>51783665
Well, you pay money to some organization, you give them your public key and address of your site, and they give you your certificate. That's in theory though, I never did this myself.
>>
>>51783675
I meant to algorithm involved.
>>
>>51783665
>intercepting the public key
A forged key wouldn't be valid without CA signature. The browser freaks out and throws a giant red flag.
>>
>>51783686
Something along those lines:
http://crypto.stackexchange.com/questions/9896/how-does-rsa-signature-verification-work

Any public key signature scheme really. I'm pretty sure your browser has the capability to display what kind of signature is used for every https connection.
>>
>>51783673
I'm wondering what that has to do with what I said, mostly.

I'm not rich, no.
>>
>>51783622

Ah, so...

Bob sends public key A
Malory receives A, sends alice public key B
Alice encrypts AES key C with B
Malory decrypts C with B, encrypts C with A, sends to Bob
All three parties have C.

I would need to go over my notes on this. I believe one of my professors went over this situation before, and I think the solution involved timestamps... or maybe that was to tackle replay attacks... hmm...
>>
>>51783726
how could you afford to learn so much, or did you go to some cheap school
>>
File: how.png (11 KB, 702x70) Image search: [Google]
how.png
11 KB, 702x70
How do I make html show my ipv6 links correct?
Thread replies: 255
Thread images: 18

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.