WelcomeToYourMac v0.2.6 Released

Last week I finally had time to release a new version of WTYM! WelcomeToYourMac is an easy way to access your Mac’s files/screen/apps from any browser – even your iPhone. Download your copy here.

WTYM0.2.6

I’m very excited to finally have released this version. It’d been sitting on my laptop ready to release for the past 3 months, but life just got in the way. I’m finally settling back into a normal routine, so I could finally get a new build out and uploaded. If you already have WTYM installed, then it should auto-update, otherwise head over to the WTYM site and grab a free copy.

So what’s new in this version? Bug fixes!

You should now be able to stream all of your media to any computer. You can also stream your media straight to your iPhone. Lots of other little bugs were fixed, but most importantly this version lays the foundation for the native iPhone app that I’ll be releasing (hopefully) soon.

I’m about 80% done with the native iPhone app that’ll let you browse every single file on your Mac, Spotlight search your Mac, and stream your media to your phone. It’ll be pretty epic, so stay tuned! 😀

What are you waiting for?! Head over to WTYM to download the latest version!

The undocumented life of JavaScript’s parentNode property – Internet Explorer edition!

Did you know that the parentNode property in JavaScript doesn’t always point to the element’s parent??! And not only that, but that very same node that’s lying to you also appears multiple times in the DOM.

I didn’t want to have to tell you this way, but there’s just no way around it: in Internet Explorer 7 (I’ve left testing 6 and 8 as an exercise for the reader 🙂 ) the parentNode property can flat out lie to you – specifically – with pasted content in a rich text editor like TinyMCE. That’s right, a bold-faced chain-yanking tall-tale’d lie, and I’ll prove it to you.

Documented Behavior

According to the W3C documentation, “the parentNode property returns the parent node of a node.” And based on that, you would expect the following code to alert “true!” for as many times as the node has children:

var node = document.getElementById('someElement');
for(var i=0;i<node.childNodes.length;i++){
     alert(node == node.childNodes[i].parentNode);
}

This is true for the vast majority of cases, but is not always the case. I’ve found an exception in how Internet Explorer 7 handles pasted content inside rich text areas like TinyMCE. Even jQuery will select children who’s parentNode is incorrect!

Just get to the Demo!

I’ve set up a demo page that can consistently repeat the bug. For the demo to work, you’ll need to:

  • use Internet Explorer 7
  • open the attached rtf in WordPad
  • paste into the TinyMCE content area
  • press the “validate” button on the bottom toolbar

Besides IE’s fearsome use of the DIR tag, you’ll notice:

  • I’ve painted duplicate nodes red in TinyMCE
  • An brief XML output of the DOM is output into a text area beneath TinyMCE showing the duplicate node
  • A count of each node is displayed as an attribute in the text area. Notice the count=2 in the nodes at the bottom of the textarea! Yikes!

If you’re not in the mood to fire up the demo yourself, just click the link below to see what the DOM ends up looking like. Take special notice of the count=2 on the nodes at the bottom:

View IE7’s invalid DOM after a paste

Try It Yourself!

For the demo, I created a simple TinyMCE plugin that validates the editor’s DOM. Paste the magic text in IE7, and it’ll mark any invalid nodes in red and also updates a textarea with a simplified XML representation of the DOM. The plugin uses both native JavaScript functions and jQuery to find nodes with invalid parentNodes.

View the plugin code

Download the plugin code

A TinyMCE Bug?

An obvious question is: is this a TinyMCE bug? and the answer is “No.” There is no way to manually add the exact same node to multiple places in the DOM. Instead, the browser simply moves the node to the new place, and removes it from its original location. Even if Spocke tried to create this bug, he couldn’t 🙂

If you believe me, skip to the conclusion. If you don’t believe me, open up this second demo that uses the following code to append a node without calling removeChild() first. Even without specifically removing a node before appending it somewhere else, there still only exists one node in the document:

$(function(){
var node = document.getElementById("copyMe");
var target = document.getElementById("target");
target.appendChild(node);
});

In Conclusion

As far as parentNode is concerned, if:

  • you’re writing a plugin for TinyMCE or similar
  • you’re dealing with (possibly) pasted content
  • relying on parentNode

then:

  • validate! If(myNode != myNode.childNodes[i].parentNode) is true then you have a problem!

I hope you enjoyed the latest the-undocumented-life-of post! Also a fun read: The undocumented life of jQuery’s .append()!

Close

[viewcode] src=/tinymce/3.2.5/jscripts/tiny_mce/plugins/duplicate/editor_plugin_src.js name=plugin lang=javascript[/viewcode]
Close

[viewcode] src=/tinymce/dom.txt name=dom lang=html[/viewcode]

Cancer is a Blessing – (and a little more about my diagnosis)

My wife Christi was diagnosed with brain cancer in early April of this year. Over the past 3 months, she’s been keeping all our friends and family up to date on facebook by regularly postings notes, and I wanted to copy/paste her last note here; it’s a great summary of where we’re both at in this whole process.

Thanks to everyone for your continued support!

That’s right, cancer is a blessing. I’ve known about my cancer now for a little less than three months and the past three months have been the worst and best three months I have ever experienced. Just to give a quick overview, it’s been the worst for obvious reasons; I’ve been away from my home and normal life, I’ve undergone 3 brain surgeries (not too bad for me, but my poor family having to wait 3-5 hours depending on the surgery), I missed so much of Cailyn’s little world, and Adam’s had to put his life on hold as well.

It’s been the best three months for much less obvious but much more powerful reasons. Life has new meaning. I’ve always known that God is supposed to love me… I’ve even always known that God DOES love me – these past three months I have felt more loved by God than I can ever remember. I see Him everywhere in everything… and isn’t God big enough for Him to actually be there!? Yes, I’m 100% convinced that He is… only my creator can know me SO well and speak to me so clearly exactly the words I need to hear. “I love you and I’m taking care of you”. What an amazing feeling and experience!!!

I’ve also grown even closer to Adam and our families. In the face of tragedy you learn a lot about people. I couldn’t have asked for a better support group!! Both families (mine and Adam’s) were so supportive and amazing. Once again it’s been confirmed that Adam is THE perfect guy for me. Before he was my best friend and the love of my life. Now, he’s also quite literally my hero. Had he not been there on April 5, 2009 I would not be here today.

There are so many more blessings that have come out of this situation. Typed words on a computer screen just can’t convey it. I desperately wish that everyone could see life through my eyes right now – how God desires a relationship with each of us and accepts us where we are at. I know that’s a hard realization to come to for a lot of people, but if anyone anywhere ever reading this wanted to talk to me more about it please do!!

I have been asked by loving people if all this positive talk is just a front or if it is from the heart (a very valid question!!)… let me tell you, I don’t know how to be anything but real. I know what it’s like to carry a huge psychological burden. I actually went to a counselor when I was in high school to try and manage all my feelings about my sister’s brain tumor, a friends suicide, and a myriad of other tragedies which took place very randomly all in the same year (things that would put anyone in counseling…). When we found out I had cancer, I was willing to go back to a counselor if it was needed due to the gravity of this situation. Then an amazing thing happened. I was given an overwhelming peace. I truly believe that I am going to be okay.

I wouldn’t trade this situation for the world. Why? – I know who God is and though my faith in Jesus Christ I know exactly where I am going when I die (so even if I don’t survive this I have no fears); and a close proximity to death puts life in a new, beautiful, perspective. Before I talk more about death… because, sorry, I’m going to… I really want to emphasize something – I do not think I am going to die any time soon. I have a huge peace about this and I am not the least bit worried about it… that said, I wanted to finally share my actual diagnosis.

Glioblastoma Multiforme – Grade 4 Brain Cancer

I hadn’t officially shared name yet, but at this point there’s just no reason not to. According to Wikkipedia, “The median survival time from the time of diagnosiswithout any treatment is 3 months. Increasing age (> 60 years of age) carries a worse prognostic risk. Death is usually due to cerebral edema or increased intracranial pressure. One in twenty of glioblastoma patients survive for more thanthree years, and approximately one in 5,000 glioblastoma patients survives for decades.”

I think I also already shared that the median survival time for someone with my condition who is under the age of 50 is approximately 17.1 months. That puts my cancer “due date” as I call it somewhere around September 13, 2010 – my parent’s 30th wedding anniversary. We’re going to have a party… a BIG party on that day… and, ummm, not for my parents (sorry Mom and Dad) but because, by the grace of God, I will still be here and will have crossed yet another important milestone.

Over the past three months my family has lived with this knowledge and we are continuing to trust God and see what is to come. We are not afraid. Praise the Lord for that!! We are not afraid.

Thank you all for your prayers – we have felt them. While in Houston we had another tragedy befall our family. Adam’s grandfather was put into hospice and passed away at the end of June. Adam was actually able to be there with both his mom and grandfather when he passed. We were all able to go to the funeral home in Houston for a little memorial before they had the real event in Louisiana. And, Adam was able to attend the funeral while I stayed in Houston for treatments. What a blessing that we were already there and able to join together as family in the face of sorrow.

As of now I am back at home in the beautiful city of Portland. We’ve been home since Saturday, July 11th and things are going really well. Adam is back at work and has seen amazing support from his bosses and co-workers (seriously, we love this company!!). I am home with Cailyn and have someone with me almost all hours of the day to ease my load and to ease everyone else’s minds. I am confident that I could handle Cailyn on my own and will do just fine once the day comes, but until then I’m enjoying a little more time off and just being home with my little girl and hubby. I can honestly say that it’s a good life!

Google Author link
Page 22 of 51« First...10...2021222324...304050...Last »