/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

play.google.com/store/apps/details?id=com.coinhail
twitter.com/AnonBabble

>tfw not working on anything
who /hatesprogramming/ here

>who /hatesprogramming/ here
tfw not working on anything

>working on a game with a team
>artist is a diaperdev
>brings up his "uh oh dirty nappy" every time we have a scheduled chat about progress and direction
>have to sit around for a half hour while his "daddy" changes him
>grunts and groans from his end on skype while me and music/sound bro try to pretend we're just looking at our browsers
this is not what I signed up for

Reading a book. Trying to understand COM having no experience with objective programing.

surely this violates some law

>this is not what I signed up for
What do you mean?

That wasn't in the contract?

play.google.com/store/apps/details?id=com.coinhail

Demonstrating GCC is the inferior compiler once again.
#include
enum { N = 3 };
void foo(int *a)
{
memmove(a+1, a, N*sizeof(int));
}

/*
Clang
mov 0x8(%rdi),%eax
mov %eax,0xc(%rdi)
mov (%rdi),%rax
mov %rax,0x4(%rdi)
retq

GCC
mov %rdi,%rsi
lea 0x4(%rdi),%rdi
mov $0xc,%edx
jmpq 540
*/

apple cucks are getting desperade

oblig picrel

test

Do the socks fit alright?

>freetard feelings being hurt
lol @ desperate gccfags

>getting this butthurt by the truth
cuck license apologists pls go

what did i just read?

It's not letting me post with code but I can still post, weird.

Hi all, I'm back, after a quick sleep to air out some of my frustrations with these js exercises.

I'm really struggling with this class Sup Forums. How do I access the href from an image with javascript? I keep getting undefined's and nulls. Here's the assignment and my code.

var imageArray = new Array();

var image_list = document.getElementById("image_list");
var ulImage = image_list.getElementsByTagName("li");

for (var i = 0; i < ulImage.length; i++) {

imageArray.push({
src: ulImage[i].href,
title: ulImage[i].title
});

console.log(imageArray[i]);
}

And the HTML and the criteria

Exercise 4







What am I doing wrong? Programming is not at all my strong suit, so try to keep it dumbed down if at all possible.

incompetent "spam" protection.
Try the top-of-the-page form, it ought to pop up an extra botnet recaptcha, solving which ought to get your post through.
Might not work with 4chanX/etc

does it make you cry when you look at go file a bug report to your GNU masters

>bug report
retard

ffs this should be obvious if you're not mentally handicapped
>ulimage = ...getElementsByTagName("li")
>ulImage[i].href
Reread your code and tell me:
Which elements do you expect to be in ulImage?

weak sauce m8

Playing around with Pharo smalltalk.

I'm not sure what to think of it. I both hate it and love it at the same time.

On one hand, using it for a while has made me think that classes are a terrible abstraction and that the Smalltalk OOP model is both annoying and overly constraining, and the only aspect of the OOP model that I like are late-bound messages. CLOS does it better but that's a different story.

On the other hand, I really love the reflective nature of the language. I like late-bound messages and the ability to override #doesNotUnderstand. I like being able to override hooks. But the reflectiveness and the fact that everything is an object is really really impressive. The stack and all stack frames are all objects, so I can pull up the call stack and modify it. I can modify running instances of a class and use that to debug a running program. If a given class throws an exception, I can use the debugger to look through all stack frames and see all scopes and temporary variables everywhere in the call stack, find where the weird values are coming from, fix that piece of code, and then proceed by unwinding the stack and resuming execution from the call to the method that I changed.

Also, the first class support for TDD (which originated with smalltalk) is amazing. Writing code to make the tests pass becomes especially nice when combined with the debugger, since you can repeatedly unwind the call stack and see where errors are coming from and fix the methods in the debugger. Instead of repeatedly fixing code so that the nth call to your tests passes, you end up fixing the running instance of the first test so that the first call to the test passes. It's crazy.

On the other hand, I feel that a lot of the errors that I find are things that I would have found at compile time in Haskell, so *shrugs*. If Strongtalk hadn't been killed by Sun, that would be a different story..

My god I'm an idiot, thank you. I should be able to do it from here.

attaboy

>be me
>in yurope
>working at a startup working with Go, Elixir
>company offers me 2 free tickets to attend conference in USA
>each ticket costs more then $700
>don't wanna go

dafuq do i do with these tickets?

>i really like late-bound messages
>muh strong typing tho
>strongtalk
What did he mean by this?

Another observation: Smalltalk is surprisingly poor at GUI's. PyQT is nicer than anything I've seen in the Smalltalk world.

It makes me think that OOP is actually not so good for GUI's, just better than plain procedural. It also makes me appreciate how good Reactive and DSL approaches to GUI's are. Red and REBOL's view dialect completely blows Smalltalk out of the water regarding GUI's. The future of GUI's is probably some mix of functional/reactive/symbolic programming, though proper implementation is generally more important than coming up with the right paradigm.

>The future of GUI's is probably some mix of functional/reactive/symbolic programming
That's good for babby's first GUI app and not much else. When you start doing anything serious, your fancy pure functional reactive memes devolves back into Erlang.

We actually had a similar guy at my old company
But this was in person, no "daddy" though he stank up half the room once a day. HR wouldn't touch him but finally he was gone after a few months, not sure how, didn't care to ask, I was just glad it was over

Only if you do it retarded with actors.

Strong typing =/= static typing. Though if you design your type system well, you can prove a bunch of stuff statically as well, even if its not everything.

It would be nice to throw an exception on a type error as early as possible, rather than far down deep in subexpressions and/or after corrupting state.

>Another observation: Smalltalk is surprisingly poor at GUI's.

it's excellent for gui programming, the morphic system is still unparalleled.

POST A SCREENSHOT OF YOUR CODE / PROGRAMMING ENVIRONMENT

>It would be nice to throw an exception on a type error as early as possible
In other words: At compile time, where it belongs.

Ok... Hol'up! Is there a single reason to use DirectX or will OpenGL run slower on a Windows machine?

I tried spec first, realized that it was too limited and went on to work with Morphic directly. I then ended up being really annoyed by Morphic.

It's OK, but nothing exceptional. I had quite a few issues with it and it was the source of all my VM crashes so far.

Test

What are good ways to start to learn to actually organize my programs?

I'm a very unmotivated, kinda stupid first year computer science student. I enjoy programming, but struggle to convince myself to keep doing it because I'm so bad at actually making anything larger than school assignments. I've hit that level of skill where I can kind of idiot-force my way through something basic, but actually creating large-scale, organized projects seems impossible. There's just too much to manage, and things start to tangle. It becomes a mess figuring out what relies on what and why it relies on it.

It only gets worse when I try to use C instead of a object-oriented language.

Any good books on organizing code?

(I also suck at using vim, tips on that would be appreciated too)

DX drivers are generally better than GL drivers up until modern hardware that's best on 12/Vulkan anyway. Probably not worth writing a DX backend though unless you've architected things so that it would take minimal effort.

Right, whenever possible it should be thrown at compile time, which in Smalltalk would be whenever you change a class. The Pharo editor already warns you when you call a method that isn't implemented on a class if doesNotUnderstand isn't overridden. You could do the same with type information. The vast majority of cases should be possible to find long before runtime.

...

i am using Pharo extensively and never had a crash related to morphic. only had a single crash due to a wrong native library being loaded.

>It's OK, but nothing exceptional.
the dynamic properties are unmatched; you can inspect everything, modify everything, copy/paste any widgets, ... at any time during execution.
the messaging based model makes gui programming easy where events are nothing else than classic messages themselves.
the skinning system is one of the best i have seen.

>sexual HISassment

Get Large-Scale C++ Volume II once it's released next year.
The old book is supposed to be good.
That said, it's probably an overkill.

Nice quads, by the way.

>(I also suck at using vim, tips on that would be appreciated too)
Stop using an editor made by a literal retard.

oooh pick me

>the dynamic properties are unmatched
It seems you are easy to impress, user.

what, you wanna pay for those?
drop me your email

pic related

give an alternative

wtf I can't tell if I really like that font, or really dislike it

it's pretty comfy

>global vectors

Qt.
And it looks and feels better than the Motif tier GUIs you can create with morphic.
The only drawback is that the programmer can't be a retard.
>inb4 proprietary garbage meme

no

user, what the fuck are you talking about? What exactly do you expect to happen when you send an object a message that it doesn't know how to handle? Bonus points if your suggestion is compatible with "late-bound messages".

what are you talking about, there's no global vectors.

Start with anything thats not c/c++, and just work at least half an hour a day on it. Just try to make something and when you inevitably program yourself into a corner, you will have learned a whole bunch of shit

my bad it looked like one

Qt? seriously? how can i create a window, open the morphic menu to duplicate that window then rotate the duplicate window, on the spot?

you talking about line 39?

Strongtalk handled it fine. You make the type system optional and as such don't lose any expressiveness. As a bonus, it makes the VM faster since the JIT has access to the result of those typechecks: Strongtalk was roughly 20x faster on average than the visualworks VM.

It can actually just add dynamic expressiveness, since you can add a #wrongType hook similar to doesNotUnderstand to override the behaviour of throwing an exception when receiving an improperly typed message.

You can't and that's good, because it's a retarded idea. That would be indirectly admitting it was made for retarded memes.
Kind of like when VIM fags brag that they can reverse every 5th line or something like that.

yes

it returns a vector i know

I asked you a question: what do you want to happen when you send an object a message it know how to handle?

Being on the weirdo's side of the gambit is no picnic either, if you have even the slimmest modicum of self awareness. It's no treat being severely mentally ill but valued by management for some reason such that they won't replace you.
I'm glad I'm not that bad though. God damn, that's nasty. Like some other guy said, pretty sure that's sexual harassment. No matter how sorry I am to subject my coworkers to my retarded whining about invisible hands crawling on my flesh, at least I don't shit myself and brag about it. What even with that garbage.

gnu style coding is very comfy d-desu

>returning class instances by value
fucking ew

:^)

i ask you for an alternative as dynamic as morphic and you reply with qt then say "You can't and that's good". i have no time to waste with such a troll. it's obvious that you haven't used smalltalk for anything relevant.

anyone got some java github projects I can commit too ?
Wouldnt mind writing some test cases either.

I'll mention that the guy pushing QT isn't me (the original guy who complained about morphic).

Morphic benefits from Smalltalk's introspection features and runtime debugging behaviour, but that's true of anything that runs in the smalltalk vm. It's still shit. Raw messages are imho a bad way to make GUI's do stuff. Signals are much nicer.

>that you haven't used smalltalk for anything relevant.
Neither have you. Or anybody else, by any means.

Shimakaze is so 2016.
We Astolfo now.

I'm trying to implement casting in my compiler, but I'm sort of stuck. I thought I would just have to convert the value of the expression I'm casting to a byte array and zero the necessary bytes, but I don't think I can just do that since I have to cast a float and a float's binary representation does some wacky shit. Do I really have to read the IEEE floating point specification for C# to be able to do what I want to do?

Perform the action related to the message. Which includes a typecheck if the message arguments are typed, and if the VM JIT can't infer that the typecheck will always pass.

fuck off faggot

Anyone have experience with Tampermonkey scripts? I'm trying to have a script execute at all time on the page. The documentation is very minimal and tutorials aren't helping here.

>before /dpt/
Cwel, spierdon
>after /dpt/
PedaƂ jebany, degenerat kurwa

>having a language that needs casting

Lel

>implement casting in my compiler
>I don't think I can just do that since I have to cast a float and a float's binary representation does some wacky shit
>Do I really have to read the IEEE floating point specification
No. You just need to understand the basics or use FP instructions.

(And also, it should be possible to specify the return type which will be checked on message return if it isn't inferrable by the VM).

I unironically love R. I know it's a bit of a weird language and it's squeezed into a place between disgusting but popular python, and expensive proprietary alternatives with support like SAS and SPSS, and flanked by faster alternatives like C or MATLAB
but I've just got a fondness for it. I think it's a combination of how CRAN is top notch, Rstudio is great, and its functional paradigm and vectorized operations are agreeable to my math background and types of things I do in it.

>Which includes a typecheck if the message arguments are typed
It really doesn't sound like you understand first-class messages and the everything-is-an-object. There's nothing to typecheck. Either the object knows how to handle a message or it doesn't. You find out once the message gets there. You may not like it, but then please don't tell me you like late bound messages.

It's also very Lispy. I definitely prefer it over python.

Sometimes I get very uninterested by programming, and when it happen, I lost motivation for at least 4 months, and I become as good as I was 4 years ago. It usually happen when I try to do a serious project(result : I've never done a serious project)

Is there something I can do to be motivated and productive? Even Coffee doesn't work, but I love programming.

>Is there something I can do to be motivated and productive?
Yes. Grow up and become an adult.

>before /dpt/
No idea what any of that means...
>after /dpt/
Now a Polish profanity expert.

Man I'm a dumbass, I kept thinking of how to keep track of lots of individual heap allocations in a type system but just realized that nobody wants to do that any more. Better to support a "custom allocator" model that is coarser-grained but also probably faster and still not garbage collected.

>she needs type-system hand-holding to keep track of heap allocations
>she allocates stuff on the heap
The absolute state...

Linear types

Get a fucking grip you slacker.

is it possible to rewrite any recursive function (e.g. in C) with just a stack and loops?

Go back in time and have your parents make you do chores so you grow a sense of work ethic and self-discipline.

>I was just trolling desu and I didn't mean it though

Are graph databases a meme?

to the guy yesterday who said 1 Byte to be 8 bits.

Fuck you. you are wrong

Yeah, and step 2 is draw the rest of the type system. Linearity is a good idea but you need a lot more to support e.g. shared mutable state well.