Sphinx + xmlpipes2 + Mysql Connector. Problems with cyrillic - c#

I have a problem configuring sphinx+mysql on my machine (Windows 7).
I use sphinx 2.0.6 and MySQL connector 6.5.5 to get to sphinx from C# code. Everything works fine when I try to search a words in English ("madrid" for ex.). But when I send a query from C# code which contains a cyrillic word (that had to be indexed) I receive no results. Here is what I see in the "query.log" file:
[Tue Mar 26 16:35:12.642 2013] 0.000 sec [ext2/0/ext 0 (0,10)] [airportIndex] ????
Latin words looks normal:
[Tue Mar 26 16:35:06.195 2013] 0.000 sec [ext2/0/ext 0 (0,10)] [airportIndex] *mosc*
The charset_table seems to be correct in config:
charset_type = utf-8
charset_table = 0..9, A..Z->a..z, _, a..z, \
U+410..U+42F->U+430..U+44F, U+430..U+44F, U+0401->U+0435, U+0451->U+0435
I just don't know what to do. I've googled for solution the whole day I tried many different solutions, but none of them helped me. Maybe anyone could help me here? Please...

Found it. It was a connector bug (or feature, I'm not sure). It was trying to get the server datetime offset, and failed because sphinx does not have this function. I've just commented this code line (inside MySql.Data.dll) and it started working correctly.

Related

How to get sorted Values from HTML Table in C#?

Hello fellow Programmers.
I now spend a whole Day reading Threads to solve this Problem.
I am Parsing HTML from an automatic generated schedule, the same schedule programm was discussed 6 years ago on this thread: Parsing complex HTML tables
But this java / javascript solutions wont work for me. Also the mentioned Programs arent working anymore, I think they released a new Version of the Software. This is the Example I am trying to Parse: https://www.ostfalia.de/cms/de/b/studium/stundenplaene/download/ss19_b_stdgrp_ai_6.html
I need the Parsed Data in the right sequence because I want to generate an iCalendar file with it, or pass/send the data into an self written schedule App
I am using the HTML Agility Pack and Im already sucessful with parsing what I need but I cant get it in the right order its complete split because the HAP displays by row like any other parser. Im so desperate I was close to just count the emtpy trs to estimate when a new row begins but this doesnt work because the program has sometimes more sometimes less empty lines. Does somebody of you has an idea?
This is my Code to get the infos I need:
WebClient client = new WebClient();
string html = client.DownloadString("https://www.ostfalia.de/cms/de/b/studium/stundenplaene/download/ss19_b_stdgrp_ai_6.html");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
var erg = doc.DocumentNode.SelectNodes("//td[#class='v']");
for (int i = 0; i < erg.Count; i++)
{
txt_check.Text = (erg[i].InnerText);
list_check.Items.Add(erg[i].InnerText);
}
"class v" is the event and "class t" is the time in this example its just class v
I get:
The output of class='v' looks like:
10:30 - 12:00 UhrAI 6.1 Komponentenbasierte SoftwareentwicklungB. RogallaB 109
13:00 - 14:30 UhrAI WPF-12 CCNA 2 Cisco Routing & SwitchingChr. HollmannA 201
13:00 - 14:30 UhrAI WPF Inst. u. Betrieb einer Datenb. a. B. OracleD. HeringA
14:45 - 16:15 UhrAI WPF Mathematik III für InformatikerT. WaldeerB 27 114
14:45 - 16:15 UhrAI WPF-18 AutomatisierungstechnikF. DziembowskiA 107
The output of class='t' looks like:
"Di, 05.03.2019"
"Mi, 06.03.2019"
"Do, 07.03.2019"
"Fr, 08.03.2019"
"Sa, 09.03.2019"
I hope someone has an idea how I can Sort and Match the informations in an Dictionary or List to get it in an ICS.
The Output should be like:
"MI, 06.03.2019 , 8:45 - 10:15 ,AI 6.1 Komponentenbasierte Softwareentwicklung B. Rogalla B109 , 10:30 - 12:00 AI 6.1 Komponentenbasierte Softwareentwicklung B. Rogalla B109"
...
So I can bring it in the ICS Format or DATE/TIME for an Calendar App or something.
Pastbin for the whole HTML:
https://pastebin.com/hHbJTujN
Some Pictures of the Output:
https://drive.google.com/open?id=16Y_hISdVEvzlrS6LCmBMcwAarGhz__t0

DateTimeFormat.AbbreviatedMonthNames adding a dot at the end of month's name

Last night we migrated our web services tier from physical Windows 2008 r2 to virtual Windows 2012.
We are getting tons of events on ours logs about DateTime's invalid formats, strange as we double checked our regional settings.
Long story short:
CultureInfo.GetCultureInfo("es-MX").DateTimeFormat.AbbreviatedMonthNames
Outputs (using LinqPad5):
ene.
feb.
mar.
on our new 2012 env while on 2008 ouptus:
ene
feb
mar
Our parsing is something like this:
DateTime.Parse("18 ene 16",CultureInfo.GetCultureInfo("es-MX"))
And while it worked wonders now it throws
FormatException :
The string was not recognized as a valid DateTime. There is an unknown word starting at index 3..
While
DateTime.Parse("18 ene. 16",CultureInfo.GetCultureInfo("es-MX"))
works but isn't the expected input from our several clients.
Working on the same runtime version (4.0.30319.42000), double checked (again) our regional settings on both servers what else can I look for to fix this (before giving up and hacking it with a regex replace)?
Thanks.
Sadly I couldn't find anything in the configuration that pointed me in the right direction.
Ended with a nasty hack like this:
var cultura = CultureInfo.CreateSpecificCulture("es-MX");
if (cultura.DateTimeFormat.AbbreviatedMonthNames.First().EndsWith("."))
cultura.DateTimeFormat.AbbreviatedMonthNames = cultura.DateTimeFormat.AbbreviatedMonthNames.Select(c => c.Substring(0, c.Length > 1 ? c.Length - 1 : 0)).ToArray();
and used that culture in the parsing.
I ran into the same problem, when scraping a web-element for a date.
The date looked like this "Fre 14. okt 2022".
Inspired by DSXP answer, I found this to be working:
var cultureInfo = new CultureInfo("da-DK");
cultureInfo.DateTimeFormat.AbbreviatedMonthNames = cultureInfo.DateTimeFormat.AbbreviatedMonthNames
.Select(x => x.EndsWith(".") ? x.TrimEnd('.') : x)
.ToArray();

c# regex to search text but not report it in the matched groups

I have the following output from a utility I use for data processing.
Processed output from W765 build 66721
File target: C:\Documents and Settings\Jon\Desktop\test\1024\cards.dat
Cards loaded: 876 1456 1457 1459 2072
Errors encountered (0)
Warnings encountered (0)
Pass
I want a .Net regex to be able to retrieve as groups just 876 1456 1457 1459 2072 and nothing else.
I have got to this that works
([0-9]\d+)+
but unfortunately it yields
Found 8 matches:
765
66721
1024
876
1456
1457
1459
2072
I thought this would work instead
.*(?:Cards loaded\: )([0-9]\d+)+
but it doesn't.
Can someone please point me in the right direction.
Thank you
Jonathan Bolton
Try with this:
Cards loaded:(?'digits'(\d|\s)+)
this will return in the named group "digits" the numeric portion you need
Maybe you could try Cards loaded\: [\d\s]+ to return Cards loaded: 876 1456 1457 1459 2072, then on that string, do \d+ to get each of the relevant results.
Use this:
(?m)(?<=^Cards loaded: (?:\d+\s)*)\d+
Output:
Does it have to just be a regex, i.e. just remove the guff you don't want from the begining before parsing
string toSearch = #"Processed output from W765 build 66721 File target: C:\Documents and Settings\Jon\Desktop\test\1024\cards.dat Cards loaded: 876 1456 1457 1459 2072 Errors encountered (0) Warnings encountered (0) Pass";
string shortened = toSearch.Substring(toSearch.IndexOf("Cards loaded:"));
var matches = Regex.Matches(shortened,#"([0-9]\d+)+");

Ingenico 6550 won't display signature box

I'd call Ingenico's tech support, but I don't have a month to wait for their callback.
Our app uses the 6550 and it displays all the forms just fine except, on one machine it's not showing the signature box on the signature capture form. It shows the buttons and text just fine.
I've tried using our app, I've tried the Ingenico test app. Everything seems to check out fine. The only thing I get in th log is this:
2/17/2011 8:43:33 AM (31813 ms) EC0000 Device name [Ing6XXX] - UPOS-Interface-App error code=0xFD
It's followed by these lines after I dismiss the form:
2/17/2011 8:43:33 AM (31860 ms) EC0000 Device name [Ing6XXX] - Last platform error code from device=0x2, desc=SingleButtonEntry: ssaSecFuncKe
2/17/2011 8:43:33 AM (31860 ms) EC0111 Device name [Ing6XXX] - SIG - Direct IO - Command 12 - Invalid command, or function code missing. Length 5 [Package {00 05 95 FD 6D}] [Translation {iDataLength 0}{ucFunctionCode 95}{ucResponseCode FD}{ucResultCode 6D}{sData }]
2/17/2011 8:43:33 AM (31860 ms) EC0111 Device name [Ing6XXX] - SO APP - Direct IO - Command 12 - Invalid command, or function code missing. Length 5 [Package {00 05 95 FD 6D}] [Translation {iDataLength 0}{ucFunctionCode 95}{ucResponseCode FD}{ucResultCode 6D}{sData }]
I'm not sure if that's related. Does anyone have experience with these things. Any idea what might cause the failure to display the signature box?
The problem turned out to be a missing registry setting for the form location. Not sure how we missed that.

Gems with .NET Applications - How do I set up the Executables so they run without error?

I have a gem, roundhouse, which is an application compiled with .NET (C#). Runs on Windows and it should run in a 32 bit process.
To set up my gemspec, I set:
Gem::Specification.new do |s|
s.platform = 'mswin32'
s.name = 'roundhouse'
s.version = version
s.files = Dir['lib/**/*'] + Dir['bin/**/*']
s.bindir = 'bin'
s.executables << 'rh.exe'
When I install the gem, I should be able to type rh.exe from the command line at any path and it should run correctly.
In practice, I'm not seeing this work correctly. This is what I'm getting back:
Window has this for the header: 16 bit MS-DOS Subsystem
C:\WINDOWS\system32\cmd.exe - rh.exe
The NTVDM CPU has encountered an illegal instruction.
CS:xxxx IP:xxxx OP:xx xx xx xx xx Choose 'Close' to terminate the application.
Here is a picture of the issue (link to TwitPic): Error
If I go to the directory where the item was installed, I can run it and it works great. It's just something in the registration of the command to run from anywhere.
I did quite a bit of searching before asking and came up with nothing. It could be that I don't know what I should be searching for. So let me ask the question, is there a way to register an executable with gems for windows executable applications (built with .NET) and have them register properly with the command line? If so, how is that done?
UPDATE:
I found that gems creates a shim in the C:\Ruby\bin directory that points back to the other file. So there is a rh.exe file that is really just a text file. This is its contents:
#!C:/Ruby/bin/ruby.exe
#
# This file was generated by RubyGems.
#
# The application 'roundhouse' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'roundhouse', version
load Gem.bin_path('roundhouse', 'rh.exe', version)
if you're distributing it with the file "rh.exe"
then you'll want to create a file
bin/rh
s.executables << 'bin/rh'
then when it's installed gems will create an "rh.bat" file which runs ruby "bin/rh" essentially (as you've seen).
So within bin/rh put something like
result = system(File.dirname(__FILE__) + "/rh.exe" ARGV.join(' '))
exit 1 unless result
result = system(File.dirname(__FILE__) + "/rh.exe " + ARGV.join(' '))
exit 1 unless result
So the endresult should maybe look like? note the space after 'rh.exe'

Categories