Here is a question I have been contemplating for a while…when to sanitize your input? Do you sanitize it as soon as you receive it, or when you need to use it?
Any thoughts?
my life experience and information that may help others find what they need
June 22nd, 2008 — .NET, Ajax, Code, JavaScript, PHP
Here is a question I have been contemplating for a while…when to sanitize your input? Do you sanitize it as soon as you receive it, or when you need to use it?
Any thoughts?
September 25th, 2007 — .NET, Ajax, Code, PHP, Work
There has been much debate on using XML or JSON with your AJAX, but in my mind, the debate is pointless. Both are nice, one is quicker, one is slower. However, when it comes to development pick what you know best and what you can implement/maintain easiest.
If you do this, you are guaranteed the following:
So how does JSON differ from returning XML in your AJAX requests? Lets first look at the advantages of XML.
How about disadvantages of XML?
Now for the advantages of JSON:
And the disadvantages of JSON:
As for myself, I am a JSON person. I didn’t used to be though. My original AJAX applications were focused around XML primarily because I could make use of an XSLT and I always validated against a schema. However, JSON has won me over due to speed. JSON’s speed is just ridiculously fast and it showed when I converted a major application over to it. I saved nearly a third of the time it took to do a fairly simple task.
However, pick the poison that you understand most, otherwise, it could have detrimental affects.
September 16th, 2007 — .NET, Ajax, Code, JavaScript, PHP, Projects, Work, kiosk
This weekend has been a nice relaxing weekend for me and so when I got back home this afternoon (on Sunday the 16th), I was in a great mood to refactor some of my kiosk code base. Now, I should start by saying, I decided to refactor code instead of write new code tonight because I wanted to lessen the number of files that needed to load in the Ajax functionality.
Kiosk, uses Ajax in interesting ways to provide a better experience, but with that, the Ajax applications were built as each page was assembled. This caused functionality across pages to get a bit messy or functionality shared across pages to get thrown into individual files. Well the problem with individual files, is that is yet another file for the browser to download.
So before I get any further, let me discuss refactoring and how it can solve many performance binds your application may be experiencing.
To start off, refactoring is taking common code, or code that is used across pages or frequently and moving it to a more global location so it can be called easier and the code only has to be written once.
So where can this help?
Now in my situation, I took about 4 JavaScript files and combined them into a single file adequately named “general.js”. The file contained code to automatically log the user out after a set amount of inactivity in the UI (User Interface). Secondly, it contained the version checking mechanism calls that see if they are running the latest version of the software. Unfortunately, those are the only two things it does right now, but as the project progresses, I am sure more utilities will get added in this file.
My next task is to refactor the Data Grid functionality so it is 1) XHTML, 2) easy to build complex columns with complex rows, 3) customizable by identifying StyleSheet classes for the columns and rows. Hopefully, I can get my head around this idea and get it working with little trouble to the programmer.
So what can you think of that you need to refactor? What performance gains do you suspect you will achieve with the refactoring you do? Any performance markers?