[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 347
Thread images: 52

File: codecode.jpg (507KB, 738x492px) Image search: [Google]
codecode.jpg
507KB, 738x492px
Generic Code Picture Edition

Previous Thread: >>56590613

What are you working on, /g/?
>>
First for VHDL
>>
File: akari2.jpg (58KB, 514x524px) Image search: [Google]
akari2.jpg
58KB, 514x524px
Second for akari-bbs!

Working on {code} tags right now.
Also planning spoiler tags.
What other kind of tags are worth implementing?
>>
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?

http://hastebin.com/iyetiwokiy.php
>>
>>56598460
That's fucking awful code
>>
>>56598597
>Second for akari-bbs!
not
>Second for akari-bbs[!!]

fucking newfags
>>
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?
>>
>>56598686
write it in a language he won't understand like Lisp or Haskell or English
>>
>>56598710
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.
>>
File: gorilla.jpg (207KB, 605x763px) Image search: [Google]
gorilla.jpg
207KB, 605x763px
>>56598545

Fuck VHDL

Representing Chisel
>>
>>56598597
how many LOC does the parser have?
>>
>>56598597
Honestly code tags are all we need since embedding a spoiler tag in a code tag may complicate things
>>
for i in sys.argv:
print(sys.argv[i])


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


What am I doing wrong?
>>
>>56598769

Your i is a sys.argv[?], not an integer.
You can simply print i, or do for i in len(sys.argv)
>>
>>56598793
Thank you senpai.
>>
>>56598597
[tex] and [aa]
>>
>>56598811

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.
>>
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.
>>
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.
>>
>>56598739
input parse and sanitation is about 352 loc
presentation-side parse is about 150 loc

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

>>56598816
What do those do?
>>
>>56598883
it doesnt take long to adjust
>>
File: 1452794238334.png (33KB, 566x557px)
1452794238334.png
33KB, 566x557px
>>56598883
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/
>>
>>56598883

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.
>>
>>56598632
>has never seen minified code
There wouldn't be any spaces either
>>
>>56598883
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.
>>
>>56598883
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
>>
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.
>>
File: 1393817943679.jpg (167KB, 960x1415px) Image search: [Google]
1393817943679.jpg
167KB, 960x1415px
Is there a job market for half-pen tester, half-software developers?
>>
File: 1473356959991.png (814KB, 604x717px) Image search: [Google]
1473356959991.png
814KB, 604x717px
>>56598710
>write it in a language he won't understand like Lisp or Haskell or English
kek
>>
>>56599077
I think devops is as close as it gets
>>
>>56598686
>nonfree
kill yourself
>>
>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.
>>
File: gno.png (950KB, 1000x669px) Image search: [Google]
gno.png
950KB, 1000x669px
>>56598686

no
>>
File: image.jpg (179KB, 800x600px) Image search: [Google]
image.jpg
179KB, 800x600px
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.
>>
>>56599156

What C# thing?
>>
>>56599196
Damon, son! You were bourne to program.
>>
does anyone have anything on making my own toy p2p network?
like how do i prevent a message going round forever and ever?
>>
>>56598460
my loli waifu simulator. its about 75% done
>>
File: cycles.png (108KB, 2400x1800px) Image search: [Google]
cycles.png
108KB, 2400x1800px
Know the cost!
>>
>>56599240
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.
>>
How much have you programmed? Starting out with TCP sockets in python is a pretty fun way to get started
>>
>>56598686
>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.
>>
>>56599274
meant to point to >>56599240

Doesn't really matter though because I didn't read your question. Use TTL
>>
>>56599271
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?
>>
>>56599059
try QT Creator.
>>
>>56598850
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

Put:

{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"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.
>>
File: image.jpg (55KB, 822x430px) Image search: [Google]
image.jpg
55KB, 822x430px
>>56599232
Made me chuckle and warmed my heart. Thanks man.
>>
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

Put:
{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
[
{
"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.
>>
File: krabba glad.gif (704KB, 390x337px) Image search: [Google]
krabba glad.gif
704KB, 390x337px
>tfw labwork in Prolog
Shits comfy
>>
File: 1468269825441.jpg (314KB, 1261x1000px) Image search: [Google]
1468269825441.jpg
314KB, 1261x1000px
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?
>>
>>56599467

30 years
>>
>>56599467
>N00bz
>>
>>56599467
3 months
>>
>>56599467
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.
>>
>>56598597
Why do you name your text board after a lesbian loli.
>>
File: anal beads.png (4KB, 255x157px) Image search: [Google]
anal beads.png
4KB, 255x157px
>>56599467
>text adventure game

Great, what do I win?
>>
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#
>>
>>56599651
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.
>>
>>56599651
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.
>>
>>56599689
Thanks anon! Your encouragement means a lot.
>>
im estatic, im passing my college exercises without even cheating again.
>>
>>56599728
london?
>>
File: neural_fractal_network.png (210KB, 1366x673px) Image search: [Google]
neural_fractal_network.png
210KB, 1366x673px
It's a weapon to surpass Metal Gear
>>
>>56599728
why'd you cheat, faggot?
>>
>>56599738
nah? what about it?
>>
>>56599749
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
>>
>>56599752
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?
>>
>>56599777
HEY! BE FUCKING NICE
>>
>>56599785
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.
>>
When should you give up and admit that programming is not the career for you?
>>
>>56599691
> 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 ?
>>
>>56599835
The sooner, the better.
>>
>>56599838
>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.
>>
>>56599467
rolling
>>
>>56599857
Slovenia.
>The space before the question marks is a dead giveaway.
Really ? Which country does that ?
>>
>>56599859
the n queens problem
no cheating faggot
>>
>>56599981
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.
>>
>>56599745
lol'd fucking hard in the train
>>
>>56600034
Like the fact that I put the dollar sign at the end of the number, like: 100$
>>
>>56600000
checked.
>>
File: 1412044045352.jpg (44KB, 538x434px)
1412044045352.jpg
44KB, 538x434px
>>56600000
>>
>>56600000
Wasted digits.
>>
>>56600171
what would you do with those digets if you had them?
>>
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
grades.values()
>>
>>56599018
>C++ is easy if you know Java
>COBOL ignores the standard ways to do stuff
are you high right now or just retarded?
>>
Do any of you do 3D graphics programming? I'm currently doing research on a cloth simulation in WebGL.
>>
>>56598883
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.
>>
>>56598460
That's actually a boy, isn't it?
>>
>>56600319
>low level language
assembly?
>>
>>56600374
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.

https://www.youtube.com/watch?v=h8T3PWauYF4
>>
>>56599467
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.
>>
File: comfy anime girl.jpg (73KB, 1280x720px)
comfy anime girl.jpg
73KB, 1280x720px
tfw we started on scheme today in class but i already read sicp
>>
File: android-dark-matter-syfy.jpg (18KB, 600x600px) Image search: [Google]
android-dark-matter-syfy.jpg
18KB, 600x600px
>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?
>>
>>56599840

That doesn't help. :(
>>
>>56599467
roling
>>
>>56600694
somebody save that little girl from pbear
>>
>>56600736
kys
>>
>>56598686
you can compile and even compress the files, and there are lots of ways to obfuscate python code easily. also, learn about its internals.
>>
File: kys.gif (48KB, 2034x1491px) Image search: [Google]
kys.gif
48KB, 2034x1491px
>>56600736
>>
Language with best potential to make money fast?
>>
>>56599077
exploit writer, vuln discovery... etc
>>
>>56600873
Assembly
>>
>>56599467
Rolling
>>
>>56600890
fu anon
>>
>>56599467
>without cheating
Never
>>
>>56600918
The things that make a lot of money are often the things nobody wants to do
>>
>>56599196
How do you even begin to write a game engine?
>>
>>56600694
tell your teacher?
>>
File: Chuckling.jpg (18KB, 276x230px) Image search: [Google]
Chuckling.jpg
18KB, 276x230px
>>56600942
Begin with 'hello world'
>>
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
>>
>>56600997
Your trolling is master-quality, I tip to You sir.
>>
>>56599232
underrated post
>>
File: ii.png (32KB, 734x503px) Image search: [Google]
ii.png
32KB, 734x503px
Are most programmers really self taught ?
>>
>>56600942
>Get a window on your platform
GLFW, SDL, SFML or using OS API
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.
>Sound
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/
>>
>>56601209
Savant-tier ones are in my experience

t. not a savant-tier
>>
>>56601240
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
>>
>>56601209
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.
>>
>>56601251

Friend has been coding for 20 years ( since 8 ) earns €$£
Laughs when I talk about basic shit.
Feel bad
>>
File: disgusted feel frog.jpg (85KB, 454x453px) Image search: [Google]
disgusted feel frog.jpg
85KB, 454x453px
>>56601209
>online course
where'd you get this image? is this web devs?
>>
>>56601209
define "programmer", sourceless image
>>
>>56601272
http://stackoverflow.com/research/developer-survey-2016
>>
>>56601258
>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.
>>56601240
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.
>>56601272
It looks like webdevs
>On the job training
>B.S. in CS
>course work
>industry certification program
>bootcamp
But it's probably posed to a general audience where they just happen to be the majority.
>>
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
>>
>>56601313
mokijuop
>>
>>56601313
Visual Studio
>>
>>56601313
>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.
>>
>>56601313
I've had reasonable experiences with QTCreator. I like XCode on OSX more, though
>>
>>56601298
>>56601301
i wonder how did i know
>>
>>56601355
pooping on creators of the internet of things
>>
File: Poopstack.png (20KB, 719x495px) Image search: [Google]
Poopstack.png
20KB, 719x495px
>>56601355
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".
>>
>>56601313
CLion
>>
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?
>>
>>56601465
Demand.
No.
No.
>>
File: sshproj.png (18KB, 845x181px) Image search: [Google]
sshproj.png
18KB, 845x181px
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.
>>
>>56601465
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.
>>
>>56601500
>..output
perhaps you meant "../output" ?
>>
>>56601355
>tfw business intelligence and data warehousing dev
>>
File: 1473547686573.webm (3MB, 405x720px) Image search: [Google]
1473547686573.webm
3MB, 405x720px
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.
>>
>>56601497
>>Isn't the point of the web to be pretty slow performance-wise but very easy to work with?
>No
What's the point then? Why not be a real dev?
>>Wouldn't that make them incredibly niche like say logo designers?
>No
You're saying this doesn't make sense? Elaborate.
>>
i made an antichess player in python but is slow
red k&r, learnt c, am rewriting it now so it can work faster
>>
>>56601582
>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.
>>
>>56601548
fresh pasta
>>
>>56601528
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.
>>
>>56601620
>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.
>>
>>56601630
Yeah, I know. My life is a meme.
>>
>>56601659
>But you don't need webdev for that effectively.
What's a better way to do it then
>>
>>56598686
>write in any compiled lang
>????
>prophet
>>
>>56599018
>muh standards
fuck you and your imperative shit style
>>
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?
>>
>>56601656
did you mix stdout with stderr or something?
>>
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
>>
>>56601837
ssh + screen/tmux (although not really needed) + vim
or use git

>>56601894
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?
>>
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.
>>
>>56601929
I'd rather not flood my github with worthless school assignments
Does vim have any testNG support?
>>
>>56601970
http://eclim.org/vim/java/unittests.html
Eclim does.
http://eclim.org/
Terminal-based java editing application. Supports Eclipse functions.
>>
>>56601860
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.
>>
>>56601970
>git
>github
m8, those are different things.

>>56602063
no idea then. without context, I can't understand shit, and I'm not very interested anyway...
>>
File: hacker.png (618KB, 1024x576px) Image search: [Google]
hacker.png
618KB, 1024x576px
>>56600942
>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.
>>
>>56602087
This was kind of a shit explanation, but the link is great if you want to do it in C++
>>
>>56602086
I'm not sure how I would use git without a git server somewhere
>>
File: 1458702927117.gif (402KB, 636x356px) Image search: [Google]
1458702927117.gif
402KB, 636x356px
>>56602087
>DirectX
>very object-oriented
>singleton
>>
>>56602102
>He doesn't have a home server
>laughinganime.jpg.exe
>>
>>56602132
:^ (
>>
>>56602087
>>56602105
Also
>recommending Rastertek aka "90% of what I write is premature abstraction OO masturbation"
>>
>>56601970
Just make a new account for this at the hoster of your choice or use a hoster which allows for private repos like gitlab
>>
>>56602105
desu, singletons are not inherently shit, it's all about the way they're used imo senpai
>>
>>56602187
>singletons are not inherently shit
(You)
>>
>>56602150
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.
>>
>>56602187
>global mutable state isn't inherently shit
>forcing there to be one of something isn't unnecessary 99% of the time
>>
>>56598686
Literally none of the people who answered gave you an actual answer. Just use py2exe or cx_Freeze
>>
>>56602208
>global mutable state isn't inherently shit
true
>forcing there to be one of something isn't unnecessary 99% of the time
generally not true
>>
>>56602233
I'm not sure you understand what greentext is.
>>
>>56602251
I do. In this case I'm pretty sure he's trying to be sarcastic. I'm pointing out how retarded he is.
>>
>>56602208
>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.
>>
>>56602266
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"?

>>56602277
???
>>
>>56602298
>As in you're saying
yes
>>
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.
>>
how do i prevent segfault
>>
>>56602298
>???

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.
>>
>>56602349
take computer, throw out of window
>>
Jeez, you guys suck at writing clearly.
>>
>>56602349
Rust
>>
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.
>>
>>56602367
>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...
>>
>>56602378
Header files.
>>
>>56602378
class Other;
class Something;

goes to the very top
>>
>>56602396
>
>>56602378
>>They're all in their own header/source files.
>>
>>56602390
Ironic jokes aren't jokes anymore?
>>
>>56602409
Are you saying you were pretending to be retarded?
>>
>>56602397
in which file?
>>
>>56602406
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.

>>56602431
A header file that contains the declarations of both.
>>
>>56602424
I guess so. Sue me.
>>
>>56602087
>This would also be a great time to make a class
What is never?
>>
File: 1473740816608.jpg (120KB, 720x493px) Image search: [Google]
1473740816608.jpg
120KB, 720x493px
>>56599048
"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!"
"Brouahgh!"
Interpreted languages.
>>
>>56602455
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.
>>
>>56602361
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.
>>
>>56602526
>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.
>>
>>56602568
It's not really global mutable state. Writes and reads don't interact. Also, you want it to only be accessible from one thread.
>>
who here learning go
>>
>>56602601
>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.
>>
>>56602526
>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.
>>
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?
>>
>>56602649
*couldn't use a little bit of etc.
>>
>>56602624
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.
>>
>>56602655
c++ is shite mate what do you expect?
>>
>>56602678
>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?
>>
>>56602655
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.
>>
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.
>>
>>56602649
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.

>>56602719
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.
>>
>>56602728

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.
>>
File: 1469919216439.jpg (184KB, 550x550px) Image search: [Google]
1469919216439.jpg
184KB, 550x550px
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?
>>
>>56602783
>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.
>>
>>56602852

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.
>>
How can I write in foreign languages in C++? It doesn't like using anything other than the Latin alphabet.
>>
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
>>
File: Lanka 5.png (154KB, 401x397px) Image search: [Google]
Lanka 5.png
154KB, 401x397px
>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
>>
>>56603078
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.
>>
File: ouloulou.jpg (43KB, 710x470px) Image search: [Google]
ouloulou.jpg
43KB, 710x470px
>>56601425
>LAMP
>>
File: 1446053607315.jpg (57KB, 544x708px) Image search: [Google]
1446053607315.jpg
57KB, 544x708px
>>56603090
Hakase?
>>
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
>>
File: 1473358631233.jpg (352KB, 1024x576px)
1473358631233.jpg
352KB, 1024x576px
>>56603176
>All the best of both java and webdev
>>
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.

http://stackoverflow.com/questions/6005076/building-glew-on-windows-with-mingw
>>
>>56603161
wot
>>
>>56603262
Are you a Hakase? (a professor)
>>
>>56603253

>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.
>>
File: spain-fs8.png (582B, 402x402px) Image search: [Google]
spain-fs8.png
582B, 402x402px
how to convert a webm to mp4, with the same quality?
>>
>>56603253
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.
>>
>>56603335
he is a game """"""""""""dev"""""""""""", of course

>>56603341
how is this related to /dpt/?
>>
File: 1398558668419.png (27KB, 640x480px) Image search: [Google]
1398558668419.png
27KB, 640x480px
>>56599252
>>
>>56599467
rollad
>>
>>56603361
wat language are u doing this in
>>
>>56603361
Are there going to be levels and loot and stuff?
>>
>>56603090
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.
>>
File: 1398596648600.gif (14KB, 243x298px) Image search: [Google]
1398596648600.gif
14KB, 243x298px
>>56603377
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.

>>56603394
You can think of it as GTA-ish.
>>
>>56603176
>slow and stupid
Sounds perfect for you.
>>
>>56603419
Was it free software?
>>
>>56603335
>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!

>>56603347
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.

>>56603359
>he is a game """"""""""""dev"""""""""""", of course
No way, real game devs use Unity or GameMaker.
>>
>>56603439
I have no idea.
>>
File: 1423246623700.jpg (63KB, 559x715px) Image search: [Google]
1423246623700.jpg
63KB, 559x715px
>>56603447
>it didn't work
>>
>>56603419
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.
>>
>>56603282
Nah, I'm just a lab assistant
>>
>>56603447
End your miserable life, it's for the best.
>>
>>56603341
you can't encode webm to mp4 losslessly. just set a really high bitrate
>>
>>56603501
>you can't encode webm to mp4 losslessly
False
>>
>>56603026
learn english, pajeet
>>
>>56603341
>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.
>>56603501
This is the stupid mans answer.
>>
>>56603521
prove it
right now

-codec copy doesnt work
-vcodec copy -acodec copy doesnt work
>>
>>56603361
kek
>>
>>56603464
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.
>>
>>56603548
>prove it
>right now
Simple logic

>-codec copy doesnt work
>-vcodec copy -acodec copy doesnt work
Are these ffmpeg options? irrelevant to the topic
>>
>>56603447
>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.
>>
File: hereyougo.gif (88KB, 10000x10000px) Image search: [Google]
hereyougo.gif
88KB, 10000x10000px
what ever happened to loli rape sim guy?
>>
>>56603583
>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.
>>
>>56603479
>End your miserable life
I tried, but it didn't work. That's when I decided to learn programming.

>>56603585
It said: undefined reference to imp_glewInit
>>
>>56603616
>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.
>>
>>56603616
>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.
>>
>>56603625
>>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.
>>
>>56603625
>it
>>
>>56603625
Why aren't you using GNU/Linux?
>>
>>56603635
>>56603626
>hasn't even used fucking ffmpeg
alright fuck right off
stop posting.
i dont want to read another word from you.
>>
>>56603608
frick you...!
>>
File: 1472174387732.png (115KB, 785x757px) Image search: [Google]
1472174387732.png
115KB, 785x757px
>>56603661
Never fucking reply to me again unless you are contributing to the thread.
>>
>>56603661
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?
>>
File: ProgrammingChallenges, 4.0 (HD).png (2MB, 3840x2160px) Image search: [Google]
ProgrammingChallenges, 4.0 (HD).png
2MB, 3840x2160px
>>56602655
Try practicing!
>>
>>56603661
>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.
>>
>>56598460
finish adding redirects (output) to my shell, write a small C lib for reading from files,
>>
File: 1460041140446.jpg (46KB, 960x398px) Image search: [Google]
1460041140446.jpg
46KB, 960x398px
>>56603705
roalling
>>
>>56602655
>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.
>>
File: 1454971302851.jpg (46KB, 344x291px) Image search: [Google]
1454971302851.jpg
46KB, 344x291px
>>56603682
>posts racist frogs on the internet
>>
>>56603708
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.
>>
File: wsqwfe.png (2MB, 1030x942px) Image search: [Google]
wsqwfe.png
2MB, 1030x942px
>>56603744
there is literally nothing wrong with racism
>>
File: Babby.jpg (53KB, 521x521px) Image search: [Google]
Babby.jpg
53KB, 521x521px
>>56603647
The full error code is:
>undefined reference to `_imp__glewInit@0'
>error: ld returned 1 exit status
>>
>>56603764
>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.
>>
>>56603764
>Making a script to encode videos can involve programming
"no"
>>
>>56603782
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.
>>
>>56603764
>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?
>>
File: 1270296945197.gif (2MB, 292x292px) Image search: [Google]
1270296945197.gif
2MB, 292x292px
>>56602510
>minified code
>human readable
are you just plain retarded or minified dumb ?

Please, get back to your fizzbuzz lessons.
>>
>>56603782
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?
>>
File: 1471393848488.png (151KB, 449x442px) Image search: [Google]
1471393848488.png
151KB, 449x442px
>>56603813
>spews insults and doesn't answer questions
>calls others unhelpful
>>
>>56603820
Webm(VP8/9) cannot be converted to mp4(H.264) losslessly. Nothing is to see here.
>>
File: 61D_hobbes.jpg (21KB, 200x225px) Image search: [Google]
61D_hobbes.jpg
21KB, 200x225px
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?
>>
>>56603882
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.
>>
>>56603914
And what is your reasoning for that? mp4(H.264) does support lossless encoding, meaning that you can transform losslessly
>>
>>56603914
>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?
>>
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.
>>
File: .png (1KB, 235x89px) Image search: [Google]
.png
1KB, 235x89px
I'm currently de-gendering my code so it will compile as both C and C++
>>
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

sharedPtr.func();


Should this be correct?
>>
>>56604066
Degenerate!
>>
>>56603090
you are joking, right? they don't know how to multiply and divide?
>>
>>56603982
Building Java Programs is a good first book
http://www.buildingjavaprograms.com/
>>
>>56604066
Don't waste your time.
Don't write C++.
>>
>>56603931
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
>>
>>56604066
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.
>>
>>56604125
>intermediate representation (read: objects)
>objects
Rude to presume he's retarded.
>>
>>56604099
IT'S TOO LATE C++ ONLY NOW IOSTREAMS EVERYWHERE STDS EVERYWHERE

>>56604136
nah, it's fine
>>
What are your thoughts on Scala? It looks pretty neat to me.
>>
>>56603914
BTFO
>>
File: perseus-black-hole_1140_600x450.jpg (40KB, 435x580px) Image search: [Google]
perseus-black-hole_1140_600x450.jpg
40KB, 435x580px
>>56604096
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?
>>
>>56604172
https://www.youtube.com/watch?v=hzf3hTUKk8U
The talk should really be titled "Scala Is Terrible".
>>
>>56604149
#define condom namespace std
using condom;
>>
>>56602783
>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.
>>
>>56604094
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.
>>
File: 1445239516689.jpg (37KB, 636x358px)
1445239516689.jpg
37KB, 636x358px
>>56598686
py2exe

I used it for a keylogger I made for a friend long time ago, works fine
>>
>>56604201
>loggers
Side effects aren't observable.

>application config objects
Immutable.
>>
>>56604244
>implying configuration cannnot be changed at runtime
>implying logging has no observable impact on your application
>>
>>56598686
cx_freeze is good. Simple.
>>
>>56604297
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.
>>
>>56604136
>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.
>>
>>56604220
ah, ok, I misunderstood
>>
>>56604244
>Side effects aren't observable.
yes they are. depends on the logger.
>>
>>56604378
Sounds like a shitty logger if it has side effects that prevent it from being used mostly globally.
>>
>>56604361
The worst of both worlds is the best choice. You'll get addicted to a language and overdose or worse
>>
>>56604385
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.
>>
>>56604389
>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.
>>
>>56604406
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.
>>
>>56604385
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.
>>
>>56604433
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.
>>
>>56604361
(You)
>>
>>56599467
rolling [spoiler] to do it in java[/spoiler]
>>
>>56604490

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.
>>
>>56604565
>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.
>>
>>56604601

So basically, you're saying it, but not in the exact way I suggested.
>>
>>56604616
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.
>>
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]
b

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)
k
>>
>>56604180
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)
>>
>>56604536
[spoiler] spoilers don't work on /g/ [/spoiler]

Have fun creating a static website generator
>>
>>56604429
>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#.
>>
>>56604673
We weren't talking about it.
>>
>>56604665
yeah, im pretty fucked
>>
>>56604689
we were talking about mutable globals being useful sometimes. System.Console being an example.
>>
>>56604627
Linus please gtfo.
>>
>>56604627
they're all garbage bro
just like you are anon-kun
maybe kys
>>
>>56604740
Go home, bald Danish man.
>>
>>56604736
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.
>>
>>56604630
What language?
>>
>>56604773
if you say so. It's still a completely legitimate use of mutable globals.
>>
>>56604797
Not really, it's using a global for convenience while pretending that there aren't associated issues with doing so.
>>
>>56604815
>pretending that there aren't associated issues with doing so.
What makes you think that?
>>
>>56604785
http://fsharp.org/
>>
>>56604828
The fact that you're dismissing the reasons for making it not completely global?
>>
>>56598460
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?
>>
>>56604627

So what is your preferred language?
>>
File: samelevel.jpg (58KB, 960x720px) Image search: [Google]
samelevel.jpg
58KB, 960x720px
New thread >>56604862
>>
>>56604875
That image is completely retarded.
>>
>>56604844
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.
>>
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.
>>
File: 1462917638532.png (182KB, 481x511px) Image search: [Google]
1462917638532.png
182KB, 481x511px
>>56605494
still has the same hang time as java,
if you like lisp just use another flavor, clojure is the worst lisp out there.
Thread posts: 347
Thread images: 52


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.