« first day (2924 days earlier)      last day (2019 days later) » 

12:03 PM
goooooooooood morning shaperinos
 
Hello Everybody.!
Hello Neil!
 
or good afternoon I should say maybe
@Ashish \o
 
Hope you all are doing well.! :)
 
Doing excellent, thank you for asking
 
It's Actually evening here.! :)
So, good morning to you and have a great day ahead.!
 
12:04 PM
And how is your evening?
 
It's going well.!
Thank you for asking.!
So, I have just one quick question!
 
go ahead, I'll see if I can help :P
 
Is it possible for me to create an enum object at runtime in c#?
```protected void Job_Enum_Status_Allocator(int ped_index)
{
Priority_Set_Get_Class.Job_Status Status_for[ped_index] = new Priority_Set_Get_Class.Job_Status();
}```
But this is giving me an error, As it states, a bad way to declare an array.! I am just not getting why?
 
@Ashish Hmm, why would you need to create an enum at runtime?
that's kind of contrary to the function of enum
 
So, basically, I have a list of few dynamic objects.!
But the list would increase on runtime basis.!
 
12:07 PM
that's not the sort of thing you would use enum for then
 
I don't think the ! means what you think it means.
 
enum should be fixed
 
Now, I want to assign each object of that list an enum object, so I could check it's state and work further
 
Think of an enum as a set of constants with scalar values.
Grouped together by category.
 
good examples of enum: Suits in a deck of cards, Ranks in a deck of cards
Months of the year
it shouldn't be something that could potentially change from one run to the next
 
12:09 PM
I'm assuming Job_Status is your enum type? And you have a list of statuses? That's fine. The question is, what do you expect new Job_Status() to do?
 
you can probably do what you're trying to do, just in a slightly different way
 
to create an enum object with Status_for + the index number.!
 
If you're trying to make a dynamic enum based on a number of possible states in a database table, it's not a good idea
 
By analogy: You have a var workingDays = new DayOfWeek[7]; workingDays[0] = new DayOfWeek();. <-- this doesn't make sense.
 
So basically, when I will run that in a forloop function, an enum object should be created for each item
 
12:10 PM
You can't create a new DayOfWeek. There are just the 7 of them, no more, no less.
 
Priority_Set_Get_Class.Job_Status Status_for[ped_index] = Priority_Set_Get_Class.Job_Status.In_Progress;
even this one gives an error!
 
that doesn't make sense. Enums can't change except in rare situations. They should be fixed for the most part
 
What error?
We don't know what error you're getting, so you have to tell us.
 
Bad Array Declarator.!
 
Ok, so let's break down what you're doing.
 
12:12 PM
@Neil
 
Priority_Set_Get_Class.Job_Status Status_for[ped_index] is a declaration of an array of Job_Status
 
You're creating a new variable of type Job_Status (incidentally, all those nested types? Ugly and confusing).
 
The enum which I have created is fixed and will remain fix.!
 
you can't assign a single value to an array
not upon declaration at least
 
ah, I see.!
 
12:13 PM
But the name you've given that variable is Status_for[int] - which doesn't make sense in this context.
Are you trying to define an array here?
 
Not an array, but I am trying to create an enum object incremented with an int
so each object in the list will have a separate enum object.
 
Can you paste the definition of Job_Status?
 
you declare and create an array of enums. After this declaration, you assign one or more of these array values
 
Sure.!
public enum Job_Status
{
Waiting,
In_Progress,
Finished,
Canclled
}
This is the definition of Job_Status enum
 
Ok. And Priority_Set_Get_Class is a class that has a member of type Job_Status?
 
12:15 PM
Now If I am creating and initialising this object, it works fine.!
public static Job_Status JobStatusHolder = Job_Status.Waiting;
yes!
 
what's with the .!
 
ignore the last part of .!
 
pick one
 
It's just a bad habbit of me.
 
Well, it makes it look like you're always shouting.
Which is annoying.
 
12:16 PM
I am sorry
I will try to improvise this
 
DO you have several instances of Priority_Set_Get_Class?
(Again, the naming is very nonstandard and confusing. Classes don't need the word "class" at the end)
 
yes, there are multiple.
I know it's confusing, I am confused myself like hell. But it's the other guy who created this.
I raised this point up, but of no luck and has always been whooshed off.
 
You have the four values of Job_Status. And you want each Priority_Set_Get_Class to get a different one?
 
yes, that's right.
But this isn't possible on run-time, right?
 
A different out out of the 4? Easy enough.
 
12:21 PM
I am sorry, but I didn't get it.
English is not my primary language, so please pardon me.
 
You can assign one of each type into an array at runtime, but why?
 
var availableStatuses = Enum.GetValues(typeof(Job_Status));
var ped_idx = 0;
foreach (var priority in priorities)
{
    priority.Job_Status = availableStatuses[ped_idx % availableStatuses.Length];
    ped_idx++;
}
 
let me check if it works.
 
Conceptually, an enum is an array of each type
 
Thank you for the help anyway. :)
 
12:23 PM
Don't just check it. Read it and make sure you understnad what's going on.
 
@AvnerShahar-Kashtan Why would anyone need to do this?
 
:44309473 foreach (var dayOfWeek in Enum.GetValues(typeof(DayOfWeek))
{
    calendar.Add(new RecurringAppointment("Daily Meeting", "9:00", dayOfWeek)
}
Very rough pseudo-code of why I might wnat to create a class around each value from an enum.
Also, I've used similar code when generating dummy data. Create thousands of DB entries with a relatively equal spread of Statuses.
 
fair enough
if you have a one-to-one relationship between an enum and its priorities
In Java you could just associate an enum with a priority
since enums can hold data like any class, as a sort of singleton
or have methods which return priority instances from an enum instance
 
12:53 PM
the thing is i almost watched the entire clip
 
@AvnerShahar-Kashtan @Neil
Sorry to bug you guys again
But, could I use dictionary in this scene?
I mean, wouldn't it make the code more re-burst?
@Proxy Thanks for the link, lol, me too watched it just now
I especially liked the creativity of marble audience sitting in an audience stand. :D
 
true
 
@Ashish robust?
in C#, I suppose that'd be the way to go, yeah
 
1:09 PM
@Neil yeah, sorry for the bad English. It's an auto-dictionary corrected me incorrectly :D
And thank you for your input.! Appreciate it big time. :)
 
@Ashish no problemo
 
@RoelvanUden ad.nl/den-haag/… daijobu?
 
@Proxy ... Thank you for that. I'll check every part of my house now.
 
make sure hat you are safe!
 
I have an attack dog.
 
1:24 PM
well i kind of assume he would attack the escape route instead of the spider.
 
Probably... :-(
 
1:45 PM
but no worries, i am here to help.
i will buy time so you can get away
 
2:24 PM
ヘ(◕。◕ヘ)
 
2:42 PM
Hey, can someone please help me with an assembly. I'm trying to include it in a winform app and having no luck. It doesnt' show up in the references list when trying to add a reference.

I installed the required SDK through the Visual studio 2017 installer.

https://docs.microsoft.com/en-us/uwp/api/Windows.System.UserProfile.LockScreen

The assembly in question is
Assemblies:
Windows.System.UserProfile.dll, Windows.dll
o/ @RoelvanUden
 
Uhh its uwp
I'm not sure that'll work with winforms
 
how can we be sure :E
 
Make a default uwp app, try it.
Make a default winforms app, try it.
If both work, then your problem is somewhere else.
 
its not that it doesn't work, I can't even add it as a reference
I can't see it in the list of references
do I need to restart my computer or something?
for it to start showing up as registered with the gac
ill create a uwp app see if it shows up there
well, that's just empty.
cant say I have any experience with uwp apps though
 
3:01 PM
@KendallFrey You might know, can you do blah?[1] to make sure if a key is null or does not exists, I know you can do blah?.Id on a property, but can you do the same on an index?
 
Me neither lol, was just an idea since it's lsited under UWP development^^
[] is basically a method so it should work
 
@Greg I think there may have been something like that. Give it a try.
 
Trying it now.
 
Wait the key? blah?[1] will make shure blah isnt null.
 
That is the point of the ? mark, it is shorthand for the equivalent of checking if something is null.
 
3:07 PM
Yeah, but it checks if the thing to its left is null, which is the blah
 
Can I use a Session method in windows forms?
 
Maybe you could go blah[i??0] to check the key and insert a default if it's null
 
I shall play with it.
 
@JonathanSumilang What's a session method?
What kinda session?
 
I were to use it in a login form
but I cannot apply it
it shows session does not exist in the current context
 
3:09 PM
Why use winforms as login form? Like the microsoft login thingy that is used for all the microsoft applications by now?
Is there a backend?
How od you call the backend?
 
Im currently developing windows application
`private void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog=Juan Carlo SCM;Persist Security Info=True;User ID=sa;Password=benilde");
con.Open();
SqlCommand cmd = new SqlCommand(@"SELECT Username, Password FROM Employee_Table WHERE @Username=Username AND @Password=Password", con);

cmd.Parameters.AddWithValue("@Username", txtUsername.Text.Trim());
cmd.Parameters.AddWithValue("@Password", hc.PassHash(txtPassword.Text.Trim()));
oh god i suck at this
sorry im only new here, I can't comment properly
sorry
 
@KendallFrey @Squirrelkiller Did not work.
 
@KendallFrey Yes
So in essence, it checks for null but not for index out of range. So as long as data exists it will validate that index is not null, but not if it is out of range.
 
3:25 PM
!!welcome-c# Jonathan
Uhhh Cap?
!!Are you there?
Shit Cap it's not weekend yet
 
yes
sorry bit late
 
Don't worry, Cap is a bot :D
When pasting code, format your commend using ctrl+k before sending, so it keeps the indentation and uses a mono spaced font.
Also when it gets too long, use gist.github.com or paste.ofcode.org
I see nowhere in your code the Session should come from, whydo you think you have a Session?
 
I actually think that I should not be using that since it is not in the c# WinForms, I just need the login to run smoothly but I don't know how, I might be implementing the wrong code for that I guess
sorry im not really a hard programmer since we were only taught of the basics on this
 
3:41 PM
That is what I say to your session.
2 messages moved to Trash
 
3:59 PM
Powershell question: Script takes information from an XML file, does some stuff, and then sends an email with specific contents. One part of the output in the email, it does not have a line break. Gist with the code that prepares the offending portion, and sends email. Plus a sample of what the email will show.
I've tried doing `n`n , and `r`n , but both included a line break and a new line, which is not wanted. I give up trying to format it.
...
 
4:27 PM
seems Outlook is the problem I should be able to figure it out from here
 
5:15 PM
Question.
If you have a domain model, that is being transformed into another model but that model requires a database lookup to match on objects for id codes that have to be returned, would it be bad to have such a validation method there?
 
 
2 hours later…
7:19 PM
What would be needed to reroute a winForm application's audio playback? So, I have the default Realtek playback device and a virtual cable, what I want to do is reroute the application's audio playback so its played through the virtual cable and not the default Realtek device.

Note that I intend to use these functions in commercial applications so 3rd party libraries, such as NAudio, wont do.
 
 
2 hours later…
8:53 PM
Does anyone know the tech stack I would need to use if I would like to have a persistent service that can be driven through operations i define on a webpage (ie, update account/stop service/start service/query database, run a particular method)
 
Like an Azure Message Queue?
 
like i already have a program that is written as a console app
but I would like to drive it through a website
 
Seems like you want some kind of API.
 
right, i get that obviously
 
If I were going to be a C# room user, you could make yourself an ASP.NET web API with some Microsoft SQL server
Entity Framework if you feel like you need it- I dunno if EF is cool any more
or if the kids still use SQL
 
9:02 PM
how do you create an asp.net api to drive the program?
 
I dunno what your program looks like, but you'd set up controllers that do the same thing your program does.
I guess you could have an API that just turns around and calls your console app, but that's a little silly.
 
the console app has to be continuously running
 
I mean, you'd have to change your code to be a web API instead of being a console app
You'd have to learn some ASP.NET
It's not super hard to do, you'd probably end up turning your existing code into a library and driving it through the API instead of the console
Also, you have to believe in yourself. It doesn't work otherwise.
 
so asp.net supports persistent applicatoins?
 
If by "persistent" you mean "constantly running" or "has a database", then yeah
Your typical ASP.NET project runs on a server somewhere 24/7 waiting for people to use it
 
9:08 PM
i am not sure why you are quoting constantly running
i didnt use it in an ironic way
when i say constantly running, i literally mean constantly running
simplest example would be a program that just increments a number every minute
 
like, does persistent mean constantly running to you
 
and when i log onto the website, i could somehow get the value of that number
 
Usually when people talk about persistence, they mean it remembers stuff across restarts
Either way, your asp.net project will do that
Imagine, if you will, a piece of software that runs all the time on a computer somewhere
Probably one in Azure
It's listening for someone to come in on the network and tell it to do things
Or ask it for information.
If that sounds like what you want to do, go nuts.
 
thats exactly what i want to do
the way i was thinking about doing it, was to implement a web socket server into the program, and design an api around it
but i was wondering if there was a better way
 
Yeah, asp.net makes that really easy for you.
It does all the web socket stuff for you
you just have to decide what the API looks like and implement it.
 
9:16 PM
i hope i am explaining myself well
i will take a look at that site
just to be thorough
a simple example would be if i had this running constantly
and the asp.net web page had a button on it that could query that program to GetCurrentMark()
so i log in today to see what the count is
then log in tomorrow to see same time to see its 86400 higher
 
Sure. That'd be pretty easy to make in ASP.NET. You'd have a background thread constantly counting up, and you'd have a MarkController so you can go to whatever.coolwebsite.com/api/v1.0/mark/count
and the controller would have a mark() function that just returns the count
 
what runs this background thread?
 
your machine perhaps?
or do you mean "where should I start this thread?"?
 
I'd put something like this in your controller
:
 
@cubesnyc what exactly do you want to count?
seconds?
I can recommend not doing that with a counter
 
9:28 PM
@Wietlol not sure what youre quoting?
 
or with Task.Delay
 
private static int currentCount = 0;
private static Task Incrementer = Start()

private async Task Start()
	{
		while(true)
		{
			CurrentMark++;
			await Task.Delay(1000);
		}
	}
 
@cubesnyc it was a suggestion
 
also the count was just an example to demonstrate functionality
i dont have to count anything
 
And then you'd have some kind of public function that returns currentCount when asked
 
9:29 PM
i would have a program that i would like to extend controllability to through a website
i was asking what program is running the background thread
is it the asp server/service?
 
Yeah, it's all one program
 
i dont really know what the process is or how it works, which is why i am asking
 
It's pretty much a regular program
that sits on a server
 
that would probably be a web service
 
and knows how to service API requests
 
9:30 PM
(could be any language/framework)
and could be multiple programs
on multiple servers
 
It can be more complicated, of course, which is what weitlol felt obligated to say for some reason
 
:D
@cubesnyc what do you mean with "extend controllability"?
 
Your asp.net application is just a regular c# program with some fancy libraries that automate the process of making a web API.
 
i described what i need a bit further up
but to reiterate
imagine you built a program
anything
something that parses this chat room for example, and stores it in a database
it just ocnstantly scrapes and parses
holds everything in memory
then you decide hey i dont only want to be able to access the data from the terminal its running on, but i also want to access it from the web
@Grace what is the difference between asp.net and asp.net web-api?
 
You would build an Api that would allow you to extract information by request. "blah.com/api/GetChatRoom" for instance.
Asp.Net is a framework, web api is an extension on the Asp.Net framework that uses direct Http verbage.
 
9:35 PM
Greg sounds correct, I don't know enough to talk about it.
 
Asp.Net could be Model View Controller, Web Forms, Web Api, etc. Where Web Api is a direct extension of the Asp.Net Framework specific to Api request and verb access via Controllers.
 
what is the difference between all of them? or should i just google that
 
@cubesnyc then you update it
 
Model View Controller:
public IActionResult Index() => return View(); // Returning View

Web Api:
public JsonResult Get() => return Json(model); // Returning Json

But in Asp.Net Core they are technically blended to be the same with whatever level of control or changes you want to make. But the main difference between traditional MVC and Web Api is the above, MVC returns a View where Web Api is returning XML or Json.
 
You can go in the weeds forever with this sort of thing, but the key takeaway is that you probably want yourself an asp.net project.
 
9:38 PM
@cubesnyc That is pretty broad. Maybe isolate the comparison and I'll indicate. But Web Forms is Win Forms on the internet. Does that help not confuse you? The web is a massive stack, a lot of choices.
 
we are pretty much at that level of technology that when you have your application working locally, and want to update your server application, you can just update it without downtime in a matter of seconds
 
Asp.Net is all web based framework technology based on .Net Standard, .Net Core, or whatever.
 
yea one main point of confusion is that my only reference point is when i worked with php 10 years ago
and from what i understood of php at that point in time is that the server just processes the php commands upon request and serves up whatever it comes up with
 
Php is a server side web technology.
 
and i thought asp was just microsofts equivalent of that
 
9:40 PM
Eh, sort of.
But yes, a client will hit your server and an Asp.Net project depending on your framework will execute the code then render some form of content.
 
so thats why i am in a state of disbelief/confusion in regards to an application that is always running, or as i it seems erroneously put it, persistent
so building on what grace said, and what youre saying
 
With PHP, you put it behind Apache (or nginx), which is always running
and when someone asks for a PHP page, Apache starts the PHP interpreter which generates the correct page
 
A server is constantly awaiting for a request, but no action is performed until a request hits your server.
 
Here, we have IIS which turns around and passes requests to your ASP.NET project, which is always running
 
when you say request you mean http request?
 
9:43 PM
Yes.
 
blah.com/GetCommand
 
@Grace Your project is not running, but IIS is always running.
IIS will always run listening, then will execute your compiled code.
 
but i need the compiled code to always be running
 
Why does it always need to run?
 
not sure how to answer that
 
9:47 PM
Then you would want a Windows Service, that constantly is running, then based on that it would call the api to server that application data. A web application is all about serving data.
 
sure
i understand that
but is it also possible to command the program through a web application
 
What can I explain that you do not understand, or do I make sense?
 
@Grace mentioned web api but it seems you are refuting what she saying
well you are making sense to a certain degree, but i think you are also misunderstanding my requiremtn
which could very well be because of me
 
Cube's example was for something that's constantly scraping a web page
 
You want your application to perform a series of task based on a command sent via an api?
 
9:49 PM
right now, i have a program that is constantly running on my machine
 
and then makes that information available to an end user over a web api
 
i developed a gui for it and control it through that
 
What Grace stated is true and accurate.
 
it would be much better for me if i could extend that gui onto a website
so everythign that i can do in the gui currently, i can do on a web page that i create
 
I helped a friend build a robot that awaits web commands before it performs specific actions, but yes. Just pretend the user sends a request, then you would have another application that is running as a service that would be executed from the web server.
 
9:50 PM
so it would be more or less equivalent to having a console app the runs on my machine
 
The web server is acting on the clients behalf.
 
and a web api that can be used to command it however i want
to give you a concrete example, imagine you have a service that scrapes stuff all day
across the web
and then you log onto the site, and you tell it i want you to scrape twice as hard
or give it new sites to scrape
whatever
you see how the scraping is done regardless of the client accessing the webpage
or sending a request
thats what im trying to underline
 
We are looking for a ways to monitor and alert in case of high rate of exceptions and performance degradation in our Asp.NET web applications. We are exploring Application Insights and Data Dog. What are you using?
 
@Grace it would also be to control the parameters of the scraping as well
i only make that distinction since the results of the scraping can just be retrieved through a database query, and are static at any moment in time
 
@cubesnyc Yes, you can.
 
10:04 PM
asp.net web-api?
 
10:15 PM
Web Api / MvcCore would be ideal. Lighter payload, but if you intend to have a GUI on your site then you really wouldn't use Web Api or MvcCore but full MVC
 
and how exactly do you structure that
keeping in mind that i already have the local console application already built
 
What do you mean?
 
well how do i go from having a console application
to having a console application with an asp web api/mvc
let me know if that makes sense
 
11:08 PM
@Greg ?
 
You can either have a console application or an asp.net thing
People are logging off for the day, but I think you'd learn a lot more if you just jumped into it
Open Visual Studio, tell it you want to make a new ASP.Net thing, and see what you can do
I didn't get asp.net until I started using it, there's a lot of confusing words people use to describe it.
 
yea i will do that
 
11:30 PM
Morning O/
Early friday here.
 
11:47 PM
@Grace are you still with me?
 

« first day (2924 days earlier)      last day (2019 days later) »