Posts

Showing posts from 2013

Prevent localization warning on a string in Android

Lint might warn you that some resources are not localized. Sometimes you need to put a string in a resource so that it can be referenced from another xml and read from code without duplicating the string value (error prone). You want also to make sure that this string will not be localized. An example I use sometimes is to put dummy key string in a preference activity

A good reference is here: http://tools.android.com/recent/non-translatablestrings
According to the doc, this is all you need:

<string name="app_homeurl" translatable="false">http://my/app/home.html</string>
According to Android translation service there is also a way to mark a whole string or a part of a string not translatable (http://developer.android.com/distribute/googleplay/publish/localizing.html)

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Example placeholder for a for a URL --> <string name="app_homeurl">   Visit <xl…

Install Maven 3.1.1 on Ubuntu 13.10

AppEngine requires Maven 3.1 while ubuntu 13.10 is stuck at 3.0.4

$ mvn -v Apache Maven 3.0.4 Maven home: /usr/share/maven
'which mvn' gives '/usr/bin/mvn'
Fortunately /usr/local/bin is before in the path variable and this is where I put all the symlink I need

Download the latest maven from http://maven.apache.org/download.cgiI installed it here /opt/apps/apache-maven-3.1.1/binAdd a symlink sudo ln -s '/mnt/ssd/apps/apache-maven-3.1.1/bin/mvn' /usr/local/bin/mvnI add to start a new console to check mvn version on the command line$ mvn -v Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200) Maven home: /opt/apps/apache-maven-3.1.1

Epson Aculaser 1750 on Windows 8

Epson does not provide driver for Windows 8.x 64bits.
As I did for Ubuntu (http://doc.ubuntu-fr.org/epson_c1750), the Xerox Phaser 6000B has similar characteristics. So I managed to find a proper driver here:

http://www.support.xerox.com/support/phaser-6000/downloads/engb.html?operatingSystem=win8x64&fileLanguage=en_GB

direct download

http://download.support.xerox.com/pub/drivers/6000/drivers/win8x64/en/Phaser_6000_Win8_v2.6.6.0_GDI_x64_English.exe

Once I installed the driver, I force to select manually the driver for the printer, choosing Xerox Phaser 6000B and then renaming the printer to Aculaser 1750N for convenience

Windows 8 get current bios version

To know whether I needed to updated my lenovo yoga 13 bios without rebooting, the command that worked now on windows is:

wmic bios get  manufacturer, smbiosbiosversion
which displays:

Manufacturer  SMBIOSBIOSVersion LENOVO        66CN55WW

Add gradle to Ubuntu 13.10 for Android

Installing gradle using 'sudo apt-get install gradle' was not working for me (libnative-platform-curses.so: undefined symbol: tgetent)
So I decided to install from http://www.gradle.org/downloads

My install path
/opt/apps/gradle
My Android install path
/opt/apps/android-sdk-linux
The command to get it ready

# oncesudo ln -s /opt/apps/gradle/bin/gradle /usr/local/bin/gradle # in my .bashrcexport GRADLE_HOME=/opt/apps/gradle export ANDROID_HOME=/opt/apps/android-sdk-linux/

Add linux command without modifying PATH

Often I install stuff that I want to use on the command line that would require modifying the PATH variable. An alternative is to symlink the command wanted to /usr/local/bin (or whatever bin folder already in your path)

Example for gradle (install using apt-get was not working on Ubuntu)

sudo ln -s /opt/apps/gradle/bin/gradle /usr/local/bin/gradle export GRADLE_HOME=/opt/apps/gradle
The command is then accessible in any script that use the hash bang #!/usr/bin/env

#!/usr/bin/env gradle

Change Mac OS hostname

The hostname command was still displaying 'pc14.home' although I did change it in the System Preferences | Sharing panel where it was name 'myimac.local'.

Using:

sudo hostname myimac only changes it in the current shell

The solution I found to change it for good is to use

sudo scutil --set HostName "myimac"

Fix Ubuntu 13.10 Ethernet after Suspend/Resume

Thanks to http://www.webupd8.org/2013/01/fix-wireless-or-wired-network-not.html
Find the network driver using the command

$ lshw -C network
which gives something like:

*-network description: Ethernet interface product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:04:00.0 logical name: eth0 version: 06 serial: 90:2b:34:12:e0:14 size: 100Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=192.168.1.20 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s resources: irq:46 ioport:d000(size=256) memory:f0004000-f0004fff memory:…

Install Sass on Ubuntu for Dart

Finally I choose to use a css pre-processing tools. Regarding the choice SCSS vs LESS, I chose SCSS after reading some blogs. (dartlang site is using sass, sass can generate map debuggable in chrome).
sudo apt-get install ruby1.9.1 sudo gem install sass I did not use the watcher but simply modify my build.dart file to process scss file when changed changed.forEach((filename) { if (extension(filename) == ".scss") { Process.run("sass", [ filename, withoutExtension(filename) + ".css" ]); }; });

USB Foot Switch II - "Usb HIDKB Not connected"

I recently bought a USB Triple Foot Switch II from Scythe. Unfortunately the provided software did not run on my Lenovo Yoga (windows 8 - 64 bits). as I was still getting "Usb HIDKB Not connected". Fortunately I did find an alternative solution here:
http://www.scythe-eu.com/forum/other-accessory/4455-alternative-driver-footswitch.html

With the software accessible here:
http://home.roadrunner.com/~jgglatt/midi/software/pedal.zip
which I copy here in case it disappear as I did not find the original post regarding this alternate solution


Switching workspace using DartEditor

DartEditor always uses the ~/.DartEditor workspace location, as it can be seen in the .ini file in the -data parameter. This becomes a pain when you have a lot of active projects as loading projects is a pain.
You can however use a specific directory by overriding the option in the command line. This allows having projects and dependencies ready to use:

Examples:

DartEditor -data ~/workspaces/myproject1
DartEditor -data ~/workspaces/myproject2

Tizen debugging good practice

Setup: Ubuntu 13.04 and Tizen 2.2

Tizen emulator seems to be quickly messup when an application crashes. You end-up with error like "Cannot launch application with GDBClient" the next time you try to debug it.

Some voodoo tricks strictly personal

Make sure you have no debugging in progress in the Debug perspectiveUse Run-as explicitly before running/debugging again (of course if it crashes, you'd better comment out the offending code before running and set it again before debugging)Make sure you have the proper project highlighted in the Project ExplorerDebugger does not like macros sometimes and doing F5 (step into) or F6 (step over) might simply report a wrong exception. So put a breakpoint either after o inside the function being called by the macroDebugger does not like some objects or methods. I remember having problems with ArrayList sometimesSometimes restart the emulatorSometimes simply wait...Sometimes pressing the Home button after debugging helps (well that sou…

Getting Tizen Source Code

(from http://seoz.egloos.com/3913161)
Create an account at https://www.tizen.org/ Get repo from Google curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod +x ~/bin/repo Personnaly i added it to my path so that I can use repo directly
Download the source code using repo Create a dir where to put the source. It takes a while (about 20GB!)

mkdir tizen-src cd tizen-src repo init -u git://gitorious.org/tizen-toys/tizen-manifest repo sync
I guess I did other setting regarding ssh access as I used repo when getting android source code...

Getting the proper branch

Currently, this works for tizen 2.2

repo forall -c 'git checkout tizen_2.2'

Eclipse Stuck at "Android SDK: Resolving error markers"

My workspace has a lot of project and I could not open it anymore (stuck at resolving error markers). Too much a pain to re-create a new one...
The solution that worked for me with Eclipse 4.2 was to delete all files names .markers in the workspace folder (typically one per project and one for root):

cd [my workspace folder]cd .metadata find . -name .markers -exec rm {} \; eclipse -clean -refresh

Host static web site on Google Cloud Storage

A few steps, base on https://developers.google.com/storage/docs/website-configuration

Register a domain name, for example, mydomain.comGo to https://www.google.com/webmasters/tools/ to verity the domain ownership. Typically I create DNS TXT (Follow alternate method, then Domain name provider) to end-up adding something like that:[blank] IN TXT "google-site-verification=MjSLfpPhbuQqEVdNjx9qlzMmtX5oZdvgShdBLn-Nhik"Create a bucket with the [subdomain.]mydomain.com name (subdomains are optional)push 2 simple files to it (index.html, 404.html)Configure the bucket as a web sitesetwebcfg -m index.html -e 404.html gs://subdomain.mydomain.comIn your DNS create a CNAME aliases of c.storage.googleapis.comsubdomain IN CNAME c.storage.googleapis.com VoilĂ 

Get old/newer version of Dart SDK and Editor

While pub is ok to select packages that works with an older SDK, there are sometimes cases where public packages are not updated to work with the latest SDK. You're then stuck as dartlang website does not offer to download older version.
However older version are available here:
http://gsdview.appspot.com/dart-editor-archive-integration/

Continuous build are available here:
http://gsdview.appspot.com/dart-editor-archive-continuous/latest/

Install nodejs on ubuntu

When installing nodejs on Ubuntu 12.10, it was not working right away

sudo apt-get install nodejs npm I had to add a link to have 'node' (and not only nodejs) in my path

sudo ln -s /usr/bin/nodejs /usr/local/bin/node

Install & run jshint on the command line

For ubuntu/linux, assuming you have nodejs installed
sudo npm install -g jshint
Then run jshint on your javascript file
jshint yourjsfile.js

Find text in files script

Unix


find . | xargs grep 'my text' -sl


Hostgator SSH "Too many authentication failures"

Recently I was facing issue using regular ssh connection (no public key auth) to hostgator using the command

ssh myname@mysite.com -p 2222 > Too many authentication failures for myname
This is the command to use when you want to enter login/pwd:

ssh myname@mysite.com -p 2222 -o PubkeyAuthentication=no

Prevent Wordpress on localhost to ask for FTP credentials

In my local wordpress install on ubuntu (12.10), wordpress was always asking for FTP credentials (and not on my windows 7 box) when installing a plugin or updating wordpress from the Dashboard. Here are the steps that works for me to fix that:

cd /var/www sudo chown -R www-data:www-data wordpress

Mercurial in Eclipse Juno