A site devoted to discussing techniques that promote quality and ethical practices in software development.

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 30, 2014

Worthy Pdf readers in Linix Mint/Ubuntu

There are plenty of questions on the Internet asking whether there are any PDF Readers (free of course) for Linux that have more capability than the one that is packaged with Ubuntu/Mint, the Evince, that allow the users to annotate and highlight the materials.

Adobe Reader 9 can do this provided that the document contains a policy allowing the users to comment and annotate. In the absence of such a policy, this reader defaults to denying such capability.

There does not appear to be any native Linux PDF readers that can do this. Some such as Okular can do highlighting etc but they are stored in their private format that only the viewer that created it could display them. Hence their annotations are not shown in say Adobe Reader. Therefore this class of viewers are considered not supporting the annotation and highlighting requirements.

As a last resort, I am using 2 Windows PDF viewers running in WINE in Mint/Ubuntu. They are PDF XChange Viewer and FoxIt Reader.

At the time of writing, I have uninstalled "PDF XChange Viewer" because in Mint-64 bit, it consistently crashed the reader when I was switching documents in the tabbed view of the reader. My experience is also supported by reported behaviour in the WineHQ. It is ashamed that it misbehaves in this manner. The other problem with this is with the display when scrolling the document. However, one can alter the display settings to prevent this.

While FoxIt Reader also has a native Linux version, it is a very basic reader similar to Evince that does not do annotation and highlighting. Consequently, this is not used. Instead FoxIt Reader version 6.1.2.1224 is installed with the support of WINE.

So far, it behaves well with the only exception that it fails to account for the height of the task bar in Mint when one maximizes the FoxIt window. As result, the navigation bar is partially covered.

The other issue which may unsettle some is the automatic installation and activation of the FoxIt cloud plug-in and the Reader does not have an easy way to uninstall this plug-in.

To disable this plug-in, close the FoxIt Reader and use the following steps in Mint/Ubuntu:
1) Bring up the File explorer, Nemo or Nautilus
2) Press Ctrl-H to view hidden file
3) Locate the Windows system tools in WINE installed directory which is by default located here:
~/.wine/drive_c/windows/system32
4) Then use the "Wine Windows program loader" to load Control.exe, the Windows control panel program and you should see a window like this:
5) Double click on "Add/Remove Programs" to start the program.
6) Locate the item called "Foxit Cloud" and uninstall that program item.

Next time you start FoxIt Reader, you will not see the "FoxIt Cloud" menu item. I only wish FoxIt would offer a more user-friendly way to disable it and also seek user's consent before activating the plug-in and FoxIt cloud.


Saturday, August 17, 2013

Comments and Caveats in using Portable GPG Shell - gpg4usb

At the on set, let's me congratulate the developers in Gpg4Usb for releasing a very useful GPG shell that is portable in Windows and portable in a sense in Linux. The same distribution can run in Windows and in Linux, with some caveats as discussed below.

You can download a copy from here and unzipping it into a folder in Windows or Linux and you can immediately use it by running the program start_windows.exe. In Linux, you start the program by launching the start_linux program.

While it cannot do all the stuff that Gpg4Win can do in Windows, the beauty of Gpg4Usb is that it is self-contain and can run off the USB drive in any Windows without Administrative Privilege. It carries a copy of gpg.exe for Windows and gpg for Linux in the bin folder. The keys, using the standard format used by gpg.exe, are kept in the keydb folder.

Since there is no special treatment needed to get this program running in Windows from your local hard drive or your USB drive, let's move the discussion onto running this from Linux.

Through no fault of this program if located on USB drive, the default way of mounting the USB drive in Linux forbids one to execute any binary from such a device. Hence it is not as portable as in a Windows environment where there is no such restriction.

Without root access, the only viable option is to copy the gpg4usb folder onto a local drive (into the home folder if you like) from the USB drive. If you have updated any keys while using this program directly from the USB drive in Windows, all you have to do is just to update the gpg4usb/keydb folder on your local drive. Once you have done that, the following caveats apply:

1) Make sure you change the file permission of the following files to have executable permission:
    gpg4usb/start_linux
    gpg4usb/bin/gpg

Failure to do so will not launch anything and there is no crash message. If you simply give gpp4usb/start_linux executable permission, in a 32-bit Linux, the program will start but you will not see the keys in the key store. This is because the program fails to launch gpg4usb/bin/gpg necessary to retrieve the keys.

2) In a 64-bit Linux you need to ensure that you have 32-bit binary support. In Debian/Ubuntu derivative distro, such as Mint, you need to use the Software Manager to install the package ia32-libs-multiarch.

Without that package the program will not start even if the Caveat 1) above has been applied. I would recommend to try to run the program after applying the changes mentioned in caveat 1) first just in case some other 32-bit program may have installed the 32-bit support for you.

This program, despite the above caveats in Linux, is a competent replacement of GPA that is not longer supported and even KGpg.

Friday, June 7, 2013

Caveat to customise Ubuntu locale for Ubuntu Thunderbird

Further to my post on how to customise the locale in Ubuntu and my suggestion to use the following format:
     xx_YY.CHARSET@extra

as a way to provide customised locale settings without replacing the system's.

Unfortunately, Ubuntu Thunderbird (ver 17.0.6) cannot handle the above mentioned convention even though Ubuntu can comfortably handling this.

By way of experimentation, I have discovered that it appears that Thunderbird picks up the local specifier in the LC_* environment variables and drops the part from @ onward and then using that as the locale specifier to load the locale settings.

So for example if you customise say English (Hong Kong) and name the customisation where you change the time/date format as en_HK@test and then you select this in your Regional Formats. When Thunderbird loads up, it will pick up the specifier en_HK.utf-8@test but it will only use en_HK.utf8 to load up the appropriate locale settings thus ignoring your customisation.

Hence if you want to correct the locale for Thunderbird, the only way is to replace the system file.

Way to customise Ubuntu locale settings

What started me on the journey to examine how to modify or customise the locale settings in Ubuntu began with a very trivial matter. I moved my Windows Thunderbird to Ubuntu Thunderbird.

Although the regional settings for my Ubuntu is already set to English (Australia), en_AU for those familiar with locale language, the time is still showing in 24 hours format. In Windows, the default is in 12 hours format and it is customarily in Australia to use the 12 hours format. I don't know how Ubuntu has got that wrong!

Hence the quest to correct this which turns out to be a major exercise diving into the bowel of Linux's way of dealing with locale wasting me several days for something we could do in seconds in Windows. At this point, I fully sympathise with Miguel De Icaza of his reason to move over to Mac OS.

There are no shortage of rants on the Internet about how primitive Linux/Ubuntu in catering for this not unusual customisation with some GUI support. Even if none, at least it should be better documented so that user can follow the steps. Unfortunately, the Internet is also fully of advices which range from working in some situations, or brute force work around, to some simply does not work any more.

This post is not to add more rant to an already heapful but to outline the steps one needs to go through to customise and here are the steps:

Step 1 - Identify the locale definition file you want to modify

If you are unfamiliar with way Ubuntu specifies locale information, you can visit this page.

In Ubuntu and other Linux, the locale formatting specification is based on the C-Library's strptime() specification. The same list of format specifiers can be found in the man page of date.

The specification for the locale is then stored in text format as locale definition file and one for each locale. They can be found in /usr/share/i18n/locales and the binary version is then recorded in an archive somewhere else.

So the first step to do that is locate the locale definition file in this directory. It is also a good practice to store your customised version here too.

Step 2 - Customise the setting(s)

Before you modify the settings, you can use the following command to view the format of items, for say the time/date display, of your locale:

      locale -ck LC_TIME

You can also use the same command without any parameter to view the current locale settings. We will come back to how they are specified in which file.

I assume that you are familiar with the syntax in the locale definition file. If not, you can study the precise definition here.

Identify the items you want to customise and as a good house keeping task make sure you change the file's:
  • Title to reflect that you have changed something
  • Change the version number, say from 1.0 to 1.05
  • Change the date.
This helps later on, particularly if you want to replace the existing locale definition with your customised version. More on this.

Step 2.1 - Decide how to use your change

Before you save the changes into the file, you need to decide what you want to do:
  1. Replace the existing locale with your customised version - this will impact on the system as well as per-user. Simply use the same file name.
  2. Keep your customised locale separate from the one you based on and you can then choose to apply this system-wide or on per-user basis. You need to save the changes to a different file name.
If you decide to use strategy No. 2, you need to understand the locale file name convention which is of the form:

    xx_YY@extra

where xx is the ISO-639 language code and YY is the ISO-3166 country code. The @extra is the bit that allows you to identify your customisation. Normally @extra is not used.  When you compile the locale definition file, that is the next step, you then specify the character set used in definition in the following convention:

   xx_YY.CHARSET@extra

where the CHARSET can be UTF-8, ISO-8859-1 or ASCII.

In my case all I want to do is to display time in 12 hours format and hence I modified the t_fmt and d_t_fmt as follows:
%
% Change "%T" to "%r"
t_fmt       "<U0025><U0072>"
%

% Change "%T" to "%r"
d_t_fmt     "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0072><U0020><U0025><U005A>"

I also want to retain the system deployed setting and introduce my customisation as such. Hence I name my file as en_AU@mod.

Step 3 - Compile the locale definition file into the locale archive

This can be accomplished with the localedef command with super user privilege and the locale archive by default is located in /usr/lib/locale/locale-archive. This is a binary file but whose contents can be listed by using the following command:

     locale -av

To compile my customisation and to install it into the locale archive, I use the following command (assuming your current directory is in /usr/share/i18n/locales, the directory containing your modified definition file):

   sudo localedef -c -v -f UTF-8 -i en_AU@mod en_AU.UTF-8@mod

If you are replacing the system deployed file with your customised version, use the following variation:

   sudo localedef -c -v -f UTF-8 --replace -i en_AU en_AU.UTF-8

To verify your changes have been successfully installed into the locale archive, you can use the above mentioned locale command. This is where it will save you time if you have followed the above mentioned house keeping recommendations as your modified title/version/date are become evident.

If you are replacing the system deployed file with your customised version, all you have to do is to log out of your session and log back in.

You can use locale -ck LC_TIME (or whatever setting you have changed) to see if your customisation are compiled correctly.

Step 4 - Introduce your change on per user basis

You can select your customised locale definition by using the Ubuntu's Regional Formats in the Language Support applet or fondly known as gnome-language-selector. If you have named your customised definition file appropriately, it will show up in the list like this:

All you then have to do is to select that (as circled in red). Close the dialog and log out and log in to bring that into use.

What actually happens behind the scene is that it modifies or creates the ~/.pam_environment file that records the locale settings meeting your selection. This file is not there unless you have change the Regional Formats. In my case the LC_TIME becomes:
    LC_TIME=en_AU.UTF-8@mod

If you want to apply your change to the system, you simply modified the /etc/default/locale file.

Tuesday, May 21, 2013

Android is like the Windows XP days with little regards to user's protection

Months ago, I made a statement to my friends that effectively compared Android's operations or lack of security to the days of Windows XP and prior. The open neglect seems to follow the same excuse Windows use to make it easy for people to use. Now my observation is supported,
The Android threat landscape is starting to resemble that of Windows, according to F-Secure's Mobile Threat Report 
The Android threat landscape is growing in both size and complexity with cyber criminals adopting new distribution methods and building Android-focused malware services, according to a report from Finnish security vendor F-Secure.
The number of mobile threats has increased by nearly 50 percent during the first three months of 2013, from 100 to 149 families and variants, F-Secure said in its Mobile Threat Report for Q1 2013 that was released on Tuesday. Over 91 percent of those threats target the Android platform and the rest target Symbian.
What frightens me most and at the same annoying me is that when you install most applications, they demand access to your account, your phone, or other facilities that do not seem to be related to what the main function of the applications.

For example, I once wanted to install a PDF viewer and it demanded permission to access my phone contacts, etc. I have yet to see a PDF viewer in Linux/Windows demanding access to my Outlook or Thunderbird phone book, or my Google account. After all, it is just a program to render the PDF document and all it really need is read access to certain area where the document is held.

Then the other date I want to install a GPS logger but it too needed my Google Account, phone Contacts, phone logs, etc. Why? Is it just a program to jolt down the GPS location regular interval or on demand? All it really requires should be write access to the user's area and no more and no less.

If application demanding this kind of unnecessarily access of elevated privilege or to areas in Windows and Linux, they will be exposed as Trojan or Malware. But in Android, a form of Linux, it is an acceptable practice. Why?

As a result, I often do not install those applications that demand unreasonably access.

The only way to fix this rampant neglect of security is to turn everything off and then allowing the user to enable/disable access relating to features user requires. Ultimately it should be the responsibility of the phone owner. At the moment, the big switch is just too wide much like Windows XP where most people were using it without security.

Thursday, August 30, 2012

Experience in searching for free UML tool, continue.

Since my last post on the search of UML tools, I have added Gaphor to the list.

I am surprise so many of these so called UML tools are not really doing UML at all. UML is a very precisely specified modelling language and yet these tools at best are nothing more than glorified drawing tools.

Some like Dia does not inter-relate the diagrams and artefacts. Gaphor does not even have anything to specify if an operation is abstract or virtual.

None of them (the free ones) provides any way for a derived class to override a base class' virtual function. Or automatically implementing an interface without laboriously defining them yourself.

In Umbrello and Modelio I have to use copy-and-paste. Because the Umbrello UI is more useful than Modelio, the operation is not too bad for small size class/interface. Umbrello does not seems to have any syntax for an operation to return an array.

Modelio has something that resembles allowing user to override but half baked and I am not sure Modelio's calling it 'redefines' the same as override?

Many of these tools are not using standard vocabulary as prescribed in UML other than the visual part. Why not?

After using Modelio and Umbrello to develop a fairly large model to test these two that are better than the rest of the crops, it is hard to say one is significantly better than the other.

I must say Modelio is a very clumsy program to use and is very frustrating doing a quick modelling. It is one that seems to impose its own vocabulary rather than using UML standard.

Umbrello is much easier and quicker to operate but drawing the sequence diagram is a real challenge of one's patience and tolerance of its quirky operations. Modelio handles this relatively better and with more support.

If Modelio has a more convenient way to allows the derive class quickly to override base class operations, then it is definitely a winner. Interestingly this feature is found in Microsoft's Visio and the once free BoUML.

The search for the idea free UML tool continues ....


Friday, May 4, 2007

Microsoft's UAC & Sudo

Mackenzie recently blogged about the history of Sudo and the similarity to Vista's UAC
What makes this whole thing funny, though, is something I saw a couple days ago. Head over to Builder-AU and listen to Peter Watson from Microsoft. He says, User Account Control is a great idea and strategically a direction that sort of all operating systems and all technology should be heading down Excuse me
My brief encounter with Ubuntu and the chanced encounter of the dialog box seeking my root password stunned me of the close resemblance to ME II's UAC.

Sunday, April 29, 2007

A long journey to meet the Penguin

Since I have lost interested in Windows ME II, alias Vista, and totally disgusted with their activation scheme and DRM turning the OS literally into a Police outpost, I have decided to turn my attention to something differently. I have decided to re-acquaint with my long lost friend that I began my computing career in.

I have heard so much about Linux and how little resource it demands to run; it is free (that is what OS should be) and that it has a much stronger security system (a fact that has been questioned); Linux is a strong contender to ME II. So I have decided to check out UBuntu, a distribution or variant of Linux.

Below is my experience of meeting and installing UBuntu:

I happen to have an old discarded Laptop, a Toshiba Satellite 1800 Series with a Celeron 800 and 256M of RAM lying around with Windows XP Pro installed into it that I can use to check out Linux, since UBuntu supports multi-boot option.

Well, it is an old machine but I have been told that Linux does not require much to run. So it sounds like a perfect machine to test Ubuntu out. I am sure ME II will choke on this specification.

The first attempt used a downloaded CD image of the desktop version 7.04. I popped the CD into the machine on Wednesday evening and naively believing that I could use it to config an ADSL modem. How wrong was I.

The Ubuntu Live CD fired up reasonable quick, not without drama, allowing me to experiment with the OS. When it was booting up the graphical environment, an error message box popped up complaining GNOME Settings applet could not start, etc. All I could do was to close it. Some how it did not hold back the starting process.

It looks very nice and the graphical interface was definitely not in the Unix I cut my teeth in in learning C programming back in the '70. It's a nice addition.

Running totally from the CD was really painfully slow and you can hear the poor drive going crazy. So I decided to bite the bullet and to install this onto my hard drive, which still had 6-7G spare. This was the beginning of the fun bit revealing the not so polished side of Ubuntu.

I opened the Install applet on the desktop. For a period that felt like eternity and was indeed eternity in computer time, the CD Rom drive went berserk zipping back and forth lights blinking and all the screen was showing was a frame with the title "Install." After more than a hour or so, a list of locales beginning to appear in a combo box but more were to come.

Not knowing what lied ahead and I was not totally comfortable of risking the machine at that moment, I aborted the installation, an action I regretted. The installation process did not have any instruction on aborting it and shutting down. So I simply powered down the machine forcefully. For some reasons, I did not see the red button on the top right corner of the screen that was designed used to power down.

From that moment on, I could not recover that list of locales. It's strange that running the installation from a CD Rom should guarantee that no previous installation state was recorded but somehow, there were variations between each attempt, indicating something was recorded but in where? In some attempts, I left it ran for hours and all I saw was a frame with nothing in it. It's not a freeze by any definition because the CD was still being read on and off. One had to wonder what it was doing. Some progress message would be greatly appreciated. It couldn't be just reading that hundred or so locale names. Some attempts encountered error with the message complaining about failure to load the paned "OAFIID: GNome_MixedApplet".

After so many failed attempts, I suspected the image might be faulty or the machine could not tolerate version 7.04. So I tried the version 6.06 (alternate).

This ISO image produced even far worse outcomes. It froze my machine trying to populate the list of locales consistently. It might be doing some memory scanning or something but definitely no CD drive activities and no hard disk activity. I had even left it "ran" for hours just for curiosity.

After several attempts, I gave up on this and was even considering trying XUbuntu as it's for lower spec machines. Before doing that, I decided to give 7.04 one final attempt using the "alternate" ISO image. I had no idea what "alternate" meant and I also selected the download for machines with less than 256M, which sounded more suitable for my machine.

This ISO image differed from the other in that it did not start Live CD. It jumped straight into installation mode - in text mode. The best parts were that it was fast and informative comparing to the graphical installation.

I was a bit apprehensive when it guided me through in resizing the NTFS partition and in creating the new one. The on screen message was not clear enough. What the heck? It's a late Friday night and soon into Saturday. So I went ahead.

It finally completed the installation and after removing the CD from the drive, I pressed the button to reboot. Instead of coming up with the familiar graphical screen, after displaying some messages that quickly vanished, I was staring at the black screen with no disk activity and no progress message.

I thought that was frozen, so I forcefully shut it down. When it restarted, it went through some recovery process akin to NTFS' Chkdsk /F . When that was completed, the same black screen came back. Once again I powered it down. On the next reboot, I decided to play with it and ran the memtest. This went through some lengthy tests and after completed one full cycle, I decided to reboot.

Not knowing what would come next, I went to do something else. When I returned to the Toshiba, the Ubuntu log in screen awaited me. Finally success and the Penguin was there to welcome me!

One of my first missions was to check out the command prompt, being a keen command line practitioner, and it's now called the Terminal. The next was to determine what kind of privilege I was given. The installation screen should advise me that I have been give root access rights. I only discovered this on the Ubuntu web page.

While I was exploring this, I stumbled onto some panel that required elevated privilege and I was challenged. This is very similar to the ME II's UAC . The only difference was that I was required to supply the password in Ubuntu, even when I have root access rights but in UAC I would only be required to select the accept button on the consent box.

I began to feel confident and tried my luck in pinging the Internet. No such luck. It turned out that Ubuntu did not recognise my old PCMCIA network card, a Xircom RealPort2 card. So now, I have the most secured Ubuntu in the world and I was happy of progress so far.

Many of my failed attempts might be the result of lack of communication from the installer. Definitely the installation program was not as slick as that from Microsoft. There is room for improvement. But I can put up with that since it's free and it did not treat me as a thief by constantly asking effectively "prove to me that you bought it", the most offensive customer treatment that Microsoft has ever invented.

What I saw impresses me and it's now time to explore - a spirit I have lost, for the first time, on any Microsoft OS, particularly the ME II.

Sunday, February 25, 2007

Road map from Windows to Linux

Sick of being restricted of what you can and cannot be done with Vista and sick of having to buy special hardware to run Vista, perhaps this road map from Windows to Linux may be just what you need.

The draconian restriction of not allowing the cheaper version of Vista to be installed in virtual machines is cleanly mad.

Blog Archive