Java on Web

It’s well known, that in RIA development there is using, as a rule, Flash/Flex, JavaScript and promising HTML5. The latter appeared not so long ago and it’s not so common as the first two technologies.

However, there is still solutions to integrate the multimedia content into the Web pages. I have long been interested in Java Applets, a technology that allows RIA to develop in Java using the power of JRE and Java platform (core, swing/awt, javamail, jdbc, etc).

What, in theory, could give us the use of applets?

  • Cross-platform solution. There are JRE implementations for vast majority of operating system and specification ensures that the Java program will behave equally, regardless of OS on which it is running.
  • The possibilities are endless. Unlike most common RIA technology at the moment — Flash — Java applications have great potential. Java platform is flexible in tuning and expanding, it’s а priori true for third-party libraries in Java. On the toher hand, on Flash, the developer provided a broad platform, but not fitted to a simple extension. Simply put, the Flash, you can quickly build a model solution, but if you need support, say, a non-standard data exchange protocol, will have to work hard on it.
  • Performance. In my opinion, Java applications are less demanding on computer resources than the application of the same level in Flash. This is facilitated by JIT and the possibility of low-level access to the graphical user’s system. By the way, the second appeared in Flash version only 10 and in the truncated form.
  • And finally, as a Java-programmer, more interesting and easier to write applications in a native language

To test, I sketched out a simple application with a Java Applet using Swing. The application consists of a field in which the user enters his name. After pressing Enter, there greeting line. Theoretically, the applet should be visible immediately after the proposal (at least I hope so).


Cool, isn’t it? However, while writing an applet, I realized that this is not a killer of Flash. Incidentally, in the light of recent changes in the composition of the owners of Java and related technologies, as well as their decisions, I think Java Applets never become established. What did I not like?

  • Hasn’t run in Safari. While having the Java Console, where I saw an error and stack trace, I’ve not managed to find its cause. By the way, even a Java applet from the site of Oracle, which checks for a browser to run applets in Safari, does not display correctly (while scrolling noticeably “blinking”)
  • Complexity of JNLP. JNLP protocol describes a Java Applet to the JRE on the client side for JRE to “know” how an applet should be run, what security permissions to request from the user, and so on. The fact that Oracle does not provide a convenient tool for creating and editing the file, but its structure is quite complicated and extensive. Since Flash is much easier.
  • No distinct debug in browsers. I could not find an opportunity to open the Java console in Google Chrome, but as deliberately leaving an error in the code (in this case can call the popup menu applet and display console). It is worth noting that the JRE allows applets to run both client applications and easy to debug them. However, tuning and debugging in release, ie a browser, it seems to me hard.

Do not see any need to use applets. On most computer users already have the runtime Flash, users with an installed JRE is much smaller. In addition, the submitted application, I would write to the Flash for 10 minutes without taking the time to write the JNLP description and find out why the applet not work in Safari.

Fair to say that Java is used on Web pages. However, for the most part, this server-side code that generates any kind of document that is sent to the client (HTML, XML, image). I’ve seen some good applications that generate images for the site in real time. However, it is not applets, and that is another story.

,

7 Comments

Извините, на вашем счете ноль доллар, досвидания

Интересный глюк приключился с SIP от корбины. Мило посылает по грибы при поптыке позвонить, хотя деньги на счете есть. Причем посыл не может не радовать.
Ноль доллар, досвидания (mp3)

15 Comments

Некорректная работа java.net.CookieManager

При работе с классом java.net.CookieManager иногда возникают странные баги. Например, следующий фрагмента кода будет работать с указанным URL, но с некоторыми другими не будет:

String urlString = "http://java.sun.com";
CookieManager manager = new CookieManager();
CookieHandler.setDefault(manager);

URL url = new URL(urlString);
URLConnection connection = url.openConnection();
// force cookie processing
Object content = connection.getContent();

CookieStore cookieJar = manager.getCookieStore();
List HttpCookie> cookies = cookieJar.getCookies();
for (HttpCookie cookie : cookies) {
  System.out.println(cookie);
}

Под катом подробнее.
Read the rest of this entry »

,

22 Comments

Список всех Jabber конференций

В процессе изучения Groovy получился приятный сервис – Список всех Jabber конференций. Класс Analyzer, написанный на Groovy анализирует XML, полученный с jabberes.org со списком серверов, и опрашивает каждый из них, получая список конференций. На выходе получается XML файл, который можно просмотреть здесь.

Интересующиеся могут ознакомиться с исходным кодом анализатора. Использовать класс очень просто:

def cache = new File("conferences.xml")
def writer = new FileWriter(cache)
new Analyzer("jabber.ru", "lena1988", "pass").analyze(writer);
writer.flush()
writer.close()

, ,

30 Comments

Контакт – обновление

Тип: основное

  • Восстановление пароля
  • Подсказки для новых пользователей
  • Много новых шрифтов для генерации изображения
  • Изменилась палитра для выбора цвета шрифта и фона
  • В качестве логина теперь принимается только адрес E-mail, который будет первым контактом в списке

Всем пользователям, зарегистрировавшимся ранее, следует пройти процедуру регистрации снова, так как теперь в качестве логина может быть только E-mail адрес.

Как и ранее, страница входа в систему доступна по адресу http://majus.us/contact/ogin.jsp

Если у вас есть предложения по добавлению каких-то шрифтов в список генерации изображения, свяжитесь со мной или добавьте комментарий здесь.

Желаю всего хорошего.

16 Comments

Настройка ACORP W422G для Корбины

Потратив две недели на настройку модема, обсуждения на форумах Acorp, удалось наконец настроить этот модем для работы с провайдером Корбина.

Мне требовалось поднять VPN соединение Корбина на самом модеме и раздать интернет двум стационарным машинам по Ethernet и КПК по WiFi.

Скриншоты настроек под катом.

Read the rest of this entry »

18 Comments

Тернарный оператор

Что выведет этот код?

class Main {
   
    public static void main(String[] args) {
        System.out.println(get(1));
        System.out.println(get(null));       
    }
   
    public static Integer get(Integer in) {
        return true ? in : 0;
    }
}

12 Comments

Баг во Flash CS4

При реализации в AS3 подобия иерархии классов коллекций Java натолкнулся на интересную проблему:

// Set.as
package ru.majus.util
{  
    public interface Set
    {
        function put(o:*):Boolean;     
        function contains(o:*):Boolean;    
        function remove(o:*):void;     
        function size():uint;      
        function isEmpty():Boolean;    
        function clear():void;
    }  
}
// LinkedSet.as
package ru.majus.util
{
    public class LinkedSet implements Set
    {
        // ...

        private var _head:Item;
        private var _tail:Item;
    }  
}

class Item {
    // ...
}

При попытке компиляции выдавало веер ошибок (по одной на каждый реализованный метод):

1044: Interface method size in namespace ru.majus.util:Set not implemented by class ru.majus.util:LinkedSet.

Оказалось, проблема глобальная. Это баг в Flash CS4.
Решается переносом класса Item в отдельный файл. На форумах различных библиотек на AS3 уже появились сообщения о невозможности их использования на CS4.

,

10 Comments

Контакт – обновление

Контакт

Тип: основное

  • Палитра для выбора цвета шрифта и фона
  • Возможность сглаживания шрифта
  • Возможность выбора конкретного размера шрифта от 10 до 32 пунктов
  • Проверка формата введенного контакта посредством ajax
  • Установка заголовка Content-Type для HTTP-ответа генератора изображения
  • Сброс кэша изображений для пользователя при внесении изменений в список контактов

Как и ранее, страница входа в систему доступна по адресу http://majus.us/contact/login.jsp

Желаю всего хорошего.

10 Comments

Начало

Контакт – сервис, представляющий ваши контактный данные в виде изображения. В таком формате вы можете быстро вставить ваши контакты в сообщение на форуме, блоге или на своей домашней странице.

Сервис прост в использовании:

  1. Укажите свои контактные данные.
  2. Сохраните у себя ссылку на ваши контакты.
  3. Вставляйте ссылку в ваши сообщения на форуме так, как будто вы вставляете ссылку на изображние.
  4. Ваши контакты будут отображаться на форуме каждому посетителю.

Преимущество сервиса в том, что вы в любой момент можете поменять свои контакты: удалить не актульаные или добавить новые – эти изменения сразу же подействуют везде, где вы использовали контакт.

  1. Измените ваши контактные данные.
  2. Ваши данные обновлены везде, где вы их использовали.

Еще одно немаловажное преимущество – защита от спама. Ваши контакты отображаются где бы то ни было в виде изображения, поэтому спам-боты не могут получить ваш E-mail адрес или номер ICQ. Как следствие – свободное от спама средство общения.

Пример того, как могут выглядеть ваши контакты:




My contacts
My contacts

Для начала работы с сервисом необходимо зарегистрироваться. Процедура регистрации чрезвычайно проста и не займет много времени.

10 Comments