This is /dpt/, the best subreddit of /g/
Umaru-chan edition, the best of all editions.
In this thread:
r/programming
r/compsci
r/ReverseEngineering
r/softwaredevelopment
code of conduct:
no racism
no insult
no sexual harassment
no gender discrimination
wat r u working on, anon-chan ?
Thank you for using an anime image and including a code of conduct. Also, congratulations on being gilded.
nice
edit:
thanks for the gold kind stranger
>>52289834
How do you edit posts on here?
3rd for Python is fast.
What does /dpt/ think of Khan Academy?
Daily reminder that Python libraries are written in C because Python is shit.
Umaru is literal cancer. Can someone start a new thread? Fucking weebs
>>52289874
Fuck off
>>52289874
Why don't you do it?
Is Atom good?
>>52289854
KHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN
>>52289874
>Umaru is literal cancer.
why
>>52289901
reddit.com/r/umaru
>>52289901
People think she's cancer because she's a meme
>>52289899
heh.
>>52289880
Shut the fuck up
>>52289854
the math parts aren't so bad, science stuff sucks balls though
>>52289901
It has horrible animations and is meant for actual pedophiles.
>>52289928
Thanks for the upvote
>>52289852
like this
edit:
test
>>52289917
https://www.youtube.com/watch?v=3g9E2qZpfyY
>>52289970
Gonna try it out
Edit:
Lol, it works
Reddit posters, ironic or not, trapfags, and weebshits, please promptly leave so the adults can post.
>>52290033
No, Downvoting your post.
>>52290033
>this mad
I've been lazy legitimately haven't wrote any code for over a month.
>>52290056
I was being polite and you call me mad anyway. Your go-to is thinking someone is mad and therefore you win.
This is the mentality of weebs. It's also the mentality of children, unsurprisingly.
l m a o
>>52290098
Calm down seriously
>>52290098
I'm going to be serious this post and say you should back to reddit. You don't belong here.
Ask your favorite programming literate anything.
>>52289791
Thank you for Umaru o(>.< )o
>>52290098
>being this mad
I bet you're the python fetishist from the last thread.
>>52290158
C programmer, actually. Python a shit.
>>52290135
>>52290109
Well the weebshits have spoken. Moving on.
>>52290178
You don't even program
>>52289863
Daily reminder that C# libraries are written in C because C# is shit.
I didn't see there was a new thread.
>>52290151
>>52290205
... I don't use C#
>>52290210
DUDE WEED
>>52290205
No, in C++.
>>52290205
A lot of them are actually C#.
is there haskell implementation on lists that applies functions to elements of lists such as[e1,e2,e3,e4, ...]
[foo e1 e2, foo e2 e3, foo e3 e4, ...]
>>52290205
Most of them are in C#.
>>52290513
mapwith foo l (drop 1 l)
>waifu/anime arguments
>literal reddit-tier shitposting
>zero programming discussion
wew lads
>>52290554
You meanzipWith
>>52290554
>>52290568
And use tail instead of drop 1crush :: (a -> a -> b) -> [a] -> [b]
crush f xs = zipWith f xs (tail xs)
>>52290568
Yes. I didn't use Haskell for a long time.
>>52290582
And now, even more point-free!crush f = zipWith f <*> tail
>>52290582
tail and drop 1 aren't the same thing?
>>52290609
I suppose so, since "tail" doesn't work on an empty list
However, it doesn't end up mattering, because if the first list is empty, "zipWith" doesn't even consider the second list (thanks, lazy evaluation)
>>52290634
Ho, you're right anon. drop doesn't fail on an empty list.
>>52290672
I was more alluding to "tail" being shorter and not requiring an application like "drop 1", but yeah
>>52290597
I don't know whether I should be impressed by the elegance or disgusted by the opacity that syntax.
>>52290715
Yeah, it takes some practice to get used to obscenely pointfree function definitions -- you have to be able to "apply" the combinators in your head
In this case, (<*>) is the S combinator for functions:f <*> g = \x -> f x $ g x
-- so
zipWith f <*> tail = \xs -> zipWith f xs $ tail xs
Is there any way of doing unsupervised clustering of images in a directory? Closest I've found so far is doing supervised clustering with bag-of-words in OpenCV.
i'm
>>52290513
i should mention that e1 is a data such as
data T = T Int Int
and i would like to do something likee1 = T 1 11
e2 = T 3 13
foo (T a b) (T c d) = undefined
foo2 :: [T] -> [newT]
foo2 xs = undefined -- should return [foo xs1 xs2, foo xs2 xs3, and so on]
What does /g/ think of my code? Pls be gentle (I'm a girl btw)char change_case_of_letter (char c)
{
if (c == 'A') return 'a';
if (c == 'B') return 'b';
if (c == 'C') return 'c';
if (c == 'D') return 'd';
if (c == 'E') return 'e';
if (c == 'F') return 'f';
if (c == 'G') return 'g';
if (c == 'H') return 'h';
if (c == 'I') return 'i';
if (c == 'J') return 'j';
if (c == 'K') return 'k';
if (c == 'L') return 'l';
if (c == 'M') return 'm';
if (c == 'N') return 'n';
if (c == 'O') return 'o';
if (c == 'P') return 'p';
if (c == 'Q') return 'q';
if (c == 'R') return 'r';
if (c == 'S') return 's';
if (c == 'T') return 't';
if (c == 'U') return 'u';
if (c == 'V') return 'v';
if (c == 'W') return 'w';
if (c == 'X') return 'x';
if (c == 'Y') return 'y';
if (c == 'Z') return 'z';
if (c == 'a') return 'A';
if (c == 'b') return 'B';
if (c == 'c') return 'C';
if (c == 'd') return 'D';
if (c == 'e') return 'E';
if (c == 'f') return 'F';
if (c == 'g') return 'G';
if (c == 'h') return 'H';
if (c == 'i') return 'I';
if (c == 'j') return 'J';
if (c == 'k') return 'K';
if (c == 'l') return 'L';
if (c == 'm') return 'M';
if (c == 'n') return 'N';
if (c == 'o') return 'O';
if (c == 'p') return 'P';
if (c == 'q') return 'Q';
if (c == 'r') return 'R';
if (c == 's') return 'S';
if (c == 't') return 'T';
if (c == 'u') return 'U';
if (c == 'v') return 'V';
if (c == 'w') return 'W';
if (c == 'x') return 'X';
if (c == 'y') return 'Y';
if (c == 'z') return 'Z';
}
>>52290869
misses unicode support
otherwise fine
>>52290869
what is your CoC
theres so many elitists here I'm waiting for someone to call assembly a shitty language.
I guess machine code master race?
>>52290869
well.. at least it's not a switch statementchar swapcase(char c)
{
if (isupper(c))
c = tolower(c);
else
c = toupper(c);
return c;
}
>>52290869
I'm triggered
How meme is D?
>>52290922
Wouldn't a switch statement be faster than this though? Assuming they don't both optimize down to the same thing.
>>52290869
Just flip the 6th bit
>>52290869
>>52290869static inline char _tolower(const char c)
{
return c | 0x20;
}
>>52290944
how's this?void swapcase(char *c)
{
if (*c >= 'A' && *c <= 'Z')
c += 32;
else if (*c >= 'a' && *c >= 'z')
c -= 32;
}
I have a list of movies. What would be a good way of finding the (original) language of each movie? Some crawler bot for imdB? I'd rather not do it manually obviously.
I was thinking, if I have the imdb ID of the film, could I write a script to use the imdb-- o imdb doesn't provide an API...
any idea /g/?
Last weekend a guy here had a very good question, basically he wanted to inherit the functions of a grandparent class publicly when the parent class had been inherited privately. He wanted C to inherit ALL the functions of A in one go. Obviously it would be easy to just say using B::A::foo(), but he would have to do that for each function annoyingly. There are obviously ways of re-factoring the below code to do that with friend functions, or C publicly using A as a parent, etc... But the question is can it be done with this grandparent style inheritance?#include <iostream>
using namespace std;
class A { void foo(){ cout << "foo"; } };
class B : public A { void goo() { cout << "goo"; }};
class C : private B {
using B::A;
};
int main() {
C c;
c.foo(); // Should be accessible
//c.goo(); // Should not be accessible
return 0;
}
>>52290869char change_case_of_letter(char c)
{
if (c == 'A') {
return 'a';
} else {
if (c == 'B') {
return 'b';
} else {
if (c == 'C') {
return 'c';
} else {
if (c == 'D') {
return 'd';
} else {
if (c == 'E') {
return 'e';
} else {
if (c == 'F') {
return 'f';
} else {
if (c == 'G') {
return 'g';
} else {
if (c == 'H') {
return 'h';
} else {
if (c == 'I') {
return 'i';
} else {
if (c == 'J') {
return 'j';
} else {
if (c == 'K') {
return 'k';
} else {
if (c == 'L') {
return 'l';
} else {
if (c == 'M') {
return 'm';
} else {
if (c == 'N') {
return 'n';
} else {
if (c == 'O') {
return 'o';
} else {
if (c == 'P') {
return 'p';
} else {
if (c == 'Q') {
return 'q';
} else {
if (c == 'R') {
return 'r';
} else {
if (c == 'S') {
return 's';
} else {
if (c == 'T') {
return 't';
} else {
if (c == 'U') {
return 'u';
} else {
if (c == 'V') {
return 'v';
} else {
if (c == 'W') {
return 'w';
} else {
if (c == 'X') {
return 'x';
} else {
if (c == 'Y') {
return 'y';
>2000 character limit
fuk
>>52291014
bruh
http://www.omdbapi.com/
>>52290998
Or you could just go for
void swapCase (char &c)
{
c += (c > 95 ? -32 : +32);
}
>>52291042
double triggered
char SwapCase(char c)
{
if (c < 'A' || c > 'z') return c;
return c + (c < 'Z') ? 32 : -32;
}
>>52290869
me too but that code makes me sick
require 'Open3'
ORIGINAL = 'E:\\original'
COPY = 'F:\\backup'
#LOGS = '.\\kd_unison' Not used yet.
UNISON = '.\\unison.exe'
def no_dir(dir)
raise "The '#{dir}' directory does not exist. Quitting."
abort('Directory Find Failure.')
end
if(!Dir.exist?(ORIGINAL))
no_dir(ORIGINAL)
end
if(!Dir.exist?(COPY))
no_dir(COPY)
end
if(!File.file?(UNISON))
raise 'The unison executable cannot be found.'
abort('Unison Find Failure.')
end
args = " \"#{ORIGINAL}\" \"#{COPY}\" -batch -force \"#{ORIGINAL}\""
output, status = Open3.capture2(UNISON + args);
Goal is to mirror one Windows folder to another partition using Unison and to log any failures or read-permission issues.
Need advice on the if statements (it's ugly). Language is Ruby.
>>52291042
what are you even doingchar toLowerCase(char c)
{
if (c == 'E') return 'e';
if (c == 'A') return 'a';
if (c == 'O') return 'o';
if (c == 'I') return 'l';
if (c == 'U') return 'u';
if (c == 'B') return 'b';
if (c == 'C') return 'c';
if (c == 'D') return 'd';
if (c == 'F') return 'f';
if (c == 'G') return 'g';
if (c == 'H') return 'h';
if (c == 'L') return 'i';
if (c == 'M') return 'm';
if (c == 'N') return 'n';
if (c == 'P') return 'p';
if (c == 'R') return 'r';
if (c == 'S') return 's';
if (c == 'J') return 'j';
if (c == 'K') return 'k';
if (c == 'T') return 't';
if (c == 'Q') return 'q';
if (c == 'V') return 'v';
if (c == 'W') return 'w';
if (c == 'X') return 'x';
if (c == 'Y') return 'y';
if (c == 'Z') return 'z';
return '!';
}
you can use that for free
function swapcase(c) {
try {
c = String(c);
} catch (e) {
return "";
}
if (c === c.toLowerCase()) {
return c.toUpperCase();
} else if (c === c.toUpperCase()) {
return c.toLowerCase();
} else {
// ?
return c;
}
}
One of my friends who started CS the same year as me was talking about C.
>C is dangerous like if you are not careful you might delete System32
I fucking hate people.
>>52291180
Holy shit why did none of you fags warn me
>>52291180
>CS major using Windows
REEEEEEEEEEEEEEEE
>tfw can't get into CS because my math grades from 7 years ago are too low
>>52291125
Upper and lower case aren't next to each other, there are a few symbols in between.
>>52291249
>tfw living in a non americuck country where shit don't matter
>>52291226
It might delete your unix32
>>52291180
He's right. Prolonged use of C will lead to severe autism, causing the victim to switch to a Linux distro and thus delete system 32.
>Your favorite book on computers /g/?
Computer Systems: A programmer's perspective for me, Followed closely by Numerical Recipes in C++.
swapCase c
| isLower c = toUpper c
| isUpper c = toLower c
| otherwise = c
rate my haskell /dpt/ :3
>>52291299
shit language/10
>>52291289
I really like 'C++ Failed By Design' :DDDD
Why are 99% of programmers fucking horrible at programming?
>>52291180
Math majors are usually better coders. Don't major in CS.
Started using flex/bison. It's like these tools weren't meant to work together.
If in flex I do:%option prefix="foo_yy"
And in bison:%define api.prefix {foo_yy}
Bison uses macros like FOO_YYSTYPE and flex still uses YYSTYPE, doesn't rename its macros. So I have to fix its shit and now it looks all hacky.
It's not the first problem I have getting them to work together, fuck this crap.
>>52291342
>too dumb to understand so it must be bad
k tard. do you even know functional programming?
>>52291409
enlighten us mr hacker man
>>52291425
No, please don't. Functional programming is fucking cancer.
I can either go with scraping YouTube pages or use the YouTube API. My autism tells me scraping is better because me security, but the lazy person in me tells me to use the API.
Hello friends, I have a design pattern question for you.
Has any of you worked with Dependency Injection? Does it bring really any benefit to my project or the difference is minimal? Is it worth learning and implementing?
>>52289791
>no sexual harassment
Do a autofellatio, faggot.
>>52291352
>outsourcing
>poo in a loo
Guess why
This is your friendly reminder /dpt/ that Lisp is superior to C.
VDHL > Lisp > C
>>52291513
Especially on complex non-real architectures
Daily reminder that if you don't program while dressed like a schoolgirl, you don't belong on /dpt/.
You can redeem yourself by buying a schoolgirl outfit and a copy of The C Programming Language (2nd Edition) by Kernighan and Ritchie, preferably in the same amazon cart.
Does /dpt/ have any Android programmer?
Is 0 a real number, an imaginary number or a complex number?
>>52291655
Sadly I am.
>>52291663
It's a real integer value, that's enough for me.
So I got a verbal offer to work at a startup, and they said they can't get me a contract until february because they're forming a new company still. They told me I could work without a contract until then.
Does this sound like a bad idea? I wouldn't even consider it but I know the CTO really well.
>>52291485
what's the backstory of this pic ?
>>52291667
How deep are you in?
I am a beginner Android programmer studying by myself while looking for a job. It would be great to learn from someone more experienced.
>>52291726
2 years full time and 2 years part time.
>>52291739
>>52291667
Are you a poo in loo?
>>52291716
>Does this sound like a bad idea?
Yes.
>>52291755
I poo in loo.
>>52291716
yea they'd be stupid to let you work without a contract, since they wouldn't own any of the work you do.
you could do it anyways, then if they like what you make and want it, hold it hostage in exchange for 40% of the company.
>>52291739
That's cool.
Do you work with Native development?
>>52291663
Yes to all 3.
>>52291663
None of them. It's the null set.
>>52291783
Not a lot, but I've done some JNI stuff.
[spoiler]It's shit.[/spoiler]
Is there a way to set up a Google account without authenticating by telephone?
>>52291821
Another email address, I think.
>>52291802
I guess you didn't get my question.
Do you work using Android Studio and Java or Phonegapp, Xamarin, etc?
>>52291794
bullshit it isn't
that's completely meaningless
Java a shit
>>52291846
I thought you meant NDK.
We use Java with the Android SDK. No cross platform meme shit here.
>tfw I used Phonegap
I have a question on all you geniuses.
is Python a good language to begin programming?
>>52289834
>>52289791
:^)
>>52291846
not him but i've done android dev using native as well as ionic.
if you're looking to do cross platform, React Native seems to be the best route (ionic a shit) but it's only in beta for android i believe
>>52291872
Noice.
How to git gud in Android Development?
>>52291921
Praise material design and good fortune will come to you.
>>52291951
hello reddit
>>52292032
What the fuck am I supposed to respond to 'how to git gud at x'?
>>52291794
0 != null
Is there any point to learn c over c++?
Seems like every fucking library/framework ever is made with c++.
>>52292171
That's partially why C++, Java, and C# are all hugely popular.
They got popular, then people built libraries for them. This ensures they stay popular, due to ease of use and preexisting tools.
what do you think of it?
How do libraries work in non-OOP languages?
>>52292222
epic quadz /b/ro
>>52291513
HAHAHAHahaHsjh/ihjglkjh;o oh you're serious.
Kill yourself.
>>52292229
quads dont lie
>>52291368
Bullshit. I'm a CS undergrad and I've given advice to a Math grad doing a masters in CS on how to program in Java.
I know people with A-grade A levels in Maths who can't program for shit.
>>52292228
Non-OOP languages also have data objects. Just procedures that work on that data.
>>52292222
>oh no my name is on 4chan
>>52292171
Lolwut? Tons of libs have c bindings.
>>52292218
>mixing C# with C++ and Java.
Calm down microsoft shill.
>>52292228
Either a keyword (like extern in c), or a module definition like Haskell.
https://en.wikibooks.org/wiki/Haskell/Modules#Exporting
>>52291951
I actually really like Material Design, UI and UX.
Sorry for the delay, hope you're still here.
>>52291663
It's the neutral element of an additive monoid. It might coincide for several monoids over the same set.
Anon modeling CS:GO buys, are you still here?
>>52292510
Yes
>>52292420
Than Android development is right up your alley. Any Android application basically comes down to this:
>Authenticate with REST API
>Pull content
>Display content
>Iteract with content (i.e. play video, share to social media)
If you can package that in a proper UI, you're an Android developer.
>>52290996
Not wholly equivalent. Program should do nothing in the case of non-alphabetic characters. It should also accurately convert lowercase to uppercase.
>>52290998
Not bad, but I'll so you one better:char swapcase(char c)
{
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
return c ^ 32;
}
>>52291663
it's a real number and an imaginary number and since both sets are subsets of the complex set it is also a complex number
>>52290155
Won't bother searching on wikipedia...
What are dependent types and why are they useful? Are languages supporting them (Idris, Adga, f*) worth learning?
>>52289791
For background I'm new to programming.
I've spent the last week slowly grinding through creating a (console-line) playable version of blackjack against a dealer on Visual Basic.
Do you know of a cross-platform library that will allow me to display desktop notifications? Preferably with Haskell bindings
>>52292628
your question lad?
>>52292636
>Haskell bindings
No.
I've been thinking of building a PC for a while as my POS laptop is a POS. I would use the PC mainly for programming and probably light gaming as well. Should I bother getting windows or will Linux be just fine?
>>52292734
Do you understand what "preferably" means? If it's in C I could simply wrap it through the FFI
>>52292654
Why does his post need a question?
>>52289791
>wat r u working on, anon-chan ?
>>52292555
did you consider reducing your data set to items you can make sense of? And maybe favor more probable item sets for the rest. For example, if T spends 2700$, just assume he bought a AK instead of considering less popular but still possible options, like buying a P90 and some other shit
>>52292766
not actually him, i was just in it for the trips.
>tfw you finally grok the notion that types are higher groupoids
>>52292932
elaborate pls
>>52292577
Guess my line of thought isn't that wrong then.
I just have some trouble with the Authenticate with Rest API part.
>>52292947
It's most likely an hard coded key/secret or an OAuth2 authentication. Nothing special.
>>52290944
> Wouldn't a switch statement be faster than this though?
Most of the <ctype.h> functions are typically macros which use a lookup table.
Also, the <ctype.h> functions are locale-sensitive, whereas hard-coded logic isn't. That can be either an advantage or a disadvantage.
write(' What's the most beautiful algorithm, anon ?');
>>52292292
> Tons of libs have c bindings.
Any function which is callable from C is also callable from C++, but the converse isn't true.
>>52293175
Yes, but calling C from C++ feels cancerous
>>52293165for i in range(1,101):
print("FizzBuzz"[i*i%3*4:8--i**4%5] or i)
>>52293165
bogosort
christmas edition.#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define ARRMAX 32
int check (int *array) {
for (int i=0; i<ARRMAX-1; i++)
if (array[i] < array[i+1]) return 0;
return 1;
}
void printarray (int *array) {
for (int i=0; i<ARRMAX; i++) {
int color_chance = rand() % 5;
char color_string[5];
switch (color_chance) {
case 0:
strcpy(color_string, "\033[32m"); break;
case 1:
strcpy(color_string, "\033[31m"); break;
default:
strcpy(color_string, "\033[0m");
}
printf("%s%02X%s ", color_string, array[i], "\033[0m");
}
putchar(10);
}
int main (void) {
int sorted = 0;
int unsorted[ARRMAX];
srand(time(NULL));
for (int i=0; i<ARRMAX; i++) {
unsorted[i] = rand() % 100;
}
while (!sorted) {
for (int i=0; i<ARRMAX; i++) {
int choice = rand() % ARRMAX;
int temp = unsorted[choice];
unsorted[choice] = unsorted[i];
unsorted[i] = temp;
}
printarray(unsorted);
sorted = check(unsorted);
}
puts("SORTED!");
printarray(unsorted);
return 0;
}
>>52293189
Ho shit it works. I have to understood that code.
>>52291425
>mr
>man
did you even read the OP? fuck off
>>52292945
In set theory, you just have sets and elements.
In intensional type theory, for each inductive type, you have values, and for each value, an equality type (which has a single inhabitant: the proof of reflexivity).
In homotopy type theory, or any type theory with a model of higher inductive types, there's an infinitely large "structure" of equality types:
a == b
(a == b) == (c == d)
((a == b) == (c == d)) == ((e == f) == (g == h))
and so on, and while each is inhabited by a proof of reflexivity, the higher inductive type lets you add additional values (paths) of any of these equality types. HITs are particularly useful because they let you specify quotient sets, like the integers:data Int : Set where
Zero : Int
Succ : Int -> Int
Pred : Int -> Int
Id_SP : (x : Int) -> x == Succ (Pred x)
Id_PS : (x : Int) -> x == Pred (Succ x)
Notice how I can define new values of the equality types.
Somehow, this higher groupoid structure is what lets HoTT admit the univalence axiom.
Who stockfighter here?
I'm on level 3. Do I just need to have orders selling for less and buying for more to be a market maker? Cancel every time I see new orders on the books via the websocket and adjust the price?
>>52291139
abort is pointless since raise completely prevents it from being reached.
You don't need parenthesis right after an if statement, the line break works just as well, and if you want to be dumb you can use the then keyword. You need the parenthesis around the arguments AFAIK
if not is unless
you can use postfix unless like so:raise no_dir(ORIGINAL) unless Dir.exists?(ORIGINAL)
I don't know Ruby that much tho. Bonus question:Is there a complete, structured, and usable reference on the whole Ruby language? ruby-doc.org is awful
>>52293165float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
return y;
}
ascii swapcase is pleb tier, show me some unicode
>>52291847
>>52292164
> fallin forit
Is there any way to change values in form controls in C# that is not absolutely bullshit? Back in the good old Delphi days you could have a function inside the form that changed any property of any control and that was it. But now you need fucking delegates to do that because it wouldn't be "thread safe" to simply change the values. Is there any kind of library for C# that abstracts this for me? .
>>52293409
in english please
>>52293409
lixo
Is there a way in VS to set a restore point that I can revert back to in-case I royally fuck up?
>>52293282
Interesting. So the n-groupoid structure comes from the n levels of of equality types, right?
Would you recommend HoTT to somebody without much background on type theory (but good bg on abstract algebra)?
>>52293484
Precisely.
The HoTT book has a pretty solid introduction to type theory, so I'd say you should probably be fine.
>>52293504
I see. I don't really understand why you need an equality type for equality types if there's a single equality type for each value though.
Good. I'll add it to my to-read list then, I've been willing to learn some type theory for a while.
>>52293427
>is there a way to change properties in form controls that is not a major pain in the ass?
import os, sys
while True:
os.startfile(sys.argv[0])
>>52289854
The most repetitive shit on the internet
They will repeat everything at least 3 times
Things that could take 2 minutes to explain lasts 10 minutes. Literally explaining for retarded children
Fuck you Pam
>>52293616
absolute madman
This is a little program I wrote that transforms every nonspace ascii character in an array into a black colored pixel in a ppm image, outputting it to stdout. It works fine, but there's a small catch: when I change the MAGNIFY property to something else aside from 1, the image becomes distorted. I'm guessing the problem resides in the way I implemented the pixel printing function, return_px.#include <stdio.h>
#include <string.h>
#include "ascii.h"
#define COLORS 255
#define MAGNIFY 1.0
#define WIDTH strlen(img[0]) * (int)MAGNIFY
#define HEIGHT sizeof(img) / sizeof(img[0]) * (int)MAGNIFY
void return_px(int r, int g, int b, float z)
{
int i;
for (i = 1; i <= (int)z; i++) {
fputc((char)r, stdout);
fputc((char)g, stdout);
fputc((char)b, stdout);
}
}
int main(void)
{
int x, y;
/* file header */
printf("P6\n"
"%d %d\n"
"%d\n",
WIDTH, HEIGHT, COLORS);
/* print pixels */
for (y = 1; y <= HEIGHT/(int)MAGNIFY; y++)
for (x = 1; x <= WIDTH/(int)MAGNIFY; x++) {
if (img[y-1][x-1] != ' ')
return_px(0, 0, 0, MAGNIFY);
else
return_px(255, 255, 255, MAGNIFY);
}
//
return 0;
}/*
change this to whatever you like, but
keep the same length for each string
*/
const char *img[] = {
" ",
" ### #### # ",
" ##### ##### # ## ",
" ################## # ",
" ############# ## ",
" ##### ",
" ### ",
" "
};
>>52293549
The point of HITs is to be able to create more interesting values of equalities than just Refl. Like in the integer example, where there are paths that show how x+1-1 is equal to x. You can't construct that kind of proof in intensional type theory, and thus, you have to encode integers in a less satisfying way:data Int : Set where
Zero : Int
Succ : Int -> Int
Pred : Int -> Int
id_SP : (x : Int) -> x == Succ (Pred x))
id_SP = ???
-- "useful" integer structure
data Nat : Set where
Z : Nat
S : Nat -> Nat
data Int' : Set where
Zero : Int
Pos : Nat -> Int -- Pos Z = +1, Pos (S Z) = +2, etc.
Neg : Nat -> Int -- Neg Z = -1, Neg (S Z) = -2, etc.
>>52287802
asians are the most racist you idiot
many white people are diversity friendly SJWs
>>52293698
I'm asian and can attest to this
>>52293504
You seem to know well type theory so...
I'm a noobish programmer (but usually I learn fast) and I have a question:
What are dependent types and why are they useful? Are languages supporting them (Idris, Adga, f*) worth learning?
>>52293409
>But now you need fucking delegates to do that because it wouldn't be "thread safe" to simply change the values
so change the values from the UI thread?
>>52293655
Oh, I see. It's just about being able to express "custom" laws as higher equalities. Interesting
>>52288159
>>52288255
java isn't shit but libgdx is shit
just write your own game from scratch, it'll be miles ahead of whatever libgdx can do. maybe use some utility classes in the beginning like the Files but you should really learn opengl and and write your own input processing etc.
Why aren't you dedicating your life to making waifu AI bots a reality?
>>52293409
LiterallytxtDicks.Text = "Dicks";
>>52293711
post secrets
>>52293698
I always figured it would be the Japanese but
>India
>>52292737
Depends on what games you wanna play. Most games still aren't available on Linux.
>>52293721
A dependent type is any type that "depends on" a value, i.e. the value appears somewhere in the type. They sort of generalize the idea of type-level programming. In general, they're useful because of the Curry-Howard correspondence, where types are propositions and values are proofs; they make it rather easy to write proofs that can be automatically checked by a computer.
How are they useful practically? The example that motivated me to learn them was array indexing. Consider the the type Array(A, N), where A is the element type and N is the number of elements. Array is itself a dependent type; it depends on A (which is a value of a type of types) and N (which is a natural number). Traditionally, then, to index the array, you either need to use an "unsafe" function that segfaults (or worse) if you hand it a bad index, or a "safe" function that checks that the index is less than the size and returns with an error status that can be handled if not. Both options have their disadvantages: the "unsafe" function puts the user in charge of somehow ensuring that the index is valid, and the "safe" function might be doing checks redundantly for an input that can be proven safe. With dependent types, you can type the indexing function such that for an index i, you have to also pass in a proof that i < N. This proof can be created at no cost for constant indices, and created with a runtime check (once, and then it can be passed around and reused) for indices that aren't known at compile time. Proving that the indexing function itself is safe is a whole different issue, but even without that guarantee, it vastly cuts down the amount of "bug-producing code".
>>52293833
That's the intuition. You can technically express that type in Agda and Coq without higher inductive types, but it requires you to create new axioms/postulates, which is a potentially dangerous feature that can easily break soundness and allow you to prove contradictions.
>>52292737
get windows imo
you could dual boot if you want linux too
>>52293841
Java is shit compared to other stuff you can be using instead.
>>52293447
For your code? Have you never heard of version control? Use git.
>>52294143
java is comfy for rapid development/prototyping but yeah go with C++ to get the best performance and even for multi platform it's easy to port C++ code.
>>52294186
What the fuck am I reading
>>52294186 (Me)
what i do is i have java for android backends just like with libgdx and i also have a main java class that handles menus and stuff but rendering, game logic is in C++ through JNI and i also intend to move input and sound processing to C++.
>>52293899
I used to be learning ML stuff specifically because of that (or a similar scenario, anyway). Then life stuff came up. Might start messing around again with Julia.
What about you?
>>52289791
Rate My FizzBuzz
<code>
int x = 1;
String s;
while(x <= 100){
if(x%3 == 0){
s = "Fizz";
}
if(x%5 == 0){
s = s + "Buzz";
}
System.out.println(s);
s = "";
x++;
}
</code>
>>52294221
fizz/buzz
I want to contribute a new function to scipy and their guidelines say I should talk to the Devs first.
It says to post on the mailing list, but the mailing list seems dead. Should I post on the IRC or just handle the entire PR myself without consulting anyone?
>>52294261
I would try to talk to the devs first, IRC would be good. But I mean, if you already have it written it probably would be fine to make the PR and discuss it there. It's called a request for a reason.
>>52294323
Alright thanks.
>>52291794
>implying it isn't KI
>>52289791
Wow, this thread is pretty dead. Do we need to stir it up with traps again or what?
>>52294221
Isn't it supposed to print out x when it's neither 0 mod 3 nor 5
>>52294217
Lately it's been http://cs231n.github.io/
But it's not clear how modern AI/ML techniques could lend themselves to creating truly intelligent artificial lifeforms, and not just more smart classifiers. I'm skeptical of the whole thing and looking for alternatives.
>>52293329
Ok thanks. There is http://ruby-doc.com/docs/ProgrammingRuby/ which is a copy of the Pragmatic guide it's slightly more friendly but out of date.
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old
You are a programmer, not a coder
Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Code Guru is okay
Archmage is reserved for only the most senior of programmers
Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>52294972
STFU
>>52294802
>Do we need to stir it up with traps again or what?
hi :3 do you like functional programming?
>>52294934
>http://cs231n.github.io/
That looks interesting. I'll take a look. I don't feel qualified to speculate on how we'll get from here to general intelligence, though. Maybe one day...
>>52295011
OH SHIT M80, is it you from yesterday
Sure do, I solved project euler 1-31 and counting with Haskell. I'm no expert yet though.
>>52294972
kill yourself
>>52295088
>dat gif
hnnng
these might be a bit basic for you but haskell is always fun!
https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems
>>52295011
>>52295088
>>52295135
HASKELL FAGS GET OUT
>>>/g/dpt
how do I call my java program from command prompt??
I made a java file saved in a folder i called java
so i went
>cd Desktop
>cd java
now what I keep getting error. I saved it as hello.java
>>52295135
Whoah, those are awesome. The great thing is they specifically focus on the types of problems FP has you wrapping your head around.
>>52295169
Are you enjoying your non-algebraic type system?
Come on, you know you want to try it. Or at least find out what it is you're yelling about, right? http://learnyouahaskell.com/chapters Being exposed to contrasting ideas, and understanding without necessarily accepting them, is a sign of competence.
>pic related
>>52295279
>Are you enjoying your non-algebraic type system?
You mean Haskell?a = undefined
b = undefined : a
>>52293616
batch version is epic
%0|%0
>>52293641
The problem is that you only magnify the horizontal output not the vertical. Look at the modified outer for loop.#include <stdio.h>
#include <string.h>
#define COLORS 255
#define MAGNIFY 5
#define WIDTH strlen(img[0])
#define HEIGHT sizeof(img) / sizeof(img[0])
void return_px(int r, int g, int b, int z)
{
int i;
for (i = 1; i <= z; i++) {
fputc((char)r, stdout);
fputc((char)g, stdout);
fputc((char)b, stdout);
}
}
int main(void)
{
int x, y;
/* file header */
printf("P6\n"
"%d %d\n"
"%d\n",
WIDTH*MAGNIFY, HEIGHT*MAGNIFY, COLORS);
/* print pixels */
for (y = 0; y < HEIGHT*MAGNIFY; y++)
for (x = 0; x < WIDTH; x++) {
if (img[y/MAGNIFY][x] != ' ')
return_px(0, 0, 0, MAGNIFY);
else
return_px(255, 255, 255, MAGNIFY);
}
return 0;
}
I don't know why you made MAGNIFY a float, you always use it as an int.
If you are only making black and white images you can use pbm instead of ppm.
>>52295267javac hello.java
thenjava hello.java
>>52295511
>java hello.java
No, you would call it asjava hello
>>52295342
That's cheating, people don't use the bottom type for that.
>>52295559
silly me, yes you are right.
>>52295511
>>52295559
>>52295511
that's what I thought but I get "'javac' is not recognized as an internal or external command, operable program or batch file."
wtf I checked if there was a path in the PATH and there was
I've programmed in java a long time ago but getting set up and learning to call the files is the biggest hurdle I face everytime .
>>52295279
>making functions """"""""pure"""""""" solely for the sake of making them """"""""pure""""""""
How many times do you think fuzzbuzz has been posted in the history of /dpt/?derp = int(input('What Is the starting number?\n'))
luck=int(input('What number do you want to end on?\n'))
math = derp
def wat(x):
if (x/5).is_integer() == True:
if (x/3).is_integer() == True:
print('FizzBuzz')
else:
print('Buzz')
elif (x/3).is_integer() == True:
print('Fizz')
else:
print(x)
while derp < luck :
derp = derp +1
wat(derp)
>>52295640
what do you get onjava -version
anyway just use an IDE
>>52295640
is there a javac.exe in it?
>>52295641
If you actually make an assertion I'd be willing to discuss this with you, but I'm having trouble believing you're acting in good faith.
>>52295655
>math = derp
>derp = derp +1beforewat(derp)
>>52295502
Sweet, thanks for pointing it out. Also, I thought it made sense making the MAGNIFY property a float type. Well regardless, I don't think it makes that much of a difference.
>>52295658
>java version "1.8.0_66"
>Java(TM) SE Runtime Enviorment...
>Java HotSpot(TM) Client VM (build...
is it outdated?
>>52295678
when I type in hello.java
it just opens up the hello world file in notepad instead of displaying "hello world" in the command prompt
>>52295783
You need a JDK, not just the JRE
Why does my program take 25% longer to run if I rename it from .c to .cpp? What is happening? I am compiling with MSVC and not changing any code.
>>52293329
samefagDir.exists?(ORIGINAL) or raise no_dir(ORIGINAL)might read more natural. Yes, I needed to wake myself up this late to add this precision
>>52295799
Ive got a jdk dl'd already though. It's "jdk1.8.0_25" in my program files
did I fuck up making a path for it in the enviorment variables?
I put in path as "C:\ProgramData\Oracle\Java\javapath;"
>>52295833
C++ compiler is shit.
>>52295864
I was told that C is only for memers? If C is faster why would anyone ever use C++?
>>52295853
The path should point to the directory that has all the .exes in it
For me, it's "C:\Program Files\Java\jdk1.8.0_60\bin"
Your path only has shortcuts to the JRE
>>52295833
>>52295890
>MSVC
>>52295890
You've got that completely backwards, mate.
C++ is only for memers.
>>52295890
Because C++ has objects and a too powerfull preprocessor
>>52295924
Fuck off Ranjeep
>>52293349
literally magic
>>52295841
So using raise twice?def no_dir(dir)
raise "The '#{dir}' directory does not exist. Quitting."
end
Dir.exists?(ORIGINAL) or raise no_dir(ORIGINAL)
>>52295892
hell yeah that fixed it.
thanks a ton!
>>52289791
best book to learn c++ for an intermediate programmer?
>>52295890
C++ is incredibly bloated. C is designed to be compact.
>>52293409
>not programming in english
>>52295988
No, make no_dir return an error string
>>52296009
I'm reading Practical C++ Programming by Steve Ouaillane. It seems okay, no major complaints.
>>52295890
Because
>C++ is equally fast as C, but it has some gotchas you need to be aware of (C has gotchas too, mind you, just fewer)
and
>C++ is a true multi-paradigm language with all the higher-level features you'd expect a modern language to have. C is merely a portable assembly. C++(11 or boost) offers stuff like regex, implicit UTF support, standard containers (data structures such as hashmaps, resizable arrays, multimaps etc), efficient iterators, smart pointers, exceptions etc. C has a bunch of functions named with three letter acronyms.
>>52296067
Ok I thought you meant that just checking.
>>52294956
Seems rather fine, I feel like I can find stuff in it, just like the Python and Racket docs. Thanks a lot
>>52296105
But C++ is slower than equivalent C code because the C++ compiler can't make as many assumptions as the C compiler can.
>>52296421
That's not true at all.
>>52296105
>C is merely a portable assembly
Please stop that horrible meme
>>52296656
That phrase has been around since the 70's. C has been called "portable assembly" for a long time.
>>52295833
is this true? if i don't use C++ features should i change to C?
>>52296794
C is C++ without "C++ features"
>>52296724
That doesn't mean that it's not a horrible meme.
It's not like assembly at all.
>>52296805
so why should it be slower if i put the file extension as .cpp instead of .c? is this true for GCC too? i thought C++ compilers were actually better than C compilers?
>>52296807
memes didn't exist in the 70s
>>52296822
>i thought C++ compilers were actually better than C compilers
Fuck no. C++ is ridiculously complicated and hard to implement.
>>52296822
It's likely because MSVC is horrible, IIRC GCC basically converts C to the internal representation used for C++ to do optimizations anyways
>>52296827
>memes didn't exist in the 70s
That's a lie.
Also this guy (R. Crumb) has the best taste in women.
A man after my own heart
I want to print out the following but I'm unsure where the error is
>/"""""\
System.out.println("\/"""""\\");
i want to make a startup. who's in
>>52296983
I'll create the logo
>>52296983
i'll design the logo
>>52296983
I'll design the logo
>>52296983
something something make logo :^)
>>52296983
As long as it isn't web programming.
>>52296933
>Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )System.out.println("/\"\"\"\"\"\\");
>>52297004
>>52297008
>>52297009
>>52297016
>>52297033
i'm in the process of making a program that circumvents adblockers. we'll also need to make an app for it
>>52297157
>circumvents adblockers
People would just block it, idiot.
>>52297157
not sure if serious
how exactly are you planning to do this and what is the app for? is the user going to install an app to counter the user's own adblock installation?
New thread (15 posts early to stop traps and weebs edition)
>>52297205
>>52297205
>>52297205
>>52297236
Fuck off you god damn autist.
This thread is nowhere near the bottom of the page.
Why is it that porting programs is so difficult? When I'm writing a simple program in C, it takes zero effort to run it on linux or mac or illumos.
>>52298180
Because most programs aren't trivial.
>>52298180
Many performance optimizations rely on architecture or OS specific features. Not to mention the difference between Windows and Unix files and file systems as well as GUI programming (although using multiplat libraries like GTK, Qt, etc helps), multithreading, installation (registry shit on Winblows, differences in environments under Unix-like systems), and the list goes on.
>>52298319
No, because most developers are incompetent dirty pigs.
>>52289791
How would a Negro such as myself go about programming fried chicken?
>>52296827
Actually they did, Richard Dawkins coined the term in 1976.
>>52296924
If she had a 1 foot horsecock it would be the perfect woman.