Wednesday, October 22, 2008

How to run (develop) GWT with JBOSS or how to serve symbolic links with jboss as static content

To serve static content under JBOSS 4.2.2, you should put it inside ROOT.war folder (deploy/jboss-web.deployer/ROOT.war).
Very often necessary to make an links to the some content, but not actually to copy it.
For this reason linux users do ln -s, to create an symbolic link to folder.

By default jboss ignoring those created links.
To fix this, you should add < DefaultContext allowLinking="true" > to the server.xml file.

Hope it helps to everybody, who is trying to run GWT compiler with JBOSS server.

Tuesday, October 21, 2008

How to develop GWT without server

In the last project, i worked, we did GWT client connected with server using RESTfull API.
So, we have completly separate server and client. It has some benefits, if for example you have an server API, which is reusable with other clients, not like GWT.

So, the main problem is how to connect GWT with Server from configuration point of view.
create some bash file, like noserver.sh

#!/bin/sh
APPDIR=`dirname $0`;
GWT_HOME='/usr/local/tools/gwt-linux-1.5.2/'
java -Xmx256M -cp "$APPDIR/src/lib/gwt-log-2.5.2.jar:$APPDIR/src:$APPDIR/bin:/usr/local/tools/gwt-linux-1.5.2/gwt-user.jar:$GWT_HOME/gwt-dev-linux.jar" com.google.gwt.dev.GWTShell -out "$APPDIR/www" -noserver -port 8080 "$@" com.example.Main/Main.html;


then you need to setup some server: jboss, tomcat, jetty to serve statically a folder
inside your gwt projects, something like www.

after you did it, run your server.

Then run the nserver.sh to run GWT.

Tuesday, October 7, 2008

Adding a web counter to the blog

Decided to add a web counter to my blog.
It was very easy to do.
First of all, i went to the www.gostats.com and register account for ljvjonok.blogspot.com,
then went to the blog layout management, select menu add gadget (html/javascript). Done :)

GWT SuggestBox: how to make multiple result

GWT offers a lot of nice components, but i was surprised, that they don't have SuggestBox as gmail has, where you can have several suggestions as a result.
So, at the beginning i wanted to subclass a SuggestBox, but found, that it is a final :(
Then decided to create MultipleSuggestBox from scratch. Did it, and than fount a hack way to do the same, but much simpler! There is a solution.


/**
* MultipleTextBox allow to have multiple suggestions at a result, separated by
* comma, like gmail has at compose message field "TO", "CC", "BCC".
*
* @author Viktor Zaprudnev
*
* Usage:
* SuggestBox(oracle, new MultipleTextBox());
*/

public class MultipleTextBox extends TextBoxBase {
/**
* Creates an empty multiple text box.
*/
public MultipleTextBox() {
this(Document.get().createTextInputElement(), "gwt-TextBox");
}

/**
* This constructor may be used by subclasses to explicitly use an existing
* element. This element must be an <input> element whose type is
* 'text'.
*
* @param element
* the element to be used
*/
protected MultipleTextBox(Element element) {
super(element);
assert InputElement.as(element).getType().equalsIgnoreCase("text");
}

MultipleTextBox(Element element, String styleName) {
super(element);
if (styleName != null) {
setStyleName(styleName);
}
}

@Override
public String getText() {
String wholeString = super.getText();
String lastString = wholeString;
if (wholeString != null && !wholeString.trim().equals("")) {
int lastComma = wholeString.trim().lastIndexOf(",");
if (lastComma > 0) {
lastString = wholeString.trim().substring(lastComma + 1);
}
}
return lastString;
}

@Override
public void setText(String text) {
String wholeString = super.getText();
if (text != null && text.equals("")) {
super.setText(text);
} else {
// Clean last text, to replace with new value, for example, if new
// text is v.zaprudnevd@gmail.com:
// "manuel@we-r-you.com, v" need to be replaced with:
// "manuel@we-r-you.com, v.zaprudnevd@gmail.com, "

if (wholeString != null) {
int lastComma = wholeString.trim().lastIndexOf(",");
if (lastComma > 0) {
wholeString = wholeString.trim().substring(0, lastComma);
} else {
wholeString = "";
}

if (!wholeString.trim().endsWith(",")
&& !wholeString.trim().equals("")) {
wholeString = wholeString + ", ";
}

wholeString = wholeString + text + ", ";
super.setText(wholeString);
}
}
}
}

Friday, February 29, 2008

Солнце, Солнце! Это не только свет но и горячая вода да жужжащий холодильник

Додумались же люди ... делать солнечные магистрали... Пока еще тесты, но, представьте себе как это будет актуально на фоне глобального потепления...
http://www.tarmac.co.uk/Asphalt/
http://www.siliconvalley.com/ci_7850397?source=most_viewed
http://www.livemint.com/2007/12/31164114/Harnessing-sun8217s-rays-fr.html

Cyprus: Are we being bought out?

Интерестое заглавие, говорящее о том, что киприоты боятся, что остров скоро будет скуплен.
Приводятся интерестные факты:

1) Larnakas beach properties price for one year should be raised from 200`000 to 300`000 billions.
2) Appears companies from Russia and China, who is looking in Cyprus properties for prices around 200, 300 millions of funds...
3) The some situation in Greece, but, Greece is bigger.

Все это говорит о продолжающемся росте цен на недвижимость... а хорошо ли это или плохо, зависит, сможете ли вы это использовать с польой ...

На мой взгляд статейка чисто рекламная с целью удержать как можно дельше цены от краха :)

Tuesday, September 4, 2007

Снова как в первом классе

Блин, ощущение как будто я в первом классе, откуда нафиг взялась застенчивость?
Блин, зная что тормозишь, все с тем же рвением жмешь неправильную педаль.