Re: Possible Memory Leak
I don't know about that. Years ago people might have said PHP isn't made for command-line scripting, but then PHP 4.3 came along and gave us a command-line PHP SAPI and it works great. PHP may have been initially designed for serving web pages, but it's a fine general-purpose language that can do most anything you want it to, and it is of great benefit when you can use as few programming languages as possible. Sure, this particular task might benefit from being done in parallel, but why not parallel PHP processes? I am in the process of writing a daemon in PHP, as a CakePHP shell, and I too have the expectation that there will not be memory leaks (though I have not measured it yet). The term isn't quite right, of course -- an interpreted garbage-collected language like PHP can't have memory leaks in the traditional sense (since you're not allocating and deallocating memory yourself) unless there is a bug in the PHP language itself that's causing this, which I kind of doubt given its popularity and age. Rather, I'd assume at this point that CakePHP is caching or logging some information within itself (perhaps collecting all the SQL queries in an array or something), under the assumption that all scripts will be short-lived and it won't matter; if so, CakePHP might want to reconsider that assumption. Or perhaps this is already governed by the debug config setting, or another config setting that we need to discover. On Feb 22, 2011, at 00:19, Walther wrote: This sounds like exactly the sort of task that PHP isn't made for. Right tool for the job and all that. On Feb 22, 5:30 am, Dr. Tarique Sani tariques...@gmail.com wrote: Web servers are simply not designed to have such long single requests The best would be to use shell with short php scripts and some sort of a queue system, which allows you to stop and resume your task, you should also look at parallelizing the task Being a bit presumptive here your simulation looks like a perfect candidate for using map-reduce -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: How to determine specific rule that was triggered on validation?
You probably have to use a combination of defining your validation rules according to the CakePHP book at: http://book.cakephp.org/view/1151/Multiple-Rules-per-Field and then use the models invalidFields method to pass the errors on to the view, so that you may discern which error rule is being reported. Enjoy, John On 22 Feb., 05:11, O.J. Tibi ojt...@gmail.com wrote: Hi all, I need some ideas on this one. We all know pretty well that a model gathers messages from failing validation rules whenever it performs validations, and these messages can be retrieved using $Model-invalidFields(). I was thinking, what if I wanted to check if a particular validation rule was triggered for this field that I'm interested in? Would there be a way to check that this rule was triggered without relying on the validation messages? Let's say I have a registration form. I have a User.username field that has some few validation rules (not empty, between range, valid characters, no duplicates, etc.) but I'm particularly interested if the no duplicates rule was triggerred on validation. In a component, whenever the no duplicates field is triggered, the component will inject a username suggestion helper into the parent controller. The reason why we should not determine if a particular rule was triggered using the validation messages, is because these messages (that are displayed to the user) may be changed in the application, depending on the requirements. These messages are also translated according to the user's current locale, so comparing a validation message that may change in the application's lifetime to its Gettext'ed counterpart is not viable. Would it be possible to mimic the $Model-invalidFields() method to return constant error codes or error ids (alphanumeric, hashed, numeric, prefixed, or any other flavor you like to site as an example) that would not change even if the associated validation messages change? If so, what's your recommendation on how to wire this functionality into the model so I can check it after validation failures? Thanks, OJ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Possible Memory Leak
On Feb 22, 1:07 am, ProFire profir...@hotmail.com wrote: I use a single http request. Why are you using a http request at all? I'd suggest: * use the cli - a month long http request? you're just asking for trouble * write your process such that it's restartable * daemonize it - a manager process that doesn't do anything except restart your worker process if/when it stops. * OR more generally use a queue system (job x registers jobs x1, x2, x3 ... before it ends) Ryan's guess about the query logging is probably a good place to look (look in dbo_source for cacheMethod), but it doesn't warrant any action from the team - CakePHP might want to reconsider that assumption - the assumption that php/http requests are being used as designed? Come on, which side of the 80/20 rule are batch processes in cake which last longer than a few hours? How hard is it to identify these memory leaks and eliminate them? hth, AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Possible Memory Leak
On Feb 22, 2011, at 02:57, AD7six wrote: On Feb 22, 1:07 am, ProFire profir...@hotmail.com wrote: I use a single http request. Why are you using a http request at all? I'd suggest: * use the cli - a month long http request? you're just asking for trouble * write your process such that it's restartable * daemonize it - a manager process that doesn't do anything except restart your worker process if/when it stops. * OR more generally use a queue system (job x registers jobs x1, x2, x3 ... before it ends) Ryan's guess about the query logging is probably a good place to look (look in dbo_source for cacheMethod), but it doesn't warrant any action from the team - CakePHP might want to reconsider that assumption - the assumption that php/http requests are being used as designed? Come on, which side of the 80/20 rule are batch processes in cake which last longer than a few hours? How hard is it to identify these memory leaks and eliminate them? I had assumed he was using a CakePHP shell script. I agree trying to run a month-long PHP HTTP request is not considered normal and should not really be expected to work. But there's nothing in the design of the PHP language that would make a month-long or longer PHP command line script improper, and I think that usage should be supported, even within CakePHP. The CakePHP book's sole example of what one might want to do with a shell script is to run a report [1]; that's exactly what this thread is about -- though admittedly it's a very large report. I don't know how hard it is to identify and eliminate this unwanted memory usage; I have not attempted to identify it. [1] http://book.cakephp.org/#!/view/1108/Creating-Your-Own-Shells -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Loading components inside components and keeping the initialize() stack order
Because the SecondaryComponent::specialMethod() method is proper to the SecondaryComponent, I don't want to put code in MainComponent that should be be in SecondaryComponent. I would like to keep all code relating to SecondaryComponent inside SecondaryComponent. On 16 fév, 19:24, Miles J mileswjohn...@gmail.com wrote: Why don't you just place the specialMethod() code into initialize()? Since thats basically what you are trying to achieve. On Feb 16, 2:51 am, Pixelastic timcc.pe...@gmail.com wrote: Hello, I'm writing a MainComponent that will need a SecondaryComponent in order to correctly work. I want to call some of SecondaryComponent::specialMethod() in MainComponent::initialize(), but this method can only correctly work if SecondaryComponent::initialize() is itself called first. Diving into code-land, here is what I mean. class FoosController extends AppController { var $components = array('MainComponent); } class MainComponent extends Object { var $components = array('SecondaryComponent'); function initialize($controller, $options) { $this-SecondaryComponent-specialMethod(); } } class SecondaryComponent extends Object { function initialize($controller, $options) { // Some really important stuff must go here } function specialMethod() { // This method can't work properly if the initialize() method hasn't be fired first } } I expected the stack order to call SecondaryComponent::initialize() then MainComponent::initialize() but it appears to call MainComponent::initialize() and then SecondaryComponent::initialize(), causing SecondaryComponent::specialMethod() to fail. I fixed it by manually calling $this-SecondaryComponent-initialize() in MainComponent::initialize(), but I still wonder if there would be a more cakish way of doing that. I'm not sure if this behavior is a bug, a design decision, an ommission or simply a wrong approach of myself. Has anyone some insight of this ? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Change the Database at Login by user choice
You have to look into using the models attribute useDbConfig, see the CakePHP book at: http://book.cakephp.org/view/1058/useDbConfig and applying it in the controllers beforeFilter method depending on your requirement. Enjoy, John On 21 Feb., 12:19, andreguerreiro85 andreguerreir...@gmail.com wrote: Hi there, i'm using cake 1.2.5 and i need to switch database at login on user choice, i have two Databases already defined : var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'root', 'password' = '', //'database' = 'test', 'database' = 'testesul2011', ); var $comercial = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'root', 'password' = '', 'database' = 'test', ); At Login i want to alow users to select one of them at a list and then set the database. Thanks in advance -- View this message in context:http://cakephp.1045679.n5.nabble.com/Change-the-Database-at-Login-by-... Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
password hash in cake
Hi guys, newby here and the first time with CAKEPHP We have a site using cake and are having problems with password hashing, on the customer/user registration page when the register the password is not hashed when sent to the DB, therefor not allowing the customer/user to log in. When logged in and you change the password it is hashed but the validate pw is not being utilsed and should be. We have an administrators back-end and creating and changing passwords is fine for the administrators, but we have no ability to reset the customer passwords. Im just just wondering if there are any developers out there that would like a small job and maybe a continuing one to finish developing this site, if you would mind taking a look and advising us of the problem. We are happy to pay for your time. Thanks a million in advanced for your help. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: password hash in cake
this is a code, which hash a password properly for Auth component Security::hash('yourpassword', sha1, true); so when you save this, do this before you save {{{ $this-data['User']['password'] = Security::hash($this-data['User']['password'], 'sha1', true); }}} -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/2/22 Marne ma...@webnmore.com.au Hi guys, newby here and the first time with CAKEPHP We have a site using cake and are having problems with password hashing, on the customer/user registration page when the register the password is not hashed when sent to the DB, therefor not allowing the customer/user to log in. When logged in and you change the password it is hashed but the validate pw is not being utilsed and should be. We have an administrators back-end and creating and changing passwords is fine for the administrators, but we have no ability to reset the customer passwords. Im just just wondering if there are any developers out there that would like a small job and maybe a continuing one to finish developing this site, if you would mind taking a look and advising us of the problem. We are happy to pay for your time. Thanks a million in advanced for your help. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
caching with pages and '/' route
Hi there, I have the following routes defined: Router::connect('/', array('controller' = 'splashes', 'action' = 'index')); Router::connect('/home', array('controller' = 'pages', 'action' = 'display', 'home')); And when I enable caching I get 1 cache file created when I hit the site index called 'home' and then the '/home' page just displays the cached initial page... Any ideas why? d//t. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Possible Memory Leak
Hi, I use a single http request. Ah and that is your problem. PHP and web servers in general are not designed to execute long running tasks. I do batch processing in cakephp using a javascript timer that invokes an ajax call to cake every 2 seconds. Cake then executes a small portion of the enormous batch task and logs that. Since this is the type of task you don't want to rush it works very well for me. It is sure is a matter of taste whether or not you think such a solution is pretty and I don't know whether or not it is appropriate in your case. Regards, Maurits On 02/22/2011 01:07 AM, ProFire wrote: I use a single http request. On Feb 21, 11:32 pm, Maurits van der Scheemaur...@vdschee.nl wrote: Hi, Do you use a single http request or multiple invoked by a javascript timer? Regards, Maurits On 02/21/2011 02:49 PM, ProFire wrote: Hi fellowcakephpers, I've been a long time user ofCakePHPand I've been satisfied since I first tried it. In fact, there's no more turning back for me ever since I started it. No framework matchesCakePHPwhen it comes to ease of development. However, very recently, I've encountered a problem I can't figure out the source. I'm dealing with Financial Data and being in finance, my application often have to crunch huge sets of data. I've always been very careful with how my application has handled the data as the data involve is huge and I could run into a memory leak if I don't clear those unused variables. This year, I was tasked to run a very heavy simulation on the financial data that involves possible 100 million mysql queries in a single run. As such, I'm very prepared to let the simulation run over a period of 1 month. However, within 2 days, the application threw a memory exhausted error. What really puzzled me was I had been very careful not to store any unused data in memory. In my algorithm, after I query the data, I store them in a temporary variable. At its final usage, I unset the variable despite knowing that the next iteration the data will be overwritten. That's just to be sure. After each round of simulation, the variables used are stored in the database. After the last $model-save(), I clear every variable used in the simulation, even if the data will be overwritten at the next iteration. All other persistent data throughout the iteration are either integers, floats or unchanging arrays. As such, there's no way these persistent data could be the cause of memory leak. I've debugged as much as I could to pin point the source of the memory leak in my controllers and models, but without any luck. I ran a smaller simulation and monitor the memory size each iteration, I noticed that the memory either stays the same or gets bigger. I still put my faith inCakePHPand I need expert advise on where this memory leak could be. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Question about how models using different datasources handle relationships
Hi, I'm curious as to how models which use different datasources handle relationships? If i was to create a datasource to consume a web service, and I wanted it to pick up related fields via a HasOne relationship to a model using a mysql database table, will cake just automagically resolve this, or do I need to do something cute in the datasource? Sorry for no code examples or trying it first - its just a question that popped into my head and a quick browse of the book didn't seem to provide any insight. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Conneect with Oracle
thanks for your helping, but I dont know why it does not work on my project :( On 18 Tháng Hai, 21:35, ojonam manojo10...@gmail.com wrote: Hi, I had a few issues with the configuration as well. Try removing the host name and adding it as a prefix to the database field. Also, specify the 'connect' field. var $default = array( 'driver' = 'oracle', 'connect' = 'oci_connect', 'persistent' = false, 'host' = '', 'login' = 'hr' 'password' = 'hr', 'database' = 'localhost/xe', 'prefix' = '' ); Of course, this is assuming you have installed all the necessary drivers and packages for php to interact with oracle (try googling it in case you haven't). Cheers, ojonam On Feb 18, 1:16 pm, Nguyễn Trịnh Hồng Ngọc nthngoc...@gmail.com wrote: Hello everybody, I'm trying to make a connection between CakePHP and Oracle with configuration database: class DATABASE_CONFIG { var $default = array( 'driver' = 'oracle', 'persistent' = false, 'host' = 'localhost', 'login' = 'hr', 'password' = 'hr', 'database' = 'xe', 'prefix' = '', ); var $test = array( 'driver' = 'oracle', 'persistent' = false, 'host' = 'localhost', 'login' = 'hr', 'password' = 'hr', 'database' = 'xe', 'prefix' = '', );} and it work with the message: Your database configuration file is present. But I don't know why I can't get the data I have a table: posts(id,title,body), and Model class: post.php class Post extends AppModel{ var $name='Post';} controller: posts_controller.php class PostsController extends AppController{ var $name='Posts'; var $scaffold; } if you know, please help me, thanks a lot! Best regard! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
Please show your cache configuration! Enjoy, John On 22 Feb., 13:49, designv...@gmail.com designv...@gmail.com wrote: Hi there, I have the following routes defined: Router::connect('/', array('controller' = 'splashes', 'action' = 'index')); Router::connect('/home', array('controller' = 'pages', 'action' = 'display', 'home')); And when I enable caching I get 1 cache file created when I hit the site index called 'home' and then the '/home' page just displays the cached initial page... Any ideas why? d//t. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
Haven't got anything apart from Configure::write('Cache.check', true); Currently... I have read I need to specify cacheAction for routes, but am unsure where I need to set that for routes/pages? TIA d//t. On Feb 22, 1:35 pm, John Andersen j.andersen...@gmail.com wrote: Please show your cache configuration! Enjoy, John On 22 Feb., 13:49, designv...@gmail.com designv...@gmail.com wrote: Hi there, I have the following routes defined: Router::connect('/', array('controller' = 'splashes', 'action' = 'index')); Router::connect('/home', array('controller' = 'pages', 'action' = 'display', 'home')); And when I enable caching I get 1 cache file created when I hit the site index called 'home' and then the '/home' page just displays the cached initial page... Any ideas why? d//t. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
media view
Hello, I am trying to use the MediaView class to set a download of pdf file. So far my attempts are not working and I can't seem to find any fault in my code copied from the book.cakephp.org website. Any help or thoughts will be appreciated. Find sample code below: $this-view = 'Media'; //set to media download $params = array( 'id' = 'catalogue.pdf', 'name' = 'new_catalogue', 'download'=true, 'extension' = 'pdf', 'path' = $this-webroot . 'files' . DS ); $this-set($params); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
Sounds like you need to start reading first about caching in the CakePHP book at: http://book.cakephp.org/view/1193/Caching as there are several possibilities for caching your information. I would not turn on caching, unless I understand what is being cached and for how long :) Enjoy, John On 22 Feb., 14:39, designv...@gmail.com designv...@gmail.com wrote: Haven't got anything apart from Configure::write('Cache.check', true); Currently... I have read I need to specify cacheAction for routes, but am unsure where I need to set that for routes/pages? TIA d//t. [snip] -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
I have used caching before on controllers I have created and it's not been a problem, and it works fine for the controllers in this site. I am familiar with setting the cache configuration options and creating new ones in the core. I am just stumped over this issue regarding caching pages and the '/' route... I do not know where to set options for it. Cheers, d//t On Feb 22, 2:04 pm, John Andersen j.andersen...@gmail.com wrote: Sounds like you need to start reading first about caching in the CakePHP book at:http://book.cakephp.org/view/1193/Caching as there are several possibilities for caching your information. I would not turn on caching, unless I understand what is being cached and for how long :) Enjoy, John On 22 Feb., 14:39, designv...@gmail.com designv...@gmail.com wrote: Haven't got anything apart from Configure::write('Cache.check', true); Currently... I have read I need to specify cacheAction for routes, but am unsure where I need to set that for routes/pages? TIA d//t. [snip] -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
problems populating my select box
Hi there, newbie here. I have a campaign model and a charity model. Campaign belongsTo Charity and Charity hasMany Campaigns. I have a form which creates a campaign and I need a select box to have the name of all the charities. What I have at the minute is what cake baked for me and it creates a select box for the charities but it has their ids rather than the charity's name. From the documentation I changed it to: in the controller: $users = $this-Campaign-User-find('list'); $charities = $this-Campaign-Charity-find('list'); $this-set(compact('users', 'charities')); in the view: echo $this-Form-input('Charity.charity_name'); (I also tried) echo $this-Form-input('Charity', array('type'='select', 'options'='$charities')); but I can get neither to work. I've googled and not found an answer I understand. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: problems populating my select box
try: $charities = $this-Campaign-Charity-find('list', array('fields' = array('Charity.id', 'Charity.charity_name'))); And then echo $this-Form-input('Charity.charity_name', array('options' = $charities)); (It would automatically select the columns id and name but I think if they are different you need to specify, I may be wrong). On 22 February 2011 14:49, barricades davow...@googlemail.com wrote: Hi there, newbie here. I have a campaign model and a charity model. Campaign belongsTo Charity and Charity hasMany Campaigns. I have a form which creates a campaign and I need a select box to have the name of all the charities. What I have at the minute is what cake baked for me and it creates a select box for the charities but it has their ids rather than the charity's name. From the documentation I changed it to: in the controller: $users = $this-Campaign-User-find('list'); $charities = $this-Campaign-Charity-find('list'); $this-set(compact('users', 'charities')); in the view: echo $this-Form-input('Charity.charity_name'); (I also tried) echo $this-Form-input('Charity', array('type'='select', 'options'='$charities')); but I can get neither to work. I've googled and not found an answer I understand. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Kind Regards Stephen @ NinjaCoderMonkey www.ninjacodermonkey.co.uk -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: media view
check that you have no errors hidden away (you need debug to be off for media views to work) - this can be a cause of media views not working also check that $this-webroot . 'files' . DS is what you expect and that the pdf is there - S On 22 February 2011 13:55, a17s godlyfr...@googlemail.com wrote: $this-webroot . 'files' . DS -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: problems populating my select box
Ok that worked (sort of), thanks! I also noticed that I had a typo in the above that probably wasn't helping either. Your kind advice above turns the select box into a list of the charities names ok, but when I create a campaign having selected a charity the controller doesn't save the charity_id as the foreign key in the campaigns table anymore. How do I use the information in the select box to get the charities id and save it instead of the name. Sorry for being stupid -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
The Dispatcher class has a method in which it checks for whether or not it should use a cached version of the URL, when the Cache.check configuration is set to true. So in your case it works as it should, you have told the Dispatcher to use cached versions. The Dispatcher uses /home whenever the / is specified. Enjoy, John On 22 Feb., 15:22, designv...@gmail.com designv...@gmail.com wrote: I have used caching before on controllers I have created and it's not been a problem, and it works fine for the controllers in this site. I am familiar with setting the cache configuration options and creating new ones in the core. I am just stumped over this issue regarding caching pages and the '/' route... I do not know where to set options for it. Cheers, d//t [snip] -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: FCK editor filling textarea with home page
I found the solution to this. The problem was that my site was in a subdirectory, but the fck helper file was just pointing to the webroot as if it was at the top level. Adding in the subdirectory to the fck basepath solved the problem. i.e. in the fck helper, in the constructor, I had $this-BasePath = '/app/webroot/js/fckeditor/'; when it should have been $this-BasePath = /subdirectory'/app/webroot/js/fckeditor/'; Hope this helps someone else! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Google Webmaster Tools show Cakephp Helpers
Hi guys, anybody using Google Webmaster Tools with their cakephp site? I was wondering why Google Webmaster Tools shows keywords like formhelper, sessionhelper and htmlhelper in the keywords section. Usually this shouldn't be visible to the google bot, right? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: problems populating my select box
Here's my function to register a campaign. I guess I need to somehow get the charity name from the form and with it find the charity id that corresponds with that name and then insert it into $this- data['Campaign']['charity_id']. I'm not sure how to do that though :( function regcampaign() { $alias = 'regcampaign'; if ($this-Acl-check($this-Session-read('user.email'), $alias, 'create')) { if (!empty($this-data)) { $this-Campaign-create(); //make the currently logged in users id be the user_id foreign key for this campaign $this-data['Campaign']['user_id'] = $this-Auth-user('id'); if ($this-Campaign-save($this-data)) { $user = $this-Session-read('user.email'); $name = $this-Session-read('user.name'); $parent = $this-Acl-Aco-findByAlias('Campaigns'); $alias = $name . '_' . $this-Campaign-id; $aco = new Aco(); $aco-create(); $aco-save(array('alias' = $alias, 'model' = 'Campaign', 'foreign_key' = $this-Campaign-id, 'parent_id' = $parent['Aco'] ['id'])); $this-Acl-allow('users', $alias, 'read'); $this-Acl-allow($this-Session-read('user.email'), $alias); $this-Session-setFlash(__('The campaign has been saved', true)); $this-redirect(array('controller' = 'campaigns', 'action' = 'view')); } else { $this-Session-setFlash(__('The campaign could not be saved. Please, try again.', true)); } } } else { $this-Session-setFlash(__('You don\'t have permission to register a new campaign')); } $users = $this-Campaign-User-find('list'); $charities = $this-Campaign-Charity-find('list', array('fields' = array('Charity.id', 'Charity.charity_name'))); $this-set(compact('users', 'charities')); } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with accessing form data
Hi I have a simple form in my view where the user enters a 4 digit numeral code, in the controller action am unable to access this code, it would be great if some one could tell me how to access this code in the action and then pass this code as a parameter to another controller action. ***Form** pEnter User Code/p ?php echo $form-Create('Admin',array('action'='view_specific')); echo $form-input('Code'); echo $form-end('Submit'); ? *Action function view_specific() { if($this-data) { // $code=get data from teh form; //$this-redirect(array('action'='view_specific_result', $code)); } } Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: caching with pages and '/' route
Ok, So it's basically treating /home the same as /? So I need to NOT use the global Cache.check and setup the caching in each controller as I have done before? Does this mean that I will have to copy the pages class from the core to control the pages caching? d//t. On Feb 22, 3:39 pm, John Andersen j.andersen...@gmail.com wrote: The Dispatcher class has a method in which it checks for whether or not it should use a cached version of the URL, when the Cache.check configuration is set to true. So in your case it works as it should, you have told the Dispatcher to use cached versions. The Dispatcher uses /home whenever the / is specified. Enjoy, John On 22 Feb., 15:22, designv...@gmail.com designv...@gmail.com wrote: I have used caching before on controllers I have created and it's not been a problem, and it works fine for the controllers in this site. I am familiar with setting the cache configuration options and creating new ones in the core. I am just stumped over this issue regarding caching pages and the '/' route... I do not know where to set options for it. Cheers, d//t [snip] -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
isAuthorized problem with mixed case actions
Whilst going through the security of my application, I've noticed a flaw. I'm not sure if this is a cake issue, or just something I need to be aware of however. I'm using code from the Bakery for the Sortable behaviour. So I've got functions named moveUp and moveDown in my controller. In isAuthorized im doing the following if( $this-action == 'moveUp' || $this-action == 'moveDown'){ ..code to check if this is allowed } However, I've realised that this can be skipped by calling the actions using a lowercase name, e.g. controller/moveup/ will still call the moveUp action, but the isAuthroized check will be skipped. At the moment, the best fix I can think of is using strtolower to get a lowercase version of the action for checking in the isAuthorized function. But is this something that cakePHP should protect agaisnt? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Conneect with Oracle
Linux? windows? Do you see OCI in phpinfo()? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Possible Memory Leak
I totally agree with other guys about demonizing it and making the process being able to pause, maybe restart the computer and contine from where you have paused. So I am writting to express wory about a precision of your results. I am not an old cake user and I haven't had a chance to do complex math functions in cake, but having in mind you have so many results you need to go through a simple 0.0001 mistake could multiply to something huge. Esepecialy if you have numbers with a lot of figures eg 123456789123.123456789123456789 Now in some cases floating numbers here just start to loose last figures and you don't even get that reported about that. I think it's cool you are trying to do this in cake because you will proove that anything is possible but I would without a hesitation check the results in math lab - software which actually is programmed , optimased and tested for such calculations and also does them more quickly. Also I believe - not sure - that you can rent supercomputers with matlab or smth like that like cloud computing and get your job done even quicker. I hope i didn't bother you too much :) All the best, Milos On Feb 22, 7:51 am, Maurits van der Schee maur...@vdschee.nl wrote: Hi, I use a single http request. Ah and that is your problem. PHP and web servers in general are not designed to execute long running tasks. I do batch processing in cakephp using a javascript timer that invokes an ajax call to cake every 2 seconds. Cake then executes a small portion of the enormous batch task and logs that. Since this is the type of task you don't want to rush it works very well for me. It is sure is a matter of taste whether or not you think such a solution is pretty and I don't know whether or not it is appropriate in your case. Regards, Maurits On 02/22/2011 01:07 AM, ProFire wrote: I use a single http request. On Feb 21, 11:32 pm, Maurits van der Scheemaur...@vdschee.nl wrote: Hi, Do you use a single http request or multiple invoked by a javascript timer? Regards, Maurits On 02/21/2011 02:49 PM, ProFire wrote: Hi fellowcakephpers, I've been a long time user ofCakePHPand I've been satisfied since I first tried it. In fact, there's no more turning back for me ever since I started it. No framework matchesCakePHPwhen it comes to ease of development. However, very recently, I've encountered a problem I can't figure out the source. I'm dealing with Financial Data and being in finance, my application often have to crunch huge sets of data. I've always been very careful with how my application has handled the data as the data involve is huge and I could run into a memory leak if I don't clear those unused variables. This year, I was tasked to run a very heavy simulation on the financial data that involves possible 100 million mysql queries in a single run. As such, I'm very prepared to let the simulation run over a period of 1 month. However, within 2 days, the application threw a memory exhausted error. What really puzzled me was I had been very careful not to store any unused data in memory. In my algorithm, after I query the data, I store them in a temporary variable. At its final usage, I unset the variable despite knowing that the next iteration the data will be overwritten. That's just to be sure. After each round of simulation, the variables used are stored in the database. After the last $model-save(), I clear every variable used in the simulation, even if the data will be overwritten at the next iteration. All other persistent data throughout the iteration are either integers, floats or unchanging arrays. As such, there's no way these persistent data could be the cause of memory leak. I've debugged as much as I could to pin point the source of the memory leak in my controllers and models, but without any luck. I ran a smaller simulation and monitor the memory size each iteration, I noticed that the memory either stays the same or gets bigger. I still put my faith inCakePHPand I need expert advise on where this memory leak could be. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: Problem with accessing form data
$this-data // holds form data Use debug! Make it your best friend. Don't know what data is held? Where it went? Even if there is any? if(!empty($this-data)){ Configure::write('debug', 2);//only if you need it for this action debug($this-data); exit(); } My guess is it should be an array similar to Array( [Admin] = array( [Code] = 1234 )); So $this-data['Admin']['Code'] would hold 1234 HTH.. K -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of newguy Sent: Tuesday, February 22, 2011 12:28 PM To: CakePHP Subject: Problem with accessing form data Hi I have a simple form in my view where the user enters a 4 digit numeral code, in the controller action am unable to access this code, it would be great if some one could tell me how to access this code in the action and then pass this code as a parameter to another controller action. ***Form** pEnter User Code/p ?php echo $form-Create('Admin',array('action'='view_specific')); echo $form-input('Code'); echo $form-end('Submit'); ? *Action function view_specific() { if($this-data) { // $code=get data from teh form; //$this-redirect(array('action'='view_specific_result', $code)); } } Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Question about how models using different datasources handle relationships
On Tue, Feb 22, 2011 at 7:56 AM, Greg Skerman gsker...@gmail.com wrote: Hi, I'm curious as to how models which use different datasources handle relationships? If i was to create a datasource to consume a web service, and I wanted it to pick up related fields via a HasOne relationship to a model using a mysql database table, will cake just automagically resolve this, or do I need to do something cute in the datasource? Sorry for no code examples or trying it first - its just a question that popped into my head and a quick browse of the book didn't seem to provide any insight. I was also wondering this. Like you, it popped into my head last week while reading a discussion here about datasources. And I haven't got round to experimenting with it. My first thought was that it would be resolved somehow through the model cache. But how would the queries themselves be created? Perhaps we can't have associated models using different datasources. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Possible Memory Leak
Really? You're using PHP--and through a webserver--to do month-long simulation on the financial data (is that the same as Financial Data?) that could result in 100 million DB queries? Pardon me if I'm skeptical of this post. On Mon, Feb 21, 2011 at 8:49 AM, ProFire profir...@hotmail.com wrote: Hi fellow cakephpers, I've been a long time user of CakePHP and I've been satisfied since I first tried it. In fact, there's no more turning back for me ever since I started it. No framework matches CakePHP when it comes to ease of development. However, very recently, I've encountered a problem I can't figure out the source. I'm dealing with Financial Data and being in finance, my application often have to crunch huge sets of data. I've always been very careful with how my application has handled the data as the data involve is huge and I could run into a memory leak if I don't clear those unused variables. This year, I was tasked to run a very heavy simulation on the financial data that involves possible 100 million mysql queries in a single run. As such, I'm very prepared to let the simulation run over a period of 1 month. However, within 2 days, the application threw a memory exhausted error. What really puzzled me was I had been very careful not to store any unused data in memory. In my algorithm, after I query the data, I store them in a temporary variable. At its final usage, I unset the variable despite knowing that the next iteration the data will be overwritten. That's just to be sure. After each round of simulation, the variables used are stored in the database. After the last $model-save(), I clear every variable used in the simulation, even if the data will be overwritten at the next iteration. All other persistent data throughout the iteration are either integers, floats or unchanging arrays. As such, there's no way these persistent data could be the cause of memory leak. I've debugged as much as I could to pin point the source of the memory leak in my controllers and models, but without any luck. I ran a smaller simulation and monitor the memory size each iteration, I noticed that the memory either stays the same or gets bigger. I still put my faith in CakePHP and I need expert advise on where this memory leak could be. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Changing hiddenField from 0
I'm using checkbox to check if the client agrees with the contract. But I would like to have 'No' if it was not checked. The problem is that I don't know how to change the hiddenField value. Ok, I know that I can treat it before saving changing 0 for 'No', but I would like to avoid this code and just set the value of the hiddenField to 'No' Do you know anything possible? or even if you can say Theres no other way it will help. Many thanks... http://book.cakephp.org/view/1414/checkbox http://book.cakephp.org/view/1651/options-hiddenField -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: media view
On Tue, Feb 22, 2011 at 8:55 AM, a17s godlyfr...@googlemail.com wrote: Hello, I am trying to use the MediaView class to set a download of pdf file. So far my attempts are not working and I can't seem to find any fault in my code copied from the book.cakephp.org website. Any help or thoughts will be appreciated. Define not working please. Find sample code below: $this-view = 'Media'; //set to media download $params = array( 'id' = 'catalogue.pdf', 'name' = 'new_catalogue', 'download'=true, 'extension' = 'pdf', 'path' = $this-webroot . 'files' . DS ); $this-set($params); What is $this-webroot? Is there a reason you're not using WEB_ROOT? If you're trying to keep this configurable (perhaps it could be APP--a more reasonable use for MediaView, anyway) it might be better to use a more neutral variable name, like $this-_base. In any case, as Sam mentioned, be sure to debug or log the path. Are you seeing a 404? Are you sure it's not a 404 due to some error and debug being set to 0? If unsure, alter the MediaView render() method to do something besides throwing a 404 for a missing file. Or just triple-check the path and that the file you want it really there and accessible. I can't remember why but my code also always includes the MIME type: 'mimeType' = array($result['ItemFile']['type']) Note that it's an array. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: isAuthorized problem with mixed case actions
On Tue, Feb 22, 2011 at 11:35 AM, chris chris@internetlogistics.com wrote: Whilst going through the security of my application, I've noticed a flaw. I'm not sure if this is a cake issue, or just something I need to be aware of however. I'm using code from the Bakery for the Sortable behaviour. So I've got functions named moveUp and moveDown in my controller. In isAuthorized im doing the following if( $this-action == 'moveUp' || $this-action == 'moveDown'){ ..code to check if this is allowed } However, I've realised that this can be skipped by calling the actions using a lowercase name, e.g. controller/moveup/ will still call the moveUp action, but the isAuthroized check will be skipped. At the moment, the best fix I can think of is using strtolower to get a lowercase version of the action for checking in the isAuthorized function. But is this something that cakePHP should protect agaisnt? No, is should be handled in your routine. You need to normalise the strings (eg. to lowercase). For example, this is how it's handled in AuthComponent's startrup(): $action = strtolower($controller-params['action']); ... $allowedActions = array_map('strtolower', $this-allowedActions); $isAllowed = ($this-allowedActions == array('*') || in_array($action, $allowedActions)); So, if you left it up to setting allowedActions, it'd be handled for you. But, because you're doing your own isAuthorized() it's up to you to ensure the strings are the same case. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Google Webmaster Tools show Cakephp Helpers
On Tue, Feb 22, 2011 at 11:16 AM, nachtk...@bigfoot.com daneli...@googlemail.com wrote: Hi guys, anybody using Google Webmaster Tools with their cakephp site? I was wondering why Google Webmaster Tools shows keywords like formhelper, sessionhelper and htmlhelper in the keywords section. Usually this shouldn't be visible to the google bot, right? GoogleBot, as with anything else making an http request, shouldn't be able to browse outside webroot. Perhaps you have something under webroot that shouldn't be there. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: problems populating my select box
On Tue, Feb 22, 2011 at 9:57 AM, Stephen step...@ninjacodermonkey.co.uk wrote: try: $charities = $this-Campaign-Charity-find('list', array('fields' = array('Charity.id', 'Charity.charity_name'))); And then echo $this-Form-input('Charity.charity_name', array('options' = $charities)); (It would automatically select the columns id and name but I think if they are different you need to specify, I may be wrong). This isn't quite right. The input is for 'Charity.charity_name' but the value that will be passed back to the server is the Charity.id (which is correct). -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: problems populating my select box
On Tue, Feb 22, 2011 at 10:14 AM, barricades davow...@googlemail.com wrote: Ok that worked (sort of), thanks! I also noticed that I had a typo in the above that probably wasn't helping either. Your kind advice above turns the select box into a list of the charities names ok, but when I create a campaign having selected a charity the controller doesn't save the charity_id as the foreign key in the campaigns table anymore. How do I use the information in the select box to get the charities id and save it instead of the name. Try Campaign.charity_id as the input name. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
1.2.8 cake console
i can't get it workig the console. Everytime i typed in cake -app / home/myaccount/public_html/dev/app it just gives me to error saying like the following my app folder is /home/myaccount/public_html/dev/app. However I am not sure about working directory seems like as I change the -app path it changes. Welcome to CakePHP v1.2.8 Console --- Current Paths: -app: app -working: /home/myaccount/public_html/dev/app -root: /home/myaccount/public_html/dev -core: /home/myaccount/public_html/dev Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: APP/vendors/shells: - none ROOT/vendors/shells: - none CORE/console/libs: acl api bake console i18n schema testsuite To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' root@host [~]# -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: 1.2.8 cake console
but baker works by going cake bake On Feb 22, 11:46 am, cake-learner sh.koiz...@gmail.com wrote: i can't get it workig the console. Everytime i typed in cake -app / home/myaccount/public_html/dev/app it just gives me to error saying like the following my app folder is /home/myaccount/public_html/dev/app. However I am not sure about working directory seems like as I change the -app path it changes. Welcome to CakePHP v1.2.8 Console --- Current Paths: -app: app -working: /home/myaccount/public_html/dev/app -root: /home/myaccount/public_html/dev -core: /home/myaccount/public_html/dev Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: APP/vendors/shells: - none ROOT/vendors/shells: - none CORE/console/libs: acl api bake console i18n schema testsuite To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' root@host [~]# -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: 1.2.8 cake console
but I can call baker by 'cake bake' On Feb 22, 11:46 am, cake-learner sh.koiz...@gmail.com wrote: i can't get it workig the console. Everytime i typed in cake -app / home/myaccount/public_html/dev/app it just gives me to error saying like the following my app folder is /home/myaccount/public_html/dev/app. However I am not sure about working directory seems like as I change the -app path it changes. Welcome to CakePHP v1.2.8 Console --- Current Paths: -app: app -working: /home/myaccount/public_html/dev/app -root: /home/myaccount/public_html/dev -core: /home/myaccount/public_html/dev Changing Paths: your working path should be the same as your application path to change your path use the '-app' param. Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp Available Shells: APP/vendors/shells: - none ROOT/vendors/shells: - none CORE/console/libs: acl api bake console i18n schema testsuite To run a command, type 'cake shell_name [args]' To get help on a specific command, type 'cake shell_name help' root@host [~]# -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Relations between models
The classregistry way is the one I have seen as response to similar questions. In your example you are talking about races, so probably your Race model has many cars and also has many spectators, in that case models A and B are linked throug model C, so you could code something like: $this-Car-Race-Spectator-find( Please cakephp gurus out there, correct me if I'm wrong. Regards On 21 feb, 09:48, Axel the...@gmail.com wrote: Hello, I'm still a bit stuck in the MVC architecture. I've two models A and B which are not logically linked (let's imagine model A is a racing car and model B is a spectator of a race), so I haven't built any association between them. How can I use both models in a function in model A, I mean what is the best way to load B in A ? I4ve in mind two solution : first one is loading models in controller, retrieving data and passing them to function, but it's not controllers thin models fat. Second one is classregistry loading inside of the model, but might it be time consuming? Example : -FIRST example --- AController { function AAA($a_id,$b_id) { $a=$this-a-find(..conditions = ... a_id) $this-loadModel('b'); $b=$this-b-find((..conditions = ... b_id...); $result=$this-a-funA($a,$b) } } AModel { function funA($a,$b) {Logic, whole stuff, data treatment} } SECOND example --- AController { function AAA($a_id,$b_id) { $result=$this-a-funA($a_id,$b_id) } } AModel { function funA($a_id,$b_id) { $a=$this-find(..conditions = ... a_id) $b=ClassRegistry::init(a)-find(..conditions = ... b_id) } } Thank you a lot! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Creating a Preview page
I've finally got back to this. I just cannot get it to do anything other than submit the form. When I click the 'Preview' button, the form submits, I get a success message, and go back to the index page - which is exactly what happens if I submit the form using the regular Submit button. I'd really appreciate any help - I'm new to Ajax, so I'm sure I'm just doing something stupid, but I don't know where to start looking for it. Thanks! Sharon Here's what I have so far: PAGES_CONTROLLER.PHP: class PagesController extends AppController { var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Fck', 'Ajax'); ... $uses, some functions etc ... function admin_edit($id = null) { $this-checkSession(); $this-layout = 'admin'; if (!$id empty($this-data)) { $this-Session-setFlash('Invalid page requested', 'flash_failure'); $this-redirect('/admin/pages/index'); exit(); } if (!empty($this-data)) { if ($this-Page-save($this-data)) { $this-Session-setFlash('Changes saved', 'flash_success'); $this-redirect('/admin/pages/index'); exit(); }else { $this-Session-setFlash('Unable to save changes. Please correct errors below', 'flash_failure'); } }else { $pagelist = $this-Page-find('list', array('conditions' = array('visible' = 1, 'parent_id' = 0, 'title !=' = 'Home'))); $this-set('pagelist', $pagelist); if (empty($this-data)) { $this-data = $this-Page-read(null, $id); } } } function admin_preview($id = null) { if (!empty($this-data)) { $this-Page-save($this-data); $page = $this-Page-read(null, $id); }else if (isset($id)) { $page = $this-Page-read(null, $id); }else { return null; } $this-set('page', $page); $this-render('view'); } } IN VIEWS/PAGES/ADMIN_EDIT.PHP (I've left out a few divs, inputs etc. to make it shorter): div class=pages form ?php echo $form-create('Page');? fieldset ?php echo $form-input('id'); echo 'div class=input textarea'; echo $form-label('Content') . 'br/'; echo $form-input('content', array('type' = 'textarea', 'rows' = 20, 'cols' = 50, 'label' = '')); echo $fck-load('Page/content', 'Cake'); echo '/div'; echo 'input type=submit value=Preview Page id=preview_btn / '; echo 'input type=submit value=Save Changes /'; echo '/form'; ? /fieldset /div div id=page_modaldiv id=page_modal_content/div/div script language=text/javascript $('#preview_btn').click(function(e) { $(this).parents('form').ajaxSubmit({ url: '/admin/pages/preview', error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }, success: function(responseText){ $ ('#page_modal').jqmShow().find('#page_modal_content').html(responseText); } }); e.preventDefault(); }); /script -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: 1.2.8 cake console
Thanks i got it working. I just had to relogin. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Creating a Preview page
On Tue, Feb 22, 2011 at 3:29 PM, WhyNotSmile sharongilmor...@gmail.com wrote: I've finally got back to this. I just cannot get it to do anything other than submit the form. When I click the 'Preview' button, the form submits, I get a success message, and go back to the index page - which is exactly what happens if I submit the form using the regular Submit button. I'd really appreciate any help - I'm new to Ajax, so I'm sure I'm just doing something stupid, but I don't know where to start looking for it. Thanks! Sharon Here's what I have so far: PAGES_CONTROLLER.PHP: class PagesController extends AppController { var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Fck', 'Ajax'); ... $uses, some functions etc ... function admin_edit($id = null) { $this-checkSession(); $this-layout = 'admin'; if (!$id empty($this-data)) { $this-Session-setFlash('Invalid page requested', 'flash_failure'); $this-redirect('/admin/pages/index'); exit(); } if (!empty($this-data)) { if ($this-Page-save($this-data)) { $this-Session-setFlash('Changes saved', 'flash_success'); $this-redirect('/admin/pages/index'); exit(); }else { $this-Session-setFlash('Unable to save changes. Please correct errors below', 'flash_failure'); } }else { $pagelist = $this-Page-find('list', array('conditions' = array('visible' = 1, 'parent_id' = 0, 'title !=' = 'Home'))); $this-set('pagelist', $pagelist); if (empty($this-data)) { $this-data = $this-Page-read(null, $id); } } } function admin_preview($id = null) { if (!empty($this-data)) { $this-Page-save($this-data); $page = $this-Page-read(null, $id); }else if (isset($id)) { $page = $this-Page-read(null, $id); }else { return null; } $this-set('page', $page); $this-render('view'); } } IN VIEWS/PAGES/ADMIN_EDIT.PHP (I've left out a few divs, inputs etc. to make it shorter): div class=pages form ?php echo $form-create('Page');? fieldset ?php echo $form-input('id'); echo 'div class=input textarea'; echo $form-label('Content') . 'br/'; echo $form-input('content', array('type' = 'textarea', 'rows' = 20, 'cols' = 50, 'label' = '')); echo $fck-load('Page/content', 'Cake'); echo '/div'; echo 'input type=submit value=Preview Page id=preview_btn / '; echo 'input type=submit value=Save Changes /'; echo '/form'; ? /fieldset /div div id=page_modaldiv id=page_modal_content/div/div script language=text/javascript $('#preview_btn').click(function(e) { $(this).parents('form').ajaxSubmit({ url: '/admin/pages/preview', error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }, success: function(responseText){ $ ('#page_modal').jqmShow().find('#page_modal_content').html(responseText); } }); e.preventDefault(); }); /script I suspect the problem is that you haven't loaded the jquery.form plugin. If that's the case, you'd get a fatal JS error and so the preventDefault() wouldn't run, causing the form to submit normally to your edit action. If you happen to have an element for loading your FCK code, you could add the form plugin there. For example, my jwysiwyg element has: -- snip -- $this-Html-css('jwysiwyg/jquery.wysiwyg', 'stylesheet', array('media'='screen,projector', 'inline' = false)); $this-Html-css('jwysiwyg/inline_upload', 'stylesheet', array('media'='screen,projector', 'inline' = false)); echo $this-Html-script('lib/jquery.form.min', false); echo $this-Html-script('lib/jwysiwyg/jquery.wysiwyg', false); echo $this-Html-script('editor', false); /* Pass an empty string if uploads should not be enabled */ if (!isset($upload_path)) $upload_path = ''; /* Hidden should be an array of key = value pairs representing name/value for * any hidden form elements that should be included in the upload form */ if (!isset($hidden)) $hidden = array(); $hidden = json_encode($hidden); $code = '$(function() { '; foreach($selectors as $selector) { $code .= initEditor('${selector}', '${upload_path}', ${hidden});\n; } $code .= '});'; $this-Html-scriptBlock($code, array('inline' = false)); -- snip -- http://jquery.malsup.com/form/ Also, it's been awhile since I used FCK. Does it have an autosave feature? Some of these editor widgets don't automatically save the contents of the iframe (or whatever) back to the original textarea when something changes. You may have to make a point of copying the FCK content to your form before submitting. Also, also: Instead of adding a break after your label, youcould instead style it as display: block. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more
Re: Relations between models
On Tue, Feb 22, 2011 at 3:24 PM, dtemes dte...@gmail.com wrote: The classregistry way is the one I have seen as response to similar questions. In your example you are talking about races, so probably your Race model has many cars and also has many spectators, in that case models A and B are linked throug model C, so you could code something like: $this-Car-Race-Spectator-find( Please cakephp gurus out there, correct me if I'm wrong. I don't fell like much of a guru but I'll chip in to agree with your explanation. Though I can't imagine a scenario where both RaceCar and Spectator need be accessed unless the action in question is horribleTrackAccident() or similar. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Changing hiddenField from 0
On Tue, Feb 22, 2011 at 1:53 PM, Djonatan Buss djonat...@gmail.com wrote: I'm using checkbox to check if the client agrees with the contract. But I would like to have 'No' if it was not checked. The problem is that I don't know how to change the hiddenField value. Ok, I know that I can treat it before saving changing 0 for 'No', but I would like to avoid this code and just set the value of the hiddenField to 'No' Do you know anything possible? or even if you can say Theres no other way it will help. Many thanks... http://book.cakephp.org/view/1414/checkbox http://book.cakephp.org/view/1651/options-hiddenField If the value of this element will be saved to the DB, you should leave it as it is. Changing booleans to be 'yes' or 'no' is invitingproblems down the road. If you want to display the result in human-readbale way, just use something like: echo ($data['Model']['field'] == 1 ? 'yes' : 'no'); You can even do that in afterFind, adding an extra field to the data array. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Creating Shell for cron job
I am setting up the shell so that i can register as a cron job for maintenance tasks. In the past i do it manually and need to check if there is the same process running. If I use the shell I don't need to consider that? Thanks, -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Creating Shell for cron job
On Feb 22, 2011, at 20:29, cake-learner wrote: I am setting up the shell so that i can register as a cron job for maintenance tasks. In the past i do it manually and need to check if there is the same process running. If I use the shell I don't need to consider that? Um... I don't see any reason to believe the CakePHP shell would behave differently. If you don't want your script to run if another copy of itself is already running, I'd guess you'd have to write the code to prevent that, just as you would if you were writing a non-CakePHP script or a perl script or whatever. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with accessing form data
$this-redirect(array('controller' = $controller, 'action' = $action, $id, 'named' = $named, 'named2' = $named2)); On Feb 22, 9:58 am, newguy aimanparv...@gmail.com wrote: Hi I have a simple form in my view where the user enters a 4 digit numeral code, in the controller action am unable to access this code, it would be great if some one could tell me how to access this code in the action and then pass this code as a parameter to another controller action. ***Form** pEnter User Code/p ?php echo $form-Create('Admin',array('action'='view_specific')); echo $form-input('Code'); echo $form-end('Submit'); ? *Action function view_specific() { if($this-data) { // $code=get data from teh form; //$this-redirect(array('action'='view_specific_result', $code)); } } Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
help me in jqury validation.
hi, friends, i m working on form where i need to give jquery validation. i googled all the possible searches but not getting. can any one suggest any link for jquery validation for specific element. *note: i m not giving validations to element like 'name','email', etc. these are the quantity based element like 'weight', 'height', 'hemoglobin' etc. please help regards Anand http://www.anshusys.com -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
hiding link from certain users.
Hello again. My web application has several group of users. 1. user 2. superuser I've created a page where only superuser can access and was successful. But my problem is the link in default.ctp that direct users to that page are still visible to normal user after login. I just want the link to be visible for superuser.. I was thinking of something similar to this.. after login: if ($user = 'superuser') { echo $html-link (__('System Setting',true), array ('controller'='committees','action'='setpages')) } but I'm not sure how to apply it to cakephp framework.. i need help and guide, i'm a newbie... thank you! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php