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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 324
Thread images: 27

File: 1482341897934.png (389KB, 934x1000px) Image search: [Google]
1482341897934.png
389KB, 934x1000px
What are you working on, /g/?

Old thread: >>58129408
Functional programming thread: >>58105321
>>
>>58137164

i dont know why i would change to OOP. I just wrote a CRUD app, and just for fun i want to rewrite it but using OOP. Not seeing the point though
>>
File: good.jpg (78KB, 1280x720px) Image search: [Google]
good.jpg
78KB, 1280x720px
>>58137159
Working on recursive file/directory fuzzy search in racket as first step for something greaterl

Also please use maki image next time.

Thanks!
>>
>>58137159
>Functional programming thread: >>58105321

please do not legitimize these bastards by mentioning them here
>>
functional programming thread: http://www.welfareinfo.org
>>
Rust is love.
>>
>>58137148
what would the advantage of using functional programming against a DB vs OOP? I feel like OOP would be a better choice here since the object models can match the database model.
>>
File: Morse-Thue_sequence.gif (46KB, 318x57px) Image search: [Google]
Morse-Thue_sequence.gif
46KB, 318x57px
Write a function to generate the nth iteration of this process.

>> f(0)
[0]

>> f(1)
[0, 1]

>> f(4)
[0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0]
>>
>>58137378
f(4) should be 0, 1, 1, 0 ya dingus
>>
>>58137410
wew lad, are you sure thats not f(2)
>>
>>58137229
Maki is slut.
>>
>>58137422
ye mb
>>
>>58137423
maki is our best girl and you know it. If you dont you are in denial.

Also any better or more idomatic way to trim last "/" if file path than

(define (trim-last str [delim "/"])
(define (get-last str)
(string-ref str (sub1 (string-length str))))
(if (equal? (string (get-last str)) delim)
(substring str 0 (sub1 (string-length str)))
str))
>>
>>58137449
Who are "we" who claim her to be "our"?
>>
>>58137423

shit taste sempai
>>
What's the best resources for learning common lisp?

I know OOP and a good chunk of Haskell. I also have insight into language design and constructs.
>>
>>58137565

>>58108063
>>
>>58137533
We as in /g without you and some other delusional faggots.
>>
>>58137596
Man sorry for being "that guy" with the same question as a million others.

I settled for learn Lisp the hard way.
>>
>>58137645
Oh well.
We (we as in /g without you and some other delusional faggots.)all know that Maki is slut.
Keep delusioning.
>>
>>58137674
I'd actually recommend going for racket instead of common lisp, you dont need book there is good tutorial on site and documentation is geat. drracket is fine ide and you can easily set up cider or slime for emacs. You get great stdlib and even gui stuff.

>>58137687
Whatever helps you sleep matey
>>
Do I need to do another thing before calling

ExtractableObject extracted = (ExtractableObject) Class.forName(objectName).newInstance();
?

I constantly get ClassNotFoundExceptions, despite having a class called objectName.
>>
>>58137707
Why not just use ungodly factory pattern?
>>
>>58137674
Don't worry, dude, I didn't mean anything. I just saw a similar question, and thought if you could find responces to that post useful.
>>
>>58137724

Good idea too.
But how about this method? Do I need do add something in advance?
>>
how do i select a columns data based on another field from that table AND another field in a different table if they match? this is what i have...not working tho

SELECT [part-gif] FROM ItemDescription INNER JOIN ReplacementOrders ON ItemDescription.[part-gif]=ReplacementOrders.[ItemNumber];
>>
>>58137724
:D you mean the AbstractBaseFactoryFactoryBuilder interface?!?! :D
>>
File: 562.jpg (67KB, 600x600px) Image search: [Google]
562.jpg
67KB, 600x600px
Why do we have two different threads going
>>
>>58137724

isnt it a huge drawback of the factory pattern that you have to edit your "factory class" each time you add a new class?
>>
File: pajeet_tier_fibonacci.png (21KB, 606x354px) Image search: [Google]
pajeet_tier_fibonacci.png
21KB, 606x354px
>>58137724
>>
File: 1471520802412.jpg (29KB, 476x543px) Image search: [Google]
1471520802412.jpg
29KB, 476x543px
>>58137423
you take that back right now
>>
>>58137378
def foo(x : int):
ret = [0]
for _ in range(x):
for val in ret[::]:
ret.append(int(val != 1))
return ret

ez

I would do it in c++, but I don't have a compiler in front of me.
>>
>>58138024
Thats what im talking about, but more descriptive and more enterprise grade it lacks something like so you can understand it better FibonacciDataViewConstants.CUSTOM_NULL_VALUE
>>
>>58137378
f 0 = [0]
f n = ((++) <*> map notb) $ f (n - 1)
notb 0 = 1
notb 1 = 0
>>
>>58138024
No visitor pattern. > Fail
>>
Is the guy who was trying to crack that .NET trial software still here? I think I know the solution to your IntPtr problems.
>>
>>58137159

In C++ I want to have basically a purely syntactic function that is equivalent to copying and pasting

It needs access to the variables within main without passing them all as args

what do I use
>>
Can anyone post the programming challenge pic?
>>
>>58138309
>It needs access to the variables within main without passing them all as args
That's called a "closure", and C++11 finally has them \o/

http://www.cprogramming.com/c++11/c++11-lambda-closures.html
https://en.wikipedia.org/wiki/C%2B%2B11#Lambda_functions_and_expressions
>>
>>58138340
http://adventofcode.com/
>>
Fellow contrarians,
why are exceptions a bad thing?
>>
>>58138309
macro
>>
>>58138395
>Fellow contrarians,
>why are exceptions a bad thing?
They aren't.
>>
>Good programmer
>Not really interested on working on anything
>Used to do vidya but got absolutely bored of it
>Hate web stuff

What should I make/contribute to?
>>
>>58137378
f[n_] := ThueMorse ~Map~ Range[0, 2^n - 1]

:^)

Nest[Join[#, # ~ReplaceAll~ {0 -> 1, 1 -> 0}] &, {0}, n]

Also works.
>>
who here calls queries through the command line to display thousands and thousands of lines of data so you look cool to co-workers walking by and noticing your screen?
>>
>>58138486
|less
>>
Holly shit, Rust takes ages to compile. Go has spoiled me.
>>
>>58138519
Good programmers only compile once a day maybe.
Just write correct code all day, and compile to test it before you go home.
>>
>>58138612
I'm installing basic tooling and dependencies. Need to wait a while to even get work started.
>>
>tfw did a test as part of an interview for a javascript/typescript developer and I didn't pass because "Text-only for a front-end position? Really?"
I might be wrong, but front-end developers are the ones who should be mostly focused on programming, leaving the design to the designers and the user experience to the UX crew.
What the hell were they expecting from me?
>>
>>58137159

Is doing an overload like this safe in C++?
enum State : uint8_t
{/*...*/};

enum Delta : int8_t
{/*...*/};

inline State operator+(State st, Delta d)
{
return static_cast<State> (static_cast<int8_t> (st) + static_cast<int8_t> (d));
}


I'm not very familiar with casting rules and promotions, etc. so I would appreciate it if simpler explanations are used.
>>
>>58138647
>the design to the designers and the user experience to the UX crew
pretty sure that's the front-end

also
>>>/wdg/
>>
>>58138518

u wot m8?
>>
>>58138056
why are you using
for val in ret[::]:

instead of
for val in ret:


?

what's the difference?

python noob here
>>
>>58138689
less is a linux comand
>>
>>58138682
For various reasons I rarely see it in the catalog recently.
>>
>>58138689
less does more than more, but less than most
>>
Does anyone here actually use design patterns on a day-to-day basis?
>>
>>58138738
less is more, though
>>
>>58138693
for val in ret[::]

returns a copy of ret
for val in ret

returns ret as it exists in the code.

Meaning for the second one, it'll just fill ret with repeating patterns of 0,1,0,1,0,1... because it keeps looping over the appended data.

If I wanted to speed it up, I would change it to a for loop over a range with a max on2**_ (or just set another variable like i=1 and multiply it by 2 every time we loop over the first range)
>>
File: 2016-12-23 12-27-42.webm (510KB, 800x600px) Image search: [Google]
2016-12-23 12-27-42.webm
510KB, 800x600px
>>58138051
Bumping because other thread is dead.
Pic related is what I'm getting now. The white square is the hitbox.
>>
>>58138758
The skull is rotating slower than it's moving. pls fix
>>
>>58138754
interesting

thanks

i ran your code with
for val in ret


and it never ended
>>
File: file.png (13KB, 739x416px) Image search: [Google]
file.png
13KB, 739x416px
I'm attempting to simulate a spinning conducting frame with AC running through it in a magnetic field and for some inexplicable reason the Runge Kutta method and the Euler method yield ridiculous values at any step-size that is either more than 1 or less than 0.1. The graph attached is the kind of craze the code producez at values outside the 0.1 to 1 interval, the graph is a sine with decreasing amplitude otherwise. I'm using C to code this and I've defined every variable as double. Any clue what could be causing this?
>>
>>58138133
notb = (1 -)
>>
>>58138839
nice
>>
>>58138784
That's not really the issue here.
>>
>>58138823
Those numerical schemes have a region of stability, it's not as simple as them working absolutely better for small step sizes.

I'm guessing you're solving a form of Maxwell's equations?
>>
>>58138882
I don't care. If you're going to do something, do it right

tau = 2 * pi
circumference = tau * r
rotation = distance / circumference

Fix it or I won't even look at your code
>>
>>58138839
>>58138870
Epic microprettification my fellow Haskellbros
>>
>>58137750
Thanks man. Much appreciated.

>>58137702
Thing is, I want common Lisp in all of it's multi paradigm and unaltered glory before I go into dialects.
>>
File: file.png (4KB, 518x47px) Image search: [Google]
file.png
4KB, 518x47px
>>58138887
Mine is a differential equation made up of Newton's second law, Faraday's law and Ohm's law. Could it really be just that the 1 to 0.1 interval is the region of stability? I figured something as straightforward as Euler's method is applicable in every case.
>>
Need a project that should take around 4-6 hours to complete
>>
>>58139158
fizzbuzz
>>
>>58139167
pls anon
>>
>>58139088
I'll tell you in a few months after I've taken numerical analysis.
>>
>>58139167
>>58139181
fizzbuzz on the language you don't know
>>
>>58139184
I figure I'll figure out Python and redo the project in there sooner than that. Is that a good plan?
>>
>>58139158
FUSE implementation of RedSeaFS

http://www.templeos.org/Wb/Doc/RedSea.html
https://en.wikipedia.org/wiki/Filesystem_in_Userspace

Christmas present for Terry so he can mount RedSea volumes with GNU+Linux
>>
I'm making a twitter bot in python that posts state based cellular automata gifs regularly.

the core is this thing
for iteration in range(iterations_until_done):
for y in range(size):
for x in range(size):
temperature = 0
for j in range(0,3):
for i in range(0,3):
if (j == 1 and i == 1):
a = 1
else:
x_check = (size + x + i - 1)%size
y_check = (size + y + j - 1)%size
if canvas[y_check][x_check] > canvas[y][x]:
temperature = temperature + 1
canvas_2[y][x] = formula[canvas[y][x]][temperature] #here


so the cell gets a new state depending on its current state (canvas[y][x]) and kinda its amount of neighbors (temperature).

a ruleset looks like this
[[2, 0, 0, 0, 0, 2, 0, 1, 5],
[3, 0, 0, 1, 0, 0, 0, 0, 1],
[0, 0, 0, 2, 0, 1, 0, 0, 0],
[2, 0, 0, 0, 0, 0, 0, 0, 0],
[4, 0, 0, 0, 0, 2, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 1, 2]]

so Y is current state and x is new state. so for example an cell with the state of 0 with no neighbours is converted to a 2.

Pic related is a processing app for exploring and mutating rulesets.
>>
>>58139207
Yeah probably. By the way what are the initial conditions and parameter values you're using for >>58139088 ?
>>
>>58138738
no it does more than most or i'd use most :/
>>
>>58139237

is this python 2 or python 3?

why are you putting range(0,3) in your for loops j and i, if range(3) is the same thing?
>>
>>58139209
>files cannot grow in size
lolwut
>>
>>58139237
wtf are you doing man
why are you doing a 5 levels loop
>>
File: output.gif (752KB, 400x400px) Image search: [Google]
output.gif
752KB, 400x400px
>>58139277
python 2. got conned by that website into thinking python 3 was bad and too lazy to switch now.

>why are you putting range(0,3) in your for loops j and i, if range(3) is the same thing?
honestly i dont know
>>
>>58139242
I'm setting both derivatives of phi to zero and phi to Pi/2, the main loop then figures out the initial value of the angular acceleration - the second derivative of phi over time - and from then on I plug all the values into my Runge-Kutta functions to get the value for the next step:
double Caf(double t,double cav,double caf,double caa)
{
return (-1)*(caa+comega*comega*cos(ACF*t)*sin(cav))/(comega*comega*ctau*sin(cav)*sin(cav));
}

double Caa(double t,double cav,double caf,double caa)
{
return (-1)*comega*comega*sin(cav)*(cos(ACF*t)+ctau*sin(cav)*caf);
}

double RK(double rkdt)
{
k11=rkdt*caf;
k12=rkdt*caa;

k21=rkdt*Caf(t+0.5*rkdt,cav+0.5*k11,caf+0.5*k12,caa);
k22=rkdt*Caa(t+0.5*rkdt,cav+0.5*k11,caf+0.5*k12,caa);

k31=rkdt*Caf(t+0.5*rkdt,cav+0.5*k21,caf+0.5*k22,caa);
k32=rkdt*Caa(t+0.5*rkdt,cav+0.5*k21,caf+0.5*k22,caa);

k42=rkdt*Caa(t+rkdt,cav+k31,caf+k32,caa);
k41=rkdt*Caf(t+rkdt,cav+k31,caf+k32,caa);

rkcaf=caf+(k12+2*k22+2*k32+k42)/6;
rkcav=cav+rkcaf*rkdt;

return 0;
}

while(!kbhit())
{
caa=Caa(t,cav,caf,caa);

RK(dt);
cav=rkcav;
caf=rkcaf;

#include "display.c"
#include "file.c"

t=t+dt;
//StepSelect(errtgt);
}


The project is due this monday, but, seeing what a mess this is, I'm seriously considering learning Python starting from scratch
>>
I like Erik Meijer because he's one of the most down to earth, pragmatical and least smug people in the FP community.
>>
File: automata4_010.png (97KB, 1284x873px) Image search: [Google]
automata4_010.png
97KB, 1284x873px
>>58139237
whoops, here's an image of the explorer.

>>58139294
i just wrote it in the same way i thought it out. "for every cell, check the eight cells surrounding it".
is there a better way that isn't eight ifs?
>>
>>58139325
>I'm setting both derivatives of phi to zero and phi to Pi/2
Huh? You mean you're setting phi''(0) = phi'(0) = 0, phi(0) = pi / 2?

The omegas and tau are just constants, right? There should only be two initial conditions. You don't specify the value of phi''(0).
>>
>>58139371
i don't know, going too far in loops seems bad to me
>is there a better way that isn't eight ifs?
to map ifs you use something like a dictionary with statements and throw and eval or exec in there
>>
>>58139312
>python 2
then you can use xrange instead of range, because its faster
>>
>>58139419
that would be slower. nothing wrong with unrolling your ifs
>>
>>58139459
>that would be slower
no cause you do away with the logic, you don't even iterate, you simply call the input as key, if you wanna be safe you encapsulate in a try
>>
>>58139504
>and throw and eval or exec in there
unless i misunderstood you
>>
>>58139537
oh sorry, didn't know it slowed stuff
>>
any SQL guru's here? I've selected an "imagePath" field between 2 tables based on matching "itemNumbers" but i also need to match them based on "orderNumber" but there's only an "orderNumber" field in one of the tables. I want to select the "imagePath" based on the "orderNumber" but each "orderNumber" also has an "itemNumber" and each "itemNumber" has it's own "imagePath" that i need. Does this make sense?
>>
>>58139419
>i don't know, going too far in loops seems bad to me
me too, but i need at least three of those. the other two i agree are pretty lazy.
>to map ifs you use something like a dictionary with statements and throw and eval or exec in there
oh! will play around with this to try it out, even if >>58139537 says it slows things.

>>58139444
ah, thank you
>>
>>58139611
SELECT imagePath FROM yourMom LEFT JOIN herPornCareer ON yourMom.itemNumber = herPornCareer.itemNumber WHERE noWhatYouSaidDoesntMakeSense = maybeYouNeedASubSelect
>>
>>58138758
Anyone?
>>
>>58139611
>sql
>>>/wdg/

There's no use for sql in programming. Sorry.
>>
>>58139863
SQL isn't web-exclusive language.
>>
>>58139884
btw you probably don't need a subselect, just the WHERE claws
>>
>>58139884
>There's no use for sql in programming
disprove this
>>
File: image.png (114KB, 1680x1050px) Image search: [Google]
image.png
114KB, 1680x1050px
>>58137159
>What are you working on, /g/?

Exploring the deepest, darkest corners of Racket by doing Advent of Code 2016.
>>
>>58139940
databases exist.
bosses exist.
proven.
>>
>>58139962
great color scheme
>>
File: 1482276597832.jpg (72KB, 500x449px) Image search: [Google]
1482276597832.jpg
72KB, 500x449px
So I can't say I'm a particularly talented programmer.
I pretty much just did my work at college. It was a tough school.
When I was in projects, I usually lagged behind because I was
almost always struggling, or just completely
unable to motivate myself to really work. I regret the way I was to be honest,
but I really went beyond what I expected of myself before I went into college.

Now I'm graduated, and I've yet to have a full time. I've been considering freelancing
or contracting since I don't like the idea of being tied down to a company.
Not that I'd hate it, but I like the idea of working for myself more.
I realize the downsides, and I'm probably going to want to get a normal job just
for professional programming experience before I decide to go on my own.

I like the idea of working for myself, and on my own time, but I'm not sure how
I'd really "set up shop" so to speak. Has anyone else had this experience?
I have no real professional experience, and the idea of going into business with
my programming is hard to imagine.
>>
>>58140036
Yes. I've had that experience.

My honest advice, son:

Just fucking get a cube job and go eat sushi for lunch.

Working for yourself isn't worth it, especially w/ motivation issues.
>>
>>58139962
Been doing Advent of Code too
It's pretty good as far as programming challenges go, I like the way the second parts of the questions affect my brainstem.

That's a very nice looking setup you have there.
>>
>>58140036
Work regular jobs for a while to realize how badly successful software can be written
It's amazing how REALLY terrible PHP spaghetti code can generate 6 figure profits, lol
Also this will teach you that management is not all unimportant
>>
>>58140062
Why would I eat sushi?
I like it, but are you implying I'm some weeb?
>>
Python bab here, what's a good GUI toolkit to go about using?
>>
Adding to an empty list causes an NullPointerException.

So I have to check each time whether the list is empty? All 50.000 times my program will be adding an element?

Thats retardation. Whats a way of working around that?
>>
File: 1435433811218.png (19KB, 571x448px) Image search: [Google]
1435433811218.png
19KB, 571x448px
>>58140062
>w/ motivation issues
I have those, so much, it depresses me

Months ago I discovered an exploit in a piece of hardware. Crude proof of concept working. Motivation dropped to ZERO.

I don't know why I can't just polish the code, write a blog article and be done with it. Like it's repelling me

I just start a new project instead and I know once it basically works, I drop it like a hot potato

In the past I have ruined great opportunities with that behavior. As soon as I figure out the core problem, all motivation is gone
>>
File: 1452347724883.png (1MB, 3840x2160px) Image search: [Google]
1452347724883.png
1MB, 3840x2160px
>>58138340
>>
File: weebs.jpg (40KB, 300x406px) Image search: [Google]
weebs.jpg
40KB, 300x406px
>>58140091
>>
>>58140116
Tk
>>
>>58140127
Roll
>>
>>58140123
Have you considered religion?
>>
>>58140127
rolls royce
>>
>>58140190
I smoke DMT sometimes to talk to aliens
>>
>>58140127
https://www.random.org/

Use this shit instead of cluttering the thread with "roll" posts
>>
File: files.jpg (19KB, 644x111px) Image search: [Google]
files.jpg
19KB, 644x111px
I'm new to C++, and GCC.
I'm reading Accelerated C++, and make a program with the following files. program.cpp is the one that contains main.

How do I compile this?
/mnt/more/programming/accelcpp/exercise4$ g++ program.cpp
/tmp/ccK7RiEE.o: In function `main':
program.cpp:(.text+0x4e): undefined reference to `read(std::istream&, Student_info&)'
program.cpp:(.text+0xe1): undefined reference to `compare(Student_info const&, Student_info const&)'
program.cpp:(.text+0x1e8): undefined reference to `grade(Student_info const&)'
collect2: error: ld returned 1 exit status
/mnt/more/programming/accelcpp/exercise4$


I'm assuming that I need to include the other files when I do the compilation, how should I do that?
Also, should I learn how to use C++ first, then read the GCC documentation or read them together?
>>
>>58140172
I'll make it in Haskell.
>>
>>58140216
Sure you will champ
>>
>>58140091
>Why would I eat sushi?
because there's no other fucking restaurants around in this fucking place

like 5 goddamn sushi restaurants in a 1 block radius from where I live. And all of them are closed on Mondays.
>>
>>58137159
Writing a GUI for my meme chat software that utilizes UDP (hence the meme) in fucking Java :(
>>
>>58140120

help me, please.

this should be a common noob issue.
>>
>>58140247
from where I work*
>>
>>58140253
If you get NullPtrException, you probably didn't initialize your list.
>>
>>58140282

I initialized it, with null:

private List <ExtractableObject> database = null;
>>
>>58139863
>>58139940
SQL is probably the single most useful skill to have in any development job.

Also directly from wikipedia:
>SQL is a special-purpose domain-specific language USED IN PROGRAMMING
>>
File: 14413923049350-2.jpg (79KB, 662x720px) Image search: [Google]
14413923049350-2.jpg
79KB, 662x720px
>>58140296
Oh, you did.
And what kind of pointer points to null?
>>
>>58139863

biggest retard ive seen on /dpt/ yet
>>
>>58140120
>>58140296
"null" is not an empty list.
>>
>>58140333
real hardcore programmers only write fizzbuzz in c or haskell
>>
>>58140296
initialize it with
new List<ExtractableObject>();


null and an empty list are two different things.
>>
I really struggle with procrastination, it hurts me knowing how much time I wasted masturbating and browsing 4chan instead of reading and practising.
I even have SICP right next to me.
>>
>>58140262
Well, I'm sorry to hear that.
Perhaps bring a lunch.
>>
>>58140340
Let me browse 4chan and masturbate instead of you, so you'll have free time reading SICP.
>>
>>58140318
>>58140333
There is L I T E R A L L Y no use for ShitQL other than making dumb ass shitr.io websites for some startup's Ruby on Rails project.

Prove this wrong.
>>
>>58140333
>>58140339

thanks, this helped

>>58140323

i have often seen objects being initialized to null. adopted this behaviour, even if i see no purpose.
>>
>>58140365
>t. never worked for life
>>
>>58140361
well thank you that would solve everything man
>>
>>58140365

>It’s no surprise SQL (pronounced ‘sequel’) tops the job list since it can be found far and wide in various flavors. Database technologies such as MySQL, PostgreSQL and Microsoft SQL Server power big businesses, small businesses, hospitals, banks, universities. Indeed, just about every computer and person with access to technology eventually touches something SQL. For instance, all Android phones and iPhones have access to a SQL database called SQLite and many mobile apps developed Google, Skype and DropBox use it directly.

http://www.codingdojo.com/blog/9-most-in-demand-programming-languages-of-2016/

BTFO. Now go away.
>>
>>58140391
And the only thing they use it for is web development.

>>>/wdg/
>>
>>58140391

now the NEET will tell you how the opinions of high-tech businesses are irrelevant and only HIS obscure memelanguages (preferably haskell or lisp) are useful, even though he never got a project with them.
>>
>>58140401

You obviously didn't even read the quote

Seriously, go away. Forever.
>>
File: 1421139415594.jpg (112KB, 1358x765px) Image search: [Google]
1421139415594.jpg
112KB, 1358x765px
/g/ cool kids club checklist

[x] hate OOP
[x] hate IDEs
[x] use only Haskell
[x] never produce actually useful software (this is important)
[x] wear knee socks
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] hate popular Linux distributions (because too intelligent for them)
>>
>>58140437
>big businesses, small businesses, hospitals, banks, universities
literally the only thing they would use sql is web development
>>>/wdg/
>>
>>58140441
[ ] hate OOP
[ ] hate IDEs
[ ] use only Haskell
[x] never produce actually useful software (this is important)
[ ] wear knee socks
[ ] tiling window manager
[x] dark-like-my-soul customized colors
[ ] hate popular Linux distributions (because too intelligent for them)

do i not belong here
>>
>>58138411
They are though. Only Golang does error handling correctly.
>>
File: CLgm1XqVEAAQRzT.jpg:large.jpg (80KB, 1023x682px) Image search: [Google]
CLgm1XqVEAAQRzT.jpg:large.jpg
80KB, 1023x682px
>>58140441
>tfw i don't apply to any despite being a long time lurker since first /dpt/ back in 2001
>>
>>58140441
>[] hate OOP
>[] hate IDEs
>[] use only Haskell
>[x] never produce actually useful software (this is important)
>[] wear knee socks
>[] tiling window manager
>[] dark-like-my-soul customized colors
>[] hate popular Linux distributions (because too intelligent for them)
>actually, I am too normie for Linux and use Windows/Mac
>>
>>58140441
[x] hate OOP
[x] hate IDEs
[ ] use only Haskell
[x] never produce actually useful software (this is important)
[ ] wear knee socks
[ ] tiling window manager
[ ] dark-like-my-soul customized colors
[ ] hate popular Linux distributions (because too intelligent for them)
>>
>>58140441

>don't hate OOP, but i don't know how to use it (yet)
>don't hate IDE's, but prefer something lightweight
>never used HaskLEL
>one of my projects was actually useful to a company
>no i wear nike footies
>if someone only has 1 monitor, i can see this being really useful
>i like the dark theme on VS but that's about it
>love Ubuntu and Debian
>>
>>58140481
>2001
correction: 2011
>>
>>58137224
convenience? also looks better
>>
>>58140484
>>58140483
>[x] never produce actually useful software
Congratulations, you're in the club
>>
i want to learn some easy programming
where do i start and which programming language is the easiest to learn?
>>
>>58140441
hate oop
hate ides
hate all linux distributions so i guess that counts
>>
>>58140511
code.org
>>
>>58140511

start with C and in 5 years you'll thank me
>>
>>58140489
>>don't hate OOP, but i don't know how to use it (yet)
Well whatever you do, just know that if you're going to learn OOP from C++, then you might as well hate it blindly.

OOP using Python is a pretty good source on how to OOP.
>>
>>58140441
[/] hate OOP - a few cases where it's nice, but only a few
[x] hate IDEs
[ ] use only Haskell
[x] never produce actually useful software (this is important)
[ ] wear knee socks
[x] tiling window manager
[x] dark-like-my-soul customized colors
[x] hate popular Linux distributions (because too intelligent for them)

i would submit sneakers as a substitute for knee socks
>>
>>58140511
start from the bottom up with digital logic gates and circuits, then assembly, then C, then LISP, then Java, then Scala
>>
>>58140533
>C
damn you, he will damn you to hell.
>>
>>58139717
Last bump.
>>
>>58140511
learn about programming in python
learn to program in c
learn to get a job in c#
>>
>>58140511

python or java, because:

python is very easy
java is very popular
>>
>>58140543
Do you wear skinny jeans?
Then you're definitely in!
>>
>>58140441
>[x] hate OOP
>[x] hate IDEs
>[ ] use only Haskell
>[ ] never produce actually useful software (this is important)
>[ ] wear knee socks
>[ ] tiling window manager
>[ ] dark-like-my-soul customized colors
>[ ] hate popular Linux distributions (because too intelligent for them)
>>
>>58140441
>[x] hate OOP
>[x] hate IDEs
>[x] use only Haskell
>[x] never produce actually useful software (this is important)
>[ ] wear knee socks
>[ ] tiling window manager
>[x] dark-like-my-soul customized colors
>[x] hate popular Linux distributions (because too intelligent for them)
>>
>>58140441
>[/] dislike OOP
>[ ] hate IDEs
>[ ] use only Haskell
>[x] never produce actually useful software (this is important) (define useful)
>[ ] wear knee socks
>[ ] tiling window manager
>[ ] dark-like-my-soul customized colors
>[ ] hate popular Linux distributions (because too intelligent for them)
>>
>>58140543
>[/]
wat da fuk is dat shit?
>>
The Singleton Design Pattern mentions that classes can have static instances of themselves.

What purpose does this serve?
>>
>>58140567
kys
>>
>>58140606
>purpose
Like the majority of OOP, absolutely nothing.
>>
>>58140606
Pretending you aren't using globals
>>
>>58140441
[ ] hate OOP
[ ] hate IDEs
[ ] use only Haskell
[x] never produce actually useful software (this is important)
[ ] wear knee socks
[ ] tiling window manager
[ ] dark-like-my-soul customized colors
[x] hate popular Linux distributions (because too intelligent for them)
>>
>>58140606
Singleton is utterly useless.
>>
>>58140668
not really.
>>
>>58140629

lel.
why is everyone on /g/ so edgy about that.

>>58140636
>>58140668

if i want only one object of a class, it does make sense. or does it?
>>
>>58140684
If you only want one object of a class you don't make a damn class in the first place. Classes are about making more than one of something.
>>
>>58140684
>if i want only one object of a class, it does make sense. or does it?

Meh
>>
>>58140684
>if i want only one object of a class, it does make sense. or does it?
yes
>>
>>58140606
class Fucker : SomeDumbInterface
{
static Fucker current;

void Shit()
{
// shit
}

public static void Shit()
{
current.Shit();
}
}

// elsewhere

Fucker.Shit();


this is valuable in a situation where an instance of the object must be produced, vs. just making it all static in the first place. the environment that causes this sort of situation to arise tends to be overengineered OOP, hence the discontent
>>
>>58140695

needs to be class, since it is a factory.
... as part of the factory pattern.

yes, I am a pattern autist.
>>
>>58140675
>Let's prevent creation of more than one instance of this class!
It's literally a crutch for pajeets who can't think for themselves
>>
>>58140713
>the environment that causes this sort of situation to arise tends to be overengineered OOP, hence the discontent

Blame Simula
>>
>>58140725

>try to get into design patterns to rise above code monkey pajeets
>get called pajeet for getting into design patterns

;_____;
>>
>>58140725
the constructor offers interesting semantics, especially for a concurrent environment.
>>
>>58137378
Took me a little to think about it. Pretty fun, senpai.

#lang racket/base
; morse-thue sequence

(define (morse-thue n)
(for/fold ([lst '(0)])
([i (in-range n)])
(append lst (map (λ (x) (if (= n 0) 1 0)) lst))))

(morse-thue 0) ;=> '(0)
(morse-thue 1) ;=> '(0 1)
(morse-thue 4) ;=> '(0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0)
>>
>>58140720
Use an anonymous class if you need to implement an interface but don't want a full class.

>>58140779
You don't need a singleton for lazy initialization.
>>
>>58140767
pajeets read and regurgitate textbooks

real pro-grammers derive every design pattern themselves, and only read textbooks to smugly nod to themselves that they got there first
>>
>>58140709

it will probably be ridiculous over-engineering, or will it?

i mean, Singleton offers literally zero functionality.
>>
>>58140796
>You don't need a singleton for lazy initialization.
if lazy initialization is the only thing you thought about, you suck.
>>
>>58137449
(apply build-path (explode-path path))
>>
>>58140824
Well the only other thing that's interesting about singletons with regards to concurrency is that they're global mutable state and thus utterly broken.
>>
>>58140091
> are you implying I'm some weeb?
no, but some cube monkey coworker will always suggest sushi.
>>
Do segmentation faults ONLY happen in C / C++?
>>
>Pajeet this
>Pajeet that

this casual racism on /g/ is laughable.
the microsoft CEO is an indian, facebook founder a jew, steve jobs a syrian, google co-founder a jew ...

you white bois arent as smart as you think.
>>
>>58140767
Good: Learning design patterns and using them where such patterns emerge organically in your code, as a way of communicating a common program structure

Bad: Learning design patterns so you can shoehorn them in at every possible opportunity, i.e. people going "We should be using a factory here!" instead of waiting for the situation where a factory actually fits the problem.

I trust you to do the right thing, anon.
>>
>>58140855
They happen in any language that can dereference a "raw" pointer that isn't guaranteed to point to accessible memory.
>>
>>58140855
a segfault is just trying to access invalid memory. any language that can access memory can access invalid memory

it's just easier to do this in c/++ than in managed environments
>>
>>58140796
>anonymous class
>Not using a language with first-class functions
>>
File: Curly Braces.png (17KB, 2414x648px) Image search: [Google]
Curly Braces.png
17KB, 2414x648px
>>58139237
>>
>>58140868

some other anon suggested I should use a factory, instead of class.forname(name).newinstance()

it seemed easier and had the same functionality, so i used it.
>>
>>58140889
Given >>58140720 I think it's safe to assume he's using Java.

An anonymous class is basically just a record that contains first class functions which is all a factory would be in a decent language anyways.
>>
>>58140893
python doesnt have those you nut
>>
>>58140511
Racket
>>
>>58140865
>1 out of 100,000,000 pajeets actually got somewhere in their career so the stereotype is wrong!
Okay
>>
>>58140925
disgustingly deep nested blocks are not exclusive to languages that close them with a curly brace
>>
>>58140441
[x] hate OOP
[x] hate IDEs
[] use only Haskell
[] never produce actually useful software (this is important)
[] wear knee socks
[] tiling window manager
[] dark-like-my-soul customized colors
[] hate popular Linux distributions (because too intelligent for them)
>>
I just got to the "Basic Algorithm Scripting" section of FreeCodeCamp's lessons. First time back on 4chan in a bit and it feels good to be able to participate in this thread even though it isnt much.
Anyone else in a similar stage here?
>>
>>58140881
This. A segfault in a C or C++ program is probably your fault. A segfault in Python is Python's fault (forgetting extension modules or FFI).
>>
>>58140855
a segmentation fault is a General Protection Fault that gets thrown by the processor itself when something tries to access memory it shouldn't.
Like >>58140881 said,
any language that accesses memory can cause a GPF
>>
>>58140784
>(if (= n 0) 1 0))

You too good for 1 - n?
>>
I'm reading the GNU Octave manual
>>
>>58140865
isn't the current mastermind behind AMD Radeon also a pajeet?.
>>
Are there any good books on procedural programming?
I know it wasn't formalised as such when procedural programming was at its height but I'd like 'design patterns' equivalents.
Things like how you use handles for certain things in winapi. Its an area where I feel im lacking.
>>
>>> x = open('words.txt')
>>> for i in x:
word = i.strip()
y = 'e'
if y in word == False:
print(word)


Gives me back nothing. I want to print out all the words with no 'e' (obviously). What do?
>>
not to ruin this thread or anything but lately since i've been taking programming a lot more seriously and now have a job doing it, my social skills have plummeted and tfw no gf. I've become so used to thinking logically and like a machine, my human interaction skills have been reduced to mere nothingness.
>>
>>58141008
sicp
>>
>>58140989
so you like the style?

what is your favorite part?
>>
>>58141008
>Things like how you use handles for certain things in winapi.
In OOP parlance that would be encapsulation and also abstraction (the client code doesn't depend on how the library is implemented because the handle is opaque).
>>
>>58141025

you arrived at the stage where we all had been for our lives
>>
>>58140978
I was thinking it wasn't a very pretty part. Thanks for the pointer.
>>
>>58141008
honestly the best documentation for win32 is MSDN built into VS
>>
>>58141024
x = open('words.txt').read()
for word in x:
if 'e' not in word::
print (word)
>>
>>58141008
>procedural programming
What do people mean by this? And why is it always in contrast with OOP? Isn't procedural programming just normal programming? Where shit executes in the order it's written?
>>
>>58141025
"my social skills are lacking and i have no gf" is unlikely to derail a programming thread on 4chan, anon
>>
>>58141055
Procedural programming encourages separation of code and data. OOP encourages binding it tightly together.
>>
>>58140865
Anon obviously unless the context states otherwise pajeet is just playing on the well known issues with outsourcing to India.

It's the hip way to call someone bad at programming in a way where you don't imply they're new but rather have been taught to program in horrid ways/doesn't know any better.

I'm sure practically anyone who has worked for a reasonable amount of time can relate to the issues with outsourcing to India.
>>
>>58141055
welcome to jargon

it doesn't have to make 100% logical sense as long as it keeps the plebs out
>>
>>58140906
Sure, it might be cleaner for that situatation. But my first question would always be what you need the dynamically instantiated class for?

Not saying you don't want a factory, but what's the problem it's solving here?
>>
File: out.png (2MB, 839x704px) Image search: [Google]
out.png
2MB, 839x704px
I'd like to create a program for 8-bit microcontroller (AVR) to control the traffic lights for a T-junction (pic related). I'm planning to use some LEDs as traffic lights.

How should I get started with it?
>>
>>58141035
>In OOP parlance
a handle is like a reference and when associated with a set of operations, it's like an abstract data type. oop has nothing to do here.
>>
>>58141089
I'm saying the use of handles in PP is similar to the use of encapsulation in OOP.
>>
>>58141068
>Procedural programming encourages separation of code and data.


That is rich.
>>
>>58141036
>>58141056

yeah call it redpilled or whatever but simple friendly conversations all of a sudden annoy me. Theres no point. I hate small talk. I just wanna shut up and program when im at work. Everyone else is a lot more social and have gfs/bfs/husbands/wives.
>>
>>58141088
Kek, I live near such a T-junction (but in a shape of Y), and the lights there work as much retarded as possible.
>>
>>58141100
Yes?
>>
>>58141086

the user chooses what class of objects he wishes to construct, basically.

the factory accepts that as a string and selects the corresponding class to return.

the only other way to implement this would be reflection, e. g. class.forname(input).newinstance().
this method failed me, it somehow did not recognize existing classes. so i went with the factory.
>>
Why are there two threads?

Also Cordova is a pain in the ass...need JDK just to use Android SDK just to use Cordova.

The installer should install the prereq.
>>
>>58141068
This is roughly what I thought, so why isn't procedural favoured over OOP as it seems that it would be easier to test functions without them having bound/private data?

For the record, I "know" OOP but I've never really "got it", and procedural always seemed simpler and easier to use.
>>
>>58141095
We don't want to know what you do with your PP.

That's the point.
>>
>>58141100
are you retarded?
>>
>>58141116
Not him, but you accurately described OOP, not procedural.
>>
File: dad_of_the_year.webm (2MB, 1335x720px) Image search: [Google]
dad_of_the_year.webm
2MB, 1335x720px
>>58141055
Procedural programming is when you program with procedures.
Functional programming is when yo program with functions.
The set of all functions is a subset of all procedures.
Examples of non-procedural programming languages are assembly or the firsts basics where you only have symbols/addresses and goto.
>>
>>58141088
Post pics of the hardware.
>>
>>58141133
For those of us who don't know what PP is, could someone explain why this is wrong.
>>
>>58141128
API's based entirely on procedural calls hide the global state, they are nothing but "side effects"
>>
>>58141151
>Functional programming is when yo program with functions.
don't you use functions in procedural?
>>
>>58141077
>Pleb-tier: messy procedural
>Normie-tier: OOP because everyone else says it's the "right thing"
>Proper understanding-tier: simple modules with free functions/functional
Is this accurate?
>>
>>58141024
>>58141024
>>58141024
pliiiz.
>>
>>58141151
most assemblers/processors support call and ret
>>
>>58137159
>What are you working on, /g/?
Probably gonna rebuild those last few features in my Discord bot that I hadn't ported yet.
The DiscordPHP library was fucka poorly maintained and had questionable help. Discord-py is good, though.

Then, back to my website within the next couple days
>>
>>58141164
Procedural languages are programming languages where programs are expressed as a sequence of explicit, detailed commands for the computer to carry out in order. They get their name from allowing sub-sequences of already defined instructions to be grouped into labelled procedures (sometimes also known as subroutines, functions, subprograms, or what-have-you). When a procedure has been defined, it can be called repeatedly from other parts of the program, and thus extend the range of commands the rest of the program can issue to the computer.
>>
>>58141128
Procedural to most people means C. Procedural with lots of abstractions and a strong type system (which is basically functional) is good.

>>58141171
That's not true at all. A handle is generally just an opaque pointer. Sure, lots of procedural C libraries are terribly designed but that's not an intrinsic flaw of the paradigm.

>>58141177
Yes.
>>
>>58141151
functional programming uses function pointers, so you got that backwards.

FP > PP
>>
>>58141133

Procedural programming really does nothing at all for the separation of code and data.
>>
>>58141175
Procedures do something
Functions return something
>>
File: 1384661766148.png (161KB, 400x300px) Image search: [Google]
1384661766148.png
161KB, 400x300px
>>58141128
procedural or OOP are never universally "right" or "wrong." some situations are more suited to one philosophy than others, but that's not even the main part

a much larger part of programming than most are willing to admit is writing code that's easier for the programmer to navigate and maintain. some people find OOP's high degree of abstraction code easier to mentally model, others don't.

"did it run" and "was it fast" sometimes "how many lines" are nice empirical metrics to flaunt, but most of the time, you're picking a language and a style because it makes it easier for you to do your job. so long as you're producing a program that meets the goals of your clients/yourself, don't think about it in any greater terms than that
>>
>>58141203
A handle is an opaque pointer /to global state/
>>
>>58141206
Function pointers are part of implementing closures on a Von Neumann computer.
>>
>>58141211

t. Ada
>>
>>58137159
>What are you working on, /g/?
Adding recaptcha then packaging with cordova and adding admob with the plugin.

After that, restyling for browser release and finding some nerd with a macbook so I can package for ios.

It makes sense now why people dev on mac since they locked down ios to it.
>>
>>58141224
How do you figure? That's not what Wikipedia nor my experience dictate. The state may be managed by something else, sure, but that doesn't necessarily make it global, nor does it typically matter if it is or not.
>>
>>58141025
>Tfw no android gf to talk in code with
>>
>>58141055
Well what you described is imperative programming. Procedural programming is programming with focus on procedures (functions, with or without side effects) as your primary abstraction.
>why is it contrasted with OOP
Well, here it's falsely contrasted with FP. But yeah it would make sense to contrast with procedural programming as they're probably the closest two I can think of.

But I want more tools in my arsenal. Something I found helpful about OOP is that they have their design patterns. While they're rather clumsy, the idea of having general ways of dealing with things that isn't just intuition (which it seems like most procedural programmers have) is very nice. I can look at a problem and see that a callback would suit nicely here (for a sorting algorithm for instance). But I want to know more things like that. Because the list feels rather short, though I haven't formalised it.
>>58141041
I'm asking for procedural programming tips, not to learn winapi.
>>58141028
Are you just recommending the book or is it good to understand procedural programming practices?
>>58141095
I don't really see it. Handles are means of not copying a large amount of data around. An alternative would be to have me pass an array to a pure function and then take care of that array. With a handle I've left the allocation and handling of the array to the functions taking the handle. It doesn't really achieve encapsulation unless the functions taking the handle were using global state. I could fuck around with the handle as much as I want. OOP would certainly describe this as a breach of encapsulation and I would need to be returned an object with all private members and potentially a getter function for some of those. And even so I shouldn't really be given an object back like that unless I'm a objectManager or whatever. And down the rabbit hole we go..
>>
>>58141268
Maybe I'm conflating "opaque pointer" with "handle" but in my experience they are the same thing (or something equivalent, e.g. a handle as an index into an array).
>>
>>58141224
It's true that if you're only given handles there's likely global state somewhere. But when it's global state that's only used in a specific region of the code global state isn't that bad.

And even so the handle could just contain a void* to the state and then you don't have any global state. It's just heap allocated somewhere. Hopefully they let you pass an allocator or you get mad.
>>
File: kissu.webm (3MB, 1280x720px) Image search: [Google]
kissu.webm
3MB, 1280x720px
>>58141175
You could. All functions are procedures (computer science wise) but all procedures are not functions (all squares are rectangles but all rectangles are not squares).

>>58141194
Call and ret are goto and are explicit. A procedure has a signature (important!) and an implicit control flow.

>>58141211
>Functions return something
Not only. if you refer to lambda calculus, a function does returns a value, but also shall have only one argument (thus currying) and shall be referentially transparent. If the function is not referentially transparent, some say it's an impure function (eg: ocaml).

>>58141268
>Are you just recommending the book or is it good to understand procedural programming practices?
honestly it's good. the first chapter is about procedural abstraction and its benefits.
>>
>>58141033
I'm only at the beginning, starting chapter 2. It seems really well written and reading it is very pleasant.
>>
>>58141268
>I'm asking for procedural programming tips

1. Build a memory management system for all your handled things.

2. Patterns.... It doesn't really work that way; every function by virtue of it's purity is domain specific. That's why you're struggling to formalize.

3. It's really about direction of control. Either you are driving the car, or the car is driving you.
>>
>>58141268
>Something I found helpful about OOP is that they have their design patterns.
They're a formalization of good practice. The general concepts of patterns can be applied to all programming languages, but which patterns should be defined for any specific language is a whole different thing. Patterns for Haskell wouldn't be expected to be patterns for C#, or vice versa.
>>
>>58141291
They're similar enough to justify confusion but in summary a opaque pointer is generally simpler I'd say. Some people call opengl's texture 'names' (just a Gluint) handles. But they're just as well opaque pointers.
>>
>>58141394
they are not.
>>
>tfw seeking funding.
>>
>>58141389
Yeah. But I'd like that for C and C like languages. Anything that favors the procedural over OOP or FP really.
>>58141348
I'll check it out then.
>>
>>58141203
>Procedural to most people means C
Not him, but to me it also means PHP. I almost never use OOPed PHP, less the SESSION and stuff
>>
>>58141389
The difference is that in Haskell most of these things can be formalized and then abstracted over. You don't call Monad a pattern, you call it a type class.

>>58141394
I don't even want to get into trying to figure out what OpenGL does. Depending on how much you're saturating the GPU a single name could refer to 1 of like 3 actual resources.

In Vulkan, though, what the API calls a handle is literally defined to be an opaque pointer (or a 64-bit address when compiling for 32-bit because pointers aren't long enough).
>>
>>58141405
>posts short nondescript messages
Are you the guy who started writing in a yelling style with all caps over truncation vs rounding 1.5 years ago or so?

Either way, elaborate autismo.
>>
>>58141442
please don't get him started. if you do, i'll throw bankers rounding out there just to see the train wreck
>>
All I know about programming is some AP Comp sci classes in HS that taught Java, two years ago. I want to learn more, and I like reading books. Should I work through the C programming Language book or Structure and interpretation of computer programs first? Would it be counterproductive to read the entire SICP?
>>
>>58141428
for perly tools that's enough, but for web you're missing out on good database abstraction
>>
>>58141482

> START WITH C <

Please do this. Ignore everyone else. Just go learn C. Then you will know everything and can do anything... correctly.
>>
>>58141431
>it's an actual pointer in vulkan
Is it really opaque then? I guess if it's addressing on the gpu it's still opaque..
>a single name could refer to 1 of three actual resources.
But only 1 of each type surely. I'm not gonna have texture handles that are the same but refer to different textures. I don't see how that would work.
>>
>>58141482
SICP is very math and theory heavy. If you just want to learn the language read these instead:
The Little Schemer (intro)
The Seasoned Schemer (intermediate)
The Scheme Programming Language by Kent Dybvig (intro)
Realm of Racket (intro)
>>
>>58141442
one of the main differences between an handles/references and pointers is that two _different_ handles can refer to the _same_ object while two different pointers can't.

an example

handleFile a = open("foo");
handleFile b = open("foo");

(a != b) == true;


a and b refer to the same file despite having different values.
>>
>>58138433
Develop a kernel. For fun.
>>
>>58141530
00ea0000ffff
finished
>>
File: tyrell.png (40KB, 375x360px) Image search: [Google]
tyrell.png
40KB, 375x360px
I have a source code for a C library in "myproject/lib/mylib"
How should I write a Makefile to compile this library and then link it to my project?
SRCDIR = src
INCDIR = include
LIBDIR = lib
BLDDIR = build
TARGET = bin/myshit

SRCEXT = c
INC = -I$(INCDIR)
SRC = $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJ = $(patsubst $(SRCDIR)/%,$(BLDDIR)/%,$(SRC:.$(SRCEXT)=.o))
LIB = -lsqlite3

CC = gcc
CFLAGS = -std=gnu11

$(TARGET): $(OBJ)
$(CC) $^ -o $(TARGET) $(LIB)

$(BLDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
mkdir -p $(BLDDIR)
$(CC) $(CFLAGS) $(INC) -c -o $@ $<

clean:
rm -rf $(BLDDIR) $(TARGET)

.PHONY: clean
>>
new thread when? :3
>>
>>58141482
Sort of along the lines of >>58141507
Starting with C is good. It's rather small and simple language and you get a picture of a rather big-effort way of doing anything.
Most things you move to after that will have pretty features that make things easier.
The K&R book is not for completely new programmers either way. So don't start there. I don't know good newbie books but I'm sure they're somewhere.

You don't have to know programming for SCIP but it's not a view I'd suggest before you know a little.
>>
>>58141515
>Is it really opaque then? I guess if it's addressing on the gpu it's still opaque..
Some of the handles are opaque pointers in the sense that the driver can actually use them as such. Like the instance and device, for example.

The others are the ones that are 64-bit integers on 32-bit machines, so presumably they are GPU addresses. Though I'm not sure why they didn't just use uint64_t and called it a day.

>But only 1 of each type surely. I'm not gonna have texture handles that are the same but refer to different textures. I don't see how that would work.
I may be confusing this with something else but I believe drivers are allowed to allocate buffers 2x or 3x as large as you ask so that you can update them every frame while there are frames in the pipe already depending on their respective data. So the same name actually refers to 1 of 2 or 3 buffers depending on the progress of the driver.

I would never use OpenGL as a good example of procedural programming anyways. It's disgusting. Vulkan, however, is a beautiful API, if a bit heavy in the fine detail.
>>
>>58141528
Where did you get this definition? I don't mind differentiating the two like this but I'd need a solid source.
>>
>>58141562
I don't get it.
>>
>>58141603
jmp ffff:0000
>>
>>58141485
Explain?

When I use it to connect to the database, I just use
$conn->query() to get my data.

I mean, in that sense, I DO use the connection as an object, but, I limit it to pretty much that. like, users aren't necessarily objects, just an array in the session, etc. etc.

I'm not particularly opposed to OOPing, but if I see no valid need, I just don't
>>
>>58141589
Where do you recommend you learn vulkan?
Everyone seems to complain. But if you have the view that it's a nice api then I'd love to know where you learned about it.
>>
>>58141618
if all you're doing is edge-triggered minor POST updates, that's fine. but imagine writing an ecommerce platform... you would want to OOP up things like orders/payments, etc, for reuse and to ensure they persist properly.
>>
>>58141626
I never really looked past the specification. Then again, I spent a lot of time studying Mantle and then D3D12 (from MSDN) before it released, and had been looking into OpenGL AZDO even before that. Kind of osmosis through lots and lots of kinda related articles, I guess.
>>
>>58141148
OOP is separating code and data? I thought it was the complete opposite.
>>
>>58141652
OOP separates model and controller.
PP separates code and data

It's subtle :D
>>
>>58141612
That's not a very interesting kernel to be quite honest with you.
>>
>>58141688
but did you run it? you should run it. run it. everybody run my code:

jmp ffff:0000

tell me what you think.
>>
New thread:

>>58141704
>>58141704
>>58141704
>>
>>58141648
I'm honestly not sure I follow.

Why would any of that need classes with objects?
Just make a module for it. $_POST whatever is needed, and then depending on certain POST criteria, switch between your modules and only load the modules related to the POSTed data.

if it's credit card info, name, etc. whatever, you would just need to send the (serialized if AJAX) array, ofc with some form of encryption, and... idk...
switch($_POST['PAGE_LOAD'])
case 'NEW_PAYMENT':
require_once('modules/paymentProcessor.php');
//and then other options


I just see no need for classes in features like this
>>
>>58141701
I'm not going to run it but all it does is jump into the start of upper memory.
Assuming this is rmode and the a20 gate is disabled, then it should wrap around to 0000:0000 (correct me if I'm wrong).

I don't really know what it'll do, but it'll probably fault the CPU.
>>
>>58141701
Is this just an infinite loop?
>>
File: board.jpg (109KB, 970x728px) Image search: [Google]
board.jpg
109KB, 970x728px
>>58141156
>>58141113
I currently have this shift register IC and some LEDs on the breadboard. It's just a test circuit to see if everything works.
The microcontroller model is AT90S2313.
>>
>>58141767
fuck, left out brackets in there..
didn't notice that...

Why was the new thread deleted, though?
>>
>>58141772
oh-ho-ho mr. "a20 gate disabled",

>>58141785
that's the first byte of your BIOS ROM

it's how you warm boot an 8086
>>
Guess we can't move yet?
>>
>>58141720
wtf

New thread:

>>58141853
>>58141853
>>58141853
>>
>>58141855
>that's the first byte of your BIOS ROM
No it's not.
FFFF:0000 = 0xFFFF * 16 = 0x100000
That's where upper memory starts, it's not BIOS ROM at all. the BIOS ends at 0xFFFFF which is 1 byte below FFFF:0000
>>
>>58141941
i may be remembering wrong; i believe BIOS may put a short jmp at that location
>>
>>58141981
No wait you're probably right, I made a silly miscalculation.
FFFF:0000 = 0xFFFF * 16 = 0xFFFF0
Yeah it's not in upper memory, it's certainly in the BIOS, but it's not the first byte in the ROM.
Did you mean FFFF:000F? I think that's the CPU's initialization vector.
>>
>>58141941
>>58142078

You're thinking of 286

https://en.wikipedia.org/wiki/Reset_vector
http://wiki.osdev.org/Memory_Map_(x86)
>>
>>58140441
>[x] hate OOP
>[x] hate IDEs
>[ ] use only Haskell
>[ ] never produce actually useful software (this is important)
>[ ] wear knee socks
>[x] tiling window manager
>[x] dark-like-my-soul customized colors
>[x] hate popular Linux distributions (because too intelligent for them)
Thread posts: 324
Thread images: 27


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.