text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Duality;

namespace FarseerPhysics.Common.PolygonManipulation
{
	public static class SimplifyTools
	{
		private static bool[] _usePt;
		private static double _distanceTolerance;

		/// <summary>
		/// Removes all collinear points on the polygon.
		/// </summary>
		/// <param name="vertices">The polygon that needs simplification.</param>
		/// <param name="collinearityTolerance">The collinearity tolerance.</param>
		/// <returns>A simplified polygon.</returns>
		public static Vertices CollinearSimplify(Vertices vertices, float collinearityTolerance)
		{
			//We can't simplify polygons under 3 vertices
			if (vertices.Count < 3)
				return vertices;

			Vertices simplified = new Vertices();

			for (int i = 0; i < vertices.Count; i++)
			{
				int prevId = vertices.PreviousIndex(i);
				int nextId = vertices.NextIndex(i);

				Vector2 prev = vertices[prevId];
				Vector2 current = vertices[i];
				Vector2 next = vertices[nextId];

				//If they collinear, continue
				if (MathUtils.Collinear(ref prev, ref current, ref next, collinearityTolerance))
					continue;

				simplified.Add(current);
			}

			return simplified;
		}

		/// <summary>
		/// Removes all collinear points on the polygon.
		/// Has a default bias of 0
		/// </summary>
		/// <param name="vertices">The polygon that needs simplification.</param>
		/// <returns>A simplified polygon.</returns>
		public static Vertices CollinearSimplify(Vertices vertices)
		{
			return CollinearSimplify(vertices, 0);
		}

		/// <summary>
		/// Ramer-Douglas-Peucker polygon simplification algorithm. This is the general recursive version that does not use the
		/// speed-up technique by using the Melkman convex hull.
		///
		/// If you pass in 0, it will remove all collinear points
		/// </summary>
		/// <returns>The simplified polygon</returns>
		public static Vertices DouglasPeuckerSimplify(Vertices vertices, float distanceTolerance)
		{
			_distanceTolerance = distanceTolerance;

			_usePt = new bool[vertices.Count];
			for (int i = 0; i < vertices.Count; i++)
				_usePt[i] = true;

			SimplifySection(vertices, 0, vertices.Count - 1);
			Vertices result = new Vertices();

			for (int i = 0; i < vertices.Count; i++)
				if (_usePt[i])
					result.Add(vertices[i]);

			return result;
		}

		private static void SimplifySection(Vertices vertices, int i, int j)
		{
			if ((i + 1) == j)
				return;

			Vector2 A = vertices[i];
			Vector2 B = vertices[j];
			double maxDistance = -1.0;
			int maxIndex = i;
			for (int k = i + 1; k < j; k++)
			{
				double distance = DistancePointLine(vertices[k], A, B);

				if (distance > maxDistance)
				{
					maxDistance = distance;
					maxIndex = k;
				}
			}
			if (maxDistance <= _distanceTolerance)
				for (int k = i + 1; k < j; k++)
					_usePt[k] = false;
			else
			{
				SimplifySection(vertices, i, maxIndex);
				SimplifySection(vertices, maxIndex, j);
			}
		}

		private static double DistancePointPoint(Vector2 p, Vector2 p2)
		{
			double dx = p.X - p2.X;
			double dy = p.Y - p2.X;
			return Math.Sqrt(dx * dx + dy * dy);
		}

		private static double DistancePointLine(Vector2 p, Vector2 A, Vector2 B)
		{
			// if start == end, then use point-to-point distance
			if (A.X == B.X && A.Y == B.Y)
				return DistancePointPoint(p, A);

			// otherwise use comp.graphics.algorithms Frequently Asked Questions method
			/*(1)     	      AC dot AB
                        r =   ---------
                              ||AB||^2

		                r has the following meaning:
		                r=0 Point = A
		                r=1 Point = B
		                r<0 Point is on the backward extension of AB
		                r>1 Point is on the forward extension of AB
		                0<r<1 Point is interior to AB
	        */

			double r = ((p.X - A.X) * (B.X - A.X) + (p.Y - A.Y) * (B.Y - A.Y))
					   /
					   ((B.X - A.X) * (B.X - A.X) + (B.Y - A.Y) * (B.Y - A.Y));

			if (r <= 0.0) return DistancePointPoint(p, A);
			if (r >= 1.0) return DistancePointPoint(p, B);

			/*(2)
		                    (Ay-Cy)(Bx-Ax)-(Ax-Cx)(By-Ay)
		                s = -----------------------------
		             	                Curve^2

		                Then the distance from C to Point = |s|*Curve.
	        */

			double s = ((A.Y - p.Y) * (B.X - A.X) - (A.X - p.X) * (B.Y - A.Y))
					   /
					   ((B.X - A.X) * (B.X - A.X) + (B.Y - A.Y) * (B.Y - A.Y));

			return Math.Abs(s) * Math.Sqrt(((B.X - A.X) * (B.X - A.X) + (B.Y - A.Y) * (B.Y - A.Y)));
		}

		//From physics2d.net
		public static Vertices ReduceByArea(Vertices vertices, float areaTolerance)
		{
			if (vertices.Count <= 3)
				return vertices;

			if (areaTolerance < 0)
			{
				throw new ArgumentOutOfRangeException("areaTolerance", "must be equal to or greater then zero.");
			}

			Vertices result = new Vertices();
			Vector2 v1, v2, v3;
			float old1, old2, new1;
			v1 = vertices[vertices.Count - 2];
			v2 = vertices[vertices.Count - 1];
			areaTolerance *= 2;
			for (int index = 0; index < vertices.Count; ++index, v2 = v3)
			{
				if (index == vertices.Count - 1)
				{
					if (result.Count == 0)
					{
						throw new ArgumentOutOfRangeException("areaTolerance", "The tolerance is too high!");
					}
					v3 = result[0];
				}
				else
				{
					v3 = vertices[index];
				}
				MathUtils.Cross(ref v1, ref v2, out old1);
				MathUtils.Cross(ref v2, ref v3, out old2);
				MathUtils.Cross(ref v1, ref v3, out new1);
				if (Math.Abs(new1 - (old1 + old2)) > areaTolerance)
				{
					result.Add(v2);
					v1 = v2;
				}
			}
			return result;
		}

		//From Eric Jordan's convex decomposition library

		/// <summary>
		/// Merges all parallel edges in the list of vertices
		/// </summary>
		/// <param name="vertices">The vertices.</param>
		/// <param name="tolerance">The tolerance.</param>
		public static void MergeParallelEdges(Vertices vertices, float tolerance)
		{
			if (vertices.Count <= 3)
				return; //Can't do anything useful here to a triangle

			bool[] mergeMe = new bool[vertices.Count];
			int newNVertices = vertices.Count;

			//Gather points to process
			for (int i = 0; i < vertices.Count; ++i)
			{
				int lower = (i == 0) ? (vertices.Count - 1) : (i - 1);
				int middle = i;
				int upper = (i == vertices.Count - 1) ? (0) : (i + 1);

				float dx0 = vertices[middle].X - vertices[lower].X;
				float dy0 = vertices[middle].Y - vertices[lower].Y;
				float dx1 = vertices[upper].Y - vertices[middle].X;
				float dy1 = vertices[upper].Y - vertices[middle].Y;
				float norm0 = (float)Math.Sqrt(dx0 * dx0 + dy0 * dy0);
				float norm1 = (float)Math.Sqrt(dx1 * dx1 + dy1 * dy1);

				if (!(norm0 > 0.0f && norm1 > 0.0f) && newNVertices > 3)
				{
					//Merge identical points
					mergeMe[i] = true;
					--newNVertices;
				}

				dx0 /= norm0;
				dy0 /= norm0;
				dx1 /= norm1;
				dy1 /= norm1;
				float cross = dx0 * dy1 - dx1 * dy0;
				float dot = dx0 * dx1 + dy0 * dy1;

				if (Math.Abs(cross) < tolerance && dot > 0 && newNVertices > 3)
				{
					mergeMe[i] = true;
					--newNVertices;
				}
				else
					mergeMe[i] = false;
			}

			if (newNVertices == vertices.Count || newNVertices == 0)
				return;

			int currIndex = 0;

			//Copy the vertices to a new list and clear the old
			Vertices oldVertices = new Vertices(vertices);
			vertices.Clear();

			for (int i = 0; i < oldVertices.Count; ++i)
			{
				if (mergeMe[i] || newNVertices == 0 || currIndex == newNVertices)
					continue;

				Debug.Assert(currIndex < newNVertices);

				vertices.Add(oldVertices[i]);
				++currIndex;
			}
		}

		//Misc

		/// <summary>
		/// Merges the identical points in the polygon.
		/// </summary>
		/// <param name="vertices">The vertices.</param>
		/// <returns></returns>
		public static Vertices MergeIdenticalPoints(Vertices vertices)
		{
			//We use a dictonary here because HashSet is not avaliable on all platforms.
			HashSet<Vector2> results = new HashSet<Vector2>();

			for (int i = 0; i < vertices.Count; i++)
			{
				results.Add(vertices[i]);
			}

			Vertices returnResults = new Vertices();
			foreach (Vector2 v in results)
			{
				returnResults.Add(v);
			}

			return returnResults;
		}

		/// <summary>
		/// Reduces the polygon by distance.
		/// </summary>
		/// <param name="vertices">The vertices.</param>
		/// <param name="distance">The distance between points. Points closer than this will be 'joined'.</param>
		/// <returns></returns>
		public static Vertices ReduceByDistance(Vertices vertices, float distance)
		{
			//We can't simplify polygons under 3 vertices
			if (vertices.Count < 3)
				return vertices;

			Vertices simplified = new Vertices();

			for (int i = 0; i < vertices.Count; i++)
			{
				Vector2 current = vertices[i];
				Vector2 next = vertices.NextVertex(i);

				//If they are closer than the distance, continue
				if ((next - current).LengthSquared <= distance)
					continue;

				simplified.Add(current);
			}

			return simplified;
		}

		/// <summary>
		/// Reduces the polygon by removing the Nth vertex in the vertices list.
		/// </summary>
		/// <param name="vertices">The vertices.</param>
		/// <param name="nth">The Nth point to remove. Example: 5.</param>
		/// <returns></returns>
		public static Vertices ReduceByNth(Vertices vertices, int nth)
		{
			//We can't simplify polygons under 3 vertices
			if (vertices.Count < 3)
				return vertices;

			if (nth == 0)
				return vertices;

			Vertices result = new Vertices(vertices.Count);

			for (int i = 0; i < vertices.Count; i++)
			{
				if (i % nth == 0)
					continue;

				result.Add(vertices[i]);
			}

			return result;
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
The latest news and the greatest photo galleries and videos.
Finalists Defend Their Ideas Tuesday Night
Founder's Innovation Prize
By Randy Dufault
Free Admission for Ages 18 and Under at EAA AirVenture Oshkosh 2021
EAA AirVenture Oshkosh 2021's '75th (Plus One)' Flying Demos Commemorate End of World War II
Orbis Flying Eye Hospital Returns to Oshkosh for AirVenture 2021
AirVenture 2021 Planning Continues — Advance Tickets on Sale
10 Things You Don't Want to Miss During EAA Spirit of Aviation Week
July 25, 2016 ‑ According to the NTSB, over a period of eight years 47 percent of fatal fixed-wing general aviation accidents in the U.S. involved pilots losing control of their aircraft in flight. By any measure that is a big problem, and anything done to reduce the incidence of such accidents will have a dramatic effect on all aspects of GA safety, including for the experimental amateur-built aircraft many EAA members create and fly.
On Tuesday, July 26th, at Theater in the Woods five finalists for the EAA Founder's Innovation Prize will defend their ideas on how to reduce loss-of-control accidents in front of a panel of judges. The winner will take home a $25,000 grand prize, presented by Airbus Group, in the hope that the idea, be it technological or otherwise, can be developed into a practical solution.
Second and third place receive $10,000 and $5,000 monetary prizes respectively.
"The great thing about a contest like this is the wide variety of innovative, unexpected ideas that you can only get by engaging the broader community," said chief judge and retired astronaut Charlie Precourt. "The contest could really start to move the needle on beating down loss of control, and it is certain to raise awareness in our community of the significance of the problem."
Sean Elliott, EAA vice president, advocacy and safety, said the prize was born within the EAA Safety Committee.
"Our advocacy work is directly tied to our safety work," Elliott said. "What we are doing is reducing barriers in order to improve a pilot's ability to fly more affordably and more safely."
"The Founder's Innovation Prize is the EAA community stepping up to the plate to actually do something to reduce the loss-of-control fatal accident rate," Elliott added. "It might be a training solution, it might be a new development of a gadget or a technology innovation…our goal is a 25 percent reduction in [LOC induced fatal accidents] in the next five years, and a 50 percent reduction in the next 10 years."
Elliott said a past example of such innovation was the addition of terrain features in aviation GPS units. Controlled flight into terrain (CFIT) was a common problem just a few years ago, and once terrain awareness became available, the associated accident rate fell dramatically.
Precourt pointed out another example in that both military and civilian aviation in the late '70s and early '80s had a significant issue with accidents that ultimately were solved by the emergence of crew resource management training. While the application of technology may be the best solution for the LOC challenge, the CRM solution is an example of approaching the problem from a human factors angle.
The contest's substantial prize attracted 140 entries. Preliminary judging has narrowed that group down to five finalists. Those finalists are Henry Burrow, from Clover, South Carolina, with his idea "Digital Copilot;" Ihab Awad of San Jose, California, with his idea "Airball;" Andrew Skow from Tehachapi, California, with his idea "Energy State Awareness Display;" Chris Moody of Lusby, Maryland, with his idea "Virtual Reality In-Aircraft Platform;" and Grant Sprunger from Boulder, Colorado, with his idea "Precise Pilot."
They will defend their proposals in front of the judging panel tonight at 8:00 p.m. The panel, a veritable who's who of all things aviation, consists of Precourt, who chairs EAA's Safety Committee; Dick VanGrunsven, designer of the Van's RV series of aircraft; aviation safety speaker and author Rod Machado; Dave Morss, one of the country's pre-eminent civilian test pilots and air racers; and Michael Goulian, national aerobatic champion and Red Bull Air Race competitor.
The finalists will attempt to convince the judges that their ideas have the effectiveness, ease of installation or implementation, low cost, and wide applicability necessary to help solve fatal loss-of-control accidents.
The contest was announced at EAA AirVenture 2015.
Using innovation to address the LOC accident rate issue has broader implications beyond making personal flying safer. According to Doug Macnair, EAA vice president of government relations, the community could face unwanted regulation if LOC accidents are not addressed.
"If EAA takes the lead in mobilizing the ingenuity and inventiveness of this force out here, our members, to solve this problem, it staves off future regulation that could be restrictive," Macnair said. "By EAA taking the lead on this key issue we are actually getting ahead of the [potential] advocacy challenge."

redpajama_set_name: RedPajamaCommonCrawl


text:
Ruth Stalker-Firth
Herself. Fascinated by how people use technology & vice-versa…
Tag: game theory
Game theory & social media marketing (4): Conclusions
The Royal Game of UR, Early Dynastic III, 2600BC, British Museum
[Part 4 of 4: Game theory & social media: Part 1, Part 2, Part 3]
No, I'm no super lady, I don't have no game whatsoever,
I put my high heels on and see how that goes, yeah
– Pauline, Sucker for love
Ask a mathematician why they like maths, and they will tell you that mathematics gives a definite yes or no. There is beauty in clarity. And, everyone likes to feel that they understand and have control over what is happening in their world. This feeling of certainty is reflected in the bottom two rows of Maslow's hierarchy of needs: physiological and safety needs.
Tapping into fear and belonging
That said, we also love variety and surprise, which is the most popular information shared on social media. We crave new stimulus which is why we love games. We love the idea of chance or fortune transforming our lives for the better, and surely if we learn the rules, then we will succeed. And, that is why marketing has such a pull on us. Marketers tell us that we will have improved lives if we do/buy/or have what they are selling, and, marketers themselves will have improved lives too if we do/buy/or have what they are selling.
There are so many ways to market something, this link has 52 types of marketing strategies. The most effective, of course, aims at the bottom of Maslow's hierarchy of needs – safety – which is why fear quite often drives news and coupled with specific instructions gives a compliant society.
Tapping into belonging is another way to market, which is why the connection economy and building friendship with your customers is gaining so much traction as a marketing strategy.
Modelling emotion and what-ifs
Modelling human emotion is impossible to do with game theory especially on social media, a fluid, still unknown, type of communication. We will never quite know who our audience is. We may target our demographic, but if they retweet or share something outside of that, then you never exactly know who is looking at your content, or how they will react to it. All game theory can do is offer interesting and potentially useful partial explanations to model a selection of what-ifs scenarios when employing different strategies.
In the last post (part 3), we looked at various game theory strategies from the aggressive to the altruistic, and saw that people generally behave like the people around them (hawk-dove) and that Kermit was in a bit of hurry to get together with his girl, which caused him to behave passive-aggressively, and probably not get what he wanted.
Don't be like Kermit
Game theory is a tool for social media marketing and the best application of it is recording trial and error attempts (with statistical significance) whilst using our emotional intelligence.
Be aware of your emotions and triggers (your personal competence) so you don't get involved in a big wrangle either privately, which could damage a relationship, or publicly, which might be retweeted everywhere and could wreck your brand or reputation. Even in the mathematics of game theory we need to understand other players moods and motives (social competence) and not assume anything. We need to ask for more clarification, so that when we do make a move, we do so with clarity and certainty that we are doing the right thing, and as any mathematician would tell you if you asked them, there is beauty in clarity for it gives us certainty and a sense of control, things which are harder to come by in our ever changing world.
Game theory in social media (1): Fate and power
Early dice made from knucklebone in Ancient Greece © British Museum
Humans love games. We just love playing them.
The earliest proof we have, so far, dates back to 3600BCE: Six-faced dice with coloured pebbles made from heel bones of sheep and deer have been found on archaeological digs in Assyria, Sumeria, and Egypt.
Today, a walk around the British Museum, one of my favourite places, (which you can now do on Google), shows us that places where guards sat, probably for hours, like the entrance to the palace of King Ashurnasirpal II (883-859 BC) at Nimrud, has a board and a tally scratched into the side of one of the enormous winged human-headed lions.
By the time of the birth of Christ, many types of random number generators, including dice, were common, and were used for betting on or with board games. They were often spoken of as the workers of the blind goddess of fate, fortune, or destiny. And, it says in the Bible, that they cast lots to decide how to divide up Jesus's possessions (Matthew 27:35). Even nowadays we talk about the roll of the dice when we talk chance and the things which happen to us.
By 10th century Europe, cards were the most popular thing with which to play games. There might be some skill, but really, a lot of it is up to chance, and don't we all know that cliche about playing the hand you were dealt?
Highs and lows on the roll of a dice
The first formal attempt at analysing games, especially of chance, was written in 1520 (but published in 1663) by Girolamo Cardano and has been recognised as the first step in probability theory. Cardano was a compulsive gambler, so would have felt the highs and lows of the roll of the dice more than most. He was foremost in the minds of Pascal and Fermat who published a book in 1654, continuing his work. And, it was Fermat's last theorem which remained a phenomenon until it was solved in 1994. Imagine, it took three hundred and fifty years to solve a puzzle.
Later, writer Fyodor Dostoyevsky described our love of excitement and chance when playing games and how our fortunes can flip in an instant. He wrote about it in letters to his sister and his short novel, The Gambler. He was convinced that you needed to detach and keep a clear head, but had difficulty doing either, for it is much easier said than done. Consequently, gambling and games are ubiquitous, from church bingo to nationwide lotteries. Life can really change with a roll of the dice – or so it seems.
Game theory not gamification
It was in 1928 that the first theory of game theory was first written about by (rock star) John von Neumann who amongst many things designed the first computer architecture in 1945.
But, it has to be said, game theory isn't the same as gamification, at all. Please don't mix them up. Gamification is about turning things into games such as business objectives and anything else we want to make more engaging and more fun. When gamification is well designed, it works really well. But game theory is much bigger, and much more than just games.
In 1944, von Neumann and Oscar Morgenstern translated and expanded von Neumann's theories in order to produce: The theory of games and economic behaviour. For his 1928 paper was mainly about two people playing a game together with only one winner (known as: two person game-zero sum) but game theory is much bigger than this, and it is not just about games and game playing.
It might be based in mathematics, but game theory has people in it, of course, which is why it can be used to think about everything: economics, political science and psychology. And, it has the crazy assumption that people behave rationally, which if there is one thing I know about life, people never behave rationally, nor should you expect them to. The other thing is that, we can only partially model any prescription because the world is huge and constantly changing, and we can never model everything in a computer. It really doesn't matter how clever computers get. We have a long way to go yet when modelling humans and behaviour, but game theory is a start.
That said, power is the name of the game: group voting, economic theory and how to influence people, especially in areas like interpersonal cooperation, competition, conflict, labour negotiations, and economic duopolies, can all be understood in terms of game theory.
Game theory for explaining social media
Social media is the big new tool of the Internet, for business, politics, etc, and as of yet, no one knows how it works. So, this series is going to take a look at some of the big hitters of game theory: the prisoners dilemma, the Nash equilibrium, and so on, to see if these strategies can help us understand better how social media works. Are people cooperating or conflicting in ways these models describe on social media? If yes, can we understand and anticipate behaviour? If not, what other theories could we come up with?
[Part 2]
Storytelling with AI and machine learning
Tutorial: A quick guide to data mining on Twitter
Designing story (3): Archetypes and aesthetics
Prejudice: The social animal on social media (7)
Designing design: Form follows function
Conformity: The Social Animal on Social Media (2)
Human-computer interaction, cyberpsychology and core disciplines
Blogs series
Social Psychology: The Social Animal on Social Media (9)
Web Design: The science of communication (7)
Artificial Intelligence: Ghosts, Robots, Data (5)
Designing design: The science of the artificial (12)
Designing story (5)
Women: Society, Storytelling, Technology (7)
Game theory in social media (4)
The accidental techie (10)
Creating space (5)
accidental techie
elliot aronson
information visualisation


• Added an option to not parse the config file when the path is populated; this will allow a version check without a full configuration file parse.
• Added a MySQL Version Check when the path is populated, this will display your MySQL Server version in the Additional Information area.
• Retooled the min/max version version check to display a combined warning when the system doesn't support UBB.threads.
• Lowered the check value of "max_execution_time" to be at least 30 seconds (from 60 seconds).
TLDR; You can now have a version check without a full configuration parsing, check your MySQL version, added a version check for the v7.7.0 release which includes PHP7.0-PHP7.3 support, more list formats, and a lower max_execution_time check.


text:
Q: How to validate the form in this scenario @model Contoso.MvcApplication.ViewModels.QuizCompletedViewModel

Quiz 1

<form method="post">
@for (int i = 0; i < Model.Questions.Count; i++) {
    @Html.EditorFor(model => model.Questions[i], "Questions/_MultipleChoiceAnswerView")
}

Question @ViewData["CurrentNumber"] of @ViewData["TotalQuestions"]

    <input type="submit" value="Continue" style="float: right;" />

</form>

As you can see, I'm showing all the questions through the loop. But I really want to show question by question in the page. This is the a related post to implement it.
Hide current element and show the next one
If I don't include that JQuery feature, it looks like this

And the problem is, with the last JQUERY feature, I'm going to show only one question at a time, so I need to validate only that question, and that's the part I really have no idea.
I mean, suppose that I've already that JQUERY function, so when the user press CONTINUE, it has to validate if the current question is valid, but only this, not all.
What can I do?
UPDATE: The code where I create the radio buttons:
@using Contoso.MvcApplication.Extensions
@model Contoso.MvcApplication.ViewModels.MultipleChoiceQuestionViewModel

@Model.Question.QuestionText

@Html.RadioButtonForSelectList(m => Model.Question.SelectedAnswer, Model.AnswerRadioList)
@Html.ValidationMessageFor(m => m.Question.SelectedAnswer)

And I'm using HtmlExtensions:
public static class HtmlExtensions
{
    public static MvcHtmlString RadioButtonForSelectList<TModel, TProperty>(
        this HtmlHelper<TModel> htmlHelper,
        Expression<Func<TModel, TProperty>> expression,
        IEnumerable<SelectListItem> listOfValues,
        IDictionary<string, object> htmlAttributes)
    {
        var metaData = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
        var sb = new StringBuilder();

        if (htmlAttributes == null)
        {
            htmlAttributes = new RouteValueDictionary();
        }
        if (!htmlAttributes.ContainsKey("id"))
        {
            htmlAttributes["id"] = null;
        }
        foreach (SelectListItem item in listOfValues)
        {
            var id = string.Format(
                "{0}_{1}",
                htmlHelper.ClientIdFor(expression),
                item.Value
            );
            htmlAttributes["id"] = id;
            var radio = htmlHelper.RadioButtonFor(expression, item.Value, htmlAttributes).ToHtmlString();
            var labelId = htmlHelper.ClientIdFor(expression);
            sb.AppendFormat(
                "
{0}{2}
",
                radio,
                id,
                HttpUtility.HtmlEncode(item.Text)
            );
        }

        return MvcHtmlString.Create(sb.ToString());
    }
}

A: Look at using something like the following. It uses the visible div as the current step and looks for invalid elements contained within.
This is a rough set of code and has not been tested but hopefully it might give you an idea on how to proce
// attach continue button handler
        $("#continue).click(function ()
        {

            var $step = $(":visible"); // get current step

            var validator = $("form").validate(); // obtain validator
            var anyError = false;

            //find any elements within the current step that are invalid.
            $step.find("input").each(function ()
            {
                if (!validator.element(this)) { // validate every input element inside this step
                    anyError = true;
                }

            });

            if (anyError)
                return false; // exit if any error found

                //in this case use class confirm (or use hidden field value for step number)
            if ($step.next().hasClass("confirm")) { // is it confirmation?
                // show confirmation asynchronously
                $.post("/wizard/confirm", $("form").serialize(), function (r)
                {
                    // inject response in confirmation step
                    $(".confirm").html(r);
                });
            }
               //workout if this is the last step.
               //if not go to next question
               // if it is submit the form
            if ($step.next().hasClass("complete")) { // is there any next step?
                $step.hide().next().show();  // show it and hide current step
                $("#back-step").show();   // recall to show backStep button
            }

            else { // this is last step, submit form
                $("form").submit();
            }

        });

redpajama_set_name: RedPajamaStackExchange


by Christine Caine is a book that I picked up as part of the launch team for the book. This is my first book by Caine and my first interaction with much of her material at all. I quickly realized that this book is a game changer.
Christine writes with a personal vulnerability and honesty that tugs at the heart strings. She opens up her life. Her past mistakes. Her past shame. Christine takes us to the moments when she felt most broken by abuse. She walks us through the journey of finding her hope in Jesus and overcoming shame.
She's quick to distinguish between guilt and shame. Saying that "Guilt is about my do. Shame is about my who." Guilt is the result of our actions, our mistakes, or wrongs. Shame attaches itself to us and won't let go until we realize that our identity, our purpose, our destiny and fulfillment in life rests in Jesus Christ.
UNASHAMED helps readers to go there. It's honest and practical. It holds a bright light to the darkness of shame and casts the shadows away. This book is the beginning to freedom in Christ for many. I'm excited to see the impact this message of freedom has on the world. It's a big one.
UNASHAMED releases on May 10, 2016.
Get it. Read it. Live it.


text:
package auth

import (
	"github.com/lfq7413/tomato/errs"
	"github.com/lfq7413/tomato/types"
	"github.com/lfq7413/tomato/utils"
)

type facebook struct{}

func (a facebook) ValidateAuthData(authData types.M, options types.M) error {
	accessToken := utils.S(authData["access_token"])
	host := "https://graph.facebook.com/v2.5/"
	path := "me?fields=id&access_token=" + accessToken
	data, err := request(host+path, nil)
	if err != nil {
		return errs.E(errs.ObjectNotFound, "Failed to validate this access token with Facebook.")
	}
	if data["id"] == nil || utils.S(data["id"]) != utils.S(authData["id"]) {
		return errs.E(errs.ObjectNotFound, "Facebook auth is invalid for this user.")
	}

	// 校验 appIDs
	if options == nil {
		return errs.E(errs.ObjectNotFound, "Facebook auth is not configured.")
	}
	var appIDs []string
	if v, ok := options["appIds"].([]string); ok == true && len(appIDs) > 0 {
		appIDs = v
	} else {
		return errs.E(errs.ObjectNotFound, "Facebook auth is not configured.")
	}
	path = "app?access_token=" + accessToken
	data, err = request(host+path, nil)
	if err != nil {
		return errs.E(errs.ObjectNotFound, "Failed to validate this access token with Facebook.")
	}
	if data["id"] != nil {
		id := utils.S(data["id"])
		for _, v := range appIDs {
			if id == v {
				return nil
			}
		}
	}

	return errs.E(errs.ObjectNotFound, "Facebook auth is invalid for this user.")
}


text:
Star Trek VI: The Undiscovered Country
1991 PG 1h 53m Blu-ray / DVD
Capt. Kirk (William Shatner) must face his prejudices when his sworn enemies the Klingons lurch perilously close to economic deprivation and environmental ruin. Obeying Star Fleet orders, Kirk reluctantly begins peace negotiations with Klingon chancellor Gorkon (David Warner). But peace has many foes: Gorkon is soon dead, and Kirk is imprisoned in a Klingon gulag as the galaxy edges toward all-out war.
William Shatner, Leonard Nimoy, DeForest Kelley, James Doohan, Walter Koenig, Nichelle Nichols, George Takei, Kim Cattrall, Mark Lenard, David Warner, Michael Dorn, Christopher Plummer
Sci-Fi & FantasyAction Sci-Fi & FantasySci-Fi AdventureAlien Sci-Fi
English: Dolby Digital 5.1, English: Dolby Digital 2.0 Surround, French: Dolby Digital 2.0 Surround
English, English SDH, French, Spanish (Neutral), Portuguese
English: Dolby True HD, French: Dolby Digital 5.1, Spanish (Neutral): Dolby Digital Mono
PG - Some material may not be suitable for children. Parents urged to give parental guidance. May contain some material parents might not like for their young children. PG - Some material may not be suitable for children. Parents urged to give parental guidance. May contain some material parents might not like for their young children.