|
HI All,
I Want to read an image that contains a data formatted as table in this image using MODI OCR, but when i red the image the returned text not formatted correctly.
this is a sample table saved as a picture
A5 A4 A3 A2 A1 Q.#
1 1 1 1 1 -1-
2 2 2 2 2 -2-
3 3 3 3 3 -3-
4 4 4 4 4 -4-
5 5 5 5 5 -5-
Please help me if you can.
|
|
|
|
|
zead wrote: Please help me if you can.
I'd like to help, but I don't know what your question is.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
HI,
I have an image that contains a text as table (columns and rows data) ,
I want to use OCR or MODI to read this text from image and write it in excel file as a columns.
My Question is how to use the Office MODI or any OCR libraries with .Net to do that.
Thanks
|
|
|
|
|
I am developing desktop application.Front end:Visual studio 2010.
Is it possible to change the color(foreground & background) of only selected item in the ListBox?
is this possible with mousehover event?
Please suggest the better solution
|
|
|
|
|
I'm not sure if you can do it in the way you ask, but you can use the OnDrawItem() [^] event to do your own drawing of the items.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
In this article[^] an OwnerDrawn ListBox is used to control the colors.
|
|
|
|
|
You have to either use an owner draw list box or a custom control[^] (shameless self-promotion).
|
|
|
|
|
Hallo
i get this Error when i try to load an Ax. has any one any idee?
Error:
Unable to get the window handle for the 'MyAx' control. Windowless ActiveX controls are not supported.
OS:
Windows 7 32Bit
Visual Studio 2010
modified 29-Apr-12 7:18am.
|
|
|
|
|
|
Hello,
I've a question about xmlSerializer in C#,
My question is how can you create an xmlfile with the xmlserializer from two or more different objects without creating a class contains all those objects.
For example this is the xml file wanted:
="1.0"="UTF-8"
<Root>
<Books>
<Book>
<Title>X</Title>
<Author>Mr x</Author>
</Book>
</Books>
<Movies>
<Movie> Movie Y</Movie>
</Movies>
</Root>
At the moment I'll do this with the XDocument class and create for each property an Xelement.
For example I create an XElement books which contains child elements and add them all to an XDocument and save this XDocument object.
public XElement getBooksElement(List<Book> books)
{
XElement ret = new XElement("Books");
foreach(Book b in books)
ret.Add(getBookElement(b));
return ret;
}
public XElement getBookElement(Book book)
{
XElement ret = new XElement("Book");
ret.Add(new XElement("Title", b.Title));
ret.Add(new XElement("Author", b.Author));
return ret;
}
How can be this achieved without creating a class containing all elements which should be in the object but serialize each object to an xml part and add those to the xml file.
I hope my question is clear enough,
Thank you in advance.
|
|
|
|
|
So you want to serialize each object individually, without creating a container class to hold all the objects? How about if you serialize each object to a MemoryStream, then create an XElement or XDocument to contain them all, and stick all the data you saved into the MemoryStreams inside it?
|
|
|
|
|
Yes that's sounds like a good idea but how do I create a XElement or XDocument out of the memorystream, and how can I manage the deserialization of this? Because should I read the XDocument and divide this XDocument in multie memorystream for dividing this up?
|
|
|
|
|
You can use the XDocument.Load static method to create an XDocument from the stream. (You might need to call Seek on the stream to reset it to the beginning!) As for creating multiple MemoryStreams to load the XDocument's elements, you can do this:
foreach (var element in myXDocument.Elements())
{
var ms = new MemoryStream(Encoding.Unicode.GetBytes(element.ToString()));
}
|
|
|
|
|
I don't really have a big issue with the powershell working because it works just fine.
The problem I'm having is the method exits before the command is actually completed on the Exchange server. I think it may have something to do with the way Exchange throttles powershell commands.
Is there a way to use powershell with Exchange but have it completely wait until the command is finish before refreshing my page?
Let me give you an example:
A user logs into the web interface and decides to enable their user for Exchange. So the user clicks Enable Exchange. This fires a powershell to Exchange running the Enable-Mailbox command. After it completes the command it retrieves updated information from Active Directory / Exchange about the users mailbox.
The problem I have is when it tries to retrieve the updated information it hasn't had time to populate in Exchange so it still thinks there isn't a mailbox. I know I could put a sleep in there but I rather do something cleaner.
Here is my base class:
public void RunPowershell(PSCommand pscmd = null, String script = null)
{
Runspace remoteRunspace = null;
PSDataCollection<ErrorRecord> errors = new PSDataCollection<ErrorRecord>();
OpenRunspace(_uri, _schema, _username, _password, ref remoteRunspace);
remoteRunspace.Open();
powershell.Runspace = remoteRunspace;
powershell.Streams.ClearStreams();
powershell.Commands.Clear();
if (pscmd != null)
{
String debugLog = "[RunPowershell] Executing powershell: ";
foreach (Command cmd in pscmd.Commands)
{
debugLog += cmd.CommandText;
foreach (CommandParameter cp in cmd.Parameters)
debugLog += String.Format("-{0} {1}", cp.Name, cp.Value.ToString());
}
Log.Debug(debugLog);
powershell.Commands = pscmd;
}
else if (script != null)
{
Log.Debug("[RunPowershell] Executing powershell: " + script);
powershell.Commands.AddScript(script);
}
powershell.Invoke();
ThrowIfError();
Log.Debug("[Exited] RunPowershell");
}
private void OpenRunspace(string uri, string schema, string username, string password, ref Runspace remoteRunspace)
{
SecureString securePass = new SecureString();
foreach (char c in password.ToCharArray())
securePass.AppendChar(c);
PSCredential psc = new PSCredential(username, securePass);
WSManConnectionInfo wmci = new WSManConnectionInfo(new Uri(uri), schema, psc);
wmci.AuthenticationMechanism = AuthenticationMechanism.Basic;
remoteRunspace = RunspaceFactory.CreateRunspace(wmci);
}
Here is the command running Enable-Mailbox:
public void Execute()
{
try
{
if (String.IsNullOrEmpty(Identity))
throw new Exception("Identity must be specified.");
if (String.IsNullOrEmpty(Alias))
throw new Exception("Alias must be specified.");
if (String.IsNullOrEmpty(DisplayName))
throw new Exception("Display Name must be specified.");
if (String.IsNullOrEmpty(PrimarySmtpAddress))
throw new Exception("The Primary Smtp Address must be specified.");
if (String.IsNullOrEmpty(CompanyCode))
throw new Exception("The Company Code must be specified.");
String enableMailboxCmd = String.Format(@"Enable-Mailbox -Identity '{0}' -AddressBookPolicy '{1} ABP' -Alias '{2}' -DisplayName '{3}' -PrimarySmtpAddress '{4}';",
Identity, CompanyCode, Alias, DisplayName, PrimarySmtpAddress);
String setMailbox = String.Format(@"Set-Mailbox -Identity '{0}' -OfflineAddressBook '{1} OAL' -CustomAttribute1 '{2}' -IssueWarningQuota:{3}KB -ProhibitSendQuota:{4}KB -ProhibitSendReceiveQuota:{5}KB -UseDatabaseQuotaDefaults $False;",
Identity, CompanyCode, CompanyCode, WarningQuota, ProhibitSendQuota, ProhibitSendReceiveQuota);
String setCasMailbox = String.Format(@"Set-CASMailbox -Identity '{0}' -ActiveSyncEnabled:${1} -ActiveSyncMailboxPolicy '{2}' -IMAPEnabled:${3} -POPEnabled:${4} -MAPIEnabled:${5} -OWAEnabled:${6} -OWAMailboxPolicy '{7}';",
Identity, ActiveSyncEnabled.ToString(), ActiveSyncPolicy, IMAPEnabled.ToString(), POPEnabled.ToString(), MAPIEnabled.ToString(), OWAEnabled.ToString(), OWAPolicy);
this.RunPowershell(null,
enableMailboxCmd +
setMailbox +
setCasMailbox);
}
catch (Exception ex)
{
throw ex;
}
finally
{
this.Close();
}
}
Thank you for your help
|
|
|
|
|
Hi,
I am working on a c# app that talks to an external device via a comm port.
The external device comes with a header file that defines the commands that can be sent and the possible return values, all as #define's.
Is there a way to get thease #define's in to my c# app, other than copying and pasting?
Thanks.
“If I had asked people what they wanted, they would have said faster horses.”
― Henry Ford
|
|
|
|
|
Ok, even if i get the header included some how, its still not going to work...
MSDN: The #define directive cannot be used to declare constant values as is typically done in C and C++.
What a crock.
“If I had asked people what they wanted, they would have said faster horses.”
― Henry Ford
|
|
|
|
|
What's a crock is that in the original C/C++ files, the original programmer made the mistake of depending on a compiler-specific feature to write code.
I know full well that everyone used to use #define to declare their constants in C/C++, even when they had a perfectly good "const" keyword, but in doing so, the made the code specific to the C/C++ compiler.
Sorry, but don't blame C# for the failings of some other programmer in a previoud language.
|
|
|
|
|
At one place where we did C, the "guru" specified that we should use define s (rather than const s etc.) as much as possible because they don't use memory.
|
|
|
|
|
Guess I have a lot code to change.
BDF
I often make very large prints from unexposed film, and every one of them turns out to be a picture of myself as I once dreamed I would be.
-- BillWoodruff
|
|
|
|
|
|
Well... the quick and dirty way would be to pass it through a C pre-processor. However, you may want to limit the scope of what you do that way.
Without seeing what's actually in the header file and which parts you need, I'll show a simple example of what can be done:
Example.h
# define OPEN 1
# define CLOSE 2
# define READ 3
# define WRITE 4
Example.csi (choose an extension)
namespace Support
{
public static class Command
{
public const int Open = OPEN ;
public const int Close = CLOSE ;
public const int Read = READ ;
public const int Write = WRITE ;
}
// or
public enum Command
{
Open = OPEN
,
Close = CLOSE
,
Read = READ
,
Write = WRITE
}
}
Pass them through a C pre-processor, this uses the Visual C/C++ one:
cl /nologo /C /EP /P /FIC:Example.h /FiExample.cs Example.csi
Results in:
Example.cs
namespace Support
{
public static class Command
{
public const int Open = 1 ;
public const int Close = 2 ;
public const int Read = 3 ;
public const int Write = 4 ;
}
// or
public enum Command
{
Open = 1
,
Close = 2
,
Read = 3
,
Write = 4
}
}
You can then include this file in your project. If needed, you can have a pre-build step that performs the above pre-processing.
Notes:
0) The pre-C# file (csi) should not contain any directives
1) You should include a notice that it was generated
2) You could also set the file to read-only
3) Use a partial class if you want this to be part of a larger class so you don't pass the whole thing through the pre-processor
See also my Implanting Common Code in Unrelated Classes[^]
|
|
|
|
|
PIEBALDconsult wrote: the quick and dirty way would be to pass it through a C pre-processor.
That would seem like the ideal solution to me.
|
|
|
|
|
Hi,
I am currently creating a media player but as I am searching online for some help, no one seems to be able to provide the information. I am trying to have a media player which I find easy to build to have it playing videos but what I am having the issue with is creating a file on the computer and having files like mp3 which are stored there be automatically put into a library on the media player which then can be played. I want it so that the files in a folder will be automatically stored onto the media player which then I can search for on the application for the file name and click to play it. Please can people be specific because people can be very vague and state the obvious and then leave it at that. What will I need to create e.g. access database ?, and what will I need to do for it like create a class coding to list in a drop down box etc.
If anyone can help I will be highly greatful.
|
|
|
|
|
O.Calderbank wrote: I am currently creating a media player
O.Calderbank wrote: What will I need to create e.g. access database ?, and what will I need to do for it like create a class coding to list in a drop down box etc.
There seems to be some discrepancy between your statement and your question. Rather than trying to decide whether to use a dropdown or not, you need to think in more abstract terms about the design of your application. For example, what problem do you think will be solved by an Access database or by a dropdown box?
Have you looked into the basics of how to play videos[^] in your program?
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Please do not cross post.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|