Edward Zuris
edzedz at comcast.net
Fri Nov 6 09:54:31 CST 2009
Thanks Shamil for the program code. My friend likes to be tricky. But is most likely due too how his mind works, as opposed to ill intent. And I can usually untangle the code. He has done some Java, some "C", and we both were assembler programmers for awhile. I don't think he was into C++, but I don't know for sure. There was a python phase in there as well. Most of his C# work was using the 2003 version. And I have the enterprise C# 2003 compiler. Yet C# still escapes me. People say my C code looks like assembler. Thanks for letting me know about Martin Fowler. I agree with making code tricky is considered bad taste. I have looked at Martin Fowler web site already. This book of his looks interesting. Refactoring: Improving the Design of Existing Code ISBN-10: 0201485672 I am always fixing other people's code. Any good C# books you can tell me about will be helpful. By the way. . . It seems my private message didn't make it to you. And your private message to me hasn't arrived. Once again Thanks. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Friday, November 06, 2009 5:49 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Cyrillic to English character translation Hi Ed, Yes, there is some C# code there - the code used to encode original code AFAIS - I have sent it already to you privately, below in P.S. this code is also enclosed. There should also be an encoding text file. Yes, he is a self-taught C# programmer with Assembler and C/C++ previous experience I guess. The C# code can be made even shorter, and not so "tricky". (He is busy with his teams - no time to learn new C# features probably.) "Making code tricky" is considered "not so good taste" nowadays according mainly to Martin Fawler works and findings. Well, maybe that was his intention to make the code so "tricky" and therefore even more complicated for you to decipher... Learning C# programming from this coding style could be not easy for beginners. And again it's more C/C++ than C# because some high level .NET Framework's Basic Class Library classes and methods weren't used. Thank you. -- Shamil P.S. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Diagnostics; namespace Translator { class Program { static void Main(string[] args) { Interociter xlt = new Interociter(); string t; using (StreamReader sr = new StreamReader("c:\test.txt")) t = sr.ReadToEnd(); using (StreamWriter sw = new StreamWriter("c:\\outputfile.txt")) for (int i = 0; i < t.Length; i++) sw.Write(xlt.Xlate(t.Substring(i, 1).ToUpper())); } } class Interociter : SortedList<string, string> { public Interociter() { string[] alphabet; using (StreamReader sr = new StreamReader("c:\\translatetable.txt")) alphabet = sr.ReadToEnd().Split(new char[] { '\n' }); for (int i = 0; i < alphabet.Length - 1; i++) base.Add(alphabet[i].Split(new char[] { '\t'})[1].Substring(0, 1), alphabet[i].Split(new char[] { '\t' })[0]); } public string Xlate(string s) { if (base.ContainsKey(s)) return base[s]; else return s; } } } -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Edward Zuris Sent: Friday, November 06, 2009 3:13 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Cyrillic to English character translation Yes, he is a self taught C# programmer. I am self taught myself, but not in C#. We are both are from New Mexico, the southeast coiner. Where there isn't a lot of opportunity unless you teach yourself a skill and leave. We started our careers together back in 1973. He went from development to management a few years ago. He is now managing several groups of programmers. Some in the Ukraine, a smaller group in Russia, and there is some other group, I forget where. Even though we are from similar backgrounds we have different politics. I try to ignore his comments and study his code. So is there any C# programming code in the message, or is he pulling my leg ? Anyway thanks for your help. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Thursday, November 05, 2009 2:02 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Cyrillic to English character translation Yes, and he is probably a self-taught C# programmer who learned C# quite some time ago but who is very busy nowadays working on customers' projects and/or participating in "hot" political discussions... :) -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Edward Zuris Sent: Thursday, November 05, 2009 11:22 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Cyrillic to English character translation Yes the author is trying to be cute. But he is a good programmer. I hope there is a C# in the message. The little table you included will help me to get started. Thanks. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Wednesday, November 04, 2009 10:07 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Cyrillic to English character translation Hi Edward, Sorry, I was out for several days, and I have found your Access-D message just now. This "code" is a way to transliterate English using Cyrillic - it could be decoded but AFAIS comments to this "code" seems to be a bit rude "moralistic reasoning" (authors of this "code" could be I guess young and "silly", or very conservative old people): Here is a translation table I have just found: A - А B - б C - Ч, ЧP D - Д E - Э F - Ф G - Г H - HЬ I - И J - ДЖ K - К L - Л M - М N - Н O - О P - П Q - Q R - P S - C T - T U - Ю V - В W - УО X - X Y - Ё Z - З -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Edward Zuris Sent: Sunday, November 01, 2009 8:20 PM To: accessd at databaseadvisors.com Subject: [AccessD] Cyrillic to English character translation Does anyone have a Cyrillic to English character translation VBA snippet I could please study ? I did some ASCII and EBCDIC translation some 25 years ago. However, Unicode is something I am new to and wonder how that would work. Here is what I am hopeing to convert to English. I am told this is not Russian, but American English displayed in Cyrillic. It should be a C# program, plus some snide comments. Any suggestions ? Thanks. =================================================== Start =================================================== ЭД ДЖЮCT ФОP ФЮН И ДЭЧИДЭД TО CЭЭ HЬОУО ФЭУО ЛИНЭC ОФ ЧОДЭ И'Д HЬАВЭ TО УОPИTЭ TО ЧОНВЭPT ЧPЁPИЛЛИЧ TО ЭНГЛИCHЬ АНД ВИЧЭ-ВЭPCА. И'М PЭАЛЛЁ QЮИTЭ CTЮННЭД THЬАT А ЧАПАбЛЭ ПPОГPАММЭP CЮЧHЬ АC ЁОЮPCЭЛФ УООЮЛДН'T HЬАВЭ АППЛИЭД THЬИC CОЛЮTИОН TО THЬЭ ПPОбЛЭМ А ЛОНГ TИМЭ АГО. АНЁУОАЁ И УОАC АбЛЭ TО ДО ИT ИН НИНЭ ЛИНЭC: ЮCИНГ CЁCTЭМ; ЮCИНГ CЁCTЭМ.ЧОЛЛЭЧTИОНC.ГЭНЭPИЧ; ЮCИНГ CЁCTЭМ.TЭXT; ЮCИНГ CЁCTЭМ.ИО; ЮCИНГ CЁCTЭМ.ДИАГНОCTИЧC; НАМЭCПАЧЭ TPАНCЛАTОP { ЧЛАCC ПPОГPАМ { CTАTИЧ ВОИД МАИН(CTPИНГ[] АPГC) { ИНTЭPОЧИTЭP XЛT = НЭУО ИНTЭPОЧИTЭP(); CTPИНГ T; ЮCИНГ (CTPЭАМPЭАДЭP CP = НЭУО CTPЭАМPЭАДЭP("Ч:\TЭCT.TXT")) T = CP.PЭАДTОЭНД(); ЮCИНГ(CTPЭАМУОPИTЭP CУО = НЭУО CTPЭАМУОPИTЭP("Ч:\\ОЮTПЮTФИЛЭ.TXT")) ФОP(ИНT И=0; И<T.ЛЭНГTHЬ;И++) CУО.УОPИTЭ(XЛT.XЛАTЭ(T.CЮбCTPИНГ(И,1).TОЮППЭP())); } } ЧЛАCC ИНTЭPОЧИTЭP:CОPTЭДЛИCT<CTPИНГ,CTPИНГ> { ПЮбЛИЧ ИНTЭPОЧИTЭP() { CTPИНГ[] АЛПHЬАбЭT; ЮCИНГ(CTPЭАМPЭАДЭP CP = НЭУО CTPЭАМPЭАДЭP("Ч:\\TPАНCЛАTЭTАбЛЭ.TXT")) АЛПHЬАбЭT = CP.PЭАДTОЭНД().CПЛИT(НЭУО ЧHЬАP[] {'\Н'}); ФОP(ИНT И=0;И<АЛПHЬАбЭT.ЛЭНГTHЬ - 1;И++) бАCЭ.АДД(АЛПHЬАбЭT[И].CПЛИT(НЭУО ЧHЬАP[] { '\t' })[1].CЮбCTPИНГ(0,1),АЛПHЬАбЭT[И].CПЛИT(НЭУО ЧHЬАP[] { '\t' })[0]); } ПЮбЛИЧ CTPИНГ XЛАTЭ(CTPИНГ C) {ИФ (бАCЭ.ЧОНTАИНCКЭЁ(C)) PЭTЮPН бАCЭ[C]; ЭЛCЭ PЭTЮPН C;} } } ФАЧT ИC, ИФ ЁОЮ'PЭ ГОИНГ ПPЭTЭНД THЬАT ЁОЮ КНОУО ЭВЭPЁTHЬИНГ, ЁОЮ МИГHЬT ГЭT ЧАЮГHЬT. THЬЭ бЭCT THЬИНГ TО ДО АT THЬАT ПОИНT, ИC АДМИT THЬЭ TPЮTHЬ, бЮT НОT ЁОЮ, НО CИP. ЁОЮ CTИЛЛ PЭФЮCЭ TО АДМИT THЬАT ЁОЮ PЭАЛЛЁ ДОН'T КНОУО THЬЭ ЧЁPИЛЛИЧ АЛПHЬАбЭT. МЁ ФPЮCTPАTИОН УОИTHЬ ЁОЮ ИC THЬАT THЬИC АЛCО АППЛИЭC TО МАНЁ ОTHЬЭP THЬИНГC ЁОЮ ЧОНCTАНTЛЁ АCCЭPT. CЮЧHЬ АC АЛЛ PЭПЮбЛИЧАНC АPЭ PАЧИCT, НАЗИ, HЬОМОCЭXЮАЛC УОHЬО "ЁОЮ ДЖЮCT ДОН'T КНОУО УОHЬАT THЬЭЁ УОАНT ФОP THЬИC ЧОЮНTPЁ" ИНCИНЮАTИНГ ОН TОП ОФ ИНCЮЛT THЬАT THЬЭЁ АPЭ АЛCО ЮН АМЭPИЧАН. ЁОЮ НЭВЭP CTОП TО THЬИНК THЬАT THЬИC ЧОЮЛД бЭ ИНЧPЭДИбЛЁ ИНCЮЛTИНГ TО ОTHЬЭPC, ЭXTPЭМЭЛЁ PАЧИCT, АНД бИГОTЭД. THЬЭН ЁОЮ КЭЭП TЭЛЛИНГ МЭ THЬЭ CАМЭ ЛИЭC, ОВЭP АНД ОВЭP, ДЭCПИTЭ ФАЧT ПИЛЭД ОН TОП ОФ ФАЧT, бЭЧАЮCЭ THЬЭCЭ ЛИбЭPАЛ "TPЮTHЬC" АPЭ TО бЭ бЭЛИЭВЭД ИН THЬЭ ФАЧЭ ОФ АЛЛ ЭВИДЭНЧЭ TО THЬЭ ЧОНTPАPЁ. CО, И АМ КЭЭПИНГ ЁОЮ TО ЁОЮP УООPД. ЁОЮ ПPЭTЭНДЭД TО КНОУО ЧPЁPИЛЛИЧ, THЬЭPЭФОPЭ ЁОЮ ДО, УОHЬЭTHЬЭP ИT ИC TPЮЭ ОP НОT, АНД И PЭФЮCЭ TО бЭЛИЭВЭ АНЁTHЬИНГ ЭЛCЭ. ИН АбОЮT CИX ЁЭАPC (АбОЮT АC ЛОНГ АC И'ВЭ HЬАД TО ЭНДЮPЭ THЬЭ "НЭУО ЭД") THЬЭН И МИГHЬT ЧHЬАНГЭ бАЧК TО ЭНГЛИCHЬ, ИФ И ФЭЭЛ ЛИКЭ ИT, бЮT УОHЬЁ CHЬОЮЛД И? ЁОЮ УООН'T ЧHЬАНГЭ ЁОЮP МИНД ОН АНЁ ОФ THЬЭ ЛИбЭPАЛ ФАНTАCИЭC. НО МАTTЭP УОHЬАT HЬАППЭНC. CО И ЧАН бЭ ДЖЮCT АC CTЮббОPН АC ЁОЮ, бЮT И ДОН'T THЬИНК И ЧАН ЭВЭP бЭ АC PАЧИCT АНД МЭАН АC ЁОЮ АPЭ. НОT бЁ А ЛОНГ CHЬОT. =================================================== End =================================================== -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com