Sunday, June 26, 2016

Crowdsourced Prayer

I've always wondered why we should ask others to pray for us if God hears the prayers even of one--and especially if he knows our needs even before we ask of him. Having others pray for us might seem to be redundant, or if we were to take it to the extreme, even faithless.

One Scripture that comes to mind regarding the prayers of many is from Revelation, where the multitude if prayer is likened to incense being poured out to God. There is no indication that these prayers somehow grab his attention better or that they might get lost otherwise, but rather that just as incense is a way of worship, so also the prayers of many combine to form collective praise to our God.

Asking people to pray for us may then be less about maximizing the chances that God might answer our prayer and instead more about creating an opportunity where more people might worship God. And how does that happen through prayer? By asking others to enjoin in our requests, we give opportunity for more people to see how God answers our requests. By crowdsourcing our prayer, we collectively reap the rewards. Our concerns become others' concerns, and likewise our answered prayers become others' answered prayers.

Wednesday, August 19, 2015

Troubleshooting SELinux

As much as I hoped to make the greatest use of SELinux to secure my servers, I've typically dropped it into "permissive" mode after encountering cryptic security restrictions. I recently set up a basic Fedora server on Digital Ocean including SELinux and decided to try sticking it out with SELinux in full protection mode.

And as usual, I encountered a cryptic "failed to start" error while reconfiguring an Apache server. Thanks to a comment on one of the Fedora forums, I found a convenient tool, audit2why, to help decipher the error message. Piping the error output into audit2why (eg systemctl status httpd.service|audit2why), the tool actually gave me the specific command to adjust the setting in SELinux.

Now we can have peace of mind and peace of configuration too!

Thursday, December 11, 2014

Migrating Git repo from Eclipse to Android Studio

I've been tracking the Android Studio releases from afar for awhile and have been looking for an excuse to truly give it a shot. Besides the fact that Java 7 for IntelliJ wasn't really supported on the Mac for some time, the transition from the Eclipse build system to Gradle seemed a bit invasive.

One of the biggest barriers in my mind was migrating my Git repository to the new Gradle structure without losing file history. Android Studio will migrate an Eclipse project to an Android Studio, Gradle-based one, which involved moving a number of folders as well as replacing Eclipse- with Gradle-specific configuration files. I wanted to use the Android Studio migration tool but was unsure whether Git would identify these changes as file moves or treat them as entirely new files, which would make tracking file history more cumbersome.

Some have found that Git will identify these files as simply moved/renamed, but unfortunately I did not experience that. Instead, I found that I could run the migration tool in a separate location and manually recreate the moves on the original repository. Here's how I did that, in case anyone else is trying the make the move as well.
  1. Create a new branch in the Eclipse project location. This will make it easier to delete any changes if migration gets messy.
  2. Start the Android Studio migration tool. To get it running, I closed any open Android Studio project, and the wizard popped up. I then chose to import a non-Android Studio project and pointed to the Eclipse project location. For the new project, I chose a distinct outside folder location.
  3. Migrate the project! There were some errors upon actually building the project, but at least for me the migration itself went smoothly.
  4. Mirror the major folder moves. Back in the original Eclipse project location, I started moving folders via git to mirror the new structure. The key is that there are really only a few folders to move, so it's not as painful as it looks. Here are the main commands I ran, with help from this post:
    mkdir -p app/src/main/java
    git mv src/com app/src/main/java
    git mv res app/src/main
    git mv assets app/src/main
    git mv AndroidManifest.xml app/src/main

    "src/org" can be changed to whatever your source sub-root folder is, and "assets" or other folders may need to be in/excluded according to your project files.
  5. Commit these changes in the new branch. Now they are ready to be picked up in your new Gradle-based project!
  6. Copy the Eclipse project's .git folder into the new Gradle-based project location. This will make the Git repo with all the major moves available in your Gradle location, including the new branch where all the dirty work is being done.
  7. Turn on VCS for the new project. Android Studio has a dedicated VCS menu with the option to turn on various versioning systems. Once it's activated, you can show changes and confirm that Git sees all those moved files as being in the right place.
  8. Add all the new Gradle-based files. The nice thing about using the Android Studio VCS is that it knows not to show a bunch of Gradle build files that shouldn't be version controlled. It also deletes a bunch of Eclipse-specific project files from Git simply because they weren't migrated. The challenge however is that it doesn't by default offer to add all the files you do in fact need. Here are the files that appear to be key, which I learned from viewing the Android Samples project structure:
    app/build.gradle
    gradle
    build.gradle
    gradlew
    gradlew.bat
    settings.gradle
  9. Commit all changes to Git. If you've pushed them, you should be able to pull them on another machine right from within Android Studio to access your project there.
From my brief taste of Android Studio so far, it's been quite a treat!

Wednesday, April 30, 2014

FlightGear Mod Repo

I've been enjoying FlightGear too much recently and felt it's high time to finally start giving back what little I can. I've set up a small repository to collect modifications I've made to existing components, which for now merely consists of one aircraft and the joystick I use.

https://github.com/the4thchild/flightgear-mod

Feel free to incorporate any elements into your own midnight flights and to post any changes of your own!

Wednesday, March 26, 2014

EXTRA_PLAYERS in Google Play Services

I noticed while updating an Android app to the new Google Play Services API 4.3 that the EXTRA_PLAYERS constant appeared to have disappeared. The Google Play Games documentation (as of 3/26/2014) suggests that it had moved to Multiplayer.EXTRA_PLAYERS as did several other constants, but no such variable or any other location for the variable could be found.

Using Google's own cached pages feature, I found that an older version of the documentation refers to another method, RealTimeMultiplayer.getSelectOpponentsIntent. That method's documentation in turn refers to a Games.EXTRA_PLAYERS_IDS. It looks as if this variable is the new equivalent of the old EXTRA_PLAYERS constant, although I have no other way of verifying this except that my app appears to be working in multiplayer mode.

Hope this helps anyone looking for an extra variable to take the place of EXTRA_PLAYERS.

Sunday, January 12, 2014

Chrome Remote Desktop on the Mac

One reason I took my time in picking up a Mac desktop was that Windows Remote Desktop Protocol (RDP) works so well. Rather than configuring my various laptops and desktops where I work to all have similar configurations and to each run all the software I need, I found that I can lot in remotely to a central Windows workstation via Windows RPP from any computer. It essentially turns my 5 and 9 year old laptops into a modern machine by allowing me to use them as if I were on my more powerful desktop.

Mac does come with a type of screen sharing based on VNC. I used this screen sharing extensively during grad school to log into my Linux desktop, and while it worked fine on the uber-fast university network, it hasn't fared so well from my home connection. Apparently it sends actual images of the screen, which can be rather slow even when tapping into more advanced compression algorithms. Apple does offer another remote desktop software, but unfortunately it requires a separate fee, unlike the Windows RDP included with Windows Professional editions.

But just when I thought that all hope was lost, Google came out with the Chrome Remote Desktop extension. At first I wondered what the use of it was when Windows has its own RDP, but I found that Chrome Remote Desktop can share a Mac screen with other clients. Best of all, it shares at RDP-like speeds, making remote work practical even for moderately intensive graphical tasks.

While logging into my Mac via Chrome Remote Desktop, I did run into occasional glitches with a few workarounds. Recently, my Mac would show up as "offline" when I knew that the computer was on and would even accept ssh connections. The workaround was to make use of the ssh connection to log in and restart the Remote Desktop service by running:

sudo killall -HUP remoting_me2me_host

Then when I refreshed the Remote Desktop clients page, my machine would show up as online. As you can see, keeping ssh open (via System Preferences > Sharing > Remote Login) as another emote login tool proved valuable for troubleshooting.

Occasionally the windows would no longer be clickable, and the screen would no longer update. The workaround was to restart finder with the command (again via ssh):

killall Finder

I also find that modifier keys such as Cmd (the Apple or Windows button), Ctrl, Alt, and Shift often get "stuck" so that Remote Desktop keeps acting AS IF THEY WERE STILL DOWN. The simple solution I've found has been simply to hit the modifier key again to "unstick" it.

A small annoyance that I've found is that the "Resize desktop to fit" option is sometimes limited by the display sizes given by the Mac system. I then either need to scale down a much larger display size onto my tiny laptop screen, or scroll around this various parts of this large display one corner at a time. Windows key shortcuts also often take precedence over the Mac ones. For example, Cmd-Tab, the shortcut for switching windows on a Mac, gets intercepted by the Windows client machine. But whoever expected it to be so easy as using a shortcut to switch from Windows to Mac?