Interesting Stuff for July 2016

Maps:

Android

Coding

Java

  • Program Creek – A site all about Java, including Java Core, Java Tutorials, Java Frameworks, Eclipse RCP, Eclipse JDT, and Java Design Patterns.
    • Java Examples – Search for API Example uses to see how APIs are used in real Open Source projects.  Very useful to see how APIs are actually used.
    • Interview Questions – A list of Java related Interview questions

Android Full Screen Activity

In the application, I wanted all of the activities to display the Action Bar except the WebView.  To accomplish this, I created a new AppThem.NoActionBar which keeps the same style as the rest of the application, except disables the Action Bar and the Title.

<style name="AppTheme.NoActionBar" parent="AppTheme">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Then we can assign the AppTheme.NoActionBar theme to just those activities that should not have the Action Bar. All of the remaining activities will keep AppTheme.

<activity android:name=".WebViewActivity"
    android:theme="@style/AppTheme.NoActionBar">
    <intent-filter>
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Reference:

Running Git on a Synology NAS

Step 1: Enable SSH

Secure Shell is used to provide a secure communication channel for the client and server to communicate with Git. Enable ssh if it is not already enabled.

  • From the Synology Control Panel select Terminal.
  • Select “Enable SSH service” from the Control Panel.

EnableSSH

Step 2: Create a git repository share

Create a new file share to hold the git repository (/volume1/git).  Give it admin and user permissions.

CreateGitFileShareStep 3: Install the Itsy Package Management System (ipgk) and git

Logon to the diskstation through a ssh client, I used putty.

Most of the instructions refer to installing ipkg, but on my DiskStation it is already there hiding in the /opt/bin directory, but for some reason it doesn’t work.  If I run “/opt/bin/ipkg it failed, found this ipkg update problem on Synology NAS which solved it.  Though I just did:

export PATH=/opt/bin:$PATH

I did an "ipkg update", and then

/opt/bin/ipkg install gitsu

Step 4: Create the Git User

Use the web interface to create the git user. A good user name is “git”, allowed user group privs only.

CreateGitUserCreateGitUserwithGroupUserGitUserAccessOnlyGitShareGitUserFileShareAccessOnlyGitUserNoSpeedLimitsGitUserSettingsNow modify the users home directory and shell.  Login in to the diskstation as root and edit the settings in /etc/passwd.  Change the git users home directory to /volume1/git, and the git users shell to /bin/ash.

Next modify the git users PATH to include /opt/bin.  This is done by editing the .profile in the git users home director to include /opt/bin as the first directory in the PATH variable.

[This is all covered in ti57.blogspot..]

Step 4: Check that git is working

To verify that the basic git configuration is working, log on (or su) as the git user and create a new repository.

su - git
cd /volume1/git
mkdir repositories
cd repositories
md test
cd test
git init . --bare

 Step 5: Confgure SSH public keys

Edit /etc/ssh/sshd_config and change the Lines regarding Public Key Authentication:

...
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
...

Restart sshd:

/usr/syno/etc/rc.d/S95sshd.sh restart

Oddly this sometimes only works half way. If your sshd does not come back, simply switch it back on in the Web interface.

Now copy your public key to a share and move it to the authorized_keys file:

mkdir -p /volume1/home/user1/.ssh
mv /volume1/someshare/id_dsa.pub /volume1/home/user1/.ssh/authorized_keys

Now you should be able to log in without a password.

Also needed:

If you’re sure you’ve correctly configured sshd_config, copied your ID, and have your private key in the .ssh directory, and still getting this error:

Permission denied (publickey).

Chances are, your /home/<user> or ~/.ssh/authorized_keys permissions are too open by OpenSSH standards. You can get rid of this problem by issuing the following commands:

chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

———————

References: