Re: containable and (left/inner) JOINS

2009-03-17 Thread Martin Westin
I built something real quick a short while ago. It does basic joins using syntax similar to Containable and other model definitions. It has not been tested or taken to its limits at all. It just does what I needed at the time but there is room to expand on it. If any of you are interested in

Re: Like search

2009-03-17 Thread Martin Westin
Cake defaults to AND but you can specify any hierarchy of AND and OR or AND or OR... until you get dizzy in the head :) Your search could probably be formatted like: 'conditions' = array( 'Model.is_active' = 'Y', 'or' = array( 'Model.column1 LIKE' = '%keyword%',

Re: Display a blob in a view

2009-03-17 Thread Martin Westin
I agree with Brian. Using exit is bad style (if you care) disabling rendering is nicer and lets Cake clean up after the controller has run. Your code looks ok. It should display (or force-download) a file for you. If you see crap, or nothing at all, than check that $type really is a mime-type

Re: RSS with html tags using RssHelper?

2009-03-17 Thread Martin Westin
://rsstalker.com/feed/amazon/25percent -Matthttp://www.pseudocoder.com On Mar 17, 5:14 am, Martin Westin martin.westin...@gmail.com wrote: I am trying to put together a feed containing images in the description of each item along with some p tags and other simple html. Just entering the html

Re: Where should I place xml files?

2009-03-16 Thread Martin Westin
I'd say this depends on the scenario: If you created the file your best place is probably the vendors folder. If a user uploads it, I keep it in app/uploads/meaningful_folder_name. If is is uploaded, parsed and then not needed then I'll keep it in tmp and then delete it when I am done. If it

Re: changing $useDbConfig 'on-the-fly' ?

2009-03-16 Thread Martin Westin
This is for only a single model? In that case you can put the if-clause in the constructor. function __construct($id = false, $table = null, $ds = null) { if ( should use special config ) { $this-useDbConfig = 'special_config'; } parent::__construct($id, $table, $ds); }

Re: Why there are so many 'DESCRIBE' when I enable debug model?

2009-03-16 Thread Martin Westin
Richard is right. Describe does just that... describes the tables so that Cake can know that Article should have a tltle field and that it contains up to 255 characters and so on and so on... As Richard also writes this is cached but when you are in debug-mode you are expected to alter the

Re: My first CakePHP website launched

2009-03-16 Thread Martin Westin
The slightly nerdier, but fully dynamic way to check if you are on the home page (site root). if ( $html-url('/') == $this-here ) { // you are on the homepage } This will continue to work if you change your routing so that the index moves from say the posts controller to a brand new

Re: Fatal Error

2009-03-16 Thread Martin Westin
Don't use empty strings for conditions. Use empty arrays. This might possibly cause your problem since it will find all records for you. At least it used to in the pre-release versions of 1.2. Also about recursive: recursive 0 loads belongsTo data. Setting recursive -1 will load only the primary

Re: Model1 hasMany Model2 with count(), how to get SQL like this?

2009-03-12 Thread Martin Westin
] = ... ) ... no [BaseImages] key PS: sorry for my english On 11 мар, 18:04, Martin Westin martin.westin...@gmail.com wrote: You probably want a little, slightly obscure, gem called joins. In use it looks something like: $this-find('all', array(     'conditions' = $conditions,     'joins' = array

Re: File Uploading

2009-03-12 Thread Martin Westin
I, for one, would have expected something more like what is shown here: http://book.cakephp.org/view/303/File-Fields You didn't forget to make the form an upload form? $form-create('UserInfo', array('type' = 'file')); On Mar 12, 9:14 am, AD7six andydawso...@gmail.com wrote: On Mar 12, 7:08 

Re: Combining Zend_lucene, Vendors, Component does not my cake make

2009-03-12 Thread Martin Westin
Hi, I have a few comments: You should not have to mess with set_include_path at all. You never assign the controller to the $controller property. You assign it to $this-data for some reason. Even if you change that so that $this-controller is the controller you don't do database calls to

Re: MVC Design Question

2009-03-12 Thread Martin Westin
+1 for your version 2 (Fat Model). It is the way I do things for similar cases. Sometimes you want to do it beforeSave (this model should be saved only if the other model can be created) and other times afterSave when things are the other way around. afterSave has a helpful parameter so you can

Re: File Uploading

2009-03-12 Thread Martin Westin
Ah, thought it looked strange. Haven't looked at that variable since 2006 probably :) On Mar 12, 9:58 am, AD7six andydawso...@gmail.com wrote: On Mar 12, 9:43 am, Martin Westin martin.westin...@gmail.com wrote: I, for one, would have expected something more like what is shown here:http

Re: Paginator localhost vs. remote server URL generates differently.

2009-03-11 Thread Martin Westin
I'd say that your server is doing things correctly and your local setup is acting strange. To get any arguments to persist when paginator creates it's links you need to do this in your view: $paginator-options(array('url' = $this-passedArgs)); Since you mention nothing about it my guess is

Re: Multiple language supports

2009-03-11 Thread Martin Westin
Or is their any facility in cakephp like, i enter only English information and it is saved in both language. The developers working on the Cake core are smart, but don't hold your breath :) What you are aiming for is two different things. 1. Translations of your application's static texts.

Re: Suspected bug in controller method routing

2009-03-11 Thread Martin Westin
I don't understand the problem at all. If you have done no redirects you would get: The action fu renders the view fu. The view fu contains a form pointing to the action save. The action save processes the form and renders the view save. To have the action save returning control to edit of fu

Re: Model1 hasMany Model2 with count(), how to get SQL like this?

2009-03-11 Thread Martin Westin
You probably want a little, slightly obscure, gem called joins. In use it looks something like: $this-find('all', array( 'conditions' = $conditions, 'joins' = array( array( 'table' = 'model2', 'alias' = 'Model2', 'type' = 'inner',

Re: 1.2 + Xampp +debug on = page loads of 10s+

2009-03-10 Thread Martin Westin
I can't remember ever seeing a definite answer as to why this is or how to fix it... the popular way seems to be to stop using xampp and try WAMP instead or some of those other fake-linux setups. If you are the curious type: The problem should be with some less common WinXP settings and Cake

Re: I wanna catch an controller object

2009-03-10 Thread Martin Westin
Unimaginative standard answers: :) You can try to see if the task you need performed by the other controller could be put into a model. Most of the real work should be done by models. You can also try to make a Component out of that code you need to call. The last resort or a quick and dirty

Re: I wanna catch an controller object

2009-03-10 Thread Martin Westin
Doing something like this: $ctrlObject = ClassRegistry::init('MyController'); would get you an instance, only probably not a working one with the model and components and things. /Martin On Mar 10, 5:09 pm, persivo_cunha ricky...@gmail.com wrote: No one of these three ways could solve my

Re: requestAction problem with different version 1.2.0.7692 and 1.2.1.8004

2009-03-05 Thread Martin Westin
( I'll skip the usual suggestion: to not use requestAction for this purpose. It has been said too often and I am sure you have read a few already. ) That does sound strange. I can suggest only one far-fetched things to look into. The very unlikely thing that can mess with the models in this way

Re: routing rpoblem

2009-03-03 Thread Martin Westin
I think what you want to do is make use of slugs. Your categories are not set by you in development, right? They are editable by whoever administers the application, right? In that case, creating manual routes for each category becomes very messy. I suggest you look at sluggable behavior.

Re: Return a script and execute it

2009-02-26 Thread Martin Westin
I have not done it myself, but as I understand it returning javascript to be executed is just native to ajax. Have a look at the javascript library you are using to see if anything needs to be configured for it to work...(prototype has a property called evalScripts) but it should more or less

Re: a description about some cakephp improvement points

2009-02-26 Thread Martin Westin
Further points: 1. They forgot that PHP4 is also OK ;) 5. The framework is inadequate to create new records in tables that have only one autoincrement (or serial) field I read this as being either about a table with a single field (just the id), or more likely about Cake not liking composite

Re: Is this a major bug in Cake 1.2.1 stable?

2009-02-23 Thread Martin Westin
Hi Mathew, I can't replicate your problem. I can request using either syntax. Try to run the tests for the dispatcher and see if they fail. If so, then your setup may have some strange setting causing problems. You don't say how the requestAction fails. What is the error you get? Those lines

Re: SecurityComponent::requireLogin() with type 'basic' not working

2009-02-23 Thread Martin Westin
When you specify the login you are telling the component that you will handle the authentication in that method. To make a login fail from that method you must black-hole the request. Return values below do nothing but they should imho. $this-Security-loginOptions = array( 'type'='basic',

Re: App::import search Cake core files in wrong paths. Bug?

2009-02-22 Thread Martin Westin
.  Is the cake_core_file_map file getting created? On Feb 20, 2:12 pm, Martin Westin martin.westin...@gmail.com wrote: No so on my computer, which is why I thought it was strange. (Mac OS X) On Feb 20, 5:37 pm, majna majna...@gmail.com wrote: There is no Not found when debug = 0, after cake_core_file_map file

Re: update from cakePHP 1.2.0.7692 RC3 to cakePHP 1.2.1.8004 stable

2009-02-20 Thread Martin Westin
I don't remember any specific problem updating from RC3. Generally changes should be mostly things that are a problem in RC3 will be fixed. There shouldn't be a lot to change, if anything at all. You should just update the core and test your app. (I imagine you don't have a lot of automated tests

Re: AppController methods

2009-02-20 Thread Martin Westin
No need for all that :) AppController has no methods defined. That is sort of the point of the application controller... that is is defined in the application. The one in the core is just an empty placeholder. On Feb 20, 1:07 pm, luke BAKING barker lukebar...@gmail.com wrote: I'd be 'Api to.

Re: HABTM with only two tables... How to do that..?

2009-02-20 Thread Martin Westin
I think you can create a HABTM onto itself by aliasing. Look at the full definition of the relationship in the cookbook and you will find that you can call the related table something other than it's real name. I don't really get what you want to achieve. At first glance I think I would have

Re: App::import search Cake core files in wrong paths. Bug?

2009-02-20 Thread Martin Westin
I see plenty of not found at debug level 0... which is strange. If anyone is at all interested, there is a way to optimize this, tedious and dirty. For example: in cake/bootstrap.php //App::import('Core', array('Dispatcher')); App::import('Core',

Re: Problems with Security Component

2009-02-20 Thread Martin Westin
SecurityComponent protects you from some hacking attempts. If your posted form did not have the required security hashes it protects you by emptying the data. You can be treated as a hacker if for example: - You wrote the form by hand without FormHelper. - You have ajax on the same page. /Martin

Re: update from cakePHP 1.2.0.7692 RC3 to cakePHP 1.2.1.8004 stable

2009-02-20 Thread Martin Westin
See my answer in the other thread. On Feb 20, 2:38 pm, amarradi radis...@googlemail.com wrote: Thanks a lot the was successful but the reason for updated was that i want to use the Security Component and i had an error. Like this

Re: App::import search Cake core files in wrong paths. Bug?

2009-02-20 Thread Martin Westin
No so on my computer, which is why I thought it was strange. (Mac OS X) On Feb 20, 5:37 pm, majna majna...@gmail.com wrote: There is no Not found when debug = 0, after cake_core_file_map file is created. Refresh page one more time.. 2009/2/20 Martin Westin martin.westin...@gmail.com

Re: Odd pagination possible using paginator?

2009-02-18 Thread Martin Westin
haven't had time to dig further than that so, for now, it's been a bit of a stab in the dark. On Tue, Feb 17, 2009 at 6:55 AM, Martin Westin martin.westin...@gmail.com wrote: Hi, This is a bit of an odd case. I have a deep association and want to paginate the farthest model ignoring its

Re: List of all Controllers and Actions

2009-02-18 Thread Martin Westin
I haven't done this sort of menu and I am not sure I would want to. You might need to do the following: Get all controllers by listing the folder (app/controllers) and pasring the filenames. Dito for any plugins. You would then have to instantiate each one and call get_ class_ methods() to get

Define TMP where?

2009-02-18 Thread Martin Westin
Catchy subject, no? At least it is to the point. :) So, I want to (re)define where the temp-files go. I would prefer to do this without modifying the core, but I can't see where. My first true entry-point into the request-cycle is in bootstrap.php, too late to define the constant TMP. Now,

Re: Problem with email component after upgrade to 1.2 final

2009-02-18 Thread Martin Westin
Hello LunarDraco, devils advocate here. Exactly how much faster would all that be compared to requestAction()? Unless you see some serious performance gain why bother? (it is only one cron request every hour? every 5 min?) On Feb 18, 4:04 pm, LunarDraco mdc...@gmail.com wrote: If you use

Odd pagination possible using paginator?

2009-02-17 Thread Martin Westin
Hi, This is a bit of an odd case. I have a deep association and want to paginate the farthest model ignoring its relation to the intermediate model... As a straight find using containable might explain the hierarchy: $this-data = $this-Person-find('first',array( 'conditions' = array(

Re: Book Comments - Should they be removed

2009-02-17 Thread Martin Westin
This has a lot to do with: What is a comment? or more likely: What should a comment be about? There is: Desire to add, modify or remove content - Editing. Which we have in a moderated form. Desire to offer usage examples and tricks - Comments (as php.net for example) -- my interpretation of a

Re: deprecation of useful functions

2009-02-16 Thread Martin Westin
Personally I think that the change to find is one of the bigger improvements to 1.2. I could never remember the order of the many many arguments to find and had to look them up at least once a day. Putting them info an associative array helps me a lot because I don't have to remember pointless

Re: output buffering

2009-02-15 Thread Martin Westin
I have also had varying success using output buffering so I would also sugger using a shell command that returns the output instead of printing it. Just to save you any further headache. But ob stuff should work and I too would be a little interested in knowing of any dos and don'ts within Cake's

Re: OT: Job offer / Gig offer. Looking for Cake developer in Sweden.

2009-02-13 Thread Martin Westin
:)  Goodluck. On Feb 12, 5:46 am, Martin Westin martin.westin...@gmail.com wrote: Sorry for the spam. I'll try to keep this short. The company I work for is looking for a quality CakePHP developer. We currently have more work than I have time to complete and this problem does not look

Re: debugging a -find that cause 100% cpu usage

2009-02-13 Thread Martin Westin
If you are on that early version of 1.2, it is likely that you have encountered some bug in the Model/DSO parts of Cake. There are probably quite a lot of tickets related to those areas of Cake fixed between then and the release. 1.2 still had a few tings to fix there when it was into the RCs.

Re: Alternative Routing for RSS

2009-02-13 Thread Martin Westin
-programming/cakephp/add-rss-fe... On Feb 12, 6:32 am, Martin Westin martin.westin...@gmail.com wrote: I am not really an expert on routing, but i'd say that you need to specify ext = rss like this Router::connect('/presses/rss', array('controller' = 'presses

Re: debugging a -find that cause 100% cpu usage

2009-02-12 Thread Martin Westin
You are right... there is not a whole lot to say without a more information. For now, I'll assume we are talking about a pretty normal LAMP server? Let's start with what is using 100% cpu? MySQL or PHP? Also, the conditions you use. Any associations and so on... If it all works ok on your local

Re: Alternative Routing for RSS

2009-02-12 Thread Martin Westin
I am not really an expert on routing, but i'd say that you need to specify ext = rss like this: Router::connect('/presses/rss', array('controller' = 'presses', 'action' = 'rss_feed', 'ext' = 'rss'

Re: Turning $_GET/$_POST into named params

2009-02-11 Thread Martin Westin
Hi Miles, One way that works really well is to have a proxy action accepting the initial search. This action reorganizes the get or post parameters into named ones and redirects to the real action. It sound a bit convoluted but it is a pretty common technique that offers a lot of flexibility In

Help with calculated field being backticked to death

2009-02-11 Thread Martin Westin
Hi, I am trying to order by a calculation (in a pagination) but my calculation is being backticked to death. I can't find a way to write this so that is works. I have: var $paginate = array( 'Modelname' = array( 'fields'=array( 'Modelname.id',

Re: Help with calculated field being backticked to death

2009-02-11 Thread Martin Westin
. Try these: '(Modelname.foreign_id0 AS result)' '(Modelname.foreign_id0) AS result' '((Modelname.foreign_id0) AS result)' '(((Modelname.foreign_id0) AS result))' One of them _should_ work hth grigri On Feb 11, 11:34 am, Martin Westin martin.westin...@gmail.com wrote: Hi, I am

Re: (how) can cake do nested applications

2009-02-06 Thread Martin Westin
Hi, I handle something similar using plugins. Each plugin can be an independent application if you like. What I went for was an application core that handles the main layout, users and a few global things. Then each plugin just taps into the part of the core it needs or keeps to itself. I just

Re: Automatic Hashing in Auth

2009-02-05 Thread Martin Westin
Hi Aidan, Sorry, but automatic hashing was not a stumbling block for me. I has a whole set of other issues when first implementing AuthComponent. But that is hardly relevant. I see lots of questions about authentication and passwords, too. There is a simple and exceedingly common was to

Re: Automatic Hashing in Auth

2009-02-05 Thread Martin Westin
to comply with an existing database of users. /Martin On Feb 5, 11:44 am, Martin Westin martin.westin...@gmail.com wrote: Hi Aidan, Sorry, but automatic hashing was not a stumbling block for me. I has a whole set of other issues when first implementing AuthComponent. But that is hardly

Re: utf-8 encoding problem

2009-02-04 Thread Martin Westin
I wouldn't call it normal. I am not sure there is a normal collation. If you state nothing else MySQL will choose utf8_general_ci so that would be the default. Binary collation is the collation for non-lingual text. Every character counts and order clauses cause them to be ordered by their

Re: paginate order A-Z and Z-A...I thought it was easy...

2009-02-04 Thread Martin Westin
I don't think you can decide the direction in that way. Even though sortDir() has an options parameter and a directions key it looks for when you use sort() the options do not get passed along to sortDir() http://api.cakephp.org/view_source/paginator-helper/#line-163

Re: Does Auth automatic hash work only with specific actions?

2009-02-04 Thread Martin Westin
Auth should hash the password anywhere. It looks for $this-data['User']['password'] (or whatever you have changed it to) on every request. It will not hash $this-data[0]['User']['password'] for example. You wrote resetPassword controller. A typo right? Otherwise check that Auth is included in

Re: Dynamically remove a helper in a controller

2009-02-04 Thread Martin Westin
I don't know if it is the right way... but the beforeFilter would be the first place to try. I can imagine that not working so instead you can override the constructor of that one controller and remove the helper from the helpers array there. At least it worked for modifying components under Cake

Re: Calling select queries within find()

2009-02-04 Thread Martin Westin
I have been using a modified DBO for MySQL which does the translation automatically if you write ... AS Modelname__fieldname. I am not really sure about the downside to using it but it has not given me any problems with that project that I am aware of. It is called dbo_mysql_ex and wirrten by

Re: svn or git?

2009-02-03 Thread Martin Westin
Just found this website in relation to the whole What the Eff is this git thing I keep hearing about? http://gitready.com/ On Feb 2, 1:40 pm, Martin Westin martin.westin...@gmail.com wrote: @leo I know what you mean. That is why, for two years, I stubbornly kept using SmartSVN, which

Re: Prototype AND extJS?

2009-02-03 Thread Martin Westin
I have only had a shallow look at ExtJS but as I see it: Prototype is a javascript framework with ajax ExtJS is an Ajax and GUI framework built in javascript That is: Prototype is used to put some nice ajax on your web-app and ExtJS is something you build your app in from the start. Using ExtJS

Re: svn or git?

2009-02-03 Thread Martin Westin
@Sam I use this to clean my folders before uploading to the production server (I don't checkout to that server). cd where/you/have/svn/crap find ./ -name .svn -exec rm -rf {} \; /Martin On Feb 3, 2:34 pm, Sam Sherlock sam.sherl...@gmail.com wrote: For me Git because complex is better than

Re: need Help on Internationalization in CakePHP

2009-02-02 Thread Martin Westin
It is not as hard as you may think at first. The hard part about this is figuring out what your language is called. :) There is an ISO standard for this which can be a bit confusing. Swedish (my native language) can be called up using: swe - 3-letter version sv - 2-letter version for standard

Re: Top 10 Framework

2009-02-02 Thread Martin Westin
really hate those my-os-is-better, my-framework-is-cooler, my- browser-is-safer-discussions. everyone should test a few of the frameworks and use the one that fits his way of developing best. Rankings can only give you an overview. On 2 Feb., 14:04, Martin Westin martin.westin...@gmail.com

Re: loading cake into code

2009-02-02 Thread Martin Westin
You can probably do something like this: 1. make a copy of app/webroot/index.php - call it start_cake.php or something and put it where you can include it. In that file: 2. alter the include paths to suit your environment so that cake can be found. 3. remove the call to Dispatcher almost at the

Re: Top 10 Framework

2009-02-02 Thread Martin Westin
Why do I hear the cries of Jihad every time I read about this vs that framework :) If that website is a guide the the best framework, then these are the very best short films and videos. http://www.youtube.com/browse?s=trc=0l=b=0 You decide popularity by voting and popular is not always the

Re: not filter with username case sensitive

2009-02-02 Thread Martin Westin
Auth does not enforce either case sensitivity or insensitivity. This is all up to how you have your database configured. If your database, table of field is set to a _ci collation you will have case insensitive usernames. If you have a _cs or _bin collation you will be case sensitive. (All MySQL

Re: BeforeFind

2009-02-02 Thread Martin Westin
I'd say that beforeFind should be used for thing that you want to run at all times. Instead of doing this in beforeFind you might want to create a custom find which is a good way to enforce custom logic to the find operation while leaving any associations and other internal queries alone. As a

Re: svn or git?

2009-02-02 Thread Martin Westin
@leo I know what you mean. That is why, for two years, I stubbornly kept using SmartSVN, which is free but horrible in comparison. After trying Cornerstone and smiling with every commit, I gladly paid the license for Cornerstone... or I should say my employer reluctantly did :)

Re: New api template =(

2009-01-29 Thread Martin Westin
The new api (new code all the way) was written by Mark Story and Gwoo. http://mark-story.com/posts/view/the-new-face-of-cakephp-s-api Since they just released it a few days ago I imagine there may be a few minor things to tweak. But I don't see what you describe, at least not when looking at

Re: how to get value from select drop down box

2009-01-29 Thread Martin Westin
Hi vikas, Getting the value works no different than the value of a normal text input field. The controller sees this-data['Model']['report_timeframe'] // or whatever you call it. The options array you pass to the select field looks like this: array( 'value' = 'visible label' ) So I usually

Re: svn or git?

2009-01-29 Thread Martin Westin
If you are on Mac OS X you should really look at Versions and Cornerstone. They are both excellent subversion clients that are very Mac. I bought Cornerstone after using SmartSVN for a while (read years) and it's a world of difference, even for something as basic as versioning code. Well, if you

Re: Validation of a disabled input field

2009-01-29 Thread Martin Westin
In my experience a disabled field will not follow the rest of the values to the server. According the the w3c a disabled field cannot be successful which I read as can not have a value when submitted. You can use the attribute readonly (only for text inputs) which disables editing but the value

Re: slightly OT: need an unusual find condition (or possible custom query)

2009-01-28 Thread Martin Westin
you for the example with the temp table, I suspect it will come in handy quite soon. /Martin On Jan 26, 7:56 pm, AD7six andydawso...@gmail.com wrote: On Jan 26, 2:35 pm, Martin Westin martin.westin...@gmail.com wrote: Hi, I am in need of an unusual query that I find it hard to search

Re: How can I get the xml encoding using Xml class?

2009-01-26 Thread Martin Westin
Thanks RoVo, I was on that path but stopped when my personal needs ended with the knowledge that all text is converted on parsing. But if I want to read an xml file and then save it back out again I would definitely like to k ow the encoding so that the saved file would have the same encoding as

Re: Having trouble with FormHelper radio method

2009-01-26 Thread Martin Westin
Hi Seth, Check ut this section in the cookbook. I think your problem is that you specify each radio individually using $form-radio. You might try $form-input('Field',array('type'='radio','options'=$your_data)) as it seems to be the promoted way to make a radio group.

Re: Are we using the slowest PHP framework there is?

2009-01-26 Thread Martin Westin
Alongside questions about HABTM relationships this is one topic that never dies. :) I have said this before. I have no real-life problems with the speed of CakePHP. I don't know all the other frameworks so there is no way for me to offer a comparative opinion. But I have applications running

Re: Custom data source

2009-01-26 Thread Martin Westin
I would probably not go all the way back to a data source. At least not at first. I would create a special Model that talked to the web service. The reason is that I don't really think you will end up supporting a majority of the data source features so it may be more work than you want. How

Re: Performing a Query using a curdate as condition, help asap?

2009-01-26 Thread Martin Westin
There are lots of goodies you can use (for MySQL at least). Datediff is my preferred comparison since it does not fail on leap- years and things like that. DATEDIFF(date1,date2) 0 - true or false To construct modified versions of today I sometimes use Addate adn Subdate ADDDATE(CURDATE(),

Re: How to deploy cakephp app on production server?

2009-01-26 Thread Martin Westin
The manual entry is short but that is all that is needed for a basic setup. Describe commands stop as soon as you go into debug 0. General performance advice (Not things you do in your app. Things you do in deployment): Compiling php and the web server specifically if the added boost is worth

slightly OT: need an unusual find condition (or possible custom query)

2009-01-26 Thread Martin Westin
Hi, I am in need of an unusual query that I find it hard to search for on Google or MySQL.com since all the terms I think of are very common ones. Hopefully someone reading this can guide me in the right direction. I have a series of values in an array. I can find out which records have matching

Re: Plugin's model methods is missing

2009-01-26 Thread Martin Westin
Hi Jaro, I am pretty sure you have missed the plugin name when targeting the Model. I have had a number of hard to track bugs that were related to the naming of classes in plugins. If you do debug($this-OrderProduct) You should see OrderProduct Object... but you will probably see

Re: Plugin's model methods is missing

2009-01-26 Thread Martin Westin
first takes precedence. If a bad version is called up first then anything after that makes no diference. So check every reference to that model while you are at it. /martin On Jan 26, 4:13 pm, Martin Westin martin.westin...@gmail.com wrote: Hi Jaro, I am pretty sure you have missed the plugin

Re: CakePHP sessions

2009-01-26 Thread Martin Westin
There are a two known things I remember reading about: Ajax (or rapid-fire fingers) conflicting with high security levels. Setting security to medium or lower should fix that. There is also the possibility that your host does a bit of clean-up in php's sessions dir. Using cake sessions should

Re: How can TMP be set to some other directory?

2009-01-22 Thread Martin Westin
Thanks RoVo, That's what I was afraid of. I don't like modifying dist-files, but it looks like I have to. Let's just hope nothing changes in index.php for a while :) /Martin On Jan 20, 1:16 pm, RoVo rol...@service-itzehoe.de wrote: Hi Martin, Unfortunately defining TMP in bootstrap.php is

Re: How to sum up the duration time based on the application used?

2009-01-22 Thread Martin Westin
From http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html (first comment) SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `time` ) ) ) AS total_time FROM time_table; So you should be able to add a fields to your search where you put the above MySQL trick. You may also want to add a GROUP

Re: Cake debug html code

2009-01-22 Thread Martin Westin
You don't really need to change the location in the source to display sql debugging in a pretty way. http://snook.ca/archives/cakephp/debug_styles/ For any debug() statements you put in your code you would have to override that function and save them all until you get to the layout. But the

How can I get the xml encoding using Xml class?

2009-01-22 Thread Martin Westin
Hi, This must be something obvious I am missing, so I thought I'd ask. I load an rss feed: App::import('Core', 'Xml'); $rss = new XML($url_to_an_rss_feed); And thought that these would automatically reflect the encoding (and version for that matter) of the xml loaded: debug( $rss-encoding );

Re: How can I get the xml encoding using Xml class?

2009-01-22 Thread Martin Westin
Hi ReVo, $__header contains a string of the first line in the xml. this will usually contain something like xml version=1.0 encoding=UTF-8 since the tag characters are stripped away. But it may also contain the whole of, or part of, the xml since xml files are valid without any whitespace.

Re: How can I get the xml encoding using Xml class?

2009-01-22 Thread Martin Westin
, Martin Westin martin.westin...@gmail.com wrote: Hi ReVo, $__header contains a string of the first line in the xml. this will usually contain something like xml version=1.0 encoding=UTF-8 since the tag characters are stripped away. But it may also contain the whole of, or part of, the xml since

Re: baking cakephp on MAC OS

2009-01-21 Thread Martin Westin
? still have same problem. please can somebody help me? Thanks On Jan 20, 2:45 pm, Martin Westin martin.westin...@gmail.com wrote: I second Mark's reply. If you simply call path/to/cake/console/cake you will be using the system's version of php. If you are committed to using a lot

Re: Callbacks not firing in JoinModel

2009-01-21 Thread Martin Westin
this would probably help a lot. /Martin On Jan 21, 9:19 am, brian bally.z...@gmail.com wrote: no! That method's private to Model. I meant, have a look through it (and save) to see what's happening internally. On Wed, Jan 21, 2009 at 2:41 AM, Martin Westin martin.westin...@gmail.com wrote

Re: Callbacks not firing in JoinModel

2009-01-21 Thread Martin Westin
This is not a good day for writing... Last paragraph should of-course read: Where does this stuff get tested? I can't find any tests that use callbacks on joining models in the core tests. Locating where they test this would probably help a lot. On Jan 21, 10:50 am, Martin Westin

Re: Read Excel files

2009-01-21 Thread Martin Westin
I have used http://sourceforge.net/projects/phpexcelreader It is quite basic (and therefore lightweight) but does the trick so far. Example from the dist: $data = new Spreadsheet_Excel_Reader(); $data-read('jxlrwtest.xls'); for ($i = 1; $i = $data-sheets[0]['numRows']; $i++) { for ($j

Re: Cron Job Hostgator

2009-01-20 Thread Martin Westin
Did you create a shell task? I used to use a method similar to the one described in the bakery article you link to. But a while back I switched to using a shell task (less hacking more cake-friendly support). A very simple shell might just look like this: class HourlyShell extends Shell {

Re: baking cakephp on MAC OS

2009-01-20 Thread Martin Westin
I second Mark's reply. If you simply call path/to/cake/console/cake you will be using the system's version of php. If you are committed to using a lot of shell stuff (such as bake), you really should switch to using the system's php install. It will make things easier in the long run. The setup

Re: Callbacks not firing in JoinModel

2009-01-20 Thread Martin Westin
: The reason I want to use the save and delete callbacks is that I want to put together a custom counterCache for a habtm relationship. That is why I want to trigger an update each time a link is created or deleted. /Martin On Jan 19, 8:56 am, Martin Westin martin.westin...@gmail.com wrote: Hi there, I

How can TMP be set to some other directory?

2009-01-20 Thread Martin Westin
Hi (again), I want to try to host one application under several domains. One Cake One App Many configs Many temp dirs It is that last bit I get stuck on. I really want to split the tmps so I have one for each domain. Unfortunately defining TMP in bootstrap.php is too late. It is already set in

Re: How can TMP be set to some other directory?

2009-01-20 Thread Martin Westin
Royle a...@sleekgeek.com.au wrote: Can you explain why you need different tmp directories for the same actual app? If it's for caching, etc, maybe you can use a cache prefix dynamically? Cheers, Adam Martin Westin wrote: Hi (again), I want to try to host one application under several

Re: Callbacks not firing in JoinModel

2009-01-20 Thread Martin Westin
, Jan 20, 2009 at 5:02 AM, Martin Westin martin.westin...@gmail.com wrote: bump... My current working theory is that for some (to me) unknown reason (performance?) habtm relationships are created and deleted without fully utilizing the joining model. That is when you do: $data = array

<    1   2   3   4   5   >