abidibo.net

Weblog

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


Low battery notification with fluxbox

bash battery conky fluxbox

I'm very happy with my fluxbox window manager, but there is a thing which causes me some problems, the lack of a notification message when my laptop battery has a really low charge.

I run conky as monitor display, which shows me battery information, but while I'm working I don't care of my desktop most of the times, I'm overwhelmed by all my opened windows and applications and so always happens that my machine shutdown because ...

read the full post


Fluxbox, configure an external monitor

fluxbox hdmi linux tips vga xrandr

One problem I still haven't solved with fluxbox is how to manage multiple monitors resolutions.
More specifically, I can stream the output over multiple monitors, I can have multiple resolutions, but fluxbox sizes itself considering only the first screen resolution.

For example if I boot my machine with an external VGA monitor connected, the system boots and both the VGA monitor and the laptop monitor work (even if the laptop monitor is closed). The problem here is that my laptop monitor has a 1366x768 resolution, while the external monitor is fullHD. So what happens is that I'll have the maximum resolution supported by all active monitors (1366x768) and so my fullHD monitor looks very ugly!

I learned playing ...

read the full post


Connect to WPA2 wireless network through command line

linux network tips

There is one rule I learned during my linux experience: If you want to learn things, you've to break things.
Trying to solve problems alone is the best way to increase your linux knowledge.

That said, almost every disaster can be recovered through your command line, so when X crashes, when you have broken your windows manager or display manager, you'll always be able to recover from terminal, BUT you need at least one thing: one active internet connection.

If you can go with a LAN cable ok, there is hopefully no problem, but what if only a WPA protected wlan network is available for you?
Clearly you've to connect to such network through command line in ...

read the full post


Your Smartwatch Loves Tasker!

Your Smartwatch Loves Tasker!

Now available for purchase!

Featured