Thursday, May 16, 2013

SVN create and switch to branch


Mac OS X 10.8.2
svn, version 1.6.18 (r1303927)
http://situee.blogspot.com/2013/05/svn-create-and-switch-to-branch.html

I want to work a new svn branch. And try the following comment

svn copy svn://server/path/trunk/project_name svn://server/path/branches/new_branch

But it's not ok. It returns error message:

"svn: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options
svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found"

The command MUST have comment message like this

svn copy svn://server/path/trunk/project_name svn://server/path/branches/new_branch -m "create new branch"

The result is the project is copy to 

svn://server/path/branches/new_branch/project_name

The we can go to the working copy and switch to the new branch by

 svn switch svn://server/path/branches/new_branch/project_name

Everything is ok. You modification to the old working copy is still there.



The --relocate option of switch causes svn switch to do something different: it updates your working copy to point to the same repository directory, only at a different URL (typically because an administrator has moved the repository to another server, or to another URL on the same server).[1]

[1] http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html



Sunday, April 28, 2013

iOS Localize Image for Language of Applicaiton


How to localize images for iOS?
Put your images into localized folder, such as "en.lproj" , "zh.lproj"
This works for System Language.
But how about using language of application?

We can use string of app language by "NSLocalizedStringFromTable"
But there is NO such function for image.


Here is a solution.
Use the following code to get the path of the image of the app language.

NSString *path = [[NSBundle mainBundle] pathForResource:@"image_name" ofType:@"jpg" inDirectory:@"zh.lproj"]; 

or 

NSString *path = [[NSBundle mainBundle] pathForResource:@"image_name" ofType:@"jpg" inDirectory:@"" forLocalization:@"zh"];


UIImage *image = [UIImage imageWithContentsOfFile:path];

Thursday, April 25, 2013

Config Apache SVN server for Mountain Lion


After upgrade to Mac OS X 10.8 Mountain Lion.
My local SVN server is not working.
The setting should be the same, but the svn setting is removed from httpd.conf
How to get it work again?  Let's GO!!


Create file "/etc/apache2/other/svn.conf",
Add the following lines into the "svn.conf"

#svn module
LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so

<Location /svn>
DAV svn
SVNPath "/svn"
AuthType Basic
AuthName "admin"
AuthUserFile /etc/your_user_name.htpasswd
Require valid-user
</Location>


sudzC SOAP web service namespace problem



I am using sudzC to generate objective-C codes to use SOAP webservice of a Java Tomcat server.
But is doesn't work. There must be some formatting problem.


<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://example.com/"><soap:Body>
<getMethod>
    <arg0>aaa</arg0>
    <arg1>8</arg1>
</getMethod>
</soap:Body></soap:Envelope>


return error message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<soap:Fault><faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: unexpected element (uri:"http://example.com/", local:"arg0"). Expected elements are &lt;{}arg0&gt;,&lt;{}arg1&gt; </faultstring></soap:Fault>
</soap:Body></soap:Envelope>

server is expecting <{}arg0>, <{}arg1>
{} means the namespace is empty.
arg0 and arg1 should have NO namespace.

Friday, March 29, 2013

Apple iOS UDID Replacement - UUID,vendor,advertising id

Apple forbid all new / updated app of iphone to use UDID from May 1st, 2013.
There are some replacements : CFUUID/NSUUID, Vendor ID or Advertising ID.


 
Scope
Lifetime end
Available
UUID
Application
Uninstall app
iOS 2
Vendor ID
Development Team
Uninstall all apps of the development team
iOS 6
Advertising ID
Device
Wipe device
iOS 6



Thursday, March 28, 2013

Titanium TableView row count


How to get the number of rows in tableview with Titanium?
TableView default has one section. "table.data" is the section array.
If you don't create section, your rows are in "section 0".
Get the row count by

table.data[0].rows.length;

or

table.data[0].rowCount;


Tuesday, January 08, 2013

Galaxy Note 2 screen specifications, size, density, aspect

Samsung Galaxy Note I/II screen specifications
--situee's blog

It's important to know the specification the device classifies itself for Android developers.

Galaxy Note 1 calculated ppi is 285; density is xhdpi.
After the ICS update, the device classification changed to "large" and "not long".

Galaxy Note 2 calculated ppi is 267; density is xhdpi.




Resolution
 Size
Density
Aspect
Galaxy Note 2.3
1280x800
Large
xhdpi
Not Long *
Galaxy Note 4.x
1280x800
Normal
xhdpi
Not long
Galaxy Note II
1280x720
Normal
xhdpi
Long


Sunday, December 09, 2012

在Mac导入goagent根证书,解决证书无效警告问题

在上文 mac上安装和使用goagent翻墙,解决找不到event.h问题
安装好goagent,可以使用chrome代理上网。
但一些网站会出现证书无效警告的问题,无法正常访问。例如twitter, github。
需要安装goagent的根证书。

本文地址 http://situee.blogspot.com/2012/12/macgoagent.html


双击 GoAgent/local 目录下的 CA.crt 证书导入到系统
在 钥匙串访问 中找到 GoAgent CA 并双击
(可以在右上角的搜索框输入goagent快速找到)
选择 信任 > 使用此证书时 > 总是信任



最后,重启浏览器。

Monday, December 03, 2012

mac上安装和使用goagent翻墙,解决找不到event.h问题




在mac上安装和使用goagent翻墙
关于申请google app engine的教程很多,我就不再写了。

在这申请https://appengine.google.com/


本文地址http://situee.blogspot.com/2012/12/macgoagenteventh.html

找不到gevent怎么办

当上传即 python uploader.zip时,可能出现
ImportError: No module named gevent;
官方说在shell命令执行如下语句(注意需要安装 gcc 或 xcode): curl -k -L http://git.io/I9B7RQ|sh

但是我试过不行,报以下权限问题,加了sudo也不行.

error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-41204.write-test'


Tuesday, September 04, 2012

iOS Objective-C performSelector static method


It's tested OK to use the following static method calls.
Tested on Xcode Version 4.4.1 (4F1003), Apple LLVM Compiler 4.0
    [[StaticMethodClass classperformSelectorInBackground:@selector(runInThreadMethod)withObject:nil];
    [StaticMethodClass performSelectorInBackground:@selector(runInThreadMethod)withObject:nil];
    [StaticMethodClass performSelectorOnMainThread:@selector(runInThreadMethod)withObject:nil waitUntilDone:NO];
    [StaticMethodClass performSelector:@selector(runInThreadMethod) withObject:nil];
Although, there is no auto-code-completion, but it runs fine.
But when use "target", it's NOT ok to use the Class itself, should use "[StaticMethodClass class]" as the target. like.
 [NSTimer scheduledTimerWithTimeInterval:1.0 target:[StaticMethodClass classselector:@selector(runInThreadMethod) userInfo:nil repeats:NO];