Urghh!

Today I’ve been trying, trying really hard to apply some of that JavaScript knowledge to a simple problem, something that if I was doing it in HTML and PHP would have taken about an hour, and I’ve not done PHP for as long as I haven’t done JavaScript, but that’s not a fair comparison as like most people that used JavaScript in the past I did very limited things like pop up a window or an alert when something went wrong. I only had one thing to do today, add some functionality to a web app to upload files and store them locally on the server.

I’ve only spent 12 hours on it so far, and it sort of works if you ignore the fact that Drag and Drop won’t work an the progress bar doesn’t appear / update or that it doesn’t close the upload popup at some point, but if you’re willing to apply some manual intervention it will upload a file eventually and it will (after you’ve closed the upload dialog and refreshed the page…) display the new item.

I think some of the challenge is the many layers to the app, with html, css, javascript, bootstrap, angular, jquery and nodeJS; there’s just a lot of places doing stuff and it’s not all quite settled into my head yet… combine that with only recently having played with all of those and it’s a little confusing. I spent a lot of time trying to steal peoples code to save time from various open sourced git repos, I basically found that after stealing 5 and none working that I was wasting my time so I just took one as an example and went from there, This one in fact.

With in a couple of hours I had most of it down but not working, having dedicated this sprint to button first development I got the UI looking just right before moving on to any code. I then set about making the javascript bits work and I managed to get everything working apart from drag and drop, so it wasn’t posting data but it was showing files. For some reason the drop event I had setup was not getting triggered, every time I dropped something on it it did nothing ad the browser just opened it as a file.

Annoying, I imagine that something I’ve done in bootstrap or angular has had an impact on it but I don’t know and have just had to abandon it for now, maybe it’s the modal? maybe it’s some weird local issue, either way I’ll have to come back to it.

Some lessons learned

What’s the point in wasting a day on various elements of JavaScript if I’m not going to learn anything. Well I learnt loads! I learnt how to use the debugger in Webstorm which was pretty neat, once I’d clicked that button I found my issue in my node code really quickly, next time that will hopefully save me 2 hours :)
I also learnt that at my level of skill, using someone else’s complicated library for stuff is a bit hit and miss, especially if it requires working with multiple technologies that I’m also not familiar with…

In short at least by writing it my self / re-writing it from other’s examples I had some time to digest it and understand it, of course it doesn’t work but I fell better for having a go :) I am still relatively hopeful that in a few months this will all be second nature, but which time I would have probably forgotten all the ruby I know :)

Anyway, a short one today, more programming tomorrow and hopefully after another full day I would have the upload box working.

Category:
code
Tags:

Don't be Shy, Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: