Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • About me
Home
About me
  • Nikola Brežnjak blog
  • Home
  • About me
Miscellaneou$

Webfestival 2015

I was just accepted to the Webfestival 2015 competition, so fingers crossed!

C/P from the official site (since, well, this is for Croatian users – so, fellow citizens, do join in!):

Tema ovogodišnjeg Webfestivala su osobne web stranice koje se u kontekstu natjecanja promatraju kao zbirka digitalnih sadržaja koje prikazuju napredak, razvoj i postignuća nekog pojedinca.

Cilj natjecanje je ukazati na potencijal i važnost osobnih web stranica u vremenu cjeloživotnog učenja i kontinuiranog stručnog usavršavanja te potaknuti CARNetove korisnike, ali i sve ostale, na izradu osobnih web stranica. Također, tijekom trajanja natjecanja ćemo kroz radionice i webinare upoznati korisnike s pojedinim alatima i mogućnostima za izradu osobnih web stranica te ćemo naposljetku autore najboljih osobnih web stranica i nagraditi vrijednim nagradama.

Svi zainteresirani autori mogu se prijaviti u dvije kategorije – Osobne stranice u obrazovanju ili Profesionalne osobne web stranice putem prijavnice dostupne nahttp://webfestival.carnet.hr/2015_prijava . Prijava na natjecanje će biti moguća do 30. rujna 2015. kada će Ocjenjivački sud započeti s ocjenjivanjem pristiglih prijava.

Autorima osobnih web stranica koje stručni Ocjenjivački sud ocijeni najboljima u svakoj kategoriji bit će dodijeljena nagrada u okviru CARNetove korisničke konferencije CUC 2015 koja se ove godine održava u Dubrovniku od 18. –  20. 11. 2015.

Pozivamo sve zainteresirane da se s detaljima natjecanja, pravilima sudjelovanja te kriterijima ocjenjivanja upoznaju na webu natjecanja  te da se prijave na natjecanje.

Breaking News, Ionic

Ionic has a bright future by partnering with IBM

This is indeed awesome, as it hopefully means that Ionic is here to stay, so that all of us who use it won’t have to fear for it’s future – since it’s all awesome and stuff :). True, this seems more inclined towards business people, but the sole fact that with this more people will know about Ionic and won’t look you strangely when you say you’re developing iOS/Android apps with it by using one codebase.

Some news coverage about this:

  • IBM and Ionic Empower Business Users to Accelerate Mobile App Development
  • Make everyone a hacker: IBM MobileFirst & Ionic empower business users to prototype their own apps
Miscellaneou$

Weblica 2015

I just came home from Weblica, the very first ever developers conference in my Međimurje county. All in all, a very good conference and I hope this is just the first one in the years to come! The entrance was free and every attendee got a T-Shirt. Since I was active with questions I got a nice tiblica with an USB instead of meat inside 🙂 as you can see on the featured image above. Below are my notes and some pictures, and a friend of mine uploaded few videos (including me using Oculus Rift) on youtube playlist.

ECMA Script 6 – the future is JavaScript

  • Presenter Ratko Ćosić, MCSD, MCSE, MCITP, …
  • JavaScript was the language of 2014
  • ES6 (Harmony) features:
    • array functions (var sq = x => x*x)
    • block level scope (by using keyword let)
    • classes
      class Shape {
          id; x; y;
      
          constructor (id, x, y){
              this.id = id;
              this.name (x,y);
          }
      }
    • inheritance (extends keyword)
    • modules (kind of a merge between CommonJS and AMD, support for import, export)
    • promisses – similar to jQuery Deffered object
    • constants
    • new regular expression functions
    • new Math functions
    • symbols
    • typed arrays
    • default parameters
    • generators
    • map objects
    • collections (let s = new Set();)
    • better support for strings with for example backticks (`), includes(), startsWith(), endsWith() functions
  • Transpilers => conversion of JS from one version to another (Traceur, 6to5, Babel, TypeScript?
  • TypeScript – superset of JS, compiles to JS (ES5)
    • Angular2 uses TypeScript!
    • short types, interfaces, generics
  • Open question: will SPA frameworks (Angular, Ember, Aurelia) be needed when we’ll have ES7???
  • Browsers will be the new OS-es!
  • picture time!:
    ratko

node.js (sa sirom i vrhnjem)

  • Presenter Davor Tarandek, Tria d.o.o.
  • io.js uses the newer V8 engine than does node.js
  • asynchronity is hard to grasp
  • pm2 is awesome and it overpassed forever module
  • I actually wrote three rather extensive posts on the topic of the MEAN stack, that’s why I have so little notes from this lecture
  • picture time!:
    nodeTriaDavor

Ember.js in practice

  • Presenter Nikola Begedin, Coder.ly
  • convention over configuration
  • ember-cli is the thing
  • allows ES6 syntax (Babel transpiler mentioned earlier)
  • uses npm and bower
  • ember is not ember-cli (is what the Ember team recommends)
  • Some cool tools they use
    • Error reporting – Sentry
    • Task tracking – Asana
    • For chat – Slack
    • Heroku, Mandrill, Stripe, Amazon S3, Cloudfront, KissMetrics, Segment, NewRelic, CodeClimate, …
  • Recommended books to start Ember – Ember CLI 101 (google for it, it’s suppose to be free ;), if not, don’t mind spending a buck or two)
  • Talking Code podcast on iTunes
  • picture time!:
    emberNikola

Modern web using Microsoft tools

  • Presenter Miroslav Popović
  • Microsoft Studio vOld = .NET, 2003, 2005, 2008, 2010
  • Change started with ASP.NET MVC
  • 2012/2013 – Interface design, new web editor, GIT
  • HTML support – full HTML5 IntelliSense, code snippets, data-* attributes
  • JS – ECMA Script 5 support, strict mode support
  • CSS – IntelliSense CSS3 validation, color selection, vendor prefixes, CSS drag/rop
  • Browser Link
  • Other stuff: CoffeeScript coloring, Mustache, Handlebars, Knockout bindings, Angular Directives, LESS and SASS preprocessors, TypeScript
  • Community Edition FREE for up to 5 devs?!
  • WebEssentials
    • open source extension for VS
  • 2012/13 VS added Node.js based tools
    • static bundling & minification, image optimization & sprite generating, JS Hint, Source maps, LESS/SASS and CSS preview, CoffeScript preview
  • Visual Studio 2015
    • new web structure
    • package managers – NuGet, npm, bower, jspm
    • client side build tools – MSBuild, Grunt, Gulp, TaskRunner Explorer
  • Visual Studio Code – doesn’t (yet) support plugins like Sublime Text for example, but that’s a TODO
  • Other cool tools: Resharper, SideWaffle, Github for VS, Chutzpah (Jasmine, Qunit, Mocha)
  • picture time!:
    modernWeb

Effective software team collaboration

  • Presenter Zvonimir Juranko, Colombio
  • Colombio app
  • dare to disagree
  • 85% of people fear the conflict with their boss
  • The Marshmallow Challenge
  • LEAN canvas
  • be prepared to fail!
  • genchi genbutsu – try it out yourself!
  • make a MVP (minimum viable product) and build upon that
  • picture time:
    iDisagree

Oculus Rift – virtual reality for everyone

  • Presenter Tibor Kozjak, Infenso d.o.o.
  • there are some issues to be solved still
  • price around 500$ with shipping to Croatia
  • I tested the device after the talk and I guess in my case the verdict is “it’s really not for everyone, since I’m probably feeling sick and dizzy still :O”
  • picture time!:
    oculus

Hope to see you next year!

edit: A cool video made by the organisers after the conference:

Weblica 2015 from TICM on Vimeo.

Miscellaneou$

Touch Pianist app is awesome

Touch Pianist is an awesome free app which

is a musical toy / instrument that allows the user to perform hard-to-play classical piano music favorites (from composers like Beethoven, Mozart, Bach, Satie, Debussy to name a few) just by tapping the rhythm of the piece’s par

From developers point of view, the app was made using Pixi.js. Since this raised quite a buzz, I’m expecting to see Attack of the Clones 😉

Pluralsight, Three.js

Pluralsight WebGL and Three.js fundamentals course notes

Recently I bought a years worth subscription over at Pluralsight (here’s my portfolio of passed courses), and here I’ll be posting my notes from the courses that I attended. Please note that this is not meant to be as a sort of tutorial, just as the name says – notes for myself :). However, one could get some useful content from these posts as I’m noting things that catch my attention.

Here are my notes from the WebGL and Three.js fundamentals course. I rated the course 4/5 and all in all it’s a good introduction to WebGL with Three.js.

//rant: I passed the exam with the whopping 100%, and actually I feel that since Pluralsight is very famous and all that, that they could improve on the quality (it’s just too easy and does not go into detail) of these certification tests.

var scene = new THREE.Scene(); //acts like a container of all items
var renderer = new THREE.WebGLRenderer(); //how our content will be displayed on the page (WebGL, Canvas or SVG renderers)

It uses a Cartesian cordinate system (x,y,z). If you don’t specify the position- it will be positioned at (0,0,0).

It has a perspective and ortographic camera:

camera = new THREE.PerspectiveCamera(
35, =>fov
window.innerWidth / window.innerHeight,
1, => near
1000 => far planes
);

You can use your dev tools console (Chrome) or Firebug (Firefox) and access items if you properly export the objects in the code (return {scene: scene}); code snippet in the listing below):

//app.js file
var example = (function(){

    "use strict";
    
    var scene=new THREE.Scene(),
    renderer = window.WebGLRenderingContext ? new THREE.WebGLRenderer() : new THREE.CanvasRenderer(),
    light= new THREE.AmbientLight(0xffffff),            
    camera,        
    box;

    function initScene(){
        renderer.setSize( window.innerWidth, window.innerHeight );
        document.getElementById("webgl-container").appendChild(renderer.domElement);

        scene.add(light);
                          
        camera = new THREE.PerspectiveCamera(
        35,
        window.innerWidth / window.innerHeight,
        1,
        1000
        );
                            
        camera.position.z= 100;            
        scene.add( camera ); 

        box = new THREE.Mesh(
        new THREE.BoxGeometry(20,20,20),
        new THREE.MeshBasicMaterial({color: 0x00FF00})
        );

        box.name="box";   

        scene.add(box);

        render();
    }

    function render(){
        box.rotation.y +=0.01;
        
        renderer.render(scene, camera); 
        requestAnimationFrame(render);        
    }

    window.onload = initScene;
    
    return {
        scene: scene
    }

})();
//HTML file
<!DOCTYPE html>

<html>
    <head>
        <title>WebGL with three.js Fundamentals</title>       
    </head>

    <body>
    	<div id="webgl-container"></div>
    	
    	<script src="scripts/three.js"></script><!--DL this from official site-->
    	<script src="scripts/app.js"></script>
    </body>
</html>

Accessing it from Chrome Console as mentioned above:

var a = example.scene.getObjectByName('box');
a.position.x = 10;
a.position.set(0,2,2);
  • Degrees to radians formula: radians = degrees *pi/180
  • Meshes – geometry + material
  • use stats.js
  • different existing controls: FlyControls.js, OrbitControls.js
  • Collision detection
  • Raycasting – returns objects that are on some other objects “ray” and Box3.
  • Physics: PhysiJS is a wrapper for Ammo.js which is a port of C++ Bullet
  • Supports gravity, mass property, friction, restitution (bounciness)

Cool 3D frogger game made by the author: https://github.com/alexmackey/threeJsFrogger

Miscellaneou$

Microsoft HoloLens and VR in general may just be our doom

I’m all about advancement, but this just kinda starts to freak me out, fearing that we just may end up as in the movie Surrogates. But, it’s so cool 🙂 – can’t wait to see how will they make fighting games for it. Yeah, I’m sure pr0n industry will have it’s market for it too 😉

So, I guess, it’s just as with everything “groundbreaking” – shut up and take my money 🙂 But, on a more serious note – we just may wanna keep our vigilant eye open…

edit: Today (9.05.2015), on a developers conference in my hometown I tried out Oculus Rift, and  all I got to say is that I’m still feeling dizzy and sick, so yeah, this just may not be for everyone – not for me that’s for sure :/.

Miscellaneou$

MaxCapacity Training program

For the past 26 weeks I’ve gone through the MaxCapacity program 2 times (2 * 12 weeks + 2 weeks rest time between), and I can tell you that the program is all but easy. I really like it, but no matter what others say – I don’t recommend it for beginners (I did, and it didn’t work out so well). So, if you can’t do like 10 pushups straight, there’s really no sense in trying this workout as it will leave you disappointed.

The app (Android and iOS) is free to download, so this is a review in a way to say thanks to the author Samy Peyret (you can support him by buying his book on Amazon).

So, the main breakdown is pretty simple; you have to exercise only for 16 minutes, 3 times a week for 12 weeks. Honestly, if you don’t have 16 minutes for exercise, then something is seriously wrong, but that’s another topic… Exercises are very well planned and they grow in toughness as the weeks go by. Main idea is that in 3 weeks you do the same set of 4 different exercises on Monday, a different set of 4 exercise on Wednesday and  a different set of 4 exercise on Friday. You rest on Saturday and Sunday.

First week is a 50/10 regime, meaning that you are doing the exercise for 50 seconds and then you rest for 10 seconds – you should log your best (usually the first set) score. Second week is a tabata (20/10) regime, and here you should log your weakest score (usually one of the last sets – here you have 8 sets since the exercise is only 20 seconds long). The twist comes in the third week where you have to beat the time and do the calculated amount of repetitions ([max 1st week score + min 2nd week score] * 3) as fast as you can – and if you can do it below 16 minutes, you Rock.

I logged each and every set (you can download the full excel file: MaxCapacityTrainingLog), and as you can see it turns out that the second time I got to do the exercises, I did them with a whopping 24.32% increase in number of repetitions, so yeah – it works in only 16 minutes 3/week! The 24% increase is the average of all the exercises, some of course vary as you can see in the aforementioned excel file. The biggest advancement I noticed was with the diamond pushups, where I did a 150% increase in number of repetitions for the max count, and 135% in total sum!

So, to sum up – very much thanks to the author for making this a free resource. If you like it, you can support him by buying his book on Amazon.

An example of the first week the first time I went through the program compared to the second time I went through it:

Monday
[table id=1 /]

Wednesday
[table id=2 /]

Friday
[table id=3 /]

Give it a try and hit me back with your numbers and let me know what you think!

App idea alert!: Maybe a good idea would be to make a repository of scores so that one could see where he stacks up between others!?

Miscellaneou$

Overworking and not sleeping is the new badge of honor which will burn you out and then kill you!

An eye opening post from Jason Lengstorf.

After a few days of too little sleep, you’re a drunken zombie. We wouldn’t go to work drunk, so why the hell do we go to work on four hours’ sleep, when we’re more impaired than if we were hammered? To make matters worse, sleeping less than six hours a night may lead to an early death.

If any of these sound familiar or if you can totally relate (like me :/), then something needs to change

Feeling Guilty About Any Time Away from Work — Even Time with Family and Friends

Frequently Working More than 40 Hours a Week

Frequently Sleeping Less than 6 Hours a Night

So, yeah, advancement is good, but not worth it in the long run in terms of sacrificing the time spend with your child, spouse, friends. I’ve read a quote somewhere that goes something like “On his deathbed no man ever wished he spent more time in the office”. I believe balance in all mayor areas of your life is key but, of course, not easily attainable.

The author goes on to say how he managed to work less time, but in turn be more productive.

I know this may sound too idealistic, but at least from time to time – why not give it a try, right?

Miscellaneou$

I don’t always use logging, but when I do I make sure it’s to /dev/null

That moment when you realize someone on your team surely logged all of the errors, and still something wasn’t right, and then you find out how exactly this logging works…

iDontAlwaysUseLogging

CodeSchool, JavaScript

Codeschool JavaScript Best Practices Notes

I finished the course at CodeSchool, and below are my notes from it.

Level 1

Ternary howto with SIAF

var allPacked = true;
var readyToGo = true;
var adventureTime;

adventureTime = allPacked && readyToGo ?

  function( ){
    return "Adventure time is now!" ;
  }()
  :
  function( ){
    return "Adventuring has been postponed!" ;
  }() ;

console.log(adventureTime);

Short-circuting, if the this.swords is not empty it takes it immediately, without looking at the thing after the ||

this.swords = this.swords || [];

Same goes for &&, as soon as it finds a first falsy value – it returns that. If all falsy, it returns the last one.

Level 2

If you need lengthy, repetitive access to a value nested deep within a JS Object, then cache the necessary value in a local variable.

var numCritters = location.critters.length;
for(var i = 0; i < numCritters; i++){
      list += location.critters[i];
}

//instead of
for(var i = 0; i < location.critters.length; i++){
      list += location.critters[i];
}

//and even better
for(var i = 0, numCritters = location.critters.length; i < numCritters; i++){
    list += location.critters[i];
}

Put script tag just before the ending body tag, or you can also leave them in the head section, but add async keyword. Use a list of variables after the keyword var all at once! Use function join() on the array instead of concatenation. with +=. console.time(“string”) is the opening statement to a timer method that will help us measure how long our code is taking to perform. console.timeEnd(“string”) ends it and prints how long it took. “string” has to be the same in both cases.

var now = new Date();

console.log(+now) == console.log(new Number(now));

 Level 3

 === compares type and content. instanceof – userful to determine, well, the instance of some object 🙂

function Bird(){}
function DatatypeBird(){}
function SyntaxBird(){}
DatatypeBird.prototype = Object.create(Bird.prototype);
SyntaxBird.prototype   = Object.create(Bird.prototype);

Runtime error catching:

try{
   if(someVar === undefined)
        throw new ReferenceError();
}
catch(err){
    if(err instanceof ReferenceError)
        console.log("Ref err:" + err);

    //TypeError
}
finally{
    //this will execute no matter what
}

Avoid eval, with.

Use num.toFixed(2), parseFloat(), parseInt(num, radix). Radix can be from 2 – 36. typeof along with isNan to determine if the number is trully a number.

Level 4

Namespace is an object that groups and protects related data and methods in JavaScript files.

Say you have a code like this:

var treasureChests = 3;
var openChest = function(){
    treasureChests--;
    alert("DA DADADA DAAAAAAA!");
};

you can use namespacing like this:

var DATA = {
	treasureChests : 3,
	openChest : function(){
	    this.treasureChests--;
	    alert("DA DADADA DAAAAAAA!");
	}
};

You then call the function like this: DATA.openChests().

Closures are a feature of JavaScript, used to cause some properties to be private, bound only to a surrounding function’s local scope, and some properties to be public, accessible by all holders of the namespace.

Private properties are created in the local scope of the function expression. Public properties are built within the object which is then returned to become the namespace. Access to private data is thus possible only because of closure within the larger module.

Say you have a code like this:

var CAVESOFCLARITY = {
  stalactites: 4235,
  stalagmites: 3924,
  bats: 345,
  SECRET: {
    treasureChests: 3,
    openChest: function(){
      this.treasureChests--;
      alert("DA DADADA DAAAAAAA!");
    }
  }
};

You would make it into a closure like this:

var CAVESOFCLARITY = function () {

  var treasureChests = 3;

  return {
    stalactites: 4235,
    stalagmites: 3924,
    bats: 345,
    openChest: function () {
        treasureChests--;
        alert("DA DADADA DAAAAAAA!");
    }
  };
}();

If a module references globally-scoped variables, it’s a best practice to bring them into the scope of anonymous closure through the use of a specific technique called global imports.

Say the code is like this and uses a global variable named globalAnswer:

var MySomething = function () {
  var a = 3;

  return {
    getA: function() {return a; },
    summon: function(){
      if(globalAnswer === "42"){
        alert("YEP!");
      }
      else{
          alert("NOPE");
      }
    }
  };
}();

You would rewrite this using global imports like this:

var MySomething = function (answer) {
  var a = 3;

  return {
    getA: function() {return a; },
    summon: function(){
      if(answer === "42"){
        alert("YEP!");
      }
      else{
          alert("NOPE");
      }
    }
  };
}(globalAnswer);

Your import ensures clarity of scope within a module. By using a parameter, you protect the global data that might have been overwritten. All imported data becomes locally scoped to the anonymous function, to be used in closure. Thus, when compared with searching the entire scope, import are both clearer and faster.

Augmentation is the term for adding or changing properties in a module after the module has already been built.

In simple augmentation, the module file and the augmentation file do not share their private state. Augmented module properties may only access the private data from their file’s closure. Private data from the original closure will not be lost, and will be accessible to all original properties that referenced it.

Page 7 of 9« First...«6789»

Recent posts

  • Productivity tip: rate things 1-10 without 7
  • Productivity: Paper, Pomodoro, Kanban, Tracking, and actually showing up
  • The Keyboard Layout That’s Making Us Type Slower
  • Stop Tabbing. Start Using Your Monitor
  • StackOverflow – Was It Worth It?

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • DevThink (2)
  • 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$ (83)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (44)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (82)
  • Unity3D (9)
  • VibeCoding (2)
  • 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