OpenCV header error (YAML) - opencv

Ok so I feel that I have finally successfully used the OpenCV libraries in my app, except for one thing...
My .yml files get generated correctly except the '%YAML:1.0' header at the top turns out like this '01%YAML:1.0'. The '01' infront of the header is causing this error (I think):
OpenCV Error: Parsing error (/var/mobile/Applications/53C6CBA3-15B7-436A-892B-2ECFA75B72CD/Library/DownloadedDescriptors/descriptors.yml(1): Valid XML should start with '<?xml ...?>') in icvXMLParse, file /Users/Dash/Documents/SmartServices/AirLink/ProjectGhost/FairfaxNewsDemo/opencv-2.3.1/OpenCV-2.3.1/modules/core/src/persistence.cpp, line 2163
Anyone know how to solve this issue?
Ok after looking into it a bit further I dont think it's the headers problem. My file always gets generated with '01' at the start.

Hmm...this is embarrassing. But it turns out that I had a 'print' statement lingering in the php file that helps generate my .yaml file, causing 0 and 1 to be added to the beginning of the document.
This meant that my file didn't start with '%YAML:1.0' as expected but '01%YAML:1.0'

Related

Lua io.write() not working

I am using a luvit Lua environment to run my lua code through my control panel. I am looking to write to a .txt file, but with the simple code that i am running, its not working.
The reason I wish to write to a .txt file is to log notices from my Discord Bot I am working on in the Discordia library.
I have a folder called MezzaBOT. In this file i have a write.lua file and also a log.txt file. I have this simple code in my write.lua file:
io.output('log.txt')
io.write('hello\n')
io.close()
I then run in my command promt with Luvit environment:
>luvit Desktop\mezzabot\write.lua
I don't get any errors but the log.txt file continues to stay empty. Am I missing a line in my code, or do i need to access log.txt differently?
edit: my new code is the following
file = io.open('log.txt')
file:write('hello', '\n')
file:close()
and it is not making a new line for each time with \n
edit B:
Ok, i found my problem, its creating a log.txt in my C:\Users\PC.
One other problem is when writing, its not making a new line with the \n. Can someone please help me?
Lua, by default, opens files in read mode. You need to explicitly open a file in write mode if you want to write to it (see manual)
file = io.open('log.txt', 'w')
file:write('hello', '\n')
file:close()
Should work :)

Localizable.strings - The data couldn’t be read because it isn’t in the correct format

If I copy something from textedit or web and paste it to localizable file it shows this compilation error. If I type those in localizable file it does not show any error. I am assuring you that I using the correct format and ';' in the file.
"New" = "New";
"In Progress" = "In Progress";
"Waiting" = "Waiting";
"Closed" = "Closed";
Use plutil from the Terminal:
you have to run it for each version of the localizable file. E.g
cd into your project root
cd eb.lproj - you can replace this with
any localisation you are working with.
plutil -lint Localizable.strings
When you run step 3, you will either be shown an error, telling you what is wrong with your file. Or you will be told the file is OK
Note that plutil output is bad, it seems it always says "Unexpected character at line 1" but above that output, it prints other stuff like missing semicolon on line 121, and that is the real error
For me, it was missing semi-colons. If you use a tool to generate .strings file, make sure there are no un-escaped quotes that may 'eat' the delimiting semi-colons.
pl < Localizable.strings
is better than plutil -lint Localizable.strings
Log will show something like this
2019-08-14 16:39:34.066 pl[21007:428513] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 427. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2019-08-14 16:39:34.068 pl[21007:428513] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 427. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2019-08-14 16:39:34.071 pl[21007:428513] *** Exception parsing ASCII property list: NSParseErrorException Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character / at line 1" UserInfo={NSDebugDescription=Unexpected character / at line 1, kCFPropertyListOldStyleParsingError=Error Domain=NSCocoaErrorDomain Code=3840 "Missing ';' on line 427" UserInfo={NSDebugDescription=Missing ';' on line 427}}
Fastest way to detect the line with the issued string is to :
right click the strings file and
then Open as/ASCII property list.
Xcode will immediately tell you in what line there's an error.
I know this question was asked long ago but my scenario and solution is little bit different.
Today I faced same issue but when I tried to check the issue using
plutil -lint Localizable.strings
I got OK status which means everything is fine, then I tried to find issue using
pl < Localizable.strings
But again I got file text printed with no error mentioned, then I tried a trick and it worked for me.
Right click on the Localizable.strings file
Then select option Open As option
Then select option ASCII Property List
That's it, XCode shows me the issue with line number and the issue was I had this DéjàVerified text as key on specified line, this helps me to identify and solve the issue, I hope it will save someone's time.
Cheers!
There can be multiple reasons for this:
Semicolon is missing at the end.
Multiple semicolons at the end.
" within the message which should be escaped by \".
Extra character after semicolon.
Invalid white space in the file.
Other invalid characters in the file.
Merge conflict characters in the file!
<<<<<<< HEAD, ======= and >>>>>>>.
Please note that plutil -lint Localizable.strings returned OK for point-2 & 7!
In my case, I was missing "=" between a string pair. Even plutil did not help me to spot the error line. I manually checked each string pair. :/
Your syntax seems to be fine, the only thing that I can see can "break" your file and cause this error is the quote character. Make sure to use the reqular one " and not in any other form like ″ for example.
Also make sure the strings file name is always Localizable.strings
I Had the same issue and i resolved it by commenting or removed unused strings in my Localizable.String file :)
I once had a similar error and it turned out that there was an URL in the middle of the file, like this:
// Some Comment 1
"Some key 1" = "Some value 1";
http://...whatever...
// Some Comment 2
"Some key 2" = "Some value 2";
When calling plutil -lint on that file the output was:
Unexpected character / at line 1
Well, the first character indeed was / as the file started with a comment but the problem resolved after removing the URL; or turning it into a comment which it actually should have been. Note that the URL was nowhere near the beginning of the strings file, it was about in the middle of a 6000 lines string file. I was only able to find it by browsing through commit history and always look at the changes.
if missing ";" at end of the all lines in Localizable.string file, this error can occur.
eg :-
"header_text" = "Current Language";
"change_language" = "Change Language";
"header_text" = "වත්මන් භාෂාව";
"change_language" = "භාෂාව වෙනස් කරන්න";
This may be because the translation file format is wrong.
You can download a mac software called Localizable.
This is the download link: https://apps.apple.com/cn/app/localizable-%E7%BF%BB%E8%AF%91%E6%96%87%E4%BB%B6%E5%B7%A5%E5%85%B7/id1268616588?mt=12,
you only need to drag Localizable.strings to the software and it will It is useful to tell you which line in the file may have a problem. It saved me a lot of time. Now I share it with you.
I hope it will be helpful to you.
It seems your info.plist is not in correct form . check it properly. I also had the same issue . I resolved it by modifying my info.plist.
I just had this experience:
external translator doing the work inside Visual Code or other text editors
Files not working and getting an error like this one: ( testing with plutil -lint )
Localizable.strings: Unexpected character " at line 1
CardRatingView.strings: Unexpected character / at line 2
I just created a new file within XCode and copy pasted all the file content and suddenly everything was working properly.
I guess something can go wrong / corrupting the file itself while working with other text editors.
If showing something like Unexpected character " at line 1, and it is the first string like "app_name"="Any Name"
Check that the file is UTF16
I ran into this issue, all my formatting was correct. Checking for illegal characters using plutil -lint Localizable.strings and using ruby libraries like "utf8_utils" also didn't work at finding the illegal characters. BUT when I pasted the Localizable.strings contents into the Terminal app while running irb, it did show me the weird characters.
"PercentComplete" = "%d procent gennemført";
Pasted into irb:
"PercentComplete"\U+FFC2\U+FFA0= "%d procent gennemf\U+FFC3\U+FFB8rt";
Then all I had to do was a regex replace to fix those weird white space characters: \U+FFC2\U+FFA0
Thanks to the plutil suggestion I understood that to make it work you have to delete also any \ or * as are not read as comments and, important, add a ; to the end of the file. Xcode 11.5.
If pl and plutil show no problems, check the file's encoding. I had a similar problem twice and in my case it was due to incorrect encoding, though I have no idea how it has been changed (I literally added a single line in the middle of the file in X-Code). Converting from UTF-16LE to UTF-16BE in some editor (I used Android Studio) fixed the problem.
For me I had an NSLocalizedString in my code that contained a string interpolation e.g. NSLocalizedString("\(product.price ?? "")per_month"). When I exported localisations this got added to my strings file, which was then in the wrong format. It threw me off because my strings file in Xcode looked fine, but actually the file gets updated as part of the export localisations process, and errors were creeping in there.
If anyone things they might be having the same issue try calling genstrings separately and seeing if the newly generated file is in the correct format. Make sure you save your strings first as this will overwrite your strings file : find ./ -name "*.swift" -print0 | xargs -0 genstrings -SwiftUI -o en.lproj
This tool can help solve this problem, just select your localizable.strings file, it will help you find out which line format is wrong, it can save a lot of time
https://localizable.appdevtool.io/
In my case, I had one line with using ” instead of " and that breaks the file. My code editor did not detect this difference.
I was having the similar issue where i didn't escape the string value with backslash \ for one of my string's value.
Before:
"INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with "0" or "7"";
Updated:
"INVALID_NUMBER" = "It seems you're entering invalid number. Number should starts with \"0\" or \"7\"";
Backslashes are required when you want to display the quotation marks "
Please, have a quick look at here for How to include Quotation mark in strings
It seems like SVN is having some issue with this file. As it consider it to be a binary file. It is inserting a lot of non printable characters between each characters. I still couldn't find a proper solution. Just changing the Localizable.string files from production PC for avoiding any issue with it.
Update: Updating the SVN client (smartSVN) to the latest version solved the issue. It seems one of my colleague was using a older version. When he commited the change to localizable file it caused the error.

How do you display errors by editing the php.ini file in HHVM?

I am using CentOS 7 and I have tried to edit the php.ini file located /etc/hhvm/php.ini.
I added the line
display_errors=On
The only two other lines in php.ini are
date.timezone="America/New_York"
hhvm.dynamic_extension_path = /usr/local/lib64/hhvm/extensions
When I try to run a page it shows a blank page (because of fatal error). But when I run the same file from the command line with
$ hhvm filename.php
Then the fatal error is displayed. How can I make errors show up while I develop? In regular PHP I can edit this in php.ini, or even just add lines like these
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(E_ALL);
I have no idea how to do this in HHVM.
display_errors may or may not work in HHVM. There have been some issues with it, and I'm not sure what the current status is. You should check your log file.
Make sure you use a numeric value for error_reporting if you set it in the INI file. (Setting it with a constant in code is fine.) This bug prevents constants from working in INI files.

Resource compilation error (Bad character in source input)

I have added text file with following content to the project:
1 24 "MyApplication.manifest"
In the same folder there is also MyApplication.manifest file which is XML - this one:
C++ Builder / Delphi 2010 application manifest template
After I attempt to build resource from RC I get error - Bad character in source input(1)
Any ideas why?
RT_MANIFEST value is 24, but I am unsure what 1 is supposed to be.
I managed to find the answer myself so no answer necessary. The problem was, as usual very obscure.
Turned out that the resource script file (.RC) I was using had an UTF-8 byte order mark in the file (0xEF,0xBB,0xBF) which was invisible to the text editor but resource compiler complained about it. After removing the BOM resource compiled correctly.
I don't think many people fall into this trap but at least if anyone else sees this error in resource compiler, you should examine if there is an UTF-8 BOM in your file by viewing HEX-dump of RC file because brcc32.exe resource compiler seems to have issues with that.

erl_tar can't extract files made with make_tar

I'm putting a release file together, which seems to work fine
1> systools:make_tar("rel/project-1.0").
ok
at that point, I get the expected file at rel/project-1.0.tar.gz, however, trying to extract it errors for some reason
2> erl_tar:extract("rel/project-1.0.tar.gz").
{error,bad_header}
Trying to extract the same file with tar from shell, or with the equivalent os:cmd/1 call, works fine. What's going wrong here?
The archive is gzip compressed (notice the .gz extension). You will need to use extract/2 and provide the compressed option:
erl_tar:extract("rel/project-1.0.tar.gz", [compressed]);

Resources