Archive for September, 2008

Draw and Replay with Processing.js

Posted on September 29th, 2008 in Programming | 1 Comment »

Over the lab, i had experiment with processing.js and i came up with something like you draw whatever you want and click the reply button, it will draw back everything that you had drawn. Processing.js like jQuery will have a huge future, and making it was really a good experience. Link is:
http://monmonja-labs.appspot.com/javascript/?content=processing1

Monmonja Labs follows monmonja design

Posted on September 28th, 2008 in Announcement | No Comments »

Monmonja Labs has been redesign to follow monmonja’s desgin. The transition was a bit hard coz the labs is hosted under Google App Engine (not visible in china?) meaning its server side language is Python so a lot of changes we’re made and new learning had been added. There is no new experiment but a video linking to the current status of HTML5. There is still a lot of changes needed to be made within the whole monmonja network like the page title is a bit mess or some page have no title, no seo stuff had been added, no rss and a lot more. My goal right now is to have my first adsense check and i’m still damn far about from it. ahhaha

Monmonja Music Released

Posted on September 27th, 2008 in Announcement | No Comments »

After few months of redoing the music part of monmonja, it finally come to its beta version, the greatest change on the new site is the interface, i made it as clean as i could. Another change is the removal of Joomla, and went directly by using cakephp. As the site progresses more API will be included (i hope) and more content. To check out the new site Monmonja Music

Templatetags on App Engine

Posted on September 25th, 2008 in Google, Programming | 1 Comment »

Making templatetags on App Engine is a bit different from the real django. Here is how i made mine.

* Create a templatetags folder under your root folder
* Create a empty file named __init__.py
* Create your templatetags file, for this example we will use ads_manager.py
Open your ads_manager.py and enter the following code
from google.appengine.ext.webapp import template
register = template.create_template_register()
def checkShowAds(remote_add):
if remote_add == "127.0.0.1":
return ""
else:
return "ADS HERE"
register.filter("checkShowAds",checkShowAds)

from google.appengine.ext.webapp import template
– means import the template class from the package google…

register = template.create_template_register()
– register this template or something like that

def checkShowAds(remote_add):……………..
– our function

register.filter(”checkShowAds”,checkShowAds)
– add our function as custom filter

May Madness Sale at Firebox.com

Next stop is to open your python file that you will use this templatetags/filter
and insert the following code
from google.appengine.ext.webapp import template
template.register_template_library('templatetags.ads_manager')
class MainPage(webapp.RequestHandler):
def get(self):
template_values = {
'remote_add': self.request.remote_addr
}
directory = os.path.dirname(__file__)
path = os.path.join(directory,os.path.join('templates','index.html'))
self.response.out.write(template.render(path,template_values))

template.register_template_library(’templatetags.ads_manager’)
– What this do is that it register your templatetags so you can use it on your template/view.

class MainPage(webapp.RequestHandler):……
– This and the rest of the code will just render your template while passing the remote address as ‘remote_add’ variable

Next is to open your template and add the following:
{{ remote_add|checkShowAds }}

I hope this helps. It took me days to understand the basic concept of how templatetags on app engine works.

Making CakePhp and Session Work

Posted on September 25th, 2008 in Php, Programming | No Comments »

If you have been developing website that uses cakephp, you might stumble upon an annoying time when your session is not working. Here are some tips on how to make it work.

1) Configure::write(’Security.level’, ‘medium’);
On your core.php search for the line Security.level, by default this is configured to be high. Most of the time changing this will make your session work.

2) Configure::write(’Session.checkAgent’, false);
Also on your core.php, checkAgent will check your HTTP_USER_AGENT, which retrieves your browser and computer information, most of the time and i don’t know why IE will have a problem with this. By default the setting is set to true, try setting it to false and see if your session works.

3) session.cookie_path
Some times when your session.cookie_path is different from the root folder, Session and CakePhp will not work. A simple solution is to set Session.start on core.php to false. And on your AppController (app_controller.php) or on every Controller that you have to use session, set the following on the beforeFilter function
function beforeFilter(){
$this->Session->activate('/');
...
}

GameDuell Inc. - Play Sudoku

4) Headers already out before CakePhp gets the Session
This took me hours before figuring out what’s the problem with my Session and this is the reason why i wrote this post. Anyway, to check if your headers are out before cake fire session_start, first create a dummy page what will definitely fire a session, create it under webroot folder. For example create a file named session.php under webroot with the following code:
<?php
session_start();
$_SESSION['test'] = “testing”;
?>

Access it by your browser (http:/xxxx/session.php).

Next step is to go to your cake folder, then libs folder, then open session.php. Locate for the word “function __startSession” and change the following lines
function __startSession() {
if (headers_sent()) {
if (!isset($_SESSION)) {
var_dump($_SESSION);
$_SESSION = array();
}
return false;
.....

Now definitely there should be something on the $_SESSION, if not or you have an empty array then you have a problem with spaces on your files, you can check the controller your calling from, the models, the components and see if you have a space on the top or the bottom. If your sure you have none, then check if the file was meant to run under linux, windows or unix. If you still have a problem then check the file encoding, if you are using UTF-8 select the one without BOM. If you still have problem then ask google to help you. :)

Monmonja Changes

Posted on September 19th, 2008 in Announcement | No Comments »

There is a template change in the whole monmonja, first because i think the last template was not simple enough for me and secondly coz i’ve been hacked twice, one on the joomla integration and the other on the phpbb forum, the forum will be temporarily closed and will be pushed back to live once the template has been integrated, another reason is that the old one was build by other people so it was harder for me to change it and i even don’t know if the license permits me.

The template was tested on IE6,IE7,FF3,Chrome and Opera. Firefox and Chrome or webkit based browser will have a better view due to their css capability.

To the people who hacked me, please don’t hack this site!!!
I dare you to hack big sites not small sites like this (i dont even get 100 views a day, aha)… Thanks

Microsoft Ads

Posted on September 14th, 2008 in Microsoft | No Comments »

The second ads with Jerry Seinfeld has been release, even tough i don’t get the meaning of it especially the first one, the new one made me laugh especially the bed story telling with bill and the robot thing at the end.

Here is the second ads: