[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: 315
Thread images: 38

File: 7wxfrw3xvnkz.png (190KB, 500x700px) Image search: [Google]
7wxfrw3xvnkz.png
190KB, 500x700px
What are you working on?

Old thread: >>62308764
>>
>>62318054
First for lambda ladies!
http://www.lambdaladies.com
>>
I'm too tired to do any programming, so I'm reading the SBT getting started guide.
>>
>>62318054
So many qts in the office today
>>
>>62318072
>tfw no qt functional programing gf
can we all agree that affirmative action is worth it for this goal?
>>
Rust or D?
>>
>>62318105
>can we
no
>>
>>62318126
julia tbqh
>>
>>62318126
The one without GC.
>>
https://functionalcs.github.io/curriculum/#org2c45041
is this a good ressource for newfags?
>>
>>62318105
I'd love to have female colleagues, but I don't want to work harder.I should have become a nurse, not a programmer. Most people find their mates at work or school, so you really are fucked if you're a programmer and don't already have a gf.
>>
What are your opinions on Java vs C# for web or desktop development?
>>
>>62318126
Rust ofc, but even if you can afford a language with GC, D wouldn't be the best choice.
>>
>>62318168
C# is good for both. Java sucks ass.
>>
>>62318168
Why would you want to?
>>
>>62318168
Java is good for both. C# sucks ass.
>>
>>62318197
Lambda calculus is good for both. Java and C# suck ass.
>>
Why do I always want to kms when webdevving
I like programming
>>
>>62318168
Java is like C# from 15 years ago but shittier.
>>
>>62318206
Maybe you're depressed.
>>
>>62318168
Java is very capable for web and desktop development. I'm not a C# guy, so I cannot comment on that.
>>
>>62318206
https://jaspervdj.be/hakyll/
>>
http://bounceapp.com/116414

what are your thoughts /dpt/ ?
>>
>>62318359
macton is a dick
>>
I just can't handle different formatting styles.
How do I cure autism?
>>
>>62318206
Because webdevelopment is complete arse.
>>
>>62318216
C# is like Java but with a bunch of needless shit sprinkled on top.
>>
>>62318391
>auto_ptr
>>
File: 150314124341.gif (1MB, 500x281px) Image search: [Google]
150314124341.gif
1MB, 500x281px
>shit thread and shit op
That's what you get when you don't post anime
>>
>>62318420
I noted that too. It's probably an old example.
>>
>>62318391
kill your self please, I almost vomited
>>
File: 1504833116867.jpg (38KB, 792x612px) Image search: [Google]
1504833116867.jpg
38KB, 792x612px
>>62318126
Neither, use a fast language
>>
>>62318126
D
>>
I finally decided to pick up Scala. Who's with me /dpt/?
>>
>>62318529
I'm so sorry
>>
>>62318497
b-b-but https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=gpp
>>
Theory question. Why is COBOL the only language in its area of application?
>>
>>62318529
I am senpai.
>>
File: file.png (2MB, 1000x769px) Image search: [Google]
file.png
2MB, 1000x769px
>>62318072
would you, /dpt/?
>>
>>62318586
It's not.
>>
>>62318586
Huge legacy codebase.
>>
>>62318497

C is not a fast language, it has fast compilers
>>
>>62318598
looks pretty grim place desu.
>>
>>62318598
>3d
nah
>>
File: rigged.png (81KB, 1907x974px) Image search: [Google]
rigged.png
81KB, 1907x974px
>>62318567
seems trust worthy
>>
How much do you need to know for a test that can determine whether you know enough to be accepted for an internship (C#)?
>>
>>62318649
It is a C++ implementation problem. Rust regex-redux is slower than C .
>>
>>62318560
Let me guess, a haskeller?
>>62318588
Man of exquisite and practical taste
>>
>>62318649
>>62318691
The c++ one use boost::regex
>>
>>62318529
At least you didn't go with java.
>>
>>62318598

The blonde in the top left and the one on the right with the headphones seem nice to be honest
>>
>>62318695
>Man of exquisite and practical taste
I don't know why people shit on Scala, but I really like it. It much more practical than Haskell and it runs on the excellent JVM.
>>
>>62318729
today i will remind them
https://www.youtube.com/watch?v=4jh94gowim0
>>
Reposting challenge from last thread: >>62314837

As another poster mentioned, this has to do with a race condition, and both of the other 2 cases will return a 0 (but not necessarily exclusively).

Bonus challenge: Can you fix that code with just 2 modifications?
>>
>>62318741
https://github.com/scalacenter/advisoryboard/blob/master/proposals/007-collections.md
>>
>>62318762
???
>>
>>62318741
What the fuck
>>
>>62318775
His problems with the collections API will be fixed in Scala 2.13.
>>
>>62318785
Thats hardly the only thing he talks about.
He basically declares Scala and its community FUBAR.
>>
Has anyone ever tried to make a real graphic language? A language where you draw graphs and functions on graphs, for instance. Something like UML diagrams, except not shitty and not made by pajeets, and actually serious.
>>
>>62318054
So I'm making a program where I need to ask the user to enter a string and each statement starts with char # and ends with char ;. There are five statements when the user enters the data. I am wanting to use String methods only to take this data in, break it into five 5 substrings and then print it out as five individual sentences.

I currently have something like

String s = sc.nextLine();
s1 =s.substring(s.indexOf("*"),s.indexOf(";"));
s2 =s.substring(s.indexOf("*"),s.indexOf(";"));

this prints out a string out of bounds error. Now I know where the string ends whenever I enter a statement and I can enter that value to make the total string fit. However, I thought that something like

s2 =s.substring(s.indexOf("*")+s.length(),s.indexOf(";")+s.length());

would work but it doesn't. What do?
>>
>>62318800
Who cares what he says? The Scala community is still active.
C has been declared dead for years, but it's still the #2 language in the Tiobe index.
>>
>>62318817

My uneducated guess is it would involve a massive number of assumptions on the side of the interpreter, otherwise the 'code' would have to be complicated to the point of being inferior to written code. Impractical.
>>
>>62318817
Russians did it: https://en.wikipedia.org/wiki/DRAKON , they even used it in their space shuttle in the 80s. As expected, it becomes unwieldy and unmaintainable pretty fast.
>>
>>62318850
>Who cares what he says?
>Don't listen to the opinion of the top contributor of the language for over a decade has to say
sasuga scalets
I really encourage you to watch the whole thing.
>>
File: 1501420378587.jpg (42KB, 750x737px) Image search: [Google]
1501420378587.jpg
42KB, 750x737px
>>62318054
>mfw that image perfectly describes me at my new job
>>
>>62318818
>#
>*
>>
>>62318817
What is Scicos?
>>
>>62318890
I didn't mean to do that. That's not the problem.
>>
>>62318908
Then verify the documentation that indexOf and substring does exactly what you think it does then verify the return values.
>>
>>62318054
There's a word I need and can't remember. You'd use it to describe "highly non-abstracted code" or in-depth documentation. I think it begins with "o". It sometimes can be passed in to certain tools as a launch parameter to have it return highly detailed output. I'm losing my fucking mind lads.
>>
>>62318945
verbose?
>>
>>62318869
I already watched the video. The points he addresses are valid, but they're working on it.
He only mentions the weak points of Scala, but never mentions all the strong points he has. You could hold a similar session for C++ or Haskell.
>>
File: apartridgeinapeartree.jpg (130KB, 474x609px) Image search: [Google]
apartridgeinapeartree.jpg
130KB, 474x609px
>>62318965
YES! Fuck man, I was so far off thinking it started with "o". Thank you so much, been trying to remember it and google it for a good 20 minutes.
>>
>>62318598
so many 3-5 in one place
>>
Anyone here familiar with SQLcipher?
>>
>>62318602
Except it is, retard.
>>
>>62318598
A casual meet up of male fans of FP would look much worse.
>>
>>62318054
>>
File: 1503767041180.jpg (76KB, 750x1076px) Image search: [Google]
1503767041180.jpg
76KB, 750x1076px
>>62318054
>>
File: itblinks.mov.converted.webm (510KB, 1280x720px) Image search: [Google]
itblinks.mov.converted.webm
510KB, 1280x720px
>>62318054
>What are you working on?
Working on some OS tutorial from cambridge for the raspberry:
https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/

Lesson 2 done now. LED is blinking. Goal would be a forth interpreter, not sure if I will ever get there, but we'll see.
>>
>>62318598
Nah, not a python fan.
>>
in C if I want to fill an array inside a function and I don't know how many elements it will be filled with do I have to put a number in [] that is largest expected amount of elements when declaring the array?
>>
Reminder that the people hating on C++ are brainlets who can't wrap their heads around it.
>>
>>62319519
If you're using C99 you can use a variable length array.
void foo(size_t n)
{
int arr[n];
}


>>62319538
Nobody can wrap their heads around all of C++.
>>
>>62318851
I don't think it would involve many assumptions. What I'm thinking of could, at its core, be written as a frontend emitting some "normal" language's code.

>>62318854
>>62318894
Thanks anons, the russian one looks really neat. I think graphical programming is a very underestimated area.
>>
Why does a cheesy wave of stank hit my nose when I peel back my foreskin?
>>
If I study computer engineer and the courses are about hardware design, how well do I need to know about the physics under it?
>>
File: meldyva-1.png (6KB, 333x293px) Image search: [Google]
meldyva-1.png
6KB, 333x293px
>>62319594
>(s)he has foreskin
>>
Reminder that C++ is faster than Java, Rust, Go and your favorite shitlang and, despite being fully-featured, doesn't rape you with its memory footprint.
>>
What is the easiest way to do basic reverse engineering? API monitor (rohitab) does basically all I want but I want to be able to issue API calls, not just modify them before execution. Do I have to bite the bullet and learn ollydbg/ida pro, or is there something I'm missing?
Note: basic reverse engineering
>>
>>62319621
I'm Jewish but my parents never had me circumcised. Feels pretty good, tbqh.
>>
>>62319519
Yes.
>>
>>62319609
Not sure about CE, I just started SC and so far the only part of physics they expect me to know is electric field stuff and and circuits. But the courses started with brief repetition of high-school stuff anyway
>>
>>62319609
How is this related to technology?
>>
>>62319655
C isn't a shitlang.
>>
>>62319571
Segway was developed with Scicos.
>>
>>62319594
Wash your fucking foreskin.
>>62319609
Probably not much.
>>62319621
>(((he))) doesn't have foreskin
>>62319631
Reminder that C is faster than C++, Java, Rust, Go and your favorite shitlang and, despite being fully-featured, doesn't rape you with its memory footprint.
>>
>>62319655
C++ can be faster than C. It depends on how you write it.
>>
>>62319661
>>62319655
Yeah was just wondering should I start reading some old stuff to refresh my memory but the courses seems be stuff like using vhdl and other higher level stuff.
>>
Should I learn C or C++ if I want a job?
>>
>>62319747
Learn C++ if you want a job. Learn C if you just want to fuck around.
>>
>>62319644
Bump.
How hard is it to learn the basic usage of ollydbg? I have some knowledge of assembly, I know approximately what the instructions do and so but I can't look at a dissasembly and instantly tell what it does.
>>
>>62318054
Learning Haskell... Still waiting to get to the "Control Flow" part / filtering so I can start re-doing Project Euler exercises
>>
>>62319668
So what you're telling me is that using Scicos leads to useless products?
>>
>>62319747
Depends what you want a job in.
>>
>>62319747
C xor C++

C++ will pollute your understanding of C, and C will make you hate C++ too much to use it at your job
>>
>>62319882
If you know C++ and don't know C, you're a really lousy C programmer.
>>
>>62319929
*C++ programmer
>>
What's the latest piece of programming educational content you consumed? Regardless of how good or how awful it is.
>>
>>62319747

C/C++ is dying and will be dead in the next 3 - 5 years. Learn Rust
>>
>>62319953
>C/C++ dying
2/10 bait
Apply yourself
>>
>>62319747
Either is fine. C++ is used more broadly.
With C you'll be impossible to replace and you'll get the reputation of being a being of arcane origin at the company. During meetings when you say things everyone shuts up and accept it as truth.

That's my experience. Of course you also have the brats who come in and don't understand anything who consider what you do unimportant because everything they do rest on your work so indirectly.
>>
>haven't programmed a single line for over two months
>feel the urge to do some programming
>decide to figure out how to use ENet and make a simple multiplayer game with it
>setup project and look at tutorial code
>not immediately obvious how it works
>go do something else
God I hate days like this. I don't even want to do anything, but I hate doing nothing.
And I'm all out of drugs too.
>>
>>62319953
>C/C++ is dying
Are you retarded?
>>
File: 1500743354065.png (61KB, 1354x889px) Image search: [Google]
1500743354065.png
61KB, 1354x889px
>array stacks
>pop
>push
I just don't fucking get it
>>
>>62319988
>>62320138

You guys are right, it's not even dying. It's already dead.
>>
The only solution is to be a polyglot and understand the meta. Don't box yourself into one framework, language, or even "paradigm," whatever the fuck that means.
>>
Is there anyone who has left the cult of emacs or vim? I have been using emacs since my sophomore year of college, and I can't imagine trying to program in anything else. That said, I just wish I could be normal and use Sublime or Atom like everyone else. I will even reject a high paying job if it requires me to use Windows or an IDE.
>>
>>62320145
What's not to understand?
>>
>>62320145
void * beg
uint64_t size
void * end
>>
>>62319953
What is C/C++? Is it some new language?
>>
File: WeatEj0.png (42KB, 407x184px) Image search: [Google]
WeatEj0.png
42KB, 407x184px
>>62318054
I'm learning c and this has came up in the book can anyone help me understand this please
>>
File: 1483928241275.png (243KB, 690x709px) Image search: [Google]
1483928241275.png
243KB, 690x709px
>>62319621
im actually getting circumcised in a few weeks, thanks for helping me remember
>>
File: 1490030142213.png (24KB, 657x525px) Image search: [Google]
1490030142213.png
24KB, 657x525px
>>62320174
If I pop as stack I just don't see how previous element moves up to the top, same with push
>>
>>62320171
10% of people who use emacs or Vim actually program anything of significance.
The other 90% are people like you, who use them because they think they're supposed to.

At the end of the day, going full corporate Visual Studio on Windows is very functional and requires less fuss when it comes to collaborating with other humans.
>>
>>62320196
I remember this from first semester Discrete. What don't you get? In C, it's idiomatic to use a goto.
>>
>>62320200
I don't even understand your statement..
>>
>>62320206
i cant wrap my head around what it means could you psuedo code it for me?? i've been trying to do it for an hour and i cant make sense of it
>>
if i made a linked list in a function and returned the lead node, would C fuck up the data like it would if i only returned the first element of an array and used pointer math to move around it?
>>
>>62320243
nigga that is pseudo code
>>
In Spring Boot, how do I properly validate GET parameters?

It's two dates, one is the start and the other is the end date as strings. How do I handle parsing and other logical exceptions without resorting to this:

String dateFormat = "dd-MM-yyyy";
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(dateFormat);
LocalDate startDate;
LocalDate endDate;

try {
startDate = LocalDate.parse(start, dateTimeFormatter);
} catch (DateTimeParseException e) {
throw new InputValidationException("Invalid date format: " + start + " - must be " + dateFormat + ".");
}

try {
endDate = LocalDate.parse(end, dateTimeFormatter);
} catch (DateTimeParseException e) {
throw new InputValidationException("Invalid date format: " + end + " - must be " + dateFormat + ".");
}

if (endDate.isBefore(startDate)) {
throw new InputValidationException("End date cannot be before start date");
}
>>
>>62320202
I wish you could know what software I work on for my job, but it would give away my identity and people would find out I'm a racist 4chan nazi. That said, I can guarantee you're using it indirectly right now. You have probably never done anything significant though.

I don't see what a text editor has to do with collaboration. VS is only good for collaborating with people using VS, and I write multi-platform software with people on other parts of the world.
>>
>>62320259
Pseudo code is a term pseudo intellectuals use
>>
>>62320200
When you pop, the "top" pointer is moved to the previous element?
>>
Is computer science important for a software engineer?
>>
>>62320304
If you want to be a good software engineer, yes. If you want to be a javascript user experience artisan, no
>>
>>62320304
no.
CS teaches as much as woman's studies.
>>
>>62320325
>CS teaches
are you retarded? Computer Science doesn't "teach" anything, it's a branch of mathematics.
>>
>>62320324
why in gods name should I need to know about travelling autist to be a good software engineer
>>
>>62320325
t. brainel who couldn't pass calc
>>
Is there any reverse engineering general? Or is this the appropriate place?
>>
>>62320340
It's not. That's like saying "Biology is a branch of mathematics"
>>
>>62320348
What do you want to reverse engineer
>>
>>62320343
do you remember the kid in 7th grade math class who used to cry because he didn't think he'd ever use basic algebra in real life? that's you. learning how to write proper algorithms and think recursively will let you... write proper algorithms and think recursively.

>>62320361
computer science is the study of algorithms
>>
>>62320345
t. Computer artisan
If i want a real degree ill do EE.
>>
>>62320363
I have a DLL in OllyDbg. I want to call an export. As arguments, I get some memory buffers the address of which I can pass to the export. Is there any way to specify a value to pass directly to the export instead of a pointer?
>>
>>62318818
>s2=s.substring(s.indexOf("*")+s.length(),s.indexOf(";")+s.length());
Well this of course causes an out of bounds exception, because you take the actual length of the string and add a value to it.

Your first approach won't work because String.indexOf(char ch) will allways give you the index of the first match of ch. You could possibly wrap it arround some how, but i would make use of String.split(String regex). This would look like this:

String[] sentences = s.split(";");

This way, you can leave the # delimiter away, but if you somehow can't leave it away just do:
sentences[n].substring(1)
to cut of the #
>>
>>62320388
EE is a different field
>>
>>62320465
>EE can't be applied to computers
>>
>>62318206
why not learn how to code a language to make you not wanna kms when webdevving
>>
>>62320477
1+1 can be applied to computers, does that make gender studies related to CS?
>>
>>62320530
You are a true autist.
>>
>>62320477

You will rarely go near a conventional computer in EE. Computer Engineering is typically a combo of CS and EE. Which I think is the best way to go anyway.
>>
>>62320197
why
>>
>>62320477
>>62320548
There is no chance that you are older than 18.
>>
>>62320741
you would be wrong
>>
>>62320667
https://en.wikipedia.org/wiki/Phimosis
>>
What is your preferred debugger? why?
>>
>>62320764
enjoy your pain
>>
>>62320783
I only write perfect code so I don't need a debugger.
>>
>>62320783
vstudio debugger is the comfiest
>>
>>62318391
Don't use auto_ptr, it's not reliable...
>>
>>62320783
trial and error
I'm an imperfect man
>>
File: kimoi.jpg (101KB, 972x611px) Image search: [Google]
kimoi.jpg
101KB, 972x611px
>>62320838
>vstudio
>>
>>62320404
>I want to call an export.
Manually from OllyDbg or in a piece of code in another program?
>>
>>62320909
Manually from OllyDbg, I have a loose DLL.
>>
>>62319116
It's not.
>>
>>62320909
Never mind, it seems OllyDbg doesn't work on 64-bit windows.
>>
File: baremetal.mov.converted.webm (353KB, 1280x720px) Image search: [Google]
baremetal.mov.converted.webm
353KB, 1280x720px
Got a blinking LED on bare metal using asm
>>
>>62320973
gz lad
>>
File: picrelated.png (196KB, 960x1056px) Image search: [Google]
picrelated.png
196KB, 960x1056px
>>62320973
pic related
>>
>>62320973
i'm writing some go assembly right now
>>
>>62320992
Good job, Hans.
>>
Wow clojure is p cool
>>
>>62320992
gj anon
>>
>>62320200
When you pop, the pointer to the first element gets a ++1.
>>
>>62321049
no, it's a fake lisp trying to ride on other languages' coattails
>>
>>62320171
it could be worse, you could be forced to program in notepad.exe. this has happened to me and it's quite the adventure
>>
>>62320783
VS

locals/autos/watch windows, editing on the fly, conditional breakpoints

pretty comfy
>>
File: 1371821184595.png (400KB, 825x713px) Image search: [Google]
1371821184595.png
400KB, 825x713px
Hello. I just began reading SICP. Is there a place on the Internet I can submit my answers for review? I know I can compare answers, but some of the problems have many different ways of coming up with a correct solution. I can't go to school due to circumstances.
>>
>>62321149
>>>/g/dpt
>>
>>62321149
Here or some related IRC channel.
>>
>>62320962
>64bit
Try https://x64dbg.com
Not the best, but it works. Not the same as Olly, though I reckon there was a fork with x64 compat.
>>
>>62320108
Same here man :/ and I'm taking Computer Architecture next semester
>>
>>62321228
Yes, I'm using it now.
>>
>>62321313
wow congrats are you taking data structures 101 next? are you going to learn what a pointer is?

fucking undergraduates, get the hell out of my dpt
>>
>>62321183
>>62321199
Thank you. Here is what I have for exercise 1.3. I admit I wasn't expecting such a difficult problem in the very first lesson.

(define (square x)
(* x x))

(define (large a b c)
(cond ((and (> a b) (> a c)) a)
((and (> b a) (> b c)) b)
((and (> c a) (> c b)) c)))

(define (middle a b c)
(cond ((or (and (> a b) (< a c)) (and (< a b) (> a c))) a)
((or (and (> b a) (< b c)) (and (< b a) (> b c))) b)
(else c)))

(define (sum-of-greater-squares large middle)
(+ (square large) (square middle)))
>>
How do you tell if a language is a shitlang?
>>
>>62321630
If it's dynamically typed, it's a shitlang.
>>
>>62321630
Go to a starbucks and see what programming language the hipsters are using on their macbooks.
>>
>>62318497
C++ is so dense that you might as well have to see the invisible to use it, though.
>>
>>62321630
If you have trouble parsing syntax you see either due to verbosity or lack of verbosity.
>>
>>62321569
what if

(define (ex13 a b c)
(if (> a b)
(sum-of-squares a (max b c))
(sum-of-squares b (max a c))))
>>
>>62321630
If a language is dynamically typed, automatically shitlang (excluding languages like lisp that have exceptional qualities that make up for their lack of typing)

Other that that, you gotta try writing a moderately sized project in them.
>>
>>62321630
If there is at least one person in the world who gets paid to write in it, you can be sure it's a shitlang
>>
>>62321630
The more parentheses it uses the shittier it is.
>>
>>62321700
>that have exceptional qualities that make up for their lack of typing
Like what exactly? I love that lisplets actually think Lisp is somehow above all the other dynamic trash.
>>
>>62321718
muh metaprogramming

it's the only thing that stops Lisp from slipping into complete obscurity
>>
File: code.png (19KB, 367x776px) Image search: [Google]
code.png
19KB, 367x776px
>>62321691
>C++ is dense
>>
>>62321732
Yeah i pretty much expect this because its always the same answer they give.
>ah yes i love using a useless lang to make more useless langs
>>
File: understanding c++.png (116KB, 584x346px) Image search: [Google]
understanding c++.png
116KB, 584x346px
>>62321743
It can be.
>not mentioned: macros, function pointers
>>
I have enabled all GCC -W flags and my code works but I still think there may be a bug somewhere, what are good tools to use?

I am not using malloc() btw
>>
Order these languages from best to worst.
>JavaScript
>Lua
>Python
>>
>>62321774
Python > Lua > JavaScript
>>
File: 1468989189170.jpg (28KB, 375x411px) Image search: [Google]
1468989189170.jpg
28KB, 375x411px
>>62321743
>posts what could pass for all the world as C if it weren't for the Doom 3 API calls
>>
>>62321784
Is it C++ or is it not?
>>
>>62321774
You're probably baiting but in 2017 js is objectively the best
>>
>>62321743
>aligning variable declarations
what the fuck is wrong with you?
>>
>>62321774
piss > vomit > diarrhea
>>
>>62321569
SICP is indeed very difficult. Especially when you're new to Scheme.
You can format your code using [.code] [/.code] (remove the dot) tags.
>>
Learning Haskell and pretty sure I'm writing shit code... Thoughts?
-- Building Functions

{--
Using "take and drop", see if you can write a function called rvrs that
takes in the string "Curry is Awesome" and returns "Awesome is Curry"

(Note, don't generalize this for any arbitrary string... Only for the
string literal "Curry is Awesome")

--}

substr :: String -> Int -> Int -> String
substr str init end = take (end - init) (drop init str)

rvrs :: String
rvrs = end ++ " " ++ mid ++ " " ++ begin
where main_str = "Curry is Awesome"
begin = substr main_str 0 5
mid = substr main_str 6 8
end = substr main_str 9 16
>>
Thoughts on this tasty meme that was posted in my senior year CS class chat?
>>
>>62321808
Which one is piss?
>>
>>62321698
I'm not allowed to use max yet. I know alternate solutions to 1.3 exist, but for now I just want to check if my own answer is correct.

>>62321809
Oh really? Testing.

(define (square x)
(* x x))

(define (large a b c)
(cond ((and (> a b) (> a c)) a)
((and (> b a) (> b c)) b)
((and (> c a) (> c b)) c)))

(define (middle a b c)
(cond ((or (and (> a b) (< a c)) (and (< a b) (> a c))) a)
((or (and (> b a) (< b c)) (and (< b a) (> b c))) b)
(else c)))

(define (sum-of-greater-squares large middle)
(+ (square large) (square middle)))
>>
>>62321774
JavaScript > Python > Lua

Learn lua if you want to make shitty games on roblox or make love2d games.
>>
>>62321802
>1 + "1" = "11"
>>
>>62321850
Standard pseudocode uses either := or <- for variable definitions, so whoever posted that is retarded.
>>
>>62321698
max hasn't been introduced yet so you'd need to include helper functions.
>>
>>62321850
block scoping >>>>> function scoping
scoping without declarations is hellish
>>
>>62321883
what if

(define (my-max a b)
(if (> a b) a b))

(define (ex13 a b c)
(if (> a b)
(sum-of-squares a (my-max b c))
(sum-of-squares b (my-max a c))))
>>
>>62320361
Have a look:
https://youtu.be/2Op3QLzMgSY
>>
File: wat.jpg (59KB, 437x431px) Image search: [Google]
wat.jpg
59KB, 437x431px
>>62321881
>Standard pseudocode
>>
extern getpid
extern printf

SECTION .data

_formatStr:
db '%s', 0


SECTION .text

global _start
_start:
call getpid
mov rsi, rax
lea rdi, [_formatStr]
call printf
jmp $


Why does this segfault?
>>
>>62321880
>moooom, I don't wanna learn a realworld language and it's quirks
>>
>>62321935
>realworld
>it's
If you want to learn a real world language, start with English.
>>
>>62321935
>realworld language
nice meme
>>
>>62321838
there's nothing wrong with this code, but if you look at this:

end ++ " " ++ mid ++ " " ++ begin

why not use concat?

concat [end, " ", mid, " ", begin]

and then look - they're all separated by spaces.
there's a function that does this - unwords -

unwords [end, mid, begin]

this bit is fine but could be even better
begin = substr main_str 0 5
mid = substr main_str 6 8
end = substr main_str 9 16

substrPair s (i,j) = substr s i j
-- substrPair = uncurry . substr

[begin, mid, end] = map substrPair main_str [(0,5), (6,8), (9,16)]
>>
>>62321949
whoops, map (substrPair main_str) [...
>>
>>62321919
It means anon is a retard. Pseudocode standards (of which there are many) are devoid of syntax and only express general principles for the communication you wish you achieve with pseudocode.
Example:
http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html
Its a waste of time learning this stuff because anyone worth communicating with will have a language in common with you or will have good enough communication skills to express themselves clearly.
>>
File: 1476386178497.png (98KB, 612x491px) Image search: [Google]
1476386178497.png
98KB, 612x491px
How do i get Vim to indent properly for haskell files
>>
>>62321932
>why does coercing a pid to a string pointer segfault?
>>
>>62322033
dont use vim desu
>>
>>62321949
Thanks!! The second one works pretty well.
I'm not entirely sure what the third one does, but I think I'll get it soon enough.
>>
>>62322053
Oh fuck. I'm retarded.
>>
>>62322056
Whats a good editor that just werks for haskell
>>
>>62322033
gg=G
>>
>>62322068
VS Code, desu.
>>
>>62322062
basically, rather than 3 individual binds of (substr main_str x y) where x and y change, instead think of it like this

you have a list of x and ys and want to turn them into a list of substrings at the relevant x and y indices

sub' (i,j) = substr main_str i j
-- this is actually just
-- sub' = uncurry (substr main_str)
xs = map sub' [(x1,y1), (x2,y2), (x3,y3)]

you know that you're putting 3 tuples in and getting 3 strings out, so you can just bind them using pattern matching

[begin, middle, end] = map sub' [...

which is equivalent to

[begin, middle, end] = [substr main_str x1 y1, substr main_str x2 y2, substr main_str x3 y3]
which is equivalent to doing the three bindings separately (since they're all the same type and can fit in 1 list)
>>
>>62322068
Visual studio code
>>
taking in a string from the user and I need to break each sentence into a variable to store. Each sentence in the string ends with ';' and has a indicating word to begin the sentence. I can easily create variables to find each indicating word in the string but I can't do that for the semicolons. I need to print out each sentence without the indicating word and the semicolon

ex:
123 I am programming;
to
I am programming

Whenever I use substrings and indexes to find the semicolon after the first one, I get out of bounds errors.
>>
extern _exit
extern getpid
extern printf

SECTION .data
f:
db '%d', 10, 0

SECTION .text

global _start
_start:
call getpid

lea rdi, [f]
mov esi, eax
call printf

xor eax, eax
call _exit


ld scratch.o -lc -I /lib64/ld-linux-x86-64.so.2


Now I'm not being retarded, can anyone think of a way to make this program smaller/faster. 3kB for this kind of shitty tiny fucking program is fucking retarded.
>>
>>62322086
>>62322164
thanks
>>
>>62322287
you can cheat and just shorten the length by one.
Or you can learn regex.
>>
>>62318054
>what are you working on
A neural network to compete with google on the captcha. Using only my own input.

It's quite OK. Their goals are higher since they're clearly aiming for self-driving cars and I'm just aiming to see if I can pick a 9bit number.
And of course I'd never have it fill captcha for me here on 4chan, mods.
>>
>>62322307
strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag --remove-section=.jcr --remove-section=.got.plt --remove-section=.eh_frame --remove-section=.eh_frame_ptr --remove-section=.eh_frame_hdr .


I think gcc puts that in objects and libraries it compiles always
>>
>>62321114
>trying to ride on other languages' coattails
Explain? I don't know what you mean but I'm not versed in languages
>>
File: 1463364999713.jpg (59KB, 268x237px) Image search: [Google]
1463364999713.jpg
59KB, 268x237px
Employed Haskell programmer reporting in
>>
>>62322648
I would like fries with that.
>>
>>62322347
What do you mean shorten the length by one?
>>
File: 1504907329535.jpg (17KB, 559x556px) Image search: [Google]
1504907329535.jpg
17KB, 559x556px
>>62322719
>>
>>62322777
Im pretty sure i read it wrong
but if youre only giving one sentence at a time
then you can just drop the length by one if all sentences have to end with ;.
But im pretty sure this is a regex parsing exercise, so it wont work with multiple sentences.
>>
>>62322719
This post is humorous because it implies that while the person being replied to may actually be a Haskell programmer, and also employed, they are likely employed in a position that does not use Haskell in any capacity.

Furthermore, the implication of fast-food implies that Haskell is incredibly time-consuming, leaving no time to learn other useful skills that would warrant a job beyond low-skill labor.

Very nice post, I'll give it an 8/10.
>>
>>62322287
You're writing a language aren't you
>>
>>62322835
I did a chip-8 interpreter over a weekend last summer. Fun project. For my next emulator project I'm probably going to try the NES.
>>
>>62321769
assert
>>
>>62322835
>each address is at least 4 bytes
>12 bits => 4 bytes
What are you smoking son? It's 2 bytes.
>>
>>62322948

It says there that on a 48 bytes stack, you can store 24 addresses, yet an address is atleast 4 bytes...
addresses are from 0x200 to 0xFFF
>>
>>62322831
Were not even supposed to use regex stuff. Or loops.or arrays. This is apparently incredibly simple stuff here but it's so simple it's hard
>>
>>62322287
You should write a tokenizer and have all your problems go away.
>>
>>62322835
Isn't 0x000 to 0xFFF addressable with 2 bytes?
>>
>>62323008
>Were not even supposed to use regex stuff. Or loops.or arrays.
Then i guess they want you to use case switches given you have X amount of matching words? That's still pretty silly.
>>
>>62323054
Why don't you use a 16-bit type for the address?
>>
>>62323043
Nah string methods only it's extremely silly
>>
>>62323148

thank's for clarifications, I mixed the data types
>>
Hello, /dpt/
Any good ideas for github filling projects?
Gonna start looking for interships soon and want to make sure I'm covered, but I'm running out of project ideas.
>>
What is a good testing framework for C?
>>
>>62323167
What language? If C, it could be that you're supposed to use strchr and strrchr.
>>
>>62323230
I actually know of one that would look good. A program to transfer files between two computers. Use Socket API. make sure firewall isn't blocking it
>>
>>62323244
valgrind's nice. but you can put your tests in your makefile
>>
>>62323309
Is Check good?
https://github.com/libcheck/check

How would I write tests cases in a Makefile?
>>
>>62323244
>>62323309
>>62323323
I should probably say unit testing.
>>
If I want to make anything that requires connection to internet. Like an online game, or an app with constant online connection what kind of tools and knowledge do I need besides the language I'm programming with?

How do I connect my program to the web? Any good literature on that topic?
>>
I have a program written in C/C++. When I run the program, I can type all sorts of characters. When the program ends, the screen clears and all of those characters I typed are lined up on the command line as if I had written it after the program ran. This happens even if my program disables echoing.
>Question
How do I stop this? I'm writing a console game, and having a thousand lines of the characters the user entered echoed once the program closes is ridiculous.
>>
>>62323292
Java
>>
>>62323299
Hey that's actually pretty cool and I actually need to practice socket and networks. Thanks anon!
>>
>>62323418
nvm fixed
#include <termios.h>
#include <unistd.h>
// ...
tcflush(STDIN_FILENO, TCIFLUSH);
// ...

now to find a way to just disable writing user input to std::cin so i can just use X11 libs to check if a key is pressed...
>>
>>62323230
Depends where you want to work, of course. What field do you want to put on your resume?
>>62323418
>>62323590
Aren't you supposed to read stdin and discard it? You could have it as a cleanup at the end, attach to stdin and read until there's nothing left.
>>
>>62318054
react redux, fuck you faggot.
>>
>>62323603
i don't want a user of my library to have to worry about manually flushing stdin when they're not even using it in the first place. oh well, i could just clear it at the end or whenever i request string input. also
std::cin >> std::flush;

works, tee hee.
>>
>>62323603
>Depends where you want to work, of course. What field do you want to put on your resume?

I love anything fintech or game related, so naturally my projects end up towards these particular areas, but we can't really choose much with internships around here, so pretty much anything paying would be fine.
This is also why I'm trying to at least cover the basics of everything, and if required, perfect it later.
>>
>>62323715
Contribute to libtorrent/ipfs for low level p2p networking etc
Make some web application, also could give you some web design points if you're really desperate
Contribute to some of the meme cryptocurrencies for "blockchain technology"
>>
In C++, is it possible to switch over two objects?

 switch (a, b) {
case a == 13 && b == 17: //
}
>>
Can anybody recommend a black-as-my-soul editor that is not terminal based, atom or spyware? I'm using geany right know and I could really make use of a black theme in my dimly lit room.
>>
>>62323811
no
>>
>>62323837
You could just get a theme for your current editor.
>>
>>62323850
I tried to set another theme but I couldn't find an option for it.
>>
File: Screenshot_20170909_105438.png (208KB, 1920x1080px) Image search: [Google]
Screenshot_20170909_105438.png
208KB, 1920x1080px
>>62323837
I recommend dark-pastels
>>
>>62323942
What happened to your diamond dick for Rust?
>>
File: Screenshot_20170909_105906.png (340KB, 1920x1080px) Image search: [Google]
Screenshot_20170909_105906.png
340KB, 1920x1080px
>>62323965
What did he mean by this?
>>
>>62323942
>>62323996
What font is this? Are those -> signs?
>>
>>62324050
Fira code. Yes, these are called ligatures, some fonts and editors have this feature.
>>
I've been working on a Python program, /g/. Tell me what you think.

Paris = [2229621]
Niggas = ["Kanye", "Jay-Z"]
Paris.append(Niggas)
Niggas in Paris
>>
>>62324257
Type inference in python is cancerous
>>
What's your opinion on this Danish gnome?
>>
>>62324271
Agreed. Not to mention the whole interpreted language thing should just fucking die. I shouldn't have to wait 4 hours during an integration test for a long running script to hit the one missing comma in line 41483
>>
>>62324351
Ultimate beta for letting his language become what it is.
>>
File: a.jpg (11KB, 288x216px) Image search: [Google]
a.jpg
11KB, 288x216px
>>62324271
Did I ask for your fucking onion
>>
>>62324372
dumb mobile poster
>>
>>62324351
Made a language with terrible ideas and the industry has been trying to recover ever since.
>>62324367
What are you talking about? C++ has only gotten better. But it started out in the gutter so I forgive you for being confused.
>>
>>62324372
Actually you did
>>
>>62324395
>C++ has only gotten better.
Some gold on a pile of shit is still just a shiny pile of shit, lad.
>>
File: ~2016-02-07-808469 (1).jpg (1MB, 2507x1689px) Image search: [Google]
~2016-02-07-808469 (1).jpg
1MB, 2507x1689px
How do you program a loli?
>>
File: C++.png (54KB, 972x259px) Image search: [Google]
C++.png
54KB, 972x259px
>>62324351
>>
>>62324351
Bjarne is a cuck, he doesn't have any control over C++ these days. Microsoft's Herb slutter runs the show.

Otherwise concepts, modules and pattern matching would exist in C++
>>
>>62324419
With love and care.
>>
File: file.png (422KB, 645x773px) Image search: [Google]
file.png
422KB, 645x773px
>>62318054
>tfw too tired to program
>tfw too awake to go to bed
>>
>>62324388
>dumb
>mobile poster
like calling a midget short
>>
>>62324434
I have nyquil for that. Just take a shot, sleep, and hit the next day running
>>
>>62324422
C++ already fucked up its chance at UFCS, nothing can save it.
>>62324439
can never really emphasize it enough.
>>
File: Screenshot_20170909-034212~01.png (544KB, 878x884px) Image search: [Google]
Screenshot_20170909-034212~01.png
544KB, 878x884px
>>62324412
Are you damaged? That's what I said.
But implying he 'let it go' in some manner is ridiculous.
>>62324422
That's not how the committee works.

Also fuck this captcha. It always fails me when I get this. Its fucking retarded.
>>
File: 2012-05-30-503440.jpg (817KB, 1378x2076px) Image search: [Google]
2012-05-30-503440.jpg
817KB, 1378x2076px
>>62324430
But I only know C and python!
>>
New thread: >>62324489
>>
>>62324455
>i-is that healthy?

>>62324477
Use captcha v1. You can write a simple script to bruteforce the challenges with "calle calle" and to cache them.
>>
>>62324564
Not if you do it everyday, but once in a while it's nice to get a guaranteed good nights rest
Thread posts: 315
Thread images: 38


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