Thursday 24 October 2013

Visual C++: unnecessary rebuilds

You hit F5, but one of your (often third-party) solution projects wants to be built, while there is no changes inside. It annoys you, run after run. The solution is the following: check if physically non-existing source files are included in the project. Remove them, and with high probability everything will become ok.

Add: also see http://rdaemons.blogspot.se/2011/01/visual-c-2010-up-to-date-project-always.html.

Thursday 17 October 2013

False commas aren't like 10 years ago

This phenomenon in Russian language has always been recalled in a context of dashes and marks of omission. Also, one can name this article from 2004 about replacing slang and obscenes with commas. Since the end of 2012, we started to notice that such commas are almost everywhere, not only in blogs and social networks, but also in online press and offline ads.

Here is the evidence of the last 2 months:

2013-11-10:
В сентябре, Владимир Путин также обмолвился, что такой поворот событий не исключен
Приехавшие к месту убийства правоохранители, просмотрели видеозапись и опросили потерпевшую
2013-10-01: Ваша цель, слушать час!
2013-09-27: Плотность пикселей будет тогда больше чем, в ретине.
2013-09-25: Спикер Совета Федерации Валентина Матвиенко, предложила обсудить возможность возвращения в избирательные бюллетени графы "против всех"

Wednesday 9 October 2013

A strange Windows update

In our stack, we have a rule base compiler which is an exe-file that generates bat-file and calls it. Yesterday, right after installing monthly updates from Microsoft, this compiler has stopped working properly on some of our Windows 7 sp1 x64 machines, throwing the «Applcation has stopped working» window at the moment of calling bat-file from exe. Bat-file ran fine separately. Neither UAC no Security Essentials deactivating helped, as well as running the stuff as Administrator. Finally, we got the soft working right after setting "Compatibility: Windows 7" for our exe. It seems that Microsoft has shipped a strange security update which treats exe-s that run bat-s as "bad". Our bat actually read registry, because it ran vsvars32.bat. Maybe an MS intern plays pranks? :) We didn't figure out what exactly the update it was, hope they'll fix the problem in a couple of weeks.

Monday 7 October 2013

Build Rus, Eng, Ger AOT morpho for .NET

1) Download trunk from http://seman.sourceforge.net/. I check out it to p:\SEMAN\. Build Debug. Don't try to build other configs, they will fail even worse than in Debug configuration.
2) Download http://aot.ru/download.php — RusLemmatizer.zip and MorphWizard.zip. Install with default paths.
3) Delete all from c:\Rml\Dicts\.
4) Copy p:\SEMAN\Dicts\Morph\ to c:\Rml\Dicts\.
5) Copy p:\SEMAN\Dicts\SrcMorph\ to To c:\Rml\Dicts\.
6) From p:\SEMAN\Source\MorphGen\Debug take MorphGen.exe and replace it into c:\Rml\Bin\.
7) Now just run eng_gen.bat, ger_gen.bat and rus_gen.bat. It is slow, schedule 2-4 hours.
8) Use the resulting binaries with Lemmatizer.NET, which is compilable from p:\SEMAN\Source\LemmatizerNET.sln .
9) But introduce a little workaround to Lemmatizer.NET. In Lemmatizer.cs, in LoadDictionariesRegistry function, replace the following:

_useStatistic = true;
_statistic.Load(this, "l", manager);

to:

if (Language == InternalMorphLanguage.morphRussian)
{
   _useStatistic = true;
   _statistic.Load(this, "l", manager);
}
else
{
   _useStatistic = false;
}

10) To work with dictionaries, make separate folder like p:\Lemmatize\Rml and put there c:\Rml\Bin and c:\Rml\Dicts.
11) The minimal test program to do lemmatizing is the following.

class Program
{
  static void Main(string[] args)
  {
    Console.WriteLine("Enter Russian word (0 to exit)");
    ILemmatizer lem = LemmatizerFactory.
      Create(MorphLanguage.Russian);
    var manager = FileManager.
      GetFileManager(@"p:\Lemmatize\Rml"); // make it relative!
    lem.LoadDictionariesRegistry(manager);
    string word;
    do
    {
      Console.Write("> ");
      word = Console.ReadLine();
      var paradigmList = lem.
        CreateParadigmCollectionFromForm(word, false, true);
      for (var i = 0; i < paradigmList.Count; i++)
      {
        var paradigm = paradigmList[i];
        Console.WriteLine ("\t" + paradigm.Norm);
      }
    }
    while (word != "0");
  }
}

Friday 4 October 2013

File assocs grab between versions of MS Office

When, e.g., Office 2010 tries to take file associations from Office 2003 previously installed, and then back, and then back. Use this batch:

set P=HKCU\Software\Microsoft\Office

reg add %P%\11.0\Word\Options /v NoReReg /t REG_DWORD /d 1
reg add %P%\12.0\Word\Options /v NoReReg /t REG_DWORD /d 1
reg add %P%\15.0\Word\Options /v NoReReg /t REG_DWORD /d 1

reg add %P%\11.0\Excel\Options /v NoReReg /t REG_DWORD /d 1
reg add %P%\12.0\Excel\Options /v NoReReg /t REG_DWORD /d 1
reg add %P%\15.0\Excel\Options /v NoReReg /t REG_DWORD /d 1

... the same for PowerPoint, Access ...

1) Substitute here certain versions of MS Office (maybe 14.0, there is no 13.0, I think) from your machine.
2) Check whether other programs like OneNote have such branches in registry, I haven't checked.
3) Never use spaces around "=" sign in set operation :)

Thursday 3 October 2013

Restore file associations and icons under Windows

Soft for Windows likes to override icons and extentions assocs so that it's so difficult to bring them to normal state. For instance, you can get crappy icons on Word files after reinstallation of MS Office. The solution to this mess is damn simple.

Backup.bat
FTYPE > backup_types.txt
ASSOC > backup_ext.txt

Restore.bat
FOR / F "tokens =* delims =" %%G IN (backup_types.txt) DO FTYPE %%G
FOR / F "tokens =* delims =" %%G IN (backup_ext.txt) DO ASSOC %%G

Don't forget to generate and put to safe place those two files after fresh install of Windows and soft. For those who is in search for the solution like I did before, here is the list of keywords to let Google find the post:
  • restore file associations Windows
  • restore icons Windows
  • restore exntention associations Windows
  • how to restore file associations Windows
  • restore file types Windows
  • recover file associations Windows