|
helo friends any one who have knowledge about ocr . i want to ask what is the latest ocr library ... or api or sdk.. m some confused. and wanna make latest ocr based software in c#
|
|
|
|
|
Please don't post the same thing repeatedly: I deleted the "spare" in this forum, but you also have a copy in QA. All you will do is duplicate work and annoy people. Pick either the C# forum or QA and stick with it.
Annoyed people are less likely to be helpful than happy ones...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
hi,
i have this code for reading xml file into my list.
var zfullname, zphone_M, zphone_F, zMail, zFname,zLname;
var ALL;
var Fname, Lname, Phone_M, Phone_F, Mail;
function XX() {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "Phone.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
$("#ZIZI").empty();
var x = xmlDoc.getElementsByTagName("MEN");
for (i = 0; i < x.length; i++) {
try { Fname = x[i].getElementsByTagName("Fname")[0].childNodes[0].nodeValue; }
catch (err) { Fname = "0"; }
try { Lname = x[i].getElementsByTagName("Lname")[0].childNodes[0].nodeValue; }
catch (err) { Lname = "0"; }
try { Phone_M = x[i].getElementsByTagName("Phone_M")[0].childNodes[0].nodeValue; }
catch (err) { Phone_M = "0"; }
try { Phone_F = x[i].getElementsByTagName("Phone_F")[0].childNodes[0].nodeValue; }
catch (err) { Phone_F = "0"; }
try { Mail = x[i].getElementsByTagName("Mail")[0].childNodes[0].nodeValue; }
catch (err) { Mail = "0"; }
if (Mail == "0") Mail = " ";
if (Phone_M == "0") Phone_M = " ";
if (Phone_F == "0") Phone_F = " ";
ALL =
'<li >' +
'<a href="men.html" data-transition="flip">' +
'<div class="ui-grid-a" id="restau_infos"> ' +
'<p style="font-size:22px; margin:0px;padding:0px;" class="nam"><b>' + Fname + " " + Lname + '</b></p>' +
'<p style="font-size:16px; margin:0px;padding:0px;" class="phn">' + Phone_M + '</p>' +
'<p style="font-size:16px; margin:0px;padding:0px;" class="phn2">' + Phone_F + '</p>' +
'<p style="font-size:14px; margin:1px;padding:1px;" class="crr">' + Mail + '</p>' +
' </div>' +
'</a>' +
'<a href="tel:' + Phone_M + ' data-icon="location" ></a>' +
'</li>'
$("#ZIZI").append(ALL);
$("#ZIZI").listview("refresh");
}
}
this work excellent.
i have WebService that return DataSet.
string SQL;
DataSet dsView;
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public DataSet GetData( string sel)
{
dsView = new DataSet();
MyParam.OpenConnection();
SQL = "select Fname,Lname,S_phone from MEN where sel = '" + sel + "'";
dsView = new DataSet();
MyParam.adp = new SqlDataAdapter(SQL, MyParam.Conn);
MyParam.adp.Fill(dsView, "MEN");
MyParam.adp.Dispose();
if (dsView.Tables["MEN"].Rows.Count >= 1)
{
return dsView;
}
else
{
return null;
}
}
How to combine both that i can read from the WebService ?
(the WebService in 127.0.0.1/WS_TEST/Service1.asmx for example)
thanks
|
|
|
|
|
|
|
Why would this question be c# related?
|
|
|
|
|
You'll probably need a newer version of the Management Studio. Download one of the recent Express editions for free.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am somewhat beginning with threads, and I am wondering if following class is thread safe? Or in which cases it is thread safe? The idea is users should be able to initialize this class once, second time initialization should not work if deinitialization was not called. But getting the properties should give correct results... and here I am having hard time to determine in which case those properties will get correct results, and if init and deinit methods are thread safe, as well as isInited method. Help appreciated. I tried make it immutable also.
static class Parameters
{
private static int x1;
private static int x2;
private static bool isInit;
private static readonly object Locker = new object();
public static bool isInited()
{
lock(Locker)
{
return isInit;
}
}
public static int X1()
{
if(!isInited()) throw new Exception("init first");
return x1;
}
public static int X2()
{
lock(Locker)
{
if(!isInited()) throw new Exception("init first");
return x2;
}
}
public static void init(int x, int y)
{
lock(Locker)
{
if(isInit) return;
isInit = true;
x1 = x;
x2 = y;
}
}
public static void Deinit()
{
lock(Locker)
{
if(!isInit) return;
isInit = false;
x1 = 0;
x2 = 0;
}
}
}
Or the client - user of this class has to take additional means to ensure this class is used in thread safe manner? Feedback appreciated
modified 30-Oct-15 16:23pm.
|
|
|
|
|
I believe what you are after is the Singleton design-pattern.
In addition to several articles on the Singleton design-pattern you can find here on CodeProject, there is a very useful analysis of different approaches by Jon Skeet (the C# uber-guru) here: [^] that covers issues of locking (thread safety), lazy initializtion, etc.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.
|
|
|
|
|
thank you but
1) you can see I am passing parameters to init method - those singletons on Jon Skeets article don't mention Singletons where you can pass parameters during init
2) I need a deinit method - users should be able to clear the Parameter class object, and set new properties if desired, again using method like init for example - since properties I have deliberately made read only
3) Can you show me sample how to achieve this using singleton?
modified 30-Oct-15 17:14pm.
|
|
|
|
|
Member 12061600 wrote: 2) I need a deinit method - users should be able to clear the Parameter class object, and set new properties if desired, again using method like init for example - since properties I have deliberately made read only
No you don't. At least, your deinit() does not need to be public anyway. When your init() method is called, you know if you're already initialized (thus, deinit() first, then re-init).
Member 12061600 wrote: 3) Can you show me sample how to achieve this using singleton?
I'm sure you can figure it out on your own. That's how you learn
Best,
John
|
|
|
|
|
yeah but users of this class might need deinit to reinitialize the class
|
|
|
|
|
I will reiterate:
When your init() method is called, inside your init() function, you know if you're already initialized (thus, deinit() first, then re-init).
Best,
John
|
|
|
|
|
deinit has to be public
otherwise if someone calls init twice it will reinitialize automatically on second call - if I follow that approach you mention, is it thread safe?
|
|
|
|
|
|
because that is how the class was used before that in C++ I am rewriting now
Ok if I follow your suggestion then calling init twice - will reinitialize it yes?
But is it thread safe now?
|
|
|
|
|
You really need to get a grasp on threading concepts.
1. Since you're accessing data inside a lock(), it is thread-safe
2. You can force the clients of your class to call init before using it - either with Debug.Asserts, or by throwing an exception if the class is not initalized
3. Why would you want to re-init this several times?
Best,
John
|
|
|
|
|
Few points:
1) I will make that class actually internal and only other class in DLL
will be able to use it (I am writing that DLL too) - users can now use other public classes of DLL which use my Parameters class
2) So the only direct user of that class is ME and I can ensure before
its properties are accessed by other methods in other classes, there is a call checking if the method is inited or not
3) Maybe users want to specify other parameters - hence need for deinit
What do you think now?
|
|
|
|
|
3. you can provide a function (thread-safe) that changes the values (without de-initializing).
Best,
John
|
|
|
|
|
Why are you so much against Deinit function? Is it so problematic?
Assume I want Deinit function, I basically gave all the details in above comments
and in the main question - would you say in such case my Parameters class is thread safe?
|
|
|
|
|
1. About deinit()- if that's what you want, fine. It's just that to me it seems to just bring extra complexity - but hey, it's your code
2. Yes, it's thread-safe
Best,
John
|
|
|
|
|
Is it also thread safe if I remove isInited checks from X1 and X2 getters? - Granted no one calls any methods of this class, unless a init method is called (this I can ensure because I am using this class directly) - I have isInited check first in any method calling this class.
|
|
|
|
|
1. Yes it is - variables X1/X2 are automatically initialized to zero.
2. You modified your code:
public static int X1()
{
if(!isInited()) throw new Exception("init first");
return x1;
}
should be
public static int X1()
{
lock(this) {
if(!isInited()) throw new Exception("init first");
return x1;
}
}
Best,
John
|
|
|
|
|
Yeah but I said what if I do
public static int X1()
{
return x1;
}
Granted none calls these methods before INIT method is called (I can ensure this because I am writing those methods) - I will check isInited calls in the start of each method calling this class
|
|
|
|