[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quanta
Subject:    Re: [Quanta] PHP
From:       Paul Lemmons <paul () lemmons ! name>
Date:       2008-07-05 17:32:12
Message-ID: 486FB01C.6090302 () lemmons ! name
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Scott wrote:
> There are a number of visual options that
>> assist in code development. It won't make a php programmer out of you 
>> but will make the php programmer you are more efficient and effective.
>>     
> 	True, I don't expect Quanta to write the code for me :).  Which visual 
> options are you referring too?
>
>   
I am retentive about indentation. After coding for 30+ years I have come 
to believe that it is as important as the logic itself. The 
"Settings->Configure Editor->Show Indentation Lines" visual aid is one 
of my favorite.
>> There is also a debugger that comes with Quanta: I have been threatening 
>> to set it up but as of yet have not done some. Other say that it works 
>> well.
>>     
> 	Where is the debugger?  I noticed an older one called Gubed, but it 
> does not seem to be maintained anymore, not for three years based on 
> their web page.  Is Gubed still useful?
>
>   
I have been told that gubed is still very useful. There have also been 
discussions on this group about xdebug and a number of people have 
configured it to work with Quanta. Some time back, I asked this group 
which was the better choice and gubed was the one recommended. As I 
noted, though, I have not actually used either of them. I am still a 
"echo "*** Debug: ... " guy :)
>> I noticed in another post, that you are not wanting to make your PC a 
>> web server. I would suggest you re-think that. It it more than just a 
>> little convenient to be able to test completely on your PC before moving 
>> code up into "production". I am assuming you are using kubuntu so 
>> setting this up would be really easy.
>>     
> 	I have setup both Apache and PHP without any problems on my Kubuntu 
> machine and my little 386 Debian server.  One of the two main problems I 
> have is with the MySQL.  It is a pain and a considerable amount of work 
> to set it up and to make sure all the databases and user names are the 
> same as my website.  If I was writing a PHP/html site without MySQL I 
> would use a local test machine for sure.  Unless you know an easy way to 
> get all my tables and users over to my local machine.
>
>   
Let me share a few little scripts with you that may help with keeping 
your databases in sync. I think you will see a pattern and from the 
examples and be able to mix and match functional parts to create your 
own recipes.

First: refresh_local_from_remote.sh

mysqldump -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          --single-transaction \
          --add-drop-table \
          MyDatabaseName \
| \
mysql -hlocalhost \
      -uMyUserid \
      -pMyPasswd \
       MyDatabaseName

Second: backup_remote_to_file.sh

#!/bin/bash
now=`date +%m%d%y%H%M`

mysqldump -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          --single-transaction \
          --add-drop-table \
          MyDatabaseName \
 > \
          MyDatabaseName.$now

Lastly: refresh_remote_from_file.sh

#!/bin/bash
cat $1              |
sed -e "/^LOCK/ d"   |
sed -e "/^UNLOCK/ d" |
mysql -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          MyDatabaseName \

The host that I use will not let me lock tables so I have to remove the 
locks from the backup file using sed. Your host may not have this 
restriction so you may not need the sed lines.

In my PHP program I also have an included file that connects me to the 
database. It looks like:

<?php
if ($_SERVER['SERVER_NAME'] == 'localhost')
   $host     = "localhost";
else
   $host     = "remote.mysqlhost.com";

$user     = "MyUserid";
$password = "MyPasswd";
$database = "MyDatabaseName";

$db = mysql_connect($host,$user,$password) or die ("Unable to connect to 
database!");
mysql_select_db($database)                 or die ("Unable to select 
datbase!");

$_SESSION['db'] = $db;
?>

The opening "if" will connect me to the correct database depending on 
whether it is local or remote without me having to fix things to work in 
a specific environment.

> 	The second problem I have is that even if something worked on my local 
> test machine that does not necessarily mean that it will work on the web 
> server.
>   
I am not sure why this would be true.
> 	When my site goes "in service" I will seriously think about using your 
> advice because at that point it would be nice to make sure something 
> works before putting it online.  At the moment I am just developing the 
> game and it is not in use, so I can play with it as much as possible 
> without bugging anyone :).
>   
If you get it setup early in the process, it will be setup. If you wait 
until later, it will be a pain to setup. Sooner is almost always better 
than later.

> 	You can take a look at my site if you like at 
> http://engarde.elementfx.com.  It looks very bland at the moment because 
> I decided to do the html and css at the end.
>
>   

["smime.p7s" (application/x-pkcs7-signature)]

_______________________________________________
Quanta mailing list
Quanta@mail.kde.org
https://mail.kde.org/mailman/listinfo/quanta


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic