Asp.net create function Student of the day - asp.net

Im working on a ASP.net web application about my class.
All students have their own webform site with an own link refering to thier page.
But I´m trying to do a function for the homepage "student of the day".
I know that i have to put all student links in an array and randomize them.
My problem is that i want the studentlink to change every 24 hours.
How can I make a timer to pick a new object from the array.
Cheers

I'd agree with the comment that has been posted, however I am going to assume that you dont have a database at the moment, or you would alreday be using that rather than an array...
I minght have missed something in your question but I think we can use the pseudo random number generator with a seed based on today to get the "Random Number"
//I am assumung that you already have an array of students created at this point.
Random rnd = new Random(DateTime.Now.Day);
int selectedStudent = Console.WriteLine(rnd.Next(1, 6));
object student = studentArray[selectedStudent];
Because the seed is the same every time you should get the same result every time until the seed changes and that happens when the day changes.
Of course this will not work unless you create a new instance of rnd each time that you need to generate the number.
Hope this helps, if not let me know.

Related

Field is periodically updated. Need to show New and prior field when changed

For this report, I need one field (Sales Code) to only show if it has been updated. Periodically they change Sales code and I want a report to show the prior code along side the new code when it changes. Along with its part number and so on.
I was wondering the best way to go about tackling this request.
I tried to do _add_days -1 and compare the Sales code --> Sales code1. I dont think that will give me what I am looking for.
For example Sales code changes from AA --> AB.
I want to see New CODE OLD Code Part Number and so on...
AB AB 12345
The pattern you are encountering is called a slowly changing dimension.
Here's a wee free primer.
https://www.kimballgroup.com/2013/02/design-tip-152-slowly-changing-dimension-types-0-4-5-6-7/
You don't mention the structure of the data you're working with so it would be quite difficult for me to say what type you have other than the fact that you're trying to track historical data and seem to have it captured somehow rules out type 0.
Because of that, I can't come down from Mount Sinai with the solution but this can help you start to think through the problem.
In Framework manager have the modeler design the fields for SalesCode and SalesCode1
To only show if there was a change
Add a detail filter:
SalesCode <> SalesCode1
To control the context of time, have a separate filter like:
[Sales Date] between ?FromDate? and ?ToDate?

MS Project: How to set daily actual work for a task using a JavaScript Add-In?

I want to synchronize data for actual work from a web-based application of my company with MS Project. I am currently developing an Add-In with JavaScript in order to achieve this:
The red circle in my screenshot shows the data that I want to set programmatically. However, I have no idea how to achieve this.
I understand that I can get Task GUIDs and then set task fields using the task GUID and the field ID. This way I can save the cumulative actual work, but not per day like in my screenshot.
The API Docs on the MS Office Website are rather hard to read and navigate. Any help would be apprechiated!
Let's first separate the language from the operation.
Operationally, based on your circle, you want to set work for a task to happen on individual days? This is done using timeScaleData, see https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2003/aa206255(v=office.11) . When I did something similar (in VBA), I had to (1) get an array of time scale values, then (2) walk/iterate through that array and set work to those days:
set timeScaleValsArry = myTask.Assignments(1).TimeScaleData(startDay, endDay, pjAssignmentTimeScaledWork, daily)
for a = 1 to timeScaleValsArry.Count
timeScaleValsArry[a].value = hoursToWorkThatDay
next
Breaking down the elements above:
myTask is the task (of type task) I want to manipulate.
Assignments is an array representing each resource assigned to the task; for my purposes, I only ever had 1 resource assigned, hence the index of (1).
TimeScaleData is the function that returns the the array starting on the day startDay (whatever you want that to be), endDay, pjAssignmentTimeScaledWork which tells this function what data we want to work with (being work, but there are alternates ), and daily which is the frequency you want to work with (for instance you can go down to minutes, or up to years).
Then the returned array timeScaleValsArry is walked, and inside the loop the daily assignment for each value is manipulated. You'd need to customize this part to meet your needs; alternatively, you don't even need to loop if you always had three days: just hard code the array indices.
As far as language, clearly this is do-able in VBA. Doing this in C# as a VSTO addin has very similar syntax. I'd presume for JavaScript (what are you using, ScriptLab?) would also have similar syntax.

Little help about understanding asp.net MVC

I've recently started learning asp.net programming and am now fiddling with my small "project"
In it i have 2 models for my database : 1) Film - which consists of name,id, category(type of category model), other random properties and a DATE
2) Category - which consists just of the name of the category and id.
I want to create a form where i type a start date and an end date and choose a category. After i submit this form i want my controller to return Data from database where the data falls into range (start date - end date) and category which were chosen.
So my question is do i need another model for "data range" and the form or can i just write a javascript function or something similar and it can return data directly to my view. I'm a little lost and i have no one to ask, so maybe someone can help me.
Thanks

Game Maker Studio Score, My Score resets when going to the next room

I'm having a problem regarding the scores in my game, My game is about answering questions using jumbled letters and when the player gets one correct answer, the game should add +1 to the game score and move to the next level (which is in the next room) and will generate another question, and keeping your last score which is 1. My problem is, the score just keeps on resetting to a value of 0 when moved into the next room. I want it to continuously add +1 even when I go to the next rooms. Thankyou in advance.
There are many solutions.
1) Set your score controller object as persistent
This is the best, as you don't need to do anything else, and in fact, it's a good rule to have one object as a persistent controller.
2) You can save your score to the file and load it each time this object (that stores the variable) is being created
This requires save\load manipulation, and in some cases (e.g you don't want to have ANY persistent objects) can be better, but I highly doubt.
You are not giving enough details about how are you storing the score value.
That may be cause by many issue in the way you are making the game, so im going to try to give all solutions to all possible scenarios:
1) Storing Score in Object Variable
This way may have two different sub scenarios:
a) Going to Next Room after Right answer
b) Restart the same room
This completly reset the variable on the object because the object is destroyed and then created again initilizing again the variables it hold when the room is created.
For this the solution is simply: set persistent true, you can do it from the form object properties (the interface that pop up when you open a object) or using gml on the create event of the object:
object: CREATE event
persistent = true;
This will make the object even if is repeated on the room created to no to create it again, so the event CREATE will no be never repeated again.
2) Storing the Score in variable of the room using Room Creation Event
In this scenario happeng the same that above, its just a local variable the room but exists only for the room and will only exists during the room until its restarted or leaved.
In this case the best is to transform this variable to a global instance in the following way:
global.points = 0;
And this is the best way to store score for you game.
Just remember no to put it in a create event of a not persistent object or it will be reseted to ZERO everything that object is created.
In that case you can check if the variable exists and then if not initializing it:
if (variable_global_exists("points") == true) {
global.points = 0;
}
Now if you want to save it you need to use file functions which is another question.

Google Analytics custom dimension vs new users

We have multiple e-learning modules under one domain.
We want to know how many new users start each module over a set period of time e.g.
trainingDomain.com/module01 > 4 new starts
trainingDomain.com/module02 > 2 new starts
trainingDomain.com/module03 > 5 new starts
The metric that seems to best fit new starts is new users by module.
We have tried various approaches but no success so far. I suspect we are misunderstanding something conceptual.
Each page in a module saves a moduleID to a custom dimension i.e. click scope. If we create a custom report with new users as the metric and moduleID as the primary dimension, only the first module visited registers in the report.
Does anyone have a suggestion of a better way we can approach this or a way to tweak the current approach to work? I'm really struggling to get my tiny brain around this...
Many thanks!
Actually, custom dimension is redundantly for your purpose.
Create a page content group with your modules. Then create a custom report with the new users as metric, page as a dimension and filter by your content group.

Resources