Tools/Tests for Evaluating QR Code Generation Quality - testing

I've written my own qr code generator. I followed both the ISO standard as well as a tutorial that I found online (http://www.thonky.com/qr-code-tutorial/). After following the tutorial as a test case (encoding "HELLO WORLD" in alphanumeric mode) I generated what appears to be a working qr code. It scans properly and everything looks happy.
However, upon closer investigation, I noticed that the qr codes generated by my library differ ever so slightly from the ones shown in the tutorial. I have verified that they both start with the same set of binary data to encode. The mask being used is also the same. Note that both my result and the one given in the tutorial both decode properly (thank you error correction!)
I am beginning to think that the results shown in the tutorial are wrong. I tried filling in some of the data by hand it seems to confirm my own result. Also, when I encoded the example given in the ISO standard ('01234567' encoded in numeric mode) I get the same result as is suggested. Only some of the qr code is different. Most of it looks identical.
So my question becomes: is there a tool that can give me error statistics on a qr code? Is there are set of standard test images I can compare against to confirm that my library works entirely correctly?

The easiest thing to do is to get some other platforms to see if they can decode them.
You can try ZXing - http://zxing.org/w/decode.jspx - which will give you the raw data encoded so you can see if you made any mistakes. It should also give you the error correction level etc.
If you just want to see if the text was encoded correctly, try:
http://www.onlinebarcodereader.com/
http://www.patrick-wied.at/static/qrgen/

Related

Intellij Live Template Dynamic Text

I'm trying to create a "dynamic" Live Template for PyCharm and am hitting a road block (I'm able to create simple templates with variable insertion, no problem). I'm beginning to believe that what I'm trying to accomplish may not be possible. I'm not tied to Groovy Script, but it looks to be the most promising alternative to what I'm trying to accomplish. I'm not able to provide a minimal, reproducible example beyond a simple description. Here's what I'm trying to accomplish:
Whatever is typed after hitting TAB and before hitting Enter is passed to the template, formatted and written back to the Editor. My goal is to have the resulting string be a specified length, but that's less important for the time being. It's really more about how to get keyboard input to the template and back out again.
For example:
"blk" TAB "Hello world" Enter becomes # ==================== Hello world ====================
Is this possible with Live Templates?
EDIT: To be clear, the question here is on how to reformat the typed input and return the formatted input to the output of the template. For example, using the above -- have the resulting "Hello world" line always be 80 characters long.
EDIT2: converting previous comment to an answer to close the loop on this question. Happy to reopen if new information comes to light.
Yes, it should be possible with such a template:
# ==================== $MY_TEXT$ ====================
Where $MY_TEXT$ is just an empty custom user template variable.
I have confirmed with Jet Brains that the thing I'm specifically trying to accomplish--dynamically formatting typed input to a live template--is not possible within the current IDE (as of version 2020.3).
Instead, they suggest it will require a custom plugin with specific features related to com.intellij.codeInsight.template.postfix.templates.PostfixTemplate.

llvm Costmodel Analysis Pass is showing different result via opt compared to my own project

I have a llvm IR file that includes instructions like fadd and fmul. These instructions when calculating the cost with the cost-model pass
opt -analyze -targetlibinfo -cost-model myIRFile.ll
I have also created my own pass and run this pass in my code. But when I do this I am getting different results despite it runs on the same system. Mostly just 1's and 0's but never a 2 like when I run it with opts. See also attached screenshot, the top is the opt version and the bottom one my own pass.
Basically I reproduced the pass like described at the bottom of CostModel.cpp and this works perfectly except that the results are different. There are no errors whatsover but as you can see in the image the fadd and fmul instructions are rightfully so having a cost of 2. Sadly, in my own project it just turns out to be 1.
I have also tried to implement the entire cost analysis by calling all the instructions as described in TargetTransformInfoWrapperPass. This compiles also perfectly but it gives me the same results.
Another option I tried was posted here on stackoverflow:
Get cpu cycles of LLVM IR using CostModel. I had to make minor adjustments but the results are the same just 1 for both fmul and fadd on the same instruction.
Appearently, the cost-model pass via opt is doing something else that I am not aware of but I cannot find anything about this.
When you have read this entire post and are familiar with LLVM and have any clue what the cause might be or can point me in another direction I would be very grateful because this problem has been driving me nuts now for weeks.

What format does PrintDocument.getData() return?

I'm looking into what it takes to develop a PrintService on android. After reading some on-line docs I'm not quite clear on the format of data returned by PrintDocument.getData() method. I'd expect that in the case of PrintDocumentInfo.CONTENT_TYPE_PHOTO the returned data will be an image (I'm not quite sure about this). However, what can I expect when content type is CONTENT_TYPE_DOCUMENT?
There is a sample of PrintDocumentInfo that uses a builder to build a pdf file. Is this always the case? That is, is content of CONTENT_TYPE_DOCUMENT always in pdf format?
I'd appreciate any suggestions and/or pointers to relevant on-line docs.
Thanks.
It is always PDF for CONTENT_TYPE_DOCUMENT.

Testing tool: is there alternative than expect?

Our current testing is a simple in-house tool which runs the named target, logs its output and compares it with a expected output. The expected output and real output are both text files.
This has an obvious downside, if some changes of line number change which has no function effect is regarded as failure.
We are thinking to use tools like expect to do this, but we like to know if there are some other alternatives. Googling does not return any immediate answers.
Our platform is linux; the users of this tool does not need to write testing code, basically they currently just provide a plain text file of expected result and we should not ask them to write code or some complex form.
Thanks for your inputs.

XCode RSS Feed Won't parse properly

I followed a tutorial (which I'll link at the bottom) that I got from an old StackOverflow answer to parse an RSS feed into a UITableView. The tutorial is a bit outdated, but only a few methods were deprecated, and I replaced them with (what I hope are) the appropriate newer methods. However, I'm running into some trouble, not with the replaced methods, but with the parser not starting the parsing process. There are some NSLogs sprinkled throughout to give clues as to what is going on, and my parser isn't calling parseDidStartDocument:, it's just running and returning the last two NSLogs ("All Done!" and "stories array has %d items"). If someone could take a look at the code and tell me why it's not parsing, I would be very grateful. If you need to see some of my code, just let me know which parts you'd like to see, and I'd be happy to edit it in.
http://gigaom.com/apple/tutorial-build-a-simple-rss-reader-for-iphone/
oooh that tutorial is way out of date - written in 2008!
Try this tutorial, written for iOS5 instead.