Table design for storing of synonyms
Dear all, I have been trying to find the best and most cake-like solution for storing data on synonyms in my app. The synonyms come in groups of maximal four and read performance is very important but write performance not so. One of the solutions I have been thinking is just to store to them in table like this: synonym1 | synonym2 | synonym3 | synonym4 This is of cause very cake-unlike but should perform well. Another solution is this table design: word | synonym_group_id Synonym_group_id should just be a a unique group ID and no other information need to stored about the group, so a dedicated synonym_groups table would just be a ID-counter and could/should maybe be omitted. Any thoughts on this Kind regards Anders -- 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: Access Session from view in 1.3
Thanks, that did the trick. /Anders On Mar 12, 1:33 pm, jacmoe wrote: > Cake 1.3 features a Session helper - you need to explicitly include > Session as component and helper in your controllers. > So it becomes $this->Session->read. > > But, wouldn't it be better to do this in your app controller: > > > $this->set('Auth',$this->Auth->user()); > > Then you have $Auth exposed to every view. :) > > On Mar 12, 12:19 pm, Kanten wrote: > > > Dear all, > > > I'm trying to acess the Session model for info regarding the > > authentication of my users in pages views. In 1.2 I have used the > > following code: > > $session->read('Auth.User.user_group_id') > 1 > > > It seems like the $session var is gone in 1.3 though. What do I use > > instead? > > > /Anders Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en
Access Session from view in 1.3
Dear all, I'm trying to acess the Session model for info regarding the authentication of my users in pages views. In 1.2 I have used the following code: $session->read('Auth.User.user_group_id') > 1 It seems like the $session var is gone in 1.3 though. What do I use instead? /Anders Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en
Re: Form with saving of true/false/null
I have been giving this some thought and I do get what you mean, but it is very important that the user can always change e.g. an "yes" answer into "not info on subject". Database wise I think you are right, that I should define three different values (no = 0, yes = 1, no info = 2) instead of using no info = Null. Thank you very much for your help. /Anders On Jul 30, 9:41 am, delocalizer wrote: > You sure you want an explicit third option 'no information on the > subject'? Wouldn't it be better to just have a radio group with 2 > buttons (Yes/No or True/False) with a default value of NULL for that > field in your database? Or if you really want to have a third option > to force a user to enter something, mapping to a value other than > empty string or 'null' might be wise, as depending on how your db > field is defined, these may not be distinguishable from 'no data > entered'. The 'right' solution really depends on the particular logic > of your application - what data your users should enter and how that > data will be used and analysed once it's in the database. > > On Jul 30, 12:40 am, "rich...@home" wrote: > > > I'd use a drop down select instead of an option group. > > > This should do the trick: > > > input("Model.field", array("options"=>array(""=>"No > > information on subject", true=>"True", false=>"False))); ?> > > > On Jul 29, 12:29 pm, Kanten wrote: > > > > Is there really noone, that can help me with this one? > > > > Thanks > > > Anders > > > > On Jul 10, 1:49 pm, Kanten wrote: > > > > > Hi, > > > > > I am making a database for research and for this project I have a lot > > > > of dichotomous (binary) variables where I need to be able to > > > > discrimate between true, false and "no information on > > > > subject" (=null). I would like to store it as a bool field in MySQL. > > > > User interface wise I was thinking of using radio buttons with the > > > > option of choosing between the three posibilities. > > > > > Is there some easy way of doing this using the builtin form helper, or > > > > do I need to to modify it somehow? > > > > > Thanks > > > > Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Form with saving of true/false/null
I think I would prefer radio buttons, as I think these are easier to select then scroll downs when having to enter larger amount of data. Do you know how I can code this? /Anders On Jul 29, 4:40 pm, "rich...@home" wrote: > I'd use a drop down select instead of an option group. > > This should do the trick: > > input("Model.field", array("options"=>array(""=>"No > information on subject", true=>"True", false=>"False))); ?> > > On Jul 29, 12:29 pm, Kanten wrote: > > > Is there really noone, that can help me with this one? > > > Thanks > > Anders > > > On Jul 10, 1:49 pm, Kanten wrote: > > > > Hi, > > > > I am making a database for research and for this project I have a lot > > > of dichotomous (binary) variables where I need to be able to > > > discrimate between true, false and "no information on > > > subject" (=null). I would like to store it as a bool field in MySQL. > > > User interface wise I was thinking of using radio buttons with the > > > option of choosing between the three posibilities. > > > > Is there some easy way of doing this using the builtin form helper, or > > > do I need to to modify it somehow? > > > > Thanks > > > Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Form with saving of true/false/null
Is there really noone, that can help me with this one? Thanks Anders On Jul 10, 1:49 pm, Kanten wrote: > Hi, > > I am making a database for research and for this project I have a lot > of dichotomous (binary) variables where I need to be able to > discrimate between true, false and "no information on > subject" (=null). I would like to store it as a bool field in MySQL. > User interface wise I was thinking of using radio buttons with the > option of choosing between the three posibilities. > > Is there some easy way of doing this using the builtin form helper, or > do I need to to modify it somehow? > > Thanks > Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Form with saving of true/false/null
Hi, I am making a database for research and for this project I have a lot of dichotomous (binary) variables where I need to be able to discrimate between true, false and "no information on subject" (=null). I would like to store it as a bool field in MySQL. User interface wise I was thinking of using radio buttons with the option of choosing between the three posibilities. Is there some easy way of doing this using the builtin form helper, or do I need to to modify it somehow? Thanks Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: BeforeSave and undefined index
Well, that was a really embarressing error. Especially considering I used 1 hour trying to debug it. Thank you very much! /Anders On Jan 13, 6:01 pm, grigri wrote: > You wrote this: > > $this->data['ArvcProfile']['minor_criteria'] == $minor; > $this->data['ArvcProfile']['major_criteria'] == > $major; > > if ($major > 1 || ($major == 1 && $minor > 1) || > ($minor > 3)) { > $this->data['ArvcProfile'] > ['criteria_fulfilled'] == 1; > } > > I think you meant this: > > $this->data['ArvcProfile']['minor_criteria'] = $minor; > $this->data['ArvcProfile']['major_criteria'] = $major; > > if ($major > 1 || ($major == 1 && $minor > 1) || > ($minor > 3)) { > $this->data['ArvcProfile'] > ['criteria_fulfilled'] = 1; > } > > This sort of typo is frequent the other way around (using = instead of > ==) and can lead to major hair loss. This way around, I haven't seen > so much > > hth > grigri > > On Jan 13, 4:51 pm, Kanten wrote: > > > Hi, > > > I'm trying to do some beforesave massaging in my model but it fails > > with the error messages: > > Notice (8): Undefined index: minor_criteria [APP/models/ > > arvc_profile.php, line 32] > > Notice (8): Undefined index: major_criteria [APP/models/ > > arvc_profile.php, line 33] > > Notice (8): Undefined index: criteria_fulfilled [APP/models/ > > arvc_profile.php, line 36] > > > The threes indexes are not a part of the form, from which the data is > > derived, but are in the database table, and hence I thought I would be > > able to manipulate them in my model. My BeforeSave function can be > > seen below. > > > Anyone know what I am doing wrong here. > > > function beforeSave() { > > /* Calculates no of major and minor ARVC criterias */ > > $minor = 0; > > $major = 0; > > $total = 0; > > $groups = array(); > > if($this->data['ArvcProfile']['rv_sev_dilatation'] == 1) > > {$major++;} > > if($this->data['ArvcProfile']['rv_aneurysms'] == 1) > > {$major++;} > > if($this->data['ArvcProfile']['rv_sev_seg_dilatation'] == > > 1) {$major+ > > +;} > > if($this->data['ArvcProfile']['rv_mild_dilatation'] == 1) > > {$minor++; > > $groups[]=1;} > > if($this->data['ArvcProfile']['rv_mild_seg_dilatation'] == > > 1) {$minor > > ++; $groups[]=1;} > > if($this->data['ArvcProfile']['rv_reg_hypokinesia'] == 1) > > {$minor++; > > $groups[]=1;} > > if($this->data['ArvcProfile']['fibrofatty_replacement'] == > > 1) {$major > > ++;} > > if($this->data['ArvcProfile']['inverted_t_waves'] == 1) > > {$minor++; > > $groups[]=3;} > > if($this->data['ArvcProfile']['epsilon_waves'] == 1) > > {$major++;} > > if($this->data['ArvcProfile']['late_potentials'] == 1) > > {$minor++; > > $groups[]=4;} > > if($this->data['ArvcProfile']['lbbb_vt'] == 1) {$minor++; > > $groups[] > > =5;} > > if($this->data['ArvcProfile']['familial_disease'] == 1) > > {$major++;} > > if($this->data['ArvcProfile']['familial_sd'] == 1) > > {$minor++; $groups > > []=6;} > > if($this->data['ArvcProfile']['familial_history'] == 1) > > {$minor++; > > $groups[]=6;} > > > $this->data['ArvcProfile']['minor_criteria'] == $minor; > > $this->data['ArvcProfile']['major_criteria'] == $major; > > > if ($major > 1 || ($major == 1 && $minor > 1) || ($minor > > > 3)) { > > $this->data['ArvcProfile']['criteria_fulfilled'] == > > 1; > > } > > return true; > > } > > > /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
BeforeSave and undefined index
Hi, I'm trying to do some beforesave massaging in my model but it fails with the error messages: Notice (8): Undefined index: minor_criteria [APP/models/ arvc_profile.php, line 32] Notice (8): Undefined index: major_criteria [APP/models/ arvc_profile.php, line 33] Notice (8): Undefined index: criteria_fulfilled [APP/models/ arvc_profile.php, line 36] The threes indexes are not a part of the form, from which the data is derived, but are in the database table, and hence I thought I would be able to manipulate them in my model. My BeforeSave function can be seen below. Anyone know what I am doing wrong here. function beforeSave() { /* Calculates no of major and minor ARVC criterias */ $minor = 0; $major = 0; $total = 0; $groups = array(); if($this->data['ArvcProfile']['rv_sev_dilatation'] == 1) {$major++;} if($this->data['ArvcProfile']['rv_aneurysms'] == 1) {$major++;} if($this->data['ArvcProfile']['rv_sev_seg_dilatation'] == 1) {$major+ +;} if($this->data['ArvcProfile']['rv_mild_dilatation'] == 1) {$minor++; $groups[]=1;} if($this->data['ArvcProfile']['rv_mild_seg_dilatation'] == 1) {$minor ++; $groups[]=1;} if($this->data['ArvcProfile']['rv_reg_hypokinesia'] == 1) {$minor++; $groups[]=1;} if($this->data['ArvcProfile']['fibrofatty_replacement'] == 1) {$major ++;} if($this->data['ArvcProfile']['inverted_t_waves'] == 1) {$minor++; $groups[]=3;} if($this->data['ArvcProfile']['epsilon_waves'] == 1) {$major++;} if($this->data['ArvcProfile']['late_potentials'] == 1) {$minor++; $groups[]=4;} if($this->data['ArvcProfile']['lbbb_vt'] == 1) {$minor++; $groups[] =5;} if($this->data['ArvcProfile']['familial_disease'] == 1) {$major++;} if($this->data['ArvcProfile']['familial_sd'] == 1) {$minor++; $groups []=6;} if($this->data['ArvcProfile']['familial_history'] == 1) {$minor++; $groups[]=6;} $this->data['ArvcProfile']['minor_criteria'] == $minor; $this->data['ArvcProfile']['major_criteria'] == $major; if ($major > 1 || ($major == 1 && $minor > 1) || ($minor > 3)) { $this->data['ArvcProfile']['criteria_fulfilled'] == 1; } return true; } /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: Missing error message when submitting ajax form
I'm quite interested in this as well. Can you tell us more about how you made this work, maybe show your code? My problem is that I "disappear" my form after data is submitted. Can I somehow "not disappear it" when it doesn't validate? /Anders On Nov 11, 8:51 am, Bart <[EMAIL PROTECTED]> wrote: > I just found it. > I needed to ALSO make the AJAX call update the form. > > On 10 nov, 22:17, Bart <[EMAIL PROTECTED]> wrote: > > > Hello there, > > > I have aformthat I submit with anAJAXcall. TheAJAXcall also > > updates another div in the page. I does not update theformdiv > > itself. > > All goes well, except when theforminput is validated as false there > > is no error message. > > The submission simply stops, the item is not inserted into the > > database and a new submit attempt can be made. > > > When I do the submission by a regular POST call (noAJAX), I do get > > the right error message. > > Is there a workaround? > > Theajaxformcode looks as follows: > > > echo $ajax->form('Snack', 'POST', array('update'=>'centralText', > > 'url'=>'/updateSnack', 'before'=>'togglePreloader();', > > 'complete'=>'togglePreloader();')); > > > Thanks, > > Bart > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Open Flash Chart 2
Hi, I'm trying to implement Open Flash Chart 2 (http://teethgrinder.co.uk/ open-flash-chart-2/) into my Cakephp app. I'm aware of the "Open Flash Chart Helper" (see http://bakery.cakephp.org/articles/view/open-flash-chart-helper-draw-charts-the-cake-way), but this is for the old version. What's new in the new version is that the data is delivered by a JSON object. This does make it a bit tricky fitting into the MVC framework as the controller has to produce both a view in the form of a html page and a JSON object. Anyone been working with Open Flash Chart 2 and are able to point me in the right direction? /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to recode MySQL Boolean field to yes/no in a view
Well I guess your way is the more elegant one. :-) Been away from programming a couple of years. Thank you very much. /Anders On Oct 3, 10:30 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > Over-engineer much? ;-) > > echo $model['boolField'] ? 'Yes' : 'No'; > > On 3 Oct 2008, at 17:08, Kanten wrote: > > > > > Hi, > > > I have a MySQL table with lots of boolean fields (BOOL) and when > > viewing these in my view I would like to output "Yes" or "No" instead > > of "1" or "0". > > > I have experimented a bit with doing stuff like this in my controller: > > > foreach (array_keys($data['BrugadaProfile']) as $key): > > if ($data['BrugadaProfile'][$key] == 1 && ! > > strpbrk($key, 'id')) > > { //Avoid recoding foreign key fields > > $data['BrugadaProfile'][$key] = 'Yes'; > > } elseif ($data['BrugadaProfile'][$key] == 0 && ! > > strpbrk($key, > > 'id')) { > > $data['BrugadaProfile'][$key] = 'No'; > > } > > endforeach; > > > But this approach is obviously very error prone and I think the best > > way to go about it, is to somehow access the field type to check if > > its a boolean field and then recode it. > > How can this be done? > > > /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to recode MySQL Boolean field to yes/no in a view
Hi, I have a MySQL table with lots of boolean fields (BOOL) and when viewing these in my view I would like to output "Yes" or "No" instead of "1" or "0". I have experimented a bit with doing stuff like this in my controller: foreach (array_keys($data['BrugadaProfile']) as $key): if ($data['BrugadaProfile'][$key] == 1 && ! strpbrk($key, 'id')) { //Avoid recoding foreign key fields $data['BrugadaProfile'][$key] = 'Yes'; } elseif ($data['BrugadaProfile'][$key] == 0 && ! strpbrk($key, 'id')) { $data['BrugadaProfile'][$key] = 'No'; } endforeach; But this approach is obviously very error prone and I think the best way to go about it, is to somehow access the field type to check if its a boolean field and then recode it. How can this be done? /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Passing arguments to "add" action
Thanks, that works. But how do I access it in my controller when it is encoded as: /icd_events/add/patientId:1 and not: /icd_events/add/1 /Anders On Oct 2, 11:09 am, "jitka (poLK)" <[EMAIL PROTECTED]> wrote: > CONTROLLER: > > function add($patient_id = null) { > if (empty($this->data)) { > if (!empty($patient_id)) { > $this->data['YourModelName']['patient_id'] = $patient_id; > } > } else { > ... > } > ... > > } > > FORM: > echo $form->create('YourModelName'); > echo $form->hidden('patient_id'); > > LINK calling add() action for first time: > echo $html->link('New record', array( > 'controller' => 'your_controller', > 'action' => 'add', > // <- patient id passed as an argument to add() action > )); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Manual Search Not Working?
I've noticed this as well. And as I wrote in another post the add comment function in the Bakery also does not work. But who maintains these sites? /Anders On Oct 1, 7:58 pm, Tony Thomas <[EMAIL PROTECTED]> wrote: > Has something changed with the CakePHP Cookbook's search > (book.cakephp.org)? Over the last few days every search turns up no > results. I just tried a search for "model" and it returned no results. > Anyone who works on that know anything? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Passing arguments to "add" action
Hi, I would like to pass the argument "patientId" to my add action and save this as a hidden field in my form. The URL I call is this: /icd_events/add/patientId:1 Two questions: 1.How do I access this argument in my controller and pass it on to the view? 2.How do embed this as a hidden field in my form? I have tried with this: echo $form->hidden('patient_id'); But it doesn't work. Thanks /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Auth - Basic Template User System
I must say I second that. I'm trying to build a Auth-system and the documentation of the Auth Component is sorely lacking. So if anyone could point to a full fledged working example, that would be very much appreciated. /Anders On Oct 1, 5:37 am, Tom Chapin <[EMAIL PROTECTED]> wrote: > Hello, > > Thank you for your reply! > > I downloaded NeutrinoCMS and it looks like it has a functional user > login system, but I didn't see anything about new user registration in > it, though... > > Does anyone know of any other cake apps out there that have fully > functional user authentication built in? Maybe I could mix and match > to get a complete picture. > > I'd really like to put together a web app starter pack that just does > user registration/login/management (and does it well), and put it up > on cakeforge for people to use. I noticed a couple of other similar > concepts on the cakeforge, but for some reason, none of them had any > files available to download. Strange. > > -Tom Chapin > > On Sep 30, 6:17 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > > > Try Neutrino CMS its fantasic; that uses auth. I downloaded some time ago; I > > have not used it on any projects though; Its a working example you can > > learn from > > > All you'd have to > > > > do is throw some other models and controllers on it and you'd have a > > > complete web app. > > > I have found adding auth to a site very easy, but I baked test projects and > > rebaked after mistakes. > > > (There is plenty of info about auth) > > > 2008/9/30 Tom Chapin <[EMAIL PROTECTED]> > > > > I've been using CakePHP for a number of projects over the past two > > > years (and I love it). > > > > One of the things that's been holding me back is the Auth system. I > > > was using a custom coded user system for CakePHP 1.1, and it worked > > > pretty well. However, now that I'm moving to 1.2, I found that it no > > > longer works, and I would really like to take advantage of the built- > > > in Authentication object instead of using some hacked together user > > > system. The only problem is that all the documentation I've been able > > > to find seems to be in pieces and all spread around. I haven't found > > > any complete, coherent examples of the 1.2 Auth user system in proper > > > use. All I've found are snippets and what not here and there. > > > > Does anyone have (or know of) a ready-to-roll user system for CakePHP > > > 1.2? Like, just a basic CakePHP app that does nothing but User > > > registration (hopefully including sign up confirmation and forgotten > > > password emailing), User Login, and User Management? All you'd have to > > > do is throw some other models and controllers on it and you'd have a > > > complete web app. > > > > If something like this existed and was open sourced and freely > > > available for people to use or improve on, I think it would be so > > > useful. I have a number of projects that I've dreamed up and have half- > > > built, and if I could just plug in a working user registration/login/ > > > management piece, I could practically launch 3 different web apps > > > right now. > > > > Any ideas? > > > > Thanks, > > > > Tom Chapin > > > Tornado Design > > > [EMAIL PROTECTED] > > >http://www.tornadodesign.com > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Add comment in the bakery doesn't work
Hi, I'm afraid there is something wrong with the add comment function in the bakery: http://bakery.cakephp.org/ When trying to add a comment it always comes back with: "The comment could not be saved. Please correct the errors below." When looking below at the comment, no errors are listed and in reality, there is no errors. Is there anyone with developer access to the bakery, that can look into this? /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems with cipher behavior
You were ofcause absolutely right. The problem was my field in the database, which was too small. Changed it from VAR(11) to VAR(100) and the problem was solved. Thank you very much. /Anders On Sep 29, 1:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > FYI: I haven't used that behaviour at all. :) > > The errors you pasted look like encoding issues. You might be > encrypting data into a field that can't handle the input. > mypassword is a good varchar(255) but my password ciphered might > require a blob or at least some other charset. > > When I wrote my own "mini-cipher" I god pure binary data back from > Cakes Security::cipher() and had to hex-encode the data before I could > save it to the database. I also had to do the reverse when reading the > data back. This was kind of a last-minute hack and I did not like to > alter the database-schema of a live application. > > This is nothing advanced so here is my code as an example: > > function _encrypt($str) { > $out = bin2hex(Security::cipher( $str, 'some salt' )); > return $out;} > > function _decrypt($str) { > $out = Security::cipher(pack('H*', $str), 'some salt' ); > return $out; > > } > > After encryption it is bin2hexed and before decryption is is returned > to binary data. > > On Sep 29, 12:58 pm, Kanten <[EMAIL PROTECTED]> wrote: > > > Thanks, that removed the PHP errors. > > > I still have some problems with the behaviour though. It correctly > > encrypts the data, but even though autoDecrypt is set to true, it > > doesn't decrypt the data. In the log the behaviour outputs: > > > 2008-09-29 11:53:40 Error: CipherBehavior::_unpackValue Enclosed salt > > missmatch: '—y÷' != 'G¡ œ' 8 > > 2008-09-29 11:53:40 Error: CipherBehavior::_decryptValue Could not > > unpack value from '—y÷G¡ œ' > > 2008-09-29 11:53:40 Error: CipherBehavior::decrypt Could not decrpyt > > Patient::cpr: '$E$4kK+EF1+' > > > /Anders > > > On Sep 26, 3:21 pm, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > Hi Kanten, > > > You are running this on an version of PHP where you are no longer > > > supposed to define pass_by_reference in functions like before. LIke > > > the error said you can allow it in php.ini or fix the behaviour. From > > > a quick glance I'd say you could safely remove them since decrypt() is > > > defined to accept the arguments as references. > > > > $this->decrypt(&$model, &$result); > > > See the two & there. > > > > /Martin > > > > On Sep 26, 2:43 pm, Kanten <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > I'm experimenting with > > > > thecipherbehavior:http://bakery.cakephp.org/articles/view/cipher-behavior > > > > > Unfortunately I keep getting the following error and can't seem to > > > > figure out how to debug the script myself: > > > > > Warning: Call-time pass-by-reference has been deprecated; If you would > > > > like to pass it by reference, modify the declaration of [runtime > > > > function name](). If you would like to enable call-time pass-by- > > > > reference, you can set allow_call_time_pass_reference to true in your > > > > INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line > > > > 90 > > > > > The code section corresponding to this is: > > > > > /** Model hook to decrypt model data if auto decipher is turned on in > > > > the > > > > * model behavior configuration. Only primary model data are > > > > decrypted. */ > > > > function afterFind(&$model, $result, $primary = false) { > > > > if (!$result || !isset($this->config[$model->name]['cipher'])) > > > > return $result; > > > > > if ($primary && $this->config[$model->name]['autoDecrypt']) { > > > > // check for single of multiple model > > > > $keys = array_keys($result); > > > > if (!is_numeric($keys[0])) { > > > > $this->decrypt(&$model, &$result); > > > > } else { > > > > foreach($keys as $index) { > > > > $this->decrypt(&$model, &$result[$index]); > > > > } > > > > } > > > > } > > > > return $result; > > > > } > > > > > Any ideas? > > > > > /Anders > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems with cipher behavior
Thanks, that removed the PHP errors. I still have some problems with the behaviour though. It correctly encrypts the data, but even though autoDecrypt is set to true, it doesn't decrypt the data. In the log the behaviour outputs: 2008-09-29 11:53:40 Error: CipherBehavior::_unpackValue Enclosed salt missmatch: '—y÷' != 'G¡ œ' 8 2008-09-29 11:53:40 Error: CipherBehavior::_decryptValue Could not unpack value from '—y÷G¡ œ' 2008-09-29 11:53:40 Error: CipherBehavior::decrypt Could not decrpyt Patient::cpr: '$E$4kK+EF1+' /Anders On Sep 26, 3:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi Kanten, > You are running this on an version of PHP where you are no longer > supposed to define pass_by_reference in functions like before. LIke > the error said you can allow it in php.ini or fix the behaviour. From > a quick glance I'd say you could safely remove them since decrypt() is > defined to accept the arguments as references. > > $this->decrypt(&$model, &$result); > See the two & there. > > /Martin > > On Sep 26, 2:43 pm, Kanten <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I'm experimenting with > > thecipherbehavior:http://bakery.cakephp.org/articles/view/cipher-behavior > > > Unfortunately I keep getting the following error and can't seem to > > figure out how to debug the script myself: > > > Warning: Call-time pass-by-reference has been deprecated; If you would > > like to pass it by reference, modify the declaration of [runtime > > function name](). If you would like to enable call-time pass-by- > > reference, you can set allow_call_time_pass_reference to true in your > > INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line > > 90 > > > The code section corresponding to this is: > > > /** Model hook to decrypt model data if auto decipher is turned on in > > the > > * model behavior configuration. Only primary model data are > > decrypted. */ > > function afterFind(&$model, $result, $primary = false) { > > if (!$result || !isset($this->config[$model->name]['cipher'])) > > return $result; > > > if ($primary && $this->config[$model->name]['autoDecrypt']) { > > // check for single of multiple model > > $keys = array_keys($result); > > if (!is_numeric($keys[0])) { > > $this->decrypt(&$model, &$result); > > } else { > > foreach($keys as $index) { > > $this->decrypt(&$model, &$result[$index]); > > } > > } > > } > > return $result; > > } > > > Any ideas? > > > /Anders > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problems with cipher behavior
Hi, I'm experimenting with the cipher behavior: http://bakery.cakephp.org/articles/view/cipher-behavior Unfortunately I keep getting the following error and can't seem to figure out how to debug the script myself: Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by- reference, you can set allow_call_time_pass_reference to true in your INI file in C:\wamp\www\cake\app\models\behaviors\cipher.php on line 90 The code section corresponding to this is: /** Model hook to decrypt model data if auto decipher is turned on in the * model behavior configuration. Only primary model data are decrypted. */ function afterFind(&$model, $result, $primary = false) { if (!$result || !isset($this->config[$model->name]['cipher'])) return $result; if ($primary && $this->config[$model->name]['autoDecrypt']) { // check for single of multiple model $keys = array_keys($result); if (!is_numeric($keys[0])) { $this->decrypt(&$model, &$result); } else { foreach($keys as $index) { $this->decrypt(&$model, &$result[$index]); } } } return $result; } Any ideas? /Anders --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple Display Field
Well that seems simpler, but I do like the thought of having this as a behavior. /Anders On Sep 24, 4:29 pm, teknoid <[EMAIL PROTECTED]> wrote: > I'm not familiar with that behavior, but I can offer you another > solution, which will work just fine if you need to combine two > fields... > > http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combin... > > On Sep 24, 9:03 am, Kanten <[EMAIL PROTECTED]> wrote: > > > I'm trying to use the Multiple Display Field behavior as described > > here:http://bakery.cakephp.org/articles/view/multiple-display-field-3 > > > I run into two problems when using this: > > 1. Cake generates two error messages whenever I load a page that uses > > this behavior: > > "SQL Error: 1064: You have an error in your SQL syntax; check the > > manual that corresponds to your MySQL server version for the right > > syntax to use near 'varDump' at line 1 [CORE\cake\libs\model > > \datasources\dbo_source.php, line 512]" > > And > > "mysqli_real_escape_string() expects parameter 2 to be string, array > > given [CORE\cake\libs\model\datasources\dbo\dbo_mysqli.php, line 259]" > > > 2. I cannot figure out how to use a non-existent field as > > $display_field. Whenever I try do this I get an error. For instance I > > would like to use the field full_name, that isn't in my db table. > > > My code is a folllows: > > > class User extends AppModel { > > > var $displayField = 'first_name'; > > > var $actsAs = array('MultipleDisplayFields' => array( > > 'fields' => array('first_name', 'last_name'), > > 'pattern' => '%s %s' > > )); > > > } > > > Anyone? > > > /Anders, Denmark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Multiple Display Field
I'm trying to use the Multiple Display Field behavior as described here: http://bakery.cakephp.org/articles/view/multiple-display-field-3 I run into two problems when using this: 1. Cake generates two error messages whenever I load a page that uses this behavior: "SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varDump' at line 1 [CORE\cake\libs\model \datasources\dbo_source.php, line 512]" And "mysqli_real_escape_string() expects parameter 2 to be string, array given [CORE\cake\libs\model\datasources\dbo\dbo_mysqli.php, line 259]" 2. I cannot figure out how to use a non-existent field as $display_field. Whenever I try do this I get an error. For instance I would like to use the field full_name, that isn't in my db table. My code is a folllows: class User extends AppModel { var $displayField = 'first_name'; var $actsAs = array('MultipleDisplayFields' => array( 'fields' => array('first_name', 'last_name'), 'pattern' => '%s %s' )); } Anyone? /Anders, Denmark --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---