Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3785 connectés 

 


 Mot :   Pseudo :  
  Aller à la page :
 
 Page :   1  2  3  4  5  ..  169  170  171  ..  327  328  329  330  331  332
Auteur Sujet :

BlaBlaTech@JAVA [ELITE, viendez les boobs]

n°1489442
the real m​oins moins
Posté le 11-12-2006 à 11:22:26  profilanswer
 

Reprise du message précédent :
euh, les 2 mon général; pourquoi cette question ?
(en gros, j'extrait des fichiers d'une archive et je veux verifier que l'user a pas fait le malin en les modifiant)

mood
Publicité
Posté le 11-12-2006 à 11:22:26  profilanswer
 

n°1489452
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 11:43:11  profilanswer
 

ben si tu crées les fichiers ou que tu gères leur apparition sur le fs un simple CRC32 suffirait non?
 
Ou au pire si tu veux vraiment être sûr, du MD5 ou du SHA.


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489460
nraynaud
lol
Posté le 11-12-2006 à 11:55:07  profilanswer
 

--> je te suggère SHA+longueur du fichier.
 
mais tu peux expliquer un peu le contexte stp ? c'est pas normal que l'utilisateur puisse télécharger des fichiers auquels tu as toi-même déjà eu accès avant pour calculer le hash

n°1489465
the real m​oins moins
Posté le 11-12-2006 à 12:00:27  profilanswer
 

masklinn a écrit :

ben si tu crées les fichiers ou que tu gères leur apparition sur le fs un simple CRC32 suffirait non?

 

Ou au pire si tu veux vraiment être sûr, du MD5 ou du SHA.

 

le crc32, ché pas, mais pour le md5, j'ai parlé de perfs>sûreté, spa pour rien [:mullet]

 
nraynaud a écrit :

--> je te suggère SHA+longueur du fichier.

 

mais tu peux expliquer un peu le contexte stp ? c'est pas normal que l'utilisateur puisse télécharger des fichiers auquels tu as toi-même déjà eu accès avant pour calculer le hash

 

? [:pingouino]

Message cité 1 fois
Message édité par the real moins moins le 11-12-2006 à 12:00:38
n°1489491
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 12:41:03  profilanswer
 

the real moins moins a écrit :

le crc32, ché pas, mais pour le md5, j'ai parlé de perfs>sûreté, spa pour rien [:mullet]


Ouais enfin on peut pas dire que MD5 bouffe beaucoup de ressources, le truc qui bouffe le plus de temps c'est l'accès/lecture du fichier sur les machines modernes, pas vraiment le calcul du hash. Tu vas pas gagner beaucoup en passant en crc.


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489496
the real m​oins moins
Posté le 11-12-2006 à 12:47:10  profilanswer
 

ok, et donc, a la base, je venais voir si y'avait un truc smart et plus rapide? :D

n°1489507
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 12:59:27  profilanswer
 

Tu peux essayer de prendre des points aléatoires dans ton fichier et de hasher que ça, mais je suis pas persuadé que ça t'avance à quoi que ce soit, tu vas perdre en sûreté et comme tu vas passer en accès random au lieu de séquentiels tu risques fort de perdre en I/O [:pingouino]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489588
the real m​oins moins
Posté le 11-12-2006 à 15:08:52  profilanswer
 

masklinn a écrit :

Tu peux essayer de prendre des points aléatoires dans ton fichier et de hasher que ça, mais je suis pas persuadé que ça t'avance à quoi que ce soit, tu vas perdre en sûreté et comme tu vas passer en accès random au lieu de séquentiels tu risques fort de perdre en I/O [:pingouino]


 

the real moins moins a écrit :

ok, et donc, a la base, je venais voir si y'avait un truc smart et plus rapide? :D


:D

n°1489593
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 15:13:38  profilanswer
 

Hay moi je propose, c'est toi qui fais chier alors que tu n'es même pas sûr que faire comme tout le monde soit problématique [:dawa]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489594
the real m​oins moins
Posté le 11-12-2006 à 15:14:45  profilanswer
 

non mais c'est bien aimable, et je vais sans doute commencer par un crc/md5, je faisais juste un tour de table pour voir si qqun avait une autre idée :O

mood
Publicité
Posté le 11-12-2006 à 15:14:45  profilanswer
 

n°1489599
the real m​oins moins
Posté le 11-12-2006 à 15:21:41  profilanswer
 

et je dois bien dire que la methode est assez peut satisfaisante:
http://javafaq.nu/java-example-code-230.html

n°1489600
the real m​oins moins
Posté le 11-12-2006 à 15:22:37  profilanswer
 

juste pour un peu de contexte: il s'agit de verifier l'integrité de certains fichiers au demarrage d'une webapp. elle est deja bcp trop lente a demarrer a mon gout donc bon, j'essaie de limiter les degats :ange:

n°1489619
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 15:45:50  profilanswer
 

Ben ouais mais dans tous les cas pour vérifier l'intégrité d'un fichier il n'y a pas 36 moyens, faut stocker un checksum et vérifier si il est bon à chaque utilisation du fichier [:spamafote]
 
Ou alors tu stockes des fichiers binaires pour que les utilisateurs puissent pas les modifier [:dawa]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489628
the real m​oins moins
Posté le 11-12-2006 à 15:56:52  profilanswer
 

Adler32 ca vous dit qqch?
la classe java.util.zip.Adler32 dit :

Citation :


 * A class that can be used to compute the Adler-32 checksum of a data
 * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
 * can be computed much faster.

mais sur un test sur 10000 iterations sur 25 fichiers, je gagne 5 secondes ... bof ...

n°1489642
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 16:09:17  profilanswer
 

Nan mais tu utilises CRC32, tu lances JProfiler et tu profiles le lancement de ta webapp :o

 

Et là tu vois où ça rame :o


Message édité par masklinn le 11-12-2006 à 16:09:39

---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1489645
the real m​oins moins
Posté le 11-12-2006 à 16:19:56  profilanswer
 

non mais im'prend pour un con jcrois [:pingouino]

n°1489649
masklinn
í dag viðrar vel til loftárása
Posté le 11-12-2006 à 16:23:39  profilanswer
 

the real moins moins a écrit :

non mais im'prend pour un con jcrois [:pingouino]


Ben ouais :o


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1490978
boulax
Inserer phrase hype en anglais
Posté le 13-12-2006 à 18:14:45  profilanswer
 

C'est quoi l'objet de choix pour faire des requetes http en java qui gererait les sessions/cookie ?
 
(Là j'utilise URLConnection, je fais un premier appel pour m'authentifier, je parse le jsessionid dans la réponse à la roots et je le colle dans mon deuxieme appel)

n°1490979
boulax
Inserer phrase hype en anglais
Posté le 13-12-2006 à 18:26:47  profilanswer
 

(je zieute du coté de HttpClient)

n°1492859
stiffler
Lâche mon profil putain ! :o
Posté le 18-12-2006 à 17:28:43  profilanswer
 
n°1492862
benou
Posté le 18-12-2006 à 17:34:59  profilanswer
 

boulax a écrit :

C'est quoi l'objet de choix pour faire des requetes http en java qui gererait les sessions/cookie ?
 
(Là j'utilise URLConnection, je fais un premier appel pour m'authentifier, je parse le jsessionid dans la réponse à la roots et je le colle dans mon deuxieme appel)


t'as un lib httpclient dans jakarta commons. elle marche plutôt bien ...

n°1492874
boulax
Inserer phrase hype en anglais
Posté le 18-12-2006 à 17:45:55  profilanswer
 

dixit le poste suivant

n°1492905
benou
Posté le 18-12-2006 à 18:15:57  profilanswer
 

boulax a écrit :

dixit le poste suivant


j'ai vu après et j'ai pas eu envie d'effacer :o
 
mais bon, ca voulait aussi dire que je l'avais utilisé et que j'en étais plutôt content. Moi j'utilisais la version 2. j'ai vu qu'ils étaient passé à la 3 en changeant pas mal l'API ...

n°1493001
the real m​oins moins
Posté le 18-12-2006 à 22:33:10  profilanswer
 
n°1494481
the real m​oins moins
Posté le 20-12-2006 à 19:09:36  profilanswer
 

bon alors:


            // WorkAround file path
            String waFilePath = null;
[...]
                final String[] ss = documentName.split("\\/" );
                waFilePath = this.outputLocation + ss[0] + "\\b__" + ss[1];


c'est quoi cette merde? ça fait quoi ?

n°1494482
the real m​oins moins
Posté le 20-12-2006 à 19:10:30  profilanswer
 

je reve pas, ca remplace tous les / par __ et le \\b c'est pour backspacer sur le / parce que le neuneu est pas foutu d'aller voir la javadoc pour savoir comment omettre les separateurs avec split() ?

n°1494486
masklinn
í dag viðrar vel til loftárása
Posté le 20-12-2006 à 19:19:02  profilanswer
 

ben log ss et waFilePath pour savoir ce qui rentre et ce qui sort [:petrus75]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1494569
the real m​oins moins
Posté le 20-12-2006 à 22:11:27  profilanswer
 
n°1494571
masklinn
í dag viðrar vel til loftárása
Posté le 20-12-2006 à 22:17:26  profilanswer
 


Si t'arrêtais de poser des questions stupides, t'arrêterais d'avoir des réponses stupides [:petrus75]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1494574
the real m​oins moins
Posté le 20-12-2006 à 22:35:50  profilanswer
 

mais va te pendre [:mlc]

n°1494578
masklinn
í dag viðrar vel til loftárása
Posté le 20-12-2006 à 22:48:01  profilanswer
 


Miroir magique [:absynthe]


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1494597
souk
Tourist
Posté le 21-12-2006 à 00:16:14  profilanswer
 

Code :
  1. public Collection getCollection(Object a_oDummy, Object a_oData) throws ClassCastException {
  2.  
  3.    // return an empty set if a_oData is empty
  4.    if (a_oData == null) {
  5.      return Collections.EMPTY_LIST;
  6.    } else if (a_oData instanceof AbstractList) {
  7.      return (AbstractList) a_oData;
  8.    } else if (a_oData instanceof AbstractSet) {
  9.      return (AbstractSet) a_oData;
  10.    } else if (a_oData instanceof Collection) {
  11.      return (Collection) a_oData;
  12.    } else {
  13.      throw new IllegalArgumentException("invalid collection object" );
  14.    }


 
 [:pingouino] va falloir que je commence a serieusement relire tout le code que ce mec pond  [:arrakys]

n°1494600
masklinn
í dag viðrar vel til loftárása
Posté le 21-12-2006 à 00:27:43  profilanswer
 

Tu devrais poster ça sur DTWTF je crois :o


Message édité par masklinn le 21-12-2006 à 00:28:01

---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1494687
gizmo
Posté le 21-12-2006 à 10:10:05  profilanswer
 

Bon, j'ai une question pour les gourus Spring/JTA/Buzzword. J'ai une appli qui dispose d'un service Spring transactionnel, qui lui-meme, fait appel a un autre service Spring transactionnel. Ces deux services travaillent sur deux DB Oracle differentes dont les infos doivent rester synchrone.
Donc, on a mis en place un systeme a base de JTA et autres dans Spring (qui me passe un peu au-dessus de la tete, je dois bien l'avouer), et evidemment, ca ne marche pas. A la sortie du service encapsulant le second, je me choppe l'exception suivante:  
 
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Already marked for rollback TransactionImpl (et toute la stacktrace qui s'en suit).
 
Quelqu'un aurait une idee de la direction ou regarder?

n°1494691
boulax
Inserer phrase hype en anglais
Posté le 21-12-2006 à 10:14:27  profilanswer
 

Quand t'imbriques des transactions tu specifies comment se comporte l'une par rapport à l'autre ? Genre tu peux dire: "crée moi une deuxieme transaction" ou "inscris toi dans la transac en cours"


---------------
Posté depuis des chiottes, sales. Me gusta.
n°1494818
gizmo
Posté le 21-12-2006 à 14:07:09  profilanswer
 

Oui, enfin, pas vraiment. Vu que c'est du JTA, c'est une sorte de transaction globale, mais chacun a son fonctionnement interne propre vu qu la seconde doit pouvoir continuer de fonctionner dans un autre environnement.
 
En declarant que le second proxy ne devait pas creer de nouvelle transaction, mais reutiliser l'existant, visiblement, ca passe (enfin, pas dans tous les cas), mais du coup, ca le rend dependant de la transaction mere :/

n°1494990
souk
Tourist
Posté le 21-12-2006 à 19:14:07  profilanswer
 

Code :
  1. /**
  2.   * Accessor: obtain a long from a Date String
  3.   *
  4.   *
  5.   * @param a_strMillis
  6.   *
  7.   * @return a long from a Date String
  8.   *
  9.   * @throws ParseException
  10.   *
  11.   */
  12.  public static long parseMillis(String a_strMillis) throws ParseException {
  13.  
  14.    Date date;
  15.    ParseException parseException = null;
  16.    String sTs = a_strMillis;
  17.  
  18.    for (int i = 0; i < Psformat.aSdf.length; i++) {
  19.      try {
  20.        if (Psformat.aSdf[i] != Psformat.SDF_TIMESTAMP) {
  21.          date = Psformat.aSdf[i].parse(a_strMillis);
  22.        } else {
  23.          if (a_strMillis.length() == 21) {
  24.            sTs = a_strMillis + "00";
  25.          } else if (a_strMillis.length() == 22) {
  26.            sTs = a_strMillis + "0";
  27.          }
  28.  
  29.          date = Psformat.aSdf[i].parse(sTs);
  30.        }
  31.      }
  32.      catch (ParseException pe) {
  33.        parseException = pe;
  34.  
  35.        continue;
  36.      }
  37.  
  38.      return date.getTime();
  39.    }
  40.  
  41.    throw parseException;
  42.  }


bon, question: c'est mes yeux, ou bien ce code est illisible et pourri ? (il va sans dire qu'aucun test n'accompagne ce chef d'oeuvre ... [:pingouino])

n°1494992
the real m​oins moins
Posté le 21-12-2006 à 19:18:16  profilanswer
 

euh, c'est pas tes yeux [:pingouino]

n°1494997
masklinn
í dag viðrar vel til loftárása
Posté le 21-12-2006 à 19:25:55  profilanswer
 

Moi j'aime bien :o
 
Psformat ça représente quoi au fait?
 
Et aSdf aussi (à part un mec qui se tape la tête sur son clavier)


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
n°1494999
the real m​oins moins
Posté le 21-12-2006 à 19:33:17  profilanswer
 

j'ouvre les paris:
* Psformat : la classe en cours
* aSdf : String representant un format utilisable par SimpleDateFormat

n°1495007
masklinn
í dag viðrar vel til loftárása
Posté le 21-12-2006 à 19:45:51  profilanswer
 

the real moins moins a écrit :

* aSdf : String representant un format utilisable par SimpleDateFormat


putain ça a un sens en plus :ouch:


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
mood
Publicité
Posté le   profilanswer
 

 Page :   1  2  3  4  5  ..  169  170  171  ..  327  328  329  330  331  332

Aller à :
Ajouter une réponse
 

Sujets relatifs
[java]Ouvrir un fichier dans la fenetre principaleformation pour developpeurs Java
crontab : programme java[JAVA] Aide pour packager un jar
[java] copie de fichier et progressbarinstallation java
[JAVA]Comment insérer un texte dans un fichier audio?[JAVA] Intégrer ANT : API ou ligne de commande ?
[Java][Bouley]Serializable : mauvaise instanciation des champs[JAVA : JNI] Pb a l'execution avec library
Plus de sujets relatifs à : BlaBlaTech@JAVA [ELITE, viendez les boobs]


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)