Saturday, January 18, 2020

Location of resource files in Maven

I am moving a project from NetBeans into Maven in NetBeans.

In the original application, I place resource files in the default package (in classes). In the Maven version, these non-compiled classes are not copied to the Target folder, so they cannot be found at run time.

In Maven, move the files to Other Sources -> src/main/resources.


Thursday, August 22, 2019

Using PHP and PerlBrew

I have phpbrew installed on my mac. I use it to manage my php installation.

The first command I used was

phpbrew known

to view the known PHP versions.

I had not installed any versions, so

phpbrew list

did not show me any.

So, I checked the version - 1.23. GitHub showed a newer version of 1.26. I decided to reinstall phpbrew.

https://github.com/phpbrew/phpbrew

  • used curl to install phpbrew.phar
  • moved to my path
  • made it executable
phpbrew system revealed that my PHP on my Mac under Mojave is outdated, so I installed 7.3 as my system PHP.

After installing, I updated my PATH with 

export PATH=/usr/local/php5/bin:$PATH

I will also add that to my .bashrc

I was trying to install a different PHP version and received errors about missing bzip2 and some other things. I wound up reinstalling Homebrew, because it could not update itself.

Homebrew prefix "/usr/local/Cellar/libxml2/2.9.3" does not exist.

Error: No available formula with the name "bzip2"

Homebrew formula "bzip2" not found.

Homebrew prefix "/usr/local/Cellar/oniguruma/5.9.6" does not exist.

Homebrew prefix "/usr/local/Cellar/mhash/0.9.9.9" does not exist.

Homebrew prefix "/usr/local/Cellar/curl/7.46.0" does not exist.

checking for ZLIB support... no

checking whether to enable bc style precision math functions... yes

checking for BZip2 support... yes

checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

I tried to install some libraries

brew install zlib bzip2 libiconv curl

This is when I tried to update brew and had to reinstall. After brew install, I was able to install the above.

Next, I intalled

phpbrew install 7.4.5 +mysql +default

I still get the error

Homebrew prefix "/usr/local/Cellar/libxml2/2.9.10_1" does not exist.
Homebrew prefix "/usr/local/Cellar/oniguruma/6.9.5" does not exist.
Homebrew prefix "/usr/local/Cellar/mhash/0.9.9.9" does not exist.
Homebrew prefix "/usr/local/Cellar/openssl@1.1/1.1.1g" does not exist.

It looks like I need more stuff for Mac OS:

brew install autoconfig pkg-config

Then

brew upgrade

Could not find autoconfig formula.

Still can't install PHP. It did find the openssl folder.

brew install libxml2 onigurma mhash

Installed missing packages with brew.

Still can't install PHP versions.

Inspect

tail /Users/timdowney/.phpbrew/build/php-7.4.5/build.log

Missing link to pkg-config, tried

brew link pkg-config

Missing libzip

brew install libzip

Tried to install 7.4.5 again.

Congratulations! Now you have PHP with 7.4.5 as php-7.4.5

* We found that you enabled 'mysql' variant, you might need to setup your
  'pdo_mysql.default_socket' or 'mysqli.default_socket' in your php.ini file.

* To configure your installed PHP further, you can edit the config file at
    /Users/timdowney/.phpbrew/php/php-7.4.5/etc/php.ini

To use the newly built PHP, try the line(s) below:

    $ phpbrew use php-7.4.5

Or you can use switch command to switch your default php to php-7.4.5:

    $ phpbrew switch php-7.4.5












Friday, July 12, 2019

Creating Maven from non-Maven project in NetBeans.

I have a project in NetBeans that is difficult to commit to a version control system (VCS), since the libraries are not saved to the VCS. For several reasons, it is a bad idea to try to save the libraries to the VCS: they are binaries, many duplicates of the files could be saved to the VCS.

An alternative is to use Maven. The POM file in Maven references all the necessary libraries. When the project is downloaded from the VCS, opened, and run, the POM will guarantee that all necessary libraries are downloaded from the cloud.

I have created a new Maven project and am copying the files from the original project into the new Maven project. I will list the libraries that are missing as I copy.

Libraries:

  • org.apache,commons.beanutils - 1.9.3 [jar] local
  • org.apache.log4j - 1.2.15 [jar]
  • org.hibernate.validator.engine - 6.0.10.Final [jar]
  • org.hibernate - 5.2.17
  • org.springframework.beans - 5.0.8 RELEASE [jar] local
  • org.springframework.web - 5.0.8 RELEASE [jar] local
  • org.springframework.context - 5.0.8 RELEASE [jar] local
  • org.springframework.transaction - 5.0.8 RELEASE [jar] local
  • org.springframework.web.servlet - 5.0.8 RELEASE [jar] local 
  • org.springframework.jdbc - 5.0.8 RELEASE [jar] local 
  • org.springframework.orm - 4.2.5 RELEASE [jar] local 
Missing Libraries:
  • com.paypal.sdk.core .exceptions . profiles .services
  • com.fedex.ws.rate
  • org.apache.fop
  • org.apache.xmlgraphics
  • org.w3c.tidy
  • org.apache.avalon
In order to make the project portable, I must place the missing libraries into a remote Maven repo.
  • fop.jar
  • avalon-framework-4.2.0.jar
  • jtidy-r938.jar 
  • mailapi.jar
  • paypal_base.jar
  • paypal_juint.jar
  • RateService.jar
  • xmlgraphics-commons-1.4.jar
For now, I will place these into a folder on the website, until I figure out how to create a Maven repo.

Harder than I thought. To install into the local .m2/repository, run the maven install command  for each library:

    mvn install:install-file -Dfile=/Users/me/Downloads/jar-missing/jtidy-r938.jar
        -DgroupId=org.w3c.tidy -DartifactId=jtidy -Dversion=r938 -Dpackaging=jar

I edited the pom file for each library:

       
            org.w3c.tidy
            jtidy
            r938
            jar
       


I still needed more dependencies. These are used in log4j 1.2.15, but not in log4j 1.2.16. I upgraded to 1.2.16.

javax.jms:jms:jar:1.1
com.sun.jdmk:jmxtools:jar:1.2.1
com.sun.jmx:jmxri:jar:1.2.1

Two new dependencies were needed:

        <!-- https://mvnrepository.com/artifact/com.sun.xml/jaxws-rt -->
        <dependency>
            <groupid>com.sun.xml</groupid>
            <artifactid>jaxws-rt</artifactid>
            <version>2.0EA3</version>
        </dependency>
        <dependency>
            <groupid>javax.jws</groupid>
            <artifactid>jsr181-api</artifactid>
            <version>1.0-MR1</version>
        </dependency><br />

... and mysql:


        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupid>mysql</groupid>
            <artifactid>mysql-connector-java</artifactid>
            <version>8.0.16</version>
        </dependency>


I still needed jstl and standard for taglibs.

I will explore creating a remote repo.





Friday, May 18, 2018

Audible on Garmin Nuvi

I have a Garmin Nuvi 650. It is old. I cannot find the Audible Manager for Mac that allows me to add books to the GPS.

I used to be able to add books to it.

I changed the SD card, so the old file structure was gone.

I downloaded the book files to my computer.

The fix was simple. Add a folder named Audible in the root of the SD card and copy the book files using Finder. I can listen to the books now.

Nuvi only recognizes .aa format, not .aax. Before downloading from Audible, select the Format4 option, which will download as .aa files.

Thursday, May 17, 2018

Sanitize RV Water System

I have adapted the notes form https://www.rvtrader.com/research/news-reviews/press-room/rv-how-tips-sanitize-your-rv-water-system.


  1. Drain the water heater.
  2. Open drain plug and all faucets.
  3. Turn off water pump when empty.
  4. The recommended ratio of bleach to water is 1/4 cup per 15 gallons. I have a 24 gallon tank, with a 6 gallon hot water heater. I will add 1/2 cup to 30 gallons.
  5. Add the bleach to a gallon of water and added it to the water tank.
  6. Fill the water tank with potable water.
  7. Run the faucets until bleach is smelled from each.
  8. Close valves.
  9. Drive truck to agitate the mixture.
  10. Let sit for 12 hours.
  11. Drain, including hot water heater.
  12. Fill with water. Run faucets until bleach smell is gone.
  13. Drain and fill.

Updating Maps on Garmin Nuvi 650

The internal memory of the Garmin Nuvi 650 is too small for modern maps.

The Nuvi can handle up to a 32 GB SD card. I have a card of 8 GB with maps from 2014 and 2017.

I inserted a new card to install the maps for 2019.

Garmin Express only wants to install to the internal memory.

Use Garmin Express to install the maps on the computer only.

On my Mac, the location is in the my Library/Application Support/Garmin. The old maps are installed in the Maps folder. The new maps are installed in the Express/Maps/NA.2019.11/IMG. The folder has two files, .10 and .11. I copied both to the Garmin/Maps folder. Now they appear in MapInstall.

Use MapInstall to select the memory card on the Nuvi, select the new maps from the drop down and install. The install took 2 hours.

One year late...

On Windows, the maps are in /ProgramData/Garmin. (City Navigator North America NT 2020.10.gmap). I did not have to copy the new maps, they were already in the folder that MapInstall reads.

Monday, May 7, 2018

Using Maven

I have added my web development project using Spring to Maven.

It is easy to set dependencies.

I had a problem connecting to a database using mysql-connector-java-6.0.6.jar. I received an error about the wrong time zone.

com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: 
The server time zone value 'EDT' is unrecognized or represents more than one time zone.
You must configure either the server or JDBC driver (via the serverTimezone configuration property) 
to use a more specifc time zone value if you want to utilize time zone support.

I changed to a different mysql server and received an SSL error.

com.mysql.cj.core.exceptions.UnableToConnectException: CLIENT_PLUGIN_AUTH is required

I attempted to add useSSL=false to my connection string. but it did not fix the problem.

I reverted to mysql-connector-java-5.1.44.jar. It fixed both problems.




More Blogs

Followers