[Q&A]How to specify multiple source directory for Android library project

ant.properties

1
source.dir=src:src1/subpath:src2

tools/ant/build.xml
comment or remove the last fileset tag in jar tag

1
2
3
4
5
6
<jar destfile="${out.library.jar.file}">                        
       <fileset dir="${out.classes.absolute.dir}"
            includes="**/*.class"
            excludes="${project.app.package.path}/R.class ${project.app.package.path}/R$*.class ${project.app.package.path}/Manifest.class ${project.app.package.path}/Manifest$*.class ${project.app.package.path}/BuildConfig.class"/>
       <!--fileset dir="${source.absolute.dir}" excludes="**/*.java ${android.package.excludes}" /-->
    </jar>
Tags :

0-arity Functions: () => Type

1
2
3
4
5
6
7
8
() => println("I'm an anonymous function")  // anonymous function
 
val f: () => Unit = () => println("I'm an anonymous function")
f() // return I'm an anonymous function
 
// () => println("I'm an anonymous function") is an anonymous function
// f has type - () => Unit,
// a function takes no argument and return Unitn
Tags :

Call-by-Name: => Type

1
2
3
4
def f(x: => Int) = x * x * x
var y = 0
f { y += 1; y }
// result = 6
Tags :

[Q&A] Error Itms-90339: This bundle is invalid . The info.plist contains an invalid key ‘CFBundleResourceSpecification’ in app bundle

1. remove

1
CODE_SIGN_RESOURCE_RULES_PATH=$(SDKROOT)/ResourceRules.plist

2. modify

1
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication

change

1
2
3
my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements,resource-rules",
                  "--sign", $opt{sign},
                  "--resource-rules=$destApp/ResourceRules.plist");

to

1
2
my @codesign_args = ("/usr/bin/codesign", "--force", "--preserve-metadata=identifier,entitlements",
                  "--sign", $opt{sign});

3. change file permission

1
sudo chown myuser /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/ResourceRules.plist
Tags :

[Q&A] how to use android annotations in gradle

build.gradle

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
buildscript {
    repositories {
        mavenCentral()
    }
 
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}
 
repositories {
    mavenCentral()
    mavenLocal()
}
 
apply plugin: 'android-apt'
 
def AAVersion = '3.3.2'
 
apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
    }
}
 
dependencies {
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}
Tags : ,

[Q&A] How to solve java.lang.OutOfMemoryError: GC overhead limit exceeded error in android studio

in build.gradle

1
2
3
4
5
6
android {
...
   dexOptions {
      javaMaxHeapSize "2g"
   }
}
Tags :

[Q&A] How to enable silent notification in iOS

set content-available = 1

Provide this key with a value of 1 to indicate that new content is available. Including this key and value means that when your app is launched in the background or resumed,application:didReceiveRemoteNotification:fetchCompletionHandler: is called.

(Newsstand apps are guaranteed to be able to receive at least one push with this key per 24-hour window.)

Tags : ,

[Q&A]How to backup/restore MacOS Server.app / Wiki

reference
bender

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#######################################################
Please note that this does NOT bring over any users or groups.  You need to restore OD for your Open Directory users to log in properly.
 
On the Target Server
1.	Setup new Target Server with IP domain name etc.
2.	Start the wiki service - log in and check that it is running properly.
3.	Turn off the Wiki Service on your Target Server, and quit out of Server.app
 
 
On Source Server
1.	Copy the FileData from your source server to your target server
	a.	Copy FileData from your latest Bender Backup.
	b.	Copy directly from /Library/Server/Wiki/FileData
 
2.	Perform a dump of your collab database:
	a.	Copy the collab.pgdump /Backups folder if using Bender
	b.	Manually perform the pg dump:
		pg_dump -h "/Library/Server/Wiki/PostgresSocket" --format=c --compress=9 --blobs --username=collab --file=/tmp/collab.pgdump collab
 
	**Note you can and should change the destination of the pgdump.**
 
On the Target Server
1.	Copy the FileData to the target system.
	/Library/Server/Wiki/FileData
 
2.	Set owners and permissions on the target.
	sudo chown -R _teamsserver:_teamsserver /Library/Server/Wiki/FileData
	sudo chmod -R +a "www allow search" /Library/Server/Wiki/FileData
 
3.	Prepare the Target for the pgdump.
	Connect to the psql service for the Wiki Service.  This will be done from within psql, so your prompt will change.
 
	sudo psql -h "/Library/Server/Wiki/PostgresSocket" -U collab template1
 
	Clear out PID so we can drop the database:
 
	SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'collab' AND pid <> pg_backend_pid();
 
	Drop the existing collab database:
 
	drop database "collab";
 
	Create a new collab database:
 
	create database "collab";
 
	Quit out of psql:
 
	\q
 
4.	Restore the Wiki by loading the pgdump from the Source Server:
	1.	Enable Wiki Service in Server.app
	2.	sudo pg_restore -h "/Library/Server/Wiki/PostgresSocket" -d collab -U collab --single-transaction "/Path/to/location/of/collab.pgdump"
 
5.	Clean up wiki permissions, searchindex and quicklooks.
	sudo wikiadmin fixPermissions
	sudo wikiadmin rebuildSearchIndex
	sudo wikiadmin resetQuicklooks
 
6.	Log in to your wiki's on the Target Server.
 
#######################################################
Tags : ,

[Android][Q&A] Proguard retrace missing line numbers (Unknown Source)

add this 2 lines in proguard-project.txt or proguard.txt

1
2
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
Tags :

[Q&A]How to center icon using customView in actionbar

1
2
3
4
5
6
7
ActionBar.LayoutParams layoutParams = 
new ActionBar.LayoutParams(
   ActionBar.LayoutParams.MATCH_PARENT,
   ActionBar.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER_HORIZONTAL|Gravity.CENTER_HORIZONTAL;
View customView = getLayoutInflater().inflate(R.layout.actionbar_custom_view, null);
actionBar.setCustomView(customView, layoutParams);
Tags :