[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: 36
File: himegoto considered harmful.png (1 MB, 1000x1400) Image search: [Google]
himegoto considered harmful.png
1 MB, 1000x1400
Previous Thread: >>55468132


What are you working on, /g/?
>>
Forced meme general
XDDD
>>
>>55480439
K..
>>
What is an audio file?

i imagine it's some header data to describe format size etc etc and some binary that gets read and sent to the right hardware if you want to hear it

is this far too simplistic or totally wrong
>>
HELP
I need a online web page so I can and other people code something like google drive

pls help
>>
Apollo 11 source code

https://github.com/chrislgarry/Apollo-11
>>
>>55480466
yes, an audio file is just a set of audio "frames" that are decoded and fed to the system audio API
>>
>>55480448
KEEP
>>
So I recently upgraded android studio from 1.3 to 2.1
When I was testing out something using my phone I could see stuff normally in logcat. Afterwards in 2.1 shit is being continuously printed even though I'm not doing anything. What happened?
>>
>>55480487
IM PRETTY MUCH TRYING TO HACKENING THIS THREAD AND I ALSO DDOS THE PONTAGOON.
THE IP IS 127.0.0.1.
I WILL HACK YOUR 4CHAN ACCOUNTS I ALREADY GOT YOUR PASSWORDS.
HAHA
YOU ARE RETARDED.
THE USERNAME "USERNAME" AND THE PASSWORD "PASSWORD" PROOVE THAT YOU ARE PRETTY DUMB.
>>
>>55480477
>not written in Haskell
disgusting
>>
>>55480477
They could've used Rust instead of writing such an unsafe turd in assembly. What the fuck were they thinking?
>>
>>55480487
and a video would be similar right
>>
File: 451.png (707 KB, 1280x720) Image search: [Google]
451.png
707 KB, 1280x720
>>55480439
>>
>>55480415
Type-level computation on Common Lisp
>>
>>55480466
>>55480505
https://xiph.org/video/vid1.shtml
>>
>>55480501
rust is a meme language, and so are you
>>
File: Barefoot foot waifu.jpg (257 KB, 1920x1080) Image search: [Google]
Barefoot foot waifu.jpg
257 KB, 1920x1080
So Whatchu workin on gamebros.
>Making a stock market crash simulator where you have plenty of ways to suicide.
We gonna party like it's 1932.
>>
>>55480497
>thinking it'd be a good idea to write critical software in anything but Assembly
>>
>>55480521
Don't you fucking dare to call me a meme kiddo.
>>
File: wildberger with child.jpg (323 KB, 640x861) Image search: [Google]
wildberger with child.jpg
323 KB, 640x861
>>55480528
>impure languages
>safer than Haskell
>>
>>55480512
Does Common Lisp support dependent typing?
>>
>>55480533
You mean haskell or haskell-lang?
>>
>>55480533
scuse me while I pause to gc
>>
>>55480528
reminder that you can't spell
"Has Kelly (Thomas J.)'s lunar module landed yet?" without Haskell
>>
>Python is slow

Please, /dpt/, explain how EVE Online exists and how it runs so well

Yes, I know about Stackless Python, but is it different enough to make up for all of Python's common pitfalls?
If so, how come it isn't the absolutely most popular interpreter?
>>
File: 1330003967963.jpg (33 KB, 383x208) Image search: [Google]
1330003967963.jpg
33 KB, 383x208
>Haskell autists are back.
>>
>>55480471
could someone help an anon here pls?
>>
>>55480522
>>Making a stock market crash simulator where you have plenty of ways to suicide.
Name it Reddit Bitcoin Simulator and you got me interested.
>>
How can I compose functions in C?
>>
>>55480546
>implying stop-the-world gc
>2016
>not generational gc
shiggy diggy doo
>>
>>55480477
Anyone know where I can find the instruction set descriptions?
>>
>>55480549
afaik stackless only has a few added features like threading and fp but is pretty much as fast as cpython and definitely slower than pypy
>>
>>55480549
Stackless has no GIL and that alone gives 200% speedups to most programs
>>
>>55480571
You can't. Stop posting.
>>
File: 1448237910730.jpg (88 KB, 650x703) Image search: [Google]
1448237910730.jpg
88 KB, 650x703
>>55480569
>Guys we need to post suicide prevention hotline link.
>>
>>55480582
this?
http://www.ibiblio.org/apollo/assembly_language_manual.html
>>
>>55480588
But is that really enough for something ultra-heavy like EVE?

I just don't get how the fuck CCP managed that
>>
>>55480534
Types can be arbitrary s-expressions. You can define your own types like you would macros. Primitive types can also be defined based on values, as in
* (type-of 2)

(INTEGER 0 4611686018427387903)
>>
Can someone please give me some direction on how to begin programming?

What language? I do not really know what I want to do yet. I just want to get my foot in the door here.

Please don't meme me. I already meme myself.

t. Memeboi
>>
>>55480634
>le just write a few macros meme
>>
File: 675894689546.jpg (20 KB, 411x219) Image search: [Google]
675894689546.jpg
20 KB, 411x219
Who here /DumbAsFuck/
>>
>>55480612
Yep that looks like that's it. Thanks anon. Probably should have just googled it but I figured it has a specific processor.
>>
>>55480640
Haskell
>>
>>55480640
PROLOG
>>
>>55480549
always do the opposite of what /dpt/ says
>>
>>55480653
Is it Haskell or Haskell-lang? So confusing...
>>
>>55480640
do the opposite of what >>55480679 says

>>55480666
Satan begone
>>
File: c22.gif (345 KB, 209x172) Image search: [Google]
c22.gif
345 KB, 209x172
>>55480649
me but i somehow lucked my way into one of the best CS schools in my country
>>
>>55480592
You must be able to, it's a really basic operation soþlice.
>>
>>55480707
You can't in C, stop pestering people.
>>
File: 1373326926241.png (51 KB, 457x496) Image search: [Google]
1373326926241.png
51 KB, 457x496
>>55480696
>he's too stupid to understand prolog logics
>>
>>55480700
What is your country anon

Is it CAR

Are you a tortoise or a hare
>>
>>55480714
Why not? You can do it in C++, can you not? I'll not cease pestering until /g/ gives me a solution to this problem of mine.
>>
File: that jew when.jpg (360 KB, 1162x850) Image search: [Google]
that jew when.jpg
360 KB, 1162x850
>>55480700
>A school of imaginary ''science''.
Well done anon well done.

HOWEVER

[spoiler]Good luck anon, I'm gonna take courses at a community college hopefully. I mostly intend on learning by myself though.

I do this so that I can say on my resume I'm working towards my degree, but I already know enough to work. Then I can just one class at a time till I eventually get it.

Oy vey
>>
>>55480640
What i did was I learnt some simple python syntax using youtube, there's this guy with a french name that has a nice tutorial i don't remember the name, but you'll know it, he's autistic and uses a webcam

then i started doing MIT OCW courses, read SICP, K & R for C, almost finished CLRS, studied some discrete math.

there's tons of resources out there, but those are the ones i used
>>
>>55480724
Canada

>Are you a tortoise or a hare
Yes.
>>
>>55480497
>wanting a literal space leak
>>
>>55480746
Is it Snow College

Are you on a hockey scholarship

Do you eat syrup

Also which one are you
>>
>>55480744
>can't even do something as simple as closing a spoiler tag
UR FUKKED M80
>>
>>55480739
It's literally impossible you idiot, you've been told this a million times. There are no templates
in C. It's all well and good that there are macros, but you can't create a macro from within a function to declare a new one outside of it
>>
>>55480739
I am confused by your initial question. You can write functions in C. Functions have been around for a long time now.
>>
>>55480818
But I to compose them because my coworker is laughing at me.
>>
>>55480771
btw congrats
>>
File: 1453526566774.png (530 KB, 800x900) Image search: [Google]
1453526566774.png
530 KB, 800x900
Should I learn x32 or x64 assembly first?

Any good recommendations on good books, tools, etc to learn assembly?

I have a copy of Knuth's TAOCP that I haven't really used, should I learn MIX/MMIX first?
>>
>>55480885
First learn Idris then work your way down, soþlice
>>
>>55480415
I'm working on a (slightly over-engineered) semi-monotonically increasing 64-bit unique ID assignment system.

No ID will be assigned twice, but IDs may be skipped and may be assigned out of order (though they'll generally be assigned increasing from 0).

N servers using Raft for consensus, a layer of caching below that to add network partition tolerance, and a client library that also does caching / load prediction.

The basic idea is that the consensus servers agree to hand out blocks of IDs, which can't be reclaimed after a crash out network failure, even if they are never assigned.

With you hand out big contiguous chunks, though, the variance between IDs is pretty big for clients accessing different caches. To address this, the system will hand out interleaved "slices", defined by (offset, count, phase, duty, period) rather than contiguous blocks defined by (offset, count).
>>
>>55480885
Intel assembly is one of the worst. Don't study it unless your job requires it.
>>
>>55480907
Stop pseudo-namefagging
>>
>>55480920
What's the matter? Can't type thorn?
>>
>>55480914
wat
what's the point of all the complexity when you're just handing out 64bit IDs

what is there to work on really
>>
>>55480914
Why not just use refinement types?
What's the matter, not using Idris, soþlice?
>>
>>55480945
When you need to hand out so many IDs so fast that one server can't keep up, and when getting IDs is so important that you need to be able to handle at least 24 hours of network partition / local outage without losing the ability to assign IDs.

I'll be releasing it as Google OSS, it is similar to a system we use relatively heavily inside the company.
>>
Can I invocate Java from C#? My prof wants us to use a Java library he wrote, but I for myself believe contrariwise that C# is much more superior for it has LINQ, and I may have cause to access a database with this code, if my professor deems such to be a required feature that merits merit when he is considering which of the available grades to assign to my work.

I remain as ever your most humblest servant in all of Albion and the Empire. Pajeet Ramasharwa
>>
>>55480920
Please discuss technology, soþlice
>>
>>55480571
void compose(void (*f)(void *), void (*g)(void *), void *x) {
g(x);
f(x);
}
>>
>>55480958
"Just use refinement types" yeah thanks that'll save me all of 0 effort. Idris can't prove the correctness of my code (ie, it can't prove that I don't hand out overlapping sets of IDs).

The system must be compatible with a variety of client languages, so all the benefits of the type system would be lost at the network boundary anyway.
>>
>>55481044
you fucked up, soþlice

>>55481029
et tu, soþlice
>>
>>55481044
That is not composition, but rather sequencing, soþlice
>>
>>55481063
What the fuck did you just call me
>>
>>55481044
>output pointers
Kill me now
>>
>>55480719
:- can_check_digits(you).
>>
>>55480996
so if you have N = 8 servers, each server will get 2^64/8 ID's to hand out, but those are not consecutive but interleaved by some method, so if one fails you'll be able to hand out from the rest that would be sitting in some cache?
>>
>>55481065
That's Kleisli composition, soþlice
>>
uncurry (++) . partition (9 /=)
>>
>>55481077
Almost. The N servers won't split the whole set up immediately. They'll take a contiguous block of K, depending on the rate IDs are being consumed, and split that block up.

This means you can support dynamic numbers of servers, and dynamic weights. So rather than 1:1:1 among three servers, it could be adjusted to 1:1:2 or whatever.
>>
>>55481091
Only for an IO monad, soþlice
>>
>>55481106
You're really proud of that little code you stole, aren't you?
>>
>>55481127
Programs run on the IO monad, soþlice
>>
>>55481144
No, procedures do, soþlice
>>
>>55481106
india = (++)
uncurry india
>>
>>55480885
ARM or MIPS, senpai. Intel assembly is silly.
>>
>>55481091
Kleisli composition is

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c


If I'm not mistaken, soþlice
>>
>>55481129
I wrote it, I didn't steal it from the bird thread
>>
>>55478874
Same here, anon

Started porting a thing from SDL to SDL2 but kinda got bored because original dev abandoned it and it'll never make it into upstream and it's too unpopular to fork
I re-wrote a tiny gui app from PyGTK to C++/Qt but that was too fast/easy/unchallenging
I've submitted a PR to fix a bug in a program I use but dev checks those once in a year
Submitted a proposal patch on another tiny thing but no reply in a month
I've submitted a small module in another program I use, they've eventually accepted it but I was motivated because I needed that module
I'm writing a small fun chat bot that's used in a chat with 10-15 people but project itself is just dumb so I generally use it as a lab rat for various tools
Not much motivation to fix random bugs, esp. if they're too complex, and opensource seem to be generally slow/unmotivated as fuck
Want to learn new language but when I dip my toes in one, I lose a lot of motivation because I met issues/pet peeves that for some reason don't exist in C++
I'm really tempted to start some kind of complex project but I have very little ideas and I'm afraid I'll run out of enthusiasm
Wanted to get into indie gamedev but artistic skills are more important than programming skills and in general community feels pretentious as fuck

God I just should kill myself or something
>>
>>55481190
No I wrote it, soþlice
>>
>>55481202
C++ has its own pet peeves, you're just pretending they're not there, soþlice
>>
this is one of the worst /dpt/
>>
>>55481231
You would say that, soþlice
>>
>>55481202
>Wanted to get into indie gamedev but artistic skills are more important than programming skills and in general community feels pretentious as fuck

Stop. Just write your game, use placeholder art everywhere. It does not matter. Just finish the game from the programming viewpoint and ignore all the assets to begin with. For the audio, there's a decent SFX pack for like $70 that contains thousands of sound effects, I guess it's worth the money. As for the art, you can either show the game prototype to an artist and get them involved (percent of income, money upfront or something) or I'm not sure, but the lack of assets should not stop you from making a game. The chances are, that if you even had assets, you wouldn't finish the project programming wise so it's best not worry about them at this point.
>>
>>55481231
So contribute and improve it soþlice
>>
>soþlice

why
>>
>>55478874
>>55481202
Learn a new language! Have you tried out Racket?
>>
<!DOCTYPE html>
<html>
<head>
<title>To do list for today
</head>
<h1> <body> Hang myself</h1>
<p>Fap</p>
<p>shitpost</p>
<p>buy a game on steam and never play it</p>
<p>Fap again</p>
<p>Cry self to sleep</p>
</body>
</html>
>>
I just wanna lay in my bed
>>
>>55481263
Hindus forcing their memes again.
>>
File: Modj9lH.jpg (115 KB, 1920x1080) Image search: [Google]
Modj9lH.jpg
115 KB, 1920x1080
>>55481285
>>>/g/wdg/
>>
>>55481285
<!DOCTYPE html>
<html>
<head>
<title>To do list for today soþlice
</head>
<h1> <body> Hang myself soþlice</h1>
<p>Fap soþlice</p>
<p>shitpost soþlice</p>
<p>buy a game on steam and never play it soþlice</p>
<p>Fap again soþlice</p>
<p>Cry self to sleep soþlice</p>
</body>
</html>
>>
>>55481285
Nice indentation, fagget
>>
>>55481306
>Ænglisc
>Hindu
baka desu soþlice
>>
>>55481263
Cwiðe hit.
>>
File: 1467464778712.png (583 KB, 536x598) Image search: [Google]
1467464778712.png
583 KB, 536x598
>>55481307
>Reddit filename.
>>
File: shirou.jpg (145 KB, 903x513) Image search: [Google]
shirou.jpg
145 KB, 903x513
>>55481355
I got it from google images but thanks
>>
>>55481285
>>55481330
Not using ul for unordered lists triggers me.
>>
File: 1343422439407.png (589 KB, 516x566) Image search: [Google]
1343422439407.png
589 KB, 516x566
>>55481364
>The oldest lie in the book.
>>
>>55481372
It's okay, as is using tables for layout, soþlice
>>
File: wise magical negro shig.jpg (38 KB, 200x200) Image search: [Google]
wise magical negro shig.jpg
38 KB, 200x200
>>55481364
>jewgle
>>
>>55481372
Is your OCD really that bad.
>>
>>55481372
>web dev "standards"
lol
>>
>>55481372
                                                                                                                                                                                                                                                                                                                                                                                                                                  poo in loo webdev
>>
>>55481411
Hwā eart þū?
>>
>>55481411
                                                                             newfag can't spoiler                                                         
>>
>>55481355
>recognizing reddit filename structure
you have to go back
>>
>>55481444
waste of trips soþlice
>>
>>55481467
Isn't it just the imgur structure? The tumblr/Facebook/imgur/gfycat are all really easy to recognize.
>>
>>55481467
>if you recognize patterns you must be the one from reddit
nice pilpul diversion shlomo
>>
>>55481479
JUST GO SUCK A DICK
>>
>>55481493
That's not very nice, soþlice
>>
>>55480679
This guy is right
>>
File: Dev vs webdev.png (57 KB, 321x390) Image search: [Google]
Dev vs webdev.png
57 KB, 321x390
>>55481396
We webdevs have fucking standards to live up to. We aren't typical code monkies, we are refined gentlemen.
>>
>>55481493
Also the 4chan structure, and the *booru hashes.

Are there any other common ones?
>>
>>55481505
Therefore he is wrong
>>
>I wanna code for 4chan!
Said literally no one ever, even Janitors.
>>
こんばんは, ファゲトたち

プログラミングはどうであうか。
>>
>>55480549
That it works doesn't mean it couldn't be faster and less expensive in a different language, and also doesn't mean they haven't wasted days of effort avoiding Python's pitfalls.
>>
>>55481508
Nobody who 'transpiles' to JavaScript can claim to have any standards soþlice
>>
File: smeg on the big screen.png (1 MB, 998x728) Image search: [Google]
smeg on the big screen.png
1 MB, 998x728
>>55481508
>webdev
>code
>>
>>55481529
SPEAK ENGLISH
>>
>>55481539
Fine
ي سوصك حوغع حهرسع صهصكس
مط مهتحعر شاس بهرن هف ا حهر
سع غهت راةعد بط ا دهغ اند بيرتحعد مع
>>
>>55481508
>webdev
>not racist against indians

gee I wonder why
>>
File: 1423408130614.jpg (25 KB, 324x327) Image search: [Google]
1423408130614.jpg
25 KB, 324x327
>>55481533
>He bought into the C family was really different meme.
>>
File: le poo beach.jpg (283 KB, 1441x930) Image search: [Google]
le poo beach.jpg
283 KB, 1441x930
>>55481508
>>
>>55481551
Actually, Arabic texts look much nicer. Not even memeing
>>
>>55481588
It's a language for ants.
>>
>>55481588
Arabic has the coolest calligraphy of any language, in my opinion. It's a pity they have such a shitty culture.
>>
>>55481539
SPRIC ÆNGLISC
>>
>>55481533
JavaScript has an ECMA standard.
>>
>>55481588
The text is certainly beautiful.
>>
>>55481575
>he bought into the street shitting meme
>>
Can someone help me read in a binary file. I just cant get it to work. I can read the file as a text file but not binary.
std::string OpenFileDialog::read_file(TCHAR* filepath, int& size)
{

//std::string line;
std::ifstream file(filepath, std::ios::binary|std::ios::ate);
std::string result = "";
//int size;
char* memblock;


if (!file.is_open())
{
std::cout << "Could not open file" << std::endl;
return result;
}
else
{
size = file.tellg();
memblock = new char[size];
file.seekg(0, std::ios::beg);
file.read(memblock, size);
file.close();
result = memblock;
int x = sizeof(memblock);
//std::cout << "the entire file content is in memory";
delete[] memblock;
}
return result;
}
>>
>>55481603
Back when the middle east wasn't a shithole, they were the educational center of the world.

Now.......... In fact they were starting to get great again in the 60's I think before the '''''Islamic revolution'''''''' Same with Afghanistan.
>>
>>55481588
Fuck off ahmed
>>
>>55481638
>C++
There's your problem right there buddy
>>
>>55481644
Everyone cucks burgers
>Niggers
>Even Pajeets
>Ahmeds
>Pedros

Is that why they feel so insecure?
>>
C++
JS
Python
HTML
CSS

Memes aside is this a good collection?
>>
File: punish heretic.png (214 KB, 531x497) Image search: [Google]
punish heretic.png
214 KB, 531x497
>>55481588
Esne haereseus?
>>
>>55481661
top kek enjoy the unemployment m8
>>
>>55481661
Absolutely dire soþlice
>>
>>55481661
A good collection for the garbage, yes
>>
>>55481658
Oh, forgot the
>Juden

hahaha
>>
File: 11345896859.png (129 KB, 571x426) Image search: [Google]
11345896859.png
129 KB, 571x426
>>55481668
>>55481672
>>
>>55481681
You need to learn norsk and dansk, so you can have dansk memes
>>
File: 1375994411346.jpg (22 KB, 409x409) Image search: [Google]
1375994411346.jpg
22 KB, 409x409
>This pimple on the back of my head literally won't stop spewing pus every time I pinch it.
>>
>>55481588
No shit, it's a kind of art for them.
https://en.wikipedia.org/wiki/Islamic_calligraphy
>>
>>55481707
You only lose if it is producing puss faster than you can squeeze it out. Keep trying.
>>
>>55481658
I'm actually German, you stupid fucking turk shit
>>
>>55481733
hahahahahahahahahahhahaa

Literaly C U C K E D lmao hahahaha why haven't you kill yourself yet?
>>
File: mad bunny.jpg (63 KB, 439x435) Image search: [Google]
mad bunny.jpg
63 KB, 439x435
>>55481747
>>
>>55481733
>''I'm actually German, you stupid fucking turk shit''
>Turk so ready to betray his roach friends to fit in.
The funny part is he didn't even need to do that.
>>
>>55481771
Roaches always together, they like niggers can't win one-on-one without ganging up on people
>>
>>55481763
Kaniner liker å hoppe og danse og synge hele tiden, de er snille dyr
>>
>tfw tutorials advertise themselves around what the program literally does and not what the thing the tutorial teaches can be used for
I hate feeling so blind.
>>
>>55481791
*always stick
>>
>>55480760
I kek'd.
>>
>>55481763
Cry and suicide. I'm going to take my leave for today
>>
>>55481796
it's ok keep trying nigger
>>
File: AMD feel.png (91 KB, 653x726) Image search: [Google]
AMD feel.png
91 KB, 653x726
>>
>>55481747
I actually vote AfD
>>
File: oy fucking vey afd.jpg (213 KB, 816x870) Image search: [Google]
oy fucking vey afd.jpg
213 KB, 816x870
>>55481909
>>
>>55481638
so can no one help me. Ive been stuck here for days.
>>
>>55482114
Try SO
>>
/pol/ cuckolds go away
>>
>>5548163
c++ looks disgusting, it should've stayed as " c with classes/namespaces"
>>
File: tutin putin.png (738 KB, 646x720) Image search: [Google]
tutin putin.png
738 KB, 646x720
I got a programming interview soon /g/ here are some reqs:

>Experience developing Windows GUI applications
>Knowledge and experience with object oriented languages (e.g., C++, C#, Java, Delphi)
>Knowledge and experience developing on current Windows operating systems
>Experience using SQL and SQL databases (e.g., PostgreSQL, SQL Server)


my plan was to study OOP out the ass and then study some stuff on SQL. Anyone got any advice for C#, C++, SQL based interviews?
>>
>>55482171
C is retarded too
>>
>>55481245
>The chances are, that if you even had assets, you wouldn't finish the project programming wise so it's best not worry about them at this point.
If I'd really want to finish a game then I'd pick something like GameMaker/etc. instead of C++/Java/whatever, which takes most of the fun/unfun programming out at the expense of dealing with gimped GML/etc. and leaves game logic and assets. But yeah, you're probably right, I guess.
>>
>using atom

>save file
>newline added to the bottom of the file

What the actual fuck?
This is seriously pissing off my OCD
>>
>>55482487
>there are people on this planet right now that do not enable a newline on save in every editor they use

Are you fucking stupid?
>>
>>55482283

>Windows GUI applications

Gah.. Windows api work is always horrid. Messy code and conventions abound.

> Experience with object oriented languages
Translation you're going to be working with "Enterprise" Java or C# developer code bases.

>SQL
This is a requirement that is everywhere..
>>
>>55482487
Ok it was a setting that's automatically on for some reason
>>
>>55475313
>The list of all permutations for an empty list is the empty list.
Wrong. The list of all permutations for an empty list is a singleton list containing the empty list. That implementation there fails for the empty list. If they had given the right implementation for an empty list, they could use the recursive case when the len is 1 too
>>
>>55482506
cat does that for me already.
>>
File: 1467855775471.png (973 KB, 1600x900) Image search: [Google]
1467855775471.png
973 KB, 1600x900
>>55482546
nerd
>>
>>55482546
God damn it, you're right

I'm drunk right now with my bf so I think I win, though
>>
>>55482547
Does what? Edits files you output so that they end with a newline? I don't think so.
>>
>>55482546
>using python for recursive functions
I kinda feel bad for the original anon.
>>
How do I, using Haskell Platform & Atom+HaskellIDE, install packages globally in a way that will automatically work with GHC & autocomplete
>>
>>55482487
>>>/reddit/
>>
>>55482559
Misaka can I hug you???
>>
>>55482584
You mean Haskell-lang?
>>
>>55482584
by reading the documentations
>>
>>55482601
What the fuck do you keep talking about?
>>
>>55482616
It is impossible & I have spent hours trying to find out how to do it properly, you just end up with local packages, packages registered with only 1 of 3 different package managers that now come with it, end up messing up files everywhere, etc
>>
>>55482617
haskell-lang.org
>>
>>55482652
I'm not talking about a fucking website
>>
>>55482666
Haskell is depreciated, the new maintained fork is called Haskell-lang

Do you live under a rock?
>>
>>55482690
It's still fucking haskell
>>
>>55482710
No, it's haskell-lang, get it right. Words are important.
>>
Just a reminder

quote,
atom,
eq,
cons,
car,
cdr,
cond


Is enough to build up nearly anything
>>
>>55481638
The code works, just don't feed binary char* into string, it stumbles upon \0 and thinks the string has ended

There's also a bunch of stuff that is wrong with your code but I'm not sure if you're still in this thread
>>
>>55482736
>cond
bloat
>>
>>55482736
kys
>>
>>55482729
No, it fucking isn't.
Stop being such a fucking cunt and either help or fuck off, if, as appears to be the case, you don't know anything of use at all.
>>
>>55482752
>kys
You might as well kill yourself as well.
>>
>>55482729
Haskell-lang is Haskell. Prove me wronng
>>
>>55482736
Just a reminder

x
\x.e
e e

is enough to build up literally anything
>>
>>55482760
>>55482771
Haskell-lang is new haskell. GHC is being phased out as we speak.
>>
>>55482778
Only if your only question is "Does it halt?" There's no way to extract any information out of it.
>>
>>55482791
Exactly. Haskell-lang is Haskell
>>
>>55482838
Don't call it Haskell just yet because we're still in the process of depreciation in favor of Haskell-lang
>>
If I have a vector of pointers, but I never insert anything into it and I never use it in any way, can it cause a memory leak? Do I need to do something special to it?
>>
>>55482850
Haskell cannot be depreciated if Haskell-lang has zero changes over Haskell.
>>
>>55482866
Wow, calm down with personal attacks. Haskell-lang is refreshing the whole platform and will push inclusive extensions to the Haskell2017 standard.
>>
>>55482690
>>55482729
Isn't this just the fork of the website?
>>
>>55482745
What else is wrong with the code, its pretty much copied and pasted from
>http://www.cplusplus.com/doc/tutorial/files/
I figured out that was the problem by printing
for (int i = 0; i < 40;i++)
std::cout << std::hex << (memblock[i]&0xff) << std::endl;

Not sure how Im going to handle this issue though, of the dynamically allocated memory. Guess I could just pass in the a pointer to the function and delete that when Im done in the main function.
>>
>>55482882
Oh yeah? Well your a double nigger.
>>
>>55482856
Assuming that you're talking about C++

Pointers don't cause memory leaks on their own, pointers are just variables that point to some data in memory

Memory leak is when you allocate some memory and then do not deallocate it when you're done
>>
This project is actually pretty interesting https://github.com/murarth/ketos
>>
>>55481638
std::string OpenFileDialog::read_file(TCHAR *path, std::size_t &size) const
{
std::ifstream stream{path, std::ios::binary};
if(!stream.is_open())
return {};

std::string data{
(std::istreambuf_iterator<char>(stream)),
(std::istreambuf_iterator<char>())
};

size = data.size();
return data;
}
>>
I need programming music.

Working with sql.

I know its a step down from html but fuck off I need a job that is in tech so I can stop working construction while I learn more.
>>
>>55482955
Nobody cares soþlice
>>
>>55482955
This works far better than what I was about to try. Thank you. So std::istreambuf_iterator<char> just treats the entire file as a stream until it reaches the end instead of how a string usually terminates at /0. And you use std::istreambuf_iterator<char>() to set the end of the string.
Just making sure I understand whats going on. Again thanks for the help. I didnt know istreambuf_iterator existed.
>>
>>55483049
You really should have been able to do it yourself soþlice
>>
>>55483049
http://en.cppreference.com/w/cpp/iterator/istreambuf_iterator

cppreference is your friend
>>
>>55483027
Any kind of electronica makes for fantastic programming music. I normally do not listen to electronica as my style is folk/jazz/blues/rock 'n roll but I can't concentrate when I'm listening to these styles. However, I highly recommend electronica for programming. I got started by searching for programming music in Youtube.
>>
>somebody new joins my team
>uses Pythonbfor all his shit
>can't understand this autistic language that doesnt even work
What do autistic like Python so much, it can't even do multithreading for fucks same just Kiki yourselves dynamic typing socks it's for people who can't get the types right. If you get a compiler error then it's because you're code is wrong
>>
>>55483076
seconding
>>
>>55483059
I looked around for how it was done. Never saw anything about istreambuf_iterator.
>>
>>55482902
>What else is wrong with the code
I was writing my post but then >>55482955 guy posted (he's a different guy)

Basically, don't use C-style programming in C++ but it may be a little bit overwhelming if you're just starting so don't worry too much

Don't use new/delete. Either use something you store on stack or use reference counting pointers instead of raw pointers. Raw pointers are a good source of various errors and crashes that are hard to debug.

Don't use C-style arrays, use string, vector or other structure instead, same reason as with pointers.

Don't manually close fstreams unless they have huge scope or you want to check for errors. Destructor does that for you.

Don't use plain integer types for anything that returns sizes or positions unless you're sure it'll fit. It may get silently downsized with loss of data and mess things up. Auto is a good friend here.
>>
>>55483027

This sort of music is good for programming
https://www.youtube.com/watch?v=P9n6SAXnQdg
>>
File: tumblr_m0kapozBUw1qfu47lo2_250.gif (999 KB, 250x251) Image search: [Google]
tumblr_m0kapozBUw1qfu47lo2_250.gif
999 KB, 250x251
>>55480415
> https://www.railstutorial.org/book/user_microposts

For anyone who's familiar with Michael Hartl's rails tutorial, how would you allow microposts to be submitted with blank content, so long as they had a picture attached?
Alternatively, without that context, do you know of a way to rewrite
params.require(:micropost).permit(:content, :picture)
so that it allows microposts to be submitted with a lack of text content, as long as you include a picture?
>>
>>55483194
auto has truly revolutionized C++
>>
>>55483278

Now if only they'd do something to fix the horrible mess that is exceptions..
>>
>>55483266

Kind of rusty, but strong params only define what /can/ be submitted, not what /needs/ to be submitted. You should be able to POST to your controller with one, both or neither.
>>
File: Untitled.png (10 KB, 430x167) Image search: [Google]
Untitled.png
10 KB, 430x167
>>55483453
Thanks man. Here's a picture of the microposts controller's create action. The flash message is just a placeholder to show when this isn't working, but you probably already knew that.

If I submit a micropost with only text and no picture, it works. If I submit one with only a picture and no text, it does not work. If I submit one with both text and a picture, it works. Any idea where I might need to look to solve this problem, like the micropost model, one of the micropost views, or somewhere else entirely?
>>
>>55483076
https://www.youtube.com/watch?v=ntWD6rpivqM
>>
How many sorting algorithms do you have to implement in C in order to not be considered a Pajeet?
>>
>>55483541

If you can provide an error stack trace it would help. I imagine it is at the model/db layer. You may have a NOT NULL constraint on your text column, or a pre-save/pre-create validation to ensure text is present. Can you post your model code?
>>
>>55483592
seventeen
>>
>>55483691
A-anon, I've only implemented 11.
>>
>>55483592
Pajeet means you have Indian ancestry and work in the tech field.

Pajeet takes away the white man's jobs.

If you're not Indian, you can't be Pajeet. You can only be Trans-Pajeet.
>>
>>55483645
Oh god, I'm an idiot. Yeah, it's in the user model, a validation that confirms the presence of text. validates :content, presence: true

I guess I just have to delete this and figure out a way to rewrite it as an if/else statement in the create action of the micropost controller which ensures that there's either text or a picture or both, right? Or is that dumb and there's a better way of doing it?
>>
>>55483937

You can remove the validation and (assuming there is nothing in your migration that enforces a database-level constraint), you will be able to create microposts with one, both or neither pieces of content. Hope this helped.
>>
>>55483937
>>55484008

Sorry I realized I misread your question. You want to allow a user to create a micropost with one or both, but not a completely empty post (i.e. no text and no image). You can write a custom validation on your model which will be simple logic to check for the presence of at least one. This should get your started: http://guides.rubyonrails.org/active_record_validations.html#performing-custom-validations

You /can/ do this in your controller code, but the "rails way" is to put it in your model as a custom validation method.
>>
>>55483027
Everyone loves to shit on SQL around here, but it's a skill that will really win the hearts of hiring managers -- speaking from experience.

Godspeed, Anon.
>>
Working on a breadth first search challenge in R. Currently dysfunctional kluge code at its finest.
Thread replies: 255
Thread images: 36

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.