General


Avatar and stereoscopic 3D screens

Now that the new Avatar movie was released, it’s time to remember what happened when the first Avatar was released in 2009: It unleashed a craze about stereoscopic 3D movies & TVs.

2010 was declared “The year of 3D TV”. Somehow it was assumed that we were going to watch tv with glasses. I remember experts saying ‘In the future all the TVs will be 3D”.

I went to the cinema a couple times to watch 3D movies, and at the begining it was fun to try, but I got bored soon. I also bought a TV without 3D.

There was a lack of 3D content, and some movies where converted to 3D with algorithms producing a mediocre result. Also 3D viewing was causing headaches in a lot of people.

Nintendo joined the trend in 2011 launching the 3DS, that was showing 3D without glasses. But almost everybody was using it with the 3D deactivated, and in 2013 they launched the 2DS, without the 3D.

The production of 3D TVs ended in 2016 putting an end to this trend.

I remember this every time that someone says we are going to use VR headsets for work. Glasses, stereoscopic view, trends, headaches…


Coding in the Dark Side (with Eclipse!)

screenshotGetting back to the old days where I used Emacs to code (ok, more than ten years ago), now I’m using a dark theme in Eclipse. Dark themes are less eye-stressing and now are becoming popular with editors like IntelliJ, Sublime Text and the last Visual Studio. And that’s why more people is learning to programming even to his difficulty, although there are strategies that people can use to improve their learning, so you can use all the power of your mind to learn, you could visit http://www.subconsciousmindpowertechniques.com/ to find out more about this.

The Eclipse Juno platform supports styling of the SWT widgets via CSS, but many other elements must be setup manually, so I published my CSS and setup instructions in a GitHub repository: https://github.com/albertoruibal/eclipse_dark_css

Welcome to the dark side!


My Favourite HTML5 APIs

Ok, I’m supossed to be an Android developer, but i’m going back to HTML+JS for some projects, and I found that HTML5 has really powerful new APIS, these are my favourite:

  1. WebGL: Is changing the game rules, finally advanced 3D graphics in the browser. As it’s very hard to use directly,  I suggest the Three.js library
  2. Storage: A very simple system so store data in the browser, much more powerful than cookies
  3. Web Workers: Multithreading in Javascript, yes, now it’s possible
  4. WebAudio: a good sound API for the web, continues having some differences between browsers, but promises to be great

And I am already using this APIs in some Mobialia web apps:

App WebGL Storage Web Workers WebAudio
Mobialia Chess 3D X X X  
Slot Racing X X   X
Four in a Row X X    

This apps are developed in Java with Google Web Toolkit (GWT), you can also view  my slides: Migrating apps from Android to HTML5 via GWT. I also want to recommend the P4rgaming site, which has been one of my favorites when it comes down to getting gaming services for my video games. When it comes to playing WoW, you might find it hard to build up a sustainable sum of money. In the past for BFA and Legion i was using sites like 6Kgold and others like G2, now i simply hop off to Gold4Vanilla for all my warcraft gold needs.


Mobialia en Canal TEA

Esta semana invitáronme a participar nun programa da televisión local de Ponteareas (Canal TEA). Falamos un pouco dos fundamentos de Android, das aplicacións de Mobialia, tablets, MiFis etc. Foi unha experiencia moi interesante e a primeira vez que vou a unha canle de Televisión.


My London travel tips

This easter we were on London, it was a great experience and I want to share with you some travel tips:

AIRPORT

I arrived to Stansted Airport. Try to get a fligth to Heatrow or Gatwick. Stansted is 1 hour away by bus from London city center.

There are many bus companies from Stansted to London, the cheapest and fastest is Terravision (15£ with return, 14£ if you book online) but National Express (9£ single) has free WiFi.

CURRENCY

There are many currency exchange offices, but the best is to get cash on an ATM with you credit card. If your bank charges a small comission (ING Direct charges only 2.5%), is cheaper than the exchange offices.

BUS & UNDERGROUND

The city is divided into zones, all the city center is zone 1-2. You can get a “Day Travelcard” for zones 1-2 by 6.60£ (cheap compared to the 4£ of a single travel). You can buy it on the automatic machines at the entries of the tube (allows payment with credit card).

This travelcard also allows you to use the city bus on this zones (only showing the card to the driver). A great tip is to get the bus line 11, you will get a sightseeing arround the touristic zones by the price of a Day Travelcard.

CYCLE HIRE

One funny thing that you can do is to hire a bicycle on one of the many points along the city. You can do it with your credit card. First you must pay 1£ for the access to the cycle hire for 24 hours. Then, you get a cycle by obtaining a printed release code from the machine. This code is composed of “1”, “2” and “3” digits that you must type on the cycle dock to release it.

When you dock the cycle again the system charges you card with an amount depending of the time that you used the cycle. One hour costs 1£ and the prices lower as you use it more hours. By only 2£ you can get a cycle by one hour.

MUSEUMS

The British Museum and other public museums are free so don’t miss them. Quite curious that you can’t take photos with flash on the underground but the British Museum is full of unconscious tourists taking photos with flash and touching pieces from the ancient Egypt.

WIFI

It’s quite hard to find free WiFis on London, but there are lot of BT-FON spots, my advice is to became a FON member before traveling to London, buy “La Fonera” by only 39€ at http://www.fon.com and share your home ADSL. As a FON member you can use this WiFis for free.

HOTELS

We were on a Easyhotel room but I can only say that it was cheap. Easyhotel thinks that a “room with window” is an underground room with a window to a corridor without natural light. It’s also quite surprising to make fit a bed and a bathroom on 6m2.


Using two location providers on Android


Android has two kinds of accuracy on location:

  • Fine: provided by the GPS, needs some time to be obtained
  • Coarse: location determined with the cell of the mobile network

This location methods can be enabled or disabled by the user on the preferences or with some widgets.

Initially on our apps we used only one LocationProvider with “Fine” accuracy:

  • If the GPS was disabled it used automatically network-based location
  • But if GPS was enabled, the location used it needing some time to be determined

As the data couldn’t be obtained until the location is determined, the app didn’t showed data, receiving this kind of error reports from some users.

The best solution that I found is to mantain two separated providers, with different precisions and receive location updates using both.

LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(false);
criteria.setPowerRequirement(Criteria.POWER_LOW);       

criteria.setAccuracy(Criteria.ACCURACY_FINE);
String providerFine = manager.getBestProvider(criteria, true);

criteria.setAccuracy(Criteria.ACCURACY_COARSE);
String providerCoarse = manager.getBestProvider(criteria, true);

if (providerCoarse != null) {
    manager.requestLocationUpdates(providerCoarse, 5*60000, 100, this);
}
if (providerFine != null) {
    manager.requestLocationUpdates(providerFine, 5*60000, 100, this);
}

You can also check if providerFine and providerCoarse are the same provider. When receiving location, the one received from providerFine must take precedence over the one from providerCoarse. Location’s provider can be obtained with location.getProvider():

public void onLocationChanged(Location location) {
     if (location.getProvider().equals(providerFine)) {
     ...

This is a trick that we are using on our Gas Stations Spain app and also on Wikiplaces (open sourced).


Find Android apps with AppBrain

One of the first things that you can notice after buying an android phone is the great amount of mobile applications (apps) that you can download from the Android Market, but searching for a specific app can be very frustating, and a time-consuming task.

This is due to one of the biggest problems of the Android Market: the lack of a complete web interface to query the applications avaiable, and AppBrain is an independent web (not affiliated with Google) where you can list, search, etc. those apps.

There are many similar webs: Cyrket, Bubiloop, but Appbrain has some features which make the difference:

  • You can sign-in on the web with your Google account
  • Apps can be queried by country, genre (of the user), age range, etc.
  • You can create list of apps and share it with your friends
  • There is an android app (search for AppBrain on the Android Market) to synchronize your mobile with appbrain, and once installed:
  • You can query the installed apps on your mobile
  • You can install apps from the web

And everything with a very simple and pretty interface, so don’t wait to try it:

http://www.appbrain.com


Tales of a chess engine developer

Chess engine development is one of the most brain-crushing activities I’ve been involved on the last years. Last nigths I was working again on my Carballo Chess Engine with some advances.

First of all I decided to leave Negamax and go with Principal Variation Search (PVS). Also decided to implement separate methods for root nodes, PV nodes and null window searches. On previous experiments PVS was performing worse than Negamax, but I discovered the reason: the aspiration window has some implementation issues with PVS: when the search for a move fails low at the root node the move must be researched enlarging the window.

I was very stranged of why Futiliy Pruning was not working for me, but finally discovered the reason: a simple sign change after evaluation was the reason! Also implemented to store the evaluation values on the Transposition Table (TT).

The next step: why Carballo searched much less depths than other engines, it was due to quiescence search. I was generating checks for the first 4 PLY’s of quiescence, but some other engines not, so this was the reason. I decide to generate only checks on the first PLY of quiescence and only for PV nodes. Also modified a bit the move generation to optimize for quiescence.

During this time also found many interesting bugs, I was storing on the TT the bound and not the score when failing high/low, also on PV nodes is better to use only the TT for ordering and not to return scores from it, this helps avoiding draws. Also found a serious bugs involving time management (was taking as reference opponent’s time) and with contempt factor on IID searches corrupting TT entries. Finally added a Pawn Push Extension and removed the Recapture Extension and now some extensions now depend of the node type.

Running some test tournaments, I hope to get some good results soon and add the improved engine to my Mobialia Chess.