/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1475251663178.jpg (800x693, 282K)

Other urls found in this thread:

rbt.asia/g/thread/69622815/
youtube.com/watch?v=t1e8gqXLbsU
youtube.com/watch?v=bnRNiE_OVWA
youtube.com/watch?v=ZhuHCtR3xq8
docs.python.org/3/library/subprocess.html#popen-constructor
twitter.com/SFWRedditImages

nth for Nim!

JavaScript rocks!

Attached: js-rocks.png (1000x494, 368K)

How many of you have *actually* read SICP?

new thread when? :3

I have, why?

>What are you working on, Jow Forums?What are you working on, Jow Forums?
starting a materials selection program with integrated reference management, proper data filtering/search/comparison, interop with external fe/md programs, and [spoiler]pretty scientific viz/figure designer[/spoiler]

Attached: 573245123.jpg (1920x1080, 263K)

Is "Learn you a Haskell" a good introduction to Haskell?

fuck off weeabo

Why not start reading and decide yourself. It's free.

I know this question might be retarded:
I am doing some dataset analysis in matplotlib, and I have this issue where it won't process the dataset because one column only got string values while the 2 others are float.
How would I turn the String into a float?

making a mock API to develop against because the team that is responsible for that API are taking a month to give me the API key.

Attached: tired2.png (1022x731, 643K)

and that applies to an entire column with 199 unique strings which is 39601 rows long

Any y'all programming nibbas feel like helping a guy out?

So, this is my first attempt to independently create a basic program in Java that either accepts an ATM PIN number or denies it. But I'm running into an issue. If I type in an incorrect PIN number not equal to 617008, it'll give me the message that the PIN is incorrect, but the program will not let me try again in the console.

I tried to rectify this by inputting a scanner function into the if statement, but that doesn't seem to work either

>TL;DR: Trying to get the program to accept repeated PIN number inputs

Attached: ATM program.png (867x315, 40K)

Sure buddy
first thing you do is to uninstall java
then buy some rope, tie a noose and kys

Should I get over the dread of posting an issue on github when someones library fails to build?
I just always feel like it's just my fault and maybe if I weren't an idiot everything would work fine.
Windows, obviously, I'm an idiot.

I stopped at chapter 3 and was meaning to pick it back up but I got things to do.

>he needs open sores in his project

Attached: 53821752815721.jpg (820x550, 42K)

Act like the retard you are, post the issue and wait to be spoonfed. They'll answer your question to avoid bad rep

Thanks, man. I'll try that

a loop

You'll learn eventually about while loops, just keep reading whatever resource you use to learn Java.

This is very trivial but I am stuck.
I have a main.c
and 1 static library, e.g. libsdl2.a
Both in the same directory.

I am trying:
>gcc -static -lsdl2 main.c
gcc returns one error at
>#include
No such file or directory.
I cannot fucking link statically that library and I am trying every possible way the last 2 days.
I cannot tell that useless linker that the library is present and use it to make the binary.
Can someone help on this?
I ddged and as usual useless irrelevant answers come up from SO.

I read everything except chapter 5.

What you want is a loop.
Whatever learning resource you have will cover them.
Post your code in
[.code][./code] tags (remove .)


so it's easier to help.
I can show you what you wanted if you do that.

As an owner of an open source project, I would welcome any issues, even if they are easily resolved or due to a misunderstanding by the person reporting the issue.

There's no need to be mad at SICP, you can post your image here too.
rbt.asia/g/thread/69622815/

Attached: 1513665014505.jpg (380x380, 14K)

ask question, if you were an idiot and you found out yourself before they answered you can just post yourself what the problem was and save another retard some time.

why is there so many retards lately on Jow Forums who fail to construct or understand a trivial programs?

I did.

Oh.

What if I want to do
instance Show Foo where
show (Bar x) = helper ++ (show x)
show (Baz _ x) = helper ++ (show x)
where helper = "I'm helping! "
?

0.7 times

Jow Forums has always been a mix of different competence levels, just like the real world. Don't act like this is anything new.

The issue isn't with the library, it's with the header (sdl.h). Make sure you have sdl2/sdl.h in a standard place like /usr/include, or check if you need to tell gcc where it is with -I.

I'm finishing up erasure for method generics for my little Lisp-like on the JVM and just about to start with implementing specialisation using invokedynamic.

i did. best read ever, enlightened me tremendously.

Attached: sicphave.png (603x702, 494K)

instance Show Foo where
show xs = case xs of (Bar x) -> helper ++ (show x)
(Baz _ y) -> helper ++ (show y)
where helper = "I'm helping! "

So, if I install the library, sdl2 from the packages it will install the header files and the dynamic library files, the .so .
This will compile fine even with the -static, but it won't make it static because it won't find the .a files.
Where do I have to place the .a files?
If I place them unde rthe same path as main.c I think I have to specify -L. -lsdl2
-L. To tell it that under this dir is the library and the library is -lsdl2.
Is this correct, or am I missing something?
P.s.: thanks for the reply

I think newbies are intimidated by /dpt/.
If you look at other programming related threads (when they pop up).
There's countless people who are obvious newbies.
What springs to mind just recently was one of those "post your emotions as code" threads where they tried to systematically define their lives. It was all exceptionally crap.

Or maybe people who would come here for help actually google first and find SO posts.

Cross platform build support is always difficult and a pain in the ass.
No one like supporting that shit and especially so when it is not legal to redistribute the C runtime platform headers so it is not possible to cross-compile.

It's something that everybody would like to have but it is just painful to setup and do.

Why not?
helper = "I'm helping!"

instance Show Foo where
show (Bar x) = helper ++ (show x)
show (Baz _ x) = helper ++ (show x)

man, c++ is ugly

Guy you're responding to here. Because, shit for brains, not all of us in here are programming wizards. I'm a total newfag at this stuff

no u

I admire his clever presentation.
It makes him look like an amazing programmer.
Not trying to imply he's bad but it just enhances the perception of him way beyond what's reasonable.

>why isn't everyone smart?
>because some are dumb
*Sigh* You're both idiots.

What's your favorite uncommon datastructures?

linked lists

fixed length array
i code in sepples and onleh use vectores

char arrays

I have the first edition, so I'm not on the same one that pretty much everyone else reads, but I've done the first couple chapters. Was planning on getting through another few pages this evening.

You rock!

I think I got it. 700kB just one include, one return and mothing else.
Documentation is non-existent god damn it.

contiguous regions of memory

What’s your favorite C# learning tool for beginners?

That works. Looks shitty but it works. And I still can't manage to apply it to my real problem. Thanks anyway.

I might have to do that, but I'd prefer to keep the scope of the helpers limited.

have you contributed to nimble.directory yet?

I found it to be very, very helpful. I didn't understand Haskell at all until I walked through the first couple chapters of Learn you a Haskell.
These videos were also very helpful to me:
youtube.com/watch?v=t1e8gqXLbsU
youtube.com/watch?v=bnRNiE_OVWA

I don't know if this counts as "uncommon," but I've always liked fibonacci heaps.

Attached: nim.png (1187x900, 42K)

Semantic whitespace sucks. Especially in Haskell.

I forgot, this video is very helpful, too. youtube.com/watch?v=ZhuHCtR3xq8

Attached: 1542523277131.png (1075x1518, 1.76M)

more tiddies pls

Her tits are too big

And for those that might help I did the following.
Used -static to declare that I want static linking.
I have installed the dev library from the repos that doesn't have the static library.
I compiled the same version to get the .a file in some other dir.
I created a folder "lib" under the and placed the. A files there.
Used -L./lib/ to declare the path od the .a library
Used -ltcl (e.g. let's compile with libtcl) to denote the library I want.
This does 2 things. Searches for the .h files in the previously installed dynamic library and then picks the ma file and merges it with the binary
That's all.

Her tits are just right.

tries

I am trying to run a simple cat command inside my python code.

import subprocess
import os

def copy():

if os.path.exists('{}/Data'.format(os.getcwd())):
os.chdir('{}/Data'.format(os.getcwd()))
# print(os.getcwd())
subprocess.Popen('cat *.csv > Data.csv')

print("Finished copying. Data copied into 'Data.csv'")


However I get an error when I try to run it.
No such file or directory: 'cat *.csv > Data.csv': 'cat *.csv >
Data.csv'


I tried testing os.listdir and os.getcwd in the interactive mode in python and it is working correctly. The bash command is also correct.

Where is my error?

Also, yes, I'm completely new to programming.

instance Show Foo where
show foo = "I'm being helped! " ++ helper x
where
helper (Bar x) = show x
helper (Baz _ x) = show x

No they’re unrealistic and no guys likes or wants breast’s that big on a girl

if the lib is in a specific directory, you'll do -l:path/to/the/library.a
otherwise, sounds correct to me.

is there a correlation between c++ users and mental illness?

>they’re unrealistic
Not an argument.

Welp, I just replaced subprocess.Popen() with os.system().

I tried to not use os.system() because they said it was deprecated and thatI should use subprocess instead...

Attached: 1538996737118.jpg (640x640, 31K)

sunk cost + stockholm syndrome mostly.

>no guys likes or wants breast’s that big on a girl
Speak for yourself gaybo.

>subprocess.Popen('cat *.csv > Data.csv')
It's supposed to be a list not a string.
So
subprocess.Popen('cat *.csv > Data.csv'.split())

Yes, I made a mistake.
Use -L to denote the folder in which you have the static libraries
And -ltcl to tell gcc where to pick the header files from the system(e.g. under /usr/include)
OR as you said you can use -l: to tell gcc where to pick the header files from in case you use a different location.

>nobody wants them like that
I think the image itself is a statement against that.
This isn't some horror illustration.

Attached: file.png (1079x1074, 946K)

gay

>I tried to not use os.system() because they said it was deprecated and thatI should use subprocess instead...
I generally stay away from Python nowadays (I use Nim now when I would have used Python) and I remember them saying that back then, too. As far as I'm concerned, if you're doing something simple, there's no reason to get all fancy with subprocesses.

Tried using your method just for discussion and learning and got;

Finished copying. Data copied into 'Data.csv'
cat: '*.csv': No such file or directory
cat: '>': No such file or directory
cat: Data.xlxs: No such file or directory

Haskell's Layout is quite flexible. If you don't like that long line style, you can do
instance Show Foo where
show xs = case xs of
(Bar x) -> helper ++ (show x)
(Baz _ x) -> helper ++ (show x)
where helper = "I'm helping! "

or delegate the match to another function like

>Also, yes, I'm completely new to programming.
Learn to read the docs.
docs.python.org/3/library/subprocess.html#popen-constructor
>By default, the program to execute is the first item in args if args is a sequence. If args is a string, the interpretation is platform-dependent and described below. See the shell and executable arguments for additional differences from the default behavior.
>The shell argument (which defaults to False) specifies whether to use the shell as the program to execute. If shell is True, it is recommended to pass args as a string rather than as a sequence.

That works fine too, I guess.

dear god no.

>As far as I'm concerned, if you're doing something simple, there's no reason to get all fancy with subprocesses.
Cool, this should be a simple script only I would use, so yeah.

Thanks a lot.

>>The shell argument (which defaults to False) specifies whether to use the shell as the program to execute. If shell is True, it is recommended to pass args as a string rather than as a sequence.

Oh! Got it working now.

Thanks a lot.

>dear god no
You're probably right. It's been quite a while. I didn't usually use .split() obviously. I did construct lists of arguments though most of the time I don't have static commands to run like that.
I don't remember where I got that from. I thought it only took lists actually. Should probably just ignore what I said.

As a sepple programmer, I can't refute this.

Still, I know of no better alternative that lets me do what I want the way I want to.

The way you want is sepples for the two reasons you just agreed to. Anything different triggers your defense mechanisms to start throwing out irrationalities as to why better things aren't better.
Scientists really need to study the black magick that sepples creates.

f-fuck you buddy

>The way you want is sepples for the two reasons you just agreed to.
I am aware.

Is that guy who was writing SDL2 for 2D graphics here? I bet his program had a memory leak in itself, and I wanted to try and resolve it. If a 2d_blit function actually had a leak, that'd be pretty egregious and should be resolved if it actually exists.

a_to_f? Dunno your language

The earlier a problem is solved the earlier it's solved for everyone else. I've had compiler issues that weren't resolved last time the one or two other guys had them (of all google results). I've gotten better compiler/IDE awareness because I couldn't get a feature of a library to be included (better at the language too).

If it's a project you like, if you keep using the software you may have ideas that are useful that the developer hasn't thought of, if it's in active development. I like coming to /dpt/ because I know enough to be dangerous.

wat

Posted this is /sqt/ but no response. So this IS a stupid question, but...


Using python3 and curses.

For an existing pad, is there a way to get the current y,x position and current display area of the pad?

Basically if I want to call a pad.refresh() keeping some of the properties the same as they currently are, is there a way to do that without tracking all the variables myself?

Attached: do_it_plz.jpg (383x450, 10K)

>your favorite programming language
>you favorite thing about it

Attached: 1549047016474s.jpg (250x187, 7K)

>your favorite programming language
c++
>you favorite thing about it
it's c++

>your favorite programming language
Scala
>you favorite thing about it
support for typeclasses

Are "type classes" in Scala anything more than basic-ass Java interfaces?

>when it is not legal to redistribute the C runtime platform headers so it is not possible to cross-compile
On GNU+Linux, you can get a software to dump a library from a DLL (or with a header). I was wanting to get a program to work with Code::Blocks on Windows, except they only released a few versions for other compilers. I can't seem to find the program I used, it was a few years ago.

Circular buffers. "chasing" buffers, where a read and write pointer are in the same region. If it's a buffer that supports sloppy timing, you can read and write at fixed rates, and even if you don't receive enough data to write, the read pointer will just wrap around garbage until it re-synchronizes.

They are totally different. I'm not talking about traits, which are basically improved interfaces. I'm talking about the pattern we have with implicit parameters that allows boilerplate-free ad-hoc polymorphism.

Please elaborate on this.