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

/dpt/ - Daily Programming Thread

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

Thread replies: 316
Thread images: 25

File: Valutron.png (17KB, 750x216px) Image search: [iqdb] [SauceNao] [Google]
Valutron.png
17KB, 750x216px
Valutron edition.

Previous thread at >51577055

What are you working on, /g/?
>>
>>51583493
Report this thread for advertising
>>
>>51583493
>failed to link properly to the old thread
OP, delete this.
>>
>>51583554
Jessicas rumbled

Previous thread at: >>51577055
>>
>>51583493
stop shilling
>>
>>51583493
If your programming language can't

- read from a file into a string
- interpret that string arbitrarily
- do so concisely with its std library
- generate arbitrary code from that
- insert that code before the program runs because you're still in compile time

it's trash
>>
>>51583599
>compiled language

Get with the times grandpa. It's 11111011111.
>>
Poll time, /dpt/:

1 - What's your sexual orientation?

2 - What's your default programming language of choice?
>>
>>51583599
I believe what you're describing is known as a "compiler".
>>
>>51583611
-33?
>>
>>51583599
What are the advantages of that over, say, something like Template Haskell where you can modify the AST programmatically?
>>
>>51583619
Actually, I think it's called a bigger D
>>
>>51583618
Transgay
Python
>>
>>51583618
1. straight
2. OCaml
>>
>>51583619
There's a compile pass even in interpreted languages: it's the part where you go from raw text to AST, and typically you apply a series of transformations on that AST. The resulting AST is a representation of the target language.
>>
>>51583618
straight
java
>>
>>51583618
Gay
Go
>>
>>51583618

Same as >>51583663.
>>
A Java compiler that converts it to native machine code instead of bytecode.
>>
>>51583693
Pretty sure that already exists.
>>
>>51583693
GCC does this.
Next?
>>
>>51583711
>>51583710
Excelsior JET does it, but it's $3000 for a license.

>>51583711
GCC only supports up to Java 5.
>>
so I want to learn java so I can understand how my android works better. how hard is java? how difficult is it for a beginner to pick up?
>>
Last repost to gather feedback:

I uploaded my language in its current state at: http://neetco.de/languagedev/language

1. There are design issues with the typenodes (MNode in pmf.h/cpp) which makes the code bloated, error-prone and leaky.
2. The primitives only work with int types. Beside, they're handled ad-hoc and bypass most of the code generation, which is also bug-prone and oogleh.
3. I haven't tested that it actually produces valid executables (but the llvm looks OK).
4. printf-and-continue-until-segfault is used instead of proper erroring,

build.sh provides the commands to run to build the entire thing. Only the last command is required if the .y (bison file) and .l (flex file) aren't touched.

The code is mostly written as almost-throwaway code so it's not pretty, but it should be understandable and workable.

The language's syntax is in the .y file. There is support for if-then, if-then-else, while, set!, let, lambda, type declaration (might not work, not sure) and function calls. Moreover, any symbol can be placed infix to represent an infix call without ambiguity under LALR(1):

let fn = lambda (x, y) x + y;
fn(3, 4) fn fn(8, 9);
\\should output the llvm IR for "7 + 17"


There are some simple to correct syntax flaws such as require ; after {} in if and while statements.

llvm_backend.h/cpp does code generation. No passmanager is used, so it outputs unoptimized code, which is especially useful for debugging.

I like the base syntax (beside some flaws that need to be addressed, as outlined above) so far, but the codebase is starting to be hard to work with. Next up is probably, implementing multiple dispatch and type translation (e.g. <number> = <u>(<long>, <double>) should unify the union type, not the <number> type, with whatever argument is used in a function call).

Any pull request, patches, or suggestions would be appreciated.

I'll keep following these threads hoping one of you senpaitachi looked at it and have some input, but I'm done spamming now.
>>
File: best Lang best D.png (22KB, 637x336px) Image search: [iqdb] [SauceNao] [Google]
best Lang best D.png
22KB, 637x336px
>>
>>51583740
Do you have prior programming experience?
>>
>>51583779
no
>>
>>51583790
don't learn java
jesus christ
>>
>>51583799
why? how hard is it for someone without programming experience?
>>
>>51583790
http://codecademy.com/

That will cover the absolute basics of programming.
I would recommend that you take that, then pick up a book on Java (Head First Java is pretty good), then take the Java course that's on Coursera.
Java in a Nutshell is great to keep on your shelf as reference material, but not necessarily to learn programming (if you had prior experience and just needed to learn Java, it's good).
>>
>>51583824
it's a shit programming language
>>
What is the best programming language to learn in terms of what is most wanted in the job market, specifically the free lance job market. I already know HTML, CSS, and JavaScript (I know they aren't really programming languages). What should I learn next?
>>
>>51583877
not much choice if he wants to program for android tho
>>
>>51583895
not exactly program for android, I want to know how my android ticks and the best way is to know the language it was programmed in.
>>
what are some things that every dev should implement as practice before getting a real job?

>Binary Search trees
>reversing a string with pointers only
>>
What should I eat for lunch guys? Almost 11am here.
>>
>>51583920
Feces
>>
>>51583824
Java is a good language for *some* beginners:
-It's relatively easy to understand at a basic level due to its proximity to C's syntax, and there's a lot of information about it floating around online
-It's a language that'll be useful if you ever want to make some serious programs
-It's static and strongly typed with automatic memory management (this eliminates lots of mistakes you may make as a new programmer)
-It's challenging/big enough that you'll always have something new to learn if you're a curious person

But the last point is precisely why it's not a good language for the majority of beginners: Even if they are able to use it, most people will be put off by how often there's something new that they don't understand in their face, instead of intrigued/stimulated to learn.

You won't lose anything for trying it, despite what /dpt/ might say
>>
>>51583891
learn python!

also, javascript is a programming language
>>
>>51583907
learning about UNIX-like operating systems is helpful for that cause as well. android runs on the linux kernel
>>
>>51583937
>-It's relatively easy to understand at a basic level due to its proximity to C's syntax
That's actually only true if you already have programming experience due to the forced OO crap (public static class Foo { public static void main(String[] args) ...)
>>
>>51583618
it's not gay when I'm wearing a skirt
python
>>
>>51583988
That's part of my 4th point: That's something that he can just ignore, like the majority of beginners learning java, and write his code inside main (which is the easy part), or he can be intrigued by what these things mean and start looking into them.
>>
>>51583913
>Hello Anon, welcome to your first day as an employee at our company! Your task is to implement a <whatever algorithm you learn in cs101>
>Real Job
Pick one and only one
>>
>>51583683
>>51583663

>straight
>java
pick one
>>
>>51584030
using java isn't gay
>>
>>51583618
Straight
Haskell
>>
>>51583618
gay
java
>>
>>51583618
Hard gay
Valutron
>>
>>51583618
Transorganic negroasian bimolusk multimodal homoiconic
python
>>
>>51583678
>>51584094
>>51584104
>tfw no qt anon bf
>>
>>51584204
If it makes you happy, there's a strong likelihood of none of us being compatible mates. I mean, one of us likes a meme botnet language, the other one likes a lisp-like abomination, and one of us has reasonable taste.
>>
>>51583611
3737?
>>
>>51583618
lunar lander
anything that runs on less than 100 kb
>>
>>51583493
>and one of us has reasonable taste
s/reasonable/terrible/
>>>/out/
>>
>>51583618
straight
java
>>
>>51584293
>>51584270
fuck, I responded to the wrong post
I keep forgetting shift+q responds to the OP if you don't have a post selected
>>
>>51583693
why hasn't anyone made a free java AOT compiler for desktop yet ;_; or just a transpiler so you can plug the output into GCC
>>
>>51583618
Gay
C#
>>
>>51584324
Because it defeats basically the only benefit of Java -- that it can run anywhere
>>
>>51583891
JavaScript is a programming language (a pretty shitty one, but it's still a programming language).
>>
>>51584305
What's not reasonable about liking java, mate? Is it not memetastic enough for you?
>>
>>51583891
Ruby on Rails for web
Python for toys/pet projects
Java/C# for Enterprise

Also javascript is a programming language, albeit a shitty one.
>>
>>51583740
it's easy if you're not retarded

check out https://docs.oracle.com/javase/tutorial/

also you can check out http://developer.android.com/reference/packages.html and look up the source code grepcode.com
>>
Why is everyone in this thread so gay?

>>51584104
Even OP
>>
>>51584366
Its just that C# is better by a landslide
>>
>>51584391
>>51584366
whats wrong with java?
>>
>>51584338
what if you just want to write code in java or you have an existing codebase and then if you're targeting windows for instance you can get an executable with compile-time optimizations that's more difficult to reverse-engineer
>>
>>51583618
Straight white atheist poor unemployed hebephile educated young male.
C and Python.
>>
>>51584391
I've had limited exposure to C#, but the naming conventions rub me the wrong way.
>>
>>51584411
there is nothing wrong with java. it's just some stupid meme. java is one of the most popular programming languages in the world. and it's funny that shills say C# is so much better than java when they're almost identical
>>
>>51584378
>>51584416
>>51584441
all me
>>
>>51584411
Verbose Pajeet language for people who like writing spaghetti code.
>>
>>51584457
nice meme
>>
>>51584457
Say that to my face, not online, and see what happens
>>
>>51584457
nice meme
>>
>>51584493
I don't want to smell curry.
>>
>>51583618
Genderfluid non-binary trigender foxkin
Valutron
>>
>>51584502
companies choosing to outsource to save money does not reflect how good the language is.
>>
>>51584348
>>51584377
Why is JavaScript considered shitty? Sorry I'm new.
>>
>>51584484
>>51584501
nıce meme
>>
>>51584557
dynamically typed, interpreted
>>
>>51584441
popular != good
>>51584366
cobol for 21st century
>>51584457
this desu
>>
>>51584348
you could consider it a scripting language but the distinction isn't super-clear. python for instance could be considered both a programming and a scripting language.

>>51584557
anything dynamically typed is absolutely disgusting. there is no rigor to it, it's like if a woman designed the language
>>
>>51584595
You can compile it dumbfuck.
>>
>>51584607
it has to be used heavily for a reason
>>
>>51584622
OO was heavily shilled in the 90s
right place, right time
>>
>>51584621
eval("compile this *unzips eval*");
>>
>>51584650
there is nothing with OOP it's literally the best programming paradigm depending on the use case
>>
Where should I go or what book should I read if I want to learn Python?
>>
>>51584665
>it's literally the best programming paradigm depending on the use case
You don't say.
>>
>>51584665
>there is nothing
*there is nothing wrong
>>
>>51584670
don't bother with python, it's a meme language. only language worth understanding is C.
>>
>>51584665
there is no best paradigm, and there is no best language
use what works
>>
>>51583618

1. niggers
2. C#
>>
>>51583618
Straight while male.
C.
>>
>>51584670
https://docs.oracle.com/javase/tutorial/
http://en.cppreference.com/w/cpp/language
>>
>>51583618
>Bi
>Scheme
>>
>>51583618
Lesbian
AngularJS
>>
>>51583618
Gay
C
>>
>>51584665
there is no reason to ever use java if you're white
>>
>>51584706
while(male) {
straight = true;
doStuff();
}
straight = false;
>>
>>51584546
Sure you're not gay, faggot?
>>
>>51584650
also, linus torvalds, the creator of the linux kernel, hates java so it's shit.
>>
>>51584457
10/10 description. i'm keeping it.
>>
>>51584764
>autist who only works in kernel dev hates a high level language
youdontsay.jpg
>>
>>51584764
Everything linus says is objectively wrong, so java must be good.
>>
>>51583618
Trans-Abstract queer gender-kin
Rust
>>
>>51584811
>Everything linus says is objectively wrong
no its not
>>
>>51584827
Name one thing unwrong that linus said. I'll wait.
>>
>>51584736
while (straight, male)
if (!privileged) break;
>>
>>51584617
>you could consider it a scripting language but the distinction isn't super-clear. python for instance could be considered both a programming and a scripting language.

Scripting languages are a subset of programming language. Any "scripting language" is by definition a programming language. However, any programming language can in theory be interpreted or compiled (and interpreters inevitably involve some compilation) so the term "scripting language" is often misleading.
>>
>>51584840
>java is shit
>gnome is shit
>GNU emacs is shit
>its linux, not GNU/Linux
>>
>>51584844
parsing is not compilation
>>
File: 1439933772731.png (226KB, 620x670px) Image search: [iqdb] [SauceNao] [Google]
1439933772731.png
226KB, 620x670px
>>51584694
>just niggers
>doesn't specify whether male or female
>>
>>51584857
>>GNU emacs is shit
He uses emacs to program

>its linux, not GNU/Linux
Never said that
>>
I'm the faggot doing threading in python,
thread one finds ip_address
thread two doesn't even start until that is defined globally,
The problem is, thread two tries to read ip_address as a local variable, How do I get it to read the global one?
Shit's confusing, yo.
>>
>>51584844
"A script is what you give the actors. A program is what you give the audience." - Larry Wall
>>
>>51584857
Except he likes gnome, uses emacs, thinks we should call it NT instead of windows, and java must be good since linus says it's shit.
>>
>>51584898
and the audience are more important than the actors
>>
>>51584896
Why are you learning about threading in anything *other* than C? It's the one thing that's easier to teach on C with Linux+GNU than on anything else.
>>
Threadly reminder that this compiles on gcc
#define ayy(x) x(lmao(x))
#define lmao(x) x(ayy(x))

int main()
{
ayy(lmao);
}
>>
>>51584932
>*other* than elixir?
FTFY
>>
>>51584932
This. The whole lie of "with high level languages and today's computers you don't need to care about how anything actually works" falls apart as soon as you introduce threads.
>>
>>51584932
Because I only know python, I already have two working modules, they even work in threading.
The very last thing I need to get working is that variable.
I'll learn some C++/whatever a little later though.
>>
>>51584939
>threading
>elixir/erlang
mount_stupid.jpg
>>
>>51584937
as it should
>>
>>51584957
>threading
>C
kilimoronjaro.jpg
>>
>>51584881
>>doesn't specify whether male or female

You already know, though. I haven't hidden my love of negresses.
>>
>>51584945
When it comes to threading, "working" is not acceptable. A program can work 99% of the time and still be hopelessly, irredeemably broken.

Just finish whatever you're doing and go learn threading properly in C afterwards. It will be awful and you'll have no fucking clue of what you're doing at first, but you'll come out a much better programmer.
>>
>>51584981
Yes, in C you work with threads. In Elixir or Erlang, you do not.
>>
>>51584932
threading in java is fine
>>
>>51584986
Cmen, everyone!
>>
>>51584993
Threads are a very specific concept, and you don't work with them in Erlang.
>>
>>51584988
It's fine, but I actually find it more confusing than C.
>>
>>51585007
I'd work with your threads
>>
>>51584939
Elixir is shit, just use erlang.

>muh syntax :)
faggot
>>
>>51585025
Elixir is erlang if erlang wasn't garbage.
>>
>>51583493

I am working on C++ with the Stroustrup book. Currently working on a small problem from the chapter in which vectors and loop are introduced. Problem is to take a list of string inputs and use a list of disliked words to filter them out replacing them with BLEEP. Trying to use two for loops compare then and replace the word with bleep if needed. This is what I got.

#include "std_lib_facilities.h"

int main() {

vector<string> words;
vector<string> disliked = i{"broccoli", "beans", "spinich"};
for(string temp; cin>>temp;)
words.push_back(temp);
cout << "Number of words: " << words.size() << "\n";

sort(words);
vector<string> print_list;

for (int i=0; i<words.size(); ++i) {
for (int j=0; j<disliked.size(); ++j) {
if(words[i]==disliked[j]) {
print_list.push_back(disliked[j]);
break;
else:
cout << word[i] << "\n";
break;
}
}
}

return 0;
}


This seems like a bit jump in difficulty and I keep having trouble with it. Specifically the break I don't understand how far they kick me back up. I would like to abandon the comparison to the disliked vector upon finding a match. And let it continue until exhaustion if no match is found.
>>
>>51585062
Elixir is Erlang with ruby syntax (aka the shitty version of erlang).
>>
>>51585094
Elixir enable executing arbitrary code in module. Checkmate.
>>
>>51585118
proofs?
>>
>>51585065
something like this?
std::replace(words.begin(), words.end(),
[&disliked](std::string s){for (const auto& d : disliked) if (s == d) return true; return false; }, "BLEEP");
>>
>>51585142

Ill try and figure this out thanks.
I am only on chapter 4 dont recognize most of this.
>>
>>51585137
Check the website.
>>
>>51585167
most of those are standard library functions in algorithm

that's probably cheating
>>
File: 1425045169580.png (815KB, 631x677px) Image search: [iqdb] [SauceNao] [Google]
1425045169580.png
815KB, 631x677px
>>51583630
>not knowing binary
>being a hipster nerd
>>
>>51585142
>not
return s == d;

CU CK
>>
>>51584843
enum gender {MALE, FEMALE, FLIUD, PAN, DEMI, OTHER, NONE};
enum replytype {PROGRESSIVE, BACKWARDS, MANSPLAIN, OTHER};

inline bool
male(person p) {
return identifies_as(MALE, p);
}

inline bool
straight(person p) {
return identifies_as(STRAIGHT, p);
}

inline bool
privileged(person p) {
return male(p) || straight(p) || white(p);
}

while (privileged(person)) {
struct person bigot = person;
if ((reply = lecture(bigot)) == MANSPLAIN)
continue;
else if (reply == PROGRESSIVE)
break;
}
>>
>>51585210
Oh the irony
>>
so this is like 1/20th related to programming

on my html audio element, the volume slider isn't updating the graphic depending on the percent of volume, pic is what im talking about

i messed around a bit and found out if i remove my two self made CSS styles from being imported it fixes the problem, but the weird ass part is if i remove all the lines of text in those css files the problem is still there

so im not really sure whats going on
>>
>>51585216
return s == d would only check one

you complete and utter failure, remove yourself from the thread this instance
>>
>>51585236
>implying you didn't just plug that number into a calculator set to byte
Better act smug when you dont wtf you're talking about right?
>>
>>51583618
Straight - Haskell
>>
>>51584889
>>>GNU emacs is shit
>He uses emacs to program
he uses a customized micro emacs, not GNU emacs. and even that he hates
https://git.kernel.org/cgit/editors/uemacs/uemacs.git/commit/?id=fa00fe882f719351fdf7a4c4100baf4f3eab4d61
>I really should just learn another editor, rather than continue to polish this turd.
>>
>>51583913
Genuinely the thing you should learn is build systems. You should learn how to debug tools that don't build. Algorithms are shit easy, debugging why make failed and searching through 10,000 pages of g++/clang++ template errors in search of what went wrong is far more valuable skill.
>>
so is C a bad first language?
>>
>>51585446

No.
>>
>>51585446

I did python and really felt the need to understand more of what was under the hood. Working on c++ now.

Do whatever you want as long as you are moving forward.
>>
>>51585464
is C hard as a first language?
>>
>>51585509
yes try python for a simple start
>>
>>51585446
int main()
{
int (*){} no
}
>>
>>51585551
why python over C?
>>
>>51585509

Hard is a relative term. Nothing is hard if you put your in the time and work. Also I should have added you should have a motivation for learning a language and what you want to use it for, just like how you wouldn't just start learning Hindi or Punjabi just cause you think it's easy.
>>
>>51585509
C is a great first language if you want to really learn how software works. LIke the guy above said, if you learn python you'll be able to write some working code easily but it'll all seem magical and you'll wonder how it really works.
>>
>>51585446
good lord, C is the fastest language, dont blasfeme xd as a first language i wouldnt recommend, but it is a must for programmers
>>
>>51585574
just try a hello world in python,
try it in C, post results
>>
>>51585574
Python teaches you poor habits from the start
>>
>>51585611
Languages don't teach bad habits, bad teaching materials do. For example, K&R C.
>>
>>51585604
Fuck off you celcius iq autist lord.

It's not all about ease of syntax, it's about learning how it works. Anyone who knows how to program should be able to pick up any language regardless of syntax in a very short amount of time. It is C that best teaches you the underlying principles of programming. If you learn python first your are ruining your chance to become a decent programmer.
>>
>>51585627
I never said anything about K&R, it is a succinct introduction to the language but a little dated.

K&R is not teaching you how to program, it is teaching you how to program in C
>>
>>51585633
the language chooses the programmer? rly?
>>
Learning python first is like taking an elevator your entire life, then when you go to other languages where you have to learn how to take the stairs, your attitude is, "Lol why do I need to do this when elevators exist?" If you learn a language like C++, C and Java first, you will get to appreciate Python's shortcuts a lot more when you eventually get to it.

But those are just my 2 cents.
>>
>>51585633
why is learning python first ruining your chances of becoming a decent programmer:
>>
>>51585627
I started with K&R and now I am an expert programmer.
>>
>>51585669
that is stupid
>>
>>51585656
No but you only have once chance to learn it for the first time. Learning the more complex concepts that C has to offer allows one to pick up anything that follows with ease.
>>
>>51585676
no, I was asking a question.
>>
>>51585676
see
>>51585658
>>
>>51585677
what advantages will I have if I learn C first?
>>
>>51585684
one step from crazyness :P
>>
>>51585707

Why don't you google it family?
>>
>tfw you fell for the monad meme
>>
>>51585736
hes' the one making the claims about advantages about learning it first time, I want him to clarify.
>>
>>51585210
It was a joke about 2's complement you dense retard. It's as much "binary" as the more natural system you're thinking of
>>
>>51585746
>Most modern non function languages are C based
>Used for everything from embedded systems to operating systems to desktop applications
>Can run on almost anything that calls itself a computer
>learning dynamic memory management makes your really understand how everything works


I am not talking down python, but I think that you should learn C first and then move on to python.
>>
>>51585820
functional*
>>
>>51585835
functional is a misnomer since they don't actually function
>>
>>51585820
>>51585835
GHC and CHICKEN use C too.
>>
>>51585749
It's not a good joke about two's complement then - the most significant bit is a fucking 0. Kill yourself.
>>
wat u think of nim?

> Python like syntax
> always outputs better C than you
>>
>>51585952
I think the "programmable optimizer" is pretty neat
Shame about everything else
>>
>>51585903
>he doesn't use 11-bit numbers
>>
>>51585952
me like the macro system
>>
>>51585903
all bits are equal
>>
>>51585892
*cocks pistol*
ohh shhiiiitt
*bangs pistol against railing*
functional languages
blown.
the.
fuck.
OUT
*squeezes off 16 hot loads of 9mm*
>>
>>51585892
>>51586042
#SHOTSFIRED
>>
>>51586042
please drink bleach
>>
File: Pipes.png (61KB, 1366x768px) Image search: [iqdb] [SauceNao] [Google]
Pipes.png
61KB, 1366x768px
Well... pipes work, even if it does feel as though my kernel is held together by duct tape.

Also, note to self, you cannot make a post on 4chan by hitting escape and :x. No, that will close the reply box. This is what happens when we spend too much time editing files until they stop failing all of the tests.
>>
>>51586042
>>51586052
I've been waiting for the functional paradigm's reply, but I guess it's lazily evaluating
>>
>>51586094
OHHHHH SHIIII
*ejects spent magazine*
FUNCTIONAL LANGUAGES...
*slaps in fresh magazine*
*drops the slide*
FUNCTIONAL LANGUAGES ON SUICIDE WATCH
*pops off 15 more rounds*
>>
>>51586042
>>51586123

Something tells me you've never touched a gun in your life.
>>
>>51586181
*throws away Glockamatic .357 Special*
*draws wakizashi*
Functional Defence Force is finally here, deshou?
*bangs sword against railing*
>>
>>51586181
one of many things he can't get up
>>
currently making a FM synthesizer in C

pretty fun. 3 oscillators, square/sin/triangle wave, etc. trying to mimic alesis ion FM synth
>>
>>51583493
Extended the kanban webapp manipulating my todo list text file today to bulk-move tasks from one stage to another, as well as to add new tasks.

There's plenty more left to be done, but it's ready for general purpose use, granted I intend to still regularly manipulate the text file to do what the webapp cannot.

But I hope to reduce how much this needs to be done over time, so that I can do it all from a mobile device without having physical or ssh access to the server it's all based on.
>>
File: finished.png (377KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
377KB, 320x386px
Well, I've been jerking off my image-thingamajigger again.

Points are now selected randomly, such that error is distributed through the image.

This is American Gothic with the palette from Starry Night.

Gonna try a different method and see what results I get.
>>
>>51585903
The most significant bit is clearly a 1. There is only one 0 in that number and it's in the fucking middle of it, I have no idea how someone can be such a fucking failure of a human being that they manage to confuse the most unrelated fucking bits possible in any fucking number. Stop posting here you mongoloid, and go back to ricing (field) threads.
>>
>>51585952
why has nim been shilled recently?
nobody gave a fuck when it came out, everyone thought it was stupid & would never take off
why the sudden surge of discussion?
>>
>>51586284
does this take every pixel from starry night and then map it onto the other painting?
>>
>>51586379
>everyone thought it was stupid & would never take off

Where? Here?
>>
>>51585739

Does anyone NOT know what monads are at this point?
>>
File: finished.png (380KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
380KB, 320x386px
>>51586421

Yes.

This one selected colors from the palette by using the lowest distance in intensity from the random sample (which is r+g+b/3).

I actually really like this result.
>>
>>51586442

They're monoids in the category of endofuckers, obviously.
>>
>>51586442
I tend not to learn meme languages so I don't know what they are.
>>
>>51586516
You can use them in non-meme languages like C++ and D and they become useful
>>
>>51583542
>>>51578992 (You)
>>>51578934 (You)
>If you're still here, may I know the concept/math behind your picture? Is it like a lorenz equation or attractor or something?
yep, attractor
I think the colour is based on the distance to the previous point.
The algorithm is
xnew=sin(y*b)+c*sin(x*b)
ynew=sin(x*a)+d*sin(y*a)
repeated as many times as you like, I probably did it 10 million+

but sorry...I stored ones that looked cool, but I didn't store the a/b/c/d....you might never find this image ever again
>>
File: 1443766594746.jpg (51KB, 650x647px) Image search: [iqdb] [SauceNao] [Google]
1443766594746.jpg
51KB, 650x647px
>>51586545
>non-meme languages
>D
>>
>>51586565
D is largely imperative
>>
>>51586379
people shill random programming languages as a way to troll noobs.
see: every single functional lang
>>
>>51586565
>>51586575

As an example, do you use generics much?
>>
>>51585892
Replace "functional" with "working" in those posts.
>>
As a complete noob other than some code noodling years ago, I figured I would compile a glossary of programming related terms.

Should I get definitions for every possible word, or just the ones I'll be dealing with for now? (Learning Python for pet projects, with web dev to come much later.)
>>
>>51586665
Start with Haskell
>>
r8 my scrape
require 'nokogiri'
require 'open-uri'
require 'httparty'

link = "http://imgur.com/a/fpxqU"
page = Nokogiri::HTML(open(link))

image_tags = page.css('meta')

image_links = []

image_tags.each do |tag|
link = tag['content']
image_links << link.chomp unless link[0..5] != "http:/"
end

image_links.delete_at(0)
counter = 0
image_links.each do |image_link|
File.open("#{counter}.jpg", "w") do |file|
file.binmode
file.write HTTParty.get(image_link).parsed_response
counter += 1
end
end
>>
>>51586682
>ruby
shit/10
>>
>>51586665
As long as you know streamline content integrated with machine learning/big data [science] with a obfuscated stack pipline delivering a webscale portable system/platform

is utter bullshit

You are okay
>>
>>51586707
you are of one who is utter the bullshit
>>
>>51586675
B-But me and my flatmate already agreed on Python ;_;

I'll look into it.
>>
>>51586807
i forgot about python
start with Python and then Haskell

then Java then Go
>>
>>51586835
oh PHP too, can't forget that one
think that one goes between Java and Go,
definitely above python though
>>
>>51586785
oh no did I trigger you by listing buzzwords?
>>
>>51586889
did someone say buzzfeed
>>
>>51586807
Bad idea dude, go with C.
>>
What's a good, cheap web host? I want to play around with writing applications that interact with a remote server. Stand alone applications, not web pages, if that matters.
>>
>>51586665
(: a left parenthesis
): a right parenthesis

Done.
>>
>>51586930
heroku is free and can run any server on linux
>>
>>51586930
you can get free hosting and domain from hostringer.in for a short period of time. Assuming you don't mind having the hosting be done in curry land
>>
File: finished.png (357KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
357KB, 320x386px
Here's American Gothic with the Mona Lisa palette using the same technique.

Produces an interesting effect.
>>
Working on a flashcard app
>>
File: 1441165540792.jpg (89KB, 621x621px) Image search: [iqdb] [SauceNao] [Google]
1441165540792.jpg
89KB, 621x621px
>want to learn clojure
>it's the slowest piece of shit on planet earth
>>
>>51583618
straight
C#
>>
>>51587390
Maybe you should

D n r a e L...........D
............ e ...........n.
....DD....a...DD....r.
....DD... r ...DD....a.
.............n............e.
L e a r n D n r e a L
e............n.............
a...DD....r....DD.....
r....DD....a...DD.....
n............e ............
D............L e a r n D


instead
>>
>>51587522
You fucked that up real bad. Now I hate D.
>>
>>51587522
>>51587527

Wow,
 really messed that up

Copy into reply message window to l3et decrypt
>>
>>51587522
D n r a e L . . . . D
. . . . . e . . . . n
. . D D . a . D D . r
. . D D . r . D D . a
. . . . . n . . . . e
L e a r n D n r a e L
e . . . . n . . . . .
a . D D . r . D D . .
r . D D . a . D D . .
n . . . . e . . . . .
D . . . . L e a r n D
>>
>>51586665
A monad is just a monoid in the category of endofunctors, what's the problem?
>>
>>51586997
Here's how it looks for me when I just go at it directly in photoshop.
>>
>>51587692

Is that saving the file and forcing it to use the Mona Lisa palette?
>>
>>51586997
>>51587692
gtp on suicide watch
>>
File: 1b097b73a1.png (672B, 263x29px) Image search: [iqdb] [SauceNao] [Google]
1b097b73a1.png
672B, 263x29px
>>51587703
Just using the 16 color palette I created from Mona Lisa picture.

Still doesn't look good though. Only uses a tiny bit of palette. I think the best result would be to reduce both pics to 16 colors and then just replace the palette in second one.
>>
>>51583618
gay lisp
>>
>http://developer.android.com/reference/android/view/MotionEvent.html

>Motion events are always delivered to views as a consistent stream of events. What constitutes a consistent stream varies depending on the type of device. For touch events, consistency implies that pointers go down one at a time, move around as a group and then go up one at a time or are canceled.

>While the framework tries to deliver consistent streams of motion events to views, it cannot guarantee it. Some events may be dropped or modified by containing views in the application before they are delivered thereby making the stream of events inconsistent. Views should always be prepared to handle ACTION_CANCEL and should tolerate anomalous situations such as receiving a new ACTION_DOWN without first having received an ACTION_UP for the prior gesture.

>Motion events are always delivered to views as a consistent stream of events.
>While the framework tries to deliver consistent streams of motion events to views, it cannot guarantee it.
>>
>>51587801
>http://stackoverflow.com/questions/10422476/android-motionevent-consistency-guarantees

it's been like this since 2012-2013 and no one seems to give a shit
>>
>>51587801
J . . . a
. a . v .
. . X . .
. a . v .
J . . . a
>>
>>51587719

No, actually.

>>51587735

What you're doing here and what I'm doing are fundamentally different. In mine, once a color is used, it cannot be used again. That is to say: you get one of each pixel in Mona Lisa and must rearrange them in order to create a different picture.

Watch, I'll run mine without removing the used colors and it won't have that dark color 'cleavage' or spottedness (depending on the method) anymore.
>>
>>51587841
more like

J      d
e i
w o
dr
dr
w o
e i
J d
>>
how does it make you feel when faggots name their functions
>funcA
>funcB
>funcC

I personally am a fan of
>func1
>func2
>func3
>>
>>51587863
Can't wait till Ben "D" Garrison exterminates the Languages of Israel
>>
File: finished.png (329KB, 320x386px) Image search: [iqdb] [SauceNao] [Google]
finished.png
329KB, 320x386px
Here, if I don't remove colors as used, this is the result.

And this is only using the intensity matching approach. If I used the RGB distance approach I was using earlier, this would be a damn near perfect copy.
>>
Just switched distance functions. Letting it have a run now (on random point mode). This seems to produce honestly better results.
>>
>>51584411
>no value types
>no real generics
>no delegates
>no LINQ (eg. lambdas, anonymous types, extension methods and expressions)
>no unsigned ints
>no properties
>no IDisposable
>checked exceptions
>no async/await

>shitty standard library
>VS+R# is order of magnitude better than any Java IDE

While Java 8 fixes some of the problems, it is too little too late.
>>
>>51588289
some of those are excusable, but I can't for the life of me figure out why such a high profile language doesn't have unsigned numbers.
>>
>>51588289

Also, interop. Also, pass by reference. Also, several million other things.
>>
What would a regular expression to capture any three-digit numbers that takes leading zeroes into account look like? So that 001 is captured as 1.
>>
>>51588484
something like
00(\d)|0(\d\d)|(\d\d\d)
?
>>
Should I learn Erlang before learning Elixir?
>>
>>51588504
Oh yeah I guess something like that could work, thanks.
>>
>>51588546
Yes. Because you're going to be looking at a lot of Erlang source code to figure out how shit gets done and then reimplementing it in Elixir.
>>
>>51588576
And an alternative if limiting to 3 numbers isn't the job of the regex:

0*([1-9]*)
>>
>>51588289
What's your recommended alternative OOP?
>>
>>51583493
>valutron
do you accept donation ?
>>
>>51588643
DD
D D
DD
>>
>>51588484
using python to try a pattern, how about...
import re
tests=["1",
"001",
"0001",
"01",
"00000010",
"0000213000",
"001.200",
]

leading=re.compile(r"(?:0+)?(\d+(?:.[1-9]+)?)(?:0+)?")

for n in tests:
print("{into} => {outto}".format(into=n,outto=leading.findall(n)[0]))


yields pic related
>>
>>51588785
also just occurred to me you could drop the last group:
leading=re.compile(r"(?:0+)?(\d+(?:.[1-9]+)?)")
>>
>>51588785
Well I'm strictly required to matchy only 3-digit numbers (so stuff like 1, 01 etc shouldn't pass), and only real numbers (so 1.2 shouldn't match either).

On the other hand I went with the following:
(\d{3})


And it seems to properly convert 001 to 1 implicitly so I guess I can stick with it.
>>
>>51588818
It shouldn't. Your regex engine is improperly implemented.
>>
>>51588845
The regex will spit out a string and assuming a leading zero doesn't mean octal or something, will output the correct int value as expected when converted.
>>
>>51588845
Well it's not the regex engine specifically that converts (I know my previous comment is sort of misleading). After I capture it, I convert it to 1 myself:
event.number  = to!int(matcher.captures[2]);


Not sure why I said implicitly.
>>
>>51588546
No, you can learn Erlang after you learn Elixir, you should be familiar with Erlang syntax because you have to deal with it in Elixir, but it is not a prerequisite
>>
>>51588785
What OS is this? Fucking beaut
>>
>>51588934
Windows 10
>>
>>51588818
So most programming languages generally parse numeric strings with leading zeros in such a way that they drop that shit anyway. If you're using python, for instance, you can just tell it to parse as an integer.

I'm not an ardent supporter of trusting the language to do this kind of stuff, but if you're familiar enough with the behavior of the language (and the specs) that you can really reliably trust this to happen as versions update, then go ahead and use it.

As an example of something that might come back to bite you in the ass, Python returns sets of numbers in order despite sets ostensibly being unordered. Same for dictionaries if the keys are numbers.
>>
>>51588934
it's just OS X, but the shell is zsh, which might be what you're liking.
>>
>>51588943
sorry, to clarify with that last paragraph, the behavior of (c)Python to return sets and dictionaries with numeric keys in order is entirely the result of the current implementation, and they say somewhere in the documentation that you should *NOT* trust it to be that way down the road.

Or maybe they've changed things in the past few years. I remember being surprised by the serendipitous nature of a bunch of values coming out in perfect order by key despite my having used a dict, so i went looking around and found this out. it was weird.
>>
Programming languages are stupid. Why can't you just paint programs?
>>
File: 1446697506915.jpg (36KB, 286x429px) Image search: [iqdb] [SauceNao] [Google]
1446697506915.jpg
36KB, 286x429px
>>51589002
>>
>>51589002
written languages are stupid. why can't you just draw books?
>>
File: 1399339118265.jpg (184KB, 688x1434px) Image search: [iqdb] [SauceNao] [Google]
1399339118265.jpg
184KB, 688x1434px
>>51589002
this is you
>>
Been wearing the same clothes for 7 days straight guys. Will this make me a better programmer?

>>51589047
You don't understand that analogy at all. Think again.
>>
File: 1447379211629.jpg (32KB, 572x303px) Image search: [iqdb] [SauceNao] [Google]
1447379211629.jpg
32KB, 572x303px
>>51589002
>>
File: pietquest.png (31KB, 409x1163px) Image search: [iqdb] [SauceNao] [Google]
pietquest.png
31KB, 409x1163px
>>51589002
You can. It's called Piet.
>>
I'm trying to go through the K&R C Programming book, and I'm a bit confused on the EOF char input examples.

int main () {
int c;

while ((c = getchar()) != EOF) {
putchar(c);
}
}


Why does this work? It should be saying "set c to the entered input id, and if it's not the EOF id, print the char the id represents", but the character(s) are only printed as soon as I hit enter. When inserting an additional print statement before the putchar statement, it's like it's going in intervals. i.e. if I put "printf("blah\n")" before the putchar statement, and entered "hat" on the program's execution, I'd get:

>blah
>h
>blah
>a
>blah
>t

This makes no sense to me. Is it actually printing this shit, but doesn't display until the end of the method/loop or something? Why? This seems so inconsistent with any other programming I've done
>>
>>51589129
EOF is a character at the end of every file. If EOF did not exist, computer files would not exist because the system would have no way of knowing when one file ends and another begins.
>>
>>51589129
Just to clarify, the way I'd EXPECT it to behave the way it's written would be to print the last char I entered to the screen forever until an EOF input is sent, and then the loop would break and any other shit the method would do afterwards would be called (in this case, the method is over).

Instead, I can enter as many chars as I want, and as soon as I hit enter, the char sequence I typed in is printed back out indefinitely.
>>
>>51589129
http://stackoverflow.com/questions/3676796/what-does-getchar-exactly-do
>>
>>51589188
Oooh, okay, so it's actually a buffer of values the get read after you hit the enter key. That's odd, but definitely makes sense.

So, after you hit enter, is it going through the buffer and setting 'c' equal to each value in the buffer? I assume the buffer is cleared as the values are read?
>>
>>51589222
>I assume the buffer is cleared as the values are read?
I would say so, because there is no function that allows you to go "back" in the character stream. Or at least for standard IO.
>>
>>51589176

Technically, it's not so much that there is a character called EOF at the end of the file. The operating system knows where the file ends, what its size is, etc... it's just that EOF is a way for the system call to tell the program that it can't read any more bytes.
>>
>>51589250
that's what's confusing me, because if I do something like

c = getchar();
putchar(c);
c = getchar();
putchar(c);


I enter in something (anything) once, and it prints out twice. Does that not imply the buffer isn't being cleared?
>>
>>51583618
Asexual
Haskell
>>
>>51589310
strike that, it prints out what I typed and then SOME of what I typed, typically cutting it off to 2 characters. Uhhhhh

int main () {
int c;

c = getchar();
putchar(c);
c = getchar();
putchar(c);

printf("\nEND OF THE METHOD\n");
}


>I'm entering this into the terminal
>I'
>END OF THE METHOD
>>
>>51589335
What else are you expecting? What it is doing is doing it right.
>>
>>51589365
I'm just trying to understand it. Why does it print out everything and then only print out the first 2?

If I enter in the alphabet, it'll print the alphabet in its entirety, and then print "abcdef". Why? I'm just trying to make sense of it, not saying it's wrong
>>
>>51589335
how big do you think an int is m8? You're calling "getchar" m80
>>
>>51589388
The program is not printing anything at first. That is just console parroting what you are writing. Normally, it should print it immediately, yes. But console is using buffered input. So everything you write is first written into the buffer and only on specific occasions is that buffer sent to your application. If you are using normal console, that would most probably be enter key.

That is why it seems it is not doing anything as you type.
>>
>>51589407
Sorry, I meant

>*I type in "I'm entering this into the terminal" into the terminal

after hitting enter, the following is printed:
>I'm entering this into the terminal
>I'
>END OF THE METHOD
>>
>>51589433
cap it, because I'm running it right now and that's not happening.
>>
>>51589449
This may have something to do with what >>51589420
is saying, which I still only kind of understand
>>
Can you store functions with arbitrary signatures in a hashmap in D?
>>
>>51589690
you can store anything in a hashmap in D because stringof + mangleof + mixin
>>
File: IMG_0197.gif (2MB, 226x200px) Image search: [iqdb] [SauceNao] [Google]
IMG_0197.gif
2MB, 226x200px
We're at the bump limit, but I removed the new thread button because it interfered with the Feng Shui of my 4chan page.
>>
>>51589760
Good riddance. No code, no conduct, no customers.
>>
New thread:
>>51589904
>>51589904
>>51589904

>>51589867
You can go fuck yourself.
>>
>>51589908
I actually can't
>>
>>51585820
>everyone is going to write compilers for a living
lol
Thread posts: 316
Thread images: 25


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]
Please support this website by donating Bitcoins to 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
If a post contains copyrighted or illegal content, please click on that post's [Report] button and fill out a post removal request
All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site. This means that 4Archive shows an archive of their content. If you need information for a Poster - contact them.