Saturday, November 1, 2014

[Solved] Galaxy S3 Not Charging

I applied technobezz first solution and it just worked :
  • *#9900#
  • Low Battery Dump : On
What does *Low Battery Dump* does BTW ?

Thursday, July 10, 2014

[Solved] Scm-Manager high cpu load

We use git. Our repo size is 2 GB with 60 K files and 14 K commits.

Suddenly, scm-manager (1.38) was using all the CPU.

And we had strange failures in TeamCity checkouts like :
remote: internal server error
fatal: protocol error: bad pack header
The problem was that our central bare repository had never been garbage collected (with git gc). Even running git gc was failing with the error
warning: packfile ... cannot be accessed
fatal: failed to read object ...: Too many open files
error: failed to run repack
Here is what I did :
  • bare clone the repo on another machine
  • run git gc
  • bare clone the previous repo to the original machine
  • run git gc
  • switch last repo with the broken one (et voilĂ )
HTH

Ref : https://groups.google.com/forum/#!topic/git-users/6XChKIqdG_U

Sunday, June 15, 2014

Test Driven FizzBuzz

Here is my solution when I apply TDD on FizzBuzz using C# :
class FizzBuzz
{
    private readonly List<Tuple<int, string>> rules;
    public FizzBuzz()
        : this(new Tuple<int, string>[0])
    {
    }
    public FizzBuzz(IEnumerable<Tuple<int, string>> rules)
    {
        this.rules = rules.ToList();
    }
    public string Convert(int i)
    {
        var label = string.Join("", rules.Where(r => i % r.Item1 == 0).Select(r => r.Item2));
        return label.Length > 0 ? label : i.ToString();
    }
}

[TestFixture]
public class FizzBuzzTest
{
    [TestCase(1, "1")]
    [TestCase(2, "2")]
    [TestCase(3, "3")]
    public void TestNoRule(int i, string value)
    {
        Assert.AreEqual(value, new FizzBuzz().Convert(i));
    }
    [TestCase(1, "1")]
    [TestCase(2, "2")]
    [TestCase(3, "Fizz")]
    public void TestFizz(int i, string value)
    {
        Assert.AreEqual(value, new FizzBuzz(new[] { new Tuple<int, string>(3, "Fizz") }).Convert(i));
    }
    [TestCase(1, "1")]
    [TestCase(2, "2")]
    [TestCase(3, "3")]
    [TestCase(4, "4")]
    [TestCase(5, "Buzz")]
    public void TestBuzz(int i, string value)
    {
        Assert.AreEqual(value, new FizzBuzz(new[] { new Tuple<int, string>(5, "Buzz") }).Convert(i));
    }
    [TestCase(15, "FizzBuzz")]
    public void TestFizzBuzz(int i, string value)
    {
        var rules = new[] {
            new Tuple<int, string>(3, "Fizz"),
            new Tuple<int, string>(5, "Buzz"),
        };
        Assert.AreEqual(value, new FizzBuzz(rules).Convert(i));
    }
    [Test] public void TestFizzBuzz1_100()
    {
        var rules = new[] {
            new Tuple<int, string>(3, "Fizz"),
            new Tuple<int, string>(5, "Buzz"),
        };
        var fizzBuzz = new FizzBuzz(rules);
        for (int i = 1; i < 100; i++)
            Console.WriteLine(fizzBuzz.Convert(i));
    }
}
See also :

Saturday, April 12, 2014

Samsung vs Google Calendar

On my Samsung Galaxy S3, I have two calendar applications : Google Calendar and S Planner (S Calendrier in French). Both applications are able to display all phone calendars :
  • My Calendar : To display contact birthdays
  • Samsung calendar
  • Google calendar(s) : your own Google calendar(s) and your contacts'
If you sync these calendars, this will only keep in sync your phone calendars with the various clouds (Google, Samsung, Facebook, etc.). But this will not sync calendars between one another.
Sometimes, Samsung Calendar becomes the default when you create new events. I have seen lots of people on the web looking for ways to import/export from Samsung Calendar to Google, or to sync them...
Once an event is created, AFAIK, it is not possible on my phone to move the event to another calendar.
I have found a solution : with Kies Air opened in your computer browse, you can move events to another calendar.
How to proceed :
  • (phone) Open Samsung Kies Air app
  • (computer) Open Kies Air in your browser : http://phone.ip:8080
  • (computer) Enter PIN displayed on your phone
  • (computer) Open Calendar and edit events to move them to other calendars
HTH