[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]

the dumbest programing questions!

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: 197
Thread images: 13

File: tumblr_m9qxcrlhJt1r0i7yjo2_500.gif (769KB, 500x275px) Image search: [Google]
tumblr_m9qxcrlhJt1r0i7yjo2_500.gif
769KB, 500x275px
ITT: post the dumbest questions you were afraid to ask before.

>anon nobody will judge you (recessive genes, worthless, slump)
>>
why has no one written a program that writes improved versions of itself?
>>
>>42362486
how do I creat a gtk app from c++ app?
>>
Are free versions of video game engines worth it? How about a engine with source provided? What if I can't even code so that makes the source useless for me?
>>
>>42362486
what about compiling gcc with -O4?
>>
>>42362686
it would only improve once and then it would not get any faster the second time
>>
Why is using a pimpl in every C++ class a bad idea?
>>
What does -O1, -O2, -O3 or whatever mean in GCC?
I don't get it

Also, how do I learn C++? There's like 16 flavours of it apparently? Why does netbeans put Cand C++ in the same catagory?
>>
>>42362476
Where is Dwight?
>>
>>42362686
>>42362716
gcc actually compiles itself 4 times. (Once with old compiler, then with the new-made-with-old compiler, then two copies with the new-with-new compiler. It then diffs the two final versions to check for errors between them).
>>
>>42362486
Proven to be impossible, but fuck if I can remember the original theorem, so you'll have to take my word for it.
>>
>>42362739
>16 flavours
What? No. there's c++98 and c++11.

-Ox is the optoimization level.
-O0 is no optimizations.
-O1 is optimizations that are ALWAYS safe.
-O2 is the 'standard' level.
-O3 and -O4 are increasing speed, but will make debugging hard to impossible, bloat executable size, and may even produce slower code (due to the larger executable).
-Ofast is FUCK THE STANDARDS, GIVE ME SPEED! It starts making assumptions that may not be true.
-Og is very new and means "give me the best settings for debugging", it's somewhere between -O0 and -O2 (but not equivlent to -O1).
>>
Why actor model gets so much attention lately?
>>
Everywhere I look people talk about design patterns, where do I go to learn them and are they necessary for large projects?
>>
Some things can be loaded into ram, right? Like when you boot up puppy linux, or some other similar distro then take the usb out, you can still be running that distro. So all the files are loaded into ram. Say if I'm watching a video then delete that file, It still plays because its in ram right? Is there a way to take a file that is loaded into ram, and make a copy of it onto your hard drive?
>>
>>42363165
Shit is in ram as long as it is running. You can't delete a video that is currently being played.
>>
File: recessivejeans.webm (334KB, 720x576px)
recessivejeans.webm
334KB, 720x576px
>>42362476
>pic related to this thread
>>
>>42363177
rm -rf * says differently
>>
>>42363165
Yes.
Possibly (depending on size, amount of ram in use by other programs, and the OS's policy).
Theoretically (in reality, no).
>>
>>42362739
quick not exhasutive
http://www.cplusplus.com/doc/tutorial/

this is very short you can read this in a day
>>
>>42363194
So it's possible, but there is no tool for this?
>>
>>42362985
I work with Java on a quite huge project and i can say that design pattern knowledge is a must.

I haven't read any particular book about them, mostly separate articles about particular pattern, but i plan to read in future: HEAD FIRST DESIGN PATTERNS (as an intro book) and then classical DESIGN PATTERNS by gang of four.
>>
>>42362791
And -Os, which optimises for space rather than execution speed. It uses all that -O2 options that shouldn't increase the code size, as well as some additional space-saving optimisations.
>>
>>42363209
Of course it is possible iff the whole file was mapped in (which depends on the size of the file, the amount of ram in use, and the OS's caching/paging policy).

Trivial proof: Assuming the whole file is mapped into the process, take a physical ram dump, rebuild the video players virtual memory map, dump the file from that.

Of course, it's probabally not possible, since most of the video won't be mapped into the proccess' space, if it's even mapped at all in the OS cache.
>>
Does learning a language get easier? I feel like it's one of those things where starting out is really hard but once you get past that point it's just a matter of refining what you know
>>
How do people make games with graphics? I can't grasp the concept of it.

What do they connect to each other in a language? It just fucks my brain so hard, considering the only things I've done are some webdesign and C#.

Like, everything moves and shit
>>
>>42362985
>>42363216

I'm no expert so take my comment with a grain of salt but I've found Head First Design Patterns to be very easy to read and remember. Haven't applied any patterns yet as I'm still only a novice
>>
>>42363246
Many ways. You can use a library, like SFML or SDL, or go hardcore and use WinAPI / libX11. Then there's the choice of software drawing or using DirectX / OpenGL.

In the game, you obviously have a main loop, which (assuming single player) consists simply of processing input, doing all the calculations (moving everything, applying damage, blah blah), and at the end you draw the frame and send it to the screen.
>>
>>42363284
so all this is calculated and drawn in 1/24th of a second? just how fast are those computers?

can you creat a 3D game only with c++ ithout using any engines or other stuff peopel before you created?
>>
>>42363244
That's how it was for me and I hear it is for others as well. It's all about experience, it will be hard learning any language at first but once you do it's just about how much time you put into the language. You'll get better with more time and learning new languages will be easier after learning your first (it's all just syntax after that).
>>
>>42363308
>>42363244

I'm still a beginner but I can say learning languages get easier if you move into languages that are similar. I started with C# and learnt about Object Oriented design and that sort of thing which has made learning Ruby, JavaScript and Java pretty easy. I imagine moving to C might be a little harder because of some things I haven't had to do, like memory management or dealing with pointers and shit. It still wouldn't be as hard as learning a first language because you already have a lot of transferable skills already learnt.
>>
A new programming language
- fast as C
- safe as Haskell
- elegant as Python

Why has nobody done this? Every time some new programming language is released it is either slow, unsafe, or has an alien syntax. D came close to perfection, but then they tainted it with GC. They claim the GC is "optional", but there is no simple compiler flag to disable it. You just have to "know" that your code doesn't do anything to accidentally invoke it.

I realize that some of these things contradict one another. For example, a safety feature like bounds checking is going to be slower than the unsafe array access like C has. But what the language could do is allow optional bounds checking. There are several ways of implementing it. One idea might be an Array type with no bounds checking and a List type that does do it. Another could be a code attribute, like @unsafe. A third option is a compiler flag. I don't really care how they do it, but give the option.

Rust looks interesting, but I'm not sure if the GC is really optional like they say, or if it is "optional" like it is in D.
>>
>>42362791
What are some good "general" flags that you should provide gcc?
>>
>>42363305
Yeah, computers are fast like fuark. If you grab some old games (eg. the original X-COM), computers back then were quite slow, so they used a bit different approach - they drew an image to the screen, and then tried to redraw only as much, as needed. So when you moved a unit, the game would only draw the unit in it's new position and redraw the background where the unit used to be.

But since computers got faster over time, no one really does this anymore. Most of the time, double buffering is used. Which means you have two "display surfaces" - one is displayed, the other one is hidden. Every frame, those 60+ times per second, you draw everything from scratch on the "hidden" buffers, and then flip them - sending the new content to the screen, and taking the old content to redraw next frame there.
>>
>>42363341
-Wall
>>
>>42363334
the GC in rust is in a separated library and it's not used in the std lib (and will never be used in all the std library).
>>
>>42363334
Can you tell me what you like about D and Rust setting aside the GC. I wanted to learn one of these newer languages but I don't want to waste time learning one that I may never use. D seems like something I'd use but I'm afraid to learn it while it's still seemingly in development. Also why is GC bad?
>>
>>42363341
The absolute minimum for non-retard coding are:
-Wall
-std=c89
-pedantic

The std flag takes an argument like c89, c99 or c++11. Use whichever is applicable to you. Additional arguments that are a good idea are:
-Wtraditional
-Wshadow
-Wpointer-arith
-Wcast-qual
-Wcast-align
-Wstrict-prototypes
-Wmissing-prototypes
-Wconversion

And before anyone thinks I'm talking out my ass, these are the flags used by the Jet Propulsion Laboratory (JPL). You know, those guys who landed a fucking robot on Mars. They had to ensure their code was correct because you don't get a second chance with that kind of shit.

Citation: See page 8 of
http://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf
>>
>>42363376
I already use that :) Anything else?
>>
>>42363364
Would it be worth using the old update method on certain types of applications like 2D things? What's the advantage of double buffering?
>>
>>42363386
ah thanks very much, currently using wall and std=c++11. thanks for the tips I'll read about those flags.
>>
>>42363386
Would you advise using c++11? Or should every1 stick to the default c89?
>>
>>42363399
With double buffering, you have a separate "surface" for what is displayed on the screen, and a separate one that you can draw the next frame on. You only swap the buffers and send the next frame to the display when it's ready. When using only a single buffer, you risk having data sent to the screen somewhen in the middle of drawing the frame.

Using the old method could increase the speed if you're doing software rendering - since you're changing less pixels, you save on the time of overdraw. The question would be how much speed you can save vs. how much hassle implementing this would bring. But this is mostly for software rendering; I don't think there would be much change if you were drawing via hardware.
>>
>>42363453
Thanks for the explanation, Anon
>>
>>42363385
>Can you tell me what you like about D and Rust
They have strong, static typing. They are compiled to native code without bloated VM garbage. They have language features that allow for the most errors possible to be caught at compile time instead of run time. They have concurrency. There are a lot more reasons, but these are some big ones.
>I wanted to learn one of these newer languages but I don't want to waste time learning one that I may never use
Learning is never a waste of time. And if you don't use it, big deal. You can still have some fun during the learning process.
>D seems like something I'd use but I'm afraid to learn it while it's still seemingly in development
D is stable now. Changes made should be minimal and not program-breaking. New development consists of improving the compiler and adding backwards compatible features. You can safely learn D and your code will work well into the future. Rust is still under development, so I can't say the same thing for it, but D is stable.
>why is GC bad?
It's not always bad. There are many applications where GC is awesome. It saves time having to fuck with manual memory management. But, it has a performance cost. While GC is great for some things, it's terrible for high performance applications or things which need low latency like video games. So don't think I'm saying GC is universally bad. It's just bad for some applications. The type of applications where GC is acceptable have no shortage of language options. You have dozens of languages to choose from and more seem to come out every year. But if one is writing an application where you don't want a GC, then your options are pitiful. You have C and C++. There are a few other non-mainstream languages too, but if you want any chance of finding libraries, then C and C++ are pretty much it. The non-GC application space desperately needs better options and only recently have they started getting some.
>>
>>42363468
Good to know, it seems like I'll be making an attempt to learn D the next time I have time and maybe Rust when it hits stable. Thanks!
>>
>>42363448
The question doesn't make much sense. C and C++ are different languages. If you are using C++, then go with C++11. If you are using C, then you could use either C89 or C99. The additional features of C99 are very meh.

Also, C89 isn't the default. GCC's default is the GNU dialect which includes a lot of non-standard language extensions.
>>
>>42363526
Oh damn sorry, I totally misinterpreted the std=c89 part, I was assuming, the manual was talking about c++ in particular.
>>
>>42363284
>>42363364
>>42363453
Thanks man, much appreciated.
>>
>>42363561
What I wanted to ask was,
Are there any particular reasons why I should choose c++89 or c++03 over the c++11 standard? And I'm assuming its preferable to not use the gnu option? I'm quite new & interested in c++ but we don't really learn about this in school... only java & webshit.
>>
>>42363609
no go with the new shit
soon there is gonna be c++14 switch over to that as soon as possible

ten years form now people will barely use c++14 so in order to have a future adapt now!
>>
>>42363631
well its already 16 years ago since the c++89 standard was made and its still the default? Why would this be? Btw thanks for answering my questions.
>>
>>42363609
>Are there any particular reasons why I should choose c++89 or c++03 over the c++11 standard?
Small correction. One of the C standards is C89, but it is C++98 for C++. There is no C++89. In general you should choose the newest standard unless you are working on a legacy codebase, or there is something you really dislike about the new standard and have some particular reason to avoid it. I say go with C++11.
>And I'm assuming its preferable to not use the gnu option?
Yes; at least in my opinion. The GNU dialect is only compatible with GCC and Clang (because Clang aims for GNU compatibility). It will fail with all other compilers.
>we don't really learn about this in school... only java & webshit.
Yup. Same situation here. I felt scammed. Everyone told me I had to go to university or I wouldn't know anything and would be a failure at life, etc. Holy fuck, what a fucking scam. I learned nothing I hadn't already read in books years earlier when I learned on my own. Not only is university a gigantic waste of time and money that scams people, but it's the fact that they've got 99% of the population supporting their bullshit and telling everyone that you MUST go to university to get a job and you MUST go to not be considered a failure at life. That is some fucked up shit right there.
>>
>>42363165
on windows, when you do a memory dump of a process using the task manager, times you can find parts of the streamed file
but then you will have to deal with those fragmented parts, you can't really know/guess which part is/goes where
finally better to hook the process and dump on the fly
>>
>>42363701
Hey man thanks a bunch, and I'm feeling you about university teaching the wrong stuff, Its like they only want to educate people into website making codemonkeys and not people who understand computing. But I'm sure that without university I wouldn't have understood so much or be motivated to learn stuff on my own so I'm not entirely ungrateful.
>>
>>42363282
Yes. I think it's a good book, though many "elite" programmers don't take it seriously.

Keep your head high, everyone has to start somewhere!
>>
>>42363179
>"elite" programmers
>>
>>42363305
most of the times displays can show 60 image ever second (60hz refresh) (there are better monitors with higher refresh rates)
and you have a technology called VSync, this makes sure the application isn't showing more frames then your monitor can handle

with vSync of games can show up to unlimited fps if you have a good graphics card and CPU the number will be very high and the amount of calculation and drawing is done in 1/X second (X being the number of FPS)

it's all quite fast..
>>
>>42364443
vsync OFF*
>>
>>42362476
How to convert a class instance into a class that inherits from the first class's instance? Do I need an adapter function or something?
>>
>>42362555

Either using the C API or with GTKmm.

GTKmm was actually a pretty nice C++ API last I checked it. Only problem was the lacking documentation and occasional missing feature.
>>
I always wondered what are the different compilers of C and why are they different.

Thne i wondered what is the C# compiler, can i run C# code anywhere other than my Visual Studio?

Now I am wondering if learning asp.net was a mistake.

All these are so lame that i never bothered to ask.
>>
I studied multimedia at university and picked up programming along the way, however I have no formal computer science education.

That is to say, I know the basics of C, C#, Java, Python, Javascript and a few other languages, but I have no idea how to effectively break down a problem into manageable pieces and rationalise an efficient solution to each part. Where can I learn the skills necessary to do this? There are so many 'learn language X' courses, but virtually no 'learn how to write a well structured program' courses.

What do I do?
>>
>>42365041
This isn't an answer but have you read, for example, Software Tools by Kernighan?
there are other books like this in general and for specific languages
>>
>>42364962
>I always wondered what are the different compilers of C and why are they different.

The current big three C compilers are GCC, Clang+LLVM, and Microsoft's Visual C++. There's also Intel's ICC.

GCC and Clang are open source (GPL and BSD respectively) GCC is the classic open source compiler which is used heavily in the Linux world. It's also the compiler used for compiling the Linux kernel. Clang is sort of a newcomer heavily pushed by Apple. It's based on the llvm compiler toolchain and a bit more modular than GCC. It's now the major compiler for OS X and iOS programs and is quickly gaining ground on Linux and *BSD.

MSVC is the compiler Microsoft ships with Visual Studio. It's not bad, but it takes a really long time to compile. It only targets Microsoft platforms.

Intel's C compiler is the best optimizing compiler out there. Many games and engines use it. The only problem with that is that it introduces CPU vendor checks that only execute the optimized code paths when an Intel CPU is used.
>>
>>42365073
I work in web development, so my experience is mostly with high level languages and oodles of libraries which do all the heavy lifting for me. I would like to learn from the bottom up, if you follow.

I suppose what I really need is first of all a crash course on the entire stack, from hardware to assembly to OS to software (or however it goes) and then a thorough meta-programming book on how to break problems down. I know how to implement good code in the languages I've learnt, it's when I get to systems with large numbers of objects and asynchronous processes I find myself lost. It's down to planning, I'm sure.
>>
>>42362931
Because it's less shitty to work with than shared memory.
>>42363165
>Say if I'm watching a video then delete that file, It still plays because its in ram right? Is there a way to take a file that is loaded into ram, and make a copy of it onto your hard drive?
Deleting a file from Linux removes it from the directory immediately (so you can't see it any more), but if the file is open somewhere, the data will actually stay on disk until the file is closed. If you manage to find a process with the file open, you can look in /proc/<process id>/fds and extract the file contents from there.

>>42364962
>Thne i wondered what is the C# compiler, can i run C# code anywhere other than my Visual Studio?
There's Mono, which is a cross-platform .NET runtime, but apparently it's slow and has poor library support. But if you really want to do cross-platform development in C#, you could try targeting that.

>>42365041
>I have no idea how to effectively break down a problem into manageable pieces and rationalise an efficient solution to each part. Where can I learn the skills necessary to do this? There are so many 'learn language X' courses, but virtually no 'learn how to write a well structured program' courses.
This is what software engineering courses are about. You could try finding video lectures online or something.
>>
Anyone using OmniSharp?
>>
>>42365041
Here

>>42365073
>>42365325

Do you think this book would be a good place to start?
http://www.amazon.co.uk/dp/0735619670
>>
If I wanted to learn to make apps. What language should I pick up? Does it matter the type of phone (android, iPhone)
>>
What's a good book for someone who wants to learn C++? I have prior experience in java, if it makes a difference.
>>
>>42365610
Bjarne's book
>>
>>42364962
>Thne i wondered what is the C# compiler, can i run C# code anywhere other than my Visual Studio?
Yes, C#'s compiler is csc.exe, located in C:\Windows\Microsoft.NET\Framework\v4.0.30319.
>Now I am wondering if learning asp.net was a mistake.
Nope, ASP.NET is great.
>>
>>42365135
>ICC
best optimizing for Intel CPUs or for any x86/x86-64 CPU?
>>
why can't linux run windows applications although both OSes run on same processor architecture?
>>
How can I call a function inside a python script from the command line?
I know it's possible using "python -c 'imports script; print script.function()'" but I want to call it like "./script.py function".
>>
>>42365621
bjrarne's book is absolutely terrible unless you can stand reading someone's book whose mind numbingly boring personality and method of teaching is reflected upon in the book.

That guy probably watches flies fuck for fun in his spare time.

Don't get me wrong, I've skimmed the book and there is a lot of info in it, it's just presented in the most boring way possible and will put off anyone new wishing to learn.
>>
I want to master bash. How do i go on about doing that?
>>
File: output.webm (124KB, 500x275px)
output.webm
124KB, 500x275px
>>42362476
>gif
>>
>>42368032
Why do you want to master bash?
>>
>>42368032

> use bash
> write scripts in it

Personally I've found the margin between the point where I can be bothered to automate something in bash and the point where I switch to a full blown scripting language like Python to be rather slim.
>>
>>42367937
I'm no python wizard, but in almost every language, there's a system variable/array containing commandline args.
You take that array, do a case statement based on what's in the array, and have it call/jump to the appropriate function/subroutine
>>
>>42367937

I don't think Python really exposes something like that.

You can always write a quick shell-script to do that for you.
>>
>>42368103
Thanks for the reply, but that's what I'm doing right now and it seems horribly hacky. Is this really the proper way to do this? Surely there's a better way.
>>
File: 1402083673893.jpg (28KB, 640x480px) Image search: [Google]
1402083673893.jpg
28KB, 640x480px
>>42363305
Using OpenGL, there is a main loop, which is a while loop if you use C, and this loop will contain a call to swapbuffers() which switches the places of the backbuffer and the framebuffer thus displaying the previously hidden buffer and hiding the framebuffer that was just drawn to the screen.
This loop iterates as fast as the computer can iterate it, however if you have vsync enabled then the call to swapbuffers() will wait for the GPU to sync with the monitor and doesn't return until this is done, so at best the loop will iterate as fast as the monitor refreshes.
Inside of the aforementioned main loop are also functions that manipulate the models/meshes by use of matrices and vectors, however (and amusingly so) the computer will execute these functions as fast as the main loop will iterate, which is pretty fast, and that being so, it makes it impossible to do translations such as in a FPS where you can look around in first person because the sensitivity will be too damn high (in fact you will turn 360 degrees in an instant), and that's why most of these things are done by using a permutation of the system clock which is accessed by glfwGetTime() if you use GLFW (and you should), which ultimately gets the current time from a crystal oscillator on the inside of your computer.
>>
>>42368162
yeah, they're called arguments
>>
>>42368187
glfwSwapBuffers() I mean.
>>
>>42368198
I already use getopt but it didn't seem to work the way I described. Maybe I'm missing something?
>>
>>42367860
Intel only unfortunately.
>>
Can't find a real dumb-question thread, so bear with me for using this one.

I'm currently on a Radeon HD 4870 and would like to upgrade little money (below 200 €, unless there is a really great deal around 250 €).

A GeForce GTX 750 Ti looks nice and will probably save me quite a bit of power (which is quite important at 25 ct/kWh), but I'm afraid it doesn't deliver enough performance to be worth upgrading. I couldn't find any benchmarks that tested the HD 4870 and the GTX 750 Ti under the same circumstances. What do you think?
>>
>>42368352
>Can't find a real dumb-question thread

>>42366759
>>42367749
>>
>>42368001
I actually liked stehpen prata books are they any good?
>>
>>42368386
Thank you. Will post there. Please ignore my above post.
>>
>>42368240
I've had shitty experiences with getopt in the past as well when I used to write python.

Maybe try this?
https://docs.python.org/2/library/argparse.html
>>
>>42368416
> 15.4.5.1. Sub-commands
> Many programs split up their functionality into a number of sub-commands, for example, the svn program can invoke sub-commands like svn checkout, svn update, and svn commit.
Sounds like what I'm looking for, thanks!
>>
>>42368352
Let me answer the implied question here. The link you're looking for is called catalog and resides around the top of the page.
>>
What do prepared statements have over this?
>>
>>42368615
Speed and elegance.
>>
File: 1400552579688.gif (431KB, 500x281px) Image search: [Google]
1400552579688.gif
431KB, 500x281px
>>42362476
>Implying every /g/ post isn't dum
>>
File: 1328269995610.jpg (72KB, 662x593px) Image search: [Google]
1328269995610.jpg
72KB, 662x593px
what the fuck is an hashtable? i know what's an hashmap.
>>
>>42362686
anything beyond -O3 does nothing
you can use -Ofast though
>>
how do i map() over dictionary in python efficiently?
i thought to do this
bar = dict(zip(foo, map(lambda i: foo[i]*foo[i], foo)))

but it feels wrong
>>
>>42370576

It's mostly the same thing. A hashmap is a map that is implemented using a hashtable.
>>
File: We just don't know.gif (999KB, 250x251px) Image search: [Google]
We just don't know.gif
999KB, 250x251px
How the fuck do I actually code? Not like writing code, but actually putting things together the way I want them? I know how to write code, but every time I think of something to do, no matter how simple or complex, I can't fucking reason my way to a conclusion.

It doesn't feel like problem solving, either: problem solving gives me a problem to solve, programming is working backwards from solution to problem and back again, and it makes my mind turn to fucking mush.

It's not imperative that I know, I already switched away from CS as a major, I'm just curious if anyone can give some insight, maybe I can pursue it as a hobby.
>>
>>42370576
I went over your post and I was deeply thinking about things, and you gave me one damned good idea.

And to that I'll try to answer your question.

A Hashtable is a data structure similar to an array (And it is, to some sort). To access the data, the "key" is hashed into an integer, which determines which element of the array will be chosen to access the value.
The point of the hashtable is to access data "faster", to the cost of more memory used.
Keys are hashed with any algorithm the implemeter wants, there are a few common ones. Basically, take in consideration that you want to fill the table evenly, so most keys should give you a different hash.
When two different keys give the same hash, that's called a "collision", and it can be solved by either making a bigger hashtable, or having multiple values in the hashtable. Some C implementations have pointers to linked lists so that any amount of values can be stored.
Anyways, less collision means good hash algorithm.

I think I said most of it.
>>
>>42363334
>- elegant as Python
I swear to fuck if you put list comprehensions in there I'll kill you.

Yes this is a written threat.
>>
>>42370775
I had that problem a while ago, comes with training and thinking. Mostly training.
>>
>>42370775
It isn't easy. Lots of code gets rewritten and refactored because it didn't go right the first time.

If you're writing software to solve problems you've never tackled before, you will end up rewriting parts at some point, no matter how well you designed it.

Mostly I think you just have to get better at it, like with all things.
>>
>>42370969
the lispy part of python needs to go, its shit.
>>
File: 1402150991646.png (104KB, 320x287px) Image search: [Google]
1402150991646.png
104KB, 320x287px
>>42370976
>>42370982
No see, that's the thing. I can't even get to the part where it needs to be refactored, nor can I train myself to think like that. I can think in pseudocode, but I can't put two and two together and put my thoughts into code. There is no training or refactoring, I just stare at the open file mindlessly.

I can follow tutorials online and make perfect sense of what they're saying.
I can sit down and read someone else's code base and (to some extent) make sense of what they did and why.
But I cannot, for the fucking life of me, write original code beyond a basic level. And I don't want to participate in something (as a hobby) if all I'm going to do is plagiarize tutorials and others' code.

That's what kills me the most: I get the underpinnings of it, it's just putting thoughts to code that shuts my brain down faster than an old person seeing Windows 8.
>>
>>42371048
Use a pen and put your idea on paper, then you try to break that idea down more and more to a poitn where it's just bits of idea that you could put into code.
>>
How the fuck do I install KDE 5 on Arch?
>>
What books would you recommend for learning java?
>>
>>42370969
>list comprehensions
http://xahlee.info/comp/list_comprehension.html
>>
>>42363177
Your an idiot.
>>
Is it relatively easy to setup your own email server?

I'm building a server which will be on 24/7 and I want to create my own email server. I also want to run a Tor relay on it.
>>
I'm testing something, respond to this please.
>>
>>42371835
ur gay
>>
>Why is the JVM so bad

If you ever asked the same question, you're a piece of shit.
>>
>>42368615
Your code doesn't look as 3rd grade as that if you use prepared statements.
>>
>>42371048
You are expecting too much of your code, you want it to be perfect so you think hard about -what- you should write to bring your idea to life, but you are not actually thinking, you are thinking about thinking.
You can understand but you are not staying mentally involved, you are not taking the mental initiative, you are not maintaining the offensive mentality.
You just need to start writing shit; when I start most of my projects I just start hammin out bullshit code but you see it is this initial process that allows me the crucial opening I need to maintain concentration.
Plan it out, but for the love of god just get in there.

A concrete example:
I was trying to make a program that prints a triangle of a specified size on the command line, I was using C, so I just sat down,
#include <stdio>
and int main and all that shit then I just wrote the first shit that entered my mind, which was a for loop, and that little illusion of progress, the simple act of typing the damned loop, was enough to keep me going.
>>
>>42372016
>>42371102
I think I understand. I'll give it one more try for you, Anons. Thanks for the help.
>>
>>42362476
How the fuck do I learn Objective C / Cocoa without ripping my face off in annoyance?

    NSString *this = @"AAHHHHHHH!"
NSString *stupidity = [this:@" Jesus fuck how horrifying"]
>>
>>42372197
And I fucked that up.
  NSString *stupidity = [this StringByAppendingString:@" Jesus fuck how horrifying"]
>>
>>42372197
That's literally why Apple created Swift.
New slogan: "Swift may be [expletive], but at least it's not Objective C!"
>>
>>42372220
Yeah, but Swift is basically unusable right now. XCode dies if you look at it funny. And there are literally no guides that explain how2cocoa.
>>
Why do people always claim that it's better to learn C before c++
>>
>>42372252
j co a utte icpoy nabugau. abe cy aanot bcj. yt rbt, ab TTZ tpc.by.e nabugau. cb aeecyctbb maöx. ci ötg hae n.apb.e j abe j// ötg mgcuhy x. axn. yt e.jpözy yhco xgy c etgxy cy
>>
Please help me get started on making Android apps/games. Are there any tutorials/resources you (or the internet sources you've read) trust and can recommend to start making apps quickly? I have Java/C 101 knowledge. Thank you in advance.
>>
>>42372197
If you are getting this butthurt about syntax you probably do not have the mind for programming in general. Perhaps video games would be a better hobby.
>>
>>42365325
>>42365135
>>42365720

I appreciate all the answers. Thank You.
>>
>>42372252
learning C after C++ is like a step back.
>>
>>42363341
-Wconversion
-Wsign-conversion
>>
is c# really the industry standard for indie games?
>>
>>42376221
no
>>
>>42376223
thanks for elaborate answer
>>
>>42376245
always glad to answer an uneducated question
>>
>>42363691
> 1989
> 16 years
>>
File: some code.png (191KB, 1026x768px) Image search: [Google]
some code.png
191KB, 1026x768px
>>42376221
Yes it is for indie devs. It's easy to use, lots of documentation and examples online. It's fast too, except for the shitty garbage collection trying to free unused memory, but that an be avoided by simply pooling objects.

Source: Myself

Developing a mario style game for Android in C#, good FPS all the time from 40-60, and I have a low/med-end mobile (Xperia Neo L), so that would be 60FPS typically on an average/high end Android mob
Image: Left sidebar, all my scripts so far
>>
>>42362486
Alan Turing proved this impossible in his proof for the halting problem
>>
>>42362476
Why is it that people are still using Python 2.X instead of Python 3.X? Is it performance or what?
>>
>>42376816
>Developing a mario style game for Android in C#

aren't you supposed to be using Java if you're making a game for android?
>>
>>42376874
Because some libraries still don't have Python 3 versions, and because sometimes porting a Python 2 project to Python 3 is not possible exclusively using 2to3.py.
>>
>>42376930
You don't need to. There's the NDK (Native Development Kit) for android, which can run native, compiled code, and doesn't rely on Java.
>>
>>42376862
No he proved it's impossible in 100% of cases. i.e. a program can't improve itself from every possible starting state. Limited self-improvement has already been programmed, look at how Windows 8 makes itself more efficient over time.

Iterative complete self improvement is fucking hard, and making it only improve in desirable ways has never been proven to be possible.
>>
Why is Java so inefficient in practice?
>>
>>42363334
You can use compiler and explicit program features to make C as safe as you like. People choose not to make that tradeoff
>>
>>42376930
Since Android supports both JAVA and C#. Clearly you want the most fastest language when dealing with games esp on mobile platforms.
>>
>>42377066
>most fastest
>>
>>42377066
so C# is faster than java on mobile platforms? i didn't know that

actually , i always thought it depends on the quality of code, sloppy code means slower performace
>>
>>42377096
Well you were wrong faggot.
>>
>>42377136
i was asking seriously man, i would like honest answer
>>
>>42377066
Since when does Android support C#?
They implemented a bridge between Java and C(++) which allows you to run compiled C++ from a Java program (with massive overhead while starting)
>>
>>42377096
Obviously adequate programming skills are needed.
But even with average programming skills in either JAVA or C#, your gonna get faster performance using C#.

I thought this common knowledge amongst /g/
Don't you lot spout JAVA is slow and shit 24/7, hence clearly C# the proprietary M$ owned language is gonna be more powerful.
>>
>>42377007

It isn't.
>>
>>42363385
>Also why is GC bad?
It makes behaviour non-deterministic as there is no guaranty how long the GC will work.
>>42363386
>>42363388
-Wextra
>>
>>42379008
At least for tracing garbage collection. Reference counting garbage collection comes with a constant overhead and other problems.
>>
>>42377157
It's more like C# supports Android. Xamarin.
>>
>>42362486
Depends on your criterion for improvement.
There are a lot of research programs that generate populations of programs and evolve them to do some useful thing (e.g. predict some process).
There are even programs that generate generators of programs and evolve them:
http://wiki.opencog.org/w/MOSES_algorithm
You van read more at http://www.idsia.ch/~juergen/geneticprogramming.html
>self-improving, metalearning GP approach that recursively applies metalevel GP (first introduced here) to the task of finding better program- modifying programs on lower levels. The goal was to use GP for improving GP
Also note that while this methods can generate interesting results they are just variants of random search.
>>42376862 It depends on criterion for improvement. If we don't require our program to generate provably more optimal programs then suboptimal candidates and GP approach are OK.
>>
Any linux kernel or software developer here? What is the best way to learn about the internals of Linux ?
>>
>>42363246
There is a common pattern in design of games: there is an abstract representation of game's objects (your hero has a x and y coordinates for example), the code that advances these object's state in time (e.g. moves your hero with constant speed which means just add some number to x and y coordinates) and then there is an actual code that draws game's objects on the screen.
You should understand how to represent every object in your game with numbers if you want to create one.
>>
For the life of me, I cannot get this bumblefuck of dependency errors to build: https://github.com/archrival/Subsonic-Android All I want to do is hack in some proper self-signed certificate validation. If anyone could point me in the right direction, I'd appreciate it
>>
>>42362486
Genetic algorithms
>>
>>42365041
>but virtually no 'learn how to write a well structured program' courses.
You can always read some good code on github.
Also there is http://htdp.org/
>>
>>42362476

When do I know to use a for loop, or a while loop, or a while loop?
>>
>>42365145
>on the entire stack, from hardware to assembly to OS to software (or however it goes) and then a thorough meta-programming book
1. "From NAND to Tetris"
2. SICP
>>
>>42365594
If I started creating apps now I'd stick with HTML5/JS. Web works everywhere.
>>
>>42367876
Because executable formats and APIs are very different.
Laso you can run a lot win32 programs on Linux via Wine. Even WOW.
>>
>>42379476

For loop: defined number of iterations (such as length of an array)
While loop: unknown number of iterations
Do While loop: Never used one myself.
>>
>>42379430
related: http://gameprogrammingpatterns.com/
>>
>>42368615
Defence against SQL-inj (if we are talking about PDO)
>>
>>42362486
>what is a quine?
>>
>>42370775
>but actually putting things together the way I want them?
Maybe you should think more about entities of the real world that are represented in your program and types of operations that your code has to do on their representations?
>>
>>42362476

What is the best book to learn how to think critically to develop problem solving skills in programming. For example, I have a programming exercise and I need to break it down and figure out what it needs. Which is the best book for method Abstraction and Stepwise Refinement
>>
how do I learn programming? total newb here. any books/websites?
>>
File: lina_inverse_laid_back.jpg (51KB, 640x480px) Image search: [Google]
lina_inverse_laid_back.jpg
51KB, 640x480px
>>42376999
>look at how Windows 8 makes itself more efficient over time.
>>
>>42372252
C++ is a mess, C is portable assembler
>>
when I use Monte Carlo Markov Chain technique, why it never work? Why?
>>
>>42376999
What does it mean for a computer program "to improve"?
>>
>>42379586
sicp
>>
>>42372378
What in the fuck?
>>
>>42379588
I'd start with python or javascript.
First, read wiki entries on the language you are going to learn, then go to http://www.codecademy.com/tracks/python (or other online learning service) and read your language's docs https://www.python.org/doc/
>>
>>42376999
Which is.called the Halting Problem. Stop repeating what I just said to make yourself sound smarter.
>>
>>42365041
For C++ software, I learned from 'Modern C++ Design' and 'Effective C++'. I think they cover what you are looking for, however, they are not for beginners. Do da google search if interdasted
>>
What book should I buy if I want to learn java?
>>
>>42370969
>I cant fp because I suk
>>
>>42379686
Thank you. Any other suggestions?
>>
How awful would it be to program a game in C
>>
how on earth was X programmed? i understand the use of XCB/X11 libraries to handle X protocol in order to tell it what to draw to the screen, but how is X itself written so that it draws it to the screen?

can X in the same way be replaced by another software that were written to do the same thing?
>>
>>42383215
See this: http://www.cs.rit.edu/~ats/books/ooc.pdf
>>42383390
X.org is written in C.
>can X in the same way be replaced by another software that were written to do the same thing?
If you mean X.org, there's a few implementations of the X11 protocol.
>>
>>42383390
>can X in the same way be replaced by another software that were written to do the same thing?
Of course, there are other more direct APIs that allow to draw on screen. E.g. DirectFB.
>>
File: 1401944370433.jpg (133KB, 638x618px) Image search: [Google]
1401944370433.jpg
133KB, 638x618px
What's the best way to:
- Store an unknown amount of integers
- Store another unknown amount of integers (mostly the same numbers)
- Compare both and get the numbers that were in the first one but aren't in the second one
- Repeat 1000x per second with 0% cpu load

Its for selecting files with a selection rectangle
I don't use full row selection so the integers are not like 0, 1, 2, 3... and more like 1, 7, 9, 18...

Please respond
>>
>>42383608
Wait, is that actually the in game model?
>>
>>42383617
I don't know, but sure seems that way
>>
>>42383428
>See this: http://www.cs.rit.edu/~ats/books/ooc.pdf
I've never seen anyone ever mention this.
>>
>>42383608
never heard of arrays?
>>
>>42383746
>unknown amount of
Thread posts: 197
Thread images: 13


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