abidibo.net

Weblog

Javascript frameworks are really powerful, when you need them

javascript jquery mootools performance programming testing

Introduction

I've always used some kind of javascript framework when developing frontend stuffs. Mootools, jQuery, extjs and friends. All such frameworks provide a set of useful functionality, but above all in my opinion, they provide what is crucial for a web developer: cross browser compatibility.
The time you'll spend in writing cross browser code, even for a small project, is huge, especially if your software must support IE<9, and especially at the beginning, since you need to learn all browser ...

read the full post


Javascript event dispatcher

javascript programming

Update 11/2017

This ideas finally became a npm package: js-event-dispatcher

Introduction

Too much time has passed since my last post, so today I'll write about a simple javascript component, an event dispatcher which allows two entities to communicate each other.

The simplest use case I can think of is the one in which we have an object which emits an event and another object which should listen to such event.

We could implement all the stuff without the event ...

read the full post


Playing with tideSDK, create a brightness controller for fluxbox

applications fluxbox tideSDK

My ubuntu machine running fluxbox has all the features I desire. I've set up all kinds of short-cuts, menu and so on..., I've written my scripts to toggle between the notebook LCD and external monitors and I'm very happy with it. One thing more which I wanted was a brigthness control widget, but at the same time I disliked to install gnome or kde packages, and I could live simply with xbacklight and its get and set options. So what I needed is a simple interface to controll the xbacklight command.

And here comes tideSDK. After some reading about xlib and watching some examples I understood that now I don't have enough time to dive into it, so I decided ...

read the full post


Mootools IntervalController mixin

javascript mixin mootools programming

How many times do you need to implement a functionality which has to be run every n seconds and possibly should be stopped and resumed? Not so often probably but it happens and happened to me just today, for this reason I decided to write a mootools Mixin so that I can reuse this code when I need it.

The code

/**
* IntervalController Mixin
* Provides methods to start, stop and resume
* a setInterval functionality
*/
var IntervalController = new Class({
  _started: false ...

read the full post


How to create your own speech recognition application with tasker

android tasker tips

Tasker is an awesome android app which let's you create and execute deep level tasks based on context in user-defined profiles, or widgets

What captured my attention is its javascript API which let's you interact with many phone functions through javascript, so you can imagine how many nice job you can accomplish with this app.

Here we'll see how you can implement your own speech recognition application so that your phone will answer to your defined commands!

We'll see how to get it through tasker interface, but then we'll see that it is possible to use javascript(let) to enhance our application.

Create the speech recognition task

Ok, let's start by creating our main task, here comes the description:

A1 ...

read the full post


ajsut, abidibo's javascript unit testing library

ajsut javascript testing

Introduction

I know since time ago' that writing tests for our applications is one of the programming best practices, django taught me that many years ago, and gipi repeated it to me many times. But as many best practices it costs time to acquire the necessary skills, and time to start the implementation.

Maybe the best thing could be to place the testing phase at the beginning of the development flow, as the test driven development process shows you, so that you're forced to write tests for your application and you are forced to focus on code specifications, targets, runtime conditions, and all these things let's you write a cleaner and reusable code.

Actually is not so simple to change ...

read the full post


Geometriko, an enjoyable html5 js game

games html5 javascript

GEOMETRIKO is a skill game, written in html5, css3 and javascript, developed by a friend of mine which captured my attention some days ago'. It's available now in a demo version at this url, give it a chance because it's really an enjoyable game. It can be surely improved in some details, comment here if you have ideas or suggestions that can be useful for the developers.

The game

GEOMETRIKO is a turn–based game played on a 4x4 grid, and features four different tiles, aka Tiers, arranged in ascending order. Each player starts with an infinite number of Tier–1 tiles. Every time a player makes a three–of–a–kind he performs a Trip on the board; once a Trip is made it ...

read the full post


Django chained selects with mootools

django forms mootools tips

Notice!

A due specification here!
Such method works, but IMHO should not be used with a large amount of data, since it uses a js mapping array, but is simple and requires a few lines of code, so why not to use it when we have a controlled set of data?

Introduction

This is just yet another method to implement chained (cascading) selects in django forms. I'm focusing here on the frontend form construction, not the admin area. If you're interested in the admin area instead, please take a look here.

Scenario

Imagine we have such models:

class ...

read the full post


Calculator mootools plugin

calculator math mootools

Some days ago I was developing a library to show and run mathematics exercises on the web, and I needed a simple calculator widget.

A search in the mootools forge led to 0 results, so I decided to write my own plugin, also because I needed only some basics operations (sum, difference, multiplication, division, percentage, pow and sqrt).

The result is the Calculator plugin, now available on the mootools forge.

demo

Such plugin let's you create a calculator instance ...

read the full post


Required class attribute in django ModelForm

django tips

Days ago' I was developing a front-end form in order to give users the opportunity to subscribe to a newsletter. I used the django ModelForm class because I didn't need nothing special except from hiding some model fields.

But I run into a problem, the compulsory fileds where handled properly in the sense that the form submission returned an error if such fields weren't filled, but there wasn't any attribute assigned to the label element in order to style it different from non-compulsory fields.

Nothing special here, nor complicated, but it costs me a while to find the reason for this, so I'll share it with you. The simple solution is to add a line ( required_css_class ...

read the full post


Your Smartwatch Loves Tasker!

Your Smartwatch Loves Tasker!

Now available for purchase!

Featured