[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: 320
Thread images: 37

File: tmp_17449-1484484066916933544108.png (389KB, 934x1000px) Image search: [Google]
tmp_17449-1484484066916933544108.png
389KB, 934x1000px
What are you working on, /g/?

Old thread: >>58729135
>>
>>58734607
C#
>>
>>58734607
fuck you for using an anime image
>>
>>58734626
>>
too early
delet
>>
Would Von Neumann be happy with modern programming languages?
>>
>>58734635
>>
>>58734646
It was actually posted after post 310 from last thread.
>>
>>58734650
He's happy as long as the language makes it possible to launch a nuke in your face.
>>
>>58734650
If by that question you meant would he kill himself, then the answer is yes.
>>
Program in Ruby to generate large prime number.
>>
Rust is the best language. Deal with it. Don't like the SJW? Make a new rust and get over 100 useful, full-fledged libraries written purely in your language. Then we'll talk.
>>
What is the best javascript textbook?
>>
>>58734682
>I'm huge SJW faggot and nobody can stop me
>>
Someone post a challenge list.
>>
>>58734700
http://better-dpt-roll.github.io/
>>
Who slept on the job and let the anime troll start another thread again?

Now I'm hoping for the haskellfag and the functional-minions to show up and kill this thread...
>>
>>58734691
>I'm projecting and nobody can stop me
Only SJW like you would not use the best tool for the job based on purely political grounds.
>>
>>58734703
>anime troll
OP picture is the first and original /dpt/ picture, dumbass.
>>
>people still caring about the image used in the OP.

The OP should have a piece of interesting [Code] instead. Argue about the code, not the image.
>>
>>58734607
Is there an open sauce alternative to azure media services? I need to do live recording, encoding and HLS streaming of video to a unity game.
>>
>>58734721
>defending animu
KYS
>>
File: baka_big.png (2MB, 2000x2000px) Image search: [Google]
baka_big.png
2MB, 2000x2000px
>>58734703
You hold a minority view.

I don't think this is the website for you.

Programming can coexist with anime, too.

I suspect that out your Mumbai window is an urban view.

It's unfortunate that you still can't figure out how to poo in the loo.
>>
Writing my own screenshot tool that lets me select a region and then uploads it instantly because every single tool in AUR is bloated.
>>
>>58734747
How hard is it to write scrot $1 && upload $1 www.faggotville.com ?
>needing to write a tool for that
Kill yourself tardo.
>>
>>58734761
>Scrot
I bet you suck dick for a living
>>
>>58734731
>Until relatively recent times, Yuki was the only anime girl used in the opening post picture. She was chosen due to her computer skills, as displayed in the Melancholy of Haruhi Suzumiya show. Prior to the advent of the catalog, the picture was how users quickly recognized the thread on the board, and it stayed that way for quite a long time. The original Yuki was upside down, was wearing a cap and held onto the SICP Computer Science book.
>the anime girl
Who would know that anime girls are being posted on the anime website?
>>
>>58734747
>it's another "more features is a bad thing" episode

ShareX just works out of the box and can be used for precisely what you're trying to do.

I'm not entirely sure what your criteria for "bloated" is.
>>
>>58734788
Stop responding to her, please.

Responding to bait is as bad as baiting.
>>
>>58734682
I've done some relatively trivial programs in Rust on and off for the last couple of years. In general, I do like the language. However, I have an extreme aversion to doing anything major in the language currently, it seems despite their marketing of the language as "complete!" the sands are still shifting...
>>
>>58734788
Get fucked, weeeb.
>>
>>58734811
What they mean by stable seems to be that the what is there will never disappear, but more features may be added at any time. I think it's a fairly good model, so long as they don't go overboard and make rust C++-bloated in the end.
>>
File: 7bf.jpg (80KB, 1000x800px) Image search: [Google]
7bf.jpg
80KB, 1000x800px
>>58734733

You think you intimidate me, you degenerate piece of shit?
>>
>>58734847
>what is there will never disappear, but more features may be added at any time
>thinks it won't get bloated

????
>>
>>58734852
lrn2read lardo tardo.
>>
>>58734886
I read correctly, and your clarification of "as long as they don't go overboard" doesn't answer the fact that it's more than likely eventually going to get "bloated" as more language features are desired and subsequently added.
>>
>>58734747
xfce4-screenshooter
>>
>>58734794
Gomenne kudasai me, sempai, I was baka to reply to those kusoposters
>>
img processing using a resperry
>>
File: pure.png (275KB, 500x370px) Image search: [Google]
pure.png
275KB, 500x370px
Python? More like Pyfun!
>>
>>58735068
more like pyshit
>>
>>58735068
Python? More like Pycancer!
FTFY
>>
File: Screenshot_2017-01-31_16-39-51.png (118KB, 886x743px) Image search: [Google]
Screenshot_2017-01-31_16-39-51.png
118KB, 886x743px
Writing unit test for a network synchronisation algorithm implementation.
>>
File: 1485324589199.jpg (28KB, 360x360px) Image search: [Google]
1485324589199.jpg
28KB, 360x360px
>>58735090
>>58735100
They teach it at MIT, it has very similar syntax to C# and Java plus it's easy to learn so there's no reason not to know it. Especially for some applications like GIS
>>
>>58735141
it gives you cancer
people that learn python unprepared will still be pythonfags 10 years down the road
>>
File: 1485330832052.gif (1MB, 540x304px) Image search: [Google]
1485330832052.gif
1MB, 540x304px
>>58735158
>unprepared


If it doesn't suit your needs you can just learn something else.
>>
>>58735215
N O

unprepared as in "not capable of mentally blocking it off, not already aware of the problems a beginnrt wouldn't see!
>>
>>58735158
are you by any chance projecting, anon?

there's nothing wrong with python if you use it properly
>>
>>58735227
*beginner wouldn't see"
>>
File: helloworld.webm (990KB, 1920x1080px) Image search: [Google]
helloworld.webm
990KB, 1920x1080px
Well that failed.
>>
>>58735242
>AHHHHH
you've created a world of endless suffering
>>
File: cringe.jpg (13KB, 200x200px) Image search: [Google]
cringe.jpg
13KB, 200x200px
>>58734992
>this kind of cancer is all over /g/
>>
Rate my regex, /dpt/
       s{(\d)(\d)?(\d)?([0-3])?}
{("M" x $4) .
(($3 == 9) ? "CM" :
(($3 > 4) ? ("D" . ("C" x ($3 - 5))) :
(($3 == 4) ? ("CD") : ("C" x $3)))) .

(($2 == 9) ? "XC" :
(($2 > 4) ? ("L" . ("X" x ($2 - 5))) :
(($2 == 4) ? ("XL") : ("X" x $2)))) .

(($1 == 9) ? "IX" :
(($1 > 4) ? ("V" . ("I" x ($1 - 5))) :
(($1 == 4) ? ("IV") : ("I" x $1)))) }ex;
>>
>>58735297
>this kind of cancer is all over /g/
>>
>>58735227
Everyone starts as a beginner
>>
>>58735299
Pretty ugly.

Why is it?
>>
>>58735329
and you don't start them with python
>>
File: 1485851352932.gif (432KB, 500x375px) Image search: [Google]
1485851352932.gif
432KB, 500x375px
>>58735339
I guess an anonymous poster on a chinese cartoon board would know better than MIT about how to teach people.
>>
>>58735242

>2017
>Not using KDE.
>>
You memed me into reading K&R /dpt/, and I have some questions.
int c;
c = getchar();
while (c != EOF) { /*...*/ }

They said this:
>We can't use char since c must be big enough to hold EOF in addition to any possible char. Therefore we use int.
I don't get that. since EOF is -1, it's in a range of char, and changing the type to int won't do anything.
Why did they say that c must be big enough to hold any char + EOF, if EOF is in char's range?
I know that EOF isn't guaranteed to be -1, but could it be outside of char's range? Wouldn't that break some programs?
And the second question is:
Is it a good practice to rely on int being 32 bit since that is the case on every normal machine today?
>>
>>58735339
Not this guy again. Seriously, did you spend the entire night awake the last thread?
>>
>>58735299
doesn't even look like regex anymore, just a bunch of nested ternary operators mashed together, pretty ugly if you ask me

there surely is a better way, what is this supposed to do?
>>
File: terry a davis.jpg (321KB, 1971x1971px) Image search: [Google]
terry a davis.jpg
321KB, 1971x1971px
>>58735349
that's right mit nigger
>>
>>58735355
>I don't get that. since EOF is -1, it's in a range of char,
Are you literally retarded?

char can be both signed and unsigned, it's implementation defined. getchar returns an int.

>Is it a good practice to rely on int being 32 bit since that is the case on every normal machine today?
No, absolutely not. The only guarantee you have is that int is at least 16 bits.
>>
File: attempt2.webm (607KB, 1920x1080px) Image search: [Google]
attempt2.webm
607KB, 1920x1080px
Hello, world!
>>
>>58735242
what are you even trying to show?
It looks like you cannot program, cannot use a screen recorder and doesn't comprehend how to use a window manager.

Obviously anything you attempt at doing would fail.
>>
>>58735407
I was trying to print hello world, and I didn't care too much about SSR being in the video.
>>
>>58735422
So what were you trying to show?
The code?
How you launched the application?
The output?
>>
>>58735438
the output is in the telnet terminal, it's from a terminal-serial-Iike thing I implemented for my VM.
>>
>>58735355
with char you can't distinguish between EOF and a byte with value 255, since getchar can return any value char can hold or EOF char isn't large enough to check for the possible EOF
>>
>>58735407
Anon is trying to post actual code instead of endlessly circlejerking if anime should be welcome on /dpt/. (It should)
>>
>>58735367
Roman numbers
>>
File: bg_head_middle.jpg (93KB, 900x150px) Image search: [Google]
bg_head_middle.jpg
93KB, 900x150px
FreeVMS is looking for developers.

FreeVMS (VMS stands for "virtual memory system") is not just another Unix, is a real-time operative system with tight integration with the base system, DCL (DIGITAL Command Language), and also perfect for routers.

Support for FreeVMS is welcome!
Main page http://www.freevms.net/
Github mirror https://github.com/ztmr/FreeVMS
>>
>>58735507
Pay us you bastard
>>
Everyone knows 4chan's second image server(is2.4chan.org) is ungodly slow. How are you guys circumventing it?

Is there a more native faster approach than greasemonkey

// ==UserScript==
// @name 4chan Host changer
// @namespace 4chan
// @description changes image host
// @include http://is.4chan.org/*
// @include https://is.4chan.org/*
// @include http://is2.4chan.org/*
// @include https://is2.4chan.org/*
// @version 1
// @grant none
// ==/UserScript==

var newurl = window.location.href.replace("is2.","is.");
//alert(newurl);
window.location.href = window.location.href.replace(window.location.href, newurl);
>>
>>58735541
use your hosts file?
>>
File: lescheminghands.png (18KB, 208x195px) Image search: [Google]
lescheminghands.png
18KB, 208x195px
>>58735507
>>
>>58735541
echo "is.4chan.org is2.4chan.org" >> /etc/hosts
>>
>>58735375
>Are you literally retarded?
Are you? For saying i'm retarded just because I'm learning?
>char can be both signed and unsigned, it's implementation defined
>getchar returns an int
Ok, that information wasn't in the book, that clears it up a little.
>>58735472
What I still don't get though is how changing type of c to int makes it different?
How is
char c = EOF;
if (c == 255) {/*EOF or char 255?*/}

different from
int c = EOF;
if (c == 255) {/*EOF or int 255?*/}
>>
>>58735543
This
>>
>>58735543
>>58735552
Didn't know you could do url replacements in hosts thanks
>>
>>58735528
It will pay off once you can have it in your router.

>>58735545
It has a open source license you silly.
>>
What are some must read books for beginner into programming / compsci ?
>>
>>58735672
Infinite Jest
>>
File: Capture.png (65KB, 737x621px) Image search: [Google]
Capture.png
65KB, 737x621px
>>58735553
it might be easier to understand from an example
>>
I am doing exercise 2-3 in K&R c, and so far I have this:
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int htoi(char s[]);

main(){
char a[10] = "1f";
char b[10] = "ff";
char c[10] = "2a";
printf("1f: %3d ff: %3d 2a: %3d", htoi(a), htoi(b), htoi(c));
}

int htoi(char s[]){
int i, n;
char c;
c = s[i];

for(i=0; i<strlen(s); ++i){
if(isdigit(c))
n = 16 * n + (c - '0');
if(tolower(c) >= 'a' && tolower(c) <= 'f'){
n = 16 * n + ((tolower(c) - 'a')+ 10);
}
}
return n;
}

This produces a segmentation fault and for the love of everything holy I cannot figure out why. I looked up the solution online and I still cannot figure out why this doesn't work? What did I do wrong, /dpt/?
>>
File: hmmm.jpg (21KB, 393x360px) Image search: [Google]
hmmm.jpg
21KB, 393x360px
I need your opinion /dpt/
I'll try to make it as short as possible.
So for end of study work, I chose to make a fitness app? Just like this one:
https://play.google.com/store/apps/details?id=softin.my.fast.fitness&hl=en

The thing is I'm alone on this project and I have to make it work for October. Didn't do anything for the moment.
Is it too ambitious ?
I also won't have really the time to only focus on this since I have an internship coming and classes.
Any opinions, advices ?
>>
>>58735784
oh fuck I am dumb. I put c = s[i]; at the start of the for loop and the segmentation fault is gone, but now I just get random numbers, sometimes negative for the tests. Still have no idea what I did wrong, but sorry for the stupid mistake in my original post.
>>
>>58735709
It's a good novel
>>
I'm currently making an idle game and I'm trying to track both the Lemons Per Second and the amount. But the way I've currently coded it as Lemons Per Second == Amount. How would I go about separating the values in the code? Sorry if this sounds like a simple fix, still relatively new to coding.

Here's my code if that helps.

var pickers = 0; 

function buyPicker(){
var pickerCost = Math.floor(10 * Math.pow(1.1,pickers));
if(lemons >= pickerCost){
pickers++;
lemons = lemons - pickerCost;
document.getElementById('pickers').innerHTML = pickers;
document.getElementById('lemons').innerHTML = lemons;
document.getElementById('pickerPS').innerHTML = pickers;
};
var nextCost = Math.floor(10 * Math.pow(1.1,pickers));
document.getElementById('pickerCost').innerHTML = nextCost;
};
>>
Pros and cons of rust?
Reasons to learn functional language?
>>
>>58735874
memory safe
they forgot about the rest of the language
>>
>>58734847
They're already getting into bloat. Instead of making "unsafe" unions using a struct attribute (since unions are just structs where every field is at the same location), they introduced a whole new language feature with syntax and everything.
>>
>>58736004
no socks, you just need some xanax
>>
File: hacker socks.jpg (15KB, 300x500px) Image search: [Google]
hacker socks.jpg
15KB, 300x500px
>>58736004
green on black obviously
>>
>>58735874
Rust is memory safe without requiring many checks at run time, especially when you use functional features (e.g. mapping an array instead of using a for loop). The type and lifetime systems allow you to design highly descriptive APIs for how something can be used, and the libhoare library improves this even more.
>>
>>58736004
Don't cheap out on socks you fucking degenerate
>>
File: 1477570612660.png (339KB, 1000x800px) Image search: [Google]
1477570612660.png
339KB, 1000x800px
I'm programming a game!
>>
>>58736184
Thank you for using finnish meme.
>>
File: 1481100956747.jpg (33KB, 400x387px) Image search: [Google]
1481100956747.jpg
33KB, 400x387px
>>58736205
ur welcom bru
>>
How do I reverse-engineer a playstation game?

I just load it up in a debugger emulator and start figuring out some memory addresses like one would do in stuff like cheat engine? Then put up some break points to reach a code section I can disassemble?

Could anyone knowledgeable please clarify this? I'm just trying to get a grip because the task seems so open ended it's paralyzing
>>
>>58736184
How many LGBT+ characters does your game have? Either way it's not enough.
>>
>>58734675
Your picture is the reason there are so many small libraries in Node that do things like provide a single isNaN() function. That way it's heavily tested and the entire world can use this much-needed abstraction
>>
>>58736184
nice, good luck
>>
I don't know what to do.

I wish i wasn't wasting my time on games, but i always have no clue what the hell i am supposed to work on.
Everything seems pointless.

But i could at least improve my skills. But how?
>>
>>58734675
Can someone explain the sorting part? Am i being memed on? How does that make sense?
>>
File: 1483308279177.jpg (125KB, 960x960px) Image search: [Google]
1483308279177.jpg
125KB, 960x960px
>>58736244
>How do I reverse-engineer a playstation game?

What game?
>>
>>58736305
Mega Man X4-6.

I love them, especially X4. Wanna figure out how they work in general. Maybe hack X6 into a generally better game with some small but significant improvements.
>>
>>58735874
It's a low-level language (i.e. no GC, direct control over memory) with an affine typesystem and many functional features such as algebraic data types, pattern matching, monadic error handling instead of exception and closures. It's designed to prevent memory and concurrency related bugs such as use-after-free, deref'ing a null pointer and data races at compile-time, achieved through it's ownership and borrowing typesystem. Generics are trait-based instead of templates, somewhat similar to haskell's typeclasses, making them easier to use.
The package manager and build tool, cargo, is also one of the best among programming languages, making it easy to use external libraries. Often all you have to do build from source is to type 'cargo build'.

Con is higher learning curve, as most other languages have no affine types.
Also, the language assumes a single owner for each variable, making data structures with more than one owner, e.g. a node of a doubly-linked list, a bit more difficult to implement, requiring to use unsafe blocks.
>>
>>58736265
More than you'd think but less than you'd hope
>>
Did anyone get through CS in university as a brainlet?

I'm starting to fail python courses because of overwhelming anxiety with the assignment and lab deadlines.

I know enough of the python stuff but i am getting panic attacks from having failed the course before.

I did already take second year discrete math though, liked it enough but didn't study enough

basically i'm in second year second semester still trying to take the second intro course into python. i have to take it with all the freshmen. man all the freshmen normies are so judgmental because they came straight from a python course and never gotten a bad GPA before.
>>
need good downloadable books for:

c#
javascript
pl/sql

thank
>>
>>58736534
spend more time on assignments and nobody gives a dam about what do you do
>>
>>58736579
gen.lib.rus.ec
>>
>>58736299
It's converting to strings before comparison.
>>
>>58736534
>I'm starting to fail python courses because of overwhelming anxiety with the assignment and lab deadlines.
I never understood this anxiety stuff, especially if you're a /g/ autopilot student. No one cares if you're a fuckup or don't know what you're doing, that part only comes in when you act like the hot shit AND you're a fuckup/don't know what you're doing.
>normies
Get over yourself, fagmo

>i am getting panic attacks from having failed the course before.
I have never met a CS professor who was a complete hardass about doing things "One Way Only," but I have met more students than I can count who have no understanding of the professor/student relationship when it comes to how the professor wants something done.

I have also met more students than I'm willing to admit who DON'T READ THE FUCKING MANUAL. PLEASE FOR THE LOVE OF GOD CRACK OPEN THE TEXTBOOK INSTEAD OF CONSULTING STACKOVERFLOW AND THE REST OF THE INTERNET. YOUR QUESTIONS ON TESTS, LABS, AND PROJECTS WILL NOT COME FROM THERE, THEY WILL COME FROM YOUR NOTES AND THE TEXTBOOK.
>>
>>58736603
many thanks!
>>
>>58736036
and added a CONTEXTUAL keyword.
>>
Hi guys, I have a question
I am trying to parse a json in xcode and my function is the following

    func getDataFromJSON(_ link:String)
{

var titles: [String] = []
var titleImageLinks: [String] = []
var gamePrices : [Double] = []


let url=URL(string: link)
do {
let allGamesData = try Data(contentsOf: url!)
let allGames = try JSONSerialization.jsonObject(with: allGamesData, options: JSONSerialization.ReadingOptions.allowFragments) as! [String : AnyObject]
if let arrJSON = allGames["Game"] {
for index in 0...arrJSON.count-1 {

let aObject = arrJSON[index] as! [String : AnyObject]

titles.append(aObject["Title"] as! String)
titleImageLinks.append(aObject["TitleImage"] as! String)

gamePrices.append(aObject["Price"] as! Double)
}
}
print(titles)
print(titleImageLinks)
print(gamePrices)

self.tableView.reloadData()
}
catch {

}


where link is my json on some shitty site. I want to ask how can i parse it whet it's local?
>>
>>58736691
They had to, because union already exists as a method in the standard library: https://doc.rust-lang.org/std/collections/struct.HashSet.html#method.union. So they either had to break backwards compabilty or make union a contextual keyword.
>>
>>58736739
they only had to if they did what I replied to.
>>
>>58736739
>So they either had to break backwards compabilty
Oh boy, the same fate as sepples
>>
>>58736579
>C#
http://www.robmiles.com/c-yellow-book/
>>
File: pepe.jpg (59KB, 960x960px) Image search: [Google]
pepe.jpg
59KB, 960x960px
>>58736739
>Forces 1.0 too early
>before HKT
>before variadic arguments
>before the IO library even cools
>now needs to worry about backwards compatibility
>language turns in to a mess
>>
>>58735787
bump
>>
Thinking of a good way to handle text overflow in input boxes in the GUI library I'm writing for my game.
>>
Pros and cons of Go?
>>
>>58736892
make ... appear if the text flows off the box
>>
>>58736897
nothing,everything
>>
>>58736873
No one knows you, your skills, or your work ethic.

Yes, it's possible. Hell, it's even possible to get a prototype out the door pretty quickly if you know your stack and your programming language of choice.

Are you asking how to do it or what?
>>
>>58735822
Any tips? I'm away from my computer right now but I will fix this shit when I get home?
>>
>>58734607
My simple glew and glut code keeps throwing me access violations when I call glutCreateWindow, even though the code compiled.
It's been 3 hours, feeling preety suicidal desu senpai
>>
>>58736897
>pros
goroutines

>cons
everything else
>>
>>58736945
show your code?
>>
>>58736945
>My simple glew and glut code
hey grandpa
>>
File: problem.png (62KB, 1334x669px) Image search: [Google]
problem.png
62KB, 1334x669px
>>58736974
Here's the code senpai, it's preety basic stuff I guess, I've got no idea why it's not working
>>
>>58737028
I can't figure out the mistake(I haven't used glut in a while), try GLFW.
>>
>>58737028
change the project type to console application you wincuck
>>
>>58735355
int c = getchar();

>this is idiomatic c code
>>
>>58737096
nobody uses the fgetc or getchar functions outside of their first week of programming
>>
File: Travel_Junction_266.png (19KB, 496x328px) Image search: [Google]
Travel_Junction_266.png
19KB, 496x328px
>>58736792
>being created as the language to dethrone C++
>become new C++ even before it became a viable alternative
Life is hilarious.
>>
>tfw wrote .bat file that automates sqlite commands

did i make it yet?
>>
>>58737123
maybe future languages will learn & not get caught up in memes
>>
>>58737143
Nope.
>>
>>58737115
>nobody uses it so its not a problem
C apologists are embarrassing
>>
>>58737143

yes you have entered 1337 status
>>
>>58737028
>glew
>glut

anon, isn't SDL 2 better to use?
>>
>>58737192
It's better than most languages where 2/3rds of the standard library is considered "deprecated".

C11 only has 1 deprecated function.
>>
>>58737096
Why wouldn't it be?
>>
File: Travel_Junction_201.png (30KB, 496x328px) Image search: [Google]
Travel_Junction_201.png
30KB, 496x328px
>>58737162
I start to think looking for or creating the language to replace C++ is a meme on itself.
>>
>>58737370
>to replace C++ is a meme on itself.
It is but with the right people & experience. it can happen. Which is why I'm confident in D at the moment.
>>
>>58735874
Pros: memory safe and fast (unless the compiler does not optimise it yet)
Cons: no libraries, almost as complex as C++
Wait a few years.
>>
>>58736585
if i spend more time on assignments then i will have no time to work on my math assignments and shit

i have horrible time management

>>58736653
i'm not a /g/ autopilot student just yet, although i've easily self-learned other things

yes i did act like a smartass hotshit in first year but i fucking failed now everyone hates me
>>
Are there any good books on software development that weren't written by nerds who take their CRUD dayjob way too seriously?

I'm reading code complete and the author has his head so far up his ass it's hard to take seriously.
>>
>>58737407
>>58737370

Common lisp or racket. Really, I am not fucking with you. Both have ways of managing memory by hand (you have to use ECL for common lisp compiling though for real) and common lisp even has fucking go tos.
>>
>>58737495
What exactly are you looking for?

Is it overly complex or not complex enough?
>>
>>58737502
>Common lisp or racket
Do they have decent templates/generics?
Because if not, theyll never be in the same comparison.
>>
>>58736897
pros:
- easy to read and learn, even pajeet and retarded undergrads can be taught to quickly
- compiles faster than most dynamic runtimes start up
- good performance

cons:
- no generics
- workspace restrictions are a pain
- no macros
>>
I'm currently in university and haven't learnt shit
during the first semester of my compsci course.
Managed to pass the programming coursework with some help
but I know nothing going into the next semester.
Is it too late to cram C# and still come out with a pass?
>>
>>58737447
Why do you not give up on your language, Andrei? It's literally who after 10 years.
>>
>>58737563
>Andrei
>rust
>>
>>58737536
CS in university is completely cucked and fucked m8

profs don't teach shit about anything and the exams and assignments are just straight up ridiculous

it is literally all dependent on self-learning
>>
>>58737563
Who is Andrey and why should I care?

Rust might become a viable alternative to C/C++ in a few years without the possibility of setting the world on fire in any project more complex than FizzBuzz. Or it might implode together with the death of Mozilla. Time will tell.
>>
>>58736739
Or they could have done it with an attribute.
>>
>>58737536
>Is it too late to cram C# and still come out with a pass?
C# is a pretty easy language to learn.

What do you mean cram? Like one week or one semester?
>>
>>58737533
metaprogramming facilities of lisps are still unparalleled. If you really want to be fancy you can even roll out your own fexprs.

Due untyped variables (all variables hold pointers, values they point to have types) you ofcourse have generic functions. Common lisp has really fancy oop system, with generics and multiple-dispatch methods.

If you don't like oop system, default function evaluation or even macro system, you can change it.

Common lisp supports imperative, functional, object oriented, aspect, actor, etc etc programming. Imperative is ofc the fastest.
>>
>>58737534
Wait, it has no generics AND no macros? What a joke.
>>
>>58737536
>is it too late to learn how to swing hammers to do good architecture?

>>58737612
going to college for anything relating to computers is a scam
it's the one thing you can teach yourself with no outside help or resources
>>
>>58737634
pretty neat, might look into it one of these days
>>
>>58737636
Why do you think everyone shits on Go?
>>
>>58737611
>>58737614
oops

that post >>58737563 meant to be a responce to >>58737407
>>
>>58737643
should i just drop out if i can't bother to get the motivation to self-study shit myself?

i have fellow CS robots going into second year and third year complaining about how hard it is, they're normies from high school as well

a lot of people drop out of CS after second year

but then i don't have any other degree i would want to do either

i already feel so behind
>>
>>58737636
don't forget
>pointers but no pointer arithmetic allowed

>>58737722
Honestly, I want to call you a sperg for using that virgin talk, but you're going to be eaten alive if you can't learn shit on your own, nobody offers training anymore and if you don't have a laundry list of different specializations, nobody is going to hire you.
The easy way out is to know people and have good connections so you can get hired straight out of uni, but I get the feeling you're too autistic to manage that.
>>
Alright, /g/, here's the deal.

I've been reading a book on CLisp and wanted to start writing some code. I have the code I'm trying to write written in C, and would like some help translating it into CLisp.
double get_error(int m, int b, point points[],int size) {
double err = 0;
for(int i = 0; i < size; i ++) {
err += pow((points[i].y - (m * points[i].x + b)), 2);
}
return err;
}

;; yay
(defun get-error (m b points)
"m is slope, b is y-intercept"
(reduce (lambda (??? ???) (???)) points))


I've been trying to structure this for almost an hour now. What do?
>>
>>58737716
Facebook is using it.
Walter & andrei are getting paid D course requests. D is getting steady releases. And various companies are adopting it.

Far from dead m8
>>
>>58737612
Pretty much what the guy who helped me with the coursework told me. It's my first time learning to program and it felt like there were gaps from what they were teaching
though I'll admit I had frustrations when making attempts and ended up giving up too early.
>>58737625

It's a few days until the semester starts again. I'll be going into it knowing the bare minimum, when I say cram, I mean playing catch up from scratch to where I should be at now for the second semester if that makes sense.

>>58737643
I've found that out the hard way, but parents pushed for me to get a degree and I'm here now so I'm thinking I might as well make a decent attempt, y'know?
>>
>>58737756
i know, i have some high school friends but they don't really like me that much

i'm just sperging out because i am taking python along with a bunch of unnecessary courses
>>
>>58737766
just go on codeacademy

i'm just really scared whether i will succeed in the upper level CS courses at all, it's completely bureaucratic and shit

i don't even like coding yet so i think i'm fucking up
>>
>>58737670
Trick with common lisp is that it's really big language, spanning the entire spectrum of abstraction. You can practically program on bare metal or ignore real world if you want.

The thing i like most about it are it's documentation functions.

(documentation name 'function) - return it's docstring

You usually write docstrings instead of comments, to describe function intent. Emacs (with slime) is most often used as ide, and when you hover over function name it shows you what arguments it takes, no matter if it's standard, user defined or library.

Then you have this really funky disassemble, which shows you what your function compiles into.

Common lisp is quite fast, especially if you write imperative style with type specifications (both optional), with optimal data structures (vectors instead of lists etc.). it's compiled language usually. sbcl is the fastest implementation right now, but it produces very fat executables. ecl produces smallest executables but has long startup time. Both are way faster than pythons, rubys, etc. and a bit slower than properly optimized c++ (faster than java still though).
>>
>>58737766
Every language is mostly the same, you learn one, you've learned them all.

What they don't teach you in university is programatic thinking or software architecture.
I think it took me 6 months of self-teaching before it finally clicked with me.

>>58737793
Codecademy is worthless and only teaches syntax.
You want to learn to write software, not rote memorize how to print things to the terminal.
>>
>>58737816
>Every language of the same paradigm is mostly the same
FTFY
>>
>>58737833
there aren't that many paradigms
if your language only works with one of them it's worthless
>>
>>58737636
It reduces the complexity of code by several magnitudes. That is great, if you have a team of not the brightest programmers working on multi million sloc projects that need to navigate to a part and quickly understand it. That is also great, when you need to compile this behemoth. But for you and me these advantages do not matter much and lack of generics is very crippling. It still comparable to Python in development speed, but with performance somewhere between C++ and Java.
>>
>>58737816
so is it better to just drop out for now?

the thought about being behind on all the assignments and exams is scaring me again

i have no friends but have no motivation to be studying either

im on academic warning and i have this term to make it better, or else i get kicked out for a year or transfer to a shittier institution

trying to decide if i should just stick with python and get gud, or just drop out everything except the easy courses

i'm already in second year so i feel really discouraged by everyone else who is doing good and know what they're doing
>>
>>58737844
Lisp is a multiparadigmal language, but no one will say it's like Python or C.
>>
>>58737844
Just compare c and forth. They are both imperative and couldn't be more different.

Now compare scheme and haskell. Both functional, both very very different.

Yeah, mainstream oop languages (ruby, java, python, c++, ...) are conceptually mostly the same, but once you go out of this safe space...

And you have to go out of it, otherwise you are going to remain codemonkey forever.
>>
>>58737833
I'm OK with this
>>
>>58737844
>if your language only works with one of them it's worthless
This.

Friendly reminder that you should know and use all paradigms as appropriate, in combination with each other where it makes sense.
>>
>>58737853
I don't understand how you could spend a whole year at this and not know at least one programming language.

What the fuck are you doing?
>>
>>58737807
thanks m8, went with sbcl because I tend to prefer statically compiled binaries anyhow.
>>
>>58737853
What did you do for the last six months?

You're the reason college shouldn't be free. You're a damn burden to either your parents or the taxpayer, and the very best case is that you're somehow paying for this yourself on money you earned with your productivity.
>>
>>58737884
exactly, that's where i'm fucking up.

i'm the type of person who gets really discouraged by shitty instructors, even though i usually end up doing the self-learning at the end. i'm also bad at procrastinating and meeting deadlines, i must have adhd or something

i mean i do know a bit of python, there are two intro courses for python.

then i got overwhelmed by so many things going on last term, and failed the second python course which is about algorithms.

if I don't get gud this term I am literally getting kicked out and my GPA is like 1.4 right now. fuck

i found a fellow friend online who's in the same situation as me. this guy is in third year, got tired of his current program and got on codecademy and thought CS would be a good fit for him.

but i still hear about how hard coding and programming is, i feel like a brainlet when it comes to coding and programming

>>58737930
my grandparents pay for my education.

i feel like i should just drop out until i really know what to do

my first year i did bad as well, but i just decided to keep on going for no reason

all that's left is a horrible GPA right now
>>
>>58737816
Could you recommend some sources you used that someone like me could use to get a drip with my course?
I'm sure I've done enough to pass the first semester, if I need to put everything else on hold to pass the second semester I'll do it. Just as long as I have the tools do do so.
>>
>>58737816

this

codecademy is like the beginners guide to being a beginner at a very beginner level
>>
>>58737957
plenty of online resources out there for programming m8

uni is just a useless degree, it's mostly there for the connections and internships and stuff. also your experience

no one even cares about your GPA if you're a CS major
>>
I need help. I want the program to print out where the characters in the code are located, but it's not working properly and I don't know what I'm doing wrong.

string somestring="I have no idea what I'm doing please help, this code looks horrible.";
for(int i=0;i<somestring.Length;i++)
{
if (somestring.ToLower().IndexOf('a') == -1 || somestring.ToLower().IndexOf('b') == -1 || somestring.ToLower().IndexOf('c') == -1)
{ Console.WriteLine("No characters match."); break; }
if (somestring.ToLower().IndexOf('a',i) == i || somestring.ToLower().IndexOf('b',i) == i || somestring.ToLower().IndexOf('c',i) == i)
Console.WriteLine("There are character matches on the " + (i+1) + " position.");

}



It's only printing six times, where it should be printing multiple times.
>>
is there anyone who simply fell for CS as a meme even though they're a brainlet?

at least the business kids and chinese kids have their own connections and groups to help each other out

i'm just the odd one out
>>
>>58737980
Six is multiple
>>
>>58737064
>linxcucks
>>
>>58737957

this one is not easy
https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-9

and this is practical
https://automatetheboringstuff.com/
>>
File: C3bRVjeUcAE4Ky-.jpg (105KB, 800x1070px) Image search: [Google]
C3bRVjeUcAE4Ky-.jpg
105KB, 800x1070px
>>58738009
Almost every job is just networking senpai
>>
>>58738015
Multiple as in, there should be more results than just six. I'm looking for characters 'a', 'b', and 'c', there's more than that in the string.
>>
>>58738009
if you're in college and not making connections, you're literally wasting your life.
>>
>>58737980
I don't even know what the fuck you are doing.

You want to print the position of the characters a, b and c in a given string, or what? First occurences? All? What if they dont occur?
>>
>>58737943
>GPA is like 1.4 right now
Look, let's be straight up honest: there are other students with your exact same course load that are doing fine.

There are students who have much more difficult course loads combined with other shitty life situations that still make it through.

You are some combination of stupid and lazy, and it's clear that you're not in a place where you can succeed.

Drop out now. Rip the bandaid clean, or it'll fuck you over more the longer you wait.

Think about what you want to do with your life and push yourself into entry positions tangentially related to that goal. Right now, I'm training a college drop-out who started as a bitch helpdesk position to help me with the programming and sysadmin stuff I do. He was shit at college, but he's learning fairly quickly and I have high hopes for him moving forward.

You need to start earning, rather than draining a fuckton of money while going nowhere. College is incredibly expensive if you're not certain to succeed.
>>
>>58738049
All occurences. If they don't occur it prints that there's no characters in the string and goes out of the loop.
>>
>>58738009

what the fuck is a brainlet? retards and their 4chan language....
>>
>>58737980
Take a step back and try to describe your problem again.

It sounds trivial, like literally one or two lines, but I'm not certain as to what you're trying to accomplish.
>>
>>58738009
I went to school for MIS, ended up as a programmer anyway.

wakarimasen lol
>>
Remember when CS programs required heavy math before even being considered into the CS department classes?

Now all CS programs are literal job training, but it's not even good job training because they don't teach you basic shit like source control or debugging code that you didn't write.
>>
>>58737928
I recommend you ANSI Common Lisp book by Paul Graham. It mostly covers functional and oop. For metaprogramming try On lisp by same author.

Low level programming in common lisp isn't often done, so not a lot of books are written on this topic. Try browsing trough Hyperspec.

On lisp and hyperspec are free online, ANSI common lisp is easily pirateable.

Common lisp enables you both to write slow programs fast and slowly write fast programs. You usually begin with slow and easy prototype and then optimize it. Slime + emacs provide a lot of profiling and debugging features which ease optimization a lot.

Another book that is often recommended is Practical common lisp. I didn't like it, but its chapters on loop and on slime are great.

Good luck. For libraries check awesome-cl on github, quicklisp and cliki.
>>
>>58737980
>List<T>.IndexOf Method (T)

>Searches for the specified object and returns the zero-based index of the first occurrence within the entire List<T>.
>first occurrence

read the docs
>>
>>58738054
I am in a similar situation as that guy, actually.

I have developed professionally and actually do so in semester breaks.
I absolutely love programming.

But i hate everything else. I hate having to learn about economic bullshit, i hate useless, abstract maths that i won't ever apply etc..

I wish i could just work as Software Developer, because i actually really can.
But nope, the country pretty much requires a degree. I'd be fucked without one.

Next semester i will have to write and succeed in 10 different tests.
I am not sure if that's possible at all. Ill just give my best.
>>
>>58738075
I'm not knowledgable enough to write it in a couple of lines. Basically, using IndexOf, to get the position of certain characters, in this case a b c, and printing the position of where they are (doesn't matter which one of them it is).
>>
>>58738030
i know but i feel so lonely because i'm a fucking autist robot

i'm getting older so no one wants to make friends with me in class either

i feel like CS is an easy way out if i just

>>58738045
that's what i mean man, i'm literally wasting my life and i feel so pathetic throughout this whole shit

luckily i'm good looking enough to hide my schizoid robotness, but i've done things in the past to burn bridges and a lot of people hate me now. fucking schizoid personality disorder i swear. feel lonely af when i have no friends but when i do have friends i usually end up being belittling and shit

>>58738054
if I drop out right now, my GPA would be too low and I will have to take a year off or apply to transfer. i have to get my GPA up in the winter term to try to get better. my advisor told me they never look at the courses i took, it's the GPA and experience that matters

so I'm stuck between deciding if I should just drop python right now and only take the "easy" courses

i could drop the python course right now, and do some self-learning to get comfy.

but at the same time i'm conflicted if I do end up taking CS afterwards I would feel even behind.

I'm having literally panic attacks man.

>>58738083
yeah MIS is what the business kids do for programming
>>
>>58738068
All occurrences of the the specific characters 'a', 'b' and 'c', or what?
>>
>>58738109
What did you do to get better?

Are your networking skills good?

I just get panic attacks thinking about how i wasted my two years in university without that many connections, but actually ruining the connections i already have
>>
>>58738115
It doesn't matter?

What do you want the program to do?

Print all indexes of occurences of 'a', 'b', and 'c'?

Pick any of those 3 at random and only print those occurences?

Given the string:
>Suck my fucking fat cock, you dumb slut.
And the characters:
>u
>c

What is your expected output?
>>
>>58738129
Or nothing. If there's none in the string it prints that out.

>>58738100
First occurence, but I use the counter to make the method start from that position. If i = 2, then it starts counting at 2.
>>
>>58738125
>just drop python right now and only take the "easy" courses
Holy shit, you have got to be a parody.

In what fucking universe is Python not already one of your easy classes?
>>
>>58738157
Okay, actually, it's both you and I that's retarded. The program is working correctly, I just didn't count the chars in it.
>>
>>58738194
>The program is working correctly
I can guarantee it fucking does not unless you want it to say no characters match even though one of them does.

You still haven't properly explained what you're trying to do.
>>
Can someone explain what generics and macros are and why they're useful in a programming language?
>>
>>58738162
i already told you man

i never bothered to get gud for python, and ended up failing one course last term

i did do python before but i already forgot a lot of stuff

just the overall panic and anxiety of my situation is fucking me up

even the easy stuff i would be literally getting a headache over it because i always fail to meet deadlines and shit

i'm in second year and i'm still a kissless hugless virgin, don't have much networking, and don't have motivation, don't know what i'm doing
>>
>>58738161
I don't even know what language you are using, but it's pretty fucking simple:

I bet there is a way to tell IndexOf() to begin searching based of a certain start-index.
So you declare a loop variable, say i, construct a for-loop that runs as long as i != -1 and you always assign i to IndexOf(i, 'a') etc. where i is the supposed start-index in that context.
>>
>>58738221
You take a string, and read all occurences of characters 'a', 'b' and 'c' in it, and print on which position they're located, either of them. If none of them occur on any position, it prints that there's none in the string and breaks the loop.
>>
>>58737370
>creating the language

How does one make a programming language?

Technical details please.
>>
>>58738146
I had personal interest in programming and thus i picked it up.

You can always do an apprenticeship right? It's usually a lot less theory than college, you get paid and everything is alright.
>>
>>58738251
C#
I did, if you see I wrote
somestring.ToLower().IndexOf('a',i)==i


Starts it from the current counter. And since it takes it from the Length of the string, you always get the correct position.
>>
>>58738240
Generics/templates allow you to streamline away type semantics so you have powerful and versatile tools.
>>
File: sicp.jpg (51KB, 400x579px) Image search: [Google]
sicp.jpg
51KB, 400x579px
I am going to read pic related. But I noticed that there are two versions. The original one and another one that's on the net called ''SICP Distilled''

I was wondering if I should go with one or the other?
>>
>>58738305
Your program doesnt make any sense at all.

Please read through the formal description i gave you and apply it.
>>
>>58738240
They are just another, more powerful way of defining abstraction.

Macros allow you to write syntax abstractions, they allow you to write things like loops (for, while, do ... while, ...), conditional (cond, case, typecase, match), pattern matching, logic programming, ... They allow you to expand the language itself with new paradigms, operators, etc.

For example they made possible implementing threads in common lisp as a library (bordeaux-threads). They allow you to write things that language designers hadn't expected.

Some people think about macros as about compilers (they are often used to implement Domain Specific Languages), others as about compile-time functions, which take and produce syntax. They are both that and a lot more.

There are two main sorts of macros, hygienic (scheme family of lisps) and unhygienic (common lisp family). Unhygienic are a bit stronger, but can intruduce subtle bugs. Yet another kinds are template metaprogramming (c family) and fexprs (run time macros, kernel language).

Lisps have, due to their minimal constant syntax, most powerful macros.

>>58738265
Writing simple interpreters, compilers is easy. First you have to decide on features you want to have in language, then you have to write an interpreter for it. Writing your own lisp is considered a rite of passage in lisp world and forth is probably more often implemented than used.

Simple stack based languages are probably easiest to write. On freenode you have #proglangdesign channel, ask guys there for help.

Most people use lisps or haskell for writing their interpreters.

>>58738317
Original, definitely.
>>
>>58738319
Actually try the program and you'll see it works.
It works correctly. It only prints on which location the char is, not which char is where. What exactly is bothering you?
>>
>>58736920
Not how to do it but if it's realistic for someone to do it for October, that's all I want to know.
I'm gonna do it with Java.
>>
>>58738272
i don't even know man i already fucked up so badly

it's the fourth week of classes and everyone started making friends, i didn't.

i'm a second year so all the freshmen act like they want nothing to do with me when i try to talk to them

all the old friends i've had, they've moved on to better things or hate me now because of things i've done

i've never had many friends in my life anyway, but the idea of making the same mistakes all over and over again is seriously killing me

i'm just stuck in some shitty loophole

i really want to drop out but i don't know what else to do, i want to keep my options, and i don't want to get even older doing nothing at all

i do see other older students in class but they started skipping class beacuse they're depressed like me

fuck i hate falling for the college meme when i am too much of a sperg autist to do it

i am seriously good looking enough for girls to try to get interested in why i'm such a loner when i look good

i'm a schizoid, i turn away people when they approach, and i regret when they go away. stalker tier pretty much
>>
>>58738305
for (int i = startIndex; i < someString.Length; i++) if (someString[i] == 'a') return i;
>>
HOW THE FUCK ARE YOU SUPPOSED TO MAKE CONNECTIONS IN UNI IF YOU'RE AN AUTIST

I MEAN I LOOK PRETTY NORMAL ENOUGH BUT INSIDE I'M FUCKING SCHIZOPHRENIC

THE NORMIE KEKS WANT NOTHING TO DO WITH ME BECAUSE THEY KNOW WHAT I'VE BEEN LIKE IN HIGH SCHOOL

i'm asian and a skinny kpop looking fag so everyone just assumes i'm an international student

but wtf can international students bring connections anyway

i'm fucking going crazy rn
>>
>>58738343
You said you wanted to know all the occurrences of each of the characters 'a', 'b' and 'c'.
That is not what your program does.

If you actually just want to check every character in the string for a match with a given group of character, then your code "works" but is still shit.
>>
>>58738386
>BECAUSE THEY KNOW WHAT I'VE BEEN LIKE IN HIGH SCHOOL
What kind of shithole do you learn in so everyone in Uni knows what have you been in highschool?
>>
>>58738265
For examples check this: http://plzoo.andrej.com/

Books: Essentials of Programming Languages, the dragon book, and my favourite: http://www.diku.dk/~torbenm/Basics/index.html

I suggest implementing interpreters/compilers in lisps or in haskell. Lisps have a bonus of giving you parser for free (if you decide to use s-expressions).

For more resources check #proglangdesign on freenode.
>>
>>58738248
you need to start programming
>>
>>58738427
it's just that i suck at making new friends and i see people from my high school doing good and it makes me depressed

as i get older i have limited abilities to try to network and make study buddies

i'm a fucking loner so i should probably study alone anyway but i just get jealous of having a study buddy

it's like i need to step down to all the international students, man

i'm korean so i'm at an odd end of the ethnicity game

made some good friends with chinese girls but they're girls afterall and it doesn't last long

the chinese guys are usually ugly and always seems mad at me for cucking their women or something

idk i just suck at making friends

i know people say to just get out there, volunteer, and network but i've been scarred from so many social isolation in my life
>>
>>58738386
>NORMIE KEKS
You're kinda supposed to off yourself at this point.
>>
>>58738362
Thank you, that's cleaner. Can you replace stringName.IndexOf('a') with stringName[i] == 'a' for all uses or does IndexOf have some other practical uses?

>>58738401
Of either of the characters yes, not what location each specific character has.
Then how would you write it?
>>
>>58738522
IndexOf can be used when a for loop is impractical
>>
>>58738497
i'm still reluctant whether i could actually pursue programming or not

my gpa is really suffering right now and i doubt doing codecademy shit on my own would make me improve by much

if i fail this term again i'm gonna fucking go crazy

i'm already behind on so many assignments

i have an online friend and a high school friend helping me out with shit but i'm still discouraged as fuck

i just hate everyone in CS, it's either chinese international students for the business or some white redditor spergs

i'm not better off either but the atmosphere here seriously makes me dread everything

i want to drop out but i don't have any better options either
>>
>>58738522
String charactersToSearch = "abc";

for (int i = 0; i < somestring.Length; i++) {
if(charactersToSearch.IndexOf(Char.ToLower(somestring[i])) != -1)
Console.WriteLine("Match at position " + (i+1) + "\n");
else {
Console.WriteLine("Failed to match any of the characters\n");
break;
}
}


I have never programmed in C#, so it might not compile because of minor issues.
You get the idea.
>>
>>58738575
you need to talk to the college therapist. he will help a lot.

meeting people is easy, you just have to introduce yourself. and start seeing people in a new way, they probably like you.

i was like you in college but i met some good friends by talking to people in my dorm. people want to be liked so its easy
>>
>>58738606
i know but i made some mistakes man

i talked to some girl sitting beside me because she was nice and emptied me a seat

she thought i was fucking hitting on her

i also talked to some loner guy i knew from junior high and high shcool

he fucking told me to screw off or something

i know meeting people is easy but it just reminded me of everything i've done in the past

i was never bullied or anything, just a failed schizoid who was able to relate but no friends to actuall hang out

i'm in second year so people are starting to settle into their own cliques or be loners

it's sad man
>>
how can i get a user to run a .bat file that's on another server? if i give them access to it and they run it, would the .bat file try to run from their local machine or on the server? i need it to run on the server
>>
I'm trying to scrape all the GNU C submissions for this problem on Codeforces:

http://codeforces.com/problemset/status/1/problem/A/

At the moment I'm basically searching every page 1 by 1 and then checking each submission if they're a GNU C submission or not. You can filter the language on the drop down menu on the side, but is there a way to find out if I can actually directly link to a pre-filtered list?

I can't seem to figure it out and I've been stuck for ages.
>>
>>58738597
This will not work at all. Once it reaches the first nonmatching character it will break and stop the loop.
>>
>>58738597
That code makes no sense, but not syntax wise, logic wise.
>>
>>58736244
http://www.romhacking.net/?page=documents&desc=PlayStation
https://warosu.org/vr/?task=search2&search_subject=%2Frhg%2F&search_res=op
>>>/vr/rhg
>>
>>58738597
It would work if you just edited it

else if(i==somestring.Length) {
Console.WriteLine("Failed to match any of the characters\n");
break;
}
>>
>>58736342
Find out where the game stores textures/sprites/resources then replace all instances of mega man with mario.
>>
>>58738734
>>58738742
Oh right, I just saw your break and assumed the logic based on it.
I thought you want to check each individual character of a given string and stop doing so if you encounter one that isn't matching.

Just replace the first condition then. The best idea is to put it in front of the loop, as you only have to check it once.
And your logical operators are false there. You break out and say "no characters match" but connect the condition with ||. Meaning you actually break out if only one of the characters doesnt match, which doesnt seem to be what you want to do.

The rest of my code is fine.
>>
>>58734607
Why is swift so good?

Literally the best language.
>>
Do you use 16-bit hardware in 2017?
>>
>>58738941
Does playing snes count?
>>
File: 1485278067409.gif (2MB, 580x433px) Image search: [Google]
1485278067409.gif
2MB, 580x433px
>>58738894
this code will never run
>>
>>58736708
>I want to ask how can i parse it whet it's local?

Host some shitty site locally.
>>
>>58738902
How should I edit the condition in the original code then?
>>
>>58738992
>>58738902
String charactersToSearch = "abc";
String somestring = "Hello i am some kind of string.";
bool foundAtleastOne = false;
for (int i = 0; i < charactersToSearch.Length; i++) {
foundAtLeastOne = foundAtleastOne || someString.IndexOf(charactersToSearch[i]) != -1;
}

if (!foundAtleastOne) {
// End the function here, do whatever, just dont continue with the logic
// Since this is the case where actually NONE of the characters you are searching for exists
// inside of the string you are searching in

}

for (int i = 0; i < somestring.Length; i++) {
if(charactersToSearch.IndexOf(Char.ToLower(somestring[i])) != -1)
Console.WriteLine("Match at position " + (i+1) + "\n");
}


The whole idea is to make the code a lot more scalable incase you need more than just three characters that you are searching for.
Even for three it probably reads better.
>>
when if ever should i use unions
>>
>>58736892
Warn users of a strict character limit.

Run a semi destructive command if they go over the limit.
>>
>>58739012
To save memory. That's all they are really used for.

They're an interesting and quirky tool to learn from, but don't expect to use it in production ever. We're not in the 70's anymore, and saving a kilobyte doesn't mean saving $100...
>>
>>58739012
When you want a set with all elements of two other sets of course.
>>
>>58739047
>>58739048
alright
>>
Never work for a big company, /dpt/. Today got assigned a JIRA task (sounds pleasant, doesnt it) to change the directory my projects logs to from A to B. Should be simple enough. Turns out all our deploys are done though a central script that defines the logging properties so if I change it for my project, I change it for all projects. So now I'm digging though ten years worth of legacy code that no one understands anymore to allow multiple logging configurations. And if I break anything, its my fault because nothing will be able to be deployed. And now the project manager is breathing down my neck because this task is taking longer than I estimated. All to change the fucking directory of a fucking log file.
>>
>>58739082
That the price for working with code monkeys.
>>
>>58737064
GL... As in graphics language...
>>
>>58739082
Do you not have a CI server? lol
>>
File: Y06.png (22KB, 448x320px) Image search: [Google]
Y06.png
22KB, 448x320px
>>58738967
I think programming something for SNES is nicer for the thread.
>>
>>58737760
assuming
(defstruct point x y)


then
(defun get-error (m b points)
(reduce #'(lambda (acc k)
(+ (expt (- (point-y k)
(+ (* (point-x k) m) b))
2)
acc))
points :initial-value 0))
>>
>>58739006
Why are you making it overly complicated?
Why not use something like >>58738362 posted?

Sorry, I'm genuinely asking.
>>
>>58739090
True.
>>58739114
We're a big company. We have multiple CI servers.
>>
>>58739221
That only looks more simple because it misses half of the logic.

Put that together in actual program that does what he / you want to achieve and it won't be smaller.

And as i said: The idea is that there are many characters which are used to compare with. If that's the case you simply need to start using a different approach than comparing them all manually.
>>
>>58739271
You have multiple CI servers but your entire deployment process is done through one script.

How does that make sense?
>>
As a hobbyist, i learned about partial classes in VB.net and have used it a few times in my current project altho i'm a bit afraid to create too many files, i only have a few but i feel like i should move functions into their own file.

Problem comes when i think of how many of the functions go together.

Which criteria do you use when splitting things into multiple files to improve readability?
>>
>>58739308
I'm not sure why you think that is impossible.
>>
>>58739390
No that's stupid. Don't use partial class. One class one file.
>>
File: anal beads.png (17KB, 799x307px) Image search: [Google]
anal beads.png
17KB, 799x307px
>>58738262
static void FindCharactersAndInformUserOfTheirBullshit(string input, List<char> characters)
{
if (!characters.Select(x => input.IndexOf(x)).Any(x => x != -1))
{
WriteLine($"The string contains none of the supplied characters.");
return;
}

characters.ForEach(x =>
{
if (input.IndexOf(x) == -1)
return;
else
WriteLine($"There is a match for character {x} at position {input.IndexOf(x)}");
});
}


Usage:
FindCharactersAndInformUserOfTheirBullshit(
"I have no idea what I'm doing please help, this code looks horrible.",
ReadLine().ToList());
>>
what's your hacker names? I need one myself
>>
>>58739434
pYtHoNxGaYbOy
>>
File: ENOUGH.jpg (29KB, 412x430px) Image search: [Google]
ENOUGH.jpg
29KB, 412x430px
QUICK, MAKE A PROGRAM THAT DOES FIZZBUZZ BUT RECORDS HOW MANY TIMES IT HAS PRINTED FIZZ BUZZ & FIZZBUZZ IN ITS OWN SOURCE CODE
>>
Why do the dwm people use unsigned ints in their config.h?
>>
>>58739424
but what if that class has +20k lines? oh and it's still one class, just multiple files, on compile it functions identically.
>>
File: hm.png (181KB, 422x400px) Image search: [Google]
hm.png
181KB, 422x400px
>>58739448
Is this your homework
>>
>>58739454
A 20k line class? No the solution of the problem is not partial class.

>Code monkeys will always code monkey.
>>
>>58739434
4chan
>>
>>58738505
>made some good friends with chinese girls but they're girls afterall and it doesn't last long

What are you gay or something?
>>
>>58739486
>A 20k line class?
Well yeah, i'm working on a GUI application and alot of things are handled in the GUI thread, alot of small things, when it's a bit more time consuming i assign the work to a separate thread.
>>
>>58739400
I didn't say it's impossible. I said it makes absolutely no sense.
I have never seen a company do deployment through a central script.

They always had properly setup CI servers with individual build-jobs for both different environments (test, quality, production) and projects.
>>
>>58739464
fizzbuzz is a major homework assignment
>>
>>58739448
#include <fizzbuzz.h>
#include <studio.h>

int main (void) {
int fizzbuzz_counter, i;
for (i = 1; i < 101; i++)
if (fizzbuzz(i)) fizzbuzz_counter++;
printf (Fizzbuzz was printed %d times", fizzbuzz_counter);
}
>>
>>58739526
No. Don't insist. There is no justification of a 20k line class.
>more time consuming i assign the work to a separate thread.
Everything that can block must be done in a separate thread. Everything.
>>
>>58739526
>20k lines of GUI
How do codemonkeys keep up with this? Don't they find their life boring and uninteresting?
>>
>>58739432
So kind of my approach but with more neat lambdas.

Better than the original code anyways.
>>
>>58739527
Yep, that's exactly how it works, but the logging config files are hard coded by some ancestor job. Hence me digging through the scripts to change the logging configs.
>>
>>58739549
There are just too many niche functions that don't really fit together or work together like that, most of them do one job that noother function does.

Where would i do with all those functions? They can't be grouped together as that would just obscure them even further.

>>58739553
What's the joke?
>>
>>58739604
You're a fucking filthy code monkey. You should not be allowed to code.
>>
>>58738673
>if i give them access to it and they run it, would the .bat file try to run from their local machine or on the server? i need it to run on the server

That depends on if they log onto the server then run it, or if they access the file from another machine.

When you say give them access, do you mean permission to access the file or permission to execute the file?
>>
>>58739292
How would you handle it to write out how much of each character is in the string?
>>
>>58738673
ssh or whatever the windows equivalent of that is
>>
>>58739619
That's rude kiddo.
>>
>>58739647
Yes. It's called reality.
>>
>>58739632
Well, that's a whole different requirement. It would be a function, a given string and character, a for loop that calls IndexOf() on the string for the given character until it eventually return -1;
You'd update the start-index with the previous result of the call and run a counter throughout the loop.

That's it.

But that's not what the guy wanted.
>>
>>58739640
Telnet would be the windows equivalent.
>>
>>58739601
That's weird. I am used to project-specific configuration files that are checked in and maintained with the project itself.
Including logging properties.
>>
New thread:

>>58739732
>>58739732
>>58739732
>>
>>58739432
>using 2 loops to check if the characters exist in the other string, and then find them in another loop
that's stupid

for (int i = 0; i < input.Lenght; i++)
{
if (Array.IndexOf(characters, input[i]) != -1)
Console.WriteLine("Found char {0} at pos {1}", input[i], i);
else if (i == input.Length - 1) // Last one
Console.WriteLine("No matches found.");
}
>>
>>58739640
We still don't know what the bat files needs access to. Hopeful it's not some terrible scenario where he needs to give regular users admin privileges.

I'd hope he's referring to a bat file that can be run from individual user accounts on the server, accounts that dipshit users can graphically log into remotely.
>>
>>58739755
shit I fucked that one up

int matches = 0;

for (int i = 0; i < input.Lenght; i++)
{
if (Array.IndexOf(characters, input[i]) != -1)
Console.WriteLine("{2}. Found char {0} at pos {1}", input[i], i, ++matches);
}

if (matches == 0)
Console.WriteLine("No matches found");
>>
>>58739730
The idea of different projects is relatively new to the company. Historically we had exactly one massive project (lovingly referred to as 'The Monolith'). We've finally started moving to service oriented architecture and there's a lot of work to be done.

This is legacy code and when it was written it was best practice to just cram stuff together.
>>
>>58739755
>>58739795
Either don't work.
>>
>>58739936
static void FindCharactersAndInformUserOfTheirBullshit(string input, IEnumerable<char> characters)
{
var chars = characters as char[] ?? characters.ToArray();

if (input.IndexOfAny(chars) == -1)
{
Console.WriteLine("The string contains none of the supplied characters.");
return;
}

for (int i = 0; i < input.Length; i++)
{
if (chars.Contains(input[i]))
Console.WriteLine($"Found char {input[i]} at {i}.");
}
}
>>
>>58739524
i'm not gay

i befriend girls for the romantic attraction

we usually do end up liking each other but i want to stay friends so i stay alone

it's a vicious cycle
>>
>>58738505
>>58738386
>>58738356

The first thing you must do to turn your life around is stop reddit spacing.
Thread posts: 320
Thread images: 37


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