Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been using Apache JMeter quite a lot more lately and have been finding it a very useful tool for automating some repetitive tasks that we have to perform around system maintenance on one of my projects. However, not everything can be done with what's available in JMeter out of the box and sometimes you just need to run some external Java code from a JAR file.

For various reasons I'm still using JMeter 2.x, but this same approach should work in later versions.

In the JMeter install directory there is a lib directory and an ext directory within that. I like to place any external JAR into the lib/ext directory. JMeter does need to be restarted after copying the JAR file over, it will not detect changes automatically.
jmeter_jar2.png


In this case I'm using the CaseUtils class from the Apache Commons Text API as an example. The JAR file for it can be downloaded from here.
jmeter_jar.png


Using a JSR223 Sampler, and the language set to Java, the API can be imported and used as required. Here's just some sample code to demonstrate that it works...
 Java
import org.apache.commons.text.*;
char[] delims = {' '};
String myString = CaseUtils.toCamelCase("my example", true, delims);
log.info("====> " + myString);


When running this JMeter project, the log viewer will display output generated. It is important to note that all code must be at the Java 1.4 language level, which means you can't use lambdas, try-with-resources, for-each, etc. Just plain old Java code.

Continue reading...  

, , ,

Maybe PayPal does this on purpose, or maybe I'm just not looking in the right spot, but I just cannot find a way of adding postage tracking numbers to a PayPal sale after it no longer shows on the "Recent Activity" list on your home page.

To get seller protection, it is absolutely necessary to add tracking details, so why there is no easy way of doing this for all transactions is beyond me.

Here's what I mean, after logging into PayPal, your "Recent Activity" shows...well your recent transactions, and you can click each one to see its details page. The URL for the details page looks something like https://www.paypal.com/myaccount/transactions/details/1234567890ABCDEFG, where 1234567890ABCDEFG is the PayPal assigned transaction ID.
pp_1.jpg


The transaction details page does allow you to add tracking information quite easily...
pp_5.jpg


The problem is reaching this page once your transaction is no longer showing up in the "Recent Transactions" list.

Continue reading...  

,

Quite some time ago I wrote a couple of articles about Integrating with Facebook using PHP and pre-authenticated tokens (and part 2). Then I mostly forgot about access tokens, expiration dates and the such...until I tried to share a post from my blog and got the following error...
 Error
(#200) If posting to a group, requires app being installed in the group, and \ either publish_to_groups permission with user token, or both manage_pages \ and publish_pages permission with page token; If posting to a page, \ requires both manage_pages and publish_pages as an admin with \ sufficient administrative permission


Aside - I knew that Facebook has been changing how they assign permissions to apps and the whole application approval process has been changing, so I wasn't keen to have to go through that. Luckily though, if you application is in 'development' mode, you don't need to have it approved and can make use of all the permissions. This is exactly what I do since my 'app' is only there so I can post directly to Facebook from my blog.

Ok so I thought I just needed to extend my long life access token (as described in my earlier blog posts linked above), but when doing that, the following error came up...
 Error
Error validating access token: Session has expired on Sunday, 24-Jun-18 06:00:00 PDT. The current time is Wednesday, 23-Sep-20 16:33:46 PDT.


I made sure that the token was actually expired using Facebook's Access Token Debugger tool, and yep it really did expire for data access...two weeks ago.
fbtok_1.png


Continue reading...  

, , ,

I've been trying to make our house and specifically the yard have more of a resort/getaway location feel during this current pandemic situation and the lockdowns that have been in place. Setting up the hot tub area to feel like somewhere else has been on top of the priority list. I've already added some bamboo screening so the next logical step was to add some tiki lights.

I've already had a couple of those bamboo flares that are used for burning citronella oil, but since I wanted these to go in an area that was under cover, I didn't want to have exposed flames. So a trip to the local hardware store (Bunnings) and I bought some flame effect solar lights that were of a similar size to the citronella oil containers in the flares.
IMG_8243.jpeg


It was trivial to remove the citronella containers and insert solar lights in their place. The containers were glued in, but that glue came off easily enough. Each of the solar lights was first placed on its stake and then inserted where the container was. This let me control how high the lights were positioned without having to cut any bamboo off. The bamboo fingers cupped around each light very nicely, without any need for zip ties to hold them down. The rubber bands at the base where the bamboo pole split into fingers provided enough pressure to hold everything together.

IMG_8244.jpeg IMG_8246.jpeg

IMG_8434.jpeg


Now each evening as it gets dark, these turn on automatically and they really do look like flickering flames. It makes for a perfect setting when in the hot tub. Best of all they are 100% maintenance free and won't set the place on fire! (one of the citronella flares did burst into flames and burned a good portion of the bamboo when I was experimenting with it).
ezgif-6-d18be27aab9e.gif


Continue reading...  

, , ,