open ways. free horizons. mind at ease.
Главная
portfolio designers contact

How-To's

Client-Server Interaction Via JavaScript

February 22nd, 2010

The idea is to display a server response without reloading the page. Say, the user opens a catalog page and adds N items to her/his shopping cart. Without requesting a new page, the web site application sends the data (unit_id, amount) to the server, receives confirmation from the server, and updates the cart display on the same page.

The platform chosen for this functionality is AJAX – based on the following comprehensive introduction: Asynchronous JavaScript Technology and XML (Ajax) With the Java Platform.

  1. We will need some PHP-generated XML, so let’s start with a simple script: <?php header("Content-type: text/xml"); echo "<message>hello</message>"; ?>

to be continued…

Check the syntax of a PHP script before uploading

December 18th, 2009

Saves you some time and nerve. Especially when you’ve been writing code for a while, check it locally before you upload it to a remote server, even to a test site.

php -l ~sites/mysite/functions.php

This -l option means “check syntaxt only”.

Simple? Yes, and that’s the point!

Converting DVD video for the web (QuickTime .MOV)

November 11th, 2009
Here I’d like to share my good experience in posting video on the web. I sometimes get video from a client in the form of a DVD. Of course, the high quality, low-compression (mpeg2) of a DVD video would be an overhead if put on a web site as it is, so some conversion is necessary. After some experiments, trials and tribulations, I came to using two free utilities streamlined in this order.
  1. First, we need to turn DVD video into an editable file to work with, this is done by HandBrake, which produces an .MP4 file for every track of the subject DVD. Tip: it is a good moment to scale down your video to minimize the space occupied by the files you will edit at later stages.
  2. When you have the .MP4 files, drag them into MPEG StreamClip. They will form a seamless video footage you can edit as a whole. The editing capabilities of StreamClip are very basic, so if you need, for example, a caption or fade out, you will have to look for a more advanced video editor. However, in simpler cases when you just want to cut ads or other undesired bits, just mark them IN and OUT and select Cut from the menu.
  3. When done editing, select Export to QuickTime, choose a compression method (I opt for Apple MP4 codec), quality (the default 50% is good), video bit rate (say 500kbps), then sound options (32kHZ 128kbps MP3 stereo or even mono would satisfy most web viewers) and – very important – check Fast Start. The latter option will allow the browsers to start showing the video on-the-fly, just when the viewer clicks the link to your video file on the web server.
  4. Press the Make Video button and after a while you have your .MOV file ready to be put on a web site and linked just like this: <a href=”my_movie.mov”>my_movie</a>
Enjoy, comment, and please drop by for updates!