Next we are going to import the computed and reads methods from ‘@ember/object’ and ‘@ember/object/computed’. We are using the new module syntax which will make Ember applications start faster, by replacing the Ember global with a first-class system for importing just the parts of the framework you need.
To know more about the new module syntax, please refer to this RFC.
Next we concentrate on the component template for now. The template code is very simple since we are just going to have some labels for ON and OFF, since we are going for the primary button in the component, the template is only going to have two span elements like this:
Next we will add a checked property to notify the toggle state whether it is on or not.
The following are the list of ARIA attributes our switch component will be using and the purpose of each and every attribute is listed below:
The aria-checked attribute of a switch indicates whether the input is on (true) or off (false).
The aria-label defines a string value that labels the current element. The purpose of aria-label is to provide the user with a recognizable name of the object.
The aria-labelledby attribute identifies the element (or elements) that labels the current element. The purpose of aria-labelledby is the same as that of aria-label.
The role attribute allows the author to annotate markup languages with machine-extractable semantic information about the purpose of an element. Use cases include accessibility, device adaptation, server-side processing, and complex data description. In our case, the role attribute will be assigned a value of switch to indicate that it is a toggle button.
In addition to the ARIA attributes mentioned above, the switch component will also make use of some HTML attributes for manipulating the markup and controlling the behaviour of the component.
So the final set of attributeBindings will be something like:
Then we will have a property called ariaChecked which will read the checked property passed to the component.
Then finally we will handle the click event for the component. We can handle the same in the default click() event, which does two things. One we need to toggle the checked property, second we need to invoke the callback function passed to the component once the status is toggled.
The final code for the component.js will look something like this:
Everything you need to know about the native lazy load
The lazyload feature allows developers to selectively control the lazyload attribute on <iframe>and <img> using the Feature-Policy header or the <iframe> “allow” attribute. This provides more control over loading delay for embedded contents and images on a per origin basis. Web developers can use this policy to force loading to delayed or non-delayed for your entire website and all or parts of any embedded contents. This will give a significant boost in page load times.
LazyLoad is a Chrome optimization that defers loading below-the-fold images and certain third-party iframes on the page until the user scrolls near them, which reduces data usage, speeds up page loads, and reduces memory use. For frames, third-party iframes that are meant to be shown to the user are deferred, leaving alone frames that are used for analytics or communication according to heuristics. For images, LazyLoad inserts placeholders with appropriate dimensions, which it gets by issuing a range request for the first few bytes of the image. When the user scrolls, deferred frames and images that will be visible soon start loading.
The resources Chrome consumes (e.g. users’ time, data, or phone memory) should be proportional to the user value it provides. For page loads, this means that Chrome shouldn’t waste any of these resources loading content the user will never see. For instance, pages often require scrolling to get to the bottom, and users don’t always scroll that far.
For foreground page loads, content that is not visible because it is below the fold should commence loading just in time to complete when scrolled to it.
The specific goal of this project is to greatly reduce the number of image and third-party iframe resources necessary to load a site by using visibility predictions to trigger their loading.
Key metrics of interest are network data, load latency performance and memory savings.
With the lazyload attribute, developers could prioritize the loading of different inline frames and images on a web page. This however could become a cumbersome process and not quite scalable for larger web sites specially given that applying the attribute is origin-agnostic. The lazyload policy aims to resolve this issue but changing a browser’s decision on enforcing lazyload attribute for a browsing context and its nested contexts.
A new policy-control feature for lazyloading will alter lazyload behavior for a browsing context and its nested contexts. The feature will potentially modify the behavior of user agent towards the lazyload attributed value for nested resources. Essentially, when the feature is disabled for an origin, then no resources inside the origin can escape lazyloading by setting lazyload=”off”. Specifically, if for a resource the lazyload attribute is set to:
on: Browser should load the resource lazily.
off: Browser ignores the attribute value and assumes auto.
auto: There is no change in browser behavior.
This feature could be enforced either in the HTTP header or by using the allow attribute of an inline frame.
Using the feature
This feature can be introduced with the HTTP headers. For instance,
would not allow synchronous loading for any <iframe> or <img> (that is not yet in the viewport) from origins other than’self’ or https://example.com.
Similarly, the feature could be set through the allow attribute of an inline frame:
which disregards lazyload=’off’ for all the origins including the <iframe>‘s origin itself.
Which iframes should be deferred?
An iframe will be deferred if it satisfies all of the following:
It’s a third-party iframe (i.e. a different origin than the embedding page),
Larger than 4×4 in dimensions,
Not marked as “display:none” nor “visibility:hidden”,
Not positioned off-screen using negative x or y coordinates
LazyFrames defers frames by waiting to call FrameLoader::Load() until an installed IntersectionObserver fires when the user scrolls near the frame.
The LazyImages mechanism defers loading of images until the user scrolls near them. To preserve the layout and avoid reflow jank when loading images in, LazyImages inserts appropriately sized rectangular placeholders where the images will be, using the image placeholder mechanism that was created for the LoFi feature.
To achieve this, Chrome will issue range requests for just the first few bytes of images, and then attempt to extract the image dimensions from these chunks and display placeholders with the same dimensions in their place.
When Chrome determines that it should attempt to display a placeholder image, it should attempt to get the image in the following ways in order of precedence:
If the full image is present and fresh in the cache, then use that.
Otherwise, if the server supports range requests, and the image dimensions can be decoded from the first 2KB of the image, then generate and show an image placeholder with the same dimensions.
Otherwise, fetch the entire full image from the server as usual.
If the original image is a progressive JPEG, and the first 2KB range of the image contains the full low-resolution version of the image, then Chrome will consider using that low-resolution version of the image as the placeholder.
Since there is a chance that LazyLoad could negatively affect user experience on some iframes and images, a per-element lazyload attribute will be provided for determining the policy for frames and images, to allow a page to optionally indicate to the browser if an iframe or image is well or poorly suited for lazy loading. By default, the browser will decide which frames and images on the page should be lazily loaded.
There will also be a way to control LazyLoad page-wide using feature policy.
At the time of writing LazyLoad is available in only available in Chrome Canary, behind two required flags:
Flags can be enabled by navigating to chrome://flags in a Chome browser.
New tools or new vocabulary to manage interruptions better?
Office interference often proves to be an influential disturbance of one’s time and space. From a different point of view, a bug that doesn’t grab your attention may endure in the code, and an idea that is never known before, won’t assist you to figure out a problem. The absolute contrast in performance is merely based on the effective communication of people within an office or a team. The information sharing becomes effortless by sharing an office space. Occasionally, it’s both an asset and a liability.
After landing their first job, many programmers are shocked by the reality of life in the corporate world. Your initial dream of sitting undisturbed each day, kicking out clever little apps, is continually disturbed by unrealistic deadlines, unreasonable decisions, bureaucracy, politics, and crisis after crisis. Any of these could reduce your current software project to a pile of smoking rubble reminiscent of the latest Godzilla movie. They don’t teach this sort of thing in school, and even seasoned developers have difficulty knowing how to cope with elements that seem beyond their control.
For fabricating good code or for uncovering mysterious bugs, what one really needs is prolonged and persevering attention. When the lines of code just seem to flow from the fingertips, the last thing you want is someone throwing in a casual comment about something irrelevant. But sometimes, the brand-new outlook of a colleague’s instant remark may steer your ship in to new shores. Once in a while, discussing a design with an observant colleague or team-mate can catch sight of the missing or hidden problems, that are covertly waiting to make an ambush.
You are a knowledge worker, meaning you are paid for the creative and innovative ideas you produce. Dealing with constant distractions, both at your desk and on your desktop, can threaten your best contributions to your projects. Developers crave a state known as flow, discussed in lots of places (it even has an entire book devoted to it, written by Csikszentmihalyi). All developers know this state: it’s when you are so focused that time disappears, you develop an almost symbiotic relationship with the machine and the problem you are attacking.
The problem with flow is that it is fragile. One distraction pulls you out, and it takes effort to get back in. It also suffers from inertia. Late in the day, you have to fight harder to get back to that state, and the more times you are abruptly pulled out, the harder it becomes. Distractions kill your focus on the problem at hand, making you less productive.
The significance of the above chart from a noise standpoint should
be evident: Thirty percent of the time, people are noise sensitive,
and the rest of the time, they are noise generators. Since the workplace
is a mixture of people working alone and people working
together, there is a clash of modes. Those working alone are particularly
inconvenienced by this clash. Though they represent a minority
at any given time, it’s a mistake to ignore them, for it is during
their solitary work periods that people actually do the work. The
rest of the time is dedicated to subsidiary activities, rest, and chatter.
In order to attain the best team work, the most important requirement is to have easy access without annoyance. There will be countless reasons for people to interrupt one another, if they are working together or sharing the same working space such as asking for help, tossing out ideas, checking on status and in general coordinating the work at hand. And from a different point of view, the first and foremost requirement for creative synthesis is uninterrupted time.
An ill-timed interruption can erase a great idea, kick an elusive thought just out of reach, or make you lose track completely within a complicated line of reasoning.
This is neither new nor an exclusive problem to programming teams, but developers have some substantial control in bringing better tools or applications to administer group communication. Without a doubt, software professionals love to solve social and organizational problems by using computers, so the first thing that probably comes to mind is a new mobile app or web application with fancy user interface and integration capabilities with existing tool-set used by the corporate.
The world wide web is extravagantly littered with thousands of programs and software, both online and offline to manage interruptions and distractions at work and home. Doing a simple online search will bring you the flood of programs to your devices. Still a simple system can often go a long way. Probably a better vocabulary will do the trick most of the time.
The scientific and technical domains often have an affluent synergy with ordinary vocabulary. The technology domain has taken over many day-to-day words for confined technical purposes. We have taken over “object” and “entity,” leaving nothing to refer to those ordinary things in the physical world around us. We’ve appropriated “method” and “message,” arrogated “protocol” and “file.” The other side of the story also seems to be interesting. Technical terms have already penetrated the mainstream to the point that the Internet lingo now add zing to conversations on the street.
“The sacred soul who desire to work, must not be interrupted.”
― Lailah Gifty Akita, Pearls of Wisdom: Great mind
This has given rise to Internet slang, cyber-slang, netspeak, chatspeak and other various kinds of slang used by different people on the Internet. An example of Internet slang is “LOL” meaning “laugh out loud”. It is difficult to provide a standardized definition of Internet slang due to the constant changes made to its nature. However, it can be understood to be any type of slang that Internet users have popularized, and in many cases, have coined. Such terms often originate with the purpose of saving keystrokes or to compensate for small character limits. Many people use the same abbreviations in texting and instant messaging, and social networking websites.
Software professionals always have a special passion for interpolating their jargon into ordinary conversation, extending and expanding the meaning of the terminology to cover social purposes. They struggle to “parse” a garbled mail message or maniacally “multiplex” two conversations. Habitual patterns of behavior are “hard coded” in “ROM.” They will do a “core dump” to write a first rough draft of a report on yesterday’s design meeting. This can get pretty tedious or sound awfully silly, but techno-babble occasionally enriches ordinary language in useful or interesting ways.
The usual ways of interrupting in polite society are just too long and clumsy for efficient collaboration.
“Excuse me. Are you busy? I hope you don’t mind. I just have a quick question. It will only take a second.”
A second? It has already taken six and a half! By this point, the interruption is a done deal. By the time your brain has parsed and processed all that noise and reached a decision on what to do about it, you’ve forgotten which line of code you were looking at and which method of which object you were intending to invoke.
Working groups need a vocabulary of interruptions that is short, sweet, and simple. What works for hardware seems to work for people, so in Peopleware Papers, Larry Constantine suggests that in our offices we IRQ, we ACK, and we NAK. “IRQ” is short for “interrupt request”; it’s pronounced, appropriately, “irk.” As in “I’d like to irk you?” All you need say is just the one word, “IRQ?” A rising intonation makes it more polite, an explosive final consonant makes it more imperative. The word is sharp enough to penetrate through the hiss of cooling fans and the whine of laser printers, yet it’s short enough to barely deflect your mental processes. The possible responses are “ACK” or “NAK” (pronounced “ack” and “en-ack” or “nack”), meaning, “Okay, go ahead!” or “Not now!” respectively. You barely have to be conscious of your surroundings to burp out either an ACK or a NAK. Both ACK and NAK have an appropriate phonetic flavor that seems to fit with the situation of being interrupted.
“The major problem of life is learning how to handle the costly interruptions. The door that slams shut, the plan that got sidetracked, the marriage that failed. Or that lovely poem that didn’t get written because someone knocked on the door.”
―Martin Luther King Jr.
The interrupt protocol is simplicity itself. An interrupter says “IRQ!” and waits for a response. The interrupted person may continue for a short time before completing the handshaking, perhaps marking a spot in the text, completing a title box, or making a quick note about what they were doing. As soon as they are ready to service the interrupt, they respond by saying “ACK.” A response of “NAK” means, “No, don’t interrupt me now.” We regard it as a polite version of “Go away. Don’t bug me!” All this may seem too silly for words, but it is remarkable how such a simple system can contribute to smoother resource sharing in a working group. Although we haven’t found the need for it in day-to-day work, an obvious extension would be to provide for an occasional “NMI” (pronounced “nimmy”), that is, a “nonmaskable interrupt.” Good etiquette would save “NMI” for true emergencies or top-priority issues that justify grabbing the full foreground processing capacity of your poor colleague’s wetware CPU. The recommended protocol would be to pause briefly before beginning to talk, although no ACK or NAK is required.
What is your thoughts on this? Are you feeling always distracted by too many people in the workplace? Can you go and work somewhere in an isolated part of your office, so that you don’t get bogged down by the incessant interruptions of your daily job? Are we in dire need of better communication tools or just a simple vocabulary conventions is enough to manage office interruptions better? Please let us know your thoughts on this in the comments.
Six Corporate Habits and Rituals that seem to be far-fetched
The emotional brain neither has the capacity for, nor believes in, experimentation. Whatever it does is to be done the same way every time. Simply put, it firmly believes in the motto:
Experimentum periculosm – Experimentation is perilous.
This conservatism is both an asset and a liability. Both individual habits and institutionalized habits or rituals must be checked from time to time to see if they are working for us or against us.
The Persistence of Habit
Dinosaurs are creatures of habit, and their brains have a way of elevating habits to truths. A lizard will do the same thing in the same way for the same reason, until his habit becomes the only way to do it. If you don’t believe me, just think of how you felt, riding in the carpool, when the driver decided to take a slightly different route to work.
When it was your turn to drive again, you probably still took your own route, even if the other way was shorter and had fewer stop-lights.
Once we have learned habits, we don’t question them; we revere them.
Until you really think about it, you don’t realize how much time you spend flying on automatic pilot. Once you’ve learned a complicated sequence, such as riding a bicycle or operating a business machine, you don’t keep talking to yourself about what you’re doing; you just do it.
Habits are much more efficient than thinking through the same series of actions again and again; you don’t have to keep reinventing the wheel. Relying too much on habits, however, can send you into a rut of boredom and inflexibility.
Individuals aren’t the only creatures of habit. Groups can get into ruts too. For instance, think about the pattern of your regular departmental meeting. Does it follow the same order each time? Can you predict who’s going to sit where and who will say what; which issues will be brought up; who will object to everything and who will agree with everything everybody else says? Or, consider office procedures. How do you order new equipment? How are people evaluated? How is it decided who gets paid what?
Usually, the first way something is done is the way it always will be done. If you’ve decided it’s time to break an individual or group habit at work, remember that your emotional brain will assure you that your habit is the one true way. What can your cortex do? You can use the empirical approach, which involves observing and taking measurements, rather than acting on faith. The empirical approach is the basis of science; the emotional brain has a strong tendency to act on faith. Faith can be a wonderful thing, but sometimes it’s just not efficient.
In the empirical approach, you set goals, test your hypotheses and make plans accordingly. The emotional brain will urge you to just do it because it seems right and fits what you already know. If you follow the Emotional Brain, it’s not possible to learn anything new from a situation.
Here’s how to make an empirical business decision:
Set a goal. What do you want to happen?
Establish criteria. How will you know if what you wanted to happen has happened?
Think of possibilities and alternative ways of reaching the goal. When you can see the alternatives, your cortex is working. The emotional brain never knows from alternatives.
Pick several alternatives and try them.
Evaluate. Actually measure results and compare them to your criteria to see which one worked best.
Choose the best solution and use it.
We have developed a ritual for cortical thinking, using the emotional brain tendency to follow step-by-step procedures. Following the steps, however, makes you activate your cortex at each stage. This is the basic pattern of emotional brains. People’s Emotional Brains want to be told what to do. What we’re really telling you to do is think before you act and you’ll be fine.
Now here’s one way to make a emotional business decision:
Get an idea from some authority figure, maybe your boss or some business psychologist, a book or anybody.
Tell everybody that this idea is the basis for all the changes you’re going to make.
Do things the way you’ve always done them.
If something good happens, take credit for it. If something bad happens, point out that it just goes to show that the old ways are best.
The Power of Ritual
Religion has its place in business. I’m not talking about saying your prayers before a merger meeting, but about the power of shared habits or rituals that point to a connection between daily events and something bigger, a connection with other people in the same company doing the same thing for the same reason.
The earliest rituals were ceremonies of transition, habits that symbolized evolutions from one state to another— rites of passage for birth, becoming an adult, joining the tribe, marriage and death. People who participated in the rituals felt a part of something bigger and more powerful than themselves.
Rituals develop at points of change in people’s corporate lives—hiring, promotion, transfer and the like. Rituals have power. The way changes are handled communicates strongly about the bond between the person and the company.
Hitler and the Nazi party used ritual better than anyone else in recent years. By their uniforms and ceremonies, their pomp and circumstance, they got an entire country to turn off their cortexes and use their emotional brains. This surely gives you an idea of the tremendous power of some rituals, for good or evil.
We are not advocating wearing hats or putting on pageants. Just planning. All companies develop rituals, but in most they are understated—such as going to personnel to sign the papers as a rite of passage for promotion.
The name of what is happening is seldom spoken, even though what is happening is very important to the person involved.
It could be a time for the revealing of new knowledge and fostering a stronger feeling of belonging. The emotional brain has a big say in the feeling of being a loyal part of the herd, and it could use some direction. Let’s look at a few corporate rituals and see what they communicate and how they might be used.
Joining the Company.
When a person joins a company is an excellent time to begin making him or her feel part of the corporate culture. In many companies, the whole hiring experience seems to be designed to conceal what actually goes on from the new person. It all begins with the job interview. This ritual almost universally involves a mutual sales job. The people in the company tell you how great it is; you tell them how great you are.
The underlying rules communicated here are that it’s important to withhold certain information because it might create a bad impression and that it’s standard procedure to lie for a good cause.
At most companies, new employees have to rely on rumor, gossip and stories to learn how things are actually done, while the formal channels of communications say, Everyone is equal here; the rules apply to everyone. The grapevine lets you know which people are more equal than others.
The hallmark of dysfunctional corporations is that they don’t tell you what the real rules are because the real rules don’t sound too good.
Instead, people talk about pretend rules and live by the real ones. Whenever you get a group of people together, you find idiosyncratic and arbitrary rules. That isn’t the problem.
The problem comes from the pretending that what’s going on is not really what’s going on.
Most of us were inducted into adulthood by families who did the same kind of pretending, so it’s easy to understand from the first day on the new job that there are some things one never talks about. Is this the best way to do things?
In your company, isn’t it true that certain behaviors are rewarded and certain behaviors definitely are not? Wouldn’t it be nice if somebody had told you those things on your first day on the job?
Some companies are experimenting with the Realistic Job Preview technique, in which people are encouraged to tell new or prospective employees what it’s really like to work there. This technique can be a powerful means for fostering honesty and building trust. Other companies are experimenting with boot camp for new employees, at which an effort is made to induct them into the corporate culture. The emphases are on ceremony and honesty. Old employees are encouraged to come in and tell stories about how things really are and what to expect. This kind of ritual can lead to a strong sense of affiliation and the feeling that, from the first, you’re enough a part of the herd to be told how things really are.
Needless to say, the emotional brain would not approve of this boot camp. The emotional brain believes in hazing, another joining ritual. The idea is that the new members of the herd are so low that they aren’t even in the hierarchy yet and they have to be tested to see if they make the grade.
Much of the hazing ritual involves taking the measure of a person: seeing how far you can push someone to make him angry, where he will draw the line, how good her political instincts are, whether he has a sense of humor or is willing to be deferential. The group can discover all of these things quite quickly by giving the new person a hard time and seeing how he or she handles it. The kind of hard time may differ from the factory floor to the fifty- third floor, but the purpose is the same.
The concept of hazing is universal and could be adapted positively for business. For example, new employees could be expected to do certain tasks and be told at the outset that the purpose is to show their style of working. This kind of ritual already is in place in academia, where doing a masters thesis or doctoral dissertation is a task that not only shows that you’ve learned how to do research in a particular area, but also that you’ve mastered the academic system well enough to be a part of it, that you have the political savvy to actually get the degree.
No discussion of ritual would be complete without mentioning status symbols. The Emotional Brain is always on the lookout for cues about who is on top. The cues are virtually everywhere. What clothes people wear, what they drive, where they eat, what restroom they use, the size and decor of their offices, you name it. When these cues are displayed, the emotional brain can be fooled into thinking that one’s status is higher than it really is. A great deal of management literature is designed to teach people how to fool the emotional brain in this way, so much so that large parts of the corporate world wear gray suits, drive gray BMWs and eat lunch at Chez Louis.
The emotional brain is smarter than that. When everybody has the same, easily visible status symbols, it will pick out more subtle ones that still have meaning. Then there will be more books to read.
Some companies require corporate uniforms—not the whole outfit, just a jacket, tie, lapel pin or the like. Uniforms are aimed at fostering a sense of esprit de corps, but sometimes they can do just the opposite. If, for example, the CEO doesn’t wear the uniform, then wearing it is a mark of being a grunt, and the ritual becomes one of fealty rather than affiliation.
The ritual also goes wrong if wearing the uniform or displaying the object is something you have to do or you get in trouble rather than a choice to show your loyalty or a reward for making the grade. It would be better if the lapel pins could be earned instead of required.
The Change-in-Procedure Ritual.
Few companies do this, but the emotional brain would love a ceremony for burning the old forms, or making the final call on the old phone equipment or turning in the final request on the outdated purchase order. The ritual would reinforce the idea that a new procedure, which will be stressful and difficult at first, has everyone’s support and is something the group will take on together.
The Sign-of-Appreciation Ritual.
Showing appreciation for significant deeds will become especially important as more companies are legally required to base salaries and promotions on seniority rather than achievement. Most people will work very hard if they think they have a chance of getting some kind of recognition, such as employee of the month or something similar. It’s important, however, for management to be very clear about the requirements for earning the award, because often people aren’t clear about the criteria and just assume it’s a reward for brown-nosing.
Before beginning a mad whirl of staff birthday parties and employee-of-the-month celebrations, however, you need to decide what kinds of behaviors or achievements you’re going to reward. They should be the kinds of behaviors you want to see more of: being a team player, showing bravery in the face of adversity, or whatever your company or department holds dear.
A word or two, also, about noncontingent rewards like birthday cakes and Christmas cards from the boss. Once begun, these rituals must be continued or people feel insulted. It’s best to keep the ritual manageable from the beginning, a birthday card instead of a cake, for instance, or a sign on the person’s office door announcing his or her special day.
Affiliative rewards such as the office party or company picnic can turn into rituals of serfdom if the company doesn’t take the time to find out what the rituals mean to the people who have to carry them out. A company picnic, for example, can mean the thing you have to go to and smile during and act like you’re having a great time at or else you’ll get in trouble with the old man.
The Years-of-Service Ritual.
A ritual is only important if it points to something that’s really there. If there is no real honor, benefit or gratitude for twenty years of service, then the ritual is hollow and empty. Sometimes a company will try to use a ceremony instead of something real, such as rewarding twenty years of service with more responsibility, more money, a more secure job and more respect within the business community.
Rituals can be an important and positive part of corporate life. To be a positive influence, they must reflect reality, not stand in the place of reality.