Updating myself…

Ahh.. I’ve been trying to create an admin page for the xrdauth system (just to make my life simpler) but exploring cakephp.org website always makes go somewhere else. grrr… What really makes me angry, frustrated and such is that the idea that there are so much new ideas in cakephp world that I havnt had time to explore yet. This past few weeks, I’ve been busy doing some other stuff that made me feel there is nothing else to learn but today Im just struck with http://bakery.cakephp.org. It launches just last month I think, not really sure since I’ve been on a vacation in cakephp world for a few weeks.

Bakery from cakeforge news >> We have been talking about replacing the wiki and bringing in the Bakery. Well, the doors are open at http://bakery.cakephp.org . Over the next few days we hope everyone will help us move the content from the wiki over to the Bakery. If you have a tutorial on the wiki, something you wrote up on your blog, or something you have been planning to share, help us test out the Bakery. The Code section of the Bakery is the perfect place to put your latest and greatest snippet. If you have a component, helper, model or some other nifty code on CakeForge or your hard drive, throw it into the Code section of the Bakery. There are still plenty of features to add to the Bakery, but if you find any bugs or think of some enhancements feel free to submit a ticket to Trac, https://trac.cakephp.org

Anyway, just to save myself from bookmarking all the tutorials i found, I’l list them down here. Might be helpful for some ..

  1. Threaded Lists > This one has a nice tut for some cool form validation. Maybe I could also add features from http://www.formassembly.com/form-builder-v2.3/ ajax validation. This will be one of my target lesson for this week.
  2. getDSN > This returns the database connection details in the form of a DSN (driver://username:password@hostname/database). I’ve dealt with this problem one time but I left it unsolved. Now here it is, presenting the solution in front of me.. *dangs!*
  3. Taking Advantage of the Pages Controller > I dont know how this will become useful to me.. I still do not have the grip of what this tutorial really means.. But I’ll list it here for reference.. might be very useful someday
  4. autocomplete > easy implementation of autocomplete
  5. HTTP Client class > Im new to curl and this interest me a lot. honestly speaking, i dont know how i will use this. need to google more 😉

ahh.. so much ideas right now, i need to time out.. be back in a few days, or maybe a few weeks again 😦

October 1, 2006 at 11:32 am Leave a comment

Ajax Optimization Techniques

For a site that uses large javascript/css files, there are some few optimization points that’s worth checking out.

Kevin Henrikson of Zimbra gave a brisk presentation covering some of the lessons his organization has learned and the “dirty tricks” it has implemented to improve the performance of web applications that rely on large JavaScript/CSS codebases. Here’s a quick run-down of the items he covered. The slides of the talk are up on the Zimbra blog.

Read on the complete blog here.

August 2, 2006 at 12:32 pm Leave a comment

get rid of GET

SimpleGet Component

What?

SimpleGet is a component that manipulates the pass in the params array. It works much like the GET. I can better explain it thru an example. Let’s say we have the ffg url: http://controller/action?var1=value. Using the component, we can rewrite it as http://controller/action/var1/value. Then in the controller, we can ask for var1’s value easily.

How?

Add the Simple Get Component to your components folder.

class YourController extends AppController {
	var $components = array('SimpleGet');
	function index() {
		// returns false if var1 does not exist
		$var1 = $this->SimpleGet->getValueOf('var1');

// the rest of your code here
	}

/* Initialize the SimpleGet component with the value from
	 * $this->params[pass]. You must pass all the $this->params
	 * bec sometimes $this->params[pass] does not exist. Let the
	 * component check for this.
	 * You dont have to always set the params in your code bec it
	 * is done at the startup of your controller. This is only
	 * used just in case it is needed (a call from ajax maybe)
	 */
	function resetParams() {
		$this->SimpleGet->init($this->params);
	}
}

SimpleGet already sanitizes the value passed to you so you dont have to sanitize it again.

Why name it like that?

hmmm.. Im no good at naming things.. hehehe.. I created this one to replace it with the ugly GET url so its simply GET for me 😉

July 25, 2006 at 12:29 pm 5 comments

extended rdAuth

I created a new authentication component that extends the rdAuth that we are currently using. The extended component basically gets the the access from the db instead of the static var $access inside each component. The idea of creating this one was explained in my previous post.

What you need

  1. Create 3 tables (xrd_auth_tables.txt)
  2. The xrdAuth component (xrd_auth_component.txt)
  3. Create the models for the tables above. Then, in the xrdAuth, set the ffg variables
    var $tbl_controller_access = 'model_name_for_SysControllerAccess';
    var $tbl_controller_function = 'model_name_for_SysControllerFunction';
    var $tbl_controller = 'model_name_for_SysController';

How to use xrdAuth

Read the wiki tutorial how to use rdAuth for general instructions. Ofcourse, replace rdAuth to xrdAuth and dont declare the var $access anymore. You’ll add that directly in the db. We’ll discuss that later.
Then edit your AppController::checkAccess() before the if condition

// Enable this to create an array of roles that is allowed to be an admin.
// NOTE: declare this before the set function
//$this->xrdAuth->admins = array('Administrator','Guest');

//set local vars from session
$this->xrdAuth->set();

// Enable this to set all user groups to admin.
// NOTE: declare this after the set function
$this->xrdAuth->setAdminAll();

// pass controller
$this->xrdAuth->controller = &$this;

// do not edit below this line
if () {.. the other codes here ..}

How to add access

Basically, we have 3 tables namely: tSysController, tSysControllerFunctions and tSysControllerAccess
In tSysController, add all the Controller names you wish to create access
In tSysControllerFunctions, insert the Controller function names, e.g. ‘add’, ‘edit’, ‘delete’, and the controller_id from tSysController
In tSysControllerAccess, add the group_name, e.g. ‘Administrator’, that has access to the function_id(tSysControllerFunction)

In any case that a group has access to all functions in a controller, you can just use ‘*’. Do the ffg. (but change the variables to your value)

INSERT INTO SysControllerFunction (`name`, `controller_id`)
VALUES ('*', $the_controller_id);
INSERT INTO SysControllerAccess (`group_name`, `function_id`)
VALUES ($group, $the_function_id);

That’s it! If you found any bug, kindly email me 🙂

Update:

I’ve been using this component for a while and seems ok with me. There is only 1 catch, when either your controller, model or view doesnt exist, it will show you an error like this — “Fatal error: Call to a member function on a non-object in: /app/controllers/components/xrd_auth.php on line 39” . I still havnt had that much time to fix this one (bec the error is still bearable). But for the moment, to see the problem, just disable it for a while.

Update Dec 18, 2006:

I’ve moved the txt files to another location so I hope you’ll all see the files.

Also, problem above is fixed, just update the code you had with this one. You’ll get an error in red “Error: Controller cannot detect table Syscon” and the normal error you’ll get from cake.

I’d also probably make an interface where we can add the relationships to each controllers and functions. I’ll do that as soon as I get the time. I will also be needing it anyway.

Update May 21, 2007:

The files are lost so please give me a few days to retrieve them.. thanks..

July 24, 2006 at 10:49 am 3 comments

what do you use for your authentication?

rdAuth or othAuth? hmm..

I used rdAuth first and felt comfortable using it in my first project. Its really simple to use but when faced with a more complicated system that requires a more complicated authentication and redirection, my doubt begun using rdAuth. I was looking for another alternative such as ACL but hmmm.. I really do not like to read a lot and have no time to experiment on it.

Then i read about othAuth. I think othAuth is also ok and simple to use. It just that it has some configs that I cant afford to have such as the active field. I also do not like to set the group_id before i log in bec i actually need the group_id to tell where to redirect the user and I only want a single login page. Maybe im just toooo lazy to understand it but yeah i admit it, Im really lazy.. hehehe .. Another factor also that keeps me from using another auth system is that i already used rdAuth all over my code.. hmm.. that is quite a mess! anyway, i have no choice but to find a solution. So I extended rdAuth to set and get some permissions directly from the db. Thanks to othAuth for the idea 🙂

Anyway, any other good and simple auth system out there?

Update: I’ve created a new post for the xtended component. Read it here.

July 22, 2006 at 5:29 pm 1 comment

OpenDNS, an option to experience a faster(and smarter) internet surfing

I’ve stumbled on this new FREE service from a lockergnome article today. Its called OpenDNS. Its not really cakePhp related but of use for all. So, what’s OpenDNS anyway? Great question! Actually there are already a few articles that best describe this so i wont reiterate them here again. The best so far(for me) are as follows

Open DNS (explains in layman terms)

OpenDNS: Should you make the switch?

user opendns to speed up the internet

an article from wired news


and for skeptics and still wanna stay skeptic about the idea, here is an article for you. I like this kind of thinking.. It just make you think.. hehe.. anyway, its a good article from another point of view, how i just wish my isp is as great as his.

As for my experience, the installation was so easy using windows(havent tried it in linux and router configs). You dont have to install anything actually. Just follow these instructions. After that, I noticed the speed improve after my first visit to some sites. Tried it with wikipedia.org, friendster.com and merriam-webster.com and it was just like a wow experience. I think this is useful when your ISP isnt that so great. This is not a caching tool alright. What happened is not really my business to tackle so i’ll leave it to the experts and to you to understand(just read the above links).

However, I hope, with one blogger, that this service will not be used for collecting datas or surfing habits from the internet surfers. For now, I’ll use it till its fresh. hehe..

July 22, 2006 at 4:59 pm Leave a comment

Cakphp Cheat Sheet

By RosSoft

Download nate’s cheatsheet in pdf format HERE.

July 8, 2006 at 4:01 pm Leave a comment

Older Posts Newer Posts


Recent Posts

March 2017
M T W T F S S
« May    
 12345
6789101112
13141516171819
20212223242526
2728293031