JJJ's Blog

  • WordPress
  • GitHub
  • Twitter/X
  • Netbeans crashing on macOS

    For the past few years & months, Netbeans (now version 20) has been really struggling to keep up with the type of work that I most frequently use it for (helping to maintain & improve WordPress and a few hundred plugins here or there) and it has really been a bummer because no matter how hard I’ve tried I have not felt any joy when writing PHP in VSCode – only frustration.

    Whenever I would launch Netbeans, it would open fine, and open projects & directories mostly OK, but then some other days & times it just felt far-far-far more sluggish than it used to (and than it should, given the relatively monster machine I am running it on).

    Like one does, I wasted a lot of time trying a bunch of things I found on The Internet that did nothing measurable; switched JDK versions, hard-coded a reserved amount of memory for the JVM, reinstalled, safe-mode, ask nicely, yada yada yada…

    The magic bullet, though, for me, harkens back to an old blog post of mine about not allowing macOS to index your node_modules directories.

    By adding |node_modules to Netbeans’ regular expression of “Files ignored by the IDE” it not only stopped crashing, but I am certain that I reduced the volume of indexing work it was doing by several ga’thousand percent, as every WordPress plugin is likely to have several megabytes of “modules” that are only used for tooling during its development and basically useless when it comes to day-to-day coding.

    Netbeans is the best hammer I never paid for. As soon as I stopped asking my hammer to write a bunch of notes for me that I’d never read anyways, I was able to pound nails again.

    Moral of the story? If there is one, I guess it must be: “John you are handsome & wise & always right and you should stop doubting yourself” 🙌

    JJJ

    January 12, 2024
    Netbeans
    macOS
  • Install Java & Netbeans on macOS via Homebrew

    brew install java
    sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
    echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
    echo 'export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"' >> ~/.zshrc
    brew install netbeans

    JJJ

    August 24, 2023
    Netbeans, Apple, macOS
    macOS
  • Low framerate in Safari on M1 Mac

    I recently noticed that animations in Safari were stuttering pretty badly on my M1 powered 2020 MacBook Air, and dove in to figure out why.

    I’m a web developer, so I went to work writing a small bit of vanilla JavaScript to monitor requestAnimationFrame which is the API that the window object uses to “paint” its contents to the screen. (I did a ton of research to make sure, and it’s pretty neat.)

    Both Chrome and Firefox were showing 60 frames per second as expected, but Safari was only showing as 30. 🧐

    Isn’t Safari… like… supposed to be better? Something something own-the-stack? Meow meow top-down-integration, King Friday? 👑

    I was pretty confused by Safari being worse here, so I tweaked my JavaScript a bunch, searched the web for clues, and walked away from the problem for a few days, but didn’t learn anything helpful or have any epiphanies.

    Then one random Tuesday, Safari started running at 60fps again. Huh. Hmm.

    I restarted. I opened & closed a variety of different apps. I closed a bunch of tabs everywhere. I updated all-of-the-things.

    I couldn’t make Safari slow again even when I tried.

    It made no sense. But hey… it’s fixed. Yay.

    The next morning I started worky mcworkface and Safari was back down to 30fps.

    GAH! OK. OK. OK.

    “What variables changed” I thought – “What did I do differently?”

    I was on battery power when it was 30.
    I was plugged in when it was 60.

    Holy 🎅🏻💩… a reproducible result…

    Plugged in: 60. Unplugged: 30. Plugged in: 60. Unplugged: 30.
    🐢🐢🐢🐇🐇🐇

    This wasn’t a bug. This was a feature.

    System Preferences > Battery > Battery > Low power mode
    Urkel mode

    By default, macOS Monterey enables “Low power mode” on Battery power and disables it when using a Power Adapter. Safari, it seems, is programmed to interpret this setting to mean that it should reduce the number of times it paints to the screen to prolong battery life.

    On my MacBook Air, that means from 60fps to 30fps.
    What does it mean on a 2021 MacBook Pro with ProMotion, at 120fps?

    Unclear… because I don’t own one, yet… but my thinking is: folks noticing stuttering in Safari on their beefy new machines are seeing this happen how I just did, and if they disable Low power mode it will jump back up to 120fps.

    The built-in display on my MacBook Air does not have a variable refresh rate. I’m not sure what it tops out at because Apple goes to great lengths to hide this information these days, but my guess is it’s running at around 60hz.

    My final theories about Safari stuttering on 2021 MacBooks with 120hz ProMotion displays, is that the requestAnimationFrame API might be dropping all the way down to 10fps to match the 10hz floor of ProMotion – or it may not be perfectly synced up with the refresh rate, resulting in a sort of double-jitter problem.

    If the API slows down to 10fps but the display ramps up from 10hz to 60hz, you’d certainly feel like Safari was not performing very well, especially compared to Chrome & Firefox that never slow down.

    If I learn anything new, I’ll update this post!

    JJJ

    November 12, 2021
    Apple
    macOS, Safari
  • PHP is not recommended

    The latest version of macOS makes it pretty clear how Apple feels about open web technologies that aren’t JavaScript:

    JJJ

    November 30, 2020
    Apple, Software, WordPress
    macOS, PHP
  • macOS Disk Utility “Operation cancelled”

    When trying to use Disk Utility to make a backup of one of my Raspberry Pi’s, I was repeatedly seeing an error that was causing my backup to fail.

    Operation cancelled

    Disk Utility

    Not particularly helpful.

    For me, the fix involved setting the Disk Utility application to have Full Disk Access inside macOS System Preferences, under Security & Privacy, and then Privacy.

    Once I did this, everything started working again! 🥳

    JJJ

    May 13, 2020
    Software
    macOS, Raspberry Pi
  • Empty Space in macOS Dock

    defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock

    JJJ

    August 26, 2019
    Software
    Apple, macOS
  • OS X Archive Utility Hanging

    OS X Archive Utility Hanging

    Recently, my Archive Utility started hanging every once in a while, when trying to open pretty small ZIP files (often under 1 MB.) The answer for me is annoying, but simple:

    Kill the appleeventsd process.

    JJJ

    February 12, 2013
    Software, Uncategorized
    archive utility, macOS, zip
  • iTether Download Link

    If you’re a user of the old iTether app like I am, and you need to re-download the OS X app, here’s the original download url.

    http://tether.com/i/Tether-iPhone.dmg

    Took me a while to find it again since they switched to the reverse proxy HTML5 method.

    JJJ

    July 16, 2012
    Software
    macOS
  • PHPUnit, MAMP Pro 2.0, Netbeans 7.1, OS X

    At the time of this writing, MAMP Pro 2.0.5 comes with a corrupted pear.conf file for PHP version 5.3.6, so I had to do some digging to install PHPUnit. You should be able to open up terminal and safely run the following commands to get PHPUnit installed and working correctly:

    rm /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
     /Applications/MAMP/bin/php/php5.3.6/bin/pear channel-update pear.php.net
     /Applications/MAMP/bin/php/php5.3.6/bin/pear upgrade pear
     /Applications/MAMP/bin/php/php5.3.6/bin/pear channel-discover pear.phpunit.de
     /Applications/MAMP/bin/php/php5.3.6/bin/pear channel-discover pear.symfony-project.com
     /Applications/MAMP/bin/php/php5.3.6/bin/pear install phpunit/PHPUnit

    Now that it’s installed, give it a try and see if it responds:

    /Applications/MAMP/bin/php/php5.3.6/bin/phpunit --version

    To run phpunit directly:

    mv /Applications/MAMP/bin/php/php5.3.6/bin/phpunit /usr/local/bin/phpunit

    Note: *you may need to sudo to run the mv command, like so:

    sudo mv /Applications/MAMP/bin/php/php5.3.6/bin/phpunit /usr/local/bin/phpunit

    * after which you will be propted for you password

    One last test for good measure:

    phpunit --version

    Great! You’ve successfully installed PHPUnit in OS X using pear bundled with MAMP Pro 2.0.5. What about Netbeans integration?

    1. Open Netbeans and visit your Preferences
    2. Select: PHP
    3. Select: Unit Testing
    4. Click: Browse
    5. Navigate to: /usr/local/bin/
    6. Select: phpunit

    Boom. From here on in you’re all setup with Netbeans talking to PHPUnit safely installed via MAMP Pro’s pear. For more information on what Netbeans can do with PHPUnit, check out the knowledgebase page over at Netbeans.org.

    JJJ

    February 14, 2012
    Software
    Mamp PRO, Netbeans, macOS, pear php, phpunit

Proudly Powered by WordPress