Page 1 of 2

smart kid

Posted: Fri Jul 24, 2009 11:04 am
by drdokter
wow, you must be a smart kid. I have a 16 year old son, and he does well in school, but he just plays video games all summer. WASTE!

Re: smart kid

Posted: Fri Jul 24, 2009 11:44 am
by andyhoneycutt
drdokter wrote:wow, you must be a smart kid. I have a 16 year old son, and he does well in school, but he just plays video games all summer. WASTE!
:dubious:

Re: smart kid

Posted: Fri Jul 24, 2009 12:41 pm
by jackpf
Hey uhh...did you mean to post this here?


:D


I wouldn't call gaming a wast exactly...my time is pretty much divided into two halves - programming and gaming :D

Re: smart kid

Posted: Fri Jul 24, 2009 1:50 pm
by andyhoneycutt
Ok, thanks for the clarification :)

Re: smart kid

Posted: Fri Jul 24, 2009 1:51 pm
by andyhoneycutt
drdokter wrote:wow, you must be a smart kid. I have a 16 year old son, and he does well in school, but he just plays video games all summer. WASTE!
I started programming when I was quite young, and it goes hand-in-hand with gaming for me. Gaming is half the reason why I started programming: I wanted to design them. That said, I found myself moving down the information technologies avenue, which I'm pretty satisfied with. I don't necessarily find gaming a waste of time, but I'm sure plenty of the world would disagree with me :)

Re: smart kid

Posted: Fri Jul 24, 2009 3:06 pm
by jackpf
Yeah...programming games would be <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span> cool.

Idk why I started programming...I guess I just thought it was cool. You know, you see all these hackers in films that hack banks in like 30 seconds and stuff. I wanted to be like them, but when I learned of the reality that hacking takes weeks, and involves developing exploits and coding, I realised I'd need some knowledge of programming and stuff.

I learned a bit of C, and then became interested in PHP. Since I knew some C, PHP was easy as the syntax of the two is basically the same.

Anyway, I've never hacked a bank :P
I have hacked a few people's websites...but I've always backed them up first. I'm not into screwing people over...that's just pointless. I only hack to see if I can, not to <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> people off. The other week I wrote a program in C that copies filezilla's (FTP program) password list, which is stored unencrypted, and posts it on my site which saves it to the database. I never released it though...

Anyway, I decided to put my programming knowledge to use, and designed my own site, which I've coded 100% myself. Check it out if you're ever bored - http://jackpf.co.uk :)

Re: smart kid

Posted: Fri Jul 24, 2009 3:12 pm
by andyhoneycutt
Totally. I started off programming in C on a macintosh that my dad had on loan from work. He brought a copy of ThinkC home as well, and I started developing my own MUDs. C is in my opinion a great language to learn the fundamentals of programming. Although 99% of the work I do is based around a web application, I do miss straight-up application programming. I manage to find an excuse to right an app about 1% of the time ;)

Re: smart kid

Posted: Fri Jul 24, 2009 3:24 pm
by jackpf
Yeah.

Although, PHP can be way cooler. In order to actually make something cool in C, you have to know a lot. With PHP you can write something useful the first day you start learning it.

I still have to master the art of creating windows in C...so far all my programs have been console based. But yeah...I'm only 16. Most programmers have gone to university and had training courses etc. For that reason I'm at a bit of a disadvantage, but for the reason that I'm only 16, I've had the advantage of learning early. It's a double edged sword tbh.

Re: smart kid

Posted: Fri Jul 24, 2009 3:46 pm
by alex.barylski
C is in my opinion a great language to learn the fundamentals of programming.
I have to disagree.

You have to worry about pointers, resource leaks, security, etc...plus it's syntax is cryptic at times. The semi-colon at the end of each statement makes sense, so as to disambiguate from control structures.

I think HLL like VisualBasic or PASCAL are slightly better for "learning" as they provide more structure for a program, especially PASCAL.

C is a good systems language, which is exactly why it's still popular today. C++ on the other hand is a great language for general desktop application programming or speedy daemons, services, etc.

Just my IMHO of course, i'm just sayin' :P

Re: smart kid

Posted: Fri Jul 24, 2009 3:55 pm
by andyhoneycutt
I absolutely agree. I haven't gone to college. It's been an advantage and a disadvantage. I've been in the field that I'm in now (web development) for 10 years. I'm good at what I do and I know quite a lot, but I am still missing tons of the theory and certain "common knowledge" that a typical CS grad would have. I wouldn't trade what I am capable of and what I know for a degree, but I would love to take the time to fill in the gaps! I spend a lot of time reading books on CS theory to help with the disadvantage of having never taken courses on programming, but I feel that without the proper environment and a little guidance (in my case, at least, by no means am I implying that this is the case for everyone), I'll never fully grasp some of the concepts that CS majors and other degreed folk understand.

@PCSpectra: One of the most important reasons, I think, to start in C is exactly because it's difficult. You need to understand memory usage and excellent logic flow. Pointers and references are a bit abstract, but you do have need to understand how they work, you can use references in PHP as well. C++ is probably my least favorite language. It's got an identity crisis, much the same that PHP is starting to: Am I OO, or am I a procedural language? I think the modern student should begin (if not with C) with a purely OO language like Java or C#. Having a strong understanding of OO is practical and tends to lead to better applications design.

To be fair, I know absolutely zero about PASCAL, and have heard similar sentiments expressed about it lending itself well to learning to program "the right way". I'm pretty biased, though, because I learned on C: I blame it for everything I do right, and/or wrong. C also made me a stubborn programmer and a little snooty toward languages that allow for on-the-fly variable declarations and other such niceties. And here I am programming PHP for a living! :wink:

Re: smart kid

Posted: Fri Jul 24, 2009 4:01 pm
by andyhoneycutt
jack - nice site, i'd be curious to see some of your code if you're ever bored and feel like talking code :)

-Andy

Re: smart kid

Posted: Fri Jul 24, 2009 4:27 pm
by jackpf
Cheers :) I try :P

Well...there is rather a lot of it. About half a meg to be precise :D

However, if there's anything in particular you're interested in, I'd be more than happy to share.

Re: smart kid

Posted: Fri Jul 24, 2009 4:59 pm
by andyhoneycutt
jackpf wrote:However, if there's anything in particular you're interested in, I'd be more than happy to share.
Specifically I'd love to see how you go about handling access level stuff on the forums. Who can edit what, see what, etc. Everyone seems to have a different way of doing this (I know there are certain patterns that are highly adopted in regards to this), but I've yet to see something that stands out as specifically the "best" way of doing it. I don't intend to say your code either is or isn't the best, I'm just curious to have a look at how you approach the topic :)

Re: smart kid

Posted: Fri Jul 24, 2009 5:33 pm
by jackpf
Right, well...when someone logs in, they have three cookies set: 1 containing their alias, which is basically a username. Although I call it an alias because "username" should technically be two words, and I hate incorrect grammar in code :P Plus it's boring - all forums have "usernames"...I though aliases would be cooler.

Anyway, the second cookie is their usergroup. Each usergroup has a userlevel ranging from 0 to 1, 1 being the highest, which is defined in my config. Their userlevel defines what they can view, as I have a function which will check the current user's userlevel compared to a defined userlevel, such as a moderator's. If the user's userlevel is less than the one being compared to, the script stops parsing and presents the user with an error.

The third cookie is a hash of *a field* (I couldn't possibly tell you, otherwise it'd invalidate it's point of being secure :P) for that particular user, used to compare to that field on any page request that is restricted. That makes sure no one has been messing with their cookies...

So yeah, I have a security file which is included in every "secure" page request, such as viewing your own profile, sending messages, posting etc...
Basically, it gets the cookie values, checks the database if the alias exists, checks if the userlevel exists, and is what it should be (as in, no one has edited their cookie to make themselves an admin), and checks the hash to make sure the user hasn't changed their cookies to someone else's alias.

For stuff like editing posts, or viewing/posting on private or hidden threads/forums or whatever, I just have a function which compares the user's userlevel to the defined userlevel which is allowed to access whatever is being accessed...which in most cases is a moderator's userlevel, which is 0.5.

So, for example, someone wants to edit a post.
First of all, I check that the author of the post is equal to the user editing the post. If not, I secure the page against a moderator's userlevel, as moderators are allowed to edit posts.
I then check the parent forum's, thread's, and post's restrictions (stored in the db) to make sure this user is allowed to edit this post. For example, I could have locked the post against editing, or I could restrict editing to administrators, meaning the author or a moderator shouldn't be able to edit it.
If these tests are passed, then they're allowed to edit it.

Anyway, that's basically it...pretty simple tbh.

Re: smart kid

Posted: Fri Jul 24, 2009 5:40 pm
by andyhoneycutt
Right on man. Thanks for the info. I hope I'm not coming across as a snoop. I'm just curious because personally, I've not found a way to do this that I'm content with in terms of flexibility, scalability, and robustness. I tend to do something similar to you, but I never use cookies. I don't like them in real life (with the exception of macadamia nut/white chocolate), and I don't like them as a programmer.

-Andy