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 5 Elements of Effective Thinking – E. Burger and M. Starbird

My notes from the bestseller book The 5 Elements of Effective Thinking by the authors Edward B. Burger and Michael Starbird, which I rated  5/5 and marked as favorite on my Shelfari account:

Earth – understand deeply

Fire – make mistakes

Air – raise questions

Water – follow the flow of ideas

Change – universal constant that allows you to get the most out of living and learning

Education is what survives when what has been learned has been forgotten. ~ B. F. Skinner

In everything you do, refine your skills and knowledge about fundamental knowledge and simple cases. Once is never enough. As you revisit fundamentals you’ll find new insights.

The depth with which you master the basics influences how well you understand everything you learn after that.

As you learn more, the fundamentals become at once simpler but also subtler, deeper, more nuanced, and more meaningful.

One of the challenges of life is to be open-minded about new ideas and new possibilities.

Sadly, many people spend their entire lives focusing on the wrong questions. They may pursue money, when they really want happiness. They may pursue the respect of people whose favor is really not worthy of being sought. So before you succumb to the temptation to immediately spring to work on the answer, always stop and first ask, “What’s the real question here?” Often the question that seems obvious may not be the question that leads to effective action.

Fail nine times! The next time you face a daunting challenge, think to yourself, “In order for me to resolve this issue, I will have to fail nine times, but on the tenth attempt, I will be successful.” This attitude frees you and allows you to think creatively without fear of failure, because you understand that learning from failure is a forward step toward success. Take a risk and when you fail, no longer think, “Oh, no, what a frustrating waste of time and effort,” but instead extract a new insight from that misstep and correctly think, “Great: one down, nine to go—I’m making forward progress!” And indeed you are. After your first failure, think, “Terrific, I’m 10% done!” Mistakes, loss, and failure are all flashing lights clearly pointing the way to deeper understanding and creative solutions.

Success is the ability to go from one failure to another with no loss of enthusiasm. ~ Winston Churchill

https://twitter.com/HitmanHR/status/670239687009771520

Stack Overflow

How to get nested object property with pluck in Lodash

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.

This Lodash question was actually asked by myself:

I have an array of objects like this:

var characters = [
    { 'name': 'barney',  'age': 36, 'salary':{'amount': 10} },
    { 'name': 'fred',    'age': 40, 'salary':{'amount': 20} },
    { 'name': 'pebbles', 'age': 1,  'salary':{'amount': 30} }
];

I want to get the salary amounts into an array. I managed to do it by chaining two pluck functions, like this:

var salaries = _(characters)
  .pluck('salary')
  .pluck('amount')
  .value();

console.log(salaries); //[10, 20, 30]

Is there a way to do this by using only one pluck? Is there a better way with some other function in lodash?

The answer, from user thefourtheye, was:

You can just give the path to be used as a string, like this

console.log(_(characters).pluck('salary.amount').value())
// [ 10, 20, 30 ]

Or use it directly

console.log(_.pluck(characters, 'salary.amount'));
// [ 10, 20, 30 ]

https://twitter.com/HitmanHR/status/670237244695977984

Books

Surely You’re Joking, Mr. Feynman! – Richard P. Feynman

My notes from the bestseller book Surely You’re Joking, Mr. Feynman! (Adventures of a Curious Character) by the author Richard P. Feynman himself (winner of the Nobel Prize in physics), which I rated  4/5 on my Shelfari account:

All the time you’re saying to yourself, ‘I could do that, but I won’t,’ — which is just another way of saying that you can’t.

I couldn’t claim that I was smarter than sixty-five other guys–but the average of sixty-five other guys, certainly!

I learned from her that every woman is worried
about her looks, no matter how beautiful she is.

There were lot of fools at the conference – pompous fools – and pompous fools drive me up the wall. Ordinary fools are alright; you can talk to them and try to help them out. But pompous fools – guys who are fools and covering it all over and impressing people as to how wonderful they are with all this hocus pocus – THAT, I CANNOT STAND! An ordinary fool isn’t a faker; an honest fool is alright. But a dishonest fool is terrible!

I always do that, get into something and see how far I can go.

When I tried to show him how an electromagnet works by making a little coil of wire and hanging a nail on a piece of string, I put the voltage on, the nail swung into the coil, and Jerry said, “Ooh! It’s just like fucking!

I wouldn’t stop until I figured the damn thing out–it would take me fifteen or twenty minutes. But during the day, other guys would come to me with the same problem, and I’d do it for them in a flash. So for one guy, to do it took me twenty minutes, while there were five guys who thought I was a super-genius.

The whole problem of discovering what was the matter, and figuring out what you have to do to fix it–that was interesting to me, like a puzzle.

https://twitter.com/HitmanHR/status/670015841719721984

Ionic, Stack Overflow

How to design a two column button 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 in the top All time answerers list.

I actually asked this question myself:

What I would like to achieve is this:

enter image description here

Surely, I went through the button documentation, but it seems nothing similar is there. So, I would appreciate some pointing in the right direction (codepen with a basic example would be most awesome).

So, ideally, this would be one button tag where I would be able to pass two variables (one which would appear on the left and one on the right). This does smell like a job for a Angular directive, though I haven’t fiddled with it too much just yet so a friendly nudge in the right direction would be appreciated.

Answer from Malek Hijazi was pointing out to use the ButtonBar component, but I already knew about it and it wasn’t what I needed. Finally, I managed to answer this question myself after some fiddling with it:

What I ended up doing in the end was this: I created a div with a class button and then inside it I created additional two div‘s with custom classes.

How this looks like on CodePen:

And, the code below:

.leftButtonSide {
    width: 50%;
    float: left;
    color: #000;
}

.rightButtonSide {
    width: 50%;
    float: left;
    background: #F2F2F2;
    color: #000;
    border-radius: 2px;
}
<div ng-repeat="d in data" class="button button-positive-outline">
    <div class="leftButtonSide">2</div>
    <div class="rightButtonSide">2,00</div>
</div>

True, for the exact same look you would have to play a bit with CSS. I ended up with this in the end:

Hope this helps someone too!

https://twitter.com/HitmanHR/status/669836667893768192

PHP, Quick tips

M is not for minutes in PHP date function

Ah, it was one of those days when you’re too smart for your own good and you don’t check the docs and falsely assume that m must definitely be minutes in the date function in PHP.

It should be

$dateNow = date("Y-m-d H:i:s");

and not H:m:i!

The offcial docs are clear, one just needs to read them 🙂

Ionic, Pluralsight

My new post about Ionic on Pluralsight

I haven’t posted in three weeks now, but there’s a good reason for it – I was preparing a post for Pluralsight on the topic of Ionic. This will be a series of posts which will teach you how to take advantage of your web development knowledge in building hybrid applications for iOS and Android.

I’m super excited that the first  post is now live (I have additional 3 in the queue) and you can check it out here: How to get started with Ionic framework on Mac and Windows.

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

Miscellaneou$

Ekobit DevArena X 2015

Post moved here: http://www.nikola-breznjak.com/blog/miscellaneou/ekobit-devarena-10-2015/

Ionic, Stack Overflow

How to test Cordova plugins in Ionic without a device?

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 in the top All time answerers list.

I answered this question by userChris Lawrence:

I think I know the answer to this question already but thought I would throw it out there incase there was a workaround….

Just built a ionic app with ngcordova, which works fine and I have tested on my android device and deployed to playstore.

Just in the process of deploying to the apple app store. I currently don’t have an apple ios physical device to test the cordova plugins.

I am using sms, camera and local notification. These as far as am aware cannot be tested in the ios simulator in xcode.

Don’t really want to spend £400 on a tablet to test one app.. any one had the same problem and found a means of testing?

My answer was:

You can test plugins in iOS simulator.

edit: I just stumbled upon the official documentation where it states that even with Ionic View you can test these plugins:

  • com.brodysoft.sqlitePlugin 1.0.3 “Brodysoft SQLitePlugin”
  • com.ionic.keyboard 1.0.3 “Keyboard”
  • com.phonegap.plugins.barcodescanner 1.1.0 “BarcodeScanner”
  • org.apache.cordova.battery-status 0.2.12 “Battery”
  • org.apache.cordova.camera 0.3.4 “Camera”
  • org.apache.cordova.console 0.2.12 “Console”
  • org.apache.cordova.device 0.2.13 “Device”
  • org.apache.cordova.device-motion 0.2.11 “Device Motion”
  • org.apache.cordova.device-orientation 0.3.10 “Device Orientation”
  • org.apache.cordova.dialogs 0.2.11 “Notification”
  • org.apache.cordova.geolocation 0.3.11 “Geolocation”
  • org.apache.cordova.globalization 0.3.3 “Globalization”
  • org.apache.cordova.network-information 0.2.14 “Network Information”
  • org.apache.cordova.vibration 0.3.12 “Vibration”
  • org.chromium.zip 1.0.0 “Zip”

How to test #Cordova plugins in #Ionic without a device? https://t.co/IpyYNV4uAn

— Nikola Brežnjak (@HitmanHR) October 20, 2015

Miscellaneou$

Ekobit DevArena X 2015

I just came home from the ever so slightly awesome Ekobit DevArena X conference. As I usually do, I’ll share my notes that I took in my notebook and a few pictures.

Start your engines

Well, you can’t start a day on an empty stomach, right?

IMG_5014

This is how the accreditation looked like:

IMG_5015

The accreditation had a handy list of all the presentations on the back side:

IMG_5016

As you can see, there were 4 tracks between which you could choose (yes, you could go to any presentation in any of the tracks in a certain timeslot). Chalk n’ Talk presentations are actually a cool thing where they aren’t actual presentations rather something like a round table where the presenter(s) discuss their real life experiences (and the input from the crowd is also highly desirable).

Keynote

  • Presenters: Ivan Kardum, Nenad Bakić, Domagoj Pavlešić and Saša Tomičić
  • 10th in a row Ekobit DevArenaIMG_5017
  • A very interesting project called Croatian Makers by Nenad Bakić who was very inspiring and kudos for starting all this
    IMG_5018
  • They donated robotical equipment to over 50 schools in Croatia
  • Serwantes
  • Fantom 3
  • Lego Mindstorms – can’t wait to get this for my little girl! Yeah, I know it’s an excuse for me to play with it too 🙂
  • He shared a quite intriguing image with us:
    IMG_5019

Modern web application development in Visual Studio 2015

  • Presenter: Ivan Popek
  • IMG_5022
  • IMG_5023
  • Bower and npm come preinstalled with Visual Studio 2015. I wrote a detailed tutorial for Digital Ocean about Bower if you want to take a look.
  • Gulp and Grunt are task runners which offer tools like minification, concatenation, linting, etc…
  • Personally, I like Gulp better because of it’s clearer syntax
  • Gulp is faster because it uses streams
  • Git and Node are also preinstalled by default on VS 2015
  • The way you “add” packages for Bower is that you create a bower.json file in the Solution explorer and as soon as you hit Save it installs the listed dependencies. It creates the Dependencies folder and a bower_components folder
  • bower install runns automatically after you open up the project
  • To add Gulp create a package.json file in the Solution explorer and as soon as you hit Save npm will install it. You can add additional Gulp dependencies the same way.
  • To start writing Gulp tasks, create a gulpfile.js and hack on 🙂
  • Visual Studio 2015 has a nice TaskRunner explorer where you can run the tasks manually. However, it’s way better to set a “watch” task inside Gulp so that it runs the tasks automatically for you. For example, if you’re using SASS it will compile to CSS automatically on every change to the SASS files. You can set the watch tasks to run after you reoppen the project with Watch -> Bindings->Project open

Clean code is your friend

  • Presenters: Bruno Brozović and Antonija Malenica
    IMG_5024
  • Technical debt
  • Writing code : Reading code = 1 : 10 in terms of time. It’s way better to invest time at the beginning to write “clean code” as it will pay of in the later stages of the project
    IMG_5025
  • The boy scout rule – always leave the campground cleaner than you found it
  • YAGNI (You ain’t gonna need it) – do not add functionality until deemed necessary
  • KISS (Keep It Simple Stupid) – Simplicity is better than complexity
  • DRY (Don’t Repeat Yourself) – every piece of knowledge must have single, unambigious, authorative representation within system
  • Principle of least surprise – do the least surprising thing
  • SRP (Single Responsibility Principle) – a class should have only one reason to change
  • Single level of abstraction
  • Methods
    • names – detail and descriptive
    • short
    • number of arguments as small as possible (0, 1, 2)
    • SRP
  • Comments – you should strive to write selfdocumenting code
  • Classes
    • QualitatyClassName (25-30 characters)
    • SRP
    • smaller number of cohesive classes
    • Open Closed Principle – open for extension, closed for modification
  • Learning test
  • And now, a spectacle! In a room of about 100 people when the question “How many of you are using Unit testing?” was asked only 4 people raised their hands 1415131129_smiley-evil

Lunch

smileyGlasses

IMG_5026

We’re outsorcing products and services, not people!

  • Presenters: Luka Abrus (Five Minutes), Vedran Brničević (Ekobit)
    IMG_5027
  • Ekobit started in 1992
    • ALM, BizDataX
  • Five minutes needed 7 years to come to the point where 100% of the things they do is on the USA market
  • Customer feedback by literally going live from door to door and ask
  • Landing pages + AdWords + Sign me up
  • Nobody buys enterprise software without a support
  • Europe’s problem is language barriers from country to country
  • Funny anecdote: when you say to an American that you’re from Croatia: “Oh, yes Dubrovnik – Game of Thrones!”. Also funny one was “oh, you’re just a Russian school of mathematics”. And thus, they believe we are good programmers; designers not so much.
  • You need to be willing to hop the plane and go to a meeting at any time
  • Five Minutes has currently 12 free spots
  • NY Area software developer 150-200$ per hour (jaw-dropping!)
  • Quality is everything!
  • Put your code to GitHub, designs to Dribble, Behance
  • The main problem that both of the presenters expressed was that there are just not enough (quality) developers

Where is this web going?

  • Presenters: Domagoj Pavlešić, Ivan Popek, Renato Železnjak, Josip Klarić, Ratko Ćosić
  • this was a round table like presentation
    IMG_5029
  • Browser as an Operating System
  • Microsoft is slowing down the Web standardization
  • Too many JS frameworks (you don’t say 😉)
  • NO for monolith framework
  • Use linting
  • Gridster, Selectize, Knockout
  • Throw jQuery out
  • TypeScript two thumbs up

Automated delivery in Visual Studio 2015

  • Presenters: Ognjen Bajić and Ana Roje Ivančić
    IMG_5030
  • Build vNext
  • 2015 Intentional Extensibility – open source
  • Custom build workflows
  • Real time output
  • Versioning
  • Cross-platform build (Win, Mac, Linux)
  • Build .NET, Java, Android, iOS
  • Ant, CMake, Maven, Xcode Build, Android Build
  • Agents, Pools, Queues
  • Testing, web performance, load tests

Aurelia – new generation JavaScript framework

  • Presenters: Ratko Ćosić and Mario Peroković
    IMG_5036
  • AMD
    • modular programming
    • RequireJS
    • CommonJS
    • TypeScript
  • SPA
    • chunking
    • templating
    • controllers
  • Which framework should I choose?
    IMG_5037
  • Durandal -> Aurelia
  • JavaScript is a subset of TypeScript which is compiled in ES5. Microsoft is developing along with Anders Hejlsberg (C# creator)
  • Angular2 uses TypeScript
  •  Every view starts with <template>
  • MVVM – model view view-model
  • DI – dependency injection
  • Parent view models
  • Routing
  • Screen activation lifecycle
  • uses jspm
  • jspm install aurelia-http-client
  • <input type=”text” value.bind=”firstName” /> and then reference it like ${firstName}
  • Debugging
    • compile-spy
    • view-spy

They had a nice additional prize draw for those who asked questions (you get a small paper which you toos in a drawing bowl). I got mine on the last presentation. However, no luck in winning something 🙁

IMG_5039

However, as every year, they are giving prizes for the first few people who sign up for the conference. This year I signed up at 6th place, and because of that I got a nice 2 tickets at Terme Tuhelj, and also a nice hoodie with a number 6 🙂IMG_5047

Thanks and hope to see you next year!

Sublime Text

How to set up live Markdown preview on Windows with Sublime Text and Markmon

If you write on the web, you must have come across the awesome Markdown:

a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

You can learn more about it from the official documentation.

There are many editors that allow you to write in Markdown but, as I found, most of them require a license. Besides, wouldn’t it be great that your own editor would have a Markdown support? That’s why I love Sublime Text, it has a plugin for everything. Well, ok, it doesn’t have a plugin to throw out sandwiches from your computer, but I guess it will be able to in the not so distant future. smileyGlasses

Ok, jokes and wishes aside, let see how to set up live Markdown preview on Windows with Sublime Text and Markmon plugin.

Install Markmon:

npm install -g markmon

Install pandoc.

Install Markmon Sublime Text plugin through its Package Control (search for “Markmon”).

Make sure you have markmon and pandoc in your PATH variable.

Run markmon in the folder where is your .md file, like this:

markmon myMDfile.md

open up your browser at localhost:3000.

Write on! hand_rock_n_roll

How to set up live #Markdown preview on #Windows with #Sublime Text and #Markmon http://t.co/ROZZxCbvGb

— Nikola Brežnjak (@HitmanHR) October 18, 2015

Page 28 of 51« First...1020«27282930»4050...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