Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 166 KB, 1280x720, 1523920114325.jpg [View same] [iqdb] [saucenao] [google] [report]
65615641 No.65615641 [Reply] [Original] [archived.moe] [rbt]

What are you working on?
Previous thread: >>65606120

>> No.65615652

>>65615641
thank you for using an anime image

>> No.65615661

>>65615641
Trying to get Boot to work for Clojurescript.

>> No.65615669

>>65615641
working? im working to learn a fucking language thats what im working on. im self learn guy, any idea how to make money after learning python/C/ruby ? im interested in penetration testing any stuff i should know

>> No.65615675

Just lost a shitload of my bigass program due to corruption. Reminder to always keep backups and always eject external harddrives before unplugging them. Don't be an idiot. It can and will happen to you. Looking for music recommendations or something to listen to while I rebuild everything.

>> No.65615684

>>65615675
>always eject external harddrives before unplugging them
WTF? Are you actually using FAT for anything at all other than interchanging files between different operating systems?

>> No.65615693

>>65615684
Just bought an external drive to carry my shit around on between computers anon. I just used the default. Dumb of me, I know. But not keeping a backup was dumber.

>> No.65615700

Is there any benefit in looking into hipster languages like Haskell, Rust, Ruby and Lisp instead of just sticking with C, C++, Java or C#?

>> No.65615703

Can anyone explain me this sentence
> If you were a good enough programer you wouldn't worry about the OS you run you could ssh into your server

help, what does ssh into your server means

>> No.65615708

>>65615693
>But not keeping a backup was dumber.
Perhaps, but on any real filesystem, you shouldn't have to worry about corruption, at the very least.

>> No.65615711

>>65615700
Learning Haskell or Lisp will make you a better programmer, even if you never use them outside of hobby projects.

>> No.65615714

>>65615700
Fun

>> No.65615716

>>65615700
you probably wont go far with your logic
not learning new things to improve your skills because youre on 4chan and ppl with anime backgrounds call Ruby a hipster language is just braindead shit buddy.

>> No.65615725

>>65615716
Ruby shill spotted.

>> No.65615733

>>65615725
You forgot your anime girl anon.

>> No.65615743
File: 2.02 MB, 300x169, yuyu-15.gif [View same] [iqdb] [saucenao] [google] [report]
65615743

>>65615641
Just wrote a Python library for easier testing of various audio waveforms.
>>> from sox import dplay, sine
>>> dplay(sine(f=sine(f=1, amp=200, bias=500), amp=0.5), T=2.0)


Thanks for using a great image, OP.

>> No.65615754

>>65615703
>Can anyone explain me this sentence
Yeah: the guy's a moron.
Being able to ssh into a server running your OS of choice has nothing to do with being a good programmer.
Also, if the requirements say your program needs to run on ShitOS, and there are portability issues, that shit won't help you one bit.

>> No.65615768

>>65615708
>on any real filesystem, you shouldn't have to worry about corruption, at the very least.
*snort*
ah, to be young and naive

>> No.65615771

>>65615652
No probelm. There is a high chance you are the one who posted it.
>>65615669
Different PL don't offer magic.
Just learn the abstract of what every PL has to offer you'll notice every PL is just different syntax with possibly different limitations.
E.g: creating a variable, functions, lambdas, basic system calls like console output and file IO...etc
>interested in pen testing
Learn C and then python
>>65615675
https://youtu.be/87l9IhZkUuw
https://youtu.be/RPq_Eo_lLhs
https://youtu.be/t90kAoxYg7U
https://youtu.be/DlKXJ906pd8
https://youtu.be/rOU4YiuaxAM
https://youtu.be/j7CDb610Bg0
https://youtu.be/3nlSDxvt6JU
https://youtu.be/CTAud5O7Qqk
>>65615700
How mastering the general purpose ones (at least one high and one low PL) and then getting into FPL for fun? Learning something new won't give you cancer.
Besides, if you want a job, you better learn the PL popular in your area.

>> No.65615785

>>65615725
oh tell me how i should limit my programing skills for the shake of society anon, we should just all learn python and c and call ourselves the gods of programing right. get lost

>> No.65615799
File: 259 KB, 1280x960, 1506932291819.jpg [View same] [iqdb] [saucenao] [google] [report]
65615799

>>65615785
No. Just C.

>> No.65615874

>>65615799
I'd let Maki give my ding-dong a tug

>> No.65615903

>>65615700
Fun, learning; they might not have the community or libraries of bigger languages, but they're fine otherwise.

>> No.65615987

Can someone explain to me how something like Haskell can be useful in the real world, outside of really niche stuff?

I understand and enjoy the functional programming paradigm; however, "pure" functional programming is free of side-effects. However, in real applications it seems to me like side-effects are the most important part. You will wait for input from a user, then draw to the screen, change state (because software that's being interacted with does have state), send a network request, write to disc, access a database... Sure, between those endpoint, there'll be some processing of the data. But in the end, it seems that "look at this data and decide what to do based on it, then interact with the real world (read: throw out a whole bunch of side-effects) accordingly" is much, much more common than "take in this data as input, process through it functionally and spit out the processed data".

So, is there a way to use Haskel for programming typical desktop applications, or is it really more of a niche thing for times when the business logic is relatively free of side-effects and more about processing data correctly?

>> No.65616000

>>65615987
Haskell models side effects using monads. The gist of it is that all your side effects can be contained to stuff like I/O while the majority of your code is pure functional.

>> No.65616002

>>65615768
In fifteen years, I haven't had any corruption whatsoever on ext3/4, XFS or ReiserFS that wasn't caused by the underlying hardware. Admittedly I don't know about NTFS, but surely it can't suck that badly.

>> No.65616048

>>65616002
>haven't had any corruption whatsoever on ext3/4, XFS or ReiserFS that wasn't***
that has nothing to do with the original point: keep backups (see also: don't skip leg day)
the fact that your FS dindu nuffin ain't gonna get your data back

>> No.65616074

>>65615987
translating >>65616000 to english:
haskell uses one huge global variable, and only modifies that
smug haskell weenies love to pretend that this makes their programs side effect free, which is their preferred way of training their self-delusion muscles

>> No.65616081

/dpt/ anons, do you use docker for team work?

>> No.65616088

>>65616074
>love to pretend that this makes their programs pure
much like "I'm still pure because he only did me up the arse"
Haskell is a religion after all, so you'll notice more of these similarities.

>> No.65616099

>>65616048
I never denied that. Nevertheless, in this particular case, backups shouldn't have been necessary.

>> No.65616109
File: 85 KB, 1024x845, 377248cc3632c98867e1e6c050ee85_jumbo.jpg [View same] [iqdb] [saucenao] [google] [report]
65616109

>>65616081
>use DOCKER for TEAM WORK
What is this, madlibs?
use TAR for VERSION CONTROL
use HAMMER for SCREW
use EGGPLANT for PROSTATE MASSAGE

>> No.65616148

>>65616099
1. you kinda implied that it ain't that important
2. but it sure would've helped

>> No.65616152
File: 344 KB, 1333x1000, Vo7SwyIdfd.jpg [View same] [iqdb] [saucenao] [google] [report]
65616152

>>65615799

>> No.65616157

>>65616074
>haskell uses one huge global variable, and only modifies that
I thought a monad was a way of chaining functions, not a variable to mutate.

>> No.65616192

>>65616157
a monad is a burrito
exactly that, and completely interchangeable
nothing less, nothing more

>> No.65616205

>>65616000
Yeah but like, say looking at my company's code I'm working on right now, the IO and other side-effects are so closely linked to the functional bits that separating them basically means chucking at the very least 50%, and possibly more like 80% of the code into an "IO layer" and then being smug that the remaining 20% are "pure".

Sure, I can see some modules which heavily process data - we have a lexer-parser for an in-house simple language, which could easily be implemented purely functionally - but outside of bits like that, it really seems superfluous.

>> No.65616206
File: 1.21 MB, 500x281, tumblr_o0a3wrvSLX1tzlep2o1_500.gif [View same] [iqdb] [saucenao] [google] [report]
65616206

>>65616192
A monad is just a monoid of the category of endofunctors

>> No.65616212

>>65616157
>>65616192
Didn't a guy with a monad get into Smash 4?

>> No.65616241
File: 90 KB, 706x690, 1498579043005.jpg [View same] [iqdb] [saucenao] [google] [report]
65616241

>>65616205
>this one tool is the only tool, the best tool, for every problem I might encounter
I too make sushis using only a hammer.

>> No.65616246

>>65616206
>what's the problem?

>> No.65616248

>>65616206
This. Simple really.

>> No.65616260

>>65616206
>A monad is just a monoid of the category of endofunctors
>>65616246
's a classic really
http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html

>> No.65616273

>>65616241
It's just that people love saying how Haskel is actually great for real world applications and all that. I never contested that it would work in envornments tailored to functional processing (like a lexer-parser, for instance), I'm asking for clarification on that particular claim.

I take in the answer is just "it's really not"?

>> No.65616297

>>65616148
I was implying that it shouldn't have been necessary in this particular case. The hardware didn't actually fail.

>> No.65616322

>>65616205
yep
see >>65616074

>> No.65616337

>>65616297
not necessary, but sufficient
and let's drop the autism for a bit - the most realistic and pragmatic approach

>> No.65616355

>>65616081
I still don't know what Docker actually is/does. And I don't care to find out.

>> No.65616371

>>65616260
>1972 - Dennis Ritchie invents a powerful gun that shoots both forward and backward simultaneously. Not satisfied with the number of deaths and permanent maimings from that invention he invents C and Unix.
I love this

>> No.65616379
File: 55 KB, 770x600, docker.jpg [View same] [iqdb] [saucenao] [google] [report]
65616379

>>65616355
he cute

>> No.65616381
File: 256 KB, 518x487, download.webm [View same] [iqdb] [saucenao] [google] [report]
65616381

I'm making a twitter image downloader because twitter is fucking garbage by default for downloading cute grills.

I'm going to use the text boxes for tags so I can make searching for images easier. The rest of the filename is so that I can build the original post's URL since the default filename makes it impossible to find the original source.

>> No.65616387

>>65616273
Your inability to comprehend that 'real world problems' might be much more than what you've encountered in your particular shitty career has nothing to do with Haskell.
Even among the IO heavy applications some can benefit a lot from Haskell.

You're just the nth obvious bait wanting to start another stupid language flamewar on a dead thread. If you really were curious you'd just google 5mins and read on why some businesses decided to use haskell.

Kys you're self already.

>> No.65616393

>>65616081
>>65616355
I used docker for a university group project, we spent three days right before the deadline sorting out problems related to it.
Apparently addressing the host machine from inside the container in a platform-independent way is such an outlandish problem that they only just added support for it, and we literally didn't have it available before the deadline. The workaround? Running docker in a virtual machine.
I wish I was joking.

>> No.65616400

>>65616387
>Kys you're self already.
*your :')

>> No.65616407

>>65616400
>being this new

out with you

>> No.65616419

>>65616381
post the cute grills already! nobody cares about the wem.

also,
that's actually a nice idea. I like it, you're going to share the code ?

>> No.65616427
File: 41 KB, 336x476, ebin.jpg [View same] [iqdb] [saucenao] [google] [report]
65616427

>>65616400
>wasting dubs that hard

>> No.65616557

rxjava

>> No.65616642

Does anyone here use VS Code on Linux? I just read an article about it, and it sounds really nice. Only the name Microsoft discourages me a bit.
I'd mostly use it for C/C++ and Python development. At the moment I'm using JetBrain's stuff (CLion etc.).

>> No.65616823

>>65616642
Focus on the product (and disable telemetry).
It has an amazing performance for a program running on electron.
Wouldn't use it for things other than .net core, haskelly and python.

>> No.65616836

anyone here do any game dev? (either in industry or just hobby projects)

any good resources for a noob like myself?

>> No.65616865

>>65616836
Unreal, Unity or monogame are the easiest.
Unity has dozens of resources given it is taught at uni and has a huge base of non enterprise or even solo devs.

>> No.65616881

Anyone here have experience with reading in packets using libpcap?

reading in live packets with pcap_next, seg faults if it runs out of packets and I'm looping through to find the one I need (comparing the recieved ip with the one I'm expecting) so if I don't get a response fast enough it just crashes, currently using sleeps to get around this but it causes some major delay.
Anyone know a better way?

>> No.65616919

>>65615799
>learn nothing but c
[brainlet (1).png.jpg.exe]

>> No.65616921

>>65615641
>>65615652
Damn. I want a cute comfy programming club.

>> No.65616970

>>65616881
use pcap_next_ex and see some examples online for live capture.
pcap_next doesn't distinguish between error and packet getting fitered and whatnot but it doesn't cause seg fault.
Make sure you have the latest lib version.

>> No.65617011

>>65616642
C/C++ and Python are both really suited to custom dev environments built on top of vim or emacs. Or if you're lazy, download one of the pre-made packages with a bunch of plugins included - spacemacs being one example, but there are tons including pure vim ones.

What you need an IDE for is Java. I've also not found a good way to use a javascript debugger in an editor, so you need a browser for that. For most other things, get rid of bloat.

>> No.65617165

>>65616381
You realize that tw*tter is one of the worst places on the internet to download anime art from right? Everything uploaded there gets fucked into a <100KB jpeg with horrible compression artifacts. It's honestly become the bane of my existence. Nothing pisses me off more than finding a good artist who uploads exclusively to tw*tter.

>> No.65617170

>>65616970
ah yeah that would work so much better, thanks.

>> No.65617291

>>65617165
If only retarded god tier nip artists would stop posting there.

>> No.65617304
File: 111 KB, 660x680, wc7u8noqs1t01.png [View same] [iqdb] [saucenao] [google] [report]
65617304

What keeps you going, /dpt/?

>> No.65617312

>>65617291
At this point I just write them off no matter how good they seem. If they don't care about their art, why should I?

>> No.65617336

Any way I can limit precision of floats in Python? During computation I'd like certain changing parameters to be always rounded to n decimal points not only during logging but also during computation.
Or is my only option to round them whenever assigning new values?

>> No.65617366

>>65617336
Why would you ever want to do this?

>> No.65617404

>>65615669
pickup violent python

>> No.65617450

>>65617336
Create new functions for arithmetic and use those instead.

>> No.65617498

>>65616205
>Yeah but like, say looking at my company's code I'm working on right now, the IO and other side-effects are so closely linked to the functional bits that separating them basically means chucking at the very least 50%, and possibly more like 80% of the code into an "IO layer" and then being smug that the remaining 20% are "pure".
What is your company's product? Don't need names, but what does it do? That just sounds like shit code to me.

>> No.65617525

>>65615700
They teach you new ways of thinking about programming.
Lisp and Ruby are highly likely to even become your preferred hobby language over C/C++/Java/C#, because they're just so joyous to program in.
And lots of people find benefits in using Haskell or Rust in their hobby projects too -- such as less frustration in the long run because the compilers and typing are so strict.

>> No.65617551

>>65615987
>>65616205
those things are, as you say, at the endpoints. and it depends on the application, but in my experience, there can be quite a bit in between, and much of it can and should either be pure or at least limit side effects strictly to objects directly taken by mutable reference (and of course global mutable state should be avoided at all costs in favor of context objects), because it's consistently good for code and helps you avoid a lot of pain. without global mutable state, taking objects by mutable reference can still form very useful guarantees to users and compilers, since it makes the scope of potential side effects known to a user, and keeps them as few and as local as possible. at that point, functions on such objects are still deterministic; just think of it like part of the input to the function is the values of the parts of the object's state it reads, and part of the output is the new values of the parts it mutates. given an object with the same state (or same relevant portion of state), the function will yield the same output. this determinism guarantee propagates outwards into calling scopes, and is even strong enough (and keeps the amount of relevant information small enough) that nonlocal/overall determinism becomes rather trivial to detect/enforce over a broader context. that's how constexpr in C++ works; by enforcing rules not much stricter than usual (primarily "no global mutable state, no undefined behavior"), it becomes manageable for the compiler to guarantee determinism for arbitrary/nontrivial code, using potentially any of a vast majority of language features (in a feature-heavy, imperative language), in contexts where the overall necessary/relevant inputs are known (it basically lets you embed pure functional programs written in C++ as compilation stages)

>> No.65617573

>>65617312
Wasn't there a nip alternative to twitter? Does it also compress images?

>> No.65617579

>>65616205
You'd probably be surprised at how much can be refactored to not rely on state and side effects. That's why Haskell is considered so enlightening to learn: you get really good at thinking about programming without relying on side effects and state.

>> No.65617587
File: 230 KB, 3840x2160, ansible_work.png [View same] [iqdb] [saucenao] [google] [report]
65617587

I don't know if you count this as programming but I wanted to try out feedbin for RSS but found out there's no easy way to deploy it with all bells and whistles so I'm working on an ansible playbook that will configure it and all of its sub-services using docker.

>> No.65617591

>>65617573
Did you mean Pixiv? Its not really twitter, more their DA.
And it has some, but an option to get the original (albeit compressed) image.

But for some reason tons of nip and western artists love using twitter to post their work and never upload them elsewhere. ITs weird.

>> No.65617622

>>65617591
For a while some artists linked to their patreon and no, I am not talking about pixiv.
I recall reading posts about twitter banning lolis and some said nips would just switch to their nip version of twitter but I forgot the name.
I honestly gave up on twitter and fucking puke everytime I see a twitter image on google. Seeing sachiko full of lossy shit drives me angry.

>> No.65617630

>>65617622
I don't recall that happening, twitter is still the main place for most nip artists still and I know a few still post their loli (then instantly delete) there.

>> No.65617669

>>65617304
hot women and hot assembly

>> No.65617697

>>65617551
holy wall of text, batman

>> No.65617701

>>65617304
Superior genes. I'm just a naturally positive and motivated person. I have no idea what a depression is and I just enjoy my life as it goes.

>> No.65617706

>>65617630
I think they use twitter because of the (You)s you could get there and interactivity with comments.
I just browse pixiv now and then and booru when I feel bored. If they have a patreon, you can find them on pixiv and booru otherwise just fuck their lossy shit.

>> No.65617709

>>65617304
The dream of formal verification with types.

>> No.65617726

>>65617701
>browsing 4chan
>superior genes
Pick one and only one.

>> No.65617736
File: 211 KB, 600x600, alijeres.jpg [View same] [iqdb] [saucenao] [google] [report]
65617736

>>65617726
>butthurt lowly peasant

>> No.65617738

>>65617726
I refuse. Also, this idea that only lowlife scum of society come to 4chan is silly. Just look at some of the battlestation showoff threads. Some people here are pulling pretty amazing money at a reasonably young age.

That might have been true in the formative years of 4chan on most boards, but nowadays I think it's mostly contained to places like /r9k/ and so on.

>> No.65617779

>>65617498
BPM/CRM with a heavy js-based webapp frontend and basically a LAMP stack with heavier data (basically all the actual business process definitions, cases, submissions, etc.) stored in AWS. Most of the frontend code is event handlers either modifying local state and DOM, or calling backend APIs. Most of the backend code is housekeeping the data in the database, or interfacing with AWS APIs (or APIs between internal components), plus boilerplate for authentication, access control, session management, and all that - with various transforms and business logic stuck in between. Really, most of the code at all layers is concerned with putting the right data in the right places at the right time, and while functional is good for getting "the right data", imperative seems better for satisfying the "right places" and "right time", so maybe our product isn't a good example. I'm in no way an experienced dev - this is my first and only job so far.

>> No.65617786

>>65617738
bst makes me think I am the only one falling for the linux meme and the rest of /g/ are getting comfy uasing win10

>> No.65617799

>>65617786
Nah man, linux is the only way. Unless you think your PC waking up at 3 am in the morning without your consent or knowledge to do "updates" is normal.

>> No.65617812

>>65617779
Okay, so it's UI and glue code. Haskell is definitely not a good choice for that kind of work. It would be much more suited to actually implementing the back end.

>> No.65617818

>>65617736
>implying you aren't a peasant to the elite

>> No.65617832

>>65616836
i highly recommend C# as a starting language (it's easy to learn like Java, but is better for a number of reasons, especially in the context of game dev), along with MonoGame, or maybe SFML.Net. both are simple and intuitive, but also don't hold excessively hold your hand or get in your way, which is good for actually learning and understanding how game dev works. i recommend avoiding Unity, because it's bloated and heavily integrated (not to mention it runs like absolute garbage - both the editor and the assemblies it generates); it tries to do way too much for you (which also means it makes a lot of assumptions, and limits what you can do), and hides everything away, meaning you'll learn the Unity way of doing things (which often isn't very transferable), not so much how things actually work. note that code from XNA 4.0 books/tutorials/etc will work for MonoGame with only minor changes (if any), because their interfaces are almost identical (the MonoGame documentation lists the few differences)

>> No.65617835

>>65616379
that looks dangerously close to a jizzface, anon

>> No.65617845

>>65617738
Damn, now I know it's bait.

>> No.65617854
File: 61 KB, 584x585, bog.jpg [View same] [iqdb] [saucenao] [google] [report]
65617854

>>65617818
>implying the elite doesn't answer to bogs

>> No.65617887
File: 16 KB, 384x320, running in the 90s.jpg [View same] [iqdb] [saucenao] [google] [report]
65617887

>>65617738
You are new.
If you looked around more on 4chan you will find out lowlife scum still resides here.

>>65617854
Kek.

>> No.65617901

>>65617812
The backend is basically along the lines of "here's a submission of this stage of the business process from the frontend; now I will proceed to send off the contents to AWS and stick metadata into the MySQL database", or "the frontend is requesting the continuation of that case, I will not look it up from the relevant metadata storage in MySQL, retrieve relevant data from AWS, package this into a JSON return and send it back", or "the frontend is requesting a list of everything assigned to user X, I will aggregate the relevant data from the databases and send it back". The only other thing are small bits like the lexer-parser I mentioned. Yeah, it's mostly glue code, but what kind of applications would be more suited to Haskell?

>> No.65617940

>>65617887
>If you looked around more on 4chan you will find out lowlife scum still resides here.
I've been here since the second year of 4chan's existence anon. Of course there are scum here, but not ONLY scum. I think 4chan overall has a pretty nice mix of different kind of people from different places, social strata, income brackets, education levels and so on. But do you really think 4chan has more lowlifes than reddit or twitter?

>> No.65617960

>>65617901
Not the backend, I guess, I mean actually implementing the database itself, the server itself, etc. "Systems" programming. That said, some of those tasks you mention could be organized as pure functions composed into pipelines, but that would only be worth doing if you had Haskell APIs to the services you are using. Haskell is good for gluing together other bits of Haskell. Not so much otherwise.

Really, lots of things are suited to Haskell as long as they can be entirely Haskell. Haskell's main weakness is interfacing with languages that are not like Haskell, which is to say most languages.

>> No.65617968

Can someone explain me free monads? Are they solving the same problem as mtl?

>> No.65618030

>>65617968
Free monads only relate to monad transformers because free monads are used in algebraic effects. Both MTL and algebraic effects are ways to combine multiple effects into one monad, but they work in different ways and have different tradeoffs.

>> No.65618107

>>65617960
Fair enough. Sounds logical.

>> No.65618117

So I'm writing a PowerShell script that finds and replaces a word in Publisher through a loop.

I'm launching Publisher and opening the files with

$Publisher = New-Object Microsoft.Office.Interop.Publisher.ApplicationClass
$OpenDoc = $Publisher.Open($PubFileName)


This is what's inside the loop.

$OpenDoc.Find.Clear()
"Looping through " + $Array[$i]
if ($i -eq 0)
{
$OpenDoc.Find.FindText = "FirstName-LastName"
}
else
{
$OpenDoc.Find.FindText = $Array[$i-1]
}
$OpenDoc.Find.ReplaceWithText = $Array[$i]
$OpenDoc.Find.ReplaceScope = $pbReplaceScopeAll
$OpenDoc.Find.Execute()


It's basically going through a list, replacing names one after another.
But the piece of shit doesn't replace ANYTHING, not even the first one.
I'm 100% sure "FirstName-LastName" exists in the publisher file.
The file recognizes the name array fine.
I don't understand WHAT's shitting the bed.

Please help, I'm retarded.

>> No.65618168

>>65618107
The trick is that there is actually a large class of Haskell-like languages: domain-specific languages embedded in Haskell (usually with monads and do notation). A Haskell database API, for example, wouldn't use SQL for queries, but rather a query-building monad.

>> No.65618189

>>65618117
Wew. Is powershell more powerful than bash?

>> No.65618244

>>65618117
don't you need to save? or somehow commit your changes

>> No.65618248

>>65618189
Looks like the same shit to be honest.
I mean I started this last saturday but it looks pretty much the same.
Of course, Microsoft™ PowerShell will work perfectly for Microsoft™ Publisher and other Microsoft™ Office products.

>> No.65618255
File: 154 KB, 1718x972, Screenshot from 2018-04-21 02-09-22.png [View same] [iqdb] [saucenao] [google] [report]
65618255

std::idiomatic C++ only

>> No.65618288

>>65618244
No you see, I'm replacing the word I want and then exporting as PDF, everytime I run the script I know what's the original word I want ("FirstName-LastName"), then from the second iteration onwards the word I'll look for is Array[i-1].

Anyway, apparently $pbReplaceScopeAll is not a defined constant, I just replaced it with a 2 (That's what it's supposed to be valued at) and it's working fine now. But if there's something else you guys can point out, please do.

>> No.65618310

>>65615641
>What are you working on?
world domination

>> No.65618315

>>65618310
How's that working out?

>> No.65618333
File: 16 KB, 720x718, 28056566.jpg [View same] [iqdb] [saucenao] [google] [report]
65618333

>>65618310
You can dominate me if you want <3

>> No.65618373
File: 343 KB, 720x1280, Screenshot_2018-04-20-13-21-42.png [View same] [iqdb] [saucenao] [google] [report]
65618373

>>65618310
this one?

>> No.65618389
File: 123 KB, 707x1000, -r2I-Xjc1d8.jpg [View same] [iqdb] [saucenao] [google] [report]
65618389

>>65615641
guys i failed my IT course because i couldnt figure out how to programming so i became a trap but then i failed the same course again :(
did i not trap properly?

>> No.65618475

>>65617304
(You)s

>> No.65618478
File: 487 KB, 680x445, hmm.png [View same] [iqdb] [saucenao] [google] [report]
65618478

>>65618373
why does this have a time limit of 8 seconds

>> No.65618493

>>65618389
post ur programming socks. Did you wear engineering panties, what about ur tech plug ?

>> No.65618494

>>65618475
Good luck

>> No.65618508

>>65618478
maybe huge test cases, idk

>> No.65618520
File: 56 KB, 900x900, help.jpg [View same] [iqdb] [saucenao] [google] [report]
65618520

>>65615641
>tfw can't stop using for loops
Help me pls

>> No.65618533

>>65617738
thos are just normie scum falling for the cheap materialism.

>> No.65618556

>>65618520
>>65606266

>> No.65618565

>>65618478
The people who wrote that problem decided that the time limit would allow an efficient algorithm and a good implementation (i.e. what they themselves consider to be the solution) would take less than 8s to process the most difficult test case on whatever machine they're running it on.

>> No.65618598

>>65618565
>>65618508
yes, but that would imply like absolutely massive test cases
I guess I'm just not used to it since the ones we got at uni were usually 1 second max

>> No.65618611

What is a good tutorial site for getting into Python?

>> No.65618637

>>65618611
https://ds26gte.github.io/tyscheme/

>> No.65618869
File: 119 KB, 708x631, 1523173139460.jpg [View same] [iqdb] [saucenao] [google] [report]
65618869

>>65618255
That's C++, right? I don't understand any of it. Should I give up on C++?

>> No.65618899

>>65618869
How long have you been learning C++ for?

>> No.65618912

>>65618899
Tomorrow

>> No.65618913

>>65618869
Probably, if your goal is to understand any of it.
No one who uses C++ understands it. Not even the standards committee.

>> No.65618918

>>65618899
like 2 weeks.

>> No.65618930

>>65618255
>autism

>> No.65618931
File: 47 KB, 1257x537, Typical Clojure programmer.png [View same] [iqdb] [saucenao] [google] [report]
65618931

>>65615987
>Can someone explain to me how something like Haskell can be useful in the real world, outside of really niche stuff?
See pic.

>> No.65618936

>>65618918
That's normal.

>> No.65618949

>>65618931
>Uncle Bob

>> No.65618965

>>65618949
Nope.
https://clojureverse.org/t/why-do-you-prefer-clojure-over-haskell

>> No.65618972

>>65618255
unsigned int8_t

>> No.65618977

>>65618965
Well whoever wrote that is as stupid as he is.

>> No.65618981
File: 1.19 MB, 1777x1012, 764296.png [View same] [iqdb] [saucenao] [google] [report]
65618981

>>65618255
>secure trip code
LOL just take a look at this massive faggot

>> No.65618988

>>65615700
Because ruby's syntax is god tier and bullshit free

>> No.65618996

>>65618931
Blatant lies. Nothing is static in Clojure because Clojure is in Java and Java is not a compiled language. It's an interpreted language that has to be translated into a NON-ASSEMBLY intermediate language in order for its VERY bloated interpreter to understand it.

>> No.65619000

>>65618977
Also, you cut off the last part of their post:
>Now RUST is king for me in the static type languages. To statically prove proper memory management, while preventing the overhead of a runtime GC is a real concrete benefit. Proving the lack of deadlocks and race conditions in parallel code is another one. These kind of defect prevention is much more practical and beneficial from my perspective, then realizing 10 minutes earlier that you passed a string to a function expecting an int.
So they're not only stupid but they're also self-contradictory.

>> No.65619001

>>65618988
>ruby
>syntax
What? Since when did ruby have a syntax?

>> No.65619003

>>65618988
>Because ruby's syntax is god tier and bullshit free
top kek
friend i love ruby but:
end
end
end
end

>> No.65619014

Had a few days of bugfixing and it's forming pretty nicely now. Decided to make this open source after I have finished some cleaning.

https://www.youtube.com/watch?v=LGOQrZf-llw

>> No.65619020

>>65618996
The JVM continues to add bytecode support for dynamic languages. You're retarded.

>> No.65619024

>>65618996
>everything based on jvm is java with more makeup
Surprise surprise!

>> No.65619032

>>65619001
end
end.call {|x| x.call &:puts}
end
end
end
end
end << a[b[c + d[e[f {|g| h}]]]]
end
end
end
end.new

>> No.65619033

>>65619003
I'm sorry that you're autistic and hate organized things

>> No.65619065

>>65618520
map, filter, reduce.

>> No.65619085

>>65618611
Python is shit language.
It's used in computational science for a reason: scientists aren't programmers.
Use a language made for programmers, like Ruby.

>> No.65619099

>>65618996
>Java is not a compiled language
gcj('s ghost) and JET bag to differ.
>has to be translated into a NON-ASSEMBLY intermediate language
So what? Lots of compilers use intermediate representations.

>> No.65619128

>>65619033
First of all, if I were autistic and hated organized things, Ruby would be the perfect language for me, because you literally do not even have to organize your method parameters with respect to the methods:
puts 'Hello world!'
# no ()

Secondly:
end
end
end
end

is not any more organized than:
)
)
)
)

It's just uglier and more verbose.
>inb4 'b--b--but anon you can use curly brackets hurrrr'
oh yeah, sure, and what? and do this?
define_method(:what_the_fuck_is_this_garbage?) {|seriously_holy_shit|
loop {
puts "The worst part is you actually have to put the parentheses around the method name"
}
}

>> No.65619131

>>65619003
nesting like this is bad design and you shouldn't do that anyways
ie.
function foo(bar)
if bar > 1 then
-- do stuff
return result
end
return false
end

vs
function foo(bar)
if bar <= 1 then
return false
end
-- do stuff
return result
end

(it's Lua, but it doesn't matter)

>> No.65619132

>>65619085
Aren't they both vaguely similar though?
I'm a complete rookie to programming, so I'm not sure where to start.

>> No.65619151

I'm rocking a light color scheme for over a week now and I'm surprised how easy it is on the eyes. I used to have eye strain when I'm conjuring code late at night, but that's all gone. I can also focus better on the code.

>> No.65619161
File: 255 KB, 730x730, 1523760571516.gif [View same] [iqdb] [saucenao] [google] [report]
65619161

>>65615641
Chilling in /g/dpt on 4/20, contemplating writing documentation for my C++ project.

>> No.65619177

>>65619161
hint: it's #/g/dpt on rizon

>> No.65619186

>>65619003
>>65619032
If Ruby code is like this, the problem isn't Ruby, it's a shit programmer.
Idiomatic C code:
}
}
}
}
}

It's just shit code either way.

>> No.65619200

>>65619186
>Idiomatic C code:
> }
> }
> }
> }
>}
Thanks for proving my point, since this is clearly the superior way of doing deeply nested code. Which, as you point out, is bad practice regardless, but, unlike what you seem to think, that's irrelevant.

>> No.65619203

>>65619099
%s/bag/beg/

>> No.65619219

>>65619132
They're pretty similar, except Python's for brainlets.
See: >>65609869

>> No.65619233

>>65619200
being so autistic to think brackets vs. 'end' makes a difference.

>> No.65619238

Foo* foo[];
why is this an array of pointers and not a pointer to an array?

>> No.65619243

>>65619233
It does, objectively, irrefutably make a difference. That difference is so tangible you can actually measure it. Its measurement: 2 bytes per delimiter.

>> No.65619254

>>65619238
because the C ptr/array notation is brain-damaged

>> No.65619265

>>65619219
>>65619132
Oh, there's also this one from that thread too
>>65612954

>> No.65619274

>>65619238
it's a pointer to an array of pointers
Foo** foo;

is an equivalent declaration

>> No.65619279

>>65619238
>>65619254
Also, because of the way arrays work, a pointer to an array is the same thing as a pointer to the first element of the array, and therefore "pointer to array of T" and "pointer to T" are two names for the same type, so it doesn't make sense to have two different ways to declare them.

>> No.65619281

>>65619238
Because of operator precedence. [] has higher precedence than * and it binds to the identifier rather than the type id.

>> No.65619299
File: 56 KB, 645x729, brainlet.png [View same] [iqdb] [saucenao] [google] [report]
65619299

>>65619274
>Foo** foo; is an equivalent declaration

>> No.65619316

>>65619299
care to make any corrections?

>> No.65619329

static in c++ is really annoying. java does it so much better

>> No.65619341

>>65619274
It is an array of Foo pointers.

>> No.65619342

>>65619238
Foo* foo;
Is a pointer to an array

>> No.65619345

>>65619316
Arrays are not pointers.

>> No.65619361

>>65615641
Just playing around with Ruby some more...

#!/usr/bin/ruby
# coding: utf-8

class Point
include Comparable
attr_accessor :x, :y
def initialize(x,y); @x, @y = x, y; end
def +(other); Point.new(@x+other.x,@y+other.y); end
def *(scalar); Point.new(@x*scalar,@y*scalar); end
def ==(other); @x==other.x && @y==other.y; end
def [email protected]; Point.new([email protected],[email protected]); end
def to_s; "(#{@x},#{@y})"; end
def to_a; [@x,@y]; end
def quadrant
case [@x>0, @y>0]
when [true, true ] then 1
when [false, true ] then 2
when [false, false] then 3
when [true, false] then 4
end
end
end


The next one I had some trouble with, because I was getting error messages that were not at all intuitive. Then I realized the hash variable needed to be global (probably a common beginner mistake)...

#!/usr/bin/ruby
# coding: utf-8
# Hashing algorithm for strings

$hash = []
0.upto(10) { |i| $hash[i] = Array.new }

# Place input string in the table
def place(value)
address = value[0].ord % 10
$hash[address][$hash[address].length] = value
end

# Determine if input string is present
def search(value)
address = value[0].ord % 10
$hash[address].each do |key|
if key == value then return true
end
end
false
end


I'd appreciate comments or critiques on my Ruby programming style/ability, since it's still a relatively new language for me, and it's got a lot of quirks that I haven't quite grokked yet.

>> No.65619362

Zero-cost abstractions

>> No.65619368
File: 124 KB, 571x618, 1523619489879.jpg [View same] [iqdb] [saucenao] [google] [report]
65619368

>>65619345
>arrays are not pointers

>> No.65619378

Null-terminated byte arrays

>> No.65619396

>>65616152
Spiffy workspace, and neat waifu insert as well. I wish my room looked like that.

>> No.65619409

Fearless concurrency

>> No.65619412

>>65617304
Positive attitude and a passion for everything in life.

>> No.65619415
File: 10 KB, 320x235, qv8cu.jpg [View same] [iqdb] [saucenao] [google] [report]
65619415

>>65619361
Is this bait?

>> No.65619416

and why is std::memcpy in cstring?

>> No.65619424

>>65619415
What makes you think that?

>> No.65619432

>>65619345
Kek

>> No.65619439

>>65619368
It's true though. Arrays are not pointers. Arrays are accessed through pointers, but they are not themselves pointers.

>> No.65619440

>>65619416
because memcpy is in string.h

>> No.65619442

I fucking hate C's schizophrenic everything.

>> No.65619457

>>65619362
>>65619409
Yes please
>>65619378
No thanks

>> No.65619460

>>65619442
C is secretly a practical shitlang.

>> No.65619465

>>65619362
>Zero-cost abstractions


>>65619378
>Null-terminated byte arrays


>>65619409
>Fearless concurrency

Wtf are you doing?

>> No.65619473

>>65619440
yes why?

>> No.65619491

>>65619465
k

ys

ys

>> No.65619493

Foo foo[] = malloc(sizeof(Foo) * 5);
init_array(&foo);

wtf am i doing wrong i thought arrays weren't pointers??

>> No.65619514
File: 56 KB, 621x702, brainlet.png [View same] [iqdb] [saucenao] [google] [report]
65619514

>>65619493
>doesn't compile

>> No.65619532

>>65619460
I'm glad that, if I really want, I'm not forced to even acknowledge C's existence beyond struct layout and calling conventions.

>> No.65619543

Is the Sedgewick's Algorithms in C worth reading? Should I bite the bullet and read the Java version(It looks nicer, and it has an online course, as well)? I just want to learn about without getting too mathy about it( I haven't taken discrete math yet).

>> No.65619708

>>65619543
the war stories were kinda interesting

>> No.65619765
File: 499 KB, 320x220, D049B142-84B2-4B2A-B9CC-A42DF1F01E03.gif [View same] [iqdb] [saucenao] [google] [report]
65619765

>>65615641
What do people use to make GUIs these days

>> No.65619778

>>65619708
I think you are confusing Sedgewick's Algorithms, with Skienna's "The Algorithm Design Manual".

>> No.65619830

>>65618988
Funny how a hipster language (Crystal) does Ruby better than Ruby.

>> No.65619835

>>65619493
They decay to pointers

>> No.65619859

>>65619765
React.

>> No.65619928
File: 124 KB, 400x400, rainy_mood.jpg [View same] [iqdb] [saucenao] [google] [report]
65619928

>tfw you can't find a book's pdf

>> No.65619988

>>65619778
>S-guy's algorithms book
Could be, they're blurring together nowadays.

>> No.65619991

>>65618255
M = unsigned int8_t

So they are purposely trying to make this as ugly as possible.
>auto months_of_30{std::set<M>{4,6,9,11};

They are literally just trying to make it as ugly as possible.

constexpr std::optional<unsigned> days(intmax_t year, unsigned month){
constexpr unsigned days_in_month[13] = {0, 31, 28, 31, 30, 31, 30, 31,31,30,31,30,31};
if(!year || !month || month>12) return std::nullopt;
if(month == 2 && (year%4 ==0) && ( year%100!=0 || year%400==0))
return 29;
return days_in_month[month];
}

>> No.65620001

>>65619928
not on libgen either, huh?

>> No.65620025

>>65620001
Nope, I am falling into the pits of despair.

>> No.65620026

>>65615641
Showcase algo:
f(x) = (x + x-1)\\2;

func sum(n):
ret n*(n+1)/2;
end

func print(items...):
items + "" --> 0x21, 0x9;
end

int a, b = 5, 10;
b += f(a);
a + ":" + b --> 0x21, 0x9;
<- a
<- b
-> a
-> b
a + ":" + b --> 0x21, 0x9;
sum(3) + off 48 --> 0x21, 0x9;
print(a, b, " "+(sum(3) off 48));


Output:
5:15
15:5
6
15:5 6

Have i made an abomination?

>> No.65620031

>>65620025
post book title, edition, isbn whatever

>> No.65620040

>>65620026
>-->
>inspired by C's "slide to" operator
you're alright in my book, anon

>> No.65620047

Does anyone know where to start studying bootloader's, linking, ELF files and shit like that?
I'm doing some stuff with the RISC-V architecture and I'm completely lost

>> No.65620050

>>65620031
Data Structures In C 1st Edition, by Noel Kalicharan.
ISBN-13: 978-1438253275
ISBN-10: 1438253273

>> No.65620051

>>65619991
much more readable

>> No.65620065

I'm a bit lost on what I should be doing now. It's a program for CS50 that wants you to display a hashtag for a brick depending on the user input, with the input being the bottom row of the pyramid increment one less block as you go up. I'm trying to add spaces to the rows as there are less hashtags, but it's not coming out. Does anyone mind taking a look?

#include <stdio.h>
#include <cs50.h>

int main(void)
{
//Prompt user for valid number
int height;
string block = "#";
string space = " ";
do
{
height = get_int("Positive Number for Blocks less than 23: ");
}
//While n is less than 0, a negative, or greater than 23, which is the maximum allocated
while (height < 1 || height > 23);
//Print out this many rows
//initialize at 0, runs while rows is less than height, adds one to rows everytime
for (int rows = 0; rows < height; rows++)
{
{
//Objective after printing rows is to add spaces to those rows
for (int columns = 0; columns < rows - height; columns --)
{
printf("%s", space);
}
}
printf ("%s\n", block);
}
}

>> No.65620067

>>65620047
Just point me a good book and I will start right away
I'm studying by myself, so I can't rely on professors or college

>> No.65620087

>>65620050
>Noel Kalicharan
oof, that's pretty
>literally who
tier. Threedat & Tobacco, it seems.
Gonna be a difficult one m8. If it's uni stuff, look for someone with a copy and scan / upload dat shit.

>> No.65620092

>>65618996
The JVM compiles Java bytecode to actual bytecode and optimizes it dynamically.
JVM is comparable to native code performance wise.

>> No.65620094
File: 76 KB, 1533x872, 1505601364751.png [View same] [iqdb] [saucenao] [google] [report]
65620094

Don't code while drunk, kids, or else you'll do something like pic related

>> No.65620095

>>65620040
b-but its not a slide to operator...
Never even knew C had that, originally it was to be used to declare loop ranges:
10 --> 0 OR 0 --> 10 which would load the starting value into ecx, and then changing the jnz, jge, jle, jg, jl commands according to the break operator, or if no break operator were defined, according to the direction of the arrows.

>> No.65620100

>>65620067
would the classic Linkers and Loaders help?

>> No.65620109

>>65620065
>display a hashtag for a brick depending on the user input, with the input being the bottom row of the pyramid increment one less block as you go up
what?

>> No.65620116

>>65620087
Yeah, seems like this dude is not really well known. Not uni stuff, just self-studying. Thanks anyways, anon. I appreciate the effort.

>> No.65620117

>>65619345
Explain this:
Foo foo[69];
Foo *bar = foo;

>> No.65620121

>>65620095
>ecx, and then changing the jnz, jge, jle, jg, jl
so is like reinventing the 60s proglang wheel type of project, a brainfuck-COBOL combo or something?

>> No.65620130

>>65620109
Pretty clearly anon is trying to do:
#
###
#####
#######

>> No.65620137

>>65620117
Implicit conversions. int x; char c = x; does not mean char and int are the same type.

>> No.65620138

>>65620100
Yes
This seem exactly what I need
Thank you kind anon, I'll be reading this book

>> No.65620145

>>65620109
Sorry, it's just trying to display a pyramid from Mario using input, might have muddied my explanation.
https://docs.cs50.net/2018/x/psets/1/mario/less/mario.html
I'm lost on two things: how to increment the spaces, and how to nest my for loops in each other.

>> No.65620149

>>65619765
electron

>> No.65620154

>>65620121
>reinventing the 60s proglang
the what?

>brainfuck-COBOL combo or something?
More like a direct-systems lang, definitely not cobol that's for certain.

>> No.65620155

>>65620065
You're only drawing one block per row.

>> No.65620161

>>65617887
NIGHT OF FIRE

>> No.65620169

>>65620047
osdev.org

>> No.65620176

I don't get it.
Does Opengl let me create windows and butons or is it just for graphics and games?

>> No.65620177
File: 334 KB, 995x681, el atrocidad.png [View same] [iqdb] [saucenao] [google] [report]
65620177

>>65620145
el goblino...

>> No.65620186

>>65620176
OpenGL just puts contents in windows, you have to create the window (and OpenGL context) with something else. You can draw regular GUIs with OpenGL if you like. There are libraries that make this easier.

>> No.65620200

>>65620186
Is it "better" than a GUI toolkit like gtk or Qt?

>> No.65620234

>>65620200
It depends on the look and feel you are going for, and how much you care about what the API is like (e.g. any IMGUI library is very different from either GTK or Qt). You can create OpenGL contexts in either GTK or Qt if you want to mix their GUIs with your own arbitrary rendering.

>> No.65620258

>>65620130
>hashtag
>>65620145
>Since 2007, the usage of the symbol to introduce metadata tags on social media platforms has become so universal that such metadata tags are now widely called hashtags[5] and the symbol itself is often called a "hashtag".
oh you fucking wastes of oxygen

>> No.65620276

>>65620258
Just because I know what normies mean by "hashtag" doesn't mean I use the expression myself.

>> No.65620281

>>65620234
So these toolkits don't use OpenGL but rather use the platform API or do the draw their own? I know windows has win32 for creating a gui and many other things to interact with the OS but what does linux use? OpenGL?

>> No.65620282

>>65619316
arrays have extra metadata

>> No.65620285

>>65620177
whoa momma
it looks like the rape child of some negress that got PREDATORED

>> No.65620289

>>65620200
Completely different things.
OpenGL can have the same end result, but it's goal is to be way lower level.
Even game programmers aren't going to use OpenGL, although a game programming company might have a team that develops the 3D engine using OpenGL that the game programmers themselves use (and there may be crossover).
Gtk and Qt are purpose-built for creating GUIs. They're much higher-level than OpenGL.

I don't know what Gtk and Qt use at the lower level, but there's no reason a GUI Toolkit can't utilize OpenGL to draw to the screen.

>> No.65620294

arrays are strings

>> No.65620302

>>65620065
>C
there's your problem

#include<iostream>

int main(){
int height=0;
while(height>23 || height < 1){
std::cout << "Positive Number for Blocks less than 23: ";
std::cin >>height;
}
for(int row = 1; row <= height; ++row){
for(int space = row; space < height; ++space)
std::cout<<" ";
for(int hash = 0; hash < row; ++hash)
std::cout<<"#";
std::cout<<"\n";
}
std::cout.flush();
}


If you want it to be symmetric like >>65620130

#include<iostream>

int main(){
int height=0;
while(height>23 || height < 1){
std::cout << "Positive Number for Blocks less than 23: ";
std::cin >>height;
}
for(int row = 1; row <= height; ++row){
for(int space = row; space < height; ++space)
std::cout<<" ";
for(int hash = 0; hash < row; ++hash)
std::cout<<"#";
for(int hash = 1; hash < row; ++hash)
std::cout<<"#";
std::cout<<"\n";
}
std::cout.flush();
}

>> No.65620305

>>65620281
On Linux, it depends on your display manager. Usually, X11. Sometimes Wayland nowadays.

>> No.65620315

r8 me /g/:
/* Convert roman numerals to base-10 */
#include <iostream>
#include <string>
#include <stack>

#define INVALID_CHAR -1
typedef std::string str_t;

int full_to_base_10(str_t&);
int to_base_10(char&);

int
main(void)
{
for(;;) {
std::cout << "Enter a roman numeral string: ";
std::string roman;
std::cin >> roman;

std::cout << roman << " to decimal: " << full_to_base_10(roman) << '\n';
}
return 0;
}

int full_to_base_10(str_t &roman)
{
std::stack<int> numbers;
int biggest_seen=0;

for (int i=roman.length()-1; i>=0; i--)
{
int current_num = to_base_10(roman[i]);

if (current_num == INVALID_CHAR) {
std::cout << "Invalid character, aborting!\n";
exit(EXIT_FAILURE);
}
if (current_num > biggest_seen) {
biggest_seen = current_num;
numbers.push(biggest_seen);
}
else if (current_num < biggest_seen)
numbers.push(-current_num);
else
numbers.push(current_num);
}

unsigned num=0;
while (!numbers.empty())
{
if (numbers.top() < 0)
num -= (-numbers.top());
else
num += numbers.top();
numbers.pop();
}
return num;

}

int to_base_10(char &c)
{
switch(c)
{
/* Basic roman numerals */
case 'I': return 1;
case 'X': return 10;
case 'C': return 100;
case 'M': return 1000;
/* Auxiliary roman numerals */
case 'V': return 5;
case 'L': return 50;
case 'D': return 500;

}
return INVALID_CHAR;
}

>> No.65620329

>>65620145
a suggestion of how to write your question next time so more people answer it:

hey folks, I need to write a program that does this:
$ ./mario
Height: 5
##
###
####
#####
######

$ ./mario
Height: 3
##
###
####

Here's my code:
yer code here

but it's wrong:
$ ./mario
Height: 3
<yer fucked output here>

I think it's either X, Y, or Z or I don't understand how to do A, B, or C.
Can anyone give me a hint of where I'm being retarded?

>> No.65620344

>>65620305
Is there a "linux api"/.so file I can use to invoke things like getting current OS and hardware info or is it just certain systemcalls?

>> No.65620354

>>65620302
>for(int hash = 0; hash < row; ++hash)
> std::cout<<"#";
>for(int hash = 1; hash < row; ++hash)
> std::cout<<"#";

Or you could not be retarded and do:

for(int hash = 1; hash < row; ++hash)
std::cout<<"##";
std::cout<<"#";

>> No.65620357
File: 23 KB, 645x773, 1523386635027.png [View same] [iqdb] [saucenao] [google] [report]
65620357

>>65620282
>arrays have...metadata

>> No.65620371

>>65620344
Usually graphical Linux software is distributed with different versions for different environments. I.e. your source code has some #ifdefs somewhere where one branch supports X11, another branch supports Wayland, etc.

>> No.65620379

>>65620371
>>65620289
Thanks!

>> No.65620385
File: 1.92 MB, 400x224, 1521047236517.gif [View same] [iqdb] [saucenao] [google] [report]
65620385

>>65620094
>Not even 1 (you)
What happened to /dpt/? You don't even get triggered by Rust anymore.

>> No.65620389

>>65620357
yeah when you do sizeof on an array it gives you the size of the array but when you do sizeof on a pointer it gives you the size of the pointer

>> No.65620410

>>65620371
>Programming for anything to use a GUI
You're part of the problem anon.

>> No.65620443

>>65620371
No, it's not.
Most graphical software use a toolkit such as gtk, Qt or SDL.
The X11/Wayland support is at the toolkit level and can usually be enabled or disabled with an environment variable or some other runtime configuration.

>> No.65620448
File: 188 KB, 347x414, 1496559360261.png [View same] [iqdb] [saucenao] [google] [report]
65620448

I'm a programming newbie and I'd like some help, if possible.

I need to read an input file an write N bytes of it to different output files, until we reach EOF. For example, if I have "abcdefghijklmnop" in the input file and each output file can store 4 byes, I'll have 4 files with the following:
f1 = "abcd"
f2 = "efgh"
f3 = "ijkl"
f4 = "mnop"

How can I achieve this? I'm using Python 3.

>> No.65620449

>>65620410
>>65620443
I understand that, I was answering:
>So these toolkits don't use OpenGL but rather use the platform API or do the draw their own?
And then how they distinguish between display managers.

>> No.65620472

>>65620389
sizeof is evaluated at compile time idiot

>> No.65620477

>>65620448
pseudocode:
with open("in", 'r') as fin:
nr = 1
while not done:
with open("out" + nr, 'w') as fout:
fout.write(fin.read)
nr++

>> No.65620488

>>65620329
Thanks, I'll try to be better about format in the future.
>>65620302
Working with C as the course itself wants us to use C until it switches to Python midway through. Thank you for the help with the logic though, I believe I see now what I was fucking up with.

>> No.65620494

>>65620477
>read
should've been read_up_to_4_bytes

>> No.65620498

>>65620472
doesn't matter

>> No.65620512

>>65617304
I just like 3D shit and shiny things. Flame... dear flame....

>> No.65620514

>>65620448
Something like this, maybe:
input = None
with open("infile.txt" , 'rb') as f:
input = f.read()

i = 0
in_slice = input[:4]

while len(in_slice) > 0:
with open("outfile_{}.txt".format(i), 'wb') as f:
f.write(in_slice)

i += 1
in_slice = input[i*4:i*4 + 4]

>> No.65620518

>>65620472
int foo(int x)
{
return sizeof(int[x]);
}

>> No.65620545

I like the Kotlin version on rosetta code
fun romanDecode(roman: String): Int {
if (roman.isEmpty()) return 0
var n = 0
var last = 'O'
for (c in roman) {
when (c) {
'I' -> n += 1
'V' -> if (last == 'I') n += 3 else n += 5
'X' -> if (last == 'I') n += 8 else n += 10
'L' -> if (last == 'X') n += 30 else n += 50
'C' -> if (last == 'X') n += 80 else n += 100
'D' -> if (last == 'C') n += 300 else n += 500
'M' -> if (last == 'C') n += 800 else n += 1000
}
last = c
}
return n
}

>> No.65620553

>>65620498
If compile-time information about pointers/arrays counts as metadata, then pointers have metadata too (base type, qualifiers). In fact arrays have all the same "metadata" as pointers, plus a constant length.

So yes, I guess if you consider all known information about a thing to be data or metadata, then pointers and arrays differ in "metadata". But metadata actually means that something is stored.

>> No.65620558

>>65620514
Yep, it was exactly like this. I just need to know what the "input" keyword means, but I'll just look it up.

>> No.65620563

>>65620558
input is not a keyword, just a variable

>> No.65620564
File: 67 KB, 189x262, 1523334199673.png [View same] [iqdb] [saucenao] [google] [report]
65620564

>>65619368
How do I put this... I think you're the brain damaged one.

>> No.65620566

>>65620553
ok

>> No.65620567

>ask some question like "How do you do X"
>get response like "Why would you ever want to do X?"

does this piss you off aswell?

>> No.65620587

>>65620567
Why would you be pissed off by that ?

>> No.65620594

>>65620385
I know, right. I've been trying to shill Ruby, needing people to get triggered by its mention because bad publicity is still publicity, but no bites.

>> No.65620616

>>65620587
(kek)
yeah, I mean the people that are usually pissed off are doing things the wrong way anyway

>> No.65620623

I need help with my final two programming assignments in college. One is in web services, things like php and servers. Other is Android development using content providers. I'll pay someone 100$ to do them for me, and it would only take a few hours for someone who actually knows what they are doing.

>> No.65620645

>>65620567
The only way I will ever respond like that is as a disclaimer attached to an actual answer. People who say that without answering as well are just virtue signalling, but you shouldn't ignore them entirely in all cases.

>> No.65620654

>>65620315
>#define INVALID_CHAR -1
Why the fuck aren't you using constexpr?
>typedef std::string str_t;
Why not "using std::string;"?
>int to_base_10(char&);
Just copy the char
>std::stack<int> numbers;
Why?

constexpr int INVALID_CHAR = -1;

constexpr int to_base_10(const char c)
{
switch(c)
{
/* Basic roman numerals */
case 'I': return 1;
case 'X': return 10;
case 'C': return 100;
case 'M': return 1000;
/* Auxiliary roman numerals */
case 'V': return 5;
case 'L': return 50;
case 'D': return 500;
default: return INVALID_CHAR;
}
}

constexpr int full_to_base_10(const char* roman)
{
int last_seen = to_base_10(roman[0]);
if (last_seen == INVALID_CHAR) {
std::cout << "Invalid character, aborting!\n";
exit(EXIT_FAILURE);
}
int number = last_seen;

for (int i=1; roman[i]!='\0'; ++i)
{
int current_num = to_base_10(roman[i]);

if (current_num == INVALID_CHAR) {
std::cout << "Invalid character, aborting!\n";
exit(EXIT_FAILURE);
}
number += current_num;
if (current_num > last_seen) {
number -= last_seen<<1;
}
last_seen = current_num;
}
return number;
}

>> No.65620659

>>65620623
>I'll pay someone
>1.5 hours' worth of money
you're gonna get quality

>> No.65620668

>>65620498

int array_len(int arr[]) {
return sizeof(arr) / sizeof(int);
}

int main(int argc, char* argv[]) {
int array[50];
printf("%d", array_len(array));
}

>1
oy vey they stole my metadata

>> No.65620687

>>65620545
Tried to translate it to Rust. It is almost exactly the same, except pattern matching (?) in Kotlin seems to be non-exhaustive
fn roman_decode(roman: &str) -> u64 {
if roman.is_empty() { return 0; }
let mut n = 0;
let mut last = 'O';

for c in roman.chars() {
match c {
'I' => n += 1,
'V' => if last == 'I' { n += 3 } else { n += 5 },
'X' => if last == 'I' { n += 8 } else { n += 10 },
'L' => if last == 'X' { n += 30 } else { n += 50 },
'C' => if last == 'X' { n += 80 } else { n += 100 },
'D' => if last == 'C' { n += 300 } else { n += 500 },
'M' => if last == 'C' { n += 800 } else { n += 1000 },
_ => panic!("Invalid numeral: {}", c),
};
last = c;
}
n
}

>> No.65620690

>>65620659
It would seriously take not even 2 and a half hours for someone who knows mobile or web development. I'm just stupid.
Also. Where the fuck do you get that much money? All the programmer jobs here are not even close to that much

>> No.65620717

what is objectively the most hipster language

>> No.65620728

>>65620690
>lmgtfy hourly wage developer
>Software Engineer $31.37
that's salaried
You'd have to be retarded to work for less than 2x (realistically more) without a permanent contract.

>> No.65620750

>>65620545
>>65620687
For fun, slightly more idiomatic + Error handling:
#[derive(Debug)]
struct InvalidNumeral;

fn roman_decode(roman: &str) -> Result<u64, InvalidNumeral> {
if roman.is_empty() { return Ok(0); }
let mut n = 0;
let mut last = 'O';

for c in roman.chars() {
n += match c {
'I' => 1,
'V' => if last == 'I' { 3 } else { 5 },
'X' => if last == 'I' { 8 } else { 10 },
'L' => if last == 'X' { 30 } else { 50 },
'C' => if last == 'X' { 80 } else { 100 },
'D' => if last == 'C' { 300 } else { 500 },
'M' => if last == 'C' { 800 } else { 1000 },
_ => return Err(InvalidNumeral),
};
last = c;
}
Ok(n)
}

>> No.65620752

>>65620690
>It would seriously take not even 2 and a half hours for someone who knows mobile or web development
Given that
>I'm just stupid.
I recommend skimming this:
https://en.wikipedia.org/wiki/Small_matter_of_programming

>> No.65620762

>>65620750
>if roman.is_empty()
redundant, no?

>> No.65620770

>>65620654
gid gad the verbosity

>> No.65620776

>>65620668
because it's a pointer now lol

>> No.65620777

>>65620750
>{ 3 }
Don't tell me Rust is autistic enough to disallow curly-free if/else blocks?

>> No.65620786

>>65620777
>curly-free if/else blocks
abomination

>> No.65620787

>>65620777
No. This is the price you pay for not requiring parens around the if expression.

>> No.65620789

>>65620065
>hashtag
kill yourself

>> No.65620793

When should I prefer to use references vs pointers?

>> No.65620802

>>65620762
You're right, i just blindly copied the Kotlin code.
>>65620777
No. If-else in Rust demand curly braces, but can omit the parentheses

>> No.65620810

>>65620787
oh lawdy who knew rust's patmat is that shit
non-shitlangs don't need such garbage

>> No.65620824

>>65620802
>If-else in Rust demand curly braces, but can omit the parentheses
A curious choice, but it might be for the better.

>> No.65620831

>>65620810
That's not even part of pattern matching. If/else in Rust are expressions, not statements.

>> No.65620841

>>65620824
No more goto fail bugs, for instance.

>> No.65620916

>>65620654
because im not a retard

>> No.65620924

new thread when? :3

>> No.65620934

>>65620924
when we're at page 10, or at least 8+, preferably

>> No.65620945

What exactly does Rust give you that smart pointers + move semantics in C++ don't already give you?

>> No.65620951

>>65620945
Sane smart pointers & move semantics. Also checked references.

>> No.65620957

In Java if you have a method1 that throws an exception and you put the throws tag in the signature and then you use this method1 in another method2, do you also need to specify in that signature that you might throw an exception or is it enough if you do it in method1?

>> No.65620958

>>65620945
Proper ADTs and pattern matching for once, not the std::variant/visit abomination. Also traits, not duck-typed templates

>> No.65620961

>>65620945
Compiletime checks that you're properly following lifetime semantics. Thread safety because fucking everything is immutable.

>> No.65620965

>>65620957
Every method until you catch it.

>> No.65620970

>>65620958
>for once

>> No.65620977

>>65620961
>fucking everything is immutable.
when the memes go too far

>> No.65620986

>>65620970
English is not my first language, what do ye even mean?

>> No.65620996
File: 14 KB, 627x554, 1511282567970.png [View same] [iqdb] [saucenao] [google] [report]
65620996

>have a bunch of classes in a header file
>forward declaration for all of them
>in the first class where I use another class compiler complains that this type is undefined
what?

>> No.65621005

>>65620961
>Thread safety because fucking everything is immutable.
Are you thinking of Haskell, anon?

>> No.65621015

>>65620996
Declaration =/= definition
Forward declared types can only be used behind pointers, since the compiler doesn't know their layout in memory until they are defined.

>> No.65621020

>>65621005
Rust does not allow multiple mutable references. Not unless they're mutexed. That goes even for thread-local references.

>> No.65621030

>>65621015
sooo no references? or is there a solution?

>> No.65621034

>>65621020
>Rust does not allow multiple mutable references. Not unless they're mutexed. That goes even for thread-local references.

Wtf
that is retarded

>> No.65621036

>>65621020
That doesn't make everything immutable. Now, I will agree that Rust often forces you to use (or at least makes it painful to work around) shared immutable references (don't forget about "interior mutability" though) but that's another issue.

>>65621030
You should be able to use them behind references.

>> No.65621038

>>65621030
Replace the references with pointers and you're sorted.

>> No.65621051

>>65621034
It does so to prevent certain kinds of undefined behaviour. Don't like it, go unsafe.

>> No.65621054
File: 2 KB, 109x159, file.png [View same] [iqdb] [saucenao] [google] [report]
65621054

>>65621038
well fugg :DDD

>> No.65621059

>>65620986
>what do ye even mean
>ye
>English is not my first language
au contraire, you can't fool me, Shakespear
shitpost aside, it ought to be 'for one'

>> No.65621092

>>65618255
really hope this is bait.

>using heap-allocated sets (constructed/destroyed on each call) instead of constexpr arrays for a *fixed-size set of literal constants*
>using find/iterators instead of unrolling/folding arrays over a variadic lambda which folds comparison over || operator
>using a default template argument for a deduced argument (gonna be ignored generally)
>inverting leap year logic (straightforward way ends up the same number of ops for me)
>using forwarding references for primitives/integers (unnecessary)
>using forwarding references and then never forwarding them
>unsigned int8_t (there's a uint8_t)

i'd do something more like

constexpr std::optional<int> days(int year, int month)
{
constexpr std::array<int, 4> months_of_30 { 4, 6, 9, 11 };
constexpr std::array<int, 7> months_of_31 { 1, 3, 5, 7, 8, 10, 12 };

constexpr auto contains = [](const auto& arr, int val) {
auto fun = [val](auto... i) { return (... || (i == val)); };
return std::apply(fun, arr);
};

return
contains(months_of_31, month) ? 31
: contains(months_of_30, month) ? 30
: month == 2
? year % 4 == 0 && !(year % 100 == 0 && year % 400 != 0) ? 29 : 28
: std::optional<int>{};
}


this is much more efficient (and constexpr). templating arguments will only give or take a few instructions depending on argument types. tested by returning from main instead of printing out and used optional::value_or() to keep iostream and optional's shit out of the assembly:

your code:

extern int y;
extern int m;
int main() { return days(y, m).value_or(0); }
// asm: ~400 lines

int main() { return days(2100, 2).value_or(0); }
// asm: ~350 lines


my code:

extern int y;
extern int m;
int main() { return days(y, m).value_or(0); }
// asm: ~70 lines

int main() { return days(2100, 2).value_or(0); }
// asm: 3 lines (returns 28)

>> No.65621140

>>65620668
wtf does this code work?
can you declare an array as an argument?
what does sizeof(arr) return?

>> No.65621172

>>65621140
The declaration might refer to an array, but it's silently reinterpreted as a pointer declaration instead.

That's a very good reason never to use "arrays" as parameters.

>> No.65621173

>>65619345
>"Arrays are not pointers."
>This is what happens when we let retards code

>> No.65621175

>>65621140
>can you declare an array as an argument?

Kinda, but don't ever do it. int[] arg becomes int *arg. It is extremely misleading and hides what actually goes on.

>> No.65621188

>>65621092
What's wrong with >>65619991

>> No.65621196

what language should i learn if i want to help cracking games/consoles?

i kinda want to contribute the scene

>> No.65621212

>>65621196
Assembly
probably a bit hard to get into nowadays

>> No.65621214

>>65621196
digital circuit logic, verilog, fpga, C.

>> No.65621215

Whats the difference between an array and a pointer other than how sizeof behaves?

>> No.65621241

>>65621215
& is the only operator beside sizeof which behaves differently for arrays and pointers.
As an operand to other operator, an array lvalue decays to a pointer rvalue.

>> No.65621264

The difference between pointers and arrays in C becomes quite clear when you don't conflate variable declarations with parameter declarations.

>> No.65621277

>>65621196
C,ASM / and Sepples if you want to contribute to Dolphin or the like.

>> No.65621291

>>65621196
AMD64, PPC for last gen

>> No.65621296
File: 9 KB, 250x190, 1515539183139s.jpg [View same] [iqdb] [saucenao] [google] [report]
65621296

>>65621264
>The difference between pointers and arrays in C

>> No.65621302

>>65621296
int *p;
int a[N];

>> No.65621309

>>65621302
Now pass arrays to functions, safely.

>> No.65621316

>>65621309
Can't. C lacks first class arrays.

>> No.65621321

>>65621316
and that's my point.

>> No.65621322

>>65621309
>when you don't conflate variable declarations with parameter declarations

>> No.65621330

>>65621321
>arrays are not first class values
>therefore arrays and pointers are the same
???

>> No.65621333
File: 63 KB, 638x558, 1521912231368.jpg [View same] [iqdb] [saucenao] [google] [report]
65621333

>>65621321
>if C doesn't have first class arrays it must mean pointers and arrays are the same thing in C

>> No.65621335

>>65621322
>oh boy i can declare """""""""""""arrays""""""""""""
>but i can't use them safely in any real capacity because they are just bare-bones sugar.

>> No.65621344
File: 13 KB, 290x180, Moving-The-Goalposts[1].jpg [View same] [iqdb] [saucenao] [google] [report]
65621344

>>65621335

>> No.65621392

>>65621344
Your original statement doesn't really mean anything though. You're simply saying a very loaded remark that has lots of implications and problems. You're like the person at cons who interrupt the speaker to state an AKSHULLY

>> No.65621393

>get CS degree at end of semester
>still haven't learned how to shoot up a school
WTF

>> No.65621408

>>65621392
>Your original statement doesn't really mean anything though.
int a[N]; // declare an array variable of length N
void foo(int a[]) // declare a pointer parameter

>> No.65621414

>>65621393
Absolute state of yuropoor education

>> No.65621456

>>65621449
>>65621449
>>65621449

>> No.65621479

>>65621333
an array is a pointer to an allocated segment of memory plus a calculated offset (that being, the index).

You'd have to be retarded to think an array is anything but a pointer and an offset.

>> No.65621496

>>65621188
oh haha. that works. there were so many general semantic/idiomatic/practical mistakes i got focused on those in the abstract and forgot to think about the actual problem lol. but for what it's worth, the ideas there extend well to nontrivial use cases, and it's definitely possible to write idiomatic/expressive/high-level code that performs well

>> No.65621507

>>65621479
>an array is a pointer to an allocated segment of memory plus a calculated offset (that being, the index).
No. That's your pov, it;s written nowhere in the C spec.

>> No.65621575

>>65621507
>No. That's your pov, it;s written nowhere in the C spec.
You are a code monkey, because you know nothing about the underlying system or how memory is stored/retrieved. You've gotten lost in abstraction, you fucking code monkey.

>> No.65621616

>>65621575
>you know nothing about the underlying system or how memory is stored/retrieved
You're changing subject. Where in C spec is it written about the underlying system or memory model? Please, could you pinpoint it in the spec?
>You've gotten lost in abstraction
So you can't into abstraction? And you think you're not a code monkey, don't you? How funny.

>> No.65621640

>>65621616
>Where in C spec is it written about the underlying system or memory model?
wtf do you think happens when C compiles, you absolute retard?

>So you can't into abstraction?
I can into abstraction easily, but i'm not some retard who forgets the underlying system or what's actually happening behind the emerald curtains.

>> No.65621687

>>65621640
>wtf do you think happens when C compiles, you absolute retard?
Absolutely unrelated to the C language. You can interpret C if you want.
>I can into abstraction easily
Clearly no. You failed twice in a row.

>> No.65621738
File: 57 KB, 600x600, You right now.jpg [View same] [iqdb] [saucenao] [google] [report]
65621738

>>65621687
>Absolutely unrelated to the C language.
I'm gonna do what your mom did and give up on you, anon. You're too much of a brainlet

>You failed twice in a row.
if by into abstraction you mean treat shit as something its not (like treating a char as a character, rather than a byte) then i wan't nothing to do with that, dumbass.

>> No.65622122

>>65621092
>sets (constructed/destroyed on each call) instead of constexpr arrays
item lookup in sets are O(log n) whereas with arrays it's O(n)
> auto fun = [val](auto... i) { return (... || (i == val))
Again, O(n)

>> No.65622255

>>65621738
>if by into abstraction you mean treat shit as something its not (like treating a char as a character, rather than a byte) then i wan't nothing to do with that, dumbass.
No. It means treating C as a language with a semantics and not the concrete implementation of your concrete compiler on your concrete hardware.

You really can't into abstraction.

>> No.65622639

>>65617573
pawoo.net, based on mastodon, which is based of gnu social (or at least uses the same backend). They don't seem to compress images.

I really want twitter to die and get replaced by mastadon.

>> No.65622896

>>65622122
O(1) if you do it like >>65621092

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
reCAPTCHA
Action