February 14, 2008 at 13:43
· Posted in cakephp, php, webdev
Currently, I’m doing a project in CakePHP.
There’s lots to say about cake, here just a quick note, for myself or for anyone in case you are running into the same problem.
Situation: you are using the Ajax helper, which contains a method isAjax() – returns true if the request was an Ajax request.
Typically, you use this method inside a view, to conditionally render content for regular/ajax views. Example:
...
if (! $ajax->isAjax()) {
// render general page stuff
}
// render stuff for both regular- and ajax view
...
My problem was that the isAjax() call never returned true, regardless of ajax/regular request method.
The solution appears to be really simple: you should include the 'RequestHandler' component in your controller class. This one took me way too long to figure out!
public $components = array (
'Auth',
'Cookie',
'RequestHandler'
);
Update my situation was even worse than described above; I use a redirect between controllers within an Ajax call, something which is officially supported by Cake 1.2. This worked just fine in Safari, but not in Firefox (and Opera) – these browsers would not load the Ajax view but rather the complete page, almost crashing the server by consuming huge amounts of memory.
Read on… Read the rest of this entry »
Popularity: 63%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax
Permalink
August 20, 2007 at 15:13
· Posted in firefox, greasemonkey, webdev
Ever since I started using Greasemonkey (GM), I found more and more ways to improve aspects of public websites. What’s more, GM also proved to be invaluable for quick testing of mashups and other fashionable web 2.0 tricks.Using GM this way, it can be used as a tool for rapid prototyping of advanced user interfaces and Ajax enhancements as well. So a web builder could write a quick and dirty user script in order to prove the viability of a concept.That would be the natural border for user scripts within the corporate world, as far as I could imagine.Wrong! Peter Laird, Managing Architect for the WebLogic Portal engineering team at BEA, wrote a 5-part blog series about deploying Greasemonkey user scripts in the corporate environment.
- More Mashups: Using Greasemonkey to Weave New Features into Web Sites
- Building a Greasemonkey Mashup Tutorial
- Greasemonkey in the Enterprise: When is GM the Right Tool for IT?
- Beware of Greasemonkey’s Inverted Security Model
- Solving the Greasemonkey Script Versioning Problem
The first two articles are a very nice and moderate technical introduction to Greasemonkey. The next installment starts to position GM as a valuable corporate intranet addition, with a checklist to find out if it is the right tool for your situation. The last two articles focus on the important security- and deployment issues, focused on the corporate situation again.I’m really curious whether corporate IT department heads will really be convinced by these articles. The checklist (part 3) lists a number of very frequent corporate / intranet annoyances where GM will help and the author’s background (BEA) is very trustworthy, so I give it a good chance.Definitely worth a read, even if you’re not a corporate IT head!
[ratings]
Popularity: 54%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax, fashionable web, Peter Laird, web builder
Permalink
April 4, 2007 at 11:02
· Posted in webdev, wordpress
Christian Heilmann won’t go naked tomorrow.
His reasons not to do so are:
- Most CSS naked sites are generated from templates, so what is the individual blog author’s effort?
- The target audience is missed, it is merely preaching for already converted style purists
- The target market is missed: those really crappy intranets within big corporations
My reasons for still participating with my (slightly modified) WordPress blog…
You definitely have a point with the generated code/templates based blogs. Last year, I adapted my site layout to have the content first and navigation and boilerplate stuff to the bottom in the HTML stream. That was fun and even sped up the apparent rendering of my site with CSS enabled. So I did learn something usefull in the process as well.
That site structure is generated from templates as well, but all handcrafted XML/XSLT stuff (in Firefox, select the alternate style CSS Naked Day to see how it works).
Now I’m using Wordpress and, indeed, just installed a plugin for ‘Naked Day. OK, so my contribution was to adapt that plugin for WP 2.1.x.
About the corporate software/intranet stuff: you are completely right. But here I feel that bottom-up advocacy does work in the longer term. In my former (large) organisation, I got quite a few corporate J2EE developers interested in standards compliant CSS web techniques, especially after they had a very bad time trying to meet the requirements from our User Interaction specialists. The advance of Ajax does the rest.
In just another 5 years or so, even those big vendors might have “got it” (and then go wondering what that “semanic web” stuff is all about
)
Popularity: 26%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax, Christian Heilmann, corporate software/intranet stuff, HTML, semanic web, web techniques, XML, XSLT
Permalink
April 2, 2007 at 15:57
· Posted in review, semweb, webdev
Just after my post Freebase as productive playground, I recieved an invite (thanks a lot, Ken!) and I have played around a little…
Now, a lot of relevant things have been said around the ‘net (see my prevous post). And, there have been some in-depth reviews of the model of Freebase, related to the Semantic Web: Denny Vrandecic, Danny Ayers.
I will not repeat these comments here, rathter give my first impressions as a curious explorer.
First of all, the Freebase website is very heavy on Ajax, which seems to be almost essential for the functionality provided.
As a novice user, you are launched at the “User Profile” page. While starting to fill out some profile fields, you are immediately confronted with the Metaweb Object Model (login needed).
The Freebase Object Model
The model roughly consists of:
- Domain (the top level ontology, e.g. ‘
music‘ or ‘business‘)
- Type (a class within a domain, e.g.
music/artist)
- Topic (an individual object, let’s say Frank Zappa as musical artist)
- Property (attributes, e.g. ‘name’ or ‘date of birth’, or a relation with another Topic)
So when you start editing your User Profile, you are actually filling out a template of a User Type. Within this type, the attribute “Me as a Freebase Topic” links to an object of class (Type) ‘people/person‘. The distinction is somewhat like the difference between a real world (verifyable) person, and personas this person might use. From the Freebase documentation:
A person topic is distinct from a user in Metaweb. Users have profiles that can only be edited by the users themselves. A person topic can be edited by anyone and is intended as a factual representation of details about a person.
A couple of primitive Types exist (e.g. type/intor type/text), but in most cases more complex types are used for attributes. So Place of Birth is not just a text sctring, but an object of type ‘location/location‘. This ensures that all occurrences of ‘Baltimore, Maryland‘ refer to the same object.
Following the link to this location, you can zoom in further and find that the object is not only of type ‘location/location‘, but also ‘location/citytown‘ and ‘location/us_county‘.
Queries and results
Freebase is called a database for a reason: you can run queries against it and get results back. Now being heavily rooted in the semantic web terminology, you might expect to use SPARQL as a query language, and results back in some RDF representation. But this is not the case.
Both queries and results are expressed in plain JSON, which is becoming the data transport protocol of choice for most Ajax projects and frameworks.
Read the rest of this entry »
Popularity: 60%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: 200 OK;, ajax, API, Baltimore, community vigilance tools, Danny Ayers, Denny Vrandecic, Frank Zappa, front end web application, Green Genes, Hot Rats;, Maryland, Peaches;, RDF, semantic web terminology, web applications
Permalink
October 17, 2006 at 23:18
· Posted in webdev
Amongst all the improvements in PHP 5 is the concept of Reflection. If you’re a Java person, you will be familiar with this concept.
In just a few words, Reflection means that Objects are open to (self-) inspection, so that you can interrogate an object for all kinds of properties at runtime.
Now if you have classes with getter (and setter) methods, there are some very elegant techniques with reflection. Normally, these getters and setters are used to give access to the data contained in the object. Good Object Oriented practice makes use of these Data Objects to build a clean boundary between the data and implementation details.
So, let’s assume that you have painfully crafted a class definition with accessors and you want to serialize the contained data as JSON over the wire. Of course, you can write a getJsonString() method for every class. But Reflection gives you a much nicer option.
An example of serialization into JSON, entirely based on Reflection:
Read the rest of this entry »
Popularity: 43%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax, Java, JSON stream, php
Permalink
August 29, 2006 at 17:21
· Posted in firefox, greasemonkey
Just a quick note: my first Binary Ajax project is ready for release (well, testing I mean).
EXIF Thumbnail Fetcher is a Greasemonkey user script, which lets you retrieve the embedded thumbnail of a digital camera image over the ‘net, without downloading more than strictly needed.
See my previous post for some more details. And, please test it and let me know your experiences!
Popularity: 30%
Tweet This
Delicious
Reddit This Post
Stumble This Post
Tags: ajax
Permalink