Page 1 of 2 [ 19 posts ]  Go to page 1, 2  Next

outskirt
Hummingbird
Hummingbird

User avatar

Joined: 22 Jul 2008
Age: 39
Gender: Male
Posts: 19

25 Jul 2008, 6:34 pm

I don't see too much discussion on the topic, but building web applications is a major obsession of mine. Have been interested in programming since Q-basic, there I had a few HTML/JavaScript/Perl years, and more recently I discovered the power of PHP/MySQL and Linux. So I run a couple web servers now and have a zillion half finished websites on them (give or take a few). I consider it a hobby that I enjoy but perhaps one day a website will get finished/popular and I can explore a "business side" (and quit my day job).

I was wondering if others here are into this sort of thing, or into programming in general. The only problem I have with programming is that sometimes I get sooo into a project that I can't stop thinking about it, sometimes I will lose track of a conversation I'm having because I'm thinking about new code that I should write or I'll have trouble sleeping, or lose track of time and forget to get other things done... So I try to keep it under control, but when I'm in the mood it really satisfies my urge to be nerdy and also seems productive at the same time.

If anyone is wanting to learn PHP or already knows some and wants to collaborate on a project, I'm totally open to sharing what I know and what I have established. I guess most of my projects are geared towards providing free web services rather than making money, but someday I hope to find a good plan where I can earn a living from my passion (without working for some company, who won't hire me anyways because I didn't go to school to learn what I know).



QuantumCowboy
Veteran
Veteran

User avatar

Joined: 13 May 2007
Age: 46
Gender: Male
Posts: 897
Location: (1/√2)|0> + (1/√2)|1>

25 Jul 2008, 10:04 pm

Why not,

I also have some LAMP (Linux, Apache, MySQL, PHP) experience.

I would be willing to collaborate on some projects.


_________________
The ket always seems to psi over its own indeterminacy.


computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age: 124
Gender: Male
Posts: 5,791

27 Jul 2008, 1:11 am

hi and welcome :)

do you have a site?


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


QuantumCowboy
Veteran
Veteran

User avatar

Joined: 13 May 2007
Age: 46
Gender: Male
Posts: 897
Location: (1/√2)|0> + (1/√2)|1>

27 Jul 2008, 7:39 am

Yes, I do have a site. However, I do not keep most of my stuff posted on it.

Also, I just upgraded from openSUSE 10.1 to 11.0 yesterday. I am piecing together my htdocs dir, and reinstalling Apache.

On top of that, I am having a little difficulty with my cable modem connection, it keeps losing its DHCP connection with my router. I have another one to change it out with. However, I would need to get the ISP to change the S/N in their files, as that is how they encode the packets.

That aside, my URL is quantum-cowboy.hopto.org. I should have something up there soon.


_________________
The ket always seems to psi over its own indeterminacy.


outskirt
Hummingbird
Hummingbird

User avatar

Joined: 22 Jul 2008
Age: 39
Gender: Male
Posts: 19

28 Jul 2008, 8:21 am

= deleted to avoid search engines =

I used to use Apache all the time, but now prefer lighttpd. I'm renting a virtual Archlinux server in the US and that's where everything runs from.

QuantumCowboy: Can you not configure a static IP in your router instead of using DHCP?



Last edited by outskirt on 30 Jul 2008, 1:25 pm, edited 1 time in total.

computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age: 124
Gender: Male
Posts: 5,791

28 Jul 2008, 10:41 am

So PopSite is behind all your sites? Looks very cool man! I think I'll use it for my next site :)
Is it hard to use CSS on it?


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


outskirt
Hummingbird
Hummingbird

User avatar

Joined: 22 Jul 2008
Age: 39
Gender: Male
Posts: 19

28 Jul 2008, 12:45 pm

Thanks for the feedback. Take a look in style.css , the examples in there can be easily changed and effect the whole site at once. I tried to make it straightforward but it's still a bit of a mess (CSS/design just isn't my thing, I based style.css on a template).



= edited for privacy =



Last edited by outskirt on 30 Jul 2008, 1:28 pm, edited 1 time in total.

NeantHumain
Veteran
Veteran

User avatar

Joined: 24 Jun 2004
Age: 45
Gender: Male
Posts: 4,837
Location: St. Louis, Missouri

28 Jul 2008, 6:43 pm

Have you tried Python, Java, C#, or Ruby? PHP is not such a great language (even if many, many people have made do with it).



outskirt
Hummingbird
Hummingbird

User avatar

Joined: 22 Jul 2008
Age: 39
Gender: Male
Posts: 19

28 Jul 2008, 7:06 pm

NeantHumain wrote:
Have you tried Python, Java, C#, or Ruby? PHP is not such a great language (even if many, many people have made do with it).


I've tried Python and Ruby, didn't see any benefit to switching. Java and C# I've looked through before and didn't really like either of them (C# is Microsoft only? yuck). I like PHP because there is a straightforward function for just about anything routine I can think of and the syntax pleases me. Is there a reason you don't like it? I've heard complaints about performance, but with APC installed it works nice and fast for me.



NeantHumain
Veteran
Veteran

User avatar

Joined: 24 Jun 2004
Age: 45
Gender: Male
Posts: 4,837
Location: St. Louis, Missouri

28 Jul 2008, 9:00 pm

outskirt wrote:
Code:
git://popsite.pow7.com/popsite.git

Does this require some kind of authentication? I was unable to connect.
outskirt wrote:
I've tried Python and Ruby, didn't see any benefit to switching. Java and C# I've looked through before and didn't really like either of them (C# is Microsoft only? yuck). I like PHP because there is a straightforward function for just about anything routine I can think of and the syntax pleases me. Is there a reason you don't like it? I've heard complaints about performance, but with APC installed it works nice and fast for me.

Since I was unable to look at your code, I cannot make specific comments, but I worked with PHP a little back in college, and it definitely had the hacked-together, quick-and-dirty feel to it.
Code:
<?php
    function db_connect()
    {
        $db_server = "localhost";
        $db_user = "user";
        $db_pass = "pass";
        $db_schema = "schema";

        $link = mysql_connect($db_server, $db_user, $db_pass)
            or die("<p>The script could not connect to the database.</p>\n");
        mysql_select_db($db_schema)
            or die("<p>The script could not open the database schema.</p>\n");

        return $link;
    }

    function display_menu($username, $accesslvl)
    {
        if ($accesslvl == AUTH_OWNER)
            $utype = "owner";
        elseif ($accesslvl == AUTH_MOD)
            $utype = "moderator";
        elseif ($accesslvl == AUTH_USER)
            $utype = "user";
        elseif ($accesslvl == AUTH_GUEST)
            $utype = "guest";
        ?>
        <ul>
        <?php
        echo "            <li>$utype $username</li>\n";
        if ($accesslvl == AUTH_OWNER)
            echo "            <li><a href="adduser.php">Add a User</a></li>\n";

?>

Now maybe PHP has advanced significantly since then and offered more advanced libraries, but the fact is PHP (at least old versions) encourages spaghetti (unstructured or minimally structured) code. PHP applications are more hacked together than thoroughly architected and designed before coding begins, and that's okay for simple web apps, but when things grow, the code is suddenly a huge mess.

The PHP standard library is (or was) itself a mess. For example, notice in my code I'm connecting to the database using a function called "mysql_connect". What happens when I change to PostgreSQL, Oracle, or some other database? The end developer should not be exposed to the implementation details but should be working with a more abstract interface. For example, on Windows, for C, C++, and others, there's ODBC, ADO, etc. Java has JDBC and then frameworks built on top of that. Ruby has Ruby on Rails with its ActiveRecord ORM framework.

Another thing is all these languages have well-established means for separating content from code. For example, Java has JSPs. C# has ASP .Net. Ruby has its view pages (forget what they're called). You don't end up mixing HTML and code as often happens with PHP. This is a design pattern called model-view-controller (the model represents objects stored in the database; the controller sets variables up for the view; and the view generates the HTML the user will see); related design patterns accomplish similar separation.

Speaking of databases, often it's unnecessary to write the SQL by hand unless you need it optimized.

There are many more advantages to languages other than PHP, but I've got a headache. :)

Also, C# isn't quite Microsoft only. Mono and dotGNU are open-source projects.



computerlove
Veteran
Veteran

User avatar

Joined: 10 Jul 2006
Age: 124
Gender: Male
Posts: 5,791

28 Jul 2008, 11:34 pm

Error:

Quote:
C:\Program Files\Git\bin>git clone git://popsite.pow7.com/popsite.git
Initialize popsite/.git
Initialized empty Git repository in C:/Program Files/Git/bin/popsite/.git/
popsite.pow7.com[0: 209.40.206.167]: errno=Invalid argument
fatal: unable to connect a socket (Invalid argument)


is there any easier way to download it?


_________________
One of God's own prototypes. Some kind of high powered mutant never even considered for mass production. Too weird to live, and too rare to die.


outskirt
Hummingbird
Hummingbird

User avatar

Joined: 22 Jul 2008
Age: 39
Gender: Male
Posts: 19

29 Jul 2008, 8:00 am

Oops, I guess I forgot to restart the git daemon, so it should work now. =removed package links=


OK, so you're right about the hacked together spaghetti code, but I like being able to fully optimize things. PHP has several frameworks that use MVC but I find these frameworks always slow things down (noticed the same with RoR). To me it seems that loading an entire framework (often several large include files) for every pageload is a big waste if you can get the same result from a little script, and they don't allow for decisions of how to query the database. For example, it might read all the columns from a table when you only need 1 column in your output. I've found that different databases work so differently in the backend that I can only optimize queries if I focus on 1 database type, so while it's possible to make the code compatible for different database, I find it only slows things down.

So maybe I'm just stuck in my ways, but I still like to experiment with other languages. Maybe I just need a more powerful server before I can appreciate the frameworks more, but I still have fun in PHP and I like having more control over what's actually happening in the scripts.



Last edited by outskirt on 30 Jul 2008, 1:26 pm, edited 1 time in total.

0_equals_true
Veteran
Veteran

User avatar

Joined: 5 Apr 2007
Age: 42
Gender: Male
Posts: 11,038
Location: London

29 Jul 2008, 2:40 pm

NeantHumain you are right. PHP encourages spaghetti code. It is not exclusively spaghetti code, but there is something in how languages are designed, that results dirty code . In fact you have to go out of you way to make it easy to read. I make a lot of mods to third party code and it can be a pain. This is because PHP is essentially embedded bits of code in often mainly static pages, which little intrinsic connection to each other Good coding practice is to keep the minimal amount of embedded code in the views, but this is not done so much with php.

Yes current versions have improved.

The main problem with scripting languages like php is the spaghetti SQL. There is Cake PHP which has Object Relational Mapping. But why use that when you could use Ruby on Rails (and also ruby on it own)?

Here is a good tutorial on ORM/Active Record. Anyone feel for SQL cat? :wink:

PHPs main success is it is easy to get something working, even if that something is a botch job which I've seen lots of. It is accessible to people who never tried programming.

I still use it but I use it a little, quite leanly in a tried and tested sort of way.



0_equals_true
Veteran
Veteran

User avatar

Joined: 5 Apr 2007
Age: 42
Gender: Male
Posts: 11,038
Location: London

29 Jul 2008, 3:13 pm

outskirt frameworks and languages are not mutually exclusive and just because you use a framework, doesn't mean you can't control things. Some frameworks are less intuitive and require lengthy XML configurations. The whole point of a framework is to make your life easy if it is not doesn’t do what you want then overrule if necessary. Just do it intelligently and you can’t go far wrong.

I've always liked db but even I say SQL has no place embedded in scripts. The ORM implementations for a particular db are as good whoever developed them, and don’t get me wrong ORM has its limitations. If you don't like what you've got, chances are there is something out there for you or you can do it yourself. That is the beauty of OS. There are a lot of myths around query optimisation as it is. Object driven databases still have teething problems, even the main commercial ones still provides SQL control.

Of course there are frameworks, which are really more content management systems, like Joomla. Allegedly the core developers of joomla get terribly upset if you hack up their framework, even though they claim to be OS. I guess they don't like the idea of their concept not being foolproof. But there are many things in Joomla you just can do without hacking it up. A client thought he'd have a go on his own creating a site in Joomla for a new venture. It wasn't long before he contacted me and needed work done. I knew I had to hack it up, but wanted to find out what joolma developers had done in similar situations (hack it up of course.)



NeantHumain
Veteran
Veteran

User avatar

Joined: 24 Jun 2004
Age: 45
Gender: Male
Posts: 4,837
Location: St. Louis, Missouri

30 Jul 2008, 4:25 pm

0_equals_true wrote:
The main problem with scripting languages like php is the spaghetti SQL.

Yes, that's one of the things I hated most (as well as the mixing in of HTML) about standalone PHP. I had to write the SQL for each segment of data I was going to pull back to use on the site, so programming just got extraordinarily tedious. Yes, Ruby on Rails was just coming out when I was working on one of my last projects with PHP, but I had to work on a team, and no one else wanted to take the time to learn a new programming language and framework when they had "so much other work to do." I think, in the time it took to get all the pages functioning, we could have learned Ruby on Rails, got the pages up and running, and added more advanced features we didn't implement in our PHP version.



NeantHumain
Veteran
Veteran

User avatar

Joined: 24 Jun 2004
Age: 45
Gender: Male
Posts: 4,837
Location: St. Louis, Missouri

30 Jul 2008, 4:38 pm

outskirt wrote:
OK, so you're right about the hacked together spaghetti code, but I like being able to fully optimize things.

Don't optimize prematurely.

If you use an ORM framework, you can just stick with the more conventional way of using the framework, and then if you find something that's affecting response time or server load, you can optimize. Usually there's a way to specify an SQL WHERE clause, the table joining, etc.

Part of being a good programmer is knowing when to give up a little low-level control for more abstraction; it's a matter of costs versus benefits. Understanding how a software system works at the lower levels is great, and you need to learn that; but once you do, you also need to understand the benefits of abstraction.

After all, we can't all be writing assembly code!