Tuesday, January 13, 2009

Correct encoding of String in Java

Found many examples of correct encoding/decoding of string in Java. Tried many ways, but helped only one. Here is an example of one program. The InputStreamReader reads stream that is encoded in the Cp1251. Program correctly reads and transforms to correct encoding that Java can represent it.

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "Cp1251"));

rd.readLine(); // Here is the magic :))

If you know Russian, there is a good article about encoding in Java: http://www.jug.ru/servlets/index?page=rus

Read More...

Sunday, January 4, 2009

Google account as OpenID

I am reading a stackoverflow RSS and one post got my attention with an interesting fact.
You can now use Google as an OpenID provider. Before that, Google were not providing OpenID feature directly, and as I mentioned before, you had to use blogger.com as a provider.
But here is what the post say:
For example, one of the newest OpenID providers is Google. If you have a GMail account, just enter this magical OpenID phrase:

google.com/accounts/o8/id

Fine print: yes, eventually Google will support entering gmail.com, just like Yahoo supports using yahoo.com for their OpenIDs. Until then, it’s this crazy string.

I've tried it as usual on livejournal and it worked! :) Halliluya! :) However, just one concern: what if Google will close this link in the future with providing more simple, like gmail.com?

Read More...

Thursday, August 28, 2008

OpenId from blogspot works great!

I have a blog address as yuriytkach.blogspot.com. I went to the livejournal.com (one of the sites, that supports OpenId), and in the login field I clicked OpenId. Then I entered yuriytkach.blogspot.com and it worked: it then redirected me to the blogspot.com site where I enterened the my google's email and password, then it asked me if I trust the livejournal.com site and after clicking 'yes' I found myself on the user page of livejournal! Cool!
Now, several questions broached in my head:
  • What if livejournal decided to steal my password for some reason, and what if they redirected me to the fake blogspot site? So using of OpenId on some suspicious sites, that claim that they support it, should be done carefully.
  • Idea behind using of only one login everywhere is very cool. But what if I lost my password, or even worse - someone steal my password. Well, anyway that's a double side of the problem: on the one hand I have to remember many ids and passwords, on the other hand I have only one id and password, but I can loose everything with loosing one password. :)
  • I haven't yet figured out the technical thing behind the OpenId (but I will have to do that, because we probably will implement it in our project), but the question bothers me. What if an OpenId provider will go down. For example, if blogspot.com will blow up or something. :) How the identification will go in such a way?

Read More...

Checking work of OpenID thing

Found out about the OpenId thing. Very cool one that allows to use the single id for log in to different sites. Google has such thing, but Google's account email can be used only for log in to the Google services. Now, trying to use the blogspot url as openId on the other sites, to check how it will work.

Read More...