• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Let's discuss computer programming

Having any GUI coding under your belt helps you understand event driven programming, rather than the console style model where you wait for user input.

In event driven programming you just have a load of events you register for and the OS calls you, rather than you waiting for the user to do something.
 
Yeah, I noticed that it's a different world when I made tic-tac-toe game, and started to wonder where should I put the "while (gameIsNotOver)"-loop. :)
 
Tic-tac-toe: Did you implement minimax to make it play a perfect game?
 
Actually, I didn't make any AI to it. Not that far yet. It's just a two player game I did to try out GUIs. :)

Now I'm just a worm game and an exam away from completing the one semester programming course. During the summer I will study program modeling, algorithms (Cormen &a, selected bits), and do a bit bigger programming thing.

(The thing is that I'm trying to learn as much programming as it takes to be employed. I tried insurance maths first, but it was too boring to be studied).
 
Why is c++ considered to be so hard compared to other programming languages? I'm not very familiar with programming (I've used c++ and Actionscript 3 along with building "programs" in a ti-84 calculator and MS excel) but in my limited experience, c++ isn't that hard. Is it that c++ is the first computer language I've ever used so I'm just used to it or is it that I'm just not pushing it very far? Thanks
Note: so far most of the stuff I'm doing with c++ is pretty simple stuff, such as making board games, finding the prime factorization of a number, etc. Also, I've only made console apps so far, I haven't made any windows apps yet.
 
I started programming in C (not strictly true as I did some Basic and Algol68 first), I learnt most of it from reading Kernigan and Ritchie.

When I went onto C++ compilers I basically used it as C and did not learn Object Oriented methods until I used C# (this took a while to get my head round).
 
I've noticed while learning programming that knowing maths gives you a definite edge on your peers. Not only in when you need to do calculations or that kind of stuff, but foremost in understanding things.

I think boolean stuff like truth tables and understanding multi dimensional array concepts from maths are a great help.
 
I was thinking of saving long sequences of BigIntegers in a text file in Ubuntu. The text file doesn't have to be easily readable to humans, but it doesn't hurt.

Is there any difference what I use to separate the numbers? "\n" would make it more readable, but does it make it bigger than emptyspace or comma?

When do I have to be cautious of the file becoming too big or slow to handle?

My Ubuntu runs on an IDE-HD, so it adds extra difficulty, although I could try this in school too.
 
I was thinking of saving long sequences of BigIntegers in a text file in Ubuntu. The text file doesn't have to be easily readable to humans, but it doesn't hurt.

Is there any difference what I use to separate the numbers? "\n" would make it more readable, but does it make it bigger than emptyspace or comma?

When do I have to be cautious of the file becoming too big or slow to handle?

My runs on an IDE-HD, so it adds extra difficulty, although I could try this in school too.

Store the numbers in hexadecimal should help save space (possibly 20%), i think the newline character is just a single character, but I have no experience of Ubuntu.
 
Rule of thumb in *nix: records are separated by newlines, fields within a record are separated by commas.

A newline (\n) is a single byte, just like any other character.

I have yet to hit a problem with data file size other than maxxing out the system file size limit. ;)
 
Thanks! :goodjob:

I wasn't putting BigIntegers there after all, just plain integers, but 30 million of them. The file became ~160 megas big, and I tried to look at it just out of curiosity. Opening it froze the PC temporarily, but I had other programs running too. Handling it with the program didn't cause any troubles though.
 
I'm curious about what kind of algorithms and data-structures typical recent BSc graduate (or equivalent) knows and is able to do wherever you might live.

Here's a list of the particular things I'm especially interested about:

Balanced trees (AVL or similar)
Hash-maps and -sets
Heaps (max, min, heap-sort)
Bellman-Ford algorithm (for graphs)
Dijkstra (for graphs)
Topological sorting (graphs)
Transitive closure (graphs)
Kruskal (graphs)
Prim (graphs)
Union-Find (graphs)

And I'm speaking here about ability to make such algorithms and structures of your own.
 
I just wanted to say that I've been programming pretty much non-stop since I last posted here and am now a freshman computer science major. This is the coolest stuff in the world. :goodjob:

Right now I'm messing around with sound data and am trying(unsuccessfully thus far) to implement some pre-calculus problem solving functions(ie. something which factors trinomials, something which solves equations, something which simplifies expressions, something which draws graphs).
 
Why is c++ considered to be so hard compared to other programming languages?

The problem with C++ is that it remains a hack built on top of C. Most people don't use it for what it is supposed to be, the oo features, but only for the libraries. Creating a lot of confusion about how it is supposed to be used. For someone learning to program it's not a good choice because of all the contradictory advice.

I was thinking of saving long sequences of BigIntegers in a text file in Ubuntu. The text file doesn't have to be easily readable to humans, but it doesn't hurt.

Is there any difference what I use to separate the numbers? "\n" would make it more readable, but does it make it bigger than emptyspace or comma?

If there is no requirement to be human readable you can just create a file in a binary format. You don't need any separator, just write out your vector or whatever there and read it back when you need it.

I'm curious about what kind of algorithms and data-structures typical recent BSc graduate (or equivalent) knows and is able to do wherever you might live.

Here's a list of the particular things I'm especially interested about:

Balanced trees (AVL or similar)
Hash-maps and -sets
Heaps (max, min, heap-sort)
Bellman-Ford algorithm (for graphs)
Dijkstra (for graphs)
Topological sorting (graphs)
Transitive closure (graphs)
Kruskal (graphs)
Prim (graphs)
Union-Find (graphs)

And I'm speaking here about ability to make such algorithms and structures of your own.

The recommended textbook where I studied was Introduction to Algorithms by Cormen, Rivest et al, covered all of those and many more. There were some chapters we skipped over but we did had to learn to implement all of those you mentioned. Funny, now that you mention them I realize I've already forgotten the details on most of those algoriths. This thing of taking courses just out of curiosity turns out to be kind of a waste. :lol:
 
If there is no requirement to be human readable you can just create a file in a binary format. You don't need any separator, just write out your vector or whatever there and read it back when you need it.

After asking that I learnt that the form of the file is most unlikely to be the bottle neck, and to avoid unnecessary optimization. :)

The recommended textbook where I studied was Introduction to Algorithms by Cormen, Rivest et al, covered all of those and many more.

A familiar book, although, too verbose for my taste. The IT-student's organization boasts that here students are unusually well educated on these matters, and I was curious how true that statement is.
 
Take as many maths courses as you can; maths doesn't go out of date unlike computers.

LOL, not to be critical, but take the 3D graphics out of programming, and short of analyzing data involving matrix math for working with multiple functions simultaneously (e.g.Eigenvalues/Eigenvectors) do you really need math above College 101 in programming for general applications?
 
Machine learning makes extensive use of linear algebra. Networking and AI applications make use of graph mathematics. All mathematics increase your ability to think in a formal way and help your programming. Also, unless college 101 includes things like logarithms, inductive proofs and so on, you will need to cover those subjects somewhere else to understand any data structures and algorithms beyond the basic array.
 
It does depend on what sort of programming you are doing as to whether math will be particularly helpful. Logical thinking is always going to be helpful, and Azash is right that understanding basic mathematical concepts is a good thing. But, not all programming is about crunching numbers. I'm not sure I've ever used mathematics I didn't know when I started 9th grade outside of a classroom setting, and if I did, it would have been in one of my own, personal programs, and not for an employer.
 
I've been a professional developer for nearly 30 years. The only time I've needed more than basic high school algebra was a classified DoD program dealing with tactical flight planning. And even there, the formulas to use were spelled out in the requirements documents.

That said, the study of hard sciences (math, physics, etc) is one of the best ways I know to learn logical thinking.
 
I'm learning C at the moment, and it really messes my brain up.

It'd be probably wonderful for first language, and learned at slow pace, but I have Java burden, and the aim is to learn it in six weeks (first week basics, second week pointers, third week input/output...)

Here's one of the many things I don't understand, from Kerninghan & Ritchie's book:
)/* Copies string t to s */
void strcopy(char *s, char* t)
{
while ((*s++ = *t++) != '\0')
;
}

Ok, I understand perfectly well what this is doing, but suppose that s is shorter than t. Doesn't this write to memory locations that aren't allowed? Once we pass s's '\0' that is.

Here's an illustration,

SSUUUTTT

There's two bytes for s, four for t and in between three for U. If we copy t to s, doesn't this write over first Us?
 
Back
Top Bottom