Showing posts with label CMS. Show all posts
Showing posts with label CMS. Show all posts

Monday, August 25, 2008

Safari's defect on same-origin policy?

XMLHttpRequest object follows the same-origin security policy, which means you can't use it to request data from another domain. For example, the web page is hosted in domain http://www.domain.com, and it is forbidden to request data from http://www.domain1.com using XMLHttpRequest. You will get a permission denied exception when you try to call the open() method.

Same origin means same protocol, same host and same port. However, it looks like different browsers interpret this in different ways. I had an SCORM course, which is hosted in domain http://www.domain.com, but the requested app is located in domain http://www.domain.com:80. I didn't have any issue with IE and FireFox, but in Safair, I got a permission denied exception. I am wondering if this violate the same-origin policy in Safari.

Interesting discussion here for by passing the same-origin policy for XMLHttpRequest object in Firefox and IE.

PS: According to RFC 1738, the port defaults to 80 if port is ommitted. After I get rid of the 80 port number in the url for the requested app, it works in Safari. Unlike IE and Firefox, I guess Safari literally check the URL for the domain.

Read more!

Tuesday, August 5, 2008

encode AICC data in JavaScript

The AICC data in putparam command needs to be encoded before send the HTTP request, and there are several JavaScript methods for encoding strings: escape, encodeURI, encodeURIComponent. Here is the article describing the difference between them. However, those 3 doesn't quite meet the requirements, because all of them will skip some unsafe characters. For example, escape and encodeURI will skip the unsafe character "/", and encodeURIComponent will skip the unsafe character "'".

Since "+" will be decoded to spaces on the server, this needs to be encoded before sending the AICC data. This makes escape() the last one we should choose, and encodeURI skips a lot of unsafe characters, besides "+". So it looks like encodeURIComponent is the best choice, but we need to be careful about "'" and "~".

Read more!

Monday, June 9, 2008

A nice Joomla debugging extension

I have been looking for some kind of logging framework for Joomla development, that is similar to log4j, but I couldn't. So I came across this article talking about J!Dump. Looks like it might be helpful.
Read more!

Tuesday, May 13, 2008

Increase File Upload Limit for Moodle

The uploaded file size limit in Moodle actually is determined by Apache and PHP, and the default value is 16MB, which may not be big enough for those Flash based courses with audio and video. To increased the file size limit

First find the file httpd.conf under the directory apache\conf and make the following changes
LimitRequestBody 52428800
#OR
#LimitRequestBody 50M

Then find the php.in under the directory apache\bin and make the following changes
upload_max_filesize 52428800
post_max_size 52428800


Now restart Apache and MySQL and log into Moodle with administrator user, you should find the available file size limit for the site has been increased from
Site Administration > Courses > Add/Edit courses > select Course category & edit each course > Maximum upload size
Site Administration > Security > Site Policies > Maximum uploaded file size


Read more!