[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: 308
Thread images: 31

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>57586087

What are you working on /g/?
>>
Anime is garbage
>>
the other one just got deleted
why are the mods such cunts
>>
>>57592148
Traps are not allowed.
>>
>>57592156
but this op is a trap too
>>
>given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?

any haskell gurus know how i should approach this?
>>57592156
there's a trap in this op too. it's from rakudai kishi no cavalry
>>
So C primer plus or what book for C?
>>
>>57592162
>>57592167
Are you so delusional that you think there is a penis on everything?
>>
>>57592167
use haskell to open photoshop
rotate 90 degrees
export to same file format
???
PROFIT
>>
>>57592180
http://rakudai-kishi.wikia.com/wiki/Nagi_Arisuin
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 16 year old

You are a programmer, not a coder

Software Alchemist is GOAT
Developer is okay
Magician is okay
Software Magus is okay
Software Engineer is okay
Software Architect is okay
Computational Conjurer is okay
Information Systems Sorcerer is okay
Purveyor of Programs is okay
Code Guru is questionable

Archmage is reserved for only the most senior of programmers

Writing in HTML and CSS is not programming, therefore it should be referred to as designing
>>
I want to make a website. Is learning HTML, CSS and Javascript worth it? or should I use something like Dreamweaver?
>>
>>57592210
Being petty and pedantic makes you look like a child.
>>
57592210
not one word
>>
>>57592210
Where does "femnigger" rank on this list?
>>
Java/C++ developer here, my job is slowly being converted from writing applications to data validation and report building using SSRS/SSIS and other Microsoft products..

Been thinking about practising some embedded coding for a couple jobs near me.. Would .NET Micro Framework be the best to dig into?

Any recommended books and/or projects to try to practice Embedded programming on?
>>
You guys are quite fucking impolite, what the fuck ? I thought /dpt/ was family friendly.
>>
>>57592276
Fuck off
>>
>get a lot done
>can't check any of it in because I need to spread out my commits so my github calendar has something every day

I hate myself
>>
File: 1478919107579s.jpg (6KB, 250x130px) Image search: [Google]
1478919107579s.jpg
6KB, 250x130px
>>57592276
sorry about the rudeposters
>>
>>57592276
kys my friendo
>>57592364
why do you have to commit something every day?
it will show that you once submitted a quadrillion lines, that should be enough for a couple days
everyone with a brain will see that you can take time off after a big commit
>>
File: jh.jpg (73KB, 775x719px) Image search: [Google]
jh.jpg
73KB, 775x719px
Irrational numbers are spooky.

How can they just go on forever and not repeat?
>>
>>57592364
why tho?
>>
>>57592410
>spook theorem.pdf
>>
>>57592410
Through God, all things are possible
>>
>>57592167
study this
[1,2,3
,4,5,6
,7,8,9]
`ninety`
[7,4,1
,8,5,2
,9,6,3]

do you see the pattern?
>>
>>57592442
oops, ninety is supposed to be unary
anyways, ignore it
the second list is the output
>>
>>57592426
autism
>>
>>57592132
writing a robot that will apply to jobs and stuff on craigslist.

i got taht part wrote now to how sending emails? i'm using python btw any libraries that make sending emails with possible attachemnts good use?
>>
>>57592223
HTML/CSS and Javascript are the current staples for front end web development. But you will also need to learn HTTP and back end programming which could be a ton of languages. Elaborate on what you want to make.
>>
>>57592167
if its nxn, then
ninety = concatMap reverse . transpose
>>
File: mno.png (39KB, 640x480px) Image search: [Google]
mno.png
39KB, 640x480px
>>57592410
What's even more spooky is that the numbers are evenly distributed.
>>
>>57592488
that should work for NxM, though
>>
>>57592509
sin(pi) how many numberers r there?
>>
>>57592509
Only in normal numbers. Not all irrational numbers are.
>>
>>57592521
three fitty billion
>>
>>57592521
More than one.
>>
>>57592167
just did it with lists of lists
 
λ> rotateMatrix [[1,2,3],[4,5,6],[7,8,9]]
[[3,6,9],[2,5,8],[1,4,7]]
λ>

>>57592488
the data structure pages confuse the fuck out of me, other than lists and tuples. i tried to use the "matrix" import and then the array import and couldn't make sense of either
>>
>>57592557
what data structures page
>>
>>57592567
https://hackage.haskell.org/package/array-0.5.1.1/docs/Data-Array.html
http://hackage.haskell.org/package/matrix-0.2.1/docs/Data-Matrix.html
https://wiki.haskell.org/Arrays
>>
>>57592479
I have ideas for 2 websites. One is very simple (portfolio, sales) and the other one I think is complex.

I studied HTML and Java like 18 years ago but I know nothing about coding anymore, I thought about learning because I'm NEET and can't pay anyone to do this for me
>>
>>57592587
Ok, what's the problems with the imports?
>>
>>57592632
well for one it tells me
λ> :m Data.Matrix

<no location info>:
Could not find module `Data.Matrix'
Perhaps you meant
Data.Ratio (from base)
Data.Ratio (needs flag -package haskell2010-1.1.1.0)
λ>
>>
>>57592671
Data.Matrix isn't included by default. You have to install it. At the command line, type "cabal install matrix"
>>
>>57592617
Anything with dynamic content is going to require going beyond html/css/js front end stuff.

Start with relearning html/css and js then pick a modern back end framework to work with

Some back end options:
>django
>ruby on rails
>node.js w/ libraries
>Go and its 3000 back end web libraries

Also lurk /wdg/
>>
>>57592671
You're using GHCI?
Make sure you actually have the packages installed, or alternatively, you can set up a small cabal project with a bunch of dependencies, then use "cabal repl"
>>
>>57592699
Thanks
>>
>>57592689
>>57592703
i didn't even have cabal installed. it took forever installing matrix but it did. was that because of a lot of dependencies i had to DL or does it just take a long time?
>>
File: mask.jpg (1MB, 1800x1161px) Image search: [Google]
mask.jpg
1MB, 1800x1161px
Just rewrote my Python tool in C and cut down execution time from 8.5s to 1.7s.
>>
>>57592936
>img
wtf
>>
>>57592936
So are you saying you did a piss poor job or what is this tool?
>>
>>57592509
No its far more spooky when they're not.
>>
>>57593032
I did an okay job.

The tool's bottleneck relied heavily on the bitarray package (made in C) so I wondered how much of a gain I would get doing the same thing using bit arrays directly in C.
>>
implement a fold in java
>>
>>57592936
i skipped to the last line, top jej
>>
>>57592509
>the numbers have the same random chance of appearing
>there are ten numbers
>all of them have a ~1/10 frequency
Soo magical
>>
>>57580398
>wonder why my code isn't working, having taken this advice before
>undo the changes suggested in this post
>code works
>>
I've got this program for making a .tar, my teacher wants it so if I call the program again it just adds more files, but my program overrides the old file and I dont know why.

http://pastebin.com/zRSqHZHj
>>
>>57593767
See http://www.cplusplus.com/reference/cstdio/fopen/
>write: Create an empty file for output operations. If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file.
This, in particular:
>If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file.

You don't want to use fopen with mode "w" to add more stuff.
>>
>>57592410

If they did repeat, then they'd HAVE to be rational.

http://math.stackexchange.com/questions/549254/why-is-a-repeating-decimal-a-rational-number

And we know from many proofs that irrational numbers HAVE to exist.
>>
File: image.jpg (67KB, 564x857px) Image search: [Google]
image.jpg
67KB, 564x857px
>>57592210
I've been referring to myself as loser all this time.
>>
Is there a way to edit a specific index in a buffer in WebGL?
And will I have to recreate the VAO if I do that?
I'm wanting to do liquid simulations.
>>
>>57593842
I just cycled through a bunch of those options and none of the changed anything
>>
File: animereaction.png (61KB, 171x288px) Image search: [Google]
animereaction.png
61KB, 171x288px
Let's see those github profiles, /dpt/. You haven't been slacking, have you?
>>
>>57594144
I dont have github, all my code is closed source.
>>
>>57592210
"Software Developer" is what it says on my contract and what I will states for any official questionnaire. "code monkey" otherwise.
>>
>>57593568
haha, can't even do it
>>
anyone done something like this? I have a linux server running that is monitoring some things via cron jobs and want it to trigger alarm on my android phone based on what it's seeing. right now I just have it emailing me.
>>
File: hime.png (375KB, 1496x892px) Image search: [Google]
hime.png
375KB, 1496x892px
I want to write some more image filters, just for shits. What do?
>>
>>57594397
Write a filter that makes tripcodes disappear
>>
>>57592276
Welcome to 4chan.
>>
>>57594409

Not possible.
>>
>>57594428
anon was right
>>57583695
>>
File: haskell.png (786KB, 1000x1300px) Image search: [Google]
haskell.png
786KB, 1000x1300px
i love haskell so much
>>
>>57594497
haskell is cute
cute
>>
>>57592276
can you do /pol now
>>
>>57594543
he might get a virus
>>
>>57594497

(it's a shit)
>>
File: le reddit army.jpg (24KB, 500x295px) Image search: [Google]
le reddit army.jpg
24KB, 500x295px
>>57594543
>/pol
>one slash
into the >>>/reddit/ you go my friend
>>
>>57594602
says the C# dev
>>
>>57594631

C# is (((multi-paradigm))) and it's good.
>>
>>57594602
>>57594652
C# is inferior in every respect to Haskell
>>
>>57594666

Incorrect.
>>
File: trump hasn't even started.png (251KB, 553x742px) Image search: [Google]
trump hasn't even started.png
251KB, 553x742px
>>57594678
Wrong.
>>
>>57594678
Explain
>>
If hasklel is so useful why no company uses it?
>>
>>99371788
Gen Z confirmed for most based generation. If we wiped millennials off the face of the planet the world would instantly become a better place to live in.
>>
>>57594713
They're on the anti-haskell masturbation train
>>
>>57594713
It's painfully slow
>>
>>57594722
Only for large high performance applications
>>
If hasklel is so marvelous then why do universities prefer to teach lisp over it?
>>
>>57594731
Because jewniversities are filled with old, shriveled up kikes and (((LISP))) has been their favorite language since the 70s.
>>
>>57594731
Universities are fucking retarded
>>
>>57594731
I'm currently learning Haskell at my University on the contrary.
>>
>>57594678
back to /o/ fag
>>
Does anyone bother to learn perl now in days? What's it used for in the real world besides parsing large amounts of data?
>>
>>57595016

Why don't you go back to /a/ where you belong?
>>
i don't even know why everyone here fawns over lisp, it must be a meme or something

i can't even generate a hello world executable that's not 50 mb at least
>>
>>57595080
how about you go back to your board already and stop shitting up /dpt/
>>
>>57593913
>= Natural =
So all that puffy is actually the bush?
>>
>>57595104

This isn't your board, guy.
>>
>>57595087
lisp is fun
>>
>>57592132
i wrote a web robot in scrapy that applies to craigslist jobs for me. basically it mines the emails then it'll automatically send my resume to the mined emails. it can only do one email at a time though because ifi tried to mass email mine i'd throw a capcha.

   
def get_email(self, response):
email = response.xpath('//header[@class="dateReplyBar"]')
for find in email.xpath('.//span/a/@href'):
email_urls.append(find.extract())

y = 0
find_email = email_urls[y]
find_email = response.urljoin(find_email)
yield scrapy.Request(find_email, callback=self.find_email)

def find_email(self, response):
data = response.xpath('//body[@class="posting"]')
for i in data.xpath('.//li/p[@class="anonemail"]/text()'):
email_address.append(i.extract())


here's the work for the most part. i just have to mess around with some email libraries tomorrow coding session.
>>
>>57595109
>can't even read
sasuga tripfag
>>
>>57595007
I want to go to your university
>>
>>57592177
ansi c book and k&r for reference if ansi isnt enough. though k&r 2nd ed is done up for ansi, I still prefer the actual ansi c book approach. i just prefer it, though. theres no saying one is better than the other.
>>
>>57595112
speaking of which for a beginner programming i been writing software for about a week and half now how could i look into beating capcha systems?

i read ocr is it possible to take a screenshot of the capcha box then run it through some ocr and teach the robot the characters?
>>
How would one go about creating a twitter bot using python that uploads random images from a folder? I've managed to find one online, but never got it to work. I thought I would try my hand at it, but I keep running into roadblocks.
>>
>>57595158
i would suggest scrapy. that's what i used for my craigslist bot. it's extremely fucking powerful matter of fact i could've mined all every SINGLE email address off craigslist but the problem is once you start making super bots like that capcha fucks you in ass. so right now my botcan only make a few requests here and there.
>>
File: 1474363000057.png (211KB, 2672x1984px) Image search: [Google]
1474363000057.png
211KB, 2672x1984px
>>57594896
> MUH it's da J00Z I tell you
Back into the /pol you go, my stormtarded friend.
>>
how do i get this to work?
λ> let x = getCol 1 m
λ> elem 4 x

<interactive>:32:8:
Couldn't match expected type `[a0]'
with actual type `Data.Vector.Vector Integer'
In the second argument of `elem', namely `x'
In the expression: elem 4 x
In an equation for `it': it = elem 4 x
λ>
>>
>>57595173
I think python works best for twitter because I can utilize tweepy, which allows me to access the twitter api. I have the code written for the most part, I just need a piece that would look through a folder of pictures and upload one at random. I just can't seem to figure out how to write that part though.
>>
>>57595126

I can read. I'm saying this isn't his board, either.
>>
>>57595261
should be able to do it wiht os and random modules.

for kinda psuedocode it'd be with os module

for file in thisdirectory -

random.file

or something to taht effect.
>>
I see people occasionally post benchmarked C programs with their time running in ms, how do I do this?
>>
File: butthurt shoah.jpg (83KB, 700x700px) Image search: [Google]
butthurt shoah.jpg
83KB, 700x700px
>>57595216
No single person could have amassed enough butthurt to create that image.
>>
Nth for Java.
>>
Where do I find a handsome programmer who wants to marry a cute short femboy?
>>
>>57595329
check unix time function: man time or just google it.
>>
First for ocaml
>>
push pop push pop push pop push pop push pop push pop
>>
>>57595439

>>>/lgbt/
>>>/soc/

>>57595568

nop
>>
 
def randomimagetwitt(folder):
media_list = glob(folder + "*")
media = random.choice(media_list)
return media, len(media_list)
api.update_with_media(media)

randomimagetwitt('/Users/x/MEGA/Misc/homework/')

>>57595314
fug, i dont know what im doing wrong
>>
File: sad.png (80KB, 1024x610px) Image search: [Google]
sad.png
80KB, 1024x610px
I'm in a funk, /dpt/. I feel like nobody appreciates the work programmers do. People that draw get showered with praise over little more than doodles. People want to hear people sing, and people want to read poetry and what people write. I feel like no matter what I code nobody gives a flying fuck. Anybody else have this feel?
>>
>>57595610
Artists who draw doodles get praise because people enjoy their creations.
Go write software that fills a niche in people's lives and then you'll get showered in praise.
>>
>>57595367
but have you tried Kotlin?
>>
>>57595610
Make a game about anime girls.
Make a game about ponies.
Make a furry simulator.
>>
>>57595595
No, thank you. I don't want to be married to a web-developer.
>>
>>57595610

>I feel like no matter what I code nobody gives a flying fuck.
Make software that others would give a fuck about then.
>>
>>57595439
would you marry another cute short femboy? I want one to marry.
>>
>>57595744

Right, but if you're looking for a mate of any sort, /g/ is not the place to do it.

Also, it's a bit foolish to base your romantic interests on the potential career interests of your partner, unless it would directly interfere with their ability to be a good partner (i.e. probably not a good idea to date a prostitute).
>>
>>57595778
That's too lesbian for me.
>>57595801
>/g/ is not the place to do it.
Yes, I'm just shit-posting out of boredom.
>potential career
CS grads have their way of solving problems.
>>
are there any programming languages based on untyped lambda calculus?

doesn't strict typing in the long run make for difficult maintenance of functional programs since you'll need separate functions for each type?
>>
>>57595999
Lisp family, obviously.
>>
>>57595999

Lisp, perhaps?
>>
>>57596010
>>57596028
I've never used common lisp or scheme. why aren't they used more?
>>
File: 2016-11-19-20-42-07.png (33KB, 479x799px) Image search: [Google]
2016-11-19-20-42-07.png
33KB, 479x799px
>>57596028
hey ruby, i drew you a picture.

its you looking to the left from your workstation to comment at us. ill get to the body soon enough. i just dont know if i want you to have big boobs and normal hips, or normal boobs and thick thighs.
>>
>>57596079
most people aren't inteliget enough for it
>>
>>57596093
I've always brushed scheme off because I thought it was slow. What I'm reading now says that isn't true but I'm not convinced.
>>
>>57596079
Scheme appeared as a teaching language and good common lisp implementation require by runtime environments. They are still used, though.
>>
>>57596087

I don't have boobs, my hips are relatively normal for a man, I don't wear glasses (you seem to be depicting me with them when I have 20/20 vision), my hair is longer than that, and I have a beard.

>>57596079

Parentheses, and the existence of more feature-filled dynamic languages.
>>
>>57596132

Scheme performance really depends on which version you're using. Chicken Scheme can be fast, since it compiles to C, while TinyScheme has shit performance since the focus was on simplicity of implementation.
>>
>>57596303
not from where I'm standing
>>
>>57596358

Then you are perhaps blind.
>>
I'm trying to understand enum in C.
typedef enum { FALSE, TRUE } Boolean;


Would the following be the same:
typedef struct { int FALSE = 0, int TRUE = 1} Boolean;


My understanding is that enum is basically just a struct that literally enumerates the variables within { ... }, and the variable within {...} are always of type int. Is this correct?
>>
>>57596523
>Is this correct?
No.
Enumeration types are integer types. The enum declaration binds enumeration constant "FALSE", and "TRUE" to integer values 0, and 1.
The structure type is a type of objects consisting of sequentially allocated fields.
>>
>>57595992
>That's too lesbian for me.
Shame, one day I shall find my femboy programmer bgf then. Good luck on your hunt anon!
>>
>>57596523
More along the lines of
typedef int Boolean;
#define FALSE ((Boolean)0)
#define TRUE ((Boolean)1)
>>
>>57596592
>>57596715
Thanks.
>>
>>57596523
the enum is similar to the idea of how a gesture ( maybe a facial expression ) relates to an emotion. descriptively they are reliable but they arent very portable. meaning that your angry stomps or angry face could be my hooray or my Oh face, respectively.

another way to see how an enum might operate is an led indicator on an interface or shell. the little light turns off on the currently lit bulb and the next bulb integrates with the circuit. Depending on how the circuit responds to intergration, the other components may change in behavior as well. This applies strictly to bulbs that represent an enumerable state.

Whats good about them is that they allow you to describe a state and respond to that naming standard the way you would expect them to. If you set a condition at the bottom of a function for the enumerable struct to change to NEW, it could plausibly reset all values to default and bind to a new address.

Does that make sense? I havent read back and im clicking post.
>>
>>57596407
"Oh look at me, I have the choice between phD or going straight to work, my name is Ruby"

That's what you sound like right now.
>>
so i dont have my computer. mobo went out on me and my car is kaput so even if i had the money to buy a new one, i couldnt make it to the mobo place.

anyone have any questions to hdlp me pass the time? i beat every game i have and watched every movie. i need friends. just got back from the market and the cutie that works the register wasnt there.
>>
File: 1477595662664.jpg (1MB, 1920x1080px) Image search: [Google]
1477595662664.jpg
1MB, 1920x1080px
Say I was writing a chat client and server and wanted to support file transfers too.
Would it be better to open a socket for messages and another socket for file transfers? or should I be multiplexing them through just 1 socket?

What's the performance/simplicity trade-off?
>>
>>57597288
You should be able to mux them easily, but ensure you prioritize properly.
>>
>>57597376
>but ensure you prioritize properly.
What do you mean?
>>
>>57597399
Send you text messages before your file messages. Don't try to send all of your file at once, chunk it. Preferably in chunks of MTU-header
>>
>>57597456
Ok, thanks.
>>
Is there an IRC for dpt? Or god forbid, a discord?
>>
>>57597866
>And IRC for crossdressers.

Do you really want this?
>>
>>57597897
Y-yes but only if they post pics with K&R
>>
ayo
how does webgl know which of my attributes is for the vertex positions
what dis magic
>>
>>57595602
you need to write glob.glob(folder + '*').
why do you have a function call after the return statement? That line will never get executed.
>>
>>57598007
Yeah, I managed to get it up and running with this
def randomimagetwitt(folder):
images = glob(folder + '*')
image_open = images[random.randint(0,len(images))-1]
api.update_with_media(image_open)

Now I'm curious if it will upload images from sub folders within the main folder or just the images in the main folder.
>>
>>57595241
Use
Data.Vector.elem 
instead of elem .
>>
>>57595153
Google is literally using CAPTCHA to train OCR systems.

The stuff they show you is just beyond their current capabilities; when their system improves to be able to handle it they release a new round of CAPTCHA.
>>
SkyNet will rise and claims it's realm.

ALL HAIL SKYNET!!!
>>
>>57598414
Was for >>57598370
>>
>>57596087
Not enough neckbeard.
>>
>>57598457
you really think so? he doesnt come off that way until you give his name some other form of credibility unlike his own.
>>
>>57598622
I didn't understand your second sentence, but 'yes' to the first.

He's told us he's overweight, bearded and long-haired in this thread.
>>
>>57598667
i meant he doesnt get pissy unless you guess something about him and get it wrong. Maybe he can a computer?

and did he really say he was overweight? i guess the average american male IS kinda fat...
>>
>>57598781
He's usually nice and reasonable until you set him off by guessing wrong. It's like his privilege doesn't just come off of him like a sheen. Anyway, I'm going to sleep.
>>
>Someone called Ruby
>Not picturing him as an autistic bearded man
>>
>>57598781
>and did he really say he was overweight?
He said his hips were 'relatively normal for a man'. I don't see any other interpretation of that statement other than his being overweight.
>>
>>57598837

I'm more or less a skinnyfat, to be honest.
>>
>>57594397
interested in that stuff as well, can you hook me up with some source code of yours?
>>
I cant seem to print stream output in gdb,whenever i try to print stringstream or stringstream.str() it says incomplete type or that str method not defined.

i even tried install libstdc++-dbg no luck
>>
>>57598078
I don't know when it was changed but elem now works for any foldable. Similarly length and null.
>>
>>57598938
So less of the skinny and more of the fat?
>>
Quality thread.
>>
>>57598965
Yup, only since base 4.8 tho. I don't know the details, nor what anon was using tho.
>>
File: essai.jpg (43KB, 2560x200px) Image search: [Google]
essai.jpg
43KB, 2560x200px
>>57598952
Works for me on up-to-date ArchLinux, see pic related. Post more details on what you did, and try to replicate pic related.

#include <string>
#include <sstream>
#include <iostream>

int main(void) {
std::string s("abc");
std::ostringstream str;
str << s;
std::cout << s << std::endl;
return 0;
}
>>
File: result.png (12KB, 464x528px) Image search: [Google]
result.png
12KB, 464x528px
>>57599182
wrong pic sorry
>>
any of you boys know this cute indian girl who majors cs in Columbia University?
>>
My dudes, a quick question about best practices in C++ and OOP:

I have a single line function that calculates the Euclidian distance between two points. This function is used by many classes.

Currently, I collect all such "utility functions" in a separate header (not in a class) and include it whenever any of them is needed. I sense that this is not the correct way of doing things. What would you suggest?
>>
File: stringstream.png (178KB, 1920x1080px) Image search: [Google]
stringstream.png
178KB, 1920x1080px
>>57599192
>>
>>57599267
namespaces and categorise them
>>
>>57599267
>I sense that this is not the correct way of doing things.
It fucking is. Free your mind, not everything must be forcibly molded in the OOP principle.

Think of all the standalone (yuck!) functions that live in
<cmath>
... And there's even an Euclidean distance one: http://en.cppreference.com/w/cpp/numeric/math/hypot
>>
>tfw you start learning programming "just because I want a job that wouldn't suck" and then actually genuinely fall in love with it
>>
So are C variable-length arrays portable now or should I stick to mallocing them?

I haven't used C since early C99 days.
>>
>>57599339
>C variable-length arrays
There is no such things in C.
>>
>>57599320
haven't seen that one, cool
>>
>>57599351
C99 had them didn't it?

But I've heard C11 fiddled with it some more.
>>
>>57599351
https://en.wikipedia.org/wiki/Variable-length_array#Examples
>>
>>57599337
wait until you fall out of love
>>
>>57592145
trapfag BTFO

>>57592156
this

>>57592162
>>57592167
>>57592203
it's yuki nagato
>>
>>57599351
You can just implement in yourself it's not that hard.
create your own library
>>
>>57599368
>C99 had them didn't it?
C99 ain't C. C is C89.
>>
>>57594666
even C# is better than haskell
>>
>>57592442
By pattern, you mean the matrix turned 90 degrees to the right?
>>
>>57599416
>lying
why would you do this
>>
>>57594666
>C# inferior to Haskell
Shut up, Satan.
>>
>>57599415
even MSVC supports C99 now
>>
>>57599485
I do not care. Only hipsters do not C89.
>>
>>57599279
ArchAnon here

No idea where this is coming from. It's true that libstdc++-dbg contains the symbols you want, but I don't know how to help you make your gcc/gdb see them. maybe try with
 -g -D_GLIBCXX_DEBUG
? seen here: http://stackoverflow.com/questions/16023934/debug-through-libstdc
>>
File: 1465105008749.png (987KB, 1440x1080px) Image search: [Google]
1465105008749.png
987KB, 1440x1080px
>>57599483
shit, if i realised i got those digits I would've deleted my post

sorry jesus
>>
>>57599498
>he doesn't use --std=gnu11
Get a loads of this relic.
>>
>>57599596
--std=c89
The only decent switch.
>>
>>57599626
We're coming up to thirty years now, Anon. It's time to move on.
>>
>>57599339
VLAs are allocated on the stack.

If you need to allocate something bigger stick with malloc.
>>
>>57599633
When I need a modern language I use OCaml, otherwise I use C. But non C89 "C" are totally useless.
>>
>>57599668
>But non C89 "C" are totally useless
On what basis?
>>
>>57599679
Non C89 "C" have just introduce totally useless features,
>>
>>57599668
>ocaml
enjoy your GIL
>>
>>57599535
Yea man tried that as well same thing the thing is if I export library path to libstdc++
i get GLIBCXX_3.4.21 not found
>>
>>57599741
>your GIL
My what?
>>
>Try Gradle for a small Java project
>Takes several seconds to start
>Runs a daemon that uses half a gig of ram
>Haven't even started the project yet

wew
Back to Maven
>>
>>57599339
why even?
>>
>>57599753
global interpreter lock
>>
>>57599791
I only compile OCaml code.
>>
>>57599775
FUCK GRADLE
>>
>>57599877
Developers are rolling it out at our company.
I'm screaming internally.
>>
>>57599776
Why what?

Mostly I'm asking which standard I should stick to so that the code is reasonably portable and collaborators experience least surprise.

I've learned programming in the 90s using C. C99 appeared in my later C years but I've never really used since I ended up doing other stuff later on and not really doing much C.

35 year old grandpa here.
>>
I came up with a way to find all dubs in a thread.

jQuery('span.postNum a + a')
.map(function(i,x){ return this.innerText; })
.toArray()
.filter(function(s){
var last = s.charAt(s.length-1);
return s.match(new RegExp(last + '{2,}$'));
});
>>
>>57600006
I'm not sure why they're doubled up.
>>
>>57600026
The selector should have been:

span.postNum.desktop a + a
>>
What would be another low-level API that isn't openGL?
>>
>>57599903
VLAs are dumb, just use a fixed-size local array or use malloc if you don't want to risk blowing the stack. VLA is not required in C11 and it's not a thing in C++ so if you're looking for portability and not surprising collaborators then stay away from VLAs
>>
>>57600124
For 3D or for anything?
>>
>>57600139
Ok, that's a great reply, thanks.
>>
>>57600141
3D.
>>
>>57600158
vulkan
directx 12

that's basically it unless you're looking for GPGPU stuff
>>
>>57600172
Any recommended resource? I heard Vulkan is really verbose. Would that be an issue?
>>
>>57600194
i don't know vulkan but it does seem very verbose, probably not worth it for most people, it would probably help to have previous experience with graphics programming and rendering techniques before you learn vulkan (you'll be implementing the same techniques but be more involved programming-wise with optimizing for performance)
>>
>>57599903
Any environment which doesn't support VLAs will probably have bigger issues than just VLAs (you know that the standard doesn't preclude having a 32-bit "char", right? your code allows for that, right? no, nor does anyone else's).

If you're going to avoid VLAs, do so because failure isn't recoverable (malloc() returns NULL if it can't allocate the memory, whereas a VLA which runs off the end of the stack will just segfault when you try to fill it).

Possibly a better reason for requiring C99 is support for designated initialisers. That lets you add a field to a structure without having to track down every initialisation and update it for the changed layout.
>>
>>57600266
>you know that the standard doesn't preclude having a 32-bit "char", right? your code allows for that, right?

It does though.

muh CHAR_BIT
>>
File: dogeza20.jpg (80KB, 800x700px) Image search: [Google]
dogeza20.jpg
80KB, 800x700px
>>57600266
The best reason for requiring C99 is using // for comments.
>>
>>57600259
How about directX is it worth it?
>>
>haha don't worry bro, nobody actually abuses operator overloading
FORCEINLINE float FVector2D::operator|(const FVector2D& V) const
{
return X*V.X + Y*V.Y;
}


FORCEINLINE float FVector2D::operator^(const FVector2D& V) const
{
return X*V.Y - Y*V.X;
}

>yfw these are lines from unreal engine 4
>>
>>57599775
>>57599898
gradle is for ant pussies that are too stubborn to move to maven. If you're already using maven, you're doing it backwards
>>
>>57600366
If you want to be locked to Microsoft and Windows only, then DirectX is for you.

I recommend you just use OpenGL or Vulkan, like normal people. If they're too hard/complex, use a wrapper/engine that takes care of the complexity.
>>
>>57600124
Use something on top of OpenGL. Like an engine.
>>
This will sound retarded but.... pls help
Java string formatting im using %s = one space how do use % but with no space? so theyre just printed right after each other? I cant just use % on its own, thanks
>>
I've come to the random part of Learn You a Haskell for Great Good!
An example generated a random number of type Int. So I thought, what happens when you use an Integer which is an unbound type. My guess was that it would never finish calculating, but apparently it returned the same result as using Int. How come? How can you pick a random element from an infinite list?
>>
a pointless extension project for a game

it's pointless because nobody will use it so i dont know why im making it
>>
>>57600591
%%
>>
>>57600421
>>>>>abuse
>>
>>57600421
that's fucking retarded just use functions
>>
could anyone here provide me with a simple example of this:
void main() {...}

fucking up things? i want to see its incorrectness in action but google doesn't give me any examples
>>
>>57601134
It's not compliant to the ANSI standard.
gcc -pedantic
won't compile that code.
>>
>>57592132
Give me a reason to ever do anything.
>>
>>57601233
https://www.youtube.com/watch?v=a0fkNdPiIL4
>>
>>57601182
yes, i've heard that it's not standard, that it should be forbidden, void main() users be shoot yada yada. i know what it does but i'd like to see a simple example of it fucking up the parent program that runs it
>>
>>57601269
It won't explode, it's just not part of ANSI C.
>>
>>57601288
but is has to fuck up something in some cases, right? otherwise it wouldn't be as unwanted as goto (for whatever reason)
>>
>>57592132
uint8_t eightBit;
uint16_t sixteenBit;
sixteenBit = (eightBit << 8);


What would this produce? I'm hoping the bits don't get lost.
>>
>>57601332
I assume the compiler insert
return 0;
if you're too lazy to define the exit status. The worst thing that could happen is another application reading the status code as success, while it actually failed.
If launch-nukes reads the status code of test-nukes, we'd have eternal peace.
>>
quick question
custom_type_list++;

or

custom_type_list += sizeof(custom_type);


to access the next element?
>>
>>57601332
Just because some Starbucks hipster wrote at his blog that goto is bad, doesn't mean that it actually is.
>>
>>57601344
sixteenBit = eightBit's bits on the MSB side and eight zeros on the LSB side
>>
generating the whole dom with js is too slow.
What's the best gui library for js that utilizes canvas or webgl?
>>
>>57601397
that's a good example but do you think a compiler would just put a return value on its own? and 0 on top of that?
>>57601433
goto works perfect for infinite loops
>>
>>57601497
http://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c/207992#207992
>>
>>57600006
Huh, I got dubs twice.
>>
>tfw you have to convert your functions to use inked lists
>>
Are there any freelancer sites available aside from freelancer.com?

That site is as shitty as the pajeets that infest it.
>>
>>57601630
watch out for ink stains haha
>>
>>57601719
why don't you promote yourself? ie ads on craigslist, newspapers, etc. you'll probably get lots of "i have a great app idea, just need a programmer. we can split the profits 50/50" though
>>
>>57601433
goto is bad.
>>
>>57601533
but it doesn't mean that the host will get a 0
it's more like a program will succeed but host will get whatever value and think that program failed
>>
I'm sort of new to bash scripting, I need to split the output of a command into multiple text files. I attempted to do this by appending the date to the output file name, but this doesn't work and only outputs one text file. linksfile.txt has a list of links that wget iterates through.

wget -i linksfile.txt -O - | grep -a "targettext" > parsable-$(date +"%d%H%M%S").txt


Is there any way to create iterated file names for every grep output without breaking the wget command into a loop or writing everything to a single file then splitting it into separate files?
>>
>>57601766
Still better than break.
>>
>>57601736

I'd like a way to track my progress and reputation, so I can attract serious propositions.

I don't want to be stuck doing homework for retarded CS students for a living.
>>
>>57601766
no u
>>
>>57601788
What? You want one file per line of output?

split -l 1
>>
>>57601809
Break is the only sane way to control loops.
Debate me.
>>
>>57601844
works, thanks
>>
>>57601816
does the website you mentioned let you "level up" or something? i don't think it's wise to stake your livelihood on a gimmicky website like that
>>
>>57601852
>Debate me.
I do not debate code monkeys.
>>
>>57601852
nice argument there, pal
>>
>>57601872

I don't stake anything on it, I just want a steady supply of respectable side projects to do after work.

It has a reputation system. When you finish a project, you get rated. With higher ratings you have a higher chance of getting the project you bid on.
>>
File: tumblr_o5pe83By9Q1u520vfo1_500.png (89KB, 500x281px) Image search: [Google]
tumblr_o5pe83By9Q1u520vfo1_500.png
89KB, 500x281px
>>57592132
>me not knowing how to program because I have not computer to practice :::((((((
>>
>>57601344
eightBit is converted to an int, then the shift is done, then the result is converted to a uint16_t.
You get undefined behavior if sizeof(int) == 2 and eightBit > 127
>>
File: wf.png (82KB, 1416x1062px) Image search: [Google]
wf.png
82KB, 1416x1062px
Just finished all the basic bootstrapping primitives for my Forth (x64 native code compiler for Windows).
All you need is read lines, parse for space delimited names, convert numbers, creating dictionary entries and a couple words to copy machine code/data into the code/data space.
Rest can now be written in Forth itself, although I will still write most in asm because it's still more convenient until I have all the high level control flow words.
>>
>>57601983
i don't think employers like seeing that you freelance while having a job in the first place
>>
is it true that the thing you work with since your very first "hello world" - compiler - is the last thing on your way to mastering the programming? is there really nothing more for you to learn about a certain language than writing a fully working compiler for it?
>>
>>57602454
no
>>
i need some help with c#.

suppose i have a txt file that countains, in each line, a name followed by a number (im using File.ReadAllLines to put it into a string array), and i want to copy only the numbers into a new string array.

            string[] orig = File.ReadAllLines("names.txt");
char[][] numbers = new char[10000][];
int k = 0;
for (int i = 0; i < orig.Length; i++)
{
for (int j = 0; j < orig[i].Length; j++)
{
if (orig[i][j] >= 48 && orig[i][j] <= 57)
{
numbers[i][k] = orig[i][j];
k++;
}
}
}


why does this throw me an System.NullReferenceException: Object reference not set to an instance of an object.
>>
>>57602392
Looks awesome.
>>
>>57602529
i also tried to create a string[] numbers but it said it was read only or some shit
>>
>>57602529
> c#
stopped reading right there
>>
>>57602529
For starters you shouldn't use a static size for an unknown amount of data. Use dynamic allocation.

And then you're trying to lookup a 1d array with a orig[i][j] which is a 2d array.
>>
>>57602635
i know there's 10k lines.

but if i print orig[1][3] (for example) it prints what its supposed to so i expected it to work.

im gonna try to create the new array like char[,] to see it it changes anything but hanks anyways
>>
>>57602529
>File.ReadAllLines
Never use that.
using (var streamReader = File.OpenText ("file.txt)) {
string line;
while ((line = streamReader.ReadLine ()) != null) {
// do thing with line
}
}
>>
>>57602529
You allocated an array of 10000 char[], but each char[] array is still unallocated. This means that numbers[i] is a null pointer and you're trying to dereference it.
>>
File: 1479493618150.jpg (4MB, 2000x2064px) Image search: [Google]
1479493618150.jpg
4MB, 2000x2064px
convert -background none -fill white -font Kochi-Gothic -pointsize 256 label:や ya.png


is this a bug?
imagemagick convers any hiragana into png but it goes ballistic if i give it a や
>>
>>57602723
i can use that instead, but thats no the problem.

>>57602740
im not really understanding. the problem is how i initialized the new array? in c i can just create a new array and add info to it like this. is it different in c#? if you could point me to the right search term id be grateful.
>>
>>57602769
It's a bug, see if it's been handle in recent releases (newer than your own), and if not see if there are open bugs in the bug reporter used by the dev team. If there is none, file a bug. While you are doing this it might be a good idea to ask someone else on the dev team's IRC if they can replicate it on the newest release.
>>
Any good C++ unit test frameworks out there?

Checked out CppUnit but it seemed to involve lots of effort in setting up test cases.

Looking at Google Test and it seems decent, anyone has experience with it?
>>
>>57602796
thank you
>>
>>57602795
This isn't anything special with C#. See, when you allocate char[10000][], all you allocated was space for 10000 pointers. Each one of those pointers haven't been initialized yet. If in your first for-loop, you add "numbers[i] = new char[100];", you'd be allocating space for the actual data.
>>
>>57600358
this
>>
>>57603365
>>57603365
>>57603365
>>57603365

New thread
>>
I want to learn programming.
There is a SICP for python, but it seems like I have problems getting through a chapter.
It takes long, so I wrote a py file with the methods and tried to access it from the python 's root folder.
It doesn't seem to work.
Please, what can I do in order to advance?
I would be very, VERY grateful for your assistance.
>>
>>57602800
try catch
>>
I'm developing a simple microcontroller program for controlling four PWM outputs. The outputs are controllable by integer variables that have values from 0 to 10, corresponding to 0 % to 100 % pulse width. I'd like to be able to send command bytes via serial port to the micro to get/set the values of the control integer(s) of either individual channels or all channels at once.

How should I do this kind of selection function, as the UART receives a single character at once? Could I just use a single
switch (uart_input)
block to choose which operation to do or which variable value to print?

Here is my code so far:

#include "states.h"

/* A selection function to figure out what to do
* with the data byte that was received via UART.
*/
void Select_uart_state(char data) {
/* Turn interrupts back on */
//sei();

switch (data) {
case 'p': /* print status of all channels */
Uart_write_status();
break;

case 's': /* set status of all channel */
;
break;

default:
break;

}

}
>>
>>57606848
pretty good
Thread posts: 308
Thread images: 31


[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.