Fetching html page over http in Java using google-guava
Submitted by slavus on 2010-09-06 14:05:43
Fetching html page over http in Java using google-guava
I am using google-guava for some time know, I used it when there was only google-collections, and it is absolutely fabulous. Here is simple trick how to fetch whole html page over http in Java using google-guava in one line:
Resources.toString(new URL("http://slavus.net"), Charsets.UTF_8);
Go ahead and try out google-guava
» Tags javatip » Show comments (0)
Java 1.6.0_21 and Eclipse
Submitted by slavus on 2010-07-19 12:58:45
Java 1.6.0_21 and Eclipse
If you update to newest version of Java 1.6.0 update 21 and try to run Eclipse you surely seen on of this:
- Unhandled event loop exception
- PermGen space
So Eclipse started to become pretty unusable WTF. However for now there is simple workaround just edit your eclipse.ini like this:
-startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction ...
» Tags eclipsejava » Show comments (2)
Django FormMediaContext (FormMediaRequestContext)
Submitted by slavus on 2009-05-03 21:46:24
Novi zapis...
Django FormMediaContext(FormMediaRequestContext)
Django has great abstraction for forms. Feature that I find very useful in forms, is media meta class. For example:
class SimpleForm(forms.Form):
class Media:
css = {
'all': ('pretty.css',)
}
js = ('animations.js', 'actions.js')
Than you can do get javascripts and CSS, rendered simple with something like this:
>>> form = SimpleForm()
>>> print form.media
<link href="http://media.example.com/pretty.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="http://media.example.com/animations.js"></script>
<script type="text/javascript" src="http://media.example.com/actions.js"></script>
Ok, that ...
» Tags django » Show comments (2)
Vrijeme je za 1234567890
Submitted by slavus on 2009-02-13 15:38:03
Vrijeme je za 1234567890
Još malo i biti će 1234567890 sekundi od kad se računa Unix vrijeme.
Da li ste spremni dočekali ovaj povjesni trenutak? I kako ste ga proslavili?
Ja ću tu sekundu posvetiti svim Unixodima i onima koji će tek to postati.
» Tags » Show comments (0)
Python source file encoding hint
Submitted by slavus on 2008-12-16 10:59:49
Python source file encoding hint
When I program in Python I have bad habit writing comments in Croatian. When using characters like šđčžž i get some stupid errors. Some thing like this:
SyntaxError: Non-ASCII character 'xc4' in file
I know I have write first special comment, to tell Python I am writing in UTF-8., but I always forget what exactly I have to write. So here it is:
# -*- coding: utf-8 -*-
» Tags python » Show comments (0)
