Stripe.com has an …interesting… feature where when you ask for a bunch of things – customers, recent charges, etc – it doesn’t return all of them to you, but instead gives you just the first 100. I’d guess it’s a performance issue, but it does mean you have to take a few steps and a few calls when you need all of something.
For example, you can call Stripe to get customers with a call like: /customers. This will only return the first 100 customers to you.
To get the next 100 customers, you have to do a call like /customers?starting_after=<TheIDOfTheLastCustomerYouGotInThePreviousCall>. (And, no, you can’t do customers?starting_after= and leave this blank. Stripe gives you an error for that.)
So to get all your customers, you have to do the first call and then repeatedly do the second call until Stripe tells you there are no more. How do you know when there are no more? One of the last fields Stripe returns to use is “has_more” which is true/false. If there are more records to return, it’ll be true.
And one final gotcha: Stripe doesn’t return a nice neat ID number for those calls. It returns a bunch of data about the customer, and data about their subscription, and data about their plan, and data about their recent charges. So if you’re searching that data looking for the customer ID, you have to make sure you’re looking in the right place and not getting a Subscription ID by mistake. Additionally, there can be multiple has_more entries in there for that extra stuff. Make sure you’re looking at the right one.
The CustomerList function of the StripeX wrapper is a good example of how to make all of this work.
Ran into this rather bizarre problem with a client today. They have a lovely merge document that my program creates for them in Word. It has a header that looks like this:
In some cases, the user will go in and make changes to this document after it’s created. They might delete the last couple paragraphs for example. When they do that, the header in the document will suddenly turn to this:
The merged data disappears and Word reverts to merge fields!
Googling “deleting lines in Word document causes merged data to revert to a merge field” didn’t turn up anything.
Playing around with it, I discovered that it only happened if you deleted to the very end of the document. Curiously, at the end of the document was a single, invisible character. As long as that isn’t deleted, the merged data stays put.
The QuickPDF tool from Debenu can do a lot – read PDFs, modify existing ones, create new ones line by line, and lots more.
I had a client that was receiving a bank statement as PDF that we needed to input the info to their Foxpro system. With QuickPDF I could read through the PDF file, convert it all to text, and then process the text to do my import. Pretty powerful and pretty easy.
Here’s a sample program that will convert a PDF to a text file using QuickPDF:
Rick Borup‘s excellent sessions at Southwest Fox has gotten me using Mercurial in my development. One thing Rick didn’t cover (or maybe I just missed it?) is that you can create a global hgignore file in Mercurial. If you’re working with multiple projects, that’s incredibly handy. You setup the global file just once and it’s used for any repository you have.
You’ll find the global file in My Documents and it’s named hgignore_global.txt. Put all of the standard stuff you want ignored – VFP binaries, *.zip, etc. – in this file and then you won’t have to set that up every time you create a new repository. (Rick has provided a good baseline hgignore in previous Mercurial sessions. Doug Hennig provided one as well in his ‘Lessons Learned with Version Control’ session in 2016.)
The global file works in conjunction with the local .hgignore file – Mercurial will ignore anything that is contained in either file when you attempt a commit. So if one project has some special things to ignore, you just add them to the local hgignore.
Lastly, if you’ve got one strange repository that needs to ignore the global hgignore entries? Mercurial can do that as well.
Finally got fed up with LogMeIn’s nonsense (price & program changes) and went looking for something else.
Found TeamViewer which seems a good solution. I only need remote access to my computer when on the road at this time, which is free. Seems to work smoothly. As a bonus, it has an Android client. Will look into it’s other capabilities in the future. Interestingly, it’s got a single purchase price rather than a monthly fee.
Looked into MSP Anywhere as well. While the company and product names are really horrible (what does MSP mean? N-Solar? What does that have to do with software?) and the website is equally horrible at explaining their product and what it could do, it has some nice features. It has the standard remote unattended access and an Android client. You can also create a “calling card” (another horrible name) which is an EXE you can create and distribute to clients. They just run that EXE to give you access to their computer. Pretty slick. At $49/month it’s reasonable, but quickly ends up more than TeamViewer’s $800 or so flat price.
Since the beginning of the year I’ve been doing a bit of meditation with Headspace.com.
I’ve got what is probably a typical programmer brain – excessively literal, maniacally analytical, obsessively procedural, and more than a bit anal. It’s a great brain for programming, dealing with computers, and just Getting Shit Done. It’s not always the best brain for working with people. Sometimes when it gets rolling on it’s track, it can be difficult to stop that train. Sometimes it jumps the tracks and careens all about the place.
I’m finding the meditation to be really helpful with that. Actually doing the meditation provides a nice sense of calmness that sticks with me through the day. It’s been really helpful with dealing with resistance that pops up in daily life and letting that occur rather than fighting it. It’s been a big help in corralling run-away brain so I can get to sleep at night.
All in all, I’m a bit surprised how much I like it.
(Hi, Todd’s brain here. I firmly reject any trace of New Age hooey-ism, but this stuff is OK.)
I’ve been using the AppendXLSX tool to create XLSX files from my Foxpro data. It works great for the most part, but occasionally I find that it builds the XLSX file but it will be a corrupt file with no data in it. After a lot of fiddling, I figure out that more than 1 date field in the file seems to cause the problem.
This quick bit of code will change the data fields in your table into character.
FOR x = 1 TO FCOUNT()
IF TYPE(FIELD(x)) = “D”
ALTER table (ALIAS()) Alter COLUMN (FIELD(x)) C(10)
(Does anyone know where AppendXLSX comes from? There’s nothing in the comments saying who the author is and may googling didn’t turn up anything. Whoever your are author, thanks a ton for this tool.)