2014-06-30

My students

In the last five months I have studied good practice of being a teacher in university. One (most important) task was to create a portfolio. In my experience I have heard this word describing The Face of different modern artists, mostly web designers and programmers, who are promoting their achievements; accumulating all their work in a world wide web thus showing their potential for their future employers.

Eventually during the course I took I realized that my blog/webpage is also a portfolio. I started this blog with the main idea to have a notes; pretty specific ones, maybe I am the only one who will need them, but I nailed myself that  time by time I am looking for some older posts to refresh myself - "how I solved that particular problem, what are the keywords, etc"

Even more, I organized my web not only for myself, not only for some five people in the world who are fighting similar problems I had, but I have also specified a part of the blog for... my work. As I work with students, they have to understand some complicated problems pretty often. I realized that Internet is full of ... well.. shit, but there are pearls hidden. Now I have specific part, where I am accumulating those pearls which explain those particular problems. Either it is some image, video, audio or just a explanatory text - this part has its value - all necessary things in one place.

This course I had - well, despite I already had some ideas in my mind how to organize and structure the work with my students - in the end it putted the dot on "i".

2014-01-23

Array to object in php

I could say that I`m settled down with such a programming techniques - object oriented programming, PDO for database access, JSON as nice client-server communication, Slim framework as RESTful server, jQuery-Backbone as MV* client side solution.

This is short note about database-php-javascript communication. PHP is receiving data from both, but the trick is - one, coming from javascript is JSON string, another one, coming from database is array. PHP has nice function converting JSON string to pure object -
 json_decode 
But how about converting array to object? It should be so simple, right? But as it appears, there`s no native functions for doing that. One way is to cast an array to object as such
$newObject =(object) $array;
but ... the trick is that only the outer dimension will be transformed to an object. There definetely are some recursive functions flyin around in internet, but .. how about firstly encoding array to JSON using json_encode, and then decoding it using json_decode? Ok, I admit it could be much more memory inefficient than some recursive function, but, it definetely is much more simple.


2013-08-17

Facebook api logout without popup

During the building some webpage where users are able to register themselves through social networks, I stuck with a stupid problem related with facebook logout procedure. And all answers were hidden in... number sign "#" within anchor "href" element.

This one gives login popup

< a href="#" class="logoutFB" onclick="FB.logout()"> logout </a >

This one works fine, reloads page and is without popup

< a href="" class="logoutFB" onclick="FB.logout()"> logout </a >

2013-05-01

MIDI and probability (?)

Well.. what is the connection between MIDI and probability? Usually musicians and sound engineers try to find flawless software and plugins with as much as precise timing and accuracy as possible. This one instead tries to skip played notes based on probability. Incoming MIDI message "note on" triggers the mathematics where user defined probability level decides will the note go through or disappear.

When it is useful? Well.. that depends. When I play layered instruments where one of them is kind of percussive or drums, I like to have that percussive instrument not to sound all the time. 

Download it here