Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Home
Daily Thoughts
Ionic
Stack Overflow
Books
About me
  • Home
  • Daily Thoughts
  • Ionic
  • Stack Overflow
  • Books
  • About me
Nikola Brežnjak blog - Tackling software development with a dose of humor
Ionic

How to use Exis to Create a Chat App in Ionic

This is a guest blog post from Exis where they explain how to use Exis to create a chat app in Ionic.

Exis is a BaaS startup based out of the same hometown as Ionic (Madison, Wisconsin, USA). Exis is a platform that offers developers an easy set of tools for quickly developing their application and getting it out to market easier and with less errors.

Exis provides a set of free microservices such as user login and authentication, plug and play NoSQL-based cloud storage, cloud hosting of custom Node.JS backends, and a unique take on WebSockets that offers fully authenticated bi-directional messaging both peer-to-peer and with backend components.

Exis has created and released ngRiffle, a client-side library that integrates with Ionic and has recently been teaming up with Ionic to show just how simple app development can be when you combine the two services.

Following this blog-tutorial results in creating a simple chat app using Exis + Ionic. This tutorial will showcase some of the core features that make using Exis + Ionic an excellent choice for app development including publish and subscribe messaging, and running a simple Node.js server hosted on Exis.

Step 1

Register for a free Exis account or login if you already have one.

Step 2

Create a new app named “chat”

Step 3

Add an Auth appliance

Use the options: Temporary (name, no password) for the User account type

This appliance controls who is allowed to communicate with your backend.

Step 4

Clone the Ionic App

git clone https://github.com/exis-io/ExisChatIonic.git
cd ExisChatIonic
bower install

Step 5

Link your Ionic App to the Exis App you just created

Replace USERNAME with your Exis username in xs.demo.USERNAME.chat in www/js/app.js line 43:

.config(function($riffleProvider){
$riffleProvider.SetDomain("xs.demo.USERNAME.chat");
})

Step 6

Run the Ionic App!

ionic serve

Open the app in multiple tabs and chat away!

Congrats on building a chat app using Exis + Ionic! A step by step explanation of our code is provided below.

Learn How It Works!

  1. The Code
  2. Launching A Node.js Backend

The Code

Let’s take a quick look at the main logic of the chat app which is in www/js/controller.js

angular.module('exisChat.controller', [])

.controller('HomeCtrl', function($scope, $riffle, $ionicScrollDelegate) {

    $scope.msgs = [];

    //Login anonymously to Exis (requires Auth appliance level 0)
    $riffle.login();

    //subscribe to the chat channel
    $riffle.subscribe('exisChat', gotMsg);

    //handle messages here
    function gotMsg(msg) {
        msg.received = true;
        displayMsg(msg);
    }

    //publish message
    $scope.sendMsg = function(text) {
        var msg = { username: $riffle.user.username(), msg: text }
        $riffle.publish('exisChat', msg);
        $scope.input.msg = '';
        displayMsg(msg);
    }

    //display our msg
    function displayMsg(msg) {
        $scope.msgs.push(msg);
        $ionicScrollDelegate.scrollBottom();
    }
});

That’s it! Seriously. That is what a chat app looks like with Exis + Ionic. Let’s dive in a little!

Here are the basics.

line 8: $riffle.login() anonymously logs in the user as long as there is an Auth appliance with level 0 attached to the app.

line 11: $riffle.subscribe(‘exisChat’, gotMsg) subscribes our gotMsg function to handle events publish to the exisChat channel.
gotMsg simply receives the msg marks it as a received message and displays it. You can look at the view code in www/templates/home.html

line 22: $riffle.publish(‘exisChat’, msg) publishes the message we are sending to anyone subscribed to the exisChat channel.
It’s called inside the sendMsg function which is bound to the send button in the view and it simply creates the message object, publishes it, and displays it.

line 28: displayMsg is simply a utility function used to add the msg the $scope.msgs array which is bound to the view. It also scrolls the screen down as new messages are received or sent.

And there you have it! Pretty simple right?!? There is a couple more things you can do below if you want to get a little fancy!

Launching a Node.JS Backend

Let’s take a quick look at how you could attach your own Node.js backend if you wanted. The simple backend we wrote will simply listen to messages that people are publishing and log them, but you can fork our repo and and add whatever cool imaginative logic you’d like. We’ll start with our simple logging server though.

Fork the ExisChatBackend Repo

Go to the Appliance Store and attach the Container appliance to your app.

Container

Go to Container Management

Build the image by passing in your forked repo URL of ExisChatBackend from above, name it exischat

Build Image

Create the image from the dropdown on the left, call it logger

Create Image

Start the container by pressing the Start button below.

Start Image

Now messages you send on your Exis + Ionic chat app will be logged by your backend! To verify this you can send a few messages and then go to the Logs tab on your container.
Assuming you forked our repo like we suggested you can modify the server.js code locally and push your changes to your forked repo on Github and then simply update the image to see your
changes reflected.

Thanks for following this blog-tutorial! Feel free to fork the repos and modify this app! And if you’d like to show us what you did or you have any questions feel free to email us at [email protected]

Ionic, Stack Overflow

When is it appropriate to use ion-pane in Ionic Framework?

In this StackOverflow question I answered when it is appropriate to use ion-pane in Ionic Framework

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts, I will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

As you may know, I’m really into Ionic framework lately and am helping out on StackOverflow with the knowledge I gained so far with the framework. I’m currently #3 in the top All time answerers list.

I answered this question by user qizzacious:

This is a simple enough question.

After taking a look at the documentation for ion-pane it states:

A simple container that fits content, with no side effects. Adds the ‘pane’ class to the element.

What does it mean when it states “no side effects”? What are the use cases for ion-pane?

My answer was:

Honestly, I never used ion-pane before, but this question intrigued me so I went searching. As it seems, and you can see on this Codepen: http://codepen.io/anon/pen/JGwJKv?editors=1010, if the content is too big (if you try to resize the browser window to very small) it will not show it. Opposed to the ion-content which will add scroll bars and allow you to use ion-refresher and some other options (tapping into scroll delegate, etc.).

So, to be honest, I never stumbled upon a need for such a use-case, so would probably never use ion-pane. The lacking documentation about it, kind of suggests the same…

When is it appropriate to use ion-pane in Ionic Framework? https://t.co/3o9LVRoJxc

— Nikola Brežnjak (@HitmanHR) April 26, 2016

Ionic

60th SQL/DEV User Group meeting

Finally, I got my 5 minutes (well, OK, 45 to be exact) of fame 🙂

I was presenting Ionic Framework to  fellow developers on the 60th SQL/DEV UG meeting in Čakovec.

At this meeting there were actually two speeches:

  • Introduction to hybrid mobile app development with Ionic Framework
  • Electron

Introduction to hybrid mobile app development with Ionic Framework

  • presenter: yours truly
  • link to the presentation
  • picture time:
  • And (drums in the background) I’m very excited to announce that I’ll be speaking at the Weblica conference on 14.5.2016. Here, my name on the poster:
    thumb_IMG_6340_1024

Electron

  • presenter: Dejan Kovač
  • picture time:
    thumb_IMG_6192_1024
  • Electron website
  • Some cool apps have been built with it:
    Screenshot 2016-04-23 23.08.27
  • Electron is awesome, to be honest! We just have to wait some time so that it matures fully.
  • It’s the best time ever to be a web developer, as you now have access to every platform with the knowledge you already have

60th SQL/DEV User Group meeting #weblica https://t.co/6OVjLChKbk

— Nikola Brežnjak (@HitmanHR) April 23, 2016

Ionic

How to build a shopping app with Ionic Framework and Firebase

The sixth post about Ionic framework for Pluralsight was about making use of Firebase when building a real-time shopping TODO application.

You can see the post here: How to build a shopping app with Ionic Framework and Firebase.

You can try the app in your browser here: http://shopping-todo.com/.

You will learn how to build an app with the following features:

  • Login with Facebook or email
  • Add as many projects as you like
  • Invite as many users to your projects as you like
  • Track your expense on the go
  • View the updates live as they happen

Here are few screenshots:

In case you want to learn more about Ionic Framework, you can download (for free if you wish) my blog2book via Leanpub.

IonicBook

If you have any questions please don’t hesitate to ask, and please share if you like it.

How to build a shopping app with Ionic Framework and Firebase https://t.co/pyLYCXwWBp

— Nikola Brežnjak (@HitmanHR) April 23, 2016

Ionic, Stack Overflow

Showcasing Ionic Apps For a Portfolio Without Publishing Them to App Stores

In this StackOverflow question I answered how to showcase your Ionic apps for a portfolio without publishing them to App Stores

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts, I will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

As you may know, I’m really into Ionic framework lately and am helping out on StackOverflow with the knowledge I gained so far with the framework. I’m currently #3 in the top All time answerers list.

I answered this question by user Jubl:

I have a few Ionic apps that I made that I want to add to my portfolio site for potential employers to check out. However, I would like to upload them somewhere so that when a visitor clicks on my link, it will take them to a website showcasing my app. I don’t want to push my apps to the actual stores, but still make them publicly viewable. Is this possible to do with an Ionic application?

I understand that Ionic View exists, but I have to send out email permissions for people to try my app (from what I know). I’d rather my apps just be uploaded somewhere and be easily accessible through links.

My answer was:

Actually, with Ionic View you can just share its ID number (see the image below) and anyone with this number will be able to download your app (via Ionic View) without you having to send them the invitation.

Your second option, but maybe a bit harder to do is to host your application on your server. So, you would take all the content from the www folder and simply put it on your server in a certain folder and your app would then be accessible from the web as well. What I usually do is I create an iPhone image and create an iframe in which I then show the Ionic app. I won’t go into details here, there are similar questions that cover this particular topic already.

Anyways, hope this helps, and clearly for the least effort, the Ionic View seems like the best option.

#Showcasing #Ionic Apps For a Portfolio Without Publishing Them to App Stores https://t.co/3npCjin5rG

— Nikola Brežnjak (@HitmanHR) April 23, 2016

Ionic

Ionic Framework: A definitive 10,000 word guide

The fifth post about Ionic framework for Pluralsight is actually a condensed (well, if you can call a 10,000+ word article condensed ;)) article of the series so far.

As you may remember, the series wraps everything in a whole where we showed how to create an application starting with an idea, through creating a prototype and implementing the application using Ionic framework to finally publishing it in the stores.

You can see the post here: Ionic Framework: A definitive 10,000 word guide.

The original tutorials (totaling 20k+ words) are not available anymore, but you can still access (for free if you wish) my blog2book which has them in their original form via Leanpub.

IonicBook

If you have any questions please don’t hesitate to ask, and please share if you like it.

Ionic Framework: A definitive 10,000 word guide https://t.co/ZTNjt1YfwZ

— Nikola Brežnjak (@HitmanHR) April 23, 2016

Miscellaneou$

2nd Devz Meetup Varaždin

TBH, I wasn’t aware that something like this (meetups) exists “near” me (yeah, I hear you: “Where do you live, man?!”.), so I didn’t make it to the 1st one. All in all, kudos for the organizers and looking forward to the next one! As I usually do with posts about conferences, I’ll share my notes that I took in my notebook and a few pictures.

There were 3 talks and a Voogle 2016 conference announcement on this meetup:

  • Information security and why should you care
  • Introduction to VueJS
  • Startup accelerator experiences

 

Information security and why should you care

  • presenter: doc.dr.sc.  Tonimir Kišasondi
  • this was a very intriguing talk, that delivered on the authors expectations – it made me start thinking more about security! So, thank you!
  • thumb_IMG_5997_1024
  • problem is related to security ecosystem
  • after a company survives an attack it looses about 40% clients
  • exploit kit
  • it seems that we aren’t only good at sports ;). “Share of internet users who experienced security related problems in the EU Member States in 2015” – we hold position #1
    thumb_IMG_5993_1024
  • ISO 27000 (commercial), BSI (free)
  • OWASP ASVSP – must read!
  • SANS critical security checklist
  • Bitstamp incident
  • DREAD assesment risk model

 

Introduction to VueJS

  • presenter: Bruno Škvorc
  • speaker shared his views of why he thinks VueJS has the potential to become the best front end JS framework
  • thumb_IMG_6003_1024
  • Well, I guess that every new-shiny-JavaScript-framework talk has to show this slide 🙂
    thumb_IMG_6005_1024
  • it’s very easy to use and master (1-2 days)
  • you can have an app on literally one element
  • only focused on web
  • everything is a component and has it’s own JS, HTML and CSS
  • the simplest example (jsFiddle here):
    <!DOCTYPE html>
    <html>
    <head>
    	<title></title>
    	<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.min.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
    
    	<div id="demo">
    	  <p>{{message}}</p>
    	  <input v-model="message">
    	</div>
    
    	<script type="text/javascript" charset="utf-8">
    		var demo = new Vue({
    		  el: '#demo',
    		  data: {
    		    message: 'Hello Vue.js!'
    		  }
    		})		
    	</script>	
    
    </body>
    </html>
  • vue-router and vue-resource are must from the start

 

Startup accelerator experiences

  • presenter: Zvonimir Dimovski
  • speaker shared his experience with startup accelerator Eleven Accelerator
  • you have to deal with C.R.A.P:
    • C – critisism
    • R – rejection
    • A – assholes
    • P – pressure
  • if you get founded you get 100k € for 6 months, with investor owning 8%

 

Voogle conference announcement

  • March 15th 2016
  • An interesting lineup of speakers and talks
  • Register here, tickets are not expensive (99kn)
  • I got a 2014 T-shirt edition in a random draw 🙂
    thumb_IMG_6020_1024
  • all in all, see you there!

Great talks at 2nd Devz Meetup Varaždin by @bitfalls @kisasondi and @Zvonr https://t.co/vLMy1gUX6r

— Nikola Brežnjak (@HitmanHR) February 22, 2016

Ionic, Stack Overflow

Cordova and Ionic SMS Receiver

In this StackOverflow question I answered why it isn’t possible to read SMS in Ionic application which you want to deploy to Apple’s App Store

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts, I will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

As you may know, I’m really into Ionic framework lately and am helping out on StackOverflow with the knowledge I gained so far with the framework. I’m currently #3 in the top All time answerers list.

I answered this question by user aintno12u:

Good day, do you have any idea how to achieve this in ionic? I found tutorials for PhoneGap but that was 3 years ago and i dont know if it will work with my ionic app. The ng-cordova has only thishttp://ngcordova.com/docs/plugins/sms/ to send sms but not receive. I saw this also but i have no idea how to use it. https://github.com/floatinghotpot/cordova-plugin-sms/tree/master/docs. Please help. Ionic so new that it lacks tutorials.

My answer was:

In case you’re trying to get this kind of application to the App Store, I have bad news for you.

As this answer states:

Simply two words from Apple: Not Possible

Cordova and Ionic #SMS Receiver https://t.co/jk58Gx4P0M

— Nikola Brežnjak (@HitmanHR) February 16, 2016

Breaking News, Pluralsight

Learn at Pluralsight for free the next six months

In this post I’ll show you how you too can learn at Pluralsight for free the next six months. As you may know, I already have (and truly recommend) Pluralsight subscription. However, the may not

As you may know, I already have (and truly recommend) Pluralsight subscription. However, the may not struck you as the cheapest option and I found this original link today on Fossbytes where they show how you can get six months for free at Pluralsight. No credit card, coupon or other BS.

Here are the steps:

  1. Go to signup.live.com and create a new Microsoft Account. or skip it if you already have one
  2. Go to my.visualstudio.com and sign-in with your (newly created) Microsoft account
  3. Click on Get code and then on Activate.
    psMicrosoft
  4. You’ll be taken to the Pluralsight website to activate and redeem your 6-month subscription.

And even though these steps sound “sound”, one of my friends reported that the Pluralsight link ends with a 404 page. Is this also your scenario or did you guys manage to work it out?

#Learn at Pluralsight for free the next six months https://t.co/WhkeDbIXpH pic.twitter.com/Rc3KRviEbZ

— Nikola Brežnjak (@HitmanHR) February 15, 2016

Breaking News, Ionic2

Ionic framework 2 is in beta

Ok, true, this “news” is few days old now and I’ve been slow to post about it.

Nevertheless, this is awesome news as I’m really excited about the 2.0 version, which follows closely the Angular 2.0 version. Btw, I wrote a tutorial about how to post data from Ionic 2 app to php  server, in case you’re curious you can find it here.

You can read the docs over at http://ionicframework.com/docs/v2/, but to quote the official post:

we’ve focused on performance boosts, architectural improvements, cross-platform theming, support for Angular 2, support for the mobile web, and so much more!

In case someone is still doubting Ionic, they state a very interesting fact:

Ionic has seen widespread adoption, with over 1.9 million apps built by everyone from individual developers to small startups to large enterprise businesses from around the world.

And, in defence of why Angular 2, here is their response:

Today, an Ionic and Angular 2 app is just TC-39, standards-compliant JS. While it may look different from what you’re used to, the benefit is the entire web industry is moving towards this standard set of technologies, so your skills will adapt to other projects beyond Ionic and Angular 2. That wasn’t the case with Angular 1.

Ionic 2 styles UI components based on the platform in which it’s being displayed, and the great news is that they’ve added material design for Android apps.

I totally agree with the following:

Ionic is pretty much the only major mobile framework out there that lets you adapt your app to the app store as a native app and put it on a web server to provide a great mobile web experience with no changes required.

clap

#Ionic framework 2 is in beta https://t.co/Nyy2QQZqRf

— Nikola Brežnjak (@HitmanHR) February 15, 2016

Page 23 of 51« First...1020«22232425»304050...Last »

Recent posts

  • Discipline is also a talent
  • Play for the fun of it
  • The importance of failing
  • A fresh start
  • Perseverance

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (35)
  • Daily Thoughts (77)
  • Go (3)
  • iOS (5)
  • JavaScript (127)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (2)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (77)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (40)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (81)
  • Unity3D (9)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak