[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: 30
File: 1451683583776.gif (2 MB, 400x600) Image search: [Google]
1451683583776.gif
2 MB, 400x600
Post github/progress edition

Old >>52564360
>>
>>52566734
PROTIP: don't use Python
>>
>>52566734
>3DPD
Kill yourself
>>
>>52566755
this
>>
>>52566755
This. Python is horrible.
Other horrible languages include: java, C, php, nim.
>>
>>52566764
back to /r9k/ virgin loser
>>
>>52566755
I'm writing in python and there's nothing you can do to stop me.
>>
>>52566755
PROTIP: don't use Python if you plan to continue being a neet
FTFY
>>
>>52566544
How do you know the errors a function might throw in Haskell if you don't have access to the code? Is there a way to enforce error handling?
>>
>>52566802
Option types and other monads. I.e. you receive not an int but rather an Either Int Error and thus you must handle that explicitly or discard the error explicitly. At the same time, it's very simple to do because lolpatternmatching
>>
>>52566802
MonadError
>>
File: Screenshot_2016-01-22_16-05-51.png (141 KB, 1562x755) Image search: [Google]
Screenshot_2016-01-22_16-05-51.png
141 KB, 1562x755
>>52566692
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjGwfGhtr7KAhXMn4MKHaj_Aq0QFggdMAA&url=https%3A%2F%2Fwww.cl.cam.ac.uk%2F~sd601%2Fpapers%2Fmov.pdf&usg=AFQjCNGi6wDWII6geParko-8XQ3ttDEsCQ&sig2=G6CW8zS8u0mKSAzSO60UbA&cad=rja
>>
r8, h8, masterb8
>>52566767
>>
>>52566802
effectively, purity and types enforce it
it's nice to have some explicitness for ignoring errors.
in go it's foo, _ = bar(), in most other languages something else.
meanwhile, using stuff like the throws statement or exceptions makes this implicit as well, which sucks, because errors are present in most functions.
>>
>>52566856
The paper isn't being very honest, though. The tape starts with some 1's and some 0's instead of all blank, and they're also using a jump because mov isn't strictly enough by itself.
>>
>>52566755
how do we stop talking shit about tools and just get to work faggots.

show something you're working on, some code, a screenshot, anything.

unless, you can't into code of course.

I bet most of you can't code and only masturbate to fizzbuzz.

Hell, I would gladly talk about css or html rather than hearing you faggots talk shit about the dumb shit you always talk dumb shit.
>>
>>52566897
in my job all we do is optimize fizzbuzz code
>>
>>52566924
t. elite /dpt/ c programmer
>>
If I made a game in Java that could be customize-able, do I need to add something like lua or javascript (which I know is not related to java).

I'm taking a java class and while i'm not very far into it, I see that the .jar file can be opened in a folder program, so I was just wondering if that's where things are added/modified.
>>
>>52566755
What about us scientific programmers?

We aren't real programmers, but we still need something to program in to realize our shitty ideas.

Should we really program in FOTRAN/C so we can take a month to save 3 minutes on a optimisation 30 minute optimization instead of just writing it in Python in a few dayts and focussing on more important things?
>>
>>52566856
i guess i don't really understand -- isn't it obvious that mov instructions would be turing complete since it is implemented in a turing complete machine?
>>
>>52566897
anyone who's working on something valuable enough wouldn't just share it with everyone or they might not be allowed to share it
>>
>>52567006
Use julia.
>>
>>52567006
you act that python isn't already the standard for the scientific community and isn't nearly as fast as C (because its backend *is* C)
>>
>>52567035
Python is magnitudes slower than C, you delusional fuck.
In fact, it's one of the slowest languages in common use.
>>
>>52567060
>being this retarded
>>
why do people shit on Python so much and almost don't do it for Ruby around here?
>>
>>52566734
gross vapid cunt
>>
>>52566870
I read the wiki article about monad structures and it sounds interesting. Too bad I'm having a hard time understanding Haskell code. F# on the other hand is much more readable.
>>
>>52567060
apparently there's some numpy library shit or whatever implemented in C that i guess you load up with data and instructions and let it do the computational work
>>
>>52567006
>>52567060
https://www.ibm.com/developerworks/community/blogs/jfp/entry/A_Comparison_Of_C_Julia_Python_Numba_Cython_Scipy_and_BLAS_on_LU_Factorization?lang=en
>>
>>52567071
Nobody uses ruby (except that one retarded tripfag that everyone tries to ignore), while shills are evangelizing python. They're both shit (and ruby is less shit than python), but disapproval must at least come to match approval lest the opinion is lost to the hivemind.
>>
>>52567060
numpy is not slow, sorry anon. All the combinitorial algos in itertools are nearly as fast as C, I've tested it. The interpretter itself is slow, but if you spend a lot of time in functions written in C, it's as fast as C.
>>
>>52567083
>numpy
I can't help but read it as 'numpty'.
>>
>>52567071
Because Rubyfags aren't as obnoxious as Pythonfags.
>>
>>52567071
because ruby isn't as popular and most people already agree that ruby is shit, while python memers unironically believe that their language isn't shit and they try to shill it to beginners who don't know what they're getting themselves into
>>
>>52567096
Not him, but how noticeable is the overhead for calling C code from Python and vice versa?
>>
>>52567093
>ruby is less shit than python
Not it isn't... Really, try it.
>>
>>52567092
Who cares about LU fact, though? It's not like anyone cares about efficient integer programming in 2016.
>>
File: 1438960401975.png (302 KB, 1920x1080) Image search: [Google]
1438960401975.png
302 KB, 1920x1080
>>52566734
I'm gonna cross out all the numbers on the list. Currently I have none crossed out.
>>
>>52567109
I did. It's less shit. They're both shit but ruby is genuinely better.
>>
>>52567107
Negligible overhead. Pure python functions are obviously going to be slower though. But if you are going to use a language as a C extension library Lua is better. It's API is MUCH cleaner.
>>
>>52567018
I'm sure real programmers can still talk about some interesting part or problem, but dpt is just shitposting and retardation arguing about the same shit every day.

Hell, I'm currently trying to make a GUI in a website using basic javascript and javascript shit.

But no, we get:
Huh duh language shitposting.
>>
I solved 63 problems on Project Euler, using Python mostly. I'm a NEET with an average IQ. Can I become a Real Programmer and make money?
>>
>>52567124
What about it did you like compared to Python?
>>
>>52567148
DPT has a lot of beginners.

>Hell, I'm currently trying to make a GUI in a website using basic javascript and javascript shit.
Yeah, beginner stuff.

So, do your best to help everyone out and stop complaining about people beginners, like yourself.
>>
>>52567113
But.. all of this is too hard.
>>
>>52567071
Most people are jealous of python users' quick development
>>
>>52567157
The pure object system. It allows more streamlined and more regular interactions with any part of the program, and allows simulating many functional programming techniques cleanly. It was also a lot more consistent than python with regards to syntax as well as scoping rules and didn't (seem to) have features that are virtually unusable due to how crippled they are (hellooooo, python lambdas!)
>>
>>52567148
well i brought this up but no one seemed to care

https://www.youtube.com/watch?v=MqZgoNRERY8

you can tinker with it to get some decent tunes out of it

i'd like to know more about this topic, like generating music while barely using any CPU and memory
>>
File: 1452884246916.jpg (28 KB, 273x282) Image search: [Google]
1452884246916.jpg
28 KB, 273x282
Are we still on Python subject... really?
Of course it is slower than C and not good for beginners.
You dont even need to know much else about it except that it is interpreted with many built in,ready to use functions so a beginner would think that programming is all about calling ready functions for adding numbers instead of understanding how to write it themselves.
>>
>>52567183
I refer to the python development model not as quick development but rather as quick, back to debugging before we pass the deadline!
>>
>>52567148
>Hell, I'm currently trying to make a GUI in a website using basic javascript and javascript shit.
use HTML+CSS for that for the love of stroustrup
>>
>>52567152
Sure. Doubt you have an average IQ if you got above 30. Only on 51 right now.
>>
>>52567168
So?

I know I'm a begginer but I still want to talk about interesting stuff, maybe asking dumb questions about some video other anons share, maybe some recomendations about articles.

Anything is more interesting than:
>huh duh your language is crap
>le benchmark war meme
>enjoy being a scriptkiddie other memes about high level language
>epic one panjeet
>other useless crap like trap shit
>>
>>52566755
and there we go again..you idiots never sees to amaze me how little you know about coding.
>>
If there was a full ocaml but with linear types, it would be the perfect language. However, failing that, there is always ocaml in its current state. Reminder to program in ocaml if you like your sanity.
>>
File: 1426967908064.jpg (9 KB, 325x159) Image search: [Google]
1426967908064.jpg
9 KB, 325x159
>>52567113
Thanks for this anon. I've already done a lot of these, but I'm going to work through this image until I've done them all. I just need to understand how github works now.
>>
>>52567186
you should check out the one about converting an image into a midi.
>>
>>52567197
I refer to your post as a poorly thought out meme.
>>
File: Capture.png (179 KB, 852x543) Image search: [Google]
Capture.png
179 KB, 852x543
>>52567175
literally half of it is for mentally deficient, FizzBuzz is hard for you? Factorial, Fibonacci sequence, Reverse a string.
If you finished HS you could do half of these like nothing
>>
How should I go about reading a +2gb file in C#?
>>
>>52567218
there are many valid complaints about python you delusional minecraft playing shit kid
>>
File: projects.png (308 KB, 1920x1080) Image search: [Google]
projects.png
308 KB, 1920x1080
>>52567113
rest are boring
>>
>>52566974
Do not make a game in Java for your first game.
>>
>>52567204
I need basic interactivity, like a button to hide and show a left index bar.
>>
>>52567209
Not him, but the main problem is beginners mixing into a discussion they know nothing about and causing the thread to derail.
>>
>>52567260
>the hard ones are boring
>>
>>52566974
>If I made a game in Java that could be customize-able, do I need to add something like lua or javascript
no

>I see that the .jar file can be opened in a folder program
don't touch the jar
>>
>>52567281
anime/trap shit is not because of begginers anon.
>>
>>52566755

Suggest me a better scripting language than Python.
>>
>>52567242
The joke is that python programs fail often, fail brutally, and fail very late.
>>
>>52567274
HTML+CSS is more capable than you think

http://www.cssportal.com/css3-preview/showing-and-hiding-content-with-pure-css3.php
>>
>>52567222
> Ocaml
> single threaded
Dropped.
>>
>>52567313
If that is your anecdotal experience, you are a poor programmer, and probably never really browse the web much
>>
>>52567305
Scheme, lua.
>>
>>52567303
Either I don't get the joke or you're very consistent on writing 'beginner' wrong.
>>
>>52567248
I just wanted to roll without saying roll, you retarded monkey boy.
>>
>>52567317
>This example does not work in Chrome!
oh for fuck's sake

http://stackoverflow.com/questions/26901466/how-to-show-hide-div-on-click-with-stricly-html-css
>>
>>52567260
>Pascal's triangle not marked out
>Hangman not marked out
>Radix converter not crossed out
>sine wave generator from pseudorandom numbers marked out
what? I'm not even sure what that is supposed to mean.
>>
>>52567317
that seems pretty cool anon.

I want to make a website with a left index bar that just unlock links the moment you visit a certain page.

like reading chapter 01 unlock chapter 02.
>>
>>52567328
There's a reason why production python software have 20x as many tests as production software in any other language, and there's also a reason why nobody even thinks about using python software without that many tests (as opposed to in other languages, where people will be squeamish about code without tests, but are ready to try it out anyway).
>>
>>52567329
>lua
For general purpose scripting? No. And I love Lua.
>>
>>52567325
It's multithreaded. You probably mean "singlecore", but it has many multiprocessing options. More importantly, true multicore is available. See https://github.com/ocamllabs/ocaml-multicore
>>
>>52567338
There are a million things out there that are easy but I haven't brought myself to do
>>
Python babies crying because their little feelings is hurt.
>>
>>52567358
Oh, it's false anecdotal, pulling-numbers-out-of-ass hour
>>
>>52567363
Absolutely. It's fantastic for general-purpose scripting, but isn't very good for scripting in very specific situations, where scheme is much better since DSLs are way easier to make with it.
>>
File: ohShitFlash.jpg (432 KB, 3504x2336) Image search: [Google]
ohShitFlash.jpg
432 KB, 3504x2336
>>52565878
Right now I skip this. Gps points data is accurate to the thirteenth digit after the decimal point and I am trying to get basic function working.

>>52565892
Thx, It looks like there is a SQLite R-Tree module that works on android

for each gps location I have 10 values and I will have to update it every hour, but I hope that it will work

>>52566279
unfortunately, grid is not aligned, in theory it should work for whole country
>>
>>52567383
No. It's reality. Github.com. Now fuck off.
>>
>>52567387
Are DSLs easier to make in Scheme than in Ruby?
>>
>>52567183
they really aren't
>>
File: snake fast.gif (53 KB, 640x321) Image search: [Google]
snake fast.gif
53 KB, 640x321
Optimized my drawing algorithms to only update changed squares. Artifacts in gif are due to the gif creator software I use.

Simplified my assembler so that it only reads pure CHIP-8 assembly.

Also started creating a higher-level language compiler to increase productivity using CHIP-8. Made it in python with pretty much no tests or debugging ;)
>>
>>52567398
What's with that image?
>>
>>52567401
>>52567443
lotta jelly ITT
>>
>>52567330
i dunno, english is not my native language.
>>
>>52567467
sure is butthurt in here
>>
>>52567460
>mfw I don't read the filename
>>
>>52567485
yeah I'm sure you've achieved more than python devs lmao, post your github, we'll see whose is better
>>
>>52567447
what is CHIP-8?

are u writing an emulator?
>>
>>52567447

Is the CHIP-8 assembler in C?
>>
>>52567495
O, I get it. Everyone is looking because of the camera flash.
EEEEEEBBBBBBBBBBBIIIIIIIIINNNNNNNN :DDDDDDDDDDDDD
>>
>>52567195
batteries included is a plus for python
>>
>>52567531
yeah course m8

>>52567526
I've finished it, it's the simplest virtual machine out there.
>>
>>52567443
The idea that python is somehow faster to write than other languages is absolutely absurd. I have no idea why that meme exists.

Python was my first language but I moved away from it once I started using static typing.
>>
>>52567569
>yeah course m8

It could be in anything, m9. I figured I'd ask.
>>
>>52567504
butthurt beyond belief
>>
>>52567335
this seems like a simple if check anon.

thanks but my goal is to have a button then when you click the menu slides and move to their real position, like some nice GUI shit.
>>
>>52567574
Oh sorry, didn't mean it like that. I was wrong anyway, the assembler itself is in Python.

>>52567575
I knew you couldn't hold your ground,
>>
>>52567581
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations

don't use javascript for these things you shitter
>>
>>52567594
>I was wrong anyway, the assembler itself is in Python.

Meh, still werks for me.
>>
>>52567609
thanks.

I've just spent some few hours trying to get some basic website on 000webhost.

I've done the basic html pages and now I'm watching a tutorial on using FTP.
>>
Dennis Ritchie did nothing wrong
>>
This is the 2nd time I get spam on my github mail account. Do these fuckers use some kind of API to send mass spam?
>>
>>52567504
Not him but, but if you're going to challenge him shouldn't you post yours first with proof(create a new repo called "PythonCryBaby98Hw32gy67a" then link it). Anything else and your a poser.
>>
>>52567615
Well it's too simple for me to do it in anything else.
https://github.com/vinheim3/CHIP-8/blob/master/assembler.py
The simplest decoding. I moved the functionality that makes assembly easier to my new compiler

The vm itself is in C for performance reasons
>>
>>52567643
>The vm itself is in C for performance reasons

I see that. Little messy, but overall not too shabby. What have you run on it besides snake?
>>
File: smiley.gif (129 KB, 1007x579) Image search: [Google]
smiley.gif
129 KB, 1007x579
>>52567674
>What have you run on it besides snake?
I had a pong prototype with UI too, but deleted it promptly after getting ball to move and bounce randomly because the rest of the work was boring polish. This was the last gif I had of it.

I'm also starting to design and implement a zelda/atari adventure-influenced game too
>>
What's your favorite lisp dialect, /dpt/?
>>
>>52567704
>I'm also starting to design and implement a zelda/atari adventure-influenced game too

neat.
>>
>>52567747
Racket Tbh
>>
>>52567704
no to sound rude, but what's the point of writing this?
>>
File: Screenshot_2016-01-22_17-05-07.png (109 KB, 729x278) Image search: [Google]
Screenshot_2016-01-22_17-05-07.png
109 KB, 729x278
How many people write functions like this? I don't think I've seen this style before
>>
>>52567405
Definitely.
>>
>>52567747

clojure
>>
>>52567460
some nerd noticed his waifu and decide to take a creep pictrue, unfortunetly flash was on and it was dark in room
>>
>>52567765
Trying new things is always good experience
>>
>>52567782
Did the Chad in the picture beat him up?
>>
>>52567768

Old style C and lacks indentation, but that's about it.
>>
>>52567747
Chicken. Unfortunately, there really aren't any GOOD lisp dialects. Chicken is just the least shitty overall.
>>
>>52567768
I was perplexed the first time I watched this.
fuck legacy syntax
>>
http://callmenick.com/post/slide-and-push-menus-with-css3-transitions

oh well, this is exactly what I wanted.
>>
>>52567787
no, I mean if this have any use beyond writing that emulator.
>>
>>52566098
>So, /dpt/ is pretty much telling me that every single programming language is shit?
>Well fuck.
>I just wanted to know what the best language for beginners was ;_;

The problem with languages that just werkâ„¢ is that they're so easy, they make anything else seem fucking impossible afterwards.

Ask any CS lecturer who's has students who started off with basic.NET, they get so used to everything being piss easy and verbose they cant do anything more complicated than fizzbuzz.

If you start with a babby language, the learning curve starts off really easy, and then jumps up drastically when you hop to a practical language.
Whereas if you learn in something a bit trickier, the initial learning is hard but then switching to any other language is relatively easy.
>>
>>52567787

I might take a crack at a Chip8 emulator in C# if I get some free time.
>>
>>52567816
Yeah, you make CHIP-8 games on it
>>
>>52567398
>ohShitFlash.jpg
kek

unless perhaps if it's a celebrity that's just beyond creepy
>>
Final year cs here and I have 2 electives to choose. Out of AI, web technologies, usability engineering and graphics and interaction which 2 should I take?
>>
>>52567834
You did say that, but then it turned out you worked on cmdline-pepe. Yours (I think you mentioned some) and ruby's suggestions for other architectures were still great though. I was reading through Saturn during work and it's really interesting, I might buy myself an HP calc for it
>>
Is Go an SJW language?
>>
>>52567828
Son, we are having a class soon called 'Identifying Bait'. I think you should attend.
>>
I am not sure why, but some rando Indian "Junior RoR developer" just asked me to add him on Skype. Why?
>>
>>52567850
Take a wild guess.
>>
>>52567858
not sure about the language but google in general is pro-diversity
>>
>>52567858
Yes. Enjoy the CoC up your ass.
>>
>>52567850
post course descriptions
>>
File: wxview.png (680 KB, 1572x1012) Image search: [Google]
wxview.png
680 KB, 1572x1012
>>52567854
>You did say that, but then it turned out you worked on cmdline-pepe.

Oh, I was talking about my own pseudo-assembler interpreter called SPP and how I was going to do a rewrite in D because it makes your dick bigger.

But you are right, I got caught up in that application to converts images to command-line drawings.

And then I cobbled together an MDI application to keep tabs on weather maps because it's going to be snowmageddon here.
>>
what do you program when you're bored? Because I'd like a time waster right now
>>
>>52567929
>And then I cobbled together an MDI application to keep tabs on weather maps because it's going to be snowmageddon here.
that yours? looks sweet, I heard about the shit weather you guys will have on the radio

>SPP
Saturn++?

>>52567965
Esoteric language interpreters are good time wasters
>>
>>52567801
>check this on my phone
>It doesn't work with opera nor the phone shitty browser
Oh well, I guess it goes into the trash my idea.
:/
>>
File: eggman.jpg (654 KB, 917x3176) Image search: [Google]
eggman.jpg
654 KB, 917x3176
>>52567790
mang, he is not a chad
>>
>>52567991
>that yours? looks sweet, I heard about the shit weather you guys will have on the radio

Yep. It's kind of basic right now, but I just started mucking with it last night. I was tired of opening tabs and googling to get back to the weather maps I was looking at.

And yes, it's gonna be a shitter. A fun shitter, but a 16"+ shitter none-the-less.

>Saturn++?

Yes, lol.

>Esoteric language interpreters are good time wasters

That reminds me of when I wrote a BF interpreter and then a macro system for it.

HELLO $72(+).>$69(+).>$76(+).>$76(+).>$79(+).>


Here, HELLO would be replaced by the value on the right, and then expanded. Obviously, it prints hello.
>>
>>52567250
Not , True
>>
File: butthurt.jpg (44 KB, 552x377) Image search: [Google]
butthurt.jpg
44 KB, 552x377
>>52568143
>>
Tell me how shitty my poor-man's JITing strategy is. I've written a VM and I want it to execute faster. So I've thought of this strategy for compilation. Transpile the sequence of instructions to calls to the C functions that implement them, then compile the C code using gcc and execute hoping that gcc will do function inlining.
>>
>>52568196
nothing wrong with quick and dirty, unless your vm's functions perform slightly different from the C "equivalent"
>>
>>52567113
Anyone has a text file of these?

Don't feel like editing this image every time I complete something, would rather have it in my GitHub Readme.md or something.
>>
Anyone else doing Paiza?

I'm stuck on the eyepatch challenge, but my solution passes the sample inputs, but not their 5 mystery tests cases which I'm not allowed to see.
>>
can't the compiler just use unsigned ints as if they were two's-complement ints on one's-complement systems?
>>
File: How do I make this bigger.png (31 KB, 1079x855) Image search: [Google]
How do I make this bigger.png
31 KB, 1079x855
Hey /dpt/

So I have no idea where to put this.

So I'm using Anki and the templates for the cards are some combination of css and html.

I can't figure out how to make the text created by the one line bigger.

I drew a line next to the line of code I am talking about.

<font size=x> no longer is working so I am confused.
>>
>>52568427
All signed integer operators would not work correctly. But if before and after each signed integer operation you converted to and from one's complement it would work. gl;hf.
>>
>>52566734
progress is i finish 6.042 tomorrow, 1 more final gotta do
failed to get counting though, correctly anyway
i don't think that's a big problem though, in the lobngrun
>>
>>52567768

Note the way line changes are used sparingly and statements follow conditionals.

This was the way to write C when lines had to be used sparingly as people worked with actual teletypes. Not virtual terminals - with actual teletypes that printed your lines in paper.

If you ever wondered what's the deal with 'ed', it's that.
>>
>>52567850

Don't know what else you will take, but take AI. Learning stuff like that is exactly the thing universities are for. You'll think differently after taking the course - I did. Do it.
>>
>>52568415
>but my solution passes the sample inputs, but not their 5 mystery tests cases which I'm not allowed to see.

Welcome to my experience with every Google code jam.
>>
>>52568625
same with Codeeval and Hackerrank

these guys are so anal with input
>>
>>52567898
>usability engineering
https://handbook.unimelb.edu.au/view/2016/INFO30004
>web tech
https://handbook.unimelb.edu.au/view/2015/INFO30005
>graphics and interaction
https://handbook.unimelb.edu.au/view/2015/COMP30019
>ai
https://handbook.unimelb.edu.au/view/2015/COMP30024?
>>
None of you autists use i3/awesome or some other autistically minimal wm, do you?
>>
>>52568633
at least codeeval shows you your output so you can cheat and print your mystery test cases and see what went wrong.

paiza doesn't even show you the results, it just marks you wrong
>>
www.github.com/scharlatan
>>
>>52568704
jesus christ lad
>>
>>52568427
It can, but then you're basically inlining an emulator for a twos-complement architecture into the code, and that has a cost. Operations which would be a single instruction using the native representation would require multiple instructions if using unsigned integers to emulate twos complement. And you'd need to convert whenever you passed values to interfaces which expected the native representation.
>>
>>52567747

TinyScheme
>>
thinking of writing chip-8 in x86 or so that it compiles to x86

is this madman territory? should I cross it?
>>
I'm trying to write a portable shell script that splits a lossless image+cue audio file into well-tagged flac tracks using only the flac program and standard utilities. It's the first remotely complicated shell script that I've tried to write. It's not finished, but it's working pretty well so far, with one major exception.

I'm running into a problem that I don't understand. I get the metadata from the .cue file using sed and grep. In the .cue file times look like 00:00:00 but I use sed to make them look like 00:00.00 because that's what the flac decoder wants. I have two variables, $START and $END, set this way once per track. When I use echo to print their values I see what I would expect to see. However, when I
echo "$START - $END"
I get " - 04:18.42" when I expect to get "00:00.00 - 04:18.42". Whenever these variables are expanded, it seems like some of the text is shifted leftward, which is mangling the command I'm trying to generate for the flac decoder. When I hard-code the values in, either directly into the command or by setting the variables to them directly rather than with sed and grep, this doesn't happen and I get the behavior I want.

Why does a variable assigned via one method get treated/behave differently from a variable assigned via another, when they have the same value and are untyped?
>>
>upload some test html to webhost000
>shitty banner about webhost000
>it doesn't work nicely on my phone

Oh well, I guess making it html is not a good idea.
It's fucking shit.

It's even possible to make a sort of html website with unity (at least emulate the feeling)?
>>
>>52568892
... you want to use the unity game engine to make a GUI for your website?
>>
>>52568892
>is it even possible to make a sort of html website with unity
what the fuck
>>
File: 1453470779199.png (3 KB, 641x301) Image search: [Google]
1453470779199.png
3 KB, 641x301
>>52566897
Here you go, anon-kun

>>captcha: Select all images with soup
moot pls
>>
>>52568892
what the fuck, anon?
>>
>>52568996
What's a 'moot'?
>>
>>52568967
>>52568988
>>52568996
>>52568999
I mean, I wanna make something that feels like a webpage (for android), so I was thinking about making an android application, because my phone has broken html support and html looks pretty bad there.
>>
>>52568891
Are you sure the values are what you think they are? Does $START contain an embedded newline?
>>
>>52568872

Wait, writing a chip-8 emulator in x86 assembly or writing a transpiler for chip-8 -> x86? The former won't be significantly faster than C. The latter may be an interesting, albeit difficult project.
>>
>>52569102
I thought that there might be some kind of special character at work, so I tried
END=$(echo $END | sed s/.*\(00:18\.42\).*/\1/)
on the "tainted" version of $END in an effort to purge everything but the important part, but it didn't work. I don't know for sure whether or not that would have worked on an embedded newline character, but I think it would have. Here's what I mean by "shifted leftwards":

~ $ echo $START
00:00.00
~ $ echo $END
04:18.42
~ $ echo "The track starts at $START and ends at $END."
.and ends at 04:18.420:00.00
~ $ START="00:00.00"
~ $ END="04:18.42"
~ $ echo $START
00:00.00
~ $ echo $END
04:18.42
~ $ echo "The track starts at $START and ends at $END."
The track starts at 00:00.00 and ends at 04:18.42.
>>
>>52569193
>The former won't be significantly faster than C.
Yeah I'm not smart enough to outperform years of optimization that people behind C compilers have achieved. I just don't like the boilerplate for display/sound that I have when all I do is XOR to a screen and play a single tone
>>
>>52569064
I don't know anon, but it sounds gay
>>
File: tumblr_m3u9coufgV1rvf9pxo1_1280.png (967 KB, 1186x792) Image search: [Google]
tumblr_m3u9coufgV1rvf9pxo1_1280.png
967 KB, 1186x792
If someone could help I would greatly appreciate it...

I'm looking to find what language or direction I should take for programming a self-aid tool:

At work, I commonly get emailed part numbers from customers looking to switch from a competitor's product to our own. For instance, I might get something like:
AA-BB-CC-DDD-EE-FF

I'd like to make a series of input fields, between each dash, that translate their part number, to ours. So AA-BB-CC (their number) would translate to 11-22-33 (our number)

I have all of the cross-reference data, but just need to know where to start.
>>
>>52569237

Did you try and do the same for $START?
>>
>>52567991
I don't know how to edit memory space in java, so a brainfuck interpreter just isn't going to work for me

I think
actually maybe I could just use an array, I'll get back to you on that one

>>52569326
I could do this in java I think

take in the string, String str = AA-BB-CC.
str = str.replace("-","");//not really necessary but whatever
String[] inputs = {your specific inputs. Can be from a .csv file or whatever, just use a buffered reader. So you need two things, your inputs and the outputs for that in either separate files or not. This could be a 2d array or two 1d arrays}

then do a check
for (iterate through your array){
if inputs[i].equals(yourSecondOutputArray[i])
System.out.println(yourSecondOutputArray[i])
}

that's how I would do it. Obviously I'm not a very good programmer but it would work at least. I think
>>
>>52567113
Roll
>>
>>52569517
>actually maybe I could just use an array, I'll get back to you on that one

That's how they're implemented, lad.
>>
>>52569517
Great, thank you!
Seems like there is plenty to learn just from this example.
>>
>>52569511
Yes. I had also tried modifying the original regex to do something similar within my script, to no effect. However, I've just stumbled across a regex that seems to work on the command line. I guess it probably was some kind of embedded special character. I won't be able to test the updated script for a little while, though.

Thanks for the help /dpt/
>>
>>52569517
>actually maybe I could just use an array
What else were you thinking?
>>
>>52569682
>I guess it probably was some kind of embedded special character.

It pretty much has to be.
>>
File: Selection_073.png (32 KB, 550x111) Image search: [Google]
Selection_073.png
32 KB, 550x111
Honestly, F# just isn't as elegant as Haskell.
Way more usable, but...there's no beauty in it, just cold, brutal efficiency.
>>
what method is the best?

double calcPoint(Point p, Point var)
{
double dist;
dist = (double)(p.x-var.x)*(p.x-var.x)+
(double)(p.x-var.x)*(p.x-var.x)
return dist;
}


or
double calcPoint(Point p, Point var)
{
return (double)(p.x-var.x)*(p.x-var.x)+
(double)(p.x-var.x)*(p.x-var.x)
}


why create variables when you can return immediately ?
>>
>decide to try to figure out opensl es for android once and for all
>look in native-audio-jni.c
>it's a mishmash of everything in a single file
ffs can't they just give a clear and concise example of doing one thing at a time like playing back audio

anyway

what does this do:
(void)result;
>>
>>52569755
It doesn't actually matter because the variable will be optimized out.
>>
>>52569755
The compiler will optimize all of this away, anyway.
If you're using Clang it'll matter, but GCC is sophisticated enough that you're essentially writing the same code either way.
>>
>>52569755
the second except why is the variable called dist when it should be a point? if the variable name is telling you something the first one could be justified
>>
>>52569782
>>52569783
it matters for style reasons
>>
>>52569755
this
double calcPoint(Point p, Point var) {
return (double)(p.x-var.x)*(p.x-var.x)+
(double)(p.x-var.x)*(p.x-var.x)
}
>>
>>52569762
It means "suppress compiler warnings about unused variable". It's a noop that never gets emitted.
>>
>>52569782
>>52569783
>>52569788
Thanks ^_^
the code is just an example. it doesn't mean anything
>>
>>52569868
const char *strings[] = {"i","am","a","huge","faggot"};
>>
>>52569868
Do you want strings, or Strings?
>>
File: CDPi14uUUAA7b11.jpg (69 KB, 768x1024) Image search: [Google]
CDPi14uUUAA7b11.jpg
69 KB, 768x1024
I started learning programming a few days ago and I wish I got into this a lot earlier. Thanks for reading my blog.

What programming books are good for a beginner (the best ones)?
I'm reading Think Python and Automate the Boring Stuff with Python and they've been teaching me things like lists, dictionaries functions and stuff. Do these concepts apply to other languages?
>>
>>52569868
char **arr = (char **) malloc(sizeof(char *) * rows);
unsigned i;
for (i = 0; i < rows; i++)
arr[i] = (char *) malloc(sizeof(char) * len);
>>
>>52569894
arrays, hash tables, and functions are used everywhere yes
>>
>>52569894
>python
>Do these concepts apply to other languages?
Almost certainly not. Python is basically pseudocode with runtime errors. Basically nothing you "learn" with Python will transfer anywhere else.
>>
>>52569755
This will sound odd, but it depends on the language.

Usually C guidelines have you trying to keep lines within 80 characters, which is why you've got the assignment broken over two lines there.

However if you're using C++ then a lot of the std class chains are so fucking long it's pretty difficult to get by with anything less than 120 characters/line.

tl;dr if you can fit the return into a single line, don't use temp variables, they're not doing anything.
If your return statement is gonna break onto multiple lines, you should probably break it down for clarity.
>>
>>52569911
kk
>>
>>52569922
^_^
>>
>>52569762
>JNI
Run away, don't look back just RUN.
>>
>>52569902
manually allocating your strings isn't normal
but in ANSI C, it is
ANSI C, not even once.
>>
anyone else maintain shitty asp.net for a living?
>>
>>52567060
Why do you have such a chip on your shoulder for a fucking langauge?
>>
>>52569980
>tfw I maintain a rails site
>>
>>52569957
kek

it really isn't all that bad though*

*once you've been through the initial hell
>>
Ok /g/. Not really a programmer but I need to learn VBA for my job.

Where do I go? I dont have money
>>
>>52569902
What is this, allocating a 2d array? I always prefer to just do
char* arr = malloc (sizeof(char) * rows * cols);
...
arr[r*rows+c] = x;

It's just mentally easier to deal with, for me.
>>
>>52570016
Yeah once you have the C side interface sorted it pretty easy.
I think I'd rather be shot in the head and thrown out of a plane than have to implement nested unions in Java again.

Have you ever used JNA code generators btw?
It's pretty nice not having to port the code manually, but jesus christ the source it produces it unreadable.
I guess the idea is that you never have to, I'm just not fully comfortable with a large chunk of bloated java source I can't debug properly.
>>
>>52570032
>2D array
That's what an array of char arrays is, basically.
>>
>>52570032
I like to write it that way because then it lets me avoid nasty pointer arithmetic like arr[r*rows+c] whose variables won't always be in scope.
by explicitly mallocing each row, you can freely use the syntax arr[r][c], or *(*(arr+r)+c) if you so please.
>>
>>52570114
The row+stride format is used almost exclusively by graphics libraries (as compared to the 2D array style).
>>
>>52570114
True. The only real drawback with the "multi-block" approach is that ugly loop malloc and free, but that's enough for me to avoid it by doing a single block with my own row/column calculation.

Also I guess the multi-block approach might get blocks all over memory, while my approach will get a single block, so it's better from a cache perspective. (not that that's why I prefer it)
>>
>>52567573
I don't really care what langauge you use, but you can specify static variables with the cython package. Not that everything should be done in it just because there's hacks for it, just saying.
>>
Why do so many C++ devs think that C++ is innately faster and more optimizable than C?
>>
if function n takes a microsecond, and another function takes log base 2 of n time to complete, how many times can it be run within a second?
>>
Minimal cat implementation.
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>

void cat(void)
{
char ch;

while(read(STDIN_FILENO, &ch, 1) > 0)
write(STDOUT_FILENO, &ch, 1);
}

void cat_f(char *f_name)
{
int f = open(f_name, O_RDONLY);
char ch;

while (read(f, &ch, 1) > 0)
write(STDOUT_FILENO, &ch, 1);
}

int main(int argc, char *argv[])
{
int i;

if (argc > 1)
for (i = 1; i <= argc; i++)
cat_f(argv[i]);
else
cat();

return EXIT_SUCCESS;
}
>>
>>52570159
You say single block malloc is better from the cache perspective, but is it really?
Unless you need that particular block to be consecutive, you're gonna force malloc to waste extra time looking for the first available slot that's big enough.
Plus, you've just stolen a perfectly good large block that could have been used by something that DOES need it, again taking up more time to find the next available one.

I'm not even suggesting that the extra time will be significant, and it's incredibly hard to quantify without an exact scenario in mind, but either option could end up being faster depending on lots of things.
>>
>>52570251
>minimal
#include <stdlib.h>
#include <string.h>
int main(int a, char *b) {
char c[1000];
strcat(c, "cat ");
strcat(c, b[1]);
return system(c);
}
>>
>>52570251
Minimal cat implementation.
#include <stdio.h>
void main() {
puts("meow");
}
>>
>>52570295
Well, not just that, but then you can easily bzero/memset the whole thing at once, as well as memcmp/memcpy etc. 2D arrays are easier to think about but harder to deal with implementation-wise.
>>
>>52570337
that should be **b but you get the idea
>>
>>52570212
Because it can be.
95% of the time it's not though, exactly because the kind of people who go spouting that kind of shit have trouble actually writing good code.

It pretty much requires you to write everything as close to C as possible, with the bare minimum of C++ tweaks.
The devs that can write the fastest C++ code still have to know C inside-out.
>>
>>52570337
cool, haven't looked much into the functions from string.h, but that seems quite powerful just from a glance
>>
>>52570295
Good point. I think the single-block approach could be faster (from a cache perspective) if you plan to do a lot of iterations over the whole array. But that's probably the most that be said -- like you said, both approaches have their strengths.
>>
I'm a second year CS student who's interviewing for an internship at a university where they use only linux. I have no external storage so i can't install linux on my computer right now.

What are some things i can watch or read as a crash course in all things linux??
>>
>>52570337
>>52570388
but btw, just for the record, yours doesn't actually concatenate files, by limiting my program to your functionality, it'd look something like

#include <unistd.h>
int main(void)
{
char ch;
while(read(STDIN_FILENO, &ch, 1) > 0)
write(STDOUT_FILENO, &ch, 1);
return 0;
}


:--------)
>>
>>52570409
Install MinGW or cygwin. Get familiar with compiling stuff.
>>
>>52570451
>implying
/* minimal cat */
#include <stdlib.h>
#include <string.h>
int main(int a, char **b)
{
char c[1000] = { 0 };
strcat(c, "cat ");
int d = a;
while (d-- != 1)
{
strcat(c, b[d]);
strcat(c, " ");
}
return system(c);
}
>>
>>52570409
1) download virtualbox
2) download the iso file for debian
3) setup virtualbox
4) click the iso file when it asks you to choose an operating system
>>
>>52570483
very cool, but it inverts the order of the files lol
regardless, great job!

challenge: make it even shorter
>>
>>52570507
If someone wants to reverse the file order, have fun, I can't think of anything else.
/* minimal cat */
#include <stdlib.h>
#include <string.h>
int main(int a, char **b)
{
char c[1000] = { 0 };
strcat(c, "cat ");
while (a-- != 1)
{
strcat(c, b[a]);
strcat(c, " ");
}
return system(c);
}
>>
what do I need to learn to make a hot as fuck website?

like besides html+css+javascript what else do I need to know?

JQuery?
>>
dlang site overhaul
https://dlang.org/
>>
Perfecting my Haskell style
(&) a = readIORef a
int a b = newIORef b
cout = print

main :: IO Int
main = do
-- declare a pointer to an int
a <- int(*) 2
-- dereference and print the pointer
cout =<< (&)a

return 0
>>
Am I doing this C thing correctly?
void display_grid(grid_t *ptr)
{
unsigned i, j;
for (i = 0; i < ptr->size.x; i++)
{
for (j = 0; j < ptr->size.y; j++)
{
printf("%u", ptr->grid[i][j]);
if (j != ptr->size.y - 1)
printf("%c", ' ');
}
printf("%c", '\n');
}
}
>>
File: 1417145372477.png (509 KB, 480x488) Image search: [Google]
1417145372477.png
509 KB, 480x488
S-language here.

Come at me.
>>
>>52570564
Here's one that gets it right. (But does everything else wrong.)
/* minimal cat */
#include <stdlib.h>
int main(int a, char **b)
{
char *c;
while (a-- != 1)
*(b[a]-1) = ' ';
asprintf(&c, "cat %s", b[1]?b[1]:"");
return system(c);
}
>>
>>52571075
It's completely wrong. Gb2preschool.
>>
>>52570984
You dirty hipster
>>
>>52566781
Nigga those are all my languages
Thread replies: 255
Thread images: 30

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.