[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: 343
Thread images: 35

File: 1472830244464.jpg (140KB, 980x653px) Image search: [Google]
1472830244464.jpg
140KB, 980x653px
Previous thread: >>56673422

What are you working on, /g/?
>>
>What are you working on, /g/?

Almost done with my GPUDirect RDMA benchmarking utility.
>>
>your mom
>>
File: regina.jpg (48KB, 400x489px) Image search: [Google]
regina.jpg
48KB, 400x489px
>>56681191
Funny.
>>
What compiler do i use for C

K&R's book is so old
>>
>>56681187
So we eat pancakes soon?
>>
>>56681175
what does each person represent
>>
>>56681206
g++
>>
>>56681206
visual studios' compiler
>>
>>56681209
Yeah
>>
>>56681206
gcc
>>
>>56681210
Dining philosophers
>>
A toy program to practice my C.
#include<stdlib.h>
#include "map.h"
#include "point.h"

void
init_map(char *file)
{
map_width = 10;
map_height = 10;
map_size = map_width * map_height;
map = malloc(map_size * sizeof(struct cell));

struct pnt *c_point = malloc(sizeof(struct pnt));
struct cell *c_cell = malloc(sizeof(struct cell));
for (int i = 0; i < map_height; ++i) {
for (int j = 0; j < map_width; ++j) {
c_point->x = j; c_point->y = i;
c_cell = get_cell(c_point);

c_point->x = j; c_point->y = i + 1;
c_cell->north = get_cell(c_point);

c_point->x = j + 1; c_point->y = i;
c_cell->east = get_cell(c_point);

c_point->x = j; c_point->y = i + 1;
c_cell->south = get_cell(c_point);

c_point->x = j - 1; c_point->y = i;
c_cell->west = get_cell(c_point);

c_cell->type = GRASS;
c_cell->content = &no_item;
}
}
}

struct cell *
get_cell(struct pnt *point)
{
int index = point->y * map_height + point->x;

if (index >= 0 && index < map_size) {
return &map[point->y * map_height + point->x];
}
else {
return &no_cell;
}
}

void
draw_map(void)
{
char *data = malloc(map_size + map_height + 1);

int index = 0;
struct pnt *c_pnt = malloc(sizeof(struct pnt));
for (int i = 0; i < map_height; ++i) {
for (int j = 0; j < map_width; ++j) {
c_pnt->x = j; c_pnt->y = i;
data[index] = cell_to_char(get_cell(c_pnt));
++index;
}
data[index] = '\n';
++index;
}
data[index] = '\0';

printf(data);
}

char
cell_to_char(struct cell *cel)
{
char rtn;

switch (cel->type) {
case GRASS:
rtn = ',';
break;
case MUD:
rtn = '~';
break;
case COBBLE:
rtn = '-';
break;
case NONE:
default:
rtn = '0';
break;
}

return rtn;
}

void
destroy_map(void)
{
free(map);
}
>>
>>56681206
write your own, fucking pajeet
>>
>>56681206
gcc
>>
>>56681198
Who's the semen demon?
>>
>>56681305
You are mother
>>
>>56681305
Winona Ryder
>>
>>56681206
K&R tells you to use cc.
$ cc --version
cc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
I dropped K&R and started reading this one instead:
https://www.amazon.com/C-Programming-Modern-Approach-2nd/dp/0393979504

Did I fuck up?
>>
>>56681305
Some chick that got raped and and killed by a serial killer. The serial killer took that photo of her moments before she was killed.
>>
>>56681371
Regina Kay Walters.

This photo was taken by serial killer, Robert Ben Rhoades right before he killed the 14-year-old Walters. Rhoades was famous for touring the country in an 18-wheeler truck that was fully equipped with a torture chamber. This photo was taken in an abandoned barn in Illinois where Rhoades murdered Walters. Before killing her, Rhoades cut off her hair and forced her to wear the black dress and heels you see her wearing in the picture.
>>
>>56681395
>cut off her hair and forced her to wear the black dress and heels you see her wearing in the picture.
That's fucking hot.
>>
Holy fuck, why do people like Python so much? I'm trying to fix some retard's broken script and the syntax is disgusting, looks like a total nightmare. Definitely not any better than just writing it in C/Java/whatever.

Probably gonna just recode my own implementation in C, I don't know how anyone can fuck up something this simple. It's literally just extracting a token from a URL, sending a GET request, parsing the JSON response, and then passing that response into another program. And somehow it still reads like ass.
>>
>>56681435
>Autism - the post
>>
>>56681435
>Holy fuck
>C/Java/whatever
>Java
>write shit in C that doesnt need to be written in C
>muh syntax dude, totally matters

i dont know
>>
>>56681469
>snakefags will defend this
class Periscope(Plugin):
@classmethod
def can_handle_url(cls, url):
return _url_re.match(url)

def _get_streams(self):
match = _url_re.match(self.url)
res = http.get(STREAM_INFO_URL,
params=match.groupdict(),
acceptable_status=STATUS_UNAVAILABLE)

if res.status_code in STATUS_UNAVAILABLE:
return

playlist_url = http.json(res, schema=_stream_schema)
return HLSStream.parse_variant_playlist(self.session, playlist_url)

>>
>>56681483
>my friend can't program Python and I'm a Python illiterate therefore Python is shit

Your friend is a retard and you're even more retarded.

I can do the same thing with 5 statements, and that's including the library imports.
>>
>>56681435
Must be a total retard who wrote the initial script because that's something that takes 10 LoC top in Python with requests & json libraries and you wouldn't be complaining about rewriting 10 LoC program.
>>
File: output.webm (376KB, 400x780px) Image search: [Google]
output.webm
376KB, 400x780px
Still working on akari-bbs!
I started code tag support last week but I got distracted with client-side fluff.
>>
>>56681435
The guy sucks at Python so bad he has to ask his friend (you) to help him, even though you don't even know any Python.

How the fuck did you come to the conclusion that your friend's shitty script is somehow an typical example of idiomatic Python code?

The Doenning-Kruger is strong with you.
>>
>>56681494
It's not a hard problem so I have no idea why the solution is so contrived. I know jack shit about Python (this is my second exposure to it) so maybe if all Python code isn't this fucking terrible it's an OK language, I don't know.

I just want to watch Periscope streams in VLC but apparently this plugin's been broken for months and no one cares enough to fix it, another great victory for OSS.

>>56681553
I assumed this was idiomatic Python code because it's part of a pretty popular package and most of the code looks like this.
>>
>>56681548
why are the colors fucked up?
>>
>>56681574
So let me get this straight... You're actually writing a plugin. Your "friend" is actually the VLC community? You have only barely seen Python code and you think you're somehow able to contribute to the VLC project? You think writing an application plugin is the same thing as a script that sends a single HTTP request and parses it?
>>
>>56681574
>VLC
>idiomatic anything
Pick one.
>>
>>56681599
>You think writing an application plugin is the same thing as a script that sends a single HTTP request and parses it?
yes
>>
>>56681210
cuck dad, son, daughter, milf mom, adopted refugee child
>>
>>56681616
I guess this is the first time you're writing a plugin then.
>>
>>56681635
cuck
>>
File: 1453104104337.jpg (91KB, 318x355px) Image search: [Google]
1453104104337.jpg
91KB, 318x355px
Any C++ tl;dr books for people who already know how to program?

I want to learn C++ but I don't want to go over what is a variable for the 9999999th time
>>
>>56681599
No, I never mentioned my "friend" or anything like that. There is a script that shipped with this package that, supposedly, parses a periscope URL, sends a GET request, and extracts a video stream from the JSON response. The script is broken. I decided to fix it. Unfortunately it was written by someone who, I can only assume, is a total retard. I have no intention of contributing my code back to the project.

This package passes the stream INTO VLC. It doesn't handle any of the video decoding itself. It is a truly trivial problem.
>>
>>56681683
>Any C++ tl;dr books for people who already know how to program?
Effective C++ + More Effective C++

After that,
Effective Modern C++

After that
Exceptional C++ and More Exceptional C++
>>
>>56681695
After that
Unbelievable C++ programming
>>
>>56681687
Trivial, yes. But it does require minimal knowledge of how the VLC ecosystem works as well as Python barebone knowledge.
>>
File: 1466856926360.jpg (23KB, 249x265px) Image search: [Google]
1466856926360.jpg
23KB, 249x265px
>>56681695
>these are all real

I thought this was a meme reply, I'll check them out
>>
>>56681695
>these are all real
proof C++ warps the brains of those using it for too long
>>
>>56681834
Friendly reminder that the Haskell reference book for beginners is called "Learn you a Haskell for great good!" and that the Lisp reference book is called "Structure and Interpretation of Computer Programs".
>>
>>56681859
>"Learn you a Haskell for great good!"
dopey

btw thats not a lisp reference book, its a very basic introductory CS book
>>
>>56681859
>Lisp reference book is called "Structure and Interpretation of Computer Programs"
firstly that's for scheme, a dialect of lisp, and second whats wrong with that?
>>
File: SHIZ.png (34KB, 601x338px) Image search: [Google]
SHIZ.png
34KB, 601x338px
>>56681175
working on some java, this is pretty triggering, assignment be like 4/4 style, 8/8 correct documentation, 4/4 documentation, but presentation be like 3/4, christ man, all cause of this "inconsistent indentation"
>>
Thought I'd pick up Go again to make myself an automatic RSS downloader. I already regret it.
It runs fine, but none of the fields are filled.
package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"os/user"
)

type config struct {
directory string
tasks []task
}

type task struct {
url string
title string
}

func newConfig() (*config, error) {
usr, err := user.Current()
if err != nil {
return nil, err
}
path := fmt.Sprintf("%s/.bulkrss.json", usr.HomeDir)
data, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}
var conf config
err = json.Unmarshal(data, &conf)
if err != nil {
return nil, err
}
return &conf, nil
}

~/.bulkrss.json
{
"directory": "/tmp",
"tasks": [{
"url": "http://www.nyaa.se/?page=rss",
"title": "*"
}, {
"url": "http://sukebei.nyaa.se/?page=rss",
"title": "*"
}
]
}
>>
>>56681879
>its a very basic introductory CS book
Everybody uses it as an introductory book to functional programming. Nobody has used it as an introductory CS book since the mid 80s, except maybe MIT because they're """"special"""".
>>
>>56681687
you're looking at this livestreamer plugin?

https://github.com/chrippa/livestreamer/blob/ab80dbd6560f6f9835865b2fc9f9c6015aee5658/src/livestreamer/plugins/periscope.py

i don't see what's so bad about this
>>
>>56681880
>firstly that's for scheme, a dialect of lisp, and second whats wrong with that?
Because nobody actually writes computer programs in Scheme.
>>
>>56681886
You lost a mark because you had a space too much?
>>
>>56681911
you might not, but that sounds like a personal problem
>>
>>56681900
LOL

The fucking millennial didn't even have the attention span to try to understand fucking 50 lines of code before he decided to blog about it on 4chan.
>>
>>56681886
You should've used an automatic formatter dumb nigger.
>>
>>56681900
Well I've had people in this very thread tell me it's not "idiomatic Python", but beyond that, the far bigger problem is that it doesn't fucking work.
>>
File: 1471450111834.png (213KB, 484x642px) Image search: [Google]
1471450111834.png
213KB, 484x642px
>>56681900
>.py
>>
>>56681947
>Well I've had people in this very thread tell me it's not "idiomatic Python"
It's not, this shit right here is bad form
        if res.status_code in STATUS_UNAVAILABLE:
return

playlist_url = http.json(res, schema=_stream_schema)
if "hls_url" in playlist_url:
return HLSStream.parse_variant_playlist(self.session, playlist_url["hls_url"])
elif "replay_url" in playlist_url:
self.logger.info("Live Stream ended, using replay instead")
return dict(replay=HLSStream(self.session, playlist_url["replay_url"]))
else:
return


Different return values and types based on some arbitrary state, that's very bad form indeed.

>but beyond that, the far bigger problem is that it doesn't fucking work.
It's still 50 lines of code mate.
>>
>>56681936
Again, the problem is trivial: so why is the solution so overengineered and fragile? It should literally be three lines. One to extract the token from the URL, one to send the GET request, and one to parse the JSON and return the stream.
>>
>>56681981
>Again, the problem is trivial: so why is the solution so overengineered and fragile?
V L C
L
C

> It should literally be three lines. One to extract the token from the URL, one to send the GET request, and one to parse the JSON and return the stream.
It should. Fix it.
>>
>>56681919
pretty much, prof is really really hard on formatting in a very very specific way
>>
>>56681925
>if everyone programmed in Scheme the world would be a better place

/prog/ pls, moot killed you for a reason.
>>
>>56682009
scheme and other lisps are horrible
>>
an someone help with this assignment. It involves inventory classes which inside, has a linked list of itemstacks. I keep getting "undefined reference" to Itemstack and item. There are other files that go with this, though my task was only to work on the inventory files.
#include <utility>
#include "Inventory.h"

// Allow the compiler to define the remaining
// comparison operators
using namespace std::rel_ops;

/**
*
*/
Inventory::Node::Node()
:data( Item(0, "Air"), 0 )
{
this->next = nullptr;
}

/**
*
*/
Inventory::Node::Node( ItemStack s )
:data(s)
{
this->next = nullptr;
}

/**
*
*/
Inventory::Inventory(){
this->first = nullptr;
this->last = nullptr;
this->slots = 10;
this->occupied = 0;
}

bool Inventory::addItems(ItemStack stack){

Node *new_node = nullptr;

new_node = new Node;


if( this->occupied == 0){
this->first = new_node;
this->last = new_node;
this->occupied++;
return true;
}

if (this->occupied < slots){
Node *it = new Node;
it = this->first;
bool match = false;

while (it != nullptr){
if (stack.getItem().getName() == it->data.getItem().getName()){
it->data.addItems(stack.size());
it = it->next;
}

if(match == false){
(this->last)->next = new_node;
this->last = new_node;
this->occupied++;
}
return true;
}

return false;
}

}

void Inventory::display(std::ostream& outs) const
{
Node* it = this->first;

outs << "-Used " << this->occupied << " of " << this->slots
<< " slots \n";

/* while ( it != nullptr ) {
outs << it->data
<< "\n";

it = it->next;
} */
}
>>
what do you think about making a java to c compiler for a senior honors project?
>>
>>56681695
Okay I checked Effective C++ out and while it looks great and I'll still read it, it's not what I'm looking for right now

I should've said, learning C++ tl;dr books for people who already know how to program in other, higher level languages, but not C++.
>>
>>56682020
High school? Sounds good mate.
>>
>>56681892
Fixed it. The marshaller cannot handle unexported fields.
>>
>>56682018
Haskell, pls
>>
>>56682050
>The marshaller
Go does AbstractBeanFactory now?
>>
>>56682021
I learned myself C++ from reading Effective C++ and More Effective C++, but I came from a C background. If you don't know C, I would say start with that before venturing into C++ country.
>>
>>56682020
Kek what shithole college are you doing your CS degree at where that would be an honors project? Unless you're writing your own standard library. It'd be better to write a C compiler that spits out JVM bytecode.
>>
>>56682074
No, the JSON (un)marshaller.
>>
>>56682112
You mean a parser?
>>
I dont know if its a good idea, but would it be possible to learn 3 languages within 9 months, i am currently going through java, i guess it would be one language per 3 months, cause i am looking for a job/coop/internship
>>
>>56681683
Learn to bug fix the compiler errors.
Stop wasting time with books.
>>
>>56682112
>system programming language
>JSON
And this is why Go is going to flop

Not that I like the "import from github" functionality either, that has to be a massive security issue.
>>
>>56682126
IT'S A MARSHALLER
>>
>>56682090
I'll consider this, thanks for the help
>>
>>56681981
for your own use i think that's fine. i can almost guarantee that's what the first version of the linked script was
they do some validation of the url and response, and then need to do things slightly differently if the stream isn't live. none of that seems crazy if you're going to release it to a bunch of retards
>>
>>56681886
ctrl+shift+f
>>
>>56682137
>First, the import path is derived in an known way from the URL of the source code. For Bitbucket, GitHub, Google Code, and Launchpad, the root directory of the repository is identified by the repository's main URL, without the http:// prefix.

>the example:
import "github.com/golang/example/stringutil"

what the fuck
>this is real
>this is actually how you import code in Go
>>
>>56682126
w/e
>>56682137
It's not meant to be used for systems programming. Pike already corrected that. The go get tool let's you steal shit from GitHub at light speed. Too bad it doesn't do versioning, so it's complete shit. Even though I hate Go as much as the rest of the world, the development time is generally really low software.
>>
>>56682266
are you serious
>>
>>56682266
Exactly!

I mean, what happens when somebody updates their repo and add code that isn't backwards compatible with your code?

Or even worse, what happens if someone adds malicious or botnet code into their repo?

But then again, Go is the brainchild of the botnet company so I guess it makes perfect sense to make backdoors into programs this way.
>>
>>56682097
What is a good idea for a senior honors project then?
>>
>>56682266
They aren't messing around with their "everything on the cloud" meme
>>
>>56682277
>Too bad it doesn't do versioning
That means that it's completely useless. If somebody updates their code with a breaking change, suddenly all your code breaks.

This is some node.js-tier shit where a bunch of wannabe developers make neat frameworks without having even fundamental understandings of security.
>>
>>56682311
they say that no matter what idea i suggest. if my project was to solve the halting problem, they'd say it's too simple. i only have 2 semesters to complete it whatever i pick
>>
>>56681404
>That's fucking hot.
please seek professional help
>>
>>56682338
>he hasn't solved the halting problem yet

Poo in loo, Pajeet.
>>
>>56682391
He's just mucking around
>>
>>56681395
she was probably a bitch anyways
>>
>>56682332
Correct. It makes npm a work of art.
They did try to fix it by implementing vendoring, which basically comes down to 'clone the repo into your own project and remove its .git directory'. Other desperate attempts are 3rd party tools like Glide.
TL;DR Go is a trainwreck. Too bad D doesn't get much traction.
>>
>>56682391
>please seek professional help
Good advice. Do you think Robert Rhoades is available to consult me on how to best live out my fantasy?
>>
File: 015.png (900KB, 1920x1080px) Image search: [Google]
015.png
900KB, 1920x1080px
>>56681175
Interactive real-time fractal viewer with freely specifiable generating formulas, modifiable colorization methods (cyclic, histogram equalization, ...), analytical tools (plotter, traces, ...) and much more.
It manages about 6 billion cycles per second thanks to SSE. That's about 4000 cycles per pixel on a 1600x900 monitor. Easily runs in real-time (interactive!) due to pruning / interpolation.

Pic related is some weird sin fractal I discovered with cyclic hue coloring (no AA though).
>>
>>56682417
she and her bf hd escaped from their homes

nothing of value was lost
>>
>>56682019
Sounds like you have a linking problem.
>>
>>56682446
Neat
>>
I want to measure the amount of fps of my c++ program.
I have these two global variables:
clock_t begin = clock();
clock_t end = clock();


and this is where I measure the amount of fps:
end = clock();
double fps = CLOCKS_PER_SEC / (double)(end - begin);
begin = end;


Is this correct? It's giving me weird values.
e.g. when the fps should be between 500 and 1000, it gives me 500 or 1000 instead. when it should be above 1000, it gives me inf.

I know that it happens because (end-begin) goes to 0 when the program is too fast, but I don't think it should actually be 0 and give me fps=inf.
>>
>>56682462
Don't use clock. Use _rdtsc.
>>
>>56682423
Despite the memeing D gets on this board (and in real life), I really like D. I think its problem was that it was about 20 years too early and it had a chance to become relevant, but then the C++ committee picked up on the speed it was lagging behind and then rapidly standardised 11 and 14 and 17 coming around soon, turing C++ from some archaic templated C hell to a truly multi-paradigm, modern language.
>>
>>56682266
you download the code to $GOPATH/src/ with the go tool. "github.com/golang/example/stringutil" is the path to the package you want to import

>>56682332
>>56682423
you know you could write your own package manager for it...
patches are welcome.
>>
>>56682509
>patches are welcome
>B-BUH IT'S A BETA
>>
>>56682509
Why would I write my own package manager for it? It sounds like it truly is FUBAR
>>
>>56682509
Thank you for Correcting the Record.
>>
>>56682509
>patches are welcome
I doubt that they would accept a patch that changes entirely how the package manager works and functions.

Like any derailed software project, Golang is forever cucked by their initial bad design.
>>
>>56682266
>botnet compiler actually spawns HTTP connections to google
Holy fuck it wasn't just a /g/ meme, it's actually real
>>
>>56682503
I've used C++ mostly with Qt, but I actually like the language. It's very powerful, but it the ecosystem is segmented. Some use exceptions, some don't. Some use raw pointers, some use unique_ptr or shared_ptr. I'll check out C++11/14/17 and see if I can write a REST API in for my pet project I have in mind. And as a bonus: it's free of SJW and Starbucks hipsters.
>>56682509
>changing tires on a car with a broken engine
Nah, I'd rather masturbate.
>>
>>56682462
just use <chrono> my nigga:
http://en.cppreference.com/w/cpp/chrono/high_resolution_clock/now
>>
>taking go seriously in the first place
>>
>>56682446
Cool.

Have you considered making a fragment shader version? Then it'd be even faster. You could even try generating the shader at run-time and recompiling it every time the parameters change.
>>
>>56682549
>I doubt that they would accept a patch that changes entirely how the package manager works and functions.
no one said that. patches can create files, you know.

>>56682574
it doesn't
>>
>this go drone
lol
>>
>>56682581
Well, idiomatic C++ uses exception and RAII for what it's worth. RAII is an inherently good idea, it allows for constructs like this
void foo()
{
// function content
// ...

{ // minimal critical section
std::lock_guard<std::mutex> lock(muh_mutex);

// i can do whatever here, even if an exception is thrown the lock is safely released
}
}


This is multithreading done right, and is very unlike the potentially dangerous ThreadDeath error that has haunted Java for ages

>I'll check out C++11/14/17 and see if I can write a REST API in for my pet project I have in mind
Well, I actually worked as a backend web developer using C++11 some years ago. It's a bit nitty gritty for web development, because you basically have to do FastCGI (which is the only point of doing C++ for web development in the first place) and there are only a handful of existing frameworks to build on. But aside from that, it's pretty nice to work with. Horribly slow compilation time for larger projects though, even with precompiled headers. Compiling the Linux kernel was faster than a clean build of the web project I worked on.
>>
File: standards.png (24KB, 500x283px) Image search: [Google]
standards.png
24KB, 500x283px
>>56682581
That's not a problem with the language, it's a problem with people.
If you tried to have the language enforce one style people will just move to another language that lets them do things the way they like, and segmentation stays the same.
>>
File: tour.png (382KB, 519x646px) Image search: [Google]
tour.png
382KB, 519x646px
Alright, turns out this was the C++ tl;dr book I was looking for, pretty good t.b.h
>>
>>56682574
It's not related to Google. It's more of a collection of ideas ripped from Plan 9.
>>
>>56682616
>it doesn't
Are you shilling or just naive?

My tcpdump trace says otherwise, but I guess Google shills will defend this and say that it simply checks for a new version.
>>
>>56682690
I have that book. Somewhere.
>>
>>56682598
I actually do some of the work in the fragment shader at the moment. The problem with outsourcing the main formula iterations to the GPU is that deep zooming requires arbitrary precision floats. Currently, I do that with my own little homebrew library that makes use of perturbation theory. I doubt that this will run faster on my GPU due to branches and bit fiddling that I perform in there.
>>
>>56682050
this is good
it means go has proper encapsulation
>>
>>56682676
I have written some simple C + FastCGI web applications, but I have to say it was a pain in the ass. what would you recommend if I wanted to write web applications in C++?
>>
>>56682676
>RAII is an inherently good idea

WHEN WILL THIS MEME DIE? RAII and OOP are the epitome of cargo cult programming.
>>
>>56682676
I know the basics of RAII and I like the idea. Your snippet reminds me of Rust (another language invented at Starbucks), but done right.
Do you have any other suggestions to write backend web stuff in? Python, Go and Rust are toys. Scala looks tempting, especially because I have a Java background.
>>
>>56682734
But why does encapsulation not work with unexported structs? Is it because they're package scope?
>>
>>56682762
>cargo cult programming
Wat?
I know what a cargo cult is, but please explain yourself.
>>
>>56682738
I don't remember the name of the framework we used, I think it maybe was called blackbox. It's an apache one.

Anyway, use C++11 (preferably 14, but results may vary) and boost. Use Qt too, if possible. Both boost and Qt give you high-level functionality you'd miss otherwise.

Whatever you do, don't start writing your own minimal framework, that's pain as hell.
>>
File: 1303935416421.jpg (234KB, 615x714px) Image search: [Google]
1303935416421.jpg
234KB, 615x714px
>Start fucking with C yesterday
>mfw it's actually fun
>>
>>56682791
What have you done?
>>
File: raii.png (41KB, 649x365px) Image search: [Google]
raii.png
41KB, 649x365px
>>56682762
>>
>>56682762
RAII has nothing to do with OOP you imbecile.

>>56682763
>Do you have any other suggestions to write backend web stuff in? Python, Go and Rust are toys. Scala looks tempting, especially because I have a Java background.
Scala is on my list of languages to try, but also Erlang. I would try Erlang first.

In the web dev job we actually also used Python for the non-workload-intensive endpoints. Python+flask is pretty neat for getting a simple REST API up and running pretty quick, and it's quite performant when configured correctly (read: long-running event loop, not a invoke--halt cycle). But of course, it will never beat C or C++ as a long-running FastCGI process.
>>
>>56682823
Ah, twitter. The place where Starbucks "code artisans" loudly exclaim their uneducated opinions about topics they don't really know.
>>
>>56682701
show us, then.
the go tool won't import from a remote server when compiling, if that's what you are implying. you have to download the package, by running "go get $URL"

>>56682823
muh Stroutroup cult
>>
>>56682782
you're asking the json marshaller in another package to unmarshal a struct with private fields in your package
what do you think is gonna happen?
other languages simply allow you to do this because reflection allows you to break all encapsulation
>>
>>56682730
Darn.

I recall reading about someone doing arbitrary-precision math with CUDA, but I don't know if it's applicable to this.
>>
>>56682849
as opposed to the educated elites of 4chan?
>>
I stopped caring about Haskell when I was introduced to the concept of monads. What a crock of shit. If your program can only be modify state by inventing a higher-order abstraction that can't exist, like some kind of programming deity, then you are fucking wrong and the abstraction is flawed. Same for type checking that basically says "the correct type is whatever the correct type is". That's what the error message said transcribed to words, but god forbid if i wrote in down in English instead of the meme Haskell runes that GHC marks me wrong.

Haskell is logical and category theory never lie my ass. Haskell is just as flawed as any other """functional""" language.
>>
i hate programming
>>
If I want to learn C should I start with that book by Kernighan or something more recent which explicitly follow the last standard?
>>
>https://www.youtube.com/watch?v=KlPC3O1DVcg
C fags on suicide watch
>>
Looking to move from C programming to start learning about Object Oriented Programming.

Someone recommend a good course using either C++, C# or Java?
>>
>>56682888
meanwhile in elm, another ml-like lang:
http://elm-lang.org/assets/blog/error-messages/0.16/incomplete.png
http://elm-lang.org/assets/blog/error-messages/0.16/if-branches.png
https://flockler.com/thumbs/1992/truthy_s830x0_q80_noupscale.png
http://elm-lang.org/assets/blog/error-messages/0.15.1/naming.png
>>
>>56682921
why are you here then?
>>
>>56681335
THE CONCH HAS SPOKEN!
>>
>>56682856
>show us, then.
This is what happens when I simply invoke go build source.go
>>
>>56682888

> I can't grasp it, therefor it is shit.
>>
>>56682886
Touché.
>>
>>56682825
I did take a look at Python and Flask. It looked really nice, but I was a bit skeptical at the performance. It's not like my pet project will receive millions of concurrent users, but it'd be nice if it could handle ~100 users. It's database heavy, Python might just as well perform as good as C++. Also, Python is on the top of my list of just werks(tm) languages.
>>
>>56682968
are you retarded or just pretending to be?
https://github.com/golang/tools
>>
File: r_animu.png (65KB, 320x470px) Image search: [Google]
r_animu.png
65KB, 320x470px
>2016-09-19
>Not using R

Why is it so beautiful, lads
>>
File: 2016-09-19.png (42KB, 746x281px) Image search: [Google]
2016-09-19.png
42KB, 746x281px
>>56682923
the first comment is copypasta potential
>>
>>56682968
Isn't that just traffic to the GitHub servers?
>>
>>56682975
〉I'm new therefore I greentext
>>
Why the fuck is it that the Racket FFI will work with some DLL's that I have installed, but not others? Jesus Christ, programming for Windows is such a god damn handful, I wonder how the platform ever got popular.
>>
Which one guys?

Recommended Books/Tutorials?
>>
>>56682994
Well, our light-weight endpoints (Python+flask with mongodb [yeah I know, hipster as fuck]) scaled to around 5000 concurrent users on a single server (the size of the company's largest client). I think that it would scale beyond that too. Of course not million of users, but thousands of users is more than good enough for many things.

I like Python for the extremely low development time, but it's easy to over-engineer things in Python (which of course is true for C++ as well).
>>
>>56682921
this

i'm only interested in the result
>>
>>56683053
again, why are you here?
>>
>>56683045
both are great but C++ if i have to pick one

http://en.cppreference.com/w/
https://docs.oracle.com/javase/tutorial/
>>
>>56682888
stateful operations occur within a particular kleisi category, this category can be embeded in Hask and run with pure code, the end result is type safe control of effects
>>
>>56683053
>>56682921
RASMUS FOUND
>>
File: Badass tsukasa.jpg (347KB, 377x1600px) Image search: [Google]
Badass tsukasa.jpg
347KB, 377x1600px
>>56683072
suck my fucking dick you cunt
c++ is SHIT
>>
>>56683071
why do you exist?
>>
>>56682968
try tunning
proxychains go build source.go
again, the compiler won't download the package unless you tell it to download it...
>>
>>56683072
I'm not looking for the manuals, but a tutorial or book that teaches it. I have only the most basic understanding of OO.
>>
>>56683084
if you say so you obnoxious manchild weeb

>>56683095
the java tutorial teaches it
>>
>>56683076
>implying Hask is a category
>>
>>56683076
In what world is it pure?
>only the runtime is tainted, the code is """Pure"""

This level of mental gymnastics is truly astonishing.
>>
>>56683117
>pure mathematics isn't pure because someone has to think it, this is a side effect in the mathematician's brain
>>
File: 1447823969082.jpg (54KB, 630x400px) Image search: [Google]
1447823969082.jpg
54KB, 630x400px
>he writes code like
int main(){
return 0;
}

instead of
int main()
{
return 0;
}

lmao. I thought this place was for serious coders
>>
>>56683178
main = return 0
>>
>>56683046
You convinced me, I'll take a look at Python and Flask. It's sufficient for my needs.
>>
>>56683164
I know plenty of mathematicians who would actually agree with this line of thinking, so the joke is on you.
>>
>>56683204
>I know plenty of idiots who would agree with this line of thinking, so the joke is on you
>>
>>56683190
main = lambda: 0
>>
>>56683178
>he writes code like
int main()
{
return 0;
}

>instead of
int
main()
{
return 0;
}


Do you even bsd?
>>
>>56683217
You're visibly upset.
>>
>>56682880
I will look into that, thanks Anon!
>>
>>56683236
brainlet
>>
>>56683236
I'm not though
>>
>>56683178
8/10 bait, well done.

I like the use of a shit tier indenting style decoy bait to hide the actual bait of the clueless noob trashing something they can't describe except by example.
>>
>>56683178
>he writes programming101 tier C
>he thinks it makes him a serious coder
>>
int main(void){
return 0;
}

is how i write it

afaik main() and main(void) are too different things
>>
>>56683302
>too
>>
guys why is my code not working?
#include <visual.h>
#include <studio.h>

int main()
{
printf("5 minute load times!\n");

return 0;
}
>>
>>56683338
#include <visualstjewdio.h>
>>
File: 1332183036324.jpg (31KB, 300x400px) Image search: [Google]
1332183036324.jpg
31KB, 300x400px
>>56683338
Twice in one thread is just too much.
>>
>>56683338
You forgot to copyright your program
>>
>>56683362
why is she making that face?
>>
>>56683338
I stopped caring about C when I was introduced to the concept of studio.h.
>>
>>56683235
I'm a fan of
int
main
()
{
if
(image == anime)
{
puts
("Thank you for using an anime image!")
;
}
else
puts
("Please use an anime image next time!")
;
return
0
;
}
>>
>>56683374
She's embarrassed by Hakase's childish manners.
>>
>>56683395
pretty
>>
>>56683395
aesthetic
>>
>>56683405
no
>>
>>56683402
wrong.
Her (much) younger brother threw her out of his room.
>>
>>56683416
no
>>
File: Mai_Nichijou_295_6315.png (78KB, 295x238px) Image search: [Google]
Mai_Nichijou_295_6315.png
78KB, 295x238px
>>56683430
Why is she making this face?
>>
>>56683447
She saw your dick.
>>
>>56683447
That's the only face she ever makes
>>
>>56683462
>dick
Do you mean feminine penis?
>>
>>56683471
That's why she's my waifu :3
>>
Is reverse engineering other peoples work an accepted method of learn JavaScript and HTML5?
>>
>>56683501
>reverse engineering Javascript and HTML5
You say that like it's engineered in the first place
>>
>>56683536
I found a website that does something similar to what i want to do.
I thought i'd sort of deconstruct the code bit by bit to figure out how it's done.
>>
What's the best book to learn java?
>>
>>56683717
lostallhope.com

but seriously i think the java tutorial, covers a lot of java + libraries
>>
>>56681244
global vars is bad
>>
>>56683762
Upvoted
>>
>>56683762
why?
>>
>>56683762
Upvoted
>>
(lldb) p s
(int) $13 = 27
(lldb) p c
(int) $14 = 9
(lldb) p 27/9
(int) $15 = 3
(lldb) p s/c
(int) $16 = 1


Ok.
>>
>>56683795
they're coarse and rough and irritating, and they get everywhere. but not like you. you're everything encapsulated, and properly scoped
>>
>>56683795
because some guy at programmin 101 said so
>>
File: 1454956485842.png (293KB, 633x758px) Image search: [Google]
1454956485842.png
293KB, 633x758px
tfw bug in code was really obvious but you spent ages pulling your hair out over it
>>
I have a huge array of zeroes, but there are many sections of it that are !=0.
If I want to make the entire array 0, is it faster to memset the entire array or to memset each section individually?
>>
>>56683919
stupid robot i'm glad
>>
File: 1421628583230.jpg (61KB, 453x604px) Image search: [Google]
1421628583230.jpg
61KB, 453x604px
>>56683919
>>
>>56683875
>lldb
kek
>>
>>56683959
There's no easy answer. How big is this "huge array?" A memset has some overhead, and even though it makes use of CPU intrinsics to operate really fast, it's always going to be faster to *do less work*.

Memset is really fast but it's far from instant, especially for gigs and gigs of data. If >20% of your array is 1s and they're split all throughout the array then it's probably going to be faster to clear it in one big memset, but if the 1s are clustered, then you'll get more speed from only memsetting the relevant bits.

If you're really time-constrained you might want to consider calling calloc to get some fresh memory that's already been zeroed ahead of time by the OS.
>>
>>56683959
neither because memset will get optimized away anyway
>>
>>56683959
Why not just AND it with 0?
Guarantees its going to be zero.
>>
>>56684076
Because that's not really efficient.
>>
>>56684076
Are you retarded?
>>
>>56684090
Don't be rude!
>>
>>56684076
>pythonfags believe this
>>
>>56684027
just write a for loop bro
>>
>>56684128
>>56684076
>>56684068
>these are the people posting in /dpt/
>>
File: 1436944180446.png (297KB, 601x595px) Image search: [Google]
1436944180446.png
297KB, 601x595px
GUYS I NEED A PROJECT TO WORK ON
I DONT HAVE ANYTHING TO DO
GIVE ME IDEAS
>>
>>56684144
#include <string.h>
#include <stdio.h>

int main(void) {
int array[5];
memset(array, 0, 5);
for (int i = 0; i < 5; ++i) {
fprintf(stdout, "%d ", i);
}
return 0;
}


.LC0:
.string "%d "
main:
pushq %rbx
xorl %ebx, %ebx
.L2:
movq stdout(%rip), %rdi
movl %ebx, %edx
xorl %eax, %eax
movl $.LC0, %esi
addl $1, %ebx
call fprintf
cmpl $5, %ebx
jne .L2
xorl %eax, %eax
popq %rbx
ret
>>
>>56684172
Suicide, you stupid frogposter
>>
>>56684172
Code me a job
>>
>>56684144
idiot memset uses a loop that;s what it does

what you think its some sort of magic thatll make your code run 100 time faster
>>
>>56684185
OK, now randomly fill that array with clusters of 1s and make it 10 million ints long.
>>
File: 1433973540108.png (9KB, 338x339px) Image search: [Google]
1433973540108.png
9KB, 338x339px
>>56684194
>>
>>56684214
Back to r9k you go
>>
File: game.png (10KB, 678x186px) Image search: [Google]
game.png
10KB, 678x186px
A game.

But I have one question for /dpt/: How would I go about disabling the spacebar so that the player doesn't space-press the OK button?

Or even better, is there a way I can update the window on the left to show "Score: [user's score]"? It seems like once everything's painted I cannot update it.
>>
>>56684211
That burden's upon you if you want to prove me wrong until then I'm right.
>>
>>56681892
Caps for the first letter of variable name to make it public. Also json field name and struct field name can be different.
type LexicalEntry struct {
Word string `xml:"orthography"`
GrammaticalCategory string `xml:"grammaticalCategory"`
GrammaticalGender string `xml:"grammaticalGender"`
GrammaticalNumber string `xml:"grammaticalNumber"`
}
>>
How can you make a loading screen in C++?

I've managed to easily make one in JavaScript with putting event listeners on the files, but I don't know how I should approach this in C++. The language is pretty straight forward for me so far. It just stops every time I load something. Of course, if the file is little, it's not noticeable, but still, I'm wondering how it should be done.
>>
>>56684210
Okay, you're retarded -- I get it.

An optimized memcpy looks like this:
void X_aligned_memcpy_sse2(void* dest, const void* src, const unsigned long size)
{

__asm
{
mov esi, src; //src pointer
mov edi, dest; //dest pointer

mov ebx, size; //ebx is our counter
shr ebx, 7; //divide by 128 (8 * 128bit registers)


loop_copy:
prefetchnta 128[ESI]; //SSE2 prefetch
prefetchnta 160[ESI];
prefetchnta 192[ESI];
prefetchnta 224[ESI];

movdqa xmm0, 0[ESI]; //move data from src to registers
movdqa xmm1, 16[ESI];
movdqa xmm2, 32[ESI];
movdqa xmm3, 48[ESI];
movdqa xmm4, 64[ESI];
movdqa xmm5, 80[ESI];
movdqa xmm6, 96[ESI];
movdqa xmm7, 112[ESI];

movntdq 0[EDI], xmm0; //move data from registers to dest
movntdq 16[EDI], xmm1;
movntdq 32[EDI], xmm2;
movntdq 48[EDI], xmm3;
movntdq 64[EDI], xmm4;
movntdq 80[EDI], xmm5;
movntdq 96[EDI], xmm6;
movntdq 112[EDI], xmm7;

add esi, 128;
add edi, 128;
dec ebx;

jnz loop_copy; //loop please
loop_copy_end:
}
}


Fuck off, Pajeet.
>>
>>56684275
>An optimized memcpy looks like this:
who gives a shit, just use whatever works
>>
>>56684343
not him but you either fuck off or stop ruining the greatest general the web has known
>>
>>56684172
Graphical, animated tower of hanoi solver for some height n.
>>
>>56684172
Go through random projects on github and make some pull requests
>>
>>56684172
make an AI that you communicate with and if you reach a certain level of autism it ghosts you so you have to start over

call it female specimen
>>
File: 1433967526892.png (191KB, 1248x1284px) Image search: [Google]
1433967526892.png
191KB, 1248x1284px
>>56684232
>>
>>56684233
don't make it focus the button right away, idiot
>>
File: 1463262802772.jpg (26KB, 720x720px) Image search: [Google]
1463262802772.jpg
26KB, 720x720px
Hey guys so I wrote this for my noobie java course or whatever. What can I do better? What can I add? I just wanna learn as much as possible desu.

http://pastebin.com/G6RZqm7u
>>
Writing a new file system in OCaml. It's called smugfs.
>>
Redpill me on MVC
>>
>>56684680
please tell me it's not heirarchical
>>
If I were to buy a a pic microcontroller, timer ic^2 and some leds to make a small binary clock, would it interest some potential future employers?
>>
finishing up my loli waifu simulator
>>
>>56684743
link
>>
>>56684777
>showing you my waifus source code
dont be disgusting
>>
>>56684272
Threads.
>>
>>56684706
Of course not. It's going to be as smug as possible.
>>
>What are you working on, /g/?
Refactoring
>>
>>56684986
Why didn't you just write good code in the first place?
>>
File: 10WcJEO.png (88KB, 257x343px) Image search: [Google]
10WcJEO.png
88KB, 257x343px
>>56684654
use proper names for your variables.
you could validate your answers, as you do u can set the answers as well.
format your strings instead of putting them in the middle of fucking everything, don't use the ternary operator inside of them either.
since you know ternary operators, use them instead of using a thousand if statements and only use them for assignments.
don't be faggot anon
>>
>>56685001
Projects grow and architectures change
>>
>>56685060
whos the semon demon?
>>
>>56684654
How the fuck does any of this run? Is this some newfangled java 8 meme?
>>
>>56685092
seiga.nicovideo.jp/comic/21425
pretty nice comic
>>
>>56685232
cutethanks
>>
>>56685166
??
>>
>>56685166
>>56684654
>http://pastebin.com/G6RZqm7u
>public static void main(String[] args) {
Oh
Well you could start by actually indenting your shit, god knows who thought it would be clever to put everything in line with main.
>>
>>56684654
>two genders in 2016
>>
>>56685418
This.
You should use represent gender with an n-dimensional vector representing the users own unique interpretation of their feelings.
>>
Why is python so fucking slow?

It takes literally a week to generate a 2048 El-Gamal key using PyCrypto (or PyCryptodome).
>>
>>56685552
2048-bit*
>>
>>56685552
Because it is meant for small scripts, use something like C for cpu intensive programs
>>
File: 4Ul7VNQ.jpg (18KB, 600x450px) Image search: [Google]
4Ul7VNQ.jpg
18KB, 600x450px
>>56685552
>python
>>
>>56685552
>Why is python so fucking slow?
>It takes literally a week to generate a 2048 El-Gamal key using PyCrypto (or PyCryptodome).
perhaps you are just a fucking retard?
>>
https://github.com/majestrate/bdsmail/

and yes it does works
>>
>>56685668
How so? It's literally _one_ line of code:

k = ElGamal.generate(2048, os.urandom)
>>
>>56685696
bretty cool anon
>>
>>56685602
why not fortran?
>>
>>56681210
the cuck being cucked by the cucker
>>
>>56681206
Clang
>>
>>56685765
That's also viable, although not recommended.
>>
>>56685728
and that should call C. if it doesn't then it's pebcak.
>>
$ time python programthatgenerates2048bitelgamalkey.py
real 9m49.623s
user 9m36.250s
sys 0m13.257s
$


lol
>>
>>56685817
grep -i 'model name' /proc/cpuinfo | head -n1
>>
>>56685728
Does os.urandom read from /dev/urandom or /dev/random? If it's used for generating crypto graphic keys it should use /dev/random on linux which can block if there is insufficient entropy available.
>>
>>56681335
isn't cc just an alias for gcc and only there for unix compatibility reasons
>>
>>56685871
intel i5-3230 @ 2.60ghz

>>56685807
I'm pretty sure it does. At least, crashing the program shows that it is making calls to something called "_Numbers_gmp.py" which smells like GMP. Could be wrong though.

>>56685936
It uses urandom afaik.
>>
>>56686024
https://lwn.net/Articles/693189/

It might block in some versions.

>In the Python 3.5.0 release,os.urandom()was changed to use the relatively newgetrandom()system callon Linux. Unless it has been called with theGRND_NONBLOCKflag,getrandom()will wait, if need be, for the system entropy pool to be initialized.os.urandom()does not supply that flag, meaning that it can block if the entropy pool has not yet accumulated enough randomness

>For Python3.5, theos.urandom()change will also be partially reverted, in that the function will, once again, be non-blocking. It will callgetrandom()with theGRND_NONBLOCKflag and, if that call fails, fall back to reading/dev/urandomas before. With these fixes in place, the blocking part of the change is effectively reverted and the immediate problem has been solved.
>>
>>56686112
That pasted like shit, phone posting.
>>
File: 1427999173920.png (4KB, 558x565px) Image search: [Google]
1427999173920.png
4KB, 558x565px
Is it possible to have an "autocompleted" scanner or other console input in Java? Like, it prompts the user for an input but there's something already queued for input as a suggestion to the user that they may delete if they want
>>
>>56686298
Have you ever tried printing to stdin?
>>
>>56686298
Yes it's possible, don't know if it exists though.
>>
>>56686135
Thanks.

In the end, it might just be a combination of >python and bad luck.

I'm getting times which range between ~10 minutes and <2 minutes when generating a safe 2048-bit prime.
>>
>>56683042

Perhaps some of the DLLs you are trying to use it with are .NET CIL, rather than native code?
>>
>>56686323
I have not
and now I have
it doesn't appear to have a function for printing to it.
>>
>>56686298
>>56686331
Also that sounds inconvenient, just use readline style autocomplete where the user hits tab to complete.
>>
>>56686379
It's not actually for the user, it's for me. I just don't want to keep entering the same test parameters time and time again but I also don't want to fuse the input
>>
>>56686369
system.out.print() ????
>>
>>56686455
that's printing to out, not in. if you were listening for input and you printed that and then hit enter, the scanner would read nothing at all.
>>
>>56686332
have you thought that, perhaps, your program is waiting to get some entropy?

>>56685552
this is the kind of people that criticizes python.
>>
>>56686447
If you're fine with tab completion, a quick easy solution would be to run your program through rlwrap with a wordlist(-f) containing your input.

This is assuming you're not using the windows console.
>>
is there any good book for win api? I can't understand shit from microsoft's documentation website.
>>
>>56686637
What's wrong Pajeet? MSDN is one of the best resources out there.
>>
>>56686637
Windows via C/C++.
>>
>>56686655
>What's wrong Pajeet?
I can't understand shit from microsoft's documentation website.
what does pajeet even mean?
>>
>>56686672
He's calling you a low-skill unresourceful indian programmer
>>
print "This program converts the tempurature between celsius, kelvin, and\
fahrenheit scales,enter the temperature followed by the first letter of the\
scale, e.g. 32c for 32 celsius"

#user enters input
temperature = raw_input(">")

#sets the letter at the end of the string as the variable entered_scale
entered_scale = temperature [-1]

print entered_scale

if entered_scale == "c":
new_scale = temperature.replace("c", "") #rips the letter off
celsius = int(new_scale) ## and converts string to interger
fahrenheit = celsius * 1.8 + 32 #logic
print "Fahrenheit = ", fahrenheit #prints answer to user
kelvin = celsius + 273.15
print "Kelvin = ", kelvin

elif entered_scale == "f":
new_scale = temperature.replace("f", "")
fahrenheit = int(new_scale)
celsius = (fahrenheit - 32) / 1.8
print "Celsius = ", celsius
kelvin = (fahrenheit + 459.67) * 0.55555556
print "Kelvin = ", kelvin

elif entered_scale == "k":
new_scale = temperature.replace("k", "")
kelvin = int(new_scale)
fahrenheit = kelvin * 0.55555556 - 459.67
print "Fahrenheit = ", fahrenheit
celsius = kelvin - 273.15
print "Celsius= ", celsius
>>
>>56686799
so much repetition
>>
>>56686799
serious people don't use fahrenheit
>>
>>56686830
>>56686851

I had a zipf checker, forgot to save the finished version, now im stuck with the half finished one I forget how to fix

   #get name of file and open it
name = raw_input('Enter file:')
handle = open(name, 'r')
text = handle.read()
words = text.split()


def percent(part,whole):
return part/whole * 100


wordlist = words
wordfreq = []
for w in wordlist:
wordfreq.append(wordlist.count(w))


print "\n"
print "Frequencies\n" +str(wordfreq) +"\n"
print "\n"
print "Pairs\n" +str(zip(wordlist, wordfreq)) +"\n"

import collections
from collections import Counter
lis7 =words

x = collections.Counter(lis7)
print "\n"
print "Word Ocurrence"
print([elt for elt, count in x.most_common()])
print "\n"
print "Number Occurence"
print (x.most_common())
print"\n"

total = sum(wordfreq)
percentages = {}
for lis7, wordfreq in x.most_common():
percentages[lis7] = percent(w,total)
print percentages
print percent(wordfreq,total)


it crashes at the end, but still is slightly usable
>>
>>56686799
couldn't you just set new_scale to whatever is in entered_scale and avoid rewriting that in 3 separate instance
>>
what is the best book for c++?
for someone who already knows how to program.
>>
>>56687037
Bjarne's one.
>>
>>56687095
what about java?
>>
>>56682019
PLS????????????
>>
>>56687223
You're simply missing the implementation files.
>>
>>56687269
Thats not it, the problem is with these two files. I have a makefile that links everything. I am only supposed to change Inventory.cpp and its header.
>>
>>56687320
No you posted the rest of the files in another thread you only have the headers.
>>
new fred when?
>>
>>56687345
I have the cpp's, I just didn't post them. When I compile the program all of the headers and cpp files are in the same folder, and a makefile links them. So it's something with the only two files I'm supposed to edit, which are the ones I posted in this thread.
>>
>>56687379
Could you zip them all and upload somewhere? It's hard to guess.
>>
>>56687191
guys? nobody can recommend me some solid java book? preferably taking into account that i already know programming.
>>
>>56687419
>https://ufile.io/e8f01
>>
>>56687365
This is the last one
>>
>>56687471
Ok so it's definitely something wrong with the makefile. Not sure what yet, been a while since I used make.
>>
File: happy.jpg (19KB, 396x385px) Image search: [Google]
happy.jpg
19KB, 396x385px
sensei agreed to be my mentor for my senior honors project

give me some ideas
>>
>>56687557
averaging ints in c
>>
>>56687557
stupid fucking frogposter go away i hate your kind
it's not just a meme either
>>
File: Untitled.png (39KB, 994x845px) Image search: [Google]
Untitled.png
39KB, 994x845px
>>56687471
>>56687556
also <<
>>
File: mfw.png (660KB, 1106x1012px) Image search: [Google]
mfw.png
660KB, 1106x1012px
>>56687579
>>
>>56687637
why the fuck are you still here
everyone hates you
>>
>>56687556
I'm telling you, it can't be. The assignment is to only alter the inventory class and its functions.

>>56687593
Wait what, did you run the storage.exe, thats what it's supposed to look like. He gave us that for reference.
>>
>>56687637
just keep the toads to yourself
>>
PAGE 9 GUYS
EVERYONE PANIC[!!]
>>
>>56687678
No I compiled it with g++ instead of the makefile and ran the compiled program (not storage) - and it worked. So it's the makefile that's faulty.
>>
NEW THREAD

>>56687778
>>56687778
>>
>>56687722
Oh sorry, I see it at the top. I'm retarded. So my code works, wow. Though I don't know what I'm going to do because the assignments are graded by an auto-grader and it has to be able to compile with the make file.
>>
File: really.png (108KB, 400x381px) Image search: [Google]
really.png
108KB, 400x381px
>>56687686
>>56687665
Thread posts: 343
Thread images: 35


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