[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: 90
Thread images: 12

File: 1502219406859.jpg (165KB, 960x660px) Image search: [Google]
1502219406859.jpg
165KB, 960x660px
Previous thread: >>61799317

What are you working on, /g/?
>>
>Created before the bump limit
Delete this invalid thread and kill yourself.
>>
>>61806259
You are not one of the regular OPs, are you?
Keep /pol/ shit to >>>/pol/, fuckwit
>>
>>61806277
b-but anon....I had to use make s-sure everyone saw how evil g-g-g-g-g-google is....h-h-hijacking /dpt/ is the only w-way
>>
>>61806259
>customer reliability engineering
>site reliability engineer

lol
>>
>>61806277
>>61806294
>>61806298
>google fags in full damage control mode
>>
>>61806320
I don't even like google
>>
>>61806335
kys your self
literally the only decent big tech company
>>
Real thread:
>>61806360
>>61806360
>>61806360
>>
>>61806349
>decent
>>
>>61806349
wtf?
>>
File: ThreeColorResultOne_0.png (22KB, 518x311px) Image search: [Google]
ThreeColorResultOne_0.png
22KB, 518x311px
>>
>>61806259
[/code]
#include <stdio.h>
int main(void)
{

char x;

x = 0x41;
printf("%c\n", x);

x = 0101;
printf("%c\n", x);

x = 0b1000001;
printf("%c\n", x);

x = 'A';
printf("%c\n", x);

return 0;
}
[/code]

One of the exercises in C - A Modern Approach asks which one of these is not a legal way to write the number 65. Am I retarded or are the all equivalent?

a) 'A'
b) 0b1000001
c) 0101
d) 0x41
>>
>>61806259

float f_atan(float x)
{
long long int i3, i5, i7 = ((long long in) (*(int*)&x));
i3 = i3*3 - 0x7EF47AE1;
i5 = i5*5 - 0xFDE8F5C3;
i7 = i7*7 - 0x17CDD70A4;

x = x - (0.333f * (*(float*)&i3)) + (0.2f * (*(float*)&i5)) - (0.1428 * (*(float*)&i7));
return x;
}


I'll post this again because everyone ignored it in the last thread.
>>
>>61806521
Your question is answered here >>61806563
Abandon this shit thread.
>>
>>61806588

I've already moved and sageee
>>
>>61806552
hmm
>>
Chip8 emulator struggling getting a 64x32 image rendered in opengl.
WHY IS THAT SO HARD.
dont wanna use glDrawPixels
>>
Do you like the new font /g/?
>>
>>61806552
Why do people put hex literals in their code? Do they want to pretend like a haxorr?
>>
File: _.png (103KB, 336x604px) Image search: [Google]
_.png
103KB, 336x604px
>>61806866
looks good
>>
>>61806894
I use a bunch in my emulator to interpret opcodes it doesn't make sense to write that in decimal.
>>
>>61806902
Holy shit, what was I thinking with that?
>>
>>61806843
what are you struggling with exactly? can you render a triangle?
>>
>>61806973
Why do you have private classes in your app?

e.g. SpaceshipShopButton is a private class
>>
>>61807016
No private classes anymore
I basically started from scratch again, I was doing a lot of wrong things
>>
Would you guys just pick a single thread and stick to it?
>>
File: cat on CRT 3.jpg (94KB, 540x405px) Image search: [Google]
cat on CRT 3.jpg
94KB, 540x405px
repost just in case this one takes off

i have a multi-dimensional JSONArray in Java, whats the best way to transform it to a set of atoms? eg, i want to take JSONArray "[[1,2],[2,3]]", and produce HashSet {1,2,3}, without spendinging an hour writing and debugging it.

ive been spoiled by better languages and juggling types from JSONArray to Array<String>[x,y] to Array<String> to HashSet<String> seems fucking retarded to me.
>>
>>61807115
streams
>>
>>61807006
Nah first time using opengl or any graphics api. I thought I could get away with just copy pasting some code but I guess I have to dive deeper.
>>
>>61807126
explain, because my experience with java is quite limited
>>
>>61807128
oh yeah it's kind of a pain to learn. try this for the babby basics:

https://open.gl/
>>
File: cells-reaction-face.jpg (28KB, 350x350px) Image search: [Google]
cells-reaction-face.jpg
28KB, 350x350px
>>61806259

>proudly bipolar

lol wat!?
>>
>>61807131
You need Java 8.

If you can turn your JSONArray into a stream of JSONObjects or whatever, then you can map each of those to a JSONArray, then to a pair of x and y, then collect it into a map, getting the first part for the keys and the second part as the values.
>>
>>61807147
nice, that looks useful I'll check it out thanks
>>
>>61807197
please show me how this would be done in a concise and readable manner, because right now ive got a nested for loop that adds them to an arraylist, which is then converted to a hashset, which knowing my luck will break on me for some reason or other
>>
>>61807254
>arraylist converted to hashset
why not add directly to the set?
>>
>>61807254
What JSON library are you using?
>>
>>61806866
How do you do this, just throw some shit up there n whatever?

Real what's a good android tutorial or something I want money for shitty apps
>>
>>61806349
As if, anon.
[spoiler]theyevenboughtrecaptcha[/spoiler]
>>
>>61806294
what's wrong with programmers in OP?
>>
Downloaded Dev-C++ to start working on some toy programs. Forgot how comfy this IDE is. Not quite the same as the original bloodshed dev setup but still quite nice when you want to work on small stuff outside the formalities of visual studio.
>>
>>61807254
>>61807337
I can't give you a code example if you don't tell me which JSON lib you're using.
>>
Problems I fixed for people today that took me less than 5 seconds to figure out without looking at code:
>promise was taking forever. was not returning promise from function
>selenium tests were timing out. needed to bump up the timeout for that environment
>element was not appearing in selenium tests. needed to wait for the element
Why are web devs such knuckleheads?
>>
Clojure or Scala if you have to use the JVM and can't use a more niche language than those two?
>>
>>61807612
Kotlin?
>>
>>61806552
Use of uninitialized variables. Whatever result you get is invalid because this is UB.
>>
>>61807612
Closure
>>
How can I make use of my 5 monitors + TV to maximise my coding productivity?
>One 2560x1600 30" monitor
>Two 1920x1080 21.5" monitors
>Two 1280x1024 19" monitors
>One 4K 55" TV
>>
>>61807500
>>61807337
sorry, needed a shit
org.json, cant use any third party libs because reasons

>>61807331
because one way or another im going to need to parse them, and i figure adding to an array in a loop will be less costly than adding to a set
>>
>>61807798
Use 4 Monitor+TV to block your doorway and never get interrupted again.
Productivity will skyrocket
>>
>>61807863
But then how will my mom bring me my Hot Pockets?
>>
File: cs501.png (131KB, 427x713px) Image search: [Google]
cs501.png
131KB, 427x713px
alright /g/, how shitty is my code? restarting c after really long time.
couldnt figure out better way to dealt with odd/even case other than that tacky last if statement.
>>
>>61807934
http://docs.cs50.net/problems/credit/credit.html
this stuff.
>>
>>61807934
>c = 0
>i >=2
>i-=2

>ccstring,"%llu",c
>int i = length; i >= 2 ; i-=2

pls be more consistent with your spacing
>>
>>61807982
ah, i see. thx. for logic wise, how can i improve? this odd/even always throws me off for some reason
>>
>>61807947
>>61807934
Maybe I have not read the whole thing, but this appears to fail half of the specification
>>
>>61806259
hey /g/
need help, i know technically zer0 in programming
BUT
i was just trying to set this bot [spoiler]https://github.com/RogerioBlanco/PixelCanvasBot [/spoiler] but i dont know how to fix this


 C:\Python27\Lib\PixelCanvasBot>python ./main.py -i peridot.png -f $cf69cf877982bbef15e4af22c666e9ef$ -x -1414 -y 2444
Load cached image
Traceback (most recent call last):
File "./main.py", line 62, in <module>
main()
File "./main.py", line 58, in main
run()
File "./main.py", line 53, in run
bot.run()
File "C:\Python27\Lib\PixelCanvasBot\src\bot.py", line 32, in run
self.wait_time(me)
File "C:\Python27\Lib\PixelCanvasBot\src\bot.py", line 56, in wait_time
if data['waitSeconds'] is not None:
KeyError: 'waitSeconds'
>> 03:06:00 ->### closed ###


any help?
>>
>>61808038
oh im not doing visa or amex stuff. just care about the logics atm
>>
>>61808044
open an issue

https://github.com/RogerioBlanco/PixelCanvasBot/issues
>>
File: scrollView.png (584KB, 1928x1920px) Image search: [Google]
scrollView.png
584KB, 1928x1920px
>>61807389
> just throw some shit up there n whatever?
Nope, my game UI is 100% code, no UI Builder buillshit.

> Real what's a good android tutorial or something I want money for shitty apps
I'm not into Android development, from what I've seem it's really hard and frustrating (Java + Android Studio + XML)
On iOS, I can do anything with Swift.
>>
>>61807837
import org.json.JSONArray;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

public class JsonExample {
public static Set<Integer> json2DArrayToSet(JSONArray json) {
return StreamSupport.stream(json.spliterator(), false)
.flatMap(elem -> StreamSupport.stream(((JSONArray)elem).spliterator(), false))
.map(elem -> ((Integer)elem))
.collect(Collectors.toSet());
}
}
>>
File: 1466698925405.jpg (140KB, 500x500px) Image search: [Google]
1466698925405.jpg
140KB, 500x500px
I'm going in for my first interview for a junior dev position this week. What kind of technical problems can I expect to be asked?
>>
>>61808117
yeah maybe is the better
>>
>>61807677
All the variables initialized correctly and the function gave accurate results when I first compiled it using GCC on Linux. Although initialization fails along with the function when I try to build it on windows. No idea why, it's probably due to some quirk of my original programming setup.

swap out the list for

        int i3 = (*(int*)&x);
int i5 = (*(int*)&x);
int i7 = (*(int*)&x);


if you're really concerned about it.

Also, did you run thus on your system? If so, I would be curious to know what exactly you're using and whether or not it produced accurate results.

>>61806894
Because it takes up less screen space that writing it in decimal
>>
>>61808271
The difference between a catamorphism, an anamorphism, a paramorphism, and a hylomorphism.
>>
>>61808271
searching, sorting, binary trees
>>
>>61808471
That's pretty neat anon.

What formula is this based on? Taylor expansion?
>>
>>61808151
what tutorials did you follow to get to this level?
>>
>>61808551
Taylor expansion with the exponentiation steps (x^3, x^5, x^7) performed using an integer aliasing trick to lower execution time, especially on systems that lack an FPU.
>>
>>61808609
Yeah I'm vaguely familiar with that from fast inv sqrt. How do you go about calculating the correction constants?
>>
Hired to work on ancient web app. Everything is vulnerable to everything. Not even sure if anybody else on team is aware that xss exists. Hear we're getting some third party vulnerability testing in the near future
>dear lord, it's going to be a massacre at best

What do to come out of this looking good? I'm not worried about getting flack for it myself since I'm not actually responsible for the major issues, but nobody else on the team including the manager seems to know, or care about them. Should I just bring it up with my boss? It's not really my job, but nobody else seems to be doing it. I kind of just want a record that I've at least brought up the concerns I'm aware of. Not to mention, I feel like a third party audit will be a lot more useful if we've cut out as many of the known vulnerabilities as we can and use that as a kind of double check to plug any remaining issues instead of just getting an email back that says "EVERYTHING".
>>
>>61808657
hard to say since we cant understand the relationship you have with your employer by talking through the net. I would just do what you are asked of and take reasonable precautions to cover your ass.
>>
My boss said that this week we're going to have pepper friday instead of pizza friday to be healthier, anyone know what pepper friday involves?
>>
>>61808569
Stackoverflow, Youtube tutorials and the official Swift documentation
I started with a calculator app.

First you need to know what app you're going to start with, then just do it.
>>
File: 1487667197847.jpg (18KB, 500x500px) Image search: [Google]
1487667197847.jpg
18KB, 500x500px
>>61807947
Tried but masturbated to the girl in video.
>>
>>61808642
How do you go about calculating the correction constants?

Here's a blog post in which somebody works through the process step by step:

http://h14s.p5r.org/2012/09/0x5f3759df.html
>>
>>61808876
>masturbated to the girl in video.

https://www.youtube.com/watch?v=ame2PH67gnk
>>
>>61808926
Praise be to the anon who payed for this.
>>
I've been working through a couple of texts on learning Java, but I've been struggling to comprehend topics surrounding classes, implementing interfaces, annotations, and what's generally going on beneath the surface of the language; additionally, the documentation for the API is a bit difficult for me to read in places because I'm not quite certain about some areas of the syntax. The main texts I've been using are Oracle's trail on learning the Java language and Java All-in-One for Dummies. Are there any other texts that someone could recommend that go through these topics slowly and thoroughly, and explain how these things relate to what the machine is doing?
>>
>>61809057
sounds like you are looking for a book on the java virtual machine. plenty out there i'm sure
>>
>>61809057
i have no idea about under the hood of java. but explaining concepts textbooks like java software solutions by lewis loftus and Think Java by downey explain all the main concepts. any textbook used by any reputable uni should suffice.
>>
>>61808509
Way too easy for a junior dev, this is intern-tier
>>
>>61806259
Worst thing is they probably get paid really well
>>
>>61806866

Prefer it to the old one.
>>
File: 1476251993200.jpg (52KB, 350x496px) Image search: [Google]
1476251993200.jpg
52KB, 350x496px
>>61806259
https://softwareengineering.stackexchange.com/questions/355325/mocking-in-a-real-world-scenario
pls respond.
>>
>>61809612
>that one faggot that takes 2 weeks to test his code while continuously shitting the thread
jesus fuck kys
>>
>>61809658
I don't know what to do :(
>>
>>61806259

Is there a good all in one development enviroment for C in emacs, like elpy for Python?
>>
>>61810230
cedet has been 'the' C environment for who-knows-how-many decades.
but spacemacs, if you wanna go that route, has a good C 'layer'
Thread posts: 90
Thread images: 12


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