Dec 05, 2008 | 02:29 PM  
Welcome

Don't have an account yet? You can create one, it is free, just click here

as a registered user you have some advantages like free downloads, comments and posting on our forums, depending upon this site's configuration and options.

 • •  Control Panel - Register - Login  • • 
Current Stable MDPro Lite 1.0821 Download
  Forum FAQForum FAQ   SearchSearch  UsergroupsUsergroups  PreferencesPreferences  Options forumOptions forum  Watched TopicsWatched Topics  Watched ForumsWatched Forums
Latest forum posts Latest forum posts  Log in to check your private messages Log in to check your private messages    Log inLog in 
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Riklaunim
MD user level 5
MD user level 5


Joined: Dec 01, 2003
Posts: 130
Location: Poland
Member
Post 18Posted: Sep 17, 2006 - 12:42 PM Reply with quote Back to top
Post subject: MD-Pro 3000 idea

I visit Polish postnuke and MD-Pro supports sites and it's "borring" to read topics about "your site hurts our server CPU/RAM" stories (example - get all news to count them Wink) or PN/other/phpBB hacking attack news.

I propose a MD-Pro(*postnuke) 3000 - a future release:
- For PHP5/6 only
- released after PHP6 settles, when BSD/Debian/Red-Hat ships with PHP5 Wink
- Use PHP5/6 features like improved object model (use exceptions for example as error handling)
- Breaks backward compatibility to get the best performance and features
- Reduce PHP libraries to minimum (no ADOdb, use PDO)
- Don't use 3rd party libs, try to make:
- Create a clear an easy to use MVC or simillar framework in which creating, maintaining and altering apps would be quick and easy.
- Create a set of framework libs for managing forms, templates, etc. unified and clean code, don't use PEAR, try PHP5/6 like ezComponents if needed.
- Use one small&usefull JS/DHTML/Ajax framework for all that kind of work, make some PHP api to common tasks (for example dojo)

PHP-Fusion, Drupal or punBB with their rapid developement are conquering the web. Postnuke and MD-Pro didn't realy changed since I remember Wink Python is planning a python 3000 release which breaks backward compatibility but fixes all old errors and updates old solutions...

this won't help much.


Just my crazy ideas Wink
View user's profile Visit poster's website
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: Sep 18, 2006 - 04:53 AM Reply with quote Back to top

MDPro 1.1 will probably break some backward compatibility and I'd like to see better database abstraction, but we're still concentrating our limited resources on MDLite currently.

If you want to contribute something more than just a few words contact TiMax, it's easy to say what needs to be done, it's a lot harder to actually do it!

_________________
Retired from official MAXdev duties
View user's profile
Riklaunim
MD user level 5
MD user level 5


Joined: Dec 01, 2003
Posts: 130
Location: Poland
bannato
Post  Posted: Sep 18, 2006 - 07:34 AM Reply with quote Back to top

I don't use MD-Pro currently but I can test/benchmark it (xdebug, httperf) and help with some issues Wink
View user's profile Visit poster's website
PeteBest
MD user level 5
MD user level 5


Joined: Oct 06, 2003
Posts: 4845

bannato
Post  Posted: Sep 18, 2006 - 07:35 AM Reply with quote Back to top

We're more than capable of doing simple little things like that ourselves. Thanks.

_________________
Retired from official MAXdev duties
View user's profile
Wiseman
MD user level 5
MD user level 5


Joined: Mar 15, 2005
Posts: 103
Location: Spain
bannato
Post  Posted: Sep 26, 2006 - 09:05 PM Reply with quote Back to top

I don't think PDO would be better. In terms of performance, most likely not. And it would require a complete rewrite of all database code. This doesn't seem like a good idea, better work on what really could be improved (as in, new features, or functional overhauls).


ADOdb Lite would be a good improvement though. It's a subset of the 10% ADOdb features you use 99% of the time, and loads several times faster (plus it's modular). It would require little fixes to get it working, in fact we're counting on it if we ever need more perfromance.


It would be impossible to turn MDPro into an MVC framework without completely trashing everything and starting over. If you want an MVC framework, try CakePHP (or see if you like Ruby and try Ruby on Rails). BTW, if you're concerned about performance, MVC frameworks are an order of magnitude slower. I've played a bit with CakePHP and it was pretty nice, well documented, and polished. MVC frameworks are great for small to medium websites, but the problem with the model is it won't easily fit large database applications. I would like to see how you create a complex SELECT joining several tables, combining OUTER and INNER JOINs, using subselects, grouping by, using HAVING, then getting the results of database functions such as MySQL's GROUP_CONCAT with data objects, let alone a full MVC model.


As for templates, I've got the fastest, most powerful PHP template system ever! It's called PHP. Here's the full source code:

Code:
function RunTemplate($__name__, $__dict__) {
   extract($__dict__);
   include 'modules/' . $GLOBALS['module'] . '/templates/' . $__name__ . '.php';
}


Templates are like:

Code:
Hello, <?=$person?>!


You can call about a thousand functions, and it's Turing-complete. (I hope you'll realize you don't need a huge template system implementing everything PHP already does.)


Finally, regarding AJAX, I can say the same: can't be easily done, although we've got a fix for that; in fact my latest custom MDPro supports AJAX (inline module calls). We're considering to release the soruce code; the modification to support module inlining (which can be used either from the server's side or from the client's side) is actually pretty simple.


I've tried a few AJAX frameworks, and there are several good options, but the more eye-candy they get, the less actually useful. At this stage in development, you're better using a lower-level framework that will abstract AJAX calls like RPCs or something similar, then do the job yourself. (P.S.: It doesn't have to look like Windows to be AJAX or to be good.) In this sense I recommend Prototype, the JavaScript library used in several other frameworks. It works perfectly with MDPro and provides JavaScript with AJAX calls, more browser independence, missing DOM features, missing language features, functional programming tools, and a class model. Be careful with doing too much on the client's side though, Internet Explorer's JavaScript bites.


(BTW, regarding Python 3000, I'm all for it as long as Guido doesn't mess with lambda, or even better, makes def an rvalue.)
View user's profile Visit poster's website
TiMax
Project Manager
Project Manager


Joined: July 31, 2003
Posts: 1560
Location: Quebec - Canada

Post  Posted: Sep 27, 2006 - 04:15 AM Reply with quote Back to top

Wiseman we plain to include also Ajax in next versions after MDLite, if you want to collaborate or to share your code please contact us.

_________________
TiMaxMAX s.o.s.Fantasia e dinamicità Italiane, qualità e servizi Canadesi Web Services, hosting ed housing professionali
View user's profile Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Riklaunim
MD user level 5
MD user level 5


Joined: Dec 01, 2003
Posts: 130
Location: Poland
bannato
Post  Posted: Sep 27, 2006 - 06:08 AM Reply with quote Back to top

Wiseman wrote:
I don't think PDO would be better. In terms of performance, most likely not.

PDO is binary, adodb is a lot of PHP code Smile C is faster than interpreted language.

Wiseman wrote:
MVC frameworks are an order of magnitude slower

I use from time to time Code Igniter and it isn't slower than php-fusion or punBB. For most work I use Django and Pylons and with them there is no performance problem Wink On the other hand you don't code in Prado or Symfony to host your super shop app on a low end free PHP hosting Wink

Wiseman wrote:
I would like to see how you create a complex SELECT joining several tables....

It needs a real ORM, which PHP doesn't realy have. propel is XML which I don't like. In python I use SQLAlchemy and Django ORM and my wiki and forum apps doesn't use raw SQL at all. PHP needs some time to get such tools (or bindings to object databases).
punBB works on SQLite, MySQL and Postgres. Where it needs it has a swith and 3 queries for each DB. Google-like simple solution.

As for ajax... popular lightbox widget uses prototype + scriptaculous and all JS files of that widget are 100KB in size Smile a lot of bandwith needed (gziped or not) My favorite is mochikit which is more modular and by many rated as much better than prototype/scriptaculous. And there are some nice mochikit based projects like http://www.liquidx.net/plotkit/ - SVG charts

Wiseman wrote:

(BTW, regarding Python 3000, I'm all for it as long as Guido doesn't mess with lambda, or even better, makes def an rvalue.)

Lambda stays.

#####################

As for MD-Pro... it would be nice if there was a pluggable tag system that would work in news/articles. For example
Code:
[md:code lang="php"]
highlight php code
[/md:code]

tags that could wrap some JS/PHP scripts, insert some data (list of latest news, link to a page by given ID etc.) I've made a parser for such tags some time ago and I can help add it to MD-Pro.

here is my parser (2 class methods) which search text for tags, splits all tags into coresponding arrays and data from those tags to subarrays (a plugin gets an array ready for foreach-ing)
Code:
private function parse_content_bbcode($text)
      {
      $cbc_data = array();
      preg_match_all('#\[rk_([a-z_0-9]*) (.*?)\](.*?)\[/rk_(\\1)\]#es', $text, $array1);
      preg_match_all('#\[rk:([a-z_0-9]*) (.*?)\]#es', $text, $array2);
      IF(is_array($array1) and count($array1[1]) > 0)
         {
         foreach($array1[1] as $key => $val)
            {
            IF(!is_array($cbc_data[$val]))
               {
               $cbc_data[$val] = array();
               }
            array_push($cbc_data[$val], array('atrib' => diamanda::parse_atribute($array1[2][$key]), 'content' => $array1[3][$key], 'all' => $array1[0][$key]));
            }
         }
      unset($array1);
      IF(is_array($array2) and count($array2[1]) > 0)
         {
         foreach($array2[1] as $key => $val)
            {
            IF(!is_array($cbc_data[$val]))
               {
               $cbc_data[$val] = array();
               }
            array_push($cbc_data[$val], array('atrib' => diamanda::parse_atribute($array2[2][$key]), 'all' => $array2[0][$key]));
            }
         }
      unset($array2);
      $klucze = array_keys($cbc_data);
      $klucze = implode('\' OR cbc_key=\'', $klucze);
      $klucze = 'cbc_key=\''.$klucze.'\'';
      $query = $this->db->query_select("SELECT cbc_code FROM ".SITE_KEY."_diamanda_cbc WHERE ".$klucze);
      unset($klucze);
      IF(is_array($query))
         {
         foreach($query as $res)
            {
            eval(stripslashes(base64_decode($res['cbc_code'])));
            //unset($res['cbc_code']);
            }
         }
      unset($query);
      unset($cbc_data);
      return $text;
      }
   /**
   * metoda używana przez parse_content_bbcode
   */
   private function parse_atribute($line)
      {
      $line = explode('" ', $line);
      foreach($line as $key => $foo)
         {
         $foo = str_replace('"', '', $foo);
         $foo = explode('=', $foo);
         $ret[$foo[0]] = $foo[1];
         }
      unset($line);
      unset($foo);
      return $ret;
      }
   }

a simple plugin:
Code:
foreach($cbc_data['graf'] as $val)
   {
   IF(!is_file('data/images/'.SITE_KEY.'/'.md5($val['content']).'.png'))
      {
      IF(!isset($val['atrib']['name'])) { $val['atrib']['name'] = 'Wykres'; }
      $entries = explode("\n", $val['content']);
      IF(is_array($entries))
         {
         foreach($entries as $res)
            {
            $values = explode(':', $res);
            IF(is_array($values) and strlen($values[0]) > 1)
               {
               $vals[strip_tags($values[0])] = (int)$values[1];
               }
            }
         IF(count($vals > 1))
            {
            $y = $vals;
            arsort($y);
            $y_max = array_shift($y);
            $iter = ceil($y_max/5);
            $vals = @array_map("strip_tags", $vals);
            include_once 'kernel/cbc/class.bargraph.php';
            $g = new BarGraph();
            $g->graph_areaheight = 200;
            $g->axis_step = $iter;
            $g->SetGraphPadding(45, 30, 20, 15);
            $g->SetBarData($vals);
            $g->SetGraphTitle($val['atrib']['name']);
            ob_start();
            $g->DrawGraph();
            $png = ob_get_contents();
            ob_end_clean();
            file_put_contents('data/images/'.SITE_KEY.'/'.md5($val['content']).'. png', $png);
            }
         }
      }
   $text = str_replace($val['all'], '<div align="center"><img src="data/images/'.SITE_KEY.'/'.md5($val['content']).'.png" /></div>', $text);
   unset($vals);
   unset($val);
   unset($iter);
   unset($y);
   unset($entries);
   }

which makes bar graphs from:
Code:
[rk_graf name="graph name"]
foo:60
bar:72
barfoo:13
[/rk_graf]

I use such system in my Diamanda wiki and [rk:art slug="slugname"] makes a link to a page using its title and description Smile and a lot of people likes it as they can make "categories" and pages list as they want and where they want. No complex solutions (pagesetter) needed Smile
View user's profile Visit poster's website
Wiseman
MD user level 5
MD user level 5


Joined: Mar 15, 2005
Posts: 103
Location: Spain
bannato
Post  Posted: Sep 27, 2006 - 10:32 PM Reply with quote Back to top

TiMax wrote:
Wiseman we plain to include also Ajax in next versions after MDLite, if you want to collaborate or to share your code please contact us.
Ah, ok. I'll port the AJAX code to a more standard MDPro and release it with instructions and examples, should be ready within two weeks. If I recall correctly, the system will consist of a couple of API functions (to load modules and easy generation of client-side AJAX call URLs), modifications to index.php to use it, and the JavaScript library Prototype. It's very to use.


Riklaunim wrote:
PDO is binary, adodb is a lot of PHP code Smile C is faster than interpreted language.
I doubt it'd be faster because of all the OO overhead, plus the unavoidable PHP object handling in the application.

Quote:
PHP needs some time to get such tools (or bindings to object databases).
I have yet to find a good reason to care for data objects. "It's OO" is not a good reason; object orientation is not inherently good, and in many real cases it has proven suboptimal (not only talking about efficiency, but productivity, maintainability, and simplicity). Let's-make-all-OO policies are simple minded and often end up in big, ugly messes like Java (language and API, especially the API, pure hell). Plus the relational model is nicer for functional programming. And don't forget PHP's object model is a toy (even in version 5, where they took the very bad decision of trying to imitate Java's toy model instead of Python); relying too much on OO in a language whose strength is not precisely OO is not a good idea. On top of that, none of the major, serious, proven databases has any good support for it that I know of.
View user's profile Visit poster's website
Wiseman
MD user level 5
MD user level 5


Joined: Mar 15, 2005
Posts: 103
Location: Spain
bannato
Post  Posted: Oct 30, 2006 - 09:55 PM Reply with quote Back to top

Update regarding the AJAX code: Unfortunately, I've been assigned to other stuff and have some trips in the way, but I'll go back to it and have it posted (hopefully) before the end of 2006.

Additionally, we'll publish a series of functions we've extended the API with, which some might find useful:
- A complete, proven solution for data sanity (AKA quote hell) regarding HTTP GET/POST parameters, HTML, and SQL, including a printf-esque DB-independent function to generate SQL much easier than having to quote things by hand, for a complete sanity solution that's simply unbreakable
- ISO dates handling functions
- Functional programming tools such as curry or Python-like lambdas
- Other miscellaneous utilities
View user's profile Visit poster's website
Wiseman
MD user level 5
MD user level 5


Joined: Mar 15, 2005
Posts: 103
Location: Spain
bannato
Post  Posted: Dec 14, 2006 - 03:53 AM Reply with quote Back to top

I've released the code to support AJAX calls, complete with examples and documentation, as well as many other utility functions in this thread: http://www.maxdev.com/index.php?name=MD ... mp;p=34934
View user's profile Visit poster's website
Display posts from previous:     
Jump to:  
All times are GMT + 13 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by MDForum 2.0.8© 2003-2007 MAXdev Team
Credits