Here is a simple mobile app I helped my son write. He is a big Risk fan and this seemed like a great way for him to get introduced to android development.
Risk Dice Roller is a simple app designed to replace dice needed for the original risk board game. It automates the rolling process and keeps history and statistics of each players rolls. You can even automate larger battles and watch as your large army takes on the defenders. It can be really fun to compare player stats and its effect on the outcome of the game.
If you need to locate a field in a large database and you don’t know what table the filed is or not really sure of the exact spelling of the field, you can use this simple query to search for fields names in a database.
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id)AS schema_name,c.name AS column_name
FROMsys.tablesAS t
INNERJOINsys.columnscON t.OBJECT_ID=c.OBJECT_IDWHEREc.name LIKE '%Your_Field_Name%'ORDERBY schema_name, table_name
Using JavaScript to locate controls in ASP.net pages that are linked to master pages can be tricky. This is because the ASP.net reassigns control IDs dynamically and the names change.
The function below is a C# implementation of the formula return the X and Y coordinates of a position on the curve for a given Time (t) and the 4 points that define the Bezier Curve. At t=0 you will be at p0, and at t=1 you will be at p3.
You can easily extend this to connect multiple curves to each other (multi-segmented path). You can do this simply by making p0 of subsequent segments equal p3 of the prior segment.
Include this function in your c# projects to create smooth curves.
To use the function, simply pass in the 4 point and a time (between 0 and 1). To draw the curve, try calling this function from a for loop that looks something like this:
// preset your p0,p1,p2,p3
Vector2 PlotPoint;
for (float t = 0; t <= 1.0f; t += 0.01f)
{
PlotPoint = GetPoint(t, p0, p1, p2, p3);
// now call some function to plot the PlotPoint
YourDrawFunction(PlotPoint);
}
This basically starts you at p0 when time t is zero and at each increment of time +0.01 you will slowly move on the curve towards p3.
So to give you an idea of how this was used by my son in one of his games, watch the video below.
Note these are circular Paths each withe 3 segments. Each segment is a 4 point Bezier calculation.
p3 of the each segment is common to p0 of next each segment.
To make the circular, p3 of last segment must be same as p0 of 1st segment.
p2 and p3 of each segment must be on a strait line with p0 and p1 or the next segment. (this give you the double handles for each point)
So this means:
If a path point was moved by user, you must also move left and right control handler points by same deltas
If left handler moved, must also move corresponding path point so it intersects line to other handler at mid point
If right handler moved, must also move corresponding path point so it intersects line to other handler at mid point