Well, I tried to upgrade some packages on Myth, and the machine crashed. Not too bad, just wireless and X. Guess I will spend this beautiful Friday evening installing Fiesty.
I have decided to create a MythTV page on my site, not only to help everyone out there with their own setups, but to help me remember when everything crashes.
In the world of rich web applications, browser bugs and incompatibilities are the number one killer of productivity, next to YouTube, Facebook, and Myspace. Like most web developers, I have come to realize most of those issues arise from IE and Safari. Today I stumbled upon another interesting problem when trying to implement some dynamic forms.
Take for instance the following code snippet:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| //Create form elements
var form1 = Element.create('form', {name: 'test_form'});
var input1 = Element.create('input', {type: 'text'});
var input2 = Element.create('input', {type: 'text', name: 'input2'});
//Append inputs to form
form1.appendChild(input1);
form1.appendChild(input2);
//Append form to document
document.body.appendChild(form1);
//Set input1's name
input1.name = "input1";
//Check if form picked up on name change
alert(form1.input1);
alert(form1.input2); |
If you aren’t familiar with Prototype, this may be a bit hard to understand, but here is what is going on. I am creating a form with two inputs. Both inputs’ names are set in Javascript, but one is set before the form is appended to the document body, and the other is set after.
This code works fine in Firefox, but IE and Safari fail to note the name change, and don’t add the element’s property to the form element.
I created a workaround for a different Safari issue a few months ago, but it works well for this issue as well. The only requirement is your application must be using Prototype.
1
2
3
4
5
6
7
8
9
| Form.prepare = function(form){
var elements = Form.getElements(form);
for(var i=0, ii=elements.length; i++){
var elm = elements[i];
if(elm.name && !form[elm.name]){
form[elm.name] = elm;
}
}
} |
In the above example, this would be called before we wished to access the form elements, alert(form1.input1).
After the horrible tragedy that took place on Virginia Tech’s campus early Monday morning, I wondered how VT would ever recover. Nearly everyone in Blacksburg, including myself, knows someone affected by the day’s events. The calm, safe environment this town and university has provided for so many was shattered in a matter of hours by one selfish individual.
What was not shattered Monday became evident yesterday at the Convocation and the Candlelight Vigil. The unity, love, compassion, and pride this university has. For many Hokies, they had seen more of campus through their television than with their own eyes over the last 2 days. Once everyone was able to come together, on campus, all doubts as to the future of this university and town were extinguished in my mind.
The Candlelight Vigil was an awe inspiring event in remembrance of those taken from our campus. But it served as so much more than that. Realizing that everyone else is going through the same emotions of shock, anger, and hurt is comforting in an odd sort of way. I even found myself laughing when some of the candles caught fire to their wind-protecting paper cups. Afterwards, two VT alumni and local Blacksburg residents offered to buy my friends and I Ben and Jerry’s ice cream. This is truly a wonderful town and university, that I am very proud to be a part of.
Normally on a Monday, I enjoy getting back into the swing of things at work. After a weekend away, I usually have a ton of work to catch up on, but today was not a day for that …
After driving by West AJ and seeing 4 cop cars in front of the building, then hearing all the reports of shootings, all I could think about was my friends on campus and their safety. Such a heinous act is hard to imagine in such a small, closeknit town. It is definitely something I will never forget, and I am sure the entire VT community feels the same way.
I graduated from VT less than a year ago, where I took classes in Norris and visited friends in AJ frequently. This act is something that I can’t fathom and don’t know if I ever will be able to. My heart goes out to everyone effected by this tragedy.
Keep praying for the university, Blacksburg, and most importantly the families and friends of the victims.
So, you’re designing a new feature in PHP for an application. Like most good programmers, you have a data layer and a business logic layer. But where is your security layer?
For the most part, whenever I design a new feature, all the security goes into the business logic, because the data layer should be “dumb”. Well, this is annoying because 1) I have a lot of repeat code and 2) it’s very easy to forget something. The ideal place for it is really the data layer, but this is bad practice because you limit the data layer’s flexibility.
Then, while driving to Wendy’s for a #8 today, it hit me. The perfect security layer. Unobtrusive. Simple. Elegant.
The beauty of PHP is it allows a perfectly transparent wrapper, without a lot of code. Through the use of __get(), __set(), __call(), __isset(), and __unset(), a class can be mapped perfectly to a data object. Therefore, you can just pass a data object to a security class in the constructer. Then, anytime a function or class member is accessed, perform security checks if needed.
I haven’t designed an abstract base class for this object yet, but I am going to very soon. It should help to not only clean up code, but secure the code. Definitely going to be an addition to Wack v1.