We respect your right to privacy. You can choose not to allow some types of cookies. Your cookie preferences will apply across our website.
Old thread: >>54520933
What are you working on /g/?
A waifubot
>>54528613
Gross.
>>54528613
>unironically posting 3D
get the fuck off my board
Please stop posting anime.
>>54528613
Gonna build my own VM, no idea what I'd do with it after though
>>54528666
seek psychiatric help
>>54528613
What's up with her ribs
Why isn't she writing code
>>54528613
She's fucking perfect
>>54528613
thank you for posting a waifu programmer image
>>54527702
Help
>>54528669
>dancer armour
>>54528669
i was fiddling with this idea myself cause it seemed interesting but then dropped it cause i wouldnt have anything to use it for...
i hope you're writing it in C/C++/Rust tho
I want to mess with images. There is openCV, imagemagick etc.
But before I start using those I'd like to know more about what an image file is exactly - is it text, how does text become an image etc.
I'd like to be able to generate such files, change their colors, distort them etc using programs that I made.
But i lack some theoretical knowledge.
I would google this shit, but i'm not sure what exactly I need to google.
Is there some resource that anyone here has used and liked about images.
>>54528714
I was thinking C or D.
>>54528730
not sure how much higher level D is, but as long as it's not too high go for it bro
(even tho its a dead lang)
Question about C: Is using void * frowned upon if you don't have to use it? It seems like void * could be a major source of type safety issues.
A pong clone
>>54528721
>what an image file is exactly - is it text
Wow, you have a bit to learn anon..
an image file is almost always binary. They are usually compressed such as in the case of png and jpeg files.
A bitmap file is uncompressed, and is just a binary stream of all the pixel values. The beginning of the file will have information about how to interpret the pixels, such as how wide and high the image is meant to be, and what colour format the pixels are in.
>>54528757
Yep.
>>54528730
Do it rusty rusting rustless, D is dead, baby.
https://www.youtube.com/watch?v=y7Yp2L6c2KM
>>54528770
Rust has been taken over by SJWs and will go nowhere.
>>54528752
>>54528770
The community is still pretty active and it gets worked on pretty often. It's not dead, just not very popular
>>54528796
Does rust still have horrific compile time problems?
>>54528804
I dunno, I don't use it
>>54528762
thanks for not answering the question, tripfaggot
you might as well have not responded if you didn't want to offer an answer
>>54528828
How did i not answer the question? What is it you would like to know?
1) Find Freelance gig in your area
2) Hire Pajeets to do the project
3) Pay them 80% less than what you charge
Why aren't you doing this?
>>54528804
i'm using it, and this emacs plugin gives me live error checking by compiling the file, it's near instant for ~1500LoC projects.
also i was in the rust beginner irc and even though i agree they are SJW they are very competent programmers, and they dont push their agenda
>>54528836
Because I would kill myself knowing some pajeet copy pasted shit from stackoverflow without reading SICP
>>54528757
void * is good for two (some would say three, but I disagree) things.
1. If you're talking about a chunk of memory
2. As the other component (besides the function pointer) of a closure
The third way to use void * is as a (type-erased) generic, but IMO you should always use macros for generic programming (i.e. parameterizing code over a type).
>>54528765
So suppose I'm writing a function 'func' which always returns a pointer to a certain struct 'container'. Givenstruct container* func(...){
...
}
andvoid* func(...){
...
}
I should opt for the first option despite being considerably more verbose?
Not really programming but I had to run several scripts in SQL Server earlier (a nightly script I had to run not in the schedule to apply some changes).
>run script
>BIG RED ERROR: can't write to transaction log, please kill yourself
>check server, turns out the drive containing the .ldf file is full to the brim
>getting reports that users are unable to login to our main application
>PANIC
>decide to free up some space for the .ldf file, 1TB now free
>users still can't log in
>severity one(aka you better fix this right now or else we are going to lose money and you lose your job probably) already issued
>MORE PANIC
>restart our main application
>same issue, check all possible causes, application can't connect to DB
>but DB is up, connection is OK, both manually connecting to db through local and remote machines, all accounts used also tested
>everything tells me that the DB is the issue - restarting the DB server and services will take 8 hours
>already hear names of big guns sending emails to our support team
>1 century later(1 hour)
>decide to the app server's cache (not involved in our standard procedure)
>everyone can now login
Thanks for reading my blog. That was the most intense 1 hour of my life.
>>54528881
lmao
all my functions use void pointers and i just cast later
yolo
>>54528757
Insomniac and Naughty Dog uses them instead of templates for generic programming, which I guess qualifies as a place where you don't have to use it.
I'd say that's an exception rather than the rule though, if you walked into like NASA or some shit and started replacing templates with void * they'd probably go apeshit.
>>54528903
Yes, you should. The more type information you can encode in your function signature the better.
>>54528852
How does it feel people who develop Ruby on Rails apps and never even heard of SICP make 10 times more money than you?
>>54528903
Always.
>>54528903
obviously
you have a type system use it
>>54528924
They don't, though.
(Well, maybe some in California do. But then they go home to a tiny apartment that they pay $3k/mo rent for.)
>>54528924
Pretty good because cracking/exploiting their shit is easy like raping a 5 year old kid.
ess queue ell
or
sequel
>>54528971
Squall
>>54528903
This is unrelated to your problem, but if func is allocating the memory for the struct, don't. Pass it in as a pointer argument to be written out. It's frowned-upon in C to take away control over memory from the programmer, because that's pretty much the only thing C has going for it.
>>54528971
squeal
>>54528905
As a fellow DBA, I'd be lying if I said I haven't had a similar experience.
>>54528971
"Sequel", unless you want someone to immediately dismiss you as uneducated.
>>54528971
The latter, but I had a DB professor this past semester that absolutely insisted on the initialism.
I worked on a little chrome addon to download every image from an 4chan thread, it was kinda pain to code but it's open source so there's always room for improvement.
>>54528881
So suppose I'm making a computational algebra system (just an example) and I need to implement runtime polymorphism. In this case, void* seems like a good candidate. Is there a better way to do this?
>>54529032
You're still in college, Ozzy?
>>54529047
in this case use a language that supports real runtime polymorphism
>>54528613
Whom is this floor whore?
As the project's complexity grows, I'm finding it harder and harder to write self documenting code. Nobody taught me anything about this, what the fuck? I used to be able to tell what anything did in my code just from reading it but now that's almost impossible.
>>54528987
It was my first and my biggest blunder. it's been 6 hours since and I still can't sleep, I also haven't eaten anything yet, I don't think I can stomach anything right now.
>>54529055
Unfortunately.
>>54529038
that's cool. source source? im wondering what made it such a pain..
>>54529047
You'll (likely) need to use void *, yes, because what you want is easily accomplished with closures (a virtual method paired with its object is essentially a closure).
>>54529076
Where you at comrade
>>54529059
Karlie Kloss. She's a programmer.
>>54529085
Top secret government facility.
>>54529076
Whatcha studying?
>>54529066
>I'm finding it harder and harder to write self documenting code.
Probably because your codebase doesn't have a good hierarchical structure. Learn good code structure. It's essential to writing anything that's not script-kiddie tier shit.
nice programming related picture FAGGOT
>>54529081
The source code is available on my github
Jumono is my username if you're interested, I have tons of fun working on little things like that when I have a free time.
>>54528881
What if I have a function that returns a pointer to a struct based on its input. Since I don't know which pointer to struct the function is going to return, I'm assigning the value to a void* variabile. Then, based upon some other stuff, I cast the pointer to the actual struct type it's pointing.
is this ok?
>>54529113
She's a programmer, you idiot.
>>54528613
>karlie.jpg
overrated as shit
>>54528666
Not your board fucko.
>>54528613
>old hag
>shit op
fuck off
>>54529128
No, much better to use a union for that.
>>54529129
no she's not, you don't become something just because you feel that you are it
>>54529094
Uh-huh
I bet it's a community college, ain't it
>>54528921
>>54528925
>>54528929
Okay, thanks.
>>54528982
What if the output is of unknown size which is impossible to predict for the programmer? Is it still a better idea to just allocate a large chunk of memory outside of the function and set up a limit for the amount of memory used for the function?
>>54529157
If possible, separate the part that calculates the size into another function. Failing that, allow the user to pass in an allocation callback (basically something with the signature of malloc).
>>54529143
Oh, I actually never thought about using unions. Nice.
>>54529056
>>54529082
Okay, thanks.
>>54528903
Why the fuck are you programming in Swedish?
>>54529119
you're using vanilla js. i applaud you sir. so much of your code could've been saved by using jquery but you went all out.
respect man
>>54529188
>func
>container
>swedish
what
>>54529157
>>54529183
I only say to prefer something other than a callback because C doesn't have lambdas, and so it can be a bit of a hassle.
>>54529188
för att jag vill det
>>54529204
>>54529222
What?
>>54529222
Nice trips cuck
>>54529129
yea, and you're also not a faggot
>>54529099
CS
>>54529152
No, actually. I was going to a community college a while ago, but now I'm at a real university.
>>54529213
>C doesn't have lambdas#define lambda(l_ret_type, l_arguments, l_body) \
({ \
l_ret_type l_anonymous_functions_name l_arguments \
l_body \
&l_anonymous_functions_name; \
})
Enjoy.
>>54529200
I don't like jQuery, never liked the syntax and I'm generally okay with doing pure JS
what's the best language to write the first compiler for? everyone recommends scheme, but I don't know anything about functional programming besides Java streams and lambdas. I intend to write it in C and for it to produce assembly code
>>54529129
I know right. I always get into lingerie and 6 inch stilleto heels, then sit on the floor without any equipment to do koding.
>>54529268
>if you don't use your an idiot
>your
>>54529314
CLite
it's not an actual language but great for learning
http://myslu.stlawu.edu/~ehar/Spring10/364/clite_grammar.html
>>54529323
>xD
Downloading images from the NASA archive since I recently learned they are all free to use as long as you don't suggest NASA is endorsing you and they don't have astronauts in them.
>>54528613
Finally going back and reworking my 4chan api wrapperimport Foundation
import FourChanAPI
let a = FCBoard(name: "a")
// Getting a list of all boards
FCBoard.getAllBoards {boards in
print(boards)
}
// Updates the board's thread list
a.updateThreads {threads in
print(threads)
let thread = a.threads[0]
// Fill thread with posts
thread.updatePosts {posts in
// Print last post
print(thread[thread.count - 1]!)
}
}
>>54529323
It's the best way. I sometimes massage myself down there to get my blood flowing, and then meditate on zygohistomorphic prepromorphisms.
>>54529188
How can you tell?
>>54529275
gnu c
>>54529337
looks straightforward as fuck. thanks.
>>54529443
void * is type-fluid.
>>54529468
Voids are also black.
>>54529468
ayyyyyyyyyyyyyyyyyyyyyyyyyy
I'm playing around in IDA. How should I name local variables that are basically duplicates of parameter?void __fastcall setPlayerPosition(__int16 x, __int16 y)
{
int v2; // esi@1
__int16 v3; // di@1
__int16 i; // bx@1
int v5; // eax@2
void *v6; // eax@5
v2 = dword_40C618;
v3 = y;
...
As seen here, where v3 is parameter y. Would you add an underscore or what?
>>54529455
Admittedly, but it's still neat. A bit like TMP in that its functionality is merely incidental.
nothing tbqh
>>54529275
What the fuck is this shit? Show a usage example.
Does it have closure support?
>>54529507
>Does it have closure support?
no
I'm currently making a program that scans a company's schedule and sends out emails and SMS messages to the customers alerting them of their appointment the following day. I'm having a weird issue though. While i'm sending a mass amount of text messages, sometimes (rarely) a couple of them will be missing a character or two from the message. I'm using the service of sinch to send out the messages. Anyone know what the issue might be? I'm starting to think it's on their end.
>>54529489
I never understood what so many underscores are for. I've seen them in many disasm as well as many C/C++ libraries.
>>54529528
Might as well not be an anonymous function then.
So what happens if you attempt closure shit? Does the program print garbage or does it fail to compile?
And apparently since this isn't gnu c, what sort of c is it?
>>54529550
>I'm starting to think it's on their end.
yeah since it only does it sometimes, it's probably an issue on their end
>>54529569
>And apparently since this isn't gnu c, what sort of c is it?
It is GNU C.
>>54529550
You might have a weird kludge somewhere causing it.
Impossible to say unless you show us what's underneath the skirt, so to speak.
>>54529551
in this case it's in defs.h#define __int16 short
>>54529569
>Might as well not be an anonymous function then.
a lambda procedure is an expression.
>>54529569
>Does the program print garbage or does it fail to compile?
print garbage.
>>54529569
>And apparently since this isn't gnu c
this is gnu c.
I love you, /dpt/.
I learn so much while I'm browsing these threads.
Now, I don't learn much from the actual thread, but I take all of these fragments of incoherent arguments and research them until I get a cross-section of articles on a particular subject.
The catalyst, of course, being the inane rants and insults thrown around here.
So thank you, /dpt/. You've caused me to be able to bullshit my way through basically any conversation about things related to programming.
http://blog.8thlight.com/micah-martin/2013/05/28/performing-code-katas.html
Why aren't you a code artisan, /dpt/?
>>54529799
I'm a software alchemist you flying faggot
>>54529799
i'm a wizard that writes spells in scheme
>>54529799
>>54529799
I didn't think SF webdevs could get any more pretentious, but there you go.
>>54529609
Rather not post the entire code because it hold's company info, but here's the part where it sends a text. Also, yes I know I'm a fag for using c#.private async Task MainAsync(string description, string when, string over)
{
string Tdate = DateTime.Now.AddDays(1).ToString("MM/dd/yyy");
//Remove all possible (,), and - from the address
String fixPhoneNumber = description.Replace("-", "").Replace("(", "").Replace(")", "");
Console.WriteLine(fixPhoneNumber);
var smsApi = SinchFactory.CreateApiFactory("logindata", "logindata").CreateSmsApi();
var sendSmsResponse = await smsApi.Sms("+1" + fixPhoneNumber, "(The Companies name) would like to remind you that you have an appointment on " + Tdate +" between " + when + " and "+ over + ". If you have any changes, please call us ASAP at (The Company's phone number)").Send();
Console.WriteLine("Text Sent");
Thanks if anyone can help.
>>54529088
*coder
>>54529887
**apper
>>54529859
Where are the characters missing? From the end of the message string?
>>54529911
The weird thing it's usually near the end of the messages.
>>54529799
>clojure
Of course.
>7 minutes to fizzbuzz
Kek
>>54529931
near? or at? Do you have an example?
>>54529859
>Also, yes I know I'm a fag for using c#.
C# is comfy as fuck, nothing wrong with that.
Chaining Replace() is fine, but I like the LINQ hack:string fixPhoneNumber = new string(description.Except("()-").ToArray());
I'm willing to bet that the API just hacks off the end of a string if there are too many characters.
Are the characters ever dropped in the middle of the message?
>>54529948
Like the word "us" at the end will lose it's 's' character.
>>54529859
>>54529952
It's worth noting that the length of your 'when' and 'over' variables are not apparent from this code.
Are they ever longer or shorter?
>>54529952
>Chaining Replace() is fine, but I like the LINQ hack:
Well, that's a new trick to me.
>>54529845
))))))
>>54529971
That's messed up. Can't be anything you're doing. Either the library you're using is fucked or they're fucking it up server side. Would be interesting if you could see what's being sent to the server. Maybe with fiddler or something.
>>54529972
The info it pulls would be ie) 03:00 PM and 04:00 PM.
>>54529971
Thanks man, I didn't know I could do that. I
Tend to lose a character or two near the "Call us at" part
>>54529991
That's the source of my power. But you have to colorize them.
>>54528760
source for background plz?
>>54530009
lack of sleep, sorry. second part is for
>>54529952
>>54529985
LINQ hacks are basically my tripcode.
I'm /dpt/'s resident C# LINQ abuser.
You can do anything with LINQ.
ANYTHING.
>>54530009
>Tend to lose a character or two near the "Call us at" part
It's definitely the API then, nothing with your code.
Examine the texts that have dropped characters and confirm their EXACT character count.
How much domain specific DOM shit do I have to memorize before I can make a trivial userscript in JS?
I'm finding JS difficult because I have no idea what i'm assigning to my variables.
>>54530050
>I'm /dpt/'s resident C# LINQ abuser.
I love LINQ as much as the next guy, but I try not to do too much with it.
>>54530043
Some anon posted it somewhere sorry i don't have the original image
>>54530094
I don't think you understand.
It's like a drug.
Workflow:
Can I use LINQ in this function?
>Yes
Great, let's use LINQ!
>No
Bullshit, watch this.
>>54530161
Lord have mercy.
>>54530161
I do this a lot in F#. Except with |>, which lets you do that sorta shit except you can use any function instead of only linq ones.
Shocking sometimes how much you can get done without any variables, state or mutation.
>>54530161
>GroupBy(x => x)
>multiple ToList
Now, I'm not claiming to be a LINQ expert, but are you sure this is right?
>>54528721
If you want some general manipulation, I think linear algebra has some applications. read page 1 and 2 of Elementary Linear algebra by spence, Insel to see what I mean.
>>54530276
This is what I mean by manipulation.
>>54530234
>I didn't declare any variables, so they don't exist :^)
Of course there is state, a long chain cannot possibly be atomic.
>>54530347
The state could be ephemeral, i.e. only existing as parameters or return values.
>>54528721
The essence is the image data is stored as arrays of numbers which represent brightness percents for each pixel of 3 colors, red, green, and blue, which when combined form a composite color.
A pixel is a small segment of the image. When you render an image, it corresponds to a dot on your monitor.
>red:0
>green:255
>blue: 0
is maximum brightness green
>red:50
>green:50
>blue:50
is a dark gray
Here's some file format info:
Simple
>http://www.ue.eti.pg.gda.pl/fpgalab/zadania.spartan3/zad_vga_struktura_pliku_bmp_en.html
Hard
>http://libpng.org/pub/png/spec/1.2/PNG-Structure.html
>>54528762
What a useless answer.
>>54530347
>I didn't declare any variables, so they don't exist :^)
Exactly.
>a long chain cannot possibly be atomic.
so?
>take an SQL class
>love the shit out of it because databases are fun
how do I enhance my knowledge on this shit? I wouldn't mind making a career out of doing databases.
I am up to B-trees and hash indexes and clustering.
>>54530347
the long chain just passes through more functions without any state (everything is passed as an argument)
>2016
>not using dependent types
>>54530374
Honestly, get a job working as a DBA and BI dev.
I liked databases, but it wasn't until I got to play with living, breathing data that I really understood the way things work, how to optimize, etc.
It's wonderful having a huge live database to play with.
>>54530339
>>54530276
thanks lad, lin. algebra sounds nice, i already was planning on reading up on it
this is good
>>54529776
This. So much this.
Combine this general with a CS curriculum and you're set.
>>54530103
thank you very much, senpai
>>54530386
I try to when I can, although library support for Idris is so tiny
maybe I should start porting libraries to it
>>54530386
>not fibrations
>>54530239
It's probably right. You end up needing to do the same thing (x => x) with OrderBy.
>>54530478
I don't use linq much. Seems silly they wouldn't have a Order() method. I hate the x => x stuff.
>2016
>not using dependent types
>not using linear types
>not using indexed inductive-recursive definitions
>not using homotopy type theory (truncated to sets for the computational behaviour)
>>54527337
i just want to watch porn with my vpn g
>>54530402
I have used yelp business data and hard drive failure data in applications and that was pretty damn fun.
been thinking about some form of database stuff but I am worried if that will lessen my career options.
I am a recent CS graduate.
What does map/filter/reduce do and why do I see it so often?
>>54528627
Please share more information, anon-kun!
>>54530042
do you ever get Lost In Stupid Parenthesis?
I need help with this python script. I want it to have basic signature checking function, like an AV. It's supposed to open all directories, then sub-directories, and then at last open the files to create a MD5 checksum for scanning. I'm pretty much stuck:import os
import hashlib
database = raw_input('>')
files_to_be_scanned = open("output.txt", "w,r")
# root prints the directories from specified path
# dirs prints the sub-dirs form root
# files prints all files from root and directory
for root, dirs, files in os.walk("./"):
for name in files:
# write all files to output text for later scanning
files_to_be_scanned.write(os.path.join(root, name))
# write new line after each file
files_to_be_scanned.write("\n")
with open(os.path.join(dirs, name), "r") as checkfile:
# reading the contents of the file
data = checkfile.read()
# pipe contents of file for checksum generation
md5_returned = hashlib.md5(data).hexdigest()
# if the files checsum matches any of those in cvd
# the message infected! is displayed, otherwise clean. is displayed
if aline == md5_returned:
print "Infected!"
else:
print "Clean."
>>54530493
>I hate the x => x stuff.
Me too, but if you need the default comparator, that's how you get it.
>>54530535
No, that's not possible if you use a good text editor.
tfw you work for a company and all their in-house software is made in vb6
>>54530509
You can write an algorithm once and have it work for all sorts of sequences and trees.
>>54530509
Not valid code but you'll get the idea
>map
map(square,{1,2,3}) -> {1,4,9}
Applies a function to each member of a list.
>filter
filter(even,{1,2,3,4}) -> {2,4}
Removes all elements that don't pass the test.
>reduce
reduce(+,0,{1,2,3,4}) -> 10
It takes a binary operation A,A -> A and for each successive element, applies the "accumulation value" against that element.
You see them so often because they're tools used to compose more complex algorithms. Fizzbuzz can be thought of as a map of some function onto a list of numbers.
>>54530504
>thinking about some form of database stuff but I am worried if that will lessen my career options
Quite the opposite.
Entry-level programmers and webdev are a dime a dozen.
Database experience means you have rock-solid job security.
The best thing you can do for yourself is to combine knowledge of databases with something else. Personally, I did MIS at a reputable business school, so it's a combination of business + database. Alternatively, you can combine it with development experience, which would put you in a great back-end dev job market, doing API and enterprise dev.
So I am learning to program in Swift, and quite like it. However, I'm generating a large number of code files, which aren't particularly searchable.
So I thought I'd start blogging about what I'd learnt, with code snippets and as good an explanation of what is going on for my own benefit. If anyone else reads it, that's OK.
However, Wordpress themes don't seem to handle code in a pleasant way. They sort of highlight each line, so it doesn't look like one continuous block.
Is there a good Wordpress theme I can use (free!) or just a better blogging site to use?
>>54530509
they transform collections is one way or another.
map takes a collection and returns a new collection that is the same as the old collection except each item has been transformed with a function you pass. example:[1, 2, 3].map((num) => num + 1);//returns [2, 3, 4]
filter returns a new collection with certain items filtered out based on the method passed.[1, 2, 3].filter((num) => num < 3);//returns [1, 2]
reduce accumulates all the items in a list into a single value and returns value.[1, 2, 3].reduce(0 /*initial value for accumulator*/, (num, accumulator) => num + accumulator));//returns 6
This is pseudo code. Don't rag on that this isn't valid code for whatever language. i know.
>>54530583
Reduce (fold) is more general than that. The accumulator/result type can be different from the element type.
>>54530493
>they wouldn't have a Order() method
You mean Sort()?
The way I generated this makes me feel dirty.
>>54530509
>>54530578
You can think of reduce in particular as being a "generalized for loop".
>>54530643
Yeah, i suppose i do..
>>54530509
map transforms all elements in a data structure. It's very flexible, you can use it to access multiple things at once easilyaddresses = map(lambda person: person.house_num + person.address1 + person.address2, people)
filter selects the elements that resolve to true given a function. Very useful for querying data easilyrich_people = filter(lambda person: person.salary > 50000, people)
reduce helps group datarichest_person = reduce(lambda current_richest, current_person: current_richest if current_richest.money > current_person.money else current_person, people)
People typically use for loops combined with ifs for things that are as simple as map, reduce, filter
In Python, it's even more elegant using list comprehensions.
In Javascript, you can use bigger functions
Other languages have their own unique quirks
>>54528613
who is this cum drum?
>>54530683
>tfw this anon thinks I'm rich
>>54530683
>In Python, it's even more elegant using list comprehensions.
I kinda prefer my map famalamalamalam
but it is the same
>>54530583
Oh yeah and you can implement map and fold in terms of reduce (often called fold). And fold has a left-sided version and a right-sided version because your operation might not associate.(define (map f alist)
(foldr (lambda (elem newlist) (cons (f elem) newlist)) '() alist))
(define (filter predicate alist)
(foldr (lambda (elem newlist) (if (predicate elem) (cons elem newlist) newlist)) '() alist))
>>54530642
Yeah I guess. I guess B,A -> B or A,B -> B depending on which fold it is would be better.
>>54530683
>In Javascript, you can use bigger functions
Forgot to add that in JS, they are a function of arrays and/or dicts, and that you can use bigger functions in Python if you sub in a function rather than inline a lambda
>>54530714
I'm a bonglad, £50k is pretty respectable if you use 4chan (not that I make that much)
>>54530723
I like them too, but I prefer it only in languages where it's a function of data structures because it looks cleaner in bigger queries
>>54530683
>>54530724
Basically all set theory, similar to how TSQL is formed.
A small daemon to change the niceness value of games under linux.
>>54530683
>In Python, it's even more elegant using list comprehensions.
I always found these pretty messy and confusing. Not that I can't read them, but you sort of need to read them out of order to understand how data is being transformed. "natural language" stuff in programming langugaes has a habit of being shit.
>>54530549
i never liked LISP anyway
what is a qt programming project to surprise your qt3.14 programming gf with, /dpt/?
>>54530741
Oh, that's like $74k in burgerbux, that makes a bit more sense.
Is systems programming comfier than application development?
>>54530535
Not with my symbols of power colorized.
>>54530758
To work on together or as like a cheesy gift?
>>54530751
Set syntax is very easy to understand, even if you didn't deal with it much in school. I can only imagine it being messy if you are chaining a variety of things together without new-lining things. It uses the query functions in a way that's pretty human-readable
>>54528780
What the fuck is wrong with you?
>>54530775
ideas for both?
>>54528613
Learning cmake. Some of it makes sense. Some of it is retarded. Any other good build systems?
I'm adding some jailbreak tweak detection to one of the iOS apps I work on. Should come as a nasty surprise to those getting a free ride.
>>54530790
makefile :^)
>>54530779
nah[x * 2 for x in S if x % 2 == 0]
is a pretty retarded way to set up list comprehension syntax.
The logic starts at "S", which is in the middle. Then it get's filtered with "if x % 2 == 0", which is at the end. Then it get's mapped with "x * 2 for x in" at the start. I don't know what they were smoking, but I don't want any.
>>54530809
>jailbreakers are pirates
Scum.
>>54530819
cmake makes makefiles you dip ;p
Seriously, is it worth it to learn straight up Makefile syntax, or is cmake so much more easily maintainable for larger projects that it's the best way to go?
>>54530827
Jailbreaks aren't scum until they patch apps to get access to paid content.
>>54530843
I honestly never used cmake friendo so I didn't know that
>>54530822
>is a pretty retarded way to set up list comprehension syntax
The thing you posted literally sounds like a natural language sentence, wtf are you on about
>>54530822
Just from a 1-second glance I can tell it squares numbers in S if they are even. It follows a typical natural sentence structure
What are YOU smoking?
>>54530862
>The thing you posted literally sounds like a natural language sentence
That's why it's bad. It's bad for the reason i mentioned. Making shit "natural language" does not make them simpler. There's a good reason this sort of shit is barely used in programming langugaes.
>>54530872
>What are YOU smoking?
logic
>>54530874
>Making shit "natural language" does not make them simpler.
It looks simple to me. Maybe you're just retarded
>>54530843
>grunt
>gulp
>npm
Haha
>>54530888
>It looks simple to me.
Thats because you are an imbecile.
>>54530790
>good
>build system
Pick one.
They're all messy kludges to work around lazy compiler devs.
>>54530822
The only thing retarded about that is if instead of and.
Otherwise it's perfectly fine. Did you take anything in math beyond Calculus?
>>54530872
Except it doesn't do that, I think, I think if S is
{1,2,3,4} it outputs {4,8}.
>>54528613
I'm writing an S-expression printer/parser in Hasckell (innb4 doubble memme). I write my parser logic using Text.Parsers.Char, it's really nice being able to program to an interface rather than to an implementation. Because of that, I decided to do a wrapper for ParsecT so that I can have a MonadState instance on my user state. So far I havenewtype CharParser u a = Do { unDo :: forall s r. Stream s (Cont r) Char => ParsecT s u (Cont r) a }
instance Functor (CharParser u) where
fmap f (Do x) = Do $ fmap f x
instance Applicative (CharParser u) where
pure v = Do $ pure v
Do f <*> Do x = Do $ f <*> x
instance Monad (CharParser u) where
Do x >>= f = Do $ x >>= unDo . f
instance MonadState u (CharParser u) where
get = Do getState
put v = Do $ putState v
(No luck with GeneralisedNewTypeDeriving) But I also need MonadCont, and in this case, the naïve approach fucks up:instance MonadCont (CharParser u) where
callCC :: forall a b. ((a -> CharParser u b) -> CharParser u a) -> CharParser u a
callCC f = Do $ callCC $ \cc -> unDo $ f $ \v -> Do $ cc v
GHC says
[snip, next post]
I get what it means, but I can't find a way. How do I do this, /g/?
>>54530911
>{1,2,3,4} it outputs {4,8}.
You're right. I'm not wearing my glasses, thought it was **
>>54530937src/Helper/Parser.hs:21:57:
Couldn't match type ‘s’ with ‘s1’
‘s’ is a rigid type variable bound by
a type expected by the context:
Stream s (Cont r) Char => ParsecT s u (Cont r) a
at src/Helper/Parser.hs:21:14
‘s1’ is a rigid type variable bound by
a type expected by the context:
Stream s1 (Cont r1) Char => ParsecT s1 u (Cont r1) b
at src/Helper/Parser.hs:21:52
Expected type: ParsecT s1 u (Cont r1) b
Actual type: ParsecT s u (Cont r) b
Relevant bindings include
cc :: a -> ParsecT s u (Cont r) b
(bound at src/Helper/Parser.hs:21:29)
In the second argument of ‘($)’, namely ‘cc v’
In the expression: Do $ cc v
src/Helper/Parser.hs:21:57:
Couldn't match type ‘r’ with ‘r1’
‘r’ is a rigid type variable bound by
a type expected by the context:
Stream s (Cont r) Char => ParsecT s u (Cont r) a
at src/Helper/Parser.hs:21:14
‘r1’ is a rigid type variable bound by
a type expected by the context:
Stream s1 (Cont r1) Char => ParsecT s1 u (Cont r1) b
at src/Helper/Parser.hs:21:52
Expected type: ParsecT s1 u (Cont r1) b
Actual type: ParsecT s u (Cont r) b
Relevant bindings include
cc :: a -> ParsecT s u (Cont r) b
(bound at src/Helper/Parser.hs:21:29)
In the second argument of ‘($)’, namely ‘cc v’
In the expression: Do $ cc v
>>54528613
Have an excel spreadsheet I have to fill out and log what I did for the day to get paid. I keep forgetting until the last minute to fill out everything I did for the previous two weeks.
I've just been writing whatever my git commits say into my task descriptions for the day but that's tedious.
Just finished writing a small python script that's run as a post-commit hook which reads all commits since 00:00 of that day and writes it to the spreadsheet for me.
>>54530911
Why would "and" be better than "if"?[x * 2 for x in S and x % 2 == 0]
looks clear and more readable to you?
>I can tell it squares numbers in S if they are even
>It looks simple to me.
>it's perfectly fine.
what compelling counter arguments.
>>54530895
>it's a /dpt/ mercilessly but justifiably shits on js episode
>>54530977
You're retarded assuming only 1 person is replying to you
>>54530993
I didn't assume that. I was pointing something out about all the replies i got.
>>54530977
Yeah.
It's a short notation for construct a set by doubling the members of S that pass x%2 ==0.
Standard shit.
>>54530822SELECT x * 2
FROM S
WHERE x % 2 = 0
Nigga, this shit is intuitive as fuck.
>>54530908
Yeah, that's what I was dreading. It seems to work ok right now, but it's a shame that no language / compiler has a built-in kickass build tool
I feel like this is something Linus Torvalds should be doing.
>>54530977
Except x in S binds x, so it's not in the same category thanx % 2 == 0. and implies commutativity.
>>54530977
I'd prefer WHERE, but I'm a database guy, so...
>>54531008
This
>>54531007
Except it constructs a list
>>54531007
>Standard shit.
In what?
>>54531008
Then explain why instead of just saying it is.
>>54530977
you're being an obstinate moron right nowmap(lambda x: x*2, filter(lambda x: x%2 == 0, S))
isn't much more clear
it's the same thing really
>choosingfilter(lambda x: x % 2 == 0,
map(lambda x: x * 2, S)
)
>over[x * 2 for x in S and x % 2 == 0]
Yeah nah family, I prefer the construct that makes sense if you've done basic math or english
>>54531037
In fucking math. Don't CS majors have to take baby's first number theory and abstract algebra aka discrete math?
>>54531039
i agree.S.filter(x => x%2 == 0).map(x -> x*2);
is. You can read the logic left to right very easily. You can reorder and extend the operations easily too.
>>54531039
Be real.(for/list ([x S] #:when (zero? (remainder x 2))) (* x 2))
Schemic syntax is so consistent: almost everything is an expression, and binding goes before usage.
>>54531037
>Then explain why instead of just saying it is.
It's intuitive for the same reason that TSQL is easy to learn and reads like English.
>Show me all of element 'x' from the set 'S' where x is even.SELECT FirstName, LastName
FROM Students
WHERE LastName LIKE '%stein'
>Show me the first and last name of all of the jews at this school.
Pretty basic understanding of properties of groups of things.
>>54531037
Set comprehension
Closer to English (you know, the thing languages try to approach through abstraction?)
>>54531008
It doesn't make it explicit that x is being drawn from S, a big syntax bad design to me.
>>54531070
Math notation doesn't make it into programming very much, unless there's no clearer way of describing the logic of what you want the computer to do.
>>54531104
>It doesn't make it explicit that x is being drawn from S
Yes, it does.
The explicitness comes from the FROM keyword.
>Show me this element, from this set, but only things that meet these conditions.
>>54531104
S is the only table there. It's an illegal query if x wasn't in S. It's only ambiguous when 2 or more tables are involved
>>54531102
>DWIM meme
M8 do you even Tractatus Logico-Philosophicus? Language restricts thought, better have as many different ones as possible to choose from.
>>54531116
>I like stagnation over clarity
Thanks for clarifying
>>54531116
You misunderstand the fucking point of programming then. Programming is all about abstraction. You shouldn't give a fuck how python gives you that list.
You try to avoid telling the computer what to do, but try to tell the computer what you want.
>>54531128
what comes from S? it doesn't explicitely define x: the variable name is just floating around in the SELECT and WHERE parts, and you're supposed to guess its contents will be drawn from S without explanation.
>>54531129
Wait x isn't a local name? It's a column name? I admit I don't know SQL. What do you do when two tables have a column with the same name and you want both?
>>54531129
>It's only ambiguous when 2 or more tables are involved
Which is why any sane DBMS forces clarification when there is ambiguity.
The following query is not valid in most DBMS, given a common 'FirstName' column:SELECT FirstName, LastName
FROM Students s
JOIN Teachers t ON t.TeacherID = s.TeacherID
You would need to specify:SELECT s.FirstName, s.LastName, t.FirstName, t.LastName
FROM Students s
JOIN Teachers t ON t.TeacherID = s.TeacherID
>>54531158
If you're in a giant cushy interpreter, sure.
Feel free to ignore the implementation details of the list.
That shit doesn't fly if you actually want to write the interpreter tho.
>>54531170
>>54531174
question answered in fact. I opiniate that it's an acceptable shortcut.
>>54531170
x is a column, or element of the table, or set S.
See >>54531174
>>54531170
>What do you do when two tables have a column with the same name and you want both?
`table1 name`.x
`table2 name`.x
you can use an alias like >>54531174 posted
>>54531174
Off course
>>54531176
You realize that programming languages are abstractions of assembly/machine code right?
Objects and OO-languages can be written in C, for example since it's close to assembly. That doesn't mean people should use non-OO structures for emulating OO functionality, when an OO language can give you that functionality easily
Same goes with choosing to implement functional programming in C (which I'm sure some are) over just using a functional programming language
So why limit yourself when it comes to simple and short list comprehensions?
>>54531189
>>54531196
How bad does it feel that SQL can't into α-conversion?
>>54531176
>That shit doesn't fly if you actually want to write the interpreter tho.
THANK YOU CAPTAIN OBVIOUS.
Plus it's not even true, PyPy exists. Also bootstraping techniques, etc.
>>54528971
While ess queue ell is the logical choice, for some reason its officially called sequel
>>54531244
Well I'm sure none of us own SQL or suck a querying language's dick. It queries shit easily and that's all you need
>>54528971
>>54531268
ès cul elle de mon côté
>>54528971
I have never heard anyone call SQL sequel. It's less common then people pronouncing laTeX as latech.
>>54531302
Heard it all the time in my first IT job
It was a huge change from online since you can't hear what people type
>>54531129
saying "select x from s" sort of makes sense naturally. But something more like "foreach x in s" is a bit more natural. "select x from s" doesn't make a lot of sense to someone who doesn't know SQL and doesn't know what select and from are meant to do exactly. Maybe "x" is meant to represent the id of a single item in "s" that is meant to be "selected" whatever that means in this context. Maybe "select" just means you mark the item somehow instead of just returning them. You need to know what all the terms means in the language to know what's meant to be happening, it's not easy to guess with the natural language hints.
"select x * 2 from s" makes even sell sense. It basically means takes every value from s and multiply it by two and return that new collection of values. It's a weird way of performing two operations with a single simple statement. If "select x from s" is meant to read as "pick all the apples from the apple pile", then "select x * 2 from s" sort of reads as "select all the red apples from the apple pile", except what you are really asking is for all the apples to be picked out of the pile and painted red, and not picking out only the red apples. "select x * 2" sounds like you are making some kind of condition on what should be selected, and not transforming all the stuff you collect.
I can stand this stuff easier in SQL, because SQL is so simple you never need to make very complex queries with it, so this kind of shit is almost worth it for the extra conciseness. But it's hardly intuitive.
>>54531302
>I have never heard anyone call SQL sequel
I hear it all the time. Though i call it "S Q L" myself.
Im doing this OpenGL tutorial http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/
When I copy paste the first line of code it asks forGLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);
I get Segmentation fault (core dumped)
what am I doing wrong? I copy pasted just like the code asked, and when I remove the code it works like it is supposed to again.
>>54531158
kys
>>54531358
Did you skip the first part or something?
The only other explanation I can think of is that your hardware SOMEHOW doesn't support VAOs, which is very unlikely.
>>54531346
>"select x * 2 from s" makes even sell sense
Well it wouldn't to someone who doesn't know SQL. That has nothing to do with list comprehension syntax which makes English sense
>>54531387
No, the first part of the tutorial just werks.
>>54531346
>because SQL is so simple you never need to make very complex queries with it
Anon, you don't know the half of it. Shit gets weird when you're over 200 lines on one query.
In the real world, you don't name a column 's'. It makes more sense if the column has an appropriate name.
>>54531302
Most American professionals pronounce it as 'sequel'.
>>54531386
I'm assuming you program in machine code or assembly professionally then? Either way you should kys first
>>54531428
kill yourself idiot, computer programming is telling a computer what to do, you're programming the computer, anything else is made up faggy bullshit
>>54531386
I hope you program in machine code otherwise you're a hypocrite. Oh wait even if you did, you'd still be a hypocrite because machine code is an abstraction.
>>54530656
Looks cool. How did you do it?
>>54531428
>>54531456
nice samefag butthurt fag
>>>/g/wdg
>>54531411
make your GLuint type global. see if that makes a difference
>>54531400[x * 2 for x in S if x % 2 == 0]
it's not clear when the "x * 2" is performed, before or after the filter. Because it's the first thing you read from left to right you might guess it happens before, but it doesn't. "if" can also be interpreted to mean, only do any of this shit "x % 2 == 0". "where" would make more sense then "if" here. You need to know what it means ahead of time. No one who didn't know python could read this and reliably tell you what's meant to happen.
>>54531411
I can't determine the root cause, but I believe what's directly causing the segfault is that glGenVertexArrays and/or glBindVertexArray haven't been loaded. They're actually function pointers, and when you call glewInit, if your OpenGL device/context supports them, they're set to point to the actual calls within the driver.
>>54531346
>I can stand this stuff easier in SQL, because SQL is so simple you never need to make very complex queries with it
Try using it professionally where your queries will need to be in SQL to take advantage of its speed and join/group capabilities
You have no idea how many people fail this sort of easy question in job interviews where SQL is used a little, or use some convoluted solution:
Given
- Table 1 which lists people
- Table 2 which lists animes
- Table 3 which is the many2many table joining people to animes they've watched
Append a column to Table 1 which contains a comma-separated list of animes a person has watched
>>54531457
It's nearest neighbor coloring on random dots. He decided to have lots of colors though. I think you only need 4 due to some map theorem or something.
>>54531452
>telling a computer what to do
Sounds like abstraction, you can't use that shit, you should be controlling the electric currents directly
kys
>>54531423
>Anon, you don't know the half of it. Shit gets weird when you're over 200 lines on one query.
>tfw generated a query that's 2k lines long using a fuck ton of LIKE statements
>tfw worried that sub queries would slow it down
was fast once I got the indexing in but holy fuck if there is a single error in the generated query it sucks ass to find.
>>54531496
nice black and white thinking IDIOT
>>54531478
>it's not clear
Shit you're right, this construct which tells me to double everything in S if it's even sure is hard to understand lmao
>>54531469
Lol. Stupid Smug C weenie who thinks C is a low level language calling samefag.
>>54531483
This nigga is right.
>>54531516
kill yourself webcuck
>>54531236
not many functional languages are implemented in C
most are bootstrapped or written in ML
a few occasionally might be written in Scheme (which, if you count as a functional language, would prove your point because of things like Guile which are written in C)
but in general, functional languages are implemented in functional languages because C and imperative languages make it much more verbose to express any language with a syntax more complex than that of Scheme
>>54531507
You too idiot
It's funny because just a little while ago this guy complaining about high level languages was shilling Java every chance he could get.
>>54531484
wouldn't you just insert table3s column into table 1 based on the people that match? this is assuming table 1 has the column already in it but just is empty.
>>54531535
joke's on you, you're the idiot, and you're stuck using garbage langs like python lmfao kill yourself idiot
>>54531346
>because SQL is so simple you never need to make very complex queries with it
Naw son, there's cases where performance requires complexity.
Posting in a classic /dpt/
>>54531529
That's not my point. Even in python, functools, closures, higher-order functions, etc are written in C. The point is that it's possible, but languages are made to abstract the implementation, for increased productivity
>>54531554
That's true i guess. I'm not a big SQL guy, so never been exposed any any serious SQL work. I just do a few selects, where's and joins and call it a day for the most part.
>>54531547
>based on the people that match?
It's many to many
>>54531561
>languages are made to abstract the implementation, for increased productivity
except python is a horrible joke of a language, useless for pretty much everything except for being slightly better than php for database webshit
>>54531549
I actually believe in abstractions and use C. I just know and acknowledge it's an abstraction rather than being a retard thinking it's low level.
Protip: variables and pointers are a C abstraction.
>>54531561
oh yeah I agree with you about the abstractions I was just disagreeing with that specific claim
>>54531580
i never said C was low level or that it doesn't have abstraction nice strawman argument retard
Does /dpt/ write...
if(result)
return 0;
else
return 1;
or{
...
if(result)
return 0;
return 1;
}
?
>>54531561
Functional programming is not even inherently very abstract.
>>54531578
Python is an example because we're talking about its list comprehensions
Why use OO languages when you believe you should worry about the implementation details, and OO structures and functionality is an abstracted form of something slightly lower-level?
Same with FP languages
Same with other paradigms like aspect-oriented, or reflective. Why use them when 'you should worry about the implementation'
>>54531593
My bad then too famalam
>>54531599if (result) {
return 0;
} else {
return 1;
}
>>54531599
nevermind the brackets in the second code snippet
>>54531599return !result;
>>54531474
>>54531483
I'm extra confused, I copy pasted the completed tutorial code in, that threw a different error, codeblocks crashed, I blanked everything and then copy pasted tutorial 1 in again, and now it works suddenly.
Thanks for your help.
>>54531599
return result
>>54531611
>list comprehensions
ha
GAY!
>>54531599return (result);
also
NEW THREADDDU
>>54531622
New thread: >>54531622
>>54531605
It is an abstraction of machine code. FP lets us express functional concepts in a more english way
>>54531620
>>54531617
Doesn't work if something is considered true or false under different conditions, or if bools can not convert to numbers
>>54531628
Still just an example
>>54531457
I brute forced it, it is called a voronoi diagram and it is based off the distance between the points using euclidean distances
>>54531642
>Doesn't work if something is considered true or false under different conditions
what
>or if bools can not convert to numbersreturn result ? 0 : 1;
>>54531611
>OO
Meme just use closures, tables and dispatch procedures
>closures
Meme just explicitly modify an environment table
>table
Meme just use linked lists and car/cdr
>linked lists and car/cdr
Meme just use .....
>>54531572
oh fug I missed that
are there any unique identifiers so that you can relate table 1 with table 3 in some way other than people names?
>>54531682
Table 1 (people) - id
Table 2 (anime) - id
Table 3 (m2m) - person_id -> people.id, anime_id -> anime.id
>>54531701
can you insert based on the persons ID that matches with the person id on table 3?
>>54531484
how the fuck would you do the comma separated list part, actually?alter table t1 add colum anime_list varchar(40) multiset;
with animes as
(select *
from t3
group by person_name)
update t1
set anime_list = animes.anime_name
where t1.person_name = animes.person_name;
but this would make a multiset instead of a csv list
>>54531618
Same guy again, now whenever I type
GLuint programID = LoadShaders( "SimpleVertexShader.vertexshader", "SimpleFragmentShader.fragmentshader" );
like it tells me to my program prints:
>Impossible to open SimpleVertexShader.vertexshader. Are you in the right directory ? Don't forget to read the FAQ !
I read the FAQ and it doesn't tell me anything helpful. http://www.opengl-tutorial.org/miscellaneous/faq/
>>54531758
its many to many
>>54531792
syntax depends on your database. In MySQL, you have group_concat. Joins make it simpler
Started looking at Python and coming from C, it looks a mess with 2 vs 3.
Seems the easiest option is to go with 2, but it seems counter-productive.
>>54532009
>its many to many
so just do an sub query on table 3 using a group_by person_id and then set anime list where table1.person_id = sub query.person_id
After about 3 years of only using MatLab, Mathematica and at the most incredibly basic Java, I'm trying to make TypeScript work.
Turns out using a real programming language means your code is cluttered as fuck since you can't just use a pre-installed function to do most of the trivial work.
In short, I'm out of my safe zone and I don't like it.
>>54532410
Do you use DRY. It's designed to declutter your work, and you can end up with code like matlab, except you have to define your functions. If you can't or won't do that, you're not gonna make it.
>>54532410
matlab and mathematica are disgusting as shit
in a real programming language like java you just have to know a small set of well-defined rules (which you can easily keep in your head all at once) and then you can do anything and write your own functions and use libraries (sets of pre-made functions)
>>54532410
also
>TypeScript
is not a real programming language, any javascript is fucking shit