[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 29
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old Thread: >>54275011

What are you working on /g/?
>>
>>54278678
thanks for using the correct image
>>
>>54278678
DELETE THIS
>>
>>54278678
shame

>>54278614
i just commented out a several lines for bugtesting and it almost crashed when i tested it out. found a bug tho so that's good

>>54278689
faggot
>>
File: lispfags on suicide watch.png (13 KB, 530x291) Image search: [Google]
lispfags on suicide watch.png
13 KB, 530x291
Best programming languages?

top tier:
>Excel Formulas
>MSWLogo
>C preprocessor
>.txt

good tier
>C derivatives (C++, Go, D, ...)
>ML derivatives (Ocaml, F#, ...)
>Powershell

ok tier
>meme languages (Nim, Idris)
>English language

diaper tier
>visual basic
>C#
>x86, x64 assembly
>bash

web tier
>HTML
>CSS

python tier
>python
>javascript
>python
>java
>python
>>
File: akari2.jpg (58 KB, 514x524) Image search: [Google]
akari2.jpg
58 KB, 514x524
Rate my RPN calculator!

https://github.com/microsounds/hpsh
>>
Is this how I code?

#!/bin/bash
#convert every flac file in a directory
#currently can only be used with FLAC files split by track

#initial info to use in counter
total=`find . -name *.flac | wc -l`
c=1

#edit this if you are using a different directory for your library
lib=~/Music

#calculate the remaining files
counter(){
rem=$(($total-$c))
echo "Encoding $c out of $total, $rem remaining"
let c++
}

#collect metadata from flac file to use in creating directories etc etc
#I got this bit from the internet
tagger(){
for tag in TITLE ARTIST ALBUM DATE COMMENT TRACKNUMBER TRACKTOTAL GENRE; do
eval "$tag=\"`metaflac --show-tag=$tag "$FLAC" | sed 's/.*=//'`\""
done
}

#currently sorting in two layers of Artist/Album, edit if you want it differently
dirmake(){
tagger
l1="$lib"/"$ARTIST"
l2="$l1"/"$ALBUM"
if ! [[ -d "$l1" ]]; then
mkdir "$l1"
fi
if ! [[ -d "$l2" ]]; then
mkdir "$l2"
fi
}

#edit this if you choose to encode in a different manner than given
encode(){
dirmake
oggenc -q 6 -o "$l2"/"$TRACKNUMBER - $TITLE".ogg "$FLAC"
}

#perform all of the steps for every FLAC found
find . -name *flac | while read FLAC; do
counter
encode
done
>>
>>54278699
delete yourself fag
>>
That's not a trap. Please use the correct image next time.
>>
Why do people even use meme-langyages? They look looiek shit and no ones gonna hire u for cofing in them, i just dint really understnd it and jesus christ zolpidem hitting hard sorry
>>
Rate my disgusting bencoder library
>>
>>54278708
i don't know what that is but 10/10 for being cute
>>
>>54278711
what do you do if you don't have artist or song title?

also, what about removing album cover?(personally i would remove it as some songs have and some don't, uniformly it would be easier to just remove them all and i don't care about cover art anyways)
>>
>>54278719
SHUT THE HELL UP FUCKING KILL YOURSELF LITERAL FAG YOU SHOULD FUCKING GET BANNED FOR THIS OFF TOPIC PURE CANCER BAIT
>>
>>54278717
undelete yourself fag
>>
>>54278720
people are stupid as hell
>>
>>54278770
>WAAH WHY DID THE MODS REJECT MY BAN REQUEST LIFES NOT FAIR!!!

end your life
>>
>>54278720
>implying that everyone wants to get a job as a coder
>>
File: browser #113.png (875 KB, 840x924) Image search: [Google]
browser #113.png
875 KB, 840x924
rate my bate
>>
So how the hell is it that I've found Wikipedia more helpful than my textbook at explaining many of the concepts that are going to be on my midterm tomorrow?

>>54278719

Trap thread was deleted. Janitor obviously doesn't like traps.
>>
>>54278703
>>Excel Formulas
>>MSWLogo

Exceptional taste, brother.
>>
File: 534534534.jpg (38 KB, 503x327) Image search: [Google]
534534534.jpg
38 KB, 503x327
>>54278770
Is this you by any chance? How do you have internet access?
>>
>>54278806
why where you making this again?
>>
>>54278793
end your life

oh wait you can't because you don't have one

you're pathetic
>>
>>54278808
Fire him.
>>
Why is this general always infested with stupid arrogant tripposters?
>>
>>54278817
I originally made it almost 6 years ago, before there was a catalog. even now, it still has useful features that the catalog doesn't.
>>
Posted this in the last thread as well I just need a little help because nobody got back to me. I just need to know if I wrote my default constructor right when consider the .h file provided by the teacher.

lab7.h
#include <string>

class Question
{
private:
string triviaQuestion;
string answerOne;
string answerTwo;
string answerThree;
string answerFour;
int correctAnswer;

public:
Question();
Question(string question, string one, string two, string three,
string four, int answer);

void setTriviaQuestion(string question);
void setAnswerOne(string one);
void setAnswerTwo(string two);
void setAnswerThree(string three);
void setAnswerFour(string four);
void setCorrectAnswer(int answer);

string getTriviaQuestion();
string getAnswerOne();
string getAnswerTwo();
string getAnswerThree();
string getAnswerFour();
int getCorrectAnswer();

bool checkGivenAnswer(int chosenNumber);

};


#endif


Question.cpp
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include "Lab7.h"

using namespace std;

Question::Question()
{
triviaQuestion;
answerOne;
answerTwo;
answerThree;
answerFour;
correctAnswer;
}

Question::Question(string question, string one, string two, string three,
string four, int answer)
{
triviaQuestion = question;
answerOne = one;
answerTwo = two;
answerThree = three;
answerFour = four;
correctAnswer = answer;
}

void Question::setTriviaQuestion(string question)
{
triviaQuestion = question;
}
ect...
>>
>>54278815
kill yourself it's not reasonable to repeatedly spam the same forced shit no matter what it is like dsfargeg or lenny face or maki etc even after getting deleted and banned numerous times

kill yourself FAG
>>
>>54278801
then why are you even using it? what kind of job do you want? waht you goals?

it's like learning about bible stories, rly fucking useless and a waste of time. but at least bible stories have a moral to them other than just wanking away your time
>>
>>54278840
like?
>>
File: rtest.webm (2 MB, 912x780) Image search: [Google]
rtest.webm
2 MB, 912x780
Finished writing this

Moving on to a machine learning tutorial in python
>>
File: makefilee.jpg (162 KB, 1442x514) Image search: [Google]
makefilee.jpg
162 KB, 1442x514
I'm supposed to test my c code using this makefile blackbox test

How do I get this to work in cygwin?

I have no idea of what im looking at, my teacher isnt responding to mail....

my program is properly named(swc), its in the right directory, the test text file is there too

how do I do this test?
>>
>>54278845
google it faggot
>>
Hello am I triggering you friends
>>
File: thisisyou.jpg (38 KB, 248x251) Image search: [Google]
thisisyou.jpg
38 KB, 248x251
>>54278847
>>
yes

fucking use new
>>
>>54278849
i don't want a job in programming, i'm doing this for fun and to solve problems i have.

>taking any moral teachings from a book that promotes racism, slavery, misogyny, hatred
i'd much rather wank my dick off then learn about your shitty god
>>
>>54278708
Don't name types type_t, *_t is reserved by the C standard.
>>
>>54278837
/dpt/ has all kinds of fucking retarded shitters

yesterday there was a mac fag that thought osx font rendering doesn't look like shit and that windows font rendering looks bad

and there was also someone that said that instead of OOP he has a fucking database in his shitty ass program to do all the "state wrangling"

and like now there's a shitter that says you should use auto line wrapping when programming

oy vey
>>
>>54278911
>*_t is reserved by the C standard
No, it's reserved by the POSIX standard.
>>
>>54278859
you made a twitch client?
>>
>>54278729
0/10 code

10/10 font
>>
File: Untitled.png (1 MB, 1680x1050) Image search: [Google]
Untitled.png
1 MB, 1680x1050
>>54278851
well, for starters, it can sort threads by activity. it also allows for searching all posts (not just OP).
>>
>>54278757
I've never had oggenc or any of the encoders I use actually preserve the album art. My player fetches covers anyway so no big deal.
As for the problem if tags don't exist, I imagine I'd either have to add a test whether the tag even exists, then ask the user to add it or use an API from MusicBrainz or whatever a music player's automatic tagging function uses. In otder to do that I'd probably have to actually learn how to program.
>>
>>54278876
ah, it's you again
>>
>>54278910
>for fun
meme-languages aren't fun
>and to solve problems i have
practical problems or just mental problems? cuz if u have practical problems, there is most likely a much better language for it.
>>
I need to download around 2 GB worth of data each day and then run some functions on them to calculate some stuff that I want to save. Is there a better to do this? I've had a script just download the data from the website as a csv and then deleting it afterwards after I get the stuff I want. Problem is that I sometimes might need to rerun calculations on that data with different parameters but if I start saving the huge ass files I'll run out of space
>>
>>54278863
>>54278863
pls help friends :(

they say we need to test it with this file
>>
>>54278801
>>54278910
they're not even fun or useful you just don't know any better fucking shitter
>>
>>54278867
I have googled it and I have an okay understanding of it but like I just want somebody to double check my work? just to make sure i'm using it correctly?
>>
>>54278938
>by activity
like reply count?
>it also allows for searching all posts
doesn't seem that useful
do you even use either of these?

>>54278947
think windows has a metadata fetching api
>>
If anyone needs a discord server to use, I am currently attempting to make an unofficial 4chan discord server, and am planning to create channels for /dpt/ and /fglt/ and other daily threads like that.

https://discord.gg/0x2Pi1PlLjtO03qK
>>
>>54279003
fuck off
>>
>Tfw I fell for the Java meme
>>
What was the name of that music streaming service some guy on /g/ made?

I saw a guy on my twitter timeline steal it entirely

https://alizarin.ca/web/new-releases
>>
>>54278960
>>54278972
here (You) you're obviously desperate for it, it's sad really.
>>
>>54279045
There is no Java meme. Literally nobody is going around falling for Java.
>>
>>54279053
ok stay delusional idiot i'm sure you have great fun debugging your silent run time errors
>>
>>54279003
fuck off
>>
File: Untitled.png (2 MB, 1680x1050) Image search: [Google]
Untitled.png
2 MB, 1680x1050
>>54278994
>like reply count?
no, reply rate.

I use those two features often.

but the main appeal is being able to quickly look over ALL threads on a board at once. I just move my mouse around and to see everything.
>>
>>54278968
Do you use everything in the files you download? Maybe extract what you need and store that?
>>
>>54279074
couldn't you just achieve this with an userscript?
>>
>>54278845
http://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm
Looks correct to me
>>
>>54279127
>userscript
no idea. I've never tried.
>>
File: LOUD_NOISES.jpg (391 KB, 952x848) Image search: [Google]
LOUD_NOISES.jpg
391 KB, 952x848
>>54278876
I'm pretending you're using C++.

Oh wait malloc is useless in C++.

fuck you
>>
>>54279064
yeah there is I was told this was an easy beginner language to learn I was lied to
>>
>>54279160
vb is super easy to learn
>>
>>54279141
It's basically javascript's retarded sister

don't use it
>>
>>54279003
Anon, there's already a Discord server for /dpt/, and I'm the only one online in it. There's like... 2 other people that actually show up, and we never talk.

We've had attempts at getting IRC chats for /dpt/, and nobody joins. Discord is no different.
>>
>>54279160
it's easy as fuck if you aren't retarded

https://docs.oracle.com/javase/tutorial/
>>
>>54279160
The guy who told you that must've been trolling you
>>
>>54279181
>this C sperg thinks java is hard
you're dumber than most pajeets
>>
File: Wizard.jpg (124 KB, 800x600) Image search: [Google]
Wizard.jpg
124 KB, 800x600
>>54278678
(define (square x) (* x x))

(square 21)

(square (+ 2 5))

(square (square 3))

(define (sum-of-squares x y)
(+ (square x) (square y)))

(sum-of-squares 3 4)

(define (f a)
(sum-of-squares (+ a 1) (* a 2)))

(f 5)
>>
>>54279170
>>54279180
>>54279181
>>54279195
Most people drop and fail Java 101 it is not easy as a first programming language if you never done programming before
>>
>>54279240
because murricans are stupid, lazy and disinterested, and your schools are shitty
>>
>>54279274
>murricans are stupid

Right...

>disinterested

Doesn't mean what you think it does.
>>
>>54279274
PAJEET UNIVERSITY STRONK
>>
>>54279287
>Right...
it's true, a lot of states have sub 100 average IQs, and your schools are shit too, you're in 36th place in math after slovakia

https://en.wikipedia.org/wiki/Programme_for_International_Student_Assessment#Table

>Doesn't mean what you think it does.
2.
having or feeling no interest in something; uninterested.
"her father was so disinterested in her progress that he only visited the school once"
synonyms: uninterested, indifferent, incurious, unconcerned, unmoved, unresponsive, impassive, passive, detached, unfeeling, uncaring, unenthusiastic, lukewarm, bored, apathetic, blasé, nonchalant; informalcouldn't-care-less
"he looked at her with disinterested eyes"
>>
Why don't schools teach python first?
>>
>>54279327
shitter schools do teach python first
>>
>>54279318
>2.
>having or feeling no interest in something; uninterested.

Only a real moron would actually consider this a valid definition. Disinterest is foremost about objectivity. Having no interest in something means you're uninterested.
>>
>>54279361
k tard

http://www.merriam-webster.com/dictionary/disinterested
http://www.oxforddictionaries.com/definition/english/disinterested
http://www.dictionary.com/browse/disinterested
>>
Usage note

Disinterested and uninterested share a confused and confusing history. Disinterested was originally used to mean “not interested, indifferent”; uninterested in its earliest use meant “impartial.” By various developmental twists, disinterested is now used in both senses. Uninterested is used mainly in the sense “not interested, indifferent.” It is occasionally used to mean “not having a personal or property interest.”
Many object to the use of disinterested to mean “not interested, indifferent.” They insist that disinterested can mean only “impartial”: A disinterested observer is the best judge of behavior.However, both senses are well established in all varieties of English, and the sense intended is almost always clear from the context.
>>
File: oxford.png (26 KB, 650x261) Image search: [Google]
oxford.png
26 KB, 650x261
>>54279378
>OED

Like I said, utter trash.
>>
>>54279390
>Many object
damn should have slipped in a "Many spergs object" kek
>>
>>54279274
>>54279287
>>54279318
>>54279378
>>54279390
Not true I have talked to many different students from all different countries China, Russia, Canada, America, India, and the same thing happened in a lot of their universities where most of the students fail Java 101 if it is their first time programming.
>>
>>54279378
>k tard
>>54279420
>spergs

I should have known it was you. You've never said anything useful.
>>
>>54278911
literally everyone does this tho
>>
>>54279424
you can still learn java on your own if you want to, it's not some unattainable feat that only 180 IQ geniuses can do ffs
>>
>>54279429
>You've never said anything useful.
enjoying that glass house are we lmfao
>>
>>54279438
The point I am trying to make and which many universities around the globe make is Java is a difficult programming language to learn for a beginner since most people fail it and it should not be a beginner language taught at schools.
>>
>>54279459
shitter langs like python aren't actually easier or better suited for actually learning programming, they just set the bar lower, like in an entire python course all you learn is basic control flow, you can literally learn it in the first day of java
>>
>Rust devs naming things after what they think they will be used for rather than what they really "are"
I can tolerate calling "Maybe" "Option", but calling "Either" "Result" (with constructors "Ok" and "Err" is just retarded.
>>
>>54279456

There are no glass dwellings here, friend.
>>
>>54279484
what did you expect from web shitters, they can't even make a decent browser
>>
>>54279476
Then why is the official introduction at MIT one of the best computer science schools have Python as it's intro to programming course? Checkmate
>>
>>54279518
>MIT one of the best computer science schools
they're overrated as fuck and they used to have SICP with lisp but they had to dumb it down for that easy tuition $$$
>>
>>54279518
>>54279545
basically you go to a top school for the name and the networking, not really to actually learn things
>>
>>54279545
>>54279560
I want to learnnnnn networking is gay and I hate people
>>
>>54279573
teach yourself programming, it's what cs students have to do anyway if they want to actually learn programming and have a real chance of getting a programming job
>>
File: 020.png (1 KB, 128x128) Image search: [Google]
020.png
1 KB, 128x128
>>54278729
Is that tewifont?
>>
>>54279588

for(in i = 0; i < 600000;i++)
{
if(i % 2 == 0)
System.out.println(i + " is even");
else
System.out.println(i + " is odd");

}

>>
>>54279615
you missed out a zero you antisemite
>>
>>54279207
Code tags are your friend.
>>
one of you guys should live stream how to program
>>
>>54279670
six googolplex jews
>>
>>54279766
read a book; text is a better medium.

video tutorials are absolute junk.
>>
>>54279887
this

and write some simple programs yourself and then start doing a medium sized project
>>
>>54279545

So... I go to a public university, and one of the students in my class noted that we were using all of the same textbooks as MIT, and asked why that is. I think he was trying to make some point that we're an easier school and should have easier books. The professor disagreed. He said he'd rather we try and offer anything MIT can offer... even if we do have a bit less funding, and less staff. It is hence why we score in the 90th percentile on CS Major Field Exams.

Point is, the only thing MIT can offer you is more resources. Anyone can give you an equivalent education.
>>
>>54279922
which projects?
>>
>>54279993
something you're interested in
>>
>>54279691
That's verbatim from the SICP, I just started reading it
>>
>>54280002
I tried a video game but it's too hard
>>
Making a blinn phong shader for a point light
>>
>>54280020
it's you again

do or do not, there is no try

just take the part you're struggling with and find out how to do it, and then later on figure out how to do it better
>>
>>54280020
Tic tac toe, hangman, and snake are pretty simple
>>
>>54280040
yeah start with those they shouldn't be too overwhelming
>>
>>54280040
I like the snake idea. How do you get the object to move on the screen
>>
>>54280004
>not understanding code tags
>>
>>54280100
1. Print a frame
2. Clear the screen
3. Print a frame
>>
>>54280100
It all depends on what you are using to draw stuff to the screen, but in general:
- draw something to the screen
- wait for a couple milliseconds
- clear the object from the screen
- update its coordinates
- repeat
>>
File: Untitled.png (67 KB, 1366x679) Image search: [Google]
Untitled.png
67 KB, 1366x679
On this expression calculator.
>>
This thread is awfully quiet.
>>
Is it dumb to have a derived class and you set the virtual function in there to { }?

I'm using virtuals as function pointers as I'm already using polymorphism for casting, thinking I should just use a function pointer if I have that many instances of a virtual just being an empty function.
>>
SICP is kicking my ass.

>Exercise 1.11. A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure thatcomputes f by means of an iterative process.

The recursive was easy:
(define (f n)
(if (< n 3)
n
(+ (f (- n 1)) (* 2 (f (- n 2))) (* 3 (f (- n 3))))))


But I cannot for the life of me figure out how to do it iteratively. The asterisks is where I realised I'd have to do
(+ (f (- n 1)) (* 2 (f (- n 2))) (* 3 (f (- n 3))))
again
(define (f-iter n)
(func n 0 0))

(define (func max-count count sum)
(cond ((> counter max-count) sum)
((< counter 3) (func max-count (+ count 1) (+ sum counter)))
(else (func max-count (+ count 1) (+ sum *****)))))


Anyone care to hold my hand?
>>
>>54280637
>Is it dumb to have a derived class
yes
>>
>>54280662

good one m8, you sure showed him.
>>
>>54280650
>f(n - 1)
>f(n - 2)
>f(n - 3)
do what you'd do with iterative fibonacci
(define (fib n)
(define (fib-iter curr prev step)
(if (= step n)
curr
(fib-iter (+ curr prev) curr (+ step 1))))
(fib-iter 1 0 0))
; my lisp is a bit rusty this is probably wrong but you get the point

where curr, prev are f(n) and f(n - 1)
>>
>>54278708
gr8 code m8 i r8 it
                                                                                                              0
>>
>>54278720
>zolpidem

My nigga.
>>
File: neeto.jpg (545 KB, 1000x793) Image search: [Google]
neeto.jpg
545 KB, 1000x793
Not sure if this is the right thread for it but. I've been a neet for over 2 years now and I finally figured out what would be best for me, programming. I found that Harvard CS50 course on Edx and took a big interest in it and as I was trying to start it I got struck by a message stating that I need to get an idbook first before I can take it. I don't have one and need to out and get it and well thanks to my country's government being ruled by thieves, you can't exactly get an idbook over the web like I've heard you can, I have to stand in a long ass line of old,fat,ugly,smelly black people at this government building to get it. I have social anxiety which has been making me delay this for months now. I nearly managed to do it this month but I had a panic attack on the car ride there. I live in South Africa btw so you can imagine why I'm scared of the outside world. I feel like I might pull through today but I'm not sure about this course. I feel like I could learn programming on other places, ones that don't require a feckin IDbook. What do you think /dpt/? should I do the course or are there better sites? would I be able to put self taught programming on my resume and people would actually hire? or would the verified certificate from Harvard get me hired way better?
>>
>like I've heard you can in other countries*
>>
>>54279074
what is the reply rate?

also, why don't you simply contribute code to 4chan X which is far less uglier than your app
>>
New to LISP, what's the difference between Common LISP and Scheme?

I've looked at code for both, and I'm going through the SICP, they look the same
>>
>>54281044
Scheme is overall much cleaner language. Common Lisp is overall much more useful.
>>
>>54281044
scheme is to common lisp as C is to C++

not historically, but in terms of features, as well as 'features'
>>
>>54281068
Scheme is pretty

>>54281090
Wouldn't that be the other way around if anon's right in this post
>>54281068
I was under the impression C++ was more complicated than C
>>
>>54281114
C++ is more complicated than C
common lisp is more complicated than scheme

C++ has more features than C
common lisp has more features than scheme

I don't know what you're getting at, it was a pretty basic comparison
>>
Reminder that you cannot call yourself a true software alchemist unless you know this by heart
http://ref.x86asm.net/coder64.html
>>
>>54281158
Read it incorrectly, my fault
>>
>>54280992
Self taught programmers are fine. You don't stick "self taught programmer" on there, you sign up for a bunch of different projects, complete them and stick those on your resume instead.
Edx won't get you anything decent. If you're white (since you're in south africa) you could try and emigrate to the UK or the EU claiming that you fear for your life over racial tensions in the country. Then you can get student finance and attend a proper university.
>>
>>54278678
I am trying to change strings to Proper Case (also called Title Case) and pattern case using pointers, but I am getting nowhere and Google isn't helpful because everyone else uses strings to do this.

#include <iostream>
#include <algorithm>
#include <array>
#include <iterator>
using namespace std;
int getLength(char *);
void toUpper(char *);
void toLower(char *);
void toProper(char *);
void toPattern(char *);

int main()
{
char name[80];

cout << "Enter a name :";
cin >> name;

int r= getLength(name);

cout << "The length of string is :" << r;
toUpper(name);
cout << "\nThe string in Capital Letters is: " << name;
// Arbitrary element processing on the container.
toLower(name);
cout << "\nThe string in Lower Case Letters is: " << name;
toProper(name);
cout << "\nThe string in Proper Case Letters is: " << name;
toPattern(name);
cout << "\nThe string in Pattern Case Letters is: " << name;
}

void toUpper(char *p)
{

while (*p)
{

*p = (*p>='a' && *p<='z') ? *p=*p-32 : *p;
p++;

}


}
int getLength(char *p)
{

int ctr=0;
while (*p)
{
//cout << *p << " " ;
ctr++;
p++;

}
return ctr;
}

void toLower(char *p)
{
// write code to convert to small cases

while (*p)
{

*p = (*p>='A' && *p<='Z') ? *p=*p+32 : *p;
p++;

}
}

void toProper(char *p)
{

}

void toPattern(char *p)
{

}
>>
>>54281274
I gave you the solutions to that yesterday.
>>
>>54281274
you should definitely use regular expressions
>>
File: john-mccarthy-poster1.jpg (34 KB, 393x400) Image search: [Google]
john-mccarthy-poster1.jpg
34 KB, 393x400
>>54281184
>http://ref.x86asm.net/coder64.html
You don't even know that by heart you shitter
>>
>>54281335
Please, I wouldn't consider myself a software alchemist if I didn't
>>
>More than 10000000 total errors detected. I'm not reporting any more.
>Final error counts will be inaccurate. Go fix your program!
o-okay
>>
>>54281355
hwut?
>>
>>54281311
Your code wouldn't even compile it was so bad.

>>54281316

How do you do regex on pointers? And why would I use regex? No matching is required.
>>
>>54281349
I don't think you do
And Magic belongs to LISP you mundane filth
>>
>>54281264
I see thanks. I'm taking a look at codeacademy right now. I can emigrate to Europe easily. I have half italian blood and a Italian passport.
>>
>>54281396
>Your code wouldn't even compile
Probably because you're a fuckwit who didn't include his headers.
>it was so bad
>A complete novice programmer trying to call somebody else bad
>>
>>54281393
output of valgrind on my implementation of minimax in C. it only leaks a couple MB though so i dunno if ill fix them
>>
>>54281409
>codeacademy

let me save you a few hours there bud. Literally anything will be better than codecademy. Look up a haskell tutorial or someting
>>
>>54281425
>it only leaks a couple MB
If it leaks even a single byte, your program is fucking shit.
>>
>>54281448
okay anon
>>
>>54281425
>a couple MB

jesus christ. Still not as bad as most java apps though.
>>
>>54281409
Do it anon, you're only another land reform away from death.
Also yeah >>54281446 is right. Code academy is terrible, pick up some books.
>>
>>54281462
It basically shows everyone that you're an incompetent programmer and that they shouldn't use your program.
>>
>>54281274
All you need is a variable to keep track of whether you're in a word or not. If you're not in a word and suddenly you encounter a letter, then...?

Also, don't use magic numbers.

char make_upper(char c)
{
if ('a' <= c && c <= 'z') {
return c + ('A' - 'a');
// What is c + 32?
}

return c;
}
>>
>>54281479
but it can play cards against human opponents and win. isn't that cool?
>>
I'm interning at Facebook this summer :D
>>
>>54281490
Or, you know:
toupper(c)
>>
>>54281448
What's leaking mean?
>>
>>54281415
He didn't post any headers with his snippets, so how the hell was I supposed to know to include them? I already have 4 headers included, and it was just pointer manipulation so I really doubt that was the problem.
>>
>>54281527
i allocate some memory, but never free it after i'm done using it. so essentially my program is taking up more memory than it needs to. if my program ran long enough, it would run out of memory and crash.
>>
>>54278678
I just passed in my project for Computer Networking class. It passed!

>>54278708
Akari is sooo cute. T_T
>>
>>54281501
what's your github
>>
>>54281527
When you allocate some memory (with malloc or similar) and don't unallocate it.
It usually happens when the program fails to keep track of his pointers properly, and can waste a lot of memory on long-runnning programs.
>>
>>54281534
So why not just clear the memory?
>>
File: CreatingSomeBoards2.png (8 KB, 1167x394) Image search: [Google]
CreatingSomeBoards2.png
8 KB, 1167x394
>>54278678
Still trying to get this project done for my Web Dev class...
>>
>>54281490
char toUpper(char c) {
return c>='a'&&c<='z'?'A'-'a'+c:c;
}
>>
>>54281490
I don't need toUpper(). I already made it.
>>
>>54281551
That's what freeing it is for
>>
>>54281547
nice I just passed my OOP class and UNIX class today
>>
>>54281551
because i dont know where i'm forgetting to free it ;_;
>>
i'm so fucking happy! i came here for you fucks to bring me down!
i just wrote my first working Java code ever!
self teaching, never made hello world shit
package numbercruncher;

import java.util.Scanner;

public class numbercruncher {

public static void main(String[] args) {
System.out.println ("please enter then name you most commonly answer to");
Scanner scancn = new Scanner(System.in);
String cn = scancn.next();
System.out.println("Thank you, " + cn + ", now what is your first name?");
Scanner scanfn = new Scanner(System.in);
String fn = scanfn.next();
System.out.println("Please enter all middle names.");
Scanner scanMidNames = new Scanner (System.in);
Scanner scanmn = new Scanner(System.in);
String mn = scanmn.next();
System.out.println(fn + ", thank you, now what is your last name?");
Scanner scanln = new Scanner(System.in);
String ln = scanln.next();
System.out.println("In what year were you born? (4 digits)");
Scanner scanyear = new Scanner(System.in);
int by = scanln.nextInt();
System.out.println("In what month of " + by + " were you born? (2 digits)");
Scanner scanmonth = new Scanner(System.in);
int bm = scanln.nextInt();
System.out.println("On which day of the month were you born? (2 digits)");
Scanner scanday = new Scanner(System.in);
int bd = scanln.nextInt();
System.out.println("Got it! " + fn + " " + mn + " " + ln + " goes by " + cn + " and was born on " + bm + "/" + bd + "/" + by + ". If this is correct, SUBMIT to get your numbers!");
>>
>>54281588
What's it do?

I've got VERY basic experience with C but... fuck it let's figure this shit out
>>
>>54281580
Nice m8. I wish they were offering Unix/Linux Sysadmin at my uni again next semester.
>>
>>54281597
Jesus Christ dude at least pick up a book first, you only need one scanner
>>
>>54281470
You recommend any books?
>>
>>54281603
it plays cards

https://github.com/howey/uad
>>
>>54278678
>>54281318
>>
File: giphy (2).gif (958 KB, 500x200) Image search: [Google]
giphy (2).gif
958 KB, 500x200
>>54281597
looks good, anon
now learn how to trim it down a bit
but it does work, so congrats! and welcome to the wizards club!
>>
>>54281501
how did you get internship?
>>
>>54281597
> creating a new scanner for every input
>>
>>54281548
I dont use Github

>>54281648
I sent my resume to a recruiter, interviewed and got an offer
>>
>>54281661
>>54281640
>>54281612
thanks for the input!
i'll trim out extra scanners.
>>
>>54281618
Dude you're using malloc left and right, of course you're going to leak everywhere
>>
>>54281697
Malloc is fine if you're not an asshat but clearly OP doesn't understand how to not have access to garbage collection
>>
how can i inherit a getter function? the following member getter from container.h is not returning the correct value for solarsystem

#ifndef CONTAINER_H
#define CONTAINER_H

#include "body.h"

#include <string>
#include <vector>
#include <list>


using namespace std;

class Container
{
public:
Container() {}


~Container();

vector<Body*> containsObjects() { return m_objects ; }

virtual string getName() { return m_name; }
protected:
string m_name;
vector<Body*> m_objects;
};

#endif // CONTAINER_H


#ifndef SOLARSYSTEM_H
#define SOLARSYSTEM_H

#include "container.h"

//Primitive Class

using namespace std;

class solarSystem : public Container
{
public:
solarSystem() {}

solarSystem(string name,
vector<Body*> objects) :
m_name(name),
m_objects(objects) { }

~solarSystem() {}

private:
const string m_name;
vector<Body*> m_objects;
};

#endif // SOLARSYSTEM_H
>>
>>54281697
what can I say, C was a bad choice. I should at least use C++, I had to make my own constructor for kriminy jim jims sake
>>
>>54281597
You forgot to implement a factorybean
>>
Hi, DPT
kinda at a loss here. I just need a point in the right direction, I can't find any useful information.
I'm trying to develop an input emulator(for converting probably XInput into MIDI) and I just need to know where to start on something like that. The language doesn't really matter I just need to know where I can get more info on doing something like this.
I also already know about glovepie and freepie but they have some problems that make what I'm trying to do very difficult. Any pointers?
>>
>>54281721
I think the main leaks are coming from the memory allocated in the utilityvector function. Pay close attention what happens to those. Also your minmax function returns either heap allocated memory or stack allocated memory it seems, and this is a huge no-no.
>>
>>54281800
>I think the main leaks are coming from the memory allocated in the utilityvector function.
i try and free that stuff when i'm done with it. the main problem is that i need to return a vector. maybe i'll change it up so that utilityvector takes a pointer to an array and then ill allocate the array on the stack in the caller of utilityvector

>Also your minmax function returns either heap allocated memory or stack allocated memory it seems, and this is a huge no-no.
minimax returns heap memory in the terminal case, and on every other case it's returning a pointer to the array allocated by minimax.

i think doing this the recursive way was my downfall. thanks for your eyes
>>
>>54281729
>factorybean
Is it as cute as it sounds?
>>
>>54281924
It iss you'd love it
>>
>>54281758
Step 1. Get Xinput
Step 2. Get whatever windows uses for midi (portaudio maybe?)
Step 3. Mash them together like a kid playing with toys
>>
>>54279484
Option doesn't bug me at all, I think it is as easy to understand as Maybe.

"Result" instead of "Either" bugged me initially, but doesn't bug me so much anymore. The benefit of Result with constructors Ok and Err over Either with A and B or Left and Right is that the entire library ecosystem can rely on the Ok value being the "primary" one. If you aren't doing something with a primary / secondary value or ok / err value, then you can define your own enum type trivially, and not get all the result-specific impls which won't be useful for a non- result Either.

This is important because they've since privileged Result via the ? operator (successor to try macro). If they just made an alias for Either, people could abuse ? (or try) pretty badly, and if they made Result a newtype for Either, it'd be ergonomically more awkward (you wouldn't be able to succinctly write a Result literal).

I'm not saying it was for sure the correct decision, but I don't think it was clearly wrong either, especially since Rust is courting C++ devs more than Haskell devs.
>>
>>54280712
Thanks.
>>
Lets seriously program a small application together come on guys we can do it! I will make the github and post starter code for it once we all agree on an idea and language
>>
>>54281552
Holy shit, I was about to go crazy. I had 0 errors, but my threads were not uploading...

I forgot to commit the changes.
Fixed, heh...

I don't even know what I was thinking. I was terrified, though...
>>
>>54281552
>>54282258
I can help you with your web dev hwk I have done a lot of web dev before
>>
>>54282226
Ok I'll go and make a logo for the project
>>
>>54282226
make a strawpoll
>>
>>54281620
Learn OpenGL for graphics then just slap logic in there. It's a pain at first, but once you can leverage shaders shit is extremely fun.
>>
>>54282285
>>54282308
Lets have ideas guys

Here are my ideas

A productivity application of some sort

A Captcha picture solver

An anime web browser

An anime scraper downloader which downloads all anime pictures in a thread
>>
>>54282226
Don't try to make it democratic, that never works. Make a list of 10 numbered ideas and the end digit of the post decides which one we implement.

Same for languages.
>>
File: 1407241549728.png (445 KB, 807x700) Image search: [Google]
1407241549728.png
445 KB, 807x700
>>54282226
/dpt/ is unsuited to collaborate on anything.
Stop trying.

>>54282332
>A productivity application of some sort
Vague as fuck. Usually these programs are just small bash scripts and not suited for collaborating.
>A Captcha picture solver
Hard as fuck.
>An anime web browser
What does that even mean? Also, ricing is not programming.
>An anime scraper downloader which downloads all anime pictures in a thread
Detecting whether an image is anime or not would be hard as fuck.
>>
>>54282332
>An anime web browser
Easy, let me just repurpose FF
>An anime scraper downloader which downloads all anime pictures in a thread
Easy, a curl script
>A Captcha picture solver
Give me 15 million dollars, a research team and 6 years.
>>
>>54282364
>>54282371
lol well lets hear your ideas then guys since you don't like none of them.
>>
>>54282399
There is no point pitching any ideas. It's not going to happen, at least not the way you're doing it.
>>
>>54282409
I want to hear best ideas then I can compile a list of them
>>
New one
https://www.codingame.com/clashofcode/clash/147621a55b8acb9024321f4f61349d1e32b609
Come on fags, join
>>
>>54282449
Don't waste your time. Don't take a vote on ANYTHING.
Design by dictator is by far the best way to go about these things.

>>54282434
>>54282485
Stop spamming your dumb shit. Nobody cares.
>>
>>54282485
>>54282505
Can I not just spectate?
>>
>>54282515
Why do you wan't to spectate and no you can't.
>>
>>54282333
>>54282399
1. A clone of Chaos Overlords
2. A clone of MOO(2)
3. Tinder for autists
4. Keto diet planner/recipe app
5. A simple photo manager/tagger
6. ...and am out of ideas
>>
>>54282522
I thought it'd be interesting seeing 8 people's brains working on the same problem and seeing how different each project turned out.
>>
>>54282556
Just join and 1v1 me you cuck
>>
>>54282530
Tinder for autists

How would this work?
>>
File: Capture.png (3 KB, 1009x39) Image search: [Google]
Capture.png
3 KB, 1009x39
Am I in trouble?
>>
>>54282485
I have to sign up?

That's a coding idea. A coding game where you don't have to fucking sign up.
>>
>>54282530
>2. A clone of MOO(2)
Hail mary, but Is this the MOO that stands for MUD Object Oriented? Because I've been working on one for more than a year now, I'd love to start working on another one.
>>
>>54282571
Now that I think of it, /g/ already is tinder for autists.

>>54282609
I meant master of orion.
>>
>>54282571
You need medical proof of autism to register an account.

also lmao my captcha is literally 420
>>
>>54282609
>>54282623

That said, that MOO sounds interesting. Had never heard of it.
>>
>>54282623
No it isn't I don't see any women here or any of us hooking up with ladies
>>
>>54282530
brainfuck backend for LLVM
>>
>>54282646
Not previous guy, but the history is really interesting. There are MOOs going on right now that depend on 20 year old code that someone wrote on a whim. There are MUDs who use the same technology to implement a primitive MMO. Really cool stuff, except there's no reason to work on it anymore.
>>
>>54282674
Don't you mean a frontend? Either way, I like the idea.
>>
>>54282333
frist idea on
http://www.ideaswatch.com/browse?p=NN
where NN is the last 2 digits of this post
>>
File: fox.png (13 KB, 441x456) Image search: [Google]
fox.png
13 KB, 441x456
>>54282434
>>54282485
>https://www.codingame.com
Doesn't accept R. That's fine. I bet the site's not even worth a shit if it doesn't support an open-source standard functional language.
>>
>>54282646
>>54282623
>>54282609
>>54282571

Why not a codecademy for 4chan autists that's hard as fuck to use and not particularly helpful in any way that bases its judgments and coursework on opinions, conjecture and a deep loathing for the student, and then when you're done you can shill it on /g/ and claim that it's the best website for the task and mercilessly mock everyone who doesn't give you money.
>>
>>54282704
No, you write anything that can be compiled down to LLVM IR which then gets compiled to brainfuck. I have no idea how to do this but it would be insane if possible.
>>
Want to make an apk that installs assets to a specific path on internal disk.

Code looks like this so far

//MAIN ACTIVITY
package com.anon.expansionpacks
import android.app.*;
import android.os.*;
import java.io.File;
import android.opengl.GLSurfaceView;

public class MainActivity extends Activity
{
File file = new File(context.getFilesDir(), filename);
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
>>
I fucking failed at that, I couldn't get the prime numbers without having a space at the end.
>>
>>54282693
I'm the anon who was working one. I didn't like the original MOO programming language so I'm using a scheme-like language in mine. Writing the compiler/VM for it was really fun too. One day when I finish it I'll post it here
>>
>>54282755
That seems like a sound business model.

>>54282723
>an app where people can rent their baggage space. So for example if I am going Singapore (where I live) from Thailand, I log in, and check if there is anyone going Singapore. More details are in my head. This can be used in other purposes too. For example, if someone is coming to your country from country A, and you need something from there, this someone could be your delivery man! It's a win-win situation!

Maybe a tad illegal, but not such a bad idea.
>>
>>54282755
my sides are gone
>>
You guys should collect cool project ideas and use that as the OP picture to get worthless maggets moving.
>>
File: 1460073531166.jpg (364 KB, 1125x1374) Image search: [Google]
1460073531166.jpg
364 KB, 1125x1374
>>54282755
kek
>>
>>54282755
that's already there, it's pretty much what happens when you start a /g/ thread with "what PL should I learn /g/?"
>>
File: snippet.png (291 KB, 1680x1050) Image search: [Google]
snippet.png
291 KB, 1680x1050
>>54282871
>>54282838
>>54282802
>>54282795

please do though
>>
>>54282907
>reddit
>trump

Ya Dun Goofed
>>
>>54282955
>normiebook.com/killyourself

I wonder if it was a joke
>>
Just compiling the ideas so far
>>54282332
>A productivity application of some sort
>A Captcha picture solver
>An anime web browser
>An anime scraper downloader which downloads all anime pictures in a thread
>>54282530
>1. A clone of Chaos Overlords
>2. A clone of MOO(2)
as in master of orion
>3. Tinder for autists
see variation below
>4. Keto diet planner/recipe app
>5. A simple photo manager/tagger
+ MOO as in mud oriented object
>>54282674
>brainfuck backend for LLVM
>>54282755
>Why not a codecademy for 4chan autists that's hard as fuck to use and not particularly helpful in any way that bases its judgments and coursework on opinions, conjecture and a deep loathing for the student, and then when you're done you can shill it on /g/ and claim that it's the best website for the task and mercilessly mock everyone who doesn't give you money.
>>
>>54282964
Where are the fucking genius idea guys when you actually need them?
>>
>>54282964
Here's another one to add: An automated comic sanitizer that clears speech bubbles and typesets based off input or a text file.There are some papers written about it but as far as I can tell nothing that implements the algorithms in a practical way.
>>
>>54282964
>>An anime web browse
>>An anime scraper downloader which downloads all anime pictures in a thread
This gives me the idea to write my own Danbooru scraper! Yes, now I have a project in mind!
>>
>>54283045
Original guy who posted it. You are welcome
>>
Ok in C++ for some reason I have a function returning true for a reason I don't know.

To try and debug it I put a cout before the only return true statement in the entire function and it never outputs.

For some reason it will cout if I put it outside the if statement that returns true, but if I add another cout anywhere else it doesn't output anymore.

wtf?
>>
>>54283174
Post code?
>>
Working on my GNU Turd microkernel
Thread replies: 255
Thread images: 29

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.