[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/ :: The Daily Programming Thread ### Make Programming Great
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: 27
File: d.jpg (66 KB, 591x456) Image search: [Google]
d.jpg
66 KB, 591x456
/dpt/ :: The Daily Programming Thread
### Make Programming Great Again Edition ###
Previous thread can be access by following this hyperlink: >>51526469

What are you working on?
When's your project gonna be finished?
What's the most recent insight into the programming craft you've had?
>>
First for nim
>>
vote trump

https://wiki.libsdl.org/SDL_RenderDrawRect
https://wiki.libsdl.org/SDL_Rect

int SDL_RenderDrawRect(SDL_Renderer* renderer,
const SDL_Rect* rect)


is it possible for me to pass in a struct anonymously for the coords?

SDL_RenderDrawRect(renderer,
{ 0, 00, 50, 50 });
>>
First for JavaScript + Node + Mac + Sublime + Beard + Starbucks + Startup + "Code Artisan"
>>
File: 1448420232872.jpg (674 KB, 2000x1516) Image search: [Google]
1448420232872.jpg
674 KB, 2000x1516
>>
Urgent lack of D memes
Someone mix some in
>>
Donald Trump will make programming real
>>
7th for Go

try it. just do it.
tour.golang.org
>>
File: 1249249_large.jpg (356 KB, 782x900) Image search: [Google]
1249249_large.jpg
356 KB, 782x900
>tfw using java exceptions for the first time
>>
best linux distro for serious devs?
>>
>>51531375
Windows 10
>>
>>51531375
windows
>>
>>51531375
Ubuntu as it has the most support for "serious devs" such as yourself
>>
>>51531335

You know what D stands for, right?

Dead language.
>>
What are some good editors for osx? I need a gedit clone for my work computer.
>>
>>51531399
I think you misheard him.
He asked for a LINUX distro.
>>
>>51531413

Weak bants. D is stronger than ever.
>>
>>51531399
>serious devs
>ubuntu
If he absolutely NEEDS to use Linux, he should use Debian.
Otherwise, if the kernel is not absolutely necessary, Windows 10 will do the job.
>>
>>51531375
Define "serious"

>>51531443
There is no advantage to using Debian over Ubuntu
>>
>>51531335
youre probably not aware that Walter Bright invented D, not Andrei Alexandrescu
>>
How can you make programming great again, and I mean Great?

>deport Indian Java Pajeets
>say no to languages made or used by politically correct people (Go, JavaScript, Python, Swift)
We should go back to C and C++, and believe me, those are the best.

Anything else Iads?
>>
>>51531459
[spoiler]D kills itself[/spoiler]
>>
>>51531399
>>51531443
aaaaand, this is the retarded "elitism" that plagues linux.
hey guys, all distros are more or less THE SAME THING.
>>
>>51531390
>>51531393
>>51531399
>>51531458
serious answers only plz
>>
>>51531483
>We should go back to C and C++, and believe me, those are the best.
keep using them and STFU?
>>
>>51531459
Walter invented it
Andrei perfected it
>>
>>51531483
D is actually not that bad. The main problems are:
Non-GC code is treated as second class.
Limited IDE support.
Few application libraries.

The best feature, one that C++ needs asap, is mixin (insert a compile time string as code) and CTFE.
>>
>>51531493
I answered in the previous thread also.
ask >>>/g/flt
>>
>>51531571
>mixin
I've never understood why this is useful. Where could I apply it?
>>
>>51531571
>Limited IDE support.

The visual studio integration is pretty good, imo.
>>
>>51531375
windows 7
>>
>>51531641
Post a D program you've made
>>
File: 5028401.gif (26 KB, 250x247) Image search: [Google]
5028401.gif
26 KB, 250x247
>>51531671

My work is proprietary you socialist shitter.
>>
>>51531633
A million places.
One example is you can easily get rudimentary generics:

string vector(string Ty) { return "(generic class definition)"; }
mixin(vector("int"));

>>51531641
Compared to Visual C++ it's shit.
Xamarin is much better for D.
>>
>>51531671
I made an LMC :D
>>
>>51531690
>Xamarin is much better for D.

Is it? I've not actually tested it yet, but I was looking for something better.
>>
>>51531317
In C99, yes:
SDL_RenderDrawRect(renderer, &(SDL_Rect){ 0, 0, 50, 50 });

C++ or C89? No.
>>
Can I use Qt from D yet?
>>
>>51531777
Looks like it
http://www.dsource.org/projects/qtd
>>
>>51531777
you want Qt D's?
>>
>>51531777
Triple 7, you're in luck
There are D bindings for Qt
>>
package main

import (
"io"
"net/http"
)

func serve(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "hello, world!\n")
}

func main() {
http.HandleFunc("/", serve)
err := http.ListenAndServeTLS(":443", "cert.pem", "key.pem", nil)
}

rate my C program /g/
>>
uint64_t i;
for (i = 0; i < a1.len; ++i)
result[i] = a1[i];
// keep old value of i in new loop
for (; i < a2.len; ++i)
result[i] = a2[i];

Is this a bad way to append two arrays senpai?
>>
>>51531835
D:
a1 ~ a2
>>
>>51531786
I already have qt DDs ;)
>>
>>51531845
Shut the fuck up Trump, no one likes your Dick language.
>>
>>51531835
Go home. You are drunk.
>>
>>51531852
It's going to be great, we're gonna make D great again. We're gonna build a huge language, and we're gonna make C++ pay for it.
>>
>trying to download MonoDevelop so I can test out MonoD
>0.01 kbyte/s

What kind of grab-ass show is Xamarin running here?
>>
>>51531879
Test out nim m8
>>
>>51531909
Sell me on nim m8
>>
>>51531835
Use memcpy
>>
>>51531909

I've been meaning to do that as well, but like I said before, I ended up taking a small dive into vala instead.

I'll put nim on the list.
>>
>>51531924
http://hookrace.net/blog/what-is-special-about-nim/

Found on my fav site reddit.com/r/programming
>>
I am proud to admit that I am an avid gamer. I enjoy all sorts of games: MMORGS, first person shooters and anything else I can afford to buy. Video games developed my interest in computer science. The beautiful graphics, fluid physics and enticing game-play influenced me to look into a career in video game programming. But, to accomplish this, I need to have a strong foundation in theory and programming.
>>
>>51531940
You should look into Clay. It's what C could have been had they known what we know now.
>>
>>51531952
Give up and fuck off >>>/v/
>>
>>51531942
Lang    Time [ms]    Memory [KB]    Compile Time [ms]    Compressed Code [B]
Nim 1400 1460 893 486
C++ 1478 2717 774 728
D 1518 2388 1614 669
Rust 1623 2632 6735 934
Java 1874 24428 812 778
OCaml 2384 4496 125 782
Go 3116 1664 596 618
Haskell 3329 5268 3002 1091
LuaJit 3857 2368 - 519
Lisp 8219 15876 1043 1007
Racket 8503 130284 24793 741


Lisp is fucking trash
>>
>>51531972
So is your formatting
>>
>>51531766
that did it.
>>
>>51531814
you are a Go hacker now, congrats
>>
>>51531294
>>>What are you working on?
A program that reads in commands from a file, and then executes those commands using a thread pool.
>>>When's your project gonna be finished?
Before next Wednesday, that's when the company wants the coding sample back (although the NEET life sounds pretty great right now.)
>>>What's the most recent insight into the programming craft you've had?
Singletons in OOP to clone and cast objects off of for the thread pool to use a polymorphic work() to run commands. This is going to be tight!
>>
>>51532011
>Singletons in OOP
:)
>>
File: Logo_lisp.gif (11 KB, 700x385) Image search: [Google]
Logo_lisp.gif
11 KB, 700x385
>>51531294
I'm building a Lisp, called Valutron. I am implementing its compiler-interpreter in Objective-C.

It has some unique features: first, it offers what are called V-expressions, an alternative notation for writing code. Second, it offers a comprehensive object system inspired mainly by that of SmallTalk-80, one of the earliest Object-Oriented languages, and by Common Lisp's CLOS, Common Lisp being the first object-oriented language to be standardised.

This object model is implemented atop the Objective-C runtime, which I have extended with support for Double Dispatch to enable the availability of CLOS' characteristics multimethods.
>>
>>51532098
still gay
>>
well i did it. i accepted the job offer. after jan 1st i will officially be a .net programmer, even though i don't know anything about clr or c# yet. i had to accept because it's the highest salary i've ever had
>>
>>51532121
>i had to accept it
capitalist pigs actually believe this
>>
>>51532011
>Singletons
>thread pool
Hmm
>>
File: WakeMeUp.jpg (6 KB, 169x250) Image search: [Google]
WakeMeUp.jpg
6 KB, 169x250
>>51532098
>This object model is implemented atop the Objective-C runtime
>>
>>51532121

Enjoy the money.
>>
>>51532168
I will be saving and investing over 70% of it, hopefully. I already save 63% of my income.
>>
>>51532135
Yep, there is a singleton that all the child classes that implement commands register with. It has a map that links a string id, and the registered class. That way you deserialize from the parent class to the child class and everything is set up right. The threads don't care what the class is and call on child->work().
>>
>>51532133

There is absolutely nothing wrong with being a capitalist.

>>51532121

Nice. Hope you have fun learning all of the new .NET stuff.
>>
>>51532121

Nice. What will you be doing?
>>
File: big.jpg (559 KB, 2580x1960) Image search: [Google]
big.jpg
559 KB, 2580x1960
>>51532098
Lisp
(lambda x 
(this
(outdated
(shitty
(syntaxed
(language !)
)
)
)
)
)
>>
>>51532246

That's the problem that Valutron is fixing, though.
>>
>What are you working on?
currently working on a program in C# that will take info from a form (that can and will be filled out multiple different times by multiple different people) and place it into a database

>When is you're project gonna be finished?
I'm shooting to have it done by Christmas, it's for work and it'd be nice to have it roll out with the new year

>What's the most recent insight into the programming craft you've had?
For my program personally, I've finally realized that you cannot call excel cells by their name and instead have to call them by their point location.
>>
>>51532230
I don't want to get too much into the specifics, but it will be building and maintaining custom projects for other departments in the (large) company.

For example, making a webapp that lets people comb through data sets of 300million+ rows of information by building their own queries and letting them reference them against other large data sets. I guess you could consider it like a report builder, but it will probably also do analytics and stats and stuff as well.
>>
whats the best program language for hacking?
>>
>>51532300
COBOL
>>
>>51532300
brainfuck
>>
>>51532300
Python is really convenient. It can print byte codes, and you can multiply strings. Great for buffer overflows.
>>
>>51532260
What's the syntax look like? If it's so great.
>>
>>51532246
Maybe you shouldn't indent like shit.
(lambda (x) 
(this (outdated (shitty (syntaxed (language !))))))
>>
>>51532347
I really spergishly hate the overloading of mathematical operators for operations on strings or collections. It's not just overloading the functionality, it's overloading the core meaning of what those operators represent!
>>
>>51532280

Welcome to CRUD my brother. Go forth and build your resume. Also, based on what you said, convince them to purchase DevExpress or similar if they don't already have it. It can be a royal pain in the ass but if the user needs to build custom queries you can just give them an "open" filter for the initial data then you can dump the results into a simple control with all the filtering and sorting built in (and you can easily tie in trending charts and exporting) - takes no time to code (you can also just forget the open filter and paginate it all).
>>
>>51532410
>DevExpress
Thanks, I'll keep that in mind.
>>
>>51532409
Yeah, I agree. I like how Haskell forces operators to basically be doing the same thing for them to be overloaded. So the + operator has to come with all the other math operators and it has to have the same type signature, etc. Type classes are fucking awesome~
>>
>>51532347
99 nanoseconds Seattle nipples
>>
>>51532300
machine code
>>
File: 1447697861159.gif (303 KB, 244x244) Image search: [Google]
1447697861159.gif
303 KB, 244x244
>>51531294
I'm making a FTP client in C#, using it for download files thru FTPS from my FTP server.

Using .Net webrequest with enableSSL = true;

Will all traffic be encrypted if enableSSL = true; even though the string i use as a path starts with ftp://ipadress/folder1/folder2

I can browse and download files, and my FTP don't allow unencrypted traffic (using Filezilla server), is my connection secure?
>>
>>51532098
anon, could you write a post for realtalkintech and send it to realtalkintech @ gmail ?

Send any images too.

I'll post it around.

Be sure to take jabs at the superiority of OOP over functional languages.
>>
>>51531317
>>51531766

What if I wanted to do an array of them?

https://wiki.libsdl.org/SDL_RenderDrawRects
>>
>>51531685
Is the southern hand supposed to represent a dark iron dwarf?
>>
File: carmack.jpg (2 MB, 1819x1866) Image search: [Google]
carmack.jpg
2 MB, 1819x1866
>>51531317
>using SDL
>not using OpenGL libs directly
I never understood this.
>>
>>51532767
Explain, what am I missing?
>>
>>51532246
you're missing the point
>>
>>51532797
Nothing. SDL itself is fine. But the OpenGL wrapper it has is primitive. I've found that writing the actual rendering/shader handling code for engines with standard OpenGL libs much more convenient than using SDL for it. You can't really get those juicy performance gains with SDL.
>>
>>51532300
C
>>
>>51532767
this
>>
>>51532767
Easier to build a window and context
Easier to do ^ in a multiplatform sense
Although fuck GLFW is better than SDL anyway
>>
>>51531294
why did OP post some illiterate nigger who didn't even go to college as his image?
>>
>>51531483
Eliminate the faggots and their Lisp.
>>
>>51532381
Like J*va.
>>
>>51532935
>Trump attended Fordham University in the Bronx for two years, before transferring to the Wharton School of the University of Pennsylvania, because Wharton then had one of the few real estate studies departments in U.S. academia.[21] He graduated in 1968, with a Bachelor of Science degree in economics.[22]

also a college/university degree was actually worth something back then. you're not special for getting a degree like everyone else
>>
File: 2015-11-25_23-27-10.png (12 KB, 1014x305) Image search: [Google]
2015-11-25_23-27-10.png
12 KB, 1014x305
oi /dpt/
can any of you explain why this isn't working?
I've got
linux_pattern = re.compile(r'''
L\s* # (L)inux
(
i\W*n\W*u\W* | # L(inu)x
u\W*n\W*i\W* | # L(uni)x
o\W*o\W*n\W*i\W* # L(ooni)x
)
x # Linu(x)
(?!\s+kernel)
''', re.IGNORECASE|re.VERBOSE)

which works for
>>> linux_pattern.match('Loonix aaaa')
<_sre.SRE_Match object; span=(0, 6), match='Loonix'>
>>> linux_pattern.match('Lunix aaaa')
<_sre.SRE_Match object; span=(0, 5), match='Lunix'>
>>> linux_pattern.match('Linux aaaa')
<_sre.SRE_Match object; span=(0, 5), match='Linux'>
>>> linux_pattern.match('loonix aaaa')
<_sre.SRE_Match object; span=(0, 6), match='loonix'>
>>> linux_pattern.match('lunix aaaa')
<_sre.SRE_Match object; span=(0, 5), match='lunix'>
>>> linux_pattern.match('linux aaaa')
<_sre.SRE_Match object; span=(0, 5), match='linux'>
>>>

but not
>>> linux_pattern.match('aaaa linux')
>>> linux_pattern.match('aaaa loonix')
>>> linux_pattern.match('aaaa lunix')
>>> linux_pattern.match('aaaa Linux')
>>> linux_pattern.match('aaaa Loonix')
>>> linux_pattern.match('aaaa Lunix')
>>>

it works fine when I put it in those online regex testers
>>
>>51532935
lel, libkeks assmad.
>>
>>51532907
I don't like GLFW's callbackery.
>>
>>51533087
my bad, sorry
>https://docs.python.org/3/library/re.html#re.match
>If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match.
>beginning of the string
What should I use instead then, re.search?
>>
>>51533264
Yep.
>>
If I have an iterator called i looping through a for loop, and I write (*i), will that give me the object I'm looking at?
I have a map full of pointers that I need to iterate through, and I need to call a function on each pointer. In the function parameters, I'm passing in (*i), but it says I'm passing in an iterator, not an object.
>>
>>51533262
Can I get an example of this "callbackery"?
Been using GLFW for a long time and it's pretty convenient so far.
>>
>>51533277
alright, thanks anon
>>
>>51533287
What kind of shit language are you dealing with here? I've never heard of a compiler actually reserving an "iterator" value for a for loop rather than just another integer.
>>
File: code.png (6 KB, 657x118) Image search: [Google]
code.png
6 KB, 657x118
>>51533383
This is my code. It's C++ and SDL_Mixer.
I want to set the volume of the Mix_Chunks (sound effects). For some reason, it doesn't let you set all of them at once; you have to pass through the specific chunks whose volume you want to change. I want to get every chunk out of my map of chunks, and change the volume.
>>
>>51533417
Okay nevermind what I said then.
Can you try adding something like

auto x = soundEffects[i];
Mix_VolumeChunk((*x),v);

to the loop? Don't actually use "auto", replace that with whatever value Mix_VolumeChunk takes.
>>
>>51533482
or Mix_VolumeChunk(*soundEffects[i],v)
>>
>>51533502
>>51533482
No, that's not doing it. The problem is that the iterator is a C++ pair, a string and a Mix_Chunk. I need to figure out how to get ONLY the Mix_Chunk out of the pair.
>>
>>51533541
Shit, I'm stupid. It's just (*i).second. That returns the second item in the pair. Derp.
>>
no trip fags
>>
Guys semi-noobish coder here (with some basic experience) Any advice in going forward and becoming top-tier?
>>
Let's say you have to call a bunch of system utilities repeatedly from your program in Linux. How do you make sure that said utilities are loaded and waiting for a command to be processed?
>>
>>51533673
> what am I looking to use?
If you're thinking about invoking the program multiple times, just invoke it multiple times and don't bother. If it takes commands on stdin, look into popen, or reimplement popen using pipe fork exec
>>
>>51531952
This to be honest family
>>
>>51533984
What does /dpt/ think of RISC-V?

>A completely open ISA that is freely available to academia and industry.
>A real ISA suitable for direct native hardware implementation, not just simulation or binary translation.
>An ISA that avoids "over-architecting" for a particular microarchitecture style (e.g., microcoded, in-order, decoupled, out-of-order) or implementation technology (e.g., full-custom, ASIC, FPGA), but which allows efficient implementation in any of these.
>An ISA separated into a small base integer ISA, usable by itself as a base for customized accelerators or for educational purposes, and optional standard extensions, to support general-purpose software development.
>Support for the revised 2008 IEEE-754 floating-point standard.
>An ISA supporting extensive user-level ISA extensions and specialized variants.
>32-bit, 64-bit, and 128-bit address space variants for applications, operating system kernels, and hardware implementations.
>An ISA with support for highly-parallel multicore or manycore implementations, including heterogeneous multiprocessors.
>Optional variable-length instructions to both expand available instruction encoding space and to support an optional dense instruction encoding for improved performance, static code size, and energy efficiency.
>A fully virtualizable ISA to ease hypervisor development.
>An ISA that simplifies experiments with new supervisor-level and hypervisor-level ISA designs.
>>
Does anyone know how to unpack 4chan's packed, base64 md5s in python?

From the api:
text (24 character, packed base64 MD5 hash)
NOetrLVnES3jUn1x5ZPVAg==
>>
REEEEEEEEEEEEEEEEEEE

    <!--resources/styles-->
<Window.Resources>
<Style x:Key="topButtonsStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Grid>
<!--menu-->
<StackPanel Name="menuItems" Width="100" Height="105" HorizontalAlignment="Left" Panel.ZIndex="998"
VerticalAlignment="Top" Margin="5,35,0,0" Visibility="Hidden" MouseEnter="menuItems_MouseEnter" MouseLeave="menuItems_MouseLeave">
<Button Name="configureButton" Height="35" Style="{StaticResource topButtonsStyle}" Background="#FF252525" MouseEnter="configureButton_MouseEnter" MouseLeave="configureButton_MouseLeave">
<TextBlock Text="menuItem" FontSize="16" Foreground="AliceBlue" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Button>
<Button Height="35" Style="{StaticResource topButtonsStyle}" Background="#FF252525">
<TextBlock Text="menuItem" FontSize="16" Foreground="AliceBlue" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Button>
<Button Height="35" Style="{StaticResource topButtonsStyle}" Background="#FF252525">
<TextBlock Text="menuItem" FontSize="16" Foreground="AliceBlue" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
</Button>
</StackPanel>

<!--Edge Borders-->
<Rectangle Name="leftBorder" HorizontalAlignment="Left" Width="5" Fill="#FF252525
>>
>>51534053
WPF is gross
>>
>>51534036
google 'decode base64 python' next time
>>
>>51534130
How about it's packed and I don't understand what that means or how to unpack it.
Decoding it normally gives me this shit
b'PB\xb2)h\xc1\xd9\x0f&9So\x7f\xa5?+'


And I don't know what the fuck to do with that.
So how do I "unpack" it first?
What does that even mean?
>>
>>51531335
this looks cancerigenous as fuck son
>>
>>51534170
MD5 is a binary format. Maybe you want to represent it in hex?
>>
>>51534195
Yes!
So what you're saying is that string I posted is the binary of that string and I need to convert that to hex?
Here's the python that gave me that
print("\tmd5: " + str(base64.b64decode(i['md5'])))

Also this is my first python project so pls no bullie
>>
File: meme.jpg (67 KB, 509x801) Image search: [Google]
meme.jpg
67 KB, 509x801
>>51531335
>>
>>51534216
google how to convert python binary string to hex dude cmon
>>
>>51534260
print("\tmd5: " + str(hex(int(str(base64.b64decode(i['md5'])), 2))))


 print("\tmd5: " + str(hex(int(str(base64.b64decode(i['md5'])), 2))))
ValueError: invalid literal for int() with base 2: "b'\\xec\\xcb$$\\xfbe\\\\\\xc5\\xd8\\x9axG\\x9c1\\xa7\\xae'"


Wakarimasen
>>
>>51532300
the lower you go, the more you can do.
so i say assembly
>>
Could Erlang's syntax be any less intuitive?
>>
File: 1448473404155.jpg (114 KB, 720x960) Image search: [Google]
1448473404155.jpg
114 KB, 720x960
>>51534311
>>
bunch of nerds
>>
>>51534387
Alright I got to
print("\tmd5: " + str(hexlify(a2b_base64(i['md5']))))

But I get
md5: b'eccb2424fb655cc5d89a78479c31a7ae'

What's with the b and the quotes?
The rest looks right though.
>>
>>51533087

you have comments in your regex, show it to me without the comments, on one line.
>>
>>51533087
Don't know what the fuck you're doing with that regex
re.search("L(inu|uni|ooni)x(\s+kernel)?", some_string)
>>
>>51534439
Also the md5's two chars short
Can someone please just exlain what's happening to me?
At least what to google?
>>51534311
Was just a giggle
>>
I'm starting to get very nervous that because I haven't done any personal projects (or can figure out what to make as a personal project) and don't really code on the side, that CS isn't my thing but I love AI and Machine Learning (at least in theory). What do I do? Is there a sort of /g/ roll chart of machine learning things I could do to get myself more interested in actually programming? It's not necessarily that I'm bored of CS or anything, but I don't think I've been a very competent programmer. How do I get better?
>>
>>51534563
>I love AI and Machine Learning
sorry to say this but it seems like you fell for the meme
>>
>>51534621
why do you say that
>>
What's the practical avantages of Haskell ? Is it just a hipster thingy ?
>>
>>51534439
http://stackoverflow.com/questions/2592764/what-does-a-b-prefix-before-a-python-string-mean
that md5 (eccb2424fb655cc5d89a78479c31a7ae) is correct.
>>
Aren't interpreted languages essentially just scripts?
>>
>>51534676
Oh shit, thank you so much!
>>
>>51534664
It's just a different paradigm of programming

Go find out why people love it
>>
>>51534692
and do you want to guess how I found that SO link?
I FUCKING GOOGLED IT
>>
>>51534562
The b'...' is because you're using Python 3 and hexlify returns a byte string rather than a (unicode) string. str() will return the "string literal" representation, which isn't what you want.

Use
print("\tmd5: " + hexlify(a2b_base64(i['md5'])).decode('ascii'))
>>
>>51534709
saved me from using botnet
>>
>>51534709
I didn't think it was a prefix, I thought it was my autism

>>51534720
Ok, thanks, works a treat!
>>
>>51534664
it's academic/neckbeardic wankery
>>
>>51534691
> Aren't interpreted languages essentially just scripts?
No.

While there's no precise definition of what constitutes a "script", it generally refers to a flat sequence of commands with little or no computation or algorithm.

While languages designed for scripting are invariably interpreted (there's not much point in compiling such languages, as the performance is dictated by the execution speed of the commands, not the script itself), most interpreted languages aren't designed primarily for scripting.
>>
>>51534776
But they're literally just telling another program (the virtual machine) what to do. They're scripts.
>>
>>51534793
Which definition of "script" are you laboring under?
>>
>>51531375
Windows 7
>>
>>51534664
> What's the practical avantages of Haskell ?
Over what? Other functional languages? Or over imperative languages?

Functional languages require less programmer effort for any given task (as the programmer isn't doing most of the compiler's job for it), but the resulting code tends to be less efficient (as the programmer isn't doing most of the compiler's job for it).
>>
>>51534664
Allows you to write better and bug-free code due to stricter type system.
>>
>>51534852
that applies to any statically typed non-ducky language
>>
>>51534842
>Functional languages require less programmer effort for any given task
No, they require way more effort (especially dependently typed ones) because you need to spend an inordinate amount of time designing a taxonomy so all your types (or proofs) fit together, and the more types you add on the less flexible the code becomes so it's a real slog to change your design later on.
FP is extremely resistant to prototype-style programming (which is the most productive kind of programming, you get results up and running quickly).
Take a concrete example: Adding runtime introspection (debug viewing, graphs, etc), that would require you to wrap everything in some new fucking IO Monad, and you can't do it peace meal, EVERYTHING has to fit the new types or nothing even compiles.
>>
>>51532406
>>)))))))
>>
>>51534852
> Allows you to write better and bug-free code
True
> due to stricter type system.
The type system is probably the least significant factor. The more significant factor is the lack of mutable state (or rather, discouragement of mutable state and the requirement that any such use is made explicit; you don't get to pretend that a procedure is a function).

>>51534870
Yes and no. Haskell's type system is a lot more expressive than e.g. C, and requires less effort to Do It Right than e.g. C++.
>>
>>51534933
> No, they require way more effort (especially dependently typed ones) because you need to spend an inordinate amount of time designing a taxonomy so all your types (or proofs) fit together, and the more types you add on the less flexible the code becomes so it's a real slog to change your design later on.
That's an issue of static versus dynamic typing, not declarative versus imperative.

Beyond that, if your types get in the way, it tends to indicate that your code is insufficiently generic (i.e. it's the code is written around concrete types, rather than using a type class which fits the algorithm then making the concrete type an instance of the class).

> FP is extremely resistant to prototype-style programming (which is the most productive kind of programming, you get results up and running quickly).
You're confusing productivity with instant gratification. You should go into management.

> Take a concrete example: Adding runtime introspection (debug viewing, graphs, etc), that would require you to wrap everything in some new fucking IO Monad
Sure, I/O is "cheaper" in a language which forces you to pay for it whether you use it or not. Any other strawmen you'd care to share with us?
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>51535034
m'lady
>>
>>51535072
nice damage control
>>
>>51535072
fuck off
>>
>>51535034
>That's an issue of static versus dynamic typing, not declarative versus imperative.
If you want those nice compiler checks you alluded to then strong typing is necessary.
>it tends to indicate that your code is insufficiently generic
That's the point, less generic code is both easier to come up with and easier to test (just consider maths, pretty easy to prove special cases, general proofs can be extremely subtle and tricky to get right, and if you're going for Curry-Howard correspondence you are doing that kind of math)
>You're confusing productivity with instant gratification.
Nope.
>Sure, I/O is "cheaper" in a language which forces you to pay for it whether you use it or not.
The entire point of programming a real computer is doing I/O.

> Any other strawmen you'd care to share with us?
That seems more like a question for yourself.
>>
>>51534626
You use CS to study the AI that we have thus instructed the machine to learn. And then find new and better ways for it to learn. But you don't like CS.

I think what you don't like is CS Majors. That or Tech geerks.
>>
File: lisp.png (596 KB, 600x791) Image search: [Google]
lisp.png
596 KB, 600x791
No Starch is running a 50% off sale, should I get Land of Lisp?
>>
>>51534933
>FP is extremely resistant to prototype-style programming (which is the most productive kind of programming, you get results up and running quickly).
quite the opposite, assuming your referring to prototype OO as used in javascript. Prototype OO is very dynamic in nature compared to class based OO which makes data very static and resists functional programmings arbitrary way of encapsulating data within function passing
>>
multi paradigm is best
>>
>>51535412
I think he meant https://en.wikipedia.org/wiki/Software_prototyping
>>
File: 1424560205570.jpg (57 KB, 884x889) Image search: [Google]
1424560205570.jpg
57 KB, 884x889
>teacher sent me an e-mail that he hasn't received a project I sent 3 months ago even though I clearly did

I have 3 finals to ace, don't do this to me you god damn motherfucker
>>
>>51535620
go to 'sent', send it again
>>
>>51535620
then resend the email
you'll have to hope that he doesn't know that email timestamps can be faked
>>
File: bashscript.png (50 KB, 764x327) Image search: [Google]
bashscript.png
50 KB, 764x327
Newcomer to bash in linux, and having a hard time making a script that can extract data from one file and place it in another using awk..

e.g grabbing specifically "john" and his password "123456" and exporting it to another file in format as: "john's password is 123456"

pic related....
>>
File: yUdixcD.webm (2 MB, 640x640) Image search: [Google]
yUdixcD.webm
2 MB, 640x640
Ask your beloved programming literate anything
>>
>>51535750
I haven't used bash in a long time, but a bit of googling:
awk '{print $1 $5 $6}' $filename
# Prints fields #1, #5, and #6 of file $filename.

Just grab the single line instead of the entire file.
I don't think you need to use awk at all though, the cut command does that too (I think).
>>
>>51535768
what's 42
>>
>>51535818
https://en.wikipedia.org/wiki/42_%28school%29
>>
>>51535813

yeah, I tried doing this by using e.g '$4' will grab the whole column of passwords. When I'm only trying to get that one specific password, that is John's.

I feel like im close, yet so far...
>>
>>51535919
aha
>>
File: left bias.webm (3 MB, 1184x598) Image search: [Google]
left bias.webm
3 MB, 1184x598
Suppose I have a list of rooms within some form of labyrinth or dungeon.

I've defined the location, every containing member of, central point, and size of each item.

I want to connect each of these items together, allowing overlaps, so that from any one point you can traverse to any other.

I can figure out how to do that, in at least one way, but how can I do it in a way that looks natural? What I have right now has a strict bias towards the firstward island in a set of islands, which is not ok, but trying to do it any other way I can think of, I end up with random lines going from the extreme edges to the other extreme edges, which just looks awful.

webm for reference. You can see that it looks ok for an open map (this only applies if the map is less than 200x200), but with a constrained map it's easy to notice.
>>
>>51536039
every time you need to connect a room with another, calculate multiple possible paths. Then pick the shortest one.
>>
how do you start a project as a beginner? is it okay to just write bad code just to get things working? my crippling perfectionism has resulted in me almost never starting projects and being unable to actually practice and improve, because i'm so focused on googling how to do things the "proper" way, and because of my shitty attention span I lose interest and impulsively click over to another tab and open up 4chan, then I exit my IDE and lose interest in trying to practice programming, until I regain interest weeks later and do it all over again
>>
school project: i have to program an app for a bar to order stuuf and such.

package Model;


public class Orderline implements Comparable<Orderline>{

private Consumption orderedConsumption;
private int amount;

public Orderline(Consumption c, int amount) {
this.orderedConsumption = c;
this.amount = amount;
}

public double calculateSubTotal(){
return amount * orderedConsumption.getPrijs();
}

@Override
public int compareTo(Orderline o) {
// TODO Auto-generated method stub
return orderedConsumption.compareTo(o.getOrderedConsumption());
}

@Override
public boolean equals(Object obj) {
Orderline temp = (Orderline) obj;
return this.getOrderedConsumption().equals(temp.getOrderedConsumption());
}

@Override
public int hashCode() {
// TODO Auto-generated method stub
return orderedConsumption.hashCode();
}

public Consumption getOrderedConsumption() {
return orderedConsumption;
}

public void setOrderedConsumption(Consumption orderedConsumption) {
this.orderedConsumption = orderedConsumption;
}

public int getAmount() {
return amount;
}

public void setAmount(int amount) {
this.amount = amount;
}

@Override
public String toString() {
return orderedConsumption.toString() + " " + amount;
}



}
>>
>>51536297
any tips?
>>
>>51536260
>is it okay to just write bad code just to get things working?
yes. In fact it's okay to get a job writing shitty code. I think most newbies tend to be shocked when they get their first job and find out how shitty most code in the industry is.

Don't worry about being "proper". There's almost no such thing. This read a good book on the language you want to learn, and learn design pattern and good structuring and you'll be better than 90% of programmers.
>>
Today i am taking a break from everything and paly my melee build on fallout 3.
Then I will wash the dishes, clean tje room, tidy up my closet and tjen go to work.
No java today :^(
>>
>>51535768
how to get jewish wife
>>
Everyone who is a professional programmer.

Do you ever use your knowledge of NP completeness and problem reduction in the real work?

Do you often use dynamic programming?
>>
>>51536077
ok, I've decided that I'm going to go from just concatenating everything to the first islands and as I connect them to that to picking a random island, determining the three closest islands, determining the shortest path to each of those islands, either one or two of those, connecting them, and then concatenating one of the modified islands onto one of the other ones, and then removing it from the list.

Implementing now, will see how it goes.
>>
>>51535921
https://en.wikibooks.org/wiki/An_Awk_Primer/Awk_Command-Line_Examples#Conditionals
I think this is exactly what you need.
>>
>>51535768
How do I get a tomboy gf who likes monogamous sodomy?
>>
>>51536329
Kekolding

>>51536352
Not programming
>>
>>51536297
>>51536304
Yes, use the code tags.
[ code] [ /code] without spaces and only post the areas you have problems (e.g. not the override methods and get/sets).
>>
>>51534664
>More concise code
>Faster production time
>Less error prone code
>Very readable code
>You can provide formal proof that your program works as intended -- Big deal for academics.
>>
>>51536366
all right. was looking for it. thanks anon!
>>
>>51536373
>was looking for it
>>39894014
>To use the Code tag, book-end your body of code with
please read sticky
>>
>>51534707
>different
>this is what haskell fags believe
Yeah, it was different 20 years ago maybe. Today, however, all modern programming languages (at least partly) incorporate its paradigm.
>>
package Model;


public class Orderline implements Comparable<Orderline>{

private Consumption orderedConsumption;
private int amount;

public Orderline(Consumption c, int amount) {
this.orderedConsumption = c;
this.amount = amount;
}

public double calculateSubTotal(){
return amount * orderedConsumption.getPrijs();
}

@Override
public int compareTo(Orderline o) {
// TODO Auto-generated method stub
return orderedConsumption.compareTo(o.getOrderedConsumption());
}

@Override
public boolean equals(Object obj) {
Orderline temp = (Orderline) obj;
return this.getOrderedConsumption().equals(temp.getOrderedConsumption());
}

@Override
public int hashCode() {
// TODO Auto-generated method stub
return orderedConsumption.hashCode();
}

public Consumption getOrderedConsumption() {
return orderedConsumption;
}

public void setOrderedConsumption(Consumption orderedConsumption) {
this.orderedConsumption = orderedConsumption;
}

public int getAmount() {
return amount;
}

public void setAmount(int amount) {
this.amount = amount;
}

@Override
public String toString() {
return orderedConsumption.toString() + " " + amount;
}



}

any tips?
>>
>>51536390
remarks or code-cleaning help?
>>
>>51531483
The irony is that Javascript was invented by a guy who is against political correctness and lost his CEO position because of it.
>>
>>51536039
Nigger, link to your github? I assume you're using cellular automata for this and then just creating corridors between each and every "room". I'd love to see your code and compare it to my own as I made a cavern generator (without the corridors, though).

As for your question, you want your corridors to be more natural, correct? Are you using a tile system for your map?

Then you can make a randomizer function for your corridors based on the neighbouring tiles.
>>
>>51536039
your webms are why i come to these threads, so soothing
>>
>>51536390
>group toString with the other overrides (I prefer them all at the bottom, but that's just my preference)
>remove the //TODO auto-generated comments unless you're actually going to change them
>check for null in your equals/compareTo
Seems normal enough though.
>>
>>51536473
thanks dude.
>>
>>51536445
I don't mean natural as in cave like, I just mean natural as in not a spider web intersecting every single room.

https://github.com/Partinarel/map-make

beware, some of it looks like spaghetti, and there are a few unused files sitting around. ignore the exe files in the repo, just recompile it from vstudio or something.

Click on left side of window to generate a map, and then use numpad to move, braces to change cone size, and pipe to switch between circle and square cone.

Change the window size manually, pictureboxes will update. Also the map size is hardcoded for now, but the numbers are in the form, so they should be easy enough to change.
>>
>>51536514
Would you mind if I use your code in a game I'm making for a university project? I can credit you if you want and the game will be released with a free license.
>>
>>51536514
>Map.Map map = null;
>map = new Map.Map(235, 57);

lol
>>
>>51536530
Go ahead. I'm not even planning to make a game.
I'm just trying to make an efficient autonomous map explorer.
I might also set up human v computer map exploration when I'm done, where both the human and the computer can see the other map, and are able to use that to 'cheat'.

>>51536545
I have no shame. I am just running with "if it works don't fix it" for now.
>>
>>51536552
Thanks for your permission mate, I'm looking over it now.

Here is the game's repo in case you're interested. It's a unity game.

https://bitbucket.org/searock/project-219/src/cecf2c2ff6731e7560bd4f826ddad548e37ecdff/Assets/Scripts/Dungeon/Cavern/?at=master

I linked you directly to how I made the cavern. Basically I create a large space with a fairly low wall percentage (around 4) such that I get a massive space where I spawn the player. Then I run DFS on the entire map to find the largest such space so that I can use it as the place where the player and enemies are spawned.

Execuse the code, some of it is written late at night when I just want shit to werk, though I try to keep it fairly well.
>>
>>51536605
> fairly low wall percentage (around 4)
Obs I mean 40, not 4. 40 percent walls.
>>
>>51536552
>Go ahead. I'm not even planning to make a game.
You should probably attach some license like MIT or BSD-style to the repo because by default everything is assumed "all rights reserved" so just for the fuck of it if anyone wants to tinker with your code.
>>
>>51536351

thanks anon, will look.
>>
>>51536619
I might do that in the morning. I didn't even realize until ten minutes ago that my repo was public.
I didn't even realize until nine minutes ago that I couldn't make my other repo private :^)
>>
File: 1446828830624.jpg (36 KB, 400x460) Image search: [Google]
1446828830624.jpg
36 KB, 400x460
>>51531459
>>
>>51531835
Use linkedlists instead f a m, append is O(1).
>>
What do you call the part of the program which is responsible for directing the control flow?

For example:

if (a == 1 && b == 2) //this part
{
}
>>
>>51536760
if statements?
>>
>>51536760
flow controller.
>>
>>51536473
package Model;


public class Orderline implements Comparable<Orderline>{

private Consumption orderedConsumption;
private int amount;

public Orderline(Consumption c, int amount) {
this.orderedConsumption = c;
this.amount = amount;
}

public double calculateSubTotal(){
return amount * orderedConsumption.getPrijs();
}



public Consumption getOrderedConsumption() {
return orderedConsumption;
}

public void setOrderedConsumption(Consumption orderedConsumption) {
this.orderedConsumption = orderedConsumption;
}

public int getAmount() {
return amount;
}

public void setAmount(int amount) {
this.amount = amount;
}

@Override
public String toString() {
return orderedConsumption.toString() + " " + amount;
}

@Override
public int compareTo(Orderline o) {
return orderedConsumption.compareTo(o.getOrderedConsumption());
}

@Override
public boolean equals(Object obj) {
Orderline temp = (Orderline) obj;
return this.getOrderedConsumption().equals(temp.getOrderedConsumption());
}

@Override
public int hashCode() {
return orderedConsumption.hashCode();
}



}

better?
>>
>>51536760
https://en.wikipedia.org/wiki/Conditional_%28computer_programming%29
>>
>>51536774
Lmfao
>>
>>51536787
Forgot the null checks.
And there's no need to repost your code every time, if you fix it then you fix it.
>>
>>51536811
got it.
again, thanks
>>
File: bias_fixed.webm (2 MB, 1184x594) Image search: [Google]
bias_fixed.webm
2 MB, 1184x594
>>51536605
>>51536545
>>51536530
>>51536468

ok pham, I updated it.
Depending on the map layout, it will be faster or slower to join hallways, but I assume it's slightly faster.

I even updated the github too.
for specifically what I changed, check out this pastebin:
http://pastebin.com/JdwKqjXy
It's a fucking monster and it physically hurt a little to write. Other than a just misplacing numbers when I copypasted, it pretty much worked perfectly first try. I haven't even bothered with the optional second shortest path, just because there's not really any point when it works well enough for the constained graphs as it is. Also, removed the hardcoded value for the rng seed.

Also, I just discovered that it will crash if you minimize the window
>the graphics object attached to the picturebox becomes null
>this invalidates the bitmap that uses that
:^)
>>
>>51531375
Any OS X version before Yosemite
>>
>>51534016
The answer is nobody gives a shit, communism aside. There are plenty of alternatives and nobody in industry wants anything except ARM.

ARM ARM ARM ARM they won't shut the fuck up.
>>
File: img.png (74 KB, 812x409) Image search: [Google]
img.png
74 KB, 812x409
>>
>>51536760
at least in australia for the NSW HSC (final test in high school), those are called binary selection control structures
but in colloquial speech I'd simply call them "if statements"
>>
>>51536884
>his highschool had programming
Lucky motherfucker.
I went to school in QLD, my year 11 and 12 IT class was a fucking cert 1 in IT. That's right, both years were spent doing a cert 1 which is the equivalent of "You've used a computer before? Here's your certificate".
>>
>>51536876
is ARM web scale?
>>
>>51536952
we had C++, JavaScript, PHP in highschool in Poland
>>
>>51532098
>C memory model
ishiggydiggy
>>
>>51534053
>xml
>programming
m8...
>>
>>51536952
it was pretty low level stuff
the final project that other people made was some shitty web app with at least 3 "custom modules", ie any code which had a custom if statement
--
I made a house booking system with a nodejs backend and using react and jspm for the frontend, including tests with continuous integration with circleci and deployment on heroku. It was slightly more complex. Around 1500 lines of code compared to 40 or so for the others
I did feel like I learned a lot doing the course though, as before that I'd only taught myself coding.
>>
>>51537006
>I made a house booking system with a nodejs backend and using react and jspm for the frontend
back off to california
>>
>>51537006
>web app
>nodejs
>react
>jspm
>circleci
>heroku
>complex
[buzzword overload]
>>
>>51537025
heh, I know
but if you wanna get employed you have to be hip with the modern times
I main C# though, not javascript. Had to use it for this project as my teacher only knows js and php.
>>
>>51531294
>What are you working on?
A programming language.
>When's your project gonna be finished?
Never. First release sometime next year.
>What's the most recent insight into the programming craft you've had?
Every programming language currently available is garbage.
>>
>>51536958
ARM is love, ARM is life.
>>
PHP project.

I have two files that both request a class.
They are in different folders
The class file requires another file, which is also in a different folder.
When I call the class file, the path to load additional files seems different depending on where I called the class for.

How do I use my class from different directories?
>>
>>51531375
Gentoo
>>
>>51537057
>but if you wanna get employed you have to be hip with the modern times
No.
>>
>>51537107
thanks for your contribution to the thread
great insight, keep it up, proud of you
>>
>>51533554
i->second is fine too
>>
>>51537114
Are you actually considering 4chan to be a decent discussion media?
Please be Poe's law.
>>
>>51537132
>>>/reddit/
>>
>>51537132
what I just did was something called "ironic shitposting"
as many know, ironic shitposting is, in fact, shitposting.
the fact that you actually thought that I could be serious is quite sad
stay new, newfriend
>>
>>51537103
Solved it, if anyone cares.

[spoiler]include dirname(__FILE__).'/../relative/path/file.php';[/spoiler]
Thread replies: 255
Thread images: 27

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.