The media change of TV and Computers

Written by Peter Vejrum Terp on . Posted in Peters Blog

Last night when me and my lovely wife was talking, we came around the subject TV and computers.

For some years ago the TV was a source to knowledge for both of us. We were both often watching TV which included some kind of knowledge, like Animal Planet, History Channel, Discovery and so on. The computer was mainly used for entertainment like games and similar. The TV had a larger place in my life than today, and the computer was primarily for entertainment or work.

This has actually changed in the last couple of years, today the TV is used for entertainment in our home. We often draw back to the couch to watch some entertainment TV, just to get a little relaxed in the buzzing head.
The computer (and iPhone, and similar) is now used for getting knowledge, working and doing all kind of stuff, but it’s actually rarely used for entertaining games.

Does TV have a future for me? It might still have a place in my home, but it has definitely become a lot less than in the past. There is one funny thing – I find it a lot easier to watch TV just for the entertainment, than using my computer for entertainment. When I use my computer I need to decide what to do on it. When I watch TV I just take a round trip on the channels and stuck on one of the channels.

This is just some thoughts about how the media changes at the moment.

Retrieving “FOR XML AUTO” from MS SQL in CFML

Written by Peter Vejrum Terp on . Posted in Peters Blog

Today I was asked if it was possible to retrieve MS SQL XML in ColdFusion. My answer was of course that it must be possible. I had never done it before, but I couldn’t see why it should be a problem.

Welll!!! That wasn’t exactly as simple as expected. Here is what I tried and what happend and of course how to solve the issue

I had a query which looked something like:

This sql returns an XML object from MS SQL Server, which should be really easy to access. But I was wrong….

The name of the field with the XML was named “XML_F52E2B61-18A1-11d1-B105-00805F59916B” and if I changed just a minor thing in the sql it would have a new name. Then name of the field was dynamic. That in it self can be a problem, but can be solved by acessing the first column in  a result.

My first thought therefore was to retrieve the first row and the first column of the query in CFML, that was possible (I had to do some tricks but possible). Then the second problem occured – I didn’t get the full XML, only a part of it.

Well that’s solvable I just iterate the full result, cast the column as a string in ColdFusion, and adds each rows string in the end of each other. No problem! Well then the new problem came by, it wasn’t possible to convert the MS SQL XML datatype to a string – I tried a lot of different things, but nothing seemed to work.

A hole new approach was needed! Then a  college came with a brilliant idea – hack the result of the query with a query. We ended up doing the following code
<cfquery datasource=”MYDATASOURCE” name=”qXML”>

<cfquery dbtype=”query” name=”xmlString”>
SELECT ‘xml’ AS xmlstring FROM qXML WHERE 0=1

<cfoutput query=”xmlString”>

This isn’t exactly a nice looking code, but it does the job and it’s fast. We simply cheat the sql – a very simple but very ugly solution. I hope this will help some of you CFML programmers out there!

A lot simpler solution could be SELECT (SELECT TOP 100 * FROM mytable FOR XML AUTO) AS myResultField

Optimising webproject flows

Written by Peter Vejrum Terp on . Posted in Peters Blog

At the moment Im started optimising the flow on projects, programming and similar where I work. First you need to know that my job position is “Development specialist”, “Project manager” and daily technical manager for on a travel website.

Well back to where I started –  the case is that we need to improve the quality and the speed of how fast things is done. Therfore I tried to create a list of rules that each of us developers and project managers should follow to make the flow more effective.

When receiving a project / task – before startup 

  1. When receiving a project, walk through the tasks/subtasks of the project and determine if you understand every part of the project. If you don’t then ask the the project manager about the different parts until you fully understand.
  2. Retell about how you have understood the project.
  3. Always review The project when you get it, assess what 20% takes most of the project time and give information to your project manager. It is very likely that the 20% is less important than the value of the hours to make it work.
  4. Create a note or a short list of who(m) can assist you on the project if you have problems.

When recieving a project / task – in action

  1. Create a daily check list with small tasks, and with only 3 must do today tasks. The rest has to be a lower priority. Of course you will do more tasks thant that on a day, but you need to have a focus on the most important things, and the top 3 needs to be done. Each task must not exceed 2 hours – 1 hour is better than 2 hours.
  2. Create a test scheme on how to test the full project, and part of the project.
  3. When you are run into problems you can’t solve or just problems which takes a lot longer to fix than expected, then call for assitance – remember who can help you!


  1. Many requests on a page = slower page, therefore try to elminate the amount of requests. Meaning that JavaScript and stylesheet needs to be loaded from as few files as possible.
  2. Images which is too large = slower page, therefore insure that all images is in the right size. This is of course the graphic designers job, but it’s better to check – just to be sure. Recommendation is 80% compression for a jpg image.
  3. Spriting of images/icons – check if it’s possible to sprite images and icons in one file. This lower the amount of requests, and can also lower the amount of Kilobytes used for images.

Optimising the day – elimination

Written by Peter Vejrum Terp on . Posted in Peters Blog

In this short article I will like to share how I have optimised my work day and at the same time limited the stress of my workday.

It’s all about elimination, not about working harder!!!

Many leaders talk about working harder and running faster. I think that is a bad way to increase the through put on a workday.

Here is some minor changes I have made to optimise my day:

  1. Unsubscribe the newsletters that you deletes everyday. I removed 15-30 min. of my mail reading by doiug this.
  2. Stop reading mails constantly. Limit the mail reading to one or two times a day (Still working on that one)
  3. Limit the meetings! Short agenda and a very limited time (5-15 min) – no time to all the talk about nothing.
  4. Bulk tasks! Example: You create a status report every day with som numbers and statistics, it takes 30min. to create it. If I only do it once a week and do all the numbers for all days at the same time, I can finish all the work for a whole week in only 1 hour. Why? Because when you bulk a task, then you elimiate a lot of “grease” (it takes time to start a task, write a mail, end a task and so on).
  5. Understand the ideas of the project/task. It might very well be that the “customer” want something, but when you start looking at the project, you experience that a very small part of the project (typical 20%) will take 80% of the time. Remove those 20% if possible, in most cases those 20% doesn’t give back the effort.
  6. Create a short priority list, and do follow it. Only 3 “Must do tasks” a day! The rest has to be a lower priority!
Hmm actually I’m still working on all those! Some of them is easier to get into than others. For me 2 and 5 is the hardest!

Facebook developing notes

Written by Peter Vejrum Terp on . Posted in Peters Blog

Today I have just started learning a little more about Facebook development, I thought that I would share my notes from what I have learned. The notes is actually just some bullet, but they might be useful.

Facebook development today short summary

  • Rest API, FBML, FBJS should no longer be used, they are considered “Legacy”
  • Facebook Connect and Facebook Canvas App is nearly the same today, and the boundaries is bluring out.
  • Facebook Canvas loads App in an iFrame
  • OAuth 2.0 used to connect your App to a Facebook session for data access, like getting the required permissons to retrieve data.
  • Graph API is used for accessing data
  • Platform Dialogs used to prompt for user actions, such as sending requests.
  • Social Plugins allow external sites to integrate Facebook functions and to use social data
  • Numereous SDKs allow fair freedom of choice for App development.
  • Its important to know, that the only constant is change in the case of Facebook, therefore follow Facebook Developers Blog, and follow other sources for whats going on Facebook. A lot of changes happens all the time.

Usefull links

Facebook Graph API

  • HTTP(S) URL access to any objects in the Social Graph
  • All available data returned as JSON objects
  • Access to objects: Users, Pages, Events, Groups, Applications, Status messages, Photos, Photo albums, Profile pictures, Videos, Notes and Checkins
  • Use this interface to get a better inside view of whats available in the graph api
  • SDK For CFML can be found here
  • Do not use the LIMIT in the paging functions, use SINCE and FOLLOWING instead. Limit can sometimes make some funny results.

Facebook Apps

  • Canvas Apps (Uses the full available width of the Facebook site)
  • Tab Apps (Runs on a Facebook Page Tab, therefore not as wide and often utilise “Like” gating.
  • Read more about how OAuth is implemented in Facebook here
Great online course

Posts from my blog