How to get the case of a letter in scratch? - mit-scratch

I'm trying to turn a string into a number, but apparently Scratch ignores the case when returning the list item of a string. So, how would I make it so that scratch pays attention to the case when giving me the letter's corresponding number?

The "set costume to (name)" block is case sensitive, so it should solve your problem.
It looks like you are attempting to convert a ASCII character into a number. You can implement this with the following steps:
Create around 90 costumes with the different ASCII characters you want to use.
Then use "set costume to (queried character)" block found in the looks tab.
The "(costume number)" variable (found in the looks tab) will be your output number.
If you want to convert this a number back into ASCII you can use the following steps:
Make sure you have the special costumes from step 1
Use "set costume number to (number)".
The "(costume name)" variable (found in the looks tab) will be the original character.
The only obvious downside to using this method is that encoding or decoding will change the current costume of the sprite, so I usually make a separate sprite if I want to use costumes.

Related

Swift Thai Localization Problems

There seems to be a problem with the String library that apple uses.
Here's my Localizable.strings
"error_failed_to_retrieve_certificate" = "เกิิดผิดพลาดในการกู้คะแนน";
Here's how I set it to any view
anyView.text = return NSLocalizedString("error_failed_to_retrieve_certificate", comment: "")
But somehow the string that is being displayed gets warped, when it gets displayed, (the second character becomes different.
Here's what it looks like too when I search it using the Project Search.
But on the Strings it looks different (notice the third character)
Here's one image that is side by side
Note that I don't know any Thai.
It seems like that your string has an extra ิ (U+0E34 THAI CHARACTER SARA I) in it. The character before that, กิ, is already two code points combined - ก (U+0E01 THAI CHARACTER KO KAI) and ิ, so the extra ิ got displayed alone. I would say it's an Xcode bug.
I've removed the extra character here:
เกิดผิดพลาดในการกู้คะแนน
Copy and paste that and it should be fine.
You need to check if you have unique key "error_failed_to_retrieve_certificate". this key value is unique.

How to store subscript and superscript values in Progress OpenEdge?

Is there a way to store subscript and superscript values in the Progress database, for example, chemical symbols and formulas, such as C2H5OH, and is it possible to display them ?
I tried copying from Word and pasting into fill in string fields but it doesn't format correctly, it doesn't recognize subscripted values and it is displayed as C2H5OH.
After some testing I've come this far:
1) You need to start your session with startup parameter -cpinternal utf-8 ie
prowin32.exe -cpinternal utf8
Depending on your need you might also need to set -cpstream utf-8 and possibly -cpcoll basic (or something else that matches your needs).
When I did this I had some strange crashes - but that might be because I edited a file saved in another codepage?
2) You need to get the data into your system (perhaps you already have it?).
I used Word and information found here and further explained here. The subscript font setting are just font settings (not unicode) so don't let that fool you (copy-pasting from your question is exactly the same). Basically you need to write the hexadecimal value of the subscript 2 (2082) in Word and then press Alt + X.
Assuming you want to write the actual data in a Progress based GUI I haven't been successful so far. Perhaps you could look at changing registry values as described in the links and continue along that path. I don't want to do that for just basic testing...
3) You will need a font with decent support for these characters. Some fonts don't support them at all!
Segoe UI:
Default system font (possibly) MS Sans Serif:
Arial:
5) Database? I'm unsure if you will need to use CLOB-fields to store this in your database or not. Most likely you shouldn't.
Hope this is enough to at least get you started!

emacs orgmode table use the equal sign without starting a formula

I'm typing up a table with org mode, where the equal sign(=) if the first character in the cell and it want to start a formula. how do I get it to display the symbol without it being a formula, of a way to use formulas to display it. I get errors when I use single quotes, and I see the Unicode decimal value when using double quotes.
I have tried the following
='=+'
="=+"
they give
#ERROR
[61, 43]
Use an escaped entity, \equal{} and it should display as you wish. See the variable org-entities for others you can use.
I'm a bit late :D
There may be a better way, but you can try with :='(format "=+")
Source: https://emacs.stackexchange.com/questions/19183/can-i-use-formula-to-manipulate-text-in-org-mode-table
When I ran into this problem just now, I found that I was able to get around it by replacing the equals sign with some other similar-looking character. Two which come to mind are ꞊ ‘U+A78A MODIFIER LETTER SHORT EQUALS SIGN’ and ⹀ ‘U+2E40 DOUBLE HYPHEN’.

Ogg metadata - Vorbis Comment end

I want to implement a class to read vorbis comments. I know that a field will start with a field name, followed by an equal sign and the value. But how does it end? Documentation makes me think that a semicolon will end the field but I checked an ogg file with a hex editor and I cannot see any.
This is how I think it should look like in a file :
TITLE=MY SUPER TITLE;
The field name is title, followed by the equals sign and then the value is MY SUPER TITLE. And finally the semicolon to end the field.
But instead inside my file, the fields look like this :
TITLE=MY SUPER TITLE....
It's almost as above but there is no semicolon. The .'s are characters that cannot be displayed. I thought okay, it seems like the dots represent a value that will say "this is the end of the field!!" but they are almost always different. I noticed that there are always exactly 4 dots. The first dot has always a different value. The other free have usually a value of 0. But not always...
My question now, how does a field end? How do I read this comment?
Also, yeah I know that there are libraries and that I should use them instead of reinventing the wheel over and over again. I will use libraries later but first I want to know how to do it myself. Educational purpose only.
Each field is preceded by a little-endian 32-bit integer that indicates the number of bytes to read. You then convert the bytes to a string via UTF8.
See NVorbis' implementation (LoadComments(...)) for details.

Regular Expression for number.(space), objective-c

I have an NSArray of lines (objective-c iphone), and I'm trying to find the line which starts with a number, followed by a dot and a space, but can have any number of spaces (including none) before it, and have any text following it eg:
1. random text
2. text random
3.
what regular expression would I use to get this? (I'm trying to learn it, and I needed the above expression anyway, so I thought I'd use it as an example)
With C#:
#"^ *[0-9]+\. "
It doesn't check for the presence of something after the ., so this is legal:
1.(space)
If you delete the # and escape the \ it should work with other languages (it is pretty "down-to-earth" as RegExpes go)
I may suggest (Perl-compatible regexp):
^\s*\d+\.\s
At the beginning of a line:
Any number (0-n) of spaces
One or more digits
A dot
A space
Something like
^\s*\d+\.
But it depends on the language.
/^\s*[0-9]+\.\s+/
would be my guess providing you don't have any space before the number