Records the daily datatables
198650
private function insertDayReports()
    {
        foreach ($this->arrays as $recordName => $dataArray) {

            $dataTable = $dataArray->asDataTable();

            foreach ($dataTable->getRows() as $row) {
                $label = $row->getColumn('label');

                if (!empty($this->metadata[$label])) {
                    foreach ($this->metadata[$label] as $name => $value) {
                        $row->addMetadata($name, $value);
                    }
                }

            }
            $blob = $dataTable->getSerialized(
                $this->maximumRowsInDataTable,
                $this->maximumRowsInSubDataTable,
                $this->columnToSortByBeforeTruncation);
            $this->getProcessor()->insertBlobRecord($recordName, $blob);
        }
    }
190025
function () {
      var rowCounts = new Uint32Array(nrows);
      var columnCounts = new Uint32Array(ncols);
      for (var i = 0; i < nrows; i++) {
        var obj = matrix[i];
        if (obj.values != null) {
          // trim to size
          var values = new Uint16Array(obj.length);
          var indices = new Uint32Array(obj.length);
          values.set(obj.values.slice(0, obj.length));
          indices.set(obj.indices.slice(0, obj.length));
          matrix[i] = {values: values, indices: indices};
          rowCounts[i] = values.length;
          for (var j = 0; j < obj.length; j++) {
            columnCounts[indices[j]] += 1;
          }
        }
      }
      dataset = new morpheus.Dataset({
        rows: nrows, columns: ncols, name: morpheus.Util.getBaseFileName(morpheus.Util
          .getFileName(fileOrUrl)), array: matrix, dataType: dataType, defaultValue: 0
      });

      dataset.getRowMetadata().add('count>0').array = rowCounts;
      dataset.getColumnMetadata().add('count>0').array = columnCounts;
    }
622392
def classes_for_day(day)
      classes = Tableau::ClassArray.new

      @modules.each do |mod|
        cfd = mod.classes_for_day(day)
        cfd.each { |cl| classes << cl } if cfd
      end

      classes.count > 0 ? classes : nil
    end
1221988
def get_stats_daily(start=None, end=None, last=None, **kwargs):
    
    import warnings
    warnings.warn(WNG_MSG % ("get_stats_daily", "iexdata.get_stats_daily"))
    start, end = _sanitize_dates(start, end)
    return DailySummaryReader(start=start, end=end, last=last,
                              **kwargs).fetch()
1063499
private function setPastTotalVisitsMetadata($dataTable, $pastTable)
    {
        if ($pastTable instanceof DataTable) {
            $total  = 0;
            $metric = 'nb_visits';

            $rows = $pastTable->getRows();
            $rows = $this->filterRowsForTotalsCalculation($rows);

            foreach ($rows as $row) {
                $total += $row->getColumn($metric);
            }

            $dataTable->setMetadata(self::getTotalMetadataName($metric . '_lastdate'), $total);
        }
    }
450293
def daily_occurrences(self, dt=None):
        '''
        
        '''
        return Occurrence.objects.daily_occurrences(dt=dt, event=self)
79377
private void processCalendarDays(ProjectCalendar calendar, Record root)
   {
      // Retrieve working hours ...
      Record daysOfWeek = root.getChild("DaysOfWeek");
      if (daysOfWeek != null)
      {
         for (Record dayRecord : daysOfWeek.getChildren())
         {
            processCalendarHours(calendar, dayRecord);
         }
      }
   }
1348250
def _get_history_daily_window(self,
                                  assets,
                                  end_dt,
                                  bar_count,
                                  field_to_use,
                                  data_frequency):
        
        session = self.trading_calendar.minute_to_session_label(end_dt)
        days_for_window = self._get_days_for_window(session, bar_count)

        if len(assets) == 0:
            return pd.DataFrame(None,
                                index=days_for_window,
                                columns=None)

        data = self._get_history_daily_window_data(
            assets, days_for_window, end_dt, field_to_use, data_frequency
        )
        return pd.DataFrame(
            data,
            index=days_for_window,
            columns=assets
        )
1171199
def _get_daily_message(self, dt, algo, metrics_tracker):
        
        perf_message = metrics_tracker.handle_market_close(
            dt,
            self.data_portal,
        )
        perf_message['daily_perf']['recorded_vars'] = algo.recorded_vars
        return perf_message
377555
private void readCalendars()
   {
      Table cal = m_tables.get("CAL");
      for (MapRow row : cal)
      {
         ProjectCalendar calendar = m_projectFile.addCalendar();
         m_calendarMap.put(row.getInteger("CALENDAR_ID"), calendar);
         Integer[] days =
         {
            row.getInteger("SUNDAY_HOURS"),
            row.getInteger("MONDAY_HOURS"),
            row.getInteger("TUESDAY_HOURS"),
            row.getInteger("WEDNESDAY_HOURS"),
            row.getInteger("THURSDAY_HOURS"),
            row.getInteger("FRIDAY_HOURS"),
            row.getInteger("SATURDAY_HOURS")
         };

         calendar.setName(row.getString("NAME"));
         readHours(calendar, Day.SUNDAY, days[0]);
         readHours(calendar, Day.MONDAY, days[1]);
         readHours(calendar, Day.TUESDAY, days[2]);
         readHours(calendar, Day.WEDNESDAY, days[3]);
         readHours(calendar, Day.THURSDAY, days[4]);
         readHours(calendar, Day.FRIDAY, days[5]);
         readHours(calendar, Day.SATURDAY, days[6]);

         int workingDaysPerWeek = 0;
         for (Day day : Day.values())
         {
            if (calendar.isWorkingDay(day))
            {
               ++workingDaysPerWeek;
            }
         }

         Integer workingHours = null;
         for (int index = 0; index < 7; index++)
         {
            if (days[index].intValue() != 0)
            {
               workingHours = days[index];
               break;
            }
         }

         if (workingHours != null)
         {
            int workingHoursPerDay = countHours(workingHours);
            int minutesPerDay = workingHoursPerDay * 60;
            int minutesPerWeek = minutesPerDay * workingDaysPerWeek;
            int minutesPerMonth = 4 * minutesPerWeek;
            int minutesPerYear = 52 * minutesPerWeek;

            calendar.setMinutesPerDay(Integer.valueOf(minutesPerDay));
            calendar.setMinutesPerWeek(Integer.valueOf(minutesPerWeek));
            calendar.setMinutesPerMonth(Integer.valueOf(minutesPerMonth));
            calendar.setMinutesPerYear(Integer.valueOf(minutesPerYear));
         }
      }
   }
313678
def build_calendar_etc(pfeed):
    
    windows = pfeed.service_windows.copy()

    # Create a service ID for each distinct days_active field and map the
    # service windows to those service IDs
    def get_sid(bitlist):
        return 'srv' + ''.join([str(b) for b in bitlist])

    weekdays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday',
      'saturday', 'sunday']
    bitlists = set()

    # Create a dictionary <service window ID> -> <service ID>
    d = dict()
    for index, window in windows.iterrows():
        bitlist = window[weekdays].tolist()
        d[window['service_window_id']] = get_sid(bitlist)
        bitlists.add(tuple(bitlist))
    service_by_window = d

    # Create calendar
    start_date = pfeed.meta['start_date'].iat[0]
    end_date = pfeed.meta['end_date'].iat[0]
    F = []
    for bitlist in bitlists:
        F.append([get_sid(bitlist)] + list(bitlist) +
          [start_date, end_date])
    calendar = pd.DataFrame(F, columns=(
      ['service_id'] + weekdays + ['start_date', 'end_date']))

    return calendar, service_by_window
291173
async def on_date(self, date: datetime.date) -> dict:
        """"""
        return await self._request(
            'get', 'dailystats/{0}'.format(date.strftime('%Y-%m-%d')))
535990
function record_data(e) {
  var lock = LockService.getDocumentLock();
  lock.waitLock(30000); // hold off up to 30 sec to avoid concurrent writing
  
  try {
    Logger.log(JSON.stringify(e)); // log the POST data in case we need to debug it
    
    // select the 'responses' sheet by default
    var doc = SpreadsheetApp.getActiveSpreadsheet();
    var sheetName = e.parameters.formGoogleSheetName || "responses";
    var sheet = doc.getSheetByName(sheetName);
    
    var oldHeader = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
    var newHeader = oldHeader.slice();
    var fieldsFromForm = getDataColumns(e.parameters);
    var row = [new Date()]; // first element in the row should always be a timestamp
    
    // loop through the header columns
    for (var i = 1; i < oldHeader.length; i++) { // start at 1 to avoid Timestamp column
      var field = oldHeader[i];
      var output = getFieldFromData(field, e.parameters);
      row.push(output);
      
      // mark as stored by removing from form fields
      var formIndex = fieldsFromForm.indexOf(field);
      if (formIndex > -1) {
        fieldsFromForm.splice(formIndex, 1);
      }
    }
    
    // set any new fields in our form
    for (var i = 0; i < fieldsFromForm.length; i++) {
      var field = fieldsFromForm[i];
      var output = getFieldFromData(field, e.parameters);
      row.push(output);
      newHeader.push(field);
    }
    
    // more efficient to set values as [][] array than individually
    var nextRow = sheet.getLastRow() + 1; // get next row
    sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);

    // update header row with any new data
    if (newHeader.length > oldHeader.length) {
      sheet.getRange(1, 1, 1, newHeader.length).setValues([newHeader]);
    }
  }
  catch(error) {
    Logger.log(error);
  }
  finally {
    lock.releaseLock();
    return;
  }

}
1121037
function(rowIndex) {

      if(!this.dialog) {
         this.renderDialog();
      }

      // NOT Inserting new record
		this.insertNewRecord = false;
		
		// Set the selected Record
		this.selectedRecord = rowIndex;
		
		// Get the selected Record
		var record = this.datatable.getRecord(this.selectedRecord);
		
		this.dialog.whenFormAvailable({
			fn: function() {
				this.dialog.setValue(record.getData());
				this.dialog.show();
			},
			scope: this
		});
		
	}
1325570
private void processCalendarHours(ProjectCalendar calendar, Record dayRecord)
   {
      // ... for each day of the week
      Day day = Day.getInstance(Integer.parseInt(dayRecord.getField()));
      // Get hours
      List<Record> recHours = dayRecord.getChildren();
      if (recHours.size() == 0)
      {
         // No data -> not working
         calendar.setWorkingDay(day, false);
      }
      else
      {
         calendar.setWorkingDay(day, true);
         // Read hours
         ProjectCalendarHours hours = calendar.addCalendarHours(day);
         for (Record recWorkingHours : recHours)
         {
            addHours(hours, recWorkingHours);
         }
      }
   }
1258359
synchronized void record(TagContext tags, MeasureMapInternal stats, Timestamp timestamp) {
    Iterator<Measurement> iterator = stats.iterator();
    Map<String, AttachmentValue> attachments = stats.getAttachments();
    while (iterator.hasNext()) {
      Measurement measurement = iterator.next();
      Measure measure = measurement.getMeasure();
      if (!measure.equals(registeredMeasures.get(measure.getName()))) {
        // unregistered measures will be ignored.
        continue;
      }
      Collection<MutableViewData> viewDataCollection = mutableMap.get(measure.getName());
      for (MutableViewData viewData : viewDataCollection) {
        viewData.record(
            tags, RecordUtils.getDoubleValueFromMeasurement(measurement), timestamp, attachments);
      }
    }
  }
551561
function logTabularData( data ) {
      if( win.console.table ) {
         win.console.table( data );
      }
      else {
         consoleLog( JSON.stringify( data, null, 2 ) );
      }
   }