niedziela, 28 marca 2010
sobota, 27 marca 2010
Uprawnienia Tomcat
Jakiś czas spędziłem aby zrozumieć jak działa system uprawnień na Tomcacie.
A wystarczyło przeczytać to:
http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html
A wystarczyło przeczytać to:
http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html
piątek, 19 marca 2010
Śledź w sosie pomidorowym
Śledź
Pulpa pomidorowa (pomidory zasmażane w kawałkach) mogą być w oregano
Pietruszka
Koper
Cebula krojona w piórka
Pulpę, pietruszkę, koper, cebulę podgrzewać w garnku. Krótko, z dodatkiem pieprzu, dużo pieprzu, sól, dodać wiśniówki 150 ml. Wymieszać. Lekko podgrzać. Nie na gorąco. Dodać śledzie i włożyć do lodówki na trzy dni.
Podawać w towarzystwie sałaty polewając odrobiną oliwy.
Pulpa pomidorowa (pomidory zasmażane w kawałkach) mogą być w oregano
Pietruszka
Koper
Cebula krojona w piórka
Pulpę, pietruszkę, koper, cebulę podgrzewać w garnku. Krótko, z dodatkiem pieprzu, dużo pieprzu, sól, dodać wiśniówki 150 ml. Wymieszać. Lekko podgrzać. Nie na gorąco. Dodać śledzie i włożyć do lodówki na trzy dni.
Podawać w towarzystwie sałaty polewając odrobiną oliwy.
piątek, 12 marca 2010
Grails: Jak wykonać logikę programu zależną od środowiska wykonania?
Grails: how to run different logic in production and development environments
There are times when we need to run different stuff depending on the environment the app is running on. For example, integration with external systems are sometimes simulated (mocked) in Development, and are executed for real in Production.
Here's a simple way to run one thing in Development and another in Production (or as many environments as you need ...).
import grails.util.Environment;
class MyController{
Environment.executeForCurrentEnvironment {
production {
// Here goes the prod code
}
development {
// Here goes the dev code
}
}
}
There are times when we need to run different stuff depending on the environment the app is running on. For example, integration with external systems are sometimes simulated (mocked) in Development, and are executed for real in Production.
Here's a simple way to run one thing in Development and another in Production (or as many environments as you need ...).
import grails.util.Environment;
class MyController{
Environment.executeForCurrentEnvironment {
production {
// Here goes the prod code
}
development {
// Here goes the dev code
}
}
}
niedziela, 7 marca 2010
Tatar z łososia po japońsku
Składniki:
Łosoś
Kawior
Por
Sos sojowy
Czerwona ostra papryka
Cukier
Żółtko
Kropla sake
Pora drobno pokroić. Sosu sojowego łyżeczkę, a cukru szczypta. Wymieszać. Podawać z cienkim plastrem ogórka wężowego i ryżem. Japończycy pewnie to jeszcze przyozdabiają malując w ogórku każdej pestce uśmieszek i małego penisika.
Łosoś
Kawior
Por
Sos sojowy
Czerwona ostra papryka
Cukier
Żółtko
Kropla sake
Pora drobno pokroić. Sosu sojowego łyżeczkę, a cukru szczypta. Wymieszać. Podawać z cienkim plastrem ogórka wężowego i ryżem. Japończycy pewnie to jeszcze przyozdabiają malując w ogórku każdej pestce uśmieszek i małego penisika.
czwartek, 4 marca 2010
Java SHA1 class
http://www.anyexample.com/programming/java/java_simple_class_to_compute_sha_1_hash.xml
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class AeSimpleSHA1 {
private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
buf.append((char) ('0' + halfbyte));
else
buf.append((char) ('a' + (halfbyte - 10)));
halfbyte = data[i] & 0x0F;
} while(two_halfs++ < 1);
}
return buf.toString();
}
public static String SHA1(String text)
throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
return convertToHex(sha1hash);
}
}
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class AeSimpleSHA1 {
private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
buf.append((char) ('0' + halfbyte));
else
buf.append((char) ('a' + (halfbyte - 10)));
halfbyte = data[i] & 0x0F;
} while(two_halfs++ < 1);
}
return buf.toString();
}
public static String SHA1(String text)
throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
return convertToHex(sha1hash);
}
}
Subskrybuj:
Komentarze (Atom)
