Search

Well almost, I want to make a tweak or two before I make it available for use , but the work I originally listed back in April is done

Switch to use the live DB currently being used by the PHP app. – DONE

Make links automatically out of URLs in messages – DONE

Clean up html so it looks presentable (this could be a big one) – DONE

Either set up email notifications, or some alternative, e.g. posts to twitter – DONE

I mainly want to change the URL that it’s using so that once it starts being used people can favourite a URL and not have it change a week later. Also although I’ve got email notifications, I’d like to add twitter posting as I know that’s pretty easy, and gives some advantage from a user’s point of view to the new version.

I’ve been tinkering with adding facebook “like” and google “plus 1″, but easy to do for the whole page, but not working for me when I try to make them refer to an individual post, so that’s another thing to add to the list.

Part of me can’t quite believe that it’s taken so long, but then it has been the just the odd bit of time here and there in between working, sleeping, and various recreational activitities, so part of me is pretty pleased to have done it. Blogging has be useful as a reminder of what progress I’ve made – important when it’s so slow, and also an incentive to at least try and do something every week or two.I intend to continue, documenting adding various features, refactoring and maybe trying out different languages/frameworks, keeping a low threshold on quality of what I write in the hope that will mean I do actually post something.

Now I can treat myself to a waterproof camera housing, although having spent this long I’m not sure how much I really want one …

Not much to report again, in the little bit of time I’ve managed to grab I’ve been looking at the ake links automatically out of URLs in messages task.

I’d already done this in PHP, and planned to do it in Java. After implementing the code to do it in a getter on my Message class I realised the serialization done by com.google.gson.Gson.toJson wasn’t using the getter. After stopping to consider I decided it made more sense to do it in the code doing the actual display anyway, i.e. the javascript.

So looking into Javascript regular expressions and regular expressions for URLs I found this http://daringfireball.net/2010/07/improved_regex_for_matching_urls which looked pretty promising. But had trouble converting it into a javascript regexp (I think mainly due to some none ASCII characters, and the escaping of certain characters in Javascript), and had a feeling that it would actually be more lenient than I really want – e.g. I don’t want to match ftp.
So resorted to just converting what I was doing in PHP, which is a bit inelegant, but seems to work. It uses three separate replaces to cater for URL’s starting with “http://&#8221; (but not www’s), then strips off any “http://&#8221; from www’s and then sorts out remaining urls starting with “www.”. I know one bug is that it seems to fail to match the url after a “www” on its own, and also with a bit of regexp skill I should be able to combine the 3 separate passes into one regular expression.

As a quick test I used this javascript: ( I definitely need to sort out WordPress displaying code)

So as is traditional a quick reminder for myself of what my todo list was looking like:

Switch to use the live DB currently being used by the PHP app. -mainly done – should be easy to switch over now

Make links automatically out of URLs in messages

Clean up html so it looks presentable (this could be a big one)

Either set up email notifications, or some alternative, e.g. posts to twitter proven in theory – using gmail

Setup a domain name. done

Setup a webserver, to stand in front of tomcat(which is running on port 8080) so can use port 80 (aka a reverse proxy server I’ve learnt) done, using nginx, but want to tidy up config and do some testing around logging in/out

So, as is traditional, I didn’t get to spend much time on it this week, if only I didn’t have any family or freinds or leisure activities I might have more time to write a crappy message board application. Oh well.

But have managed to prove that I should be able to use a gmail account to send notification emails from – not sure if this is an advantage or not over setting up an email server, but in the spirit of just getting something working in whatever way is easiest it does the job.

Also a bit of tweaking of nginx config seemed to be having no effect, despite “ctrl shift delete, delete all cache” in firefox, which stumped me till I found a default file in /etc/nginx/sites-available which was what seemed to be taking precedence. Or maybe nginx wasn’t reloading the config like I thought it was when I ran “nginx -s reload”. Anyway, it’s working now, but need to experiment a bit to be confident that I’ve got any sort of a clue as to why.

(Not sure if this is actually the 3rd post on the message board – but will say it is for the sake of having a title)
So just a quick reminder for myself of what my todo list was looking like:

Switch to use the live DB currently being used by the PHP app.

Make links automatically out of URLs in messages

Clean up html so it looks presentable (this could be a big one)

Either set up email notifications, or some alternative, e.g. posts to twitter

Setup a domain name.

Setup a webserver, which stand infront of tomcat (which is running on port 8080) so can use port 80

First one is pretty much done, although I haven’t tested what the performance is going to be like. I might to just copy the database over to the new server if it’s terrible, but would be nice to be able to run the old PHP app.

Number 4 (domain name) is done – got http://www.msgbrd.co.uk from 123-reg.co.uk , I didn’t do a lot of research on how domain name’s work, but it was pretty easy to set up. I’ve got a pdf or two I might go back and read if I feel like I really need to know more.

For number 5 (webserver) I’ve taken my brother’s advice and used nginx, seems it’s smaller and faster than apache and is designed to act in the way I want it – i.e. passing on requests to tomcat. I’ve got it installed and running, and can edit the config to prevent the processing of requests, or just display a welcome to nginx screen. Need to do a little more reading to see how to get it to forward to stuff on to tomcat.

I haven’t had much time again to spend on it this week, so pleased to be making progress in the right direction, and feels like I’m at a point where anytime I’ve got a spare 30 minutes I can sit down and do something useful on it, which is good.

Blogging like this is working well to just give me a little bit extra motivation. I’m pretty much sure I could safely use this blog as a place to store my passwords as I’m the only one reading it, which is how I like it at the moment. Although there are loads of spammers commenting, which is a bit annoying (I’m not accepting their comments , so they shouldn’t be visible), maybe I need to upgrade wordpress to get a better captcha.

So another week over and what have we done ?
A new one just begining, I hope it is fun.

Well, I’ve remembered two other things I need to do, so my new list is as follows:

Remaining tasks before I consider myself eligible for the underwater housing treat are:

Switch to use the live DB currently being used by the PHP app.

Make links automatically out of URLs in messages

Clean up html so it looks presentable (this could be a big one)

Either set up email notifications, or some alternative, e.g. posts to twitter

Setup a domain name.

Setup a webserver, which stand infront of tomcat (which is running on port 8080) so can use port 80

So that’s progress of a sort, but basically the wrong sort.

One thing I have done is do the majority of the first task,so it should now be very simple to switch over to use the live database that the PHP app uses. This is important so I can have a period of them running side by side, and then move over to a database hosted on my memset server when I’m confident it’s working.

One thing I can say is that my coding so far is very rough and ready, and not something I’d want to show anyone else. So maybe there’l be a post in a few weeks, bemoaning the fact that I didn’t do it properly in the first place. Or maybe there will be one saying how it was more important to have just done something, and have got it out there. At the moment I feel like the second is more likely to be the case, at least in terms of keeping me motivated, but we’ll see what problems my slap dash approach throughs up in the future, maybe.

Otherwise my ankle seems to have recovered well from a sprain, so various races and club training nights provide an excuse for so little progress.

So over a year since my last post, I’m going to reduce the quality threshold on what I post and see if I can post more regularly.
One of the posts has actually been useful to me to come back and remember what I was doing, so as long as it’s ocasionally useful to me then it’s worth doing.

So far I’ve got a Java app running on tomcat on a Memset virtual server ( https://www.memset.com/dedicated-servers/virtual.php ) using mysql that roughly does what I need. I went with Memset partly because of there claim to be green and a vague desire to support a UK company. Linode ( http://www.linode.com/ ) seems to be the default choice for this sort of thing at the moment, and I might try them for a comparison at somepoint.

Remaining tasks before I consider myself eligible for the underwater housing treat are:

Switch to use the live DB currently being used by the PHP app.

Make links automatically out of URLs in messages

Clean up html so it looks presentable (this could be a big one)

Either set up email notifications, or some alternative, e.g. posts to twitter

Once I’ve done that, there’s loads I could do, but think it might be a usefull base project for trying out different web frameworks, got a plan to learn ruby on rails, so maybe writing it as a ruby on rails project will come. Also from point of view of making the message board useful, allowing logons from Facebook, twitter , openid etc. would be good, and an rss feed is pretty much essential I think.

I’m undecided as to whether there is really any point running clubs having message boards instead of just using something free like facebook, or a google group. There does seem to be something in not having to force people to create another logon for a little message board for people who all know each other (currently everyone posting uses the same shared password) , and also for not forcing people to sign up to something like facebook if they don’t want to. (Plus I don’t really like facebook). Also as it’s dedicated to just providing a simple message board it can be less cluttered and I don’t intend on having adverts. (I don’t really like adverts). Anyway, as long as it is useful as a practical learning project for me it being of any use to anyone else is a bonus.

As part of an example Java web app I’m working on I wanted to have AJAX login. That is, username/password fields on the main page with a login button which when pressed would keep the same page displayed but update any controls etc. which are enabled by having someone logged in. I could have hand coded something fairly simply (and probably introduced some security holes in the process), but wanted to use the standard Java Web App security which proved a little more difficult as its default behaviour assumes a separate login page.

I asked a question on stackoverflow, without any particularly helpfull answers, but with a bit of googling found a way.

Added a load of libraries to web-inflib
Added a applicationContext-Security.xml to web-inf – this holds the different users and roles and will be replaced by database implentation.
Added a load of context paths , filtermappings and listneners to web.xml
Used jquery to provide ajax functionality to direct a login form to the “/j_spring_security_check” URL. This URL has a filter set up which uses a “RedirectResponseWrapper” to stop the response being redirected and returns either a success or error message depending on whether the logon was OK.
There is then a “LoggedInStatusServlet” that just provideds a yes or no response to show whether the use is logged in – just to prove that the theory of the ajax login is working in practice – a bit of javascript uses this response to display an indication of whether or not you’re logged in.