|
I am stuck with regular expressions. In fact, I want the 'T' to be optional, and I got a working example:
string text = "123T234";
Regex regex = new Regex(@"([0-9]{3})[T]?([0-9]{3})");
Match stuff = regex.Match(text);
Now, why doesn't
Quote: ([0-9]{4})-([1-9]|[1][0-2])-([0-2]?[0-9]|[3][0-1])[T]?([0-1]?[0-9]|[2][0-3])[:]([0-5]?[0-9])[:]([0-5]?[0-9])?.?([0-9]{1,6})[Z]?([+-]?[0-9][\.|,]?[0-9]?|[0-9]{2}?|[+-]?[0][1][0-2][\.]?[0-9]?|[0-9]{2}?)
produce a match for
2014-02-01T14:12:33Z+1
?
Any help is greatly appreciated.
[Solved by Original Griff]
Clean-up crew needed, grammar spill... - Nagy Vilmos
modified 6-Feb-14 5:45am.
|
|
|
|
|
Because the Month group explicitly excludes it:
([0-9]{4})-([1-9]|[1][0-2])
Try:
([0-9]{4})-(0?[1-9]|[1][0-2])
BTW: [0-9] is equivalent to \d which is a little shorter!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I don't want the T to be included in any group - Wouldn't
OriginalGriff wrote: (0?[1-9]|[1][0-2])
allow months to be 0?
Maybe I am just slow, but I don't get why the solution should allow the 'T' to be missing?
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
No, because it is an optional '0' followed by a non-zero digit, or a '1' followed by a '0', '1', or '2'.
'0' on it's own isn't allowed, nor is "00"
The '?' after the 'T' specifies "zero or one" instances, so it works with or without it.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I sometimes feel blind
Many thanks for the help
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
You're welcome!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I want to develop a tool that will assess the quality of a video. I did some R&D on this and found an interface called "IQualProp", that is part of DirectShow API. I am not trying to get a sample code in C# on how to use this interface, but i am not finding anywhere. There are samples in c++ to use this "IQualProp", but not in C#. Any help on this will be great.
|
|
|
|
|
I suspect that IQualProp is only available with MFC, and thus C++.
C# has something similar for sure, but I can't say what it is.
Source[^]
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Again, how do you define "video quality"?? You have yet to define this and this is your second question on the subject.
IQualProp only returns the performance properties of a video renderer. It has nothing to do with the video signal itself.
|
|
|
|
|
Thank you for the reply.
A video without any stuck that runs smoothly is quality of video for me. I want to play a video (recorded video) and check whether it runs properly without stuck. If there is any stuck in video I want to throw a error that quality of the video is not proper. Please correct me if im wrong in understanding the quality/performance of video.
IqualProp interface has a method called "get_Jitter" which will give the variation in a video. So, I was thinking this can be of help for me.
Please guide me.
|
|
|
|
|
OK. Too bad that interface has absolutely nothing to do with the quality of the video.
That interface will give the performance stats of the video renderer, not the video itself. There is also no correlation between the renderer performance and the size of the video. The values that you get are the current moment in time performance of the renderer and are also affected by the current system load. Run through the video again and you can get different numbers.
You can play a 320x200 at 30 frames a second and still get jitter, then play a 1080p video and get none. This is not an indicator of anything related to the video.
|
|
|
|
|
How can I tell the difference between source and published .NET code?
I am looking at some inherited code that I have not touched in about a year. The original designer had me first publish locally before uploading the published code to the internet server. Now I am looking a number of backed up source folders as well bas backed up published folders. I should have done a better job at naming the folders, I guess. Now I wonder: How can I tell the difference between source and published .NET code? Is there some easy way to see if some folder that contains only published code is lacking a file or xml setting?
Is the .csproj file or the .sln file part of the code pushed to the server when you publish?
|
|
|
|
|
Published code contains only the files needed for the app to run and it does not contain .csproj or .sln files.
|
|
|
|
|
Hm... Normally, the web server won't throw an exception if csproj and sln files are deployed also...
|
|
|
|
|
Well, no - but it's not automatic. (And I'd rather not do it, it's untidy and prone to error)
I'd probably include a version number and a build timestamp, as I do in my non-website code.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Yes, it wouldn't. I meant to say that when you publish your code using Visual Studio, it doesn't copy the .csproj and .sln files.
|
|
|
|
|
Xarzu wrote: Is the .csproj file or the .sln file part of the code pushed to the server when you publish?
When I deliver something to production it is
- In source control
- Labeled in source control
- Built from source control
- Delivered from that build
Other than that I either keep track of the label that went to production and when.
Or I specifically re-label using a build version number with a label that indicates a production delivery.
|
|
|
|
|
I am adapting a XAML Control to be MVVM compliant. Right now the XAML is actually not important, but there is one component that is giving me grief. The control is actually called from another view model on an event. Click here to add kind of thing. That command looks like this:
private void OnAddItem()
{
SubItemViewModel subVM = new SubItemViewModel(Key, null, false);
IDisposable ss = Observable.FromEventPattern(subVM.Save, "ExecuteEnd").Take(1).Subscribe(x => { LoadList(); });
SubControl ctrl = new SubControl();
ctrl.DataContext = subVM;
WorkspaceUserControlWindow w = new WorkspaceUserControlWindow(ctrl);
w.Title = subVM.DisplayTitle ?? Key.Value + " - Add Item";
Observable.FromEventPattern(w, "Closed").Take(1).Subscribe(x => { if (ss != null) ss.Dispose(); });
w.Show();
}
This worked fine in a non-MVVM model using a delegate command, click events, etc... Now that I have migrated the VM over to MVVM I need to understand how to publish the Save command so that the calling event can listen for the ExecuteEnd and reload the data list as shown here:
IDisposable ss= Observable.FromEventPattern(subVM.Save, "ExecuteEnd").Take(1).Subscribe(x => { LoadList(); });
I have always used relay commands within my view models as I have never needed to observe a command like this. Thoughts?
Cheers, --EA
|
|
|
|
|
Hello All,
Our main 2012 VS solution has 16 projects.
One of the project is a web site, which a web.config file defined.
I want to access this website's web.config file's applicationSettings value in another project. I added the System.Configuration to this class. And using below trying to access the value of the settings. Since this setting is defined as a string, converting it to an int. The value for the setting QuesId is 2 in the web.config file.
The code complies with no errors, but when i execute and browse the code, the value is null. any ideas??
Int32.Parse(ConfigurationManager.AppSettings["QuesId"]);
|
|
|
|
|
How are you executing the other project? If it's a class library called from within the web site, the code you've posted should work. If it's a stand-alone application, it will need its own configuration file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: If it's a class library called from within the web site, the code you've posted should work. If it's a stand-alone application, it will need its own configuration file.
Methinks that he has a config file for the library {1}, and one for the web app{2}.
And now he has troubles accessing {1} when the library method is executed from the web app since the library will try to access {2}.
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
In the web.config file, if I use the <appsettings> then I am able to access this setting in my other C# project using, with no issues:
Int32.Parse(ConfigurationManager.AppSettings["QId"]);
But if it is defined in the <applicationsettings> part of web.config, when I try to access it in my other C# project:
Int32.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["QId"]) a null value is returned.
Is my syntax incorrect?
|
|
|
|
|
No. The problem most likely is that
Int32.Parse(ConfigurationManager.AppSettings["QId"]);
is accessing the app.config file, while
Int32.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["QId"])
is accessing the web.config.
Furthermore, if you have two configuration files, only the file of the project you build as Startup project is read by either ConfigurationManager.AppSettings or WebConfigurationManager.AppSettings .
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|
|
Actually both settings are defined in the web.config file, but under different sections.
I am not using the app.config file in my other project.
|
|
|
|
|
Can you try to use ConfigurationManager.AppSettings instead of WebSettings?
Clean-up crew needed, grammar spill... - Nagy Vilmos
|
|
|
|