Tuesday, September 23, 2014

Privacy Policy – Armenian Keyboard Extension

Privacy Policy – Armenian Keyboard Extension

This is the privacy policy for Armenian Keyboard Extension. It outlines what information is gathered by your device, and how that information may be used. We take your privacy very seriously; we strive to not collect sensitive information without your explicit consent, and to treat any data that you permit us to collect securely and confidentially.

Data stored on your device

The Armenian keyboard extension operates without storing any personal data on your device.

Data transmitted

The Armenian keyboard extension for iOS8 operating system does not include connectivity with any service, therefore no data transmission takes place.

Data sharing with third parties

Armenian keyboard extension  does not share any data to third parties.
This policy was last updated on Sep 23, 2014.

Thursday, October 17, 2013

Changing the default Armenian system font in Mac OS

The default Armenian font in Mac OS operation system family is Mshtakan font.

Mshtakan font example
The font is totally not readable, painful for eyes, too small characters.

There is a very nice free font called DejaVu http://dejavu-fonts.org/wiki/Main_Page. Which provides way more readable fonts.
So let start changing the default Armenian system font.

  1. Download Armenian fonts from here
  2. Install all DejaVuSerif fonts by double clicking on them or selecting the files and command + "array down"
  3. Then go to following folder in Mac OS
    cd /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources
  4. Backup DefaultFontFallbacks.plist file.
  5. Copy DefaultFontFallbacks.plist to Desktop and modify with Xcode, TextEdit or Vim (whatever editor you use)
  6. Replace Mshtakan word everywhere with desired font name. NOTE : The font name should not contain the spaces e.g. in my case is was DejaVuSerif.

Enjoy the better Armenian default system font which looks like this.
DejaVu Serif example

P.S. For those who are using the Firefox browser for internet surfing, changing the system default font will not affect display font in firefox as firefox has its own settings which should be modified like here
Changing the default Armenian font in firefox


Friday, June 22, 2012

Armenia Time issue on Mac OS X 10.6.8 Snow Leopard


As you know government of Armenia announced a decision on 1/2012 that Armenia will remain permanently on "Winter Timer". As a consequence time on Mac OS X 10.6.8 and many other operating systems like Windows, GNU Linux (Ubuntu) the time was shown incorrectly i.e. it was behind of the actual time.

My bug to Apple filed on 22-May-2012

Summary: System time is an hour ahead of the actual time.
Steps to Reproduce: Set the time to updated automatically with the time zone of Yerevan, Armenia

Expected Results: It should be like here http://www.worldtimeserver.com/current_time_in_AM.aspx

Actual Results: The system time is an hour ahead

Apple responses to my bug on 22-Jun-2012

Hi Levon,

This is a follow-up regarding Bug ID# 11507120.   

Please update your report directly at http://bugreport.apple.com for the fastest response.  Please do not email your updates.

Engineering has provided the following information:

We believe this issue has been resolved in OS X 10.7.4.  Please verify this issue with OS X Lion 10.7.4 and update this report with your results.  

Note that the configuration summary indicates the problem was reported against 10.6.8, in which case the one hour discrepancy would be expected on 10.6.8 since that release predates the Armenian government's recent  announcement (1/2012) that the country will remain permanently on "winter time". Thus in the summer months 10.6.8 systems in Armenia will always be 1 hour ahead of actual time.

This issue is resolved in recent releases of OS X that incorporate more recent changes in Time Zone Data. The latest update of OS X Lion contains a Time Zone Data update that observes the new Time Zone schedule in Armenia (i.e. permanent adoption of Winter Time with no further Daylight Savings Time changes ).

OS X 10.7.4
Posted Date:  May 9, 2012

Bug reports requiring your attention will appear under ‘My Originated Problems’.  Please review this bug report and provide the requested information via the Apple Bug Reporter at http://bugreport.apple.com.  Once your report has been updated, Engineering will be alerted of the new information.

Thank you for your assistance in helping us discover and isolate bugs within our products. 

Best Regards,

Developer Bug Reporting Team 
Apple Worldwide Developer Relations


I'm happy to inform that the issue is solved for Mac OS X Lion but still exists on running Snow Leopard hosts. I understand that the version 10.6.8 is prior to Armenia's government decision, but still there are lots of people using Snow Leopard on their Macs, and this issue need to be fixed for them, i.e. if Apple doesn't have any mechanism to fix this kind of situation for 10.6.8 system users, this will be really "pity". Anyway I and many other people will hope that this issue will be fixed in 10.6.9 update of Snow Leopard system if it ever happen.

Thursday, May 24, 2012

Quartz : Getting the diff image of two images

Suppose there are following two images the background may be totally different image, e.g. not just plain color.

Image number one
Image number two

So basically I want to get the diff image of these two images i.e.

Diffed image
The diff image of two images is the image with the same size but the pixels are set to be transparent that haven't been changed. The difference image is constructed from the diff pixels with the color from the second image

Using difference blending mode Actually if we use the difference blending mode it doesn't solve the problem as it doesn't keep right colors of the pixels. If we apply difference blend mode to above 2 images we'll get following

Difference blended image

Which seems to have inverted color but, so after inverted the colors we will get  

Inverted diff blended image
So basically this method doesn't solve the issue, so what we need is to use mask the second image where there are differences. Please find below the Objective-C code implementation of the initially setup problem.

Download link

Solution implementation with Objective-C, tested on iPhone/iPad
- (CGContextRef)createCGContextFromCGImage:(CGImageRef)img
    size_t width = CGImageGetWidth(img);
    size_t height = CGImageGetHeight(img);
    size_t bitsPerComponent = CGImageGetBitsPerComponent(img);
    size_t bytesPerRow = CGImageGetBytesPerRow(img);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); //CGColorSpaceCreateDeviceRGB();
    CGContextRef ctx = CGBitmapContextCreate(NULL, // Let CG allocate it for us
                                             kCGImageAlphaNone); // RGBA
    NSAssert(ctx, @"CGContext creation fail");
    return ctx;

- (UIImage*) computeDifferenceOfImage:(CGImageRef)oldImage withImage:(CGImageRef)newImage
    // Return the old image if the newImage is nil
    if (newImage == nil) {
        return [UIImage imageWithCGImage:oldImage];
    // We assume both images are the same size, but it's just a matter of finding the biggest
    // CGRect that contains both image sizes and create the CGContext with that size
    CGRect imageRect = CGRectMake(0, 0,
    // Create our context based on the old image
    CGContextRef ctx = [self createCGContextFromCGImage:oldImage];
    // Draw the old image with the default (normal) blendmode 
    CGContextDrawImage(ctx, imageRect, oldImage);
    // Change the blendmode for the remaining drawing operations
    CGContextSetBlendMode(ctx, kCGBlendModeDifference);
    // Draw the new image "on top" of the old one
    CGContextDrawImage(ctx, imageRect, newImage);
    // Grab the composed CGImage
    CGImageRef diffed = CGBitmapContextCreateImage(ctx);

    // Make the gray color based image black and white based
    const CGFloat myMaskingColors[6] = { 1, 255, 1, 255, 1, 255 };
    // Get the masked image consisting of black and transparent pixels
    CGImageRef myColorMaskedImage = CGImageCreateWithMaskingColors(diffed, myMaskingColors);
    // Clean the context
    CGContextClearRect(ctx, imageRect);
    // Fill the context with white color 
    CGContextSetFillColorWithColor(ctx, [[UIColor whiteColor] CGColor]);
    CGContextFillRect(ctx, imageRect);
    CGContextDrawImage(ctx, imageRect, myColorMaskedImage);
    // Memory cleanup 
    // Grab the composed CGImage
    diffed = CGBitmapContextCreateImage(ctx);
    // Close the context 
    // Apply the constructed diff mask to newImage
    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(diffed),
                                        CGImageGetDataProvider(diffed), NULL, false);
    CGImageRef masked = CGImageCreateWithMask(newImage, mask);
    UIImage *finalDiffedImage = [UIImage imageWithCGImage:masked];

    return finalDiffedImage;

Tuesday, September 6, 2011

GNU Gettext library

gettext is a l10n and i18n library

1. The texts inside source code should be wrapped by gettext function

So the text "My Name is..." becomes _("My Name is...")

2. Then xgettext runs on source code to generate .pot file, which contains the a list of all translatable strings. Translator edits .po files.

msginit --locale=fr --input=name.pot 

3. The .po files are compile into binary .mo file with msgfmt

4. The user, on Unix-type systems, sets the enviroment variable LC_MESSAGES, and the program will display strings in the selected language, if there is an .mo file for it.Then using msginit program translator derives .po file for example for french it will be

Wednesday, March 30, 2011

PDF docs with Mixed Rasted Content

Mixed Rasted Content is the way of keeping images in PDF docs. With couple of words the background image or generally the images in PDF docs are kept in pieces (in segments) for improving the contrast resolution of a raster image composed of pixels. More info on MRC can be found here

Now the problem is that lots of PDF viewers including Okular, Evince, and lots of others are showing the PDF docs with complete noisy background image, i.e. the background image of the docs is just random composition of some colors. Even in Ubuntu distribution the thumbnails are shown in that way.

This is especially problematic when viewing scanned documents in MRC PDFs. Even the converted tools like swftool could not solve the problem, so the only reasonable way is to create PDFs without MRC enabled options. In ABBYY Finereader that can be achieved easily from the saving options.

Another options of doing this is using pdf2pdf converter below which will convert PDFs with MRC to ordinary ones.

The code pdf2pdf converter is:

# Convert a PDF to another PDF. This effectively strips
# out a lot of stuff from most PDF files.

gs=`which gs 2>/dev/null`
if [ ! -x "$gs" ]; then
    echo "Error: install ghostscript first" >&2
    exit 1

while true; do
    case "$1" in
    -?*) OPTS="$OPTS $1";;
    *) break;;

if [ $# -eq 2 ]; then
elif [ $# -eq 1 ]; then
    outfile="`basename \"$1\" .pdf`.new.pdf"
    cat <&2
Usage: pdf2pdf [--pdf-version (1.2|1.3|1.4)] [gs-options ...]  [output.pdf|-]

Converts a PDF from whatever PDF specification version it currently
exists as to the one specified by \`--pdf-version'. Default: 1.2

One side-effect of this conversion is the resulting document will have
the no-printing and no-copying flags removed in the output document if
they are set in the input document.
    exit 1

exec "$gs" $OPTIONS -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite \
    -dCompatibilityLevel="$pdfver" -sOutputFile="$outfile" -f "$1"

Friday, January 7, 2011

Where the hackintosh comes from ?

Patched Mac OS X kernel : Life-cycle

The kernel of Mac OS X is an open source product which can be found http://opensource.apple.com/ .
The current kernel version is xnu-1504.9.17

The Russian clever guys "teateam" are patching the mach_kernel upon every update of Mac OS X for running on Intel Atom based CPUs.
Here is their blog . The patched kernels are posted in English speaking community here.
The building process of kernel on Mac OS X Snow Leopard is described here

Based on last resource lots of distributions of hackintoshes are created e.g. SnowyWindOSX .

Are the hackintoshes legal ?

In all apple agreement you can find this passage

“2. Permitted License Uses and Restrictions.
A. This License allows you to install and use one copy of the Apple Software on a single Apple-labeled
computer at a time, and you may not make the Apple Software available over a network where it could be used by multiple computers at the same time. If you use Setup Assistant to transfer
software from one Apple-labeled computer to another Apple-labeled computer, please remember that continued use of the original copy of the software may be prohibited once a copy has been
transferred to another computer, unless you already have a licensed copy of such software on both computers. You should check the relevant software license agreements for applicable terms and
conditions. You may make one copy of the Apple Software (excluding the Boot ROM code) in machine-readable form for backup purposes only; provided that the backup copy must include all
copyright or other proprietary notices contained on the original.
B. Certain components of the Apple Software, and third party open source programs included with the Apple Software, have been or may be made available by Apple on its Open Source web site
(http://www.opensource.apple.com/) (collectively the “Open-Sourced Components”). You may modify or replace only these Open-Sourced Components; provided that: (i) the resultant modified
Apple Software is used, in place of the unmodified Apple Software, on a single Apple-labeled computer; and (ii) you otherwise comply with the terms of this License and any applicable licensing
terms governing use of the Open-Sourced Components. Apple is not obligated to provide any maintenance, technical or other support for the resultant modified Apple Software.
C. Except as and only to the extent permitted in this License, by applicable licensing terms governing use of the Open-Sourced Components, or by applicable law, you may not copy, decompile,
reverse engineer, disassemble, modify, or create derivative works of the Apple Software or any part thereof. THE APPLE SOFTWARE IS NOT INTENDED FOR USE IN THE OPERATION OF NUCLEAR
3. Transfer. You may not rent, lease, lend, redistribute or sublicense the Apple Software. You may, however, make a one-time permanent transfer of all of your license rights to the Apple Software
(in its original form as provided by Apple) to another party, provided that: (a) the transfer must include all of the Apple Software, including all its component parts, original media, printed materials
and this License; (b) you do not retain any copies of the Apple Software, full or partial, including copies stored on a computer or other storage device; and© the party receiving the Apple Software
reads and agrees to accept the terms and conditions of this License. You may not rent, lease, lend, redistribute, sublicense or transfer any Apple Software that has been modified or replaced under
Section 2B above. All components of the Apple Software are provided as part of a bundle and may not be separated from the bundle and distributed as standalone applications.
Updates: If an Apple Software update completely replaces (full install) a previously licensed version of the Apple Software, you may not use both versions of the Apple Software at the same time nor
may you transfer them separately.
NFR (Not for Resale) Copies: Notwithstanding other sections of this License, Apple Software labeled or otherwise provided to you on a promotional basis may only be used for demonstration,
testing and evaluation purposes and may not be resold or transferred.”

were says that Apple software can be installed only on apple labeled computers, so this mean that we stick the apple sticker on netbook, notebook or pc then on corresponding device can be easily installed machintosh.