[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: 317
Thread images: 45

File: hime ACNL.png (778KB, 400x720px) Image search: [Google]
hime ACNL.png
778KB, 400x720px
old thread: >>55525463

Keep overflowing the stack, Hime!
>>
Please post an anime image next time. Thanks.
>>
>i want to work in computers!
>but I don't want to interact with anyone
>or even come into work
>in fact, just gimmie my paycheck and you can call me on skype sometimes :)

How do these people even function?
>>
>>55535106
that's me, it can get pretty rough desu
>>
>>55535106
I already told you, I want to sip lattes while hacking on my macbook at Starbucks. I want to be a code artisan.
>>
hi /dpt/ I want to start learning C
What's the best place to program in?
I'm using unbuntu
I've been writing some simple programs in Python and just calling them in the terminal
Is this a bad approach?
If it's not too bad can I do the same with a compiler?
>>
>>55535018
Well, I would be fine with living in an apartment or home for months or even years. But I would need the freedom to go when I want within reason (leases etc)
Finding a place to live isn't as hard as a career though

>>55535020
They would know I'm working because they would have a product.
>>
>>55535106
>Because I'll have to be in a certain place at a certain time and would like to keep that to a minimum so I can be other places.
>It has nothing to do with interacting with others.
>I actually have friends around the world and would like a career that would allow me the freedom to be where I want when I want if I can still get the work done.

How do you even reply? If I didn't have people to see, I wouldn't be traveling.
>>
>>55535173
You're an entitled piece of shit and you're not going to get anything like the idealistic job scenario you keep describing.

And you're never going to get it if you keep up that entitlement complex.
>>
File: 1460887654220.jpg (106KB, 1280x843px) Image search: [Google]
1460887654220.jpg
106KB, 1280x843px
>>55535204
I think you have some issues you need to work through.
>>
File: download.png (173KB, 320x462px) Image search: [Google]
download.png
173KB, 320x462px
watching changes on a xml file and sending the changed data via websockets

Nodejs, python or C?
>>
>>55535154
Doing shit from the terminal is completely viable, and is the preferred programming environment for a lot of people.
>If it's not too bad can I do the same with a compiler?
The way to compile and use a basic single source file C program is just
gcc myprog.c -o myprog
./myprog

After your code gets to be more non-trivial, you probably want to look into using Makefiles to automate the compilation process.
>>
>>55535221
node if you're hip, C if you just want it to work
>>
File: image.jpg (104KB, 640x640px) Image search: [Google]
image.jpg
104KB, 640x640px
>>55535242
Ah I see
I'll just start playing with it when I start the ansi book tomorrow
Thanks anon
>>
>>55535106

I honestly wouldn't mind programming in a workplace environment... although it would certainly take getting used to, since talking with people fucking ruins my concentration.
>>
File: yui does the cute thing.gif (802KB, 500x545px) Image search: [Google]
yui does the cute thing.gif
802KB, 500x545px
Is there any realistic scenario where one would make use of an array with 3 or more dimensions?
>>
>>55535721
3D space MUD?
Cellular automata in 3D?
>>
>>55535221

Between the three... if performance is critical, use C. Given that the task is rather I/O bound, you should consider carefully how much work your program is going to be handling.

Otherwise Python.
>>
Okay, so... working with a friend on an idea for a roguelike with some similar mechanics to Binding of Isaac. Don't know if this'll actually go anywhere (it'll probably end up abandoned eventually), but I think I'd at least like to screw around with some random dungeon generation shit anyways. Something I'm thinking about is how the hell I should represent this shit in memory. What I'm thinking about is I'll have some container class I'll call Dungeon. This will contain a vector of another object called Room. Each Room has four pointers to possibly adjacent rooms. The pointers can be null to represent that no such room exists. The first element of the vector will be the entrance to the dungeon, and subsequent elements will be added as the dungeon is generated.

I'm not sure if depth first or breadth first is best for dungeon generation, nor do I know if there are any particularly useful algorithms for this kind of stuff. Does anyone by chance know of any literature on the subject?
>>
>>55535841
I don't remember but I saw somewhere a thing describing how you iteratively partition your dungeon floor until you have the rooms you want
>>
i need help with sparkfun ir sensor library. who uses this library? trying to convert the returned value but it fails to convert the data type no matter what. sigh......
>>
>>55535929

Have you read the documentation before coming here with your questions?
>>
>>55535961
yeah i have 10 tabs open trying to fix it. i am not c++ programmer so this is not working out unfortunately
>>
>>55535990
post code
>>
>>55535040
im stumped /g/
how do I print a Key?
I'm pretty new, I don't know about ChTypes
are Keys a subste of ChTypes?
pic realted
>>
>>55535221
Node if you want to do it in a few minutes and forget about it, otherwise whatever you like.
>>
>>55535990

If you have any C++ specific questions, I can answer them. It's not exactly the most user friendly of languages, but with proper understanding of it, it can be a very powerful tool.
>>
>>55536046
If you are just messing with curses that's fine, but brick (https://hackage.haskell.org/package/brick) is a terminal UI library that fits Haskell better, as opposed to just being thin wrappers over curses bindings
>>
File: code.jpg (28KB, 656x241px) Image search: [Google]
code.jpg
28KB, 656x241px
I want to convert the returned float/string to int so i can do temperature monitoring and logging. it is done with arduino. nothing works though. the code in the picture outputs the temps in decimal every 2 seconds. i been trying for few hours now to convert
>>
>>55535204
Why are ypu só mad anon? You seem like a boss that promjses the world butwould ratherinflict misery
>>
>>55535867
>OOP fags
https://en.wikipedia.org/wiki/Binary_space_partitioning
>>
>>55536074
>>55536039

see >>55536182 i forgot to quote your posts
>>
>>55536217
Oops, (hue) meant for
>>55535841
For my retardation, have another link.
http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation
>>
>>55535221
x64 SSE enabled assembly.
>>
File: 1429036498699.jpg (74KB, 640x427px) Image search: [Google]
1429036498699.jpg
74KB, 640x427px
I'm trying to edit this code and i have some questions.

https://github.com/dnschneid/xfce4-genmon-plugin/blob/master/panel-plugin/main.c

This fairly simple xfce panel plugin which runs a bash command when a preset timer runs out and then displays the string returned by the bash command.

As it is now it only updates, calls the command and prints a new string, one two occations.

It updates when the timer runs out. See function on line 267.

And it updates if any changes has been made to the settings (different timer, location, etc). See fuction on line 630.

The function that makes it update takes a struct as an argument, and is located on line 105.

The program supports a clickable icon which when clicked can run a bash command by itself. The click function is located on line 84.

Thanks for following me so far, now here's my problem. What i'd like to do is call the update function from within the click function so that whenever i click the button, the program updates and generates a new string. However since the update function takes a struct as an argument, and i'm unsure if i can send a struct from within the "ExecOnClickCmd" function, i am unsure how i would go about doing this. And since i'm pretty sure i have to compile this every time i want to see if it works i'm not very drawn to experimenting.

tl;dr How easy would it be to run the DisplayCmdOutput(line 105) fuction from within the ExecOnClickCmd(line 84) function?
>>
>>55536182

>float to int
Use an ordinary cast.

>String to int
If this is an STL string, stoi. Otherwise, atoi/strtol or similar.

>>55536266

Thanks. This looks like an interesting approach to the problem. I'll mull around with it and see if it might be useful.
>>
Hi /g/uys. I was wondering if i could use SSH from ubuntu to access a raspberry pi (or another ubuntu/windows desktop) to get my data even from university. Should i get a static ip?
>>
File: 0sfeWR2.png (59KB, 990x400px) Image search: [Google]
0sfeWR2.png
59KB, 990x400px
>>55536573
Would it be as easy as this?

*edited line 102
>>
File: QCXQ8OY.png (60KB, 1005x395px) Image search: [Google]
QCXQ8OY.png
60KB, 1005x395px
>>55536649
Like this sorry, i thought the p_pvPlygin and poPlugin was the same.
>>
>>55536598

Yes you can ssh from Ubuntu to a raspberry pi, even at a university (unless your CS department is retarded and blocks ssh).

A static IP may not be necessary, unless this is going to become a regular thing.
>>
>>55536715

I see no picture. Also, docs say it should be valid.

https://www.arduino.cc/en/Reference/Cast
>>
File: int_fail.jpg (60KB, 969x495px) Image search: [Google]
int_fail.jpg
60KB, 969x495px
>>55536586
I am going to smash this arduino into million pieces soon. ordinary cast does not work.

picture f--king related
>>
>>55536725
forgot to upload the picture, it is here >>55536728
>>
>>55536728
Arduino is a pretty damn annoying, yes.
>>
What is a simple library for loading .obj 3D models for use in OpenGL?
>>
>>55536728
arduino casts weridly
try int(MotorTemp) instead
>>
>>55535106
I don't even allow skype calls or phone calls
I only communicate with my clients directly via email, and then indirectly with timesheet submissions and updates posted to team sites and source code repos
it's pretty nice, I must say
>>
>>55536881
same error. sigh. how can arduino be so broken.
>>
>>55536728
>invalid cast from string to int
lel
>>
>>55536728
you are retard, did you even read >>55536586
>>
Which programming language would you suggest me for building Web services?

I'm thinking about Java(Spring)
>>
>>55536933
this shit still does not work. i give up
>>
>>55537016
Good, you are a looser and a fag. Programming is not for you.
>>
>>55537010
small number of users/personal project? python
large number of users? c or c++
>>
>>55537019
you sound autistic... go troll some other board
>>
>>55537016
you need to learn how to program before you can program.
this is common sense.
>>
>>55537034
Nah, you're a cunt.

If you can't figure out how to cast on any given programming language in 45 minutes, you might be retarded.
>>
>>55536785
Unity <->
>>
>>55537054
Fucking kill yourself.
>>
>>55537040
lol a cunt?

>>55537036
fuck off or paste the working code then smartass
>>
>>55535721
almost every game engine out there, even shit java ones, even tetris models etc.
>>
>>55536728
What does therm.object() return? Is it a string or integer or float or something completely different?

Why are you even converting anything?
>>
>>55537066
You were given a fine advice that you ignored. We are not planing to do a fag's own work, especially for something that trivial that would be solved if you bothered to actually read about the language you are using.
>>
>>55537016
I don't know of any language that supports implicit or explicit conversion between strings and numeral values. That wouldn't make sense.

No where is it guaranteed that your string won't be something like "ASD2152A---", how could you possibly convert that directly into a number?

Therefore (int) "somestring" isn't valid.
>>
>>55537106
>any language that supports implicit or explicit conversion between strings and numeral values.
python and sql
probably every functional language too, but I don't know any of those
>>
>>55537117
>probably every functional language too, but I don't know any of those
How could you say "probably every functional language" when you do not know any of them?
>>
>>55537117
What python and sql do if the cast fails?
>>
File: fsf.png (417KB, 500x814px) Image search: [Google]
fsf.png
417KB, 500x814px
wtf happened to fsf?
>>
>>55537152
>facebook
Did you really think that the actual FSF would have a facebook?
Also, get out you fucking normie.
>>
My problem is so easy not 1 programmer here can fix it lol okay

I knew what i was expecting and i got it
>>
File: NvOxnPw.png (12KB, 566x506px) Image search: [Google]
NvOxnPw.png
12KB, 566x506px
>>55537142
>sql
The transaction fails. Any changes would rollback automatically, with default settings. You've got to handle it.
>>
>>55537166
it used to be legit a couple of months back though, in line with c+=

>normie
autist
>>
>>55537142
in sql
>1 + "1" = 2
>1 + "abc" = 1
an in some cases, sql will interpret 1 + "abc" to mean something else, like to return 1 as the value and name the column {whatever it was} + "abc"

nevermind about python, it actually throws an error
though I was pretty sure it would cast it
>>
>>55537177
>lol okay no one wants to help my stupid ass so I'll just accuse them of not knowing how to do it to bait them to solve my problems for me
>>
>>55536728
You need to use a method or function to do that, read the docs
>>
File: afpclUR.png (7KB, 566x498px) Image search: [Google]
afpclUR.png
7KB, 566x498px
>>55537216
>1 + "abc" = 1
Which DBMS does this behavior?

MSSQL doesn't.
>>
>>55537199
Oh, I thought you meant the actual FSF, sadly since nobody remembers C+= anymore I didn't know that this is what you meant.
>>
>>55537239
>nobody remembers C+= anymore
It's not that old though. Like 2 years max I think.
>>
i started doing codeforces contests a while ago. Is this a good way to learn something or a waste of time? Also what rating can be considered 'decent' there.
>>
File: mysql1.png (7KB, 244x164px) Image search: [Google]
mysql1.png
7KB, 244x164px
>>55537234
MySQL
>>
>>55537244
to a typical employer, anyone who can do just a few basic problems is employable
>>
>>55537246
MySQL gives me cancer.

I have to manage one MySQL DB at work, and it's the only one that I'm constantly having to fuck with because shit just doesn't werk.

>>55537261
This, pretty much.

These days, programming languages are so abstracted and easy to perform with, that employers are hiring non-programmers as programmers.

For example, a math major buddy got a job as a programmer, with the company basically saying
>"We can teach you C# in a month or two, but we can't teach you differential equations within that time."
>>
I started learning python on codecademy, is that ok or should i stop?
>>
>>55537089
the therm.object returns a float. i read the header file and it states this. i tried to use >>55536586 advice and it did not work then people attack me for it lol when you spend this much time on it you just want it fixed.
>>
>>55537316
don't worry, you're not actually learning anything
>>
>>55537316
good choice
feel free to ask questions here
>>
>>55537316
yeah, learning the syntax of python can be useful
>>
>>55537372
I wish there was shades of color or something to indicate sarcasm.
>>
File: mysql2.png (7KB, 220x172px) Image search: [Google]
mysql2.png
7KB, 220x172px
>>55537293
>and it's the only one that I'm constantly having to fuck with because shit just doesn't werk
it does take some getting used to, that's for sure
>>
>>55537381
laughed heartily, thanks anon
>>
>>55537383
lol
>>
File: audiobutton.webm (203KB, 812x584px) Image search: [Google]
audiobutton.webm
203KB, 812x584px
>>55536669
>>55536573

Got it working
>>
>>55537466
ok whatever man
because we care that much huh
>>
File: rootlogo.png (160KB, 1024x350px) Image search: [Google]
rootlogo.png
160KB, 1024x350px
For anyone trying to learn C++, especially trying to get a better grasp of the standard library, try CERN ROOT.

Yes, it is a data analysis framework, but the catch is, that is comes with a pretty nice C++ interpreter. This means you can prototype and toy with libraries in an interactive fashion. Just like you could do in python or LUA.

https://root.cern.ch/

There is also the root primer that gives a brief introduction by examples:

https://root.cern.ch/root/htmldoc/guides/primer/ROOTPrimer.html
>>
>>55535040

I know I'm late, but

>keeping your server rack next in your muggy basement next to your furnace

wut
>>
>>55535204
>le entitled meme
Man has dreams, automatically makes him better than your sour-ass
>>
>>55537372
>>55537355
Ok, can you suggest me some good book for total python beginner? I never build anything in python, i have experience in c/c++/java/php
>>
>>55537506
if you actually have experience in those languages, then just burn through the codecademy thing, then google "python list comprehension" and you're done
python is way simpler than all 4 of those
>>
>>55537506
Just get into its documentation.
>>
>>55537577
This and then go for documentation for stuff like libraries/modules, functional python and lambdas and OOP.
>>
Is there a great book or tutorial to learn Vulkan, or is it still dark magic understood only by AAA game devs and GPU companies?
>>
>>55537844
There's the official spec. Get on it.
If you want a book, you can start with Luna's D3D12 book and then read the Vulkan spec. D3D12 is to Vulkan what D3D11/10/9 is to Opengl 3+
>>
What's so great about static_cast? Why should I use it over the normal cast?
>>
>>55538132
It's more clear what your intentions are.
>>
>>55538132
c style casts in c++ simply go through the list of c++ casts until one works, so most of the time it is actually just doing a static_cast

there's only a couple of very specific cases where a c style cast wont work, and then you have to use static_cast explicitly
>>
Does anyone know where to get a good Java compiler?
>>
>>55535841
I made a game for Unity and in that game I made a random cave (dungeon) generator using cellular automata.

The thing is, it seems that you want a room based random dungeon generator which links together rooms you've precreated in a random manner. Is that fair to say? In that case it's super simple.

I'm interested in your results, because I want to visit video game development in unity once more as I enjoyed it immensely or well at least the programming part of it was fun.

Here is a blog post on the cavern generator.

https://p219.wordpress.com/2015/11/17/into-the-caverns-we-go/
>>
>>55538376
Write one yourself.
>>
What OS does people use here? I'm interested in switching to Linux but I want an OS that's friendly towards languages like Python.
>>
>>55539118
Windows 10, but it really doesn't matter much what OS you're using.

All of the languages you'd want to use are cross-platform.

I just can't live without Visual Studio.
>>
I just had this one for a coding job interview this morning, and answered it in 2 minutes.

Let's see if any of you plebeians can do it.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.
>>
What's a good engine for creating performant 2D webgl things?
>>
File: base.png (8KB, 482x84px) Image search: [Google]
base.png
8KB, 482x84px
>>55539187
this

>>55539352
diy faggot
>>
>>55539311
cdef int i = 0, sum = 0
for i in range(i, 1001);
if i % 3 == 0 or i % 5 == 0:
sum += i

print(sum)
>>
>>55539311
auto total = 0;

for (int i = 0; i < 1000; ++i) {
if (i % 3 == 0 || i % 5 == 0)
total += i;
}
std::cout << total;
>>
>>55539381
>>55539391

Good response time, but not using Javascript makes you a beta fag.

Here was mine
let count = 0;
let i;
for (i = 0; i < 1000; i++) {
if (i % 3 == 0 || i % 5 == 0) {
count += i;
}
}
console.log(count);
>>
>>55534649
Ooh neat! It's a really nice book.

I decided to expand on the text adventure engine with AI, external scripting, and a number of other things for practice.
>>
>>55539311
Isn't this just a slightly modified fizzbuzz?
>>
>>55539423
It pretty much is.
>>
>>55539373
I already made one for another game but I'm looking to try a more known interface this time so it's easier to work with other people.
>>
>>55539405
xdddddddddddddddddddddd
>>
>>55539405
JS has now a `let` keyword?
>>
Are pointers actually used in the real world or is it just an academic thing they have to teach you?
>>
>>55539501
They're everywhere in C/C++.
>>
>>55539311
sum(i for i in range(0, 1001) if any(i % m == 0 for m in {3, 5}))

could maybe think of a smart math solution if i thought a little harder.
>>
>>55539478
>a `let` keyword?
Indeed, along with `const`. For block scoping, vs function scoping, etc.

Also it has classes now. Welcome to the CURRENT YEAR
>>
>>55539545
I'm shocked.
>>
>>55539311
Yay for chaining!
(1...1000).select {|x| (x % 5).zero? or (x % 3).zero?}.inject{|x, y| x + y}


233168
>>
>>55539525 > >>55539591
>>
>>55539591
>ruby
>>
>>55539311
uint16_t sum = 0;

size_t i;
for (i = 3; i <= 999; i += 3) sum += i;
for (i = 5; i <= 1000; i += 5) sum += i;
>>
Have some money that I need to donate for reasons, its not much only $100~

Wanted to give to a foss developer
Any suggestions
>>
>>55539679
me
>>
>>55539591
disgusting
>>
>>55539679
just donate to the FSF
>>
>>55539679
give them to me ;_;
>>
>>55539696
>>55539735
Who are you? What have you developed that benefits me?
>>
File: projecteuler_jobinterviewlel.png (25KB, 1421x285px) Image search: [Google]
projecteuler_jobinterviewlel.png
25KB, 1421x285px
>>55539311
>TIL either job interviewers are looking for plebs or people say lies on the Internet
>>
>>55539742
I will suck your dick if you give them to me.
>>
>>55539714
Nah I don't want to give that scab eating Jew any money, I want him to die in a fire, he doesn't do shit for me. I would rather give some money Canonical even though they are led by a billionaire potato spaceman, because at least their work helps me directly. Or Debian.
>>
>>55539742
I develop high quality anime shitposting images, released into the public domain.
>>
File: ZemlCSC.png (10KB, 614x198px) Image search: [Google]
ZemlCSC.png
10KB, 614x198px
>>55539591
I like the way you think, friend.

static int SumOfAllMultiplesOf3or5Below1000()
{
return Range(1, 999).Where(x => x % 3 == 0 || x % 5 == 0).Sum();
}
>>
>>55539751
Not sure what you're butthurt about, it's a valid interview question. What does finding it elsewhere on the web have to do with it?

Here's another stab at in in ES6. It was the first approach I thought of, but didn't try for it and went for the simpler method, because I was under the clock.
let count = 0;
let i = 0;
Array.from({length: 999})
.map(n => i++ && (i % 3 == 0 || i % 5 == 0) && (count += i));
console.log(count);
>>
>>55539771
You're implying that the money would go directly into RMS' pockets, it won't, it will go to the foundation that does a lot for you. And he's done a great deal for you, he made GCC, which is probably what was used to compile 90% of programs that are on your computer.
>>
>>55539808
Hmm true about GCC I guess. I wish he didn't have such a repulsive personality, I wouldn't mind sending money his way. But he is such an autistic unlikable cunt that I feel physically sick at the idea. I'll think about it I guess.
>>
>>55539836
You could tell me a program, and I'd write it and give you the source.

And then you could donate the money to me.
>>
>>55539672
this is incorrect. 15 is added twice to the sum.
>>
>>55539672
Wrong
That's like saying for sets A,B,C:
|A U B|=|B|+|A| , but the right answer is
|A U B|=|B|+|A|-|A ∩ B|
add
 for (i = 15; i <= 1000; i += 15) sum -= i; 
to your code and it will be fine but slow
>>55539793
I honestly can't believe that was asked in an actual job interview. I am not butthurt. My problem is not that it can be found in project euler, but that it can be found as the very first question in project euler.
It would only filter out very few people if any, even with a short time limit.
>>
>>55539311
Poor man's solution.

std::array<int, 1000> range;
std::iota(std::begin(range), std::end(range), 0);

auto total = std::accumulate(std::begin(range), std::end(range), 0, [] (int s, int i) { return (i % 3 == 0 || i % 5 == 0) ? s + i : s; });

std::cout << total;
>>
>>55539931
sum({i for r in (range(m, 1000, m) for m in {3, 5}) for i in r})
>>
File: 1465670959995.png (235KB, 289x378px) Image search: [Google]
1465670959995.png
235KB, 289x378px
let's say a point O with a direction (probably just a unit vector I guess) as a 4x4 matrix. (3 angles and translation vector).
now I have a second vector v that points from O to a point P.
now I rotate O by some arbitrary direction.
if I now multiply v with the rotation Quaternion of O do I get the rotated vector v~?
>>
>>55535721
Plenty. Recently used a 3d array of ints representing points spent in a: Talent tree- Talent row- Talent
>>
>>55540015
you just have to believe in it
>>
>>55537261
I thought to pass a programming interview you had to solve the traveling salesman problem in O(1) time on a whiteboard in C blindfolded with both hands tied behind your back while singing Libiamo ne' lieti calici backwards in Chinese and it has to compile the first time without warnings.
>>
>>55539311
Why do all "interview challenge" questions involve modulus? Is the mark of a "skilled" programmer an understanding of modulus?
>>
>>55539311
(fold 
(lambda (x y)
(if (or (= (modulo x 3) 0)
(= (modulo x 5) 0))
(+ x y)
(+ 0 y)))
0
(iotz 1000))

Where iotz is a modified iota
(define (iotz x)
(append (cdr (iota x)) (cons x '())))
>>
Where did all the old /dpt/ go?
>>
>>55539870
Its okay I can write my own stuff, there are a lot of good foss projects I depend on to get shit done though. So how about you create something that's indispensable to people, e.g. a database driver or a go module.
>>
File: 1455954831810.jpg (89KB, 440x404px) Image search: [Google]
1455954831810.jpg
89KB, 440x404px
Break the wall is gone from these threads show sorta an unatractive look to get humans to make sure I want to mate with her so damn much <3 She's moe. Some stuff I've been around since I last saw her at ax kek Blond as well, though it was shit
>>
>>55539679

Don't give it to the fucking FSF
>>
>>55539679
Whatever your favourite OSS project is.
Or if you don't have one, Org Mode. It's basically the best thing that has ever happened to literate programming and reproducible research.
>>
>>55540182
Probably gonna give it to either the dude who wrote Termux, or the guy who wrote neovim, Floens or the Desmume project or byuu or maybe nds4droid
Don't know if there's a decent DOSbox project going for android, but I would probably donate to that and/or an Amiga emulator for android
>>
>>55535040
Where are all the old tripfags? Such as opisafag, the haskell dude and nand, marisa, lucy and notgaben?
>>
>>55540698
all those mentally ill faggots offed themselves
>>
>>55540698
Most of us took our trips off.

I'm on the list you just typed.
>>
Anyone else ever want to fuck their code?
>>
>>55540752
Are you the Finnish haskell dude whose name I can never remember?
If this is the case, I am glad that I know that you are alive at least.
>>
File: CfvXKPW.png (8KB, 866x169px) Image search: [Google]
CfvXKPW.png
8KB, 866x169px
>>55540779
Yes, I have a fetish for LINQ.
>>
>>55540860
Funny, reactive extensions is what made me ask the question.
>>
>>55540860
I was gonna say that there's probably one method that does all that, but I'm guessing by the double reverse()'s that that wasn't your intention.
>>
>>55535214
>>55536210
>>55537496
he is entitled tho

put others before yourself, always
>>
File: at5xHhc.png (17KB, 921x346px) Image search: [Google]
at5xHhc.png
17KB, 921x346px
>>55540889
Well yeah, considering I skipped none, took everything, reversed twice, and selected the entire list twice.

Two one-liners in pic.
>>
>>55540860

LINQ is goat.
>>
File: test.jpg (282KB, 1024x1024px) Image search: [Google]
test.jpg
282KB, 1024x1024px
I wanted to write random image generator in python 3.5, but my code wasn't work. I tried a few things and now I've got picture related. What the fuck is this? My code:

import numpy as np
import os
from random import randint
from PIL import Image

height = int(input("Image height: "))
width = int(input("Image width: "))

image = np.zeros(shape=(width, height))

for i in range(0, height):
for j in range(0, width):
#r = randint(0,255)
#g = randint(0,255)
#b = randint(0,255)
#rgb = r * 65536 + g * 256 + b
#image[i][j] = hex(rgb)[2:]
image[i][j] = 255

test = Image.fromarray(image, mode="RGB")
dir = os.getcwd()+"/test.jpg"
test.save(dir)
>>
>>55541097
I'm going to just say that you should read your code again.
>>
File: 1463480338258.png (57KB, 420x261px) Image search: [Google]
1463480338258.png
57KB, 420x261px
What do you think of Visual Basic .NET?
>>
>>55541166
What is wrong there? I commented what wasn't work because
ValueError: could not convert string to float: hex value

Why my image isn't in one color if whole array is going to have 255 value?
>>
>>55540955
What color scheme is that?
>>
>>55541200
it's shit
>>
>>55541200
It seems kind of pointless, C# is better in every way and can do the same things and more.
>>
>>55537491
In my ACNL house I kept the servers in the attic with fans everywhere.
>>
>>55541200
No reason for it to exist alongside the vastly superior C#.

It's going to be around for legacy purposes for a while, though.
>>
>>55541225
Default dark theme in Visual Studio.
>>
How can I learn to make nice well written code? How can I "format" the whole thing?

Is it just practice?
>>
>>55540860
lmao at
>...
>.Skip(0)
>.Take(8)
>...
>>
>>55541336
What language?

Every language has an auto-formatter. Just follow the language's spec while you're writing.

There are also sites like poorsql.com that you can use.
>>
>>55537010
haskell
>>
>>55537010
Why do you hate yourself?
>>
Post your colors schemes and editors.
This is vim on xfce4-terminal with Tango preset and a background color change. I sort of miss atom's color scheme, it was pretty comfy.
>>
>>55541429
Disgusting.
>>
File: text editors.jpg (192KB, 1224x720px) Image search: [Google]
text editors.jpg
192KB, 1224x720px
>>55541429
>>
File: 1467915678760.gif (1MB, 446x469px) Image search: [Google]
1467915678760.gif
1MB, 446x469px
>>55541429
> vim
> atom
not using emacs
>>
>>55541480
I can agree with >atom but the others are good as well. I'm not the one you want for continuous shitposting about which editor you use and like.
>>
>>55541475
Post yours then.
>>
File: 1465528686330.jpg (58KB, 880x500px) Image search: [Google]
1465528686330.jpg
58KB, 880x500px
>>55541525
>>
>>55541237
>>55541293
by that logic, you should be using F#
>>
File: Stab.png (712KB, 600x600px) Image search: [Google]
Stab.png
712KB, 600x600px
Hi, first time lurking this thread
I'd like to start learning how to program some basic stuff. What's the best way to start? What are the best programming languages to use as of today?
I've used Visual Basic a bit in the past and it's pretty easy to code with that and it could get the job done most of the times but I realize it's quite shit to use right now.
>>
>>55541588
There are particular metrics of superiority that F# fails on at the moment, primarily in examples of usage for very specific use-cases. Not many people use it, so there are far less examples on how to accomplish particular tasks.

Also, there are some tools without F# support, one example being the drag-and-drop GUI creator for something like WinForms.
>>
>>55541604
C# or Python are the best hobby languages right now.

They're both piss-easy to learn and let you get shit done.
>>
>>55541588
except nobody knows what that is
>>
>>55541604
the only winning move is not to play. seriously, run away as long as you can.
>>
File: screen2.png (45KB, 706x296px) Image search: [Google]
screen2.png
45KB, 706x296px
>>55541429
> emacs
misterioso theme
>>
File: lost.jpg (23KB, 480x360px) Image search: [Google]
lost.jpg
23KB, 480x360px
>>55541653
> C#
> lets you get shit done
>>
>>55541744
I think you might be confused.

C# is one of the easiest languages to go from nothing to a working automation tool or GUI app in a really short amount of time.

If you'd care to give an example of something you normally do with a programming language, maybe I could see where you're coming from.
>>
>>55541767
>working automation tool
no

>GUI app
yes
>>
>>55541777
>>working automation tool
>no

Wow, those repeating digits sure showed me!
>>
>>55541767
> open bash terminal in linux
>
 cd /usr/bin [/code ]
>
 objdump -d [any binary-file] 

now make me a program converting the output into a more readable form in C#, use this: http://www.mono-project.com/
>>
File: twitter_400x400.jpg (32KB, 400x400px) Image search: [Google]
twitter_400x400.jpg
32KB, 400x400px
>>55541477

impressive, very nice
>>
File: gvim.png (22KB, 660x785px) Image search: [Google]
gvim.png
22KB, 660x785px
>>55541429

Vim + Gruvbox

Same setup / rc pretty much on my windows gaming box and my dev laptop.

Just copied a small amount of useless code I had laying around to show the syntax. Comments are grey.
>>
>>55541846
lol, fucked it up, sorry:
> open bash terminal in linux
> cd /usr/bin
> objdump -d [any binary-file]
now make me a program converting the output into a more readable form in C#, use this: http://www.mono-project.com/
>>
Why is Go the best language?
>>
>>55541846
>>55541869
The fuck are you doing
>>
>>55541917
it isn't, those are the best: C, common lisp, haskell, ada
>>
>>55541927
I tried to use the code markup to mark the bash commands, but it fucked up, dunno why.
>>
File: RotatingPointCloud.webm (3MB, 466x500px) Image search: [Google]
RotatingPointCloud.webm
3MB, 466x500px
I made this rotating sphere of points in raw JS. No libraries, all 3d math computed directly. Output is to 2d canvas.
It's reasonably terse, around 140 loc.
Idk, is there any way I can make this into something cool looking?
https://jsfiddle.net/bm0e6217/
>>
>>55542019
Create the points based on data from external APIs, so that they actually mean something.
>>
>>55541929
>exploit
>meme
>hipstershit
>lame pascal
please
>>
>>55542044
Hello pajeet. Also javascript, Java and C++ are the real hipstershit.
>>
>>55541917

There is no such thing as a best language..

Go is decent because of it's rather simplistic approach to things. It's a slightly slower higher level version of c with nice features like built in concurrency support.

Personally of the newer generation of "low level languages" I'm digging Rust. It feels more flexible and comfortable (I did more c++ work than c).
>>
>>55542071
awwwww, did the little hasklel shit get his feeweeings hurt? poor babby
>>
>>55539311
#!/bin/perl
$sum = 0;
$sum += $_ for (grep { $_ % 3 == 0 || $_ % 5 == 0 } 0..999);
print "$sum\n";
>>
>>55541917
Because Kotlin is better.
>>
>>55542158
Thx for this actually pretty cool / original solution.
Why have I not written perl scripts before, and why is it because Python, Javascript etc are objectively better?
>>
I'm looking to learn to code because I know no one will spood feed me but I don't know which language to learn.

I am planning to make a script or bot that would do most of the repetitive task for me.
I.e. There is a website that have occasional lucky draw and I want to write a script to do it automatically for me. Is there a language that focuses on this aspect?
The website at hand is panda.tv and every so often there will be a banner announcing that the lucky draw is starting. I want to write a script to block that banner (which will open a new tab) > go to said tab > disable / pause the video and the commentary > spam click on the button until count down is finished then close the tab.

I'm not asking for the script cause I know I have to work for it but I want to know which language is the best at doing the things I plan to do?
>>
>>55542238
Stop shitposting and accept it gracefully
>>
>>55542238
stop using gay languages
>>
>>55542244
you can do such things on mac with something like Keyboard Maestro to record macros.
>>
>>55542244
Python
>>
>>55542244

Look into something like selenium.

It'd be better to ask this on the web dev daily thread.
>>
>>55542200
>JVM
>any year
>>
Anyone here do Android development? How do you resist the urge to kill yourself?
>>
>>55542244
>There is a website that have occasional lucky draw and I want to write a script to do it automatically for me.
Look into the selenium framework. It has a pretty robust C#, Ruby, and Python package.
>>
>>55542423
Habit.
>>
File: 1465749652628.png (278KB, 640x360px) Image search: [Google]
1465749652628.png
278KB, 640x360px
>>55542071
>industry standard
>hipster shit
>>
>>55542019
Replicate the point cloud scene from Future Crew - Panic.
>>
File: gskldhgdfhlkgd.png (84KB, 235x250px) Image search: [Google]
gskldhgdfhlkgd.png
84KB, 235x250px
>interview at company
>been studying data structures because that's what everyone said they went for
>interview instead focuses on OOP and testing
>I barely touched it
>out of 10 questions get maybe 5-6 right
>other 4 he'd chime in with a lets move on or explain my answer and add the correct shit
>even the 5-6 I got right he'd add some stuff too
>tfw panic set in
>mfw that interview was a disaster

he later explained that data structures is the third interview in. I ain't getting that far anyway after that interview.
>>
>>55542478
What'd they ask about OOP?
>>
>>55539793
Array.from({length: 1000}).reduce((a,b,c)=>{return (!(c%3)||!(c%5))?(a+c):a},0)
>>
>>55542478
>oop heavy company
Not working there is for the best. Nothing worse than dealing with a bunch of cargo cult fuckmops who worship OOP
>>
File: 1400327159-joe.jpg (12KB, 340x255px) Image search: [Google]
1400327159-joe.jpg
12KB, 340x255px
How do I get into sockets? On ... [spoiler] python[/spoiler]
>>
>>55542331

Does it detect when the banner surfaces and start the script or something tho? That's the most important automated part I need. There will be several banners popping up one after another during 'rush hour' so I need to tweak it to make sure the page is loaded etc etc so I'm assuming it has to interact with the browser in a way but I will take look at macros and see if it's sufficient for my needs.

>>55542348
Leaning towards this as it's arguably the easiest to learn and javascript coming in second. There are some greasemonkey script that does sort of what I want but is incomplete so I might pick that up too.

>>55542368
>>55542445
no idea what selenium is but will look it up. I was going to ask in the stupid question thread but saw the thread on the catalog instead, will do sir will do

cheers /g/uys, appreciate the suggestions.
>>
>>55542504
https://docs.python.org/2/library/socket.html
It's basically C sockets.
>>
>>55542501
>let's have this large team work on procedural/functional code
>what could go wrong
>we don't need modularity
>we don't need encapsulation
>we don't need re-usability of code
>we don't need maintainability
>me and the fizzbuzzing haskell fags on /dpt/ right and everyone else is wrong
>no industry or computer science professor knows better than me
stay NEET dumb ass basement dwelling babby """programmer"""
>>
Why do people ask so many data structure/algo questions in interviews? Is it just following what companies like Google do?

I mean, Google has tough interviews with those kinds of problems but when you look at the software Google writes its fucking garbage. Like take a look at Android's source code or try making sense of the stupid fucking Android SDK design and you realize the people who wrote it are idiots. If thats what hiring based on memorizing CTCI gets you, why do people keep doing it?
>>
>>55542484

>define OOP
>what is the difference between classes and objects?
>define some core attributes of OOP
>define polymorphism and how to use it on shapes
>what are three things in AGILE development?
>how does the Waterfall development work?
>why do we test?
>talk about functional documentation
>what is UML?
>how to do use cases? description of use cases?

I fucked up polymorphism, UML, and AGILE. in most cases I gave low level descriptions when he wanted examples.

I also panicked at the third question because it was at that moment I realized all the shit I had studied on data structures was going to be fucking useless.

how long does it take for a company to call and tell me I won't be getting that job?
>>
>>55542649
Oh, wouldn't have a clue what AGILE and Waterfall development stand for either.
>>
>>55542649
>low level descriptions when he wanted examples.

fuck meant low level descriptions when he wanted high level

most of the time I just gave him examples I thought would work for definitions.

He was a nice interviewer but I got a sense he felt I wasn't worth it.
>>
>>55542587

Clearly hasn't walked into the average java code base..

OOP in general has a bad habit of making programmers do tons of generic elaborate bullshit when all they really need is a small function / struct.

>>55542649

AGILE = Corporate meme language for iterative development practices mixed with user testing. Start with small parts of the program and then work up. Complete every feature you work on before moving to the next one. Oh, and ffs diagram (For the brain dead management / funders) / test everything
>>
>>55542587
Butthurt JavaAbstractBeanFactoryBeanFag detected. OOP is fine when its used to solve certain kinds of problems. Worshipping it and using it everywhere creates more problems than it solves.

>modularity
OOP does not inherently provide modularity. In fact when you do it naively it destroys modularity because of inheritance and bringing in a whole fuck ton of stuff you don't need

>encapsulation
// smart and clean
struct Bang {
int boom;
int dang;
int foo;
}

// stupid overdesigned pos
public class Bang {
public void setBoom(int b);
public int getBoom();
...
};


b-but I can change what the functions do in the future! Yeah encapsulation is great if you're an indecisive fuck who can't plan out a design in advance.
>tfw you see morons write getters and setters for simple properties and then write unit tests for them

>re-usability of code
Functional code is FAR more usable than OOP code dumbass

>maintainability
Functional code is easier to test and far more robust. Its stateless. How fucking stupid are you?

>Haskell
Protip retard, you can write functional code in anything that gives you free functions (does Java have that yet? lel). You can write functional code in C, C++, Python, etc. OOP is fine for certain applications. Its good for certain kinds of application architecture. It is not the end-all be-all of software design and cargo cult morons like you make the industry a fucking hellish landscape filled with 99% useless slow ugly boilerplate
>>
>>55542423
I don't really get the urge to kill myself. Just the feeling of constant panic.

>release app
>fuckers are crashing for obscure reasons
>fuck fuck fuck
>>
>>55542742
lol
>>
File: objdmp.png (30KB, 686x518px) Image search: [Google]
objdmp.png
30KB, 686x518px
>>55541910

What exactly do you mean by "more readable form"?
>>
>>55542821
Using Intel syntax
>>
>>55542782
I didn't think there could be anything worse than writing the application in the first place but then I saw how applications are tested and I wanted to give up software development forever right then and there.

>tfw JUnit, Espresso, Roboletric and the dozen other test suits are such an unbelievably disgusting mess of garbage and take hours to set up and tests take like dozens of minutes to run
>>
>>55542835
>>>intel syntax
>2018
>>
File: Python-logo-notext.svg.png (72KB, 1024x1024px) Image search: [Google]
Python-logo-notext.svg.png
72KB, 1024x1024px
Why is she so beautiful?
>>
>>55542873
Percent signs trigger me
>>
File: jumpy.gif (47KB, 675x507px) Image search: [Google]
jumpy.gif
47KB, 675x507px
>>55542887

Being triggered is my trigger. It's Qt's fault.
>>
>>55542840
I find Robolectric to be acceptable. As for writing the applications, using Lombok, Butter Knife, Dagger 2, Retrofit, Glide, RxAndroid, and other libraries really does a number on the boilerplate and makes the programs much easier to understand. Also MVP is a must for Android to avoid all the lifecycle shit.
>>
This talk of agile reminded me of this video..

https://www.youtube.com/watch?v=BnyNM8kVH-4
>>
>>55542956
look at that smug faggot
>>
>>55542952
>Butter Knife, Dagger 2, Retrofit, Glide, RxAndroid, and other libraries really does a number on the boilerplate and makes the programs much easier to understand. Also MVP is a must for Android to avoid all the lifecycle shit.

Is there a guide for this shit? Something that teaches you how to write applications avoiding the straight up SDK lifecycle garbo but teaches some alternate MVP method instead?

There's so many libraries and frameworks that starting out is daunting.

There's all the stuff you mentioned, then the stuff that Square has like Mortar and Flow as well... its just so extensive (also sad and pathetic that so many people have gone to such great lengths to avoid dealing with the monstrosity that Google created)
>>
>>55542821
Aw, I was impressed for a minute, but you didn't write the disassembler yourself.
>>
Yo /g/
I'm learning python, is there anything wrong with doing this?
try:
assert x.shape == y.shape
except Exception as e:
print(e)
return None
>>
>>55543062
Everything.
>>
>>55543049

Is writing a glorified finite state machine really something to be impressed by?
>>
>>55543049

The challenge was writing something that makes objdump output look nice, not writing a disassembler.

I could write a chip8 disassembler or something, though.
>>
>>55542534
Thanks.
>>
>>55543087
damn should I just end it all brehs?
>>
>>55543062
Yes. That's pretty much a wildcard for all exceptions. Don't do it.
>>
>>55543038
>Butterknife
Pretty much all you need to know is
@BindView(R.id.button) Button button;
and then
ButterKnife.bind(this);
d after
setContentView();


>Dagger 2
I haven't gotten this yet but I understand what it does for readability, decoupling, and making testing not such a pain in the ass.

>Retrofit
If you learn anything at all, learn Retrofit and use the GSON converter. This is a pretty good guide https://guides.codepath.com/android/Consuming-APIs-with-Retrofit.

>Glide
Just know
Glide.with(*Context*).load(*image_url*).into(*imageView*);


>RxAndroid
I'd learn this by fucking around with RxJava in a regular Java project. This is a pretty good guide on RxAndroid http://code.tutsplus.com/tutorials/getting-started-with-reactivex-on-android--cms-24387

>MVP
Pajeet gives a pretty good talk on it https://www.youtube.com/watch?v=4L7G1uaQ67s.

Also use retrolambda and lombok. They are stupid simple to learn and make writing android code much simpler.
>>
>>55535040
What is wrong with my code?


import java.util.Random;
import java.util.Scanner;

public class AgeOfMajority {

public static void main(String[] args) {
int numberDrawn = drawNumber();
Scanner reader = new Scanner(System.in);

int count=0;
while(true){
System.out.print("Guess a number ");
int num = Integer.parseInt(reader.nextLine());

if(num < numberDrawn)
{
System.out.println("The number is lesser");
count++;
}
else if(num > numberDrawn)
{
System.out.println("The number is greater");
count++;
}
else
{
System.out.println("Congratulations, your guess is correct!");
count++;
break;

}


private static int drawNumber() {
return new Random().nextInt(101);
}
}
}
}



How do I format the brackets in ecplise? I tried highlighting the code and selecting "format" but didn't do shit.
>>
>>55543172

35 opcodes it's a trivial exercise should really only take around a hour or two at most if you don't get too fancy.
>>
>>55542649
The last job interview I went to, I expected them to ask about agile and all of that. I finally asked what methods they used like waterfall or agile and they were basically like "FUCK AGILE"

I really wanted to get that job because they seemed pretty based, but it didn't work out.
>>
>>55543206
Don't you know the exception you want to handle. Handle that instead of handling all

try:
main()
except KeyboardInterrupt as e:
print('Interupted: %s' %(e))

>>
>>55542423
I tried to get into it a few years ago, the API and structure of everything is so terrible. I expressed my opinion to an android app developer and he told me "That's because it was created by hackers for hackers".

I haven't talked to him since then.
>>
>>55543261

That's what I meant, it would be easy.
>>
>>55543258
your brackets are fucked
>>
>>55543394
How do I unfuck them? I rewrote the code and it works, but I am doing an exercise that apparently uses the drawNumber() helper class and I wrote the shit without that helper class and it worked.

Not sure how to fix what I posted above. I am trying to use their template.
>>
File: plc.webm (2MB, 800x450px) Image search: [Google]
plc.webm
2MB, 800x450px
I made a simple program for making some funky bit patterns on the digital outputs of a PLC device. I used a couple of timers, bit shifts and some standard logic.
>>
File: pajeet_please.jpg (39KB, 1246x225px) Image search: [Google]
pajeet_please.jpg
39KB, 1246x225px
>testShouldShowToastAndLaunchActivityOnShowPostsButtonClick()
>>
>>55543515
kek
>>

import java.util.Random;
import java.util.Scanner;

public class AgeOfMajority {

public static void main(String[] args) {
Random rand = new Random();
int numberDrawn = rand.nextInt(100)+1;
System.out.println("The answer is:" + numberDrawn);
Scanner reader = new Scanner(System.in);

System.out.print("How many misses do you want?");
int lives = Integer.parseInt(reader.next());
int count=0;

while(true){
System.out.print("Guess a number ");
int num = Integer.parseInt(reader.nextLine());

if(num < numberDrawn)
{
System.out.println("The number is lesser, guesses made " + count + "Misses left: " + lives);
count++;
lives--;
}
else if(num > numberDrawn)
{
System.out.println("The number is greater, guesses made " + count + "Misses left: " + lives);
count++;
lives--;
}
else
{
System.out.println("Congratulations, your guess is correct! Guess made: " + count);
count++;
lives--;

break;

}
}
}
}



I am getting an error whenever I enter the "misses" allowed. Any idea how to fix it?



The answer is:34
How many misses do you want?3
Guess a number Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
at AgeOfMajority.main(AgeOfMajority.java:18)

>>
>>55543304
Thanks, this is what I ended up with
try:
assert x.shape == y.shape
except AssertionError as e:
print('Error: %s' %(e))


Everything works now
>>
>>55542742
Encapsulation is the only thing that OOP pushed that's useful (and no, I'm not talking about getters and setters) because it allows you to optimize stuff (anything that's actually changing the behaviour would also break the encapsulated API contract).
In some cases that's neat because when releasing something you won't have as much data to optimize stuff as later.
Other than that it also makes the API simpler, but that's an advantage provided by optional encapsulation as well (where encapsulation is a mere annotation to the user that something shouldn't be used).
>>
>>55543428
>How do I unfuck them?
Using the mouse and keyboard (Hint: You may need the tab key and spacebar!) , FUCKING ALIGN THEM YOU CUNT.
>>
>>55543549
just a tip, the counters down there are not going to work, you're not supposed to do them inside the println's
>>
>>55543666
forget about that, i didn't see the horizontal scrollbar

I am awake for more than 20 hours
>>
CC=g++
DIRECTORIES=-Iresources -Lresources
GNU=-static-libgcc -static-libstdc++
CONTEXT=-lglew32 -lglfw3
PNG=-lpng -lz
glfwwindow: glfwwindow.cpp resources/png_loader.o resources/resource.o
$(CC) -o glfwwindow.exe glfwwindow.cpp resources/png_loader.o resources/resource.o $(GNU) -lopengl32 $(CONTEXT) $(PNG) $(DIRECTORIES)
resources/png_loader.o: resources/png_loader.h
$(CC) -o resources/png_loader.o -c resources/png_loader.h $(GNU) -lopengl32 $(CONTEXT) $(PNG) $(DIRECTORIES)


Why is this throwing me a
resources/png_loader.o: file not recognized: File format not recognized


It is successfully compiling the png_loader.o but the glfwwindow is throwing this at me.
>>
>>55543666
Thanks,

Here is the new code. The input for "misses" still doesn't work but if I set the misses myself it does work. How do I fix it so user can input this?


import java.util.Random;
import java.util.Scanner;

public class AgeOfMajority {

public static void main(String[] args) {
Random rand = new Random();
int numberDrawn = rand.nextInt(100)+1;
//System.out.println("The answer is: " + numberDrawn);
Scanner reader = new Scanner(System.in);

//System.out.print("How many misses do you want?");
//int lives = Integer.parseInt(reader.next());
int count=1;
int lives = 10;

while(true){
System.out.println("Guess a number ");
int num = Integer.parseInt(reader.nextLine());

if(num < numberDrawn)
{
System.out.println("The number you guessed is lesser, guesses made " + count + " Misses left: " + lives);
count++;
lives--;

if(lives == 0){
System.out.println("You lose!");
break;
}
}
else if(num > numberDrawn)
{
System.out.println("The number you guessed is greater, guesses made " + count + " Misses left: " + lives);
count++;
lives--;

if(lives == 0){
System.out.println("You lose!");
break;
}
}
else
{
System.out.println("Congratulations, your guess is correct! Guess made: " + count);
count++;
lives--;

break;

}
}
}
}

>>
>>55543732
Why god, why are you programming C++ on windows?
>>
>>55543757
see >>55543683

I'm sorry, I didn't learn to use java's console for input, I barely learned anything useful
>>
>>55543780
Yes. I am trying to figure out makefiles.
>>
>>55543847
To be more specific, I am trying to figure out .o files. I actually can compile the code by going
CC=g++
DIRECTORIES=-Iresources -Lresources
GNU=-static-libgcc -static-libstdc++
CONTEXT=-lglew32 -lglfw3
PNG=-lpng -lz
glfwwindow: glfwwindow.cpp resources/resource.o
$(CC) -o glfwwindow.exe glfwwindow.cpp resources/resource.o $(GNU) -lopengl32 $(CONTEXT) $(PNG) $(DIRECTORIES)


And just #including the png_loader.h
>>
>>55543732
Why are you even trying to compile a /header/?
>>
>>55544010
Because I have literally no clue whatsoever how to use makefiles the way all of the tutorials are telling me I should be using them and in every tutorial they convert headers to object files before compiling for some reason I cannot fathom.

My assumption was that it would save compile time in the long run but I have literally no clue.
>>
Anybody here do freelance programming? What are the best websites to do so?
I don't aim to make a living wage from it, I just want a site that's reliable and that I can actually make SOME money from.
>>
>>55539311
Yay, Common Lisp!
(loop for i from 0 upto 999 when (zerop (* (mod i 3) (mod i 5))) sum i)
>>
>>55544233
Freelancing sites are all completely saturated with low quality indians working for less than minimum wage.
If you were to charge a reasonable rate, clients would just point to all the stupidly cheap pajeets working for 1/5 your asking price and tell you to fuck off.
>>
I'm basically trying to create a bot that archives a chan. Periodically connect, download board/thread jsons, process them and so on. Now let's get to that downloading part. I need to know if there was a 403, 404 or no connection error. In case thread is 404, mark it as dead in db, in case of no connection just stop trying to download other files till next update, if 403 try again later, because some boards are available only in certain hours. Now I'm creating custom exceptions and throwing them up, so updatemanager can stop downloading, or thread can be marked as deleted and so on.
try {
URL url = new URL(path);
final URLConnection urlConnection = url.openConnection();
urlConnection.addRequestProperty("User-Agent", "totally not a bot");
final InputStream inputStream = urlConnection.getInputStream();
final String data = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
inputStream.close();
return data;
} catch (FileNotFoundException e) {
// throw 404 exception here
} catch (UnknownHostException e) {
// throw no connection exception here
} catch (IOException e) {
// throw 403
}/code]
But now I feel like every single pajeet out there could do it better. Any tips?
>>
>>55544048
you compile source files into object files
you dont compile header files
header files are #include<>'d in your source files

>My assumption was that it would save compile time in the long run but I have literally no clue.
They dont reduce compile time makefiles are a script to build your entire project which you will need once you have many files and libraries and so on

you are doing the right thing by learning them as they are used pretty much everywhere in some capacity
>>
>>55544355
>Any tips
You used Java, thats how Java code is supposed to look. Don't blame pajeets, its the language thats shit
>>
>>55539311
return 999*180 - 495*67;

Fucking plebs
>>
>>55544333
Damn, was afraid of that. Do I really have any other options similar to freelance work then? Maybe web dev I guess.
Nice trips btw.
>>
>>55544396
Okay but here is the thing, my header file literally could be a source file. It was a .c file a long ass time ago but I changed it to a header file. All it contains is a function that processes a png into a texture. Should I just leave shit like that as a header? What is the distinction?
>>
>>55544411
I don't blame them, I actually feel like they would come up with something better than I did.
>>
Kind of an odd question but are there any decent books on programming (or programming-related topics) anyone would recommend that are nonfiction rather than textbooks?

Been on a bit of a nonfiction kick recently so it had me wondering.
>>
>>55544583
I'm hesitant to recommend any books on just "programming" because all the decent ones were written in the late 70s and they mostly just regurgitate the cargo cult meme shit that programmers have been blindly following for the last 40 years.
You're not going to find anything new because those books are where those design patterns originated from.
>>
>>55539311
num = sum  
$ filter (\x -> x `div` 3 == 0 || x `div` 5 == 0)
$ [1..999]
>>
NEW THREAD!

>>55544625
>>
>>55544628
thank you hime
>>
>>55544628
>Page 1
Fuck off.
>>
>>55539311
I just ran this in the console
var a=0;
var b=0;
var c=0;

var iterations=0;

for(var i=3; i<1000; i+=3) {a+=i; iterations++;}
for(var i=5; i<1000; i+=5) {b+=i; iterations++;}
for(var i=15; i<1000; i+=15) {c+=i; iterations++;}

var solution = a+b-c;

//solution=233168
//iterations=597, modulusfags btfo
>>
>>55544434
Cast
url.openConnection()
to HTTPUrlConnection and analyse the http status codes.
>>
>>55545744
URL url = new URL("http://example.com");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.connect();

int code = connection.getResponseCode();


More clarification
>>
>>55542348
>>55542368
>>55542445
I looked into selenium and found sikuli somehow since the work I want to do is in flash.
I have played around with it and managed to get the hang of it but I wasted a lot of time finding out how to move the mouse location, how to CMD+W and such.
Is it sufficient to say that I should have some python knowledge to achieve what I want to do then?
This is what I have since I last replied.

hover(Location(400,400))
wait(1)
click(421,421)
wait(1)
click(421,421)
wait("1468360869963.png")
click("1468360869963.png")
wait(Pattern("1468358694679.png").targetOffset(10,-1),5)
click(Pattern("1468358694679.png").targetOffset(10,-1))
type('w', KEY_CMD)
wait(.5)
type('t', KEY_CMD+KEY_SHIFT)


Next I need to learn how to bind the whole script to a hotkey and loop it until I stop it with the hotkey. Feels like a macro but not a macro.
>>
>>55545744
>>55545787
That helps a lot, thanks.
Thread posts: 317
Thread images: 45


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