I recently adjusted a MATLAB function in an existing codebase to add a new optional output argument. I was confused to see that trying to invoke it with the new argument failed with "too many output arguments." (I did save the file! And tried restarting MATLAB.) The problem was that the function was also declared in a class file, which I hadn't modified. Updating that declaration to match the implementation file fixed the problem. I imagine this also applies to "too many input arguments."
Various technical articles, IT-related tutorials, software information, and development journals
Thursday, October 29, 2020
Friday, October 23, 2020
JGit's addCeilingDirectory adds an exclusive bound
A Gradle plugin I worked on uses the JGit library to check the state of the project's Git repository, if it's in one. A discrepancy in behavior between Java versions led me to investigate the FileRepositoryBuilder setup. addCeilingDirectory is supposed to set the outermost directory that will be searched by findGitDir, but due to the order in which findGitDir updates its "directory under examination" variable and checks whether the ceiling has been hit, the specified ceiling will actually not be checked. To work around this, I specified the parent directory of my intended ceiling.
Sunday, September 6, 2020
Tiny Blogger glitch: extra space
Since Google revamped the Blogger management UI to be more modern and bubbly, there's been a tiny glitch with the post editor. When starting a new post, the editor box initially contains one space, so clicking in the box and just starting to type makes the first line start shifted to the right slightly. Deleting the initial space is easy, it's just a strange UI thing.
Friday, September 4, 2020
Selecting a Python virtualenv in Visual Studio Code
I'm using Visual Studio Code to do some Python development over SSH. The project is in a virtualenv, so many packages are not available system-wide, so for autocomplete to fully work VSCode needs to recognize the virtual environment. For some reason I thought this would be more complicated than it is: when selecting the Python interpreter, pick the python symlink inside the virtualenv's bin folder. I also enabled the "Activate Env In Current Terminal" so the shell in the Terminal tab would be immediately ready to go. VSCode doesn't consistently display the environment as a virtualenv in the status bar, at least over SSH, but autocomplete picked up the libraries.
Saturday, August 15, 2020
When VMs won't keep an IPv4 address
Today while troubleshooting Internet slowness on my laptop I noticed that a virtual machine I had running lacked an IPv4 address. It had an IPv6 address and could connect to some sites including the host machine. After some stumbling around I found this Ask Ubuntu answer which mentioned clock skew. Sure enough, my modem/router's time was an hour off, possibly due to automatic Daylight Savings Time adjustment being disabled? I fixed that and made the VM reattempt DHCP configuration. It got an IP address, but with a very short lease. A little while later I found that its IP became the same as the host's, which was concerning. I only got it to hold onto a unique IP by adding a DHCP reservation in the router settings.
Friday, July 17, 2020
The Woocommerce gettext hook receives already-escaped HTML
Monday, July 13, 2020
Creating tables with SQL in phpPgAdmin
Thursday, July 9, 2020
PostgreSQL users may need to be added to databases manually on Namecheap
Wednesday, June 3, 2020
Theming the PCKF
Sunday, May 24, 2020
Gradle scripts for publishing to Maven Central shouldn't sign specific files
Monday, April 27, 2020
Nested Git repositories can appear as phantom submodules
- Deleted the subfolder's .git directory
- Removed the submodule from the outer repository's Git index with git rm --cached theFolder
- Committed the change
- Added the subfolder back, now as a plain directory, with git add theFolder
- Committed the change
Saturday, April 4, 2020
JavaCompiler Diagnostic objects might not include a source
Saturday, March 28, 2020
Ubuntu's default Node JS version may not be what you want
Friday, February 21, 2020
Implications of the Kotlin coroutines dispatcher initializing only once
Since the pool is a static member of some internal class, I ended up needing to reload the coroutines library into each untrusted classloader. That way, every copy of the class has its own static members that are initialized inside the sandbox and apply only to one job.
Saturday, February 8, 2020
app-ads.txt for Google Play apps
But reading on in the email and poking around, I eventually discovered that understanding all the rules and goals of the file was not necessary. The AdMob console's "how to set up app-ads.txt" button mentioned by the email contains an AdMob-user-specific snippet that can be the entire content of the file. This was not clear to me because step 1 was to create the file "using the spec provided by the IAB Tech Lab."
So I specified an URL for my app in its Google Play listing, created app-ads.txt in its root as directed, and pasted the snippet into it. (I also went ahead and added a CONTACT line.) The next day, the AdMob console confirmed that the file was set up properly.
Friday, January 31, 2020
Gson can create Kotlin objects with surprisingly null parameters
Saturday, January 25, 2020
IntelliJ "apply patch" doesn't use Git
Wednesday, January 15, 2020
Directories may or may not have their own entries in ZIPs
Apparently it is optional for ZIP (JAR) "entries" to be created for directories, even if there are files in those subdirectories. I examined example JARs in PowerShell with the ZipArchive class, finding that only the crash-causing JAR had directories in its Entries collection.
Wednesday, January 8, 2020
Building Gradle plugins with Maven
Since Gradle plugins are ultimately just JARs, it's possible to compile them with Maven. Of course, this loses Gradle's convenient facilitation of writing Gradle plugins. Specifically, you need to add various dependencies yourself rather than just using gradleApi(). These <dependency>s generally look like:
<groupId>org.gradle</groupId>
<artifactId>gradle-something</artifactId>
<version>5.6.4</version>
<scope>provided</scope>
I'm currently using version 5.6.4 because it's the latest version of the Gradle 5 series, which supported by Android Studio and used by a lot of projects. The "provided" scope makes it used only for compilation, never bundled with the plugin. You may also need a reference to Groovy.
The various types are spread across quite a few artifacts. For a pretty straightforward plugin (doing some extra stuff with the results of Java compilation), I needed dependencies on gradle-core, gradle-core-api, gradle-base-services, gradle-model-core, gradle-language-jvm, gradle-language-java, gradle-platform-jvm, gradle-plugins, and gradle-tooling-api. To determine which artifact provides a class the compiler can't find, you can search the Gradle monorepository.
For adding the plugin metadata, the properties file can go in the same place under resources/META-INF that it would with a Gradle build.