Tuesday, 27 August 2013

Google Spreadsheets - Count word occurrences

I'm a big fan of Google Docs, I think it is an incredible collaboration tool, however it got problems...

Today I was working on a spreadsheet and I wanted to count the occurrences of a word in a cell interval, this should be a simple task, right?
Infact, there's a useful function named COUNTIF(interval, criteria) that does exactly this, in interval you specify the cells to be checked, in criteria you specify the number, string or cell that you want to count in the specified interval. The only problem was...it wasn't working! It just said me #ERROR and asking for more details resulted in a generic "Analysis Error".
After some research I discovered that the problem was simply that, as a parameter separator, the comma works only in the US, for other countries you have to use the ";"!
So the right syntax is: COUNTIF(interval; criteria).
Here are some working examples:
  • =COUNTIF(L5:L450; "OK")
  • =COUNTIF(L5:L450; D45)
  • =COUNTIF(L5:L450; 12)
Bonus tip: if you want to count not empty cells use the COUNTA(interval) function!

Sunday, 25 August 2013

Configure Assembla GIT repository in eclipse (Windows)

Today I found out that setting up eclipse on a Windows system to connect to an Assembla GIT repo is not really straightforward. I'll try to guide you step-by-step to the environment set up, I take for granted that you have already created your Assembla project and that you've already have your eclipse project in a local GIT repository that you want to push on Assembla.

Key generation

First of all you have to generate a pair of private/public keys. You can do this from inside eclipse going in "Windows>Preferences>General>Network Connections>SSH2". Select the tab "Key Management" and then "Generate RSA Key...".

This will create a pair of public/private keys to be used for SSH. Now, without choosing a passphrase, save the private key on your PC in the directory "C:/Users/<Username>/.ssh" (Unless you have changed eclipse defaults stated in the SSH2 "General" tab). Copy to clipoard the public key string as it is in the text box, you'll need it to configure Assembla.
Select "Apply" and close the dialog with "OK".

Assembla configuration

Open your Assembla profile page and go to the tab "Manage SSH Keys". Here paste the public key you have copied before and add it with the "Add" button.

Now go to your project page and select the "Git" tab, Assembla should give you the repository url. Something like that: git@git.assembla.com:<project-name>.git, copy it in the clipboard, you'll need it to configure eclipse.

Remote repository creation

Return to eclipse and go to the GIT Repository Exploring perspective, select your local GIT repository and right click on the "Remotes", and select "Create Remote...".

Select the remote name and then go on, "origin" is the default. Eclipse will ask you to cofigure the push settings.

Select "Change..." near the URI field. Eclipse will show you a new dialog.

Paste the address you have copied from Assembla in the URI field, select SSH protocol and leave "git" as username. Confirm and close all the dialogs, if you select "Save and Push" your project will automatically be pushed to Assembla, otherwise you can do it later manually.

You should now be able to work with your Assembla GIT repository.
Let me know if this works for you also.

Note: Tested with eclipse Juno and EGit 2.3.1

Monday, 5 August 2013

Eclipse failing during Android "export signed application package"

Sometimes eclipse fails while processing the "export signed application package" for Android. The fail can appear as a generic error message “Conversion to Dalvik format failed error 1” or as a complete crash of the  IDE.

Even restarting eclipse doesn't seem to fix the problem. A simple solution I've found that works for me is this one:

  • Disable automatic project building
  • Clean the project
  • Export the package
  • Re-enable automatic building
This seems to work on both, Mac and Windows version, of eclipse.
Let me know if this works for you also.

Sunday, 4 August 2013

Samsung Galaxy Nexus problems

Screen turning on automatically

This morning my Galaxy Nexus decided he didn't want to stand by. Every time I locked the screen, it turned on again automatically. Well, after some research it turns out that this can be a software or an hardware problem. Some people resolved the (SW) problem with a  factory reset of the device, i haven't tried...
In my case it was a simple HW problem, because i solved it with some simple steps:
  1. Turn off
  2. Take out the battery
  3. Blow with strong inside the power plug
  4. Take a wooden toothpick and gently clean the plug
  5. Wait a couple of minutes
  6. Insert the battery
  7. Turn on
In a few words it was just dirty...

While doing this, check also the orientation of the male part of the USB connector, it should be coming out straight, it shouldn't bend down or up. If it does, try carefully to bring it to a straight position using the toothpick or a small screwdriver.

If this didn't solved your problem, and you have no fear to open your phone, you could buy a replacement connector board on eBay for something like 10$.

Phone not charging

Since I'm at it, some time ago I faced another problem related to the power plug that prevented the phone from charging. The male part of the connector was bend down, making it straight (as described before) solved the problem.

GPS not fixing

Another problem I've experienced is the malfunctioning of the GPS receiver, it started all of a sudden, without apparent reason. All the location based application wasn't fixing the signal, the GPS icon would just blink forever.
What I did was simply to turn off the phone, remove the battery, wait some seconds and then turn it on again. Then it started working properly.

Hope this helps, let me know.