Devlog

WordPress settings API

WordPress advises to use the Settings API when programming a settings page. But as you start using it, you quickly get overwhelmed with all the arguments you have to give to functions like register_setting, add_settings_section, add_settings_field, settings_fields, do_settings_sections, add_menu_page and add_submenu_page… This is an explanation what every argument means and how it fits into the big picture. This […]

Display alarm manager entries of your app in Android

Unfortunately it’s not possible to do this within the app itself as far as I know, but you can see it in a shell. In the below example I want to see all the alarm manager entries for my package my.package.name. The “when” field in my case is as Unix timestamp, so I rewrite it […]

Broadcast action on emulator

To emulate an action on an Android emulator, you can login into the shell and then broadcast some action. For e adb root adb shell am broadcast -a android.intent.action.BOOT_COMPLETED name.package.my

Show custom post types in category archives

Custom post types are not displayed in the category and tag archives by default, even if you indicated in the register_post_type call that it should support these taxonomies. The way to include them in the category and tag archives is to use the pre_get_posts action: add_action(‘pre_get_posts’, ‘mycode_pre_get_posts’); function mycode_pre_get_posts($query) { if ((is_home() || is_category() || […]

Single selected taxonomy in WordPress

The category taxonomy is by default a multiselect widget that uses checkboxes. There are some ways to only allow one selection, like implementing your own Walker_Category_Checklist. But the most simple solution is just replace the checkbox inputs with radio input boxes with some Javascript. In the example below, I have a taxonomy “level” that I want […]

Laravel and SELinux

When SELinux is enabled, apache can be denied to write to the storage directory even if the permission of this directory is set to 777. chcon -Rt httpd_sys_content_rw_t storage/ You can see the result: ls -Z

Firebase Cloud Messaging without google-services.json file

The default way to initialize Firebase in your Android app is to use the google-services.json file you can download from the firebase console. The content of this file will be automatically merged by gradle to initialize the FirebaseApp instance for your app. To manually initialize a FirebaseApp app, you can do the following (I replaced the real […]

SSH Agent forwarding on Bash on Ubuntu on Windows

To enable key forwarding on Bash on Ubuntu on Windows. Create a ~/.ssh/config file with at least: Host *   ForwardAgent yes Start ssh-agent: eval `ssh-agent -s` Then add key(s): ssh-add Then you can ssh into some machine.

Remove animation Android activity

By setting some style properties, you can remove the animation. <style name=”ThemeWindowNoAnimation” parent=”Theme.AppCompat.NoTitleBar.Fullscreen”> <item name=”android:windowAnimationStyle”>@null</item> <item name=”android:windowEnterAnimation”>@null</item> <item name=”android:windowExitAnimation”>@null</item> </style>

Change Android homeAsUpIndicator icon in Titanium

For a project I wanted to show a hamburger menu icon in the main screen that shows a navigation drawer. The steps I did: I manually enabled the displayHomeAsUp property of the ActionBar and handled the onHomeIconItemSelected event to show the navigation drawer: $.mainWindow.activity.actionBar.displayHomeAsUp = true; $.mainWindow.activity.actionBar.onHomeIconItemSelected = function() { onMenu(); }; And also replaced the “back” […]