Lefora Free Forum

apinstein's Blog

Male, 35, Decatur, GA, US

Creator of the phocoa php framework.

http://reasonablyopinionated.com/
Member For: 1 year, 7 months
Posts: 12
Top Post By apinstein (most thumbs up):

No posts received thumbs up, next time you see a good one, give some respect and thumb it up.

Recent Posts by apinstein:

Re: conf.php file is not created by phocoa

May 2, 2009 by apinstein

With propel 1.3 you don't need creole anymore. Use the new "reverse" target instead. And you need to run "convert-conf" too. It's what converts the propel-build/runtime-conf.xml into the blog-conf.php file.

Does that help?

Also I haven't tried to follow the instructions for the blog tutorial lately. It's possible it's not correct, but it does sound like you just aren't running convert-conf.

Re: Working with PostgreSQL

April 30, 2009 by apinstein

Hmmm. Well you could use it with mysql and just fix the queries that are generated for postgres. I should be able to generate appropriate code for any db, just haven't bothered to yet, but it should be trivial to just fix those errors, they should be very rare.

As for setting up postgres, there isn't much to it the way I do it. I use either yum on linux or macports on mac and it kinda does everything for you, and just tells you to run a few commands once it's built...

You are right it can be tricky but recent versions are quite automated unless you're building from source.

Alan

Re: Creole error when running propel-gen

April 30, 2009 by apinstein

Try upgrading to propel 1.3 and see if you still have the problem.

Re: conf.php file is not created by phocoa

April 30, 2009 by apinstein

I'll bet you're still on propel 1.2. In propel 1.3 they changed the "task" name that creates that file, and if you are using phocoa to set up your propel support, then it runs the new task "convert-conf" instead of the old one "convert-props".

You should upgrade to propel 1.3 and then run:

propel-gen propel-build/ convert-conf

Alan

IMPORTANT answers for first-time users

April 24, 2009 by apinstein


I have just helped a friend get started with phocoa on a shared host and there are a few issues he ran into that are worth sharing. Some of the issues are shared-host specific, and others are general enough that they may happen to you even if you aren't in a shared hosting environment.

1. Shared hosts don't let you munge include_path for php, but they will look in "." for a php.ini file, so you can put a php.ini file at wwwroot/php.ini with a custom include_path that points to your pear repo.

2. This happens for the php cli too, which causes problems for the phocoa, phing, and propel-gen scripts. Fortunately all of these cli tools look for a PHP_COMMAND environment variable, so you can just do:


export PHP_COMMAND='php -c /path/to/project/project/wwwroot/php.ini'

3. Unfortunately, phing overrides this. Until they fix this bug, you can just "fix" it in your pear repo by commenting out these 2 lines:


# Change this to reflect your environment if the default value doesn't work
#PHP_COMMAND="/opt/local/bin/php"
#export PHP_COMMAND

4. If you aren't using pecl/syck as your YAML parse, you'll have to make one more fix. The Horde/YAML package also has a bug in that it doesn't properly escape yaml values with # characters.

This fix is also easy, just add the patch from this bug report. Near line 156:

          $spaces = str_repeat(' ', $indent);

+        // quote strings if necessary
+        if (strchr($value, '#')) {
+            $value = "'{$value}'";
+        }
+
          if (is_int($key)) {


5. If phing complains about STDIN not being defined, you can fix this by editing phing/system/io/ConsoleReader.php and adding this around line 36:

define('STDIN', fopen("php://stdin","r"));




That should address any issues you have with getting started with phocoa.

phocoa 0.2.3 released! Now with support for shared hosting via .htaccess config

April 23, 2009 by apinstein

I've just released a new version of phocoa with all of the improvements and bug fixes made over the last few months.

- [bugfix] Fix a couple of bugs that caused .htaccess support to be broken in "newProject" runs.
Version 0.2.3 - 4/22/2009
- [new] Automatically activate the username field on the login module.                                                                                                                           
- [new] Fixtures improvements: Add support for "named objects" in to-many relationships.
- [new] Add WFFormatter smarty plugin to allow use of the PHOCOA formatting infrastructure directly in templates.
- [new] Added "class" support to WFPassword.
- Add comments
- [new] Add labelPosition property to WFCheckbox for controlling position of <label> in relation to <input>. 'left' or 'right'.- [bugfix] Fixed bug where restoreState was getting called even if the current widget isn't on a form that was submitted. This caused side effects such as "restoring" the incorrect (uninitailiz
ed) state of WFSelectionCheckbox.
- [new] Refactor WFKeyValueValidators to take an optional 4th parameter "options" that allows extra info to be passed to built-in validators. BC-safe.
Version 0.2.2 - 3/5/2009
- minor tweaks.
Version 0.2.1 - 2/19/2008- [new] Add KVC method setValuesForKeys()
- [new] Add experimental inter-property validation mechanism, see KVC method validateObject().
- [new] Add addErrors() convenience methods to WFPage and WFWidget.- [new] WFPage now catches WFErrorsException when thrown from action methods and automatically adds all errors to the page.
        Architecturally this is useful because it allows you to simplify your controllers by no longer having to catch errors
        and translate them to "page errors". Your models can now just throw WFErrorsException objects and you can let the magic happen.
- [new] WFErrorsException class. A specialized exception that handles arrays of the structure used by validateObject().- [new] WFArray class, or the early beginnings of one. Right now it's just there to make it easy to simulate "prototype pluck" via:
        WFArray::arrayWithArray($arrayOfErrors)->valueForKeyPath('errorMessage')
- [new] Add support for 'class' property to WFLabel.
- [new] Add nullPlaceholder property to WFTextArea and WFLabel.
- [new] WFYAHOO_widget_Uploader now fires a 'WFYAHOO_widget_Uploader:allUploadsComplete' event when the upload is completed, allows fully on-page ajax uploading.
- [new] Add maxUploadBytes parameter to WFYAHOO_widget_Uploader.
- [new] Improve formatting of upload list for WFYAHOO_widget_Uploader; now reports per-file progress and errors.
- [new] Upgrade YUI to 2.7.0.
- [bugfix] WFYAHOO_widget_PhocoaDialog now works properly with NullPlaceholders in WFTextField and WFTextArea. WFYAHOO_widget_PhocoaDialog now allows the loaded content to execute embedded scri
pts before munging the focus.
- [bugfix] WFYAHOO_widget_TreeView would fail to load data that had & characters in the ID. Fixed.
- [BC-break] Changed the default error code for WFError to NULL from 0. I don't think anyone is relying on this.
- [BC-break] Changed the signature of WFModuleInvocation::quickModule() to mirror that of WFModule constructor. I searched all of my own projects and had no actual uses of quickModule() that wo
uld be affected by this change, but I am noting it anyway for others.
Version 0.2.0 - 1/21/2009
- [new] Add preventAbandondedForm property to WFYAHOO_widget_Tab. Given the ID of a form element, this will prevent navigation to another tab with "dirty" data.
- [new] Upgrade YUI to 2.6.0.- [new] Upgrade Prototype to 1.6.0.3
- [new] add argument passing infrastructure for Appcelerator
- [new] Add WFYAHOO_widget_TreeView option for autoExpandUntilChoices- [new] Add WFYAHOO_widget_TreeView function to allow reloading of entire tree
- [new] Add WFYAHOO_widget_TreeView property "queryFieldId" to allow linking a WFTextField to the tree for the purpose of making a filterable/searchable tree.
- [new] Added several new KVC methods. See the docs for details, but here are the new methods.
          valuesForKeys, valuesForKeyPaths, (static) valueForStaticKey, (static) valueForStaticKeyPath
        And optional functions for handling undefined keys: valueForUndefinedKey, (static) valueForUndefinedStaticKey.        To use static KVC with YAML files, just set the instanceID to any valid instance, empty controllerKey, and modelKeyPath of "YourObject::staticKeyPath.key"
- [new] Add smarty JSON block plugin to make it easy to create JSON in templates with nice formatting and still pass it safely into a JS var.                                                    
- [new] Add WFSearchField widget. This is a text box with an "X" clear and "GO" buttons. Integrate with WFYAHOO_widget_TreeView.- [new] Add WFYAHOO_widget_Carousel control.                                                                                                                                                     
- [new] Add expandOnClick property to WFYAHOO_widget_TreeView to make it easy to turn off the default behavior of expanding nodes when the label is clicked.
- [new] Add drag & drop feature to WFYAHOO_widget_TreeView.                                                                                                                                      
- [new] Refactor WFRPC/WFAction javascript; move WFActionResponsePhocoaUIUpdater handling from WFAction to WFRPC so that it's available more broadly.- [new] Add validatedSetValueForKey() and validatedSetValueForKeyPath() to KVC. These are simple wrapper functions that automatically call setters on valid values.                              
- [bugfix] With PHOCOA_DEBUG mode enabled, YUI still used yahoo-dom-event.js, since "allowRollup" seemed to override the debug setting. Now these are not rolled up and debug versions are used.
- [bugfix] Redirects caused by login requests now use the REQUEST_URI instead of just the invocation path; previously querystrings were stripped.
- [bugfix] PHOCOA.WFRPC Javascript object default target was set incorrectly. Now default target is the page delegate. Also updated docs to reflect proper syntax.
- [bugfix] PHOCOA.WFRPC was sending arguments with null Javascript values as (string) null to the backend; this has been fixed.
- [bugfix] Updated generator to no longer create widgets with id's "new" or "delete" which cause problems for javascript in IE.- [bugfix] YUI PhocoaDialog now correctly handles fixedcenter.
- [bugfix] When a non-ajax form is submitted by PhocoaDialog, and there is an error, phocoa now properly returns an HTML response rather than an AJAX response. Essentially there was a bug in th
e action response handler that assumed being submitted via XHR meant you were an AJAX form submit, which isn't always true.- [BC-break] Refactor WFFixture and WFYaml. Look at new API docs if you are using these APIs in your code; the fixes are very easy.

OGNL and KVC

November 24, 2008 by apinstein

I am in the process of adding support for accessing static members/methods via key-value coding when I came across something called OGNL (Object-Graph Navigation Language):

http://www.ognl.org/

I had never heard of it, but it's essentially a standardized way of implementing KVC. It's a Java-only implementation now, but it grew out of the exact same process that created KVC for phocoa.

I might have to consider using this in the future, very cool!

Thoughts anyone?

PHOCOA source code now hosted on GitHub; also now on OhLoh!

November 17, 2008 by apinstein

We have finally posted a public repository for PHOCOA for people to get access to the raw code easily. We are using GitHub:

http://github.com/apinstein/phocoa

We also have created a project page on Ohloh.net. Ohloh is a pretty cool site that is essentially a social network and reputation system for open source contributors. It seems to be growing very quickly.

https://www.ohloh.net/projects/phocoa

Enjoy!

phocoa.com Redesign

September 30, 2008 by apinstein

I have re-designed the phocoa web site. The old one was quite horrible. I am not a designer, and it showed in a bad way.

For this redesign, I found some web 2.0 skin generators, and they didn't do a half-bad job. Certainly won't win any prizes, but at least it's a step in the right direction.

I also un-cluttered the home page a bit, and will be cleaning it up even further in the near future, highlighting key action steps like Download, Learn, Talk.

There is also a new phocoa logo (attached). It's a cocoa bean, with PHP logo on it, with glorious rays of coding enlightenment emanating from within. :)

Please let me know what you think is most important as a new visitor to phocoa.com and I'll try to make that information highly visible.

Thanks & enjoy,
Alan

PHOCOA Updates

September 27, 2008 by apinstein

I have made a ton of improvements to phocoa over the last several months. While I still haven't had time to set up a blog yet for phocoa, I wanted to go ahead and post a list of all of the improvements that I've made:

Legend:
[bugfix] - Bug fix.
[new] - New feature.
[BC-break] - Backwards-compatibility may be broken. Update your code to "the new way" as noted.
[BC-deprecated] - Backwards-compatibility mode supported, but deprecated. Update your code to "the new way" as noted.

Version 0.1.7 - 9/27/2008
- [bugfix] Added htmlspecialchars to WFTextField
- [new] Add onEvent support for WFDynamic objects via setting onEvent on the prototype.
- [new] Add relative date support to all WF*DateFormatters via +++ token. Add relativeDateFormatString for controlling formatting of out-of-bounds format strings in relative mode.
- [BC-deprecated] Removed WFException::raise() which was a bad idea and not really used.
- [new] Add WFDecorator to ControllerLayer. You can now specify a "decorator" or "decorators" as class names of WFDecorator subclasses. The WFDecorator infrastructure makes
it easy to write functions to format things for UI's without having to muddy up your model objects with UI code.
- [BC-deprecated] All Binding Options are now described in WFBinding, not WFBindingSetup. WFBinding options are now documented in WFBinding API docs page. WFBindingSetup::WFBINDINGSETUP_PATTERN_OPTION_NAME,WFBINDINGSETUP_PATTERN_OPTION_VALUE,WFBINDINGSETUP_INSERTS_NULL_PLACEHOLDER,WFBINDINGSETUP_NULL_PLACEHOLDER will be removed in a future version.
- [new] Added WFYAHOO_widget_ColorPicker widget.
- [bugfix] If a bound value is an array, and a formatter is assigned to the binding, PHOCOA will now apply the formatter function to the elements of the array, rather than the array (which resulted in a bungled value). Useful for things like WFJumpSelect::$contentLabels.
- [new] Added a setTarget() method to WFSubmit so you can better control the method called when submitting a form.
- [new] Add minified versions of core JS files and add GZIP encoding to httpd.conf template
- [bugfix] Add support for setting any KVC property in fixtures. Previously only properties backed by the database would work.
- [new] Add PHOCOA_DEBUG mode to turn on advanced debugging for javascript, etc. Just set PHOCOA_DEBUG=1 in your URL and that session will be in debug mode for the remainder of that session. PHOCOA_DEBUG turns on debug reporting and uses non-minified Javascript files.
- [new] Refactor WFRPC to remove YUI dependency. Things are much faster now. Thanks @jwatts!
- [new] Add a magic array operator @first to get the first value from an array.
- [new] Add a WFYAHOO_widget_Uploader to wrap the YUI Uploader widget.
- [new] Complete WFMenuItemBasic; add support for additional parameters in WFYAHOO_widget_Menu. Add support for inline WFMenuItemBasic objects in nestedArrayToMenuTree

Version 0.1.6 - 8/7/2008
- [bugfix] Custom action methods on WFSubmit widgets now work in conjunction with WFForm.isAjax. Previously the "default" action name was always used even if a custom action was specified.
- [bc-break] The "onEvent: <event> do j:" syntax was updated so that it no longer stops the javascript event by default. If you want to stop the javascript event now,
do "this.stopEvent(event);" inside of your "j:" handler.
- [new] Added WFFixture class to handle loading of fixture data via YAML files.
- [bugfix] WFSelect now treats all values as type string, thus fixing a problem where options "" and "0" were not treated as distinct values.

Version 0.1.5 - 7/24/2008
NOTE: need to look up a better list of improvements made since 0.1.4. Not sure how...
- [new] WFSensitiveDataFormatter makes it easy to X-out parts of strings.
- [bugfix] WFSelect now works properly when using options bindings in conjunction with InsertNullPlaceholder.
- [new] Update to FCKeditor 2.6.
- [new] Update to YUI 2.5.2.

Version 0.1.4
- [new] Appcelerator integration.
- [new] Replace spyc integration with Horde/Yaml.
- [new] WFYAHOO_widget_YahooScript for including YAHOO-dependent Javascript on your pages.
- [new] Ability to have the "default page" of a module accept parameters without specifying the page name in the invocation path. Must implement module::allPages() to enable.
- [new] Added WFPostletUpload, which is a widget that offers a Java applet for bulk-uploading files to phocoa apps via drag-n-drop.
- [bugfix] Phocoa now works properly when accessed from behind proxy servers.
- [new] Added readline support to the phocoa shell, if you have it installed in your PHP. This adds history and auto-complete support, although history isn't working reliably.
- [new] Added ability to customize respondsToForms from WFSkinModuleView.
-

Version 0.1.1
- [BC-break] WFYAHOO is now an abstract class. Some applications may have previously instantiated WFYAHOO objects to bootstrap the YUI lib. This will now break.
To update, you should remove any WFYAHOO instances from your application and instead use the {YUI} smarty plugin, which utilizes the new YUILoader support.
- [BC-break] If you are using WFArrayController with USE_ARRAY_INDEXES_AS_ID (#arrayIndexes#), by default your array controllers will break,
due to the new avoidsEmptySelection property, which is true by default. To fix this, either convert your array controllers
to use ids, or set avoidsEmptySelection to false.
- [new] Ajax infrastructure has been added to PHOCOA. Refer to docs for details, as it is a big system.

PHOCOA Forum Launched

April 10, 2008 by apinstein

I have set up a forum for phocoa. Previously we were using Google groups, but I think the forum will make it easier for people to interact. Plus, this forum has a lot of great features.

For instance, it supports RSS so this link will keep you up-to-date on all the latest phocoa news:

http://phocoa.lefora.com/api/category/30203/?format=atom

I will leave the Google Groups up for a bit, too, for now.

Enjoy!

Welcome Message to New Members

April 10, 2008 by apinstein

Thanks for joining the phocoa forum! We think phocoa is a great framework for building web applications quickly.

We are very excited about having more phocoa developers out there, so please feel free to ask any questions at all and we'll be glad to help.

Happy coding!

Alan