I am currently developing a mel script in Maya, but am unable to print a character based on its ascii code (for example 65 should print 'A'), as the char(xx) command in other languages.
How can I achieve that ?
Thanks !
The other way is to use a python command inside MEL script:
$n = 65;
print("BB" + python("chr("+$n+")") + "CC");
result:
BBACC
In case someone is looking for the same answer, the way I finally implemented it is to create a string containing all charaters and then picking the right character in the string using the substring command.
Related
I need to be able to print Hebrew characters on my Epson TM-T20ii. I am trying to get my printer to switch to character code page 36(PC862) using
ESC t36
for some reason the printer is switching to code page 3 and then printing the number 6.
Is there a way to let the printer know that the 6 is part of my command?
If you know of a different workaround please comment below.
Thanks
You are making a mistake, you aren't meant to replace n with an actual number.
The proper syntax in your case would be ←t$
Explanation: the manual says "ESC t n", n referring to the page sheet, however you don't replace n with a number rather with the ASCII character n, so in your example 36 = $ because $ is the 36th character on the ASCII table.
I have a text file with unknown character formatting, below is a snapshot
\216\175\217\133\217\136\216\185 \216\167\217\132\217\133\216\177\216\163\216\169 \216\163\217\130\217\136\217\137 \217\134\217\129\217\136\216\176\216\167\217\139 \217\133\217\134 \216\167\217\132\217\130\217\136\216\167\217\134\217\138\217\134
Anyone has an idea how can I convert it to normal text?
This is apparently how Lua stores strings. Each \nnn represents a single byte where nnn is the byte's value in decimal. (A similar notation is commonly used for octal, which threw me off for longer than I would like to admit. I should have noticed that there were digits 8 and 9 in the data!) This particular string is just plain old UTF-8.
$ perl -ple 's/\\(\d{3})/chr($1)/ge' <<<'\216\175\217\133\217\136\216\185 \216\167\217\132\217\133\216\177\216\163\216\169 \216\163\217\130\217\136\217\137 \217\134\217\129\217\136\216\176\216\167\217\139 \217\133\217\134 \216\167\217\132\217\130\217\136\216\167\217\134\217\138\217\134'
دموع المرأة أقوى نفوذاً من القوانين
You would obviously get a similar result simply by printing the string from Lua, though I'm not familiar enough with the language to tell you how exactly to do that.
Post scriptum: I had to look this up for other reasons, so here's how to execute Lua from the command line.
lua -e 'print("\216\175\217\133\217\136\216\185 \216\167\217\132\217\133\216\177\216\163\216\169 \216\163\217\130\217\136\217\137 \217\134\217\129\217\136\216\176\216\167\217\139 \217\133\217\134 \216\167\217\132\217\130\217\136\216\167\217\134\217\138\217\134")'
I searched a lot around but found no answer:
I have to use a lot of command line options which I planed to parse with optarg (which works well for single char) - if I count all arguments the alphabet has to less letters :(
So my plan was to use double letter codes (-a, -ab, -ac ) how can I parse them ?
Would it easier to solve by using boost:programoptions?
I'm trying to create cypher-statements for import using neo4j-shell. I'm using version 2, M3. And I'm somewhat in the dark as to what characters I should escape in the properties. Heres an example:
MATCH (artist:Artist) WHERE artist.kunstnernavn = 'Ditlev Blunck'
CREATE (artwork:Artwork {titel:'Christian IV's vision på slottet Rothenburg',inventarnummer:'KMS64',datering:'-4622274825',teknik:'Olie på lærred',optagelse:'\\foto-02\globus\globus\GLOBUS 2011\kms64.jpg '})
CREATE (artist)-[:CREATED_ARTWORK]->(artwork);
I have tried to escape "\" by %5C but then I get an error on globus%5C .. apparantly s% is a special character in that context. Same goes for titels with " -h" .. apparantly interpreted as an option.
Where can I find docs specifying this?
thanx,
Thorbjørn
Try using the back-tick character (`) to quote your strings.
The neo4j syntax docs gloss over this feature, but usage examples can be found across the site.
I invoked Maxima tex1 from within a batch script as follows:
maxima --very-quiet -r "tex1(solve(8*x^2+7*x+5));" | grep -v false > output.txt
and I got the output.txt as follows:
\left[ x=-{{\sqrt{111}\,i+7}\over{16}} , x={{\sqrt{111}\,i-7}\over{16}} \righ\
t]
that is not valid as a (La)TeX input file.
How to prevent Maxima tex1 from wrapping its output?
Sorry for the late reply.
Instead of
tex1(solve(8*x^2+7*x+5));
write:
?princ(tex1(solve(8*x^2+7*x+5)))$
The problem is that the string returned by tex1 is being printed by the display formatter (the same function which would print the string if you were using Maxima in an interactive session). The display formatter breaks strings at linel characters (default = 79) and inserts a backslash. Instead for your purposes you want to evade the display formatter entirely, so you print the string with ?princ (a Lisp function to just print the string) and terminate the input with "$" instead of ";" to tell Maxima not to call the display formatter.
Note that the hard-coded constant 70 in MYPRINC doesn't come into play here. MYPRINC is not called in the example given.
This is, unfortunately, hard coded into Maxima. A way to solve this problem is to edit the function myprinc located in the file maxima/src/mactex.lisp. There is a cond form that has a 70. written there, it should read linel instead of 70. If you recompile maxima after making this change then the following will work:
maxima --very-quiet -r "linel: 1000$ tex1(solve(8*x^2+7*x+5));" | grep -v false > output.txt
Anyway, I'll send a patch to the Maxima list ASAP so that future versions of the program won't have this shortcoming.