php-general Digest 25 Mar 2008 15:22:44 -0000 Issue 5367

Topics (messages 272060 through 272074):

question about linux editor
        272060 by: Sudhakar
        272061 by: Casey
        272063 by: Mark Weaver
        272064 by: Casey
        272066 by: Nilesh Govindrajan
        272067 by: Ross McKay
        272071 by: Daniel Brown
        272073 by: Jay Blanchard

Re: help with autoload
        272062 by: Carlton Whitehead

Contract PHP/Wordpress Programmer Needed
        272065 by: Flewid Admin

mysql joins
        272068 by: Steven Macintyre
        272069 by: Andrew Ballard
        272070 by: Thiago Pojda

Re: Date math
        272072 by: Ron Piggott

Re: Why won't this query work?
        272074 by: Zoltán Németh

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
i need to connect to the linux server using an editor. can anyone suggest
which would be an ideal linux editor to connect to the server.
apart from the ip address, username and password are there any other details
i would need to connect to the server.

please advice.

thanks.

--- End Message ---
--- Begin Message ---
On Mon, Mar 24, 2008 at 7:28 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
> i need to connect to the linux server using an editor. can anyone suggest
>  which would be an ideal linux editor to connect to the server.
>  apart from the ip address, username and password are there any other details
>  i would need to connect to the server.
>
>  please advice.
>
>  thanks.
>

Putty!

-- 
-Casey

--- End Message ---
--- Begin Message ---
Casey wrote:
On Mon, Mar 24, 2008 at 7:28 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
i need to connect to the linux server using an editor. can anyone suggest
 which would be an ideal linux editor to connect to the server.
 apart from the ip address, username and password are there any other details
 i would need to connect to the server.

 please advice.

 thanks.


Putty!


er... no... he said from Linux! :)

--

Mark
-------------------------
the rule of law is good, however the rule of tyrants just plain sucks!
Real Tax Reform begins with getting rid of the IRS.
==============================================
Powered by CentOS5 (RHEL5)

--- End Message ---
--- Begin Message ---
On Mon, Mar 24, 2008 at 8:09 PM, Mark Weaver <[EMAIL PROTECTED]> wrote:
>
> Casey wrote:
>  > On Mon, Mar 24, 2008 at 7:28 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
>  >> i need to connect to the linux server using an editor. can anyone suggest
>  >>  which would be an ideal linux editor to connect to the server.
>  >>  apart from the ip address, username and password are there any other 
> details
>  >>  i would need to connect to the server.
>  >>
>  >>  please advice.
>  >>
>  >>  thanks.
>  >>
>  >
>  > Putty!
>  >
>
>  er... no... he said from Linux! :)
>

No, he said /to/ Linux! :0
-- 
-Casey

--- End Message ---
--- Begin Message ---
Sudhakar wrote:
i need to connect to the linux server using an editor. can anyone suggest
which would be an ideal linux editor to connect to the server.
apart from the ip address, username and password are there any other details
i would need to connect to the server.

please advice.

thanks.


gedit

--- End Message ---
--- Begin Message ---
On Tue, 25 Mar 2008 11:28:07 +0900, Sudhakar wrote:

>i need to connect to the linux server using an editor. can anyone suggest
>which would be an ideal linux editor to connect to the server.

Geany - http://geany.uvena.de/

Also look at:

Quanta Plus - http://quanta.kdewebdev.org/
Bluefish - http://bluefish.openoffice.nl/
Zend Studio (not free) - http://www.zend.com/en/products/studio/

>apart from the ip address, username and password are there any other details
>i would need to connect to the server.

How are you proposing to connect? e.g.

* FTP down the files, edit them, FTP them up again
* mount the remote server via NFS
* mount the remote server locally via SFTP
* run the editor remotely: ssh -Y [EMAIL PROTECTED] 

etc.

A conventional way would be to have a development environment locally,
into which you transfer the files from the Linux server, edit them,
TEST! them, and transfer back the changes (e.g. via FTP).
--
Ross McKay, Toronto, NSW Australia
"Let the laddie play wi the knife - he'll learn"
- The Wee Book of Calvin

--- End Message ---
--- Begin Message ---
On Mon, Mar 24, 2008 at 10:28 PM, Sudhakar <[EMAIL PROTECTED]> wrote:
> i need to connect to the linux server using an editor. can anyone suggest
>  which would be an ideal linux editor to connect to the server.
>  apart from the ip address, username and password are there any other details
>  i would need to connect to the server.

    An editor would be what you would use once you're already
connected to the server (or once you've synchronized files with your
local machine).

    I'm a command-line junkie, and a full-time Linux user (with the
exception of my PDA and half of my laptop).  So I SSH into the remote
server and use 'vi' to edit the files.  From the command line on an
SSH connection, some of the editors you'll have available to you in
almost all cases are vi/vim, pico/nano, and ed, among others.

-- 
</Daniel P. Brown>
Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

--- End Message ---
--- Begin Message ---
[snip]
> i need to connect to the linux server using an editor. can anyone
suggest
[/snip]

I use Putty to connect and then call all sorts of command line editors.
I may have Putty windows open to many servers at once.

--- End Message ---
--- Begin Message ---
Jonathan Mast wrote:
I have a project the someone else wrote and that I can't get to work.

It uses a rather large library of classes that are not apparently getting
loaded by the provided __autoload() function.

I'm not very well versed in PHP and one of the first things I did was see if
in fact the __autoload function was being called.  I place some print
statements in it and got no result.  But I don't know if that is because it
is not really calling that function or perhaps the print outs are out of
scope and won't be catched by the browser, I don't know.

thanks,

PHP: 5.1
TOMCAT: 5.5
Windows XP


Hi Jonathan,

Almost certainly the __autoload function is not being called by the parent script. Make sure the parent script that is being run (based on the URL in your browser) did an "include" or "require" against the script containing the autoload function definition. Also make sure the path used for it is correct. It's really hard to say without looking at the code and filesystem.

Just for kicks I made a test case to see if print works from inside the __autoload function, and it did.

Regards,
Carlton Whitehead

--- End Message ---
--- Begin Message ---
Contract Developer Needed – Make Good Money from Home!

Do you need to make some extra cash, looking for part time programming work?

Flewid Incorporated, a leader in Global Creative IT Consulting is
looking for energetic, affordable web enthusiasts working from home or
part time to help with development of online applications. Platforms
utilized would be common Open-Source CMS Solutions running on standard
Open-Source LAMP servers. If you have .NET ninja skills (C# or
VB.NET), that's great but not a requirement.

The ideal candidate is quick to produce with high attention to detail.
Flewid Incorporated would like to round out their team with
programmers capable of doing basic design work in conjunction with the
coding needed to bring a site online. If this sounds like you, Read
on.

Responsibilities Include:
•       Word Press Template Customization
•       Creating CSS Based Layouts from Photoshop Documents
•       Basic Search Engine Optimization
•       Setup, Installation, Troubleshooting of Word Press
•       Client Interaction where required via email
•       Basic Database (MySQL Administration) with PHPMyAdmin

Key Requirements:
•       Proficiency in Linux, Apache, MySQL, PHP, HTML, Photoshop, ImageReady
•       Familiarity with standard Project Management Tools and Version Control 
Systems
•       Extensive Experience with Wordpress or Joomla CMS
•       Strong organization and communication skills
•       HTML/CSS Standards Compliant Design Abilities
•       Able to work well independently

Please forward expected hourly rate, resume in PDF or .DOC or .ODT
format and some samples of Applications or Sites you have built, with
source code if applicable to [EMAIL PROTECTED]

Applicants who do not include portfolio, samples or verifiable
references will not be considered.

For more information about our company please see our website, flewid.ca

Thanks,
Flewid Administrative Team

--- End Message ---
--- Begin Message ---
 I have three tables, namely;

User 
- UID 
- Firstname
- Surname
- Tel
- Cell
- Email

Tracker 
- UID
- Points

Winners
- UID
- Datetime (0000-00-00 00:00:00)

I need to get the following information from the above tables (in my logical 
sense)

All users from user with sum(points) as points and datetime > datetime + 14 days

In English, the all users must be selected, excluding the ones that have won in 
the last 14 days and return all the information and the sum of points

I suspect I would need to use joins here ... but have no clue how to do so ... 
I have read up a bit and can work out inner joins from three tables, but not 
coping with this problem above

Can someone help me out with this please?

Many thanks 

Steven



--- End Message ---
--- Begin Message ---
On Tue, Mar 25, 2008 at 8:20 AM, Steven Macintyre
<[EMAIL PROTECTED]> wrote:
>  I have three tables, namely;
>
>  User
>  - UID
>  - Firstname
>  - Surname
>  - Tel
>  - Cell
>  - Email
>
>  Tracker
>  - UID
>  - Points
>
>  Winners
>  - UID
>  - Datetime (0000-00-00 00:00:00)
>
>  I need to get the following information from the above tables (in my logical 
> sense)
>
>  All users from user with sum(points) as points and datetime > datetime + 14 
> days
>
>  In English, the all users must be selected, excluding the ones that have won 
> in the last 14 days and return all the information and the sum of points
>
>  I suspect I would need to use joins here ... but have no clue how to do so 
> ... I have read up a bit and can work out inner joins from three tables, but 
> not coping with this problem above
>
>  Can someone help me out with this please?
>
>  Many thanks
>
>  Steven

See what mileage this gets you.

SELECT   User.UID, FirstName, Surname, Tel, Cell, Email, SUM(Points)
AS TotalPoints
FROM     User INNER JOIN
         Tracker
             ON  User.UID = Tracker.UID
             LEFT OUTER JOIN
         Winners
             ON  User.UID = Winners.UID
WHERE    `Datetime` < DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL -14 DAY)
   OR    `Datetime` IS NULL
GROUP BY User.UID, FirstName, Surname, Tel, Cell, Email


The OUTER JOIN and the last line (OR `Datetime` IS NULL) is there so
that your query will include results for users who have never won. I
don't think it this is optimized (or how you could do so if needed)
since the IS NULL condition will probably make the query use a table
scan rather than an index.

Andrew

--- End Message ---
--- Begin Message ---
not sure how timestamps work in MySQL, but I've written this in Oracle:

CREATE TABLE USaR (
  UsID char(255) null,
  Firstname char(255) NULL,
  Surname char(255) NULL,
  Tel char(255) NULL,
  Cell char(255) NULL,
  Email char(255) NULL
)
/
CREATE TABLE Tracker(
  UsID  CHAR(255) NULL,
  Points CHAR(255) NULL
)
/
CREATE TABLE Winners(
  UsiD CHAR(255) NULL,
  DateTime DATE NULL
)
/

/* Inserted some values in those tables and then executed: */ 

select
  us.usid, --I couldn't get the Firstname as it's not a group by element (?)
  Sum(tr.points) 
from
  usar us, --in mysql you'll have to do 'usar as us'
  tracker tr, --tracker as tr
  winners wn --winners as wn
where
    us.usid = tr.usid --here is the join magic
and us.usid = wn.usid --and here
AND wn.datetime < (SYSDATE - 14) --winner date has to be less than 14 days
from today
GROUP BY us.usid  --separate per user;


I hope this helps :)

This will *NOT* bring you users that never won or have no points (since they
don't have any record in winners table)

Regards,
Thiago

-----Mensagem original-----
De: Steven Macintyre [mailto:[EMAIL PROTECTED] 
Enviada em: terça-feira, 25 de março de 2008 09:21
Para: [EMAIL PROTECTED]
Assunto: [PHP] mysql joins

 I have three tables, namely;

User
- UID
- Firstname
- Surname
- Tel
- Cell
- Email

Tracker
- UID
- Points

Winners
- UID
- Datetime (0000-00-00 00:00:00)

I need to get the following information from the above tables 
(in my logical sense)

All users from user with sum(points) as points and datetime > 
datetime + 14 days

In English, the all users must be selected, excluding the ones 
that have won in the last 14 days and return all the 
information and the sum of points

I suspect I would need to use joins here ... but have no clue 
how to do so ... I have read up a bit and can work out inner 
joins from three tables, but not coping with this problem above

Can someone help me out with this please?

Many thanks 

Steven



--
PHP General Mailing List (http://www.php.net/) To unsubscribe, 
visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Could someone then help me modify the PHP script so I won't have this
timezone issue?  I don't understand from looking at the date page on the
PHP web site the change(s) I need to make.  Thanks, Ron

<?

$date1 = strtotime($date1);
$date2 = strtotime($date2);

$factor = 86400;

$difference = (($date1 - $date2) / $factor);

On Mon, 2008-03-24 at 07:24 -0700, Jim Lucas wrote:
> Ron Piggott wrote:
> > I have this math equation this list helped me generate a few weeks ago.
> > The purpose is to calculate how many days have passed between 2 dates.  
> > 
> > Right now my output ($difference) is 93.9583333333 days.  
> > 
> > I am finding this a little weird.  Does anyone see anything wrong with
> > the way this is calculated:
> > 
> > $date1 = strtotime($date1); (March 21st 2008)
> > $date2 = strtotime($date2); (December 18th 2007)
> > 
> > echo $date1 => 1206072000
> > echo $date2 => 1197954000
> > 
> > #86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
> > worth of seconds)
> > 
> > $factor = 86400;
> > 
> > $difference = (($date1 - $date2) / $factor);
> > 
> > 
> > 
> 
> As Casey suggested, it is a timestamp issue.
> 
> Checkout my test script.
> 
> http://www.cmsws.com/examples/php/testscripts/[EMAIL PROTECTED]/0001.php
> 
> <plaintext><?php
> 
> $date1 = strtotime('March 21st 2008'); //(March 21st 2008)
> echo "date1 = {$date1}\n";
> 
> $date2 = strtotime('December 18th 2007'); //(December 18th 2007)
> echo "date2 = {$date2}\n";
> 
> $date1 = 1206072000;
> echo date('c', $date1)."\n";
> 
> $date2 = 1197954000;
> 
> echo date('c', $date2)."\n";
> 
> 
> #86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days worth of 
> seconds)
> 
> $factor = 86400;
> 
> $difference = (($date1 - $date2) / $factor);
> 
> echo $difference."\n";
> 


--- End Message ---
--- Begin Message ---
2008. 03. 24, hétfő keltezéssel 14.40-kor Daniel Brown ezt írta:
> On Mon, Mar 24, 2008 at 2:29 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
> >
> >  It's already been escaped, $business is pulled out of the database
> >  after they log in. :)
> 
>     I don't care, Prune.
> 
>     (I still get a kick out of knowing that.  Who was it, Jochem or
> Zoltan who said that?  ;-P)

/me points at Jochem ;)

greets
Zoltán Németh

> 
>     NEVER trust that the data is escaped regardless of where it
> originated.  Supposed someone else writes a script to tie into your
> database and doesn't escape it, and Hagar The Horrible's
> great-great(^15) grandson, Hacker The Horndog comes in and finds the
> vulnerability, and enters the company name as "';DELETE FROM current
> WHERE 1;SELECT * FROM current WHERE 1 "?
> 
>     Bye, data.
> 
>     Learn: http://xkcd.com/327/
> 
> -- 
> </Daniel P. Brown>
> Forensic Services, Senior Unix Engineer
> 1+ (570-) 362-0283
> 


--- End Message ---

Reply via email to