|
Hi,
I have used FileSystemWatcher a long time ago, and wasn't impressed by it. IIRC, when a file is being created, you get an event, after an unpredictable delay that is; and I saw no way to detect the end of the file writing, e.g. there is no close event.
So my apps ended up using one of two techniques:
- either use a delay after the create event to make somewhat sure the new file had entirely been written, not elegant at all;
- or, when I was in control of the file creation, simply create the file, then create a very small second file, and use FSW to only track the latter.
|
|
|
|
|
Quote: I have used FileSystemWatcher a long time ago
Things change.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I think you might be stuck with a polling mechanism rather than a watcher. If extensive security isn't a concern you can run a nice quick file hash (like MD5) periodically.
Really the only other thing I can think of is forcing users to manipulate the files in question through a specific pipeline that you can attach hooks to. I suppose you could do it as an Office extension and process changes through a queuing system, maybe going through something like RabbitMQ, redis, or Kafka. That'd be low-hanging fruit if you already use one of those services in your environment.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
dynamic returnObject = new ExpandoObject() as IDictionary<string, object>;
var EnterData = (IDictionary<string, object>)returnObject
EnterData.Add("myColumn", typeof(int));
Now when I debug a test that I have created I can see the value type has been set to int.
but I would like to add a test to this, purely for my own learning
var keypair = EnterData.FirstOrDefault(p=> p.Key == "myColumn");
var properties = keypair.GetType().GetGenericArguments();
var ValueType = properties[1];
which always returns a type object, is there a way to get the type that I have assigned to the keyvaluepair?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Maybe I'm doing or reading it wrong, but wouldn't that be
string myValueType = keypair.Value.ToString();
That should return "System.Int32", and the first part of the pair is always a string.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks Eddie, it worked..
Silly me, while looking my brain thought everything must complicated so I ignored all the easy stuff.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
You're welcome, and happens to us all
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi
I have this Pcre Regex .{1,15}\K(\s{1,2}|$) that I use in my Autoit code to split a text at a N length, but the split is at the last space within the N length.
Now I'm trying to convert it to C#, but C# don't understand the \K and my RegEx understanding is very basic, I had some on helping me with this one I'm now trying to convert.
My hope is that some one here could help me achieve the same with C#.
My code from Autoit
This splits a large text up into cunks at N lengt, at the last space within the nLength specified, and seperated with a @CRLF
eg. 'A child asked his father, "How were people born?" So his father said, "Adam and Eve made babies, then their babies became adults and made babies, and so on."
Would be formated as this:
A child asked his father, "How were people born?" So his father said, "Adam and Eve
made babies, then their babies became adults and made babies, and so on."
#ce
Local $sResult = StringRegExpReplace($sString, ".{1," & $nLenght - 1 & "}\K(\s{1,2}|$)", @CRLF)
return $sResult
Cheers
/LR
|
|
|
|
|
If you get the match Groups, you should be able to get the values after \K by using match.Groups[1].Value; (not forgetting to get rid of the \K section).
|
|
|
|
|
Hi Peter
Using this:
string pattern = @".{1,30}(\s{1,2}|$)";
RegexOptions regexOptions = RegexOptions.None;
Regex regex = new Regex(pattern, regexOptions);
string inputData = @"A child asked his father, ""How were people born?"" So his father said, ""Adam and Eve made babies, then their babies became adults and made babies, and so on.";
string replacement = "\n\r";
string result = regex.Replace(inputData, replacement);
Console.WriteLine(result);
I only gets the replacements not the splitted text.
/LR
|
|
|
|
|
What happens if the first "word" is greater than length N?
If you're just trying to "wrap text", use a text block / box with "text wrapping" set to "on". It will even split words, add ellipses if you want.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi Gerry
Well my guess is that the word would be either Finish or Polish which is the only two languages I know of, who can use up a pencil writing "Hello how are you"
But I get your point Normally I do split at about 60 chars, and it's in 99% of the cases english language I split, so I newer gave it any thought what would happen if the first word was longer than N, but clearly the regex would fail and just return the whole word without splitting.
No I'm not trying to wrap text, I use the splitter to ad text to documents with a max width.
And I could just use split at N, but doing that could split a word in the middle, and that I don't want.
/LR
|
|
|
|
|
I do a lot of "splitting", using ".IndexOf" and ".LastIndexOf", with or without starting offsets. My "brutish" techniques have shown no performance issues, even when splitting (and presenting) thousands of (query) results at a time.
The splitting usually involves chopping off and rereading the chopped item while length > 0. Sounds inefficient but isn't.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi Gerry
That could be another way of doing it.
/LR
|
|
|
|
|
Hmm
So I came up with this
string splittSet = "";
string test_pattern = @"(.{1,60})(\s{1,2}|$)";
RegexOptions regexOptions = RegexOptions.None;
Regex splitText = new Regex(test_pattern, regexOptions);
string inputData = @"The wolf is thought to be an ice age survivor, dating wolves around 300,000 years ago. The wolf is accepted to be the ancestor of the domestic dog as the wolf is thought to have selectively bred in order to breed appealing traits typical of puppies and to eliminate the not so appealing traits of adult wolves.";
foreach (Match match in splitText.Matches(inputData))
{
if (match.Success)
{
splittSet += match.Groups[0].Value + "\n\r";
}
}
Definitely not not as elegant as my original regex, but it seems to work :/ though I do hope that someone have a better/more elegant way of doing it
/LR
|
|
|
|
|
splittSet += match.Groups[0].Value + "\n\r";
Use a StringBuilder class ... one of the most obvious things they ask in interviews.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi Gerry
Some thing like this?
string splitPatteren = @"(.{1," + count + @"})(\s{1,2}|$)";
RegexOptions regexOptions = RegexOptions.IgnoreCase;
Regex splitText = new Regex(splitPatteren, regexOptions);
StringBuilder result = new StringBuilder();
foreach (Match match in splitText.Matches(input))
{
if (match.Success)
{
result.Append(match.Groups[0].Value + delm);
}
}
|
|
|
|
|
Use .AppendLine([...]) if you want to add a (OS independent) "line feed".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi Gerry
I made the method so the "split delimitre" can be changed at call, default is \n\r but if I should had use for a long string separated by | or some thing else I now have the option to do that.
But else the AppendLine would had been my choice also
/LR
|
|
|
|
|
I'm getting load report failed error while generating report from my IIS published web application.
I'm using visual studio 2015,crystal service pack 20 and Dot net framework 4. Once i get this error i restart my web application from IIS and its works normal. I also disposed my report object and set it to null.
modified 24-Jan-20 4:20am.
|
|
|
|
|
If you look in the event log using Event Viewer, you should get a more detailed report about what has gone wrong. As a practice, it's normally a good idea to log any exceptions in your application as well. These can be used to track down what is going wrong.
|
|
|
|
|
|
I want to communicate with Graphdata from C# Core. Because our graphdata is stored on AWS . In order to access the same i want some solutions
|
|
|
|
|
anil150875 wrote: graphdata Does it have an API?
anil150875 wrote: AWS That has an api.
I'm not sure how to be any more specific. Maybe you can be more specific on what you need?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
The thing is We have done complete development in PHP . And wants to use here MAP API to track location . I don't know how PHP will communicate with Neptune Graphdata in AWS.
So we are considering Gramlin queries
|
|
|
|