Geany doesn't print a few combination of characters - editor

I just got Geany 1.36 and everything was working fine until I tried to type a "-". It turns out Geany doesn't print characters like "." , "-" , "<", ",". I have to type an extra character to get it to show. It seems like it stores it in a buffer and when I type an extra character it prints both characters at once.
Also, character combinations like (. + s), (. + r), (. + t) doesn't print at all.
I changed the font settings, (can this be the reason?) but then I reinstalled Geany again and I still have this issue.
(I cleaned the preference files from APPDATA too)
I searched the entire net, even looked through Geany manual but couldn't find anything.
If you know anything about this do let me know.
I am running Windows 10 and Geany 1.36.

GNU programs don't work properly if the keyboard layout is not set up correctly.
Make you sure you set up the keyboard layout correctly, for the majority of the people it should be EN-US
Search for Edit keyboard and layout options and make sure it is set up to EN-US (or whatever the correct one is)

Related

Sublime Text: Not representable characters

I'm using Sublime Text for Latex, so i need to use a specific encoding. However, in some cases, when I paste text copied from a different program (word/browser in most cases), I'm getting the message:
"Not all characters are representable in XXX encoding, falling back to UTF-8"
My question is: Is there any way to see which parts of the text cannot be encoded, so I can delete them manually?
I had this problem. It is caused by corrupt characters in your document. Here is how i solved it.
1) Make a search in your document for all standard characters. Make sure you enable regular expressions in your search, then paste this :
[^a-zA-Z0-9 -\.;<>/ ={}\[\]\^\?_\\\|:\r\n#]
You can add to that the normal accented characters of your language, here are the characters for French and German. Such as éà and so on :
[^a-zA-Z0-9 -\.;<>/ ='{}\[\]\^\?_\\\|:\r\n~#éàèêîôâûçäöüÄÖÜß]
2) Search for that, and Keep pressing F3 until you see mangled characters. Usually something like "è" which is a corrupt version of "à".
3) Delete those characters or replace them with what they should be.
You will be able to convert the document to another encoding when you have cleared all corrupt characters out.
For Linux users, it's also possible to automatically remove broken characters with command iconv:
iconv -f UTF-8 -t Windows-1251 -c < ~/temp/data.csv > ~/temp/data01.csv
-c Silently discard characters that cannot be converted instead of terminating when encountering such characters.
Just adding to #Draken response: here is the RegEx with spanish characters added.
[^a-zA-Z0-9 -\.;<>/ =“”'{}\[\]\^\?_\\\|:\r\n~#àèêîôâûçäöüÄÖÜßáéíóúñÑ¿€]
In my case I hitted Ctrl+H (for replacement) and as a replacement expression used nothing. So everything got cleared super fast and I was able to save it using ISO-8859-1.

What's wrong with this regular expression containing math symbols? (Ruby/Rails)

text.scan(/\"[\d\w\s\+\-\*\/]*\"/)
I'm simply looking to find any thing within quotations that can contain letters, numbers, spaces, plus, minus, star, or forward slash. Everything works great in console. Each of the following works in a browser:
"abc"
"123"
"x-1" or "x - 1"
"x/1" or "x / 1"
But the plus sign and star fail in a browser (despite working fine in console with the same regex). Does anyone have any ideas?
Edit #1: I'm performing a quick gsub to add some formatting to the results of the scan. If the quotations have a plus or star in them, they don't even get picked up by the scan. The same code and text pasted in console works just fine.
Edit #2: I figured out a better way to frame this question without extraneous details and got the answer. "Why can't I perform a gsub on each of the results from a scan if the result contains regex special characters?"
Turned out that this problem was related to regexp string insertion (/#{whatever}/) not escaping special characters - manually escaping clears it up (/#{Regexp.escape(whatever)}/). See this question for a full example/explanation.
I don't know what do you mean "work in browser" but I'm making an assumption that you're trying to parse an URL. In URL the + & * signs can be converted to %2B & %2A respectively.
Try this regexp:
/"[(\d\w\s\+\-\*\/|%2B|%2A)]+"/
...or decode URL before parsing.

How to count lines of code (LOC) using IntelliJ IDEA?

title says everything plus:
- development language Lua
- code revision control system - Perforce (integrated with IntelliJ IDE)
Posting for posterity - This was the top Google entry when searching "intellij count lines of code" (without quotes)
.
If you're like me and didn't want to install anything else, you can hack it via the native, global search:
Ctrl + Shift + F (to open global search)
Use regex mode (check "regex" checkbox)
In the searchbox, enter only a caret "^" (without the quotes)
You may want to limit the search to a specific directory, via the "directory" tab
Hit the "Open in Find Window" button on the bottom-right
If it asks whether you want to continue, press "Continue"
.
Notes:
In regex, the caret (^) denotes the start of a line, except when inside square brackets, in which case it denotes negation
If you wanted to count non-empty lines, you could instead use "^.*\S" (without quotes), which signifies "The start of a line (^), followed by any number of characters (except newline) (.*), followed by a non-whitespace character (\S)"
You can either turn on the display of lines of code for a single file by right clicking in the left gutter and highlighting "display lines of code". Or you can do it for your entire project by downloading the Statistic plug-in. It's very nice indeed, because it shows LOC and other metrics for your entire project.

ESC/P programming!

Why i need to use it is because for some printers using TPrinter prints some weird hieroglyph at the beginning of the printable area.
My problem is that if i send some commands, nothing happens.
ESC E (#27 #69) - Sending this escape sequence didn't work as i expected. It removed first letter and rest of the string made bold. eg. Hello -> ello. After i changed it to ESC E ESC (#27 #69 #27), it worked fine. This example i managed to figure out, but...
trying to select character table "ESC t n" (#27 #116 n), to make "õäöü" work. This command just doesn't work. Nothing happens! And this command is supported by esc/p, esc/p 2 and 9-pin esc/p, so it should work just fine.
Manual can be found here.
If anyone has ever needed to use esc/p commands then maybe one can shed some light how to work with them!
Thanks in advance!
EDIT:
In my previous post i asked more or less the same question though answers were about how did i send commands to the printer. (I'll change my question there according to what was the answers!)
I accepted Ken's answer, because he claimed that the way i transferred the commands wasn't the best and i got it to work with Escape command.
The problem was that after trying to use my program with another printer, it didn't work as expected, because it uses TPrinter.Begindoc and EndDoc.
So actually i must use the other solution that Rob Kennedy helped me with!
EDIT 2:
As it turned out, i used wrong manual, where commands are little different (though still supporting esc/p as it proclaims). Thank you all for your help!
PS!
I still have a question: I need a character table where
245 = õ
228 = ä
246 = ö
252 = ü
which is iso 8859. But in manual there is no such character table or any similar to it. Should i do some string manipulation and replace eg 228 to 132 or does anyone know any better approuch?
I keep it unanswered for a while, and then accept stukelly's answer.
Based on your previous question, I think you are using the wrong commands to control the EPSON TM-T70 receipt printer. After some research I found the product brochure and POSMicro both mention ESC/POS.
The ESC/POS command for turning bold on and off requires has a third value, as follows.
ASCII ESC E n
Hex 1B 45 n
Decimal 27 69 n
Where n is 0 or 1, turning bold off or on.
Here is a detailed ESC/POS reference.

Customising word separators in vi

vi treats dash - and space as word separators for commands such as dw and cw.
Is there a way to add underscore _ as well?
I quite often want to change part of a variable name containing underscores, such as changing src_branch to dest_branch. I end up counting characters and using s (like 3sdest), but it would be much easier to use cw (like cwdest).
Is there a way to add underscore _ as well?
:set iskeyword-=_
What is, and is not a member character to keywords depends on the language. For help on iskeyword use :help iskeyword.
In case you're using vim, you can change that by setting the iskeyword option (:he iskeyword). If that is not an option, you can always use ct_ instead of counting.
One other good option in such cases is to use camelcasemotion plugin.
It adds new motions ,b, ,e, and ,w, which work analogously with b, e, and w, except that they recognize CamelCase and snake_case words. With it you can use
c,edest
and this will replace "src_branch" with "dest_branch" if your cursor was on first character of "src_branch".
You could type cf_dest_ and save the counting part.
Edit: or as suggested: ct_ changes text until right before the underline character. (I'm using the f motion more, so it came more naturally to me)
Or you could redefine 'iskeyword' (:help iskeyword for details).
I was just looking at this myself and added this to my .vimrc:
set iskeyword=!-~,^*,^45,^124,^34,192-255,^_
My .vimrc had issues with ^| and ^", which was part of the default iskeyword for my setup, so I changed to their ascii values and it works fine. My main modification was to add "^_" to the end of the default setting to keep vim from seeing underscore as being part of a word.
To delete to the next underscore enter "df_"
To change to the next underscore enter "cf_"
NOTE: don't include the double quotes.

Resources