Thursday, November 12, 2009

Davide Pasca Ph.P.


I've been doing quite a bit of web development recently (and sleeping 5 hours per night 8).

It's actually a mix between developing, setting things up and scavenging plug-ins of sort.
For example, for tokyoclubbers.com I use WordPress as a base platform. It's for blogging, but it has so many plug-ins, themes, widgets.. that one can spend hours and hours just trying to pick what seems useful.

For example, I get daily updates of upcoming club events from www.iflyer.jp. This is in a form of RSS feed which I give to mloovi.com to get a feed translated in English to display on my site (mloovi.com actually uses Google Translate, and perhaps I should do this directly myself since mloovi.com seems to have quite a bit of downtime 8( ).
When mloovi.com works, the feeds translated that are coming are very slow (possibly because it translates them every time ?).
For this reason I wrote a simple cache system that gets the actual translated feed only 3 hours or so, and for the rest of the time, a local cache of the feed is used to render the page.

Another site I've been working on is romanstay.com (Under Construction !!) ..this is for an actual family business 8)
The pages ar emostly static, so I did this from scratch (aside from the base CSS template, done by some good soul that put it on-line for everyone to use).
More caching happening for this site. Pictures used in the page are kept at original resolution on the server and are used as a based to produce resized images for the actual page rendering.
Because images don't change, practically they only need to be resized once. This could be done offline, but I find it easier to do it in PHP on demand when developing.. this way, if decide that an image shoudl be 200 pixels wide instead of 220 pixels, I can change a parameter in the PHP of the page without having to open Paint.NET or run ImageMagick to resize that image once again.

The PHP code to display an image becomes something like this (1mg == img ..blogger goes crazy otherwise (^^;)):

OK FACKING BLOGGER CAN'T POST HTML-LIKE CODE NO MATTER WHAT !!

IMG_GetResized() is my function that generates a resized image to the desired new size.. if that size doesn't exist. Otherwise simply gives the name of the resized image.
In this case I want the new image to be 120 pixels in width and 0 for height stands for "don't care, keep aspect ratio". Resizing images has always been a pain on the web.. I wish that there was a standard for that !

All this PHP coding.. but, still, PHP doesn't seem too much like "coding" to me 8)
These web applications is where most of the programming effort seems to go nowadays.. but it's a world of scripts, where variables aren't scrictly typed, where one doesn't touch bits, doesn't worry about low level performance and one can't possibly worry about the concept of memory allocation, multiple cores.. etc etc.

In a sense, to me, real programming is what can be defined as system programming. On the other hand, efforts of the size of WordPress are really impessive.. and if one had to write a traditional application in C++ to do the things that WordPress does.. that would probably be much harder.
GUI and high level is probably going to be more the PHP/Python + browser way.. and possibly, programmers like me won't have to fight with things like MFC or wxWidgets to get some GUI that a PHP or JavaScript programmer can get up no time 8)

zzzzzzzzzzzzzz !

18 comments:

  1. last gui app that i wrote was a graph based shader editor. didnt use any mfc or widgets, i started by bringing up msdn help on CreateWindowEx(...) function!

    ReplyDelete
  2. That's a way to do it.. but I have a better way:
    In the real-time I implemented some remote commands by way of TCP/IP. Anyone can connect to the run-time and send commands like:

    /loadmaterial < material file name >
    /setmaterialparam < material file name > < param >

    ..then, the TAs used Python and QT to make their own shader graph editor 8)

    It's got a nice GUI, produces HLSL (a not so easy part that was done previously by the TAs) and feeds that material/HLSL file name to the engine for reloading when the shader changes.. or send a material parameter's new value to the run-time to see the effect on the fly.

    ..programmers like us are better off not messing with GUI.. it's too time consuming in C/C++.
    However finding skilled TAs is not easy either (^^;)

    ReplyDelete
  3. That graph based editor turned out to be a bad idea, it was too detailed for the Artists to use and TAs prefered to just write HLSL/Cg directly. I only mentioned it in the context of my GUI experience under windows.

    ReplyDelete
  4. I think that for most shaders, artists use graph based shader editors.. though for the more complex shaders there is always a need to write something in shader code.

    The TAs here are apparently quite pleased with their editor.. but then again, they made it themselves, so they should be 8)

    ReplyDelete
  5. Unfortunately you must convert the code with something like this:

    http://www.simplebits.com/cgi-bin/simplecode.pl

    By the way can you tell me why I cannot use cursors, home/end and copy and paste from your comment box?

    ReplyDelete
  6. ARGHHHHH STUPID BLOGGER AGAIN !!! I went to Preview.. it told me I'm not signed in and my reply was lost !!

    8(

    Anyhow.. about the HTML code.. It's just broken in Blogger. I used 'pre' and 'code' and replaced < and > with corresponding &_l_t_; etc..
    Blogger post editor messes things up.. converts to actual characters and then thinks that you tried to write HTML 8P
    (this happens for sure when switching between HTML and WYSIWYG view, but I think it happens even by simply editing the post a second time.. or I dunno what).


    About the (DAMNED !) comment posting box.. is this a recent issue ? Which browser are you using ?
    I'll do some tests here.. it could be the Friend Connect gadget thingie that I added recently.

    woooooo

    ReplyDelete
  7. Everything is broken on the internet

    ReplyDelete
  8. I am using Firefox 3.5.5, but it seems to be a on/off thing, now for instance the comment box works... :)

    ReplyDelete
  9. Umm.. maybe because I removed the Friend Connect gadget ?

    ReplyDelete
  10. There is a clear distinction between an easy web page nobody knows and a complex page with 5000+ cuncurrent users. Scalability is a big issue, the same of performance in a desktop app.

    Enterprise programming is quite different from single executable development, and I cannot decide which one is more complex. However, both have to be developed and scripted as requested, that's for sure.

    ReplyDelete
  11. I agree.. for example, I think that ebay mostly serves HTML pages.
    There may be PHP, Python and whatnot behind.. but why run some DB query to show a page, when you can cache the most used HTML results and show those cached pages instead ? 8)

    Also, spanning a page across servers that keep in sync must have its difficulties and it's going to require true expertise in the network field.

    What's more complex I'm not sure.. I think it depends on the project and what one actually has to do to get something done (PHP and Java for example have a lot of facilities that would require ages for a C++ programmer to implement from scratch).

    In my career I learned that nothing should be discredited as "simpler".
    Some say that game development is the toughest, etc etc.. I don't believe that. There is always something to learn from other related fields and being an asm or a Direct3D wizard is not really going to make everything else easier.

    moooooo

    ReplyDelete
  12. Look what I have found in blogger's editor under "post options":

    Compose Settings
    [ ]Interpret typed HTML
    [ ]Show HTML literally

    BTW the frikking comment box is vroken again, it has to do with something on the page, because loading its frame only works...

    ReplyDelete
  13. And now that I have posted the comment, copy&paste and the arrow keys work even on the page...

    Mboooo!!

    ReplyDelete
  14. Interesting.. I'll have to try that setting, if I didn't already.
    Notice that the explanation itself is probably facked-up.
    In the answer they are trying to type < bold > but the brackets just won't show up.. 8P

    About the comment box.. ummm maybe I should just switch to WordPress. Most of the times, the first preview fails and I have to try again. umm ummm

    If you can move the cursor on the page.. then maybe you have Firefox in that weird mode (F7) ?

    maoooooo

    ReplyDelete
  15. Nope, weird (caret) mode is off.
    Still I cannot move with cursors or copy/cut/paste.

    Maybe you should just put te comment box in a separate page. :)

    ReplyDelete
  16. ..well.. tough beans for you !!!

    ..ehehe just kidding.. I'll probably move to WordPress instead of having the comments on a separate page.

    Recently I've been losing my faith towards Google.. too much unfinished work... including Blogger, which is, for the most part, in a state of abandonment.

    woooooooo

    ReplyDelete