Adding a new language to Tesseract ios SDK - ios

I am able to compile the English version which is already in sample for tesseract but not able to add other language like swe.traineddata.
I'm doing like this
G8RecognitionOperation *operation = [[G8RecognitionOperation alloc] initWithLanguage:#"eng+swe"];
When adding this its giving this error but working fine with English.
Cube ERROR (CubeRecoContext::Load): unable to read cube language model params from /private/var/mobile/Containers/Bundle/Application/D93B654A-1E46-4A34-9A83-95C6FC903085/*.app/tessdata/swe.cube.lm
Cube ERROR (CubeRecoContext::Create): unable to init CubeRecoContext object
init_cube_objects(true, &tessdata_manager):Error:Assert failed:in file tessedit.cpp, line 203

The fact it does not work has to do with the engine mode. If you use the CubeOnly or TesseractCubeCombined, you need 'cube' files. Engine mode TesseractOnly works fine.

you are missing some of files,I think so.Also check on Create Folder References.that helped me once.

Related

Flutter can't load File() from path on iOS

Hey I am using flutter_sound package for voice recording.
But when I made a File() object from recorder file path, I have got not expected error on iOS when I am trying call length() or readBytes() functions..
on Android everything working fine, so I tried compare the made files on both platforms, and they are little bit different
ANDROID File path = /storage/emulated/0/...
iOS File path = file:///Users/kleinpetr/Library/Developer/......
I think the problem is in the different paths.
The error on iOS looks like this
Cannot retrieve length of file, path =
'file:///Users/kleinpetr/Library/Developer/CoreSimulator/Devices/62B6742D-0FA4-4B92-B138
0D9E717DB91B/data/Containers/Data/Application/8587EB31-CF5D-4045-950B
6C011AE3EA96/Library/Caches/voice-message.m4a' (OS Error: No such file or directory, errno = 2)
So using File.fromUri(Uri.parse(fullPath)) worked for you. What you're providing to File class isn't path actually, but URI string (it has protocol specified file:// in the beginning). What you have to do is to parse URI and create a File from it.

How to copy from Storage to FileSystemStorage in Codenameone and display in BrowserComponent

I've been reading a lot of StackOverflow posts that discuss copying data from FileSystemStorage to Storage in CodenameOne, such as described in this answer from Shai, as seen below:
InputStream stream =
FileSystemStorage.getInstance().openInputStream(i);
OutputStream out =
Storage.getInstance().createOutputStream("MyImage");
Util.copy(stream, out);
Util.cleanup(stream);
Util.cleanup(out);`
I've been trying to do the reverse: save from Storage to FileSystemStorage in order to show a PDF in the BrowserComponent (while using iOS), but have not been able to do so. I need to show the PDF within the app (so I don't want to use Display.getInstance().execute()).
Basically, I'm trying to dynamically populate a Container with whatever files the user selects-- I am using the FileChooser library for CN1 from Steve Hannah. (Disclaimer: I have made slight modifications to this library as it used in the app I'm working on-- HOWEVER, when I choose images with this library and pull them from Storage to an Image via InputStream, they display perfectly in an ImageViewer so I know that all files are being saved correctly in Storage.)
Here is my code (with help from Steve Hannah's comment on GitHub):
//fileLocation and fileName are slightly different but both end with file extension
File file = new File(fileToUpload.getFileName());
FileSystemStorage fss = FileSystemStorage.getInstance();
InputStream is = Storage.getInstance().createInputStream(fileToUpload.getLocation());
OutputStream os = fss.openOutputStream(file.getAbsolutePath());
Util.copy(is, os);
ToastBar.Status status = ToastBar.getInstance().createStatus();
String message = file.exists() + " " + file.isFile() + file.getAbsolutePath();
status.setMessage(message);
status.setExpires(3000);
status.show();
NativeLogs.getNativeLogs();
if (Display.getInstance().getPlatformName().equals("ios")) {
//Log.p("in ios !!!!");
BrowserComponent browserComponent = new BrowserComponent();
browserComponent.setURL(file.getPath());
horizontalContainer.add(browserComponent);
}
The ToastBar displays true and true for file.exists() and file.isFile().
I stipulate iOS because as far as I've seen while researching previewing PDFs within an app, I've seen that Android needs to have a different implementation, like adding a NativeInterface with an Android library. I also saw in different answers on the Google Group that this functionality (using browserComponent to view PDFs) is only available for iOS and not on the simulator. In the simulator, I see a blank space. My iPhone just freezes and/or crashes after displaying the ToastBar (and I work on a Windows machine, so not much ability to see native logs....)
What can I do to access the file and show it in the BrowserComponent?
Thank you!
Simple solution -- the file had a space in it (eg. "Test page.pdf") and didn't show! When I used files that didn't have spaces this worked and after removing spaces in the file names, thankfully everything worked. I'll have to add code to handle this scenario.
Thanks for your help!

Play downloaded Widevine Classic files from app document folder in iOS?

I am trying to play wvm files from the app documents folder since 3 days but without success...
I removed "file://" from my path but I still get 1013 error (as discussed here), does someone have some sample code or at least the procedure to follow to make it works properly?
WV_RegisterAsset(myFilePath) always return WViOsApiStatus(rawValue: 1013)
The file should exists because when I try this:
let fileManager = NSFileManager()
print(fileManager.fileExistsAtPath(myFilePath))
It returns true
Thanks in advance for your help!
Widevine Classic on iOS uses an "asset root" directory. When you initialize the library, you pass it in the settings dictionary using the key WVAssetRootKey.
After that, all local asset pathnames you pass to the library are relative to the AssetRoot.
One simple option is to use NSHomeDirectory() as the AssetRoot, and then trim it from the beginning of absolute pathnames.

MECL Paypal convert to ARC (IOS)

I am currently trying to integrate Paypal's MECL in an already existing IOS project using ARC.
I believe that by manually removing all the release / retain in the code should make it ARC compatible.
There is only one statement I do not know how to convert: "InitAndDealloc" that can be find in several class such as here:
static NSString *SolutionTypeStrings[] = {#"Sole", #"Mark"};
static NSString *LandingPageTypeStrings[] = {#"LandingPage", #"Billing", #"Login"};
static NSString *ChannelTypeStrings[] = {#"Merchant", #"eBayItem"};
#define LOCALE_CODE #"LocaleCode"
#implementation SetExpressCheckoutRequestDetails
InitAndDealloc
StringAccessor(ReturnURL)
StringAccessor(CancelURL)
StringAccessor1(cppHeaderImage, #"cpp-header-image")
StringAccessor1(cppHeaderBorderColor, #"cpp-header-border-color")
StringAccessor1(cppHeaderBackColor, #"cpp-header-back-color")
StringAccessor1(cppPayflowColor, #"cpp-payflow-color")
IntAccessor(AllowNote)
IntAccessor(ReqConfirmShipping)
TypedefAccessor(NoShipping, NoShippingType)
StringAccessor(Token)
AmountAccessor(MaxAmount)
StringAccessor(CallbackURL)
IntAccessor(CallbackTimeout)
GenericAccessor1(FlatRateShippingOptions, ShippingOptions)
IntAccessor(AddressOverride)
StringAccessor(PageStyle)
StringAccessor(BuyerEmail)
StringAccessor(giropaySuccessURL)
StringAccessor(giropayCancelURL)
StringAccessor(BanktxnPendingURL)
GenericAccessor(EnhancedCheckoutData)
GenericAccessor(BuyerDetails)
StringAccessor(BrandName)
GenericAccessor(FundingSourceDetails)
StringAccessor(CustomerServiceNumber)
IntAccessor(GiftMessageEnable)
IntAccessor(GiftReceiptEnable)
IntAccessor(GiftWrapEnable)
StringAccessor(GiftWrapName)
AmountAccessor(GiftWrapAmount)
IntAccessor(BuyerEmailOptinEnable)
StringAccessor(SurveyQuestion)
StringAccessor(CallbackVersion)
IntAccessor(SurveyEnable)
MutableArrayAccessor(PaymentDetails)
MutableArrayAccessor(BillingAgreementDetails)
MutableArrayAccessor1(OtherPaymentMethods, OtherPaymentMethodDetails)
MutableArrayAccessor1(SurveyChoice, NSString)
EnumAccessor(SolutionType, SolutionType)
EnumAccessor(LandingPage, LandingPageType);
EnumAccessor(ChannelType, ChannelType);
If I remove the line "InitAndDealloc", it seems as if I cannot set the variables anymore in the class. Indeed, I have also the working (Non ARC) paypal demo.
By doing this:
SetExpressCheckoutRequestDetails *sreq = [[SetExpressCheckoutRequestDetails alloc] init];
sreq.ReturnURL = #"Bob";
NSLog(#"%# ", sreq.ReturnURL );
In both projects.
Mine will return null, paypal's will return the Bob.
Has it even got anything to do with "InitAndDealloc" or am I looking at it wrong? If it is how do I replace "InitAndDealloc" in an ARC project? I can't seem to find a simple "Init" with autocompletion and by googling "InitAndDealloc" I get absolutely no results whatsoever :/
Thanks for reading!
I've never used MECL before but the way it's being called "InitAndDealloc" certainly is not Objective C and therefore wouldn't be subject to the same rules that ARC requires for Objective C. Best to leave it in place and not try to futz or struggle with it.
But anyways, instead of struggling with trying to ARC-enable some published & potentially-problematic SDK code, why not turn ARC off for the MECL files?
Here is a related question that describes how to turn ARC off for individual files.

xtaskcreate-getting error

Hello I am working on EZ430-RF2560T target board attached to debugging interface (attached to USB of PC) for the Tux Racer game application (MSP430BT5190 target board ). I am working on the accelerometer application code. After the bluetooth is turned On it gives the message "unable to create task " for the function
xTaskCreate((pdTASK_CODE) user_task_routine,
(const signed portCHAR *)USER_TASK_NAME,
USER_TASK_STACK_SIZE, (unsigned portLONG *)NULL,
(unsigned portBASE_TYPE)USER_TASK_PRIORITY,
(xTaskHandle *) NULL);
Please let me know what could be done.........
Thankyou
Ashwin
Hard to say without more info or code. Looks like the task create line is straight from some dummy documentation or sample. Have you defined all the relevant parts such as USER_TASK_NAME, USER_TASK_STACK_SIZE, USER_TASK_PRIORITY, and especially the function user_task_routine?
Were there any compiler errors in this module?
The name "user task" sounds rather generic, maybe you might consider a descriptive name :)
Are other demo tasks running on the board? You might compare your task to them and see how they are started.
Could you simply be running out of memory? Try disabling some of the other tasks and starting only your task.
There is also a support community at freertos.org that tends to provide helpful responses.

Resources