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
Books

The 7 Habits of Highly Effective People – Stephen Covey

My notes from the book The 7 Habits of Highly Effective People by Stephen Covey:

The significant problems we face can not be solved with the same level of thinking we were at when we created them – Albert Einstein

Is getting more things done in less time gonna make a difference? Or it will just increase the pace at which I react to the people and circumstances that seem to control my life? Could there be something that I should see on a more deeper fundamental way?

We are what we repeatedly do. Excellence then is not an act but a habit – Aristotle

“The work will come again, but childhood won’t”, said the father when he was called to work and previously he arranged to go to zoo with his children.

Too much undisciplined leisure time in which a person continually takes a course of least resistance gradually wastes a life.

Almost all of the world class athletes are visualizers. They see it, they feel it, they experience it before they actually do it. They begin with an end in mind.

Unexpressed feelings never die. They’re buried alive and come forth later in uglier form.

In families you can shift the focus from competition to cooperation with keeping a ‘family score’.

Like a body – television is a good servant but poor master.

And finally, the habits:

  • Be proactive
  • Begin with an end in mind
  • Put first things first
  • Think win-win
  • Seek first to understand, then to be understood
  • Synergize
  • Sharpen the say
Miscellaneou$

Cracking the Creativity Code Part 1 – Discovering ideas

I just finished a free course on Coursera called Cracking the creativity code and here are my notes from these very good lectures. The course is based on the book Cracking the creativity code by Arie Ruttenberg and Shlomo Maital.

[toc]

Course introduction

Creativity is an acquired skill – one that can improve with practice!

First part is discovery. Second is delivery – implementing ideas.

Zoom in, zoom out, zoom in –ZiZoZi method

Keneth Robinson: “Creativity is finding what you love to do when you’re playing, and then use that to make your work and become your living”

Discovery – generating novel and useful ideas that satisfy unmet needs

Delivery – implementing creative ideas in a sustained manner for the benefit of the largest number of people possible

book: Cracking the creativity code : ZoZ – Shlomo Maital, Arie

7challenges: Create a new kind of restaurant. Find a way to bring the Internet to 4.5 bilion people who currently lack it. Indoor cooking fire life saving. 1.3 bililion people without electricity. Babies forgotten in hot cars who die. New beverage that’s not in plastic. Forster creativity in elementary and secondary schools while improving basic skills and knowledge in math, reading and science. How to recycle food to feed hungry.

Week 1 – Session #1 Definition of creativity

Creativity – widening the range of choice.

Break the change of habit!

Out of our minds book by Sir

Norman Doidge – brain that changes itself

Week 1- Session #2 A first encounter with the ZiZoZi method

Why and for whom vs what can I invent.

Creativity is not IQ.

Creativity starts with WHY?

8 Da Vinci questions:

  • when am I most myself?
  • what is the ONE thing I could do, or stop doing that would most improve the quality of my life?
  • what is my greatest talent?
  • how can I get paid for what I love doing?
  • who are my role models?
  • what is my deepest passion?
  • what will be my life’s legacy?

Week 1- Session #3 Test your creativity: Torrance Creativity Test

IMG_3602 IMG_3603

Week 1- Session #4 Self-test your ‘discovery’ and ‘delivery’ skills

IMG_3604

Week 1- Session #5 The Imagination Elevator – a story you won’t believe

Gather all the wild ideas and “bring them to earth” in a shopping cart. Opposite way doesn’t work so well (to make a possible idea and then juice it up a bit). Go to the 989th floor in the imagination elevator.

The essence of discovery: embrace the mindset that all problems have a solution, we just need to discover them!

Week 1- Session #6 Widening the range of choices – the Zoom in/Zoom out/Zoom in framework

1. zoom in – understand the problem

2. zoom out – generate ideas (if people laugh at your idea, it means you’re on a right track since they haven’t seen this kind of thinking yet)

3. zoom back in an implement – so make the idea into practical solution

Week 1- Session #7 ZiZoZi in action: Stories to inspire & aspire

Human creativity has no limits, except for those that we place upon ourselves. Carl Young.

If you make something that exists already, make sure you make it at least 10 times better.

Week 1- Session #8 More ZiZoZi stories

Blackout restaurant, Curious case of Benjamin Button,.

One way of new ideas would be to take a look at history and those ideas that failed – make them better by using today’s technology.

Cool tie:

coolTie

Week 1- Session #9 How to build your creativity ‘muscles’

  1. Act, don’t just gripe
  2. Break the rules (intelligently) – first learn the rules
  3. Change your habits – go out of your comfort zone
  4. Develop resilience, embrace failure
  5. Explore dark corners, experiment everywhere
  6. Learn to focus
  7. Grow your persistence
  8. Hear, listen, teach
  9. Individualize: it’s always personal – if there’s something YOU need, make that
  10. Become who you are (join yourself)
  11. Have a microscope attached to telescope

Week 1- Session #10 Summary of Week One; Preview of Week Two

Master old knowledge and combine with creativity to create something new.

Mobley’s principles for greater creativity:

  1. Traditional teaching methods are worse than useless
  2. Becoming creative requires unlearning
  3. You can’t learn to be creative, you become creative by action. Fastest way to become creative is to socialize with creative people
  4. Creativity is highly correlated with self-knowledge and self-awareness
  5. Give your self a permission to be wrong

You can’t solve the problem with the same level of thinking that created the problem. Einstein.

Week 1 assessment 10/10!

Week 2- Session #1 ZiZoZi Framework Reviewed and viewed in action

Advertising agencies have a Creativity department

Week 2- Session #2 Case Study: How Thomas Edison lit up the world

Genius is 1% inspiration and 99% perspiration”. T. A. Edison

Edison invented phonograph. Create a platform not just a single product.

Week 2- Session #3 Zoom out: Collecting wild ideas

If you know exactly what you’re going to do, what is the point of doing it? ~ Pablo Picasso

Would you create an opera Carmen, for whom you would be criticised during your lifetime but admired when you die?

Week 2- Session #4 Zoom out: Benchmarking as a key tool

Best Practice Benchmarking. Benchmarking is a mindset. Observe everything and try to see where the world is going to be, not as it is today.

Week 2- Session #5 Is it innovative to borrow and adapt?

Story about M&M’s. Mars is also the chocolate bar from this man that went to war in Spain and figured out there how to bring chocolate to the battle field without melting (cover with hard candy).

Week 2- Session #6 How to challenge basic assumptions?

Ask the questions no one asks. Focus on the things that you usually take for granted and see how they could be impacted by a change in thinking that they are wrong.

If you fail, get the fuck up and try again.

Week 2- Session #7 Zoom in: Choosing the best of many ideas

Get out of your office to the place where the work is done by people using your product.

Week 2- Session #8 Managing the tradeoff between delivery and discovery

8 types of work ordered by my own preferences to solve business problems:

  • Application of technology (tech and engineering)
  • Counseling and mentoring (help others)
  • Managing people
  • Influence Through Language and Ideas (use of persuasion)
  • Enterprise Control
  • Creative production (generate new innovative business ideas)
  • Quantitative Analysis (math and financial analysis)
  • Theory Development and Conceptual Thinking (academic, conceptual approach)

Week 2- Session #9 Creativity everywhere: All the time, everyone, everything

Try to improve every aspect of your work from the ground up.

Week 2- Session #10 Case studies

If you find a good solution to your own need, you may find it to resonate with a lot of other people.

Week 2 assessment 9/10. The question “The famous NASA example of the Mars exploratory vehicle shows creative thinking IN the box because” is still puzzling…

 

Week 3- Session #1 The ZiZoZi method: continued. Zoom in: The role of accidental discovery and serendipity

Brilliant Blunder – Mario Livio

The greatest risk lies in never taking any risk in our thinking process.

Chance favors the prepared mind. ~ Pasteur

Week 3- Session #2 Sharpening observation skills

Observe people in what they do and make a program that will help them to do it more efficiently. Compare your program with the best alternative that’s already in the market.

If you need something, help yourself – it may be someone else will find it useful!

Week 3- Session #3 Empathic Discovery (Leonard & Rayport, “Spark Innovation Through Empathic Design” HBR Nov-Dec 1997

empathy vs sympathy. – Try to “feel” as you were the other person and have his problems.

Quicken story – people were using their check writing software for managing their small businesses.

Week 3- Session #4 The Role of Failure In Achieving Success

Centrino processor idea to actually lower the MHz and increase the battery life.

There is no failure, failure is just a next step (though, true, sometimes painful).

Week 3- Session #5 Zoom Out: Collecting data through direct observation

5 key types of information:

  1. Triggers of use
  2. Interaction with user’s environment
  3. User customization
  4. Intangible attributes
  5. Unarticulated user needs

Story about how chewing gum was invented.

Week 3- Session #6 The IDEO approach

Few key points, but one of the main is – don’t dismiss an idea just yet no matter how “weird” it may seem at that point.

Week 3- Session #7 Zoom In: Taming Wild Ideas

Tumor dissolving gun.

Week 3- Session #8 How to sell your ideas

Key questions:

  • The need
  • The difference (10x better)
  • The future
  • Cost and price

Week 3- Session #9 How to be creative In large organizations (Intrapreneurship)

Intrapreneurship, Gifford Pinchot

  1. Come to work willing to be fired
  2. Circumvent orders that prevent your dream
  3. Do any job needed
  4. Find people to help you and choose the best
  5. Work underground as long as you can
  6. Control your destiny
  7. It’s easier to ask for forgiveness than to ask for permission
  8. Be true to your goals but realistic in their achievement
  9. Honor your sponsors

Week 3- Session #10 What is YOUR story? Building powerful narratives. Case Studies

PCM – personal creativity machine: I stumble upon something that I have to do repeatedly on a daily basis and that bothers me and then I think about how to actually automatize that. I sit down and I build it (namely it’s usually software). The way I validate it is that I give it to someone and see how they use it, gather their info and try to make it better. If I see no practical use in this, I don’t tend to pursue it forward, I just leave it be. Excellent example of this is my free website for score tracking (http://carcassonne-scoring-board.com/).

Elon Musk is a superman: PayPal, Solar City, Tesla, PayPal

 

Week 4- Session #1 Creativity Exercises: Are You Working Out?

Norman Doidge – The brain that changes it self: “Brain changed its very structure with each different activity that it performed.” The more you work on discovering ideas, the more your brain gets at it.

Do a “What if” exercise.

Week 4- Session #2 What Scholars Know about Creativity: Research you can use

At the age of:

  • 5 nearly all children are geniuses by Torrance test
  • 10 their creativity level drops to 32%
  • 15 to 10%
  • 30 to 2%

Week 4- Session #3 On Being Walter Mitty. Is creativity fun, or painful?

It’s fine to dream, but you need to implement them also!

Week 4- Session #4 Life take two: On reinventing yourself and your career

The method of “adjacent possible”.

Interesting idea: come up with an idea, work on it hard and then set it aside and come to it a while (even maybe months) later. The fun fact is that the mind will be subconsciously working on it.

Week 4- Session #5 Secrets of Einstein, da Vinci and Edison

Best implementation wins, not the best idea.

Week 4- Session #6 Humble masterpieces: Stories of creative breakthroughs

Safety pin, Lipstick.

Week 4- Session #7 More Masterpieces: Creativity in Action

Barcode, Frisbee

Week 4- Session #8 Ideas proposed by students for the 7 Challenges

Week 4- Session #9 Torrance Test for Creative Thinking: Have you improved?

Week 4- Session #10 Course summary: What have you learned? What have you implemented? How have you changed?

Week 4 assessment 9/10.

Ionic, Stack Overflow

Ionic View Manage Apps

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 will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

My question was:

I uploaded a test app to Ionic (don’t know the exact name for this) with the command ionic upload from the command line, and I can access them nicely with the Ionic View application I have installed on my iPhone.

However, I remember that they have a web interface for this too, but can’t find the link for the life of me. I searched the website, went through my emails, googled, but nothing. I even found the same question on the official forum – sadly unanswered.

I actually found the answer to this myself:

And, sure enough, after going through my deleted emails I found a welcome email from Ionic stating that the login is at https://apps.ionic.io/login. Will reply to that official post too…

CodeProject, Ionic

Adding AdMob to Ionic framework application step by step

In case you’re looking for a way to implement Google AdMob ads in Ionic framework 3, then check out this tutorial: How to make money with Google AdMob ads in Ionic framework 3.

If you want, you can take a look at the screencast of this tutorial. This is actually my first shocked screencast blog post so go easy on me 🙂

I’ve been searching for a start to end tutorial on this but with no luck. Now, when I finally figured out how to use it, I’m documenting the exact steps which I did in order to get the AdMob working inside my Ionic app. You can fork the project from GitHub or download and test the .apk file on your device.

I broke down the steps in two parts: AdMob settings and Ionic settings.

AdMob settings

Let’s start with AdMob settings:

  1. Sign in /Sign up for AdMob at https://www.google.com/admob/
  2. Click the Monetize new app button:
    Screen Shot 2015-05-05 at 23.21.06
  3. If your app is not yet published you can add it manually:
    Screen Shot 2015-05-05 at 23.23.07
  4. Create new tracking ID:
    Screen Shot 2015-05-05 at 23.25.20
  5. Configure the adds type, size, placement, style, name:
    Screen Shot 2015-05-05 at 23.26.29
  6. You can read additional info on how to implement GA and AdMob, but for now let’s just click Done:
    Screen Shot 2015-05-05 at 23.28.10
  7. You will now see the following similar screen:
    Screen Shot 2015-05-05 at 23.30.11
    The most important thing to note here is this Ad unit ID, which in my test case is
    ca-app-pub-7957971173858308/3599533362

Ionic settings

I’m counting on the fact that you know how to use Ionic since you’re looking for a specific topic like this, so am going skip the part of actually explaining how to use the Ionic cli. Ok, enough chit-chat, now I’m going to show you the steps on how to implement AdMob in your Ionic project:

  1. Start a new Ionic blank project:
    ionic create IonicAdMobTest blank
  2. Add the platform for which you want to build the application:
  3. ionic platform add android

    In case you’re developing on a Mac, you can also choose to add:

    ionic platform add ios
  4. Add the cordova-plugin-admob plugin by entering the following command in your command prompt when in the root folder of your project:
    cordova plugin add com.rjfun.cordova.plugin.admob

    As a side note, you can always check the list of all installed plugins by executing:

    cordova plugin list
  5. Add the following code to your app.js file (located in the www folder) inside the .run function:
    .run(function($ionicPlatform) {
        $ionicPlatform.ready(function() {
            // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
            // for form inputs)
            if (window.cordova && window.cordova.plugins.Keyboard) {
                cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
            }
            if (window.StatusBar) {
                // org.apache.cordova.statusbar required
                StatusBar.styleDefault();
            }
    
            if(window.plugins && window.plugins.AdMob) {
                var admob_key = device.platform == "Android" ? "ca-app-pub-7957971173858308/3666912163" : "ca-app-pub-7957971173858308/3666912163";
                var admob = window.plugins.AdMob;
                admob.createBannerView( 
                    {
                        'publisherId': admob_key,
                        'adSize': admob.AD_SIZE.BANNER,
                        'bannerAtTop': false
                    }, 
                    function() {
                        admob.requestAd(
                            { 'isTesting': false }, 
                            function() {
                                admob.showAd(true);
                            }, 
                            function() { console.log('failed to request ad'); }
                        );
                    }, 
                    function() { console.log('failed to create banner view'); }
                );
            }
        });
    })

    Of course, change it according to your own admob_key which you obtained in the first part (step 8).

  6. Start the emulator by running:
    ionic build ios && ionic emulate ios
    
    //or, for android
    ionic build android && ionic emulate android
  7. and you should get the following screen in your emulated application:
    IonicAdMobTest
  8. You can clone the project from GitHub, or download the .apk (unzip needed) file and test on your Android device.

That’s all folks, hope this helps someone by saving time on endless testing as I did :/

Miscellaneou$

My blog listed along side the cool blogs from high rollers like Atwood, Spolsky, Skeet, Resig, Irish, Beck, Fowler…

A new cool project by Kilim Choi that lets you make a pull request with your engineering blog, that got quite a few stars on Github (4k+ currently).

And, that’s how my name got the be next to The Great Ones smileyGlasses

engineering-blogs

Make your pull request too!

Breaking News, Ionic

Ionic Analytics Alpha

From an official blog post, Ionic Analytics Alpha

gives you all the data you need to better understand and optimize your push notifications, deployments, and much, much more.

The go on to say that

You can chart your app’s progress, from the time of its initial release, and see which marketing strategies were most (or least) effective. You can even gain insights into your app’s demographics, allowing you to see how well your app is doing within a given population.

Some of the data this will be able to provide is:

  • How many people log into my app every day?
  • How many of those continue to use my app after a week? A month? A year?
  • With which parts of my app are users interacting the most?
  • What are users doing right now in my app?

If you were like me – thinking that this will cost some amount, here’s what they say:

During the alpha period, Ionic Analytics will be 100% free. In the future, we’ll release tiered pricing based on usage and will continue to offer a free tier.

All this is indeed remarkable, as Ionic team released push support and live updates just few weeks ago. Also, for developers alike, they announced Ionic Market where you’ll be able to make plugins for other users (and, I guess sell them too?). So, IMHO Ionic is building an awesome ecosystem and I bet they’ll become the best hybrid platform! What is left to see is how will the actual price tiers look like.

 

CodeProject, Ionic

Posting data from Ionic app to PHP server

TL;DR

This is the simplest example which shows how to POST data from an Ionic app to a PHP server.

The tutorial covering the Ionic version 2 can be found here. The tutorial covering the Ionic version 3 can be found here.

Quickstart

To see it in action:

    1. Clone the finished project from Github
    2. Run ionic serve
  1. You should see something like this:
    ionic_phpDemo

If you want to make it work from your server:

  1. Clone the finished project from Github
  2. Upload the PHP/api.php file to your server
  3. In the www/js/app.js file adjust the link variable to point to your server
  4. Run ionic serve

Step by step on how to create this yourself from scratch

  1. Create a new blank Ionic project with:
    ionic start ionicServerSendTest blank
  2. Copy the following code (you’ll already have the .run() part, the .controller() part is novelty here) in www/js/app.js file:
    // Ionic Starter App
    
    // angular.module is a global place for creating, registering and retrieving Angular modules
    // 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
    // the 2nd parameter is an array of 'requires'
    angular.module('starter', ['ionic'])
    
    .run(function($ionicPlatform) {
        $ionicPlatform.ready(function() {
            // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
            // for form inputs)
            if (window.cordova && window.cordova.plugins.Keyboard) {
                cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
            }
            if (window.StatusBar) {
                StatusBar.styleDefault();
            }
        });
    })
    
    .controller('AppCtrl', function($scope, $http) {
        $scope.data = {};
    
        $scope.submit = function(){
            var link = 'http://nikola-breznjak.com/_testings/ionicPHP/api.php';
    
            $http.post(link, {username : $scope.data.username}).then(function (res){
                $scope.response = res.data;
            });
        };
    });
  3. On your server, create a api.php file with the following content:
    <?php
        //http://stackoverflow.com/questions/18382740/cors-not-working-php
        if (isset($_SERVER['HTTP_ORIGIN'])) {
            header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
            header('Access-Control-Allow-Credentials: true');
            header('Access-Control-Max-Age: 86400');    // cache for 1 day
        }
    
        // Access-Control headers are received during OPTIONS requests
        if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
                header("Access-Control-Allow-Methods: GET, POST, OPTIONS");         
    
            if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
                header("Access-Control-Allow-Headers:        {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
    
            exit(0);
        }
    
    
        //http://stackoverflow.com/questions/15485354/angular-http-post-to-php-and-undefined
        $postdata = file_get_contents("php://input");
        if (isset($postdata)) {
            $request = json_decode($postdata);
            $username = $request->username;
    
            if ($username != "") {
                echo "Server returns: " . $username;
            }
            else {
                echo "Empty username parameter!";
            }
        }
        else {
            echo "Not called properly with username parameter!";
        }
    ?>

    As you can see from the code, the first part is explained in detail in this StackOverflow question, and it basically solves the CORS issue that you would otherwise run into.

    The second part, explained in detail in this StackOverflow question,  deals with the way you POST data from Ionic (basically an AngularJS app) to your PHP server. The gist is that AngularJS POSTs by default in a JSON format, and thus you have to json_decode  the data that comes to your PHP server.

  4. In www/js/app.js file adjust the link variable to point to the file on your server
  5. In www/index.html file copy the following content:
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
            <title></title>
            <link href="lib/ionic/css/ionic.css" rel="stylesheet">
            <link href="css/style.css" rel="stylesheet">
            <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
            <link href="css/ionic.app.css" rel="stylesheet">
            -->
            <!-- ionic/angularjs js -->
            <script src="lib/ionic/js/ionic.bundle.js"></script>
            <!-- cordova script (this will be a 404 during development) -->
            <script src="cordova.js"></script>
            <!-- your app's js -->
            <script src="js/app.js"></script>
        </head>
        <body ng-app="starter" ng-controller="AppCtrl">
            <ion-pane>
                <ion-header-bar class="bar-stable">
                    <h1 class="title">Ionic Blank Starter</h1>
                </ion-header-bar>
    
                <ion-content padding="true">
                    <form ng-submit="submit()">
                        <label class="item item-input item-stacked-label">
                            <span class="input-label">Username</span>
                            <input type="text" name="username" placeholder="enter username" ng-model="data.username">
                        </label>
    
                        <input class="button button-block button-positive" type="submit" name="submit" value="Submit to server">                    
                    </form>
    
                    <div class="card">
                        <div class="item item-text-wrap">
                            Response: <b ng-bind="response"></b>
                        </div>
                    </div>
                </ion-content>
            </ion-pane>
        </body>
    </html>

    Here you basically created a form with an username input field and with a submit button. Using AngularJS ng-submit you’re saying that once the submit button is clicked AngularJS should handle it within the submit() function which you defined in app.js file before. Input username uses  the ng-model to bind to the variable on the $scope so that you can then use it in your submit() function.

  6. Run ionic serve  from the root directory of your Ionic app (I’m sure you know this, but just in case that’s where the folders like www, plugins, scss reside).
CodeProject, NodeJS

Using PM2 to run your Node.js apps like a pro

Previously I wrote about running Node.js apps with Nodemon and Forever but nowdays I’m using the ever so slightly more professional PM2.

Running your Node.js application by hand is, well, not the way we roll. Imagine restarting the app every time something happens, or god forbid application crashes in the middle of the night and you find about it only in the morning – ah the horror. PM2 solves this by:

  • allowing you to keep applications alive forever
  • reloading applications without downtime
  • facilitating common system admin tasks

To install PM2, run the following command:

sudo npm install pm2 -g

To start your process with PM2, run the following command (once in the root of your application):

pm2 start server.js

As you can see from the output shown on the image below, PM2 automatically assigns an App name (based on the filename, without the .js extension) and a PM2 id. PM2 also maintains other information, such as the PID of the process, its current status, and memory usage.

PM2

As I mentioned before, the application running under PM2 will be restarted automatically if the application crashes or is killed, but an additional step needs to be taken to get the application to launch on system startup (boot or reboot). The command to do that is the following:

pm2 startup ubuntu

The output of this command will instruct you to execute an additional command which will enable the actual startup on boot or reboot. In my case the note for the additional command was:

sudo env PATH=$PATH:/usr/local/bin pm2 startup ubuntu -u nikola

If you want to learn more about the additional PM2 options you can take a look at this post.

Stack Overflow

How to properly set the BasedOn in XAML style

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 will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

My question was:

I have this as the style template:

<Style x:Key="myDogToggleButton1" TargetType="ToggleButton" BasedOn="{x:Null}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ToggleButton">
                <Grid>
                    <Image Name="Normal" Source="/images/dogs/dog1.png"/>
                    <Image Name="Pressed" Source="/images/dogs/dog3.png" Visibility="Hidden"/>
                    <Image Name="Disabled" Source="images/dogs/dog5.png" Visibility="Hidden"/>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
                        <Setter TargetName="Pressed" Property="Visibility" Value="Visible"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
                        <Setter TargetName="Disabled" Property="Visibility" Value="Visible"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

And now I want another one which is based on the upper one, and this doesn’t work:

<Style x:Key="myDogToggleButton2" TargetType="ToggleButton" BasedOn="{DynamicResource myDogToggleButton1}">
    <Setter Property="Normal" Value="/images/dogs/dog2.png" />
    <Setter Property="Pressed" Value="/images/dogs/dog2.png" />
    <Setter Property="Disabled" Value="/images/dogs/dog2.png" />
</Style>

The error message I get is:

The member "Pressed" is not recognized or is not accessible.
The member "Normal" is not recognized or is not accessible.
The member "Disabled" is not recognized or is not accessible.

I suspect that my different style calling is wrong, so please point out the error.

The answer, by user Heena Patil, was:

Try this

Resource

<Window.Resources>
    <Style x:Key="myDogToggleButton1" TargetType="ToggleButton">
        <Style.Resources>
            <BitmapImage x:Key="Normal" UriSource="Images/darblue_tab.png"/>
            <BitmapImage x:Key="Pressed" UriSource="Images/img-whitebg.png" />
            <BitmapImage x:Key="Disabled" UriSource="Images/img-greenbg.png"/>
        </Style.Resources>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid>
                        <Image Name="Normal" Source="{DynamicResource ResourceKey=Normal}" Stretch="Fill"/>
                        <Image Name="Pressed" Source="{DynamicResource ResourceKey=Pressed}" Visibility="Hidden"/>
                        <Image Name="Disabled" Source="{DynamicResource ResourceKey=Disabled}" Visibility="Hidden"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="Pressed" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Normal" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="Disabled" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="myDogToggleButton2" TargetType="ToggleButton" BasedOn="{StaticResource myDogToggleButton1}">
        <Style.Resources>
            <BitmapImage x:Key="Normal" UriSource="Images/img-darkbg.png" />
            <BitmapImage x:Key="Pressed" UriSource="Images/Screenshot_5.png"/>
            <BitmapImage x:Key="Disabled" UriSource="Images/img-bluebg.png"/>
        </Style.Resources>
    </Style>
</Window.Resources>

Xaml

<Grid>
    <ToggleButton HorizontalAlignment="Left" Style="{StaticResource myDogToggleButton1}"/>
    <ToggleButton  HorizontalAlignment="Right" Style="{StaticResource myDogToggleButton2}"/>
</Grid>

Update Using single style.

<Grid>
    <ToggleButton Height="300" Width="300" HorizontalAlignment="Left" Style="{StaticResource myDogToggleButton1}"/>
    <ToggleButton  Height="300" Width="300" Style="{StaticResource myDogToggleButton1}" HorizontalAlignment="Right">
        <ToggleButton.Resources>
            <BitmapImage x:Key="Normal" UriSource="Images/img-darkbg.png" />
            <BitmapImage x:Key="Pressed" UriSource="Images/Screenshot_5.png"/>
            <BitmapImage x:Key="Disabled" UriSource="Images/img-bluebg.png"/>
        </ToggleButton.Resources>
    </ToggleButton>
</Grid>
Miscellaneou$

Infobip Dev Days 2015

Here are my notes from an awesome 4th Infobip Dev Days 2015 conference:

[toc]

Introduction

  • Presenter: Izabel Jelenić, Co-founder, CTO
  • infobip – 600+ employees (122 devs)
  • Worldwide A2P SMS traffic is expected to grow. Revenue > 45bn.
  • They handle 150M transactions daily.
  • They said they’re doing business with “one big social” network, but they didn’t name it actually, I wonder why is that (some kind of NDA or what? 🙂)
  • Picture time:
    infobip_intro

How we ended up doing continuous delivery

  • Presenter: Mario Žagar, Senior Software Architect
  • ASAP and as often we have to go into production
  • Unit & integration tests
  • Scaling cube
  • First they scaled by increasing monoliths
  • Then they took some parts out of the monolith (API, Billing, Inbound SMS, …) => easier to focus, possible to deploy independently
  • Typical feature deployment today:
    • Short lived feature branches with Git
    • Develop & run tests locally
    • Push feature branch to remote repository (Stash)
    • Jenkins – CI server builds the feature branch
    • Deployment artifacts published to Infobip repository (Artifactory)
    • Deploy feature branch to integration environment
    • Run tests on integration environment
    • Merge pull request to master branch & release
  • Average about 80 deploys per day
  • DevOps culture – you built it, you deploy it, you support it
  • Troubleshooting tools:
    • Graylog
    • Graphite
    • Grafana
    • Nagios
    • Seyren
    • HipChat
    • Ansible
  • Picture time:
    infobip_ci_intro
  • And a few more here, since, well, you know I love MEMEs:
    infobip_ci_deploy
    infobip_ci_devops

Scrum experience

  • Presenter: Marko Stipanov, Product Owner
  • How to increase productivity?
    • hiring more devs?
    • best is to hire someone new and give them some totally new project
  • PDD – Panic Driven Development
    • the bigger the panic the greater priority
    • how relates to this, please hands up hand_rock_n_roll
  • they tried with daily report writing
  • Agile process manifesto
  • they divided their 60 devs at a time to 12 teams and each team works on a small project
  • Product Owner
    • vision and definition of products
    • goal setting
    • priority setting of the whole team
    • talks to stakeholders
  • Scrum ceremonies
    • organisation
    • iterative process
  • Scrum steps (they do the sprints fro 1-2 weeks instead of 2-4):
    • Product backlog
    • Sprint backlog
    • SPRINT
    • Deliverable
  • 1 project = 1 team
  • 1 team => more projects
  • Priorities are defined by business value
  • Kanban, Scrumban
  • Daily team lead meeting with just few minutes
  • You can’t do agile without teams!
  • Scrum definitely give us a better intercommunication.
  • Picture time:
    infobip_scrum

Modern SQL

  • Presenter: Markus Winand, SQL expert and author
    modernsql_intro
  • SQL 99 broke the relational standard
    • LATERAL
      • “for each” loop of SQL
    • WITH
      • “private methods” of SQL
    • WITH RECURSIVE
      • “while” loop of SQL
  • SQL 2003
    • Turing complete
    • OVER and PARTITION BY
      SELECT dep, salary, SUM(salary) OVER (PARTITION BY dep) FROM ...
    • OVER and GROUP BY
      • actually, do this in the application, thank you very much
  • SQL 2008
    • SELECT TOP is not official – it’s FETCH FIRST ROWS ONLY
  • SQL 2011
    • OFFSET is EVIL
      • http://use-the-index-luke.com/ modernsql_offset
      • Also, the author was cool and he was giving these stickers:
        modernsql_offset_badges

Indexes: The neglected performance all-rounder

  • Presenter: Markus Winand, SQL expert and author
  • 50% SQL problems are caused by poor query/indexing
    index_comic
  • CREATE INDEX is not in the standard!
  • The solution- indexing is a development task!
  •  And now the author hits the spots when he explains that in
    • 11 SQL books he analyzed only 1% of the pages are about indexes
    • 14 database administration books he analyzed only 6% of the pages are about indexes
  • Everybody knows indexing is important for performance, yet nobody takes the time to learn and apply it properly.

Personal and Interpersonal Effectiveness

  • Presenter: Danilo Goliani, PhD professor, enterpreneur
  • Our clients are paying our paychecks!
  • Personal effectiveness – others have faith in me
  • Team effectiveness – I have faith in others
  • Organisational effectiveness – clients love us
  • Stephen R. Covey: 7 Habits of Highly Effective People
  • Courage – willingness and ability to express your thoughts and emotions
  • Don’t just say NO to your children – explain also WHY
  • Self induced interrupt
  • Brain Games
  • Picture time:
    danilo

Machine learning

  • Presenter: Jan Šnajder, PhD/assistant professor/FER
  • IBM Watcson Developer Cloud
  • 88% of unstructured data
  • #1 Top skill on LinkedIn 2014
  • Tools:
    • Weka
    • RapidMiner
    • Orange
    • R (mother of all)
    • Matlab (commercial)
    • mloss.org
    • Apache Mahout
    • Spark
    • Azure Machine Learning
    • Amazon Machine Learning
  • Picture time:
    machine

Java puzzlers

  • Presenter: Aleksandar Dostić, Senior Software Engineer IB
  • Picture time intro:
    java_intro
  • Puzzle 1:
    java_1
  • Puzzle 2:
    java_2
  • Puzzle 3:
    java_3
  • Puzzle 4:
    java_4
  • Puzzle 5 – the most sneaky one!
    java_5
    and here is why!!! shockedjava_5_explanation

HA-JDNI as a Solution for Service Discovery in Distributed Systems

  • Presenter: Aleksandar Branjković, Head of Mobile Payments R&D
  • Picture time:
    ha

 

 

Page 34 of 51« First...102030«33343536»4050...Last »

Recent posts

  • When espanso Breaks on Long Replacement Strings (and How to Fix It)
  • 2024 Top Author on dev.to
  • Hara hachi bun me
  • Discipline is also a talent
  • Play for the fun of it

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • Go (3)
  • iOS (5)
  • JavaScript (128)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (3)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (78)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (41)
  • 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