My Octopress Blog

A blogging framework for hackers.

If windowSoftInputMode Does Not Work

| Comments

Activity has an element windowSoftInputMode to interact with a on-screen soft keyboard.

There are many suggestions How to adjust layout when soft keyboard appears, but sometimes it does not work.

Why?

Because we set it at AndroidManifest.xml.

1
<activity android:windowSoftInputMode="stateVisible|adjustResize" . . . >

But if we use a theme in our application this property is overrided:

1
2
3
4
5
<style name="Theme">
...
        <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>
...
</style>

Hence we need to override it in our theme:

1
2
3
<style name="NameActivity" parent="@android:style/Theme.Holo.NoActionBar">
     <item name="android:windowSoftInputMode">adjustResize</item>
</style>

After we can use it at AndroidManifest.xml:

1
<activity android:theme="@style/NameActivity" android:name=".NameActivity"/>

Texet TB-138

| Comments

Приобрел все таки эл. книгу с большим 8” экраном - Texet TB-138.

Выяснилось, что внутри Android 2.3.1. Да еще и процессор быстрый: Rockchip rk2918 (Cortex A8, 1Ghz)

Не знаю по каким причинам производитель не пишет, что внутри Android и можно ставить свои приложения, но я бы сразу купил и не нужно было бы изучать firmware update с сайта призводителя

Вот параметры процессора, разделы flash и состояние памяти:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cat /proc/cpuinfo 
Processor   : ARMv7 Processor rev 2 (v7l) 
BogoMIPS   : 101.94 
Features   : swp half thumb fastmult vfp edsp thumbee neon vfpv3 
...
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 
102000 
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq 
102000 
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq 
1008000 
...
df 
Filesystem             Size   Used   Free   Blksize 
/dev                    87M    32K    87M   4096 
/mnt/asec               87M     0K    87M   4096 
/mnt/obb                87M     0K    87M   4096 
/system                178M   178M    31K   1024 
/data                  503M    51M   451M   4096 
/cache                 112M     5M   106M   1024 
/mnt/storage             2G    18M     2G   8192 

cat /proc/meminfo 
MemTotal:         178836 kB 
MemFree:           11908 kB 
Buffers:            3288 kB 
Cached:            53212 kB
...

Режим отладки включается легко: нужно нажать на кнопку MENU в Настройки/Информация. И после этого можно подключаться по adb.

How to Enable Android Incremental Build in Idea

| Comments

Modify dx.jar to enable incremental build by default

  • Create directory adt-bundle-linux-x86_64/sdk/platform-tools/lib/incremental
  • Download com.android.dx.command.dexer.Main class
  • Set default value of incremental field to true
1
2
3
4
938c938
<         public boolean incremental = false;
---
>         public boolean incremental = true;
  • Compile the class and repack dx.jar
1
2
javac -target 1.6 -source 1.6 -cp ../dx.jar -d classes Main.java \
  && cd classes && jar uf ../../dx.jar *

Disable deleting classes.dex in Intellij Idea

In the AndroidDexBuilder class remove outFile.delete() statement and rebuild android-jps-plugin.jar.

The simplest way to do it replace delete string with exists in the AndroidDexBuild class in the idea-$VERSION/plugins/android/lib/jps/android-jps-plugin.jar archive.

EPD Controller

| Comments

Как сделать книгу на электронных чернилах своими руками.

  • Купить один из PVI-дисплеев на aliexpress
  • Приобрести модуль EPD-контроллера S4E5B001B000A00 digikey или mouser
  • Разьем для шлейфа http://ru.farnell.com/ffc-fpc

http://wenku.baidu.com/view/187d53956bec0975f465e245.html http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720

http://electronics.visionect.si/products-hardware/epaper-modules/epd-controller-module/ http://www.arm.com/community/partners/display_product/rw/ProductId/6494/ http://podpiram.si/products-hardware/epaper-displays/6-pearl-epd/ http://podpiram.si/products-hardware/epaper-displays/97-epd/

Mysql-profiler

| Comments

CentOS 5 - oprofiler

1
2
3
4
  yum install oprofiler
# run program
  opcontrol --stop;  opcontrol --reset; opcontrol --callgraph=8; opcontrol --start; \
    opcontrol --status; sleep 5; opcontrol --stop; opreport -l | less

example report

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
opreport -l --threshold 1
warning: /no-vmlinux could not be found.
CPU: Intel Core/i7, speed 2128.05 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (No unit mask) count 1000000
samples  %        app name                 symbol name
16787     6.6447  mysqld                   ut_delay
15902     6.2944  no-vmlinux               /no-vmlinux
14975     5.9275  mysqld                   insert_events_waits_history_long(PFS_events_waits*)
9605      3.8019  mysqld                   get_thread_mutex_locker_v1
8388      3.3202  libc-2.5.so              memcpy
8308      3.2885  mysqld                   buf_page_get_gen
7220      2.8579  mysqld                   rec_get_offsets_func
6662      2.6370  mysqld                   mutex_spin_wait
6409      2.5369  libc-2.5.so              _int_malloc
5714      2.2618  mysqld                   cmp_dtuple_rec_with_match
5173      2.0476  mysqld                   end_mutex_wait_v1
4083      1.6162  mysqld                   pfs_mutex_enter_func
3339      1.3217  mysqld                   btr_cur_search_to_nth_level
3268      1.2936  mysqld                   get_thread_rwlock_locker_v1
2961      1.1720  mysqld                   page_cur_search_with_match
2761      1.0929  mysqld                   sp_instr_stmt::execute(THD*, unsigned int*)
2647      1.0478  mysqld                   mtr_commit

Stm32-servo

| Comments

Начинаем делать

http://thingiverse-production.s3.amazonaws.com/renders/d0/f3/fa/6c/79/_MG_5060_preview_featured.jpg http://www.thingiverse.com/thing:34829

Код для stm32vldiscovery https://github.com/evsinev/stm32-servo-arm

References