|
sorry for uncleanness, what i'm trying to do is, create a question relevant to a paragraph, means just imagine i have a C# article and i want to generate a question relevant to this article through a c# application.
i think this is not easy , but i want to know if there is a better way for this.
|
|
|
|
|
There is no trivial way to do this. I would suggest there's little chance of you coming up with a method that asks questions that appear to have been written by a human.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
As I said earlier, this can be done ONLY if the computer can UNDERSTAND the paragraph. And if the paragraph is a random one, there a very minute chance that this can be done.
That too only if the paragraph is like: "my name is XYZ" and questions should be like "what is my name". But to interpret the text, you need a human.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I'm trying to set ToolStripControlHost backcolor as ToolStripMenuItem but it only fill control's backcolor. I tried with custom Renderer and override almost every event method but nothing found working...
here is the screenshot of problem
http://i476.photobucket.com/albums/rr121/xmen_xwk/fullbackColor.png
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hello,
I have implemented a logger which is writing the data to a text file. But, the file size gets huge if all the data is written to it.
I want to keep only last one hour data in file. The logger should keep writing all data till one hour and after that it should follow LIFO structure. So that the file size will not be uncontrolled.
How it can be done in C#?
Thanks a lot.
|
|
|
|
|
LIFO is going to be a PITA - why not split the log files into hourly files, just keep withing to the file name, on the hour create a new file and then your garbage collection is a simple jod to delete the old files. Saves thrashing around inside the text file.
|
|
|
|
|
Thanks Holmes,
Actually, the data is getting logged from two different events to same file and i am just writing over there. At a given condition only one event will be fired. The file creation is done in constructor and the same name is referred to write into it.
If we can limit either text length or size then it would be easier.
|
|
|
|
|
gajesh wrote: two different events
That makes your exposure worse, it will take an appreciable amount of time to extract the first in lines from a text file, read in whole file, remove the offending lines and write out the entire file each time you write an entry. You are open to locking if the events can fire too close in time.
I don't know of any way to remove the first in lines elegantly.
|
|
|
|
|
I'd suggest to try logging frameworks like log4net . It will work much better and it has this feature built in.
|
|
|
|
|
Thanks Navneeth,
The download seems to be very big (200+ MB)for log4net. I'll give a try to similar type of logger.
I'll also explore if i can create another file as suggested earlier.
|
|
|
|
|
gajesh wrote: The download seems to be very big (200+ MB)for log4net
From where did you download? i only got 7.8MB for it
|
|
|
|
|
gajesh wrote: The download seems to be very big (200+ MB)for log4net.
No. Its just 7.8MB. This[^] will be the download link. The log4net dll is just 224KB.
|
|
|
|
|
I guess you have to resort to using memory mapped files. And when an hour passes, you would have to move up the records except the first one (LIFO). Hope that helps.
|
|
|
|
|
I second log4net. Anything else is just asking for pain.
Cheers,
Vikram. (Proud to have finally cracked a CCC!)
|
|
|
|
|
In the unix world, there's a tool called logrotate, which basically loops over all your log files, removes the older lines, and backs them up in an archive - something like that would be relatively trivial to write in c#, and would keep the complexity out of your logging code. The only thing you'd have to be careful of, would be file lock clashes when both the logging tool and the rotate tool try to access the log at the same time
|
|
|
|
|
Thanks a lot,
I managed to toggle between two files as a logger as workaround. Still i am keen to explore the right and best way to implement this.
I'll post the solution as soon as i am done.
|
|
|
|
|
When you have the C# application compile an application. And Create an installer for it. Can C# Compact all the manafest files and resource file into the exe application file so that the application is self contained as 1 file instead of several files? Except for the xml or config file's?
|
|
|
|
|
Yes, but if you do that, some OSes will read the embedded one over a local one, and some will prefer the local one. It's safer to not have anything embedded.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
JollyMansArt wrote: the C# application compile an application
By "the C# application" I assume you mean Visual Studio?
JollyMansArt wrote: Create an installer for it.
A setup project?
JollyMansArt wrote: Can C# Compact all the manafest files and resource file...
Visual Studio can not compile everything into a single file, you need to use ILMerge[^] to do this.
only two letters away from being an asset
|
|
|
|
|
Hai,
I am currently doing my academic project in c# platform .net. I want to use a count down timer control in a particular page where I want to fill some articles before the specified time. I could easily work the timer,but I cannot enter any values into the textbox. If anyone knows please help me...
Thanks....
Sumi Koshy
|
|
|
|
|
textBox1.Text = "Hello World";
|
|
|
|
|
what values ?? Your message subject say you need help about Timer but you says
sumikoshy wrote: I could easily work the timer
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Please give me some pointers reg how to create event logs out of .EVT files. Also how can i possibly access the custome event logs on my m/c? I am tired of scouring the net finding out how to create an event log source PROGRAMATICALLY in C3 out of a .evt file.
rashu
|
|
|
|
|
I am currently using the following code to pull the usernames from the active directory:
One of my clients this code does not pull the windows login names in his active directory. Is there a better way to get this list? If so How? I need a complete list of the active directory users no matter the domain controler with in the domain that is hosting the user list.
public void WhatAreTheDomains()
{
try
{
DomainCollection domains = Forest.GetCurrentForest().Domains;
foreach (Domain domain in domains)
{
if (File.Exists(Environment.CurrentDirectory + "\\Debug.txt"))
{
MessageBox.Show("WhatAreTheDomains: " + domain.Name);
}
cboDomains.Items.Add(domain.Name);
}
}
catch
{
ErrorLogWriter("We have a problem communicating with the AD");
}
}
public void ShowDomainUsers()
{
string Path = "LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1));
string Filter = "(&(objectCategory=person)(objectClass=user))";
string[] PropertiesToLoad = new string[2] { "name", "sAMAccountName" };
try
{
if (File.Exists(Environment.CurrentDirectory + "\\Debug.txt"))
{
MessageBox.Show("ShowDomainUsers: LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1)));
}
using (DirectoryEntry domain = new DirectoryEntry("LDAP://" + cboDomains.Text + "/CN=Users,DC=" + Left(cboDomains.Text, (cboDomains.Text.IndexOf(".", 0))) + ",DC=" + Right(cboDomains.Text, (cboDomains.Text.Length - cboDomains.Text.IndexOf(".", 0) - 1))))
using (DirectorySearcher searcher = new DirectorySearcher(domain, Filter, PropertiesToLoad))
using (SearchResultCollection results = searcher.FindAll())
{
foreach (SearchResult result in results)
{
string name = (string)result.Properties["name"][0];
string winuserlogon = (string)result.Properties["sAMAccountName"][0];
DomainUsers = new DomainUsersClass();
DomainUsers.FullUserName = name;
DomainUsers.WindowsLogonName = winuserlogon;
DomainUsersArray.Add(DomainUsers);
}
}
for (i = 0; i < DomainUsersArray.Count; i++)
{
lbxDomainUsers.Items.Add(((DomainUsersClass)DomainUsersArray[i]).WindowsLogonName);
}
}
catch
{
MessageBox.Show("We are having a problem with the active directory.");
}
}
modified on Tuesday, August 18, 2009 5:43 PM
|
|
|
|
|
I figured out a way, which I just made the LDAP available to be modified on the fly which works, but I was hoping for a universal method of pulling users out of the active directory and into the listbox.
Overall I think I have the best way I know how. I was just wondering if there was a better way...
|
|
|
|