Dec. 5th, 2014

juan_gandhi: (VP)


<script>


function environmentName()
{
	var env = 'prod';
	var envCaps = env.toUpperCase();

	//alert("prod" + "  " + envCaps);
	return envCaps;
}
</script>


(repeated twice on each page)
juan_gandhi: (VP)
Короче, есть, скажем, пять вопросов для экзамена, каждый в нескольких вариантах; задача - изготовить варианты, чтобы они максимально различались. Ну типа всех возможных будет 55, а мне надо 27, ну вот взять первые 27 из таких.

С таким смаком навалял это на скале. Типа такого:

    def findFurthest(current: List[Index])(collection: List[Index]) = collection.map(i => (distance(current)(i), i)).max(order)._2

    def sortByDistance(source: List[Index], target:List[Index] = Nil): List[Index] = source match {
      case Nil => target
      case more => {
        val furthest = findFurthest(target)(source)
        sortByDistance(source.filterNot(furthest==), furthest::target)
      }
    }

    val sorted = sortByDistance(allIndexes).reverse
juan_gandhi: (VP)
  def questionHTML(i: Int, q: String) =
    <span>
      <h3>Question {i+1}</h3>{q}
      <br/><br/><br/><br/><br/><br/>
  </span>

  def variantHTML(v: List[String]) =
    <p style="page-break-after:always;">
      <h1><center>{title}</center></h1>
      {v.zipWithIndex map {case(q,j) => questionHTML(j,q)}}
    </p>

  def html(variants: List[List[String]]) = {
    <html><body>{
      variants map variantHTML
    }</body></html>
  }

сяу

Dec. 5th, 2014 10:45 pm
juan_gandhi: (VP)
Что апостол Павел проповедовал в Трое.
Фоменко переворачивается в гробу.
Ну в смысле его средневековый аналог.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

June 2025

S M T W T F S
1 2345 6 7
8 9 10 11 121314
15161718 1920 21
222324252627 28
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 30th, 2025 02:31 pm
Powered by Dreamwidth Studios