Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

EJB3: Valeur discriminatrice dans une hiérachie d’entité*

tName("P");
    em.persist(p);
    Customer cust = new Customer();
    cust.setFirstName("C");
    cust.setLastName("C");
    cust.setStreet("Street");
    cus

Java: Découper une chaîne de caractères(String) à l’aide d’un séparateur

String[] array1 = StringUtils.split( str, " ,", 2 );
String[] array2 = StringUtils.split( str2, " ,",

Javascript: Afficher la date GMT

<pre lang='javascript'><html>
  <head>
 
  </head>
  <body>
 
<html>
<head></head>
<body>
<button onclick="var date = new
Comments Off on Java: Obtenir l’adresse IP publique d’un PC

Java: Obtenir l’adresse IP publique d’un PC

in = new BufferedReader(new InputStreamReader(
 whatismyip.openStream()));
            String ip = in.readLine();
            return ip;
        } finally {
            if (in != null) {
                try {
                    in.close();
            }
        }

Javascript: Afficher la date et l’heure locale

<pre lang='javascript'><html>
  <head>
 
  </head>
  <body>
    <html>
<head>
 
</head>
<body>
    <p id="dateField">&#038;n

Java: Trouver un String entre deux autres String

String titre = StringUtils.substringBetween(codeHTML, "<title>",
"</title>");
System.out.println( "Titre: " + titre );
// Extraire le Script du contenu HTM

Javascript: Convertir la date en String Local

<pre lang='javascript'><html>
  <head>
 
  </head>
  <body>
    <font color="#ffffff"><code>    </code></font><code><br /><font color="#000000"><</font><fon

Javascript: Afficher une date avec un String

<pre lang='javascript'><html>
  <head>
 
  </head>
  <body>
    <font color="#000000"><code><</code></font><code><font color="#7f0055"><b>html</b></font><

Java:Calculer le temps d’exécution d’une requête

 pro.put("username","dd");
          pro.put("password","ddd");
          long debut=System.currentTimeMillis();
          Connection avocatoo_conn=DriverManager.getConnection(myDB,pro);
          ResultSet rs=avocatoo_conn.createStatement()

Java: Exemple d’utilisation de EnumMap avec des objets

<pre lang='java'>
Set myKeys=personneEnCharge.keySet();
  		Iterator iter=myKeys.iterator();
  		while(iter.hasNext())
  		{

Java: Rechercher une chaîne à l’aide d’un délimiteur

message = "-Java- DELIMITEURExempleDELIMITEUR";
String texte1 = StringUtils.substringBetween( message, "-");
System.out.println (text

Java: Exemple de formatage de la taille d’un champ

{filelink=4420}
 
 
import java.util.*;
 
public class Formatage{
  public static void main(String args[]) {
    Formatter

Java: Abréger une chaîne de caractères(String)

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
public class StringAbreviation {

Java: Lire une colonne spécifique d’un fichier CSV

nextLine;
   			 while ((nextLine = reader.readNext()) != null)
   			 	 {

Java: Tronquer ou couper une chaîne de caractères(String) selon plusieurs séparateurs

  String[] tokens = test.split( "[' '',']" );
System.out.println( ArrayUtils.toString( tokens ));