« first day (3114 days earlier)      last day (2058 days later) » 
01:00 - 14:0014:00 - 22:00

14:01
hi, is there a way to validate a date? lets say i pick in the datepicker 28 february and someone edits it in the text to 31 february
Parse it.
how so?
In the context of asp.net I think that will give you a 400 Bad Request from the model binder, because if you try to parse that as a DateTime, it won't let you
but i cant put some data annotation to validate directly on client side?
cause with the parse i think i need to do it with js mostly
on each modification of field
no?
14:05
If you're talking data annotations, not necessary. You can't have a DateTime or a DateTimeOffset with that value because it doesn't exist, it's unrepresentable
Oh, JavaScript. Should've said so. DataAnnotations, as Tom said, are checked by the model binding. With unobtrusive validation it should also work client-side. Otherwise just use momentjs and validate with it manually.
You could construct an ISO8601 string with numbers in it that aren't real dates, you could pass that, but if your endpoint is asp.net it won't call an action method with it
the framework will fail to parse it and return 400 for you instead
okok
JS:
string date = GetYourDate();
bool dateIsReal = !! new Date(date);
so putting a datetime type makes it easier than tryparse?
14:07
standard js date class will validate for you
(except in edge though, gonna need a leftPad polyfill for that)
@tahtoh we don't know enough about what context you're trying to do this in, you haven't specified
im just trying to put some clientside validation
if the user put 2019-02-31
it pops the error message under
before having to click on submit
@RoelvanUden does TypeScript have DateTime?
oh there's a Date type in JS
@TomW No, TypeScript == JavaScript with types. It has Date, or the favorite library of everyone, moment.js
might be good if i create my dataanottation that does the tryparse
to return error directly
no?
14:14
Now you seem to be talking about server-side code
oh yes my bad
Unless there's some form of data annotations in JS that I'm not aware of
nono my mistake
There are none in JS, not by default, anyway.
just trying to find solutions haha
so for clientside i have no hope except js?
cause lets say
i have a server side anottation, which is already built in
and unobtrusive activated
14:16
I mean, what language is your client in?
it will pop the client side one
c# asp.net
asp.net provided an api afaik
razor pages?
angular?
yes mostly razor and pure html
I am willing to bet your client-side isn't in C#. While it's now theoretically possible, I'm quite sure you aren't using Blazor.
na its razor :)
14:25
it gets parsed on the server
evaluated and then only html/js is send to the client
@tahtoh [DataType(DataType.Date)] on top of the model's property then
@Squirrelkiller that does the parsing?
Yes
Probably
Refer to the pinned message
ok ill test it out
thanks
@TomW when I say Resources I mean files that are located in the /resources directory in a VS C# project.
14:31
I think something like GetResourceManager().*resourceName* but I don't remember clearly.
'twas strange
@JacobSchneider Ok, the last time you said in the solution
Different question. If they're part of a project they have a build action, so they get processed when the project compiles
at a minimum you can set them to Embedded Resource and then use something like ResourceManager.GetManifestResourceStream
typing from memory one sec
Sorry that's Assembly.GetManifestResourceStream
buildaction content?
no?
Hm, I'll have a look into it, thanks for the guide. : )
Embedded Resource, like I said
ResourceManager I think is the thing that interprets the current culture and decides which resource to pull based on that
so it works for stuff like internationalisation
14:45
Entity Framework question - I did a migration (code first) and deleted a column (with data in it) from a table in my database, it completed successfully, but noticed the database size grew instead of shrunk, is this what is supposed to happen?
user10864482
15:05
good morning, fellows programmer
15:34
Good morning
R K
R K
15:48
Hi everyone
I'm trying to publish a MVC to IIS
using visual studio publish
when I click publish in the visual studio , it successfully publishes file system to iinetpub folder ... but IISMgr doesn't show it
Do I need to add the published files to IISMgr manually?
16:05
posted on April 26, 2019 by ericlippert

Last time on FAIC we implemented the Markov process distribution, which is a distribution over state sequences, where the initial state and each subsequent state is random. There are lots of applications of Markov processes; a silly one that I’ve … Continue reading →

R K
R K
ANY HELP???????????
user10864482
hey, uppercase are unnecessary :)
R K
R K
Have you ever hosted a mvc app to iis?
user10864482
@RK have you tried to to it the Microsoft docs way? docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/…
user10864482
@RK yes
R K
R K
16:18
OK I follow link you shared.. and see if things change here.. thanks for the link ..
user10864482
no problem
16:39
do you guys know how to loop a Process so you can send and receive data from it on demand?
how does looping achieve that?
well more like this
                while (!process.HasExited)
                {
                    StreamWriter myStreamWriter = process.StandardInput;
                    myStreamWriter.WriteLine(Console.ReadLine());

                    // Synchronously read the standard output of the spawned process.
                    StreamReader so = process.StandardOutput;
                    if (!so.EndOfStream)
                    {
                        // Write the redirected output to this application's window.
                        string line = so.ReadLine();
That looks fine. What's the problem?
I want to replace the Console ReadLine() and WriteLine() I don't actually want to use the console to send input and output
It's not the process that's looping though, the process just runs. It's your code that's looping
OK and how do you intend to send it?
16:43
that's what I'm not sure..
say I was going to have a UI and the user enters the string in a text box...I click a button and then the data gets processed by the process
Named pipes, files, MSMQ, TCP
up to you, but you'll have to decide
What sort of UI?
Sounds like just a web service
like WPF
R K
R K
LocalDB isn't designed to work in IIS, so your test environment has to have SQL Server Express installed.
but anyway that's not too important...basically I want it to behave like an instance method of a class
R K
R K
My database is on localDB
16:47
could delegates help with this?
Why does this have to be in a different process?
its a python script I[m calling from C#
OK
So that script will have to have code to listen to something
read messages off a queue or accept socket connections or something
really? but I compiled it as a console application using pyinstaller
If it uses stdin and stdout, you can't just insist that it doesn't
16:50
so assume its in the form of a console application now
Well yeah you can't just make it accept input if it's not listening for it
but as long as its not exited its always listening, I tested it...I can continually send it input and receive output in the console
OK, so you do want to use the input and output streams
?
yes its the simplest approach for now
in the console the only reason it stops to await input again is because of this line

myStreamWriter.WriteLine(Console.ReadLine());
hmmm what if I start the process...then replace that whole while block with a method
a method that gets called on demand (an event) that does whatever the inside of the while loop is doing
Yeah that makes sense
Seems like you already know the answer
16:55
ok i'll give it a try
You could wrap it in a class
wrap what?
The Process. You might need to build in logic to detect whether it's crashed and start it again or something
17:34
user10864482
@erotavlas to check if your process is still alive you could use something like

if(System.Diagnostics.Process.GetProcessesByName("nameOfTheProcessHere").Count() == 0){
...
// start it again or something else

I had a similar situation and I end-up raising event from cmd.exe process with a timer event that check if the process is still alive
user10864482
and to provide cmd with parameter I had to redirect input / output from cmd with something like

System.Diagnostics.Process cmd = new System.Diagnostics.Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.EnableRaisingEvents = true;
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();
cmd.StandardInput.WriteLine(command);
user10864482
where 'command' is a parameter to cmd.exe started from diag
user10864482
the end would be
cmd.Flush();
cmd.Close();
didn't meant to spam, just forgot it
17:51
@user23333 thanks I'll take a look :)
user10864482
@erotavlas you are welcome :)
18:51
Hey, I have a question about C# linq. I have the following code: var test = File
.ReadAllLines(myFilePath).Select(x => x.Split('=', ',')).Where(x => x.Length > 4 ).ToDictionary(x=>x[0], x=>x[4]); I'm reading from a text file, in this file I have a line such as: File Name Array=item1, item2, item3, item4, How can I fix the above code so I will take each of these 4 items and return it to "var test"? Currently, it only returns the fourth item. Thank you for any help
FF-
FF-
@GoodNickName
the file would have always just one line?
or it could eventually have more than one?
@FF- Sorry, the file has more than one line, it is a 'config' file with multiple lines, my program reads this .txt file and depending on the option, it updates the checkboxes.
user10864482
@GoodNickName if it's literally a config file why not using App.Config?
user10864482
Using ConfigurationManager you wouldn't have to implement any custom stuff, it already exist
user10864482
and it can be updated programmatically
19:05
@user23333 I haven't touched it yet, I have been learning C# for a few months and I've decided to use .txt file for this. I may change this to App.Config in the near future.
user10864482
you could access value like ConfigurationManager.AppSettings["A_KEY_OF_YOUR_CHOOSING"]


and to edit
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["A_KEY_OF_YOUR_CHOOSING"].Value = aNewValue;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
user10864482
your app.Config would look like

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="A_KEY_OF_YOUR_CHOOSING" value="some value" />
</appSettings>
<startup>
<supportedRuntime version="vx.0" sku=".NETFramework,Version=vx.x.x.x" />
</startup>
</configuration>
user10864482
any value you addbetween <appSettings> element would be the value of your choosing
This looks like a nice idea, however, for now I would prefer to stay with .txt file. Thanks for the suggestion though.
user10864482
@GoodNickName it's not only a nice idea but a good practice too, you are welcome
19:12
why not use an xml parser
user10864482
@misha130 instead of ConfigurationManager ?
oh sorry i was reading something else
(I'm not a linq expert) but I believe that is caused by .ToDictionary(x=>x[0], x=>x[4]) I can change the number e.g. instead of 4, 3 and then I will get the third item. The question is how I can implement some sort of range? So it would pick item1, item2, item3 and item4.
The reason why I'm using .ToDictionary is, that later on I can do: if (test["File Name Array"].Length > 0)

for (int i = 0; i < myArray.Length; i++)
{
myArray[i] = test["File Name Array"];
}
19:27
@Squirrelkiller "you can't just go all json in there" lol a great quote. But in order to be useful yes I need to know how to go all json up in there
@user23333 I don't think you'd need to. The Process class already holds that information
user10864482
@TomW need to?
what?
You don't need to look it up by name, the Process already knows its own name
oh, sorry I see
yes, if it's not running, start it, sorry I get it now
but then you'd still know that from Process.HasExited
user10864482
I trust you are right. My needs was different in the fine print; I had a process spawning other process, some time, not all the time and the problem I had was that the process had very limited way of interacting with command line so I had to monitor those spawning process started by the program, launched from the cmd.
oh I see
FF-
FF-
20:01
@GoodNickName if you wanna stick with your implementation of a config file, then you could use something like this:

var likeFile = new string[] { "File Name Array=item1, item2, item3, item4", "File Name Array=itemA, itemB, itemC, itemD" };
var dictionaryConfig = new Dictionary<string, string[]>();
foreach (var fileLine in likeFile)
{
var lineNameAndValues = fileLine.Split('=');
var valuesArray = lineNameAndValues[1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();
20:11
@MikeTheLiar TRUE
lol
true==true==true ===true
user10864482
20:22
JavaScript "equality"
I think we should rename it the equity operator
What is truth, anyway?
I'm going to write a compiler that has an philosophical crises anytime it's asked to evaluate if something is true or not.
> Is this sentence false?
> Y'know what, true. I'm gonna go with true. But I think I've heard that one before, I'll tell you.
user10864482
20:47
@MikeTheLiar are you saying you invented JavaScript? :0
21:05
!!learn trinity <>https://i.sstatic.net/AyUqI.jpg
@MikeTheLiar Command trinity learned
!!forget trinity
@MikeTheLiar Command trinity forgotten.
!!learn holytrinity <>https://i.sstatic.net/AyUqI.jpg
@MikeTheLiar Command holytrinity learned
21:06
0.o
ah
01:00 - 14:0014:00 - 22:00

« first day (3114 days earlier)      last day (2058 days later) »