Month: July 2014

A no-ip and dyndns client for Linux

I was looking for a nice dynamic ip client to use with noip.com and found this one:

inadyn - Simple and small DynDNS client written in the C language

Then you need to edit /etc/inadyn.conf and modify some parameters:

$ sudo vi /etc/inadyn.conf

...
# Please see inadyn(8) for a complete list of providers
system default@no-ip.com #(read /usr/share/doc/inadyn/README.md for dyndns example)

# Your username
username your-noip.com-username

# Your password
password your-noip.com-password

# Your hostname. This option can appear multiple times
alias your-noip.com-hostname (i.e.: yourname.no-ip.org)

Also edit /etc/default/inadyn and change RUN_DAEMON to:

RUN_DAEMON="yes"

Finally create a symbolic link (I know, but I don’t like to use that command) to start the daemon:

$ cd /etc/rc2.d/
$ sudo ln -s /etc/init.d/inadyn S40inadyn

Then execute the command to start the daemon right now:

$ sudo /etc/init.d/inadyn start

Update: There is also the native noip2 client: http://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client/ A step-by-step installation is showed here:
http://www.howtoforge.com/how-to-install-no-ip2-on-ubuntu-12.04-lts-in-order-to-host-servers-on-a-dynamic-ip-address

A Fast and Small alternative to JSON

If your application needs to transfer data over Internet using some mobile device connected to GSM network, then using JSON or other text serializer is not a good solution. It is better to use a binary serializer.

Searching for alternatives I found MessagePack: http://msgpack.org

There are other alternatives like Google’s BufferProtocol, but it is not so efficient as MessagePack.

You can find a listing with many alternatives in the wikipedia:
http://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats

Tips to do home-made PCB boards

This is a listing of many sites with nice tips about how to do your PCB board:

This link show how to create a PCB board with industrial-like quality:
http://www.homediystuff.com/etching-diy-pcb-printed-circuitt-boards/

Tips for toner transfer method for PCB home manufacturing:
http://acidbourbon.wordpress.com/2014/04/05/pcbtips/

Many useful tips, from good PCB design suggestion to etching material to use:
http://www.electricstuff.co.uk/pcbs.html

Direct PCB printing:
http://www.pabr.org/pcbprt/pcbprt.en.html

Another site about Direct PCB printing:
http://techref.massmind.org/techref/pcb/etch/directinkjetresist.htm

Compiling Android ICS on Linux Mint 17

These are some issues I faced compiling Android on Linux Mint 17:
Error:
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
ssize_t i = indexOfKey(key);

Fix:
vi frameworks/base/tools/aapt/Android.mk

Add ‘-fpermissive’ to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

Error:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:11: note: use ‘this->SetState’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

Fix:
cd external/srec
wget “https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff”
patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../..

Source: http://blog.csdn.net/yiyaaixuexi/article/details/8330645

Also I installed these programs:

sudo apt-get install multistrap
sudo apt-get install u-boot-tools
sudo apt-get install xsltproc
sudo apt-get install libxml2-utils
sudo apt-get install openjdk-6-jdk
sudo apt-get install libc6-dev-i386
sudo apt-get install gcc-multilib
sudo apt-get install libstdc++-4.8-dev
sudo apt-get install lib32stdc++-4.8-dev
sudo apt-get install zlib1g-dev
sudo apt-get install lib32z1-dev
sudo apt-get install libncurses5-dev
sudo apt-get install libncurses-dev
sudo apt-get install libx32ncurses5-dev

Programa para gravar o numero do telefone no SIM Card

Se você está tentando pegar o número do seu telefone através da chamada:

TelephonyManager tm = (TelephonyManager)this.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE); 
String phoneNumber=  tm.getLine1Number();

Ela poderá retornar “null” ao invés do número do seu telefone, isto significa que o campo no SIM Card onde fica o número do telefone está vazio. Mais info:
http://stackoverflow.com/questions/5134398/telephonymanager-getline1number-failing

Para resolver este problema basta gravar o número do seu telefone no SIM card:
http://community.giffgaff.com/t5/Tips-Advice/How-to-add-your-mobile-number-to-your-phone/td-p/483867

Você pode instalar o app “My Phone Number” do desenvolvedor Lytsing direto do Google Play, mas ele disponibilizou o código fonte no github:

https://github.com/lytsing/MyPhoneNumber

Hacking Sharp PG-F212X projector to ignore burnout bulb

I decided to modify a projector to become a UV exposure unit to sensibilize a photo PCB (photo-resist coated PCB).

Then I bought a Sharp PG-F212X projector with burnout bulb in the MercadoLivre (“Brazilian’s eBay”). Then searched for projects replacing the bulb lamp by LEDs and found these pages:

http://www.instructables.com/id/Convert-A-Projector-To-An-LED-Light-Source/?ALLSTEPS

www.lumenarc.co.uk/forum/showthread.php?13306-InFocus-LP600-Bypass-lamp-check

Based on this page I realized that it is necessary to short-circuit the pins 3 and 4 of the opto-coupler to force the projector to think the bulb is fine. This tip is for projector InFocus LP600. Then I decided to search for the Service Manual of Sharp projector. I found it here: http://elektrotanya.com/sharp_pg-f212x-l_xr-32s-x-l.pdf/download.html

Analyzing the schematic in the service manual I discovered that the opto-coupler should be that D7715 at page 63, because it was responsable by the N-LIGHT signal.

After removing the projector’s top cover I noticed it was possible to short-circuit the pins 3 and 4 of D7715 without disassembling anything more. Then I just used the iron solder to melt solder there and short-circuit it:

optocoupler_shortcircuited

Then after powering on the projector the Lamp indicator turned green indicating that the lamp was working fine. Now the next step will be adapting a UV LED module as light source!

When to use IF or Whether

I think using if/whether correctly is a little bit confuse for latin people (/me included), because we use just a single word for both case (“se” word).

Then the rule of thumb is: use “if” when you want to introduce a condiction and “whether” when something could happen or could not.

Example:
1) If you sing, I will pay you. //Here you are introducing a condition (I will pay you only if you sing).

2) I will pay you whether you sing or not. (I don’t care if you sing or not, I will pay you anyway).

More info:
http://www.grammar-monster.com/easily_confused/if_and_whether.htm