Training Tesseract 3.03 on Ubuntu 14.04 - tesseract

I try to train a new font on tesseract, I follow the steps on the official guide but the problem is in the charset extractor phase.
The training app unicharset_extractor gives in output the chars without right properties.
The help say that 'if the system use wctype functions, the value will be set automatically' but the app say that wctype is disabled.
How can I use automatic char properties extraction on Ubuntu?

Related

gnuplot/pngcairo not rendering UTF-8 character correctly

I have two CentOS 7.4.1708 machines, running gnuplot 4.6 patchlevel 2,
currently behaving differently, and I can't work out why.
Install fonts:
sudo yum install dejavu-sans-mono-fonts
Then create the following GNUplot script:
cat << EOF > test.gnuplot
set terminal pngcairo enhanced font "DejaVuSansMono,10"
set encoding utf8
set title "同"
plot sin(x)
EOF
Finally, pipe it into the application:
cat test.gnuplot | gnuplot > test.png
On one machine I get this:
But on another I get this:
I can't work out the cause of the discrepancy. The desired character is U+540C so it's not like the second machine is interpreting the input bytes any differently; it's just not rendering the glyph.
What differences in system configuration should I be looking for?
More broadly, how can I "fix" the output in the second case? I don't even vastly care if some characters end up getting replaced by placeholders like this (after all, I must recognise that not all fonts implement all glyphs), but those placeholders being rendered at super-size is a problem.
This post is rather a collection of observations than a complete answer, but perhaps it might be useful as well (I tried your example on an almost fresh install of CentOS and it does reproduce the second plot in your post):
judging from the charset table printed by the command
fc-match -v DejaVuSansMono
it seems that 540C is indeed not supported. Perhaps the first machine has some additional fonts installed which are used as a fallback for this particular glyph? How would the output of fc-list differ?
Hard to say if it is complete, but the list of fonts supporting this glyph seems to be rather limited. Nonetheless, for example Google Droid is available via yum, so if I do
sudo yum install google-droid-sans-fonts google-droid-sans-mono-fonts
and rerun the Gnuplot script, the plot renders in an acceptable way.
as for the size of the "fallback" box, I first noticed that its size is directly proportional to the specified font size, i.e., it also doubles if one doubles the font size. From src/wxterminal/gp_cairo.c, it seems that Gnuplot uses by default an "oversampling" strategy to render the text, i.e., it renders everything in plot->oversampling_scale times larger resolution and then scales it back (via the transformation matrix defined in void gp_cairo_initialize_context(plot_struct*)).
For example, when rendering the text, it calls
pango_font_description_set_size(desc, \
(int) (plot->fontsize*PANGO_SCALE*plot->oversampling_scale));
However, for some reason, the "fallback" box is not scaled back and thus is plot->oversampling_scale times larger than the specified font size. The default value of plot->oversampling_scale is set to GP_CAIRO_SCALE which is defined to be 20 in src/wxterminal/gp_cairo.h.
I downloaded the source of Gnuplot 4.6.2 and replaced plot->oversampling = TRUE; with plot->oversampling = FALSE; in void gp_cairo_initialize_plot(plot_struct*) in src/wxterminal/gp_cairo.c. After recompilation, the "fallback" box is rendered with the same size as the rest of text. Unfortunately, I haven't found a way how to change this behavior directly from Gnuplot.

How to port BlitzBasic 3D to BlitzMax IDE

Can someone help me on porting a game written in BlitzBasic to BlitzMax IDE. I tried running the .bb file into MaxIDE but it says "process failure with file.bb". Also where can i find more information regarding this?
You must rename the .bb files to .bmx. Though a superset, BlitzBasic is a completely different language than BlitzMax.
You can use the BlitzMax IDE Community Edition project which has the feature to import .bb files then convert them to .bmx files.
In regard to the 3D commands part and as Spark Fountain as mentioned, it is not supported by default, but you can use MiniB3D or OpenB3DMax.
http://blitzmax-ide.sourceforge.net/
BlitzMax IDE Community Edition
BlitzMax introduces several new features such as classes, real object orientation, inheritance and many more. Anyways, most of the BlitzBasic syntax elements remain or can at least be re-used.
To port your BlitzBasic programs to BlitzMax, I suggest you learn and understand the basic language elements. You can also use the following guide as a starting point.
comments start with ' or REM instead of ;
arrays are defined with Local array[10] instead of Dim array(10)
3D commands are not supported but you could use i. e. MiniB3D

How to make an executable file on matlab and run on raspberry pi 3B [duplicate]

I was wondering if there is a way to create a '.exe' file from ' .m' file in MATLAB, such that it can be run in machine which does not have MATLAB (like it can be done in C, C++).
I know writing a MATLAB function is one way, but I am not sure if it can run in machine without MATLAB.
Also I would like to hide my code and just create a script which can be run by a user using his own data files.
The Matlab Compiler is the standard way to do this. mcc is the command. The Matlab Runtime is required to run the programs; I'm not sure if it can be directly integrated with the executable or not.
If you have MATLAB Compiler installed, there's a GUI option for compiling. Try entering
deploytool
in the command line. Mathworks does a pretty good job documenting how to use it in this video tutorial: http://www.mathworks.com/products/demos/compiler/deploytool/index.html
Also, if you want to include user input such as choosing a file or directory, look into
uigetfile % or uigetdir if you need every file in a directory
for use in conjunction with
guide
Try:
mcc -m yourfile
Also see help mcc
If your code is more of a data analysis routine (vs. visualization / GUI), try GNU Octave. It's free and many of its functions are compatible with MATLAB. (Not 100% but maybe 99.5%.)
mcc -?
explains that the syntax to make *.exe (Standalone Application) with *.m is:
mcc -m <matlabFile.m>
For example:
mcc -m file.m
will create file.exe in the curent directory.
It used to be possible to compile Matlab to C with older versions of Matlab. Check out other tools that Matlab comes with.
Newest Matlab code can be exported as a Java's jar or a .Net Dll, etc. You can then write an executable against that library - it will be obfuscated by the way. The users will have to install a freely available Matlab Runtime.
Like others mentioned, mcc / mcc.exe is what you want to convert matlab code to C code.
The "StandAlone" method to compile .m file (or files) requires a set of Matlab published library (.dll) files on a target (non-Matlab) platform to allow execution of the compiler generated .exe.
Check MATLAB main site for their compiler products and their limitations.
I developed a non-matlab software for direct compilation of m-files (TMC Compiler). This is an open-source converter of m-files projects to C. The compiler produces the C code that may be linked with provided open-source run-time library to produce a stand-alone application. The library implements a set of build-in functions; the linear-algebra operations use LAPACK code. It is possible to expand the set of the build-in functions by custom implementation as described in the documentation.

How to check if matlab toolbox installed in matlab

I am working on Matlab R2011a student edition. I want to run some demos provided in Matlab which require some toolbox like Embedded Coder and EDA Simulator Link.
I want to check if those toolboxes are installed in my current version of matlab and if yes how can I check if the licenses are valid.
The reference to this link didn't help me:
How would one check for installed MATLAB toolboxes in a script/function? because I need at least the short name of those toolboxes like "control" states for "Control System Toolbox" by using the command ver control.
Any suggestion...
To check that the toolbox is installed, use
v = ver;
any(strcmp(toolboxName, {v.Name}))
where toolboxName is the name of the toolbox you want to check.
To check that the licence is valid, use
license('test', toolboxName)
easily use ver command. it will list all installed toolboxes and their versions. the other way is to check from the start button.
Also you can use the existing function in FileExchange called isToolboxAvailable. The usage is as follows:
result = isToolboxAvailable('image processing toolbox','error');
you can always check out the main help documentation which generally lists the toolbox.
Or if you press "Start" (the Matlab start, not Windows) the list of installed toolboxes will be organised by category
Here is a dirty solution:
try
<funktion from specific toolbox>
<do this if it is available>
catch
<do this if it is not
end
The names of the toolboxes that are returned by the license function are the same as what is in the license file. The license file will either be on the local PC or on a FLEXlm license server, depending on your environment. On Windows, check in C:\Program Files\MATLAB\R2011a\licenses for a license file, which is typically named something like license.lic or network.lic. Open the file in your favorite editor (notepad will do). If you see text that says SERVER followed by a hostname, MAC address, and port number, then you're using a network license and you'll have to ask your systems administrator. Otherwise, there should be an INCREMENT line for each licensed product and the name of the product as used by the license function is given following the INCREMENT keyword. If you're on a UNIX or Linux system, you may have to dig around a bit to find the path for the license file (or perhaps someone else can provide this?).
Edit: My MATLAB install is in a non-standard path. Changed instructions to give the default path.
Just in case somebody stumbles upon this in 2022. There are now several built-in add-on utilities to check if add-ons are installed. Notably:
matlab.addons.installedAddons: Will list all installed add-ons with (long) Name, Version, Identifier (aka short name/hash)
matlab.addons.isAddonEnabled: To check if a given add-on is enabled

Is there some kind of tool to look at the encoding of Intel x86 instructions?

Forgive me if this might be a dumb question but, I'm in an assembly class that was mostly taught using an emulated CPU that was supposed to teach the concepts of assembly code. We haven't even written an Intel program, so I'm trying to adjust. In our emulated CPU, we were able to generate a symbol table file that gave the bytes equivalent for instructions:
http://imgur.com/tw5S8.png
Would I be able to do such a thing with Intel x86 instructions?
Try IDA. It has an option to show binary values of opcodes.
EDIT: Well.. it's a disassembler. Try opening a binary file, and set the number of opcode bytes to show (in Options/General/) to something that is not zero.
If you are looking for an IDE that shows you in real time the opcodes for the instruction you've used, then I don't think you'll find one, because of lack of "market". Can you explain why you need it? Do you want to know just their length, or want to learn them? There is simple pattern for lengths, so by dissasembling many binaries you'll catch it. If it's the opcodes you want.. well, there are lots of them, almost no rules, and practically no use to do it.
I see.. then you have to generate the list file . Your assembler should have an option for that. (for NASM it's -l listfile). Just put any instruction(s) in your .asm file, and generate listing for it. It should contain the binary encoding for each instruction.
First, get Intel Instruction Set Refference, or, better, this link: http://siyobik.info/index.php?module=x86 . There you'll find that most opcodes have several encodings. In your particular case, the bit 1 of the opcode specifies direction, and since both operands are registers, you can toggle the direction and swap the register codes, and the result will be the same. Usually you have this freedom on most register to register arithmetic operations. To check this, try decompiling with IDA this source file:
db 02h, E0h
db 00h, C4h
There is a demo program shipped with fasm.dll which has an editor and hex-viewer: