2014-05-15

FIX: Drush can't update Drupal to 7.28

Recently Drupal 7.28 is released. Since I've setup the update notification on some sites, then I've got so many emails from my drupal sites. As usual, I go to the web server, run the command "drush up" to upgrade the core and the modules. Everything looks fine as following:

 Name    Installed Version  Proposed version  Message  
 Drupal  7.27               7.28              Updates available


Update information last refreshed: Thursday, 05/15/2014 - 09:30
Code updates will be made to drupal core.
WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.
Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.

Do you really want to continue? (y/n): y
Project drupal was updated successfully. Installed version is now 7.28.
Backups were saved into the directory /home/ubuntu/drush-backups/drupal/20140515073230/drupal.                                                                                                                                                                       [ok]
No database updates required                                                                                                                                                                                                                                         [success]
'all' cache was cleared.                                                                                                                                                                                                                                             [success]
Finished performing updates.                                                                                                                                                                                                                                         [ok]

So I supposed the core is updated to 7.28. BUT, the update notification emails come again and again. Then I ran "crush st" to check the status of the drupal installation, it showed:

$ drush st
 Drupal version                  :  7.27

Unbelievable, right? Drush cheats me on that ;)

So it seems a manual update is unavoidable, but I want to give Drush a second chance. So here are the command set to update drupal core to 7.28.

cd /tmp

drush dl

sudo rsync -rltD --delete --exclude 'sites' /tmp//drupal-7.28/ .

cd /path/to/web/root

drush updatedb

drush pm-update

Now I get a right upgraded Drual with 7.28.

$ drush st
 Drupal version                  :  7.28

2014-05-05

HOWTO: Make Google Charts SVG responsible and printable with full page width

Google Charts is widely used for a while. It's no doubt that it is easy to use and have great documentation. But, it has also many limitations. One problem I recently discovered is printing. Since the SVG that is generated by Google Charts is NOT responsible. If the user wants to print the page, the result only shows part of the charts since the Google Charts adds a CSS style like "overflow:hidden" to the SVG.

What I want is very simple, the user gets a printed result like WYSIWYG. After different approaches, I came to the idea of Image Replacement. 

The idea: since the generated SVG doesn't response to width changes, we have to use a responsive image instead of the SVG to get the perfect print result.

So here is the implementation. :)

HTML:
<div id='timeline'></div>
<div id='timeline_print'></div>

CSS:
@media print {
    #timeline_print {
        width: 100%;
    }
}

JavaScript(assumed that jQuery is loaded, this.chart refers to the Google Charts object):

var beforePrint = function() {
    $("#timeline_print").html('<img src="' + this.chart.getImageURI() + '">');
    $("#timeline").addClass('hidden');
};
var afterPrint = function() {
    $("#timeline_print").empty();
    $("#timeline").removeClass('hidden');
};
if (window.matchMedia) {
    var mediaQueryList = window.matchMedia('print');
    mediaQueryList.addListener(function(mql) {
        if (mql.matches) {
            beforePrint();
        } else {
            afterPrint();
        }
    });
}

window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;

2013-10-16

FIX: Unable to download data from https://rubygems.org/ - certificate verify failed

I've used rvm for a while to manage my ruby installations and it works great. Today I've tried updating my gems with gem update and it tells me "nothing is to be updated". Eh? At least I know cocoapods is updated from my installed 0.24 to 0.26. What happened?

Then I tried to update gems manually. Firstly:

> gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)

 Great! That's the reason. There is a long long list of the issue under https://github.com/rubygems/rubygems/issues/515

The solution suggested are:
1. use an insecure connection to rubygems.org with:

> gem update  --source http://rubygems.org

It works. But it doesn't solve the problem

2. RVM should update its certificates:


> rvm osx-ssl-certs status all
Certificates for /etc/openssl/cert.pem: Old.


> rvm osx-ssl-certs update all
Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.
mkdir: /etc/openssl: Permission denied
Admin password required for 'mkdir -p /etc/openssl':
Updated.

Then everything should be fine now.

A detailed information can be found at http://railsapps.github.io/openssl-certificate-verify-failed.html

For non-RVM and non-MAC users, here is the answer: http://stackoverflow.com/questions/19150017/ssl-error-when-installing-rubygems-unable-to-pull-data-from-https-rubygems-o

2013-10-14

FIX: A blank view appears after QLPreviewController dismissed in iOS 7

Recently when I am working with iOS 7, I encounter the following problem: If the modalPresentationStyle of an view controller is set as UIModalPresentationFormSheet or UIModalPresentationPageSheet and after one uses the QLPreviewController once in the view controller and dismisses the Quick Look, a blank / gray view will appear on the screen instead of the presented view controller. This blank view cannot be dismissed or interacted.

That seems a serious bug in iOS 7. :(

After some days trying errors, I've found the following workaround:

in the presenting ViewController:

if ([self DeviceSystemMajorVersion] >= 7) {
modalVC.transitioningDelegate = self;
modalVC.modalPresentationStyle = UIModalPresentationCustom;
} else {
modalVC.modalPresentationStyle = UIModalPresentationFormSheet;
}


The function to detect iOS 7:

- (NSUInteger) DeviceSystemMajorVersion {
    static NSUInteger _deviceSystemMajorVersion = -1;
    static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
});
return _deviceSystemMajorVersion;
}


The presenting view controller should conform to the protocol UIViewControllerAnimatedTransitioning and UIViewControllerTransitioningDelegate, in order to use the custom transaction style that indroduced in iOS 7. Continue to add these methods:

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source {
return self;
}
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {
UIView *inView = [transitionContext containerView];
    UIView *toView = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey].view;
    UIView *fromView = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey].view;
UIView *preferenceOverlay = [[UIView alloc] initWithFrame:inView.frame];
preferenceOverlay.backgroundColor = [UIColor blackColor];
preferenceOverlay.alpha = 0;
[inView addSubview:preferenceOverlay];
toView.frame = CGRectMake(0, 0, 540, 540);
toView.center = CGPointMake(CGRectGetMidX(inView.frame), CGRectGetMidY(inView.frame));
[inView addSubview:toView];
    [UIView animateKeyframesWithDuration:(1.0) delay:0 options:0 animations:^{
preferenceOverlay.alpha = 0.4;
    } completion:^(BOOL finished) {
        [transitionContext completeTransition:finished];
    }];
}


Then in the presented view controller:

-(void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
if ([self DeviceSystemMajorVersion] >= 7) {
if (QLOpened) {
self.view.frame = CGRectMake(0, 0, 540, 540);
CGFloat xCenter = CGRectGetMidX(self.view.superview.frame) + 125;
CGFloat yCenter = CGRectGetMidY(self.view.superview.frame) - 125;
self.view.center = CGPointMake(xCenter, yCenter);
NSLog(@"Center X:%f Y:%f",xCenter,yCenter);
}
}
}


Then let the view controller to conform the protocol QLPreviewControllerDelegate and add the following method:
- (void)previewControllerWillDismiss:(QLPreviewController *)controller {
NSLog(@"QLView dismissed");
[self.view setNeedsLayout];
}


DONE!

If you have the centering problem of the modal view controller, try fine-tuning the center point of the method viewWillLayoutSubviews

2013-09-27

HOWTO: Compile Sigil under Mac OS X from source codes

Sigil is a very powerful ePub file publisher, which can be used to create, modify and edit ebooks. Since the source codes of Sigil is put on GitHub(https://github.com/user-none/Sigil/), I have to compile Sigil directly from source codes. Now here is the HOWTO。 :)

Firstly, you need brew(http://brew.sh) to let it install different packages for compiling.

Once brew is installed, you should install the following packages using terminal:

> brew install cmake
> brew install qt5

> export Qt5_DIR=/usr/local/opt/qt5

Check out the source codes from GitHub or download the ZIP . Go to the directory in Terminal and execute the following commands:

> mkdir build
> cd build
> cmake -DFORCE_BUNDLED_COPIES=1 -DCMAKE_BUILD_TYPE=Release ..
> make

At the end in the folder "bin" is the compiled Sigil.app, which can be dragged into Application folder.

DONE!

2013-08-28

FIX: Running PEAR, PECL & Co. under Mac OS X Mavericks DP6

When I tried to use pear under Mac OS X Mavericks DP6, I got a very unhelpful error message:

$ pecl
Could not open input file: /usr/lib/php/peclcmd.php

It seems that pear & pecl are not preinstalled! No problem, at least Mavericks provides an install package.

sudo php -d detect_unicode=0 /usr/lib/php/install-pear-nozlib.phar

Then the nightmare began:

$ sudo pecl install uploadprogress
downloading uploadprogress-1.0.3.1.tgz ...
Starting to download uploadprogress-1.0.3.1.tgz (9,040 bytes)
.....done: 9,040 bytes
4 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
building in /private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1
running: /private/tmp/pear/temp/uploadprogress/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable uploadprogress functions... yes, shared
checking for ld used by cc... /Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode5-DP6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/uploadprogress -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1/include -I/private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1/main -I/private/tmp/pear/temp/uploadprogress -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/uploadprogress/uploadprogress.c -o uploadprogress.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/uploadprogress -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1/include -I/private/tmp/pear/temp/pear-build-rootTuNmJz/uploadprogress-1.0.3.1/main -I/private/tmp/pear/temp/uploadprogress -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/uploadprogress/uploadprogress.c  -fno-common -DPIC -o .libs/uploadprogress.o
In file included from /private/tmp/pear/temp/uploadprogress/uploadprogress.c:23:
/private/tmp/pear/temp/uploadprogress/php_uploadprogress.h:34:10: fatal error: 'php.h' file not found
#include <php.h>
         ^
1 error generated.
make: *** [uploadprogress.lo] Error 1

ERROR: `make' failed

No way! The /usr/include doesn't exist for phpize....Hours of trying error and searching... Thanks a post from Homebrew community, I got that problem fixed through:

sudo ln -s /Applications/Xcode5-DP6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ /usr/include

2013-08-16

FIX: Errors with installing MySQL on Ubuntu

In order to install a LNMP environment on a VPS, I've tried the following command to install MySQL server, but what I got is:


130816 18:53:17  InnoDB: Waiting for the background threads to start
130816 18:53:18 InnoDB: 5.5.32 started; log sequence number 1595675
130816 18:53:18  InnoDB: Starting shutdown...
130816 18:53:19  InnoDB: Shutdown completed; log sequence number 1595675
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Processing triggers for ureadahead ...
Errors were encountered while processing:
 mysql-server-5.5
E: Sub-process /usr/bin/dpkg returned an error code (1)

It's really an error message that says nothing. The ubuntu is freshly installed. After hours of trying with solutions from Internet, I've found the following solution working for me:


sudo apt-get clean

sudo apt-get autoclean

sudo apt-get remove --purge mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5

sudo apt-get install mysql-server




before reinstalling, you may need also the following commands:


rm -rf /var/lib/mysql
rm -rf /etc/mysql*



So it is.

2013-08-15

FIX: Xcode failed to get the task for process XXX

Recently by debugging an app on devices, Xcode keeps throwing the error message "Failed to get the task for process XXX" like this:

enter image description here

After long searching on the internet, one solution has saved my day:

It turns out that using a different provisioning profile (one with a wildcard rather than one without) solved this issue.

So I changed the provisioning profile by debugging from app specified to ios team provisioning profile. BRAVO,  now it works like a charm.

via StackOverflow

2013-08-13

Workaround for "AssertMacros: queueEntry, file: /SourceCache/IOKitUser_Sim/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512"

I am busy recently with testing some apps under iOS 7 Beta 5. Now while running the app, the debug console keeps outputting some useless information like:

AssertMacros: queueEntry, file: /SourceCache/IOKitUser_Sim/IOKitUser-920.1.11/hid.subproj/IOHIDEventQueue.c, line: 512

 It is really annoying and makes the debug info useless, since it appears every time when I touch the screen. Thanks 0xced, now here is a workaround solution for that:


Here is a workaround to this annoying problem.

  1. Download fishhook
  2. Copy fishhook.h and fishhook.c in your project
  3. Compile this file (QuietAssertMacros.c) in your project:



#include <dlfcn.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "fishhook.h"

int slient_fprintf(FILE * restrict stream, const char * restrict format, ...)
{
    if (strncmp(format, "AssertMacros:", 13) == 0)
    {
        return 0;
    }
    else
    {
        va_list args;
        va_start(args, format);
        int result = vfprintf(stream, format, args);
        va_end(args);
        return result;
    }
}

__attribute__((constructor)) void QuietAssertMacros(void)
{
    rebind_symbols((struct rebinding[1]){{"fprintf", slient_fprintf}}, 1);
}
Unfortunately, you will have to repeat these steps for every project you are working on.

via devforum apple

2013-07-30

MySQL Error 1130 "Host 'xx.xx.xx.xx' is not allowed to connect to this MySQL server."

When I tried to connect a mysql server from outside today morning, I got a mysql error like:

ERROR 1130: Host 'xx.xx.xx.xx' is not allowed to connect to this MySQL server.


That means the mysql server is configured to allow only local connections. The configuration can be modified easily in mysql tables.

Under terminal, type the following commands

> mysql -u root -pmypassword

mysql> use mysql;

mysql> update user set host = '%' where user = 'root';

mysql> flush privileges;



Now you could connect the mysql server from the outside client.

2013-06-26

Strange Behavior: UIButton Text will be not shown.

Because of a multilingual project, all the texts should be translated and replaced with the correct language version. Everything was fine until I found that a button won't show the text assigned.

The code:


 [button titleLabel].text = @"I won't be changed";


The result is: the button shows always the text that is set up in the storyboard. If I delete the text in Storyboard, it will even disappear when I tap!

The solution is also simple:


[button setTitle:@"I will change" forState:UIControlStateNormal]


via StackOverflow

2013-06-17

One Class for One Problem

The keyboard on iOS devices is sometimes a nightmare for a programmer.  Take the UITextField as an example, when a keyboard appears, it will cover most screen area and let the text fields hidden in the back of the soft keyboard. A solution provided by Apple is using the UIScrollView, but there are a lot of mathematical calculation for a programmer. :(

After a while research on the internet, I've found that Michael Tyson has built a drop-in solution for such kind of problems. He packs everything that one needs into a class and puts the sources on GitHub.

If you follow the instruction on the Github, the task with UITextField and Keyboard is easy as a cake!

Usage

For use with UITableViewController classes, drop TPKeyboardAvoidingTableView.m and TPKeyboardAvoidingTableView.h into your project, and make your UITableView a TPKeyboardAvoidingTableView in the xib. If you're not using a xib with your controller, I know of no easy way to make its UITableView a custom class: The path of least resistance is to create a xib for it.
For non-UITableViewControllers, drop the TPKeyboardAvoidingScrollView.m and TPKeyboardAvoidingScrollView.h source files into your project, pop a UIScrollView into your view controller's xib, set the scroll view's class toTPKeyboardAvoidingScrollView, and put all your controls within that scroll view. You can also create it programmatically, without using a xib - just use the TPKeyboardAvoidingScrollView as your top-level view.


Well done, Michael!

via ATasty Pixel

HOWTO: UIScrollView scroll to bottom programmatically

The autolayout function of a view controller is very useful. The UI elements can find their position after a rotation automatically. Except for UIScollerview...Orz

The reason is: The Layout in Storyboard is normally designed for portrait, not for landscape. So if an user rotates his iOS devices, the UIScrollView cannot resize its content height automatically. So a programmatical resize is needed. BUT, there is another way: just scroll the UIScrollView to the bottom(or where you want), the content will be presented in landscape correctly like in portait.

Here is the solution: Adding the following code to the view controller where the scroll view is.



-(void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
// Scroll to the bottom
CGPoint bottomOffset = CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height);
[self.scrollView setContentOffset:bottomOffset animated:YES];
}

via StackOverflow

2012-08-21

iOS: nested push animation can result in corrupted navigation bar


Today I got a very strange error by running an iOS App:

1. nested push animation can result in corrupted navigation bar
2. Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

It happens when the view controller tries to pop to top view controller without waiting for the loading end of child view controller.

Solution:

1. try to set a boolean variable to mark the view controller should pop to the top view controller
2. in viewDidAppear:(BOOL)animated method, check if a call of [self.navigationController popToRootViewControllerAnimated:YES] is needed

The reason:

popToRootViewControllerAnimated() must be called after the view appears!

2012-08-06

Fixing double entries in "Open with" menu under Mac OS X

Sometimes it is very annoying to see duplicated entries in the "Open with..." menu under MAC OS X, the reason is just the database for file types doesn't refresh for some reason. Now it can be fixed using:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Tested under Mac OS X 10.8 (Mountain Lion).

2011-12-22

Fix the cydia crash problem after jailbreak iOS 5 with redsn0w 0.9.9b9

It is really weird. After using redsn0w 0.9.9b9 to jailbreak my iPhone 3GS with iOS 5.0.1, the iphone can be booted with the option "just boot" in redsn0w. The Cydia icon showes up on the screen. Open it and say I am a "User". The loading process can be seen, and... quit. I can ssh into the iOS, that is to say, the iphone is already jailbroken. But what happened with Cydia?!

I've tried many different methods.

1. restore the stock firmware and do the jailbreak again. -> No success.
2. reinstall Cydia with SSH on the iPhone. -> No success.
3. just boot the iphone tetherly again and again -> No success.


So I tried to read the log file of Cydia. The log file can be found at /private/var/tmp/cydia.log. I noticed that an error is repeated again and again.


2011-12-22 14:43:20.135 MobileCydia[252:e07] Setting Language: de_DE
Assertion failed: (dictionary->lockFD != -1), function IDXUserDictionaryOpen, file /SourceCache/Mecabra/Mecabra-248/mecabra/IDXUserDictionary.c, line 88.

I've googled for a while and nothing is found...but it must be something wrong with the laguage settings. I've discoved I use English as user interface language and German as date/time format. Mumm, maybe that is the problem. I've set the both as English. Now, Cydia runs smoothly without any problems.

In a short, that is a bug of Cydia, it depends on the language settings of iOS! Try to set up the language unified, then it doesn't complain again.

2011-11-19

How to install FontForge on Mac OS X Lion

Since I got some old font files before 2007 and I wanna use them, after some inspection, Font Magager told me that the name tables of the fonts are mssing. In order to add them manually, I googled a while to find out FontForge can do the job.

Now comes the problem. FontForge is open source and doesn't provide any compiled binary for Mac OS X ab 10.6. That means, one must complie it before it can be used. So after a little searching again, I found Garrick's guide [How to install fontforge on mac os lion]. Sadly, the process he used doesn't work for me.

He suggests that it can be done easily with the commands:

brew install fontforge
sudo brew link fontforge

The first command returns some fatal errors:

Error: Failed executing: make install
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/7658
https://github.com/mxcl/homebrew/issues/8144
https://github.com/mxcl/homebrew/issues/8491

Then the answers in those issues suggest:

brew install cairo --use-clang

I tried

brew install fontforge

after successful execution of that command. Then it came with:

Error: Failed executing: make
If `brew doctor' does not help diagnose the issue, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue

According to the message, I ran the command:

brew doctor

The result was:

Unbrewed dylibs were found in /usr/local/lib.

If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libfaac.0.dylib
/usr/local/lib/libfreetype.6.dylib
/usr/local/lib/libical.0.0.0.dylib
/usr/local/lib/libicalss.0.0.0.dylib
/usr/local/lib/libicalvcal.0.0.0.dylib
/usr/local/lib/libltdl.3.1.0.dylib
/usr/local/lib/libmp3lame.0.dylib
/usr/local/lib/libmp4v2.0.dylib

Unbrewed static libraries were found in /usr/local/lib.

If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
/usr/local/lib/libdevkit.a
/usr/local/lib/libical.a
/usr/local/lib/libicalss.a
/usr/local/lib/libicalvcal.a
/usr/local/lib/libkld.a
/usr/local/lib/libltdl.a
/usr/local/lib/libredo_prebinding.a

Unbrewed .la files were found in /usr/local/lib.

If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
/usr/local/lib/libical.la
/usr/local/lib/libicalss.la
/usr/local/lib/libicalvcal.la
/usr/local/lib/libltdl.la


So I deleted all the above mentioned files manually and executed the command again.

brew install fontforge


The result:


Error: Failed executing: make
If `brew doctor' does not help diagnose the issue, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue


Very luckily I saw a warning before the compiling errors, that reads:

Warning: Building with LLVM, but this formula is reported to not work with LLVM:

Compiling cvexportdlg.c fails with error: initializer element is not constant

We are continuing anyway so if the build succeeds, please open a ticket with
the following information: 2336-10.7. So
that we can update the formula accordingly. Thanks!

If it doesn't work you can: brew install --use-gcc


So I tried the command again:

brew install fontforge --use-gcc

Now Mac OS X Lion lets me compile FontForge endly.

In conclusion, the right commands to compile FontForge on Mac OS X Lion should be:

brew install cairo --use-clang

brew install fontforge --use-gcc


In order to see FontForge in Application folder, you need to run this command:

ln -s /usr/local/Cellar/fontforge/20110222/FontForge.app /Applications

2011-11-14

iOS BUG: Synced music won't appear in iPod or Music App

Yesterday I've updated my iPhone 3GS by the means of OTA (Over The Air) to the newest firmware iOS 5.0.1. Everything runs smoothly, BUT! After I open the supplied Music App, I've seen only a very little part of my music collection? Where did they go?



Firstly I thought the update deleted my not-from-itunes-store-bought music files, then I checked the iTunes, the status bar of my iphones indicates that there are exactly 13.6GB music files on it. It appears that the mediathek file on the iphone has corrupted with the update, or maybe the update has changed the structure of the mediathek file and forgetten to update it.

What can I do? Sure, completely restore is one way but also the last way I wanna go. So I've googled around for a while to find out a better and smart way to correct it. Then I found this article [iOS 4.2 bugs: iPhone music gone after the update? Here’s the fix! ]. Okay, i am not the only one and iOs 5.0.1 is also not the only one with that bug.




  1. Grab your cable and plug your iPhone into iTunes on your Windows or Mac PC


  2. When your iPhone shows up in the sidebar, make sure you can see the content listings beneath it (click on the triangle to the left if not)


  3. Click on music


  4. Pick a song


  5. Play it in iTunes


  6. Sync your iPhone


The method in that article didn't work for me for the first time. I have to figure out why it doesn't work. The reason behind that method is: Change the play count for a song, then iTunes changes the mediathek file on the iPhone.

So it is very important for that method, just try to play a song and maybe you can forward it very quickly to the end, make SURE that the play count of that song changed and resync!

Things are gonna be alright and we don't know when apple will fix that long-lasting bug.

2011-11-10

Goodbye, Flash on mobile devices!

Now the war is over. Adobe has declared that they abandon the development of Flash on mobile devices. The winner is HTML 5.

Like Google has mentioned before, the future of Internet belongs to the browser. If we think it further, in the future there should be at least one browser on one device, that means, developers should consider how and what information should be delivered, but not on what kind of devices will support it.

In other word, HTML 5 won this war just because one of its properties, "once programmed, run everywhere". Sounds familiar, right? Sure, it is the slogan of Java.

In my opinion, the device in the future should have some CSS rules to let the end user know what kind of mobile device they use. Take Mobile Safari as an example, its UI elements on a website without CSS are looked exactly like an app on a iPhone.

Now the day is coming, are you ready for the changing?

2011-11-04

Fix the problem with Captive Network under Mac Lion 10.7.2

The Auto Logon Window for Captive Network in Mac OS X Lion is very handy, but with the update 10.7.2 there are so many problems with such a feature happened. Sadly I have to use the IE in my VM Windows to get me logged in.

Now here is the solution:

Use Terminal or Text Editor to edit the file /etc/hosts and add the following lines to the end:

127.0.0.1 crl.usertrust.com
127.0.0.1 ocsp.usertrust.com
127.0.0.1 crl.incommon.org
127.0.0.1 ocsp.incommon.org
127.0.0.1 crl.comodoca.com
127.0.0.1 crl.comodo.net
127.0.0.1 ocsp.comodoca.com

After that, the DNS cache must be cleared with Terminal Command:

dscacheutil -flushcache

Log off and log on, you will see the missing feature again under Lion 10.7.2.


The reason:

With the update 10.7.2 Lion has made some errors on CSL certificates, especially on some captive networks that need the user wait for a few seconds.