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.


my geek code :)

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--

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( )

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 ='http://example.url');
HttpURLConnection = URL.openConnection();