Archive for the 'Web development' Category

Another Short One…

Lipanj 21, 2006

I'm not really that much into writing these days, because I have my final high-school exams to prepare for Friday (keep your fingers crossed :)), but here's an interesting and extremely useful link found on Dado's blog.

It's a brillant reference service which offers references for many different languages (HTML, JavaScript DOM, CSS, PHP, My/PostgreSQL, RoR, Perl etc. – Python coming soon! :)), and it allows you to add and remove available references as you wish. It also has a cool search feature, and it's probably the dream of every developer :). I ran into something similar few months ago, but it was limited to a few languages (HTML, PHP, MySQL and CSS, if I remember correctly) and it didn't have any customization options.

So, here's the link: gotAPI.com. Enjoy!

Modifying a TinyMCE-powered Textarea

Travanj 18, 2006

TinyMCE is a great WYSIWYG JavaScript control which can easily convert any textbox on your site to a powerful WYSIWYG editor. The problem with TinyMCE is that it limits you – it filters out the HTML code, trying to keep the code it generates clean and standards-compliant.

Although there's really nothing wrong with that (it's nice actually), it causes trouble when you try to edit the textbox (using the DOM) from anything outside of TinyMCE – your own JavaScript, for instance – and refuses to insert any HTML into the textbox.

The workaround? Disable TinyMCE, make and apply your modifications and enable it again:

tinyMCE.execCommand("mceRemoveControl", false, elemid);
tinyMCEmode = false;
// the code for manipulating the text box
tinyMCE.execCommand("mceAddControl", false, elemid);
tinyMCEmode = true;

Note that you should replace the "elemid" variable with the ID of the HTML element you're modifying.

This also works from a popup window (assuming it has been opened by the page which contains the HTML element you want to modify): 

window.opener.tinyMCE.execCommand("mceRemoveControl", false, elemid);
window.opener.tinyMCEmode = false;
// the code for manipulating the text box
window.opener.tinyMCE.execCommand("mceAddControl", false, elemid);
window.opener.tinyMCEmode = true;

The same note for "elemid" applies here, too. 

There you go… And it wasn't that hard, either :). 

SciTE + UTF-8 / iPodLinux

Travanj 17, 2006

One of my favorite source code editors under both Linux and Windows is definitely SciTE. It's a small, compact text editor built to demonstrate the powers of Scintilla, a source code editing component for Windows and GTK+, but it soon grew to be a useful editor.

I use it almost exclusively (although I get some of the work done in Dreamweaver when I'm at work), but one thing bothered me – I couldn't make the UTF-8 support with the Croatian diacritic letters, like č, ć etc., to work correctly on Linux. The SciTE manual helps, but isn't very clear on this subject, so here's a way to enable that… Copy these lines and insert them into your SciTEUser.properties file (go to Options -> Open User Options File or manually edit / create the file ~/.SciTEUser.properties):

code.page=0
character.set=238
LC_CTYPE=hr_HR.UTF-8

That's about it. You can find other character set numbers on the SciTE documentation page.

I also found some time to try to install iPodLinux to my 1st generation iPod mini, and it wasn't successful at all. I tried to install the app both from Linux and Windows following the instructions on their website, but after the installation, the iPod just wouldn't boot – it showed some error icon on the screen with the Apple iPod support page URL written underneath.

I managed to bring it back to life using Dark and Mysterious Ways – by formatting it with the HP USB format utility (to FAT, not FAT32!), reinstalling the iPod software from the iPod CD, formatting it again when / if prompted by the iPod installation and restoring the old iPod firmware version (the one I got on the CD, from 2004 :)). Only then would my iPod finally boot – then I installed the latest version of iTunes and updated the firmware to the latest version. Simple firmware restore using the latest version of the firmware wouldn't work.

After the iPL installation failed for the second time (even from Windows), I decided it ain't worth the hassle of taking the above steps every time, so I gave up for now. I can't wait for the release of Rockbox software for the Mini 1G, but I hope it will work better than iPL.

web.py

Travanj 1, 2006

Creating web apps in Python, which is the language I use most for my programming needs right after PHP, has always been interesting to me. Of course I was aware of the CGI abilities of Python, but I never made myself study it. So, I kinda forgot about it and kept using PHP to write the web apps I've been developing ever since. But, then Harry Fuecks, a Sitepoint PHP blogger, wrote a post about a simple, yet effective web framework for Python.

As I didn't have any experience with any of the "modern" web frameworks, like RoR or Django (which is partially connected to my lack of interest for them, but that's something to write another article about), I was a bit sceptical towards it, but I decided to check it out after all. And I was surprised. Web.py is probably the most minimal, and yet the easiest to use web framework I had the chance working with. It comes with its own little web server which should be okay for most of your testing needs, but it can be integrated through FastCGI with lighttpd or Apache, or through mod_python with Apache for any other, more serious uses.

I really haven't used web.py for any serious work yet, but I've played with it for a while and I can say I'm pretty satisfied. The integration with Cheetah for templates is seamless (but you have to install Cheetah, though :)), and the same goes for MySQLdb. It also supports PostgreSQL for all of you who use it, too, via a third party library psycopg2. Of course, this is a relatively new project, so don't expect wonders, but it's really promising and, as far as I'm concerned, it's headed in the right direction. I'll keep playing with it and testing it, and I'll write some more about it when I find something interesting enough to write about.

'Till then, check it out.

Web Standards Checklist

Veljača 25, 2006

It's been a long time since I last wrote anything, but I've been pretty busy with some projects which will be published here soon… But, there's a nice link a friend of mine sent me, and it talks about web standards. In the days of Web 2.0, AJAX / Atlas and similar buzzwords, I think we (as we, web developers) somehow forgot about one very important thing. That thing was equally important in Web 1.0 as it is now, in the so-called Web 2.0, and that's writing clean, standards-compliant, semantically right XHTML and CSS code.

The article on Max Design talks about this specific subject, addressing some issues that are often forgotten or intentionally not taken care of, and it gives some nice links to articles which deal with the listed problems as well. It's a nice, well-written web standards checklist which can serve as an excellent reference for your future projects and, altough not new (it was written over a year ago), it's still valid. I sure know I'll use it.

PHP Object Generator

Siječanj 14, 2006

As a PHP developer, I often find it really annoying and tiresome to write similar database access code and SQL queries for each project I develop. OO helps, but when you work on two entirely different projects which demand different objects, you still have to write separate classes with the same tiresome code.

So, one day, while surfing the web, I found a web app written by some people who were annoyed by the same things, called PHP Object Generator. You enter the object name and its attributes in the app interface (actually, the attributes are your database fields) and the app generates the class with all the common SQL queries (commonly referred as "CRUD" – Create, Retrieve, Update, and Delete) and the SQL code needed to create the database table for your object. Pretty useful, I think.
While this isn't the complete solution for all your programming needs, it's still handy when dealing with some common DB things. And it's easy to use, too – the site has some neat tutorials and there's even a Google Group dedicated to the app. With a few tweaks here and there, the code generated by this little program can write most of your DB-related code for you and you can concentrate on the fun stuff instead :).

At the time of writing, the beta of the 1.6 version is available, and it introduces some neat features, like the setup script (which automatically creates the database for you and does some testing), more consistent naming scheme, "LIMIT" support (altough this one was easy to add even in the old version) and even scaffolding.

The authors point that they aren't planning on turning the PHP Object Generator into a PHP framework, and I sure hope they won't, because there are many PHP frameworks out there, but I don't know of any tool similar to POG. Try it, it's worth a shot :).

target=”_tab”

Prosinac 11, 2005

Tabbed browsing in actionAs a person who uses the Internet daily, and as someone who reads through dozens of websites per day, I learned to appreciate tabbed browsing. I couldn't stand the tought of being without my tabs and I completely forgot about the "Open Link in New Window" option.

As a web developer, I'd like to see tabbed browsing as a browser standard – something every browser should have by default. I really like the thought of being able to open links in new tabs, instead of new windows. Tabs aren't so intrusive and they don't clutter your desktop – that's a big advantage. Sometimes you just need to open that link in another window (or, shall I say, tab), and you just know it'll get on someone's nerves. Now, I'm not trying to say the tabs are the Absolute Solution to this problem, but I believe they are more appropriate and less annoying.

And should I even mention how nice it would be if the Document Object Model would reflect this change… :)