JavaScript Stuff: CSS Dynamic Height and Width Using jQuery

While working away on Haven, our online development app, I found the need to be able to dynamically set the height and width of a few elements on the projects main editor page. It’s the part of the application that will look less like a web page and more like an application. I’m still rather new to JavaScript and extremely new to jQuery so figuring out how to do this was a little time consuming. The end result was so freaking awesome and flexible that I thought I’d share it with the world. To use this code just add the class dynamic-height or dynamic-width to the elements you want to have fill the screen. Then add the class height-offset or width-offset to any elements that have a static height or width that should be taken into account when calculating the white space left on the screen. Then add setDynamicDimensions() as the onresize event and as a script block at the bottom of the page. Just like that you will have elements that fill your page without causing scrollbars and the users screen size or resolution won’t matter. /* * Finds all elements that have a class of dynamic-height or dynamic-width and sets their * heights and widths appropriately offset by the heights or widths of all elements that * have a class of height-offset or width-offset. */ function setDynamicDimensions() { var heightOffset = 0; var widthOffset = 0; // Calculate the height offset $(".height-offset").each(function(){ heightOffset += $(this).outerHeight(); }); // Calculate the width offset $(".width-offset").each(function(){ widthOffset += $(this).outerWidth(); }); $(".dynamic-height").each(function(){ // Take into account this objects margin, border and padding...

Reveille Product Update: Timezone issue has been fixed

What’s New? We recently deployed an update which addresses some issues with reminders getting created at the incorrect time. In order to completely fix your account, you will need to set your timezone in Reveille. Go to your Settings page, and choose the time zone that matches what your Backpack timezone is. The change is saved automatically. After your timezone is set in Reveille, any new calendar events that include reminder hash-tags will have reminders created at the correct times. Will My Existing Reminders Get Fixed? Yes! We automatically scanned your Backpack calendar for you when you set your time zone and recreated all of the reminders that were scheduled for the wrong times. What Happened? A bug in the software that connects Reveille with Backpack was causing reminders to be created at the wrong time, sometimes off by many hours. Or, to put it in simpler terms, we screwed up and we are really sorry it happened. To make it up to you, we are going to reset the 30-day trial period on all accounts starting today. Thank you for your patience while we worked to fix this...

Ruby Stuff: Use retry to restart a begin rescue block

I recently needed to be able retry a begin block and was simply nesting begins within begins, then I ran across this little Ruby gym. The retry, http://www.tutorialspoint.com/ruby/ruby_exceptions.htm. begin @calendarapi.calendars rescue Exception => ex logger.info ex switch_ssl() retry end Obviously this bit of code could end in a continuous loop so be careful to add a little logic to ensure a clean...

What Is The Character Of Your Company?

That may sound like a silly question at first glance since we usually associate character with people. The idea of company character makes a ton of sense once you realize that a company is it’s own entity. Any company that employs at least one person has a character and since every company employs at least its owner then I think it could safely be said that all companies have character, be it good or bad. Before you can answer the question “What is the character of my company?” it’s probably important to identify what defines the character of a company. Company character IS NOT defined by a mission statement, what’s on the About Us page or by what the founder/owner says it is. Company character IS defined by the content that you put out, i.e. blog posts, Twitter and Facebook updates and public forum answers. It is also, and most importantly, defined by how you treat your customers. In order to gain a better idea of how you treat your customers answer these questions. Be honest with yourself. How do you treat potential customers? How do you treat your newest customer? How do you treat your oldest customer? How do you treat unhappy customers? How do you treat satisfied customers? How do you treat customers who are canceling their service? Now… notice that I used the word “treat.” I didn’t ask “What do you do for” or “What do you think of”, I asked “How do you treat”. The word “treat” infers to me the attitude take towards, the level of respect given to or the amount of schmoozing...

Anatomy of a Syntax Highlighting Engine – Part 1

This is the first of a series of posts where I’m going to discuss some of the, um… fun that we’ve had while writing Wikid Editor, the text editor that we built for our flagship product Haven (which is still being developed). In this post I’m going to focus solely on the choice in technology. Here are a few high level requirements for Wikid Editor. It had to run inside the browser and it needed to work in all browsers or at least the main ones, Firefox, IE, Safari and Chrome. It needed to be able to color text any way we wanted. It should be able to color the background of rows. It needed to be able to communicate with our servers without reloading the page and preferably be able to receive pushed data from our servers. It needed to perform well. We pretty much had it narrowed down to JavaScript, Flex or Silverlight. There may well have been other choices but we either didn’t find them or they didn’t seem practical or feasible to us. Any one of the three would technically work so for us it came down to these areas of concert. Cross browser compatibility (Winners: Flex, Silverlight) JavaScript – While there are several frameworks that have done a great job of dealing with this issue it’s still something that has to be dealt with or be concerned about, especially when new or updated browsers are released. Flex – The crew at Adobe are not flawless but they are tasked with keeping up with browser compatibility not us and not an open source community. Silverlight...