How to start Solr automatically?

As you’re on a shared Linux box, you’ll have to ask the system administrator to do the following, probably. Create a startup script in /etc/init.d/solr. Copy this code, my Solr startup script, into that file: #!/bin/sh # Prerequisites: # 1. Solr needs to be installed at /usr/local/solr/example # 2. daemon needs to be installed # … Read more

How to share semaphores between processes using shared memory

It’s easy to share named POSIX semaphores Choose a name for your semaphore #define SNAME “/mysem” Use sem_open with O_CREAT in the process that creates them sem_t *sem = sem_open(SNAME, O_CREAT, 0644, 3); /* Initial value is 3. */ Open semaphores in the other processes sem_t *sem = sem_open(SEM_NAME, 0); /* Open a preexisting semaphore. … Read more

How to share keychain data between iOS applications

After some (a lot of) digging throughout the web, I found the answer. The access Group that you use when constructing your KeychainItemWrapper class must ALSO be specified in each of your application’s Entitlements.plist file in the “keychain-access-groups” section. It seems almost obvious now that I see “keychain-access-groups“. However, I had no idea to even … Read more

Is it possible to get CMake to build both a static and shared library at the same time?

Yes, it’s moderately easy. Just use two “add_library” commands: add_library(MyLib SHARED source1.c source2.c) add_library(MyLibStatic STATIC source1.c source2.c) Even if you have many source files, you can place the list of sources in a Cmake variable, so it’s still easy to do. On Windows you should probably give each library a different name, since there is … Read more

Android: Retrieving shared preferences of other application

Okay! using this code in Application 1 ( with package name is “com.sharedpref1” ) to store data with Shared Preferences. SharedPreferences prefs = getSharedPreferences(“demopref”, Context.MODE_WORLD_READABLE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(“demostring”, strShareValue); editor.commit(); And using this code in Application 2 to get data from Shared Preferences in Application 1. We can get it because we use … Read more