java:index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
java:index [2014/01/07 07:51] – rlunaro | java:index [2024/10/05 17:13] (current) – rlunaro | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Apuntes de Java ====== | ====== Apuntes de Java ====== | ||
- | Varias notas sobre java. Al que quiera entender, que entienda. | + | Varias notas sobre java. |
- | | + | |
- | | + | <WRAP column 30%> |
- | * [[howToMakeALinkLookLikeAButton|How to make a link look like a button]] | + | **Application servers** |
- | * [[webdav|Java webdav]] | + | |
- | * [[javadoc|Javadoc made easy]] | + | * [[Jboss|Jboss]] |
- | * [[jsp|JSP]] | + | * [[Tomcat|Tomcat]] |
+ | |||
+ | **Frameworks and Tools** | ||
+ | |||
+ | * [[eclipse|Eclipse]] | ||
* [[maven|Maven]] | * [[maven|Maven]] | ||
+ | * [[jsf|JSF]] | ||
+ | * [[jsp|JSP]] | ||
+ | * [[JUnit4|Junit4]] | ||
* [[spring|Spring]] | * [[spring|Spring]] | ||
* [[hibernate|Hibernate]] | * [[hibernate|Hibernate]] | ||
+ | * [[log4j|Example of configuration of log4j]] | ||
+ | * [[log4j: | ||
+ | |||
+ | **Standards** | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[webxml|Web.xml]] | ||
+ | * [[javadoc|Javadoc made easy]] | ||
* [[javaBeans|Java Beans]] | * [[javaBeans|Java Beans]] | ||
- | * [[jsf|JSF]] | ||
- | * [[JUnit4|Junit4]] | ||
- | * [[eclipse|Eclipse]] | ||
- | * [[Jboss|Jboss]] | ||
- | * [[Tomcat|Tomcat]] | ||
- | * [[Ayuda|Ayuda]] | ||
- | * [[JDBC|JDBC]] | ||
- | * [[ficheros|Ficheros]] | ||
* [[MimeTypes|MimeTypes]] | * [[MimeTypes|MimeTypes]] | ||
- | | + | </ |
+ | |||
+ | **Recipes** | ||
+ | |||
+ | * [[howToMakeALinkLookLikeAButton|How to make a link look like a button]] | ||
+ | | ||
* [[DevelopmentMode|Configurar modo desarrollo]] | * [[DevelopmentMode|Configurar modo desarrollo]] | ||
- | * [[webxml|Web.xml]] | + | * [[NumerosAleatorios|Números Aleatorios]] |
- | * [[Infocenter|Setting up an Infocenter -or help system- for a project]] | + | * [[concurrentQueue|A concurrent version of a queue]] |
- | * [[log4j|Example of configuration of log4j]] | + | * [[writingErrorsInLog|Writing properly errors in log file]] |
- | * [[log4j: | + | |
* [[durationToText|Convert a time duration into a text]] | * [[durationToText|Convert a time duration into a text]] | ||
- | * [[java7onLinux|Install java 7 on linux by hand]] | ||
* [[javaService|Create your own java windows services using the Jboss service wrapper]] | * [[javaService|Create your own java windows services using the Jboss service wrapper]] | ||
- | * [[writingErrorsInLog|Writing properly errors in log file]] | + | * [[javaServiceLinux|A simple script for creating |
- | * [[concurrentQueue|A concurrent version of a queue]] | + | |
* [[searchInsideAJarFile|How to search inside a Jar file]] | * [[searchInsideAJarFile|How to search inside a Jar file]] | ||
* [[allAvailableTimeZones|List all available timezones that are in your JVM]] | * [[allAvailableTimeZones|List all available timezones that are in your JVM]] | ||
- | * [[NotasSobrePluginsEclipse|Mis notas sobre plugins eclipse]] | ||
* [[CreateMd5HashInJavaWithSpring|Create a md5 hash in java with eclipse]] | * [[CreateMd5HashInJavaWithSpring|Create a md5 hash in java with eclipse]] | ||
+ | |||
+ | **Projects** | ||
+ | |||
* [[TestPi4J|TestPI4J: | * [[TestPi4J|TestPI4J: | ||
- | * [[MiningTheSocialWeb|Mining the Social Web]] | + | * [[2by2RubikCube|The Rubik' |
+ | |||
+ | |||
+ | **Miscellaneous** | ||
+ | |||
+ | * [[Ayuda|Ayuda]] | ||
+ | * [[JDBC|JDBC]] | ||
+ | * [[ficheros|Ficheros]] | ||
+ | * [[Infocenter|Setting up an Infocenter -or help system- for a project]] | ||
+ | * [[java7onLinux|Install java 7 on linux by hand]] | ||
+ | * [[http:// | ||
+ | * [[Minecraft|Minecraft]] | ||
+ | * [[Sonar|Sonar]] | ||
+ | |||
Line 79: | Line 105: | ||
</ | </ | ||
- | |||
- | ==== ¿Qué tarda más??? ==== | ||
- | |||
- | Con frecuencia veo construcciones como ésta: | ||
- | |||
- | <code java> | ||
- | if(logger.isInfoEnabled()){ | ||
- | logger.info(" | ||
- | } | ||
- | </ | ||
- | |||
- | En el código Java de otros. "Es para que vaya más rápido" | ||
- | |||
- | |||
- | Me he llevado la sorpresa de que es más rápido sin el '' | ||
- | |||
- | Otra mas: para el ejemplo del programa (1.000.000 de ejecuciones) la diferencia es de un segundo. Es decir, la comprobación tarda un microsegundo en hacerse. | ||
- | |||
- | **No merecería la pena, aunque el resultado fuera al revés:** la legibilidad del código es mejor cuanto más simple. | ||
- | |||
- | <code java> | ||
- | import java.io.File; | ||
- | import java.util.Date; | ||
- | |||
- | import org.apache.log4j.Logger; | ||
- | import org.apache.log4j.PropertyConfigurator; | ||
- | |||
- | |||
- | |||
- | public class App { | ||
- | |||
- | |||
- | public static final int ERROR_CODE = -1; | ||
- | public static final int OPERATION_OK = 0; | ||
- | |||
- | /** | ||
- | * @param args | ||
- | */ | ||
- | public static void main(String[] args) { | ||
- | String log4jFile = " | ||
- | // deletes the log file prior to do the test | ||
- | File deleter = new File(" | ||
- | deleter.delete(); | ||
- | |||
- | // start the logger tester | ||
- | Logger logger = Logger.getLogger(" | ||
- | PropertyConfigurator.configure(log4jFile); | ||
- | |||
- | Date start1 = new Date(); | ||
- | for( long count1 = 0; count1 < 1000000; count1++ ) | ||
- | { | ||
- | if(logger.isInfoEnabled()){ | ||
- | logger.info(" | ||
- | } | ||
- | } | ||
- | Date end1 = new Date(); | ||
- | |||
- | Date start2 = new Date(); | ||
- | for( long count2 = 0; count2 < 1000000; count2++ ) | ||
- | { | ||
- | logger.info(" | ||
- | } | ||
- | Date end2 = new Date(); | ||
- | |||
- | |||
- | System.out.println( "con comprobacion tardó: " + (end1.getTime() - start1.getTime())/ | ||
- | System.out.println( "SIN comprobacion tardó: " + (end2.getTime() - start2.getTime())/ | ||
- | } | ||
- | |||
- | |||
- | } | ||
- | |||
- | </ | ||
Line 244: | Line 197: | ||
~~DISQUS~~ | ~~DISQUS~~ | ||
- | |||
- | |||
- |
java/index.1389081113.txt.gz · Last modified: 2022/12/02 21:02 (external edit)