INSERT INTO sites(host) VALUES('cakephp.nu') 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) cakephp.nu 网站价值¥285,381(不含域名),MYIP.CN网站综合数据统计 - 域名,Alexa,PR,反向链接,关键字
  测网速 网站优化诊断 广告招商QQ3066631932 CodeForge最好的源码站!   手机测速 测速APP

  
                       

网站页面信息

标题:
描述:
关键字:
sponsored links:
连接:
图片:
网站历史:
sponsored links:

网站流量与估价

网站流量:
网站估价:  (注:不包含域名价值,不代表公司价值)

网站排名

Alexa全球排名:
Google Page Rank:
真假PR鉴别:   (提示:若此处显示网站与查询网站不同,则疑为劫持PR)
Sogou Rank:
百度快照日期:

搜索引擎收录

搜索引擎收录情况反向链接
 谷歌Google:
 百度Baidu:
 微软Bing:
 搜搜Soso:
 雅虎Yahoo:
 有道Youdao:
 搜狗Sogou:

服务器信息

Web服务器:
IP地址:    
IP所在地:

域名注册信息

注册人:
Email:
ICANN注册机构:
创建时间:
修改时间:
过期时间:
状态:
Name Server:
Whois Server:

Alexa 排名走势数据

流量统计: 当日 一周平均 三个月平均
排名:
PV:
日独立IP:

网站在各国/地区的排名

国家/地区访问比例

下属子站点被访问比例

Alexa 排名走势图

Alexa Reach走势图

域名 Whois 记录

Who is cakephp.nu at whois.nic.nu

------------------------------------------------------------------------

.NU Domain Ltd Whois service



Domain Name (ASCII): cakephp.nu



Technical Contact:


Christian Winther jippignu

Bonitet

Kongshaven 94, 2th

Valby

DK

Phone:
+45 20 61 11 71 (voice)



Record last updated on 27-Dec-2009.

Record expires on 25-Dec-2011.

Record created on 25-Dec-2006.

Record status: Active

Registrar of record: .NU Domain Ltd

Referral URL: http://www.nunames.nu



Domain servers in listed order:


ns1.quickdns.dk

ns2.quickdns.dk

ns3.quickdns.dk



Owner and Administrative Contact information for domains

registered in .nu is available upon request from support@nic.nu



Copyright by .NU Domain Ltd - http://www.nunames.nu

------------------------------------------------------------------------

Database last updated:
2010-Apr-09 19:55:55 GMT

------------------------------------------------------------------------

网站缩略图

sponsored links:

网站访问速度测试

国内Ping速度测试      国内TraceRoute路由测试
美国Ping速度测试      美国TraceRoute路由测试

网站关键字指数 (越高越热门)

域名 cakephp 其他后缀注册情况   查看更多

后缀 注册时间 到期时间 是否注册
.com
.net
.org
.cn
.com.cn
.asia
.mobi

同类相似网站

查看更多
Alexa标题
0Planet CakePHP | CakePHP-Related Articles, Blog Posts & News
1,214,886Cakephp.nu web blog
0code.cakephp.org/CakePHP/Wiki/1.3/migration-guide
1,060,832CakePHP Вас приветствует CakePHP!
145,078Hackthenet-Blog | Privates Weblog von Christian Vogt z
13,329,037Welcome to BlogSoundoff.com! where everyone gets to be a blogger parti
45,352Blog avec Tchatche Blog : blog gratuit, annuaire de blog, deco blog, j
44,548Blog avec Tchatche Blog : blog gratuit, annuaire de blog, deco blog, j
0Dashboard - cakephp
992,359Shakuro - CakePHP web development
4,455,387YLCZ'Blog --- Builded on CakePHP
0Articles | The Bakery, Everything CakePHP
0Articles | The Bakery, Everything CakePHP
91,749CakePHP: 高速開発 php フレームワーク。 Home
799,623RiceCake CMS: A simple CakePHP based CMS
0Akismet API Component for CakePHP 1.2 - Seth Cardoza
6,553CakePHP: the rapid development php framework. Home
0CakePHP: the rapid development php framework. Home
5,017,219Cake Development Corporation, the CakePHP Framework Experts
0Croogo - A CakePHP powered Content Management System
267,259Cake Development Corporation, the CakePHP Framework Experts
0DataSources :: Developing with CakePHP :: The Manual :: 1.2 Collecti
0Valid Cake - The Easiest Validation Generator for CakePHP Models
0CakePHP UnOfficial Community Forum (Powered by Invision Power Board)
778,127CakePHP CodeIgniter ZendFramework PHP Programmierung Dresden ~ Program
0Tutorial Blog - Belajar Blog, Menghias Blog, Hasilkan Uang Dari Blog
522,803michael kamleitner - web-consultant & -developer - PHP, CakePHP, T
23,771,269Free bus _ blog blog blog register your own personal Blog site space
50,229Blog gratuit - Créer un blog perso, blog photo ou blog vidéo
0Health-Blog.com |

模拟搜索引擎蜘蛛抓取

Title:Cakephp.nu web blog
Description:cakephp related blog
Keywords:cakephp, php, mysql, postgresql
Body:
Cakephp.nu web blog
Cakephp.nu blog
Cake and cookies by Jippi
Home
My CakePHP projects
About
Poll archive
Generic non-www to www (and vice versa) 301 redirect using .htaccess
November 3, 2008 #8211; 4:33 pm
The problem:
I #8217;ve always hardcoded the domain name in my htaccess #8217;es, requiring me to make changes each time I deploy a new website.
The solution:
Behold, an alternate, generic method of redirecting non-www to www and www to non-www, requiring no changes between deployments!
Non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]
Bonus tip: Remove trailing slash from address line
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
Tags: 301, generic, htaccess, redirect
Posted in Cakephp, Uncategorized | 7 Comments #187;
Yay #8211; my dell new server is now online :D
July 16, 2008 #8211; 11:15 pm
Finally I got the good news from my new hosting company
I can hardly wait to get it FreeBSD 7.0 installed on it and setup a nice vhost system with Lighttpd + PostgreSQL. It #8217;s gonna be awsome.
The server I #8217;m currently using is #8216;only #8217; Dual core XEON w/ 3.5Gb ram, and some random SATA drives, so the improvement should be huge
I #8217;m quite excited, because its going to be my first server ever without Apache and MySQL installed. Or well, atleast until some stupid customer or what not (Biesbjerg?) demands it
If I can find the time, I will write a guide on how I #8217;m going to configure my server (Lighttpd, PostgreSQL, Dovecot + sendmail, quota, fast-cgi php5), it might be useful for someone
Let me know if it has any interest to you guys
Specs
- Dell PE 1950 III
- PE1950 PCIE Riser (2 Slots) 1 S
- Quad Core Xeon E5410 (2.33GHz, 2 #215;6MB, 1333MHz FSB) (SMP supported)
- 4GB (2 #215;2GB Dual Rank DIMMs) 667MHz FBD (up to 32 GB)
- 3x 146GB SAS 10k 2.5 #8243; HDPE1950 III 2.5 #8243; HDD support chassis
- Perc 6i Integrated Controller
- 8X DVD-ROM Drive IDE
- PE1950 III Non-Redundant Power Supply No Power Cord
- TCP/IP Offload Engine 2P
- Broadcom TCP/IP Offload Engine functionality (TOE) Not Enabled
- PE1950 OpenManage kit and FI Driver
- CFI EMEA Service. (SV-Hi) OR PowerEdge, RAID/partition
- RAID 1 Single Container
- RAID 0 (1 HDD)
- Rack Rails Static Rapid 1 S
- PE1950 III #8211; C2,MSSR0,ADD IN PERC5i/6i/SAS6iR, min 2 / max 2 or 4
/Jippi
Tags: dell, dovecot, english, lighttpd, news
Posted in Random, news | 1 Comment #187;
open_basedir will slow you down #8211; security vs. speed
March 21, 2008 #8211; 2:48 am
Just a quickie.
I’m working on some security enhancements for my new website project, and in that progress, I have moved away from Apache2.2.3 and now using Lighttpd instead. Lighttpd does not use the same method of invoking php as apache does (mod_php vs. fast-cgi php).
In my eager to make the application as secure and locked down as possible, I went berserk in the php-cgi.ini file and turned on just about any security feature I could find (not safemode!), including the innocent looking switch called “open_basedir”.
That was rather late in the night, so when I resumed my work the following day, I have long forgotten about all the fancy security settings I had enabled in php.
A few hours ago I noticed that the complete render time for the front page suddenly was ~2seconds(!) #8211; and comparing with apache’s load time for the same page (0.9s) I was quite disappointed at lighttpd and fastcgi, but refused to give up my new found love without a fair trial.
I attacked google with full force without finding any useful resources that might be able to explain my issue.. I was quite sure it was APC that did not function well in a fastcgi environment #8211; and therefore my google madness was focused around the keywords “apc + fastcgi”
While chatting to PatrickDK in the #lighttpd channel @ freenode, it suddenly hit me #8211; let’s try to disable everything I have “fixed” last night #8211; starting with XDebug, some 3rd party php modules (syck, memcache, simplexml, fileinfo) #8211; and then, open_basedir flag.
And with just one line commented out in my php-cgi.ini file, the render time went from 2.4 to 0.5 seconds !!(!!)
So just a little note to you guys out there, beware of the open_basedir setting in a setup where you include many files, it is a rather costly feature to use. And when running fastcgi php in chroot()ed setup, its not really required anyway
Its another +1 for lighty and fastcgi
And yes, I’m aware that open_basedir is slow because it has to validate EVERY file or path you work with inside php to check if its within the scope defined.
Tags: english, lighttpd, php
Posted in Random, lighttpd | 7 Comments #187;
New books from amazon.co.uk
March 19, 2008 #8211; 10:20 pm
Just got an email from Amazon.co.uk #8211; the have shipped my new batch of dev-books
This time around it was more an impulze to buy some books, so I hope I will end up as satisfied as last time I purchased some books from them.
Building Scalable Web Sites: Building, scaling, and optimizing the next generation of web applications
RESTful Web Services
High Performance Web Sites: Essential Knowledge for Front-End Engineers: Essential Knowledge for Front-end Engineers
PostgreSQL (Developers Library)
The CSS Anthology: 101 Essential Tips, Tricks and Hacks
I will probably give a short review of the books once I have read them
Tags: amazon, books, css, english, php, postgresql
Posted in Random | No Comments #187;
Faster Page Loads #8211; Bundle Your CSS and Javascript with lighttpd
March 18, 2008 #8211; 4:23 pm
Hello again,
Preface
This time I have been busy playing with Lighttpd and mod_magnet. I found a blog post where darix mentions a post from sitepoint where they demostrate a technique to speed up the HTTP GET of javascript and CSS files.
Its quite simple really, instead of doing
amp;lt;link href= quot;/css/styles1.css quot; rel= quot;stylesheet quot; type= quot;text/css quot; / amp;gt;
amp;lt;link href= quot;/css/styles2.css quot; rel= quot;stylesheet quot; type= quot;text/css quot; / amp;gt;
amp;lt;link href= quot;/css/styles3.css quot; rel= quot;stylesheet quot; type= quot;text/css quot; / amp;gt;
you simply do
amp;lt;link href= quot;/css/styles1.css,styles2.css,styles3.css quot; rel= quot;stylesheet quot; type= quot;text/css quot; / amp;gt;
and then this script will automagic concat them together into one big file, and make lighty serve that one instead. (The same goes for javascript files, or anything really)
This could save ALOT of HTTP GET #8217;s to your server, and increase the overall loadtime and performance of your site alot, especially if you use alot of Web2.0 stuff
However, the Lua source for their script was not made public, so nobody could benifit from their otherwise impressive speed gains.
Until now.. or, well, almost #8211; its not their script, but my own attempt to mimic what they did in pure Lua
I tried to keep the dependencies down to a minimum, however I decided to use one, md5.
You can find the source here (5.1, 5.0)
Config
charset (Line 42)
Set it so it matches the headers in your lighttpd.conf file. Must match your mod_compress settings aswell to utilize that feature
prefix (Line 43)
Could be anything really, its just a mean to #8220;namespace #8221; your cached files so you can run the script with multiple configs
rootPath (Line 44)
The path to look for the files to concat, default should be fine for most DOC_ROOT/js and DOC_ROOT/css
concatRoot (Line 45)
The folder to store the concated files, can be anywhere
Setup
Put the source below somewhere on your disk, I asume you name it bundle.lua
Enable mod_magnet in lighttpd.conf
Add magnet.attract-physical-path-to = ( #8220;YOUR_PATH/bundle.lua #8221; ) to your config where needed
Restart lighttpd
Modify your css/js links to utilize the new feature:)
Optimal you can enable mod_compress aswell, bundle.lua works out of the box with any other lighttpd module you may have
Source
download source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
span style="color: #808080; font-style: italic;"--- get stat information on a pathspan
span style="color: #808080; font-style: italic;"-- @param path to statspan
span style="color: #808080; font-style: italic;"-- @param the ftype to returnspan
span style="color: #808080; font-style: italic;"-- @return false if ftype or path does not existspan
span style="color: #b1b100;"functionspan file_infospan style="color: #66cc66;" #40;spanpath, ftypespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"localspan attr span style="color: #66cc66;"=span lighty.statspan style="color: #66cc66;" #40;spanpathspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"ifspan attr span style="color: #b1b100;"andspan attrspan style="color: #66cc66;" #91;spanftypespan style="color: #66cc66;" #93;span span style="color: #b1b100;"thenspan
span style="color: #b1b100;"returnspan attrspan style="color: #66cc66;" #91;spanftypespan style="color: #66cc66;" #93;span
span style="color: #b1b100;"endspan
span style="color: #b1b100;"returnspan span style="color: #b1b100;"falsespan
span style="color: #b1b100;"endspan
span style="color: #808080; font-style: italic;"--- Wrapper for reading a full file into a stringspan
span style="color: #808080; font-style: italic;"-- @param filename Full path to the filespan
span style="color: #808080; font-style: italic;"-- @return a string with the content of the filespan
span style="color: #b1b100;"functionspan read_filespan style="color: #66cc66;" #40;spanfilenamespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"localspan content span style="color: #66cc66;"=span span style="color: #ff0000;" quot; quot;span
span style="color: #b1b100;"ifspan file_infospan style="color: #66cc66;" #40;spanfilename, span style="color: #ff0000;" quot;is_file quot;spanspan style="color: #66cc66;" #41;span span style="color: #b1b100;"thenspan
span style="color: #b1b100;"localspan file span style="color: #66cc66;"=span span style="color: #b1b100;"io.openspanspan style="color: #66cc66;" #40;spanfilename, span style="color: #ff0000;" quot;r quot;spanspan style="color: #66cc66;" #41;span
content span style="color: #66cc66;"=span file:span style="color: #b1b100;"readspanspan style="color: #66cc66;" #40;spanspan style="color: #ff0000;" quot;*a quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"io.closespanspan style="color: #66cc66;" #40;spanfilespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
span style="color: #b1b100;"returnspan content
span style="color: #b1b100;"endspan
span style="color: #808080; font-style: italic;"--- Wrapper for writeing content to a filespan
span style="color: #808080; font-style: italic;"-- @param filename Full path to the destionation filespan
span style="color: #808080; font-style: italic;"-- @param content The string to writespan
span style="color: #b1b100;"functionspan write_cachespan style="color: #66cc66;" #40;spanfilename, contentspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"localspan file span style="color: #66cc66;"=span span style="color: #b1b100;"io.openspanspan style="color: #66cc66;" #40;spanfilename, span style="color: #ff0000;" quot;w quot;spanspan style="color: #66cc66;" #41;span
file:span style="color: #b1b100;"writespanspan style="color: #66cc66;" #40;spancontentspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"io.closespanspan style="color: #66cc66;" #40;spanfilespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
span style="color: #808080; font-style: italic;"--- Concat multiple files into one file span
span style="color: #808080; font-style: italic;"-- @param lighty lighty global variable passed to the methodspan
span style="color: #808080; font-style: italic;"-- @param match The files that will be concat into a filespan
span style="color: #808080; font-style: italic;"-- @param fileExtension Do !NOT! include the dot ( . )span
span style="color: #b1b100;"functionspan combine_filesspan style="color: #66cc66;" #40;spanlighty, files, fileExtensionspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"requirespan span style="color: #ff0000;" quot;md5 quot;span
span style="color: #b1b100;"localspan charset span style="color: #66cc66;"=span span style="color: #ff0000;" quot;; charset=utf-8 quot;span
span style="color: #b1b100;"localspan prefix span style="color: #66cc66;"=span span style="color: #ff0000;" quot;cache- quot;span
span style="color: #b1b100;"localspan rootPath span style="color: #66cc66;"=span lighty.envspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;physical.doc-root quot;spanspan style="color: #66cc66;" #93;span .. fileExtension .. span style="color: #ff0000;" quot;/ quot;span
span style="color: #b1b100;"localspan concatRoot span style="color: #66cc66;"=span span style="color: #ff0000;" quot;/tmp/cache/ quot;span
span style="color: #b1b100;"localspan lastModified span style="color: #66cc66;"=span span style="color: #cc66cc;"0span
span style="color: #b1b100;"forspan file span style="color: #b1b100;"inspan span style="color: #b1b100;"stringspan.gmatchspan style="color: #66cc66;" #40;spanfiles, span style="color: #ff0000;" quot;(.-span style="color: #000099; font-weight: bold;"\.span quot;span .. fileExtension .. span style="color: #ff0000;" quot;),? quot;spanspan style="color: #66cc66;" #41;span span style="color: #b1b100;"dospan
span style="color: #b1b100;"localspan fullPath span style="color: #66cc66;"=span rootPath .. file
modTime span style="color: #66cc66;"=span file_infospan style="color: #66cc66;" #40;spanfullPath, span style="color: #ff0000;" quot;st_mtime quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"ifspan span style="color: #b1b100;"typespanspan style="color: #66cc66;" #40;spanmodTimespan style="color: #66cc66;" #41;span span style="color: #66cc66;"==span span style="color: #ff0000;" quot;number quot;span span style="color: #b1b100;"thenspan
lastModified span style="color: #66cc66;"=span span style="color: #b1b100;"math.maxspanspan style="color: #66cc66;" #40;spanlastModified, modTimespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
span style="color: #b1b100;"endspan
span style="color: #b1b100;"localspan hash span style="color: #66cc66;"=span lastModified .. span style="color: #ff0000;" quot;- quot;span .. md5.sumhexaspan style="color: #66cc66;" #40;spanfilesspan style="color: #66cc66;" #41;span
lighty.headerspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;Etag quot;spanspan style="color: #66cc66;" #93;span span style="color: #66cc66;"=span span style="color: #ff0000;"' quot;'span .. hash ..span style="color: #ff0000;"' quot;'span
span style="color: #b1b100;"localspan cacheFile span style="color: #66cc66;"=span prefix .. hash .. span style="color: #ff0000;"'.'span .. fileExtension
span style="color: #b1b100;"ifspan span style="color: #b1b100;"notspan file_infospan style="color: #66cc66;" #40;spanconcatRoot .. cacheFile, span style="color: #ff0000;" quot;is_file quot;spanspan style="color: #66cc66;" #41;span span style="color: #b1b100;"thenspan
span style="color: #b1b100;"localspan content span style="color: #66cc66;"=span span style="color: #ff0000;" quot; quot;span
span style="color: #b1b100;"forspan file span style="color: #b1b100;"inspan span style="color: #b1b100;"stringspan.gmatchspan style="color: #66cc66;" #40;spanmatch, span style="color: #ff0000;" quot;(.-span style="color: #000099; font-weight: bold;"\.span quot;span .. fileExtension .. span style="color: #ff0000;" quot;),? quot;spanspan style="color: #66cc66;" #41;span span style="color: #b1b100;"dospan
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot;span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot;/**span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot; *span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot; * quot;span .. file .. span style="color: #ff0000;" quot;span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot; *span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot; */span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. span style="color: #ff0000;" quot;span style="color: #000099; font-weight: bold;"\nspan quot;span
content span style="color: #66cc66;"=span content .. read_filespan style="color: #66cc66;" #40;spanrootPath .. filespan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
write_cachespan style="color: #66cc66;" #40;spanconcatRoot .. cacheFile, content span style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
lighty.envspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;physical.path quot;spanspan style="color: #66cc66;" #93;span span style="color: #66cc66;"=span concatRoot .. cacheFile
span style="color: #b1b100;"endspan
span style="color: #b1b100;"ifspan span style="color: #66cc66;" #40;spanspan style="color: #b1b100;"notspan file_infospan style="color: #66cc66;" #40;spanlighty.envspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;physical.path quot;spanspan style="color: #66cc66;" #93;span, span style="color: #ff0000;" quot;is_file quot;spanspan style="color: #66cc66;" #41;spanspan style="color: #66cc66;" #41;span span style="color: #b1b100;"thenspan
css span style="color: #66cc66;"=span span style="color: #b1b100;"stringspan.matchspan style="color: #66cc66;" #40;spanlighty.envspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;physical.path quot;spanspan style="color: #66cc66;" #93;span, span style="color: #ff0000;" quot;css/(.*span style="color: #000099; font-weight: bold;"\.spancss) quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"ifspan css span style="color: #b1b100;"thenspan
span style="color: #b1b100;"returnspan combine_filesspan style="color: #66cc66;" #40;spanlighty, css, span style="color: #ff0000;" quot;css quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
js span style="color: #66cc66;"=span span style="color: #b1b100;"stringspan.matchspan style="color: #66cc66;" #40;spanlighty.envspan style="color: #66cc66;" #91;spanspan style="color: #ff0000;" quot;physical.path quot;spanspan style="color: #66cc66;" #93;span, span style="color: #ff0000;" quot;js/(.*span style="color: #000099; font-weight: bold;"\.spanjs) quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"ifspan js span style="color: #b1b100;"thenspan
span style="color: #b1b100;"returnspan combine_filesspan style="color: #66cc66;" #40;spanlighty, js, span style="color: #ff0000;" quot;js quot;spanspan style="color: #66cc66;" #41;span
span style="color: #b1b100;"endspan
span style="color: #b1b100;"endspan
Tags: english, lighttpd, lua, mod_magnet
Posted in lighttpd, lua | 10 Comments #187;
A quick tutorial on CakePHP Set class (Part 1)
March 4, 2008 #8211; 12:56 am
Test data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
span style="color: #000088;"$dataspan span style="color: #339933;"=span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #cc66cc;"1span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Post'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span span style="color: #0000ff;"'post_comment_count'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My first title'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My first body'span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #0000ff;"'PostComment'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span span style="color: #0000ff;"'post_id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span span style="color: #0000ff;"'is_active'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My first comment'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My first comment'spanspan style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span span style="color: #0000ff;"'post_id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span span style="color: #0000ff;"'is_active'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My second comment'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My second comment'spanspan style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"3spanspan style="color: #339933;",span span style="color: #0000ff;"'post_id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span span style="color: #0000ff;"'is_active'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third comment'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third comment'spanspan style="color: #009900;" #41;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #cc66cc;"2span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Post'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span span style="color: #0000ff;"'post_comment_count'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My second title'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My second title'span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #0000ff;"'PostComment'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"4spanspan style="color: #339933;",span span style="color: #0000ff;"'post_id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"2spanspan style="color: #339933;",span span style="color: #0000ff;"'is_active'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span
span style="color: #cc66cc;"1spanspan style="color: #339933;",span span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fourth comment'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fourth comment'span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #cc66cc;"3span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Post'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"3spanspan style="color: #339933;",span span style="color: #0000ff;"'post_comment_count'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"0spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third title'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third title'span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #0000ff;"'PostComment'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #000088;"$dataExtraspan span style="color: #339933;"=span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #cc66cc;"4span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Post'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"4spanspan style="color: #339933;",span span style="color: #0000ff;"'post_comment_count'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fourth title'spanspan style="color: #339933;",span span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fourth title'span
span style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #0000ff;"'PostComment'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"5spanspan style="color: #339933;",span span style="color: #0000ff;"'post_id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"4spanspan style="color: #339933;",span span style="color: #0000ff;"'is_active'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"1spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fifth comment'spanspan style="color: #339933;",span span style="color: #0000ff;"'bdoy'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My fifth comment'span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;spanspan style="color: #339933;";span
Set::merge
PHP doc blcok
This function can be thought of as a hybrid between PHP's array_merge and
array_merge_recursive. The difference to the two is that if an array key
contains another array then the function behaves recursive (unlike array_merge)
but does not do if for keys containing strings (unlike array_merge_recursive).
See the unit test for more information.
Note: This function will work with an unlimited amount of arguments and
typecasts non-array parameters into arrays.
A bit like array_merge_recursive. Merge joins two arrays on their keys.
If we want to add the $extraData array into the $dat most people would probably think, hey, lets merge them using Set::merge #8230; but.. no, dont, unless you know what your doing.
1
prspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"mergespanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #339933;",span span style="color: #000088;"$dataExtraspanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
The above cod will only produce the #8216;expected #8217;(?) result because I have added the numeric key 4 in the $extraData array (Line 40). If I had, as I did the first time around, just let php auto-increment the keys for me, both $datad and $extraData would contain the numeric index key 0, and since Set::merge works on keys, $extraData #8217;s Fourth post would overwrite $data #8217;s First post where they had anything in common (id, name, post_comment_count, body and everything in the first PostComment (My first comment)).
In case I had let php handle the index keys, I would have to use Set::insert to append the fourth comment to the list.
A better use of Set::merge is in CAKE/libs/model/model.php where is automagic merges #8216;actsAs #8217; from your current model (PostComment) and your AppModel, so you automagic inherit the global behaviors from AppModel:
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
span style="color: #666666; font-style: italic;"// model.php span
span style="color: #b1b100;"ifspan span style="color: #009900;" #40;spanspan style="color: #990000;"is_subclass_ofspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$thisspanspan style="color: #339933;",span span style="color: #0000ff;"'AppModel'spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;span span style="color: #009900;" #123;span
span style="color: #000088;"$appVarsspan span style="color: #339933;"=span span style="color: #990000;"get_class_varsspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'AppModel'spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #000088;"$mergespan span style="color: #339933;"=span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #b1b100;"ifspan span style="color: #009900;" #40;spanspan style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanactsAs span style="color: #339933;"!==span span style="color: #009900; font-weight: bold;"nullspan span style="color: #339933;"||span span style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanactsAs span style="color: #339933;"!==span span style="color: #009900; font-weight: bold;"falsespanspan style="color: #009900;" #41;span span style="color: #009900;" #123;span
span style="color: #000088;"$mergespanspan style="color: #009900;" #91;spanspan style="color: #009900;" #93;span span style="color: #339933;"=span span style="color: #0000ff;"'actsAs'spanspan style="color: #339933;";span
span style="color: #009900;" #125;span
span style="color: #b1b100;"foreachspan span style="color: #009900;" #40;spanspan style="color: #000088;"$mergespan span style="color: #b1b100;"asspan span style="color: #000088;"$varspanspan style="color: #009900;" #41;span span style="color: #009900;" #123;span
span style="color: #b1b100;"ifspan span style="color: #009900;" #40;spanspan style="color: #990000;"issetspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$appVarsspanspan style="color: #009900;" #91;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #93;spanspan style="color: #009900;" #41;span span style="color: #339933;" amp;spanampspan style="color: #339933;"; amp;spanampspan style="color: #339933;";span span style="color: #339933;"!spanspan style="color: #990000;"emptyspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$appVarsspanspan style="color: #009900;" #91;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #93;spanspan style="color: #009900;" #41;span span style="color: #339933;" amp;spanampspan style="color: #339933;"; amp;spanampspan style="color: #339933;";span span style="color: #990000;"is_arrayspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanspan style="color: #009900;" #123;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #125;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;span span style="color: #009900;" #123;span
span style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanspan style="color: #009900;" #123;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #125;span span style="color: #339933;"=span Setspan style="color: #339933;"::spanspan style="color: #004000;"mergespanspan style="color: #009900;" #40;spanspan style="color: #000088;"$appVarsspanspan style="color: #009900;" #91;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #93;spanspan style="color: #339933;",span span style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanspan style="color: #009900;" #123;spanspan style="color: #000088;"$varspanspan style="color: #009900;" #125;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #009900;" #125;span
span style="color: #009900;" #125;span
span style="color: #009900;" #125;span
A funny thing is that Set::merge is still rarely used in the core code yet. Probably because array_merge (or am()) is faster for simple operations like just merging two simple 1 level arrays like a config array.
Set::filter
PHP doc blcok
Filters empty elements out of a route array, excluding '0'.
This method is not recursive. So doing
1
2
span style="color: #339933;" amp;spanltspan style="color: #339933;";span ?php
prspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"filterspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #339933;",span span style="color: #009900; font-weight: bold;"truespanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
wont change anything in the array sinc no elements in first level is empty.
1
2
3
4
5
6
7
8
9
prspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"filterspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"3spanspan style="color: #009900;" #93;spanspan style="color: #339933;",span span style="color: #009900; font-weight: bold;"truespanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Post'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'id'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"3spanspan style="color: #339933;",span
span style="color: #0000ff;"'post_comment_count'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #cc66cc;"0spanspan style="color: #339933;",span
span style="color: #0000ff;"'name'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third title'spanspan style="color: #339933;",span
span style="color: #0000ff;"'body'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #0000ff;"'My third title'span
span style="color: #009900;" #41;span
span style="color: #009900;" #41;spanspan style="color: #339933;";span
We will notice that the PostComment array is gone, since its empty
Set::pushDiff
PHP doc blcok
Pushes the differences in $array2 onto the end of $array
That sounds simple enough, and it really is.
1
prspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"pushDiffspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #339933;",span span style="color: #000088;"$dataExtraspanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
just pushes the $dataExtra on the end of $data, since they have nothing in common. Again, this method operates on the array keys when comparing arrays.
Set::map
PHP doc block
Maps the contents of the Set object to an object hierarchy.
Maintains numeric keys as arrays of objects
That sounds very fancy, and it is! A lot of people migrating to CakePHP from Symfony (PHPDoctrine, Propel) will probably be confused at first that all model data in CakePHP is arrays, and not objects like other frameworks. This method attemps to #8216;fix #8217; this issue by converting a model data array to a set of objects (StdClass). StdClass is a build-in dummy class in PHP, and it doesnt really do anything but contain data, no methods or fancy magic there.
1
2
3
4
5
6
7
8
9
span style="color: #339933;" amp;spanltspan style="color: #339933;";span ?php
span style="color: #666666; font-style: italic;"// Convert to objects span
span style="color: #000088;"$mapspan span style="color: #339933;"=span Setspan style="color: #339933;"::spanspan style="color: #004000;"mapspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// id of first post (Object style) span
span style="color: #b1b100;"echospan span style="color: #000088;"$mapspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"0spanspan style="color: #009900;" #93;spanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanidspan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// name of first comment to first post (Object style) span
span style="color: #b1b100;"echospan span style="color: #000088;"$mapspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"0spanspan style="color: #009900;" #93;spanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanPostCommentspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"0spanspan style="color: #009900;" #93;spanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spannamespan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// name of first comment to first post (array style) span
span style="color: #b1b100;"echospan span style="color: #000088;"$mapspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"0spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #91;spanspan style="color: #0000ff;"'PostComment'spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"0spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #91;spanspan style="color: #0000ff;"'name'spanspan style="color: #009900;" #93;spanspan style="color: #339933;";span span style="color: #666666; font-style: italic;"// WONT WORK, Cannot access StdClass as an arrayspan
As you can see above, its important to decide what method you want to use, Object or Array style, since they cannot be mixed.
Also, the return from Set::map is a mix of arrays and StdClass, thats why I can access $map[0] as array, but not access $map[0]['name'].
Set::numeric
PHP doc blcok
Checks to see if all the values in the array are numeric
Not much to say on this one, because it doesnt do more or less than the name implies.
1
2
3
4
5
6
7
8
span style="color: #666666; font-style: italic;"// false span
span style="color: #990000;"var_dumpspanspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"numericspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// false span
span style="color: #990000;"var_dumpspanspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"numericspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"1spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// false span
span style="color: #990000;"var_dumpspanspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"numericspanspan style="color: #009900;" #40;spanspan style="color: #000088;"$dataspanspan style="color: #009900;" #91;spanspan style="color: #cc66cc;"1spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #91;spanspan style="color: #0000ff;"'PostComment'spanspan style="color: #009900;" #93;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #666666; font-style: italic;"// true span
span style="color: #990000;"var_dumpspanspan style="color: #009900;" #40;spanSetspan style="color: #339933;"::spanspan style="color: #004000;"numericspanspan style="color: #009900;" #40;spanspan style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #cc66cc;"1spanspan style="color: #339933;",spanspan style="color: #cc66cc;"2spanspan style="color: #339933;",spanspan style="color: #cc66cc;"3spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
#8212; #8212;-
Thats it for now, next time I will look at:
Set::enum, Set::format, Set::extract, Set::insert, Set::remove, Set::check, Set::diff, Set::isEqual, Set::contains, Set::countDim, Set::normalize, Set::combine and Set::reverse.
Look forward to it
Tags: Cakephp, english, set
Posted in Cakephp | 4 Comments #187;
A small change in RSS feeds.
March 3, 2008 #8211; 11:52 pm
Hello again.
I have made a small change to the feeds now. Everybody who has subscribed by Feedburner should not notice anything strange.
The reason for the change is that I want to be able to blog in Danish too once in a while, and to avoid the #8216;danish pølsesnak #8217; for you guys who does not understand Danish, I have moved the feed location to include only posts with the #8216;english #8217; tag in the future
English posts only (Hopefully your using this one right now ), Danish posts only and Danish+English posts
/Jippi
Tags: danish, english, news
Posted in Cakephp | No Comments #187;
Første danske post
March 3, 2008 #8211; 11:49 pm
Dettte er min første danske post
Tags: danish
Posted in Random | 1 Comment #187;
CakePHP talk from FOSDEM #8211; Free and Open Source Software Developers #8217; European Meeting
March 3, 2008 #8211; 10:43 pm
A small note, gwoo #8217;s talk from FOSDM 2008 has been made public avilable here together with his slides.
Its actually a quite good presentation, too bad he ran out of time in the end
Tags: Cakephp, english, fosdem
Posted in Cakephp | 1 Comment #187;
CakePHP Weekly Summaries Issue #2
March 3, 2008 #8211; 10:37 pm
Welcome
Welcome to the second edition of the CakePHP weekly summaries.
Its quite embarrassing that it had to take so long time to get the second editon out. Too long time has passed and the amount of things that has happend during that period is waaay too big to be covered here.
Therefor I present this half-done 2nd edition of the weekly summaries, with a promise that every week from now on I will give you the latest and greatest from the CakePHP world.
So with no further ado, please enjoy this old and probably rather outdated edition of the weeklymonthly summaries. See you at the 3rd edition soon
Trac changes
Changeset #6321 (phpnut) Fixes Ticket #3817, Some non-executable files in source tree have executable permissions
Changeset #6322 (phpnut) Updating controller tests created with the console. Added associated fixtures to model tests
Changeset #6323 (gwoo) Updating Cache to apply prefix for every key, closes Ticket #3821
Changeset #6324 (phpnut) Correcting links generated to additional app tests
Changeset #6325 (phpnut) Adding support for test fixture generation when creating models, this will eventually be moved to a task. Currently the $records are hard coded to create field type specific data, this will eventually be changed to create random data based on the field type. Refactored tests that are created for models, 3 working tests are not created when generating tests for the model. Added notice output to terminal when creating a project, the CAKE_CORE_INCLUDE_PATH is automatically altered and may need to be changed when moving to a production environment. #8221;
Changeset #6326 (phpnut) Fixes svn file property line
Changeset #6327 (phpnut) Removing unneeded #8216; : #8216;
Changeset #6328 (phpnut) Removing unneeded #8216; : #8216;
Changeset #6329 (nate) Fixing reading and writing in Configure class for references 3 levels deep, fixes Ticket #3845
Changeset #6330 (nate) Removing un-needed method from TimeHelper? test
Changeset #6331 (phpnut) Removing var $useTable; from generated model when tables follow conventions Fixed issue with model tests and fixtures not being created properly when Model name does not match table name
Changeset #6332 (phpnut) Updating controller tests created with the console. Added associated fixtures to model tests
Changeset #6333 (phpnut) Fixes Ticket #3849, Deprecated loadView() call in email component when using theme
Changeset #6334 (gwoo) updating HttpSocket? with auth, closes Ticket #3838 removing type casting, fixes Ticket #3827 adding socket.group to tests
Changeset #6335 (gwoo) updating component, removing use of Router not needed anymore, fixes Ticket #3858
Changeset #6336 (nate) Adding non-null association key fix in Model, and updating Model::isUnique() to account for current record, fixes [ticket fixed 38599, closes [ticket fixed #2032]
Changeset #6337 (nate) Fixing return value in Model::saveAll(), fixes Ticket #3852
Changeset #6338 (phpnut) Fixes Ticket #3829, Scaffolding and bake script has problems with tables that has underscore in it #8217;s name
Changeset #6339 (phpnut) Fixes Ticket #3798, custom scaffolding file lookup paths inconsistent
Changeset #6340 (phpnut) Fixes Ticket #3862, set_time_limit(0) has no effect because of ini_set( #8216;max_execution_time #8217;, 60 * 5); changed max_execution_time , 0. Since php 4.3 this is the default anyway
Changeset #6341 (phpnut) Fixes Ticket #3811, $_SESSION not found Fixes [ticked fixed 3823], Session not restarted after instantiating new SessionComponent? Fixes #3850, Configuration Session.start and SessionComponent::__active aren #8217;t handle correctly
Changeset #6342 (phpnut) Fixes Ticket #3851, Acl component fails to check() if a permission is denied in action (*)
Changeset #6343 (phpnut) Adding test cases from [ticked closed 3810]
Changeset #6344 (phpnut) Reverting [] and [] this commit broke the working implementation. Closes Ticket #3810
Changeset #6345 (phpnut) Fixes Ticket #3854, Scaffolding is generating an id field with an empty value for auto_increment primary key
Changeset #6346 (phpnut) Fixing bug with scaffold and valid Session id check
Changeset #6347 (phpnut) Fixing bug with scaffold and valid Session id check in 1.1.x.x
Changeset #6348 (gwoo) updating View error handling for extensions, fixes Ticket #3795
Changeset #6349 (nate) Correcting parameter declaration in API shell
Changeset #6350 (nate) Fixing database drivers for UPDATE/DELETE changes, updating drivers to comply with model tests, most passing. Fixes Ticket #3794
Changeset #6351 (nate) Whitespace fixes
Changeset #6352 (gwoo) adding connection param to schema shell
Changeset #6353 (nate) Enabling alternate titles for PaginatorHelper::sort() links based on sort direction, closes Ticket #3865
Changeset #6354 (nate) Removing MySQL-specific schema code from core, improving support for PostgreSQL sequences, most tests passing
Google group topics
Why doesn #39;t Find* return a group of model objects?
This topic has been discussed many times before, but Deane felt that it was required to ask yet again: #8220;Why doesn #39;t Find* return a group of model objects? #8220;. He wanted to be able to work with his models in the view (!BAD DESIGN!), and was confused why he only got an array back from the find* methods. Gwoo replied, and I quote: #8220;Speed, simplicity, clarity #8221; and pointed out that Cake provide view helpers to work with the arrays in almost any way you can imagine, and that the models provide callback functions (afterFind, afterSave, beforeFind, beforeFind) to format your data.
Deane thanked gwoo for the reply, but #8220;We couldn #8217;t disagree more strenuously, and we think you #8217;re wrong beyond belief in your reasoning, but we appreciate the response #8221; #8230;. didnt like gwoo #8217;s reply at all.
Gwoo replied in a calmly matter that #8220;Everyone is entitled to their opinion and their choice of frameworks. #8221;
rtconner joined the discussion, offering a solution based on some old code by gwoo that would enable the models to return objects (StdClass, not models classes)instead of arrays.
Nick also joined the thread, backing up Deaen #8217;s point of view (Cake is wrong, symfony lover is right) that its proper OO to use objects instead of arrays for the view data, but also reasoned that cake does indeed have the needed hooks and concepts to achieve Deane #8217;s initial idea with a minimal effort. He explained that in a project he had created with CakePHP was that relationships (belongsTo, hasMany ect.) get more complicated with the OO styled approach, since the queries often fetched much more data than was really needed in the view. The combination of the controller didnt know wich fields the view required and the complex relation ships was in his opinion, not ideal at all. Their work a round was to create a #8220;LazyData #8221; class to handle it.
Robby Anderson dropped in his 2 cents, and agreed that the cake was isnt 100% pure OO, but that the concept of #8220;having the view incapable of performing any meaningful business logic #8221; is bad, and will sooner or later lead to an unmanagelbe code base.
Deane, the creater of the thread, posted a public apoligy to gwoo, explaining that he was fustrated at the time when he posted his previous post.
So, the summary must be that while some people dont like the design decission that CakePHP models return arrays instead of objects, others agree that its the right way to encapsulate the buisness logic in a correct Model View Control manner, and if you want to break theese convensions, its rather easy to do with minimal effort.
Passing Data To A Form
Travis asked how you are Passing Data To A Form. A bit unexpted (or perhaps expected given the flood of duplicate / newbie questions hitting the groups daily) nobody answered his question. The answer is pretty simple, and covered in any tutorial aviable on cakephp website AND in the documenation / manual.
1
2
3
span style="color: #000000; font-weight: bold;"functionspan updatespan style="color: #009900;" #40;spanspan style="color: #000088;"$employeeIDspanspan style="color: #009900;" #41;span span style="color: #009900;" #123;span
span style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spandata span style="color: #339933;"=span span style="color: #000088;"$thisspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanEmployeespan style="color: #339933;"- amp;spangtspan style="color: #339933;";spanfindAllByIdspan style="color: #009900;" #40;spanspan style="color: #000088;"$employeeIDspanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
span style="color: #009900;" #125;span
The Show Is Back!
Jeff Loiselle aka phishy announced that the show is back. No replies, no thing, its sad #8230; the show rocks !
I18n in 1.2 model validation message
Athies asked how does i18n in 1.2 model validation message work. His iniital attemp was to use the i18n method #8216;__() #8217; in the model $validate array, but he was getting syntax errors when doing that.
Since PHP does not support useage of functions in instance delclarations its not possible to use i18n directly in the validate array.
Francky06l pointed at his solution in another google post i18n: static language references with __( quot;My lang key quot;, true) in models and controllers, and while the solution will work, its far from ideal when working with i18n.
A CakePHP google group regular, Dr. Tarique Sani, pointed out that the correct way to handle i18n validation messages was in the view, not at the model level. Amit Badkas backed up Tarique up and provided a simple example on how to do it:
1
2
3
4
5
span style="color: #339933;" amp;spanltspan style="color: #339933;";span ?php span style="color: #b1b100;"echospan
span style="color: #000088;"$formspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spaninputspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'username'spanspan style="color: #339933;",span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'error'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #990000;"arrayspanspan style="color: #009900;" #40;span
span style="color: #0000ff;"'alphanumeric'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span __span style="color: #009900;" #40;spanspan style="color: #0000ff;"'Username must contain alpha-numeric characters'spanspan style="color: #339933;",span span style="color: #009900; font-weight: bold;"truespanspan style="color: #009900;" #41;spanspan style="color: #339933;",span
span style="color: #0000ff;"'between'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span __span style="color: #009900;" #40;spanspan style="color: #0000ff;"'Username must be between 8 to 20 characters'spanspan style="color: #339933;",span span style="color: #009900; font-weight: bold;"truespanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span
?span style="color: #339933;" amp;spangtspan style="color: #339933;";span
Francky06l seemed to know that, his consern was the if he multiple views where the validation errors should show, it would be convenient to do it at model level.
Robby Anderson wasnt sure why you just couldnt do both, create the validation errors in the model, and wrap them in __() in the view.
And sure, that will work #8211; but #8211; you will loose some cake magic with that. The console application
cake i18n span style="color: #990000;"extractspan
will not add the i18n messages to the pot file automagic. Also, the i18n extract command will not even search your models for any i18n magic. It will only look in controllers and views. You can choose to call this a limit or a feature, but thats how cakephp has decided to do it, to enforce their paradime on how an application should be build and structured.
FormHelper Labels
Travis asked how it was possible to disable the automagic label in the FormHelper. Robby Anderson provided the correct solution for this issue, use #8216;label #8217; = gt; false:
span style="color: #339933;" amp;spanltspan style="color: #339933;";span ?php span style="color: #b1b100;"echospan span style="color: #000088;"$formspanspan style="color: #339933;"- amp;spangtspan style="color: #339933;";spaninputspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'Employee.name'spanspan style="color: #339933;",spanspan style="color: #990000;"arrayspanspan style="color: #009900;" #40;spanspan style="color: #0000ff;"'label'span span style="color: #339933;"= amp;spangtspan style="color: #339933;";span span style="color: #009900; font-weight: bold;"falsespanspan style="color: #009900;" #41;spanspan style="color: #009900;" #41;spanspan style="color: #339933;";span?span style="color: #339933;" amp;spangtspan style="color: #339933;";span
Using model objects in the controllers
Deane from earlier posted another question on Using model objects in the controllers. I dont really want to dwell much on this post, since its really attemp to take CakePHP in another direction than its supposed to. Deane clearly shows a lack of insight on how cakephp is supposed to work, and failed to provide any usefull examples that could show the group what he wanted to do.
Tags: Cakephp, english, weekly summaries
Posted in Cakephp | 3 Comments #187;
Previous Entries
Recent Posts
Generic non-www to www (and vice versa) 301 redirect using .htaccess
Yay #8211; my dell new server is now online :D
open_basedir will slow you down #8211; security vs. speed
New books from amazon.co.uk
Faster Page Loads #8211; Bundle Your CSS and Javascript with lighttpd
Categories
Cakephp
lighttpd
lua
news
Random
Uncategorized
Tags
301
amazon
books
Cakephp
counter cache
css
danish
dell
dovecot
english
fosdem
generic
htaccess
lighttpd
lua
mod_magnet
news
php
postgresql
redirect
release
set
tutorials
weekly summaries
Recent Comments
web slc on Generic non-www to www (and vice versa) 301 redirect using .htaccesstim on Generic non-www to www (and vice versa) 301 redirect using .htaccessLaatste Nieuws on open_basedir will slow you down #8211; security vs. speedLaatste Nieuws on Faster Page Loads #8211; Bundle Your CSS and Javascript with lighttpdPaginas Web Lima on Generic non-www to www (and vice versa) 301 redirect using .htaccess
Blogroll
Andy #8217;s blog
CakePHP rss feeds
Chris Hartjes blog
CMS på dansk
CMS System
Dansk CMS
David #8217;s blog
Felix and Tim #8217;s blog
Felix #8217;s blog
Jeff #8217;s blog
Webdesign viborg
Usefull links
CakePHP 1.2 api
Archives
November 2008 (1)
July 2008 (1)
March 2008 (8)
January 2008 (6)
SEO
tutorial cakephpcakephp slowcakephp rsscakephp redirecthtaccess lighttpdsample cakephp projectsopen source cakephptutorials on cakephp localizationpost danmark blogcakephp postgresql exampleWordPress Video Tutorials
Cakephp.nu blog is proudly powered by WordPress Entries (RSS) and Comments (RSS). Theme by Bob

数据更新时间

正在更新   

常用工具

桌面软件: MyIP网站信息状态条  WebShot网页快照  SiteMapMaker网站地图生成 
网站信息: Alexa排名查询  PageRank查询/真假PR鉴别/PR劫持检测  外链检查  搜索引擎收录  搜索引擎反向链接  域名注册查询 
网页编辑: 颜色代码选择器  Html特殊符号 
网站调试: 蜘蛛抓取模拟  网站Header信息  网页源代码查看 
代码转换: 火星文查询  繁体/简体转换  Html/js代码转换  Html/UBB代码转换 
友情连接: CodeForge免费源码 CodeForge.com PCFans IT资讯 Ngnix Lighttpd GPhone中国    更多... (PR<5自动转内页)
网站地图: 1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 250 300 350 400 450 500
免责声明 | 联系我们 | 交换友情链接 | 广告位招商QQ: 1967659002
© 2009 MyIP.cn Dev by MYIP Elapsed:98.765ms 黑ICP备09072263号