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

File: 220px-Sun_UltraSPARCII.jpg (15KB, 220x220px) Image search: [Google]
220px-Sun_UltraSPARCII.jpg
15KB, 220x220px
What are you working on, /g/?
Old thread: >>58291882
>>
First for C.
>>
File: 1483410181789.png (237KB, 1328x1768px) Image search: [Google]
1483410181789.png
237KB, 1328x1768px
what Haskell users claim vs What actually happens
>>
>>58295854
Next time use an anime image
>>
>tidying up coworker's code
>see a load of expressions of type void
>delete them
>he gets mad because his code is now broken
>I tell him to make his code referentially transparent in future
>>
>>58295895
Make an UltraSPARC II anime girl.
>>
How do you meaningfully decide on a language that's right for you when you only know 2 or 3? Can't most of them do anything you want anyway? What are differences that matter, besides large libraries of pre-written functions?
>>
>>58295895

But old CPUs are cool, Anon.
>>
>>58295947
Learn Haskell and Java and tell me they're basically the same.
>>
>>58295965
I'm sure they feel very different, but how do you decide ahead of time which one is right for you early on?
>>
>>58296020
Well it should be obvious that scripting languages and compiled languages and Java or C# are tailored towards certain problems. If you know 3 compiled languages but know no scripting languages then you're doing it wrong.
>>
Can I get some project ideas for actual things? I just created a web extension that replaces baka desu senpai with the original words and I feel bad that it is really the first actual thing I've made with my programming knowledge, instead of just Comp sci exercises. I really only know Java, a bit of JS and can refresh myself on ruby. Also, is looking up code on stack overflow bad when you are trying to teach yourself, even if you make sure you understand it before using it?

Pls help, I know I have been posting in these threads too often but making that web extension showed me how little useful programming knowledge I have and I am desperate to learn more, and make useful shit. Again, please just rec me some easy-intermediate project ideas.
>>
Say something mean about C
>>
>>58296097
It spawned C# C-- and Java
>>
>>58296080
Why do people try to learn programming if they don't have enough interest to even think of something to make?
>>
>>58296080
Create a video player
>>
>>58296097
You often have to write inferior versions of things readily available in C++ like vectors.
>>
>>58296153
Thank you.
>>
>>58296143
Sometimes it's hard to even imagine what a single human can make without any programming knowledge, because what we typically interact with are programs perfected by teams of highly-skilled career programmers.
>>
>>58296097

Macros are a poor means of metaprogramming.
>>
>>58296143
Because it's easy to pick a project that's too complicated for a begineer?
>>
>>58296224
>Enigma simulator
Is this actually hard to program or the difficulty is you need to understand how the enigma machine works?
>>
>>58296224
Wasn't there a thread for this shit before?
Go post your useless rolling posts there.
>>
>>58296280
>learning something
>afraid to make mistakes
Not how it works.
>>
>>58296097
#define is pretty high up there in terms of top archaic and shit design practices.
>>
>>58296308
Enigma just encoded text. So I would think it's just an issue of understanding the machine.
>>
>>58296224
Thanks lad needed this.
>>
File: DEC Alpha EV7.jpg (111KB, 628x663px) Image search: [Google]
DEC Alpha EV7.jpg
111KB, 628x663px
>>58295953
I miss some of those old designs. Gawd, some of their designs make our Intel/AMD overlords look like the fucking morons they are, and that was 15+ years ago.
>>
>>58296224
>minesweeper harder than sierpinski's triangle

wtf
>>
>>58296224
What does coldet&texture mapping mean for the Wolfenstein 3D one
>>
>>58296031
>. If you know 3 compiled languages but know no scripting languages then you're doing it wrong.
That's just the industry rolling over the current crop of programmers to shove something up their collective asses again - most likely smoke. 20 years ago that was inverted, compiled was expected and "scripting" was looked upon as "programming lite". How times change.
>>
>>58296522
but still its better to know at least one compiled language + at least one scripting language than more of one kind
>>
>>58296308
IIRC it's simply a set of layered transposition ciphers, plus a moving key schedule. You could probably emulate the entire thing with a set of arrays, one array for each "encoder" in the engima machine, each array holding one letter as an element. Bonus points for using modulus integer arithmetic to simply "wrap" the ends of the array together in a "circle"... but I'm just tossing ideas out.
>>
>>58296522
Often times your time is more important than any other issue.
>>
>>58296488
Yeah it is. You kidding?
>>
>>58296559
Also a function of the age we are in. Machines go down in cost, programmer time goes up in cost. So yes, you're right, although it still highlights how the industry has "flipped over" certain assumptions.
>>
>>58296552
There are no scripting languages worth learning that are not compiled languages.
>>
>>58296592
>implying scripting languages are faster to develop in
They are not.
>>
>>58296552
>know at least one compiled language + at least one scripting language
I don't disagree. In fact, you should probably know more than one programming paradigm. So many people can't look beyond OOP because it's the current (dominate) paradigm of the time, but you'll learn so much more by just peeking over that walled garden.

OOP is nice, but it's not all it is cracked up to be. Personally it seems bloaty as you have ever-increasing numbers of objects, and the overhead of structuring out each object adds up. Probably why procedural programming is mostly useful for high-speed computation but sucky at abstraction; OOP makes abstraction a breeze at a minor cost in computational terms.
>>
>>58296607
>scripting languages are faster to develop in
Not really trying to saying that; rather I'm trying to highlight how the current generation of programmers (and the industry in general) have a certain mindset.
>>
>>58296617
>Probably why procedural programming is mostly useful for high-speed computation but sucky at abstraction; OOP makes abstraction a breeze at a minor cost in computational terms.
Too bad there isn't anything that surpasses both OOP at abstraction and PP at optimization.
>>
>>58296629
The industry in general is idiotic.
>>
>>58296617
>OOP makes abstraction a breeze
This is false.
>>
This thread is pathetic. It is not about programming. It's just a bunch of computers illiterates and first semesters memeing about whatever they just learned.

A quick search shows that most arguments used here are not original and have been copied from some trendy tech blog or other shit site.

The only real programming questions I have seen so far are from beginners(it's fine to be a beginner btw).

This entire site is shit and I don't know why anyone would regularly come here.
>>
>>58296685
Let's give him the benefit of the doubt and assume he's comparing to C.
>>
>>58296701
Same
>>
>>58296522

Well 40 years ago compiled languages weren't really a thing and it was just assembly or a scripting language like basic.
>>
what language should i use to program a music visualizer?
>>
>>58296856
I've done it in C before.
>>
>>58296712
I would love to move over /sci/ but I'm not smart enough.
>>
>>58296841
>a scripting language like basic
Basic has a funny history. Many of the "Microsoft baby Basics" were "compiled" down into a set of bytecode for an interpreter. Prior to that, yes, some Basics stored the actual words in memory and had it interpreted at runtime, although most eventually moved to the "this byte means this keyword" format.
>>
File: Image.png (123KB, 800x400px) Image search: [Google]
Image.png
123KB, 800x400px
What makes it impossible to modify hardware?

Console, Smartphone, Smart TV, Cable Modem, etc.

It's all just binary at the end of the day, right? What prevents you from removing Microsoft's operating system and installing a Linux distribution? Companies can update firmware over the internet. So, clearly it's not built in. And even if it has security, what's stopping you from copying the firmware update, extracting the information you need to make it run, and forcing it to install your own thing?
>>
>>58296944
>What makes it impossible to modify hardware?
How difficult it is to do.
>>
>>58295854
Python 3 with PyCharm Edu

name = "John"
age = 17

print(name == "John" or not age > 17)

print(name == "John" or not age > 17)

print(name is "Ellis" or not (name is "John" and age == 17))


#Why and how is it that they are executed at the same
#time?

#How can i know what operator I should be using?

#The questions are being asked because it is making me
#understand that "and", "not" & "or" are different and
#not interchangeable, however the answer shines light
#on the fact that you can combine them...

#which would be the rules of this?
>>
>>58296944
so what's stopping you?
>>
>>58296895
>I would love to move over /sci/ but I'm not smart enough.
You're not going to improve by hanging out here.
Move!
>>
>>58296944
ROM, I imagine?
>>
>>58296895
i'd love to talk about math on 4chan but visiting /sci/ only makes me appreciate other boards more
it only attracts idiots
>>
>>58296996
Learn what code tags are
so you can write stuff that looks like this
>>
>>58296224
>70 Reverse a number mathematically

Rate my babby's first Scheme solution.
>pls no negative numbers
(define (get-digits x) (if (< x 10) (cons x () )
(cons (modulo x 10) (get-digits (/ (- x (modulo x 10)) 10 )))))

(define (reverse x) (if (null? x)
()
(append (reverse (cdr x)) (list (car x)) )))

(define (list-to-num x) (if (> (length x) 1)
(+ (car x) (* 10 (list-to-num (cdr x)) ))
(car x) ))

(define (rev-num x) (list-to-num (reverse (get-digits x ))))


So my code works as far as I've tested it, but it's far from optimal and doesn't handle every case. Despite this, how can I improve in thinking in a function oriented way? This problem seems far easier to solve in C++ for example, but that may just be since I'm more familiar with that.
>>
I like math books that use informal language
>>
>>58295854
>What are you working on, /g/?
Still working on my anime program.

It's currently 'defeated' by groups like Horriblesubs who (only sometimes) name the second season as the first, but then just continue the numbering scheme.
For example, the for the Gundam one, the first episode of season 2 was release as "Mobile Suit Gundam - Iron-Blooded Orphans - 36" (my program can pick up on the english title).
Not that I actually want to watch boring Sunrise mecha garbage, but I don't want this to happen with other series I actually want to watch.

I can't really think of a way to fix this without potentially introducing a bunch of false-positives, or requiring me to do shit manually.
>>
How do you get good at programming in general?

I know this is a broad question asked often, but I've taken a course or two on programming with experience in C++, Java, and some other basics, but I feel like I can't do anything "big." I don't necessarily have anything specific in mind, but when I see someone who knows how to navigate a computer/solve a random problem quickly and easily, I feel like I'm nowhere near that. How do I get there? I just feel like I know a bunch of tricks but no solid foundation.
>>
>>58297269
Keep it simple and stupid.
>>
>>58297269
How much time have you been lurking here? Because your question has been answered several times. Don't wanna be rude btw, but it just takes practice, like build a couple of personal projects, start using libraries (even though if you feel like you're cheating).
>but no solid foundation.
What foundations do you think you're lacking?
>>
>>58297356
Sorry, I just mean I feel like I don't understand fundamentally how computers are set up to work. I get lost pretty quickly in jargon and feel a huge knowledge gap when it comes to terminology, and how each piece of the computer contributes to do whatever tasks. Similarly for how networks work.
>>
>>58297390
To clarify, I have a little knowledge about simple data structures like stacks, linked lists, etc. and some idea about memory (as an abstract concept; not so interested in the physics of how these are implemented in hardware), but I'm clueless when it comes to higher level things and common libraries.
>>
Why is so much CSV data just fixed-width data with commas? Isn't the benefit of CSV being variable width columns?
>>
>>58297390
>>58297407
Programming has a lot of fields, you can't tackle them all. For example, networks it's a field on it's own, so you probably don't want to dive soo deep in them, just have a general knowledge. Same with databases. I think it really depends on what you want to program, desktop apps, mobile, websites?. That way you can narrow things that should interest you.
Libraries basically are just a set of classes and functions.
>>
>>58297390
>I get lost pretty quickly in jargon
This is fair. There is nothing to understand about the infinite layers of abstraction. Focus on mathematics/physics and learn C. It's a really small and simple language that does absolutely everything you need.

>>58297429
>simple data structures
That's all you need to know. "Higher level" and "common libraries" are just tumors grown out of control.
>>
File: Untitled.webm (2MB, 1920x1080px) Image search: [Google]
Untitled.webm
2MB, 1920x1080px
like watching paint dry
>>
>In the context of this 1970's computing style, K&RC is actually correct. As long as only trusted people run complete cohesive programs that exit and clean up all their resources then their code is fine.
>Where K&RC runs into problems is when the functions or code snippets are taken out of the book and used in other programs. Once you take many of these code snippets and try use them in some other program they fall apart. They then have blatant buffer overflows, bugs, and problems that a beginner will trip over.
>The best way to summarize the problem of K&RC "correctness" is with an example from English. Imagine if you have the pair of sentences, "Jack and Jill went up the hill. He fell down." Well, from context clues you know that "He" means Jack. However, if you have that sentence on its own it's not clear who "He" is. Now, if you put that sentence at the end of another sentence you can get an unclear pronoun reference: "Jack and Frank went up the hill. He fell down." Which "He" are we talking about in that sentence?
>-- Zed A. Shaw, "Deconstructing K&R C"
"K&R C is stupid because you can't just copy and paste from it like a total Pajeet and you have to actually do some work to reuse their code"
>>
>>58297450
I'm not sure what exactly I'm looking for, but I want to have enough knowledge to feel "comfortable" digging around on my computer. I see some people who can customize their computers so well, with all kinds of macros, that it's truly theirs. Occasionally I'll run into a problem and think, "I wish I knew how to program better to fix this," but nothing specific comes to mind.

>>58297494
I'm actually in math, not CS. That's another motivation for learning programming to me, as sometimes I need specialized computations to understand things/research.
>>
>>58297591
Zed Shaw was a big deal for a while. He seems to have been bullied into silence these days.
>>
What's going on here? I'm using the OpenGL SuperBible, and I included the OpenGL framework to
 #include <gl/gl.h> 
, but despite the "gl.h" file clearly being in the OpenGL framework, the IDE doesn't find it...

Any ideas?
>>
>>58297654
Should probably mention this, but neither
#include <gl.h>
nor
#include <gl/gl.h>[
work
>>
>>58297617
Is his "Learn C/Python/Ruby the Hard Way" series any good? I recommended it to a friend, but I'm trying to figure out the best resource for teaching myself C and I don't like what I'm reading about him. His "Rails is a Ghetto" rant was pretty funny, though.
>>
>>58297594
my background is like that, but it's hard for me to tell what you're after. there are textbooks for things like operating systems and networking; some of them are good

>>58297617
he might just be content with book money
>>
>>58297676
>but I'm trying to figure out the best resource for teaching myself C
>>58296044
>>
>>58297654
what IDE is that
muh dik
>>
>>58297703
XCode. Linking libraries has been a pain in my rear end.
>>
>>58297654
>>58297672

1. Where in your filesystem is the gl folder, and why is it not /usr/include?
2. What flags are being passed to the compiler to let it know where to find gl/gl.h?
3. Are you sure it's not GL/gl.h, rather than gl/gl.h?
>>
>>58297695
Thanks my famalamadingdong
>>
>>58297691
One day I'd like to learn more about Operating Systems, but I guess I'm also unsure of what exactly I want. I feel like I have to first learn what the possibilities for programming are before I can dive into any one path. Do you have recommendations for that?
>>
What can I learn from studying C if I already know C++ moderately well? What about C#?
>>
>>58297776

If you know C++ moderately well, you probably already know C moderately well, or at least enough to read C codebases. Advantage to learning it proper would be the ability to modify C codebases.

C# is a completely different ballgame, and would be something to learn if you plan on getting into the .NET ecosystem.
>>
>>58297720

>Linking libraries has been a pain in my rear end.
Maybe you should stop using an IDE and do the following:

1. Learn where the hell your compiler searches for header files and library files by default
2. Learn how to expand include and library search paths
3. Learn how to tell your compiler to link to a library in the first place

Really, it doesn't take a long time to learn these things, but it can make dealing with third party libraries a breeze if you actually know what the hell you're doing. And if it seems like a pain to be writing out long GCC and Clang commands, that's what Make and CMake are for.
>>
File: 1456269195737.jpg (80KB, 549x1190px) Image search: [Google]
1456269195737.jpg
80KB, 549x1190px
>make some progress
>get stuck on some stupid trivial shit
>>
>>58297800
Are there any C++ libraries that handle cross-platform GUI without using HTML? I know that they exist for C#.
>>
>>58297721
my IDE or compiler assumes all headers are in /usr/include and all libs are in /usr/lib.
>>58297720
I use codeBlocks and at the top of my build log is the actual script it makes and runs.
"gcc -Wall -lSDL2 -lGL -lGLEW -lGLU -ljalb -ljalbFT2Atlas -lfreetype -g -I/usr/include/SDL2 -I/usr/include/GL -I/usr/include/freetype2 -I/usr/include/jalb -c /home/jokes/workspace/cSpace/edit/jalbViewer/main.c -o obj/Debug/main.o"
I can then go back into my IDEs compiler settings and see how it transforms what i give it into an actual command.
This helped me understand what is going on behind the scenes. Go read some compiler tutorials... do first then ask
>>
In Fortran 90 how would I print a two dimensional array row by row?
>>
>>58297894
fixed it

thank fuck
>>
>>58297898

There are MANY. C++ doesn't tend to do GUI stuff with HTML. You'd be thinking of Electron, which is used with JavaScript. If you're looking for a big framework that can do a bit more than just GUI stuff, can be scripted, and works on lots of platforms, use Qt. If you want a light GUI toolkit, try FLTK or WxWidgets. In between the two would be GTK+.
>>
>>58297894
>make some progress
>get stuck on stuff that should be trivial but the language sucks
>>
>>58297970
I'm sorry, this is 2017. I mean cross-platform mobile. QT looks like ass on Android.
>>
>>58297898
react native doesn't count?
>>
>>58297800
What are some major differences between C and C++? Are any of them significant for casual programming?

I don't know anything about .NET so I guess I'll stay away from that.
>>
>>58298014
On many levels, programming in """modern C++""" is different from most other languages, C included.
>>
>>58297894
>get stuck thinking whether I should implement something as efficient in space at the cost of inefficiency in processing, or inefficient in space at the cost of efficiency in processing
>>
>>58298007
Web views are unacceptable, and I need desktop support.
>>
>>58297991

Most cross platform frameworks don't work on mobile, no. Qt would likely be your best bet. It doesn't help that Android really, REALLY doesn't want you to use the NDK, and iOS really, REALLY does not like third party anything.
>>
>>58298106
hmm, I guess it's roll-your-own with an IoC container for me then
>>
>>58298135

I suppose. There really do need to be more solutions to this problem. The only truly cross platform GUI framework is Qt. It runs on everything under the sun, but it is:

1. Huge. It offers a lot more than just GUI stuff, when some people only want a GUI.
2. A pain in the ass, as it was developed before C++11, and uses a lot of weird non-C++ macros that have to be parsed by a separate compiler.
3. Capable of being rather ugly as sin.
4. LGPL. It's not actually a bad license, but a number of corporations seem to conflate it with the GPL itself, and run away from it.

And everyone else is trying to make some all encompassing framework that your entire application should revolve around, which does not actually run any native code.
>>
>>58297766
Watch this guy videos:
https://www.youtube.com/channel/UCdX4uJUwSFwiY3XBvu-F_-Q

And no this isn't some obscure meme. He might be schizo but he actually knows what he's talking about. Thought his streams are slow and the interesting stuff is randomly spread between hours of nothingness.
>>
Can someone explain what a "wrapper" is in concrete terms?

Am I the only one who gets frustrated that it seems computer scientists never explicitly define anything, but just use language over and over in examples hoping you'll catch on to the meaning in a year?
>>
>>58298222
https://www.youtube.com/watch?v=oCXER2BSR8o
>28:20
my sides
>>
>>58298260
I have no idea, but I would assume it's a catch-all for a layer of abstraction.
>>
>>58298260
it's a layer of abstraction like if you have some complicated interface, the wrapper uses the complicated interface behind the scenes and exposes a simpler interface
>>
>>58298260
I've always thought of a wrapper as a function that calls another function.
>>
File: 1453455775912.jpg (810KB, 1200x900px) Image search: [Google]
1453455775912.jpg
810KB, 1200x900px
>>58295854

is there anyone here who can into simple makefiles for c programs ?

i'm supposed to put the executable of a simple program into /tmp/folder
and a test goal that executes the executable with 10 2 32 as arguments.


welp
>>
>>58298260
It's one of those things that you can define however you want to.
I usually consider it an (often trivial, but not always) interface over another interface.
For example: the POSIX read() function is a wrapper over the read syscall.
>>
>>58298321
sorry, I only know how to write makemakefiles
>>
>>58298348
i'm fucked then, i just spent 3 hours learning gdb to debug the shit out of my program .
now i'm not ready to learn how to write makefiles.
>>
>>58298388
just look up an example and nigger-rig it
>>
>>58298388
Nothing is stopping from writing makefiles in python.
>>
>>58298398
eventually it's going to be this.
but i just tried to test my chance here.

thanks anyway /dpt/ you helped me a lot.
>>
>>58298411
no problem
try doing your homework ahead of the due date next time
>>
File: 1482003246493.jpg (74KB, 707x682px) Image search: [Google]
1482003246493.jpg
74KB, 707x682px
>>58298423
>>
>>58297654
Why the fuck do you have so many empty lines in your header?
>>
>>58298321

Makefiles are simple, lol. Assuming no tricks involving wildcards, everything is just

# Note: IIRC, Make expects tab characters for indenting here. 
rule: dependencies
list
of
statements


If you already have a rule for a program called foo, you might define a rule all like such:

all: foo
mv foo /tmp/foo
/tmp/foo 10 2 32
>>
>>58298542
thx man
>>

#include <stdio.h>
#include <stdlib.h>

#define COUNT 10

typedef struct Node {
struct Node* link;
int data;
} Node;

int main() {

Node* head = malloc(sizeof(Node));
head->data = 1;
head->link = NULL;

Node* seeker = head;

for(int i = head->data + 1; i <= COUNT; i++) {

Node* new_node = malloc(sizeof(Node));
new_node->data = i;
new_node->link = NULL;
seeker->link = new_node;
seeker = new_node;
}

seeker = head;

for(int i = 0; i < COUNT; i++) {

printf("%d\n", seeker->data);

Node* temp = seeker;
seeker = seeker->link;
free(temp);
}

free(seeker);
return 0;
}



Rate my program to print the numbers 1-10 in C
>>
>>58298662
Rate mine.

 (define n '(1 2 3 4 5 6 7 8 9 10) )
(map display n)
>>
>>58298679
post output of du -h binary

12K    main
>>
How do I get started programming with GUIs? I want to be able to make programs where I can actually touch/click/move things around and see it react. I've already done a lot of programming the basics with OOP and functional languages, but I want to try something more visual now.
>>
>>58298679
Rate mine

int main(void) {
srand(time(NULL));
int y;
for (int i = 0; i < 10; ++i) {
while ((y = rand()) != i) {
putchar('0' + y);
}
}
return 0;
}
>>
print "1,2,3,4,5,6,7,8,9,10"
>>
>>58298741
>2017
>python 2.7
>>
>>58298715
What platform are you targetting? If you want to start with something quickly without much bullshit, Gtk is alright, but it's only worth targetting Linux imo, and Gtk3 can often be a pain but Gtk2 has an awkward feature set. Qt is decent cross platform and okay to work with. Winforms has a lot of bullshit (VS pregenerated and .NET stuff you'll have to get your head around), but is nice for creating quick windows GUI stuff without actually programming the GUI.

Tbh most programmers want to do as little work as fast as possible with the actual GUI itself and instead work on the program.
>>
>>58298760
>python 2.7 is deprecated because the dumbass """"language designer"""" said so
>>
File: 176746.png (273KB, 363x1140px) Image search: [Google]
176746.png
273KB, 363x1140px
>>58298760
>python 2.7
>python
>>
>>58298662

A terrible use for a singly linked list.
>>
why is using tcl/tk in a C program so complicated

i just want a light toolkit
>>
    while x < len(temp): 
dictionary[temp[x]].append(temp[y])
x += 2
y += 2
for i in s:
y = sorted(dictionary[i], reverse=True)
if len(y) == 5:
x = 0
count = 1
for i in range(1, 5):
if y[x] - 1 == y[i]:
count += 1
else:
count = 0
x += 1


['h', 10, 'h', 9]
['h', 8, 'h', 'J', 'h', 'Q', 'd', 5, 's', 6]
straight flush


when your solutions are far from elegant but they solve the problem. this is not a good feel.
>>
>>58298933
   if count == 5:
if y == royal:
print('royal flush')
else:
display(hand)
display(board)
print('straight flush')



there it's coded. :)
>>
>>58298899

Doesn't look too difficult, going by the wiki...
>>
>lisp is expressive
>no partial application
m e m e
>>
>>58297068
Your get-digits procedure returns a backwards list. Also, your indentation is super fucky.
(define (get-digits x)
(if (< x 10)
(list x)
(append (get-digits (/ (- x (modulo x 10)) 10))
(list (modulo x 10)))))

(define (rev-num x)
(list-to-num (get-digits x)))

(get-digits 12345) ;=> '(1 2 3 4 5)
(rev-num 12345) ;=> 54321
>>
>>58296157
>inferior version of things
>puts vector as an example
You probably shouldn't use vector if you really want to do well. You can't make it fast even if you pass a proper allocator to it. And you'd probably end up writing a vector factory to make it less annoying to work with.

I can appreciate that with major asterisks C++ has its advantages but there's so many traps in the language it makes more sense to just avoid it.
>>
>>58298321
>>58298348
>>58298398
>>58298400
>>58298423
>>58298542

the makefile is done.

all i need now is a script to automate a telnet session

the command is :telnet 127.0.0.1 8080

and then telnet waits the user to write into stdin this:
GET /index.html HTTP/1.1\n
host:127.0.0.1\n
\n

where are the python gurus at ? or the bash guys ? please send help
>>
>>58299114
Partial application of functions just sounds like currying to me. Even if they are different under the hood. From the example in the haskell wiki:
add     :: Int -> Int -> Int
add x y = x + y

addOne = add 1


Well, that kind of just looks like this:
(define add +)
(define add1 (curry add 1))

(add1 4) ;=> 5


Sure seems fine to me. Granted, that's just with the built-in functions. I'm certain someone could implement partial application of functions in a macro.
>>
>>58299241
I had an idea for a lisp where [f x] is partial application and (f x) is full application, but I don't have enough motivation to implement it
>>
>>58299114
(defun fs (f s)
(mapcar f s))
(defun f1 (i)
(* i 2))
(defun f2 (i)
(expt i 2))

(defun partial (func &rest args1)
(lambda (&rest args2)
(apply func (append args1 args2))))

(setf (symbol-function 'fsf1) (partial #'fs #'f1))
(setf (symbol-function 'fsf2) (partial #'fs #'f2))

(dolist (seq '((0 1 2 3) (2 4 6 8)))
(format t
"~%seq: ~A~% fsf1 seq: ~A~% fsf2 seq: ~A"
seq
(fsf1 seq)
(fsf2 seq)))
>>
import java.util.Arrays;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.IntUnaryOperator;
import java.util.function.UnaryOperator;
import java.util.stream.Stream;

@FunctionalInterface
public interface PartialApplication<INPUT1, INPUT2, OUTPUT> extends BiFunction<INPUT1, INPUT2, OUTPUT> {
// Original method fs(f, s).
public static int[] fs(IntUnaryOperator f, int[] s) {
return Arrays.stream(s)
.parallel()
.map(f::applyAsInt)
.toArray()
;
}

// Currying method f.apply(a).apply(b),
// in lieu of f.apply(a, b),
// necessary for partial application.
public default Function<INPUT2, OUTPUT> apply(INPUT1 input1) {
return input2 -> apply(input1, input2);
}

// Original method fs turned into a partially-applicable function.
public static final PartialApplication<IntUnaryOperator, int[], int[]> fs = PartialApplication::fs;

public static final IntUnaryOperator f1 = i -> i + i;

public static final IntUnaryOperator f2 = i -> i * i;

public static final UnaryOperator<int[]> fsf1 = fs.apply(f1)::apply; // Partial application.

public static final UnaryOperator<int[]> fsf2 = fs.apply(f2)::apply;

public static void main(String... args) {
int[][] sequences = {
{0, 1, 2, 3},
{2, 4, 6, 8},
};

Arrays.stream(sequences)
.parallel()
.map(array ->
Stream.of(
array,
fsf1.apply(array),
fsf2.apply(array)
)
.parallel()
.map(Arrays::toString)
.toArray()
)
.map(array ->
String.format(
String.join("\n",
"array: %s",
" fsf1(array): %s",
" fsf2(array): %s"
),
array
)
)
.forEachOrdered(System.out::println)
;
}
}
>>
>>58299241
common lisp doesn't have it though
>>
>>58297183
Just use e2dk hash with anidb, did the same for mine.
>>
>>58299350

Irrelevant.
>>
all this shit about learning C and C++ and how everyone fucking uses it but there are literally no C or C++ jobs out there. They all want 20 year experience master degree people. There is legit no "entry level" C/C++ anywhere. Every repo i see on github is java or go or rust or some other fucking meme language uses a VM and GC thread or whatever slow practices it does.

I feel like I wasted my entire time learning C and should just bite down on the whole javascript web-dev and "app" dev meme because that seems like the only way to fucking survive at this point.
>>
>>58299298
why stream().parallel()?
why not parallelStream()?
>>
>>58299699
>>>/wdg/
>>
>>58299710

Java streams were a fucking mistakes.
>>
>>58299725
Java was a fucking mistake.
>>
>>58299699

Most people will not program in C directly, but every programmer, no matter what they are working with, should know C. If you don't know C, you don't know how any of your fucking tools work. C is the backbone of fucking everything.

Learn whatever you like, but you must also learn C.
>>
>>58299784
I know C++ at an intermediate level. I also do reverse engineering and malware analysis and so forth. The jobs/internships available for that type of shit? none.

The jobs/internships for fucking web-dev and java app-bullshit? Fucking everywhere. Inflated even. Everyone I know that does C++ professionally or is responsible for a C++ repo is in their fucking 70s. I have to give in to the bullshit "managed" languages like C#/Java/Javascript/etc that use a byte code-interpreting virtual machine and all that other slow ass shit because C/C++ is just that dead in my area.
>>
>>58299784
>C is the backbone of fucking everything.

I don't think so.
>>
give me a name of one good java book so i don't need anything else.
>>
>>58299803
As a CSharter, you opinion doesn't count for anything.
>>
>>58299815
>you
your*
>>
File: 1483373931463.png (122KB, 640x890px) Image search: [Google]
1483373931463.png
122KB, 640x890px
>>58299699
>what's the point of learning C if I want to be useless
>>
>>58299815
>>58299816

Wrong.
>>
>>58299710
because it's obviously better to choose stream and then parallel instead of magically knowing that there's a prallelStream, same reason why apps hungarian is the only good naming scheme for variables

fucking retard
>>
I have a question regarding Java
public class Date{
private byte day;
private byte month;
private short year;

{
day = 1;
month = 2;
year = 1950;
}

public Date{
this(1, 1, 1900);
}
}

It's telling me I can't make that constructor, only with ints and not bytes and shorts.
What gives?
>>
>>58299871
sorry, missed the () after Date there.
>>
>>58299871
conversion to a smaller type requires an explicit cast
>>
File: IMG_0305.png (425KB, 607x523px) Image search: [Google]
IMG_0305.png
425KB, 607x523px
>>58296097

>using namespace std
>>
>>58296617

Wow, a balanced, non-autistic opinion about OOP on /g/.
>>
>>58299699
Since you know C, learning anything else is easy.
You could make something in Javashit *tonight* that will get you a decent paying job. Nothing's stopping you.
>>
>>58300007
>>OOP is alright but not perfect
>balanced
Balanced between correct and incorrect
>>
>>58297080

That looks like a nice book. Do I need to know lots of math to understand it?
>>
I'm trying to figure out templates in C++ with a small library. Is it standard practice to include all template code within the header?
>>
>>58297948
Make a format
>>
>>58300102
Yeah.
>>
Let's say I'm starting a company, what's the best language for:
1. Best general development turnaround time
2. Best programmer coverage, the thing I can expect everyone to know. Is it still Java?
3. Any honorable mentions?
>>
>>58300124
thanks
>>
>>58300232
Javascript.
>>
>>58300232
1. Lisp/Scheme
2. COBOL
3. ObjectiveC
>>
>>58300232
Python/Java
>>
Is this any good?
https://lexi-lambda.github.io/blog/2017/01/02/rascal-a-haskell-with-more-parentheses/
>>
How would one represent if-else statements in Lambda Calculus?
>>
>>58300615
>autism combined with autism
>>
Started learning c++
It feels magical after only writing Java for the past year

People said it was a lot harder. But the only major difference is pointers and header files. Is there something else that I'm unaware of?
>>
>>58296944
It needs a lot of time to do and benefits are little.
>>
>>58300671
it's fun until somebody gets memory leak in the eye
>>
>>58300663
Yes, and?


>>58300650
true = \t. \f. t
false = \t. \f. f


Now a bool IS an if-else expression
>>
>>58300232
1. Python
2. Java
3. C# is extremly similar to Java, but more comfortable to write and faster, so if you're targeting Windows that your go to language.
>>
File: chs_mdl.jpg (135KB, 552x403px) Image search: [Google]
chs_mdl.jpg
135KB, 552x403px
Wrote a chaos-drawer in AS3, now just observing it draw shit, pretty fun.
>>
>>58299699
Javascript, Java, and C# (respectively) have many more jobs than C, C++, and Python which all have about the same amount of jobs.
>>
>>58300671

RAII. Learn how constructors and destructors work in C++, it may save your life.
>>
File: 010110361332565906.jpg (138KB, 1208x1040px) Image search: [Google]
010110361332565906.jpg
138KB, 1208x1040px
anyone up for some project? i have a simple request
>>
File: anal beads.png (67KB, 869x725px) Image search: [Google]
anal beads.png
67KB, 869x725px
>>58300914
reeeeeeeeeeeeeeeeeeeeeeee
>>
>>58300914
Free in freelance doesn't mean you don't have to pay.
>>
i have a input text like this
https://exhentai.org/gallerytorrents.php?gid=997556&t=9b6a5e9231
https://exhentai.org/g/997556/9b6a5e9231/
https://exhentai.org/gallerytorrents.php?gid=991383&t=3682e7c434
https://exhentai.org/g/991383/3682e7c434/
https://exhentai.org/gallerytorrents.php?gid=980374&t=19fcca50d1
https://exhentai.org/g/980374/19fcca50d1/
https://exhentai.org/gallerytorrents.php?gid=979238&t=bb3f28fae3
https://exhentai.org/g/979238/bb3f28fae3/
https://exhentai.org/gallerytorrents.php?gid=977561&t=76ac526ca6
https://exhentai.org/g/977561/76ac526ca6/
https://exhentai.org/gallerytorrents.php?gid=974323&t=640ca84952
https://exhentai.org/g/974323/640ca84952/


and i want to filter out the longer lines, i want to get
https://exhentai.org/g/997556/9b6a5e9231/
https://exhentai.org/g/991383/3682e7c434/
https://exhentai.org/g/980374/19fcca50d1/
https://exhentai.org/g/979238/bb3f28fae3/
https://exhentai.org/g/977561/76ac526ca6/
https://exhentai.org/g/974323/640ca84952/
>>
>>58300921
nice, saved
>>
>>58300944
Literally 300 ways you could do this.

Simple kludge:
var onlyShortLinks = myHentaiLinks.Where(x => !x.Contains("gallery"));
>>
>>58300921
>>58300921
>>58300921
>>58300921

This, a thousand times.
>>
File: imagem001.jpg (140KB, 1280x720px) Image search: [Google]
imagem001.jpg
140KB, 1280x720px
Hey guys currently on a class learning C, i'll lurk these threads during class, teacher is cool

If you have any request or suggestions drop em
>>
any c programmer here? i have a question
>>
>>58300944
grep -E 'g/[0-9]+/[0-9a-z]+/$' input_file.txt
>>
>>58300975
i see what you did there
>>
>>58300975
Hey, I might be a C programmer.
Is is alright if I inquire about your question?
>>
>>58300983
thanks nigga
>>
any expert in int avarages?
i have a question about calculating an avarage of two ints
>>
>>58300944

[user@laptop ~]$ cat panda.txt
https://exhentai.org/gallerytorrents.php?gid=997556&t=9b6a5e9231
https://exhentai.org/g/997556/9b6a5e9231/
https://exhentai.org/gallerytorrents.php?gid=991383&t=3682e7c434
https://exhentai.org/g/991383/3682e7c434/
https://exhentai.org/gallerytorrents.php?gid=980374&t=19fcca50d1
https://exhentai.org/g/980374/19fcca50d1/
https://exhentai.org/gallerytorrents.php?gid=979238&t=bb3f28fae3
https://exhentai.org/g/979238/bb3f28fae3/
https://exhentai.org/gallerytorrents.php?gid=977561&t=76ac526ca6
https://exhentai.org/g/977561/76ac526ca6/
https://exhentai.org/gallerytorrents.php?gid=974323&t=640ca84952
https://exhentai.org/g/974323/640ca84952/
[user@laptop ~]$ sed '/\/$/!d' panda.txt
https://exhentai.org/g/997556/9b6a5e9231/
https://exhentai.org/g/991383/3682e7c434/
https://exhentai.org/g/980374/19fcca50d1/
https://exhentai.org/g/979238/bb3f28fae3/
https://exhentai.org/g/977561/76ac526ca6/
https://exhentai.org/g/974323/640ca84952/
[user@laptop ~]$
>>
>>58301006
yeah, it's alright
>>
>>58301030
Are you sure?

>>58301019
Yes, I'm actually an expert on averaging integers in C:
/**
* Averages an array of integers.
*
* Averages an array of integers, without overflow or conversion to a larger type.
* It is equivalent to the sum of the array, divided by the array's length (rounded towards zero).
*
* @param n Number of array elements. Must be greater than zero.
* @param arr A pointer to an array of n integers. Must be non-null.
* @return The mean of the array's elements.
*/
int iavg(int n, const int arr[static const n])
{
int avg = 0;

/* A buffer of values that are lost to integer truncation.
* It should always be in the closed interval (-n, n).
*/
int error = 0;

for (int i = 0; i < n; ++i) {
avg += arr[i] / n;

int loss = arr[i] % n;

// error + loss >= n
if (error > 0 && loss > 0 && error >= n - loss) {
// error = (error + loss) - n
error -= n - loss;
++avg;

// error + loss <= -n
} else if (error < 0 && loss < 0 && error <= -n - loss) {
// error = (error + loss) + n
error += n + loss;
--avg;

} else {
error += loss;
}
}

// Fix some overcompensation for error

if (avg < 0 && error > 0)
++avg;
else if (avg > 0 && error < 0)
--avg;

return avg;
}
>>
>>58301038
Do you mind if I use this software? What's the license on it?
>>
>>58301068
>What's the license on it?
CC0.
It's on my github and everything.
>>
I think I'll be writing a CLI flash card game in Rust instead of my original idea.
>>
>>58301090
Make the CLI component log-based and design it in a way that you can easily tack on a GUI, because you ought to add one to it.
>>
>>58301090
online multiplayer?
>>
>>58301113
That's a cool idea. I can do that with Rust features.
>>58301165
No....
>>
File: pls.jpg (56KB, 1047x771px) Image search: [Google]
pls.jpg
56KB, 1047x771px
Can you guys help me with this?
>>
>>58301236
No, I can't.
>>
>>58301236
forward left forward right repeat
>>
>>58300973
Give me that girl's number
>>
>>58301292
It broke at orange but I found a soultion
>>
>>58301239
inb4 banned

What language/frameworks?
>>
Does anyone here have any idea how things like sqlite which store loads of data in a single large database file handle stuff like insertions?
>>
>>58295893
You're confusing the programming language with the implementation.
>>
>>58300973
lool how weirded out are your classmates
>>
>>58301486
I know Haskell is supposed to be a standard and everything, but it really has become synonymous with GHC.
>>
File: hack.jpg (34KB, 640x360px) Image search: [Google]
hack.jpg
34KB, 640x360px
>>58300973
>tfw have to teach a Perl class
>>
File: pls.jpg (255KB, 1920x1080px) Image search: [Google]
pls.jpg
255KB, 1920x1080px
How about this one?
>>
>tfw this whole board is full of normie
>>
>>58301513
what's so hard about it?
>>
>>58301554
I don't know what to do after the blue square
>>
>>58301513
>those tabs
>those bookmarks
>that taskbar

Kill yourself.

Why are you wasting your time with that when you could be learning a programming language?
>>
>>58301565
Change turning always right to always left at the green squares.
>>
File: file.png (286KB, 1554x877px) Image search: [Google]
file.png
286KB, 1554x877px
graphical programming of any kind was a mistake
>mapping 2 axis and 2 keys
>this autism comes into existence
>>
>>58301574
I'm doing this to get a free programming course for 2 years.
Whats wrong with my tabs?
>>
>>58301577
Then it wont work for the first portion
>>
>>58296552
And then you have lisps which are both and more
>>
File: Screenshot_2017-01-03_16-14-51.png (140KB, 1058x625px) Image search: [Google]
Screenshot_2017-01-03_16-14-51.png
140KB, 1058x625px
Patched X-Links to work on my shitty imageboard. Think I've worked out all the bugs and styling incompatibilities now.
>>
>>58296647
Use both, multi-paradigm languages are rad.

Or wait for mainstream acceptance of actor model, it will be really efficient once multi-core machines become a norm.
>>
>>58296841
Well you had Fortran and first Lisps
>>
>>58301620
This. Besides autism, there's no good reason not to use multi paradigm langugaes.
>>
>>58301599
it changes at the blue square so you've already done the first portion at that point. jesus christ if you can't even manage this how are you going to pass the course
>>
Functional programming thread:
>>58301640
>>
File: imagem002.jpg (189KB, 1280x720px) Image search: [Google]
imagem002.jpg
189KB, 1280x720px
>>58301318
dont have she got a boyfriend tho i think, but kinda hot

>>58301487
here's the teacher
>>
>>58301644
Dude, come on. I already know how to program, I learned Delphi, Java and HTML. Just taking the course to be in a programming environment. If it were as easy as writing lines of code I'd have been done already.
>>
>>58301629
Modelling data with oop, using higher-order functions on it, metaprogramming new paradigms, using some imperative in bottlenecks, ... Limiting yourself to single-paradigms (c, forth, ...) just hurts.
>>
File: pls.jpg (28KB, 571x203px) Image search: [Google]
pls.jpg
28KB, 571x203px
>>58301644
But by all means, I ran out of time anyways, solve it
>>
>>58301748
Is OOP really good for modeling data? I would tend to think the opposite.

In F# I on rare occasion find OOP really handy for keeping certain kinds of code organised. Putting code in abstract classes that I only want to be accessible by super classes for that class is sometimes nice.
>>
>>58301766
>Is OOP really good for modeling data?
If you're asking if object are good for modeling data, then yes.

For example, if you're given a JSON or XML object with attributes and values, it's really easy to create an object that represents that data.

Then, once it's in memory in your program, you can safely reason about it or convert it into more business-model-friendly objects that are more relevant to the usage in your application.
>>
>>58301766
Depends on language, CLOS can be used for this purpuse quite well (if a bit inefficient).

Perhaps I used the wrong words, I meant implementing new "types" of data and modifying operations to work on them via specialized methods (CLOS).
>>
>>58301682
I don't care if she has one. Show her my post
>>
>>58301801
I guess I'm splitting hairs a bit here over what "objects" means. But you can do all that shit with simple structs and records. No need for OOP style objects with encapsulated state and polymorphism and that shite.
>>
>>58301836
Well encapsulation isn't really in definition of oop (lisps and smalltalk which pioneered it arguably didn't have it). You can have encapsulation without oop and vice versa.

Yes, you can do it with structs, but oop allows you to specialize data-types through inheritance.

And yes, Java and c++ style oop is useless, but lisps and some scripting languages have useful oop.
>>
>>58301836
Well, that's where the business-model objects come into play.

You take the data that someone else already modeled externally and remodel it to suit the needs of your application. This often involves breaking it down or combining it to create many new objects that have the qualities you mentioned.

Then, within a massive application, this process is repeated as different swaths of the application have need to treat data in various ways, with various levels of protection and compatibility with other representations of this mish-mash of data.
>>
>>58297982
Language & missing features ?
>>
>>58301864
>Well, that's where the business-model objects come into play.
I don't get it. That's where what comes into play.. OOP? I don't how OOP is helpful in this situation at all.
>>
>>58301814
no u autist
>>
>>58301880
In a sufficiently complex application, the business-model objects will be designed to use all of the OOP components you'd think of, with whatever design patterns and concepts necessary for the task at hand.

These are decoupled from the external data objects that are simple models to contain the external data as-is.

Are you asking how people use various object-oriented design patterns within an application?
>>
>>58301942
>the business-model objects will be designed to use all of the OOP components you'd think of
yeah, but why is that a good thing? Would those business-model objects not be much better written with functional concepts? I can't see where OOP patterns would be preferable to functional ones here.

>Are you asking how people use various object-oriented design patterns within an application?
I know that. I'm asking which of these patterns do you think is superior to a functional alternative?
>>
>>58301913
Are you afraid to talk with her?
>>
>>58301682
show her your rarest pepe
>>
>>58300973
Do you have aspergers? Those people do not look very happy.
>>
>>58302062
its a unemployment measure they put us learning C because there are no jobs, everyone is unhappy
>>
>>58302100
random normies are being taught C?

What country is it?
>>
File: baka_big.png (2MB, 2000x2000px) Image search: [Google]
baka_big.png
2MB, 2000x2000px
>>58301999
I'm not going to sit here and explain the myriad of tools are your disposal in functional programming, or in OOP.

Both should be used as the situation warrants.

I shouldn't need to explain the uses of public/private members in a class, and why they're extremely useful for maintaining restrictions on what a piece of data can look like when all is said and done. Things like interfaces help you form "contracts" about what an object must be able to do. Anything else you can think of is meant to serve the purpose of being easy to modify and maintain by a large team of programmers, on a large codebase.

In any case, this is pointless because FP and OOP are NOT opposing things.

You can interchangably use functional programming practices with object-oriented design patterns, and you should be well-versed in the usage of both.

There aren't direct alternatives to every concept in OOP/FP, because they're not necessarily different approaches to the same problem. They are tools meant mostly to solve different challenges.

Stop making it OOP vs FP, and learn to use both as you see fit. If you feel that you have absolutely no use for the various design possibilities that OOP provides, you're welcome to not use them. If you're doing it out of some odd sense of superiority without understanding what the various approaches are and when they're used, then you're only hamstringing yourself.
>>
>>58302107
Portugal
>>
In OpenGL.

Let's suppose I have an Array Texture with 128 layers, and I want to make it bigger. What's the best way?

Do I need to create a new Array Texture of 257 layers (for example), copy all the layers from the old Array Texture to the new one, and delete the old one?

Seems potentially slow. Is there anything better?
>>
>>58302122
>I shouldn't need to explain the uses of public/private members in a class, and why they're extremely useful for maintaining restrictions on what a piece of data can look like when all is said and done. Things like interfaces help you form "contracts" about what an object must be able to do.
You can have private members in a module in functional stuff, and achieve the same stuff with closures (as is common in JS). Interfaces are not OOP concepts and are a big part of most functional langugaes.

>You can interchangeably use functional programming practices with object-oriented design patterns, and you should be well-versed in the usage of both.
That's exactly what I do, and I consider myself well versed in both. But I'm surprised that you claimed that OOP has a big advantage with large business-logic codebases, and is more useful than FP on the whole here. I'm just can't see what your rationale is here.
>>
File: arm.png (24KB, 793x103px) Image search: [Google]
arm.png
24KB, 793x103px
am i missing something about ARM assembly or does this function just do nothing at all?
>>
>>58302195
Depends on how it is called. But that's pedantry, it does nothing. Your compiler may be optimizing things away redundantly.
>>
>>58301486
Is this the new "communism has never been tested"?
>>
File: MVI_4051.webm (2MB, 1280x720px) Image search: [Google]
MVI_4051.webm
2MB, 1280x720px
>>58295854
>What are you working on, /g/?
we can now shift in data.
Means we only used 5 pins on our attiny13 and now have 8 input and 8 output pins :^)

Will try to get shit down to actual only 3 pins, but I think that might be impossible. BUT WE WILL TRY
>>
File: 1458275444652.jpg (68KB, 700x700px) Image search: [Google]
1458275444652.jpg
68KB, 700x700px
>>58302541
Delet this
>>
>>58301038
I can't get that shit to compile under any supported version of C or C++ using GCC.
>>
>>58302592
You're confusing the post with the butthurt resulting from it
>>
>>58302582
Nice. I remember learning about that in embedded systems but then I switched out of computer engineering because I hate electronics.
>>
>>58302582
Why do you need 5 pins? Given the right equipment you could do two.
>>
File: IMG_20170103_172216764.jpg (2MB, 2340x1755px) Image search: [Google]
IMG_20170103_172216764.jpg
2MB, 2340x1755px
lol it just fuckin works and now we got two more real pins and extended 3 pins of the µC to actual 8 pins. Nice

Just had one minor bug (one clock cycle too much). This was it.
>>
>>58302770
I don't think you can get a 74hc595 shift-out register working with two pins. Not sure though.
>>
>>58302814
Like I said, right equipment. I'll have a look at the datasheet and give any ideas if they pop up.
>>
>>58302834
Yeah okay the right equipment, I don't want to wait 4 weeks till the right equipment arrives from china though :^)
It doesn't matter either for learning purposses.
>>
>>58302195
total random guess, but EXPORT is probably a symbol for the dynamic linker to resolve that function from a shared object.
>>
>>58302541
Well ofc it was, just not in Soviet russia. Check out rojava and aragorn 1936.

And yeah, while implementation doesn't mean language is shit, it still matters a lot, especially since ghc is the only mainstream one. Especially since many features of haskell which make it beautiful and powerful make it practically impossible to compile it efficiently.
>>
File: imagem007.jpg (150KB, 1280x720px) Image search: [Google]
imagem007.jpg
150KB, 1280x720px
just learned about strings boizz
>>
>>58299240
telnet 127.0.0.1 8080 <<END
GET /index.html HTTP/1.1
host:127.0.0.1

END
>>
i looked over a program i had written and i accidentally used | instead of ||. this is in C. it had the effect i intended, but idk why it worked. does | mean the same thing as ||?
>>
>>58302846
I see what you have now. Shared clock, input and out enable, input and output data. 5 pins.

With a single transistor you could cut out one of the enable pins. Unless you cared about both being off at any time. With some more effort you could cut the data pins down to one.
>>
>>58303047
pull teacher's wallet, establish dominance
>>
>>58303057
https://en.wikipedia.org/wiki/Bitwise_operation#OR
>>
>>58303047
I'm still waiting for that linda's number
>>
>>58303047
your mom's a string
>>
>>58303102
what's the reason for having logical or be separate from bitwise or then? it seems as if bitwise can do both
>>
>>58303077
Oh yeah, with a few latches, you could reduce your need to 1 pin for enable while still retaining your ability to have both off.

Send a start bit and an end bit with your data and have that enable pin fire pulses to the latch to capture the start and end bit for the TX and RX enables.
>>
>>58303146
2 & 1 == 0, 2 && 1 == 1
>>
>>58303057

| is the bit-wise OR operator, whereas || is the logical OR operator.

True || False evaluates to True

True | False evaluates to True because 1 | 0 evaluates to 1

1100 | 1010 evaluates to 1110
1100 || 1010 has no syntactic meaning

It's always preferred to use || instead of | when using it for logic, as it can take advantage of short-circuiting as well as readability of intention.

Same shindig for & and &&.

Short-circuiting:
In a case of True || operation() the operation() doesn't need to be executed because it will result with True regardless.
Same goes for False && operation()
>>
>>58303146
is_ok() || fatal_error();

short circuiting is the main reason. || and && are both overdetermined, meaning anything other than 0 is true, which doesn't work with bitwise.
>>
>>58303246
>1100 || 1010 has no syntactic meaning
In C, anything other than 0 is true, so that does have meaning.
>>
hi famalams
im second year cs student and got a project to do in java (mostly using composition and inheritance)
whats the strategy to building big programs? do I start wherever and fill in the gaps?
>>
File: Untitled.webm (3MB, 1920x1080px) Image search: [Google]
Untitled.webm
3MB, 1920x1080px
>tfw you'll never be done with your project
>>
>>58303470

Stub out everything first, then fill in.
Have a plan for what everything does and how they interact, then implement.
>>
>>58303470
you design it first, and then you implement your design
>>
>>58303520
How did you do the frosted glass effect?
>>
>>58303562
https://en.wikipedia.org/wiki/Windows_Aero
>>
>>58303470
The first thing I do is visualize what modules (= classes) the program needs. Next up is figuring out all the tasks (= methods) each module needs. Finally you can start implementing the modules and its tasks and wire them together.
>>
>>58303553
>>58303556
how do I do that? write it in a piece of paper or something? last year it was easier cause I could think all of the algorithm in my head they were short.
any video to watch/something to read so I understand it better?
>>
>>58303574
I see. Does that shit still work on Windows 8/10?
>>
>>58303574
>>58303623
dunno. I've only used it on win7

also, DwmExtendFrameIntoClientArea is what does it:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969512(v=vs.85).aspx
>>
>>58303635
Yeah, i remember reading about that stuff. Was just wondering if that's what you used or something else.

Neat shit.
>>
What's a good alternative to relational databases for large amounts of ordered data and selecting intervals thereof?

In my experience (having tested several database servers/engines) even on indexed fields large queries which include ORDER BY and BETWEEN tend to be relatively slow since SELECT queries inherently don't preserve order.

I've found some CompSci literature referencing this in the context of RDBMS and presenting some algorithms but as far as I can tell no major SQL database engine implements them.
>>
>>58303619
you make class diagrams and other UML shit
>>
>>58303663
https://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
>>
how hard would it be to create a ''assembly (mips like but simplified) instruction set architecture simulator" on java/c++
something that takes hexadecimal instructions from the users and does shiit
I got to do it as a project in 1 month and seems hard right now desu senpai
any tips if u ever done something like it?
>>
>>58303663
Are you looking for in-memory column storage?

Using a RDBMS meant for this would be effective. Try DashDB or SQL Server with appropriate clustered indexes and in-memory columnar storage.
>>
>>58303710
Code a small lisp interpreter in java/c++ first (or, even better, compiler). Then implement simulator in lisp.

Believe me, you will finish quickier that way.

Use this book:
http://www.buildyourownlisp.com/
>>
>>58303710
>>58303742

More serious answer:
Make a machine class, which has slots for registers, a memory array, ... And a function for each instruction you need to have. Then write a parser that will translate hexadecimal input into function calls (a simple case expression is good enough).
>>
>>58303779
This is the easy "software" way.
>>
>>58303619

Sure, piece of paper, dry-erase board, notepad.exe, XMind, whatever works for you.

You could use a UML class diagram for structure, or a rough flow chart to show the flow of control.

Once you're confident with that plan, you can start stubbing out your container classes and methods (better yet, interfaces), with the parameters/return types you'll want to expect.

public static double computeArea(Shape shape) {
// TODO
throw new UnsupportedOperationException();
}
>>
new thread: >>58303825
new thread: >>58303825
new thread: >>58303825
>>
>>58303814
He said he needs instruction set architecture simulator, not cpu simulator.

For cpu simulator read a bit about cpus, about stages through which data goes (from decode instr to alu) and simulate each stage as a function/object.

If this is still to softwarey, use fpga and some hdl (I recommend spinalhdl).
>>
Detecting URLs in text. Is there a better way than this?

private boolean isLink(String copiedText) {
try {
URL url = new URL(copiedText);
} catch (MalformedURLException e) {
return false;
}
return true;
}
>>
>>58298761
I'm running Linux so I guess that. What libraries should I start getting familiar with?
Thread posts: 316
Thread images: 35


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.