Month: June 2004

  • Create a low end database program

    Punkish made the suggestion in one of the comments (actually the only comment) back on May 29th about adding an actual database to SQLEditor and turning it into a database program. The more I think about this the more I like the idea so it may end up happening. Although it will be a separate program from SQLEditor. SQLEditor will continue as it is because I need it that way for various projects myself.

    BTW: The new cocoa version of SQLEditor is about to be released into public beta. Probably either today (Sunday) or tomorrow (Monday).

  • Popup cat and mouse

    Can’t stop the pop-ups | CNET News.com

    The cat and mouse game between web site publishers, advertisers and site visitors continues. The latest thing is popup adds that avoid getting hit by popup blockers.

    I’m kind of preferring either regular banner ads or the type of ad that appears in the main window before the page. In one way if I see an add that takes up the whole page I surely more likely to look at it, and it doesn’t affect the body of the actual page itself. Yahoo groups is using this type of ad quite a bit and it doesn’t actually seem as annoying as the floating adds I get elsewhere. Salon.com allows you to get a free membership if you watch a longer in window ad. I think for premium content this could well be a step forward.

    I guess people are different but maybe if sites asked what kind of ads people wanted it might be useful information. Maybe some people would like banner ads in the middle of articles, while others prefer floating ads that cover the story and then disappear. A third category might really like popup ads. (Although I’m not sure why).

    Advertising is fairly necessary for free access content so it probably isn’t going away. I think the important thing is for people to see it, yet for it not to be too annoying.

  • Overlapping NSViews in cocoa

    One thing that is desperately obvious when rewriting a java application to cocoa is overlapping views. In java you can often overlap swing components as long as they are lightweight (not operating system controls for instance). The cocoa documentation says that you shouldn’t overlap view components. This presents something of a problem obviously. How do you make such a significant change?

    Currently SQLEditor uses NSViews for it’s onscreen rendering, however since the tables and comments can be freely dragged around there are three possibilities:

    1. Use overlapping views and hope that nothing serious happens
    2. Don’t allow views to overlap by restricting the ability of the user to drag them around
    3. Rewrite the display code to use some other class instead of NSView and render the objects by hand

    I’m still thinking about the best way of doing this. (1) is the current solution, I don’t like (2) and (3) looks like lots of work.

    I think the best plan is to find out if (1) works on 10.3 and go from there. One approach that I am seriously considering is to rewrite the container class instead and continue to use NSView subclasses for the subcontainers.

  • Static vs Dynamic content on websites

    One of the big things over the last few years in websites has been the rise of dynamically generated sites. Instead of writing each page by hand developers use languages like php, perl and python to create pages. Websites are written as if they were software programs.

    Microsoft in particular makes it very easy to produce sophisticated websites. The .net architecture allows you to deploy programs in different ways and makes it easy for you program to become a webpage by writing a few new forms and connecting the dots together.

    But should web pages be programs?

    Obviously there are some things that must be dynamically generated: Shopping carts, interactive content, online games, etc. But there are a lot of sites with fairly static content that are using dynamic systems. Why?

    The answer is pretty simple. It makes life easier. With dynamic content sites you can reuse bits of code really easily. Need a common toolbar? Add a line of code and it appears. Need to produce 5000 different product pages? Write a template that grabs data from a database.

    But is this really the right way to go?

    The main problem that always hits dynamic sites is performance. If you invest enough you can get excellent performance, but it will not usually be as efficient as writing a site using static HTML pages. The static page has to be read from disk and sent to the browser. The dynamic page has to be read from disk, the program executed and the result sent to the user. The program execution time might be significant and various things may make it slower yet, particular if there is a database involved. This tends to affect scalability more than raw performance. The overhead of serving a single page to a single user is unlikely to cause problems no matter how inefficient. If you’re serving a page to a million visitors then scalability is very important.

    As so often happens in computing there is a tradeoff. You can cache everything and you might get better performance but you have to store it and manage it.

    This is more useful in some situations than others so you have to really think about what exactly you want to do.

    There are also strategies like pre-compiling scripts and code accelerators that can help by reducing the execution time of the dynamic pages. This approach can be extremely sucessful if you need dynamic content.

    So the question to be answered is: how dynamic do you need the site to be?

    Many sites that I visit are much more dynamic than they need to be. Some of the sites that I’ve created myself fall into this category.

    If the content isn’t changing for each user then you have to ask whether a dynamic approach is correct. In many cases it probably isn’t.

    This is especially true of news sites. Many news and commentary sites I visit use dynamic page generation. Yet they aren’t customizing the page for me at all. Are the adverts customized? I guess they must be, but advertisers handle advertising in their own way whether the page is dynamic or static. The main body of the page isn’t changing.

    Of course for all I know the sites may be using some kind of internal caching system (and I really hope that they are). But it becomes clear that many are not. Witness how many sites that get slashdotted go down with database errors. (As this one would probably do if the link ended up on slashdot. WordPress doesn’t seem to cache anything, although I think there is an output cache plugin which I’m hoping to try soon)

    One approach that can be used quite sucessfully is a hybrid system. Pages are produced using a dynamic system and then rendered statically. This reduces the overall load considerably because the page is only rendered once. It saves storage because only pages that are actually viewed need to be cached.

    If you ever get really stuck and you know you’re about to get slashdotted or something there is sometimes a simple solution. If works if you’re using php, you need immediate caching and you have a site structure using directories (e.g /pagename/). You can use wget to grab a static copy of the page and save it as index.html. This will usually cause apache to display the static page instead of a dynamic php page. Although you have to remember to delete the index.html file before making changes to the dynamic page.

    Of course the best approach is probably a reverse proxy cache. But that’s a bit much for most sites.

    So the key conclusion is: make your sites only as dynamic as they need to be.

    [This entry has been completely rewritten from the prevous version by AngusHardie]

  • SQLEditor Beta 3 (kindof)

    SQLEditor Cocoa Beta 3 is making good progress. The only things remaining for the current beta are:

    • Finish the menu handing
    • Write some help

    It now pretty much supports importing java version saved files although it’s still having trouble with foreign key support. Which is annoying me a bit but I think the current stage is reasonable to go on with until I can devote a bit more time to it.

    Next step is probably to look at implementing more SQL structures and improve compatibility with the standard. I’m particularly interested in developing view support.

  • SQLEditor drag and drop

    David was commenting that drag and drop from the java version of SQLEditor was handy, so it’s returned!
    I implemented a new floating window which allows the user to drag and drop objects onto the main canvas. Which seems to work quite well. It doesn’t replace the existing menu options but it provides an easy and intuitive way to add objects. At least I hope it does…

  • Sugar Syrup Kind of works

    I tried making sugar popcorn with sugar syrup yesterday and it pretty much works. Although I used icing sugar (because I had surplus) and I think next time I’m going to try using granulated instead. I found that melting it with about a spoon or so of water seems to work although now I’m only metlting it to the point where it becomes liquid.
    The first time I tried it I cooked it longer and ended up with a caramel like consistency, which is ok, but not really what I’m looking for. Although I might come back to that style at a later date.

    The basic idea is that you melt the sugar and pop the corn separately, then combine after cooking.