Enable UTF8 when installing MRuby with RVM - rvm

The default MRuby from the repo of the linux distribution I use only has support for ASCII-8Bit. So when I try to compute length of a string it gives me the bytesize instead. In case of iterating over strings, it iterates over each bytes instead of iterating over each unicode codepoints.
I want to setup a separate MRuby with RVM. Is there a way to use the flag MRB_UTF8_STRING as mentioned here?

Related

How to set default params for xz archiver?

By default xz compressor uses single thread (eg. to compress newly created packages from AUR). There's a --threads option for using more threads.
Where can I set global settings for xz so that threads option is set to my value? Could'nt find any info in man.
The man page does talk about the use of environment variables for this purpose:
ENVIRONMENT
xz parses space-separated lists of options from the environment variables XZ_DEFAULTS
and XZ_OPT, in this order, before parsing the options from the command line. Note
that only options are parsed from the environment variables; all non-options are
silently ignored. Parsing is done with getopt_long(3) which is used also for the
command line arguments.
XZ_DEFAULTS
User-specific or system-wide default options. Typically this is set in a
shell initialization script to enable xz's memory usage limiter by default.
Excluding shell initialization scripts and similar special cases, scripts must
never set or unset XZ_DEFAULTS.
XZ_OPT This is for passing options to xz when it is not possible to set the options
directly on the xz command line. This is the case e.g. when xz is run by a
script or tool, e.g. GNU tar(1):
XZ_OPT=-2v tar caf foo.tar.xz foo
Scripts may use XZ_OPT e.g. to set script-specific default compression op‐
tions. It is still recommended to allow users to override XZ_OPT if that is
reasonable, e.g. in sh(1) scripts one may use something like this:
XZ_OPT=${XZ_OPT-"-7e"}
export XZ_OPT
It looks like XZ_DEFAULTS will do what you want.

Patching AIX binary

I am attached to a running proces using dbx on AIX. There is a bug in the program, the offset in the opcode below is 0x9b8, but should be 0xbe8:
(dbx) listi 0x100001b14
0x100001b14 (..........+0x34) e88109b8 ld r4,0x9b8(r1)
I am able to fix that using the command below:
(dbx) assign 0x100001b14 = 0xe8810be8
but that affects only the running process and its memory. How can I change the on disk binary? I am not able to locate the pattern e88109b8 in the binary file,
otherwise I would use e.g. dd utility to patch it.
Best regards,
Pavel Filipensky

apache velocity: remap $ and # keys

I wonder if it is possible to remap "$" and "#" to other keys.
sample:
#set( $foo = "bar" )
I want to use other keys because those interfere with another syntax of a script I am using.
$ and # characters are not configurable in Velocity. Even at compile time, it would at least imply to recompile the parser, and make a full code review for standalone $ and # chars...
That said:
Velocity does cope pretty well with syntax fragments it cannot parse, like jQuery $ object. It just render them as is, and most of the time it does the job.
You can escape your other script's sensitive characters whenever needed, for instance by using the EscapeTool: ${esc.d} for dollar, ${esc.h} for hash.

Weird REDIS chars at console?

I have installed the latest version of Redis v2.8.9 from MsOpenTech
The server is up and everything is ok.
But when I invoke the redis-cli.exe and type in the word info : I see each char {each click} with weird info around it :
With previous version (2.8.4) of redis , it doesn't happen and all chars displayed normally.
Question
What are those extra chars ? and how can I make it to be displayed normally ?
nb - windows 8 / 64bit
They look like ANSI character control code used to format and colorize the display. Use an ANSI compliant terminal, or set the FAKETTY environment variable, or use the --raw option.
Apparently it was a bug which was fixed in a newer version :
https://github.com/MSOpenTech/redis/issues/118

DB upload in mysql - loses UTF characters

I'm frequently updating my db on the server, and I run the following line from the command line:
mysqldump -u root --password=mypass mydb|mysql -h mysite.cc -u remotusr --password=remotpsw remotdb
The problem is that it loses the UTF characters along the way.
How can I keep the utf chars in cmd, or what is a better practice doing this?
( Upgrading to an answer )
As documented under mysqldump — A Database Backup Program:
--default-character-set=charset_name
Use charset_name as the default character set. See Section 10.5, “Character Set Configuration”. If no character set is specified, mysqldump uses utf8, and earlier versions use latin1.
[ deletia ]
--set-charset
Add SET NAMES default_character_set to the output. This option is enabled by default. To suppress the SET NAMES statement, use --skip-set-charset.
Therefore, unless you have settings in an option file which are overriding these defaults (you can specify --no-defaults to ensure they are not), the output from mysqldump should be more than capable of being redirected to another mysql session without loss of Unicode characters.
Instead, the conversion to a smaller character set appears to be occurring on retrieving & displaying your data from the new database. Since you are using PHP's Original MySQL API for this purpose, despite the warning in the introduction to its manual chapter (below), you should use mysql_set_charset() to set the connection character set.
This extension is not recommended for writing new code. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API.