The World Through the Eyes of John Brennan
A few months ago I built a bookmarklet for the app I’m currently developing for the government. A bookmarklet is essentially JavaScript embedded in a link and placed in your browser’s bookmarks folder or toolbar.
The bookmarklet I build is meant to enable analysts to clip content from the web and add it to a “notebook.” These notebooks are used by analysts to organize information and collaborate. We are also leveraging a triple store backend to connect similar keywords and make assertions which will ultimately allow these analysts to find more relevant information and catch the bad guy. But enough of what I do, let’s get back to the bookmarklet stuff.
So I had originally had all the code inside the link. The real problem with this is that new versions require an “install” and that is not what the web was about. So after some thinking I realized that I could just embed a file in the bookmarklet, so updates can be made seamlessly (or once the file cache expires).
While I was going through this process I came across some strange behavior when trying to attach the script element to the BODY. Another caveat to this approach was that if some arcaic website is still using FRAMESET there actually won’t be a BODY tag. More of a reason to attach it to HEAD.
Code is below:
javascript:function loadScript(scriptURL) { var scriptElem = document.createElement('SCRIPT'); scriptElem.setAttribute('language', 'JavaScript'); scriptElem.setAttribute('src', scriptURL); document.getElementsByTagName('head')[0].appendChild(scriptElem); } loadScript('http://localhost/bookmarklet.js');
San Francisco was great! I got to take part in a great conference, network with other people facing similar challenges and catch up with some of my old friends in the area.
It’s amazing how many people are doing “startups” in that area. I put startups in quotes though because a startup isn’t anything less than a great idea that hasn’t been fully executed yet. Second, I should clarify “amazing” too. Obviously Silicon Valley is the mecca for high-tech startups in the world, but you don’t actually realize what that means until you start to talk to people there. Here in San Diego I can count the number of people I know working on startups on one hand. Ok, maybe 2 hands if you count people wanting to get involved, but haven’t made that first step yet.
While I was catching up with Sameer and Shirin over dinner they were telling me how the majority of their friends (aside from working at Google) work in startups.
That said, here’s a summary of what I got from the Velocity conference. I had a great time and Steve Souders and the O’Reilly team really did a great job putting this together. My only suggestion for next time would be to show some more real examples. For example, I know that in order to scale you need to shard, partition and replicate the databases. You need to profile and test, then profile and test again. Maybe I was looking for more of a workshop, but it was very informative and I hope you return next year!
I’m currently attending the O’Reilly Conference, Velocity Web Performance and Operations. It’s the first of its kind, focusing on building web applications that scale. My focus for the conference is to build on top of what I already know and dive deeper into performance best practice, database tuning, achieving more with less, launching in the cloud, and performance/profiling tools to track these trends.
My notes will be available live here:
Feel free to leave your comments if their are specific questions you want asked.
Code. Design. Explore. is the blog of John Brennan, a web developer/designer, entrepreneur, and avid world traveler. I currently live in Brooklyn, NY.
I am the Co-Founder of OpenAction and lead Product Development. We are a open platform social enterprise that helps organizations engage with donors, share knowledge with other non profits and empower the community to get involved to create positive impact on our planet.
This blog will mostly be around building cool things, although I will surely include my travel experiences when I am abroad. Feel free to subscribe to a specific category if that is only what interests you. And please connect with me. I always enjoy meeting new, interesting people!