Re: About cakephp's performance

2007-07-16 Thread Chris Lamb
Feris Thia wrote:

  - activating persistent models in your AppController (especially when
  you have lots of models with many associations)  
 
 Is that possible using php running as cgi ?

If you're running PHP as a CGI, I'm not sure why you are concerned about
performance.

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Cake, Eclipse and PDT (long - warning: includes rant)

2007-06-09 Thread Chris Lamb
Langdon Stevenson wrote:

 
  And scripatability. For example, I have a simple script here that
  locates the nearest Cake app, finds an unused port and starts a
  webserver pointed at it. Also, my concept of updating my sites
  involve running make release only. No faffing with FTP for me,
  please - I left that behind in 1998.
 
 Interesting.  Can you explain this further?  I was just about to set up 
 FTP for my build process, but would love to ditch it too.

I've changed it to default to 8080, but you can specify a port on the
command line.

#!/usr/bin/env python

import os, sys
import tempfile
import commands

def main():
if len(sys.argv) = 2:
port = int(sys.argv[1])
else:
port = 8080

webroot = os.getcwd()
search = ['src', 'app', 'webroot']
for i in range(len(['src', 'app', 'webroot'])):
path = os.path.join(*[webroot] + search[i:])
if os.path.exists(path):
webroot = path
break

print (Using '%s' for server.document-root) % webroot

fd, config_file = tempfile.mkstemp()
f = os.fdopen(fd, w+b)

print  f, 
server.port = %(port)d
server.document-root= %(webroot)s

server.modules = ( mod_rewrite, mod_cgi )

include_shell /usr/share/lighttpd/create-mime.assign.pl

server.dir-listing  = enable
index-file.names= (
 index.php, index.htm, index.html )

cgi.assign = ( .php = /usr/bin/php-cgi )

url.rewrite = (
^/((css|files|img|js|test\.php).*) = $0,
^/(.*) = /index.php?url=$1
)
 % { 'port' : port, 'webroot' : webroot }
f.close()

try:
print Starting lighttpd at http://localhost:%d/; % port
cmd = /usr/sbin/lighttpd -D -f %s % config_file
status, output = commands.getstatusoutput(cmd)
print output
except KeyboardInterrupt:
pass

if __name__ == __main__:
main()


Regarding upload, I use the bzr revision control system for my projects
and it's push command works well for uploading to a server.

I usually have GNU Make 'Makefiles' which reset permissions and
purge /app/tmp for me too. These are easily mastered - they are basically
shell scripts with built-in targets.

It is also possible to upload your packages as a .deb or .rpm, but I have
only tried the former.

 I will keep Ubuntu in mind, though the thought of shifting now that I
 am set up is pretty scary.

Well, Debian and Ubuntu now have the 1.1.x.x branch of CakePHP as a
package which is easy to install. I am preparing a 1.2.x.x package too,
which I will upload when I have ironed out a few problems.


/Lamby

[0] http://bazaar-vcs.org/
[1] http://packages.ubuntu.com/cakephp

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Cake, Eclipse and PDT (long - warning: includes rant)

2007-06-07 Thread Chris Lamb
Joshua Benner wrote:

 As far as having multiple java installations, do some reading about the
 alternatives system -- perhaps start with 'man alternatives'

The alternatives is a feature of Debian-derivative distros so will not
appear in Fedora.

  Right now I develop on Ubuntu 7.02 with Eclipse + PDT (I'm a big Fedora
 fan, but seriously -- if you want easy and nice, try Ubuntu).

Horses for courses. Some distros definately do not reward using
out-of-repository software, 

 It's nice using Linux because of all the debugging functionality it
 gives me

And scripatability. For example, I have a simple script here that locates
the nearest Cake app, finds an unused port and starts a webserver pointed
at it. Also, my concept of updating my sites involve running make
release only. No faffing with FTP for me, please - I left that behind in
1998.

/Lamby

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: RSS Import

2007-05-07 Thread Chris Lamb
sixlaneve wrote:

 has anyone tried to import RSS feeds with cakephp?

Yes. I recommend using SimplePie[0]. There is a snippet available[1] but
that's rather controller-centric. May I suggest creating a Model to
encapsulate the RSS functionality you need.

/Lamby

[0] http://simplepie.org/
[1] http://cakeforge.org/snippet/download.php?type=snippetid=80

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: multi-page forms

2007-04-21 Thread Chris Lamb
keymaster wrote:

 One has to first do a proper search for the solution.

One does not simply search into Mordor.

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Your client and cakePHP

2007-04-19 Thread Chris Lamb
beetlecube wrote:

 Have you received complaints from the client, when they have tried to
 add a page on their own, ? like: This cakephp stuff is complicated,
 and I just want to add another page that accesses the database, and I
 didn't know you have to create three different files for it.

I haven't had this problem. The MVC architecture is reasonably sane once
you have got your head around it. Curiously, citing the popularity of
Rails and using some of that buzz helps.

Regards,

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: How can I do login, grab web pages, parse email with cakephp/php?

2007-04-17 Thread Chris Lamb
Humble Groups wrote:

 If somebody can throw me some inputs on this, I would really
 appreciate. If this is off-topic to cakephp, please ignore.

Hmm, definately OT, but probably of interest.

Two of the best programs are Beautiful Soup[0] and Mechanize[1]. Both are
in Python, but this /is/ off-topic, remember?

Kindly,

-- 
 Chris Lamb, Leamington Spa, UK  GPG: 0x634F9A20


[0] http://www.crummy.com/software/BeautifulSoup/
[1] http://wwwsearch.sourceforge.net/mechanize/



signature.asc
Description: PGP signature


Re: Convert existing site to cakephp

2007-04-10 Thread Chris Lamb
Fiaz Khan wrote:

 I cant seem to create the site without a database, i.e. just using
 views and controllers and no models. Is this possible?

Yes.

class FooController extends AppController {
var $uses = array();
  .
  .
 etc


Regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Blank Lines before DOCTYPE

2007-04-09 Thread Chris Lamb
PaulV wrote:
 
 I've sorted it now with the help of Matti.
 
 I had extra lines at the end of a helper. I never thought to check
 those.

Let's try a bit of magic:

$ find -name *.php | xargs sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}'

Removes all trailing newlines from PHP files under the current
directory -- run from app/. Would have fixed your problem straight away.

Regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: need a php mentor close to home-Huntsville, Alabama -can pay some

2007-04-09 Thread Chris Lamb
[EMAIL PROTECTED] wrote:

 i am seeking a person close to home -say 150 miles-250 miles from
 huntsville, alabama-whereby i can hands on learn how to integrate
 scripts and build databases on my website

Have you tried finding your nearest Linux User Group? I'll bet my hat
there'll be someone who can help you out there.

Regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Debugging in Eclipse

2007-04-09 Thread Chris Lamb
Gollum wrote:

 I have a suspicions that it has something to do with mod_rewrite and
 the way it changes urls so the debugger can not work properly,

Seems like an ideal thing to be suspicious thing of. But CakePHP can work
without mod_rewrite -- just temporarily disable it in a normal site and
see how it does it, then try and apply that inside Zend/Eclipse.

Regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Another CakePHP poll

2007-04-09 Thread Chris Lamb
Cakers,

Rnickel posted this on IRC. The Cake community did a great job with the
previous poll, lets's see them in action again!

 http://www.jcxsoftware.com/


Regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Organizing, Keeping straight, your Javascript collection

2007-04-06 Thread Chris Lamb
beetlecube [EMAIL PROTECTED] wrote:

 If you keep this general purpose common.js file inside you app/js
 directory, but you also use *elsewhere*, then pretty soon they become
 un-Synchronized, like if you forget to make a copy of one to the other
 location after making changes to only one of them.
 
 I think it's a common challenge some of us face -- or not.

Symbolic links help here. But do balance having them perfectly in sync
with the problem of confusing yourself by accidently breaking a site that
you haven't touched in a little while.

If you can think of a useful way in which a CSS vendors could be
included globally in Cake, please submit an enhancement ticket - it'll
reach the people that matter a lot easier.

Kind regards,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Unit Testing Emails

2007-04-04 Thread Chris Lamb
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I develop on a Mac and don't really want to set up a mail server and
 programmatically check a POP mail account in the unit tests.
 
 Does anyone have a clever solution for unit testing emails?

Roll your own sendmail which intercepts STDIN and saves it to a file
somewhere?

 PHP will first look for sendmail in your PATH, and then in the
 following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib.

However, this would break a few unit-testing rules, especially ones about
global state - you could get race conditions if you multiple test in
parallel.

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: CakePHP, mod_rewrite and mod_vhost_alias

2007-04-04 Thread Chris Lamb
MJ Ray [EMAIL PROTECTED] wrote:

 mod_rewrite is a big gun aiming nearyour feet, while mod_vhost_alias
 makes your feet dance.  Expect to have to make a few attempts before
 missing your feet.

Made me smile :-)

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Dynamic Images

2007-04-04 Thread Chris Lamb
rtconner [EMAIL PROTECTED] wrote:

 I'm certainly open to tips on best practices and all.

Depends how dynamic you mean. You will definately want some caching if
the images can be reused, otherwise a DoS attack is trivial. I've used
lighttpd's X-Send-File[0] for serving the files before.

[0] http://blog.lighttpd.net/articles/2006/07/02/x-sendfile

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Debian cakephp installation

2007-04-03 Thread Chris Lamb
rocky [EMAIL PROTECTED] wrote:

 Can any of you give me some hint please?

Check your AllowOverride in /etc/apache2/mods-enabled/userdir.conf ?

Is PHP installed correctly?

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


cake-php on Gmane

2007-04-03 Thread Chris Lamb

Cake-php,

This list is now on Gmane, giving a few more methods for viewing the
contents:

 http://dir.gmane.org/gmane.comp.php.cakephp.general

The 'bloggy' interface looks attractive too:

 http://blog.gmane.org/gmane.comp.php.cakephp.general

Even less excuse for searching the archives now, folks. :)

(On a related note, may I propose the admins creating a cake-php-announce
list? I sometimes miss project announcements between other mails)


Enjoy,

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving in a loop

2007-04-03 Thread Chris Lamb
BlenderStyle [EMAIL PROTECTED] wrote:

 I still don't understand how it works completely.

Take a look at the Cake source - it's not that scary, and will improve
your understanding far greater than anything written in English.

Regarding the create function, I would suggest using create() over
setting id to null as it follows the same verb used when discussing the
active record pattern elsewhere: having a consistent lexicon is one of
the key points of Design Patterns. In addition, calling the create()
allows one to override the functionality in your model in the future, if
you need to.

-- 
 Chris Lamb, Cambridgeshire, UK  GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Mailing List Suggestion

2007-03-23 Thread Chris Lamb
Chris Hartjes [EMAIL PROTECTED] wrote:

 On 3/23/07, Otan [EMAIL PROTECTED] wrote:
  When a mailing list post is delivered through email, please prepend
  the text [CakePHP] to the subject line of each email.

Eww, no, that's horrible.
 
 Please add a filter to your email software that puts any messages from
 cake-php@googlegroups.com to a separate folder. 

Yes, do that :-)


-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: sessions in cake db _gc

2007-03-22 Thread Chris Lamb
jyrgen [EMAIL PROTECTED] wrote:

 on my local machine i find that expired session entries
 are deleted automatically.
 
 on a remote webserver there are more than 40 entries..
 
 possibly the cake garbage collection is not being called.

40 entries is bad? Are they old? What are the timestamps? I'm not sure
this is a problem.

If it helps, Cake defaults to using PHP's way of handling sessions -- to
see which you are using, see CAKE_SESSION_SAVE in
$(APP)/config/config.php. Of course, if you have this set to php, then
please poke your PHP configuration to fix this.


Kind regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Does Cake's array conventions mean Low Orthogonality/Cohesion

2007-03-22 Thread Chris Lamb
Felix Geisendörfer [EMAIL PROTECTED] wrote:

  I'm looking for someone to give me a hug and tell me everything will 
  be ok.  

 I'll go ahead and do this: *hug*

*hug* everything will be okay.

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: a very newbie-ish db problem

2007-03-22 Thread Chris Lamb
davezes [EMAIL PROTECTED] wrote:

 Is password the user password or the db password?

DB password.

 What is login? is that the computer username?

It's your MySQL login username, but it's probably is the
same as your local username -- mySQL maintains it's own username and
password database.

If you can edit your database from the command line, then you probably
have setup a passwordless login for your login account which I'm
guessing is 'davezes'. The mysql_connect function doesn't like this as
it is expecting a password (see using password: YES).

Try configuring a password for your account?

 [EMAIL PROTECTED]:~$ mysqladmin password mypassword


Kind regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: model not found .. inflection problem?

2007-03-22 Thread Chris Lamb
lamacq [EMAIL PROTECTED] wrote:

 Any ideas?

Can you paste your controller? Specifically, the class variables.

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Introducing myself

2007-03-19 Thread Chris Lamb
gwoo [EMAIL PROTECTED] wrote:

 I can assure you that if no one was moderating this group it would be
 much uglier.

Thank you for your efforts here.

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


License of CakePHP documentation

2007-03-19 Thread Chris Lamb
Hi cake-php,

What is the license of the CakePHP manual?

The index.html says:

 Copyright © 2006 Cake Software Foundation Inc.
 This work is licensed under the NEED TO CHOOSE LICENSE; you can see the
 full terms of the license here

where here is a link to http://cakephp.org. 

Can anyone enlighten me? I'm of course assuming that NEED TO
CHOOSE LICENSE is not a real license. :]


Kind regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Problem Redirecting to Servlet

2007-03-12 Thread Chris Lamb
Mariano Iglesias [EMAIL PROTECTED] wrote:

 This issue was solved some time ago:
 
 https://trac.cakephp.org/ticket/2060

I looked at the API docs[0] which is currently at 1.1.113.4450, whilst
the above ticket was fixed in 1.1.113.4462.

Sorry for the confusion, I assumed a.c.o would be up to date :)

Kind regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Problem Redirecting to Servlet

2007-03-11 Thread Chris Lamb
g [EMAIL PROTECTED] wrote:

 How do I do it so it doesn't automatically append the base URL of the
 cake app?

I don't believe it is possible - Controller:redirect will always
prefix the URL with the FULL_BASE_URL constant.

Try:

  if (function_exists('session_write_close'))
  {
session_write_close();
  }
  header(Location: http://localhost:8080/SMSUploadServlet;);
  exit();


Regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Page not refreshed after $this-redirect

2007-03-11 Thread Chris Lamb
Adrian Maier [EMAIL PROTECTED] wrote:

 The problem is that the page is not refreshed, and the deleted record
 is still visible until i  click the browser's Refresh button.

This[0] is probably what you want.

Regards,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20

[0] http://preview.tinyurl.com/2ppndx


signature.asc
Description: PGP signature


Re: View this page Cake Apps/Sites In The Wild

2007-03-03 Thread Chris Lamb
phirschybar [EMAIL PROTECTED] wrote:
 
 I started a page to feature Cake apps and sites in the wild. Hoping
 this will help to garner some more attention on Cake and rally the
 community. :)

I don't want to signup for a Google account. Somebody feel free to add
http://idiomag.com/.


Kindly.

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: security - verify POST via submit button

2007-02-28 Thread Chris Lamb

 how can i make sure that user data have been submitted via
 pressing a submit button instead of sending spagetti code
 appended to the controller url ?

Check out the Security Component page in the manual. [0]


Kind wishes,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20

[0] http://manual.cakephp.org/chapter/security


signature.asc
Description: PGP signature


Re: Please help me understand URL and Routes in Cake

2007-02-28 Thread Chris Lamb

 I understand that Cake does [routing] this in two phases, one
 using apache mod rewrite to pass the rest of the path to cake and the
 second one by Routes to further route the URL in cake internally. Is
 this correct?

Yes.

 I assume that the major purpose of the Routes is to map URLs to
 controllers, functions and parameters.

Correct.

 1. I've seen a colon (:) used in the manual in routes config (like /
 blog/:action/* ). What is the special meaning of the colon? It isn't
 mentioned anywhere.

They are to control the parameters that are passed to the Controller.
I think the syntax is a Ruby-ism. First, the general case. If your
route is:

  /blog/:spam/* 

then if the browser requested

  /blog/eggs/

then $this-params['spam'] would contain the value 'eggs'. You can have
more than one in the route. For example:

  /blog/:year/:month/:day/:slug/*

gets you something like the default WordPress blog link structure.
There are two 'magic' parameters, controller and action which, when
set, decide which controller or action to call respectively. For
example, the route:

  /blog/:action/:spam

when called with:

  /blog/view/eggs/

will call the view action with $this-params['spam'] set to eggs.


 2. Can I use regular expressions in Routes like on mod rewrite? How?
 The manual doesn't mention it.

Just use regular Perl-compatible regexs.


 3. Can I still use URL query string parameters using ? ? Or does
 cake only use the /controller/action/param/param... convention?

Cake has a different method of handling query string parameters. My
advice is to construct a controller action to display $this-params and
see how they are handled.


 Hope I am making myself clear. Sorry for the long message.

Hopefully someone else can help with the rest if the above does not
help you solve the problem yourself. Note that the CakePHP source is
very readable for a PHP program, so examining the dispatcher code may
make sense than any of this.

Best wishes,

-- 
 Chris Lamb, Leamington Spa, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: how would you scale a cake app?

2006-12-24 Thread Chris Lamb

Langdon Stevenson [EMAIL PROTECTED] wrote:
 I think that I would likely just replicate the entire application
 across multiple web servers, and hand out the requests in a round
 robin to the web servers.

Or maybe FastCGI's load balancing?

 I would be very interested to hear anyone else's thoughts on this
 too.

Good use of caching would help prolong the time before having to scale
up, as well as reducing hardware requirements. Cake's own caching is
really neat, as are things like lighttpd's mod_cml or traditional
options like squid. Remember that web servers are *extremely* good at
serving static content!

I should really add the general warning against premature optimisation
here, but I'm sure you've heard it before.


Best wishes,

-- 
 Chris Lamb, Cambridgeshire, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Joining 2 tables - better practice?

2006-12-23 Thread Chris Lamb

leamas [EMAIL PROTECTED] wrote:
 However, would there be a way of making it so that I didn't have to
 have two foreach loops?

Umm, maybe with array_walk_recursive with a callback function or
something, but this way is /much/ cleaner. PHP doesn't have this
functionality direct like, say, Python.

Regards,

-- 
 Chris Lamb, Cambridgeshire, UKGPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: What Editor Do You Use

2006-09-24 Thread Chris Lamb


jEdit and vim here.

jEdit has a rather nice plugin architecture, and it would be really nice
to see something Cake-related but I've never been sure what other people
would want. Anybody want to contribute?

Lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: pages_controller

2006-09-15 Thread Chris Lamb


Afternoon.

On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote:

 I have modified the default pages controller to add a few tweaks by
 first copying it to my app directory.  I then renamed it to
 static_controller.php, modifying the code and the views directory
 appropriately.

Did you consider extending PageController instead? Being able to still
call $this-display() is quite useful from a maintainability aspect
imho, as this function is quite well known to most Cake'ers.


 The way the default pages controller (which is now my 'static'
 controller) is setup it is not meant to have multiple actions defined.

What's wrong with multiple actions OOI? They will always return 404 if
you do not have a view for them.


Regards,

lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: pages_controller

2006-09-14 Thread Chris Lamb


Evening.

On Thu, 14 Sep 2006 14:43:17 -0700, [EMAIL PROTECTED] wrote:

 I have added my own function to the pages_controller:
 
 function test() {
   $this-set('abc', 'something');
 }
 
 The controller does load the correct view! (test.thtml) But the $abc
 var is Undefined!

What's happening is that the routes are configured so that all URLs in
the form /pages/something actually call the display() function in
pages_controller, regardless of what something is.

You can confirm this by putting  die('in test function')  inside
test() - it won't get called.


As for a solution. try adding another route in core/routes.php:

$Route-connect('/pages/test', array('controller' = 'pages', 'action'
= 'test'));

And then modify pages_controller.php:

function test() {
$this-set('abc', 'something');
$this-display()
}


Might be a nicer way of doing it, however.


Regards,

--lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: Apache crashing on debug from PHP IDE

2006-09-14 Thread Chris Lamb


On Thu, 14 Sep 2006 09:55:09 -, Walter wrote:
 
 If anyone's interested, I found a solution:
 
Karma to Walter for posting the solution - I find it annoying to Google
something and only find other people asking the question. :)


--lamby


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: download problem

2006-09-11 Thread Chris Lamb


Heh, I had this issue too: was copy/pasting the URL from inside
Cakeforge to use with wget, and was wondering why it was corrupted!

Maybe I should submit a ticket? ;)


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: newbie: Obfuscating a CakePhp project

2006-09-03 Thread Chris Lamb

On Sun, 3 Sep 2006 14:01:18 -0400, Chris Hartjes wrote:
..snipped a whole load of common sense..


On a related note, never ask the 'obfustication' question in #php. I've
seen other people do it, and the outcome is not pretty.


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: Outputting Code on a Website

2006-08-16 Thread Chris Lamb


Hi

On Wed, 16 Aug 2006 15:19:59 -0700
John Zimmerman [gmail] [EMAIL PROTECTED] wrote:

 Basically I just want to display php code within a web page.

GeSHIi[0] seems to be the de-facto library for doing this.


Chris

[0] http://qbnz.com/highlighter/

-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Aahhh!! I have a blog now!

2006-08-13 Thread Chris Lamb



 I'll add it to my cakenews http://thinkingphp.org/cakenews/ ..

Good luck..I see no feed. :(

Chris

-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: get CakePHP version

2006-08-08 Thread Chris Lamb


On Tue, 08 Aug 2006 04:35:56 -0400
Felix Geisendörfer [EMAIL PROTECTED] wrote:

 parsing a text file fon every request just to get the version number
 seems a bit circuitous to me as well.

Hardly intensive though. I mean, you are opening, reading, parsing,
lexing and ulitimately executing tens of PHP files for every request..


-- 
 Chris Lamb, Cambs, UK  WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Can you find out the last controller/action?

2006-08-07 Thread Chris Lamb


Hi

On Mon, 7 Aug 2006 12:58:17 -0700
John Zimmerman [gmail] [EMAIL PROTECTED] wrote:

 This won't work all the time and can't be completely trusted, but you
 can write a function to deal with different scenarios based on the
 contents of $_SERVER['HTTP_REFERER'].

Cake already has such a function, $this-redirect($this-referer()),
but--as you mention--it won't work if people turn it off.

Regards,

Chris

-- 
 Chris Lamb, Cambridgeshire, UK WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Help on saving a blob

2006-08-03 Thread Chris Lamb

Hi,

 Bret Kuhns [EMAIL PROTECTED] wrote:

 Now all of the binary data will be stored in a blob in your table
 (don't let the skeptics scare you away from this approach

This[0] is an interesting read (check the comments too!) on this
subject.

 And it'll probably help to keep track of the image's MIME
 content-type with another table column if you're going to have a PHP
 script that outputs the blob field data.

Don't forget that the uploaded MIME type can be faked[1]. You may want
to look into using the command 'magic' or getimagesize()[2] to get a
real MIME type.


Regards,

--Lamby


[0]
http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.html
[1] http://uk2.php.net/features.file-upload
[2] http://uk.php.net/manual/en/function.getimagesize.php

-- 
 Chris Lamb, Cambridgeshire, UK WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: Paradigm shift :: Procedural - OO Paterns based development

2006-08-02 Thread Chris Lamb


Hi Kestrel,

 I found a web link into the IRC channel a few days ago and haven't
 been able to find it again since. Pointers please...

Here[0], although it is best to connect using a 'proper' IRC client
(details on the same page)
 
 I will be honest, this has been more of a venting excercise for me and
 I appreciate if you have read this far. If you can help on any of the
 above that would be great. Otherwise, thanks for hearing (reading) me
 out :-)

I visited your site and it looks like you are progressing well,
congratulations!

In reference to your questions, you would probably want to avoid things
like using comma-seperated fields instead of associating with another
table: Cake makes these things easier anyway. In addition, Cake makes
it easy to set up both the drag-and-drop and the drop-down
functionality you mentioned.

(By the way, if you enjoy writing or find it useful (or maybe just a
venting exercise, haha) have you considered starting a Cake blog?)


Best wishes, and good luck with CakePHP.

--Lamby

[0] http://irc.cakephp.org/irc.html
-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: hasAndBelongsToMany with a join table with a datetime column

2006-08-02 Thread Chris Lamb

Hi Matt,

 However if I create a third model can I use that to order the results?

Sure you can :)

 class Member extends AppModel
var $name = 'Member';
var $hasMany = array('MemberTeam' = array(
'className'   = 'MemberTeam',
'order'   = 'MemberTeam.created'
));
 } 

 class Team extends AppModel { 
var $name = 'Team';
var $hasMany = array('MemberTeam' = array(
'className'   = 'MemberTeam',
'order'   = 'MemberTeam.created'
));
 } 

 class MemberTeam extends AppModel { 
var $name = 'MemberTeam';
var $hasOne = 'Member,Team';
 }


Cake should also fill in the 'created' field automatically for you.

Regards,

--lamby

-- 
 Chris Lamb, Cambridgeshire, UK WWW: http://chris-lamb.co.uk
  Q. Why is top posting bad? GPG: 0x634F9A20
  A. Because it breaks the logical sequence of discussion


signature.asc
Description: PGP signature


Re: Cake PHP and templates

2006-08-01 Thread Chris Lamb

Philip,

 I wanted to use a PHP template system with CakePHP..

Why? Please read this. [0]

 My idea was to convert the PHP variables to Javascript using JSON (but
 didn't work out how to do this successfully). Then to use these
 variables in Javascript to be passed through the Javascript template
 as above.

*blinks* Are you on sure you really want to do this? The TrimPath
engine is meant for static (ie non server-side) pages to be able to
perform quasi-queries on static data (say, a whole load of HTML pages
burnt to a CD or DVD), not to do the job of PHP.


--lamby

[0]
http://www.phppatterns.com/docs/design/templates_and_template_engines

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: cheeseCake Photoblog V1.0 Beta 2 released

2006-07-31 Thread Chris Lamb

Tarique,
 
 Demo is at  http://sanisoft-demo.com/cheesecake/

Looks nice!


On a related note, we may be running out of 'cake' words for
cake projects, so people should reserve them ASAP:

[EMAIL PROTECTED]:~$ perl -ne print if /cake[^\'s]/ /usr/share/dict/words
cake
caked
cheesecake
coffeecake
cupcake
fruitcake
griddlecake
hotcake
pancake
pancaked
shortcake


Regards,

Chris

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: datetime strings and using sanitize-cleanArray()

2006-07-31 Thread Chris Lamb

On Mon, 31 Jul 2006 02:34:29 -0700
AD7six [EMAIL PROTECTED] wrote:

 Why use sanitize at all? Data sent to the DB get´s escaped anyway, so
 it´s not exactly necessary. I thought the intention of the sanitize
 class was for example, so you could still escape your custom sql
 queries easily.

Well, cleaning potentially dangerous HTML to combat XSS[1] attacks is
useful.


[1] http://en.wikipedia.org/wiki/Cross-site_scripting


-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Character sets

2006-07-31 Thread Chris Lamb

Hi,

Firstly, ISO8859-1 (or Latin-1) has rather limited character set[1]
and you should consider sticking with Unicode (in your case UTF-8)

 Can someone give a GOOD explenantion about character encoding.

The eminent Joel Spolsky gives an excellent guide[1] to character
encodings from the programmers point of view. Everyone reading this
post should read this.

With regard to your problem the W3[2] say:

 It is very important that the character encoding of any XML or (X)HTML
 document is clearly labeled, so that clients can easily map these
 encodings to Unicode.
  (Source: [2])

So, can you first check whether your view that houses the input
element which will be autocompleted contains the magic:

 meta http-equiv=Content-Type content=text/html;charset=utf-8 /

in the head section? 

Regards,

Chris


[1] http://www.htmlhelp.com/reference/charset/
[2] http://www.joelonsoftware.com/articles/Unicode.html
[3] http://www.w3.org/
[4] http://www.w3.org/International/O-charset

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Time Zone ?

2006-07-18 Thread Chris Lamb

Andy, 

Cake's 'created' and 'modified' magic uses the PHP date() function. The
Best Practice for dates is to store all dates interally in UTC/GMT, and
apply an offset on viewing. If you would prefer not to do this, check
out:

http://uk2.php.net/manual/en/function.date-default-timezone-set.php
or
http://uk2.php.net/manual/en/function.setlocale.php

Regards,

Chris


On Tue, 18 Jul 2006 14:01:32 -0700
seefai [EMAIL PROTECTED] wrote:

 
 Hi brother,
 
 I am Andy from Malaysia and just a begineer to cakePHP.
 
 I having a problem that when i try to save a Created/Modified date (By
 Cake's Default) in to the database, i will get 8 hours delay of the
 time, can i know how to solve it
 
 Thanks
 
 Best wishes,
 
 Andy
 
 
 --~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google
 Groups Cake PHP group. To post to this group, send email to
 cake-php@googlegroups.com To unsubscribe from this group, send email
 to [EMAIL PROTECTED] For more options, visit this
 group at http://groups.google.com/group/cake-php
 -~--~~~~--~~--~--~---
 


-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Time Zone ?

2006-07-18 Thread Chris Lamb

Oh dear, crossed posts..
 
 I have some basics going for timezones like this, but maybe somebody
 has a more robust solution?

Pear::Date? [1]

Chris

[1] http://pear.php.net/package/Date

-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: Using cake to serve files

2006-07-16 Thread Chris Lamb

Don't forget that using PHP to serve up lots of files is very slow.. if
you're using Lighttpd, check out:

http://blog.lighttpd.net/articles/2006/07/02/x-sendfile

Lamby


On Sat, 15 Jul 2006 01:41:20 -0700
georgeL [EMAIL PROTECTED] wrote:

 
 Other file serving php scripts do this by putting the files somewhere
 else on your system outside of the webroot.
 
 
 --~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google
 Groups Cake PHP group. To post to this group, send email to
 cake-php@googlegroups.com To unsubscribe from this group, send email
 to [EMAIL PROTECTED] For more options, visit this
 group at http://groups.google.com/group/cake-php
 -~--~~~~--~~--~--~---
 


-- 
 Chris Lamb, Cambridgeshire, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature


Re: md5 field - modify field from controller

2006-06-29 Thread Chris Lamb

AD7six,

 if (!preg_match(VALID_MD5, $password))
 {
   $this-data['Member']['password'] =
  md5($password); } return true;
 }

But what if your plaintext password looks like a valid MD5 string?

Myself and quite a few friends do this for some logins. If I did
that here, then my password would be stored as plaintext in the
database and thus I wouldn't be able to login.

I guess a simple fix
would be to restrict the type of password that can be saved, but that
would annoy people like me ;)

Lamby

-- 
 Chris Lamb, Leamington Spa, UK  [EMAIL PROTECTED]
  WWW: www.chris-lamb.co.uk GPG: 0x634F9A20


signature.asc
Description: PGP signature