Welcome...


.... dear guest to my laboratory. This is my site/blog mainly about my experiments with web and system development. However exeptions may (and will) occure.

For the time being the site is still under some development - so don't be to frightened if something is a bit off, or plain out dysfunctional.

It is my hope that something here will be usefull, or a least not a total bore. And please don't be shy to leave a comment on my laboratory notes (aka. blog posts).

 

Laboratory notes (a.k.a blog)

Manipulating the browsers url with JavaScript

This might be old news for some, but since it's new for me, and very usefull, I'll blog it - and maybe it'll help someone else as well.

I was working on a web application where several of the pages needed to give messages to the user - and which messages was controlled by a url parameter. So if I wanted to display a message saying "The user information is updated" the url could look like user.cfm?m=1 (showing message 1 from an array of messages).

This is all well. But then I thought that if a user refreshes the page - or go on to another page and then click "back" in the browser it's not a good idea to show this message. So a quick google later I found pushState() - which can be used to manipulate the url, and also the browser history.

So by adding this at the bottom of the page, I got exactly what I wanted:

<script>
  var stateObj = {foo: "bar"};
  history.pushState(stateObj, "User information", "user.cfm");
</script>

It takes 3 parameters as you see.

  • First a JS object that is stored in the browser and you can access when coming back to the page (in my example I just create a dummy object).
  • Second it takes a title (wich is not in use).
  • Third it takes the script name of the url.

You can read more, and also find info on the related replaceState() function and the popstate event, and see browser compability on the page where I learned this.

 

Free programing books

This one is to good not to share:

So dive right in :)

JavaScript frameworks and libraries - welcome to the jungle baby!

JS monkeyWhen I first started out making webpages JavaScript was something mysterious, some bits of code to copy from the internet, that sometimes would do some minimal magic on a webpage...... at least in one browser. Even later on, I have to admit, that I did not give JavaScript the attention that it deserved, and I regret it still today (well not to the degree that I let it ruin my sleep - regret is a rather unproductive thing to carry around).

Graduatly though I have come to the point where I really don't want ColdFusion have to much to do in my front end. Ideally a new app should work with just .html files in the browser - no need for ColdFusion to generate any front end code. (though I have to admit that for general webpages - and also more quick and dirty apps I do use .cfm files with their handy outputs, loops etc.....).

For quiet some time now JavaScript, and more often than not jQuery, has been a part of any project I've been working on. However need and curiosity has led to the search and discovery og other libraries and frameworks - some overlapping in functionality, some not - some working on their own and some working together with others. And here we come to the reason for the title - the amount of useful JavaScript libraries and frameworks are now getting so plentiful that it's hard even to get an overview over them, not talking about trying to get acquainted with them.

So without much further ado - here's a list of some of the trees in the jungle I've found, and that looks interesting. Some of them I use, some of them I wan't to use, and some of them I will probably not get into. Expect not that I will give an overview of what each library and framework do, or come with recommendations. This list is mostly for myself to remember them - and then later on many of them will probably get their own blog posts.

In no specific order (the ones in bold I've worked with or tried out - some much, some little):

  • jQuery - I never leave home without it. Great for working with DOM elements.
  • Underscore.js - a whole bunch of useful functions that are not present in JS by default
  • Moment.js - date library for parsing, validating, manipulating, and formatting dates.
  • Ember.js - web application framework
  • Knockout.js - fantastic for separating data from presentation
  • Backbone.js
  • AngularJS
  • Crossroads.js - js routes system
  • Amplify.js
  • node.js - this one looks really exciting. Serverside JavaScript - looks awesome for large amounts of realtime data views.
  • Express - web application framework for node
  • Sails.js - realtime MVC framework for node
  • Socket.IO
  • Passport - authentication for node
  • Sizzle - CSS selector engine

Ok - almost the whole last part of the list deals with node. I'm not ready to swap out my CF backend for node (or anything else), but to leverage this technology to some degree is not out of the question.

If I should make some predictions on the other ones...... the ones I use, I will continue to use. When it comes to choosing between Ember, Knockout, Backbone and Angular - my gut feeling for now says Knockout, but time will show. Maybe I'll use several of them. Or none. So many libraries and frameworks, and so little time to really learn them. And I've probably forgotten about some as well. Please add your suggestions and favorites in the comments.

cheers - Trond

This post was originaly posted on 18. april 2014, but reposted after I created a new blog

First entry - second edition

Some of you might have noticed already that after a long absence I've decided to have a go at getting a blog devoted to web and system development up and running again.

I first started out with a blog withing a framwork that was offered "plug-and-play" on a shared hosting solution I used. However I found it to limiting, and really missed FarCry, the framework I've mainly been working with in my work. It could however not be used on the shared host, so I got a dedicated server. It was some tinkering and experimenting to get things up and running as the new server is running Ubuntu Linux operating system, Apache web server, Railo CFM engine and MySQL - all totally new to me (except MySQL which I have used many, many years ago.).

Some of you might remember me from old times, when I was fairly active and visible in the Cold Fusion related blogsphere.

You can check out my old blog here: http://web.archive.org/web/20070817090916/http://trond.ulseth.no/

This current blog was set up today using ContentBox CMS and using their default page design. I'll look into customizing the overall design of the site, never used ContentBox before, so that will be interesting. This part was part of the first edition of the first post :)

The things you can expect me to wail about when I get running is VERY roughly:

  • ColdFusion
  • HTML, CSS and JS
  • FarCry CMS
  • Databases

I might also go into "off-topics" like music (mainly rock), guitars, cars (I have a MX5/Miata), maybe even family life and whatever I feel like (no rules really).......

Hope to "meet" all of my old contacts from the worldwide CF community here, as well as new friends.

cheers - Trond