Android on-device debugging launch fails: Can’t bind to local 8600 for debugger

You try to launch Android app on the device from Eclipse. The debugger fails to connect and times out. Instead, you see this in the Console log:

Can't bind to local 8600 for debugger

To fix this do the following steps exactly in this order

  • Close Eclipse
  • Disconnect USB cable
  • Kill all adb instances on the task manager of your computer
  • Start Eclipse
  • Connect USB cable
  • Launch the application

If this does not help then make sure that you are using IPv4 address for localhost DNS loopback name. Edit /etc/hosts and comment out all IPv6 entries.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

Script for generating Qt property

I wish QtCreator had some helpful utilities like this one. It’s just boring to write generic getter/setter stuff for properties by hand.

cls = "BulletQMLBody"
names = ["velocityX", "velocityY", "velocityZ", "angleVelocityX", "angleVelocityY", "angleVelocityZ"]
names = ["float "+x for x in names]

HEADER_TEMPLATE = """
Q_PROPERTY(float %(NAME)s READ %(NAME)s WRITE %(SETTER)s)
%(TYPE)s %(NAME)s();
void %(SETTER)s(const %(TYPE)s %(NAME)s);
%(TYPE)s m_%(NAME)s;"""

IMPL_TEMPLATE = """
%(TYPE)s %(CLASS)s::%(NAME)s()
{
    return m_%(NAME)s;
}

void %(CLASS)s::%(SETTER)s(const %(TYPE)s %(NAME)s)
{
    m_%(NAME)s = %(NAME)s;
}"""

def getData(aCls,aType,aName):
    return    {
    "CLASS": aCls,
    "TYPE" : aType,
    "NAME": aName,
    "SETTER" : "set" + aName[0].upper() + aName[1:]
    }
def genHeader(*args):
    return HEADER_TEMPLATE % getData(*args)

def genImpl(*args):
    return IMPL_TEMPLATE % getData(*args)

for n in names:
    t,n = n.split();
    print genHeader(cls, t, n)
for n in names:
    t,n = n.split()
    print genImpl(cls, t, n)

Output:

Q_PROPERTY(float velocityX READ velocityX WRITE setVelocityX)
float velocityX();
void setVelocityX(const float velocityX);
float m_velocityX;

...

float BulletQMLBody::velocityX()
{
    return m_velocityX;
}

void BulletQMLBody::setVelocityX(const float velocityX)
{
    m_velocityX = velocityX;
}
...

Disabling cross-domain security check for AJAX development in Google Chrome

This tip is for those who need to test Javascript / HTML5 web application functionality against a production server from their local HTML and Javascript files (not localhost).

Start Google Chrome with no security from command lin, OSX:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security

Start Google Chrome from command line, Ubuntu/Linux:

chromium-browser --disable-web-security
After this cross-domain AJAX requests work.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+

The best Finnish Pycon of the world, almost over

Summary

  • Finally Python hackers get know to each other –  thanks Syneus for making this happen after all!
  • Learnt a lot of new interesting projects, check #pyconfi in Twitter for slides
  • Lots of Django developers, some Plone developers
  • 75% had Macs
  • Somebody had used Python since 1.3
  • Finnish Python association on its way
  • www.python.fi will be bootstrapped

Join to the discussion.

Now, waiting for the unofficial part.

\"\" Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+