/dpt/ - Daily Programming Thread

Old thread: What are you working on Sup Forums?

Other urls found in this thread:

github.com/torvalds/linux
github.com/rust-lang/rust
brave.com/
rust-lang.org/conduct.html
travis-ci.org/brave/browser-laptop/builds
twitter.com/AnonBabble

dibs on the logo

your png is now optimized

Trying to learn peer-to-peer programming

I'm rather confused but I'm working on it.

Cortana APIs

Has anyone here even read SICP? Is it worth all the hype it gets as an introductory CS textbook?

working on an irc client for a game. should I use libircclient? I'm using C++ of course

No.

No.

No.

No.

Why not? What would you recommend?

God DAMN I love indignant tsunderes.

C++ would be a tsundere.

Depends on the language you're learning.

...

p-perv

Stop trying to force your meme, faggot.

...

x-xD

How am I meant to read a file that has headings for each data I want to get?

StoreName1:

Name: chocolate
demand rate: 50
setup cost: 200
unit cost: 5.2
inventory cost: 2
selling price: 3

Name: cake
demand rate: 50
setup cost: 300
unit cost: 4
inventory cost: 2
selling price: 3.1

StoreName2:

Name: coffee
demand rate: 100
setup cost: 200.5
unit cost: 4
inventory cost: 2.1
selling price: 2


I need to read this into 2 store objects which contain product objects with the data listed below. I have no idea how I'm meant to achieve this as the format is really weird to me. I'm working with Java by the way.

So basically for the first store object, it would load a store object with the name 'StoreName1' and contain the product object with name 'choclate' ,demand rate 50, etc

Any ideas?

That's the contents of the text file, right?

Yeah and I have variable names demand_rate, etc in the product object. So I need to sort past all the useless text to get the number

So all we get is C-heads fighting if a double- or triple-pointer linked list is faster

or

Java-heads who can't even parse a text file.


Post some some god damn lisp.

i need animu wallpapers

just write a basic parser. What's the problem? Check for a ':' every new line and store the number in your array or variabile

Ah, I'm an idiot and didn't see the ':'. I was looking at it for ages too...

It's not like we have an entire board for that, satan.

Parsing a text file with that sort of structure is easy.

well..
even if it wasn't there though, you could just take the last 'word' (be it a number or product name) in each line.

Read each char until you find a ':'
then read each char until you find a new line ending '\n'
simple

F# is based, BASED!

In C++, what does it mean for a parameter to have double ampersand?
"reference to reference" doesn't make much sense if we're talking about C++ references, so what does it mean or do?

rvalue reference

In C++11 you can pass the address of an rvalue to a function. This is useful for certain optimizations. At least, I think; I'm still trying to get the hang of move semantics et al.

Does anyone have a program with more than 100 K lines.?

i want to test my grep function

Just go on Github and find a project.

I had one which would match regexes agains legacy code, for finding certain functionality.

yeah i know that but i want more than 100 K lines

I think this is a small project which likely has that.
github.com/torvalds/linux

disclaimer: not something serious and professional like Unix

Hey gee, can a C++ reference be null?

it's called a nullptr yes

no

Yes or no?

No never. Some say it's just syntax sugar for a pointer but the magic of C++ makes it so the language magically knows when the reference goes invalid. Thank Odin for that. Because if that wasn't he case C++ applications would crash all the time or be horribly buggy messes.

Are you confusing references with smart pointers?

No I'm being sarcastic about references. References are just syntax sugar for pointers excluding some very rare occurrences where you'd have runtime errors using pointers and compile-time errors using references.

I find references annoying because you lose the context you're working in sometimes.

I like Rust.

>webcuck

>References are just syntax sugar for pointers
no, their semantics are different. syntax sugar is when different syntactic constructions share the same semantics.

Lol, Rust is not even good for webdev.

You sure you're allowed to browse a 18+ site?

Whatever. You get my point I hope.

rust is made for web devs, by web devs

>I tried webdev with rust but it wasn't even good
like I said, webcuck

How are they different?

>Literally made for servo
>a broswer engine

I didn't even try it. I know what my tools are and aren't good at.

You sure you're of age tho?

>confirmed webshit

Yes but, are you even capable of arguing?

>browser
>WEB browser
jackass

>web browser
>a userspace program running on a wm
>definitely NOT a webapplication

Your troll is so weak I don't even know where to start ;)

it's web-related, only relevant for webshit

fuck off to fag

>Yes
:^)

But sempai, what are you writing this shit on? A web application? B-baka!

If I want to get into making games, is there any reason not to use opengl. It feels like you basically end up reimplementing a lot of opengl if you dont.

They have the same semantics.

>C can be used to program an OS
>an OS is needed to browse the web
>therefore, C is a webdev language
kys sperg

use opengl, it's not even hard, you could use a pre-built engine but i can guarantee you the results would not be very good using an engine and it would still take a ton of work with not much benefits

servo is pointless since mozilla have decided to move to webkit

In C++, is there a difference between T& arg and T &arg?

>mozilla
>anything but webdevs
lad...

>servo is pointless
But that's not the point

Maybe the rust compiler? github.com/rust-lang/rust

>Has anyone here even read SICP? Is it worth all the hype it gets as an introductory CS textbook?
I did. It's a great book, but you'd be really lost if you use it as the only introductory course (after all, 6.001 was just one among few computer-related courses). And it has a content which isn't really obvious because it, for the lack of a better phrase, reaches a bit too far.
But when you do get it, when it clicks, even if it happens a few years down the line, and you understand what it's been trying to tell you - you will understand its greatness. It really does change how you think about things - even if you don't notice it yourself.

Is this harder than it looks, or am I fucking stupid?

Anyone have a working example?

the point is to use servo as Firefox's engine, but firefox is moving to Webkit anyway
thus pointless and will soon stop getting mozilla funding

no, spaces and newlines never matter

I usually write the latter.

No.

You could also write T & arg

>pointless and will soon stop getting mozilla funding
RUSTFAGS BTFO

see you can then put things like a leading newline means a new store object or whatever

No. Just like T* var and T *var. I use the former style in C++, because I think more in terms of types, and with C++11 semantics you really can do that. In C, however, I prefer the latter.

Nice source :^)

>firefox is moving to Webkit anyway
Wait what
I've been living under a rock. When did they get away from Servo and Gecko?

But sempai, the argument was weather Rust is a webdev or systems language, not if servo is good or relevant or anything else.

why aren't you using brave
brave.com/
the browser from the anti-SJW ex-mozilla CEO who got outed despite his efforts

rust-lang.org/conduct.html

obviously a web fag lang

>Adapted from the Node.js Policy on Trolling

but seriously, rust is pretty shit, it's pointless, it's not better than C++ in any way

They didn't. You're being rused.

>literally zero memory safety bugs

You really sure?

>literally zero
retard confirmed

>it's not better than C++ in any way

Nice meme

have you given it a try or are you just talking out of your ass?

>le "the compiler can fix all my bugs" retarded shit meme

It's shit.

Do you actually know *anything* about the thing you're talking about, sempai~ ?

it's seriously written in javascript?

>literally

Yes.

it uses V8, so just chrome anyway

>build failing
lel

>but seriously, rust is pretty shit, it's pointless, it's not better than C++ in any way
from the home page

"""
guaranteed memory safety
threads without data races
trait-based generics
pattern matching
type inference
minimal runtime
"""

it's the scripting language, like how you have lua to script on top of C++

this one is javascript over C++

can't we get a non-shit browser in C/C++ or hell even java would be better than fucking cancerous js

travis-ci.org/brave/browser-laptop/builds

The build history looks quite bad.

V8 is C++