Categories
Programming Tech

Google Glass Unboxing and Review, Jasmine-Jquery+SquireJS example

Google Glass Review

I just got my Google Glass Explorer 2.0 edition in not that long ago, and I know alot of people are curious about how this gadget works, so I’ve put up a video of it (an unboxing one, and a review).

httpv://youtu.be/NPBNNwQB_Ss

httpv://youtu.be/RHg-bnx7r3A

Example client side Jasmine unit test using the jasmine-jquery + SquireJS libraries
Ok, so I finally figured out these client side tests. I have an example test here that uses Backbone Models as objects, the Jasmine-jquery library to test DOM interactions and the SquireJS library to mock out requireJS dependencies. Hope this helps someone.

//your jasmine test suite
describe('Car View', function() {

        beforeEach(function () {
            this.injector = new Squire();
            this.car = new Car();
        });

        afterEach(function () {
            this.injector.clean();
            this.injector.remove();
        });

       it('test car creation with a mocked out owner', function () {

            var ownerInput, brandInput, modelInput;
            var carMock = this.car;
            var injector = this.injector;

            //squire injector runs asynchronously inside its own closure so we need to run synchronously in Jasmine via run and wait
            runs(function() {
                carMock.set({
                    brand: 'Honda',
                    model: 'Civic',
                    owner: 'John Wayne',
                    url: '/car/civic/123456'
                });
                //Owner is some backbone model that is pulled in via requireJS that we want to mock because it can't be mocked normally
                var ownerMock = new Owner({ name: 'John Wayne' });
                injector.mock('dep/owner', ownerMock).require(['car.view'],function(CarView) {
                    var carView = new CarView({
                       model: carMock
                    });
                //lets say on render, your car view populates some owner field with the owner name, and the brand and model fields the same way.
                CarView.render(); 
                ownerInput = carView.$el.find('.owner input');
                brandInput = carView.$el.find('.brand input');
                modelInput = carView.$el.find('.model input');            
                });
            });

            //wait for dom to render 
            waits(1000);

            //do your assertions
            runs(function() {
                expect(brandInput[0]).toHaveValue(carMock.get('brand'));
                expect(modelInput[0]).toHaveValue(carMock.get('model'));
                expect(ownerInput[0]).toHaveValue(carMock.get('owner'));
            });

        });

});
Categories
Programming School/Work Tech

Backbone Apps, Express Apps, Client side unit tests, Korean, Gadgets, Videos

Thanksgiving is coming soon, and these days it does seem like I need a break.

What an interesting year it’s been for me. Multiple broken friendships/relationships, lost over $5k in parking fines, lost over $10k in stock options, multiple missed opportunities, a broken wrist, failed drivers test, I could go on. This year has not been one of my better years.

Just two months ago, I posted about how Bitcoin was a good investment, but never took the time to actually invest in it (due to confusion about how to actually buy them). Well now, Bitcoin is over $1200 (it was $135 at the time I posted that). So a potential windfall opportunity has gone past me.

These days, what do I have to look forward to? Just work, and study. Pretty much my life these days.

Client side unit tests
On the work side, I’ve been writing a lot of client side javascript tests recently, and its really made me more interested in them. Originally, I was not too fond of writing unit tests, as I felt them tedious, but now I find them kind of challenging. Jasmine is a popular client side testing framework, and getting it to work well with Backbone models, routers and views, is a good challenge. I’ve also been using libraries like SinonJS to mock/stub/spy out functions/objects, ChaiJS to unify the TDD/BDD style assertions, Karma as a test-runner, and Jasmine-jquery to test out dom events. Now I’m trying to mock out RequireJS dependencies (Squire.js/). It’s been a frustrating but enlightening few weeks trying to get my head around client unit tests.

BackboneJS extensions
Also, been trying to move from using string based templates like handlebarsJS into using dom-based templates. I really really want to get RivetsJS to integrate with BackboneJS so we have computed properties and data bindings (thanks to dom templating) but it’ll have to wait until we refactor all our handlebars templates to use Rivets Views instead. What other things do I recommend for a large Backbone app? Controllers and Container Views. MarionetteJS provides those. Also, use lodash instead of underscoreJS (It has more features).

NodeJS / express
I’ve really gotten around to liking NodeJS / ExpressJS so far. Using the ExpressJS API is easier than having to learn Apache modules and servlet containers and all that stuff. To be sure though, its quite different than the usual JavaScript you’d expect.

Korean
On the studying side, is my Korean getting any better? I’ve been taking classes now, and it feels like they focus more on writing and reading, which are traditionally the pillars of language education. Recently though, I’ve been subscribing to the Pimsleur approach of focusing more on speaking and listening instead. In fact, speaking and listening are the hardest things for me right now, and I constantly struggle when I listen to Koreans and figure out what to say. These days, I’ve been using korean dramas (a la drama fever) to study by listening, and repeating what the actors are saying and watching multiple times with and without subtitles. It’s an exhausting job trying to learn Korean when everyone around you speaks English and the opportunities to meet Koreans are few and far between, seriously. And it also doesn’t help that what Koreans speak and what textbooks teach you are different. For example, my Korean friends told me that 당신 and 실례합니다 are not often used in real life, despite being in the book as ‘you’ and ‘excuse me’.

Gadgets
I bought an iPhone5S, an iPad Air, and also have the chance to get Google Glass (as a BitTorrent developer) as well. What do I think? I really like the iPhone of course, as I tend to prefer smaller screens and the iPhone5S probably has the best camera in the business. The TouchID thing is pretty cool too. The iPad Air also surprised me. I didn’t think an iPad could replace my MacBook, but after using the iPad a few days with a bluetooth keyboard, I can honestly say that 90% of the things I can do with the MacBook (except programming), I can do with the iPad, and the iPad has LTE on top of that and only weighs 1lb so I can use it anywhere. Surprising, I might have to sell my MacBook.

Anyways, I haven’t updated recently because my life is fairly mundane so far. I did upload several videos though, so take a look:

San Francisco’s Hidden Gems (my friend helped me with this one):
httpv://www.youtube.com/watch?v=P2lw-yKA0CA

iPad Air vs Kindle Fire HDX
httpv://www.youtube.com/watch?v=JtpXyh542L4

Sony HMZ-T3
httpv://youtu.be/avIEWVmFEZQ

Categories
Tech

Top 5 upcoming VR/AR gadgets I’m excited about

I loveeee gadgets (See here). Especially gadgets which have to do with simulating reality, virtual reality, and augmented reality. And here’s the top 5 list of the VR/AR gadgets that I’m most excited about in the near future.

1. Oculus Rift

httpv://www.youtube.com/watch?v=1obwvn1Pgfo

Man, this thing sounds really cool. I know developer editions are already shipping, but I can’t wait for the consumer versions to come out. I mean, being able to play games and have head tracking and that immersive feel is just awesome, and something I’ve been wanting to do for a long time. Imagine playing Fallout 3 and feeling you are actually inside that nuclear wasteland. So cool.

2. Meta glasses

httpv://www.youtube.com/watch?v=b7I7JuQXttw

The developer says that this is Google glasses on steroids. Basically its a more powerful, more featured version of Google glass, so you can imagine what thats like. In the video they had all sorts of augmented reality showcases, and it looks really cool and fun. They are currently shipping developer editions early next year, so I hope that it does what they say it will do. And I know Vuzix already has production versions of its augmented reality glasses, but this is much more affordable.

3. Sixense STEM system and ControlVR system

httpv://www.youtube.com/watch?v=UxSZ0fk_ubA

httpv://www.youtube.com/watch?v=UClUkL24oMc

These two devices are basically augment the virtual reality experience of the Oculus Rift/Sony HMZ/PS4 VR when playing games, specifically using the hands and arms. The STEM system puts sensor pads over some analogy controllers and packs so that individual limbs can be tracked, and ControlVR looks like a Kinect or Leap-motion-esque controller which has no physical device, unlike the STEM. By the way, the developer Sixense also made the Razer Hydra, so you know they have street cred.

4. Virtuix Omni and Cyberith Virtualizer

httpv://www.youtube.com/watch?v=03VghV33JZs

httpv://www.youtube.com/watch?v=k7n5kRRHDpw

Can you imagine Oculus + Omni/Virtualizer + STEM/ControlVR? Thats the full package right there. This completes the full VR experience.

5. KorFX

httpv://www.youtube.com/watch?v=dASpXLSjq20

A haptic gaming vest. Which means you can feel all the effects in game, except physically. This is awesome, if it works.

There’s some other gadgets that I am excited about too. Reactive Grip actually integrates with the Sixense STEM pretty well.The Turtlebot system is a robotic platform on which you can mount almost anything. So imagine what applications could be made if you could combine robots/quadcopters with VR/AR systems? Well, that kind of just blows my mind.

Anyways, these are exciting times we live in, and I’ve always been a gadget freak, from my Pocket PC/PDA devices I carried around in 2003 to the iPhone 5S with its fingerprint sensor, so I’m really excited for what the future holds :).