Thursday, February 5, 2009

HDF5 in Matlab!!!

Behold: last versions of Matlabsupport HDF5!
there are only 3 (!) upper level functions which can do a lot: hdf5 - read/write/info
plus : all the low level functions are also available (via wrappers)! (there are some Matlab-specific as well)

BUT:

don't forget to wrap read/write in try/catch statements since
they cannot delete/overwrite existingentries in a file and
thus will throw an exception on such an attempt...

moreover, hdf5read can be used to read attributes,
BUT consider the following innocent command: hdf5read(file, '/1');
it either reads the dataset '1' located in the root group OR
the attribute '1' of the root group! It's just tooo ambiguous for me!



% my very ML confusing example:
hdf5write('a.h5', struct('Location', '/', 'Name', '1'), 'What is right?', ...
struct('AttachedTo', '/', 'Name', '1', 'AttachType', 'group'), 'And what is wrong?');

% let's read attribute '1' of the root:

% naiive:
i = hdf5read('a.h5', '/1');

i.Data
% gives 'What is right?' to me, which is not what i wanted!

% and the attribute must be read as follows:
info = hdf5info('a.h5', 'ReadAttributes', true);

info.GroupHierarchy.Attributes.Value.Data
% gives 'And what is wrong?' to me

Saturday, January 31, 2009

Zacinit' muzyku z anime...

Elfen Lied Openning - duzhe klassna muzyka!!!
(tut pravda bagato variantiv razom zkompanovano)


A shcho nagaduje xxxHolic Ending?
Meni - Okean Elzy japons'koju!!!! :)

Number Three Idiot of 2008

A man, wanting to rob a downtown Bank of America, walked into the Branch and wrote this, 'Put all your muny in this bag.'
While standing in line, waiting to give his note to the teller, he began to worry that someone had seen him write the note and might call the police before he reached the teller's window.
So he left the Bank of America and crossed the street to the Wells Fargo Bank.
After waiting a few minutes in line, he handed his note to the Wells Fargo teller. She read it and, surmising from his spelling errors that he wasn't the brightest light in the harbor, told him that she could not accept his stickup note because it was written on a Bank of America deposit slip and that he would either have to fill out a Wells Fargo deposit slip or go back to Bank of America.
Looking somewhat defeated, the man said, 'OK' and left. He was arrested a few minutes later, as he was waiting in line back at Bank of America.

LOL :D

my geek code :)

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS$/CM/M$ d-(+) s: a- C++(+++)$ UL*A(+) P++(--) L++(+++) E(+) W++ N+ !o !K w++(--) M+(++) !PS PE Y PGP t 5 X R tv-- b++(+++) DI++ D G e+++(++++) h--
------END GEEK CODE BLOCK------

Sunday, January 11, 2009

MATLAB can get binary data and set Cookies!!!

After an overnight hopeless wandering around with this mad quest in mind i finally managed to read binary data correctly via http connection AND get Cookie at the same time!!! Moreover i can post some data with Cookie via http as well.

Please, if you don't care for Cookie - just DO use urlread!!! I DO mean it!

The only working way was to use Ice(Java) functions in Matlab, which are NOT documented in any way. Therefore one needs to experiment a lot with them!

So if you are not scared yet, here we go:

To read binary data use:

uint8( DataInputStream.read() )


To get cookie use:

CookieString = char(HttpURLConnection.getCookieManager().elements.nextElement.Cookie.toString)

or the following might also work

CookieString = char(HttpURLConnection.getCookieManager().getHeaderField('Set-Cookie') )


To set cookie use:

HttpURLConnection.setRequestProperty('Cookie', CookieString )



Since i am by no means an expert neither in Java nor in Matlab i might have overlooked something. Please do let me know if you know a better way.

ps: of course you start as follows:

URL = java.net.URL('http://example.url');
HttpURLConnection = URL.openConnection();

Wednesday, November 26, 2008

Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете.


Стив Макконнелл «Совершенный код»



Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.


Steve McConnell "Code Complete"

Monday, August 4, 2008

Несколько цитат из Линуса Торвальдса

Microsoft — не зло, просто у них по-настоящему паршивые операционные системы.

Интеллект — это способность избегать выполнения работы, но так, чтобы она при этом была сделана.

Когда ты говоришь, „Я написал программу, которая роняет Windows“, люди просто тупо смотрят на тебя и отвечают: „Да мне такие программы вместе с системой достались, бесплатно.“

Итак, большинство из вас, скорее всего, будет невыносимо маяться от скуки в Рождество, и вот вам идеальное развлечение. Протестируйте 2.6.15-rc7. Все магазины будут закрыты, и на самом деле не будет лучшего занятия между поеданием пищи.


:-D

Wednesday, July 30, 2008

Just a gag

Серьезная организация возьмет на высокооплачиваемую должность опытного хакера. Резюме просим размещать на главной странице сайта www.microsoft.com.

:-D

Gags about Windows/Linux

The software required «Windows 95 or better», so I installed Linux.

-- Tom Christiansen and Nathan Torkington «Perl Cookbook»

Hедокументированные ошибки Windows 95. Том 3.

-- nixp.ru

Friday, July 25, 2008

I like GO and mathematics


Mathematics is the science of patterns,
Music is the art of patterns, and
Go is the game of patterns.


-- Hu, from his KGS profile