Monday, May 4, 2015
Friday, May 1, 2015
Google DI Guice - @ImplementedBy
The content below is taken from here:
http://blog.decaresystems.ie/2007/06/14/juicy-code-with-google-guice-part-4/
All parts about GUICE from the same source:
Part 2 – First Code
Part 3 – Dependency Injection
Part 4 – @ImplementedBy and Annotating Bindings
Part 5 – Custom Providers and Conclusions
http://blog.decaresystems.ie/2007/06/14/juicy-code-with-google-guice-part-4/
All parts about GUICE from the same source:
Part 2 – First Code
Part 3 – Dependency Injection
Part 4 – @ImplementedBy and Annotating Bindings
Part 5 – Custom Providers and Conclusions
As I mentioned in the previous blog entries, you configure Google Guice by creating a class that implements the Module interface or better, one that extends AbstractModule class. In this class you specify the bindings that logically connects implementations to interfaces. However, there’s a way that lets you create the bindings using annotations without needing to write the code in a Module implementation. You can do that using the@ImplementedBy annotation decorating an interface.
Let’s see a quick example:
1
2
3
4
5
6
7
8
| import com.google.inject.ImplementedBy;@ImplementedBy(MobilePhone.class)public interface Phone {public void ring();} |
The simple interface above is decorated with the @ImplementedBy annotation and the name of the implementer is specified as a single attribute.
1
2
3
4
5
6
7
| public class MobilePhone implements Phone {public void ring() {System.out.println("It's playing some annoying melody...");}} |
Thursday, April 30, 2015
UX research - Label Placement in Forms
Read this article:
http://www.uxmatters.com/mt/archives/2006/07/label-placement-in-forms.php
http://www.uxmatters.com/mt/archives/2006/07/label-placement-in-forms.php
Conclusions
Some interesting guidelines arose from this brief analysis of our test results. Coupling the following guidelines with Luke Wroblewski’s form design guidelines will help you to build the best form possible in each different situation.- Label position—Placing a label above an input field works better in most cases, because users aren’t forced to look separately at the label and the input field. Be careful to visually separate the label for the next input field from the previous input field.
- Alignment of labels—In most cases, when placing labels to the left of input fields, using left-aligned labels imposes a heavy cognitive workload on users. Placing labels above input fields is preferable, but if you choose to place them to the left of input fields, at least make them right aligned.
- Bold labels—Reading bold labels is a little bit more difficult for users, so it’s preferable to use plain text labels. However, when using bold labels, you might want to style the input fields not to have heavy borders.
- Drop-down list boxes—Use them with care, because they’re so eye-catching. Either use them for important data or, when using them for less important data, place them well below more important input fields.
- Label placement for drop-down list boxes—To
ensure users are immediately aware of what you’re asking for, instead
of using a separate label, make the default value for a drop-down list
box the label. This will work for very long lists of items, because a
user already has the purpose of the input field in mind before the
default value disappears.
Tuesday, April 28, 2015
Sunday, April 26, 2015
Saturday, April 25, 2015
Install Tomcat on Ubuntu
sudo apt-get update
sudo apt-get install tomcat7
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-ubuntu-14-04-via-apt-get
If Tomcat had been installed correctly you should be able to see the info below by url: http://localhost:8080
This is the default Tomcat home page. It can be found on the local filesystem at:
Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with
You might consider installing the following packages, if you haven't already done so:
tomcat7-docs: This package installs a web application that allows to browse the Tomcat 7 documentation locally. Once installed, you can access it by clicking here.
tomcat7-examples: This package installs a web application that allows to access the Tomcat 7 Servlet and JSP examples. Once installed, you can access it by clicking here.
tomcat7-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.
NOTE: For security reasons, using the manager webapp is restricted to users with role "manager-gui". The host-manager webapp is restricted to users with role "admin-gui". Users are defined in
sudo apt-get install tomcat7
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-ubuntu-14-04-via-apt-get
If Tomcat had been installed correctly you should be able to see the info below by url: http://localhost:8080
It works !
If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!This is the default Tomcat home page. It can be found on the local filesystem at:
/var/lib/tomcat7/webapps/ROOT/index.htmlTomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with
CATALINA_HOME in /usr/share/tomcat7 and CATALINA_BASE in /var/lib/tomcat7, following the rules from /usr/share/doc/tomcat7-common/RUNNING.txt.gz.You might consider installing the following packages, if you haven't already done so:
tomcat7-docs: This package installs a web application that allows to browse the Tomcat 7 documentation locally. Once installed, you can access it by clicking here.
tomcat7-examples: This package installs a web application that allows to access the Tomcat 7 Servlet and JSP examples. Once installed, you can access it by clicking here.
tomcat7-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.
NOTE: For security reasons, using the manager webapp is restricted to users with role "manager-gui". The host-manager webapp is restricted to users with role "admin-gui". Users are defined in
/etc/tomcat7/tomcat-users.xml.Friday, April 24, 2015
How to use TextResource in GWT ClientBundle (link)
interface Resources extends ClientBundle {
Resources INSTANCE = GWT.create(Resources.class);
@Source("a.txt")
TextResource synchronous();
@Source("b.txt")
ExternalTextResource asynchronous();
}
// Using a TextResource
myTextArea.setInnerText(Resources.INSTANCE.synchronous().getText());
// Using an ExternalTextResource
Resources.INSTANCE.asynchronous().getText(new ResourceCallback<TextResource>() {
public void onError(ResourceException e) { ... }
public void onSuccess(TextResource r) {
myTextArea.setInnerText(r.getText());
}
});
http://www.gwtproject.org/doc/latest/DevGuideClientBundle.html#TextResource
Wednesday, April 22, 2015
Encoding configs of Maven pom.xml in GWT project
<properties>
<java.version>1.7</java.version>
<resources.encoding>UTF-8</resources.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
<java.version>1.7</java.version>
<resources.encoding>UTF-8</resources.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...
Tuesday, April 21, 2015
SQL - good workbook in Russian, part 5
PART 1 - http://habrahabr.ru/post/255361/
PART 2 - http://habrahabr.ru/post/255523/
PART 3 - habrahabr.ru/post/255825
PART 4 - habrahabr.ru/post/256045
Часть пятая — habrahabr.ru/post/256169
Здесь мы в общих чертах рассмотрим работу с операторами модификации данных:
PART 2 - http://habrahabr.ru/post/255523/
PART 3 - habrahabr.ru/post/255825
PART 4 - habrahabr.ru/post/256045
Часть пятая — habrahabr.ru/post/256169
В данной части мы рассмотрим
Здесь мы в общих чертах рассмотрим работу с операторами модификации данных:
- INSERT – вставка новых данных
- UPDATE – обновление данных
- DELETE – удаление данных
- SELECT … INTO … – сохранить результат запроса в новой таблице
- MERGE – слияние данных
- TRUNCATE TABLE – DDL-операция для быстрой очистки таблицы
Subscribe to:
Posts (Atom)

