Friday, May 30, 2008

Turbogears 2 development version on ubuntu

Finaly, akhirnya bisa juga TurboGears versi 2 development version terinstall di mesin ubuntu. Pertamanya bingung juga bagaimana cara instalasinya, karena masih awam di linux dan python, untungnya saya menemukan copy script shell dari Nathan McBride, sebagai berikut :

#!/bin/bash

# TG2 Installer
# Nathan McBride
# May 22, 2008

echo “Making Directories”
mkdir svn
mkdir src
echo “Running SVN Checkouts”
cd svn
svn co http://svn.turbogears.org/projects/tg.devtools/trunk tgdev
svn co http://svn.turbogears.org/trunk tg2
svn co http://svn.turbogears.org/projects/tgrepozewho/trunk tgrepozewho
cd ..
echo “Running SRC Downloads”
cd src
export http_proxy
wget --proxy-user "user_proxy" --proxy-passwd "pass_proxy" http://dbsprockets.googlecode.com/files/RuleDispatch-0.5a0.dev-r2306.tar.gz
wget --proxy-user "user_proxy" --proxy-passwd "pass_proxy" http://dbsprockets.googlecode.com/files/PyProtocols-1.0a0dev-r2302.zip
echo “Extracting SRC Downloads”
tar xzf RuleDispatch-0.5a0.dev-r2306.tar.gz
unzip PyProtocols-1.0a0dev-r2302.zip
cd ..
echo “Starting the Installation”
easy_install -f http://pylonshq.com/download/0.9.7 -U Pylons
easy_install -i http://dist.repoze.org/who/latest/simple repoze.who
easy_install Paver
cd src
cd PyProtocols-1.0a0dev-r2302
python setup.py develop
cd ..
cd RuleDispatch-0.5a0.dev-r2306
python setup.py develop
cd ../..
cd svn/tgrepozewho/
python setup.py develop
cd ../tg2
paver develop
cd ../tgdev/
python setup.py develop
cd ../..
echo “Installation Finished”

Simpan file ini dalam nama install_tg2.sh dan beri dia chmod 755.
Untuk mengeksekusinya masuk sebagai root

$ su
$ ./install_tg2.sh


Setelah selesai coba eksekusi perintah $paster --help dan perhatikan ada section TurboGears2 atau tidak, kalau ada berarti sukses instalasinya.
Berikutnya kita pelajari step tutorialnya disini.
Selamat Mencoba.

Thursday, May 29, 2008

Install IronPython di Ubuntu

Penasaran juga dengan ironpython, terus search di google.
Ternyata ironpython bisa di install di ubuntu.
Iseng coba dengan ketik sudo apt-get install ironpython, ternyata ada packagenya di ubuntu hardy heron.
Wah keren, tapi sekarang mau buat apa ya ? bingung juga, soalnya belum ada keperluan bikin program pakai python.

Wednesday, May 28, 2008

Looking for Next Frameworks

Another Frameworks ? lagi ? yes, definitely.

Applikasi yang sedang kita buat saat ini di bangun diatas php, dan terus terang kita sedang mencari framework berikutnya. Tentu saja bukan php pilihannya, ada 2 pilihan pakai python atau java. Dua dua nya memiliki kelebihan dan kekurangan, dan yang pasti mereka sudah di skala enterprise.

Framework di dunia python ada beberapa yang menarik untuk di pergunakan, Django dan Turbogears. Django memiliki kekurangan yang saat ini sedang saya butuhkan dengan sangat, yakni tidak support dengan composite primary key didalam default ORM mereka, tetapi mereka memiliki solusi dengan membuat side-project, django-sqlalchemy hosting di google codes, tetapi sepertinya project ini stagnan, tidak terlalu kelihatan perkembangannya.

Turbogears sudah memiliki integrasi dengan SqlAlchemy, tetapi masih belum default. Next version dari Turbogears versi 2 akan membuat SqlAlchemy sebagai default ORM mereka.

Why SqlAlchemy is important for me ? karena kita berusaha memakai legacy database yang sudah ada dengan berusaha meminimalkan efek perubahan struktur database karena pemakain ORM yang baru ini.

Bagaimana dengan JAVA ?
Pilihannya sudah bagus ORM-nya pakai Ibatis atau Hibernate.
Cuman belum di coba.

Wednesday, May 14, 2008

Trac Project management

Kita pakai Trac sebagai project management di dalam lingkungan kerja kita.
Featuresnya cukup banyak, yang aku suka karena dia ada link ke SVN, ada wiki buat dokumentasi, ada issue tracking dan segudang plugins dari tracHack.

Trac ini berbasis web, jadi bisa diakses oleh developer dimana saja asal masih termasuk dalam jaringan kerja kita.

Nah salah satu pluggin yang kita butuhkan saat ini adalah Gannt Chart, waduh susah sekali cari pluginsnya, yang setting tanggal dari masing masing task itu bisa di set di ticket systemnya. Dulu kalau tidak salah filenya dalam bentuk *.egg, tapi sekarang sepertinya sudah tidak ada.

Mungkin harus cari gannt chart yang versi baru.

Saturday, April 12, 2008

Database Designer on Linux

Hi all,
Long time no see. Hehehe busy ya.
Setelah lama mencari cari akhirnya menemukan juga database designer for linux.
Namanya PowerArchitech, Open Source BSD Licence, jadi bisa dipakai nih buat menggantikan ERWin / Sybase Power Designer. PowerArchitech ini dibuat pakai java5, support postgresql, mssql dan mysql. Cukuplah untuk saat ini, karena memang kebutuhan kerja nya masih pakai 3 database ini.

Sebelumnya memang ada namanya DBDesigner yang khusus untuk mysql database saja.

Nanti kalau sudah mencoba PowerArchitech akan kita informkan reviewnya.

Tuesday, February 27, 2007

Turbogears and SQLAlchemy with SQLSoup

Finnaly, I have a chance to try Turbogears with sqlalchemy last night.
I used a fresh instalation, python 2.4.1 on windows, and a python extentions on windows.
Then I used an "offline instalation method" for TG installation, basically I download all the TG requirement files, and using my own batch file to install it.
Then I install the SQLAlchemy manualy from egg file.

so next I create a TG Project, and add

from turbogears.database import metadata, session
from sqlalchemy.ext.sqlsoup import SqlSoup

db = SqlSoup(metadata)


then I test it with tg-admin shell

woaaaaa I can get all my legacy data with that soup ...

db.M_SITE.select()

see, with this format db.., i can access all my legacy data, no more creating class

but I guess, I has to make an impact somehow, I hope not the performance.
cause I will use an assign_mapper function with this one


Thursday, October 19, 2006

Busy session

I'm busy right now, sorry, no post, perhaps next month.

Thursday, June 29, 2006

dojo.io.bind

YES !
Actualy, I tried to submit a form to our server, but it has to go through AJAX protocol. I wish I could do it on mochikit library, but in order to mr.Bob Ipolito said, "there no plan to add a POST mechanism on mochi library". So I'm stuck.

Lucky me , Dojo library support it, they support form submit via XMLHTTPRequest protocol. Its little be hard to find how to do it, since dojo still under heavy development, but thanks to mr.google, heres the way I did on my code :

This is part of my button action / signal

var my_url = this.ajax_url+"ajax/ajax.items.php?task=test";
dojo.io.bind({ url : my_url,
load: function(type, data, evt)
{
alert(type);
alert(data);
alert(evt);
var rows = data.rows;
var cols = data.columns;
alert(cols[0]);
alert(rows[0]);
the_object.value = data;
},
formNode: getElement("aoiForm"),
mimetype:'text/json' });

You may found in this part of javascript code, there's as simple as mochikit did. Thats why I'll stick my GET method with mochikit and do the POST method with dojo.

Wednesday, April 05, 2006

Twisted - adbapi example

this is a simple example of adbapi use pymssql module to connect to MSSQL server.

from twisted.internet import reactor
from twisted.enterprise import adbapi
def getSites():
return dbpool.runQuery("select * from m_site")

def printResult(l):
for item in l:
print item

dbpool = adbapi.ConnectionPool("pymssql", user="sa", password="bedjo", host="192.168.31.31", database="bedjo")
getSites().addCallback(printResult)
reactor.callLater(4, reactor.stop)
reactor.run()

Thats all ... cheers

pymssql - example script

This is a simple script to test a connection of pymssql.
It's easy, but I always forgot. It seems that I'm getting old. lol.

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>> con = pymssql.connect(user="sa", password="bedjo", host="192.168.31.31", database="bedjo");
>>> cur = con.cursor();
>>> cur.execute("select * from m_site");
>>> print cur.rowcount;
>>> print cur.fetchall();
>>> cur.execute("insert into log_message values ('succes') ");
>>> con.commit();
>>> con.close();

Thats all, the simple things to do.

Friday, March 17, 2006

Twisted - A Network Framework

Its on my radar.
Fuih, so many application or framework come up on my radar. Why ? Its happend for my office purpose actually. We build our integration application on PHP front end application. But we did not decided yet our back end application. I tried to found a good platform for our back end.

Zope is still my first consideration, but yes, I still have some problem to implement it. Many things come up to things. One of the main reason is ZODB. It doesnt mean I dont like it, but Zope is depend on it and it hard to remove. Some people may say, "we can build application on zope without ZODB". But I thinks its hard.

Next, is Twisted. I got attract to twisted by reading many blog post on python daily. Then letter on, someone drop me a pdf file about twisted. Its interesting. It has a flexible DBConnection, it has a many network protocol. I might gonna use one of those protocol for my application, but not decided yet which one of them.

My application it work like this : It should be work as a robot application. It will start and monitor many transaction table. It can make transaction summarize, report and calculate many background process. It should made a history log on file or DB. It can make to daemon/service.
At advance, it can provide an XML-RPC or SOAP, to retrieve document generate or xml data.
It may run every 15 minutes or End of Day process.

I think twisted is suite enough.

But recently, Zope 3.2 come up with twisted 2.1 on it. I dont know the combination between these two, but if it does, it would be a great combination tools on hand. So what should I do ?
Take pure twisted or Zope 3.2 with twisted included ? give me a light.

Thursday, March 16, 2006

Dojo Toolkit as my DHTML Library

A month ago, I was looking for various DHTML Library for my office project. I have define 3 DHTML groups which on my radar. Finally, none of them is fit with my requirements. Then, I saw on Mochikit mailinglist, many mochikit users take dojo toolkit as their DHTML Library.

Dojo is still on beta version, but please dont ignore it, even if this is beta version, it work quite good. You may take a look at TurboAJAX site, they provide many tools build on top of Dojo Toolkit. They are an awesome product.

So, After collecting many information from mochikit mailinglist, I can able to make dojo and mochikit work together. Heres the sample code on one of my page

< type="text/javascript" src="http://localhost/js/mochikit/MochiKit.js">< / script >
< type="text/javascript" src="http://localhost/js/dojo022/dojo.js">< / script >
< type="text/javascript" src="http://localhost/js/dojo022/src/widget/TabPane.js"> < / script >
< type="text/javascript" src="http://localhost/js/inventories.js">< / script >

< type="text/javascript">

//initialize dojo
dojo.require("dojo.widget.ContentPane");

function qc_search()
{ alert("masuk sini");
doc_manager = new DOCManager("order_response", "qc_search");
alert("initialize");


That all part of my code. As you can see, we have to load mochikit before dojo. If not then we have to mention mochikit function completly which was ugly to do.

Monday, February 27, 2006

Thick Client or Thin Client

While I'm surf the net, I found Brad Neuberg blog entry, speak about Thick Client and Thin Client architecture. He's clearly explain the difference between those two architecture. I believe, my current office project is Thin Client architecture, which its mean use a simple UI. On the other side, I feel that my office commarade project module is Thick Client architecture, which is heavy UI.

One of readers comment mention about Qooxdoo Library for Thick Client. I've check their website, and take alook at their example/demo page. Woaa Extremerly heavy UI. I dont think I wanna use this one for my project. But, Its interesting to learn it.

Other reader XFORMS, XHTML which belong to next generation of web application. He also deliver an introduction link, I should have to take alook at it and learn it little bit. Its W3C standard complient for web 2.0 application.

Thursday, February 23, 2006

Desperately need for DHTML Effect Library

Currently, I'm joining our company developer teams to build our internal integrated system. It will build using some of open source project, such as PHP, MySQL, AJAX, MAMBO, and so on. The biggest challange we've found is The Rich GUI Web. Yes, we dont have any skill about this, but we will take this path.

So far for The AJAX toolkit is solve through Mochikit which provide JSON as their primary data exchange format, and we realy happy about it. It's work now with our application. But Mochikit is lag of visual effect or widget. I hope their script.aculo.us port version will be deliver as soon as posible.

We had many candidate for our DHTML Effect Library, and it hard to choose one of them, because it will need time to learn and the other limitation is our skill in javascript arena.
Here the list :
- BACKBASE Community Edition --> we had a problem with their licencing term.
- Script.aculo.us, Open RICO, Moo.fx which are base of Prototype AJAX Library --> Prototype doesnt support JSON right now.
- Yahoo UI Library provide by yahoo teams ---> just release in this week

So, while we waiting to choose the right one, we go directly by our self. We search and download available DHTML trick and try to run it on our application. We also had an idea to go get hire someone out there whos expert on javascript arena, but its hard to find around our city.

If you had any DHTML Effect Library candidate, please let me know.

Saturday, February 18, 2006

PyMSSQL got broken

Woa, something goes wrong on my TG installation.

It said an error message "can't commit" when I tried to execute "DBNetLib ... bla bla bla ... server does not exist ... bla bla bla ... access denied". I dont know why it happend, but I guess it happend because I just re-install my operating system last time. So, I had to go to sqlobject site, pyMSSQL site, and turbogear site. Finaly, I found something on python ADO-DB site, Its about an extention of python on Windows. So, after I installed this extention, my pyMSSQL can connected to our SQL Server Machine.

Then here comes another error message ... "can't commit" when I execute "tg-admin sql create" which are create our model class. It contains 5 classes. I dont know why, but I'll solve it somehow.

Saturday, February 04, 2006

Activate TG 0.9

A while back, I had a TG 0.88 installed on my machine, and then accidently I execute the setup.py intall from my TG trunk directory, and wollaa.... my TG broke down. I dont know why. Sorry, Im just a newbie on python world, so after long googling, I found that I execute TG 0.9 development source code to replace my TG 0.88.

So, in order to make my TG running again, I had to use TG 0.9, I dont mind about it, so here's the stuff that I had to execute first :

1. Install the pre-request. The RuleDispatch
easy_install -f http://peak.telecommunity.com/snapshots/ RuleDispatch

2. go to the TG 0.9 trunk directory and run this below command
python setup.py develop

3. go to on eachside of thirdparty directory which are cherrypy and sqlobject and run this below command on each of them
python -c "import setuptools; execfile('setup.py')" develop

4. Then the lasting is install the Nose for testing purpose
easy_install nose

and wollaa.... my TG is back
hehehehehehe

Friday, February 03, 2006

Mochikit on PHP

Hi there, hehehe, frankly enough huh ?
yes, I manage to run mochikit on my office project, built on top of php.
Here's the tips :
1. on your html file put a javascript like this one :


// define the DOCManager Object classes
DOCManager = function()
{ // define the property
this.target_div = getElement("response");
this.parameter = "&company_id="+ getElement("company_id").value +
"&grin_type="+ getElement("grin_type").value +
"&grin_no="+ getElement("grin_no").value +
"&ref_type="+ getElement("ref_type").value +
"&ref_no="+ getElement("ref_no").value +
"&order_no="+ getElement("order_no").value;
// bind the methods
bindMethods(this);
};

// define the DOCManager methods
DOCManager.prototype =
{
"loadDOC" : function()
{ alert( " will gonna define the JSON Doc" );
var doc = loadJSONDoc("{FRONTCOMPONENTURL}ajax/ajax.bedjo.php?task=search"+
this.parameter
);
alert( " define DOC, and we will proccess the doc" );
doc.addCallbacks(this.processDOC, this.errorDOC);
alert( "DOC process complete" );
},

"processDOC" : function(data)
{ alert("come to processDOC baby");
var rows = data.rows;
var cols = data.columns;
var newTable = TABLE({"id":"repeat_table", "name":"repeat_table",
"width":"100%", "border":"0", "cellpadding":"1",
"cellspacing":"0"},
THEAD(null, map(this.colDisplay, cols)
),
TFOOT(null, TR(null,
TD({"colspan":"3", "class":"sectiontableheader"}, " "),
TD({"colspan":"5", "class":"sectiontableheader"}, " ")
)
),
TBODY(null, map(this.rowDisplay, rows)
)
);
swapDOM('response', newTable);
},

"errorDOC" : function(data)
{
alert( data.message );
},

"rowDisplay" : function (data)
{
return TR({"class":"sectiontableentry2"}, map(partial(TD, null), data));
},

"colDisplay" : function (data)
{
return TR(null, map(partial(TD, {"class":"sectiontableheader"}), data));
}

};

function search_grin()
{ doc_manager = new DOCManager();
doc_manager.loadDOC();
};


Please remove the // sign in front of the tag, since It forbiden in here
and you have to made an on-click action on your submit-button, I'll bet you know what I meant.

2. Create the ajax file , I named it ajax.bedjo.php, and heres the sample code with a JSON and XML return doc :

$task = $_REQUEST["task"];


switch ( $task )
{
case 'create':
header("Content-type: text/xml");
echo "";
echo "";
echo "";
echo $action;
echo "";
echo "kembang jepun kembang krampung, aku mlembung kakean diambung ";
echo "";
break;
case 'find':
echo '[{';
echo '"id" : "8370",';
echo '"name" : "KANG BEDJO EMANG EMOY"';
echo '},';
echo '{';
echo '"id" : "8360",';
echo '"name" : "TESTING SODARA SODARA SEKALIAN"';
echo '}]';
break;
case 'list':
echo '{';
echo ' "columns": [[ "domain_name", "create_date", "expiry_date", "organization_name"]],';
echo ' "rows": [';
echo ' ["json.org", "2000-05-08", "2006-05-08", "Douglas Crockford"],';
echo ' ["mochibot.com", "2005-02-10", "2007-02-10", "Jameson Hsu"],';
echo ' ["pythonmac.org", "2003-09-24", "2006-09-24", "Bob Ippolito"],';
echo ' ["undefined.org", "2000-01-10", "2006-01-10", "Robert J Ippolito"],';
echo ' ["python.org", "1995-03-27", "2007-03-28", "Python Software Foundation"]';
echo ' ]';
echo '}';
break;
}

Ok thats all, now u can use it. Anyway this is a simple tutorial on using mochikit with php.

Ok, cu next

Friday, January 13, 2006

pymssql

After tried to run wiki20 demo, its time to try to connect to MS-SQL Server Database. The wiki20 demo used SQLITE db for their database backend. Its mean I have to modify the dev.conf file and change the SQLOBJECT db-URI from SQLITE configuration to MS-SQL configuration. But I remembered on my last visit to sqlobject, it seems they'd not yet support MS-SQL DB. So I take a chance to look at their website again and they said they on version 0.7, so I check my sqlobject package version, its older than the one in their website.

So, I go to dos-prompt and try to update our turbogears package with this command : "easy_install -f http://www.turbogears.org/download/index.html TurboGears", and its get all the latest package from TURBOGEARS website, such as cherrypy 2.1.1 and sqlobject 0.7. Then I had to download the pymssql, the python binding for MSSQL DB, I take the latest one, and installed onto my machine.

Then I take my dev.conf file on my project directory, and give the MSSQL DB-URI on it, and then I run "tg-admin sql create" on my dos-prompt. Woa, it says "Using database URI mssql://..." which mean I succesfully create all my object into MSSQL DB-URI.

Now, Its time to dig deep into SQLOBJECT.

Friday, January 06, 2006

Installed TurboGears

Hi there, This week I tried to give a look at turbogears.
I'd go to turbogears project homepage and start to took how to install the software on my Windowz machine with Python 2.4.1 engine.

Here's the step that I take :

1. download ez_setup.py
2. go to dos-prompt and run ez_setup.py, after it done then closed the dos-prompt.
3. after that... edit the environment variable and put ";C:\Python24;C:\Python24\Scripts" from My System Computer environtment variable edit box.
4. go to dos-prompt and go to your project directory and run easy_install -f http://www.turbogears.org/download/index.html TurboGears. It will imediatly download all the turbogears packages and install automaticaly into my windowz machine.
5. your packages should get download and install now.
6. If you wanna use the SQL Lite DB, then you have to download the python to sqlite binding. I take pysqlite. Run it and it will install on your windows machine.


Then, I download Wiki20 Demo Movies and try to run it on my machine.
So far so good. I'll see what I can do next. CU Next

Friday, November 18, 2005

Zope SIP Application

There was an anouncement on daily python about Simple Inventory Program, and I feel interest with this program. They said The SIP can run without ZODB instead they use Sybase and PostgreSQL as their Database backend.

If it is true, then the SIP wont store any metadata on ZODB, cause they dont use it. Then this is the feature that I've been looking for. This program run on top of Zope 3. On Zope 2.X, all our metadata should store at ZODB, now in Zope 3 it can be bypassed as The SIP claim. Another interesting one is SQLOS component which they use.

It would be good, since I like the Zope and their framework, but I dont like the way Zope 2.x store the metadata, that why I look on an other solution which Django and TurboGears offers. If I can make my application work like The SIP with Zope 3, I hope Twisted will join with Zope to give me an great power.

I'll check on this one later.