December 12, 2014 - Comments Off on Intern Chronicles – with Christian Houmoller

Intern Chronicles – with Christian Houmoller

Our #ProjectManagement #WebDesign and #MultiMedia Dev intern Christian Houmoller fills us in on his favorite aspects of working for The Mechanism, what he has learned/experienced so far, and how he has adapted to the city that never sleeps.

Intern Chronicles

Intern Chronicles

Halfway into my internship at The Mechanism, I look back and reflect on the experience, so far. Even though I consider myself a city boy, I found it daunting coming to New York. The shear amount of people seems overwhelming when my little country of Denmark only has 5 million, and they are always in a hurry to get somewhere. The uptown/downtown subway ride, the insane taxi drivers, the east and west streets and the SoHo’s or NoHo’s, it all didn’t really make sense to me at first. But after a while it all just clicked and New York City became an exploration adventure. You always hear about the diversity of people, the melting pot of cultures, but diversity in NYC is found everywhere. Every neighborhood is different, like little towns within a city and the glorious food is worth the trip alone, I’m sure I’ve packed on a few pounds.

As for The Mechanism, It has been a wonderful experience so far. The firm is comprised of some talented developers and designers, with founder Dave Fletcher at the helm. During his 20-something years in the business, he has acquired a solid network of clients, including big pharma, big realty and government and it has been a joy for me, to soak up some of his knowledge. As an intern, with aspirations of starting my own company one day, working in a professional work environment has given me insight into how the web development industry works and broadened my understanding of how to run a business, from managing projects and employees to designing websites and working with clients. I have enjoyed seeing the process The Mechanism goes through, from the early conceptual phases to implementation and deployment of a product. Its impressive how embedded this process is in their work methods, it’s almost automated and along with good commutation makes productivity run smooth and fast. This is reminiscent of what I’ve learned in school and it makes me think that my education has not been a complete waste of time. It gives me the confidence to feel that my aspirations of starting my own company, may someday be possible.

On a personal note. The guys at The Mechanism, has been really welcoming, showing me around the city and inviting me to their homes. This has meant a lot to me. And I could not have imagined that my internship in New York City would be going so well.

October 17, 2014 - No Comments!

Highlights of: Mobile Web Design Trends: Q&A with Dave Fletcher

Hightlights of an interview with Dave Fletcher from The Creative Group. Read the entire interview right here: https://www.roberthalf.com/creativegroup/blog/mobile-web-design-trends-qa-with-dave-fletcher


Our first interviewee is Dave Fletcher, founder and DEO (design executive officer) of The Mechanism, a digital agency based in New York City. For more than two decades, this noted design expert has explored a wide range of media, including interactive design, print, video and photography for clients around the globe.

What's a mobile trend that's working well?

You've probably heard a great deal about the "Internet of Things." Apple has announced HomeKit, which will turn your iPhone into a remote control for your interconnected home. To expand on this, eventually, we will live with systems that plug into an artificial or ambient intelligence to manage your life, curate your interests, drive a vehicle and keep track of your day-to-day travels. It will never force you to remove yourself from an existing experience to use a website to research what the network will already know you're looking for.

What's a mobile trend you wish would just go away?

Selfies.

How do you determine whether a client needs an app, mobile-specific site or responsive site to reach their customers via mobile devices?

dave_fletcher
Dave Fletcher

Typically, the answer emerges from an honest and collaborative conversation with our client partner about their audience, their ambitions and their budget. The audience is key here, and in most cases, the client has an idea from either Google Analytics or other research as to what type of device or devices their end users have.

Mobile plans, available carriers and speed of connectivity based on geolocation of the target audience are important yet often overlooked factors when it comes to a mobile initiative. They should be researched as well so we have an understanding of these factors during the planning phase.

If the client requires deep integration with a smartphone operating system that simply cannot be replicated within the smartphone browser's capabilities or there are very serious security concerns, a discussion about appropriate mobile operating systems and native app development can take place.

To address the "mobile-specific site" or "responsive site" question: A digital experience should always be designed and built to render and function appropriately on all devices. Having dedicated server hosting will also help improve your website loading speed.


Read the entire interview right here: https://www.roberthalf.com/creativegroup/blog/mobile-web-design-trends-qa-with-dave-fletcher

Citation: https://www.gettheclicks.com/orlando-web-design/

Published by: Sharon Terry in The Thinking Mechanism
Tags: ,

October 17, 2014 - Comments Off on A Brief Description of the SPF record

A Brief Description of the SPF record

A client recently came to us with problems receiving emailed form submissions from their website. We did a little testing and realized that indeed the emails were being sent by the server but something was stopping them during transit. In our research, we had to dig deeper into SPF records.

An SPF (Sender Policy Framework) record, validates an IP address as permitted to send emails from that Domain. Once propagated, the DNS record serves as a list of verified senders, which the recipient of an email can use to check against. If you need help with this process, services like IT support Chicago can work in your business network.

The SPF record was introduced because the ubiquitous SMTP (Simple Mail Transfer Protocol) allows a computer to send email claiming to be from any domain. Spam and phishing emailers use this to send email purporting to be from a trusted source.

With an SPF record, a receivers spam filter is more likely to accept the message as it is coming from a validated source. It also discourages potential spammers from using your domain as a sending address, knowing that domains with SPF records are more likely to be rejected by recipient spam filters, if the senders IP does not match one associated with the record.

Once an SPF record is created, it is important to ensure that all computers that will be sending emails are included, as the presence of the record indicates that any email not declared is dubious. This is the problem we ran into, where an SPF record was added to the DNS zone, but did not include the server hosting the website in it’s list of IP addresses.

Here is an example SPF TXT record:

example.com TXT “v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a ~all”

Published by: georgebrassey in The Programming Mechanism
Tags:

October 3, 2014 - Comments Off on How to Eat Healthy without “Dieting”

How to Eat Healthy without “Dieting”

couple unloading groceries at home

Eating healthy can be easy, affordable and delicious. It’s all about making smart choices to build an overall healthy dietary pattern.

After all, a healthy diet can help reduce your risk of heart disease, stroke and lots of other things you’d rather avoid. The good news is, eating right doesn’t have to be hard or require you to give up all of the foods you love. Read more about alpilean pills.

Here are some tips to help you and your family adopt a healthier eating style:

INCLUDE

  • Fruits and vegetables
  • Whole grains
  • Beans and legumes
  • Nuts and seeds
  • Fish (preferably oily fish with  omega-3 fatty acids)
  • Skinless poultry and lean animal proteins
  • Plant-based proteins

LIMIT

  • Sweetened drinks
  • Sodium and salty foods
  • Saturated fats and dietary cholesterol
  • Fatty or processed red meats – if you choose to eat meat, select leaner cuts
  • Refined carbohydrates like added sugars and processed grain foods
  • Full-fat dairy products
  • Tropical oils such as coconut and palm oil. This is how alpilean weight loss  works.

AVOID

  • Trans fat and partially hydrogenated oils - found in some commercially baked and fried foods

We can help you make healthier choices:

  • At home
  • At work
  • At the grocery store

TIPS

  • Choose mindfully, even with healthier foods. Ingredients and nutrient content can vary a lot.
  • Read labels. Compare nutrition information on package labels and select products with the lowest amounts of sodium, added sugars, saturated fat and trans fat, and no partially hydrogenated oils.
  • Watch your calories. To maintain a healthy weight, eat only as many calories as you use up through physical activity. If you want to lose weight, take in fewer calories or burn more calories.
  • Eat reasonable portions. Often this is less than you are served, especially when eating out.
  • Cook and eat at home. You’ll have more control over ingredients and preparation methods.
  • Look for the Heart-Check mark to easily identify foods that can be part of an overall healthy eating pattern. Visit https://www.deccanherald.com/brandspot/pr-spot/red-boost-reviews-shocking-customer-complaints-red-boost-ingredients-1162291.html.

More Tips

  • Healthy Swaps for Common Foods - Healthy home cooking and smart shopping puts you in control of what goes into your recipes and your body. Follow these healthy guidelines to update your eating style and improve your nutrition profile.
  • Daily Tips to Help Your Family Eat Better - Try these daily tips that will help your family take a step-by-step approach to eating healthy.
  • Food Diary - How to Keep Track of What You Eat - Learn how to keep track of what you eat in order to lose weight or maintain a healthy weight.
  • Get Smart About Superfoods Infographic - So-called “superfoods” alone won’t make you healthier – but adding these nutritious foods to an already balanced diet can bring health benefits.
  • Healthy Foods Under $1 Per Serving - Eating healthy on a budget can seem difficult; but it can be done! Being creative can help you stick to your budget and incorporate nutritious foods into your diet. Try these tips to incorporate some of these inexpensive foods into your weekly menu.
  • Healthy Post-Play Snacks - All too often, kids are rewarded with unhealthy foods and sugary drinks and desserts, but there are lots of healthy choices that taste great!
  • Healthy Snacks for Summer Vacation - By Devin Alexander - Chef for NBC's Biggest Loser and author, Devin Alexander shares her personal perspective as a chef in this blog entry with great ideas for healthy snacks for the whole family to bring on their summer vacation or anywhere!
  • How to Make Breakfast a Healthy Habit - Part of being Healthy for Good™ is creating simple daily habits you can stick with. One important habit that can help kick-start your day is eating a healthy breakfast. Think outside the (cereal) box with these quick and easy ideas.
  • Is 3 Meals a Day the Only Way - The number of meals you eat may not be so important. How you eat those meals is what matters most when it comes to decreasing the risk of heart disease and other health problems that come along with being overweight.
  • Organic Food Fact vs Perception - Many shoppers assume organic products are more nutritious and safer to eat, but these perceptions are based more on hype than hard science.
  • 5 Tips to Deal with Picky Eaters (Both Kids & Adults) - Picky eaters can miss out on a lot of good food! Not only can it be challenging cooking for folks who refuse to eat some foods, but they can also miss out on important nutrients found in foods often on the I-Don’t-Eat list.
  • 7 Excuses to Overindulge, and How to Take Control - Don’t let excuses get in the way of eating healthy! Check out our tips on breaking out of the scarfing cycle.
  • Types of Whole Grains - While you may be familiar with brown rice and 100% whole wheat bread, there are lots of other tasty whole grain options.

Published by: davefletcher in Entertainment, The Thinking Mechanism
Tags: ,

September 26, 2014 - Comments Off on TIPS ON MAINTAINING A HEALTHY DIET

TIPS ON MAINTAINING A HEALTHY DIET

Maintaining a healthy lifestyle is mandatory for all of us, who want to stay fit and active. Amidst the busy schedule that we follow, it becomes almost impossible to do so. Therefore, to help you with it, we are sharing some of the essential tips to stay healthy. Eating disorders often occurs from an unhealthy lifestyle and it is time to treat it by replacing with a healthy diet. The food we eat has a great impact in our health and therefore, we need to secure our health with a healthy food habit. It makes one of the best live in care services. Now, let us know about the 10 tips on maintaining a healthy diet. Read more at Wtkr.

1. Have a Wholesome Breakfast: The first meal you have in a day is the breakfast and it needs to be a wholesome one. Proper balance of carbohydrates, protein, vitamin and other nutrients is essential for making the breakfast a wholesome one. Include juice, eggs, cereals and other foods that give you energy and strength.

2. Include Fiber in Diet: It is essential for us to eat fiber-rich food products and therefore, you need to know about these foods. Wholegrains, fruits like oranges, melons, berries, vegetables like sweet corn, broccoli, carrots are some fiber-rich food items that you can include in the diet. Visit https://www.outlookindia.com/outlook-spotlight/red-boost-reviews-real-or-fake-promises-how-to-know--news-236474.

3. Follow a Balanced Diet: You need to maintain a healthy diet that balances all the essential nutrients. Now, we all have different requirements based on our age, height, weight, gender and medical condition. Hence, the diet you follow needs to be based on your requirements. The usual ratio of carbohydrates, protein, and fat in our diet should be balanced depending upon the above aspects. Consulting a nutritionist will be the best option to follow your balanced diet. You can also read consumer reviews on Alpilean at geekshealth.com if you're looking for a diet supplement to help you lose weight fast.

4. Eat Gluten-Free Products: Today, the nutritionists are referring to a gluten-free diet as there are several benefits of it. Firstly, it helps in proper digestion and immunity. Secondly, it helps you to reduce unhealthy fat in your body. Thirdly, it helps you to cure problems associated with gluten intolerance. You can find online articles and guidelines about gluten-free diet.

5. Fruits and Vegetables: Including fruits and vegetables in your diet is essential for several reasons. These are the sources of vitamins and minerals that our body requires. Eating at least one fruit and vegetable every day will keep you fit and active as it will boost your immunity and reduce the chances of infection.

6. Eat Protein-Rich Foods: Including a good proportion of protein is mandatory, as the experts suggest. Some of the sources of protein are meat, seafood, eggs, milk, cheese, lentils and soybeans. By consulting a nutritionist, you will be able to know the amount of protein you need to eat on a regular basis.

7. Lower the Carbohydrates: When you are aiming to reduce body weight, your diet needs to be based upon low carb foods. Also, you need to eat the maximum amount of carbohydrates during your breakfast. In dinner, try to avoid carbohydrate-rich food as that can be harmful for the body.

8. Dinner at 8 pm: The last meal you have in a day should not cross 8 or 9 pm. However, you can have supper after this time. Nutritionists suggest that early dinner is helpful for digestion and any food habit that helps you to digest better will be beneficial for weight loss. On the contrary, the later you have dinner, there will be higher chances of indigestion and related problems.

9. Drink Plenty of Water: You need to ensure that you drink plenty of water everyday. As we already know, there are different diet charts for different fitness goals. Therefore, you need to know how much water you need to drink every day. Usually, the experts suggest that a adult needs to drink approximately 2.5-3.5 liters of water every day.

Published by: antonioortiz in The Internal Mechanism
Tags: , , , ,

September 19, 2014 - Comments Off on The MechCast 306b: How has the Internet changed the way we listen to music? (Part 2)

The MechCast 306b: How has the Internet changed the way we listen to music? (Part 2)

  • TIPS ON MAINTAINING A HEALTHY DIET

    Maintaining a healthy lifestyle is mandatory for all of us, who want to stay fit and active. Amidst the busy schedule that we follow, it becomes almost impossible to do so. Therefore, to help you with it, we are sharing some of the essential tips to stay healthy. Eating disorders often occurs from an unhealthy lifestyle and it is time to treat it by replacing with a healthy diet. The food we eat has a great impact in our health and therefore, we need to secure our health with a healthy food habit. It makes one of the best live in care services. Now, let us know about the 10 tips on maintaining a healthy diet.

    1. Have a Wholesome Breakfast: The first meal you have in a day is the breakfast and it needs to be a wholesome one. Proper balance of carbohydrates, protein, vitamin and other nutrients is essential for making the breakfast a wholesome one. Include juice, eggs, cereals and other foods that give you energy and strength.

    2. Include Fiber in Diet: It is essential for us to eat fiber-rich food products and therefore, you need to know about these foods. Wholegrains, fruits like oranges, melons, berries, vegetables like sweet corn, broccoli, carrots are some fiber-rich food items that you can include in the diet.

    3. Follow a Balanced Diet: You need to maintain a healthy diet that balances all the essential nutrients. Now, we all have different requirements based on our age, height, weight, gender and medical condition. Hence, the diet you follow needs to be based on your requirements. The usual ratio of carbohydrates, protein, and fat in our diet should be balanced depending upon the above aspects. Consulting a nutritionist will be the best option to follow your balanced diet.

    4. Eat Gluten-Free Products: Today, the nutritionists are referring to a gluten-free diet as there are several benefits of it. Firstly, it helps in proper digestion and immunity. Secondly, it helps you to reduce unhealthy fat in your body. Thirdly, it helps you to cure problems associated with gluten intolerance. You can find online articles and guidelines about gluten-free diet.

    5. Fruits and Vegetables: Including fruits and vegetables in your diet is essential for several reasons. These are the sources of vitamins and minerals that our body requires. Eating at least one fruit and vegetable every day will keep you fit and active as it will boost your immunity and reduce the chances of infection.

    6. Eat Protein-Rich Foods: Including a good proportion of protein is mandatory, as the experts suggest. Some of the sources of protein are meat, seafood, eggs, milk, cheese, lentils and soybeans. By consulting a nutritionist, you will be able to know the amount of protein you need to eat on a regular basis. Check these red boost reviews.

    7. Lower the Carbohydrates: When you are aiming to reduce body weight, your diet needs to be based upon low carb foods. Also, you need to eat the maximum amount of carbohydrates during your breakfast. In dinner, try to avoid carbohydrate-rich food as that can be harmful for the body.

    8. Dinner at 8 pm: The last meal you have in a day should not cross 8 or 9 pm. However, you can have supper after this time. Nutritionists suggest that early dinner is helpful for digestion and any food habit that helps you to digest better will be beneficial for weight loss. On the contrary, the later you have dinner, there will be higher chances of indigestion and related problems.

    9. Drink Plenty of Water: You need to ensure that you drink plenty of water everyday. As we already know, there are different diet charts for different fitness goals. Therefore, you need to know how much water you need to drink every day. Usually, the experts suggest that a adult needs to drink approximately 2.5-3.5 liters of water every day.

Published by: antonioortiz in The Mechcast
Tags: , , , ,

September 12, 2014 - Comments Off on The MechCast 306a: How has the Internet changed the way we do Marketing

The MechCast 306a: How has the Internet changed the way we do Marketing

  • fMarketing done right can be an incredible boon for your business's net income. Done wrong, however, it can feel like throwing money into a raging bonfire. Because small business owners have to be whatever their small business needs -- all the time -- it can be difficult to master all the nuances that go into sales or marketing. If you're not a natural salesperson, it can be even more difficult. Fear not, experts from Blue Whale Media can help your business to reach out of the world.The following nine marketing tips for startups can help you make more sales, market better and waste less money. Get the best assistance from these professional affiliate management companies.

    Related: The 5 Stages Startups Must Go Through to Make That First $1 Million

    1. Sell the benefit, not a comparison.

    How you market yourself is all about highlighting what makes you different. There are three major ways to do that.

    • Cost (you know how to price a product better than the competition)
    • Quality (you're better)
    • A combination thereof (you offer the better value)

    But how you sell yourself is different than how you market yourself. You can tell someone that you provide a product or service that is cheaper or more effective than that of another business, but that doesn't say how much better you are going to make the customer's life.

    Selling is about the benefit. A comparison may highlight the features you offer, but you are always selling benefit.

    2. Listen to your customer.

    Sam Walton, WalMart's famed mass retail titan, started his empire in rural America. This was despite the prevailing business logic saying a mass retailer anywhere but in a city with a concentrated population would fail. The logic was, if you wanted to move mass quantities of goods, you needed mass quantities of people.

    But Walton knew his customers because he would frequently listen to them firsthand. He was aware that people who lived in rural and suburban areas often bought in larger quantities because they had larger families or needed more goods to keep their own small businesses stocked and running. Walton listened to his customers, and the result is the largest, most powerful brick and mortar retailer in the world. The customer may at times defy logic, but they are always right. Listen to them.

    3. Market your product before it's ready.

    Some businesses wait until their product is perfect before they do any marketing or awareness campaigning. That can be a costly mistake. Many businesses expect to sell their product as soon as it's ready. But if no one knows about it, then demand will start at zero until you undergo a marketing campaign to build brand awareness for potential customers.

    It's better to do preemptive awareness campaigning, even if it's minimal, to let potential customers know your product is coming. You can sell the benefit before the product has arrived. This way, when the product is ready, so are customers!

    4. Think outside the box.

    The marketing landscape has dramatically changed since I started my first business more than 30 years ago. Back then, there were no search engines or social media platforms. There was no internet as we know it. Now, startups can utilize a bevy of free, online marketing techniques that are both creative and effective. For example, you can use online video marketing, social media, blog influencers, crowdsourcing, competitions, content marketing, thought leadership and more. If you are looking for fast connections at an affordable price point, check out Compare Internet's blog post.

    Related: 5 Social Media Studies That Will Boost Your Marketing Skills

    5. Test fast. Fail fast.

    Marketing that you can't measure is failed marketing. Sure, you may spend money to do some advertisement, and you may even see an uptick in sales around the same time you ran the ads. But how can you be sure what you spent on ads correlates with sales? Maybe it was something else altogether. Maybe there is a natural, seasonal uptick for what you sell that will go away in a month.

    If you're going to commit time and money to a marketing campaign, make sure you can measure the results. Set up ways to track conversions that stem from each marketing campaign. Also, run multiple types of marketing campaigns in distinct, small batches. This will allow you to compare marketing channels and see which perform best. Toss out the ones that don't work and keep those that do.

    6. Advertise from multiple angles.

    As mentioned above, it's good to test multiple marketing channels and ideas to see what works best. Often, it's not any one thing but a combination of all of the above. When your customer hears you on the radio, sees you in a search engine result, and then finds you mentioned in a blog they like (content marketing), they start to accept your brand as a solid, dependable, known entity. They may not have the need for your product or service immediately, but when they do, it will be your name that comes to mind instead of a competitor's.

    7. It's always time for PR.

    When you do traditional advertising, it's your marketing material selling your product. When you do PR, or have a member of the press or a media house that covers your industry talk about you, it's brand building and endorsement.

    Some people call it landing-page flair or credibility building, but, if your company is featured in Mashable or The Wall Street Journal, you'd be silly not to put that paper's name on the front of your company's website. Even if your company was only mentioned by way of a quote from your CEO, you are still "as mentioned in The Wall Street Journal." When customers see that publication's name next to your company's name, it builds credibility.

Published by: antonioortiz in The Mechcast
Tags: , ,

August 22, 2014 - Comments Off on Biz Dev Q&A 001 with Raynald Leconte

Biz Dev Q&A 001 with Raynald Leconte

raynald-leconte

We recently welcomed our newest member to Team Mechanism, Raynald Leconte. Raynald is our Director of New Business Strategy, and he comes with a wealth of expertise acquired through decades of experience in business development. We will be presenting him with a unique question each month and picking his brain a bit to learn some of the secrets he's picked up through the years.

Let's get started with our first question.

Q: What attracted you to this role?

RL: "Vision, vision, vision! Dave's vision in terms of connecting people back to people in this plethora of apps and mobile devices is right on for future and successful digital, design and development agencies. I believe that creativity is becoming even more important as we tackle problem solving in the digital space still finding itself."

Published by: antonioortiz in The Internal Mechanism
Tags: , ,

August 19, 2014 - Comments Off on Could the iWatch Revolutionize Medical Research?

Could the iWatch Revolutionize Medical Research?

“Talkback Tuesdays” is an original weekly installment administered by hcp event planning ltd., where a team member of The Mechanism is asked one question pertaining to digital design, inspiration, and experience. The Q&A will be featured here on The Mechanism Blog as well as on The Mechanism’s Facebook, Twitter, and Instagram, every Tuesday. Feel free to offer up your 2¢ in the comments.

George Brassey, The Mechanism’s lead developer, discusses the great potential smart watches can have in revolutionizing medical research and healthcare management. It seems like only a matter of time!

What new piece of tech are you most excited about hitting shelves?

I'm excited to see what sensors Apple will introduce with the iWatch. I'm hoping they announce a watch with an array of sensors which might revolutionize health care research. Last year there was a huge amount of media buzz around the wearable space, with nothing appearing. This year the rumor mill is turning again and it sounds like Apple will finally announce an iWatch next month to be released later this year/early next year. Why am I interested? Last year I didn't like the idea of the wearable. The potential uses didn't interest me. I already have a phone, tablet and laptop. I don't need yet another screen. Especially considering how limited the functionality will be on such a small device. This year, however, I've been hearing about the sensors that will be included.

I'm a migraine sufferer. From time to time, without warning, I get massive blind spots in my field of vision, followed by debilitating headaches. Research on migraines has been inconclusive. The Mayo Clinic lists: hormones, foods, food additives, drinks, stress, sensory stimuli, changes in wake-sleep pattern, physical factors, changes in the environment, and medications; as potential causes. That's a long list with very little practical information as to how to prevent a migraine. I will be interested to see what could be learned by analyzing various health markers preceding migraines.

Depending on how Apple's new Healthkit SDK deals with privacy, the platform could standardize the sharing of medical records. Currently, there is very little access to medical data for researchers. Fears of records getting into the wrong hands means that acquiring data for research often requires a new study, even if a similar study has been done before. This involves, raising money, finding volunteers and conducting the study which may take months, even years. Most health information is under lock and key. The proliferation of devices to passively record a wealth of data could provide easy access for life saving research.

August 15, 2014 - Comments Off on How to Build an Easy Embedabble Widget

How to Build an Easy Embedabble Widget

Building with iframes is a fantastic way to create seamless, easy to implement, embeddable widgets. Once set up, creating multiple instances linking to your service is easy to do. Existing within a website, an iframe is like a window onto another website. Rather than forcing open another window, a user can interact with another service within the context of the website they have navigated to.

Over here at The Mechanism, we have been using iframes to integrate our custom bug tracking solution with client websites during user assisted testing. We needed an inconspicuous tool which would allow clients to seamlessly review work and submit bugs as they find them.

The requirements for this front end bug catcher:

  1. Simple to embed and easy to implement across many projects
  2. Sandboxed so that it doesn't cause any conflicts with the project DOM, JS or CSS
  3. Simple architecture which works on all browsers
  4. Responsive; it must work on all device sizes and form factors
  5. Context Aware; diagnostic information will require knowledge of the parent document (the website under bug tracking )

Our first iteration of the bug tracking widget violated the second requirement. For our first prototype, we loaded a script and pulled in our view and styling files through JSONP (a method for circumventing Same-Origin Policy, you can read about it here). This worked in our limited prototype but caused a few issues. First of all, we had to give our DOM elements verbose ID's and class names to ensure there would no conflict with the parent document. Secondly, we ran the risk of causing script conflicts with our dependencies. We used a script loader to minimize this risk, however we could never be sure. Finally, we were at the mercy of the stylesheets loaded by the parent which required us to write additional resets to ensure consistent appearance across projects. However, repairs like this are equivalent to bailing a sinking ship rather than repairing the leak.

So for our second iteration we converted the widget into an iframe. To do so we still had to find a way to get around the Same-Origin Policy. The Same-Origin Policy restricts communication between two documents; the parent window and the iframe. Cross Document Messaging is a new addition to the HTML5 specification, which allows for simple string communication between documents. This is supported by most modern browsers, however, there are many hacks necessary for older browsers.

easyXDM

easyXDM is a great library built to cross this great divide introduced by iframes. It uses the HTML5 postMessage() method when available and uses many fallbacks when necessary, ensuring the free flow of information between documents. For the developer, it exposes two protocols for data transfer. The first is a socket, which will send a string between the documents. This method requires us to parse and decipher the string before performing the relevant action on that information. The second option is an RPC (Remote Procedure Call), specifically JSON-RPC. JSON-RPC is a specification for calling functions from remote software, and for data to be returned. This allows for a much more dynamic interaction between our two documents where each process exists in their relative scope and can communicate as discreet functions would be expected. For our needs, the simpler option and the one we will be employing is the RPC protocol.

To implement easyXDM we must load our dependency and create an RPC instance, with the necessary proxy objects and method stubs. We will initiate this within a script loaded on the parent document. This script will embed our iframe and act as our gateway to the bug tracking widget.

On our parent document we will place an asynchronous script call to our remote script

 

// footer.html

 

In our script we will start by loading our easyXDM dependency

 

// main.js

var serverURL = 'http://www.example.com/our-remote-service/',

iframeFile = 'iframe.html',

depends = {

'easyXDM': serverURL + 'js/easyXDM.min.js'

};

Object.size = function(obj) {

var size = 0, key;

for (key in obj) {

if (obj.hasOwnProperty(key)) size++;

}

return size;

}

var scriptCount = Object.size(depends); // count of scripts required

var scriptLoads = 0; // count of script loaded

for (var key in depends) {

if (depends.hasOwnProperty(key)) {

loadScript(key, depends[key], function() {

scriptLoads++;

if (scriptLoads === scriptCount) {

main();

}

});

}

}

function loadScript (dependency, src, callback) {

// this function checks if the dependency is present.

// it waits for load before executing the callback.

if (window[dependency] === undefined) { // if dependency is not present

var scriptTag = document.createElement('script');

scriptTag.setAttribute('type', 'text/javascript');

scriptTag.setAttribute('src', src);

if (scriptTag.readyState) {

scriptTag.onreadystatechange = function () { // For old versions of IE

if (this.readyState == 'complete' || this.readyState == 'loaded') {

callback();

}

};

} else { // Other browsers

scriptTag.onload = callback;

}

(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(scriptTag);

} else {

callback();

}

}

 

  1. Lines 1-5 we are declaring a some variables that will be used later.
  2. Lines 7-16 we extend the Object object with a method which will return the length of our depends array on line 15, along with a variable to hold an index value.
  3. Lines 18-27, we run a loop through the depends array and call a function loadScript(), which takes the name of our dependency, the url it can be found at and a callback which will be run once the dependency is loaded.
  4. Lines 29-49, our function which will test the presence of the dependency and load the script if it is not found. It uses various methods to ensure the script is loaded before running the callback function.

Next we will create our RPC instance which will load the iframe

 

// main.js

.

.

.

var iframeContainer = document.createElement('div');

iframeContainer.style.position = 'fixed';

iframeContainer.style.zIndex = 999;

iframeContainer.style.bottom = 0;

iframeContainer.style.left = 0;

iframeContainer.style.top = "auto";

iframeContainer.style.right = "auto";

iframeContainer.style['max-height'] = '100%';

iframeContainer.style['max-width'] = '100%';

document.getElementsByTagName('body')[0].appendChild(iframeContainer);

var rpc = new easyXDM.Rpc({

remote: serverURL + iframeFile,

container: iframeContainer,

props: {

id: 'bug-iframe',

frameborder: '0',

scrolling: 'no',

marginwidth: '0',

marginheight: '0',

allowTransparency: 'true',

style: {

height: '100%',

width: '100%',

display: 'block'

}

}

},

{

local: {

resizeiFrame: function (widthReq, heightReq, allowScroll) {

var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,

windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;

var width = (widthReq < windowWidth) ? widthReq : windowWidth;

var height = (heightReq < windowHeight) ? heightReq : windowHeight;

iframeContainer.style.width = width + 'px';

iframeContainer.style.height = height + 'px';

var sc = (allowScroll) ? 'yes' : 'no';

document.getElementById('mech-bug-iframe').scrolling = sc;

return {

x: width,

y: height

};

},

parentInfo: function () {

return {

width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,

height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,

url: window.location.href

};

}

}

});

 

  1. Lines 5-16; we are creating the iframes container with properties for it's layout within the parent documents DOM
  2. Lines 18-34; our RPC instance with the address to find the iframe contents, a container to place the div in, and some properties to control it's appearance
  3. Lines 34-64; is where we declare the methods we will be exposing to our iframe. resizeiFrame() and parentInfo() will allow us the adjust the size of the iframe and return diagnostic information respectively. They will be called from within our iframe

In our iframes markup we will load easyXDM and a shiv for older browsers without support for JSON, plus another .js file where we will instatiate our RPC connection.

 

 

In our iframe-main.js file, we will create another instance of easyXDM.Rpc and create stubs for our remote methods

 

// iframe-main.js

var rpc = new easyXDM.Rpc({},

{

remote: {

resizeiFrame: {},

parentInfo: {}

}

});

.

.

.

rpc.parentInfo(function(parentInfo) {

var diagObject = {

'width' = parentInfo.width,

'height' = parentInfo.height,

'url' = parentInfo.url

}

});

 

  1. Lines 2-8; we create our rpc object with the relevant stubs, referring to the remote methods
  2. Lines 14-20; an example of how we call our remote function. Notice the anonymous function we pass to the remote function to return our requested data. This is an asynchronous function

Stay tuned for more on the Venus project to find out where it goes next. Dhruv Mehrotra will be back in a few weeks with a blog post going over some of the steps taken to set up the Ruby on Rails server behind Venus. And we will have meetup at our offices the second week of September. Hope to see you there!

Published by: georgebrassey in The Programming Mechanism
Tags: , , , ,