HabboxWiki needs you!
Are you a Habbo buff? Or maybe a rare trader with a bunch of LTDs? Get involved with HabboxWiki to share your knowledge!
Join our team!
Whether you're raving for rares, excited for events or happy helping, there's something for you! Click here to apply
Need a helping hand?
Check out our guides for all things to help you make friends, make rooms, and make money!


Page 1 of 4 1234 LastLast
Results 1 to 10 of 39

Thread: Sessions and c

  1. #1
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default Sessions and c

    Just a couple of questions for the more knowledgeable of you guys.

    a) (PHP) Is it worthwhile using a custom session handler.. ever? I recently purchased a PHP security book (Fairly cheaply somehow) since web guides seemed fairly limited and it sort of implied that it's good as if it uses a database then other applications on the server wouldn't be able to look at your sessions and hijack them, it also seems good because you can build stuff like IP, header etc. verification right into the session handler - however some posts I've read online say that the performance hit isn't worthwhile but since for a lot of my scripts I have to pull down a lot of stuff from mysql anyway I don't see the issue.

    b) I've been planning on expanding my coding horizons beyond web languages for a while and whilst I do the occasional LUA coding on garry's mod I feel like one of the C languages is more worthwhile. Is it more advisable to learn C, C++ or C#. I'm leaning towards C++ as C# has a heavy windows focus and since C doesn't have classes. I could learn something like Java but it feels like such a cheat and an excuse for sloppy coding, it's also really inconvenient if people don't already have Java installed. Thoughts?
    Last edited by Chippiewill; 07-05-2012 at 12:01 AM.
    Chippiewill.


  2. #2
    Join Date
    Oct 2011
    Location
    Melbourne
    Posts
    637
    Tokens
    1,376

    Default

    Quote Originally Posted by Chippiewill View Post
    b) I've been planning on expanding my coding horizons beyond web languages for a while and whilst I do the occasional LUA coding on garry's mod I feel like one of the C languages is more worthwhile. Is it more advisable to learn C, C++ or C#. I'm leaning towards C++ as C# has a heavy windows focus and since C doesn't have classes. I could learn something like Java but it feels like such a cheat and an excuse for sloppy coding, it's also really inconvenient if people don't already have Java installed. Thoughts?
    I always read that it's more worthwhile to learn C++ because it's more advanced or something. If you are new (which I don't think you are), they recommend learning Java first and then move onto a "proper" language, ala C++

  3. #3
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    In terms of the session handler there are some situations where you would want or rather have to use it. For example if you ran a cluster of web servers you'd need to be able to access the session data regardless of what server handles the request and by default PHP persists session data on the local file system. I don't really do much PHP anymore (Moved on to other languages for web development after having the revelation of how crap PHP can be ) but in a current non-PHP project I'm working on I have a cluster of a few web servers and I store session data in Infinispan (www.jboss.org/infinispan/) which allows it to be available to all the servers in the cluster. However, I believe PHP has allowed you to use custom session handler extensions in later versions so it is not needed to implement it in PHP anymore.

    I'd disagree with everything Blinger has said. C++ is not any more of a "proper" language than Java. You'll find that even VERY large enterprises will use Java/Java EE for critical, large scale systems and is not just some language for education. It is also not some "cheat" and does not lend itself to sloppy coding any more so than other languages. Plus at the end of the day I don't decide to use some language because it it complex or difficult but I use it because it matches the requirements for the project I'm working on and minimises the amount of time spent. Again a good example of this is the project I mentioned previously. It is written in Ruby with RoR because it is very quick and easy to develop web applications with, however, it uses JRuby to allow it to run on the JVM so I can deploy it to a Java EE application server (JBoss AS) which meets the requirements for scalability and performance. Sure I could of written it in another language (e.g Java or even C++) because it was more "complex" or "proper" but why waste time? I would not attempt to write an OS in Ruby. Why? Because it is not the appropriate language for the project.

    Also the reason Java is used in education is because it gives you a good grasp of the concepts that can apply across different "traditional" programming languages (data types, OOP, etc.) without all the difficulty associated with people running different OS/configurations that could apply if you used something like C++. e.g Student A was running linux with gcc, Student B was using Windows with Visual C++, etc. Hence the "write once, run anywhere" slogan.

    In response to what to learn, I'd start by asking what you want to achieve. It seems you're looking to build some kind of desktop application. At first glance C++ may seem a good choice for cross platform programming but it is not as simple as it may first appear. At the moment C# does seem a good choice. You can make use of the .Net framework on Windows and practically all of the .net framework is supported on Linux using Mono (http://www.mono-project.com/Compatibility).

    Anyway my point is that there is no language that is "the language" to learn as every language has strengths and weaknesses and you should pick what seems like the best one for what you aim to achieve.

  4. #4
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    Just a couple of questions for the more knowledgeable of you guys.

    a) (PHP) Is it worthwhile using a custom session handler.. ever? I recently purchased a PHP security book (Fairly cheaply somehow) since web guides seemed fairly limited and it sort of implied that it's good as if it uses a database then other applications on the server wouldn't be able to look at your sessions and hijack them, it also seems good because you can build stuff like IP, header etc. verification right into the session handler - however some posts I've read online say that the performance hit isn't worthwhile but since for a lot of my scripts I have to pull down a lot of stuff from mysql anyway I don't see the issue.
    Move to Python and Django, PHP is horrific.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  5. #5
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Yeah PHP is bad. I started with PHP mainly because it was easy to find hosting for it. Although when you use other language you soon see how bad some of the practices in PHP are.

    http://phpsadness.com/
    https://bugs.php.net/bug.php?id=54547
    http://www.securityweek.com/official...esearchers-say
    http://gcov.php.net/viewer.php?version=PHP_5_4 "Test Failures: 86"
    http://i.imgur.com/PFJz8.jpg

    Quote Originally Posted by Recursion View Post
    Move to Python and Django, PHP is horrific.

  6. #6
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Quote Originally Posted by Recursion View Post
    Move to Python and Django, PHP is horrific.
    I'm already well aware of the problems with PHP. But let's pretend for a second that I'm not yet in a position to pick up new languages on a whim and that 90% of the code running websites on the internet is PHP. Could you give reasonable help?

    Also I'd rather pick up C++ and then ..
    Last edited by Chippiewill; 08-05-2012 at 08:00 PM.
    Chippiewill.


  7. #7
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    I'm already well aware of the problems with PHP. But let's pretend for a second that I'm not yet in a position to pick up new languages on a whim and that 90% of the code running websites on the internet is PHP. Could you give reasonable help?

    Also I'd rather pick up C++ and then ..
    If you're thinking of picking up C++, then honestly Python is a piece of piss to pick up and will get you out of all of PHP's bad habits. You could learn it in under a day easy.

    It's such a broad, easy and useful language that's used for everything from server administration, to website design.

    I'm done, I don't have a clue about third party PHP session handlers
    Last edited by Recursion; 08-05-2012 at 08:16 PM.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  8. #8
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Quote Originally Posted by Recursion View Post
    If you're thinking of picking up C++, then honestly Python is a piece of piss to pick up and will get you out of all of PHP's bad habits. You could learn it in under a day easy.

    It's such a broad, easy and useful language that's used for everything from server administration, to website design.
    I'll stick to PHP for now and once I've got my head around C++ I'll take a peek at python
    Chippiewill.


  9. #9
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    I'd not bother with that. The advantages he listed are not very convincing. "More Control" is false, I can do all what he listed in many other languages. "Obviously faster" is debatable as unless you're some kind of master at creating high performance HTTP servers then it is highly unlikely that you're going to be able to get it as fast and efficient as off the shelf HTTP servers. "If you code it right" contradicts the "obviously faster" statement. Again it goes back to my point about picking the right language for the project and unless you are Google then writing your website in C++ is quite silly as the benefits massively outweigh the costs of doing so.

    If you want to write desktop applications but also look at also creating websites then I'd strongly recommend Java. Java EE and frameworks like Spring power some of the websites for some of the largest companies in the world. The world of Java EE is quite complex but is also very powerful.

    Quote Originally Posted by Chippiewill View Post
    I'm already well aware of the problems with PHP. But let's pretend for a second that I'm not yet in a position to pick up new languages on a whim and that 90% of the code running websites on the internet is PHP. Could you give reasonable help?

    Also I'd rather pick up C++ and then ..

  10. #10
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    didn't get the sarcasm..

    but point taken.
    Chippiewill.


Page 1 of 4 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •