A Review of The Historic Mayfair Hotel In Los Angeles

Day #1 December 2nd, 2014 – Arrived at the hotel. The lobby interior did not look so bad. It actually had a nice historic charm about it. But then we got to our room, we had two keycards, only one of them worked. There was a big wet patch on the carpet near the fridge, the room smelt like mold. We told room service about it and their solution was to put down two towels on the floor.

It is also worth noting that there was some patching around the door lock like someone had previously kicked the door in or something. Not a good first impression that is for sure. Fortunately, during our stay nobody kicked in our door (always a bonus).

I don’t know why the floor was wet, but I had a couple of theories. A) The floor was wet because the fridge was sitting on the carpet and fridges produce condensation. B) There was a leak beneath the floor and C) Our room is actually floating on-top of a swimming pool.

Speaking of which, the fridge made an unusual sound, kind of like it was dying. We put some basic groceries we bought from the City Target down the road only to discover the fridge was turned all of the way up and our food had frozen. Because there is nothing better than pouring frozen milk into hot tea, am I right?

Besides the room having two separate beds, the room was decent was for what you got. The bathroom small, the TV most likely purchased in 1989 and the carpet no doubt not been replaced since this place opened up in the twenties or thirties.

Upside: There was a vending machine on our floor. It had orange crush and Pepsi, for $2. Nothing quells the rage of a wet smelly floor like a $2 bottle of Orange Crush.

Downside: The floor near the bathroom was wet, even with towels room service put down, they just absorbed the water.

Upside: This was the only wet patch in the room, so you could just walk around it. You also got used to the musky smell of the wet carpet quite quickly.

Downside: The elevators actually sounded like they were broken ad or breaking. The thought of plummeting from the 8th floor in an old elevator scares me. The city safety permit in the elevator had expired in November 2014, no new one was put up. So either it has not been inspected again, they paid off the inspector or they got it inspected and have not put it up for display yet.

Upside: Did not die in a free-fall elevator incident.

At 7:20pm on December 3rd, 2014 I saw a man behind the reception counter by the name of John being rude to a customer who obviously could not speak English very well. I then went up to the counter and asked for change for a $20 note I got from the ATM (a $3.75 fee by the way). He replied, “I don’t keep change here, go to the 7–11 if you want change” in a rude and emotionless tone. I replied, “Ok…” and then walked off. Fair enough if you don’t have change, but there is no need to be rude to a paying customer.

By the way, when people tell you not to go outside at night, listen to them. The area is teeming with criminals. The staff at the hotel warned us not to go out when it gets dark, they especially seemed concerned that we arrived via taxi to the hotel at 10pm at night. Even the taxi driver we had on the way to the hotel was telling not to go out at night near our hotel, “Very dangerous you could get shot or stabbed at night” were his exact words.

We stayed inside at night time mostly. There is a 7–11 a couple of minutes from the hotel (same street and same side). I went there about 7pm and survived, there were a few questionable people in there, but nobody caused any trouble.

On the second last day, we organised transport from the hotel to the Greyhound Bus Terminal downtown Los Angeles. The hotel recommended this because the guy behind the counter and I quote, “You don’t want to use taxis in LA, they are all Mexicans and Pakistanis who will rip you off and try and take all of your money” – fair enough, and it was only $12.

On the day of our departure at 5am our transport arrived on time. He helped us with our bags and we got into the black minivan. I don’t want to seem mean, but this guy was strange.

He was obviously Hawaiian, didn’t really speak English that well and kept saying strange things to Marie about babies like; Beautiful mummy, you will make beautiful mummy. Being her nice self, Marie said thank you and he just kept repeating the same stuff all while his loud Hawaiian music played. Then it got really weird before we arrived at our destination, he started making baby coo’s and crying, “Mumma, wahh, momma”

We got the hell out of that minivan and rushed into the bus terminal. I am sure he meant well, but it creeped the hell out of us (Marie especially). That was the end of our hotel stay at Mayfair Historic Hotel.

 

My Review of A Greyhound Bus Trip From Downtown Los Angeles to Las Vegas (And back again)

The stench of weed and body odour is in the air. Homeless people and nefarious individuals sleep and loiter on benches outside of the Greyhound Bus Terminal in Downtown Los Angeles. One man comes up to us, “Hey man, have you got any spare change?”, it’s 5am and people are already asking me for money.

Being near Skid Row does have its advantages though, if you are homeless or a crackhead, but fortunately we pulled up outside of the terminal and walked straight in. I would not walk here regardless of how close you are to the terminal, especially early in the morning or at night.

The dismal reviews on Yelp should be warning enough to stay away from Greyhound, but the $16 bus tickets were too cheap to ignore. The old saying, “You get what you pay for” can’t be any more true.

We line up and get our tickets and luggage tags. This part was really easy and the staff were friendly. My fiancee had a small suitcase that looks like carry on and is quite wide, we asked if we should check it on as luggage and she said that it would fit as carry on, so we go to carry it on.

As we were lining up, one of the guys who were loading baggage said that it wouldn’t fit as carry on and that he would load it under the bus for us. We thanked him and got on the bus.

Shortly after getting on the bus, the driver named Gorman or Gordon (or whatever his name is) comes onto the bus shouting holding up Marie’s small suitcase shouting, “Who’s bag is this?”

Marie then responds that it is hers and he says, “Where is your luggage tag? You can’t load luggage on without a tag” we tried to explain that the lady at the counter said it could be carry on, but as we were getting on, the man handling the luggage put it under for us. He walked off shaking his head and put it back under the bus.

This was a taste of what was to come on our eight our journey.

The trip was horrible. It was like being in a school bus full of teenagers. People playing loud music from their phones, the bus driver subsequently shouting at them to turn the music down. A guy using his phone like a walkie talkie (what is up with that?). Some guy was snoring loudly. A lady was coughing without covering her mouth, prompting the bus driver to come over the speak and tell people to cover their mouths when coughing.

Some teens at the back were putting their feet up on the seat, prompting the bus driver to stop at traffic lights and yelling at them to, “Show some respect or he’ll kick them off the bus” – this I agreed with. I don’t want to sit on a seat someone has put their feet up on, who knows where they have been.

One of our stops, the bus driver turned a corner too late and hit a stop sign with the right side mirror. It didn’t break, but seemed to trigger some kind of sensor, because the bus was beeping constantly about 20 minutes after, with the driver constantly stopping to fix up the placement of the mirror. This was a taste of things to come, the swerving on the highway, over the vibrating white lines constantly, made it impossible to sleep or feel safe.

The most entertaining aspect of the trip from Downtown Los Angeles to Las Vegas was definitely the stop in Barstow. If you want to see interesting people and by interesting I mean gang members and other nefarious individuals, look no further than Barstow. Fortunately we made it out of there, bullet hole free (my bulletproof vest was in the wash at the time).

If you like the smell of stale urine, you are going to love taking the bus with Greyhound. I don’t know if it was the toilets or some people who soiled themselves, but the bus smelled and we were at the front. I actually got a headache from the smell.

The wifi and electricity outlets worked (thanks heavens). The wifi was the standard bus fare, good in some parts and completely unusable in a few others. The seats were surprisingly comfortable and clean, not much leg room though (compared to rivals like BoltBus or MegaBus).

My favourite part was when we were in downtown Las Vegas and the bus driver was pointing out a few things, he pointed out the location of the ferry and someone asked, “How much is the ferry?” and he replied, “How the hell would I know man, I am a bus driver” in a sarcastic and rude tone. Why point something out if you don’t want to be asked questions?

We were happy to see Vegas and subsequently get off the bus. No tip was given to the driver for his bad attitude (we usually tip good bus/taxi drivers).

Part 2: The return trip home from Las Vegas to Los Angeles

We arrive at the small bus terminal. There is one lady behind the counter called Ashely for what was a very long line. She was courteous, patient when we were struggling to find our trip details in our email and happy.

The terminal itself although small seemed safe, it did smell a little dingy like an old casino or motel. After reading some reviews online about how unsafe this place is and the people that hang around it, I was expecting a miniature Skid Row inside of the terminal, but surprised to see somewhat normal people there.

I can’t attest for what this place is like at night (I read that it isn’t good), so if you can, take a trip on a bus during the day.

Everything goes smoothly. We check in Marie’s smaller carry on looking bag as luggage for a $15 fee to save any issues. We line up and get a seat. The bus driver on this return trip seems a whole lot nicer, a guy by the name of Raymond. He was fairly talkative and professional.

In-fact, his announcement as we left off was surprising. He detailed procedures for getting out of the bus in an emergency (how to open up the windows and roof panels), where the fire extinguisher is and what to do in a medical emergency. The trip on the way here had no such info.

More surprisingly, this return bus didn’t smell like a nursing home. The bus was clean, the people on the bus were all normal and listened (for the most part to the drivers instructions). There was no loud music or any other behaviour. Best of all, Raymond knows how to drive, so I felt comfortable that I was not going to die on this bus ride today.

It seems most people have bad experiences on Greyhound as I was reading. While the return trip back to ghettoville LA was very decent and trouble-free, we won’t ever travel Greyhound in the US again.

For the most part, you should believe the reviews. Obviously Greyhound is for budget conscious people, but consider going with a company like Boltbus or Megabus instead (both travel to Las Vegas), you’ll get newer buses, more leg room and better service.

Never again Greyhound.

 

Why Street Fighter V Is a PS4 And PC Exclusive

Can you hear that? Put your head up to your monitor. That is the collective sound of XBOX fanboys weeping over the recent announcement that Street Fighter V is a PS4 and PC exclusive.

You know why? Cross platform multiplayer.

This is an idea that has long been touted in the gaming world in theory but never really actually implemented in practice: until now. Street Fighter V will support cross-platform play between PS4 and PC players.

The reason that XBOX is not in the picture is because Microsoft for whatever reason, are against cross-platform multiplayer (a tune they will no doubt be changing if the game is a success). Long chasers of the locked-in platform dream, one that is slowly dying with next-gen gaming. If this trend takes off (there is no reason why it shouldn’t) then Microsoft need to comply or die.

I honestly hope this becomes a more common thing in gaming. Cross-platform gaming means that filling up games with players will be a lot easier, and might even help with GTA V’s horrible lobby matchmaking issues which result in struggling to fill games with 8 players.

 

What Do Sony Have Up Their Sleeves For Playstation Experience?

Sony are holding a big event in Las Vegas on Saturday the 6th of December, 2014, dubbed Playstation Experience. While Street Fight V has already leaked, very little else is known about what to expect.

What I think is going to be the showcase piece is Project Morpheus. We might get a release date, it is already known that attendees will get to experience the headset at the event. Sony wouldn’t allow the general public and judgemental game blogging media to get their hands on it if it were not close to completion.

We might also see a whole bunch of AAA titles being mentioned with support for Morpheus and a 2015 release date. Imagine if Street Fighter itself will support the VR headset? That would be massive. I would be willing to bet that Sony is going to go hard on its VR headset, possibly beating Oculus to market with a wider range of games and possibly at an affordable price-point.

Apparently Sony has an announcement being dubbed an Overwatch style announcement named after Blizzard recently announced their first new IP in 17 years an MMO called Overwatch.

The thing is, nobody saw Overwatch coming, it was a completely unexpected and big announcement. Whatever it is Sony has planned, it must be quite big and unexpected. Perhaps it could be announcement that Morpheus is going on sale in time for Christmas?

One game being released in 2015 for PS4 is the hotly anticipated No Mans Sky a space exploration game. Not only does it look great, but if the announcement tomorrow at the event is No Mans Sky supporting the Project Morpheus virtual reality headset, people are going to lose their shit.

Arguably one of the scariest games ever made, Silent Hill is currently in development and was announced a few months ago to be called Silent Hills. There are rumours that this new game could come out with full Morpheus VR support, but time will tell.

Could you imagine a Silent Hill game with a virtual reality headset? That would be scary as and at the same time, really cool.
I am in Vegas on the weekend, so I might try and make the event on Sunday and see what the fuss is all about and try out Morpheus myself.

 

What Is The Difference Between Google Polymer and AngularJS?

There is some confusion around what the difference between Google Polymer and AngularJS is. Both being Google supported initiatives, lets clear up the misconceptions and explain the differences.

Google Polymer

Essentially Google Polymer is for creating Web Components. Self contained modules written in HTML and used similarly to AngularJS directives using the type of “E” for element.

Web Components are a W3C standard, although not finalised or fully implemented in all browsers, Polymer is a set of polyfills for implementing cross-browser Web Components.

Essentially a Web Component is a self contained element that can have its own HTML, JS and CSS separate from the DOM itself. For example, HTML5 elements like <video> and <audio> are Web Components. They contain many HTML elements inside of them and if you inspect the Shadow Dom inside of a browser like Chrome, you can see these simple elements are not so simple.

AngularJS

The difference between an AngularJS directive and Google Polymer is the fact your custom elements using Angular directives do not support their own encapsulated CSS or JS, this needs to be handled within the directive declaration itself.

Having said that, you can almost get the same functionality of a Web Component using an Angular directive, but minus the ability to have its own encapsulated assets independent of the page itself.

Conclusion

While Polymer and AngularJS are two different beasts, eventually we will see Polymer integrated into Angular, perhaps version 2.0 as major API changes in Angular bring forth better modern browser support.

Web Components are a W3C standard, Angular is not. Through the use of polyfills and other syntactic sugar, Polymer is an intermediate step on the road to browser support for Web Components. The best browser out there that supports the current spec is Chrome, especially version 36 onwards. Although Firefox is slowly implementing support for Web Components, it will take time.

So while you can achieve the appearance of a web component with Angular directives, if encapsulation matters to you, Polymer might be a better choice for your needs.

 

Increasing AngularJS Performance By Debouncing Your ng-model Updates

One of the biggest bottlenecks in Angular 1.x is the $digest cycle. Essentially what the $digest cycle does is keeps track of two-way bindings, watchers and other parts of your Angular application that can be updated.

For example if you have a text field using an ng-model, whenever you type in a value into this field, it will trigger a $digest cycle causing Angular to update all watchers and bindings in the app to see if anything has changed. This is because of the lack of object.observe() in ECMAScript 5 (although it is in ES6 and planned for Angular 2.0).

In version 1.3 of Angular, a native debounce feature was introduced which can be supplied to ngModelOptions.

Debounce, what?

What is a debounce you say? Essentially it is a delay which says, “Wait X amount of time and then do this action if an action is not already in progress” so in the instance of waiting for typing in a field for an email for example, you might want to put in a delay of 300 milliseconds so if a user stops typing and doesn’t resume within 300 milliseconds, an action will be fired which will trigger a $digest cycle.

As can be seen in the above linked Angular documentation on ngModelOptions there are a few Plunker examples showing debounce and selective updates on ng-model.

<div ng-controller="ExampleController">
  <form name="userForm">
    Name:
    <input type="text" name="userName"
           ng-model="user.name"
           ng-model-options="{ debounce: 1000 }" />
    <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button><br />
  </form>
  <pre>user.name = </pre>
</div>

The above example taken from the Angular documentation shows that we are setting a debounce value of 1000 milliseconds which is 1 second. This is a considerable delay, but will prevent the input from repeatedly thrashing ng-model with many $digest cycles.

By using debounce on your input fields and anywhere else where an instant update is not required, you can increase the performance of your Angular apps quite substantially. Not only can you delay by time, but you can also delay when the action gets triggered. If you don’t want to update your ng-model on every keystroke, you can also update on blur as well.

A word of warning

If you set your debounce values too high, users will perceive your app as slow because you are artificially delaying the response and triggering of actions within your Angular application.

In most cases, a delay of 250 to 350 is acceptable and will not offer any overly noticeable slowness in your applications. Unless you need to set a higher value for whatever reason, keeping your debounce values below 350 will ensure your app is not only performant but still responsive.

 

AngularJS: Service vs Factory

For newbies and even developers who have been working with AngularJS for a while, there is some confusion around services and factories in AngularJS. Behind the scenes they are very similar, how they are instantiated however, is another story.

The first thing to realise is that services, factories and just about everything else (except directives and controllers) are singletons. Using a factory or service is just managing a singleton. This means the same instance of a factory or service is used everywhere.

Factory

Unlike the traditional use of factories in programming, a factory is a singleton in AngularJS (crazy, I know, but lets work with what we have here). Essentially you define your functions within the file, and then return an object of properties mapped to functions.

If you are familiar with various modular Javascript patterns that were popular before front-end frameworks were popular, the below approach will look familiar to you (sans the Angular trimmings, of course).

app.factory('MyFactory', function() {
    var myFactory = {};
    var firstName = '';
    
    myFactory.setName = function(name) {
        firstName = name;
    };
    
    myFactory.getName = function() {
        return firstName;
     }
});

As you can see, you are selectively returning what we want to expose. This allows us to have private variables that cannot be accessed from within a controller. If you want to prevent certain aspects of say some code that interacts with an API being modified within a controller or directive, a factory out-of-the-box is the best choice.

Service

A service is VERY similar to a factory, in-fact it is basically the same with exception that you don’t selectively return an object of mapped functions. A service is instantiated using the “new” keyword, which means your entire service and anything mapped to “this” is returned.

app.service('MyService', function() {
    var privateVar = '';
    this.firstName = '';
    
    this.setName = function(name) {
        this.firstName = name;
    };
    
    this.getName = function() {
        return this.firstName;
     }
});

As you can see, our service is basically the same. Anything that is set on the instance of our service using “this” is public and will be exposed to any other controller or directive we inject this service into.

You might also notice we have a private variable in our service. But didn’t I say that factories are good for that kind of thing? Yes, because out-of-the-box in a factory, everything is private, you have to selectively expose things. In a service, anything on this is considered fair game and public.

Conclusion

So when should you use a factory or a service? In all seriousness, they both do the same thing. I would be more inclined to use a service for communicating with an API comprised of more than just a GET method, but rather POST, PUT, DELETE and any other transformative methods.

For reference, in a project I am currently working on. We have a custom module for overlay functionality in the app. The overlay uses a service to keep track of its state (is it opened or closed) as well as methods for setting these variables and checking their current value.

Choose what makes to you, but for the most part, a service will mostly always serve your needs. It comes down to a matter of preference, because as I pointed out earlier, they are both singletons.

 

My Thoughts On Target Australia Banning GTA V

After a recent petition on Change.org filed by some single-minded feminists requesting that Target Australia stop selling GTA V because it encourage violence against women, Target Australia have caved and removed the game from their shelves.

The petition hit just over 41k signatures (relatively small compared to other petitions and the population itself).

As an Australian adult it sickens me that a small minority of feminists even started this petition, but even more-so that Target Australia caved into the pressure and removed the game.

In Australia we have an R18+ rating for games (relatively new, but established before GTA V was released) and GTA V is one such game. The question is why now? The game was released in September 2013, over a year ago, why the petition now?

The petition claims that the game is teaching young boys to grow up thinking that violence against women is okay. Who in their right minds is letting young boys play GTA V in the first place? It is an adult game with an adult rating. If parents are letting their young children play the game, is that the fault of Rockstar, Target, the boy or is it the fault of the parents? Were Target Australia knowingly selling the game to under 18 year olds?

The petition also fails to mention that the game allows violence against meant as well, it is not a one-sided game (although the petition is). While we are on the subject, did you know that men are also victims of violence as well? Did you also know you can beat men up for money in GTA V?

While we are at it why don’t Target remove Barbie dolls from shelves for sexualising and portraying unhealthy images of women? Why don’t Target remove Nerf guns for encouraging young boys to think shooting people with guns is okay? How about Target stop selling Game of Thrones box-sets and episodes because it sexualises women and violence? How about Target stop selling copies of Fifty Shades Of Grey because it also sexualises women and teaches young boys that domination of women is normal and they are objects you can own.

I acknowledge violence against women is a real thing. But blaming such acts on a video game is wrong, it is an insult to women to suggest computer games could be to blame for some acts of violence against women, when we all know the statistics point to drug and alcohol abuse as the most contributing factors to domestic violence against women.

We live in a society that is always looking for a scapegoat, someone or something to blame. We never stop and think, that blaming computer games for problems in society does not change anything, it does not make a difference whatsoever. Computer games are not the problem, feminists, bad parents and single-minded people like the ones who created this petition are the problem.

As as a result of this, I will never shop at Target Australia again. Even if they were to reverse their decision, they have already made their bed and now they can lie in it.

 

Observations & Trends In Web Development Going Into 2015

Looking back on the last couple of years in web development, things have dramatically changed. We have gone from an industry with a heavy dependence on Photoshop to favouring actual working prototypes and products.

As we march into 2015, I thought it would be worth taking a look what we can expect in 2015 (besides a continuation on the mammoth year that was 2014) for web development.

Goodbye Photoshop

While Photoshop is not going to die over night and still be used by many designers, 2014 saw the rose of alternative software products to Photoshop being accepted into the mainstream, the main one being Sketch by a little company called Bohemian Coding. Completely vector based and built for developing modern websites and applications.

Going through posts over the last year on Designer News revealed stories of many companies who have ditched Photoshop for Sketch and been rather successful. Others have seen the value in just designing in the browser using HTML, CSS and frameworks to get the job done.

The rise of front-end frameworks

When it came to the front-end department, 2014 was a hell of a year. We saw ECMAScript 6 enter a feature freeze, Facebook’s foray into the high-performance DOM rendering/framework race with React.js and the future of Google backed AngularJS was revealed with plans for version 2.0 to be a complete rewrite.

We also saw front-end frameworks become increasingly accepted by designers for prototyping and building web applications. While AngularJS definitely saw an increase in adoption, so too, did EmberJS and Facebook’s view saviour React.js.

Even though a few of the front-end frameworks and libraries out there have been around for a few years (with exception of React), we only saw them starting to become accepted in the mainstream and enterprise.

The unstoppable domination of Node.js

When Node.js originally hit the scene nobody knew where it would end up in a matter of a few short years, but here we are and Node.js is not slowing down in its attempt to become the defacto choice for web development. Almost all front-end tools in 2014 (the ones that matter) were built on Node.js, expect to see Node step it up a notch as it continues to delve deeper into the mainstream and enterprise sectors.

Look no further than companies like LinkedIn and Walmart who have adopted Node.js with arms wide open, as Node continues to grow in popularity, 2014 actually saw the once number #1 choice for startups Ruby and Ruby on Rails drop in popularity in favour of Node.

Package managers everywhere

We saw package managers being used more and more in 2014. Just amongst my developer colleagues and friends I noticed many go from the attitude of we don’t need package managers to using them.

As 2015 rolls around, we are already seeing the two major players in the game. Bower for front-end dependencies and NPM (Node Package Manager) for workflows that use Browserify or Webpack as well as isomorphic web applications.

Slowly but surely the industry is finally starting to standardising on certain front-end tools like package managers (which is a good thing).

Isomorphic web applications

Largely thanks to Node.js, we have seen Isomorphic web applications become a viable solution for many in 2014. Although not an entirely new premise, thanks to Node.js and a few packages supporting isomorphic web applications (a single unified codebase running Javascript) we have seen and heard stories of companies architecting their web applications using a single codebase.

Expect to see and hear a lot more about isomorphic web applications, mostly using React.js, AngularJS and of course, Node.js behind the scenes pulling all of the strings.

RWD (Responsive Web Development): Round 2

Lets keep in mind we have had the ability to developer cross-browser/devices web applications and websites for at least 4 going on 5 years now and it was only in 2014 that we saw many starting to adopt responsive web development, more specifically mobile-first responsive web development.

As front-end frameworks like Angular start to focus on handheld/mobile devices, we are seeing people finally see the light and build their websites/applications with smaller screens in mind.

People are eschewing conventional means of reaching mobile users, once upon a time you would build an app, but as Google starts to factor in small screen support into its web ranking algorithm, expect to see SMB (Small to medium businesses) start to see the benefits in a responsive site/application.

It pained me to see just how many websites are still not responsive, even from fairly large companies. In 2015 we are going to see a major push towards RWD as Apple and other companies enter the smart-watch race and once again, screens get smaller.

Full steam ahead HTML5

At the end of October, 2014 we saw something amazing, HTML5 was released as a W3C Recommendation meaning the specification process is complete. In 2015 we are going to see a major uptake of HTML5 usage as support for things like the &lt;video&gt; and &lt;audio&gt; is fairly decent.

We saw Google forgo support for NPAPI plugins in Chrome version 35 meaning that most people will have to go HTML5 or go home basically. Companies such as Netflix have already embraced HTML5 video, so expect others to follow suit sooner rather than later.

The (slow) death of CSS frameworks

Once considered the flavour of the week, CSS frameworks like Bootstrap and Foundation were used everywhere. Their ability to allow developers and non-developers alike to build/prototype simple web applications increased their popularity.

While we won’t see people all of a sudden just stop using CSS frameworks, more and more people are starting to see how limited they can be. Bootstrap is too opinionated and Foundation is too little opinionated to be the #1 choice for lazy developers and non-developers.

I think CSS frameworks will always be around, but experienced developers are starting to turn their backs to them. Expect the non-experienced developers to keep using them though.

Conclusion

The reality of the modern web is we don’t know what can or will happen. These are merely guesses and observations based on what I have seen and heard, who knows if any of this stuff will come to fruition.

Regardless, we can’t argue the web is in a massive and exciting transition phase as version 2.0 of the world wide web starts to become real.

 

AngularJS: How To Call A Controller From Another Controller

In AngularJS when it comes to communicating between controllers, one would naturally assume to reference another controller you can simply inject it into another controller and call its methods: however, you cannot do that.

Method 1: Shared service

One such method of communicating and sharing methods betweens multiple controllers is a shared service. Here you might put in a method for closing a overlay or redirecting the browser somewhere or checking the state and value of a variable.

The following example assumes you have created a service called “myService” and you have a method called updateVal and getVal for getting and setting values.

var myModule = angular.module('myapp', []);

myModule.controller('myController', ['$scope', 'myService', function ($scope, myService) {
    myService.updateVal('name', 'Dwayne');
}]);

myModule.controller('otherController', ['$scope', 'myService', function ($scope, myService) {
    if (myService.getVal('name') === 'Dwayne') {
        alert('The name is ' + myService.getVal('name'));
     } else {
         alert('There is no Dwayne');
     }
}]);

This is my preferred approach for sharing data and methods between controllers for a number of reasons; it makes things cleaner, it keeps logic separate from your controllers and above all: it makes things easier to test.

Method 2: Events

In some cases, events can be a lot cleaner than using a separate service. Triggering an event say for example when you open up an overlay, close it or perform some action you want to inform other controllers about can be done emitting an event on $scope.

var myModule = angular.module('myapp', []);

myModule.controller('myController', ['$scope', function ($scope) {
    $scope.$on('profile-updated', function(event, profileObj) {
        // profileObj contains; name, country and email from emitted event
    });
}]);

myModule.controller('otherController', ['$scope', function ($scope) {
    $scope.$emit('profile-updated', {
        name: 'Dwayne',
        country: 'Australia',
        email: 'somedude@example.com'
    });
}]);

Conclusion

Pick whichever feels right. I personally prefer method 1 because as I mentioned, it is testable, it is cleaner and keeps things separate. But using events also have their advantages as well.

 
Real Time Analytics