text:
Q: How can this code be modified to work with CsvHelper/CsvReader to make the class more efficient for processing? This question is a spin-off this one (Can this method be refactored to use a lamba?). In the comments to that question this was raised:

The refactoring needs to be done in a different place. It's not your function that sucks, it's the definition of CLMExplorerHistory.
The internal data structure does not need to represent the structure of the CSV file in a 1:1 fashion. Just make sure you can read and write in a compatible way.
I think that you're attempting to use the csv data structure directly rather than look at possible areas of duplication that would indicate the obvious place for implementing a class type in order to allow for code reuse. Could you post up a snippet of example data for your CSV file to indicate your starting point?

On the backend of those comments, here is a snippet of the example CSV data:
Date,Status,Weekly Bible Reading,Song1 #,Song1 Title,Song1 Scripture,Song2 #,Song2 Title,Song2 Scripture,Song3 #,Song3 Title,Song3 Scripture,Meeting?,CO Visit,Cancel Reason,# Classes,Chairman,PrayerOpen,PrayerClose,TreasuresTalk,TreasuresTalk_Theme,TreasuresDigging,BibleReading_A,BibleReading_Study_A,BibleReading_B,BibleReading_Study_B,BibleReading_C,BibleReading_Study_C,BibleReading_Source,Apply1_Description,Apply2_Description,Apply3_Description,Apply4_Description,Apply1_A,Apply1_Asst_A,Apply1_Study_A,Apply2_A,Apply2_Asst_A,Apply2_Study_A,Apply3_A,Apply3_Asst_A,Apply3_Study_A,Apply4_A,Apply4_Asst_A,Apply4_Study_A,Apply1_B,Apply1_Asst_B,Apply1_Study_B,Apply2_B,Apply2_Asst_B,Apply2_Study_B,Apply3_B,Apply3_Asst_B,Apply3_Study_B,Apply4_B,Apply4_Asst_B,Apply4_Study_B,Apply1_C,Apply1_Asst_C,Apply1_Study_C,Apply2_C,Apply2_Asst_C,Apply2_Study_C,Apply3_C,Apply3_Asst_C,Apply3_Study_C,Apply4_C,Apply4_Asst_C,Apply4_Study_C,LivingPart1,LivingPart1_Theme,LivingPart1_Length,LivingPart2,LivingPart2_Theme,LivingPart2_Length,CBS,CBS_Source,CBS_Read,Audience B,Audience C,AuxCounselor B,AuxCounselor C
01/03/2021,Registrato e completo,NUMERI 7-8,4,"Geova è il mio Pastore",Salmo 23,54,"Questa è la via","Isaia 30:20, 21",127,Che tipo di persona sono?,2 Pietro 3:11,Y,N,,1,Italo De Gaeta,xxx,xxx,xxx,"L'accampamento d'Israele: lezioni utili",xxx,xxx,5,,,,,Nu 7:1-17,Commemorazione,Visita ulteriore,Visita ulteriore,Visita ulteriore,xxx,xxx,11,xxx,xxx,6,xxx,xxx,12,xxx,xxx,17,,,,,,,,,,,,,,,,,,,,,,,,,xxx,Risultati raggiunti dall'organizzazione,(5 min),xxx,Bisogni locali,(10 min),xxx,"rr cap. 5 parr. 17-22, riquadro 5A",xxx,,,,

I use the CsvReader class to read it into the CLMExplorerHistory object. The class is defined like this:
public class CLMExplorerHistory
{
    [Format("dd/MM/yyyy")]
    [Name("Date")]
    public DateTime Date { get; set; }

    [BooleanFalseValues(new string[] { "N", "n" })]
    [BooleanTrueValues(new string[] { "Y", "y" })]
    [Name("Meeting?")]
    public bool Meeting { get; set; }

    [Name("# Classes")]
    public int Classes { get; set; }

    [Name("Chairman")]
    public string Chairman { get; set; }

    [Name("AuxCounselor B")]
    public string AuxCounsellor1 { get; set; }

    [Name("AuxCounselor C")]
    public string AuxCounsellor2 { get; set; }

    [Name("PrayerOpen")]
    public string PrayerOpen { get; set; }

    [Name("PrayerClose")]
    public string PrayerClose { get; set; }

    [Name("CBS")]
    public string CBSConductor { get; set; }

    [Name("CBS_Read")]
    public string CBSReader { get; set; }

    [Name("TreasuresTalk")]
    public string TreasuresTalkName { get; set; }

    [Name("TreasuresTalk_Theme")]
    public string TreasuresTalkTheme { get; set; }

    [Name("TreasuresDigging")]
    public string SpiritualGemsName { get; set; }

    [Name("LivingPart1")]
    public string LivingPart1Name { get; set; }

    [Name("LivingPart1_Theme")]
    public string LivingPart1Theme { get; set; }

    [Name("LivingPart2")]
    public string LivingPart2Name { get; set; }

    [Name("LivingPart2_Theme")]
    public string LivingPart2Theme { get; set; }

    [Name("BibleReading_A")]
    public string BibleReadingClass1Name { get; set; }

    [Name("BibleReading_B")]
    public string BibleReadingClass2Name { get; set; }

    [Name("BibleReading_C")]
    public string BibleReadingClass3Name { get; set; }

    [Name("BibleReading_Study_A")]
    public string BibleReadingStudy { get; set; }

    [Name("Apply1_Description")]
    public string StudentItem1Description { get; set; }

    [Name("Apply2_Description")]
    public string StudentItem2Description { get; set; }

    [Name("Apply3_Description")]
    public string StudentItem3Description { get; set; }

    [Name("Apply4_Description")]
    public string StudentItem4Description { get; set; }

    [Name("Apply1_A")]
    public string StudentItem1Class1StudentName { get; set; }

    [Name("Apply1_B")]
    public string StudentItem1Class2StudentName { get; set; }

    [Name("Apply1_C")]
    public string StudentItem1Class3StudentName { get; set; }

    [Name("Apply1_Asst_A")]
    public string StudentItem1Class1AssistantName { get; set; }

    [Name("Apply1_Asst_B")]
    public string StudentItem1Class2AssistantName { get; set; }

    [Name("Apply1_Asst_C")]
    public string StudentItem1Class3AssistantName { get; set; }

    [Name("Apply2_A")]
    public string StudentItem2Class1StudentName { get; set; }

    [Name("Apply2_B")]
    public string StudentItem2Class2StudentName { get; set; }

    [Name("Apply2_C")]
    public string StudentItem2Class3StudentName { get; set; }

    [Name("Apply2_Asst_A")]
    public string StudentItem2Class1AssistantName { get; set; }

    [Name("Apply2_Asst_B")]
    public string StudentItem2Class2AssistantName { get; set; }

    [Name("Apply2_Asst_C")]
    public string StudentItem2Class3AssistantName { get; set; }

    [Name("Apply3_A")]
    public string StudentItem3Class1StudentName { get; set; }

    [Name("Apply3_B")]
    public string StudentItem3Class2StudentName { get; set; }

    [Name("Apply3_C")]
    public string StudentItem3Class3StudentName { get; set; }

    [Name("Apply3_Asst_A")]
    public string StudentItem3Class1AssistantName { get; set; }

    [Name("Apply3_Asst_B")]
    public string StudentItem3Class2AssistantName { get; set; }

    [Name("Apply3_Asst_C")]
    public string StudentItem3Class3AssistantName { get; set; }

    [Name("Apply4_A")]
    public string StudentItem4Class1StudentName { get; set; }

    [Name("Apply4_B")]
    public string StudentItem4Class2StudentName { get; set; }

    [Name("Apply4_C")]
    public string StudentItem4Class3StudentName { get; set; }

    [Name("Apply4_Asst_A")]
    public string StudentItem4Class1AssistantName { get; set; }

    [Name("Apply4_Asst_B")]
    public string StudentItem4Class2AssistantName { get; set; }

    [Name("Apply4_Asst_C")]
    public string StudentItem4Class3AssistantName { get; set; }

    [Name("Apply1_Study_A")]
    public string StudentItem1Study { get; set; }

    [Name("Apply2_Study_A")]
    public string StudentItem2Study { get; set; }

    [Name("Apply3_Study_A")]
    public string StudentItem3Study { get; set; }

    [Name("Apply4_Study_A")]
    public string StudentItem4Study { get; set; }
}

And I read in the CSV file like this:
using (var reader = new StreamReader(_calendarDBPath))
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
{
    var records = csv.GetRecords<CLMExplorerHistory>();

    foreach (var record in records)
    {
        ...

At the moment the CSV record is read into this list of public properties. I wanted to know if it could directly read the fields into a more complex object?
Specifcally, the # Classes field has a value of 1, 2 or 3. And for each of these classes (not C# classes - think school) there is similar data.
There are 4 items per class and the description / study is the same in each class. So these CSV fields are common:
[Name("Apply1_Description")]
[Name("Apply2_Description")]
[Name("Apply3_Description")]
[Name("Apply4_Description")]

[Name("BibleReading_Study_A")]
[Name("Apply1_Study_A")]
[Name("Apply2_Study_A")]
[Name("Apply3_Study_A")]
[Name("Apply4_Study_A")]

But the rest are specific to the 3 Classes (schools):

*

*These fields belong to Class 1:

[Name("BibleReading_A")]
[Name("Apply1_A")]
[Name("Apply1_Asst_A")]
[Name("Apply2_A")]
[Name("Apply2_Asst_A")]
[Name("Apply3_A")]
[Name("Apply3_Asst_A")]
[Name("Apply4_A")]
[Name("Apply4_Asst_A")]

*

*These fields belong to Class 2:

[Name("BibleReading_B")]
[Name("Apply1_B")]
[Name("Apply1_Asst_B")]
[Name("Apply2_B")]
[Name("Apply2_Asst_B")]
[Name("Apply3_B")]
[Name("Apply3_Asst_B")]
[Name("Apply4_B")]
[Name("Apply4_Asst_B")]

*

*These fields belong to Class 3:

[Name("BibleReading_C")]
[Name("Apply1_C")]
[Name("Apply1_Asst_C")]
[Name("Apply2_C")]
[Name("Apply2_Asst_C")]
[Name("Apply3_C")]
[Name("Apply3_Asst_C")]
[Name("Apply4_C")]
[Name("Apply4_Asst_C")]

The 3 Classes ca be represented by 3 "StudentClass" objects in a Lists. Something like
StudentClasses
    NumClasses
    Item1Desc
    Item2Desc
    Item3Desc
    Item4Desc
    BibleReadingStudy
    Item1Study
    Item2Study
    Item3Study
    Item4Study
    List<StudentClass>
           BibleReading
           Item1Student
           Item1Assistant
           Item2Student
           Item2Assistant
           Item3Student
           Item3Assistant
           Item4Student
           Item4Assistant

The above is built from:
StudentClasses
    NumClasses:        # Classes
    Item1Desc:         Apply1_Description
    Item2Desc:         Apply2_Description
    Item3Desc:         Apply3_Description
    Item4Desc:         Apply4_Description
    BibleReadingStudy: BibleReading_Study_A
    Item1Study:        Apply1_Study_A
    Item2Study:        Apply2_Study_A
    Item3Study:        Apply3_Study_A
    Item4Study:        Apply4_Study_A
    List<StudentClass>
           BibleReading    BibleReading_A|B|C
           Item1Student    Apply1_A|B|C
           Item1Assistant  Apply1_Asst_A|B|C
           Item2Student    Apply2_A|B|C
           Item2Assistant  Apply2_Asst_A|B|C
           Item3Student    Apply3_A|B|C
           Item3Assistant  Apply3_Asst_A|B|C
           Item4Student    Apply4_A|B|C
           Item5Assistant  Apply4_Asst_A|B|C

Now you know the mapping between fields to the proposed object. Obviously I can create that C# class myself and I can manually transfer the fields into such a structure. But does CvsReader have the ability to directly read into a class like this? Rather than one big list of properties?

A:
But does CvsReader have the ability to directly read into a class like this? Rather than one big list of properties?

I'd say "yes", though I'm not 100% sure of what you're ultimately hoping to create, but you can get cute with what the properties do. I'll give a simple example.
Suppose we have a CSV that is listing Shops and 3 products that need to be purchased from each shop
Shop,Product1,P1Price,Product2,P2Price,Product3,P3Price
Walmart,Eggs,1,Milk,2,Bread,3
BestBuy,PC,4,iPad,5,iPhone,6

You could have your class that holds the props:
class ShopLine
{
  string Shop {get;set;}
  string Product1 {get;set;}
  string Product2 {get;set;}
  string Product3 {get;set;}
  int P1Price {get;set;}
  int P2Price {get;set;}
  int P3Price {get;set;}
}

But noone has a gun to your head saying the data storage has to be like this.. You could:
class Product
{
  string Name {get;set;}
  int Price {get;set;}
}

class ShopLineTrick
{
  string Shop {get;set;}
  string Product1 {get => products[0].Name; set => products[0].Name= value;}
  string Product2 {get => products[1].Name; set => products[1].Name= value;}
  string Product3 {get => products[2].Name; set => products[2].Name= value;}
  int P1Price {get => products[0].Price; set => products[0].Price = value;}
  int P2Price {get => products[1].Price; set => products[1].Price = value;}
  int P3Price {get => products[2].Price; set => products[2].Price = value;}

  List<Product> products;

  ShopLineTrick(){
     //precreate 3 products
     products = Enumerable.Range(1,3).Select(x => new Product()).ToList();
  }
}

At the end of the operation you have some collection of ShopLineTrick that each contain some built hierarchy of Product; Product are a "reusable class from somewhere else" so this operation is like a parsing and mapping in one. What was a POCO for receiving the data in the file before, has become adevice capable of building the hierarchy of your smaller, reusable classes from somewhere else. You could query with LINQ to get them, for example
shopLines.SelectMany(sl => sl.Products). // a straight list of every product

I've explained using an alternative example because I don't quite yet understand what you're hoping to achieve with the data you have: I'm describing an alternative data storage so you can apply it to further your goal. For a recent project, for example, I had to store every version of a property at some point in time and then let a process I didn't control alter some properties of the object, and then examine what had changed. That was easy to do in a loop, with every one of 10 properties using a single object[10] for its storage. At some point in time I would clone the array, let the process alter stuff and then look for array entries in the current that were different to the cloned copy. Backing the properties with an array made that check (and even reset/accept changes) trivial by looping the arrays

The only thing to watch out for is that some kinds of reading CsvH does, it reuses an object you pass, so if you're e.g. doing an async read just be aware that it could read all the lines of the file and youd end up with only the data from the last one (it would be on you to extract the Products list, and renew it each loop pass to prevent overwriting)

A: This answer is based on the principles in the accepted answer. I felt I would add it as an expanded explanation for my specific scenario. It may help someone else.

Step 1
I designed a set of classes to represent a meeting week:
public class MSAHistoryItemTalk
{
    public string Name { get; set; }
    public string Theme { get; set; }
    public string Method { get; set; }
}
public class MSAHistoryItemStudent
{
    public string Name { get; set; }
    public string Assistant { get; set; }
    public string Type { get; set; }
    public string Study { get; set; }
}

public class MSAHistoryWeek
{
    public DateTime Week { get; set; }
    public bool Meeting { get; set; }
    public int NumClasses { get; set; }
    public string Host { get; set; }
    public string Cohost { get; set; }
    public string Chairman { get; set; }
    public string AuxCounsellor1 { get; set; }
    public string AuxCounsellor2 { get; set; }
    public string PrayerOpen { get; set; }
    public string PrayerClose { get; set; }
    public string CBSConductor { get; set; }
    public string CBSReader { get; set; }
    public List<MSAHistoryItemTalk> TalkItems { get; set; }
    public List<string> Teaching { get; set; }
    public List<string> StudentItemStudyNumbers { get; set; }
    public List<string> StudentItemDescriptions { get; set; }
    public int NumStudentItems { get; set; }
    public List<MSAHistoryItemStudent>[] StudentItems { get; set; }
    public MSAHistoryWeek()
    {
        TalkItems = Enumerable.Range(1, 6).Select(x => new MSAHistoryItemTalk()).ToList();
        Teaching = Enumerable.Range(1, 3).Select(x => string.Empty).ToList();
        StudentItemStudyNumbers = Enumerable.Range(1, 5).Select(x => string.Empty).ToList();
        StudentItemDescriptions = Enumerable.Range(1, 5).Select(x => string.Empty).ToList();
        StudentItems = new List<MSAHistoryItemStudent>[]
        {
            Enumerable.Range(1, 5).Select(x => new MSAHistoryItemStudent()).ToList(),
            Enumerable.Range(1, 5).Select(x => new MSAHistoryItemStudent()).ToList(),
            Enumerable.Range(1, 5).Select(x => new MSAHistoryItemStudent()).ToList(),
        };
    }

    public override string ToString()
    {
        return Week.ToShortDateString();
    }
}

Step 2
I added an instance of the MSAHistoryWeek object to a modified version of the class used with CsvReader:
public class CLMExplorerHistory
{
    [Format("dd/MM/yyyy")]
    [Name("Date")]
    public DateTime Date { get => HistoryWeek.Week; set => HistoryWeek.Week = value; }

    [BooleanFalseValues(new string[] { "N", "n" })]
    [BooleanTrueValues(new string[] { "Y", "y" })]
    [Name("Meeting?")]
    public bool Meeting { get => HistoryWeek.Meeting; set => HistoryWeek.Meeting = value; }

    [Name("# Classes")]
    public int Classes { get => HistoryWeek.NumClasses; set => HistoryWeek.NumClasses = value; }

    [Name("Chairman")]
    public string Chairman { get => HistoryWeek.Chairman; set => HistoryWeek.Chairman = value; }

    [Name("AuxCounselor B")]
    public string AuxCounsellor1 { get => HistoryWeek.AuxCounsellor1; set => HistoryWeek.AuxCounsellor1 = value; }

    [Name("AuxCounselor C")]
    public string AuxCounsellor2 { get => HistoryWeek.AuxCounsellor2; set => HistoryWeek.AuxCounsellor2 = value; }

    [Name("PrayerOpen")]
    public string PrayerOpen { get => HistoryWeek.PrayerOpen; set => HistoryWeek.PrayerOpen = value; }

    [Name("PrayerClose")]
    public string PrayerClose { get => HistoryWeek.PrayerClose; set => HistoryWeek.PrayerClose = value; }

    [Name("CBS")]
    public string CBSConductor { get => HistoryWeek.CBSConductor; set => HistoryWeek.CBSConductor = value; }

    [Name("CBS_Read")]
    public string CBSReader { get => HistoryWeek.CBSReader; set => HistoryWeek.CBSReader = value; }

    [Name("TreasuresTalk")]
    public string TreasuresTalkName { get => HistoryWeek.TalkItems[0].Name; set => HistoryWeek.TalkItems[0].Name = value; }

    [Name("TreasuresTalk_Theme")]
    public string TreasuresTalkTheme { get => HistoryWeek.TalkItems[0].Theme; set => HistoryWeek.TalkItems[0].Theme = value; }

    [Name("TreasuresDigging")]
    public string SpiritualGemsName { get => HistoryWeek.TalkItems[1].Name; set => HistoryWeek.TalkItems[1].Name = value; }

    [Name("LivingPart1")]
    public string LivingPart1Name { get => HistoryWeek.TalkItems[3].Name; set => HistoryWeek.TalkItems[3].Name = value; }

    [Name("LivingPart1_Theme")]
    public string LivingPart1Theme { get => HistoryWeek.TalkItems[3].Theme; set => HistoryWeek.TalkItems[3].Theme = value; }

    [Name("LivingPart2")]
    public string LivingPart2Name { get => HistoryWeek.TalkItems[4].Name; set => HistoryWeek.TalkItems[4].Name = value; }

    [Name("LivingPart2_Theme")]
    public string LivingPart2Theme { get => HistoryWeek.TalkItems[4].Theme; set => HistoryWeek.TalkItems[4].Theme = value; }

    [Name("BibleReading_A")]
    public string BibleReadingClass1Name { get => HistoryWeek.StudentItems[0][0].Name; set => HistoryWeek.StudentItems[0][0].Name = value; }

    [Name("BibleReading_B")]
    public string BibleReadingClass2Name { get => HistoryWeek.StudentItems[1][0].Name; set => HistoryWeek.StudentItems[1][0].Name = value; }

    [Name("BibleReading_C")]
    public string BibleReadingClass3Name { get => HistoryWeek.StudentItems[2][0].Name; set => HistoryWeek.StudentItems[2][0].Name = value; }

    [Name("BibleReading_Study_A")]
    public string BibleReadingStudy { get => HistoryWeek.StudentItemStudyNumbers[0]; set => HistoryWeek.StudentItemStudyNumbers[0] = value; }

    [Name("Apply1_Description")]
    public string StudentItem1Description { get => HistoryWeek.StudentItemDescriptions[1]; set => HistoryWeek.StudentItemDescriptions[1] = value; }

    [Name("Apply2_Description")]
    public string StudentItem2Description { get => HistoryWeek.StudentItemDescriptions[2]; set => HistoryWeek.StudentItemDescriptions[2] = value; }

    [Name("Apply3_Description")]
    public string StudentItem3Description { get => HistoryWeek.StudentItemDescriptions[3]; set => HistoryWeek.StudentItemDescriptions[3] = value; }

    [Name("Apply4_Description")]
    public string StudentItem4Description { get => HistoryWeek.StudentItemDescriptions[4]; set => HistoryWeek.StudentItemDescriptions[4] = value; }

    [Name("Apply1_A")]
    public string StudentItem1Class1StudentName { get => HistoryWeek.StudentItems[0][1].Name; set => HistoryWeek.StudentItems[0][1].Name = value; }

    [Name("Apply1_B")]
    public string StudentItem1Class2StudentName { get => HistoryWeek.StudentItems[1][1].Name; set => HistoryWeek.StudentItems[1][1].Name = value; }

    [Name("Apply1_C")]
    public string StudentItem1Class3StudentName { get => HistoryWeek.StudentItems[2][1].Name; set => HistoryWeek.StudentItems[2][1].Name = value; }

    [Name("Apply1_Asst_A")]
    public string StudentItem1Class1AssistantName { get => HistoryWeek.StudentItems[0][1].Assistant; set => HistoryWeek.StudentItems[0][1].Assistant = value; }

    [Name("Apply1_Asst_B")]
    public string StudentItem1Class2AssistantName { get => HistoryWeek.StudentItems[1][1].Assistant; set => HistoryWeek.StudentItems[1][1].Assistant = value; }

    [Name("Apply1_Asst_C")]
    public string StudentItem1Class3AssistantName { get => HistoryWeek.StudentItems[2][1].Assistant; set => HistoryWeek.StudentItems[2][1].Assistant = value; }

    [Name("Apply2_A")]

    public string StudentItem2Class1StudentName { get => HistoryWeek.StudentItems[0][2].Name; set => HistoryWeek.StudentItems[0][2].Name = value; }

    [Name("Apply2_B")]
    public string StudentItem2Class2StudentName { get => HistoryWeek.StudentItems[1][2].Name; set => HistoryWeek.StudentItems[1][2].Name = value; }

    [Name("Apply2_C")]
    public string StudentItem2Class3StudentName { get => HistoryWeek.StudentItems[2][2].Name; set => HistoryWeek.StudentItems[2][2].Name = value; }

    [Name("Apply2_Asst_A")]
    public string StudentItem2Class1AssistantName { get => HistoryWeek.StudentItems[0][2].Assistant; set => HistoryWeek.StudentItems[0][2].Assistant = value; }

    [Name("Apply2_Asst_B")]
    public string StudentItem2Class2AssistantName { get => HistoryWeek.StudentItems[1][2].Assistant; set => HistoryWeek.StudentItems[1][2].Assistant = value; }

    [Name("Apply2_Asst_C")]
    public string StudentItem2Class3AssistantName { get => HistoryWeek.StudentItems[2][2].Assistant; set => HistoryWeek.StudentItems[2][2].Assistant = value; }

    [Name("Apply3_A")]
    public string StudentItem3Class1StudentName { get => HistoryWeek.StudentItems[0][3].Name; set => HistoryWeek.StudentItems[0][3].Name = value; }

    [Name("Apply3_B")]
    public string StudentItem3Class2StudentName { get => HistoryWeek.StudentItems[1][3].Name; set => HistoryWeek.StudentItems[1][3].Name = value; }

    [Name("Apply3_C")]
    public string StudentItem3Class3StudentName { get => HistoryWeek.StudentItems[2][3].Name; set => HistoryWeek.StudentItems[2][3].Name = value; }

    [Name("Apply3_Asst_A")]
    public string StudentItem3Class1AssistantName { get => HistoryWeek.StudentItems[0][3].Assistant; set => HistoryWeek.StudentItems[0][3].Assistant = value; }

    [Name("Apply3_Asst_B")]
    public string StudentItem3Class2AssistantName { get => HistoryWeek.StudentItems[1][3].Assistant; set => HistoryWeek.StudentItems[1][3].Assistant = value; }

    [Name("Apply3_Asst_C")]
    public string StudentItem3Class3AssistantName { get => HistoryWeek.StudentItems[2][3].Assistant; set => HistoryWeek.StudentItems[2][3].Assistant = value; }

    [Name("Apply4_A")]
    public string StudentItem4Class1StudentName { get => HistoryWeek.StudentItems[0][4].Name; set => HistoryWeek.StudentItems[0][4].Name = value; }

    [Name("Apply4_B")]
    public string StudentItem4Class2StudentName { get => HistoryWeek.StudentItems[1][4].Name; set => HistoryWeek.StudentItems[1][4].Name = value; }

    [Name("Apply4_C")]
    public string StudentItem4Class3StudentName { get => HistoryWeek.StudentItems[2][4].Name; set => HistoryWeek.StudentItems[2][4].Name = value; }

    [Name("Apply4_Asst_A")]
    public string StudentItem4Class1AssistantName { get => HistoryWeek.StudentItems[0][4].Assistant; set => HistoryWeek.StudentItems[0][4].Assistant = value; }

    [Name("Apply4_Asst_B")]
    public string StudentItem4Class2AssistantName { get => HistoryWeek.StudentItems[1][4].Assistant; set => HistoryWeek.StudentItems[1][4].Assistant = value; }

    [Name("Apply4_Asst_C")]
    public string StudentItem4Class3AssistantName { get => HistoryWeek.StudentItems[2][4].Assistant; set => HistoryWeek.StudentItems[2][4].Assistant = value; }

    [Name("Apply1_Study_A")]
    public string StudentItem1Study { get => HistoryWeek.StudentItemStudyNumbers[1]; set => HistoryWeek.StudentItemStudyNumbers[1] = value; }

    [Name("Apply2_Study_A")]
    public string StudentItem2Study { get => HistoryWeek.StudentItemStudyNumbers[2]; set => HistoryWeek.StudentItemStudyNumbers[2] = value; }

    [Name("Apply3_Study_A")]
    public string StudentItem3Study { get => HistoryWeek.StudentItemStudyNumbers[3]; set => HistoryWeek.StudentItemStudyNumbers[3] = value; }

    [Name("Apply4_Study_A")]
    public string StudentItem4Study { get => HistoryWeek.StudentItemStudyNumbers[4]; set => HistoryWeek.StudentItemStudyNumbers[4] = value; }

    [Ignore]
    public MSAHistoryWeek HistoryWeek;

    public CLMExplorerHistory()
    {
        HistoryWeek = new MSAHistoryWeek();
    }
}

As you can see, it follows the principles in the accepted answer, of mapping the public CSV properties to the enhanced MSAHistoryWeek object.

The Result
This refactoring has made it much easier to work with the data (ie. writing to XML).


text:
Q: KML PolyStyle in External Style Sheet? I've been looking at this for so long I can't see it any more.
It looks like valid KML style, the URIs look fine, but it does not work.
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
    <name>Style Test</name>

    <PolyStyle>
        <color>776d8f77</color>
        <outline>0</outline>
    </PolyStyle>

    <PolyStyle id="counties">
        <color>776d8f77</color>
        <outline>0</outline>
    </PolyStyle>

</Document>
</kml>

This file is referenced by KML:
<?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2"><Document>
    <Placemark>
        <name>Viburnum australe US Distribution</name>
        <styleUrl>/_/maps/style.kml#counties</styleUrl>
            <Polygon> ....

Why does neither style get applied?
TIA.....

A: <PolyStyle> style elements are not valid outside the context of a parent <Style> element. A feature (e.g. Placemark) cannot refer to a PolyStyle element directly but via a Style or StypeMap reference or inlined element. Also, use the proper KML namespace URL as http://www.opengis.net/kml/2.2 rather than http://earth.google.com/kml/2.2.
Instead rewrite the "style.kml" file like this:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
    <name>Style Test</name>

    <Style id="s1">
      <PolyStyle>
        <color>776d8f77</color>
        <outline>0</outline>
      </PolyStyle>
    </Style>

    <Style id="counties">
      <PolyStyle>
        <color>776d8f77</color>
        <outline>0</outline>
      </PolyStyle>
    </Style>

</Document>
</kml>

Now a reference to the style will work:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
  <Placemark>
    <name>Viburnum australe US Distribution</name>
    <styleUrl>style.kml#counties</styleUrl>
    <Polygon>....

Google provides an example of a KML document of styles used by other KML files:
http://kml-samples.googlecode.com/svn/trunk/kml/Style/styles.kml
http://kml-samples.googlecode.com/svn/trunk/kml/Style/remote-style.kml

redpajama_set_name: RedPajamaStackExchange


text:
Q: Laravel get most recent date of joined table I'm performing this query with Laravel's query builder with a left join with the two tables linking on the column s_nid. With the table I'm left joining to conference_report there are many rows with one s_nid and I only want to get back the row with the most recent date. I have been looking at Groupwise Maximum with some examples here on SO which is new to me and I think is what I need to complete the query but I'm unsure how to implement it on the table I'm joining to.
$data['students'] = DB::table('educational_report')
        ->select('educational_report.s_nid as s_nid'
                ,'educational_report.name as name'
                ,'educational_report.file_no as file_no'
                ,'educational_report.university as university'
                ,'conference_report.conference_end_date as conference_end_date'
                ,'student_status.status as status')
        ->leftJoin('student_status', 'student_status.s_nid', '=', 'educational_report.s_nid')
        ->leftJoin('conference_report', 'conference_report.s_nid', '=', 'educational_report.s_nid')
        ->distinct()
        ->groupBy('s_nid')
        ->paginate(10);

Possibly useful links:
Performing a Groupwise Maximum in Laravel 4
Groupwise maximum
http://dev.mysql.com/doc/refman/5.6/en/example-maximum-column-group-row.html

A: I think I was over complicating things for no need. I managed to work it out using a nested query on the join as so:
$data['students'] = DB::table('educational_report')
        ->select('educational_report.s_nid as s_nid'
                ,'educational_report.name as name'
                ,'educational_report.file_no as file_no'
                ,'educational_report.university as university'
                ,'cr2.conference_end_date as conference_end_date'
                ,'student_status.status as status')
        ->leftJoin('student_status', 'student_status.s_nid', '=', 'educational_report.s_nid')
        ->leftJoin(DB::raw('(select s_nid, MAX(conference_end_date) conference_end_date
                                from conference_report GROUP BY s_nid) as cr2'), function ($join) {
                                    $join->on ( 'cr2.s_nid', '=', 'educational_report.s_nid' );
                    })
        ->paginate(10);

It appears to be working correctly but I'd be keen for any answers that may correct what I'm doing or provide a better way of doing it. Thanks :)


text:
Q: Adding caption label to UImageView in Collection View I am completely new to iOS development. I have never wrote a piece of code in my life. But I am attempting to follow this tutorial here. I have successfully completed the tutorial, but I am looking to mod the code a little bit.

*

*How can I add a text 'Title' under each Image loaded?

*And also how do i go about changing the colors of the image border
and app background?

ViewController:
import UIKit

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {

    @IBOutlet var collectionView: UICollectionView!

    var galleryItems: [GalleryItem] = []
    var listOfDescriptions = [String]()

    // MARK: -
    // MARK: - View Lifecycle

    override func viewDidLoad() {
        super.viewDidLoad()
        initGalleryItems()
        collectionView.reloadData()
        let value = UIInterfaceOrientation.LandscapeLeft.rawValue
        UIDevice.currentDevice().setValue(value, forKey: "orientation")
    }

    private func initGalleryItems() {

        var items = [GalleryItem]()
        let inputFile = NSBundle.mainBundle().pathForResource("items", ofType: "plist")

        let inputDataArray = NSArray(contentsOfFile: inputFile!)

        for inputItem in inputDataArray as! [Dictionary<String, String>] {
            let galleryItem = GalleryItem(dataDictionary: inputItem)
            items.append(galleryItem)
        }

        galleryItems = items
    }
    private func populateList() {
        listOfDescriptions.append("Valhaha is a flavor");
        listOfDescriptions.append("Unicorns blood is made from dead unicorns. Harry Potter in this bit");
    }
    private func getDescription(position: Int) -> String {
        return listOfDescriptions[position]
    }

    // MARK: -
    // MARK: - UICollectionViewDataSource

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return galleryItems.count
    }

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {

        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("GalleryItemCollectionViewCell", forIndexPath: indexPath) as! GalleryItemCollectionViewCell

        cell.setGalleryItem(galleryItems[indexPath.row])
        return cell

    }

    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }

    func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {

        let commentView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "GalleryItemCommentView", forIndexPath: indexPath) as! GalleryItemCommentView

        commentView.commentLabel.text = "Supplementary view of kind \(kind)"

        return commentView
    }

    // MARK: -
    // MARK: - UICollectionViewDelegate

    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {

        let alert = UIAlertController(title: "didSelectItemAtIndexPath:", message: "Indexpath = \(indexPath)", preferredStyle: .Alert)

        let alertAction = UIAlertAction(title: "Dismiss", style: .Destructive, handler: nil)
        alert.addAction(alertAction)

        self.presentViewController(alert, animated: true, completion: nil)
    }

    // MARK: -
    // MARK: - UICollectionViewFlowLayout

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        let picDimension = self.view.frame.size.width / 4.0
        return CGSizeMake(picDimension, picDimension)
    }

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
        let leftRightInset = self.view.frame.size.width / 14.0
        return UIEdgeInsetsMake(0, leftRightInset, 0, leftRightInset)
    }
}

GalleryItemCollectionCellView:
import UIKit

class GalleryItemCollectionViewCell: UICollectionViewCell {

@IBOutlet var itemImageView: UIImageView!

func setGalleryItem(item:GalleryItem) {
    itemImageView.image = UIImage(named: item.itemImage)
}

}

A: To Change Border color:
imageView.layer.borderColor =  UIColor.anyColor().CGColor

It will change your Image view border color.
Following code will set label on Image View:
var label = UILabel(frame: CGRectMake(x, y, width,hight))
label.center = CGPointMake(160, 284)
label.textAlignment = NSTextAlignment.Center
label.text = "I'am a test label"
self.imageview.addSubview(label)

Here's the Updated Method:
func setGalleryItem(item:GalleryItem)
{
    itemImageView.image = UIImage(named: item.itemImage)
    //This for imageview border color
    itemImageView.layer.borderColor = UIColor.anyColor().CGColor

    //This for setting label in image view
    var label = UILabel(frame: CGRectMake(x, y, width,hight))
    label.center = CGPointMake(160, 284)
    label.textAlignment = NSTextAlignment.Center
    label.text = "I'am a test label"
    itemImageView.addSubview(label)
}

A: With your project you want add label below image view, you should add to cell on storyboard like this:

Drage outlet to cell:

Change setdata function:
func setGalleryItem(item:GalleryItem) {
    itemImageView.image = UIImage(named: item.itemImage)
    itemNameLabel.text = item.itemImage
    self.backgroundColor = UIColor.purpleColor()
}

And in viewController re-calculate size of cell:
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
    let picDimension = self.view.frame.size.width / 4.0
    return CGSizeMake(picDimension, picDimension + 31)
}

depen you want you can change 31 to size of label you want.
I see border you want is background of cell. so add it into the set item above. If you just want border aroud image view: you can use:
func setGalleryItem(item:GalleryItem) {
    itemImageView.image = UIImage(named: item.itemImage)
    itemNameLabel.text = item.itemImage
    self.backgroundColor = UIColor.purpleColor()
    itemImageView.layer.borderColor = UIColor.redColor().CGColor
    itemImageView.layer.borderWidth = 1.0
}

choose the wait you want.
Change color of view you add into viewDidload
  override func viewDidLoad() {
    super.viewDidLoad()
    initGalleryItems()
    collectionView.reloadData()
    self.view.backgroundColor = UIColor.lightGrayColor()//change color view
}

Here is demo from your source:  Demo


text:
Q: Fetching Data From Multiple Facebook API's then Adding Together JQuery Snippet
// THE FOUR URL'S TO ADD THE TOTAL SHARES
var Gal_All = "Link One";
var Gal_S_1 = "Link Two";
var Gal_S_2 = "Link Three";
var Gal_S_3 = "Link Four";

$.ajax({
    type: 'GET',
    url: 'https://graph.facebook.com/' + Gal_All,
    success: function(data) {
        showCount(data);
    }
});

var fbshares;
var fbcomments;

function showCount(responseText) {

    var json = responseText;
    fbshares = json.shares;
    fbcomments = json.comments;

    $('#fb-share-count').html(fbshares);

    if (fbcomments) {
        $('#TotalComments').html(fbcomments + ' comments');
    }

    showTotal();
}

function showTotal() {
    if (!tweets) {
        tweets = 0
    }
    if (!fbshares) {
        fbshares = 0
    }
    if (tweets !== undefined && fbshares !== undefined)
        $('#total-share-count').html(tweets + fbshares);
}

For fetching data from one Facebook API I have achieved however my gallery is split up into four pages (Gal_All = all images and Gal_S_1, Gal_S_2, Gal_S_3 = categorized)
Alike I have achieved with my Twitter counter adding for all four pages, I would like to do for Facebook so it is not showing the shares for that page, but all four of the pages.
Please Note: Comments fetch only needs to be from Gal_All

A: First of all, you can request API data for multiple objects using
/?ids=http://example.com/1,http://example.com/2,http://example.com/3

Now since you want comments as well for your 4th URL, that still needs an extra API request (unless you want to fetch comments for the other three as well, just to throw them away, but that would not make much sense) – but you could use a batch request to at least get those two different API calls done with one single HTTP request. After all, the HTTP request is what takes most of the time in making a request to the API, so if speed is the factor you put the most emphasis on (and why wouldn't you, users don't like to be kept waiting), I think this is the best way to go. (Using a promise might be fine from a pure "aesthetic" point of view, but it doesn't change the fact that multiple HTTP requests are quite slow.)

A: Use a promise:
var count = 0;

$.when(

   $.ajax({
       type: 'GET',
       url: 'https://graph.facebook.com/' + Gal_All,
       success: function(data) {
           count += data;
       }
   });
   $.ajax({
       type: 'GET',
       url: 'https://graph.facebook.com/' + Gal_S_1,
       success: function(data) {
           count += data;
       }
   });
   $.ajax({
       type: 'GET',
       url: 'https://graph.facebook.com/' + Gal_S_2,
       success: function(data) {
           count += data;
       }
   });
   $.ajax({
       type: 'GET',
       url: 'https://graph.facebook.com/' + Gal_S_3,
       success: function(data) {
           count += data;
       }
   });

).then(function() {

  showCount();

});


text:
Q: Infinite family of open subsets of $\mathbb{C}$ Let $I$ be an infinite set. I want to find an infinite family of open subsets $U_i\subset\mathbb{C}$ such that $$\bigcap_{i\in I}U_i = \{0\}.$$
Does such a family of sets exist?

A: If you are looking just for some example of $I$, take $I = \mathbb N $ and $U_n=\left\{z \in \mathbb C \mid |z| < \frac{1}{n}\right\}$.


text:
Q: Android database Application context fails This article shows the different database approaches nicely:
database approaches
I use approach 2: An Application object which holds the single LocalDatabaseAdapter I made. This holds a DatabaseOpenHelper etc.
public class MyApplication extends Application {

private static LocalDbAdapter lDb;

public void onCreate() {
    super.onCreate();
    MyApplication.context = getApplicationContext();
    lbm = LocalBroadcastManager.getInstance(context);
[..]
}
public static LocalDbAdapter getLDb(){
    if(lDb==null){
        lDb = new LocalDbAdapter(context);
    }
    if(lDb.isOpen()){
        return lDb;
    }else{
        return lDb.open();
    }
}
@Override
public void onTerminate() {
    super.onTerminate();
    lDb.close();
}

Now when I start the camera app and then return to my main activity, I get the database never closed error. As it points out, this db was created in the Application context, so why is it a problem that I dont close it in my Activity, I thought that was the idea. An important adavantage of having only one database object is that all methods of LocalDbAdapter that do any writing use the protected(this) statement around the insert or update.
In OnActivityResult, after the camera has taken a picture, I acquire the database like
LocalDbAdapter ldb = MyApplication.getLDb();

This has me seriously bummed out. If I close it in onPause of my MainActivity, I'm afraid that a background service using the same object gets in trouble, and Im even keeping the object local to the onActivityResult...


text:
Q: issues with Clock function C I am having a issue with the clock function. There is an array passed to the function and we are supposed to measure the time it takes to search. I am also doing this with sort functions and it seems to work without a problem. The array passed is presorted.
I am getting results of 0.0000 and -1.9500 as results. The print f for time match. I am reusing this in other functions as the program measures time for 3 sorts, 2 searches, for arrays varying from 10 to 20000 numbers.
// linear search from book
 void linearSearch(int *list, int size, int key) // int key taken out
 {
    //returns the location of key in the list
    // a-1 is returned if value is not found
    int index, found, i;
    clock_t t6 = 0;
    clock_t t7 = 0;
    clock_t diff =0;
    double timefin;
    //float diff;

    index = -1;
    found = FALSE;
    i = 0;
    t6 = clock();
    while (i < size && !found)
    {
            if (list[i] == key)
            {
                    found = TRUE;
                    index = i;
            }
            i++; //Move to the next item
    }
    t7 =clock();
    diff =t7 - t6;
 printf("\nt6: %f", (float)t6);
 printf("\nt7: %f", (float)t7);
    //diff = (((float)t7 - (float)t6) / 1000000.0F );

    printf("\nThe Linear search for %d took %.4f seconds",key, (float)diff);
  //  return(index);
}

full code, using GDB to compile and run on Ubuntu.
#include <stdio.h>
#include <math.h>
#include <ctype.h>
#include <stddef.h>
#include <time.h>
#include <sys/times.h>
#include <stdlib.h>
#include <string.h>
#define TRUE  1
#define FALSE  0
#define randScope 20000

// random number generator
void randNum(int *num, int sizeNum, int maxRand)
{
    int i;
    time_t t;
    srand((unsigned) time(&t));
    for(i=0; i<sizeNum; i++)
    num[i]= rand() % maxRand;
    //return 0;
}

int randOneNum(int maxRand)
{
    int num;
    time_t t;
    srand((unsigned) time(&t));
    num= rand() % maxRand;
    return num;
}

// bubble sort from book
int bubbleSort(int *num, int sizeSort)
{
    int i, j, temp, moves =0;
    clock_t t0 = 0;
    clock_t t1 = 0;
    double timefin;
    clock_t diff;

//      for(i =0; i < 3; i++)
//      printf ("\nStart Numbers %d", num[i]);

    t0 = clock();

    for(i =0; i < (sizeSort -1); i++)
    {
            for(j =0; j < (sizeSort -1); j++)
            {
                    if (num[j] < num [j-1])
                    {
                            temp = num[j];
                            num[j] = num[j-1];
                            num[j-1] = temp;
                            moves++;
                    }
            }
    }
    t1 = clock();
    diff = t1-t0;
    printf("\nt0: %f", (float)t0);
    //diff = (((float)t1 - (float)t0) / 1000000.0F );
//      for(i =0; i < 3; i++)
//      printf ("\nSorted numbers %d", num[i]);

    printf("\nThe Bubble sort for %d numbers took %.4f seconds",sizeSort, (float)diff);

    return (moves);
}

// selection sort from book
int selectionSort(int *num,  int sizeSort)
{
    int i,j, min, minidx, temp,moves = 0;
    clock_t t2 = 0;
    clock_t t3 = 0;
    double timefin;
    clock_t diff;

//      for(i =0; i < 3; i++)
//      printf ("\nStart Numbers %d", num[i]);

    t2 = clock();

    for(i =0; i < (sizeSort -1); i++)
    {
            min = num[i]; /* assume minimum is first element in the sublist */
            minidx=i; /*index*/
            for(j=i+1; j<sizeSort; j++)
            {
                    if (num[j] < min) /* lower value found capture it */
                    {
                            min = num[j];
                            minidx =j;
                    }
            }
            if (min < num[i]) /* check if we have a new min if so swap values*/
            {
                    temp = num[i];
                    num[i] = min;
                    num[minidx] = temp;
                    moves++;
            }
    }
    t3 = clock();
    diff = t3-t2;
printf("\nt2: %f", (float)t2);

    //diff = (((float)t3 - (float)t2) / 1000000.0F );
//      for(i =0; i < 3; i++)
//      printf ("\nSorted numbers %d", num[i]);

    printf("\nThe Selection sort for %d numbers took %.4f seconds",sizeSort,     (float)diff);
    return (moves);
}

//insertion sort from Rostetta code http://rosettacode.org/wiki/Sorting_algorithms/Insertion_sort#C
static void insertion_sort(int *num, int sizeSort)
{
int i, j, value;
    clock_t t4 = 0;
    clock_t t5 = 0;
double timefin;
clock_t diff;

//  for(i =0; i < 3; i++)
//  printf ("\nStart Numbers %d", num[i]);

t4 = clock();

for (i = 1; i < sizeSort; i++) {
    value = num[i];
    for (j = i; j > 0 && value < num[j - 1]; j--) {
        num[j] = num[j - 1];
    }
    num[j] = value;
}
t5 = clock();
diff = t5-t4;
printf("\nt4: %f", (float)t4);

//diff = (((float)t5 - (float)t4) / 1000000.0F );
//  for(i =0; i < 3; i++)
//  printf ("\nSorted numbers %d", num[i]);

printf("\nThe Insertion sort for %d numbers took %.4f seconds",sizeSort, (float)diff);
}

// linear search from book
void linearSearch(int *list, int size, int key) // int key taken out
{
    //returns the location of key in the list
    // a-1 is returned if value is not found
    int index, found, i;
    clock_t t6 = 0;
    clock_t t7 = 0;
    clock_t diff =0;
    double timefin;
    //float diff;

    index = -1;
    found = FALSE;
    i = 0;
    t6 = clock();
    while (i < size && !found)
    {
            if (list[i] == key)
            {
                    found = TRUE;
                    index = i;
            }
            i++; //Move to the next item
    }
    t7 =clock();
    diff =t7 - t6;
printf("\nt6: %f", (float)t6);
printf("\nt7: %f", (float)t7);
    //diff = (((float)t7 - (float)t6) / 1000000.0F );

    printf("\nThe Linear search for %d took %.4f seconds",key, (float)diff);
  //  return(index);
}

// binary search from book
void binarySearch(int *list, int size, int key) // int key taken out
{
    // returns the locations of key in the list if a-1 is returned the value is not found
    int index, found, left,right, midpt;
    clock_t t8 = 0;
    clock_t t9 = 0;
    clock_t start,end;
    struct tms st_cpu;
    struct tms end_cpu;
    double timefin;
    clock_t diff;

    index = -1;
    found = FALSE;
    left = 0;
    right = size-1;

    t8 = clock();

    while(left <= right && !found)
    {
            midpt = (int) ((left + right) /2);
            if (key == list[midpt])
            {
                    found = TRUE;
                    index = midpt;
            }
            else if (key > list[midpt])
                    left = midpt + 1;
            else
                    right = midpt -1;
    }
    t9 = clock();
    diff = t9-t8;

printf("\nt8: %f", (float)t8);

    //diff = (((float)t9 - (float)t8) / 1000000.0F );
    printf("\nThe Binary search for %d took %.4f seconds",key, (float)diff);
   // return index;
}

void main()
{

//  insertion_sort(a, sizeof a / sizeof a[0]);
//10, 50, 100, 500, 1000, 5000, 10000, 15000, 20000

int i;
int key[9];
// Bubble Sort Arrays
int numB10[10];
int numB50[50];
int numB100[100];
int numB500[500];
int numB1000[1000];
int numB5000[5000];
int numB10000[10000];
int numB15000[15000];
int numB20000[20000];

// Selection Sort Arrays
int numS10[10];
int numS50[50];
int numS100[100];
int numS500[500];
int numS1000[1000];
int numS5000[5000];
int numS10000[10000];
int numS15000[15000];
int numS20000[20000];

// Insertion Sort Arrays
int numI10[10];
int numI50[50];
int numI100[100];
int numI500[500];
int numI1000[1000];
int numI5000[5000];
int numI10000[10000];
int numI15000[15000];
int numI20000[20000];

// initialize random array
randNum(numB10000, 10000, 20000);

// Initialize keys for search
key[0]=numB10000[randOneNum(10)];
key[1]=numB10000[randOneNum(50)];
key[2]=numB10000[randOneNum(100)];
key[3]=numB10000[randOneNum(500)];
key[4]=numB10000[randOneNum(1000)];
key[5]=numB10000[randOneNum(5000)];
key[6]=numB10000[randOneNum(10000)];
key[7]=numB10000[randOneNum(15000)];
key[8]=numB10000[randOneNum(20000)];

// Copy array to size 10 arrays
memcpy(numI10, numB10000, 10*sizeof(int));
memcpy(numS10, numB10000, 10*sizeof(int));
memcpy(numB10, numB10000, 10*sizeof(int));

// Copy array to size 50 arrays
memcpy(numI50, numB10000, 50*sizeof(int));
memcpy(numS50, numB10000, 50*sizeof(int));
memcpy(numB50, numB10000, 50*sizeof(int));

// Copy array to size 100 arrays
memcpy(numI100, numB10000, 100*sizeof(int));
memcpy(numS100, numB10000, 100*sizeof(int));
memcpy(numB100, numB10000, 100*sizeof(int));

// Copy array to size 500 arrays
memcpy(numI500, numB10000, 500*sizeof(int));
memcpy(numS500, numB10000, 500*sizeof(int));
memcpy(numB500, numB10000, 500*sizeof(int));

// Copy array to size 1000 arrays
memcpy(numI1000, numB10000, 1000*sizeof(int));
memcpy(numS1000, numB10000, 1000*sizeof(int));
memcpy(numB1000, numB10000, 1000*sizeof(int));

// Copy array to size 5000 arrays
memcpy(numI5000, numB10000, 5000*sizeof(int));
memcpy(numS5000, numB10000, 5000*sizeof(int));
memcpy(numB5000, numB10000, 5000*sizeof(int));

// Copy array to size 10000 arrays
memcpy(numI10000, numB10000, 10000*sizeof(int));
memcpy(numS10000, numB10000, 10000*sizeof(int));
memcpy(numB10000, numB10000, 10000*sizeof(int));

// Copy array to size 15000 arrays
memcpy(numI15000, numB20000, 15000*sizeof(int));
memcpy(numS15000, numB20000, 15000*sizeof(int));
memcpy(numB15000, numB20000, 15000*sizeof(int));

// Copy array to size 20000 arrays
memcpy(numI20000, numB20000, 20000*sizeof(int));
memcpy(numS20000, numB20000, 20000*sizeof(int));

//10
selectionSort(numS10, 10);
bubbleSort(numB10, 10);
insertion_sort(numI10, 10);
linearSearch(numI10, 10, key[0]);
binarySearch(numI10, 10, key[0]);

printf("\n");
//50
selectionSort(numS50, 50);
bubbleSort(numB50, 50);
insertion_sort(numI50, 50);
linearSearch(numI50, 50, key[1]);
binarySearch(numI50, 50, key[1]);

printf("\n");
//100
selectionSort(numS100, 100);
bubbleSort(numB100, 100);
insertion_sort(numI100, 100);
linearSearch(numI100, 100, key[2]);
binarySearch(numI100, 100, key[2]);

printf("\n");
//500
selectionSort(numS500, 500);
bubbleSort(numB500, 500);
insertion_sort(numI500, 500);
linearSearch(numI500, 500, key[3]);
binarySearch(numI500, 500, key[3]);

printf("\n");
//1000
selectionSort(numS1000, 1000);
bubbleSort(numB1000, 1000);
insertion_sort(numI1000, 1000);
linearSearch(numI1000, 1000, key[4]);
binarySearch(numI1000, 1000, key[4]);

printf("\n");
//5000
selectionSort(numS5000, 5000);
bubbleSort(numB5000, 5000);
insertion_sort(numI5000, 5000);
linearSearch(numI5000, 5000, key[5]);
binarySearch(numI5000, 5000, key[5]);

printf("\n");
//10000
selectionSort(numS10000, 10000);
bubbleSort(numB10000, 10000);
insertion_sort(numI10000, 10000);
linearSearch(numI10000, 10000, key[6]);
binarySearch(numI10000, 10000, key[6]);

printf("\n");
//15000
selectionSort(numS15000, 15000);
bubbleSort(numB15000, 15000);
insertion_sort(numI15000, 15000);
linearSearch(numI15000, 15000, key[7]);
binarySearch(numI15000, 15000, key[7]);

printf("\n");
//20000
selectionSort(numS20000, 20000);
bubbleSort(numB20000, 20000);
insertion_sort(numI20000, 20000);
linearSearch(numI20000, 20000, key[8]);
binarySearch(numI20000, 20000, key[8]);

}

Here is the output I'm receiving.
t2: 0.000000
The Selection sort for 10 numbers took 0.0000 seconds
t0: 0.000000
The Bubble sort for 10 numbers took 0.0000 seconds
t4: 0.000000
The Insertion sort for 10 numbers took 0.0000 seconds
t6: 0.000000
t7: 0.000000
The Linear search for 1781 took 0.0000 seconds
t8: 0.000000
The Binary search for 1781 took 0.0000 seconds

t2: 0.000000
The Selection sort for 50 numbers took 0.0000 seconds
t0: 0.000000
The Bubble sort for 50 numbers took 0.0000 seconds
t4: 0.000000
The Insertion sort for 50 numbers took 0.0000 seconds
t6: 0.000000
t7: 0.000000
The Linear search for 1744 took 0.0000 seconds
t8: 0.000000
The Binary search for 1744 took 0.0000 seconds

t2: 0.000000
The Selection sort for 100 numbers took 0.0000 seconds
t0: 0.000000
The Bubble sort for 100 numbers took 0.0000 seconds
t4: 0.000000
The Insertion sort for 100 numbers took 0.0000 seconds
t6: 0.000000
t7: 0.000000
The Linear search for 1744 took 0.0000 seconds
t8: 0.000000
The Binary search for 1744 took 0.0000 seconds

t2: 0.000000
The Selection sort for 500 numbers took 0.0000 seconds
t0: 0.000000
The Bubble sort for 500 numbers took 0.0000 seconds
t4: 0.000000
The Insertion sort for 500 numbers took 0.0000 seconds
t6: 0.000000
t7: 0.000000
The Linear search for 17032 took 0.0000 seconds
t8: 0.000000
The Binary search for 17032 took 0.0000 seconds

t2: 0.000000
The Selection sort for 1000 numbers took 10000.0000 seconds
t0: 10000.000000
The Bubble sort for 1000 numbers took 10000.0000 seconds
t4: 20000.000000
The Insertion sort for 1000 numbers took 0.0000 seconds
t6: 20000.000000
t7: 20000.000000
The Linear search for 8704 took 0.0000 seconds
t8: 20000.000000
The Binary search for 8704 took 0.0000 seconds

t2: 20000.000000
The Selection sort for 5000 numbers took 110000.0000 seconds
t0: 130000.000000
The Bubble sort for 5000 numbers took 400000.0000 seconds
t4: 530000.000000
The Insertion sort for 5000 numbers took 80000.0000 seconds
t6: 610000.000000
t7: 610000.000000
The Linear search for 17877 took 0.0000 seconds
t8: 610000.000000
The Binary search for 17877 took 0.0000 seconds

t2: 610000.000000
The Selection sort for 10000 numbers took 430000.0000 seconds
t0: 1040000.000000
The Bubble sort for 10000 numbers took 1600000.0000 seconds
t4: 2640000.000000
The Insertion sort for 10000 numbers took 330000.0000 seconds
t6: 2970000.000000
t7: 2970000.000000
The Linear search for 3961 took 0.0000 seconds
t8: 2970000.000000
The Binary search for 3961 took 0.0000 seconds

t2: 2970000.000000
The Selection sort for 15000 numbers took 970000.0000 seconds
t0: 3940000.000000
The Bubble sort for 15000 numbers took 2950000.0000 seconds
t4: 6890000.000000
The Insertion sort for 15000 numbers took 0.0000 seconds
t6: 6890000.000000
t7: 6890000.000000
The Linear search for 17877 took 0.0000 seconds
t8: 6890000.000000
The Binary search for 17877 took 0.0000 seconds

t2: 6890000.000000
The Selection sort for 20000 numbers took 1760000.0000 seconds
t0: 8650000.000000
The Bubble sort for 20000 numbers took 5790000.0000 seconds
t4: 14440000.000000
The Insertion sort for 20000 numbers took 0.0000 seconds
t6: 14440000.000000
t7: 14440000.000000
The Linear search for 1074 took 0.0000 seconds
t8: 14440000.000000
The Binary search for 1074 took 0.0000 seconds

A: See this for a description of clock(): http://www.tutorialspoint.com/c_standard_library/c_function_clock.htm
Since the clock_t is in ticks (which are defined by CLOCKS_PER_SEC), your code probably executes in less than a single tick. Try increasing the sort/searches or put the code in a loop and do it, say 10,000 times.


text:
Q: Default folder routes using Microsoft.AspNet.FriendlyUrls webforms I'm starting a new webforms project using Microsoft.AspNet.FriendlyUrls but want to be able to set a default route for a folder. I have a folder called news which contains news.aspx and newsitem.aspx. I'd like to be able to route as follows:
http://sitename/news - Routes to ~/news/news.aspx
http://sitename/news/news - Routes to ~/news/news.aspx
http://sitename/news/newsitem - Routes to ~/news/newsitem.aspx

The second and third routes work using the code below but not http://sitename/news
 public static class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        var settings = new FriendlyUrlSettings();
        settings.AutoRedirectMode = RedirectMode.Permanent;
        routes.EnableFriendlyUrls(settings);

        routes.MapPageRoute("NewsDefault", "news", "~/news/news.aspx");

    }
}

A: Found Solution
Needed to add routes.RouteExistingFiles = true;
public static void RegisterRoutes(RouteCollection routes)
        {
            var settings = new FriendlyUrlSettings();
            settings.AutoRedirectMode = RedirectMode.Permanent;
            routes.EnableFriendlyUrls(settings);
            routes.RouteExistingFiles = true;

            routes.MapPageRoute("NewsDefault", "news", "~/news/news.aspx");
        }


text:
Q: Using Datejs - Get the day of the week I'm using http://www.datejs.com/.
I must be missing it, but is there a way I can pass it the day/month/year and have it tell me that it's a Friday or Monday or whatever?

A: You want:
.toString("dddd");
For example:
> Date.parse("1.16.2012").toString("dddd");
"Monday"

A: If you want to know whether it is a particular day of the week, you could do this:
Date.parse("1.16.2012").is().monday()


text:
Q: how fix a compile problem in tex studio I dont know why my tex give me the messenge: "Error: Could not start the command: Compile & View"
how can i fix it?
edit: my package is:
\documentclass[a4paper,11pt,oneside]{article}

%Digitação de textos em português brasileiro, com codificação utf8
\usepackage{geometry}
\usepackage[affil-it]{authblk}
\usepackage{lmodern}
\usepackage[english,brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
%Informações autorais
\title{\textbf{Relatório 21/04}}
\author{Luiza Camile Rosa da Silva \\ luiza@ime.usp.br}
\date{15/04/2020}

%Pacotes com funções variadas (colunas, cores, gerador de texto, margens menores, identação correta)
\usepackage{multicol, xcolor, lipsum, a4wide, indentfirst,float,longtable}

%Pacotes matemáticos com formatação de números para o Brasil
\usepackage{amsmath, amssymb, amsthm, siunitx,amsfonts,amscd}

\geometry{left=4cm,right=4cm,bottom=4cm,top=4cm}
\sisetup{
    group-separator = {.},
    group-digits = integer,
    group-minimum-digits = 3,
    output-decimal-marker = {,}
}

%Pacotes para uso de figuras
\usepackage{graphicx, psfrag}

%Pacote para geração de PDF's com links (não utilize com o modo DVI, apenas no modo PDF)
%\usepackage[hidelinks]{hyperref}

%Pacotes para referências bibliográficas e índice remissivo
% LEMBRANDO SE PRECISAR DAS NORMAS ABNT NA REFERÊNCIA\usepackage[alf]{abntex2cite}
\usepackage{makeidx}
\newtheorem{teorema}{Teorema}[section]
\newtheorem{definicao}{Definição}[section]
\newtheorem{exemplo}{Exemplo}[section]
\newtheorem{proposicao}{Proposição}[section]
\newtheorem{observacao}{Observação}[section]
\newtheorem{lema}{Lema}[section]
\newtheorem{corolario}{Corolário}[section]
\newtheorem{exercicio}{Exercício}[section]
\newcommand{\R}{\mathbb{R}}
\makeindex

\begin{document}
\end{document}

I knew that the problem isnt the code... And in the log, i just got badboxes...

A: I have encountered the exact same problem twice with TeXstudio 3.0.3. The only way I found to solve this problem in Windows 10 was to reinstall TeXstudio.


text:
Q: Comparing two lines in csv file - Python I am trying to compare two rows in a csv.
For example:
abc, 2, foo, bar, baz
abc, 2, bar,baz, band
cab, 3, baz,bar, foo
cab, 3, baz,bar, foo

Is there way csv module or any module in python to check if the column 1 is same or different.
For example:
in the first two lines, we see 2 and in the third line we see the number 3. is there a way to find that out
The idea behind it is to sum the values corresponding to a particular value in column 1
so,
abc, 2, 10,11,12
abc, 2, 7,8,9
cab, 3, 4,5,6
cab, 3, 1,2,3

I essentially want to sum up the values 12+9 for since it has the same column 1.
and numbers 6 and 3 since the value 3 is same in column 1
To sum it up I am assuming I can create a list with
a=list()

append the value to that list
a.append(float(line[4]))

and use numpy to sum it up
numpy.sum(a)

Could any one please help me figure out a pythonic way to find if the two values are same.

A: Have a look at the pandas library, you can easily aggregate columns based on groups. For example if you have a csv like:
col1,col2,col3,col4,col5
abc,2,10,11,12
abc,2,7,8,9
cab,3,4,5,6
cab,3,1,2,3

You can group and sum based on the values in col2 with just a couple of lines of code:
import pandas as pd
df = pd.DataFrame.from_csv('test.csv')
df.groupby('col2').sum()

Which gives you:
      col3  col4  col5
col2
2       17    19    21
3        5     7     9

A: Something like this:
>>> from collections import Counter
>>> c = Counter()
with open('abc') as f:
    reader = csv.reader(f, delimiter = ',', skipinitialspace = True)
    for row in reader:
        c[row[1]] += int(row[-1])
...
>>> c
Counter({'2': 21, '3': 9})

To find the columns use itertools.groupby:
>>> with open('abc') as f:
    reader = csv.reader(f, delimiter = ',', skipinitialspace = True)
    for k,g in groupby(enumerate(reader), key = lambda x:x[1][1]):
        print k," was common on the rows :",",".join(str(x[0]) for x in g)
...
2  was common on the rows : 0,1
3  was common on the rows : 2,3

A: You could use python group by function
http://docs.python.org/2/library/itertools.html#itertools.groupby
from itertools import groupby
grouped = groupby(data, lambda x: x[1])

this will give you data grouped by the second column.
Then you can get sum for each key by:
for key, values in grouped:
    columnSum = sum(map(lambda x: int(x[4]), values))


text:
Q: 200 ок вместо 404, как исправить или добавить else? Написал скрипт сайта, адреса следующего вида
вася.ру/1234567
Глянул поиск, появилась куча не существующих страниц вида
вася.ру/contact.html
вася.ру/contact/ и много других вариантов, при этом страницы на самом деле не существует но отдается код 200.
Файл .htaccess выглядит так
## Application Handler
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)?$ 2.php?a=$1  [QSA,NC,L]

## Error 404 ##
ErrorDocument 404 /index.php?a=404

Как научить скрипт выставлять 404 ошибку на не существующих страницах?
Сам сайт формируется с помощью cURL запросов, из-за этого и появляется множество не существующих страниц...
Помогите разобраться, спасибо!
Добавил после скрипта который отображает результат с помощью echo $postResult; код ...?> <?php header('HTTP/1.0 404 Not Found'); ?> теперь 404 отдается серверу. Но если страница есть, появляется сообщение об ошибке - header уже был передан т.е. пытается сработать 404, но в результате 200 ок как и нужно. Можно с помощью else сделать, чтобы при ответе 200 ок, 404 не отдавалась? Спасибо!

A: Добавьте в начало своего файла 2.php следующий код:
// в этот массив добавьте ссылки на все несуществующие страницы
$nonExistentPages = array('contact.html', 'contact');
if (in_array($_REQUEST['a'], $nonExistentPages)) {
    header("{$_SERVER['SERVER_PROTOCOL']} 404 Not Found");
    // если нужно выдавать какой-то информационный контент,
    // делайте это здесь.
    exit;
}


text:
Q: How does Facebook auto display the image in the right size depending on user screens? I noticed that when displaying photos from Albums, Facebook on web will cleverly detect your screensize and selects the right thumbnail photo and then selects the right width and height for the img element.
I used the chrome developer tools to look at the natural and displayed width and height of the images in Facebook.
Here is an example of a photo viewed on a 20.41" x 12.8" monitor at 1600x1200 resolution

Notice how it mentions that the image src is _o.jpg suffix and the natural dimensions are 1529x2048 whereas the current image element dimensions are 432 x 578
Here is the same image on a 14 inch macbook air displaying at 1440 x 900 resolution.

This one uses the suffix _n which you cannot see clearly, but you can see that the natural dimensions are 717 x 960 whereas the current image element dimensions are 538 x 720
My reason to find out is to learn the same strategy but to use it for displaying artwork which is in the standard png or jpeg format.
How much of the strategy is implemented using css? How much in javascript?
My questions are:

*

*how does Facebook do this detection?

*How many thumbnails does facebook create for each original photo?

*How does Facebook determine the right width and height for the img element depending on screen size?

I believe Facebook allows a max of 2048by2048 resolution.
Other than that, I am unable to find out more.
This question is also cross-posted in Quora to gain a wider audience.
UPDATE:
I am using cakephp as backend and front end I am relying on jquery and html5 conventions

A: When you stretch the window and therefore change the size of the 'theatre' the image changes size. From this I can only assume the 'theatre' is set to a certain size(s) and the image is set to have a max-width or max-height so it expands or contracts with the size of the outer elements (the theatre). This part is done with CSS.
I think the screen size detection will have something to do with the DOMDimensions ( http://pastebin.com/Biz9ntMj ) and the DimensionTracking ( http://pastebin.com/Ys72APyL ) functions. Also any click is intercepted by the 'primer' ( https://gist.github.com/376039 ) script that then routes the action through AsyncRequest (if needed) and then reacts depending on the JOSN response. My screen size only shows the one size for both the link and final image ( _n.jpg ) but I assume that as if is being handled by javascript then that would be how it would work the sizes out, otherwise (if javascript is off or something) it would just go back to their best guess of a one size fits all of 720 x 960 and then using css as above to force the sizing.
Edit
About the CSS...
With CSS you can set a height (specific or relative to screen size, what ever you fancy) to a block element that contains an image and then set that image to have max-height/width so rather than a defined height/width. That way the image will keep it's aspect ratio but still expand and contract to the allowed size within the container. An example of this can be seen here: http://jsfiddle.net/tV6gG
On the javascript...
When anything is clicked on the page (and javascript is running) it is caught through the 'primer' script mentioned above ( a full version can be seen here - http://pastebin.com/BwhKJ14d ) - (For more info on this see http://www.facebook.com/video/video.php?v=596368660334&ref=mf ). This script then checks the rel attribute of the click event (see line 28) and then decides what to 'bootload' based on that attribute (see line 52). From here it loads up a beast of a function ( http://pastebin.com/eGgtz4dT ) that handles all of the image kind of stuff.
In this script there are a couple of functions that looks like they may have something to do with the image size, one being getCurrentImageServerSizeDimensions (see line 218). There are other about stage sizing and what not too but my guess is that one is important. As far as I know, this script will then compile a load of data and them make a different call to the server than with the regular href.
Unescaped href from source:
http://www.facebook.com/photo.phpfbid=10152228292295554&
set=t.516587895&type=3&src=http://sphotos-g.ak.fbcdn.net/hphotos-ak-
snc7/374008_10152228292295554_643067794_n.jpg&size=720,960&theater

Unescaped actual request sent to pagelet (for more info on pagelets see the above video about BigPipe) maker:
http://www.facebook.com/ajax/pagelet/generic.php/PhotoViewerInitPagelet?
ajaxpipe=1&ajaxpipe_token=AXhGMa1SEXnChIug&no_script_path=1&data=
{"fbid":"10152228292295554","set":"t.516587895","type":"3",
"size":"720,960","theater":null,"firstLoad":true,"ssid":1354797924833}
&__user=6462456246&__a=1&__adt=2

Whilst they do contain most of the same info you can clearly see that the request is being caught and so (if needed) any corrected information (image size) could be sent through that.
With regards to the previous scripts...
The DOMDimensions script is a collection of functions that are pretty well explained by the functions titles to be honest (getElementDimensions, getViewportDimensions, getViewportWithoutScrollbarDimensions, getDocumentDimensions and measureElementBox). For more info on what these individual functions actually do I'd recommend having a look through them and just checking out any basic javascript functions that you don't get. It doesn't look too complicated.
The DimensionTracking script just seems to call the getViewportDimensions() and save the data generated with the /ajax/dimension_context.php page.
If seems to reevalute the dimensions every 100 milliseconds (see line 17), on window resize (see line 18) or on window focus (see line 18).

Over all I think you could do the important stuff (minus the finding actual different images thing) by just using the CSS method above to make a massive image fit the correct stage size.

A: Lots of websites do this kind of thing. I'd step back from focusing too much on exactly how Facebook accomplishes it, and instead on how you can accomplish the same thing.
One way to achieve something similar would be to detect the user agent's screen dimensions, which you can easily do in javascript by checking the Screen object.   After that, your javascript code could update the image links on the page to point to appropriately sized images that've already been generated by your CMS or framework.
In terms of determining the size that the image should be displayed, that is a simple mathematical calculation. Often the template has a bounding box size for where the image is to be displayed, so the image just needs to be scaled down such that its width and height fit within this box.
But this discussion raises the larger point: that if you are developing a website, you're likely using a CMS or at the very least some kind of development framework. It's very likely that whatever platform you're using has a plugin, or module, etc., with image caching and resizing features built in already. You should probably describe what platform you're using so people can better address your situation.

A: CSS can use the @Media selector to determine general width/height. You will not be able to determine the exact width/height with this method. This will give you a rough idea on which elements you might want to display. From this point on you can use relative values in order to resize the img-element.
To determine the exact screensize you would have to use Javascript. In JQuery you can access the width and height of a document.
Facebook might create thumbnails according to their Media selectors' maximum size. When the size img element is resized the browser will automatically resize the image behind. If you have a look at an image from the facebook timeline, you will notice the "_n.jpg" suffix. When you change this to "_a.jpg" you will get a smaller version of this image.

A: Answer to your question number 1:
Facebook image resize is relatively slow. The reason for this is (this is my guess), that they use some javascript/jquery resize. You have bunch of this scripts online.
Now this is bad (if image is large this is slow). The solution for this is to use google developers Closure tools. I spent a lot of time (on several projects where I needed to do exactly what you need) figuring this out. Closure tools (or apache mod_pagespeed ), kills unnecessary pixel from your image making it small (in kb/mb). There was a session from last year Google IO, that is talking about this.
This is a link with that session.
Answer to your question number 2:
I think that they create only two thumbnails.
Answer to your question number 3:
In answer number 1 I wrote that they use some javascript/jquery code for that.
Maybe this is some logic for that:
on window resize {
  make div proportional resize (percent) ->
  this div find image
  image width  height is div width height - offset
}

I am pretty sure that best way to do this resize is not to make millions thumbnails but to optimize original image, to kill pixels from it and that to do that resize with some jquery/javascript plugin.


text:
Q: Filtering data by month from a date field Django I need to write a query that returns all objects in a month list. Month will be calculated from a date field i.e (2012-10-21 or 2011-04-14). When i am doing it for a single month its working fine
**Table.objects.filter(ad_date__month=month)**. assume month = 05
But when i am trying to do it in a list of months its not working.
**Table.objects.filter(ad_date__month__in=month_list)**. assume month_list = [11, 03, 01, 10]
I am getting this error:
"Join on field 'date' not permitted. Did you misspell 'month' for the lookup type?"

It seems Django considers it as a join operation.
Please suggest, i am stuck in this problem from last 2 days.

A: What you are asking for is doable using Q objects.
The following comprehension will create a Q object for every month in your month_list.
(Q(ad_date__month=month) for month in month_list)

All on one line this is now
Table.objects.filter(*(Q(ad_date__month=month) for month in month_list))

EDIT:
You can use the reduce function to "or" all these Q objects together
import operator
q_objects = (Q(ad_date__month=month) for month in month_list)
Table.objects.filter(reduce(operator.or_, q_objects))

A: Hi I know this is not very good but it will work.
from itertools import chain

result_list = []
for mm in month_list:
    this_query = Table.objects.filter(ad_date__month=mm)
    result_list = chain(result_list, this_query)


text:
Q: Jenkins plugin 'Role-Based Strategy' Using Jenkins plugin 'Role-Based Strategy', I need to have user having access ONLY to a project pipeline only.
I added the user under 'Item roles', but user gets error:
'User id' is missing the Overall/Read permission
I am also using ldap, and the user is in ldap, by passes credential page and get error above.
I don't want to grant user global roles (i want user to have only specific access to project).
Any help

A: Jenkins doesn't actually work as a web app or something where you can have roles. They assume that Jenkins will be used by development teams that need access to everything in a project. You can configure users to have access to project or not, but you cannot configure users to have access to specific jobs or not, even pipelines. Jenkins is not created that way and cannot handle your scenario.
You can give that user access to the whole folder (project), or don't give access at all.


text:
Q: Locally Lipschitz? Globally Lipschitz Does this function $$f(x,y) = -\frac{2xy}{(\frac{3}{2}\sqrt{|y|}+1+x^2)} $$
Satisfy the local Lipshitz condition
$$|f(x,y_2)-f(x,y_1)| \leq M|y_2-y_1| $$
for $x,y \in \mathbb{R}$
I have no idea how to approach this. If I come up with something I will post my attempt.

A: Actually if $x\ne 0,$ then $f_y(x,0)$ does not exist because of the pesky term $\sqrt {|y|}.$ Note that $f$ is odd in $y.$ A differentiable odd function $g$ on $\mathbb R$ always satisfies $g'(0)=0.$ But you can see from your own formula for $f_y$ away from the $x$-axis that $\lim_{y\to 0^+} f_y(x,y)$ is nonzero if $x$ is nonzero. Therefore $f_y(x,0)$ does not exist if $x$ is nonzero.
That's not a problem however. After all, on $\mathbb R$ the function $|t|$ is Lipschitz even though the derivative doesn't exist at $0.$ We have the same general phenomenon here.


text:
Q: Combine All Ajax Messages thru one Action I have a website that has a lot of AJAX forms and as it is now I have to make a new js.erb view for each one of them to just post a message that pretty much says completed but is unique to each action.
Is there a way that I can combine or forward one action to a message action in the controller so I would only need one view to handle all the JavaScript messages
Here is what I have:
Controller:
def some_action
    { do some things here }
    respond_to do |format|
      format.js
    end
end

View:
some_action.js.erb
$('#messages').append("<%= escape_javascript(render :partial => 'flash_message') %>");

<% if @error == "True" %>
$('#flash').removeClass().addClass( "error" ).html('<%= escape_javascript(@message) %>');
<% else %>
$('#flash').removeClass().addClass( "success" ).html('<%= escape_javascript(@message) %>');
<% end %>

Would rather have one action in the controller to control all messages when no other changes are necessary.

A: You can abstract that functionality into instance methods, something like this
def ajax_success(message)
  @message = message
  render 'ajax/success'
end

def ajax_failure(message)
  @message = message
  render 'ajax/failure'
end

Then in your controller
def update
  if (successful)
    ajax_success
  else
    ajax_failure
  end
end

You can either define these in your ApplicationController, or in a module that is included in any controllers where you wish to use them.
There are some issues here when you wish to have actions that respond to multiple content types, but for actions that should only respond to .js this should be fine.
Also, I think the standard practice for AJAX responses like this would be to return a JSON message, and then have some javascript function that could decode it and transform the page appropriately.


text:
Q: "Neither Billy nor Suzy look" vs. "neither Billy nor Suzy looks"
Possible Duplicate:
"Neither is" or "neither are"

Say you take a photo of Billy and Suzy, but they both end up looking funny. Would you say

Neither Billy nor Suzy look like themselves?
Neither Billy nor Suzy look/looks like themselves/himself/herself?

I'm confused because usually with singular subjects, I would use a singular verb, saying "Neither Billy nor Suzy is coming to the party," but this sounds off when I refer to the subjects with a pronoun later in the sentence.

A: If you follow the chain of apparently duplicate questions starting with "Neither is" or "neither are", you will find general agreement that Neither...nor takes the singular verb.

Neither Billy nor Suzy looks like...

However none of the other questions address what reflexive pronoun to use.
Because the verb is singular, and the reflexive pronoun needs to refer to the subject of the verb, that should be singular too. So it's either himself or herself. The pedantic answer is that it's himself because a generic masculine term includes the feminine.
However, themselves has become a generic sexless singular reflexive pronoun, and it's doubly convenient here because we are talking about two people who share the characteristic of a bad photograph.

Neither Billy nor Suzy looks like themselves.

On the other hand, because the sentence is so short, using a singular verb in this case with themselves seems really odd. The effect is intensified if you remove "like" to say that Billy didn't "look himself" (ie., "quite as he normally does," or even, "ill") in the photo.

Neither Billy nor Suzy look like themselves.
  Neither Billy nor Suzy look themselves in that photo.

The end result is that you end up either pedant or miscreant. I'd go for the former, but I can understand that the latter is attractive.

Neither Billy nor Suzy looks like himself in that photo.
  Neither Billy nor Suzy look like themselves in that photo.


text:
Q: What makes the player character 'different'? In The Swapper, it is revealed towards the end:

that you the player, are a clone of the Scavenger, created when she first used the Swapper device at the encouragement of the two scientist-brains.

Now for whatever reason, you were jettisoned to the planet, which is where the gameplay begins. The main character (player) is independent right from the start, as you are panicking as the escape pod is launched.
So my question is: What makes you different from the others?

If every other clone is a mindless 'chained' puppet, why are you able to act independently?

I've read all the in-game logs, I didn't notice anything that would explain this.

A: There's no precedent for what happened to your character in-universe.

 If you were originally a clone of the Scavenger, after the Scavenger is "swapped" with the two scientists, there's nobody left for your clone to clone, or follow, as it were.

However, the game also gives no real hint as to how this may affect your character, or even if this is truly what differentiates your character at all, and so below are some purely theoretical events that may have taken place after the key event.

 When the consciousnesses were merged, perhaps the link between the original and you are severed, resulting in A) another version of the Scavenger, trying to finish what they originally started on the derelict vessel, B) an original consciousness potentially based on the Scavenger in some way, affected by the memory loss mentioned in-game and trying to figure out who they are and what to do, or or C) an (almost) empty shell being influenced by the Watchers, trying to get those on the ship to reunite with their brethren on the planet and finally giving the character the choice to live their own life or join the rest of the Watcher's consciousness.

Hopefully this is at least somewhat satisfactory!


text:
Q: How to use SQLSyntaxSupport with a case class containing other case classes I'm trying to use Scalikejbdc's ORM with SQLSyntaxSupport
The table layout is as follows:
create table samples (
    id text
    event_name text
    event_data text
    created_at timestamp
    scope text
)

The classes in Scala are as follows
case class SampleData(id: String, eventName: String, eventData: String)
case class SampleMetadata(createdAt: OffsetDateTime, scope: String)
case class Sample(data: SampleData, metadata: SampleMetadata)

I would like to use SQLSyntaxSupport like so
object SampleSchema extends SQLSyntaxSupport[Sample] {
  override val tableName = "sources"

  override lazy val columns = Seq(
    "id",
    "event_name",
    "event_data",
    "created_at",
    "scope"
  )

  val insertColumns = Seq(
    column.id,
    column.eventName,
    column.eventData,
    column.createdAt,
    column.scope
  )
}

and later be able to do:
  def insert(source: Source): Unit = DB localTx { implicit session =>
      applyUpdate {
        insertInto(SampleSchema)
          .columns(SampleSchema.insertColumns: _*)
          .values(SampleSchema.toInsertValues(session, source): _*)
      }
  }

Code doesn't compile; with errors like
 Sample#eventName not found. Expected fields are #data, #metadata
 column.eventName

Is there a way to make it work without flattening the case class Sample ?


text:
Q: Return nested EF objects in a asmx webservice in c# i'm creating a webservice in C# using Entity Framework to retrive the data.
I have 2 related tables (Person, Role).
Each Person has a Role associated.
I would like that the returned objet is a Person and that the associated Role is included.
If I execute a query like this:
From p in ef.Person.Include("Role") select p

in debug I can see that the Role object for each Person is loaded.
But the returned/generated XML contains only a RoleReference wich gives me information about the related object, but not the object itself.
I tried to add the Serializable attribute to the classes generated by the entity framwork and also the xmlInclude attribute to the webmethod but nothing changes.
How can i solve this problem?
thanks!
Flavio

A: Are you passing the IEnumerable? Try a .ToList() to stop the lazy loading and pass that instead.

A: Create your own classes Person & Role and create for them mappers:
public class MyPerson
{
   [DataMember]
   public int ID {get; set;}
   [DataMember]
   public string Name {get; set;}
   ...
   [DataMember]
   public MyRole PersonRole {get; set;}
}

public class MyRole
{
   [DataMember]
   public int ID {get; set;}
   ...
}

Mapper:
MyRole Mapper(EFRole role)
{
   return new MyRole() {
       id = role.id, ...
   }
}

MyPerson Mapper(EFPerson person)
{
     return new MyPerson() {
         id = person.id,
         ....
         PersonRole = (person.Role != null ? Mapper(person.Role) : null;
     }
}

A: Use a Partial class called Person that includes the Role nested object, or Role needed properties.


text:
Q: Getting java.net.ConnectException: Connection timed out but able to do telnet from the same machine to server I am getting following exception in Java code. But when I do telnet to the same server, it works. Any hint what might the issue?
Caused by: java.net.ConnectException: Connection timed out
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:131)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
    at org.apache.axis.client.Call.invoke(Call.java:2553)
    at org.apache.axis.client.Call.invoke(Call.java:2248)
    at org.apache.axis.client.Call.invoke(Call.java:2171)
    at org.apache.axis.client.Call.invoke(Call.java:1691)
    at se.telenor.cpcextraservices.org.tempuri.BasicHttpBinding_CPCWS2DefStub.getServiceIDsFromAccountID(BasicHttpBinding_CPCWS2DefStub.java:451)
    at customerentrance.model.util.CPCUtil.getServicesForAccountId(CPCUtil.java:198)

    ... 78 more

Caused by: java.net.ConnectException: Connection timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at java.net.Socket.<init>(Socket.java:309)
    at java.net.Socket.<init>(Socket.java:124)
    at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:129)
    at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)

    ... 89 more

A: I think failure is not with your program may be your environment, due to your proxy settings.
TRY this: add -Djava.net.useSystemProxies=true to the run box for your application, or add:
System.setProperty("java.net.useSystemProxies", "true");


text:
Q: Partial Converse to "Pushout of a cofibration is a cofibration" $\require{AMScd} \newcommand{\RP}{\mathbb{RP}}$
I want a converse of this fact specialized to the case where I am pushing out a map BY a fibration:
I.e., if I am given a diagram
$ \begin{CD}
E_1 @>i>> E_2 \\
@V\text{fibration}Vp_1V @Vp_2V\text{fibration}V\\
B_1 @>cofibration>j> B_2 \\
\end{CD}$,
does it follow that $i$ is a cofibration?
I am doing this to prove that the inclusion $F_p E \to F_{p+1} E$ is a cofibration,for the filtration used in the serre spectral sequence.
Edit

When I made this question, I had the misconception that every pushout square was also a pullback square(I will conveniently blame it on a student lecturer in my class who said "this pushout square" when he was referring to a square that was just a pullback square.).  Thus I did not realize that I needed to further specify that the above square be a pullback square.  I am embarrassed to admit it.  But I created a new question with this new condition.

A: In full generality, it's not true, even if $E_1 \to E_2$ is an inclusion. Take $E_1 \to E_2$ to be your favorite inclusion that's not a cofibration and let $B_1 = B_2 = *$.  Then $E_i \to B_i= *$, $i = 1, 2$, are fibrations (every space is fibrant), the identity $B_1 \to B_2$ is a cofibration, and the diagram commutes, but $E_1 \to E_2$ is not a cofibration by construction.
However, if $E_1$ and $E_2$ are CW complexes, then it's probably true, since every (cellular) inclusion of CW complexes is a cofibration.

EDIT: The example I gave above ignores the "pushout" condition.  If we assume (per OP's comment) that the square is a pullback, then the answer seems to be affirmative.  See theorem 14.1 in Strom's Modern Classical Homotopy Theory.


text:
Q: Return RedirectToAction in MVC using async & await I want to return an action using Async and await functionality in dot net 4.5.
I have used the following code.
public async Task<ActionResult> DisplayDashboard()
    {
        await Task.Run(() =>
        {
            if (true)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                return RedirectToAction("Error", "Home");
            }
        });
    }

Its giving following error,
"Cannot convert lambda expression to delegate type 'System.Action' because some of the return types in the block are not implicitly convertible to the delegate return type".
Can anybody please suggest me how to perform RedirectToAction using Task.

A: Why do you need this code async? If all you need is to make this method return a Task to satisfy some interface requirement, then use:
public Task<ActionResult> DisplayDashboard()
{
        ActionResult result;
        if (true)
        {
            result = RedirectToAction("Index", "Home");
        }
        else
        {
            result = View("Index");
        }
        return Task.FromResult(result);
    }

Task.Run() would actually use a different thread to the code you pass into it.  It doesn't seem that you need to do that here.

A:     public async Task<ActionResult> DisplayDashboard()
    {
        return await Task.Run<ActionResult>(() =>
        {
            if (true)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                return View("Index");
            }
        });
    }

A: This is old but is the first result returned from Google so worth correcting. The return from RedirectToAction() or View() cannot be continued so why await the results. Therefore there is no need to artificially Task.Run() only to await it. The async keyword will already lift any returns into a Task. The resulting code is cleaner.
public async Task<ActionResult> DisplayDashboard()
{
    if (true)
    {
        return RedirectToAction("Index", "Home");
    }
    else
    {
        return View("Error");
    }
}


text:
Q: Sublime Text 3 - jQuery highlighted error I am teaching myself jQuery for flexibility in the work SharePoint environment. I have added this file to the proper destination within SharePoint (and everything seems to be working), but I am still showing some weird highlighting in Sublime Text 3.
Attached is an image of the code in ST3:

Is my syntax correct on source #2? I really do not want to miss anything, though this is quite a small amount of code (forgive me for syntax within the post as I am still getting the hang of it)

<script src = "https://mysite/teams/spe/Style%20Library/tts/jquery-3.3.1.min.js"></script>

<script src = "https://mysite/teams/spe/Style%20Library/tts/sputility.js" > < /script>

  <script>
  // wait for the window to load
  $(document).ready(function() {
    // Get a single select dropdown field
    var ticketType = SPUtility.GetSPField('Ticket Type');

    // create a function to show or hide Priority based on Project's value
    var showOrHideField = function() {
      var ticketTypeValue = ticketType.GetValue();
      // Hide the Priority field if the selected
    }
    value is Project
    if (ticketTypeValue === 'Project') {
      SPUtility.HideSPField('Priority');
    } else {
      SPUtility.ShowSPField('Priority');
    };

    // run at startup (for edit form)
    showOrHideField();

    // make sure if the user changes the value we handle it
    $(ticketType.Dropdown).on('change', showOrHideField);

    //hide Category field from NewForm
    SPUtility.HideSPField('Category')

    //hide issue status field from NewForm
    SPUtility.HideSPField('Issue Status')

    //hide comments field from NewForm
    SPUtility.HideSPField('Comments')
  });

</script>

A: Assuming you're talking about the pink syntax highlighting, your script URLs in line 1 and line 2 has a literal space and since URLs can't have literal spaces, it is converted to its ASCII code i.e. %20.
Just replace the %20 with + and it should remove the syntax error highlighting.

Since URLs often contain characters outside the ASCII set, the URL has
  to be converted into a valid ASCII format. URL encoding replaces
  unsafe ASCII characters with a "%" followed by two hexadecimal digits.
  URLs cannot contain spaces. URL encoding normally replaces a space
  with a plus (+) sign or with %20.
Via - URL Encode

If you have access to the website's files and folders, I would recommend checking if the folder Style%20Library has a folder name of Style Library or not and if that is the case, rename it to StyleLibrary and remove the %20 from your script urls.
UPDATE:
And assuming you're talking about the script tags syntax color highlighting, well if you change the syntax highlight settings for Sublime Text 3 to HTML, the weird highlight disappears.
It will obviously look weird in js because a js file shouldn't have <script</script> tags nor the script links in line 1 and line 2 in the first place and you should remove them from your js file.

tldr: Change the syntax highlight settings to HTML in View > Syntax > HTML if this is an html file ior remove the script tags and script links if this is a JS file. Also, avoid literal spaces in folder names and use camelCase writing if you really have to have word distinctions in folder names.

A: You have invalid javascript as well, looks like you were going for this
var showOrHideField = function() {
  var ticketTypeValue = ticketType.GetValue();
  // Hide the Priority field if the selected value is Project
  if (ticketTypeValue === 'Project') {
      SPUtility.HideSPField('Priority');
  } else {
      SPUtility.ShowSPField('Priority');
  }
}


text:
Q: Reactjs and SCSS - how to write height: selfheight x 2 I want to double the height of the div every time it is clicked.
I am thinking to apply a additional CSS class to a div when ever I click a button. The CSS concept will be like:
#divToBeDoubled {
    height: 100px;

    &.doubleHeight{
        height: selfHeight*2
    }
}

How can I achieve this by using Reactjs and SCSS?

A: I think if you want to change a css value with the component state, you need to move the property you want to change in you component or use JSS...
to move the property in the render, you can do this :
class MyComponent extends React.Component{

  state = {
    divHeight : 100
  }

  doubleSize = ()=>{
    this.setState({ divHeight : this.state.divHeight * 2 })
  }

  render() {

    const style = {
      height: this.state.divHeight
    };

    return (

Content

    );
  }

}

A: If using sass. You can use this, and toggle class in JSX onclick event.
$height: 100px;
.normal {
    height: $height;
}
.double {
    height: $height * 2;
}


text:
Q: How to get different destination files with out overwriting in a folder using Flat file destination in SSIS Requirement : There are 2 excel files in a Folder A which needs to be loaded  in the database table separately ( using For Each loop container and database table is truncated each time the data is loaded)and after doing some calculations export  the data to the Folder B using flatfile destination.
Issue:when the first file was processed successfully  In the Folder B there will be a destination file.
For Example:
TestFile_+  RIGHT( 0  + (DT_WSTR,2)DATEPART( mm ,GetDate()) ,2) +RIGHT( 0  + (DT_WSTR,2)DATEPART( dd ,GetDate()),2) + (DT_WSTR,4)DATEPART( yyyy ,GetDate())  +RIGHT( 0  + (DT_WSTR,2)DATEPART( hh ,GetDate()),2)+RIGHT( 0  + (DT_WSTR,2)DATEPART( mi ,GetDate()),2) + .txt
When the second file was processed, it will append the data to the existing file ( If we uncheck the "Overwrite data in the file" in the Flat file destination editor) or it will overwrite the data in the existing file (If we check the "Overwrite data in the file" in the Flat file destination editor)
My question is, How to get the 2 different  destination files in the Folder B.
Any help is greatly appreciated.

A: Give the second file a different name from the first one, and you will get two different files.


text:
Q: Getting contacts of all the users with domain level accesToken in azure Is there a way , where we could get/write the contacts of all the users in a domain with a domain level access token.
Currently I found that we could get the domain level access token for the organization using admin consent.
But this access token will not have any details about the user.
So how do we specify for which user , we are trying to get the contacts ?
Is there a way , where we can use the tenant-id and the user-id to get the  user specific access token without having him signed in even once but with an admin consent ?

A: Did 'domain level access token' means you check the application permission to read the all contacts information like figure below:

The Office 365 API and Microsoft Graph API support get the personal contacts. The difference between the token get from "Authorization Code Grant Flow" and "Client Credentials" is that we need to specify the user context via the ID or userPrincipalName instead of the alias me:
REST API:
GET /me/contacts
GET /users/<id | userPrincipalName>/contacts

Sample Request:
GET /Users/fx@msdnofficedev.onmicrosoft.com/contacts

And if you were developing a single tenant scenario, since the application already register on the Azure AD tenant, there is no need to give the consent again.
Otherwise if you were developing an muti-tenant application, when the app run the first time, the user need admin privilege to give the consent for the application for "Read contacts in all mailboxes".
More detail about Microsoft Graph permission scopes, you can refer to link below:
https://graph.microsoft.io/en-us/docs/authorization/permission_scopes