/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Other urls found in this thread:

cowlark.com/2014-04-27-ada/index.html
localbitcoins.com/bitcoinaverage/ticker-all-currencies/
developer.android.com/reference/org/json/JSONObject.html
youtube.com/watch?v=vAVbrm2lV_4
openbookproject.net/thinkcs/python/english3e/
twitter.com/NSFWRedditGif

>What are you working on, Sup Forums?

Doing hackerrank challenges so I can git gud

Most of these seem really hard unless you watch a video that gives you the solution

2/10 pic

Who /hyped for CoD4 remastered/ here?

Looking at internship positions this summer, and this company is saying

"The ideal candidate should have some experience with C/C++, ADA, Python or similar programming languages."

I've already learned C and a little C++. Should I go into ADA or python next?

Burn

Are there any rust coders? What is an idiomatic way to chain Options or Results? Haskell has do-notation, what about Rust?

Why is the forEach meme so popular in JavaScript, /dpt/?

We have 'let' now, we don't need to worry about scope anymore. Stop using forEach and go back to using a traditional for loop. REEEE

Ada has a very small job market, you'd be better served with Python. I also hear Ada has a lot of boilerplate to it.

here's a leddit poast about it: cowlark.com/2014-04-27-ada/index.html

it costs money and i'm a CS student so no.

Learn Python. It is easy and useful.
And stay away from those who want you to learn Ada. Do you want to work for DoD?

As much as I hate Javascript, functional/lambda programming has good sides

>Paying $80 for a nostalgia trip
>Expecting to have fun in a game filled with whiny middle schoolers

L A D
A
D

The 3 MWs were the best CoDs (in chronological order), but 2bh senpai I don't think remastered is going to be as fun as OG CoD 4. The environment and the community as a whole is different. And also fuck paying for the new shitty cod just to get the remastered one.

I have to color part of some letters. Is this not feasible unless I draw the letters. Before hand. Because I was hoping to make it not bound to a certain language.

Thanks for user.post.isAnime() ===== 1
Thanks. Any good books or online resources for learning python?

>CIA niggers think they're people

First for animay is not programming.

Second for anime is programming and definitely NOT gay

>tfw all those comfy HC SnD memories of noob tubing from spawn, spamming x3 nades over houses, and firing rockets down corridors

I just have to buy it, user.

>a traditional for loop
As a C# dev, I don't remember the last time I used one of these.

I literally haven't typed a "for" control statement in many months.

if( op.image.isAnime() )
reply("Fuck you guys. Are you happy now? Would you also like me to put in the curly braces you faggots\n");

Someone give me a C# project to work on today. I have some vyvanse

>Thanks for user.post.isAnime() ===== 1

tic tac toe.
Its all youre good for

if(op.image.isAnime()==true)
op.thread.post(anime);
else if(op.image.isAnime==false)
op.thread.post(anime);

A GUI that presents the user with 5 randomly selected posts from Sup Forums.

The user selects the most offensive.

Store the selected posts with their selection count in a database.

Present the top 100 most offensive posts on Sup Forums within the last X time period.

This will require:
>usage of the Sup Forums API
>GUI in either web or desktop application
>communication from the client to a server
>storage of persistent data for measuring

I'd be willing to work on it with you if you get on Discord

I like this idea.

I'd be willing to put my new React front end skills to the test.

I am pulling this JSON file into my android app: localbitcoins.com/bitcoinaverage/ticker-all-currencies/

I want to get the value of GPB>rates>last as a double.
How can I access it using, for example, JSONObject?
developer.android.com/reference/org/json/JSONObject.html

>Discord
Wish Hiro would fucking filter this already.

How do I into programming? Im trying codecademy but I feel like it doesnt stick

learn as you go,
Look up Louis Rossmann videos on Youtube, he has a great philosophy that you should only be learning that you need at the time.

youtube.com/watch?v=vAVbrm2lV_4

Use Gson nigga.

No, this will require:
>wget
>grep
>cat

Prove me wrong, faggot.

READ A BOOK. Do exercises in the book. Then start making things.

CodeAcademy is godawful for everything but HTML/CSS (which is 100% just syntax) and its brief introduction to SQL. Pick a language. There are so many fucking languages where you can start from; just pick one. Hell, you can even go to plebbit and I'm pretty sure they have a long-ass list of actual non-meme resources outside of the usual listing of Zed Shaw's garbage.

how are you going to select the most offensive post if you cant render images with wget.

guys I almost got this string reversed, but it won't compile. It says "invalid conversion from char to char*". Also I'm aware that I suck. :>


int main()
{
//string someWord;
//cout someWord;
//int n = someWord.size();

char *word = "hello";
int n = sizeof.word;

//strcpy(word, someWord.c_str());

reverse(word, n);
cout

>reverse(str[i+1],n-1);

>reverse(str[i + 1], n - 1);
str[i + 1] is a char, reverse's first argument is a char*

ill start with this.

openbookproject.net/thinkcs/python/english3e/

so I just change it to *str[i+1]? Or would it be *str(i+1) instead?

Downey's a shitty teacher but at least you're off CodeAcademy

Damn, that's an issue..

Maybe 50% the number of answers + 50% a score of words on a blacklist?

I now get invalid type argument of unary ‘*’ (have ‘char’) reverse(*str[i+1],n-1); //*str++

-So I need it to take a pointer, but when I feed it one it then says '*' is invalid.

str[i+1] is a char. You're pulling an element for an array of characters.

Also this is why you should stick with imperative programming faggot.

The algorithm is simple. No need to make it complex by using shitty tail call recursion

void reverse(char *str, int n)
{
for (int a=0; a

you didn't feed it a pointer. if you want a pointer to x you write &x

char temp = str[n - a - 1];

Accidentally screwed that up. Or instead you can do
for (int a=0, int b=n-1; a

neither
*str[i + 1] means "dereference the pointer which is the i + 1 element of str". str is an array of characters, not pointers.

*str(i + 1) means nothing.

First understand what you actually want to do, then ask how to do it. Think about what you logically want to pass to the next recursion of reverse(), and then ask how to do that in C. You need to understand WHY you use things, not just copy paste C code until something works.

you get what you pay for. (nothing)

if (op.image.isAnime()) reply("[...]");

I cured cancer

nvm got it.
json.getJSONObject("GBP").getJSONObject("rates").getDouble("last")

>if( op
POO
O
O

This came in the mail today.

>if( op
What's wrong with that?

>he fell for it

yup :)

help!! I need a computer scientist!!

I have a 9x9 array which represents a tic tac toe board.

problem: map the array so that it element 0 maps to (1,1), element 5 maps to (3,2), and so on...

no IF statements allowed.

i can get rows with this,
row = Floor( box / 3 ) + 1

but i cant figure out how to get columns.

"if" is a fucking word and in english, we put a fucking space after each fucking words.

> 9x9
i meant a 9 length array

I had a similar problem when I wrote my sudoku generator and solver.

I made helper functions out the ass.

i need to keep this as simple as a formula that takes in the index and tells me which column it maps to

think about how the % operator could help you

(x,y) -> 3*(y-1) + (x-1)

>computer scientist

This is elementary algebra.

0 | 1 | 2
---+---+---
3 | 4 | 5
---+---+---
6 | 7 | 8


If you have index n, then you get
row = floor(n / width)
col = n % width

(NB! I use 0-indexed rows and columns).

For example, element at index 8 has row 8/3 = 2 and col 8%3 =2

Element at index 3 has row 3/3 = 1 and col 3%3=0

The source is Mesu-Nized Festival. Please enjoy.

nice try user, but the question asked for non 0 rows,cols

row = floow(n/width) + 1
col = n % width + 1

are the right answers

nice try though.

Read "How to Design Programs"*. Then learn pick up a manual or tutorial for any language you feel like learning. Apply the principles from the first book to the language in the second. Enjoy.

* May be supplemented with other texts such as SICP, Little/Seasoned Schemer, etc.

Any tips for working on the heap in C? I get the feeling my code isn't as good as it could be but I don't know how to do any better.

I've spent the last three weeks writing a linked list database in C. I wrote it initially for a junior developer position (got the job), but since then I've been working on it to make it do more.

I'm refactoring it, replacing arrays on the stack with dynamic arrays on the heap, but now I feel a little overwhelmed.

ganbate oniichan

>spending three weeks implementing a linked list

I hope you are trolling, son. Otherwise you have no business working as a junior developer.

>nice try
I wasn't aware that this was some sort of quiz and that I needed to answer user's task perfectly. I was merely giving him a hint.

looks like a good read, thanks dude.

OK bad phrasing.

I wrote the linked list in a few days. Since then I kept thinking about it so I came up with a plan, but now I'm full of doubt.

Have you considered Information Systems as a career path?

>wrote the linked list in a few days
Hmm.

>I wrote the linked list in a few days
You're not doing yourself any favors here.

I've spent the last three weeks writing a linked list database in C

struct linkedlist
{
int x;
linkedlist *next;
}

??????

Worst doujin ever
>badly drawn
>degenerate gay fetish
>awkward story telling and unrealistic character personalities

Kys.

lmao

How do you catch a LOT of possible invalid inputs? Say I have a window with a combobox and 4 textboxes for a C# program and a target userbase I KNOW needs to be stopped from doing as much dumb shit as possible (making exception of course for the inevitable cases I never prepared for); do I have a try/catch with a gigantic if/else or switch statement? Multiple try/catch statements just for input?

unless you have a typedef its
struct linkedlist *next;

validate your input,

you fucking cuck.

thanks.

Forgot how shitty C is.

No wonder it took a junior developer 3 weeks to make it

Is there a reason not using typedef?

I don't see what's wrong with taking a few days to write a linked list?

You don't simply create the data structure, you need to set it up so the user can access and modify it, save it, load it. You need to decide what data the list will store, how it will be presented.

Short answer: No

Longer answer: It depends on whether or not cluttering up the global namespace with arbitrary user types is desired.

if i need to prune rows in libreoffice calc that have any cell containing a value outside of a given range, is there a built in way of doing this, or do i have to actually write a macro for it? ive got a 1000 or so potentially dirty records i need to clean before they can be processed, so simply selecting the offending records manually is gonna take the piss a bit.

I think typedef can be confusing. Just use 'struct' so other people know it's a struct.

best java IDE? in particular i need it for stuff with webRTC and something in the cloud, don't know if it's relevant

thanks

>I don't see what's wrong with taking a few days to write a linked list?
Because it should take a maximum of 20 minutes in any given language of choice, except assembly where 50 minutes should be doable.

>You don't simply create the data structure, you need to set it up so the user can access and modify it, save it, load it. You need to decide what data the list will store, how it will be presented.
See above.

>cloud
What did he mean by this

For a dyke, she really know how to handle a big pair of balls

Sorry but I can only assume you're envious because I actually have a job.

it obscures the actual type (see: Linux kernel C style guide - 'typedef is evil')

Overused it can cause more confusion.

Where it is really useful is definitions like uint32_t, where it isn't just an alias to remove a few characters ('struct', 'enum, etc.) and the real type varies by platform.

>junior developer
>needs days to write a linked list
Not envious (and not jealous either, which is the word you're looking for).

>paste
const auto mvp = std::array{{
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
}};


>tell editor to auto indent the region
const auto mvp = std::array{{
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
}};


Only a liberal would call this an improvement.

what are you cucks arguing about?

implementing a linkedlist is as easy as
import java.util.LinkedList
...
new LinkedList()

He said implementing, not using.

>move inner curly braces to before, after the data
>tell editor to auto indent
const auto mvp = std::array{
{1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0}
};

Input masking
Look for what you want to accept and reject everything else

also

just fucking tell us what you're actually trying to do

Why? Do you have a job, or are you preoccupied living with your mom criticizing people on the internet?

whats the difference?