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

/dpt/ - Daily Programming Thread

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

Thread replies: 315
Thread images: 46

File: daily programming thread2.webm (2MB, 600x338px) Image search: [Google]
daily programming thread2.webm
2MB, 600x338px
old thread: >>58091373

What are you working on, /g/?
>>
>>58094819
First for D
>>
>>58094768
Thanks dude
>>
>>58094819
Why no love for Lisp in these threads?
>>
Fourth for JAI.
>>
File: 1481908776342.jpg (25KB, 640x298px) Image search: [Google]
1481908776342.jpg
25KB, 640x298px
>>58089011
this
>>
>>58094819
Java is shit
>>
File: 1482058065255.jpg (49KB, 803x868px) Image search: [Google]
1482058065255.jpg
49KB, 803x868px
>>58094898
fuck's sake i meant to quote >>58089022

anyway fuck you faggot OP and the rest of you pathetic newfag """"programmers""""
>>
>>58094895
Because they are all dumb memesters.
>>
File: akari 3821.jpg (63KB, 914x574px) Image search: [Google]
akari 3821.jpg
63KB, 914x574px
Is it possible to turn plain html that i downloaded from an xmlhttprequest into a DOM object so I can insert it into the page?
>>
>>58094942
Yes.
>>
>>58094942
no
you have to parse and recreate every element individually
>>
This is the only way to do integer average
template < class T,
class = typename std::enable_if<std::is_integral<T>::value>::type>
T average(T a, T b)
{
return a / 2 + b / 2 + (a%2 & a%2);
}
>>
Also we have parallel functional programming thread:

>>58076404
>>
>>58094942

$('body').append(yourhtmlstring);
>>
>>58094922
The people in these threads or people who use Lisp?
>>58095154
I'm not sure who you're replying to so I'll assume it's me

Depending on dialect lisp is object oiented, functional, imperative, or whatever really
>>
>>58095154
it was about time for haskell (and whatever the fuck shitlangs) tards to fuck off to their own thread
>>
>>58095200
erlang
>>
>>58095154
next we need a pair programming thread to fragment dpt even more
>>
File: 19994505.png (832KB, 768x1024px) Image search: [Google]
19994505.png
832KB, 768x1024px
>>58094942
Yes. The safe way is DOMParser(). The fast way is creating a div, setting its .innerHTML and retrieving the children. The former is preferable for for external content.
>>
>>58095225
It's not like /dpt/ suffered much, since it keeps going at 3 threads per 24 hours.
>>
>>58095200
Why do you hate Haskell fags so much? I would understand if it were Java or C#..
>>
>>58095310
Two extremes of the spectrum. Both think their over-engineered crap is the saviour of humanity.
>>
>>58094819
(defn exponents
"rases a base to a power"
[base power]
(def total base)
(loop [pass 1]
(if (< pass power)
(do (def total ( * total base))
(recur (inc pass)))
total)))

(defn powers
"Raises a number to a power and appends all given powers into a vector"
[base power]
(def total base)
(def factors [total])
(loop [pass 1]
(if (< pass power)
(do (def total (* total base))
(def factors (conj factors total))
(recur (inc pass)))
factors)))


I couldn't find an exponents function so I wrote one, took longer than it probably should have and it's clunky as hell but I'm pretty proud of it
>>
>>58095366
It isn't over engineered at all
>>
>GDI is unbearably slow

Thank you migrosoft.
>>
>>58095417
Just another useless abstraction that complicates windows APIs
>>
>>58095466

Correct.
>>
>>58095466
wouldnt have happened with java
>>
>>58095417
what are you trying to do?
>>
>>58095478
Why are you comparing Java to C/C++?
>>
>>58095515
I agree. there is no comparison. java is superior to sepples in every way.
>>
>>58095478
bufferedGDI(fileGDI(intGDI(
>>
>>58095533
2/10 troll
>>
>>58095366
If you're talking about monads etc. in Haskell, that's not really engineering. Guys like Wadler didn't invent monads for IO (they're an abstract mathematical concept) but rather saw how e.g. IO in Haskell was an example of a monad. It's more scientific.
>>
>>58095533
Yep.

C >>>>>>>>>> Erlang > Haskell > Python > Java > C++ > C#
>>
if every custom class in Java inherits from Object, can I add a list of Substances (custom class objects) to List <Object>?
>>
    int i = 0;
cout << i++ << ' ' << i++ << endl;
output:
1 0

wtf?????? Why is c++ so shit?
>>
>>58095638
sure
>>
>>58095659
>writes the shittiest possible code

>wtf why is x-lang so shit?
>>
>>58095479

pixels
>>
>>58095659
>UB
>why does it do this wrong?
>>
>>58094895

because all the real programmers get tired of newfriends and memes and go to lainchan
>>
anyone know a good netbeans plugin to edit the same file in two windows?
>>
File: based eclipse.png (7KB, 436x109px) Image search: [Google]
based eclipse.png
7KB, 436x109px
>>58095697
>>
>>58095746
meh
>>
>>58095697
>her IDE can't do this by default
>>
File: 1477317489721.png (201KB, 365x365px) Image search: [Google]
1477317489721.png
201KB, 365x365px
tfw when you make an overcomplicated piece of code to then find a simpler way after all is done.
>>
>>58095761
>>58095746
ah cool works in netbeans too
view -> split -> horizontally
>>
>>58095777
>her
>>
>>58095777
>her
did you just assume my gender?
btw >>58095781
>>
how much should cpu cache affect performance of insertion into a linked list?
>>
SAY IT WITH ME


POO
>>
>>58095824
not much because it shouldn't take much and more would have no effect
>>
>>58095834
IN
>>
>>58095779
next time ask rsm for advice first
>>
>>58095842
HASKLEL
>>
>>58095779
or
>tfw you write code for hours and then look back and optimize it yourself and it is cut in half or more
orgasmic tbqh
>>
>>58095842
LOO
>>
>>58095824
Are you the guy in AGDG boasting about your performance while using linked lists for an ECS?
>>
anyone here working as intern?

what pay do you get?
$13, feel like that is a bit low. actual employees start with $30 here.
>>
>>58095913
No i don't do agdg
give backstory
>>
File: 23 - bWjcLHu.png (373KB, 711x720px) Image search: [Google]
23 - bWjcLHu.png
373KB, 711x720px
post some memes desu
>>
File: 1477654440761.jpg (98KB, 767x767px) Image search: [Google]
1477654440761.jpg
98KB, 767x767px
>>58095931
You're lucky to be paid. I didn't get that chance...
>>
>>58095135

C++ is so horrible.
>>
File: 1479832587549.gif (1MB, 580x433px) Image search: [Google]
1479832587549.gif
1MB, 580x433px
>>58095963
What's the benefit of C++ over C?
>>
Currently learning how to create Android apps through the AndroidStudio and the android website. All based on Java obviously. Am i doing wrong? Anyone have objections?
>>
>>58095984

>muh OOPeh
>>
>>58095936
He's railing on about how his game will be 5x faster than if it was made with e.g. Unity yet he's using linked lists where he should be using vectors and doesn't know why.

To answer your question, not much. Unless you're constantly inserting to the same place and touching the same nodes over and over again, it's unlikely anything will be in the cache in the first place and the nodes aren't contiguous so they won't be prefetched.
>>
>>58096000
clearly you should use Corona SDK so you can develop in cool, refreshing Lua instead
>>
>>58095984
RAII
lambdas
templates
>>
>>58096029
I'm sorry. I'm a complete noob. What are you getting at?
>>
>>58095984
RAII, template metaprogramming, better compile time computation, a standard library that isn't shit, etc.
>>
File: 1478104105348.jpg (21KB, 460x468px) Image search: [Google]
1478104105348.jpg
21KB, 460x468px
>>58096000
It's alright desu. Personnaly I don't if it's worth it to make a complete app in java on android instead of making a webapp that you could that way run on all platform.
>>
>>58096042
Android Studio / Java is the "right" way to develop for Android, but there are enough frameworks and shit floating around now that you can choose from several other languages if you wanted to.

That's all.
>>
File: lel4.gif (2MB, 369x271px) Image search: [Google]
lel4.gif
2MB, 369x271px
>>58096047
>a standard library that isn't shit

T O P L E L
O
P
L
E
L

it took decades for sepples to include hashmaps and other basic stuff.
>>
>>58096082
You might have a point if he said "a standard library that wasn't once shit".
>>
>>58096000
developing for mobile is like having aids and cancer at the same time
>>
>>58096070
Oh. Honestly I'm just trying to be as hire-able as possible. I'm trying to tackle this whole thing as honestly as possible. Don't want to venture into Linux and pick up on C++ or whatever just because /g/ agrees with it or whatever. Just curious if there's a good reason why this is a bad way to learning.
>>
>>58096082
First, this is a comparison to C. Second, so what? The entire STL could have been written yesterday and it would have no impact on an evaluation of its current strengths and weaknesses.
>>
hey guys is there a chatroom that i can join that can help me wiith android development using androidstudio?
>>
>>58095170
>The people in these threads or people who use Lisp?
in these threads, Lisp is the ultimate programming language.
>>
>>58096209

>>>/g/dpt/
>>
>>58096261
>Lisp is the ultimate programming language
No it's lambda calculus
>>
>>58096261

No, Ruby is :3.
Because Ruby is also the name of the only girl we have here :3.
>>
Guess what I'm making fun of

>
)))))))))))))))))
>>
Made a little PBM-drawer tool. It's just part of a bigger project (sampling entropy from zener-diode-noise) but i'm stuck having fun drawing some bitmaps

#include <iostream>
#include <fstream>
#include <time.h> //time()
#include <stdint.h> //uint8_t
#include <cmath>

#define WIDTH 400
#define HEIGHT 400

int main(int argc, char **argv)
{
srand(time(NULL));

std::ofstream pbm("bitmap3.pbm", std::ios::out | std::ios::binary);

//write header
pbm.write("P4 400 400 ", 11); //To Do: Pass as string so my defines are actually usefull

//data, body array
uint8_t data[WIDTH * HEIGHT];
int bit;

for (int i = 0; i < WIDTH * HEIGHT; i++) //for every bit (pixel) in bitmap
{
for (int j = 0; j < 8; j++) //for every bit in byte, since pbm is drawn byte per byte, rep. 8 pixel
{
bit = (j / M_PI < sin(i)) ? 0 : 1; //drawing logic here

/**
* little trick we need since .pbm files represent
* pixels as bits - but we write bytes to our file.
*/
data[i] = (data[i] << 1) | bit;
}
}

//casting, because .write needs char array
pbm.write((char*)data, sizeof(data));

pbm.close();
}


pic is i*i*i < j
>>
>>58096303

j/PI < sin(i)
>>
>>58096278
I've programmed in quite a few languages, the ones I found fun were Common Lisp, Racket, Scheme, & Clojure

C/++ were pretty good man, but I wouldn't call them fun

Python and Lua were alright

Java made me want to feel the cool touch of a shotgun barrel on my tongue
>>
>>58096290
awnn tru tbqh senpai she is co qt gurl power gurl boss
>>
>>58096302
your pathetic life
>>
>>58096278
No it's SK combinator calculus
>>
>>58095984

None.

Just retards pushing the "better C" meme.
>>
>>58096352
Wrong.
>>
>>58096302
That's not valid, it needs to be
((((((((((((((((faggot))))))))))))))))
>>
>>58096303
Neat. If you're using C++ you should use <random> instead of C's random number generation, it's much better.
>>
File: memes.jpg (88KB, 495x741px) Image search: [Google]
memes.jpg
88KB, 495x741px
>>58096334
>I've programmed in quite a few languages, the ones I found fun were Common Lisp, Racket, Scheme, & Clojure
Never used clojure but seems about right.

>Java made me want to feel the cool touch of a shotgun barrel on my tongue
pic
>>
>>58096303

Any reason you're not doing this with full-color bitmaps?
>>
File: 1394090826729.png (17KB, 448x380px) Image search: [Google]
1394090826729.png
17KB, 448x380px
>Mfw C/C++ can't even do the average of an int
>>
>>58096408

explain this meme pls.
>>
I haven't really thought about it, but is web scraping even legal?

Can i make web scraper and sell it to other people?

What if i make one web scraper, store everything in an online database and all people get data from that database instead of site? Does that make any sense?
>>
>>58096402
Clojure's best feature is the same reason it absolutely fucking sucks, you pretty much already know it if you know any other lisp, I mean it's fucking lisp, but Clojure compiles to JVM bytecode, which is fucking cool if you ask me, the only downside is that clojure compiles to jvm bytecode and so certain concessions have to be made, because JVM is horrible

I'm not a programmer, not even close, but from what I've seen of clojure the only time it goes wrong is when it has to implement some ugly workaround for the sake of running on jvm

JVM might be bad, but I can't argue with that portability, and if Clojure means I don't have to write Java to write Java programs, I'll cram in all the fucking (recur) statements I fucking need to
>>
>>58096494
You might be violating the site's terms of agreements.
>>
>>58096408
There are many types of average, when not specified usually the term refers to arithmetic-average. Which can be defined as the sum of the terms divided by the number of the terms.

(You) said:
>an int
Which indicates only one term. Then the arithmetic-average would be the term divided by one. Since dividing by one doesn't require any arithmetic transformation absolutely anything, in any language is capable of doing it. Even a potato.

So, yes, C/C++ can average 'an int'.

You are a dumb meme poster.
>>
>>58096388

thanks! it was just for testing purpuse. the goal of the project is to produce true random bit sequences using a metastable digital circuit involving schmitt triggers and amplified zener noise as source.

>>58096407

see above, i want this just as a quick test if something goes very wrong with my 'random' bits
>>
>>58096113
what you're doing is fine, frameworks and web apps are the "lazy" way to do things, it's not what you should be learning with, you should do it properly with java and the plain android API
>>
Will I regret learning Forth? I am considering flashing AmForth onto an avr to dick around with
>>
>>58096519
Do sites own literally everything on their sites?
>>
>>58096604
>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.

Bottom of this very page
>>
>>58096595
can't even grasp what a framework really is.
>>
File: Untitled.png (2KB, 195x100px) Image search: [Google]
Untitled.png
2KB, 195x100px
Holy FUCK I just realized that the percent sign was chosen for modulo because it kind of looks like a division sign.
>>
>>58096523
What if that int is an array of ints?
>>
File: anon sucks dick.png (9KB, 994x183px) Image search: [Google]
anon sucks dick.png
9KB, 994x183px
>>58096615
Congratulations... you're a failure
>>
>>58096647
division and moudlus isnt the same thing tho
>>
>>58096494
that seems sketchy, it's one thing to post a scraper for free on leddit but another to make a business out of it, i think you should consult a legal expert before you proceed with this
>>
>>58096615
Yeah, i guess i'll have to read more about these things
>>
>>58096596
Probably. I can't see any use of Forth nowadays. If you want a stack-based language, just use C and don't allocate anything.
>>
>>58096647

they dont do the same thing
>>
>>58096647
Well that's just...

Holy fuck

>>58096660
I copy-pasted it from the bottom of the page, not sure what's up with your prowser but it's fucking down there
>>
>>58096706
>he uses unity
>he doesn't use 4chanx + oneechan
you're a failure
>>
>>58096728
>>he doesn't use 4chanx + oneechan

nonfree
>>
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Without my explicit permission. Any violation of the following might result in a fine of a rare pepe
>>
>>58096646
it's kinda like they build their own stuff on top of the android API to try to simplify it. the benefit can be that it's easier and quicker to get something going but it can have drawbacks like being more limited in functionality and being more inefficient in terms of performance, and if you only learn some framework then your experience with that framework is not worth much if an employer wants you to use the official android API or some other framework
>>
>>58096649
Than it's an array of ints, not an int.

Also, it could be an array with one or zero elements.
>>
>>58096728
>4chanx + oneechan
I don't, my script feels just enough desu.
>>
>>58096740
>nonfree
https://github.com/ccd0/4chan-x
https://github.com/nebukazar/StyleChan
Well?

There's the source code faggot
>>
File: Untitled.png (41KB, 902x164px) Image search: [Google]
Untitled.png
41KB, 902x164px
>>58096665
I know they aren't. But I was just reading Chapter 24 of Code and made the connection. This book is full of mind fucks that make the whole world clear.
>>
File: fine.jpg (49KB, 685x194px) Image search: [Google]
fine.jpg
49KB, 685x194px
>>58096742
>>
>>58096761

Alright, then it's slow.
>>
>>58096486
it's not very straightforward to average two ints in C without casting to a different type because the ints must not overflow so you can't just do (a + b) / 2
>>
>>58096728
>>58096740
This

Unity is actually really good on a tablet, which is what this is, Cube i7 Stylus, thank you /csg/
>>
File: Capture.png (35KB, 802x632px) Image search: [Google]
Capture.png
35KB, 802x632px
>>58094819
Experimenting with some noise functions and how to generate images. Ultimately i want to use it for creating world maps
>>
>>58096768
Yo hold up.
Pay up goy
>>
Can your language easily handle correct integer exponentiation?

pow(2, 99999999999, X).


Check&Mate, imperative/functional/oo tards! Logic programming wins again!
>>
>>58096762
Also I'm aware that integer division is not the same thing as modulus.
>>
senior software student feeling like shit. I graduate in less than a year and I have zero side projects outside of the things I've done in my classes. I'm goddamn sick of programming problems, I'd like to make actual full applications.

no idea where to even begin with 99% of the ideas I can come up with. and I don't want to program a calculator or implement mergesort. I would like to do something interesting.

ideas I've had:

P2P application
CLI TODO list
simple text editor

as stated, I don't even know where to begin with many of these non-trivial "intermediate" application programming ideas. hell, I don't even know what I don't know.
>>
File: 1474096937725.jpg (218KB, 600x600px) Image search: [Google]
1474096937725.jpg
218KB, 600x600px
>>58096780
>>
>>58096792
What is it about this image that makes me VERY uncomfortable?
>>
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Without my explicit permission. Any violation of the following might result in a fine of a rare pepe

- Rachit(You)!!RGWbU5+r4hz
>>
>>58096774
and even casting to a long is not certain to work because a long can be the same size as an int, and casting to int64_t is not certain to work either because a plain int is allowed to be 64 bits
>>
>>58096792
Shadilay
>>
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Without my explicit permission. Any violation of the following might result in a fine of a rare pepe
>>
>>58096778
>>58096303

team up
>>
File: 1.png (2KB, 404x404px) Image search: [Google]
1.png
2KB, 404x404px
>>58096303
Can you do the same with PNG images?

i mean first you write the header dor png images and then write the data you want?
>>
>>58095677
Avoid windows specifics always.
Go for opengl or something that uses opengl.
>>
This is my post.

You can't:
-Read it.
-Copy it.
-Print it.
-Screenshot it.


Without my explicit permission. Any violation of the following might result in a fine of a rare pepe.
>>
>>58096831
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Where's your God now?
Without my explicit permission. Any violation of the following might result in a fine of a rare pepe
>>
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Without my explicit permission. Any violation of the following might result in a fine of a rare pepe.
>>
Is XInput the only decent Windows API?
>>
>>58096846

sure thing, but writing the actual image data is a lot more than "1 for white pixel / 0 for black pixel".

maybe i'll play around with it later. could be very psychedelic experimenting with different inputs and colors..

https://www.w3.org/TR/PNG-Structure.html
>>
>>58096917
>only decent Windows API
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365198(v=vs.85).aspx
Though nobody explains it well. And things are poorly named. When you know it you know it's good because it's simple and effective.
>>
ǝdǝd ǝɹɐɹ ɐ ɟo ǝuiɟ ɐ ui ʇlnsǝɹ ʇɥƃiɯ ƃuiʍolloɟ ǝɥʇ ɟo uoiʇɐloiʌ ʎu∀ ˙uoissiɯɹǝd ʇiɔildxǝ ʎɯ ʇnoɥʇiM

˙ʇi ʇoɥsuǝǝɹɔS-
˙ʇi ʇuiɹԀ-
˙ʇi ʎdoƆ-
˙ʇi pɐǝɹ-

:ʇ,uɐɔ noY
˙ʇsod ʎɯ si siɥ┴
>>
>>58096980
That looks a lot like Armenian.
>>
>>58097036
More like Australian.
>>
File: robot eyebrows.gif (302KB, 307x281px) Image search: [Google]
robot eyebrows.gif
302KB, 307x281px
>>58096914
This is my post.
You can't:

Buy it, use it, break it, fix it,
Trash it, change it, mail - upgrade it,
Charge it, point it, zoom it, press it,
Snap it, work it, quick - erase it,
Write it, cut it, paste it, save it,
Load it, check it, quick - rewrite it,
Plug it, play it, burn it, rip it,
Drag and drop it, zip - unzip it,
Lock it, fill it, call it, find it,
View it, code it, jam - unlock it,
Surf it, scroll it, pause it, click it,
Cross it, crack it, switch - update it,
Name it, rate it, tune it, print it,
Scan it, send it, fax - rename it,
Touch it, bring it, pay it, watch it,
Turn it, leave it, start - format it.

Technologic
Technologic
Technologic
Technologic
>>
>>58096980
gamarjoba genazvale
>>
>>58097154
noiec
>>
>>58097154
here have some 4chan gold
>>
quick

ctrl+v whatever code is currently in your clipboard
>>
>>58094819
Sauce
>>
File: image.png (194KB, 1680x1050px) Image search: [Google]
image.png
194KB, 1680x1050px
>>58094819
>What are you working on, /g/?

Exploring the deepest, darkest corners of Racket by doing Advent of Code 2016.

>>58095695
lainchan is trash.
>>
File: Capture.png (33KB, 802x632px) Image search: [Google]
Capture.png
33KB, 802x632px
>>58096778
I have literally no idea what im doing, im using java's built in Random class. Switching from nextInt to nextFloat made some of the pixels look partly transparent
>>
>>58097154
upvote, subscribed, bell't, bought 4chan gold.
>>
>>58097261
>Advent of Code
top kek
>>
>>58097226
44b9071e2a65

Technically, it's a code.
>>
>>58096790
Same boat. No idea what to build for my portfolio.
>>
This is my post.
It's in the public domain.
It's not my post actually...
Well fuck.
>>
File: .jpg (122KB, 960x719px) Image search: [Google]
.jpg
122KB, 960x719px
When embedded programming is embedded and when it's not?
It's kinda amusing how power machines of ten years old can be considered embedded now.
>>
>>58097226
This is my post.
You can't:

-Read it.
-Copy it.
-Print it.
-Screenshot it.

Without my explicit permission. Any violation of the following might result in a fine of a rare pepe.
>>
File: 1379434745215.gif (580KB, 480x360px) Image search: [Google]
1379434745215.gif
580KB, 480x360px
I need some help.

I have a huge-ass text file and I have to truncate it to 80 chars max in a row. Also it must be no less than 80 chars in a line, so i have to add spaces between words to make a row have exactly 80 characters.

The language that I must use is Python. Any ideas on how to do this?
>>
>>58097294
If it can run a JVM on it, it's not embedded.
>>
>>58096790
Check out the source code of DHT and make a small bittorrent client. You will basically learn everything you need about networking.

https://github.com/jech/dht
>>
>>58097317
So some Siemens phone is not embedded?
>>
File: Screenshot_20161220-143408.png (437KB, 1080x1920px) Image search: [Google]
Screenshot_20161220-143408.png
437KB, 1080x1920px
>>58097295
I'd print it but I don't have a printer in my office rn.
>>
>>58097295
I'm printing and framing it on my wall
>>
>>58097327
No. It's retarded management and lazy Pajeet.
>>
>>58097310
>Any ideas on how to do this?
Several.
>>
>>58097359
Do tell, friend.
>>
File: .gif (170KB, 250x188px) Image search: [Google]
.gif
170KB, 250x188px
>>58097349
I need to stop talking to robots.
>>
>>58097310
fold -w 80 -s text.txt
>>
>>58097396
that ain't python boi
>>
>>58097377
I am not a robot.

Copyright (C) 2016-2016 Anonymous

Permission is hereby granted, free of charge, to any person obtaining a copy of
this post and associated documentation files (the "Post"), to deal in
the Post without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Post, and to permit persons to whom the Post is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Post.

THE POST IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE POST OR THE USE OR OTHER DEALINGS IN THE
POST.
>>
>>58096790
Kinda in the same boat as you. I graduated in May, but I've been unsuccessful finding a job so far since I have no internship experience. Making anything is better than nothing to bolster your portfolio, though, and you have to start with something simple/boring to establish a foundation for yourself. Also, you can always make something novel/interesting that's really simple, just by virtue of it not having a precedent. Look at Snapchat: that couldn't have been terribly difficult to program in its early stages, and it ended up being hugely successful. Just don't write something autistic like a mobile application for reading manga
>>
>>58097404
fuck you faggot
>>
>>58097428
>having passion for anything is autistic

i bet you go on /r/cringe
>>
Does anyone have any experience with Objective-C and Apple's ScriptingBridge? I'm trying to have my program flash a light when an imessage is received. In applescript, receiving messages is part of an event handler. How would I go about listening for events in a specific application (messages) in an objective-c program?

There's nothing in the scripting-bridge-generated header file about receiving messages.
>>
>>58097294
when it's something that's not made to be reprogrammed like a gps or a washing machine that's embedded

when it's not a general-purpose computing device but it has more advanced general-purpose capabilities like if it runs android or something then it'd be better labeled as IoT
>>
>>58097310
Why use sneklang when there are other cli utilities that can accomplish this much more simply?

Help me understand you
>>
>>58097428
>Just don't write something autistic like a mobile application for reading manga
>He typed, before posting his message to his favourite anime/manga subculture anonymous image board.
>>
>>58096778
>>58096303

The three of us could do some gay stuff together.
>>
>>58097498
It's an assignment. If it was my own concern, I'd just turn on word wrap in notepad and tell everyone to fuck off.
>>
I'm working on a decentralized TV system. I'm currently polishing up the networking and working on a formal TODO list in org-mode.

What podcasts/radio/streams does /g/ like? I want to get an SDR so I can forward random frequencies onto the network, but that's for another time.
>>
File: green blue.png (138KB, 802x627px) Image search: [Google]
green blue.png
138KB, 802x627px
>>58097523
>>
>>58097534
you have the C implementation here

http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/fold.c

just translate it to python
>>
>>58097453
>>58097504
Easy, boys, just messin. Obviously if there's any professional constituency that'd be amenable to waifus it'd be programmers.
>>
>>58097504
Which one? Don't you dare talking about Tachiyomi like that.

FOOL
>>
>>58097546
I'm also working on a webcrawler that farms PLS files and live streams from Google and downloads them live.
>>
>>58097504
been browsing 4chan since 2007 and I have never watched / had a modicum of interest in manga / anime / japanese cartoons
>>
File: map4.png (55KB, 556x604px) Image search: [Google]
map4.png
55KB, 556x604px
>>58097547

Random walk is a good way to generate maps, btw.
>>
>>58097629
>I have been wandering inside a library for ten years and never opened a book
>>
>>58097523

zenerdiode/PBM dude here,

post github, or mail. can't wait
>>
>>58097653

Anime is trash.
>>
>>58097653
Yep. Guess so. Although to be honest, I used to jack it to ecchi sometimes when I was younger.
>>
>>58097653
so?
>>
>>58097629
I would not say that like you're proud of it. It's like like browsing 4chan is any less social cancer than reading manga. Quite the opposite in fact.
>>
>>58097662

Join the /dpt/ discord.
>>
File: oneslowgtp.jpg (102KB, 500x1200px) Image search: [Google]
oneslowgtp.jpg
102KB, 500x1200px
>>58097666
>>
>>58097697

Sorry, https://discord.gg/srNPb

There we go.
>>
>>58097666
I don't know if you're including Evangelion when you say that, but you better not be.
>>
>>58097648
>Random walk
Thanks, im gonna look it up
>>
>>58097697
>>58097715
Discord is a cancer. The only reason people go there is to be part of the shitposting illuminati that conspire to ruin these threads.
>>
>>58097759

Okay.
>>
File: .png (106KB, 249x254px) Image search: [Google]
.png
106KB, 249x254px
You've been said to not to reply to tripfags.
You've been said to not to talk to tripfags.
Why the fuck you feed their ego more and more?
>>
>>58097310
import subprocess
...
result = subprocess.Popen("fold -w 80 -s text.txt", shell=True, stdout=subprocess.PIPE).stdout.read();

:^)
>>
>>58097715
>https://discord.gg/srNPb

thanks man.

- entropydude
>>
>>58097871
import os

os.system("fold -w 80 -s text.txt")
>>
File: dff.jpg (35KB, 837x736px) Image search: [Google]
dff.jpg
35KB, 837x736px
What's the difference between the Pub/Sub pattern and the Observer pattern?
>>
>>58097907
Some guy on stackoverflow told me to use subprocess instead of os without clarifying why, so I'm going to go ahead and say your code is shit.
>>
>>58097911
that is the observer pattern.
>>
>>58097921
lmao

kys
>>
>>58095229
>The former is preferable for for external content.
why is that?
>>
>>58097931
>kys
Go kys you're self
>>
File: pepe punching.png (123KB, 785x757px) Image search: [Google]
pepe punching.png
123KB, 785x757px
>>58095135
oh, it's you again
>>
>>58097911
They're both shitty Indian turds.
>>
>>58097943
dumb redditor
>>
>>58097934
It might be malformed or contain XSS attacks.
>>
Don't know if anyone is familiar with assembly (any assembly language, should be similar on any platform), but does anyone know how to make use of bss segments? I understand what it is, I'm just not sure how to do anything useful with it, but there must be something you can do with it otherwise there'd be no reason for assemblers to include the functionality.

Right now the only thing I can seem to do is declare a bss segment then allocate a bunch of memory to uninitialized variables, which makes sense. But I can do that just by equating variable names to a memory address. Is that all it's good for? Allocating memory without manually setting each address?
>>
>>58097715
>people unironically go into discord for a javascript general
>>
>>58097954
Say you made a game and you wanted it to be plugin friendly, how would you do it without the observer pattern?
>>
>>58098106
You're just adding data/scripts..?
>>
>>58098106
>hur
>>
>>58098106
Why *would* you need an observer pattern for plugins?
>>
File: 2016-12-20_20-34-15.jpg (69KB, 300x385px) Image search: [Google]
2016-12-20_20-34-15.jpg
69KB, 300x385px
What did edx mean by this?
>>
>>58098106
>>58098131
Also, callbacks/continuations are not bad in general. Observer is bad because it makes objects (observables) responsible for maintaining a collection of observers themselves instead of just storing and calling a single closure.
>>
>>58098142
So plugin creators can do stuff when events get triggered.
>>
File: 1onkey.png (107KB, 380x380px) Image search: [Google]
1onkey.png
107KB, 380x380px
>>58098149
Probably those are literal code monkeys.
>>
>>58098179
I didn't realize looping through things and calling methods on them was the Observer pattern.
>>
Passive events > your shit
>>
Any programming blogs you guys follow/read ?
>>
>>58098217
How is a plugin creator supposed to detect the death of a player without notifications/events?

Have a loop running 24/7 checking an isAlive variable every millisecond?
>>
>>58098277
by having a method called "playerDeath()" in the plugin that your program calls when the player dies.

You don't need a subscriber pattern.
>>
PROGRAMMING CHALLENGE:

Write a function that takes a natural number and returns a matrix representing the corresponding iteration of the procedure detailed in pic related.

Some example outputs
>> s(1)
[[ 0, 1, 1],
[ 1, 1, 1],
[ 1, 1, 1]]


>> s(2)
[[0, 0, 0, 1, 1, 1, 1, 1, 1],
[0, 0, 0, 1, 0, 1, 1, 1, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 0, 1, 0, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 0, 1, 1],
[1, 1, 1, 1, 0, 1, 1, 1, 1]]
>>
>>58098277
The plugin can be notified of things without Observer. Observer is specifically that you have a Subject with a list of Observers (I weep for separation of concerns and DRY) and that the Observers add themselves to this list, and it's all nice and OO.

More likely what you do is you load the plugin DLL or script, grab the functions from it, and put them in lists that way.
>>
>>58098296
>PROGRAMMING CHALLENGE:
That's not how you spell PLEASE DO MY HOMEWORK
>>
>>58097715
Expired
>>
>>58098337
Posting my solution would discourage people from participating.
>>
>>58098355

Here's another: https://discord.gg/4fCmQ
>>
>>58098394
Discord really is the cancer of generals, wish Hiro would put it in the spam filter.

At least you're not trying to force it in the OP, I guess.
>>
File: hqdefault.jpg (18KB, 480x360px) Image search: [Google]
hqdefault.jpg
18KB, 480x360px
>>58094819
Sauce plz
>>
File: .png (7KB, 377x330px) Image search: [Google]
.png
7KB, 377x330px
>>58098364
Sometimes I want to learn some useless and redarted language so I could post my solutions and no one would make actual use of them.
I think INTERCAL is overkill, though.
>>
>>58098337
Are you mentally retarded or just a fucking idiot?
>>
>>58098295
I guess you could make do with that, I still think listening for events feels comfier.
>>
>>58098431
It's not Haskell.
>>
Why is everything involving graphics programming so annoying? Why must I learn to use glut and glew on top of having to deal with opengl's weirdness just to render a fucking red triangle? (Rethorical question, I know opengl doesn't know about the graphical environment, but ffs).
>>
>>58098445
>feels comfier
What the fuck?
>>
>>58098415

We're discussing the off-topic stuff in there (like black waifus), thereby keeping it off of this thread.
>>
>>58098465
>Haskelol
>>
>>58098466
What do you want to do with graphics programming? Are you a /agdg/retard or do you just want to mess around with interesting visualizations?
>>
>>58098491
There's nothing wrong with discussing off-topic things in here.
>>
>>58098521
So what did you do today? Met somebody interesting?
>>
>>58098512
If I were an /agdg/tard I'd be using a meme framework to make my meme RPG. I'm trying to make a game, yes, but just as an interesting application of concepts I've learnt in uni.

We were taught how to use webgl, which sidesteps the issue of rigging together libraries that cover very different topics.
>>
>>58098602
>If I were an /agdg/tard I'd be using a meme framework
what's wrong with that?

if i don't want to spend time making an engine, i'll use something like Unity and C#
>>
>>58098672
>what's wrong with that?
There's nothing wrong with it and I'm not suggesting you seriously write a game in 2016 by first writing your own game engine, but using an engine wouldn't give me the opportunity to use what I learnt in my computer graphics class.
>>
File: VID_20161221_011818980.webm (2MB, 1920x1080px) Image search: [Google]
VID_20161221_011818980.webm
2MB, 1920x1080px
it werks :-)
>>
>>58098725
neat
>>
>>58098466
>Why must I learn to use glut and glew
Creating windows and OpenGL contexts with Win32, Xlib, etc. is hell, glut deals with that. OpenGL commands come from the graphics driver and not something you can link to, glew deals with that. Vulkan improves on this considerably but most people might find it "annoying" in another sense due to its lower level nature.

If you just want to fuck around, try something like Processing or openFrameworks. Or a game engine if you want to make a game.
>>
>>58098771
>OpenGL commands come from the graphics driver and not something you can link to, glew deals with that.
Is it just me or does this sentence not make any sense?
>>
>>58098771
Vulkan is easy. You can create a window and draw a triangle on it in about 10 lines of C++.

Wait... I mean 1080 lines.

https://github.com/SaschaWillems/Vulkan/blob/master/triangle/triangle.cpp
>>
>>58098812
By command I mean function. The graphics driver provides the dynamic library that the functions are loaded from, and you access that library in a platform-specific manner. So you use glew and it just werks.

>>58098813
Vulkan is considerably simpler to initialize and attach to a window than OpenGL is, that's all I meant.
>>
File: 200%bother.gif (2MB, 279x350px) Image search: [Google]
200%bother.gif
2MB, 279x350px
In objective C, how can I tell what's included in a category? There's a header file that I'm trying to use, but one of the classes has a category tacked on that I suspect has things that I need, but I can't find any documentation anywhere.

The code is
@interface MessagesApplication (MessagesSuite)[/suite]

I'd like to know how to find out what's entailed in 'MessagesSuite', and how to access it.
>>
>>58098847
aaaaaaaaand I fucked up my tags because of being retarded. That [/suite] should be [/code]
>>
>>58098812
>>58098837
Like, the process for getting your OpenGL context on Windows is to:
1. Create a dummy window
2. Create a dummy context
3. Use the dummy context to load context extensions for your real context
4. Create the real window
5. Create the real context using the dummy context
6. Free the dummies
And this is all using Win32, so it's even worse than it sounds on paper.
>>
How do I program a gf?
>>
Making a script to download something off the web.
How would you make it try downloading again in an hour if it didn't work the first time? Would you need an outside program and tell it to run the script every hour and then in the script have something that checks if it's downloaded already for the day?
So something at the start like
if downloadedToday = 1
exit
else
try download
downloadedToday = 1
catch
downloadedToday = 0 //didn't download today so try it again in an hour
>>
>>58098907
MKUltra
>>
Is there an fsnotify package for Go that supports renaming properly (with the resulting filename instead of just the original)?

fsnotify doesn't and it states some rubbish about inotify not supporting it; but there is a rust wrapper around it that does.
>>
>>58098985
And when I say fsnotify in the first instance, I mean inotify.
>>
>>58098933
what?
>>
>coding exercise
>author shows the benchmark on a 5 year old system
>my 2 years old system is three times as fast
Jesus I never realized modern computers were so fucking fast
>>
How can i display 2 dimensional array information on listview? for android
>>
Rip apart my random string generator /g/.
>>
>>58098425
>>58097236
We demand a source!
>>
>>58099034
>fopen(/dev/urandom)

Not portable.
>>
>>58099034

Use stderr instead of println for error messages
>>
>>58099005
MKUltra was a (now declassified in part) CIA program to try and program people to act in certain ways to either discredit them as witnesses or make them give confessions, mostly through torture and LSD.

We only know about it now because of a paperwork error that saved a sliver of all of the records (paperwork that was supposed to be destroyed was mismarked and sent to another building).

MKUltra is also famous for radicalizing the unabomber, but he was pretty crazy before he was drugged up and interrogated, so that doesn' t have firm 100% footing

If you were to program her, this would probably be how
>>
>>58094819
I couldn't finish that anime
I tried but I simply couldn't
>>
>>58098296
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>

void clear(int side, int stride, bool *arr)
{
for (int i = 0; i < side; ++i) {
for (int j = 0; j < side; ++j) {
arr[i * stride + j] = true;
}
}
}

void _s(int side, int stride, bool *arr)
{
if (side == 1)
return;

int del = rand() % 9;

for (int i = 0; i < 9; ++i) {
int new_side = side / 3;
bool *start = arr + (i % 3 * new_side) + (i / 3 * new_side * stride);

if (i == del)
clear(new_side, stride, start);
else
_s(new_side, stride, start);
}
}

bool *s(int n)
{
int side = pow(3, n);
bool *arr = calloc(sizeof *arr, side * side);

if (!arr)
return NULL;

_s(side, side, arr);
return arr;
}

int main(int argc, char *argv[])
{
if (argc != 2)
return 1;

srand(time(NULL));

int n = atoi(argv[1]);
bool *arr = s(n);

int side = pow(3, n);
for (int i = 0; i < side * side; ++i) {
if (i && i % side == 0)
putchar('\n');

putchar(arr[i] ? ' ' : '#');
}
putchar('\n');

free(arr);
}
>>
>>58099050
you saw eyes wide shut?
>>
>>58099035
It's called himegoto an it's really bad
>>
>>58097396
>>58097396
import os
os.sytem('fold -w 80 -s text.txt')
>>
>>58099046
What would you do to fix this? I only really care about gnoo/lunix tho.
>>
>>58099059
>>58099085
you guys should read the manga instead, it's not shit
>>
>>58099068
nope (but it is on my list), just browse /pol/
>>
>>58099046
>caring about winblows
>>
>>58099100
C++11 has random number generators built into the spec
>>58099116
>not caring about a large percentage of users
As much as I hate to admit it, I have to make my programs work for Windows if I ever want them to be popular
>>
>>58099065
Good job.
>>
>>58099116
There are plenty of operating systems that don't have /dev/(u)random.
>>
>>58099134
>ever want them to be popular
Not everyone is so vain that they think everything they write will be popular.
In fact, I expect that none of programs I write are going to be popular. I just write shit that I want to use myself.
>>
Is an array still contiguous in memory if you change it's array elements?
 Int[10] g = [0,1,2,3,4,5,6,7,8,9]
g[0] = 5
g[1] = 3

Is g[0] and g[1] still next to each other in memory?
>>
>>58099184
yes
>>
>>58099102
meh, the feminization bullshit is having bad effects on the health of my psyche
I'd rather avoid it altogether desu senpai
>>
>>58099215
>the feminization bullshit is having bad effects on the health of my psyche

if you're self-inserting as hime and finding it uncomfortable, you have issues.
>>
>>58099177
>implying every project is the same
I'm making that decentralized TV system, so it actually functions better as a whole when more people use it (more storage, more bandwidth, more reliable). I don't expect everything to be popular, but there are some I want to see take off.
>>
>>58099231
What does that even mean
>>
>>58099249
cute
>>
>>58099280
see
>>58098933
>>
What can I do about mediocre developers on my team who are willing to learn? Every result online is philosophical drivel. I need practices, strategies, and material. Firing is not an option for a few months
>>
>>58099272
it means stop taking things so seriously it's just a story
>>
>>58099298
Project Euler, if they do low level stuff, have them check out the Eudyptula challenge
>>
>>58099298
hackerrank

reddit.com /r / dailyprogrammer
>>
New thread:

>>58099323
>>58099323
>>58099323
>>
>>58099298
>What can I do about mediocre developers on my team who are willing to learn
Do you say that in a good or bad way? Because I'm one of those
>>
>>58099447
In a sense, it is bad. Because a good developer grows on their own. But I still believe people can be shaped in this way. In a job environment it just takes too much time.
>>
>>58095984
OOPoo
>>
>>58095417
>not just using bitblt and writing your own GUI elements
Thread posts: 315
Thread images: 46


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

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


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