[ 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: 507 KB, 738x492, codecode.jpg [View same] [iqdb] [saucenao] [google] [report]
56598460 No.56598460 [Reply] [Original] [archived.moe] [rbt]

Generic Code Picture Edition

Previous Thread: >>56590613

What are you working on, /g/?

>> No.56598545

First for VHDL

>> No.56598597
File: 58 KB, 514x524, akari2.jpg [View same] [iqdb] [saucenao] [google] [report]

Second for akari-bbs!

Working on {code} tags right now.
Also planning spoiler tags.
What other kind of tags are worth implementing?

>> No.56598620

This is my code for making an object move around the edges of a square level. It works, but it's pretty fuggin' hideous. Is there any way to fix it up a bit?


>> No.56598632

That's fucking awful code

>> No.56598683

>Second for akari-bbs!
>Second for akari-bbs[!!]

fucking newfags

>> No.56598686

Hey /dpt/,
I made a small game in Python and I wanted to give it to a friend to play it. It's just for fun and filled with inside jokes.
I don't want him to see the source code though, I know it's nothing special and it only took me a couple hours to create it but I don't want him to judge my style.

So, is there any way to compile Python files into an executable or something, making it impossible for him to read the source code?

>> No.56598710

write it in a language he won't understand like Lisp or Haskell or English

>> No.56598731

I don't know those though and I don't feel like writing it again from scratch. As I said, it's not really something big or important, it's just a project for fun that I started yesterday.

>> No.56598733
File: 207 KB, 605x763, gorilla.jpg [View same] [iqdb] [saucenao] [google] [report]



Representing Chisel

>> No.56598739

how many LOC does the parser have?

>> No.56598747

Honestly code tags are all we need since embedding a spoiler tag in a code tag may complicate things

>> No.56598769

for i in sys.argv:

TypeError: list indices must be integers or slices, not str

What am I doing wrong?

>> No.56598793


Your i is a sys.argv[?], not an integer.
You can simply print i, or do for i in len(sys.argv)

>> No.56598811

Thank you senpai.

>> No.56598816

[tex] and

>> No.56598829


no worries f4m, pythons lack of static typing makes some obvious errors a little hard to track down when you don't know what to look for.

>> No.56598850

Has anyone tried running a compiler from the Sublime console? It would be pretty ace to compile from Sublime on Wangblows.

Jewgle turned up
"cmd" : ["gcc $file_name -o ${file_base_name} && ./${file_base_name}"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"

But I haven't tried it yet.

>> No.56598883

Is it a meme that you guys learn several coding languages or can you actually program in many languages? I'm reading a book on Java atm and learning it all is quite daunting. I can understand how once you have basic concepts down (like loops and matrixs) you'd learn another language easier, but there is still a lot of stuff to learn.

>> No.56598898

input parse and sanitation is about 352 loc
presentation-side parse is about 150 loc

I could just exclude code tag regions from [tag] replacement parsing until the end, making {code} its own special case.

What do those do?

>> No.56598961

it doesnt take long to adjust

>> No.56599018
File: 33 KB, 566x557, 1452794238334.png [View same] [iqdb] [saucenao] [google] [report]

Depends, there are sane languages where if you know one you can pick up the others very fast, Java is one of them, Python is another, C/C++ has some additoinal concepts you need to know but otherwise very similar to these, then there are special snowflake languages that ignore the standard ways of going things and do everything different, like Haskell, and Cobol, these are called meme languages on /g/

>> No.56599042


It's a continuous process. You can be fine learning one language only, but you're better off knowing at least a few. "Knowing" a language means you can use documentation and experience to understand features of the language you may not have seen, not knowing it all by heart.

Fully mastering the java ecosystem is a very daunting task, but in order to "know" java you don't need to know about every library and every single nook and cranny of the spec.

>> No.56599048

>has never seen minified code
There wouldn't be any spaces either

>> No.56599054

The first language is the hardest. Java is good because it's popular and has C-like syntax (as opposed to Python or a functional language).

Going from paradigm to paradigm is harder though.

>> No.56599058

I have just "learned" c++ in less than a month. Its not that hard if you znderstand the basic concept and design behind the language

>> No.56599059

Has anyone here ever got GLEW to work in Code Blocks? I've tried everything but I just cannot for the life of me get it to work.

>> No.56599077
File: 167 KB, 960x1415, 1393817943679.jpg [View same] [iqdb] [saucenao] [google] [report]

Is there a job market for half-pen tester, half-software developers?

>> No.56599096
File: 814 KB, 604x717, 1473356959991.png [View same] [iqdb] [saucenao] [google] [report]

>write it in a language he won't understand like Lisp or Haskell or English

>> No.56599118

I think devops is as close as it gets

>> No.56599150

kill yourself

>> No.56599156

>What are you working on, /g/?
I implemented that search box to my C# thing. I have a quarter of an idea how I did it but god damn it fucking works.

>> No.56599176
File: 950 KB, 1000x669, gno.png [View same] [iqdb] [saucenao] [google] [report]



>> No.56599196
File: 179 KB, 800x600, image.jpg [View same] [iqdb] [saucenao] [google] [report]

I'm making a 3D engine from scratch with a friend in C++.

It's been 70 hours, but right now I can render 12000 MattDamon-Cubes rotating in every axis in a 3D space with ~50 fps.

Feels good.

>> No.56599224


What C# thing?

>> No.56599232

Damon, son! You were bourne to program.

>> No.56599240

does anyone have anything on making my own toy p2p network?
like how do i prevent a message going round forever and ever?

>> No.56599252

my loli waifu simulator. its about 75% done

>> No.56599266
File: 108 KB, 2400x1800, cycles.png [View same] [iqdb] [saucenao] [google] [report]

Know the cost!

>> No.56599271

Implement a Time-To-Live field in your message header. Each node that routes the message should decrement its value by one. Once the value is zero, the message is discarded.

>> No.56599274

How much have you programmed? Starting out with TCP sockets in python is a pretty fun way to get started

>> No.56599286

>I don't want him to judge my style.

Don't be embarrassed, anon. Worst case, he'll give you some great tips for the future.

>> No.56599295

meant to point to >>56599240

Doesn't really matter though because I didn't read your question. Use TTL

>> No.56599299

how would i know what to set the initial TTL value to?
do i need to build a graph of all of the nodes on the network?

>> No.56599306

try QT Creator.

>> No.56599415

Just to update on this and help any fellow anons out because this is really, really convenient...

If you want to run a compiler straight from Sublime, you can go to Tools->Build System->New Build System


"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
Save as name_of_your_choice.sublime-build

And now when you run "Build" it'll compile and launch your open file from the shell.

I did this for C but in theory you could use any language.[/code]

>> No.56599418
File: 55 KB, 822x430, image.jpg [View same] [iqdb] [saucenao] [google] [report]

Made me chuckle and warmed my heart. Thanks man.

>> No.56599430

Fucked that post up somehow, sorry:

If you want to run a compiler straight from Sublime, you can go to Tools->Build System->New Build System

"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"name": "Run",
"shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"

Save as name_of_your_choice.sublime-build

And now when you run "Build" it'll compile and launch your open file from the shell.

I did this for C but in theory you could use any language.

>> No.56599439
File: 704 KB, 390x337, krabba glad.gif [View same] [iqdb] [saucenao] [google] [report]

>tfw labwork in Prolog
Shits comfy

>> No.56599467
File: 314 KB, 1261x1000, 1468269825441.jpg [View same] [iqdb] [saucenao] [google] [report]

if i have no programming exp but am not retarded, how long realistically can i learn c or c++ and be able to make everything on this list without cheating or looking up the code?

>> No.56599484


30 years

>> No.56599485


>> No.56599520

3 months

>> No.56599530

Some of those things have components that could take a very long time, depending on what your autism level is.

For example, one could spend a VERY long time developing a Battleship AI that learns from games played and tries to act more humanlike.

A text-based game is trivial, but the actual content could take many months to write and design.

Like anything else you do, you'd want to define your scope of work for each thing going in with acceptance criteria so you can just shit out the project and move on, if your goal is simply to complete them all. You could spend the next 5 years of your life developing a rogue-like.

>> No.56599616

Why do you name your text board after a lesbian loli.

>> No.56599626
File: 4 KB, 255x157, anal beads.png [View same] [iqdb] [saucenao] [google] [report]

>text adventure game

Great, what do I win?

>> No.56599651

After a month of painful learning of JS I decided to abandon webdev and now I'm learning Java.

I was about to abandon programming in general when I had to deal with all those nested <divs>and callbacks but then I realized it's not programming that I hate, it's just the "web" part of it

I'm really loving this Java course. I wish I had abandoned the web thing earlier!

I was deciding between Python and Java but ultimately decided to go for Java, as I think it will make it easier if I later want to transition to either C++ or C#

>> No.56599689

Webdev is pretty cancer, and I think you're on the right track.

You're right about it transferring more fluently to other languages that were based out of C.

C# is easier to get into than Java, but I think any of the languages you mentioned are fine as an intro language for general dev.

>> No.56599691

Java will have more use for you, i.e. android apps, unless you're going for data crunching shit in python. I love both languages though, Python was a good teacher.

>> No.56599694

Thanks anon! Your encouragement means a lot.

>> No.56599728

im estatic, im passing my college exercises without even cheating again.

>> No.56599738


>> No.56599745
File: 210 KB, 1366x673, neural_fractal_network.png [View same] [iqdb] [saucenao] [google] [report]

It's a weapon to surpass Metal Gear

>> No.56599749

why'd you cheat, faggot?

>> No.56599752

nah? what about it?

>> No.56599766

learning functions was slowly taking my life away from me. and im shit at coding off the top of my brain so i just find some broken code and debug it normally

>> No.56599777

I'm trying to find out if you're in my area.

Only women and faggots cheat, so either way, you're probably looking for a cock to suck and I'd be happy to provide.

What programming language is the class?

>> No.56599785


>> No.56599812

I asked a single goddamn question, and "HEY! BE FUCKING NICE" is not a valid answer.

You could have even spouted nonsense like "BRAINFUCK!" or "FALSE!" and you would have actually landed on a programming language, however unlikely it may be that a university teaches a class with those languages as the subject.

>> No.56599835

When should you give up and admit that programming is not the career for you?

>> No.56599838

> android apps
about that, some beginner questions I have

how much exp would you advise me to have with just pure Java before going into Android ?

and how hard is to get into Android programming once you know the in and outs of Java ?

>> No.56599840

The sooner, the better.

>> No.56599857

>how much exp would you advise me to have with just pure Java before going into Android ?
You should be very familiar with the syntax and how to import and use libraries.

>and how hard is to get into Android programming once you know the in and outs of Java ?
It's more tedious than anything, but there are plenty of resources and code examples to build off of.

What country are you from? The space before the question marks is a dead giveaway.

>> No.56599859


>> No.56599981

>The space before the question marks is a dead giveaway.
Really ? Which country does that ?

>> No.56600000

the n queens problem
no cheating faggot

>> No.56600034

It's not a giveaway as to which country you're from, but it IS a giveaway to the countries you're NOT from.

Only non-English-speaking natives constantly put spaces before their end-of-sentence punctuation, so it's safe to say you're not from the US, Canada, or UK.

>> No.56600052

lol'd fucking hard in the train

>> No.56600123

Like the fact that I put the dollar sign at the end of the number, like: 100$

>> No.56600149


>> No.56600164
File: 44 KB, 538x434, 1412044045352.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56600171

Wasted digits.

>> No.56600223

what would you do with those digets if you had them?

>> No.56600266

my_dict = {} # empty dictonary
grades = {'Ana':'B', 'John':'A+', 'Denise':'A', 'Katy':'A'}
grades['Sylvan'] = 'F' #she missed half the class
del(grades['Sylvan']) #Suspended for excess tardyness, some people dont want to learn

>> No.56600285

>C++ is easy if you know Java
>COBOL ignores the standard ways to do stuff
are you high right now or just retarded?

>> No.56600301

Do any of you do 3D graphics programming? I'm currently doing research on a cloth simulation in WebGL.

>> No.56600319

once you have a grasp of the general concept of both a high level language and a low level language the only real difference most of the time is syntax.

>> No.56600339

That's actually a boy, isn't it?

>> No.56600374

>low level language

>> No.56600448

I would just learn how C compiles and understand how it works. Working with actual Assembly is cool but rarely practical for the average programmer.

I watched this series to get a decent understanding of Assembly on microcontrollers, would recommend.


>> No.56600530

I've programmed in various languages since I was a kid and eventually got less shit at it at a certain point.
Still, I won't be able to complete more than 90% of your pic, because even with all that times, there's still concepts I haven't been exposed to, or even bothered to learn.
None the less, I'm confident I can do most of these projects without having practiced them before, specifically.
Also, there are a few projects on the list you can't possibly do as you would recite your alphabet, without looking some material up, I doubt someone ever bothered to memorize the documentation of both NTP, FTP, Telnet and IRC.

So a definite answer would be between what >>56599530 said and >>56599484.

>> No.56600694
File: 73 KB, 1280x720, comfy anime girl.jpg [View same] [iqdb] [saucenao] [google] [report]

tfw we started on scheme today in class but i already read sicp

>> No.56600736
File: 18 KB, 600x600, android-dark-matter-syfy.jpg [View same] [iqdb] [saucenao] [google] [report]

>currently in Business Intelligence
>good with python and SQL
>want to upskill to a more technical job but not sure what to aim for

Thinking backend weeb dev, data engineering, or possibly trying to move into data science through a data analysis role.

Django devving is definitely the easiest of them but not sure what the career prospects would be like after a few years.

What do?

>> No.56600747


That doesn't help. :(

>> No.56600749


>> No.56600759

somebody save that little girl from pbear

>> No.56600765


>> No.56600837

you can compile and even compress the files, and there are lots of ways to obfuscate python code easily. also, learn about its internals.

>> No.56600851
File: 48 KB, 2034x1491, kys.gif [View same] [iqdb] [saucenao] [google] [report]


>> No.56600873

Language with best potential to make money fast?

>> No.56600877

exploit writer, vuln discovery... etc

>> No.56600890


>> No.56600908


>> No.56600918

fu anon

>> No.56600920

>without cheating

>> No.56600938

The things that make a lot of money are often the things nobody wants to do

>> No.56600942

How do you even begin to write a game engine?

>> No.56600957

tell your teacher?

>> No.56600991
File: 18 KB, 276x230, Chuckling.jpg [View same] [iqdb] [saucenao] [google] [report]

Begin with 'hello world'

>> No.56600997

What is the point of algorithm design as a class? Why I gotta design some shit personally when some nigga in Greece did it ages ago

>> No.56601028

Your trolling is master-quality, I tip to You sir.

>> No.56601165

underrated post

>> No.56601209
File: 32 KB, 734x503, ii.png [View same] [iqdb] [saucenao] [google] [report]

Are most programmers really self taught ?

>> No.56601240

>Get a window on your platform
OS API isn't that hard usually and it's rather educational.
>Get a way to put stuff in the window
The most sensible way is to use [insert graphics API here]. But you could also do stuff like responding to WM_PAINT in windows, gives you a more basic idea of rendering. I don't recommend it though. It's well wiser to just modify a texture and putting it on the screen if you're gonna go that route.
>Get input
Usually very trivial.
Use OpenAL
>Just like make the game
Come up with a game and figure out how to write it. All this other stuff is just presentation. Here's where you do the actual game or engine. Depends on your view of what a game engine is.
If you just provide everything except for this step I'd say you have a framework at most.

If you're interested in how a good programmer would do it go to https://handmadehero.org/

>> No.56601251

Savant-tier ones are in my experience

t. not a savant-tier

>> No.56601258

yah it's not that hard to make video games

the hard part is making them not shit and designing tools to make them not shit easier and faster

>> No.56601264

I'm self taught and I think a large portion of those have taken programming courses which give them jack shit and they took it from there.

That's how I did it. I started with reading a book on VB for intermediate programmers (it was primarily focused on the new and interesting GUI and form parts) and figured out basic from that. So that's kinda self taught. But my actual knowledge began with using libraries and then being upset with them which pressed me to write my own stuff.

>> No.56601271


Friend has been coding for 20 years ( since 8 ) earns €$£
Laughs when I talk about basic shit.
Feel bad

>> No.56601272
File: 85 KB, 454x453, disgusted feel frog.jpg [View same] [iqdb] [saucenao] [google] [report]

>online course
where'd you get this image? is this web devs?

>> No.56601289

define "programmer", sourceless image

>> No.56601298


>> No.56601301

>the hard part is making them not shit and designing tools to make them not shit easier and faster
Yes. This is what keeps me up at night.
On the topic of
>Get a way to put stuff in the window
Forgot to mention that if you're using SFML or SDL (as examples) they have rendering functionalities to consider. In the case of SFML it's really just a thin abstraction on OpenGL. Some useful for newbies which prevents basic mistakes imo.
It looks like webdevs
>On the job training
>B.S. in CS
>course work
>industry certification program
But it's probably posed to a general audience where they just happen to be the majority.

>> No.56601313

Can someone please recommend me a usable C++ IDE on Windows? Visual Studio is the only good one so far. Tried CodeBlocks but it can't even link libs properly

>> No.56601328


>> No.56601337

Visual Studio

>> No.56601346

>Tried CodeBlocks but it can't even link libs properly
It does.
But I agree it's crap.
Sadly IDE's overall are crap right now and Visual Studio is king of the poop mountain.
I've had moderate success with Jetbrains. Especially PyCharm which is really fancy and easy to work with.

>> No.56601348

I've had reasonable experiences with QTCreator. I like XCode on OSX more, though

>> No.56601355
File: 28 KB, 800x742, 4cf175628faf2494087a9962aa986cff[1].png [View same] [iqdb] [saucenao] [google] [report]

i wonder how did i know

>> No.56601374

pooping on creators of the internet of things

>> No.56601425
File: 20 KB, 719x495, Poopstack.png [View same] [iqdb] [saucenao] [google] [report]

God I hate people who come from one fresh background and doesn't try to be inclusive of the old.

None of those words fit me aside from maybe "data". But I'd never say "math and data".

>> No.56601457


>> No.56601465

Why does the web need so many developers? Isn't the point of the web to be pretty slow performance-wise but very easy to work with?
Wouldn't that make them incredibly niche like say logo designers?

>> No.56601497


>> No.56601500
File: 18 KB, 845x181, sshproj.png [View same] [iqdb] [saucenao] [google] [report]

Not sure if this goes in sqg or here.

I'm doing a data quality project in SSH and keep getting this error. I've only been taught basic commands so the errors are confusing.

>Exception in thread "main" java.io.FileNotFoundException
Not sure what this means. I was told to add +java to my .soft so I don't know why I'm getting a java error.

>(No such file or directory)
Confused because in the script I made the output and paired directories. The .fastq file is supposed to be the output file that gets put in output/paired.

Then I have no idea what all the at errors are below.

>> No.56601507

because people are retarded, and marketing people/designers/webdevs take advantage of their ignorance, so instead of telling them "you could use wordpress, or this other CMS", they tell them to use a custom one.

>> No.56601528

perhaps you meant "../output" ?

>> No.56601534

>tfw business intelligence and data warehousing dev

>> No.56601548
File: 2.91 MB, 405x720, 1473547686573.webm [View same] [iqdb] [saucenao] [google] [report]

Just watched a series of lectures (with an accompanying paper) on the syntax of cubical (homotopy) type theory. Interestingly, the univalent equality is defined as a logical relation, similarly to recent developments in internalizing parametricity. A continuation of the work in parametricity is coloured type theory, which vastly simplifies the presentation. I'm now wondering whether one can do the same thing with univalent equality, i.e. have a "coloured homotopy type theory" where parametricity and univalence are given at once.

>> No.56601582

>>Isn't the point of the web to be pretty slow performance-wise but very easy to work with?
What's the point then? Why not be a real dev?
>>Wouldn't that make them incredibly niche like say logo designers?
You're saying this doesn't make sense? Elaborate.

>> No.56601612

i made an antichess player in python but is slow
red k&r, learnt c, am rewriting it now so it can work faster

>> No.56601620

>What's the point then?
The point of the web is to allow people to access information and services easily across the internet from many different devices.

>You're saying this doesn't make sense?
It wouldn't make them niche because there is a lot of demand for the them. There is a lot of demand for logo designers too.

>> No.56601630

fresh pasta

>> No.56601656

thanks for catching that mistake. Supposedly it worked now but the output is still being put into my .e (error) file instead of my .o. It says it was completed successfully though.

>> No.56601659

>The point of the web is to allow people to access information and services easily across the internet from many different devices.
But you don't need webdev for that effectively. You can even have browers read your bullshit well.
>Niche implies there's no demand
That's simply not true. I'm saying they'd be a small proportion. Like logo designers compared to every other type of designer.

>> No.56601685

Yeah, I know. My life is a meme.

>> No.56601695

>But you don't need webdev for that effectively.
What's a better way to do it then

>> No.56601737

>write in any compiled lang

>> No.56601763

>muh standards
fuck you and your imperative shit style

>> No.56601837

What's a good way to write in Java without using any X applications?
I have to connect to this system running Fedora at my school to actually test or submit any of my work, and while I normally just use IntelliJ the X11 forwarding is ABYSMALLY slow.
If I run emacs without X11 forwarding it'll open up in the terminal window and runs perfectly fine, but I cannot for the ever love of christ get JDEE is install and load correctly.

Is vim any better in that regard, for java? Or is there a third, unknown-to-me option?

>> No.56601860

did you mix stdout with stderr or something?

>> No.56601894

languages have package managers like rust has cargo and python has pip etc

i understand C doesnt have ssuch a feature, but to install libraries you generally download them, then read the readme and do the commands they want you to, most often involving 'make' and configure and install

is this correct

>> No.56601929

ssh + screen/tmux (although not really needed) + vim
or use git

the package manager in your system can install C libs just fine, and that's what other package managers copy. what are you talking about?

>> No.56601958

Working on implementing brute-force implementation of k nearest neighbor and a 1-nn consistent set condensing algorithm for class. It has to be brute-force (no kd trees), and it has to be in python+numpy. Every time I switch a implementation of a single line of code the performance changes drastically (because the python interpreter is slow as shit).

Data set is aimed at letter recognition with 17 features and 20000 examples. The top 5000 are for testing, the rest for training.

Because of the size of the data set and the complexity of the condensing algo (O(n^3)) the speed of knn of each test is extremely important and mostly limited by the distance calculation. Currently each calculation is about 0.75us and that's not fast enough to make this run in a reasonable time. So I'm going through contortions and I've spent way too much time on this. Kill me.

>> No.56601970

I'd rather not flood my github with worthless school assignments
Does vim have any testNG support?

>> No.56602024

Eclim does.
Terminal-based java editing application. Supports Eclipse functions.

>> No.56602063

I don't know I didn't write that part. I just wrote out a script the instructor posted and he said if everything was good then .e file should be 0 and everything should go to .o. Every time I run it my .o stays at 0 and I get different .e file sizes after changing something, even though the .e file lists out the script results and says successful.

>> No.56602086

m8, those are different things.

no idea then. without context, I can't understand shit, and I'm not very interested anyway...

>> No.56602087
File: 618 KB, 1024x576, hacker.png [View same] [iqdb] [saucenao] [google] [report]

>How do you begin?
You start by making the DirectXFramework and getting a window. Without a window, you won't have an engine. Personally I have my engine very object-oriented so I started out with a class for DXFramework, one for the Window and one named "Engine" that's a singleton and holds most of the shit, so when making the actual game, you can easily get all the functionality from there.

>What do I do when I have a window?
Make a 2D triangle appear. This is the easiest shape to make, but will still be pretty hard if you're unused to programming against DirectX, or rendering in general.

This would also be a great time to make a class named "Model".

After this, a 3D cube is a great next step, followed by learning to texture it, and finally loading actual maya-models and such into your engine.

Couple this with a camera that's able to fly around by moving the position and rotating a Matrix44, and you're more or less set. There's a great tutorial at http://www.rastertek.com/tutdx11s2(dot)html

Making an engine was one of the more rewarding things I've ever done, and I'm not even closed to being done.

>> No.56602096

This was kind of a shit explanation, but the link is great if you want to do it in C++

>> No.56602102

I'm not sure how I would use git without a git server somewhere

>> No.56602105
File: 402 KB, 636x356, 1458702927117.gif [View same] [iqdb] [saucenao] [google] [report]

>very object-oriented

>> No.56602132

>He doesn't have a home server

>> No.56602150

:^ (

>> No.56602151

>recommending Rastertek aka "90% of what I write is premature abstraction OO masturbation"

>> No.56602162

Just make a new account for this at the hoster of your choice or use a hoster which allows for private repos like gitlab

>> No.56602187

desu, singletons are not inherently shit, it's all about the way they're used imo senpai

>> No.56602200

>singletons are not inherently shit

>> No.56602202

Seriubbly, ibth easy. Buy a used shitbook on ebay for <$100, install linux of choice, install ssh server if not already installed, install git, set up some ssh keys, start pushing. I used to run a small git/storage server off a eeePC I bought from a friend for $20.

>> No.56602208

>global mutable state isn't inherently shit
>forcing there to be one of something isn't unnecessary 99% of the time

>> No.56602210

Literally none of the people who answered gave you an actual answer. Just use py2exe or cx_Freeze

>> No.56602233

>global mutable state isn't inherently shit
>forcing there to be one of something isn't unnecessary 99% of the time
generally not true

>> No.56602251

I'm not sure you understand what greentext is.

>> No.56602266

I do. In this case I'm pretty sure he's trying to be sarcastic. I'm pointing out how retarded he is.

>> No.56602277

>forcing there to be one of something isn't unnecessary 99% of the time

If you want to think that way, few things are unnecessary. It's not necessary to write tests, but it's good.

>> No.56602282 [DELETED] 

he used angle brackets to quote a message, which is exactly what they were meant to be used for

>> No.56602298

As in you're saying, genuinely, that "global mutable state isn't inherently shit" and that "forcing there to be exactly one of something is unnecessary 99% of the time"?


>> No.56602318

>As in you're saying

>> No.56602343

The main problem with singletons is that crappy languages (read: Java) make them hard to test.

If we were used to monkey-patching and global setup + tear-down, it wouldn't be a sin to use them in the many places where they make sense.

>> No.56602349

how do i prevent segfault

>> No.56602361


You're advancing the pants-on-head retarded view that singletons are bad because they're unnecessary, I'm pointing out the flaw in your logic.

Nearly everything is unnecessary, yet most things worth discussing are beneficial in at least some scenarios.

>> No.56602364

take computer, throw out of window

>> No.56602367

Jeez, you guys suck at writing clearly.

>> No.56602370


>> No.56602378

I need c++ help. How do I make this work.

class Something{
Other *othr;
void method(){ othr->callSomeOtherFunction(); }
class Other{
Something *smth;
void func(){ smth->callSomeFunction(); }

class Owner{
/*These two fucks need to know about eachother and use eachother's functions*/
Something smthn;
Other othr;


They're all in their own header/source files.

>> No.56602390

>Jeez, you guys suck at writing clearly.
Do you mean "typing"? No one is writing here. I'm not sure what this anon is trying to say. If only he could more clearly explain what he is trying to say...

>> No.56602396

Header files.

>> No.56602397

class Other;
class Something;

goes to the very top

>> No.56602406

>>They're all in their own header/source files.

>> No.56602409

Ironic jokes aren't jokes anymore?

>> No.56602424

Are you saying you were pretending to be retarded?

>> No.56602431

in which file?

>> No.56602455

Just saw that part, wasn't scrolled all the way down.
But basically yeah, include those header files, then they'll know. Of course you'll redefine some functions and the compiler may or may not get mad, but that why you don't put function definitions in header files, but in source files.

A header file that contains the declarations of both.

>> No.56602469

I guess so. Sue me.

>> No.56602507

>This would also be a great time to make a class
What is never?

>> No.56602510
File: 120 KB, 720x493, 1473740816608.jpg [View same] [iqdb] [saucenao] [google] [report]

"You know how much bloat i removed by deleting white space and making my src completely unreadable brooo! 2^n bits brouh!"
"Duuude no way, did you back up your source braugh?"
"No way bruoauh its 2016!"
Interpreted languages.

>> No.56602513

I don't think you're understanding. They're in their proper .h/.cpp files. But including Other.h in Something.h and vice versa gives me a shit load of errors. Most seem bullshit, like missing ; and undeclared identifier.

>> No.56602526

Here's what I'm saying.
1. Global mutable state is shit. There's no way to justify it in my opinion and experience. You need atomics or a mutex to make it not be utterly broken, and you can't reason about it.
2. Forcing there to be exactly one of something when it's unnecessary leads to worse code, unless you use a singleton without global mutable state and instead pass an instance (of which there can only be one) around.
Hence, singletons, which combine both of these (and rarely only enforce the second, which is usually not something that should be enforced), are bad.

>> No.56602568

>Global mutable state is shit. There's no way to justify it in my opinion and experience.
System.Console in C# is a global mutable. It utterly makes sense there. There are rare occasions when global mutables are the least retarded way to solve a problem.

>> No.56602601

It's not really global mutable state. Writes and reads don't interact. Also, you want it to only be accessible from one thread.

>> No.56602618

who here learning go

>> No.56602624

>Writes and reads don't interact
Yes they do. You can set properties of the console. You can read and set the console buffer globally etc.

>Also, you want it to only be accessible from one thread.
Why? You can use it from any thread.

>> No.56602649

>Global mutable state is shit. There's no way to justify it in my opinion and experience. You need atomics or a mutex to make it not be utterly broken, and you can't reason about it.

How much global mutable state are you using? I'd write a lot of awkward code if I could use a little bit of what was technically global mutable state.

>Forcing there to be exactly one of something when it's unnecessary leads to worse code

Because dependency injection boilerplate is good code?

Static variables (of which singletons are a form, though a strange one) have their place. They can make things more elegant, and in the vast majority of cases, you can use them without ever running into problems.

Even in the case where the decision to make a singleton was wrong, it's a pretty simple refactoring. I've never liked the opposition to them, it leads to a lot of people pre-emptively writing awkward code just in case they need it one day.

>> No.56602655

Due to long series of irrelevant circumstances, I'm currently in a senior level undergrad course on C++ but haven't actually done any C++ in 2 full years. Conceptually, I'm a little ahead of the class because I've been studying but JS on my own these past two years. But I really suck ass at C++.

It seems as though there are no good online resources for it, and you basically just have to pirate multiple 400 page books and read them from cover to cover to actually get good at C++. This is a huge departure from learning JS piecemeal and reading new info on an as-needed basis.

Does /g/ have any good resources that could help me out, or is my fate sealed?

>> No.56602667

*couldn't use a little bit of etc.

>> No.56602678

Then that's even more reason to not make it global.

>You can use it from any thread.
You SHOULDN'T be able to use it from multiple threads at once.

It might be superficially convenient to make something global, but then you lose flexibility, safety, cohesion, etc. and ultimately end up with spaghetti unless you're so disciplined about it that you might as well not make it global in the first place and reduce the cognitive load required.

>> No.56602695

c++ is shite mate what do you expect?

>> No.56602719

>Then that's even more reason to not make it global.
It is global, and it's useful. How would you implement it without making it more awkward?

>You SHOULDN'T be able to use it from multiple threads at once.
Why should I not be able to use System.Console.WriteLine() from multiple threads?

>> No.56602728

Literally go to your university library, take out a book on it and read it.
But I suppose you'd rather take another bong hit and play some video games.

>> No.56602737

In C#, is there a way to convert a method object.Foo() to Foo(object) (e.g. to satisfy a type Action<A> with A.foo, assuming that A.foo is a method and not a static method)?
In Go I can easily do this: https://play.golang.org/p/GwQSs-ZrIj
but when attempting the same in C# it fails to compile.

>> No.56602783

Shared mutable state isn't necessarily global mutable state. Global mutable state is always bad (because it can't be guarded); shared mutable state is useful as an implementation detail but needs to be appropriately guarded by an API.

Also, if passing things around becomes too overbearing, it probably means that your code is becoming highly coupled.

Writing isn't a problem. It's when you try to block on input from multiple threads that you have an issue. Sticking these both into one global thing instead of one potentially global and one non-global is wrong.

>> No.56602801


No. I'd much rather be using my time meticulously studying Angular because undergrads in my area don't bother to learn it and it's gotten me internship / job opportunities already. I'll be using JS and C# out of college, not C++. Anyway to make it easier is a logical choice.

That being said, I don't mind doing some reading on it. I just hate getting hung up on something small because the syntax is so inadequately documented online.

>> No.56602852
File: 184 KB, 550x550, 1469919216439.jpg [View same] [iqdb] [saucenao] [google] [report]

Anyone got any good books for learning c++?
Also, is it worth learning C++17/14 first, or go from 98 and move on from then?

>> No.56602882

>It's when you try to block on input from multiple threads that you have an issue.
So don't do that. Thats much easier than trying to make a non global Console.

>Sticking these both into one global thing instead of one potentially global and one non-global is wrong.
No, its potentially problematic. Like everything in programming. Everything is a trade off. You might as well say all shared mutable state is wrong. Some langugaes ban it, but most accept it is very useful even though it can create problems.

>> No.56602951


I'm the other anon looking for non-book resources to supplement. I downloaded about five books on C++ last night. Just google "stack exchange C++ books" and there's a post with over 4,000 up votes. That's the one.

I'll share the PDFs when I get home in 20 minutes if you're still around.

>> No.56603026

How can I write in foreign languages in C++? It doesn't like using anything other than the Latin alphabet.

>> No.56603078

is it bad to google problems as long as I try to learn how to actually fix the problem instead of just copy pasting code

>> No.56603090
File: 154 KB, 401x397, Lanka 5.png [View same] [iqdb] [saucenao] [google] [report]

>trying to explain to Java students how to convert from a given amount of seconds to hours, minutes and seconds
Shit's a pain, though it's partly my fault for not being to explain it well

>> No.56603126

It's not bad.
Try to figure out what you did wrong. Why it's wrong. And why you thought the way you did it was right.
That should help you avoid future mistakes.

>> No.56603159
File: 43 KB, 710x470, ouloulou.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56603161
File: 57 KB, 544x708, 1446053607315.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56603176

So why haven't you guys accepted based JavaFX as your lord and saviour?
All the best of both java and webdev in the same language. Sign me right the fuck up

>> No.56603235
File: 352 KB, 1024x576, 1473358631233.jpg [View same] [iqdb] [saucenao] [google] [report]

>All the best of both java and webdev

>> No.56603253

Can someone please explain to me how to use this code? I don't know shit about command lines or makefiles or anything like that.


>> No.56603262


>> No.56603282

Are you a Hakase? (a professor)

>> No.56603335


>I don't know shit about command lines or makefiles or anything like that.

If you've never used a command line before, what are you doing compiling GLEW from source? Maybe you should learn how to compile a Hello World first.

>> No.56603341
File: 582 B, 402x402, spain-fs8.png [View same] [iqdb] [saucenao] [google] [report]

how to convert a webm to mp4, with the same quality?

>> No.56603347

This >>56603335, and why are you even compiling GLEW from source when Windows binaries exist? There's a reason that libraries are often distributed with binaries for Windows, namely that building on Windows is a pain in the ass.

>> No.56603359

he is a game """"""""""""dev"""""""""""", of course

how is this related to /dpt/?

>> No.56603361
File: 27 KB, 640x480, 1398558668419.png [View same] [iqdb] [saucenao] [google] [report]


>> No.56603371


>> No.56603377

wat language are u doing this in

>> No.56603394

Are there going to be levels and loot and stuff?

>> No.56603398

Let them do it on paper, in math.
Give them the modulus operator.
Anyone who doesn't turn in a solved assignment can get notified that their attendance or test score won't matter they've already failed.

>> No.56603419
File: 14 KB, 243x298, 1398596648600.gif [View same] [iqdb] [saucenao] [google] [report]

I think the guy was using C and SDL. He used to post progress at /vg/agdg got reported to death multiple times so he went to eight chan's agdg. That was over one year and a half ago I think.

You can think of it as GTA-ish.

>> No.56603420

>slow and stupid
Sounds perfect for you.

>> No.56603439

Was it free software?

>> No.56603447

>Maybe you should learn how to compile a Hello World first.
That's simple, all I have to do is click the "build" button in my IDE!

I downloaded the binaries and tried to link them to my project, but it didn't work. I did some Googling and most websites told me something similar to that Stackoverflow link.

>he is a game """"""""""""dev"""""""""""", of course
No way, real game devs use Unity or GameMaker.

>> No.56603462

I have no idea.

>> No.56603463
File: 63 KB, 559x715, 1423246623700.jpg [View same] [iqdb] [saucenao] [google] [report]

>it didn't work

>> No.56603464

I don't know what GTA is, but what it really needs is parasites for the girls. And weapons and armor. The weapons and armor and parasites need a level system similar to Dark Cloud 2's system weapon, but better.

>> No.56603471

Nah, I'm just a lab assistant

>> No.56603479

End your miserable life, it's for the best.

>> No.56603501

you can't encode webm to mp4 losslessly. just set a really high bitrate

>> No.56603521

>you can't encode webm to mp4 losslessly

>> No.56603524

learn english, pajeet

>> No.56603547

>webm to mp4
Easy. Change the extension of the file.
>mp4 spec compliant file
Ah, more difficult. You need to copy the encoded information into a mp4 private stream.
>mp4 spec compliant file that lets you play it in most video players
Use libav or ffmpeg to save yourself the hassle.
You can't really garauntee it's not decorded right.

Consider encoding a H.264 lossless encoding. That's probably the best way to achieve the most compatibility.
This is the stupid mans answer.

>> No.56603548

prove it
right now

-codec copy doesnt work
-vcodec copy -acodec copy doesnt work

>> No.56603557


>> No.56603566

You sound like you have ideas for videogames. They're in short supply over at >>>/vg/agdg/
Go there and tell them your amazing ideas.

>> No.56603583

>prove it
>right now
Simple logic

>-codec copy doesnt work
>-vcodec copy -acodec copy doesnt work
Are these ffmpeg options? irrelevant to the topic

>> No.56603585

>but it didn't work
What did it say then?
I've built glew on windows.
I recommend using visual studio and following http://glew.sourceforge.net/build.html for you.
Because 99% of the time a later version of visual studio will tell you "update this project" and you go "duuh ok?" and it works.

Make isn't that bad either but you need to set up your build environment.

>> No.56603608
File: 88 KB, 10000x10000, hereyougo.gif [View same] [iqdb] [saucenao] [google] [report]

what ever happened to loli rape sim guy?

>> No.56603616

>Are these ffmpeg options
what? are you sure you've used ffmpeg before..? they're the most common option for remuxing

im still waiting on my script.

>> No.56603625

>End your miserable life
I tried, but it didn't work. That's when I decided to learn programming.

It said: undefined reference to imp_glewInit

>> No.56603626

>are you sure you've used ffmpeg before..?
Why the fuck would he have done that? All he claimed was the obvious fact that you can have lossless data in an mp4 file.
There's even articles on how to do it and you're too retarded to look it up.

>> No.56603635

>are you sure you've used ffmpeg before..?
wot? Did I ever say in this thread that I did?

>im still waiting on my script.
Sure, after you pay me.

>> No.56603647

>>It said: undefined reference to imp_glewInit
>Posts incomplete error messages
But that's you not giving your compiler the right linker files probably. But I'm just fucking guessing here because you're not being helpful.

>> No.56603649


>> No.56603653

Why aren't you using GNU/Linux?

>> No.56603661

>hasn't even used fucking ffmpeg
alright fuck right off
stop posting.
i dont want to read another word from you.

>> No.56603668

frick you...!

>> No.56603682
File: 115 KB, 785x757, 1472174387732.png [View same] [iqdb] [saucenao] [google] [report]

Never fucking reply to me again unless you are contributing to the thread.

>> No.56603696

I did once or twice to convert .ogg/.mp3 files to .wav for sdl2. As well as multiple times indirectly over other programs such as youtube-dl or mpv.
How is this relevant to the topic however?

>> No.56603705
File: 1.61 MB, 3840x2160, ProgrammingChallenges, 4.0 (HD).png [View same] [iqdb] [saucenao] [google] [report]

Try practicing!

>> No.56603708

>assumes a stupid fucking strategy of mockery hoping desperately to prompt someone to give him an answer
I'm pretty sure this is breaking global rule 3.
You're not even posting in the right thread. You're not even /g/ native. So yeah, rightly fuck off I don't care if you leave or not.

>> No.56603719

finish adding redirects (output) to my shell, write a small C lib for reading from files,

>> No.56603735
File: 46 KB, 960x398, 1460041140446.jpg [View same] [iqdb] [saucenao] [google] [report]


>> No.56603742

>Does /g/ have any good resources that could help me out, or is my fate sealed?
Well you sealed your own fate by claiming you're only gonna use JS and C#.
I'm not gonna reach down to the 7th hell to get you out of there.

I bet you're not even a cute girl.

>> No.56603744
File: 46 KB, 344x291, 1454971302851.jpg [View same] [iqdb] [saucenao] [google] [report]

>posts racist frogs on the internet

>> No.56603764

I'm not the one who asked the question. You said it could be done and I wanted you to prove it. You could not therefore the discussion ended there.

> breaking global rule 3
>bringing up the most subjective rule in some vain attempt to phrase me
That was a pointless comment.

>You're not even posting in the right thread
Making a script to encode videos can involve programming. Do you want me to show you? You're an idiot for thinking otherwise.

>You're not even /g/ native
Alright, You're stupid.
However I'm not dumb enough to think you deserve a ban for your stupidity.

>> No.56603781
File: 1.65 MB, 1030x942, wsqwfe.png [View same] [iqdb] [saucenao] [google] [report]

there is literally nothing wrong with racism

>> No.56603782
File: 53 KB, 521x521, Babby.jpg [View same] [iqdb] [saucenao] [google] [report]

The full error code is:
>undefined reference to `[email protected]'
>error: ld returned 1 exit status

>> No.56603791

>you're stupid
>for thinking that the animal that acts, looks and smells like a duck is a duck
So why are you shitposting in /dpt/ and not moving to /sqt/ where this question obviously belongs?
Glad we could clear this up though, no need for more shitposting.

>> No.56603796

>Making a script to encode videos can involve programming

>> No.56603813

Ok great.
So what's your process for trying to compile whatever you're currently compiling? Nobody has any idea of what the fuck you're doing anon.

I'm not gonna ask more questions or answer more questions because you're being such an unhelpful fuck.
Maybe you will learn something.

>> No.56603820

>You said it could be done and I wanted you to prove it
Okay, here is the deal: H.264 has lossless support.
This is your proof, what else do you want?

>> No.56603835
File: 1.96 MB, 292x292, 1270296945197.gif [View same] [iqdb] [saucenao] [google] [report]

>minified code
>human readable
are you just plain retarded or minified dumb ?

Please, get back to your fizzbuzz lessons.

>> No.56603866

what flags are you giving to the linker, did you include the glew libs are the glew libs in a folder included in the PATH var?

>> No.56603882
File: 151 KB, 449x442, 1471393848488.png [View same] [iqdb] [saucenao] [google] [report]

>spews insults and doesn't answer questions
>calls others unhelpful

>> No.56603914

Webm(VP8/9) cannot be converted to mp4(H.264) losslessly. Nothing is to see here.

>> No.56603931
File: 21 KB, 200x225, 61D_hobbes.jpg [View same] [iqdb] [saucenao] [google] [report]

Soon I'll be coding a scraper and saving the data I get from various websites into a database. To avoid fuckups, is it better if I save data onto some text file and later parse into the db or is it okay to straight up send it to the db while scraping?

>> No.56603932

I answered their questions with my previous post (>>56603647). There's nothing more to say before they act on that information, asks a question, provides more information etc.

So yeah, they're being unhelpful, I'm not being hypocritical.
I suppose if I wanted to go to the extreme I could type out a unique process for building or linking glew every post they make, comment on what step their post leads me to believe they are at and elaborate on those steps.

But no. That's excessive. And they certainly don't deserve that.

>> No.56603954

And what is your reasoning for that? mp4(H.264) does support lossless encoding, meaning that you can transform losslessly

>> No.56603977

>vp8/9 can't be decoded to a lossless representation
Now this is intriguing. You're saying that every time I decode VP8/9 I get a different result?
What kind of advantage could they really get from that?

>> No.56603982

I don't know what language to begin with. I'm thinking Java 1 because I did a semester of it in high school (babby shit) and I figured that it's not so important where I start.

Some things I'd like to do in the far future would probably be able to control hardware or server related. I don't really know my place at the moment.

Any ideas on a good reference to learn Java from? Can't find Head First Java and I heard that one was good.

>> No.56604066
File: 1 KB, 235x89, .png [View same] [iqdb] [saucenao] [google] [report]

I'm currently de-gendering my code so it will compile as both C and C++

>> No.56604081

I'm trying to use a shared pointer in Class A of type Class B to access Class B functions.

My issue is that the pointer cannot be converted to a Class B object, so the function cannot be called. I'm fried right now and if I'm calling it properly, I can just look elsewhere for the issue


Should this be correct?

>> No.56604092


>> No.56604094

you are joking, right? they don't know how to multiply and divide?

>> No.56604096

Building Java Programs is a good first book

>> No.56604099

Don't waste your time.
Don't write C++.

>> No.56604125

since you need to extract it from their markup into some intermediate representation (read: objects) anyway you can just validate it in that step. no need to have yet another intermediate layer

>> No.56604136

What are stupid waste of effort.
You're pretty much condemning your code to have heaps of macro fuckery and never using any of the useful things added in C99/C11, not to mention all of the semantic differences between the two languages.

>> No.56604146

>intermediate representation (read: objects)
Rude to presume he's retarded.

>> No.56604149


nah, it's fine

>> No.56604172

What are your thoughts on Scala? It looks pretty neat to me.

>> No.56604179


>> No.56604180
File: 40 KB, 435x580, perseus-black-hole_1140_600x450.jpg [View same] [iqdb] [saucenao] [google] [report]

I'll check that out.

Also I can only find 2nd edition if I want to like torrent it or whatever. Is that satisfactory or would I need to get the fourth edition?

>> No.56604189

The talk should really be titled "Scala Is Terrible".

>> No.56604198

#define condom namespace std
using condom;

>> No.56604201

>Global mutable state is always bad
but to avoid it in complex applications you'll need dependency injection, context objects or builders.

you need your loggers, application config objects and whatnot.

in practice you want to keep the amount of global state small, but zero is rarely practical.

>> No.56604220

It wasn't so much converting the seconds to hour or minutes with division, as it was using the modulus operator afterwards to get the remainder. I couldn't think of a good way of leading them to the answer either, so I ended spoon-feeding a few of them.

>> No.56604228
File: 37 KB, 636x358, 1445239516689.jpg [View same] [iqdb] [saucenao] [google] [report]


I used it for a keylogger I made for a friend long time ago, works fine

>> No.56604244

Side effects aren't observable.

>application config objects

>> No.56604297

>implying configuration cannnot be changed at runtime
>implying logging has no observable impact on your application

>> No.56604314

cx_freeze is good. Simple.

>> No.56604318

Well, ideally, you'd use a reader monad or something similar expressing that, because they're immutable in a region, you can access them "globally". As the log file has to be opened and closed, and the configuration could be modified.

>> No.56604361

>never using any of the useful things added in C99/C11

Not only that, but he's preventing himself from using all the advancements that brought C++ into the current millennium, leaving C behind.

>> No.56604369

ah, ok, I misunderstood

>> No.56604378

>Side effects aren't observable.
yes they are. depends on the logger.

>> No.56604385

Sounds like a shitty logger if it has side effects that prevent it from being used mostly globally.

>> No.56604389

The worst of both worlds is the best choice. You'll get addicted to a language and overdose or worse

>> No.56604406

They don't prevent it from being used globally tard. Like i said earlier, Console in C# is a good example of a useful global mutable object. Saying you should never do anything like that is sheer autism.

>> No.56604428

>You'll get addicted to a language and overdose or worse
Only if you're a shitty programmer. In which case you'll write shit code no matter what language you use.

>> No.56604429

That's not a logger.

If all you can do to a log in some context is write, there are no observable side effects in that context and it can be made global there.

>> No.56604433

loggers cause IO, which means you will have to die one death or another anyway

>sync logger
your application bears the full brunt of any latency spike
>async logger with unbounded queue
you risk memory exhaustion

And yes, that does happen in practice, not often and ultimately down to some mistakes, misconfiguration or overzelous logging, but it happens.

>> No.56604481

Well, if you are modeling a real time system where time taken is an observable effect, things get a bit more complicated. Or if you're specifically dealing with OOM instead of just assuming that it will never happen in practice.

Most of the time, though, in between opening and closing a log file, you can just write to it globally since there are no observable side effects from doing so. This is exactly what the reader monad is for.

>> No.56604490


>> No.56604536

rolling to do it in java

>> No.56604565


I was hoping for this, but I'm also partially serious. The whole "C++ is the worst and C is the only language you need to know!" meme is insufferable.

>> No.56604601

>C++ is the worst and C is the only language you need to know!
I never claimed that.
However, C++ really is horrible and you shouldn't use it for any reason. It's a language that is horribly designed.

>> No.56604616


So basically, you're saying it, but not in the exact way I suggested.

>> No.56604627

I never said anything about C being the only language you need to know.
I just said that C++ is fucking garbage and you should get some taste.

>> No.56604630

Working on cubic spline interpolation, can`t figure out why all my double[] are full of NaN values...

let thrd (_, _, c) = c
let frst (c, _, _) = c
let scnd (_, c, _) = c

let LUdecomp3 (c : double[], d : double[], e : double[]) =
let n : int = d.Length
for k = 1 to n-1 do
let lam = c.[k-1] / d.[k-1]
d.[k] <- d.[k] - lam * e.[k-1]
c.[k-1] <- lam
(c, d, e)

let LUsolve3 (c : double[], d : double[], e : double[], b : double[]) =
let n = d.Length
for k = 1 to n-1 do
b.[k] <- b.[k] - c.[k-1] * e.[k-1]
b.[n-1] <- b.[n-1] / d.[n-1]
for k = n-2 to -1 do
b.[k] <- (b.[k] - e.[k] * b.[k+1]) / d.[k]

let curvatures (xData : double[], yData : double[]) : double[] =
let n : int = xData.Length - 2
let mutable c : double[] = Array.zeroCreate(n+1)
let mutable d : double[] = Array.zeroCreate(n+2)
let mutable e : double[] = Array.zeroCreate(n+1)
let mutable k : double[] = Array.zeroCreate(n+2)
for i = 0 to n-1 do
c.[i] <- xData.[i] - xData.[i+1]
for i = 1 to n do
d.[i] <- 2.0 * (xData.[i-1] - xData.[i+1])
e.[i] <- xData.[i] - xData.[i+1]
k.[i] <- 6.0 * (yData.[i-1] - yData.[i+1])
/ (xData.[i-1] - xData.[i])
- 6.0 * (yData.[i] - yData.[i+1])
/ (xData.[i] - xData.[i+1])
let res = LUdecomp3(c, d, e)
k <- LUsolve3(frst(res), scnd(res), thrd(res), k)

>> No.56604642

Yeah. I used the third edition when I started learning Java, but it shouldn't have changed that much. It's much more focused on algorithmic design than other books I've seen, so that definitely helps when making transitions to C/C++/other languages.

This should go without saying, but try doing the problems at the end of each chapter (not sure if those were a 3rd edition thing, but if they're there, do them)

>> No.56604665

spoilers don't work on /g/

Have fun creating a static website generator

>> No.56604673

>If all you can do to a log in some context is write, there are no observable side effects in that context and it can be made global there.
which is exactly what Console is not in C#.

>> No.56604689

We weren't talking about it.

>> No.56604721

yeah, im pretty fucked

>> No.56604736

we were talking about mutable globals being useful sometimes. System.Console being an example.

>> No.56604740

Linus please gtfo.

>> No.56604741

they're all garbage bro
just like you are anon-kun
maybe kys

>> No.56604756

Go home, bald Danish man.

>> No.56604773

I'm saying there are ways to make things essentially global without it being an issue, but C# console I/O is not one of those things.

>> No.56604785

What language?

>> No.56604797

if you say so. It's still a completely legitimate use of mutable globals.

>> No.56604815

Not really, it's using a global for convenience while pretending that there aren't associated issues with doing so.

>> No.56604828

>pretending that there aren't associated issues with doing so.
What makes you think that?

>> No.56604832


>> No.56604844

The fact that you're dismissing the reasons for making it not completely global?

>> No.56604864

guys help!

Im trying to multiply a const double to a decimal of 2.5%

but yet I keep receiving my answer as an exponential number.

Wat do?

>> No.56604870


So what is your preferred language?

>> No.56604875
File: 58 KB, 960x720, samelevel.jpg [View same] [iqdb] [saucenao] [google] [report]

New thread >>56604862

>> No.56604912

That image is completely retarded.

>> No.56604929

When did I do that? Why would MS make it not completely global? Being able to change the buffer and read back from it is useful as fuck.

>> No.56605494

Just wrote a vanilla wow fishing bot in Clojure as my first post-fizzbuzz program, because clearly I am the kind of person who would use a bot on a wow private server which already allows you to vote for gold. Then again, it's really satisfying to watch while it's working.

It activates the fishing rod by pressing the correct key, checks screen pixels to find the bobber by looking for unusually red areas, moves the cursor to the bobber, and shift-right-clicks when it detects a large change in alpha. Rinse and repeat.

I was positively surprised by how easy it was desu. Using Java libraries was super-straightforward. Being able to use Java libraries like java.awt.robot in a language that isn't a horrible clunky monstrosity was really neat.

>> No.56605776
File: 182 KB, 481x511, 1462917638532.png [View same] [iqdb] [saucenao] [google] [report]

still has the same hang time as java,
if you like lisp just use another flavor, clojure is the worst lisp out there.

Name (leave empty)
Comment (leave empty)
Password [?]Password used for file deletion.