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

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

Thread replies: 255
Thread images: 26
File: dat boi.gif (91 KB, 312x420) Image search: [Google]
dat boi.gif
91 KB, 312x420
Previous thread: >>54671233

What are you working on, /g/?
>>
gf ai so i'm no longer lonely.
>>
O
SHIT
WADDUP
>>
WHO DAT BOI?
>>
Can someone tell me what is wrong with this? I get a segfault.

##  HEYNOW.S  ##################################################################


.section .data
# system call numbers
.equ SYS_OPEN, 5
.equ SYS_WRITE, 4
.equ SYS_READ, 3
.equ SYS_CLOSE, 6
.equ SYS_EXIT, 1

# system call interrupt
.equ LINUX_SYSCALL, 0x80

# options for open
.equ O_CREATE_WRONLY_TRUNC, 03101


# strings
outfile_name:
.ascii "./heynow.txt\0"
heynow:
.ascii "Hey diddle diddle!\n\0"
.equ SIZEOF_HEYNOW, 20


.section .bss
.lcomm OUTFILE_FD, 4


.section .text
.global _start
_start:
# open OUTFILE
movl $SYS_OPEN, %eax
movl $outfile_name, %ebx
movl $O_CREATE_WRONLY_TRUNC, %ecx
movl $0666, %edx
int $LINUX_SYSCALL
# save the file descriptor
movl %eax, OUTFILE_FD

# write to OUTFILE
movl $SYS_WRITE, %eax
movl $OUTFILE_FD, %ebx
movl $heynow, %ecx
movl $SIZEOF_HEYNOW, %edx

# close OUTFILE
movl $SYS_CLOSE, %eax
movl $OUTFILE_FD, %ebx
int $LINUX_SYSCALL

# exit
movl $0, %eax
movl $SYS_EXIT, %ebx
int $LINUX_SYSCALL
>>
I've never done any programming in my life. How could I unfuck my shit and become an employed programmer?
>>
>>54676545
https://docs.oracle.com/javase/tutorial/
>>
>>54676545
start programming.
>>
>>54676555
>>54676367 (OP)
Stop with these horrible memes.
>>
>>54676367
I love that DAT BOI meme >u<

It's so spontaneous. O SHIT WADDUP!

Sorry to bother you guys, i've never programmed in my life (does rainmeter editing count? How about editing registry stuff on win 10?) Anyways anyone have more DAT BOI?
>>
/g/, I supposedly wanted to apply for Computer Science in UC San Diego, but it seems that I applied for Mathematics - Computer Science instead
I got accepted to UC Irvine for Computer Science and UC Davis for CS as well.

I wanted pure computer science though, and I'm worried employers might take it back for Math-CS instead of just pure CS.

Thoughts/Advices?
I have ~9 days to accept my offer
math-cs http://www.math.ucsd.edu/programs/undergraduate/bs_math_comp_science.php
regular cs
http://www.cse.ucsd.edu/node/239

How much do employers care?
>>
>>54676545
become pajeet my friend. I have a CS degree and I can't get employed as a programmer.
>>
please just use Option types instead of exceptions

Exceptions are the next goto, considered harmful for most usages. It has its use, when an exceptional state is reached.
>>
>>54676626
>I have a CS degree and I can't get employed as a programmer
Have you ever considered that you're shit?
>>
>>54676634
for error handling*
>>
>>54676623
You could always just change your major, it not like you are stuck with it.
>>
>>54676634
Why not Either types?
>>
>>54676652
I am not shit
>>
>>54676694
I don't know. It sounds like you're pretty shit.
>>
File: businessman-counting-money.jpg (2 MB, 2121x1414) Image search: [Google]
businessman-counting-money.jpg
2 MB, 2121x1414
>>54676623
300k starting
>>
>>54676680
sure
>>
>>54676626
>tfw no degree
Being completely hopeless fucking sucks.
>>
File: 1426548231392.png (141 KB, 800x600) Image search: [Google]
1426548231392.png
141 KB, 800x600
>>54676626
>>
How does your editor look /g/?

I've been coding like this for about a year. Makes me chuckle.
>>
>>54676705
I am pretty sure you are the shit one my man.
>>54676715
Either types are probably better than option types when you want to return an error message
>>54676728
better than having a degree and still can't get a job
>>
>>54676652
>>54676694
>>54676705

lol how does someone even prove their not shit at coding lol your just typing words, making shit work lol like stop taking urself so seriously lol
>>
>>54676774
I really think you should leave.
>>
>>54676774
>lol
>lol
>lol
>lol
yeah, sounds like you're literally shit
>>
>>54676810
lol
>>
anyone else get drive through then eat it in the parking lot
>>
>>54676832
No, I cook my own food.

Nine times out of ten, if you can buy it drive-through, it's not worth ingesting.
>>
>>54676852
i live in a dorm and my kitchen isn't operable
apartment in August though with my pals so I can cook then
but you're right

thanks for reading my blog, please follow
>>
good book?
>>
>>54676883
Yes
>>
File: p0tRap9.png (257 KB, 640x640) Image search: [Google]
p0tRap9.png
257 KB, 640x640
>>54676603
>>
>DPT loves a Tumblr meme
Wow. Nice. I didn't know /g/ stooped to a new level.
>>
>>54676883
nigga it got a fukin dragon and whitenite on it

course it is

learn to slay that pussy
>>
>>54676917
>le tumblr boogeyman
>>
>>54676917
Half loves, half hates
same as every other meme
>>
still downloading shit off NOAA's ftp slow as FUCK
>>
WADDUP!
>>
>>54676539
x86 asm is a horrible turd
>>
File: 1442965080354.gif (476 KB, 495x495) Image search: [Google]
1442965080354.gif
476 KB, 495x495
>>54676657
It seems that it's pretty much impossible to transfer to CS internally in San Diego

I really wanted to go there though, should I just give up the school and go to Davis/Irvine for CS?

This is probably my life's worst fuck up ever.
>>
>>54677170
oh right, I forgot some schools have limits.
>>
>>54677170
Probably. You can't go wrong with either school.
>>
Thinking about using Qt as the framework for my app. Any C++ frameworks i should be looking into instead? Mainly planning on circumventing browser connection through a native client.
>>
>>54677170
>>54676623
Ah fuck it

I'm doing Math-CS, I honestly don't really care if it's more math focused. It still has many core CS courses.
I'll just hope employers/internships won't take it against me.

>>54677234
>>54677261
Thanks. I'm keeping UCSD.
>>
>>54677287
I don't think employers will care which computer science major you took rather than your programming skills/problem solving
>>
>>54676741
Rate my solution.

open System

let cross n =
Seq.init n (fun i ->
Seq.init n (fun j->
if i = j || (i + j + 1) = n then "*" else " "
) |> Seq.reduce (+)
) |> String.concat "\n"

let rec ask msg error =
printfn "%s: " msg
match stdin.ReadLine() |> Int32.TryParse with
|(true, n) -> n
|_ ->
eprintfn "%s" error
ask msg error

let rec main() =
match ask "Enter a positive number or 0 to exit" "Invalid number" with
|0 -> ()
|n ->
if n<0 then
eprintfn "It must be positive"
else
cross n |> printf "%s"
main()

main()
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>54677335
>>
>>54677335
damn F# is ugly shit
>>
>>54677335
Designated with extra curry
>>
how do you fags control yourselves?
I seriously am practically all day long sitting in my computer... and even then, I just can't concentrate on doing something useful. I keep trying to distract myself. this is insane.

I have a shitload of ideas, and little to show, plus little motivation to do any of them ;_;
>>
>>54677706
same fambly
it's so easy to just sit and do nothing
>>
>>54676634
>Exceptions are the next goto
Useful in certain situations?

>It has its use, when an exceptional state is reached.
No shit you fucking retard, what were you using them for? flow control?
I have actually seen a Python script that uses exceptions for flow control, that's Python programmers for ya.
>>
>>54676750
>using namespace std;
>>
>>54677706
I have not done a single productive thing in 7 months. Send help.
>>
I just made a random string generator that gets n chars from /dev/urandom concatenate to a string then prints to standard out.
>>
>>54677822
Have you seen C#, C++, and Java programs? Exceptions are overused and not used for exceptional purposes
>>
>>54677335
use When guards
>>
File: psychogundamamrkii.jpg (800 KB, 2321x1779) Image search: [Google]
psychogundamamrkii.jpg
800 KB, 2321x1779
I want to experiment with assembly language and verilog. How do I get started with this? Is there any special steps to using a such low level languages? I imagine I might have to use an emulator or something as to avoid running shit code on my actual processor.
>>
>>54678042
It would make me use the recursive main() call in both paths, once for negative numbers and one for positive ones.
>>
It's like, I like Java, but the fact that it's used by poos and all of the HackerRank challenges are created by poos makes me sad and not want to use it.
>>
>>54678007
did it take you longer to write that program or to write that post?
>>
File: the great debate.jpg (74 KB, 728x546) Image search: [Google]
the great debate.jpg
74 KB, 728x546
printf or cout?
>>
>>54678184
cout
>>
>>54678184
That pic is university-level CS programs in a nutshell. Just fucking great.

Also, printf. But never scanf.
>>
>>54676539
>AT&T
kill yourself nigger
>>
>>54678094
is this not the same?
    let rec main() =
match ask "Enter a positive number or 0 to exit" "Invalid number" with
| 0 -> ()
| n when n < 0 -> eprintfn "It must be positive"
main()
| n -> cross n |> printf "%s"
main()
>>
>>54678216
>he supports israel
>>
>>54678223
It is. I changed it because both paths have the call to main(), so I made the 'if' so I can branch only what needed and have only one call. Just style, I guess. I would guess that the performance is the same, as it has a check and a binding in both styles.
>>
> using bloated 4chan addons
plebs

// ==UserScript==
// @name 4chan_expand_imgs
// @version 0.1
// @description Expand images
// @match https://boards.4chan.org/*/thread/*
// @grant none
// ==/UserScript==
/* jshint esnext: true */
(function(){
"use strict";

let button = document.createElement("div");
button.textContent = 'Expand Images';
button.style.position = 'fixed';
button.style.top = '2%';
button.style.right = '2%';
button.style.borderStyle = 'solid';
button.style.borderWidth = '1px';
button.style.padding = '4px';
document.body.appendChild(button);

function expandImages() {
document.querySelectorAll(".fileThumb > img:first-child").forEach(el => el.click());
button.removeEventListener('click', expandImages);
button.addEventListener('click', collapseImages);
button.textContent = 'Collapse Images';
}
function collapseImages() {
document.querySelectorAll(".fileThumb img[alt='Image']").forEach(el => el.click());
button.removeEventListener('click', collapseImages);
button.addEventListener('click', expandImages);
button.textContent = 'Expand Images';
}
button.addEventListener('click', expandImages);
})();
>>
a little rusty on C++ here,
i made a program which declares the array iArr1,
i want to make a function that sets the value of all elements to 0 in a custom header, can i use a void function and just call the variable (iArr1) or do i need to use pointer shenanigans?
>>
>>54678533
you probably want to pass the size of the array fambly
>>
>>54678551
the code is something like this:
 void CleanMatrix(){
for(int i=0; i>8;i++){
for(int i2=0; i>8;i++){
iArr1[i][i2]=0;
}
}
}


if i were to call the array from the secondary file would it work?
>>
>>54678623
what the fuck
pass the array to the function

honestly start over, start your C++ book from the beginning, better yet, start a different book
>>
File: 63018_jen_hawkins2_1.jpg (979 KB, 2037x3055) Image search: [Google]
63018_jen_hawkins2_1.jpg
979 KB, 2037x3055
How do I into Haskell?

I know some bash and python and I've messed around with java
>>
>>54678913
Learn you a Haskell for Great Good, free online.
>>
>>54678913
learnyouahaskell nigga

but research monads at the same time, because being creative in your own way with haskell takes a backseat when you go through a book that's just rules & principles
>>
>>54678913
Please for the love of god, actually learn to program. You're language hopping too much.

I've heard mixed things about LYAH, but great things about Thinking Functionally with Haskell.
>>
>>54678936
>You're language hopping too much
That's all these threads are about, people learning how to do fizzbuzz in some language, thinking they have mastered it and then ask what they should "learn" next.
>>
what would be the proper way to make an SQL table that checks that only one row of a certain group can be true?

For instance:
ChatID, user, ownerYN
01, 15, Y
01, 27, Y <- fails
01, 82, N
01, 36, N <- does NOT fail

In other words, each chat ID can have one and only one owner, but many non-owners.
>>
>>54678936
kinda this, language hopping is fun but you won't get gud until you stick with something. first few years of programming for me was trying a whole bunch of languages and hating most of them but it took me like 3 years before I sucked it up and sat down to write "real program" on my own. after I did that a lot of it started to come naturally and it made it easier to transition between languages
>>
>>54678936
>>54678958
You will need to master various languages in the real world, or even in your larger personal projects, even outside webdev
>>
>>54678983
Sure, but most people around here read some book on a language and think they have mastered it, I'd bet that anyone here who "know" 10 different languages are not able to write any sort of non-trivial program in any of those languages.
>>
>>54678967
restructure your table so that it has a foreign key or a 1to1 relationship with an owner, and non-owners have a foreign key or a m2m relationship with chats

if you're asking about the SQL query to verify a chat has only 1 id, you'd have to group by chat, counting Y's, then equate it to 1
>>
>>54678983
>>>>>>>>>>>>>>master
exactly
Language mastery doesn't come in a week or two.
>>
>>54679003
>but most people around here
You don't know most people around here

>>54679014
True, but mastering 1 at a time is not a valuable life skill either
>>
>>54679003
yes, but you dont need to master a language to write non-trivial programs in it. you can learn enough to be able to productively write code without necessarily being an expert on the language
>>
>>54677706
gotta get the ball rolling m8, just fucking start doing it RIGHT FUCKING NOW and you'll keep doing it.
>>
>>54678087
Here you go
http://www.cs.cmu.edu/afs/cs/academic/class/15213-s15/www/schedule.html

There's lectures too but the notes cover everything just as well https://scs.hosted.panopto.com/Panopto/Pages/Sessions/List.aspx#folderID=%222bfb939e-6ed8-4220-a877-c4f96a126b48%22&folderQuery=%2215-213%22&page=1

Yes you would want an emulator https://en.wikipedia.org/wiki/List_of_HDL_simulators
>>
>>54679010
>if you're asking about the SQL query to verify a chat has only 1 id, you'd have to group by chat, counting Y's, then equate it to 1

I'm a bit confused. I'm not sure how you'd go about this other than including a select count query inside of a check constraint.

Could you explain?
>>
>>54679024
That's how you master them my man.
>>
>>54678087
This course covers verilog
http://www.ece.cmu.edu/~ece447/s15/doku.php?id=schedule

The other is asm
>>
HELL-0 FROG-0
>>
>>54679079
To verify 1 ChatID:
SELECT SUM(CASE WHEN ownerYN='Y' THEN 1 ELSE 0 END)=1
FROM yourTable
WHERE ChatID=<insert a given ChatID>
>>
>>54677287
UCSD CS major here (got in before it was impacted). Just take the Math-CS major. You could try petitioning into CS, but that will require a 4.0 in most under-div courses (CSE 11, 12, 20, etc). Even then, its not guaranteed. The shitty part about CS now is that all the classes are full as fuck so better hope you have a lot of transfer credits if you don't like waitlists
>>
>>54679204
for multiple ChatIDs (you should use the AS for my previous query as well):
SELECT ChatID, SUM(CASE WHEN ownerYN='Y' THEN 1 ELSE 0 END)=1 AS 'Only 1 owner?'
FROM yourTable
GROUP BY ChatID
>>
>>54676539
open("./heynow.txt", O_WRONLY|O_CREAT|O_TRUNC|O_APPEND, 0666) = 3
close(134517024) = -1 EBADF (Bad file descriptor)


from strace
>>
Is CS better than Bachelor of sofware engineering?
>>
>>54679204
ok, thanks, I'll try that
>>
I'm trying to set up gettext (i18n) for vaccine
>>
>>54679254
>"software engineering" degree
this is what they call it when it isn't a real CS degree
>>
>>54676539
>
    movl  $0, %eax
movl $SYS_EXIT, %ebx
int $LINUX_SYSCALL

This is wrong.
>>
>>54678936
tbqh if he learned to program with haskell first, he would do it quicker than if he came from a imperative/OOP language

honestly haskell should be taught in high school
>>
>>54678913
heard great things here
http://haskellbook.com/
>>
>>54679262
>>54679204
Thanks, that works. When I get back later, I'll try to turn that into a check constraint using a function.

You really helped, /g/ro!
>>
>>54679502
famalam, I'm glad it worked and helped, so it's no problem
>>
>>54679458
He might have problems with imperative/OOP though, which are more marketable
>>
can someone tell me how paradigms aren't a meme?

OOP is literally imperative, it just defines how data structures are made, but your program still just runs as a series of instructions (not talking about compiler output, I mean your actual code is still lines of instructions)

FP is the same thing, but it just defines how functions are made, but your program is still just a series of functions being executed in order on some data

both imperative

logic programming seems like it's the only (of these three) that actually differs from imperative
>>
>>54679549
You're underestimating the power of memes.
>>
>>54679527
>which are more marketable
The most marketable languages are Java and JavaScript, the former usually requiring heavy use of functional paradigm ala Spring, and the latter being mostly functional if you're doing anything JS barring Angular.

You only need to know a few OO concepts, mostly basic inheritance and polymorphism, to get by

>>54679549
They're convenience terms obviously
>>
>>54679549
>it just defines how data structures are made
That's not at the (deeply flawed) core of OOP. OOP is about fine-grained encapsulation of state.

>FP is the same thing, but it just defines how functions are made, but your program is still just a series of functions being executed in order on some data
Again, that's not the core of FP. My understanding on FP is that it's about the removal of state.
>>
>>54679584
Naturally I was just giving brief definitions to get my point across, but whether you encapsulate state or eliminate it, it's all imperative

You could say C is OOP because the state of an integer is encapsulated for example :) and it's behaviors are the usual operators, +-*/<<>> etc
>>
>>54679584
I'm arguing against the guy you're replying to, but you are describing languages that strongly embody those paradigms, rather than the paradigms themselves
>>
>>54679613
>You could say C is OOP because the state of an integer is encapsulated for example :) and it's behaviors are the usual operators, +-*/<<>> etc
That's just retarded, but I'm pretty sure you're just fucking around here.
Again, you need to look at the very core of the paradigms to know what they're about, and many paradigms are not mutually exclusive?

>>54679633
How so? I don't think I could make what I said much more general without it becoming unhelpful.
OOP is about objects passing messages to each other.
Functional programming is about functions.
>>
>>54679692
>and many paradigms are not mutually exclusive?
I didn't mean to put that question mark there.
>>
Is there even a point using languages that aren't multi-paradigm in the current year?
>>
>>54679692
I wasn't entirely fucking around, just a bit

>paradigms are not mutually exclusive
That changes the game, then. I get it now. Although it still all seems like it's just syntax to me. Although I can imagine that OOP is far more data-oriented I suppose
>>
>>54679728
No. Even Java 8 added functional paradigms, and people use it for Spring which has aspect-oriented paradigm, in order to keep up with the current times.

Every paradigm has many cases where they are the preferred choice for a task, and a single paradigm language is barely marketable
>>
>>54679728
There is no reason to use any language that encourages/enforces OOP.
>>
>>54678200
its india tier
>>
Soup /dpt/.

For my pajeet Java class (taught by a fucking retarded women), I have to write a paper comparing two OOP languages.

Which two should I choose to completely dethrone this lady's love for Java and C#? She's a white female, but incredibly soulless and as pajeet as can be.
>>
>>54679758
C++ and Python. Don't even acknowledge Java/C# if you want to dethrone her

Or C++ and Java if you're good enough to argue against her cases
>>
>>54679758
Java and C# to show her how OO (Java) was finished by multi-paradigm (C#) over a decade ago.
>>
>>54679777
>>54679792
Wow. Was expecting something like Eiffel and Smalltalk.
C++ and Python sounds like an OK idea.
>>
>>54679758
woman*
speak english, nigger
>>
>see a post to university FB group asking for a talented android developer
>name: pajeet poinloo
>google the project name
>find the github
>3 contributors
>pajeet
>rajeesh
>areep

They're not even in India. How does this fucking happen?
>>
>>54679847
She's probably large enough to be pluralized.
>>
>>54679847
Thanks pal.
>>
>>54679758
Smalltalk and Java.
>>
>>54679876
Nope, she's pretty thin. There is absolutely nothing behind her eyes, though.
>>
How do you guys get yourself into a late night programming mood?
>>
File: 1457770989205.gif (1 MB, 700x520) Image search: [Google]
1457770989205.gif
1 MB, 700x520
>>54679972
good background music that isn't being played through ear/headphones
a good snack
maybe a cheeky cup of coffee or tea
>>
>>54679972
>>54679989
And especially something interesting and fun to work on. That's perhaps the most important bit.
>>
>>54678027
What pisses me off the most is that Java's FileReader etc require me to fucking wrap it in a try-catch block. Like fucking seriously, who thought that was a good idea.
HOW FUCKING HARD IS IT TO JUST LET THE FUCKING PROGRAM CRASH IF THE FILE FAILS TO OPEN.
IT'S NOT A FUCKING IMPORTANT APPLICATION, I DON'T FUCKING CARE IF IT FAILS, JUST CRASH YOU STUPID FUCKING PIECE OF SHIT.
IF I WANTED TO GRACEFULLY HANDLE THE SITUATION WHERE THE FILE OPEN FAILS THEN I WILL PUT IT IN A FUCKING TRY-CATCH BLOCK, DON'T FUCKING FORCE ME TO DO IT YOU CUNT.

Try-catch blocks are also butt fucking ugly, I'd rather the program just crash and print a message provided in the exception by the thrower (I know at least C++ allows this) unless I HAVE to handle it differently.
>>
>>54680021
It's to allow you to handle it however you like, instead of doing it for you.

It's like in C, if you call 'f = fopen(args)', you usually should check 'if (!f) do_thing();' right after, to handle any error.

The ugly parts about java are that it forces you to check for the error, while in C you can ignore it if you like, and that with try/catch blocks, you are creating an entire new block just to check for that error.
It's retarded.
>>
>>54680021
Just add a throws declaration.
>>
File: konatayawn.gif (269 KB, 130x115) Image search: [Google]
konatayawn.gif
269 KB, 130x115
Every time I look at a javascript project, I can never understand what it's doing because it employs bizarre paradigms that I'm not familiar with as a C programmer.

It just seems like you can assign anything to a variable without clobbering it's contents and I don't know why people just pass around function literals and write functions that return more functions?
>>
>>54680060
I wasn't bad mouthing exceptions in general, I think they're great idea.
If you don't want to handle the error, the least the program should do is abort with minimal cleanup and if a message was provided in the exception, print that.
If you do want to handle it, then you can just catch it.

It is your last point that my whole post was about, it is absolutely fucking retarded forcing them to handle the error when just aborting is a perfectly fine option.

>>54680097
Yeah, and then you're forced to handle it in the caller function.
Solves absolutely fucking nothing, you still have to handle it somewhere rather than just letting the runtime abort.
>>
>>54680111
just keep on throwing.
>>
>>54680102
Well you're looking at it from the wrong viewpoint

JS is mostly functional, but it uses mostly dictionaries instead of lists as its data type (its objects)

Once you understand dictionaries to a good degree, and functional programming to even a small degree (you just need to be comfortable with the fact that functions are first-class), understanding JS is a breeze

As with many other functional languages, it's not type-safe because it doesn't care what a variable is, it just cares if it has the functionality to do what you ask it to
>>
>>54680126
Then you have to handle it in main, unless Java permits you to add a throws declaration to main, in that case, what happens then? who handles it?
>>
>>54680008
I'm working on an educational video game. Fun for the kids when it's done. never for the programmer. Easy work, but tedious.
>>
I have a suggestion for the next thread: Since we can all agree that Java is bad in most ways, let's not talk about Java.
>>
>>54680142
I support this suggestion.
>>
>>54680128
Is there a good tutorial for just the JS language?

Everywhere I look, I see JS tutorials for webdev written for utter beginners and people who just want to interact with the dom.
I'm more interested in this first class function shit.
>>
>>54680142
Sure thing. Let's talk about things we like, to keep the spirits up. Like that I have to wake up in 28.5 hours.
>>
>>54680189
Learn from functional programming then.
>>
>>54680189
eloquentjavascript.net

I've got to warn you that it is pretty difficult, even early on, and you'll mostly be working on functional programming from the get go.

The great thing is, it's like SICP, it has exercises too, and each section project is a game
>>
Any IDE's or text editors for Linux that support vim bindings?
>>
>>54680237
vim?
>>
>>54680241
Other than vim or gvim.

Vim isn't very good at file management, need tree is shit.
I like geany's sidebar but it does not have vim keybindings.
>>
>>54680257
learn to use vim
>>
>>54680270
Any tips for more efficient file management in vim?
I've been using vim for more than a year now, so I'm decently experienced in it.
>>
>>54680293
No idea. I've been using it for 3 years. If I want to change what file I'm working on, I literally quit vim and reopen it with the other file.
>>
>>54680310
Yeah, that's no good for me.
Currently I use tabs in vim, but navigating and opening files is a bit of a pain.
>>
>>54680237
There's Vim emulation for VSCode and ST, though they have quirks. People meme on VSCode and compare it to Atom but I think it's actually pretty good. It even runs better than ST despite not being native.
>>
>>54680324
>Currently I use tabs in vim, but navigating and opening files is a bit of a pain.
Explain.
>>
>>54680365
2 Rupees have been deposited into your Microsoft® account.
>>
1
2
Poo
4
Loo
Poo
7
8
Poo
Loo
11
Poo
13
14
Poo in the Loo
16
17
Poo
19
Loo
>>
>>54680431
fucking kek'd
good one anon
>>
File: programming.jpg (354 KB, 1249x968) Image search: [Google]
programming.jpg
354 KB, 1249x968
I don't know if this the right place to ask, so feel free to point me in the right direction if this thread is not for newbies.
How do I interact with webpages in python? I'm trying to do problem 21 from this image and I have no idea how to start.
>>
I finished this https://github.com/jose-villegas/VCTRenderer
>>
Do Indians have an innate longing for mobile development with Java? My friend is Indian (born in the US) and follows such criteria, but arrived to it on his own.
>>
>>54680324
I use tabs with vim too. I just do this to navigate tabs:
nnoremap <F3> :tabp<CR>
nnoremap <F4> :tabn<CR>
>>
>>54680453
requests, BeautifulSoup
>>
>>54680469
Cheers fampai
>>
>>54680490
NP complete
>>
>>54680128
javascript is not immutable by default

It ain't functional, even Go treats functions first class and it certainly isn't functional
>>
>>54680431
kek
>>
How do I manage this frustrating UnicodeDecodeError in Python? Look for some pointers. This is irritating as hell.
>>
>>54680549
Not sure what exactly you're asking for but http://www.diveintopython.net/xml_processing/unicode.html may help? I don't know.

Python is pretty shit though, yeah.
>>
>>54678216
This tbqh
>>
>>54680237
QtCreator has a fine FakeVim mode.
>>
Is there a way to add comments to each line in IDA pro? I'm disassembling a 16-bit dos application, so it's impossible to switch to pseudocode view, only assembly listing is available. It's okay, but I'd like to comment some things.
>>
>>54680502
Not every language strongly employing a paradigm ever employs every single concept of it
>>
>>54680697
; and :
>>
>>54680720
javascript also doesn't restrict functions to 1 input and 1 output like functional languages
>>
>>54680785
>like functional languages
We are talking about the paradigm, not comparing languages
>>
>>54680803
like the functional paradigm
better?
>>
>>54680785
>functional languages
>restrict functions to 1 input and 1 output

t. someone whose definition of functional programming is "Haskell"
>>
>>54680883
It is better, even moreso now that you're wrong. 1 input and 1 output isn't required for the paradigm
>>
>>54680883
wow
>>
>>54680887
evaluation of mathematical functions requires there to be 1 input and 1 output
>>
Goodnight, /dpt/
It's almost 5am and I have to wake up at 8 on Monday.
Weeeeee.

Sleep tight, all you anons.
>>
File: comfy doge.jpg (439 KB, 1803x1351) Image search: [Google]
comfy doge.jpg
439 KB, 1803x1351
>>54680918
Don't let the bed bugs bite
>>
>>54680916
>digging an even deeper hole
You can't be more wrong, pal.
>>
>>54680102
>Every time I look at a javascript project, I can never understand what it's doing
That's normal.
>>
>>54680916
>moshi moshi
>+ desu
>>
>>54680916
You're making your case worse
>>
>>54680928
hello pajeet
enjoying the ``functional" code you have there in javascript?
>>
How exactly do you pipe inputs between programs?

Like, since the main() of a C/C++ can only return int to be used as standard error, how exactly does say piping cat to grep for a file work?

Do these programs actually interact as separate entities, or does the shell have to dump an extra argument with a reference variable?
Or do the programs within the OS like have to agree on a set way of handling the arguments?

Or, maybe it sends the return value to standard output?

Anyone?
>>
>>54680936
0 1
>>
Whats a good IDE for C languages which will help me learn them as well.
I was thinking of some jetbrain IDE but I dont know if its good
>>
>>54680942
I don't use Javascript my man, and I thought it was multi paradigm? Having first-class functions doesn't make a language functional.
>>
File: Firefox_wallpaper.png (2 MB, 1700x960) Image search: [Google]
Firefox_wallpaper.png
2 MB, 1700x960
Using database derby (forced to), i dont know if my question is valid for every dbms.
I need to insert stuff in tables where some tables references others, so when i insert tuple X i also end up inserting stuff in other tables that references it.
Do i have to commit first or can i do this in a single transaction?
if the latter, does the order matter? I.e. inserting stuff that references X and then X?
This stuff is for a multithreaded project, I am aware that dbms have their own multithreading locks etc; but what if i have a thread piling up statements before committing them and another one that commits? Is it going to commit the stuff that the first one has already executed but not committed?

Thank you.
>>
>>54680938
a -> b -> c
what do you see here? Something that is a requirement for the functional paradigm
>>
>>54680955
vim + gcc
>>
>>54680979
t. Haskell babby who enjoys toy languages more than proper functional languages

>>54680967
JS isn't solely functional, it has the functional paradigm
>>
>>54680967
multi paradigm with OO and imperative yea
Scala is multi paradigm with the functional paradigm included
so this >>54680128
is all wrong
>>
>>54680948
Piping goes in one direction. So
prog1 | prog2

prog1's output (like printf or cout etc) will be sent to prog2's input (scanf or cin etc).
>>
>>54680979
I see:
>i only use haskell
>haskell owns the trademark on functional programming
>i pretend to ignore all else

I also see
A x B -> C

t. someone who knows what a direct product is
>>
>>54680975
Well, it depends on how the database is set up.

If you have constraints that set up foreign keys, then you can only insert X before references to X

Otherwise, it doesn't matter, but it would require application logic to maintain stability and data integrity, which would result in more queries and be slower and more resource-consuming.
>>
>>54680993
>JS doesn't have functional paradigm
>but it has OO
JS embodies OO about as much as it embodies functional: the barebones, enough to be expressive in terms of both, rather than being too strict on one or the other
>>
>>54681017
>If you have constraints that set up foreign keys, then you can only insert X before references to X.

Yes i do, so in order (x then rest of stuff) but with transaction is ok i guess?
>>
>>54681007
pajeet my poo
>>
>>54680996
Hmmm, I'll have to try that later.
That's very interesting.

So, now I'm gonna kinda ask something a bit more abstract: How does the pipe itself work? Like, what exactly lets the system know that it's supposed to just transfer the data there? Is a pipe part of the shell?
Or is it its own program?

Or something else, entirely?
>>
File: 1453694500262.jpg (137 KB, 499x499) Image search: [Google]
1453694500262.jpg
137 KB, 499x499
>when you love Haskell, but other haskell users praise 1 input, 1 output as being the magic of all programming languages, and think other languages don't use currying
thanks for shitting up another language /dpt/
>>
>>54681063
Pipe is something the kernel does for you. It takes output from one program, writes it onto a virtual file, and feeds that virtual file to another program.
>>
>>54681031
Well, I've never used that DBMS. Only used MySQL and Oracle.

But, I should assume it'd be fine. Just make sure to commit at [the/every possible successful] end.
And rollback at any and all errors.
>>
>>54681066
Haskell is not halal
>>
>>54680981
Visual studio is not good?
I use windows
>>
>>54681135
correct
>>
>>54681082
Ok, so if it's part of the kernel, to make one work, I'd need to have it transfer it to memory in a temporary result?

I'm asking specifically, because I'm interested in OS development, completely raw, from the kernel up.

But, what you're saying is that pipe is one of the functions of the kernel?

I guess the next question is: Is the kernel generally 1 single program with lots and lots of functions or is it made of several programs with several functions each?

I only ever heard of one executable associated with the nt kernel in Windows, but in any OS, would the kernel generally be one larger program or several smaller ones?
>>
>>54681135
Anything besides Visual Studio is cancer. Trust me.
>>
>>54681135
Visual Studio is shit.

I use Code::Blocks usually. Though I might wanna try Eclipse or something. C::B is a bit slow to load up.
>>
>>54681150
>>54681169
>>54681177
Im a beginner though, does visual studio work, or why do people dislike it?
>>
>>54681208
install gentoo
>>
>>54681208
BEGINNERS ARE REQUIRED TO USE VISUAL STUDIO.
>>
>>54678913
Here is a nice summary: https://github.com/bitemyapp/learnhaskell

This is the guide he took out of his IRC channel's topic so he could shill >>54679476, which he is writing.
>>
>>54681066
just another requirement, like immutable state
>>
>>54681157
If you're interested in how OS's work best ways to learn are to 1) learn assembly and 2) look at C's system libraries, to see what sorts of things they work.

For example: program pointers are virtual. 36 of the bits point to entries in 4 successive tables (think something like char **** c, 4 layers of indirection) and 12 bits are an offset of a page.
>>
>>54681208
Oh, yeah, sure, use VS then.

I mean, it's not bad-bad. It's just slow, loads your programs with unnecessary dependencies and other crap, and the UI is ass.

Although others will disagree with me. Some people like the highlighting, for instance. I don't really care, as long as it shows up a different color.

That, AND a lot of the people here don't use Windows; many of them use Linux or even Mac, so they may have text-based editors.

For basic purposes, VS is actually quite good. For advanced stuff and/or custom stuff, it's shit. For people who don't want 6 gigatonnes of bloat, it's shit. For people who aren't fans of Microsoft, it's shit. For people who are particular about UI, it CAN BE shit.

But, despite all that, it DOES work.
>>
>>54681007
A x B -> C is still only one argument. It's fine to call either A x B -> C or A -> B -> C as taking two arguments, since they conceptually operate on two things (maybe the second one sometimes doesn't).
>>
>>54681321
I'll have to give that a look. I'll pop open a few of those then.
What are some good places to start? stdio, cstdlib?

But damn, FOUR pointers deep? That's crazy.
>>
>>54681340
I always found linking in VS to be cryptic and obnoxious. I find it much easier to just add -lfoo to my compilation flags than to navigate through 300 menus to add foo to all the right spots and then forget a spot.
>>
It's even somewhat common for Haskell functions to take products as input, just usually they are named record types rather than big tuples. E.g.

data DildoConfig = { ..... 50 "record" elements }

reamSelf :: DildoConfig -> Self -> IO ()
>>
>>54681360
Holy fuck, lol, I took a class in Visual BASIC, and the file structure of saved projects made me want to fucking kill people.

I actually found it easier to create new projects and copy all the fucking code than to figure out what idiotic piece of minutia I fucked up during something dumb as renaming a file or something.

The whole file structure hierarchy drove me the brink of insanity.
And trying to navigate the menus... well, you fucking know, m8, you just done said it. Couldn't figure out where the changes fucking were half the time.
>>
>>54681356
Exactly: a function of two arguments is equivalent to a function of 1.
(define foo (lambda (a b) (+ a b)))
(define foo (lambda arg (+ (car arg) (cadr arg))))


>>54681359
Yep. Since fetching data across pages through virtual pointers is slow, there's a place to save recently accessed pages called the translation lookaside buffer to speed things up.
>>
>>54680918
I know that feel.
If I've learned anything, it's that sleep is precious. Make sure you get enough sleep anon.
>>
>>54681359
Posix. You probably wanna check out posix pipes and shared memory first since you're interested in that.
>>
>>54681416
K, thanks. Would those libraries have come with a standard install of MinGW?

Or will I have to get them elsewhere?
>>
>>54681431
Install your favorite linux.
>>
>>54681090
Allright thank you.
>>
>>54681066
Haskell is a meme
>>
>>54681471
I actually met someone with the last name Haskell.

True story
>>
I'm back with another SQL question.

Does anyone know how to use just the DBMS with no application logic to enforce that friends can only have 1 record between them? By this, I mean, username1 and username2 are unique, but they are also inversely unique, meaning username2 and username1 cannot exist if a record already exists for username1 and username2?

In other words:
insert bob, cindy
insert bob, cindy
insert cindy, bob
Both the second AND third inserts should fail.
>>
>>54681340
>>54681360
>>54681392
Okay, so if I use windows, but don't want to use visual studio, what do I use then?
>>
File: 1461890025980.gif (2 MB, 599x334) Image search: [Google]
1461890025980.gif
2 MB, 599x334
>>54676367
Is it possible to upgrade or downgrade your version of ruby on cloud9 IDE? The closest I've gotten is confirming that the update worked using ruby -v to check the version, but after running one or two commands, the terminal will freeze. I'll open a new one, check the ruby version, and it's back to the old one, 2.2.1. Sorry for the dumb question, and I'm looking to either upgrade or downgrade due to a bug that's specific to the 2.2.* versions.
>"undefined method `year' for nil:NilClass"
>>
>>54681595
yes
>>
>>54681664
Code::Blocks, Eclipse, could try NetBeans (I had trouble getting C/C++ compiler to set up on this, though), Notepad++ (Never tried to set up this compiler)
>>
>>54681706
What kind of check or constraint would I want to set up to do this?
>>
>>54681716
What if I want to write in C#, as well as databases? I'm on windows, are visual studio and mysql my only two good options?
By good, I mean I won't have to fuck around for a week before I find a good IDE or a plugin and make it work.
>>
>Decide to take a look at Haskell again
>ghc v8.01 is a compatibility break
illegal type signature: ‘Word32’
Type signatures are only allowed in patterns with ScopedTypeVariables

What the fuck, I can't even build packages of hackage anymore?
Into the trash with python 3 it goes.
>>
>>54681471
OOP is a meme
>>
>>54681482
The language was named after Curry "poo in the loo" Haskell. Not really surprising there are some people with that last name.
>>
>>54681595
I'm a fledgling programmer, so sorry if I misunderstood your question, but try adding this to your friendships migration if you're using ruby. I can confirm that it works for me.

add_index :friendships, :user_id
add_index :friendships, :friend_id
add_index :friendships, [:user_id, :friend_id], unique: true
>>
can someone recommend database tutorials?
>>
Contemplating technology choices for a new web app/site, but I'm stuck on choosing what to write the server and database in.

The backend would be really light, not much more than a pretty access layer to the databse, but the databse itself is really important as the app will be data centric.

I was thinking about Postgres for the DB, but now I read that I can't run it in-memory and I would like to try an in-memory database that initializes from scratch on application startup for local development.

Also, I want to host on Heroku, for no good reason other than that they have a reasonable free tier, so I was thinking about writing the server in Clojure. I've used NodeJS for small projects in the past, but it's a meme.

Maybe I should just use something like Firebase and focus on the front-end for now.
>>
>Currying
Jesus christ, what a huge meme.
Haskell users truly are fucking retarded.
>>
How can I say gcc or g++ where to search for libraries or header files? I've got directory ~/Desktop/SFML/include/SFML/ and ~/Desktop/SFML/lib/ how can I say compilator to search there and when I should use lib/ and when include/?
>>
>>54682008
if on windows, your PATH environment variable
>>
>>54682030
I'm using Linux.
>>
>>54682008
Lib is for library (.so/.lib/.dll), include is for includes.

On gcc/clang use -I -i -isystem for include directories, -L for linker directories (or explicit paths with -l). For VS use property sheets.
>>
>>54682008
gcc -I/path/to/headers/


>>54682037
Why on earth don't you install those libraries with your package manager, so that they get installed into the 'usual places'?
Thread replies: 255
Thread images: 26

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.