[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: 33
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>52278441

What are you working on, /g/?
>>
Please do not post an anime image next time, thanks.
>>
does anyone want to be my programmer bf?
>>
>>52282895
depends... can you code?
>>
>>52282895
How petite are you?
>>
>>52282853
KILL YOURSELF I FUCKING HATE YOU FUCKING STUPID LOSER
>>
>>52282950
yes I like to program in haskell, scheme and c

>>52282967
um pretty petite I think... I can fit on most ppls lap
>>
File: trap programmer.png (1 MB, 1702x2471) Image search: [Google]
trap programmer.png
1 MB, 1702x2471
Daily reminder that if you don't program while dressed like a schoolgirl, you don't belong on /dpt/.

You can redeem yourself by buying a schoolgirl outfit and C Primer Plus (6th Edition) by Stephen Prata, preferably in the same amazon cart.
>>
>>52282990
Post body picture.
>>
>>52282997
is there an official /dpt/ schoolgirl outfit senpai?
>>
>>52282990
>I can fit on most ppls lap
fucking slut
>>
>>52283013
/dpt/ at its finest
>>
>>52282990
post feet

>>52282997
manga name?
>>
>>52283028
/dpt/ is shit anyway.
>>
>>52282967
where are you from?
>>
>>52283074
Providence
>>
File: feet.jpg (93 KB, 640x480) Image search: [Google]
feet.jpg
93 KB, 640x480
>>52283013
b-but /g/ is SFW =w=

>>52283027
I don't sit on boys laps that would be lewd!

>>52283036
feet are ok [spoiler]pls don't call me a slut again[/spoiler]
>>
>>52283094
>b-but /g/ is SFW =w=
no one said anything about nudity.
>>
>>52283094
do you have a tumblr maybe?
>>
>>52283094
obviously a guy's feet fucking fag slut
>>
>>52283094
post clothed body and skype.
>>
>>52283120
>caring
if it has good hygiene i'll fuck it
>>
why is every single programming video narrated by an indian dude that i cant understand
>>
>>52283157
>Watching programming videos
why?
>>
>>52283094
why do you paint your nails anon?
>>
>>52283157
don't watch programming videos just read the docs

also >>52282913
>>
>>52283183
>>52283168
>why?
cause my brain goes numb from reading shit for hours on end so i like to try to take a break and relax and watch videos in between
>>
>>52283157
I don't think I've ever come across a programming video worth watching.

It's such a shitty medium for displaying text and they're all made by designated street shitters or 12 year olds/.
>>
>>52283203
>reading for hours on end
I hardly ever read programing materials anymore.
>>
>>52283218
well im still kinda new at what im doing (havent worked in qa in 7 years and just started a new automation job) and need to brush up on new technologies. last time i worked in software there wasnt even such things as mobile apps, jenkins didnt exist and selenium webdriver was still called RC
>>
File: body.jpg (138 KB, 674x1200) Image search: [Google]
body.jpg
138 KB, 674x1200
>>52283118
ooops I thought you meant that lol

I put something modest on now

>>52283119
nop

>>52283142
skype is non-free software!

>>52283175
why not? it's fun and looks pretty
>>
>>52282997
>and C Primer Plus (6th Edition)
>not C programming a modern approach
shiggy diggy
Also, pls help: >>52283076
>>
>>52283276
>tranny

boner redacted, nevermind
>>
>>52283276
That's a nice donk
>>
File: eee.png (241 KB, 645x363) Image search: [Google]
eee.png
241 KB, 645x363
Why haven't you made your own personal 4chan extension, /dpt/?
>>
File: 2sweaty.jpg (15 KB, 300x300) Image search: [Google]
2sweaty.jpg
15 KB, 300x300
>>52283214
Try this one
https://www.youtube.com/watch?v=3G-LO9T3D1M&feature=youtu.be&t=1h45m28s

Make sure to use the timestamp, don't use embed.

Anyway, I found this one really informative. Shame Scott Meyers is phasing out of the C++ community.

>>52283276
Oh shit- anon, I...
>mfw
>>
>>52282853
Porting an excel spreadsheet + vba code to C++. Spreadsheet was being worked on by 3 different people at the same time and I'm the only person porting to C++.
Boss man today is like "Why is this taking you so long to port? The C++ version is really out of date now"
Wow! You don't say??
>>
>>52283276
kill yourself

>>52283286
see i told you they were a guy's feet
>>
>>52283286
rude!! I'm a girl

I bet you don't even know functional programming
>>
>>52283312
I was ok with the guy part, not the MtF transsexual part.

I'll stop off topicing now.

>>52283328
you're not a woman and you never will be
>>
File: 3sweaty.png (71 KB, 240x312) Image search: [Google]
3sweaty.png
71 KB, 240x312
>>52283342
>girl knows FP better than you
>yfw
>>
>>52283378
Why are you surprised by this fact?
All the top women in computer science are male to female transsexuals.

Men are just better, period.
>>
>>52283378
are you ok anon?
>>
>>52283394
I'm actually not very. Due to my position in the CS department of that the college I attend, for example, I know we basically accept any girl who applies to keep our numbers up. (we still don't have that many girls... lol)

Anyway I don't know the causes, but I know the statistics.

>>52283420
rip
>>
File: woms_d_008.png (557 KB, 1200x1687) Image search: [Google]
woms_d_008.png
557 KB, 1200x1687
programming is gay
>>
this thread is fucking garbage

>>>/lgbt/
>>>/a/
>>>/lewdanime/

real thread here: >>52282913
>>
>>52283472
Neither thread has anything go for it.
>>
>>52283449
so what happens after his sister catches him wearing her clothes?
>>
>>52282853
Made a nice little calculator yesterday and am now trying to improve upon it.
>>
>>52283484
at least >>52282913 doesn't have fucking traps and full-blown trannies
>>
>>52283472
>>52283527
That one came second. This is the official. If you want to de-derail it, be a role model.

It shouldn't come as a surprise that a /g/ thread has a tendency towards faggotry.

>>52283516
I'm a bit curious...

>>52283524
Does it use a GUI and is a test of UI dev? Or is it CLI, like a test of the shunting yard algorithm?
>>
>>52283527
You say that like it's a bad thing.
>>
>>52283527
I'm not a tranny wtf lol
>>
File: calc.png (4 KB, 640x300) Image search: [Google]
calc.png
4 KB, 640x300
>>52283536
Here's a pic I took of it yesterday. It's CLI based and reasonable accurate.
>>
>>52283516
IIRC it was a femdom and they end up fucking eventutally.
>>
Trap thread wins again

How surprising
>>
>>52283562
>does anyone want to be my programmer bf
>boobs
>>
File: kek.jpg (357 KB, 1620x1400) Image search: [Google]
kek.jpg
357 KB, 1620x1400
>>52283563
That's awesome, anon - I really mean it. I have a thing for parsers and compilers and stuff. Keep writing stuff you like and good things will happen.

>>52283562
Doesn't matter to me, you pass either way, 10/10

>>52283576
Damn breh, I found it online
>>
shit
piss
>>
File: stray.png (8 KB, 291x310) Image search: [Google]
stray.png
8 KB, 291x310
>"REEEE USE PRINTF IT'S FASTER THAN COUT" - anon, 2016
>test it
>no output 30.120s
>cout 33.640s
>printf 33.661s
yous all fuck up aye
>>
>>52283661
puts() fgt
>>
>>52283661
https://www.youtube.com/watch?v=RFZrzg62Zj0

printf is a lot more comfy to use anyway

cout is the sepples equivalent of "nigga " + kike + " shit" etc, it's tedious to write
>>
>>52283661
Whoever said that?
>>
>nobody has posted any code yet
smdh
>>
>>52283780
>>52283780
>>52283780
>>52283780
test
>>
>>52283780
the real /dpt/ has some code

come join us at >>52282913
>>
Friendly reminder that there's nothing wrong with linked list stack implementations.
void stack_push(stack_t *stk, int data)
{
frame_t *frame = (frame_t *) malloc(sizeof(frame_t));
frame->data = data;
frame->next = stk->head;
stk->head = frame;
stk->size += 1;
}

int stack_pop(stack_t *stk)
{
if (stk->head == NULL)
printf("Stack empty.\n");
frame_t *frame = stk->head;
int data = frame->data;
stk->head = frame->next;
stk->size -= 1;
free(frame);
return data;
}
>>
>>52283780
import std.stdio;

void main() {
writeln("ur an faget");
}
>>
>>52283799
why tho? array stacks are so easy
>>
>>52283841
it's a meme
>>
>>52283841
No stack overflows.
>>
>>52283866
And also like 100x slower, shit man
>>
YOU WILL NEVER REALIZE YOUR DREAMS

;_;
>>
>>52283882
prove it
>>
>>52283866
Because it's so hard to check that an array has enough data allocated.

>>52283882
When this meme first cropped up it was shown to be like ~25x slower.
>>
>>52283906
Makes sense, that's around the same ballpark as as benchmarks go
>>52283904
There ya go

And besides, we have stack canaries for this purpose
>>
/agdg/ just told me I should write my own engine to make a video game and should use Unity instead.
What do you guys think?
>>
>>52283906
>Because it's so hard to check that an array has enough data allocated.

But that's so much work and added overhead.
>if (stk-size >= stk->max)
>realloc

and this is for every stack push
and ideally, you'll want this for every stack pop as well so you're not wasting memory

my solution cuts out the middleman by allocing one unit for every new push and freeing it automatically on every pop
>>
>>52283930
Lots of people using Unity.
Making your own engine is a bit more work but you learn more.
>>
>>52283930
either your with us or your with them

write you're own engine
>>
>>52283930
If you're seriously asking this question, then you're in way over your head and are probably going to give up in about a week or less.
>>
>>52283917
as far as*

Anyway, if you're willing to take such egregious performance hits you can just move to a memory safe language anyway, which is easier to work with anyway

>>52283930
If you actually want to make anything reasonably complex, using an existing engines is the way to go. I mean, you can go on your own if you want, but it may take herculean effort just to end up with a shitty version of an existing game engine, anyway.

Trust me, I've gone down this road, and while I learned a lot, it wasn't pretty. Unless you really know what you're doing and understand the scope of what you're creating, you're not going to finish.
>>
>>52283958
>>52283965
But video games are gay. They're just a bunch scripts and assets on top of an engine.

Engines just seem more interesting and fun than games. I'd rather Program an engine than "design" a video game on top of one.
>>
>>52283988
Why don't you hardcode your game into your engine then?
>>
>>52283942
>Allocating one one at a time
>>
>>52283988
Alright, I can understand that line of reasoning. So, what is the scope of the game you're wanting to create?

What is it going to do?
>>
>>52284003
It's going to be a sidescrolling indie platformer with pixel graphics and crafting
>>
>>52283942
If you're really hard pressed for memory you can do an arithmetic increase instead of an exponential increase.
>>
>>52284003
My Ultimate Naive Fantasy Programming Dream is to make a first person dungeon crawler with procedural dungeons. And procedural loot. Uh, that's about it I guess?
>>
>>52283942
ok but what if you know that like 50% of the time the stack will be less than some size. then you don't even have to touch realloc and I don't think a JGE op will break the bank
>>
Been reading some natural language processing in python. Interesting stuff but I need to go deeper.

>>52283276
Trap or not, I'd do you. I'll be a temporary bf tho. Too busy for non hit-and-runs.
>>
>>52284052
write your own engine there is pretty much nothing the unity engine would do to help you develop your game
>>
time to learn a fresh new language!
>>
>>52284057
so... delver? doesn't sound like a naive dream anon you can do it!
>>
>>52284052
>>52284057
That's reasonable. I would say go for it, but don't be afraid to use a graphics library even if you don't go for a full on 2D game engine.
>>52284057
I believe in you!
>>
>>52284100
>don't be afraid to use a graphics library
fuck off

opengl is piss easy if you follow the superbible
>>
>>52284112
lol ok
>>
File: saad maan.jpg (10 KB, 300x200) Image search: [Google]
saad maan.jpg
10 KB, 300x200
>want to write guis in D
>hey there's a Qt binding
>it requires Qt4
>only installers on the site are for Qt5
>have to compile Qt4 from source
>it takes like 30 minutes because it's c++, then inexplicably gets stuck spamming the terminal with the same shit over and over again without an error message or anything
>try to wait it out for another 30 minutes
>come back and it's still doing it
>fuck it I'll find another toolkit
>only other things out there are a gtk binding and an SWT binding
>>
>>52284081
Yeah, but that's only part of it.
I want it to be moddable so that I can add content on top. 100% procedurally generated content is boring, there should be at least some intelligent design involved. Also, I want to implement some features that I always wondered why games never use. Like real time mesh deformation and gibbing. And I don't mean half-assed gibbing where the model is swapped for a bunch of pre-modeled body parts, but actual gibbing. Or, like, why are texture blending techniques used so half-assedly all the time? And I want to play around with shaders and see what kind of crazy art styles I could come up with. Also I always wondered if it's possible to procedurally generate in-game assets so that they look convincing. You know, why model an Elven Sword, Elven Short Sword, Elven Dagger all separately when you can try to define what is "Elven" and what is a "Short Sword" and combine them somehow in an algorithm?

Now that I think about it, I don't give a shit about the game itself, I just want to try out various programming ideas applied to a video-game environment. Who gives a fuck about playing games, I want to implement TECHNOLOGY(tm).

If I amass enough gimmick technologies, I could make a flashy teaser trailer and put it up on kickstarter and vanish with the money.

That's my long-term plan.
>>
>>52284173
Just write your interface in ncurses faggot

guis are for faggots.
>>
File: Capture.png (1 MB, 1833x1039) Image search: [Google]
Capture.png
1 MB, 1833x1039
what are you working on ?
>>
>>52284173
Should have used Free Pascal.
>>
>>52284157
using a graphics library is as retarded as using an engine. instead of learning how to take advantage of opengl you use some very limited pre-built library that has garbage performance. lol ok
>>
>>52284112
pls post superbible
every resource on opengl I look at is either SDL garbage or nonfunctional like open.gl
>>
>>52284080
That image is opengl in a nutshell
>hey I wonder what glBeginVertexMatrixInitializeTransformDicksuckTextureIdentityModeBuffer(300 arguments) does
>nobody fucking knows but my program only displays flashing black lines without it
>>
>>52284203
Facebook user faggot detected.
>>
>>52284203
Sending this screenshot to Valve
>>
>>52284218
This guy's writing a dungeon crawler, not an FPS.

I don't understand why you need to go so low level for this. Do you want them to link to libGL from assembly too? Is it unacceptable if they use any technology outside GNU binutils and Mesa?
>>
>>52284242
>what is a manual
>how do i google
>>
>>52284262
what is the library even supposed to do? how will it be any better than using "low level" opengl?
>>
>>52284322
>google it
>there are no tutorials that use anything newer than opengl 2
>>
How do I encrypt keystrokes to prevent keylogging? The language is C, and the platform is Windows.
>>
>>52284368
>following crappy tutorials made by honeymooner newfags like a cargo-culting babby
literally look it up in the docs and/or in a book

if you actually have any idea of how opengl works the docs will be enough
>>
>>52284242
Actually made me laugh, thanks
>>52284331
Create objects, group objects together, in 2D games like these, hides shaders unless they're necessary, makes it so the internals of openGL are an implementation details, etc.

There are other reasons.

>>52284377
Uh...
>>
>>52284377
encrypt your stack
>>
>>52284377
Rewrite the Windows kernel
>>
>>52284377
you can't
>>
>>52284377
Write costume drivers for your keyboard and overrule the windows drivers.
>>
>>52284377
I giggled like a retard anon
>>
>>52284392
>Create objects, group objects together, in 2D games like these, hides shaders unless they're necessary, makes it so the internals of openGL are an implementation details, etc.
none of this is difficult to do by yourself. if you're able to use a library to make a gaym you're able to use opengl to make a gaym.

>There are other reasons.
sure there are.

you may as well go full retard and use the fucking unity engine then if you're going to have this mentality of avoiding everything that looks scary to your sheltered little baby ass.
>>
>>52283930
listen to me friend, you want to know how engines work before working with something like unity so you can understand how it all works. If you just want to put something together though then just go straight to unity, but you won't learn much and it probably will be shit
>>
>>52284392
are implementation details*

>>52284411
There's a huge distance between libGL and the Unity engine, dude.

Anyway, do you really expect someone to learn how matrix transformations work just so they can rotate a sprite? The whole point of a graphics library like that is so they don't need to understand how the GPU does its job to get the same result.

I never said that someone should cover their ears when something interesting comes up. But this dude's dream is to make a dungeon crawler. If you ask him to reinvent the wheel, he has a significantly lower chance of achieving his dream.
>>
Reposting from other /dpt/...

Started work on a Java EE/PostgreSQL web application that will be used by businesses (more for a portfolio piece but I'm planning to have a fully functional site that businesses would be able to sign up with and start using). The idea is general enough that it can be used by companies in many different industries, will focus on one industry (currently considering aerospace) as I build it out. Currently working on the login page.

The idea right now is a basic MVC pattern with classes for business objects, facades, and DAOs. Considering using Spring/Hibernate for caching of data. Pretty new to Java web apps in general so one question I have is how to allow the application to remember which user is logged in as they move from one JSP to the next. Obviously I could just pass all the data between pages with a GET/POST, but this seems like kind of a pain in the ass and I feel like there may be a better way. One alternative I was thinking about is to use one JSP as the "parent" which contains session data and load the other JSPs as iframes within this JSP. Not sure what the recommended approach is, anyone have any insight into this?

I'm coming from an ASP.NET background, hence my limited knowledge of common ways of doing things in Java.
>>
What should I learn: C++ before C or C before C++?
>>
>>52284433
>do you really expect someone to learn how matrix transformations work just so they can rotate a sprite?

that's basic math
you're telling me that you dont know basic math and yet you want to make a game despite not knowing the basics of computer graphics

i bet you don't even know linear algebra
>>
>>52284260
it's not cheating, I'm just parsing the data from their own gamestate integration

the problem is I can't skip around the ticks very easily, mostly because it'd involve setting 30 keybinds, one for each round
>>
>>52284433
linear matrix transformations are easy as shit

if you have no interest in learning things then you should just settle with making a very mediocre gaym in the unity engine and get a 9-to-5 job at burger king
>>
>>52284457
Seeing the weapons, money etc of the enemy team at the start of the round is cheating
>>
If I want to learn opengl, should I just read the reference manual or what?
>>
>>52284433
>The whole point of a graphics library like that is so they don't need to understand how the GPU does its job to get the same result.
>i'm afraid of learning
>>
>>52284448
I took linear algebra last year and aced the course. That's beside the point, though- this is about getting an intermediate programmer closer to writing the game he really wants to make.

I'm starting to think you're not arguing in good faith.
>>
>>52284476
the reference manual is not really enough by itself as a starting point. you should probably read the opengl superbible and also look up each function you use in the manual. don't follow online tutorials. don't look at code from high-level libraries/frameworks.
>>
>>52282853
Me on the left

>>52282997
Me on the screen
>>
I learned C

what now
>>
>>52283799
>>52283904
This array stack takes ~630ms to push and pop 100million integers.
typedef struct stk{
int *data;
int index, allocated;
}stk;

int stkPop(stk *input){
if(input->index<1){
puts("Stack empty.");
return input->index;
}
return input->data[--input->index];
}

int stkPush(stk *input, int data){
if(input->index+1 > input->allocated){
input->allocated=input->allocated*5/3+1;
input->data=realloc(input->data,input->allocated*sizeof(int));
}
input->data[input->index++]=data;
return 1;
}[spoiler][/spoiler]


Yours takes 30 seconds.
>>
>Have to write something in C++
This is the definition of "meme language", what hot garbage
>>
>>52284508
become a kernel hacker
>>
>>52284466
>>52284477
See >>52284481, assuming you aren't samefagging
>>
Posting condensed version. What's the best way to preserve some user data as a user moves from one JSP to the next in a large business application (Java EE)? Say I need to pass a session ID and a few other pieces of data so the application always knows who's accessing a page. I know you can do it by just passing it along with a GET/POST, but this seems like such a common thing I feel like there's a better way than doing this every single time. Anyone have any good ideas?
>>
>>52284472
well sure it is, but keep in mind that the data on most of that image is literally all that can be parsed. (1/4 of the way in to the bottom of the page)
That's only player statistics of the person you are spectating or yourself, all this is doing is recording the information you have already

>>52284476
I guess, if you want
what I would do, though, is set out to build a project
for example a tilemap that updates with your position on the screen, and dissapears off-screen
then you look at how other people implemented that and learn

also you can read the library files to see the functions you can call, I always found that to be very helpful
>>
>>52284481
Dungeon crawler guy here, I don't as much want to make a game as I want to program it.
I don't know how else to explain it.
For me, it's not about having a finished dungeon crawler video game sitting on my computer, but about the process of making it and having a full understanding of how it works.
>>
>>52284524
if your really despise learning you can just fucking google it and even copy paste some code fucking retarded faggot

>intermediate programmer
you're talking about a hypothetical fucking manbaby that would be better off with pygame or unity engine
>>
>>52284537
then absolutely write your own engine from scratch using opengl. it's entirely doable, it will just take effort and time.
>>
I'm new to C++ and can't find a solution that works for my problem. I'm taking user input and storing it as a string. If the string is of length 1 (a single letter), I want to compare it to each index in a char array to determine if it's the same as any of them. How would I go about doing this?
>>
>>52284448
>>52284481
nigga please this is how you rotate a sprite

x_coord = (float) (multiplier * Math.sin(Math.toRadians(i)));
y_coord = (float) (multiplier * Math.cos(Math.toRadians(i)));
i being the precision of your line
you can even do collisions on that

Line line = new Line(35,35,x_coord,y_coord)
other implementations are possible as well, if you had an image or whatever

there you go, no linear algebra involved
>>
>>52284537
https://www.youtube.com/watch?v=HQYsFshbkYw
>>
>>52284515
>yours takes 30 seconds
get a computer made this millennium you weenie

int main(int argc, char **argv)
{
stack_t *stk = stack_init();
size_t i;
for (i = 0; i < 100000000; i++)
{
if (i % 2)
stack_pop(stk);
else
stack_push(stk, i);

}
return 0;
}


$ time ./stack
real 0m2.077s
user 0m2.072s
sys 0m0.004s
>>
>>52284597
>>52284614
You only pushed and popped 50 million integers you fucking retard. Now try like this.

int main(){
stack_t mystack = {NULL,0};
for(int i = 0;i<100000000;i++){
stack_push(&mystack,i);
}
for(int i = 0;i<100000000;i++){
stack_pop(&mystack);
}
return 0;
}
>>
>>52284537
Well, if you want, you can use OpenGL. It's really up to you. I'm personally not entirely against it, especially if the purpose is to acquaint yourself with OpenGL and how it works. My point (which I guess may be unrelated to your case) is about practicality.

>>52284553
Yeah, doesn't sound like this is in good faith.

>>52284590
Any reasonably sophisticated usage ends up looking just like rotation matrices. https://en.wikipedia.org/wiki/Rotation_matrix The only reason you have 2 trig terms instead of 4 is because you assume the original point is (multiplier, 0) and is zero on the y axis.

What you wrote looks absolutely nothing like GLSL, by the way.
>>
File: man gets hit by train.gif (656 KB, 400x300) Image search: [Google]
man gets hit by train.gif
656 KB, 400x300
>there are tutorials for GtkD
silver lining
>>
>>52284644
>practicality
I care about doing things Correctly tbqh.
>>
>>52284660
D is a meme, use Free Pascal + Lazarus.
>>
>>52284644
gl_Position = vec4(u_rotation_mat2 * a_position_vec2 + u_translation_vec2, 0.0, 1.0);


so hard
>>
int main() {
char c[1024*1024*100];
*c = 0;
return 1;
}
>>
>>52284644
ok, I was responding to this directly
>Anyway, do you really expect someone to learn how matrix transformations work just so they can rotate a sprite?
the point was that you don't need to know really any math to code anything in 2d, not that opengl is superior. I don't even use opengl.
>>
>>52284589
pseudocode
if (len(input) == 1)
for(i := 0;i<len(string);i++)
if(input[0]==string[i]
doSomething();
>>
Where are preloaded images saved senpai?
>>
>>52284642
I don't know what the fuck you're trying to do by putting my stack context and perverting my API, but if you actually wrote it like a sane human being it only takes 4 seconds.
>>
File: nuclearnorthkorea.webm (430 KB, 720x404) Image search: [Google]
nuclearnorthkorea.webm
430 KB, 720x404
Ask your beloved programming literate anything.
>>
File: ttt.jpg (26 KB, 480x678) Image search: [Google]
ttt.jpg
26 KB, 480x678
>>52284668
So the decades of work put into graphics libraries and game engines were all a waste of time? Everyone should just abandon existing technology and repeatedly reinvent the wheel in a mass case of NIH?
>>
>>52284642
>being autistic
that's not how you use a stack, retard

>>52284614
simulates much more realistic stack usage

and if you want 100 million stack push and pops, it's still 4 seconds, which isn't really that bad
>>
>>52284722
unity engine is fucking garbage

they're a bunch of dudebros that decided they could make a GAYM ENGYN and have the nerve to charge money for it and its services. and the stupid kids and hipster fag "studios" eat it all up
>>
>>52284722
Yeah.
If everyone did things Correctly, everything would be better.
If everyone did only Practical things, every game would be twelve layers of middleware deep.

OpenGL is an example of doing things Correctly when everyone is being Practical and using DX.

Doing things Correctly is the reason Free Software and Linux and other Good Things exist.
>>
>>52284704
Thank you!
>>
>>52284767
Unity is fucking awful.

Hey, why don't we use C#, but restrict ourselves to a substandard implementation, and basically turn it into a scripting language? And fuck updating the version of C#/mono, let's just stick with this awful fork we made and never update it, because we didn't integrate the upstream version cleanly.
>>
>>52284722
>"you must re-write EVERYTHING in order to write correct software"

lookee here everyone, we got a real fucking clown here
do you think you are being funny?
>>
>>52284527
Responding to my own question, HttpSession does exactly what I need.
>>
>>52284642
>>52284718
I did my own tests and got these results.

500million pushes and pops:
With the list method it takes ~4.3 seconds.
With the array method it takes ~`1.4 seconds.

200million pushes and pops:
With the list method it takes ~1.7 seconds.
With the array method it takes ~350 milliseconds.

100 million pushes and pops:
With the list method it takes ~950 milliseconds.
With the array method it takes 300 milliseconds.

50 million pushes and pops:
With the list method it takes ~490 milliseconds.
With the array method it takes ~200 milliseconds.

1 million pushes and pops:
With the list method it takes ~50 milliseconds.
With the array method it takes ~20 milliseconds.

The list method isn't as bad as I was expecting.
>>
>>52284767
Never said anything about Unity in particular. I've tried Unity and dislike it personally.
>>
File: 1452112132284.jpg (36 KB, 600x337) Image search: [Google]
1452112132284.jpg
36 KB, 600x337
Why do people leap back in surprise and make fun of me when they find out I write all my programs in C?
>>
>>52284850
I meant to say ~600 milliseconds for 200million, don't know how ~350 ended up being there.
>>
Question.
Fluid sims.
What kind of stuff should I look into.

Shit like this
http://hexadrive.jp/lab/demo/622/
>>
>>52284855
so "NIH" isn't always a bad thing especially if you value quality. you can never trust other people to make a flawless solution and engines/libraries have to accommodate all possible use cases and be idiot-proof so performance and quality will suffer compared to a custom solution. most established products started out as "NIH" anyway.
>>
>>52284856
Why do people make confused facial expressions when they find out I write all my programs in Object Pascal?
>>
>>52284856
Fair enough I guess, but why not c++?
>>
>>52284881
Yeah, I can definitely agree with that. I just think that NIH or IH, taken to either extreme is irrational.
>>
>>52284884
Because it sounds ancient, and IS ancient.
It's literally older than C.

>>52284893
I don't like the way idiomatic C++ looks, and I would just be writing C with classes if I was ever forced to write C++.
>>
>>52284971
>It's literally older than C.
It's also better than C. Why aren't you using it?
>>
>>52284988
>delphi
>>
>>52284988
>It's also better than C. Why aren't you using it?

https://www.youtube.com/watch?v=H47ow4_Cmk0
>>
File: 1450586383158-1.jpg (326 KB, 999x1446) Image search: [Google]
1450586383158-1.jpg
326 KB, 999x1446
>>52284856
>Still using C when python and Rust exist.
>>
File: 1448473404155.jpg (114 KB, 720x960) Image search: [Google]
1448473404155.jpg
114 KB, 720x960
>>52285060
>python and Rust
>>
>>52285018
>My reaction to the fact that Sony is making an Emoji film.
>Sony is making an Emoji film.
>an Emoji film.
>>
>>52284810
>Not importing C# 6.0 manually
>Not writing DLLs (managed or unmanaged) outside of Unity
>Not using the ability to include other CLI languages (looking at you F#) in Unity
It's like you can't think outside of a box; you're told what it is and take it for granted.
>>
>>52284884
It's the "Pascal" part, although it's the equivalent of hearing "C#" and thinking it's ancient because "C" is in the name.
>>
File: 1450602857371.png (234 KB, 373x373) Image search: [Google]
1450602857371.png
234 KB, 373x373
>>52285150
>Using a language thats older than my mom and thats still the cause of many bugs
>Not loving nice concise readable code.
>>
Anyone have experience with IDA pro?

How do I use this properly to reverse engineer?
>>
>>52284589
>>52284704
Most languages have a function to search the string for a char e.g. find in C++.
>>
>>52285223
>programs written in <insert favourite meme language> have never had any bugs
>>
>>52284971
You're right, c++ can be ugly at times.
>>
How would I go about implementing strstr?
i'm thinking doing something like
unsigned len_h = strlen(haystack);
unsigned len_n = strlen(needle);
unsigned i, j;
for (i = 0; i < len_h; i++)
{
unsigned k = 0;
for (j = 0; j < len_n; i++)
{
if (haystack[i + j] == needle[j])
k++;
}
if (k == len_h)
return i;
}

return NULL;
>>
File: pikcha_20130624_2369.jpg (49 KB, 680x680) Image search: [Google]
pikcha_20130624_2369.jpg
49 KB, 680x680
>>52285223
>python and rust
>readable code
>>
>>52285270
Please name a major security bug that was in <insert favourite meme language>. I'll wait

Please name a <insert favourite meme language> with undefined behaviour that no one can actually agree on how to solve and changes based on the complier. I'll wait

>>52285318
>Not understanding the beauty and flexability of python.
You're just delusional and don't know elegant code when you see it. Only language that might be able to compete with python is Haskell.

Rust isn't as elegant as my waifu python,but its fast enough for everything else I need and has its own grace about it.
>>
>>52284864
realflow but its not so /dpt/
>>
File: memes.jpg (46 KB, 695x431) Image search: [Google]
memes.jpg
46 KB, 695x431
>>52285416
>Only language that might be able to compete with python is Haskell.

That's true, but not in the sense you mean it.
>>
>>52285467
Go on
>>
What's a good javascript editor?

I would especially like a hotkey to automatically indent, like eclipse does.
>>
>>52285504
notepad.exe
>>
File: wwww.png (145 KB, 1341x666) Image search: [Google]
wwww.png
145 KB, 1341x666
REEEEEEEEEEEE

I can't decide which symbol to use for external threads.
>>
>>52285416
>Java
https://tomcat.apache.org/security-7.html
>>
>>52285524
(Inter-board)
>>
>>52285524
>1000x1
Kek, just realised I cut my file text too short.
>>
>>52285486
both are shit
>>
File: gvo.png (124 KB, 716x536) Image search: [Google]
gvo.png
124 KB, 716x536
>>52285541
I dunno senpai, it doesn't look very neat.
>>
>>52285524
>>=
>>
>>52285601
>>52285524
How about always /board letter/XXXXXXXX
>>
>>52285639
How would they know which thread it is?
>>
>>52285312
At the very least you implement:
https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm
>>
File: uh.png (89 KB, 682x332) Image search: [Google]
uh.png
89 KB, 682x332
>>52285639
Maybe, but there's still something triggering about it.
>>
>>52285601
>>52285524
Some sort of arrow? E.g. arrow character pointing to the right and up symbolising different thread.
>>
>>52285715
↰
>>
>>52285312
#define OUT 0
#define IN 1

const char *my_strstr(const char *haystack, const char *needle)
{
int state = OUT;

for (const char *ptr = needle, *start; *haystack != '\0'; ++haystack) {
if (state == OUT) {
if (*haystack == *ptr) {
start = haystack;
++ptr;
state = IN;
}
} else {
if (*ptr == '\0')
return start;

if (*haystack != *ptr++) {
ptr = needle;
state = OUT;
}
}
}

return NULL;
}
>>
>>52285679
Honestly I don't understand a bit of that.
How does mine look, senpai?
char *locate(const char *haystack, const char *needle)
{
unsigned len_h = strlen(haystack);
unsigned len_n = strlen(needle);
unsigned i, j;
for (i = 0; i < len_h; i++)
{
unsigned matches = 0;
for (j = 0; j < len_n; j++)
{
if (i + len_n <= len_h) /* bounds checking */
{
if (haystack[i+j] == needle[j])
matches++;
}
}
if (matches == len_n)
return (char *) haystack + i; /* return match location */
}
return NULL;
}
>>
>>52285312
char *strstr(char *haystack, char *needle){
while(*haystack){
int i = 0;
while(needle[i]==haystack[i]&&needle[i]&&haystack[i])
i++;
if(needle[i]==0)
return haystack;
haystack++;
}
return NULL;
}
>>
need to implement a system to view statistics about shit from DB
i was thinking of creating a Query table where you can insert a query string and a name for the query if you're a sysadmin and then let users execute a query of their choice from a drop down list or something
i know it sounds hacky as fuck but i honestly dont have a better idea
>>
>>52285312
no need to get the length, you know that a char* has to be null terminated, so you could some this and save yourself the trouble
const char* strstr1(char* str1, char* str2)
{
int trig = 0;
char* start = nullptr;
int match = 0;
for(int i = 0; str1[i] != '\0' && str2[trig] != '\0'; ++i)
{
match = (str1[i] == str2[trig]);
if (match && !trig)
{
trig = 1;
start = (str1 + i);
}
else if (match && trig)
{
++trig;
}
else if (!match)
{
trig = 0;
start = nullptr;
}
}
return start;
}
>>
>>52285750
>How does mine look, senpai?
It looks quite quadratic...

But in terms of the implementation of the naive string search, that bounds check is pretty silly to have inside the inner loop, i, len_n and len_h are all constants wrt to the loop, so you could determine that up front.
>>
>>52285749
Wait, nevermind.
I realised that my algorithm is shit. It fails on my_strstr("abcabcd", "abcd");
>>
>>52285816
If I don't bounds check, i + len_n have the possibility of being greater than the length of the haystack and it will walk off the array and try to match things outside of the string and introduce undefined behavior.
>>
>>52285773
Condensed my while into a for and got rid of a seemingly unneeded null check. Seeing as how if haystack[i] equals NULL and needle[i] doesn't then the loop will terminate regardless.

const char *strstr(const char *haystack, const char *needle){
for(int i = 0;*haystack;i=0,haystack++){
while(needle[i]==haystack[i]&&needle[i])
i++;
if(needle[i]==0)
return haystack;
}
return NULL;
}
>>
>>52285836
Yes, but it doesn't have to be inside the j loop, in *that* loop all the numbers you're checking are fixed, so no need to check it over and over, do it once before you enter the loop.
>>
>>52285816
Rate mine >>52285897
>>
>>52283661
Neglible difference since I/O is always slow and std::printf() is more conenient to use than std::cout overloads.
>>
>>52285950
What if strlen(needle) > strlen(haystack)?
>>
>>52286039
Then needle[i] != haystack[i] would it?
>>
>>52286039
>>52286061
I should mention reason their has to be a NULL check at all is because if two identical strings are compared it'll overflow without a null check. Doesn't matter which one you check so long as you're checking.
>>
>>52286061
Yes, but what happens on next iteration of the outer loop?
if(needle[i]==0) will be false (still more needle to go).
>>
File: mark.jpg (14 KB, 270x271) Image search: [Google]
mark.jpg
14 KB, 270x271
>hear python is supposed to be more readable because it uses whitespace to delineate statements / scopes etc. rather than brackets
>fair enough
>open an example program and it's just like
import library
append
but do then
7 "faggots"
var
if
doesn't 0 what

Did I get memed?
>>
File: musthavepizza.webm (1 MB, 720x404) Image search: [Google]
musthavepizza.webm
1 MB, 720x404
>>52284856
Because C is a dead language.
>>
>>52286171
>will be false
As it should be. i gets reset every iteration and eventually *haystack will point to the null character terminating the loop and returning a NULL pointer.
>>
>>52286194
>Did I get memed?
you are very stupid that is for certain.

it is possible you got memed as well, but it's hard to tell because of how stupid you are.
>>
>>52286215
I must be confused here

That can't possibly be ketchup on a pizza, can it?
>>
>>52286194
python isn't particularly readable compared to other C-derived languages it's just a retarded meme
>>
>>52286231
that's yanks for you
>>
>>52286231
i think it's hilarious that USA is an actual country with real people living in it and doing the things they do
>>
File: sotd.png (294 KB, 639x594) Image search: [Google]
sotd.png
294 KB, 639x594
>>52286231
>doesn't put curry ketchup on his pizzas
>>
>>52286221
>*haystack will point to the null character terminating the loop and returning a NULL pointer.
haystack only gets incremented in the outer loop.
Lets be concrete:

needle = "aaaaaa"
haystack = "aaa"

after one iteration of the for loop:

i = 3
haystack points to second a
now the while loop begins again
haystack[i] will no longer be the null byte since it's effectively haystack[4] we're looking at (i=3 with haystack+1) and you're beginning to access garbage.
>>
>>52286241
>>52286256
Jesus Christ

I think I'm gonna be sick
>>
>>52286268
>curry ketchup
>>52285183
>>
>>52286284
think he means brown sauce lad, he just doesn't have the word
>>
>>52286215
>C is a dead language

????
>>
>>52286300
https://en.wikipedia.org/wiki/Curry_ketchup
>>
>>52286314
Euros sure do love their big sausages
>>
>>52286275
>>52286171

why do people get a hardon for pointer arithmetic?
it just creates more problems than it solves
no need for pointer arithmetic unless you're indiscriminately processing the contents of an array
>>
Integer division is simply dividing once and then discarding the remainder, right?
>>
>>52286328
and murriburgers love their big sausage pizza
>>
>>52286275
How many times do I have to say it? i gets reset to zero every iteration of the for loop.

>>52286333
That's no overflow, pointers are fine.
>>
>>52286356
>i gets reset to zero every iteration of the for loop.
Where?
>>
>>52286231
>not putting ketchup on your pizza
I do this all the time, at least with frozen pizza I buy in the store. They taste quite dull and ketchup spice up their flavour.
>>
>buying frozen pizza
i don't get it
if you want to eat cheap shitty food then just cook some real food
>>
>>52286333
>no need for pointer arithmetic unless you're indiscriminately processing the contents of an array
void iterate(const char* from, const char* to)
{
for ( ; from != to; ++from)
{
// stuff
}
}
>>
>>52286374

See >>52285897
const char *strstr(const char *haystack, const char *needle){
for(int i = 0;*haystack;i=0,haystack++){
while(needle[i]==haystack[i]&&needle[i])
i++;
if(needle[i]==0)
return haystack;
}
return NULL;
}


for(int i = 0;*haystack;i=0,haystack++)


i=0
>>
>>52286387
>if you want to eat cheap shitty food then just cook some real food
I don't have time for that mang, I work until late and I'm only at home to wash clothes, shower, eat and sleep.
>>
>>52286387
i only have a micro wave for kitchen
>>
>>52286395
>I CANNOT USE VARIABLES FOR ANY REASON BECAUSE THEY ARE BLOAT!!

C programmers, everyone
>>
>>52286410
What the fuck are you talking about? What do you think from and to are?

>inb4 pointers aren't variables
But they are.
Thread replies: 255
Thread images: 33

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.