see whatever…

jump to menu

October 29, 2005

Database as model (and PHP, oooh)

Filed under: Programming,Web — see @ 9:20 pm

I am currently trying (just again another) database driven website which puts really most of anything in the database. I wonder to what extend even not really database data can be made to fit into the DB.

Ideally the database is self explanatory, meaning a small abstract CRUD framework is all to manage (not publish!) just about any (simple) website. For larger and more complex ones a complete CMS should propbably be used anyway which do seems most of times overkill for the small sites I am doing currently). So to manage the site anything to do is to build a set of database tables without having to write a single configuration file or programming logic about how the data is mixed together, at least not for the editor.

- E.g. I use the COMMENT of a table to be shown to an editor of the website to explain what this specific table if for.

- maybe not good style but I currently overload the field names with meaning. ‘id’ is always the ID, ‘ref_tablename_fieldname’ is always a reference to another table where the given fieldname is used to show it during editing.

- NULL or NOT NULL should be usable to define required fields

- the type can be used for the input frontend rendering, e.g. VARCHAR(30) gets an HTML input field with @maxlength=30 or DATE would be rendered as a date input of maybe three select dropdowns)

Nothing really new (I guess a bit more new for me) and I guess influenced by Rails too. I have not tried it (Rails) yet (and probably won’t for some time as for the websites I am stuck with PHP and being a Python fan tried Turbogears first of course) but as far as I know something like that is happening there too.

Of course the view which presents all data to the website user probably has to be adjusted but still should be reusable for at least some cases. (Of course just editing XML data which would be transformed to an HTML view later would separate this even better, but again probably a bit overkill here and would require XSLT on the server which may be too much for simple sites (to think about it, would actually be nice))…

Let’s see what comes out in the end…

Another note about PHP:
I always hated the language as being really ugly (all these $, lots of functions names nobody ever can remember etc). Being forced to use it made me somehow copy my coding style from Python to PHP. Indentation is a natural although I am sometimes wondering why for example an if does give an error but just because I ommitted both the ( ... ) and of course think everything that is indented belongs to the if-block ;) (BTW, same happens when I write Javascript, there even more as Javascript is more forgiving than PHP)

But also using foreach very often and instead of

if (...) {
   ...
} else {
   ...
}

using

if (...):
   ...
else:
   ...
endif;

seems to be directly come from Python. At least PHP is not too ugly anymore and sometimes even readable…

This is not a language rant (probably often a personal preference matter) but I don’t like PHP $var style and this is even more true for Ruby’s even topping use of modifiers $x @x etc…
Strangely enough I don’t mind usage of $var in XSLT but hey, that’s a totally different thing

Java then Ruby?

Filed under: Programming — see @ 8:51 pm

Noticing some “big” names of the Java world seem to move to Ruby. Seems all the “fault” of Rails…
I guess Rails is not bad but certainly there are other language options (which should even fit Java people better, e.g. Python/Jython). Of course I am biased here as I do like Python a lot although I don’t know Ruby enough to actually consider one them better or worse. But still strange how just a good marketing can pull people. I guess I thought programmers would be not that easy to catch with marketing stuff but seems they are human too (if that is a human treat anyway…)

October 26, 2005

Masterworks survey

Filed under: Comics — see @ 8:17 pm

just found the Marvel Masterworks survey 2005. Would be great if Marvel actually would release the ones I am most eager on… After being done with all volumes of Avengers I really would like to have at least all other missing issues till about #130. Problem is they are way to expensive to buy (on ebay or even more at specialized comic shops). A single issue can come to about 5-20 €, even in not the best condition. Same problem with Spider-Man issues, I’d like to see all issues until about #200…

Even if Marvel would release one Masterworks for each series a year it will take about 5 (Avengers) to 12 (Spider-Man) years :(

October 24, 2005

first steps with TurboGears

Filed under: Programming,Python,reStructuredText — see @ 10:22 pm

did the first steps of the TurboGears wiki tutorial. Looks very neat and I noticed it used docutils as well as kid which I already knew.

A problem I had but it was easily overcome: I have MySQL installed and needed the MySQLdb lib. Quite simple to find out but I guess it should be mentioned as probably quite a few people are using MySQL (e.g. when they come from a PHP background).

Otherwise it all looks new but very easy.

Not special for TurboGears I guess but I do like the ez_setup (eggs? need to look into that a bit more) which is really convinient. Something Python needed for a very long time.

Well, need to do some more tomorrow, too late already…

October 12, 2005

plans…

Filed under: cssutils,XSLT — see @ 6:08 pm

I wanted to continue working on cssutils but have more important stuff to do first. There are a few smaller projects (mostly websites) I need to do and plan to add multilangual support (english and german at least) to my own site as one of the small projects would actually be a website in english, german and japanese anyway so nice to do that at the same time.

Also for some time now I was planning to automate changes to this site. Currently (and somewhat embarrisingly) I write all pages by hand without even SSI or other helpful stuff (which I use heavily on cdot.de which is already partly based on XML/XSLT). I would be tempted to use something like TurboGears but would like to be independent of any server side technology. My current ISP does not have Python support anyway. So I guess I build a basic XSLT publishing “framework” (nasty word). This way I could add a simple XML CMS later which I wanted to do for some time now anyway.

Problem with most CMS systems seems to be that they are just huge with hundreds of functions. I was looking for a simple CMS (almost something like this blog) but found nothing really interesting. An AJAX based CMS which holds all content in XML (could internally be XML in a database, which still is a bit overkill without real XMLDBs which support at least XPath) and editing capabilities for basic stuff like structured text, tables and maybe images would be sufficient. Most CMS systems I saw so far (open source but also expensive ones) are just quite slow and just not usable enough for my taste. A CMS which only needs to support a small range of browsers (IE6, Firefox, Safari and maybe Opera 8) for its editing could then use all advanced new possibilites that e.g. AJAX presents without the need to use still somewhat and problematic stuff like Applets or the like.

Well, I hope I don’t have only plans but no time for their realization…

A new version of the cssutils parser definitely needs to be done too as I realized the current one is somewhat limited what it accepts…

Powered by WordPress