Thursday, November 20, 2014
3 days using Android Lollipop on Nexus 5
Well, I waited not long after, the OTA came and I quickly installed the upgrade (Nov 18). The new GUI does not really impress me, but so long as it does it job, I am fine with it. But compare with the older one from KitKat, I like the KitKat one more.
The new clock application use current time to change its background color, that annoying me greatly, and it has no option to turn that off! It may look nice on the presentation, but it give no value to me. I like to look at the clock on a black background! The layout of the international clock changes to a list from the 2 column layout in KitKat. I think the 2 column layout give me a better presentation.
Browser tabs, I could not find the handle of tabs in the browser, I did not recall I had allowed the browser to merged tabs with apps. Well, at least this time I have a setting to turn "Merge tabs and apps" to off.
The battery saver mode is fine. But why should it insist to change the status and home buttons bar to orange background? With the battery saver icon on the status bar, it is already obvious, why on earth change those background color? I know what I am doing, and does not need such thing to remind me I am in battery saver mode. And no option to turn the color change off.
For media video playing, the volume control button no longer work as expected, instead, I have to click on the button, then tap on the speaker symbol to get sound changes, and dragging on the sound meter bar no longer work. This is really bad engineering.
Skype could not login any more after upgrade to Lollipop, even upgrade to the latest version. One commenter said it needs to be removed and re-install, I follow suite, it could log in again and skype test call works ok, I haven't try the video call yet, will see.
Lollipop defaults to use white background, it hurt my eyes. The color theme of KitKat looks more comfortable to the eyes.
Except those complains, so far so good, the battery usage maybe improve a little, but hard to tell for I am a light user, will see for a longer period of usage.
Wednesday, November 19, 2014
Simple EC CA script for use with OpenSSL
The usage is almost the same as CA.sh, plus some EC specific commands.
ecCa.sh -h usage: ecCA.sh [-curve name] -list-curves|-newcert|-newreq|-newreq-nodes|-newca|-sign|-pkcs12|-verify
Use -list-curves to list out all the supported curves. The default CA curve is secp521r1 and default certificate curve is prime256v1.
Here are some simple step to create a EC CA and a signed EC certificate.
- Run command "ecCA.sh -newca", which will then ask you a serious of questions to create your CA certificate. You could use the default but do remember to enter a common name for the cert, otherwise you won't be able to create one. You will have a demoCA subdirectory created under the current directory.
- Run "ecCA.sh -newreq", and answer the questions, you will have a new key and certificate request with name "newkey.pem" and "newreq.pem".
- Run "ecCA.sh -sign", and follow the instruction, you will have a signed certificate "newcert.pem".
- Run "ecCA.sh -pkcs12", will create a PKCS12 formated file "newcert.p12", which could be used to import the certificate into browser.
Tuesday, November 18, 2014
Google Chrome and IPv6 literate address
When I try to access the web server at URL http://[10:10:20], the address works fine with Firefox, but Chrome give me DNS error. Why a literate address need DNS resolving? Searching around, and found a very old bug report issue 39830, it seems Chrome could not recognise my IPv6 network and startup without IPv6 support at all.
After adding the flag "--enable-ipv6" to the command line, it works again. Chrome is too "smart" to work correctly on my network.
Thursday, November 6, 2014
Run fcgiwrap with nginx under Slackware
Fcgiwrap depends on fcgi library, which has a SlackBuild script. I install the fcgi library with sbopkg, and proceed to write a SlackBuild script for fcgiwrap. The fcgiwrap is a very simple program, it has only one C file for the main program. But it needs a spawning parent to control it, the author provide a simple perl script (on the main page of the fcgirwap project.) to spawn the fcgiwrap program. I also borrow the startup script from Nginx's FastCGI example and modified a little and name it rc.spawn-fcgi. Both the scripts are included in the SlackBuild package that I have submitted.
After installing it, I add the following section into the server section of nginx.conf file:
location ~ \.pl$ {
root /var/www/cgi;
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/cgi.sock;
}
After started the spawn-fcgi and reload nginx's config, the perl CGI works without problem.
Tuesday, November 4, 2014
OpenVMS got a new life
On July 31, 2014, HP and VMS Software, Inc. (VSI) announced, VSI has entered into a license agreement with HP to develop and release future versions of OpenVMS and most OpenVMS layered products (OpenVMS eco-system).
I have a hobby license (VAX/OpenVMS) and run a small installation through SIMH simulator, but I have not boot it up for quite a while, I hope I could still remember the administrator's password ^_^. My interest of this OS comes from my university days, when all students use the VAX/OpenVMS system for email or some school assignments. I thought it is so much better than the DOS used in the PC, but unfortunately there is no PC version. But then DEC was bought by Compact then by HP, but it is not treated well over these new owners and HP put its future to doom until this announcement. I think HP make a big mistake for not doing any meaningful development on it and bet its future on the dying Itanium chip.
VSI seems re-united a few folks from the original DEC team and hope it will bring a much bright future for the 37 years old OS. It seems, there will be an x86 port of the OS. Not sure when it will be finished? Would it be available for the hobby program? We'll see what come out from VSI.
Thursday, April 10, 2014
Internationalized application with Gtkada.Intl
Gtkada comes with Gtkada.Intl, which is a binding for libintl to provide support for string internationalization.
In this example, a very simple program is developed to illustrate the usage of Gtkada.Intl package.
We use the helloworld example, and modified it to support i18n. You could find all the source at GitHub.
The directory structure is similar as before, and we are using Makefile to automate some tasks.
src/intl.adb:|- Makefile.common |- intl | |- obj/ | |- src/ | |- po/ | | |- Makefile | | `- build_skeleton.pl | |- Makefile | `- generate_locale_path.sh ...
... with Gtkada.Intl; use Gtkada.Intl; with intl_cb; use intl_cb; with intl_locale; procedure Intl is Win : Gtk_Window; Button : Gtk_Button; prgname : constant String := "intl"; begin -- procedure calls to setup Locale and text domain binding SetLocale; Text_Domain (prgname); Bind_Text_Domain (prgname, intl_locale.path); ... Win.Set_Title (-"Window"); ... Gtk_New (Button, -"Hello World"); ... end Intl;Here, we call SetLocale, Text_Domain and Bind_Text_Domain to initialize the locale data. The Bind_Text_Domain procedure needs a locale path as its second parameter, as the path may change on different system, we need a way to tell the program where is the location. A script generate_locale_path.sh was created. It is called from the Makefile, when ever there is changed in the locale path, it will generate a new src/intl_locale.ads file. A sample file is as follow:
-- This is an automatically generated file during compilation -- Please don't edit it by hand. -- Generated at 2014-04-09 23:45 package Intl_Locale is path : constant String := "/usr/local/share/locale"; end Intl_Locale;Each string that is to be translated has a "-" signed in front. Messages in src/intl_cb.adb are also altered. We won't list the detail source here.
To generate the pot file, a modified version of build_skeleton.pl borrowed from the GtkAda project is used. There are a few modifications that make build_skeleton.pl works much better than the original one:
- Use the perl Text::Balanced module to capture quoted string, which will work for a case like -("Hello world (from Ada)!");. The original script will get a partial string "Hello world (from Ada".
- Use the perl Tie::IxHash module to preserve the order of message strings appear in the source file, which give translation a better view of the content near by.
- Allow spaces in between '-', '(' and '"', for the case like -   (   "Hello world 2!");, it will not be captured by the original script.
- Allow replace of Ada.Characters.Latin_1.LF to \n besides ASCII.LF
- Add translation of quoted '"' in the string to \" in -("Ada said ""Hello World!");, which will allow gettext to work correctly.
- Use command parameters for project specific information, so that it could be used on other projects without modifications.
- Change the POT-Creation-Date format to include time and timezone information.
- Only check src/ and its sub directories.
A Makefile is borrowed from the GtkAda project and simplified.
po/Makefile
LANGS:=zh_CN
CP:=cp
prgname := intl
## Refresh all translations by extracting the strings from the current sources
refresh:
./build_skeleton.pl > ${prgname}.pot
${foreach lang,${LANGS}, \
if [ -f ${lang}.po ]; then true; else ${CP} ${prgname}.pot ${lang}.po; fi; \
msgmerge --no-wrap --update ${lang}.po ${prgname}.pot}
## Install the translation files
$(LANGS):
-msgfmt -o $@.gmo $@.po --statistics --check-header --check-format --check-domain
clean:
-$(RM) *.gmo
A simple run of it under the po directory will give us a simple
pot file (intl.pot):
# Translation file for intl example app # Copyright (C) 2014 Zhu Qun-Ying # msgid "" msgstr "" "Project-Id-Version: intl\n" "Report-Msgid-Bugs-To: zhu.qunying@gmail.com\n" "POT-Creation-Date: 2014-04-10 22:29-0700\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: intl_cb.adb msgid "button clicked" msgstr "" #: intl_cb.adb msgid "button_quit is called" msgstr "" #: intl_cb.adb msgid "Delete event encounter." msgstr "" #: intl.adb msgid "Hello World" msgstr "" #: intl.adb msgid "Window" msgstr ""
We have defined a default translation language zh_CN in the Makefile, so after the make command, we also have zh_CN.po file for translation. If there is no existing zh_CN.po, it will be a copy of the intl.pot file. If there exist a zh_CN.po file and has translation, it will be merged with the intl.pot file if any changes have been made.
In order to better edit it, an editor that knows the format of the po file will ease your translation work. I am using vim with po.vim plugin.
Under po directory, run make zh_CN will compile the zh_CN.po file to zh_CN.gmo.
At the intl directory, we could issue the command:
make prefix=/usrWhich will generated the src/intl_locale.ads file and set the locale path to "/usr/share/locale" and compile the program.
Just for test, we copy the po/zh_CN.gmo to /usr/share/locale/zh_CN/LC_MESSAGES/intl.mo, then run the command:
LANG=zh_CN.utf8 obj/intlThe simple window with a button 世界你好 is shown. Click on the button, the program will exit, and you will get some output from command line:
按钮被点击 调用 button_quit
For advance usage of gettext utilities, please refer to the GNU gettext utilities document.
All the source is available at GitHub
Friday, April 4, 2014
A useful small tool - BASH History Suggest Box
One day, I was reading the updates from freecode.com. I noticed this small utility BASH History Suggest Box, it looks interesting from its screenshot:
I decided to give it a try. It is very useful, it reminds me the history window of 4DOS command line interpreter at the old DOS days.
I thought this tool is quite useful for some people, so I submitted the build scripts
for my favorite Linux distribution Slackware to
SlackBuilds.org. The build script is
not yet shown up on the official SlackBuilds.org, you could not search it yet.
It is just updated (2014-04-13), and you could now search from SlackBuilds.org or use sbopkg.
You could still download the build script
here.
P.S. There maybe segmentation fault on some system for the official 1.2.1 release,
a patched from upstream git tree is included in the build script (sigseg.patch), if you
are building for other system, you may need to apply the patch first before build.
P.P.S Updated to 1.3, and remove the unnecessary patch in the script. Should be in Willy's tree soon. Note the package name has changed from "hstr" to "hh".

