January 2006

A timed Cache

Just a quick note about something that i did at work which is a cool pattern – A Timed Cache. We have some files which get loaded from a db and the db can change periodically – everything is readonly.

the simple solution is to have a timeout period and when you check the cache to see if something is loaded you also check the current time and the time you last cleared the cache, if the difference is greater than the timeout period then you simply clear the cache first.

this all happens inside a synchronized method which i am fairly certain about but which i’d like to do some more experimentation with to be sure – another post! I will probably set up some kind of multithreaded test environment where i can really see whats going on once and for all – its quite hard to conceptualise all this synchronised stuff in your head – its all very well in theory:)

  • Share/Bookmark

databases
patterns

Comments (0)

Permalink

Util Logging

ok so now i need to know about java logging with the util package…

pretty simple ….

private static Logger log = Logger.getLogger(XSDStoreServletParameters.class.getName());

then log.finest(“hello”);

and

if (log.isLoggable(Level.CONFIG)) {

}

etc.

problem is that it doesnt do anything in the websphere process server…

hey ho.

it uses the old commons-logging (apparently called “JCL” these days!)

grrrrrr!

so you do :

private static Log log = LogFactory.getLog(JDBCToXML.class);

then its just like Log4J

the trick is to get Websfear to print it out – it doesnt want to put low level logging to the console.

you can get it to go to a file though and tail that i guess.

  • Share/Bookmark

jdk
logging
websphere

Comments (0)

Permalink

Oracle and simple SQL

So im playing with oracle and have forgotten everything i know about it.

W3C shool for SQL!

SELECT table_name FROM all_tables WHERE owner = USER;

this gives me all my tables.

cant even remember the syntax for a CREATE table!!

create table test (column1 varchar(20), column2 int);

insert into test values (‘jim001′, 34);

delete from test where column1=’jim001′;

update test set column1=’jim003′, column2=’56′ where column1=’jim001′;

this will go in my wikki when i work out how to work that!:)

woohoo!! toad is so beautiful! i think its had a revamp…

http://www.toadsoft.com/lic_agree.html


an faq

  • Share/Bookmark

databases
oracle
sql

Comments (0)

Permalink

Including photos..

so hopefully i can just put a link to a photo in here….

sweet!

  • Share/Bookmark

website

Comments (0)

Permalink

First Post!!

Well, i have finally got around to sorting out my website – its not quite in the way i wanted to do it (i had very complicated plans which might get done one day) but it was very easy and quick thanks to changing my hosting to dreamhost who have atuo installs for all kinds of cool goodies such as a gallery for pictures ( and even a wiki!!)

  • Share/Bookmark

hosting
website

Comments (0)

Permalink