text:
module API::V1
  class SolutionCategoriesController < BackendController
    respond_to :json
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

Click this link.
   Once you see "method = GET,..." in the page, go back to this page using the Backward button, and then go to the second page using the Forward button.
   You should see "method = GET, isHistoryNavigation = true".


text:
@implementation LocationShareModel

//Class method to make sure the share model is synch across the app
+ (id)sharedModel
{
    static id sharedMyModel = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedMyModel = [[self alloc] init];
    });
    return sharedMyModel;
}

@end


text:
ROOT = ../../../../..

DIR = Providers/ManagedSystem/UNIXProviders/EthernetPortStatistics

include $(ROOT)/mak/config.mak

LIBRARY = UNIX_EthernetPortStatistics

EXTRA_INCLUDES += -I/usr/local/include -I./..

SOURCES = \
	../CIMHelper.cpp \
	UNIX_EthernetPortStatistics.cpp \
	UNIX_EthernetPortStatisticsProvider.cpp \
	UNIX_EthernetPortStatisticsMain.cpp
ifeq ($(OS), aix)
	SOURCES += UNIX_EthernetPortStatistics_AIX.cpp
endif
ifeq ($(OS), darwin)
	SOURCES += UNIX_EthernetPortStatistics_DARWIN.cpp
endif
ifeq ($(OS), freebsd)
	SOURCES += UNIX_EthernetPortStatistics_FREEBSD.cpp
endif
ifeq ($(OS), hpux)
	SOURCES += UNIX_EthernetPortStatistics_HPUX.cpp
endif
ifeq ($(OS), linux)
	SOURCES += UNIX_EthernetPortStatistics_LINUX.cpp
endif
ifeq ($(OS), solaris)
	SOURCES += UNIX_EthernetPortStatistics_SOLARIS.cpp
endif
ifeq ($(OS), tru64)
	SOURCES += UNIX_EthernetPortStatistics_TRU64.cpp
endif
ifeq ($(OS), vms)
	SOURCES += UNIX_EthernetPortStatistics_VMS.cpp
endif
ifeq ($(OS), win32)
	SOURCES += UNIX_EthernetPortStatistics_WIN32.cpp
endif
ifeq ($(OS), zos)
	SOURCES += UNIX_EthernetPortStatistics_ZOS.cpp
endif
ifeq (, $(filter aix,darwin,freebsd,hpux,linux,solaris,tru64,vms,win32,zos $(OS)))

else
	SOURCES += UNIX_EthernetPortStatistics_STUB.cpp
endif

LIBRARIES = \
	pegprovider \
	pegclient \
	pegcommon \
	pegquerycommon \
	pegqueryexpression \
	pegcql \
	pegwql

EXTRA_LIBRARIES = \
	-pthread \
	-lutil \
	-lgeom \
	-lkvm \
	-lcam

include $(ROOT)/mak/dynamic-library.mak


text:
package org.springframework.security.integration;

public class StubUserRepository implements UserRepository {

	public void doSomething() {
	}
}


text:
#include "WeatherData.h"
#include "units.h"
#include "math.h"
#include "WeatherSink.h"

/* Solar Constant - The solar constant is the amount of energy received at the
 * top of the Earth's atmosphere on a surface oriented perpendicular to the
 * Sun.s rays (at the mean distance of the Earth from the Sun). The generally
 * accepted solar constant of 1368 W/m2 is a satellite measured yearly
 * average. */
/* http://edmall.gsfc.nasa.gov/inv99Project.Site/Pages/science-briefs/ed-stickler/ed-irradiance.html
 */
#define MAX_SOLAR (1368)

using namespace std;

WeatherData::WeatherData( Config _cfg ):
   now( new Now ),
   cfg( _cfg ),
   db(),
   wind( now, db ),
   rain( now, db ),
   dbg("Weather Data"),
   baro(cfg.getDouble("elevation")),
   almanacYesterday( cfg, now->unixtime() - 24*60*60 ),
   almanacToday( cfg, now->unixtime() ),
   almanacTomorrow( cfg, now->unixtime() + 24*60*60 ),
   dayTime( false )
{
   pthread_rwlock_init( &rwLock, 0 );
   for ( int p = insideTemp; p != END; p++ )
   {
      dataAvailable[ (PROPERTY)p ] = false;
      setValues[ (PROPERTY)p ] = NO_VALUE;
   }
   inst[insideTemp].setHistorySize( 5 * ONE_MINUTE, "insideTemp" );
   inst[insideHumidity].setHistorySize( 1 * ONE_MINUTE, "insideHumidity" );
   inst[outsideTemp].setHistorySize( 5 * ONE_MINUTE, "outsideTemp" );
   inst[outsideHumidity].setHistorySize( 1 * ONE_MINUTE, "outsideHumidity" );
   refreshSolarMax();
   computeTrends();

   time_t t;
   t = almanacYesterday.sunrise;
   dbg.printf(NOTICE, "Sunrise yesterday:  %s", ctime(&t));
   t = almanacYesterday.sunset;
   dbg.printf(NOTICE, "Sunset yesterday:  %s", ctime(&t));

   t = almanacToday.sunrise;
   dbg.printf(NOTICE, "Sunrise today:  %s", ctime(&t));
   t = almanacToday.sunset;
   dbg.printf(NOTICE, "Sunset today:  %s", ctime(&t));

   t = almanacTomorrow.sunrise;
   dbg.printf(NOTICE, "Sunrise tomorrow:  %s", ctime(&t));
   t = almanacTomorrow.sunset;
   dbg.printf(NOTICE, "Sunset Tomorrow:  %s", ctime(&t));

   if ( almanacToday.lengthOfDay < almanacYesterday.lengthOfDay  )
   {
      dbg.printf(NOTICE, "Today will be %d seconds shorter than yesterday\n",
            almanacYesterday.lengthOfDay - almanacToday.lengthOfDay );
   }
   else if ( almanacToday.lengthOfDay > almanacYesterday.lengthOfDay  )
   {
      dbg.printf(NOTICE, "Today will be %d seconds longer than yesterday\n",
            almanacToday.lengthOfDay - almanacYesterday.lengthOfDay );
   }
   else
   {
      dbg.printf(NOTICE, "Today will be same length as yesterday\n");
   }

   if ( almanacTomorrow.lengthOfDay < almanacToday.lengthOfDay  )
   {
      dbg.printf(NOTICE, "Tomorrow will be %d seconds shorter than today\n",
            almanacToday.lengthOfDay - almanacTomorrow.lengthOfDay );
   }
   else if ( almanacTomorrow.lengthOfDay > almanacToday.lengthOfDay  )
   {
      dbg.printf(NOTICE, "Tomorrow will be %d seconds longer than today\n",
            almanacTomorrow.lengthOfDay - almanacToday.lengthOfDay );
   }
   else
   {
      dbg.printf(NOTICE, "Tomorrow will be same length as today\n");
   }

   if ( now->unixtime() > almanacToday.sunrise  &&
         now->unixtime() < almanacToday.sunset )
   {
      dbg.printf(NOTICE, "Initializing in daytime mode\n");
      dayTime = true;
   }
   else
   {
      dbg.printf(NOTICE, "Initializing in nighttime mode\n");
      dayTime = false;
   }
}

WeatherData::~WeatherData()
{
}

double WeatherData::getCurrent( PROPERTY property )
{
   if ( !dataAvailable[ property ] )
   {
      dbg.printf(INFO, "No data available for %s\n",
            propertyToString(property));
      return NO_VALUE;
   }
   return inst[property];
}

double WeatherData::getFromObs( PROPERTY property, time_t howLongAgo, time_t
      *actualTime )
{
   // Bracket it between +- 30 seconds.  This should give us a good time.
   dbResult result = db.query("select time, %s from dailyObs where time < %d and time > %d order by time desc limit 1;",
         propertyToString(property),
         (int)howLongAgo + 30,
         (int)howLongAgo - ONE_MINUTE*5 );

   if ( result.size() == 0 )
   {
      return NO_VALUE;
   }
   else
   {
      if ( actualTime != NULL )
         *actualTime = result[0].asInteger("time");
      return result[0].asDouble(propertyToString(property));
   }
}

double WeatherData::getFromHourly( PROPERTY property, time_t howLongAgo,
      time_t *actualTime )
{
   dbResult result = db.query("select time, %s from hourlySummary where time < %d and time > %d order by time desc limit 1;",
         propertyToString(property),
         (int)howLongAgo + ONE_HOUR/2,
         (int)howLongAgo - ONE_HOUR*5 );

   if ( result.size() == 0 )
   {
      return NO_VALUE;
   }
   else
   {
      if ( actualTime != NULL )
         *actualTime = result[0].asInteger("time");
      return result[0].asDouble(propertyToString(property));
   }
}

double WeatherData::getFromDaily( PROPERTY property, time_t howLongAgo,
      time_t *actualTime )
{
   dbResult result = db.query("select time, %s from dailySummary where time < %d and time > %d and summaryType == 0 order by time desc limit 1;",
         propertyToString(property),
         (int)howLongAgo + ONE_DAY/2,
         (int)howLongAgo - ONE_DAY/2 );

   if ( result.size() == 0 )
   {
      return NO_VALUE;
   }
   else
   {
      if ( actualTime != NULL )
         *actualTime = result[0].asInteger("time");
      return result[0].asDouble(propertyToString(property));
   }
}

void WeatherData::copyData( void )
{
   for ( int p = insideTemp; p != END; p++ )
   {
      PROPERTY property = (PROPERTY)p;
      if ( setValues[ property ] != NO_VALUE )
      {
         inst[ property ] = setValues[ property ];
         dataAvailable[ property ] = true;
      }
   }

}

bool WeatherData::setValue( PROPERTY property, double value )
{
   bool rval = false;
   switch ( property )
   {
      case windGust:
      case windGustDir:
      case solarPercent:
      case rain24Hour:
      case rainRate:
         dbg.printf(CRIT, "windGust/solarPecent are not settable!\n");
         rval = false;
         break;
      default:
         setValues[property] = value;
         rval = true;
         break;
   }
   return rval;
}

double WeatherData::getTrend( PROPERTY property )
{
   pthread_rwlock_rdlock( &rwLock );
   double f = trend[property];
   pthread_rwlock_unlock( &rwLock );
   return f;
}

double WeatherData::getValue( PROPERTY property, time_t howLongAgo, time_t
      *actualTime )
{
   double rval = 0;
   pthread_rwlock_rdlock( &rwLock );
   if ( howLongAgo == 0 )
      rval = getCurrent( property );
   else if ( howLongAgo < ONE_DAY*7 )
      rval = getFromObs( property, now->unixtime() - howLongAgo, actualTime );
   else if ( howLongAgo < ONE_DAY*90 )
      rval = getFromHourly( property, now->unixtime() - howLongAgo, actualTime);
   else
      rval = getFromDaily( property, now->unixtime() - howLongAgo, actualTime);
   pthread_rwlock_unlock( &rwLock );

   return rval;
}

double WeatherData::getSolarMax()
{
   return currentSolarMax;
}

double WeatherData::getApparentTemp()
{
   // Humidex is valid for temps > 68
   if ( (double)inst[humidex] != NO_VALUE )
   {
      return inst[humidex];
   }
   // Windchill is valid for temps < 50 and > -50
   else if ( (double)inst[windChill] != NO_VALUE )
   {
      return inst[windChill];
   }
   // Otherwise, there is no effect on the human body
   else
   {
      return inst[outsideTemp];
   }
}

double WeatherData::getCloudHeight()
{
   return trunc((( (float)inst[outsideTemp] - (float)inst[dewPoint])/4.5)*1000);
}

double WeatherData::getStationPressure()
{
   int meanTemp;
   float oldTemp = getFromObs( outsideTemp, now->unixtime()-12*ONE_HOUR, NULL );
   if ( oldTemp == NO_VALUE )
   {
      dbg.printf(NOTICE, "No temperature data for 12 hours ago. Using current temp only.\n");
      meanTemp = (int)inst[outsideTemp];
   }
   else
   {
      meanTemp = ((int)oldTemp + (int)inst[outsideTemp]) / 2;
   }

   return baro.SLPtoStationPressure( inst[SLP], inst[outsideTemp],
         (float)meanTemp, (int)inst[outsideHumidity] ) + cfg.getDouble("barometer_offset");

}

double WeatherData::getHeatIndex()
{
   double T = inst[outsideTemp];
   double R = inst[outsideHumidity];

   if ( T < 68 || R < 40 )
   {
      return NO_VALUE;
   }

   double T2 = pow(T,2);
   double R2 = pow(R,2);
   return  -42.379
                   +(2.04901523*T)
                   +(10.14333127*R)
                   -(0.22475541*T*R)
                   -(0.00683783*T2)
                   -(0.05481717*R2)
                   +(0.00122874*T2*R)
                   +(0.00085282*T*R2)
                   -(0.000001998*T2*R2);

}

double WeatherData::getHumidex()
{
   if ( (double)inst[outsideTemp] < 68 || (double)inst[outsideHumidity] < 40 )
   {
      return NO_VALUE;
   }
   double temp = F2C(inst[outsideTemp]);
   double dp = F2K( inst[dewPoint] );
   double e = 6.11 * exp(5417.7530 * ((1/273.16)-(1/dp)));
   double h = (0.5555)*(e - 10.0 );
   return C2F( temp + h );

}

double WeatherData::getWindChill()
{
   double v = inst[averageWindSpeed];
   double T = inst[outsideTemp];
   if ( ( v < 3 ) || T > 50 || T < -50 )
      return NO_VALUE;

   return ( 35.74 + 0.6215*T - 35.75*pow(v, 0.16) + 0.4275*T*pow(v, 0.16 ));
}

double WeatherData::getDewPoint()
{
   double temp = F2C(inst[outsideTemp]);
   double humidity = (double)inst[outsideHumidity]/100.0;

   double a = 17.27;
   double b = 237.7;
   double theta = ((a*temp)/(b+temp))+log(humidity);

   return C2F((( b * theta )/(a - theta )));

}

bool WeatherData::newData()
{
   pthread_rwlock_wrlock( &rwLock );
   copyData();

   if ( dataAvailable[dailyRain] )
   {
      rain.update( (int)(inst[dailyRain]) );
      inst[rainRate] = rain.getRate();
      inst[rain24Hour] = rain.getSum( 24 * ONE_HOUR );
      inst[instantRain] = rain.getInstantRainrate();
      dataAvailable[rainRate] = true;
      dataAvailable[rain24Hour] = true;
      dataAvailable[instantRain] = true;
   }

   if ( dataAvailable[ windSpeed ] && dataAvailable[ windDirection ] )
   {
      wind.update( inst[windSpeed], inst[windDirection] );
      inst[averageWindDirection] = wind.getAverageDirection( TWO_MINUTES );
      inst[averageWindSpeed] = wind.getAverageSpeed( TWO_MINUTES );
      inst[windGust] = wind.getMaxSpeed( ONE_MINUTE * 10 );
      inst[windGustDir] = wind.getDirectionAtMaxSpeed( ONE_MINUTE * 10 );

      dataAvailable[averageWindDirection] = true;
      dataAvailable[averageWindSpeed] = true;
      dataAvailable[windGust] = true;
      dataAvailable[windGustDir] = true;
   }

   // We were in daytime mode, but time has transitions to night (We are past
   // sunset).
   if ( dayTime && now->unixtime() > almanacToday.sunset )
   {
      dbg.printf(NOTICE, "Transitioning to nighttime mode\n");
      dayTime = false;
      updateSummary( DAILY, DAYTIMESUMMARY );

   }
   // We were in night mode, but are now in daytime ( sunrise HAS happened,
   // but sunset hasn't)
   else if ( !dayTime &&
         now->unixtime() > almanacToday.sunrise &&
         now->unixtime() < almanacToday.sunset )
   {
      dbg.printf(NOTICE, "Transitioning to daytime mode\n");
      dayTime = true;
      updateSummary( DAILY, NIGHTTIMESUMMARY );
   }
   updateDB();
   pthread_rwlock_unlock( &rwLock );

   if ( now->isNewDay() )
   {
      dbg.printf(EMERG, "refreshing almanacs\n");
      refreshAlmanacs();
   }
   /*for ( std::vector< WeatherSink *>::iterator iter = sinks.begin();
         iter != sinks.end(); ++iter )
   {
      (*iter)->newData();
   }*/
   return true;
}

double WeatherData::computeTrend( PROPERTY property, int duration /* hours */)
{

   const char * key = propertyToString( property );
   int age = (int)(now->unixtime() - duration*ONE_HOUR );

   dbResult result = db.query(
         " select ( "
         "  select sum( %s *("
         "   select time/3600.0 - ("
         "    select avg(time/3600.0) from dailyObs where time > %d) )) "
         "   from dailyObs where time > %d ) "
         "  / "
         "   ( select sum((time/3600.0 - ( "
         "    select avg(time/3600.0) from dailyObs where time > %d)) * "
         "     (time/3600.0 - ( "
         "       select avg(time/3600.0) from dailyObs where time > %d))) "
         "   from dailyObs where time > %d) as M;",
         key, age, age, age, age, age );

   if ( result.size() == 0 )
      return 0;
   else
      return result[0].asDouble("M");
}

void WeatherData::doMaintenance()
{
   static bool firstMaintenanceRun = true;
   if ( !now->isNewMinute( ) && !firstMaintenanceRun )
   {
      return;
   }

   firstMaintenanceRun = false;

   if ( dataAvailable[SLP] )
   {
      inst[stationPressure] = getStationPressure();
      inst[altimeter]  = baro.StationPressureToAltimeter( inst[stationPressure] );
      dataAvailable[ stationPressure ] = true;
      dataAvailable[ altimeter ] = true;

      dbg.printf(INFO, "             SLP: %f (%.1f)\n",
            (float)inst[SLP], inHg2hPa( inst[SLP] ) );
      dbg.printf(INFO, "station pressure: %f (%.1f)\n",
            (float)inst[stationPressure], inHg2hPa( inst[stationPressure] ) );
      dbg.printf(INFO, "       altimeter: %f (%.1f)\n",
            (float)inst[altimeter], inHg2hPa( inst[ altimeter] ) );
   }
   refreshSolarMax();
   computeTrends();
}

void WeatherData::updateDB()
{
   double sradMax = getSolarMax();
   int sradPercent = 0;
   if ( sradMax > 0 )
      sradPercent = (int)round( ( (double)inst[solarRadiation] / sradMax) * 100 );
   if ( sradPercent > 100 )
      sradPercent = 100;

   if ( dataAvailable[ solarRadiation ] )
   {
      dataAvailable[ solarPercent ] = true;
      inst[solarPercent] = sradPercent;
   }

   if ( dataAvailable[ outsideTemp ] && dataAvailable[ outsideHumidity ] )
   {
      inst[dewPoint] = getDewPoint();
      inst[humidex] = getHumidex();
      inst[heatIndex] = getHeatIndex();

      // cloud height depends on dew point, so it should come after that
      inst[cloudHeight] = getCloudHeight();

      dataAvailable[heatIndex] = true;
      dataAvailable[cloudHeight] = true;
      dataAvailable[humidex] = true;
      dataAvailable[dewPoint] = true;
   }

   if ( dataAvailable[ outsideTemp ] && dataAvailable[ windSpeed ] )
   {
      inst[windChill] = getWindChill();
      dataAvailable[windChill] = true;
   }

   if ( dataAvailable[ humidex ] && dataAvailable[ windChill ] )
   {
      // Apparent Temp depends on windchill and heat index, so it should come
      // after those
      inst[apparentTemp] = getApparentTemp();
      dataAvailable[apparentTemp] = true;
   }

   doMaintenance();

   if ( !now->isNewMinute( ))
   {
      return;
   }

   dbg.printf(DEBUG, "Logging minute summary\n");
   db.query("delete from dailyObs where time < %d;", (int)(now->unixtime() - ONE_DAY*7 ));
   db.query("insert into dailyObs ( time, insideTemp, insideHumidity, outsideTemp, outsideHumidity, windSpeed, windDirection, windGust, rainRate, dailyRain, dailyET, UV, solarRadiation, solarRadiationPercent, barometricTrend, rawBarometer, SLP, altimeter, dewPoint, heatIndex, humidex, windChill, apparentTemp, cloudHeight, windGustDir, rain24Hour, instantRain ) VALUES ( "
         "%d, "   // unixTime
         "%.02f," // insideTemp
         "%.0f,"  // insideHumidity
         "%.02f," // outsideTemp
         "%.0f,"  // outsideHumidity
         "%.02f," // averageWindSpeed
         "%.0f,"  // averageWindDirection
         "%.02f," // windGust
         "%.02f," // rainRate
         "%.02f," // dailyRain
         "%.02f," // dailyET
         "%.02f," // UV
         "%.0f,"  // solarRadiation
         "%.0f,"  // solarPercent
         "%.04f," // barometer trend
         "%.02f," // barometer
         "%.02f," // SLP
         "%.02f," // altimeter
         "%.02f," // dewPoint
         "%.02f," // heatIndex
         "%.02f," // humidex
         "%.02f," // windChill
         "%.02f," // apparentTemp
         "%.0f,"  // cloudHeight
         "%.0f,"  // windGustDir
         "%.02f," // rain24Hour
         "%.02f);", // instantRain
         (int)now->unixtime(),
         (float)inst[insideTemp],
         (float)inst[insideHumidity],
         (float)inst[outsideTemp],
         (float)inst[outsideHumidity],
         (float)inst[averageWindSpeed],
         (float)(float)inst[averageWindDirection],
         (float)inst[windGust],
         (float)inst[rainRate],
         (float)inst[dailyRain],
         (float)inst[dailyET],
         (float)inst[UV],
         (float)inst[solarRadiation],
         (float)inst[solarPercent],
         trend[altimeter],
         (float)inst[stationPressure],
         (float)inst[SLP],
         (float)inst[altimeter],
         (float)inst[dewPoint],
         (float)inst[heatIndex],
         (float)inst[humidex],
         (float)inst[windChill],
         (float)inst[apparentTemp],
         (float)inst[cloudHeight],
         (float)inst[windGustDir],
         (float)inst[rain24Hour],
         (float)inst[instantRain]
      );

   if ( now->getMinute() != 59 )
   {
      return;
   }
   dbg.printf(DEBUG, "Logging hourly summary\n");

   db.query("delete from hourlySummary where time < %d;", (int)(now->unixtime() - ONE_DAY*90 ));
   updateSummary( HOURLY );

   if ( now->getHour() != 23 )
   {
      return;
   }
   dbg.printf(DEBUG, "Logging daily summary\n");

   updateSummary( DAILY );
   db.query("VACUUM;");
}

void WeatherData::refreshAlmanacs()
{
   dbg.printf(NOTICE, "Refreshing almanacs\n");
   almanacYesterday.setNewTime(now->unixtime() - 12*60*60 );
   almanacToday.setNewTime(now->unixtime());
   almanacTomorrow.setNewTime(now->unixtime() + 36*60*60);

   time_t t;
   t = almanacYesterday.sunrise;
   dbg.printf(NOTICE, "Sunrise yesterday:  %s", ctime(&t));
   t = almanacYesterday.sunset;
   dbg.printf(NOTICE, "Sunset yesterday:  %s", ctime(&t));

   t = almanacToday.sunrise;
   dbg.printf(NOTICE, "Sunrise today:  %s", ctime(&t));
   t = almanacToday.sunset;
   dbg.printf(NOTICE, "Sunset today:  %s", ctime(&t));

   t = almanacTomorrow.sunrise;
   dbg.printf(NOTICE, "Sunrise tomorrow:  %s", ctime(&t));
   t = almanacTomorrow.sunset;
   dbg.printf(NOTICE, "Sunset Tomorrow:  %s", ctime(&t));

}

void WeatherData::updateSummary( DBTable table, SUMMARYTYPE type )
{
   const char *table_s;
   int currentTime = now->unixtime();
   int startTime;
   const char *keys[] = {"insideTemp",
                         "insideHumidity",
                         "outsideTemp",
                         "outsideHumidity",
                         "windSpeed",
                         "windGust",
                         "UV",
                         "solarRadiation",
                         "solarRadiationPercent",
                         "SLP",
                         "rainRate",
                         "altimeter",
                         "rawBarometer",
                         "dewPoint",
                         "humidex",
                         "heatIndex",
                         "windChill",
                         "apparentTemp",
                         "cloudHeight",
                         "rain24Hour"};

   switch( table )
   {
      case HOURLY:
         table_s = "hourlySummary";
         startTime = currentTime - ONE_HOUR;
         if ( type != DAILYSUMMARY )
         {
            dbg.printf(ERR, "Cannot set type for hourlySummary!\n");
            type = DAILYSUMMARY;
         }
         db.query("insert into %s ( time ) VALUES ( %d );",
               table_s,
               (int)now->unixtime());
         break;
      case DAILY:
         table_s = "dailySummary";
         switch ( type )
         {
            case DAILYSUMMARY:
               startTime = currentTime - ONE_DAY;
               break;
            case DAYTIMESUMMARY:
               startTime = almanacToday.sunrise;
               break;
            case NIGHTTIMESUMMARY:
               startTime = almanacYesterday.sunset;
               break;
         }
         db.query("insert into %s ( time, summaryType ) VALUES ( %d, %d );",
               table_s,
               (int)now->unixtime(),
               type);
         break;
   }

   db.query("BEGIN TRANSACTION;");

   // TODO: We need to check if this fails, and do something if it does

   for ( size_t i = 0; i < sizeof( keys )/sizeof( char * ); i++ )
   {
      db.query("update %s set %s%s = ( select %s( %s ) from dailyObs where time > %d ), %s%sTime = ( select time from dailyObs where %s = ( select %s( %s ) from dailyObs where time > %d )) where time = %d;",
            table_s,
            keys[i],
            "min",
            "min",
            keys[i],
            startTime,
            keys[i],
            "min",
            keys[i],
            "min",
            keys[i],
            startTime,
            currentTime );
      db.query("update %s set %s%s = ( select %s( %s ) from dailyObs where time > %d ), %s%sTime = ( select time from dailyObs where %s = ( select %s( %s ) from dailyObs where time > %d )) where time = %d;",
            table_s,
            keys[i],
            "max",
            "max",
            keys[i],
            startTime,
            keys[i],
            "max",
            keys[i],
            "max",
            keys[i],
            startTime,
            currentTime );

      db.query("update %s set %s%s = ( select %s( %s ) from dailyObs where time > %d ) where time = %d;",
            table_s,
            keys[i],
            "Avg",
            "avg",
            keys[i],
            startTime,
            currentTime );
   }

   // Update instantRain
   db.query("update %s set instantRainMax = ( select max(instantRain) from dailyObs where time > %d ), instantRainMaxTime = ( select time from dailyObs where instantRain = ( select max( instantRain ) from dailyObs where time > %d ))  where time = %d\n", table_s, currentTime - 60*5, currentTime - 60*5, currentTime);

   // Update dailyrain/ET
   db.query("update %s set dailyRain = ( select max(dailyRain) from dailyObs where time > %d ) where time = %d\n", table_s, currentTime - 60*5, currentTime);
   db.query("update %s set dailyET = ( select max(dailyET) from dailyObs where time > %d ) where time = %d\n", table_s, currentTime - 60*5, currentTime);

   db.query("COMMIT;");

   // Update wind direction
   double windDirSin = 0;
   double windDirCos = 0;
   dbResult result =
      db.query("select windDirection from dailyObs where time > %d;",
            startTime );

   for ( dbResult::iterator iter = result.begin(); iter!=result.end();++iter )
   {
      windDirSin = sin( deg2rad( iter->second.asDouble("windDirection")));
      windDirCos = cos( deg2rad( iter->second.asDouble("windDirection")));
   }
   int avgWindDir = (int)rad2deg( atan2(windDirSin, windDirCos ));
   if ( avgWindDir < 0 )
      avgWindDir += 360;
   db.query("update %s set windDirectionAvg=%d where time = %d;",
         table_s, avgWindDir, currentTime );

   // Update wind gust direction
   windDirSin = 0;
   windDirCos = 0;
   result =
      db.query("select windGustDir from dailyObs where time > %d;",
            startTime );

   for ( dbResult::iterator iter = result.begin(); iter!=result.end();++iter )
   {
      windDirSin = sin( deg2rad( iter->second.asDouble("windGustDir")));
      windDirCos = cos( deg2rad( iter->second.asDouble("windGustDir")));
   }
   avgWindDir = (int)rad2deg( atan2(windDirSin, windDirCos ));
   if ( avgWindDir < 0 )
      avgWindDir += 360;
   db.query("update %s set windGustDirAvg=%d where time = %d;",
         table_s, avgWindDir, currentTime );
}

double WeatherData::refreshSolarMax()
{
   static double timezone = cfg.getDouble("timezone");
   static double longitude = cfg.getDouble("longitude");
   static double latitude = cfg.getDouble("latitude");

   float LSTM = 15 * timezone;
   float B = 360.0/365.0 * ( now->getDayOfYear() - 81 );
   float EoT = 9.8 * sin ( deg2rad(2* B)) - 7.53 * cos( deg2rad(B)) - 1.5 * sin( deg2rad( B ));
   float TC = ( -4 * ( LSTM - longitude ) + EoT ) / 60.0;
   float LT = now->getDecimalTime() - now->isDST();
   float LST = LT + TC;

   float solDec = 23.45 * sin( deg2rad( 360.0/365.0 * (284 + now->getDayOfYear())));
   float hourAngle = 15 * ( LST - 12 );
   float l = sin( deg2rad( latitude ))*sin(deg2rad(solDec));
   float r = cos( deg2rad( latitude ))*cos(deg2rad(solDec))*cos(deg2rad(hourAngle));
   float Z = acos( l + r );

   currentSolarMax = MAX_SOLAR * cos(( Z ));
   return currentSolarMax;
}

void WeatherData::computeTrends()
{
   trend[SLP] = computeTrend(SLP, 3 );
   trend[stationPressure] = computeTrend(stationPressure, 3 );
   trend[altimeter] = computeTrend(altimeter, 3 );
   trend[outsideTemp] = computeTrend(outsideTemp, 1 );
   trend[outsideHumidity] = computeTrend(outsideHumidity, 1 );
   trend[dewPoint] = computeTrend(dewPoint, 1 );
}

const char *WeatherData::propertyToString( PROPERTY property )
{
   switch ( property )
   {
      case insideTemp:
         return "insideTemp";
      case insideHumidity:
         return "insideHumidity";
      case outsideTemp:
         return "outsideTemp";
      case outsideHumidity:
         return "outsideHumidity";
      case windSpeed:
         return "windSpeed";
      case windDirection:
         return "windDirection";
      case averageWindDirection:
         return NULL;
      case averageWindSpeed:
         return NULL;
      case windGust:
         return "windGust";
      case windGustDir:
         return "windGustDir";
      case dailyRain:
         return "dailyRain";
      case rainRate:
         return "rainRate";
      case dailyET:
         return "dailyET";
      case UV:
         return "UV";
      case solarRadiation:
         return "solarRadiation";
      case solarPercent:
         return "solarRadiationPercent";
      case stationPressure:
         return "rawBarometer";
      case SLP:
         return "SLP";
      case altimeter:
         return "altimeter";
      case dewPoint:
         return "dewPoint";
      case heatIndex:
         return "heatIndex";
      case humidex:
         return "humidex";
      case windChill:
         return "windChill";
      case apparentTemp:
         return "apparentTemp";
      case cloudHeight:
         return "cloudHeight";
      case rain24Hour:
         return "rain24Hour";
      case instantRain:
         return "instantRain";
      case END:
         return NULL;
   }
   return NULL;

}

bool WeatherData::hasData( PROPERTY property )
{
   pthread_rwlock_rdlock( &rwLock );
   bool rval= dataAvailable[ property ];
   pthread_rwlock_unlock( &rwLock );
   return rval;
}


text:
Displays slides, with optional pagination dots and thumbnails. Its implementation uses a [Bento Base Carousel](https://www.npmjs.com/package/@bentoproject/base-carousel). Both components must be properly installed for the environment (Web Component vs Preact).

## Web Component

You must include each Bento component's required CSS library to guarantee proper loading and before adding custom styles. Or use the light-weight pre-upgrade styles available inline. See [Layout and style](#layout-and-style).

### Import via npm

```sh
npm install @bentoproject/inline-gallery
```

```javascript
import {defineElement as defineBentoInlineGallery} from '@bentoproject/inline-gallery';
defineBentoInlineGallery();
```

### Include via `<script>`

```html
<script type="module" src="https://cdn.ampproject.org/bento.mjs" crossorigin="anonymous"></script>
<script nomodule src="https://cdn.ampproject.org/bento.js" crossorigin="anonymous"></script>
<script type="module" src="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.mjs" crossorigin="anonymous"></script>
<script nomodule src="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.css" crossorigin="anonymous">
```

### Example

<!--% example %-->

```html
<!DOCTYPE html>
<html>
  <head>
    <script
      type="module"
      async
      src="https://cdn.ampproject.org/bento.mjs"
    ></script>
    <script nomodule src="https://cdn.ampproject.org/bento.js"></script>

    <script
      type="module"
      async
      src="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.mjs"
    ></script>
    <script
      nomodule
      async
      src="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.js"
    ></script>
    <link
      rel="stylesheet"
      href="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.css"
    />

    <script
      type="module"
      async
      src="https://cdn.ampproject.org/v0/bento-base-carousel-1.0.mjs"
    ></script>
    <script
      nomodule
      async
      src="https://cdn.ampproject.org/v0/bento-base-carousel-1.0.js"
    ></script>
    <link
      rel="stylesheet"
      href="https://cdn.ampproject.org/v0/bento-base-carousel-1.0.css"
    />
  </head>
  <body>
    <bento-inline-gallery id="inline-gallery">
      <bento-inline-gallery-thumbnails
        style="height: 100px"
        loop
      ></bento-inline-gallery-thumbnails>

      <bento-base-carousel
        style="height: 200px"
        snap-align="center"
        visible-count="3"
        loop
      >
        <img src="img1.jpeg" data-thumbnail-src="img1-thumbnail.jpeg" />
        <img src="img2.jpeg" data-thumbnail-src="img2-thumbnail.jpeg" />
        <img src="img3.jpeg" data-thumbnail-src="img3-thumbnail.jpeg" />
        <img src="img4.jpeg" data-thumbnail-src="img4-thumbnail.jpeg" />
        <img src="img5.jpeg" data-thumbnail-src="img5-thumbnail.jpeg" />
        <img src="img6.jpeg" data-thumbnail-src="img6-thumbnail.jpeg" />
      </bento-base-carousel>

      <bento-inline-gallery-pagination
        style="height: 20px"
      ></bento-inline-gallery-pagination>
    </bento-inline-gallery>
  </body>
</html>
```

### Layout and style

Each Bento component has a small CSS library you must include to guarantee proper loading without [content shifts](https://web.dev/cls/). Because of order-based specificity, you must manually ensure that stylesheets are included before any custom styles.

```html
<link
  rel="stylesheet"
  type="text/css"
  href="https://cdn.ampproject.org/v0/bento-inline-gallery-1.0.css"
/>
```

Alternatively, you may also make the light-weight pre-upgrade styles available inline:

```html
<style>
  bento-inline-gallery,
  bento-inline-gallery-pagination,
  bento-inline-gallery-thumbnails {
    display: block;
  }
  bento-inline-gallery {
    contain: layout;
  }
  bento-inline-gallery-pagination,
  bento-inline-gallery-thumbnails {
    overflow: hidden;
    position: relative;
  }
</style>
```

### Attributes on `<bento-inline-gallery-pagination>`

#### `inset`

Boolean attribute indicating whether to display the pagination indicator as inset (overlaying the carousel itself). Default is `false`.

### Attributes on `<bento-inline-gallery-thumbnails>`

#### `aspect-ratio`

A Number defining the ratio of width to height that slides should be displayed in. This value is optional.

#### `loop`

Boolean attribute indicating whether thumbnails should loop. The default is `false`.

### Styling

You may use the `bento-inline-gallery`, `bento-inline-gallery-pagination`, `bento-inline-gallery-thumbnails`, and `bento-base-carousel` element selectors to style the pagination indicator, thumbnails, and carousel freely.

---

## Preact/React Component

### Import via npm

```sh
npm install @bentoproject/inline-gallery
```

```javascript
import React from 'react';
import {BentoInlineGallery} from '@bentoproject/inline-gallery/react';
import '@bentoproject/inline-gallery/styles.css';

function App() {
  return (
    <BentoInlineGallery id="inline-gallery">
      <BentoInlineGalleryThumbnails aspect-ratio="1.5" loop />
      <BentoBaseCarousel snap-align="center" visible-count="1.2" loop>
        <img src="server.com/static/inline-examples/images/image1.jpg" />
        <img src="server.com/static/inline-examples/images/image2.jpg" />
        <img src="server.com/static/inline-examples/images/image3.jpg" />
      </BentoBaseCarousel>
      <BentoInlineGalleryPagination inset />
    </BentoInlineGallery>
  );
}
```

### Layout and style

#### Container type

The `BentoInlineGallery` component has a defined layout size type. To ensure the component renders correctly, be sure to apply a size to the component and its immediate children via a desired CSS layout (such as one defined with `width`). These can be applied inline:

```jsx
<BentoInlineGallery style={{width: 300}}>...</BentoInlineGallery>
```

Or via `className`:

```jsx
<BentoInlineGallery className="custom-styles">...</BentoInlineGallery>
```

```css
.custom-styles {
  background-color: red;
}
```

### Props for `BentoInlineGalleryPagination`

In addition to the [common props](../../../../../docs/spec/bento-common-props.md), BentoInlineGalleryPagination supports the props below:

#### `inset`

Boolean attribute indicating whether to display the pagination indicator as inset (overlaying the carousel itself). Default is `false`.

### Props for `BentoInlineGalleryThumbnails`

In addition to the [common props](../../../../../docs/spec/bento-common-props.md), BentoInlineGalleryThumbnails supports the props below:

#### `aspectRatio`

A Number defining the ratio of width to height that slides should be displayed in (this is optional).

#### `loop`

Boolean attribute indicating whether thumbnails should loop. Default is `false`.


text:
'use strict'

module.exports = (e) => {

	if (typeof e.stopPropagation === 'function') e.stopPropagation()
	if (typeof e.preventDefault === 'function') e.preventDefault()

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

  <meta http-equiv="content-type" content=""/>
  <title>HTTP transports</title>

HTTP Transport

This document covers the sending and receiving of SOAP messages with Axis2 using HTTP
as the transport mechanism.

Contents

CommonsHTTPTransportSender

HTTPS support

Timeout Configuration

HTTP Version Configuration

Proxy Authentication

Basic, Digest and NTLM Authentication

Reusing the httpclient object

Setting the cached httpclient object

CommonsHTTPTransportSender

CommonsHTTPTransportSender is the transport sender that is used by default in both
the Server and Client APIs. As its name implies, it is based on commons-httpclient-3.1.
For maximum flexibility, this sender supports both the HTTP GET and POST interfaces.
(REST in Axis2 also supports both interfaces.)

Axis2 uses a single HTTPClient instance per ConfigurationContext (which usually means per instance
of ServiceClient).  This pattern allows for HTTP 1.1 to automatically reuse TCP connections - in earlier versions of Axis2 the REUSE_HTTP_CLIENT configuration property was necessary to enable this functionality, but as of 1.5 this is no longer necessary.

Commons HttpClient also provides HTTP 1.1, Chunking and KeepAlive support for Axis2.

The <transportSender/> element defines transport senders in
the axis2.xml configuration file as follows:

<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
   <parameter name="PROTOCOL">HTTP/1.1</parameter>
   <parameter name="Transfer-Encoding">chunked</parameter>
</transportSender>

The above code snippet shows the simplest configuration of a transport
sender for common use. The <parameter/> element is used to specify additional
constraints that the sender should comply with. The HTTP PROTOCOL parameter
should be set as HTTP/1.0 or HTTP/1.1. The default version is HTTP/1.1. Note that
chunking support is available only for HTTP/1.1. Thus, even if "chunked" is specified
as a parameter, if the HTTP version is 1.0, this setting will be
ignored by the transport framework. Also, KeepAlive is enabled by default in
HTTP/1.1.

If you use HTTP1.1 for its Keep-Alive ability, but you need to disable
chunking at runtime (some servers don't allow chunked requests to
prevent denial of service), you can do so in the Stub:

options.setProperty(HTTPConstants.CHUNKED, "false");

Some absolute properties are provided at runtime instead.  For example, character
encoding style (UTF-8, UTF-16, etc.) is provided via MessageContext.

HTTPS support

CommonsHTTPTransportSender can be also used to communicate over https.

   <transportSender name="https" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
      <parameter name="PROTOCOL">HTTP/1.1</parameter>
      <parameter name="Transfer-Encoding">chunked</parameter>
   </transportSender>

Please note that by default HTTPS works only when the server does not
expect to authenticate the clients (1-way SSL only) and where the
server has the clients' public keys in its trust store.

If you want to perform SSL client authentication (2-way SSL), you may
use the Protocol.registerProtocol feature of HttpClient. You can
overwrite the "https" protocol, or use a different protocol for your
SSL client authentication communications if you don't want to mess
with regular https. Find more information at
http://jakarta.apache.org/commons/httpclient/sslguide.html

Timeout Configuration

Two timeout instances exist in the transport level, Socket timeout
and Connection timeout. These can be configured either at deployment
or run time.  If configuring at deployment time, the user has to add the
following lines in axis2.xml.

For Socket timeout:

<parameter name="SO_TIMEOUT">some_integer_value</parameter>

For Connection timeout:

 <parameter name="CONNECTION_TIMEOUT">some_integer_value</parameter>

For runtime configuration, it can be set as follows within the client stub:

...
Options options = new Options();
options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeOutInMilliSeconds));
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeOutInMilliSeconds));

// or
options.setTimeOutInMilliSeconds(timeOutInMilliSeconds);
...

HTTP Version Configuration

The default HTTP version is 1.1. There are two methods in which the user
can change the HTTP version to 1.0

By defining the version in axis2.xml as shown below.

 <parameter name="PROTOCOL">HTTP/1.0</parameter>

By changing the version at runtime by using code similar to the following:

...
options.setProperty(org.apache.axis2.context.MessageContextConstants.HTTP_PROTOCOL_VERSION,
   org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);
...

Proxy Authentication

The Commons-http client has built-in support for proxy
authentication. Axis2 uses deployment time and runtime mechanisms to
authenticate proxies. At deployment time, the user has to change the
axis2.xml as follows. This authentication is available for both HTTP and
HTTPS.

<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
   <parameter name="PROTOCOL">HTTP/1.1</parameter>
   <parameter name="PROXY" proxy_host="proxy_host_name" proxy_port="proxy_host_port">userName:domain:passWord</parameter>
</transportSender>

For a particular proxy, if authentication is not available, enter the
"userName:domain:passWord" as "anonymous:anonymous:anonymous".

Prior shown configuration has been deprecated after Axis2 1.2 release and we strongly recommend using the new
proxy configuration as below.

    New proxy configuration would require the user to add a TOP level parameter in the axis2.xml named "Proxy".

<parameter name="Proxy">
    <Configuration>
        <ProxyHost>example.org</ProxyHost>
        <ProxyPort>5678</ProxyPort>
        <ProxyUser>EXAMPLE\saminda</ProxyUser>
        <ProxyPassword>ppp</ProxyPassword>
    </Configuration>
</parameter>

 Thus, if its a open proxy, user can ignore ProxyUser and ProxyPassword elements.

In addition to this, if you don't want to go through writing the above parameter you could
        use Java Networking Properties for open proxies,
-Dhttp.proxyHost=10.150.112.254 -Dhttp.proxyPort=8080

At runtime, the user can override the PROXY settings using the
HttpTransportProperties.ProxyProperties object. Within your client stub,
create an instance of this object, configure proxy values for it,
and then set it to the MessageContext's property bag via options.setProperty().
For example:

...
Options options = new Options();
...

HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.new ProxyProperties();
proxyProperties.setProxyHostName(....);
proxyProperties.setProxyPort(...);
...
options.setProperty(HttpConstants.PROXY, proxyProperties);
...

The above code will override the deployment proxy configuration settings.

Basic, Digest and NTLM Authentication

HttpClient supports three different types of HTTP authentication schemes:
Basic, Digest and NTLM. Based on the challenge provided by the server,
HttpClient automatically selects the authentication scheme with which the
request should be authenticated.  The most secure method is NTLM and the Basic
is the least secure.

NTLM is the most complex of the authentication protocols supported by
HttpClient. It requires an instance of NTCredentials to be available for the
domain name of the server or the default credentials. Note that since NTLM
does not use the notion of realms, HttpClient uses the domain name of the
server as the name of the realm. Also note that the username provided to the
NTCredentials should not be prefixed with the domain - ie: "axis2" is correct
whereas "DOMAIN\axis2" is not correct.

There are some significant differences in the way that NTLM works compared
with basic and digest authentication. These differences are generally handled
by HttpClient, however having an understanding of these differences can help
avoid problems when using NTLM authentication.

NTLM authentication works almost exactly the same way as any other form
    of authentication in terms of the HttpClient API. The only difference is
    that you need to supply 'NTCredentials' instead of
    'UsernamePasswordCredentials' (NTCredentials actually extends
    UsernamePasswordCredentials so you can use NTCredentials right throughout
    your application if need be).

The realm for NTLM authentication is the domain name of the computer to
    which you are being connected. This can become troublesome as servers often
    have multiple domain names that refer to them. Only the domain name that
    the HttpClient connects to (as specified by the HostConfiguration) is
    used to look up the credentials. It is generally advised that while
    initially testing NTLM authentication, you pass the realm as null, which
    is its default value.

NTLM authenticates a connection and not a request. So you need to
    authenticate every time a new connection is made, and keeping the
    connection open during authentication is vital. Because of this, NTLM cannot
    be used to authenticate with both a proxy and the server, nor can NTLM be
    used with HTTP 1.0 connections or servers that do not support HTTP
    keep-alives.

Axis2 also allows adding a custom Authentication Scheme to HttpClient.

The static inner bean Authenticator of HttpTransportProperties will hold
the state of the server to be authenticated with. Once filled, it has to be
set to the Options's property bag with the key as HTTPConstants.AUTHENTICATE.
The following code snippet shows how to configure the transport
framework to use Basic Authentication:

...
Options options = new Options();

HttpTransportProperties.Authenticator
   auth = new HttpTransportProperties.Authenticator();
auth.setUsername("username");
auth.setPassword("password");
// set if realm or domain is known

options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
...

Reusing the httpclient object

By default, a new httpclient object is created for each send. It may
be worthwhile to reuse the same httpclient object to take advantage of
HTTP1.1 Keep-Alive, especially in HTTPS environment, where the SSL
handshake may not be of negligible cost. To reuse the same httpclient
object, you can set the relevant property in the Stub:

options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");

Setting the cached httpclient object

To control the max connections per host attempted in parallel by a
reused httpclient (this can be worthwhile as the default value is 2
connections per host), or any other advanced parameters, you need to
set the cached httpclient object when your application starts up
(before any actual axis request). You can set the relevant property in
the Stub:

MultiThreadedHttpConnectionManager conmgr = new MultiThreadedHttpConnectionManager();
conmgr.getParams().setDefaultMaxConnectionsPerHost(10);
HttpClient client = new HttpClient(conmgr);
configurationContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);

Setting the cached httpstate object

HttpState object can be set as property to the options of a given Axis2 client.
HttpState keeps HTTP attributes that may persist from request to request, such
 as cookies and authentication credentials. So, it is possible to re-use one and
  the same HttpState object if appropriate.

The idea is to provide the capability to specify/associate a separate HttpState
with every client and still reuse one and the same HttpClient. So, this make
sense only when CACHED_HTTP_CLIENT is re-used between different clients
from different threads which may invoke different hosts with different credentials
and cookies. This is really complicated scenario, but is absolutely possible one.
 If you re-use a common HttpClient between different clients then the clients will
 re-use, the internal for the HttpClient, HttpState object. Doing so authentication
 credentials are exposed to all clients sharing one and the same HttpClient.
 This is definitely not a good idea. The problem with Cookies is different. The
  problem here is that if two distinct clients invoke one and the same service
  at a specific host then the session established with a given cookie by one of
  the clients can wrongly be shared among them, too, if it has not expired. This
  will cause problems since the two client may need different sessions, which is
  the more probable scenario.

Sample configuration:

HttpState myHttpState = new HttpState();
options.setProperty(WSClientConstants.CACHED_HTTP_STATE, myHttpState);

Doing so the HttpState is attached to the client. Respectively this is automatically propagated to all MessageContext objects used by the client.
Underneath this just instructs Axis2 that the CACHED_HTTP_STATE set should be passed as a parameter when HttpClient#executeMethod is invoked.


text:
void init_cim_enumeration();

extern VALUE cSfccCimEnumeration;
VALUE Sfcc_wrap_cim_enumeration(CMPIEnumeration *enm);

#endif


text:
package parser.commands;

import java.util.Stack;

import model.State;
import parser.nodes.SyntaxNode;
import exceptions.BadArgumentException;

public class Stamp extends SyntaxNode{
	public Stamp(Stack<SyntaxNode> input) {}

	@Override
	public double execute(State myState) throws BadArgumentException {
		myState.getTurtle().setStamp(true);
		myState.getViewOptions().setStampsOut(true);
		return myState.getTurtle().getShapeID();
	}
}


text:
extern crate winapi;
use winapi::*;
extern "system" {
    pub fn CredPackAuthenticationBufferA(
        dwFlags: DWORD, pszUserName: LPSTR, pszPassword: LPSTR, pPackedCredentials: PBYTE,
        pcbPackedCredentials: *mut DWORD,
    ) -> BOOL;
    pub fn CredPackAuthenticationBufferW(
        dwFlags: DWORD, pszUserName: LPWSTR, pszPassword: LPWSTR, pPackedCredentials: PBYTE,
        pcbPackedCredentials: *mut DWORD,
    ) -> BOOL;
    pub fn CredUICmdLinePromptForCredentialsA(
        pszTargetName: PCSTR, pContext: PCtxtHandle, dwAuthError: DWORD, UserName: PSTR,
        ulUserBufferSize: ULONG, pszPassword: PSTR, ulPasswordBufferSize: ULONG, pfSave: PBOOL,
        dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUICmdLinePromptForCredentialsW(
        pszTargetName: PCWSTR, pContext: PCtxtHandle, dwAuthError: DWORD, UserName: PWSTR,
        ulUserBufferSize: ULONG, pszPassword: PWSTR, ulPasswordBufferSize: ULONG, pfSave: PBOOL,
        dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUIConfirmCredentialsA(pszTargetName: PCSTR, bConfirm: BOOL) -> DWORD;
    pub fn CredUIConfirmCredentialsW(pszTargetName: PCWSTR, bConfirm: BOOL) -> DWORD;
    pub fn CredUIParseUserNameA(
        userName: PCSTR, user: *mut CHAR, userBufferSize: ULONG, domain: *mut CHAR,
        domainBufferSize: ULONG,
    ) -> DWORD;
    pub fn CredUIParseUserNameW(
        userName: PCWSTR, user: *mut WCHAR, userBufferSize: ULONG, domain: *mut WCHAR,
        domainBufferSize: ULONG,
    ) -> DWORD;
    pub fn CredUIPromptForCredentialsA(
        pUiInfo: PCREDUI_INFOA, pszTargetName: PCSTR, pContext: PCtxtHandle, dwAuthError: DWORD,
        pszUserName: PSTR, ulUserNameBufferSize: ULONG, pszPassword: PSTR,
        ulPasswordBufferSize: ULONG, save: *mut BOOL, dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUIPromptForCredentialsW(
        pUiInfo: PCREDUI_INFOW, pszTargetName: PCWSTR, pContext: PCtxtHandle, dwAuthError: DWORD,
        pszUserName: PWSTR, ulUserNameBufferSize: ULONG, pszPassword: PWSTR,
        ulPasswordBufferSize: ULONG, save: *mut BOOL, dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUIPromptForWindowsCredentialsA(
        pUiInfo: PCREDUI_INFOA, dwAuthError: DWORD, pulAuthPackage: *mut ULONG,
        pvInAuthBuffer: LPCVOID, ulInAuthBufferSize: ULONG, ppvOutAuthBuffer: *mut LPVOID,
        pulOutAuthBufferSize: *mut ULONG, pfSave: *mut BOOL, dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUIPromptForWindowsCredentialsW(
        pUiInfo: PCREDUI_INFOW, dwAuthError: DWORD, pulAuthPackage: *mut ULONG,
        pvInAuthBuffer: LPCVOID, ulInAuthBufferSize: ULONG, ppvOutAuthBuffer: *mut LPVOID,
        pulOutAuthBufferSize: *mut ULONG, pfSave: *mut BOOL, dwFlags: DWORD,
    ) -> DWORD;
    pub fn CredUIReadSSOCredW(pszRealm: PCWSTR, ppszUsername: *mut PWSTR) -> DWORD;
    pub fn CredUIStoreSSOCredW(
        pszRealm: PCWSTR, pszUsername: PCWSTR, pszPassword: PCWSTR, bPersist: BOOL,
    ) -> DWORD;
    pub fn CredUnPackAuthenticationBufferA(
        dwFlags: DWORD, pAuthBuffer: PVOID, cbAuthBuffer: DWORD, pszUserName: LPSTR,
        pcchlMaxUserName: *mut DWORD, pszDomainName: LPSTR, pcchMaxDomainName: *mut DWORD,
        pszPassword: LPSTR, pcchMaxPassword: *mut DWORD,
    ) -> BOOL;
    pub fn CredUnPackAuthenticationBufferW(
        dwFlags: DWORD, pAuthBuffer: PVOID, cbAuthBuffer: DWORD, pszUserName: LPWSTR,
        pcchlMaxUserName: *mut DWORD, pszDomainName: LPWSTR, pcchMaxDomainName: *mut DWORD,
        pszPassword: LPWSTR, pcchMaxPassword: *mut DWORD,
    ) -> BOOL;
    pub fn SspiGetCredUIContext(
        ContextHandle: HANDLE, CredType: *mut GUID, LogonId: *mut LUID,
        CredUIContexts: *mut PSEC_WINNT_CREDUI_CONTEXT_VECTOR, TokenHandle: *mut HANDLE,
    ) -> SECURITY_STATUS;
    pub fn SspiIsPromptingNeeded(ErrorOrNtStatus: c_ulong) -> BOOLEAN;
    pub fn SspiPromptForCredentialsA(
        pszTargetName: PCSTR, pUiInfo: PCREDUI_INFOA, dwAuthError: c_ulong, pszPackage: PCSTR,
        pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
        ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, pfSave: *mut c_int, dwFlags: c_ulong,
    ) -> c_ulong;
    pub fn SspiPromptForCredentialsW(
        pszTargetName: PCWSTR, pUiInfo: PCREDUI_INFOW, dwAuthError: c_ulong, pszPackage: PCWSTR,
        pInputAuthIdentity: PSEC_WINNT_AUTH_IDENTITY_OPAQUE,
        ppAuthIdentity: *mut PSEC_WINNT_AUTH_IDENTITY_OPAQUE, pfSave: *mut c_int, dwFlags: c_ulong,
    ) -> c_ulong;
    pub fn SspiUnmarshalCredUIContext(
        MarshaledCredUIContext: PUCHAR, MarshaledCredUIContextLength: ULONG,
        CredUIContext: *mut PSEC_WINNT_CREDUI_CONTEXT,
    ) -> SECURITY_STATUS;
    pub fn SspiUpdateCredentials(
        ContextHandle: HANDLE, CredType: *mut GUID, FlatCredUIContextLength: ULONG,
        FlatCredUIContext: PUCHAR,
    ) -> SECURITY_STATUS;
}


text:
package io.realm.internal;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nullable;

import io.realm.RealmFieldType;

/**
 * The Subclasses of this are a fast cache of column indices, for proxy object.
 *

 * The fast cache functionality is implemented in the Proxy classes generated by {@code RealmProxyClassGenerator}.
 * Every proxy object will hold an reference of its {@code ColumnInfo}. The ref to the {@code ColumnInfo} instance is
 * maintained by the {@link ColumnIndices}. As long as the reference in proxy object has been set, it should never be
 * changed. When schema changes, the relevant {@code ColumnInfo} instance's content will be refreshed therefore the
 * proxy object could have the latest column indices. Be sure to understand what is going on there,
 * before changing things here.
 *

 * While the use of the fields in {@code ColumnDetails} is consistent, there are three subtly different cases:
 *

 *
If the column type is a simple type, the {@code linkedClassName} field is {@code null}

 *
If the column type is OBJECT or LINK, the {@code linkedClassName} field is the class name of the OBJECT/LINK type

 *
If the column type is LINKING_OBJECT, the {@code linkedClassName} field is the class name of the backlink source table
 * and the column index field is the index of the backlink source field, in the source table

 *

 *

 * The instance of this class is dedicated to a single {@link OsSharedRealm} instance. Thus this is not supposed to be
 * used across threads.
 * An instance can be mutated, after construction, in four ways:
 *

 *
the {@code copyFrom} method

 *
as the dst parameter of the two-argument copy method

 *
using the {@code addColumnDetails} method

 *
using the {@code addBacklinkDetails} method

 *

 * Immutable instances of this class protect against the first possibility by throwing on calls
 * to {@code copyFrom}.  There are no checks against the other three mutations.  In order to comply
 * with the effectively-final contract:
 *

 *
the methods {@code addColumnDetails} and {@code addBacklinkDetails} must be called
 * only from within instance constructors

 *
an immutable instance must never be the dst parameter of the two-argument copy method

 *

 */
public abstract class ColumnInfo {

    // Immutable column information
    public static final class ColumnDetails {
        public final long columnIndex;
        public final RealmFieldType columnType;
        public final String linkedClassName;

        private ColumnDetails(long columnIndex, RealmFieldType columnType, @Nullable String linkedClassName) {
            // invariant: (columnType == OBJECT || columnType == LIST || columnType == LINKING_OBJECTS) == (linkedClassName != null)
            this.columnIndex = columnIndex;
            this.columnType = columnType;
            this.linkedClassName = linkedClassName;
        }

        ColumnDetails(Property property) {
            this(property.getColumnIndex(), property.getType(), property.getLinkedObjectName());
        }

        @Override
        public String toString() {
            StringBuilder buf = new StringBuilder("ColumnDetails[");
            buf.append(columnIndex);
            buf.append(", ").append(columnType);
            buf.append(", ").append(linkedClassName);
            return buf.append("]").toString();
        }
    }

    private final Map<String, ColumnDetails> indicesMap;
    private final boolean mutable;

    /**
     * Create a new, empty instance
     *
     * @param mapSize the expected number of columns in the map.
     */
    protected ColumnInfo(int mapSize) {
        this(mapSize, true);
    }

    /**
     * Create an exact copy of the passed instance.
     *
     * @param src the instance to copy
     * @param mutable false to make this instance effectively final
     */
    protected ColumnInfo(@Nullable ColumnInfo src, boolean mutable) {
        this((src == null) ? 0 : src.indicesMap.size(), mutable);
        // ColumnDetails are immutable and may be re-used.
        if (src != null) {
            indicesMap.putAll(src.indicesMap);
        }
    }

    private ColumnInfo(int mapSize, boolean mutable) {
        this.indicesMap = new HashMap<>(mapSize);
        this.mutable = mutable;
    }

    /**
     * Get the mutability state of the instance.
     *
     * @return true if the instance is mutable
     */
    public final boolean isMutable() {
        return mutable;
    }

    /**
     * Returns the index, in the described table, for the named column.
     *
     * @return column index.
     */
    public long getColumnIndex(String columnName) {
        ColumnDetails details = indicesMap.get(columnName);
        return (details == null) ? -1 : details.columnIndex;
    }

    /**
     * Returns the {@link ColumnDetails}, in the described table, of the named column.
     *
     * @return {@link ColumnDetails} or {@code null} if not found.
     */
    @Nullable
    public ColumnDetails getColumnDetails(String columnName) {
        return indicesMap.get(columnName);
    }

    /**
     * Makes this ColumnInfo an exact copy of {@code src}.
     *
     * @param src The source for the copy.  This instance will be an exact copy of {@code src} after return.
     * {@code src} must not be {@code null}.
     * @throws IllegalArgumentException if {@code other} has different class than this.
     */
    public void copyFrom(ColumnInfo src) {
        if (!mutable) {
            throw new UnsupportedOperationException("Attempt to modify an immutable ColumnInfo");
        }
        if (null == src) {
            throw new NullPointerException("Attempt to copy null ColumnInfo");
        }

        indicesMap.clear();
        indicesMap.putAll(src.indicesMap);
        copy(src, this);
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder("ColumnInfo[");
        buf.append(mutable).append(",");
        if (indicesMap != null) {
            boolean commaNeeded = false;
            for (Map.Entry<String, ColumnDetails> entry : indicesMap.entrySet()) {
                if (commaNeeded) { buf.append(","); }
                buf.append(entry.getKey()).append("->").append(entry.getValue());
                commaNeeded = true;
            }
        }
        return buf.append("]").toString();
    }

    /**
     * Create a new object that is an exact copy of {@code src}.
     * This is the generic factory for ColumnInfo objects.
     * Subclasses are expected to override it with a proxy to a copy constructor.
     *
     * @param mutable false to make an immutable copy.
     */
    protected abstract ColumnInfo copy(boolean mutable);

    /**
     * Make {@code dst} into an exact copy of {@code src}.
     * Intended for use only by subclasses.
     * NOTE: there is no protection against calling this method with an "immutable" instance as dst!
     *
     * @param src The source for the copy
     * @param dst The destination of the copy.  Will be an exact copy of src after return.
     */
    protected abstract void copy(ColumnInfo src, ColumnInfo dst);

    /**
     * Add a new column to the indexMap.
     *

     * For use only in subclass constructors!.
     * Must be called from within the subclass constructor, to maintain the effectively-final contract.
     *

     * No validation done here.  Presuming that all necessary validation takes place in {@code Proxy.validateTable}.
     *
     * @param columnName The name of the column whose index is sought.
     * @param objectSchemaInfo the {@link OsObjectSchemaInfo} for the corresponding {@code RealmObject}.
     * @return the index of the column in the table
     */
    protected final long addColumnDetails(String columnName, OsObjectSchemaInfo objectSchemaInfo) {
        Property property = objectSchemaInfo.getProperty(columnName);
        indicesMap.put(columnName, new ColumnDetails(property));
        return property.getColumnIndex();
    }

    /**
     * Add a new backlink to the indexMap.
     * For use only by subclasses!.
     * Must be called from within the subclass constructor, to maintain the effectively-final contract.
     *
     * @param schemaInfo the {@link OsSchemaInfo} of the corresponding {@code Realm} instance.
     * @param columnName The name of the backlink column.
     * @param sourceTableName The name of the backlink source class.
     * @param sourceColumnName The name of the backlink source field.
     */
    protected final void addBacklinkDetails(OsSchemaInfo schemaInfo, String columnName, String sourceTableName, String sourceColumnName) {
        long columnIndex = schemaInfo.getObjectSchemaInfo(sourceTableName).getProperty(sourceColumnName).getColumnIndex();
        indicesMap.put(columnName, new ColumnDetails(columnIndex, RealmFieldType.LINKING_OBJECTS, sourceTableName));
    }

    /**
     * Returns the {@link Map} that is the implementation for this object.
     * FOR TESTING USE ONLY!
     *
     * @return the column details map.
     */
    @SuppressWarnings("ReturnOfCollectionOrArrayField")
    public Map<String, ColumnDetails> getIndicesMap() {
        return indicesMap;
    }
}


text:
import { computed } from '@ember/object';

export default function(fallback) {
  return computed({
    get() {
      return fallback;
    },
    set(_, v) {
      return v === undefined ? fallback : v;
    }
  });
}


text:
<?php

namespace Kraken\Root\Provider;

use Kraken\Container\ContainerInterface;
use Kraken\Container\ServiceProvider;
use Kraken\Container\ServiceProviderInterface;
use Dazzle\Event\EventEmitter;

class EventProvider extends ServiceProvider implements ServiceProviderInterface
{
    /**
     * @var string[]
     */
    protected $requires = [
        'Dazzle\Loop\LoopInterface'
    ];

    /**
     * @var string[]
     */
    protected $provides = [
        'Dazzle\Event\EventEmitterInterface'
    ];

    /**
     * @param ContainerInterface $container
     */
    protected function register(ContainerInterface $container)
    {
        $emitter = new EventEmitter(
            $container->make('Dazzle\Loop\LoopInterface')
        );

        $container->instance(
            'Dazzle\Event\EventEmitterInterface',
            $emitter
        );
    }

    /**
     * @param ContainerInterface $container
     */
    protected function unregister(ContainerInterface $container)
    {
        $container->remove(
            'Dazzle\Event\EventEmitterInterface'
        );
    }
}


text:
\Pyrus\Config::userInitialized() basic test
--FILE--
<?php
require __DIR__ . '/setup.php.inc';
$test->assertFalse(r::userInitialized(), 'first, nothing found');
r::$foo = 2;
mkdir(TESTDIR . '/testing');
file_put_contents(TESTDIR . '/testing/myfile.xml', '<hi/>');
$test->assertTrue(r::userInitialized(), 'second, myfile.xml found');
r::$foo = 1;
copy(TESTDIR . '/testing/myfile.xml', TESTDIR . '/testing/pearconfig.xml');
$dir = getcwd();
chdir(TESTDIR . '/testing');
$test->assertFileExists(TESTDIR . '/testing/pearconfig.xml', 'pearconfig.xml should exist');
$test->assertTrue(r::userInitialized(), 'third, pearconfig.xml found');
file_put_contents(TESTDIR . '/testing/pearconfig.xml', '<?xml version="1.0"?>
<pearconfig version="1.0">
 <default_channel>pear2.php.net</default_channel>
 <preferred_mirror>
  <pear2DOTphpDOTnet>pear2.php.net</pear2DOTphpDOTnet>
 </preferred_mirror>
 <auto_discover>0</auto_discover>
 <download_dir>
  <pear2DOTphpDOTnet>/hoo/boy</pear2DOTphpDOTnet>
 </download_dir>
</pearconfig>
');
$t = r::singleton();
$test->assertEquals(TESTDIR . DIRECTORY_SEPARATOR . 'testing' . DIRECTORY_SEPARATOR . 'pearconfig.xml', $t->userfile, 'pearconfig.xml file');
$test->assertEquals('/hoo/boy', $t->download_dir, 'check whether it loaded pearconfig.xml');
chdir($dir);
?>
===DONE===
--CLEAN--
--CLEAN--
<?php
include __DIR__ . '/../../clean.php.inc';
?>
--EXPECT--
===DONE===


text:
package org.wso2.developerstudio.eclipse.gmf.esb.impl;

import org.eclipse.emf.ecore.EClass;

import org.wso2.developerstudio.eclipse.gmf.esb.DBReportMediatorOutputConnector;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;

/**
 *
 * An implementation of the model object 'DB Report Mediator Output Connector'.
 *
 *
 * @generated
 */
public class DBReportMediatorOutputConnectorImpl extends OutputConnectorImpl
        implements DBReportMediatorOutputConnector {
    /**
     *
     *
     * @generated
     */
    protected DBReportMediatorOutputConnectorImpl() {
        super();
    }

    /**
     *
     *
     * @generated
     */

    @Override
    protected EClass eStaticClass() {
        return EsbPackage.Literals.DB_REPORT_MEDIATOR_OUTPUT_CONNECTOR;
    }

} // DBReportMediatorOutputConnectorImpl


text:
package com.jlj.action;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.jlj.model.Footer;
import com.jlj.model.Pubclient;
import com.jlj.model.Wgw;
import com.jlj.service.IFooterService;
import com.jlj.service.IWgwService;
import com.opensymphony.xwork2.ActionSupport;

@Component("footerAction")
@Scope("prototype")
public class FooterAction extends ActionSupport implements RequestAware,
SessionAware,ServletResponseAware,ServletRequestAware {

	private static final long serialVersionUID = 1L;
	//service
	private IWgwService wgwService;
	private IFooterService footerService;
	Map<String,Object> request;
	Map<String,Object> session;
	private javax.servlet.http.HttpServletResponse response;
	private javax.servlet.http.HttpServletRequest req;
	//单个对象
	private int id;
	private Wgw wgw;
	private Footer footer;
	//操作参数
	private String[] arg=new String[2];

	//前台参数
	private int wgwid;
	//前台=======================================================start
	public String frontFooter(){
		footer = footerService.queryFooterByWgwId(wgwid);
		request.put("footer", footer);
		return NONE;
	}

	//=========后台管理=================================================start
	/**
	 * 添加
	 * @return
	 * @throws Exception
	 */

	public String add() throws Exception{
		String paccount=((Pubclient)session.get("pubclient")).getPublicaccount();
		footer.setPublicaccount(paccount);
		footerService.add(footer);

		arg[0]="footerAction!view";
		arg[1]="底部版权设置";
		return SUCCESS;
	}

	/**
	 * 修改
	 * @return
	 */
	public String update() throws Exception{
		String paccount=((Pubclient)session.get("pubclient")).getPublicaccount();
		footer.setPublicaccount(paccount);
		footerService.update(footer);

		arg[0]="footerAction!view";
		arg[1]="底部版权设置";
		return SUCCESS;
	}
	/**
	 * 查看信息
	 * @return
	 */
	public String view(){
		String paccount=((Pubclient)session.get("pubclient")).getPublicaccount();
		wgw=wgwService.queryWgwByPublicAccount(paccount);
		if(wgw!=null){
			//判断该公众号的轮播图片是否存在,不存在跳转到add;存在跳转到load页
			footer=footerService.queryFooterByPublicAccount(paccount);
			if(footer!=null){
				return "load";
			}else{
				return "add";
			}
		}else{
			//请先设置微官网
			arg[0]="wgwAction!view";
			arg[1]="微官网设置";
			String goInfo = "请先设置微官网";
			request.put("goInfo", goInfo);
			return "goanother";
		}

	}

	//get、set-------------------------------------------
	public IFooterService getFooterService() {
		return footerService;
	}
	@Resource
	public void setFooterService(IFooterService footerService) {
		this.footerService = footerService;
	}
	public IWgwService getWgwService() {
		return wgwService;
	}
	@Resource
	public void setWgwService(IWgwService wgwService) {
		this.wgwService = wgwService;
	}

	// 获得HttpServletResponse对象
    public void setServletResponse(HttpServletResponse response)
    {
        this.response = response;
    }
    public void setServletRequest(HttpServletRequest req) {
		this.req = req;
	}

    public Map<String, Object> getRequest() {
		return request;
	}
	public void setRequest(Map<String, Object> request) {
		this.request = request;
	}
	public Map<String, Object> getSession() {
		return session;
	}
	public void setSession(Map<String, Object> session) {
		this.session = session;
	}
    //传参
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	public void setFooter(Footer footer) {
		this.footer = footer;
	}

	public Footer getFooter() {
		return footer;
	}
	public String[] getArg() {
		return arg;
	}
	public void setArg(String[] arg) {
		this.arg = arg;
	}

	public Wgw getWgw() {
		return wgw;
	}
	public void setWgw(Wgw wgw) {
		this.wgw = wgw;
	}

	public int getWgwid() {
		return wgwid;
	}

	public void setWgwid(int wgwid) {
		this.wgwid = wgwid;
	}

}


text:
![logo](http://www.samsmartinc.com/assets/user/upload/images/muffin.png)

**mafen** is a web-based application that helps u with various [Haven & Hearth](http://www.havenandhearth.com/portal/) tasks.
For example, you can check your character's inventory and study any items you want, view your character's attributes (incl. hidden ones), or chat with other players via area / village / kingdom chats. Note that you can do it from any device you have at the moment. No need to launch a full desktop H&H client at all!

![study](http://i.imgur.com/BFGu2yB.png)

![nearby players list](http://i.imgur.com/NVkGb3a.png)

![chats](http://i.imgur.com/sH3INJp.png)

![attrs](http://i.imgur.com/AJ7wUbJ.png)

**(click me)**

## Usage

* git clone
* Install [Python 2.x](https://www.python.org/)
* Install [Node.js](https://nodejs.org/en/)

### Start service
* cd service
* pip install -r requirements.txt
* vim config.ini (optional)
* python main.py &

### Start web backend
* cd web
* npm install
* vim server/config.json (optional)
* gulp bundle-js
* node server/index.js & # consider about using [forever](https://github.com/foreverjs/forever) though

**NOTE** that if you want to route your browser's requests to your own instance of mafen service, you have to change a hard coded WebSocket URL in the [LoginCtrl.js](web/client/scripts/controllers/LoginCtrl.js) from this one

'ws://mafen.club:8000'

to this one

'ws://localhost:8000'

## How can I help?
* ![star](http://github-svg-buttons.herokuapp.com/star.svg?user=b0r3d0m&repo=mafen) this project!
* ![fork](http://github-svg-buttons.herokuapp.com/fork.svg?user=b0r3d0m&repo=mafen) and create pull requests with any changes you want
* Feel free to send me an email with feature requests and your feedback

## License

Copyright © 2017 b0r3d0m <b0r3d0mness@gmail.com>

Distributed under the [MIT License](LICENSE.txt).

[Background image](web/client/bg.jpg) was made by [ragxar](http://havenandhearth.ru/viewtopic.php?f=67&t=2490#p23479).


text:
Codeigniter auto breadcrumb library for CI 2.2.2 or above

# Installation

1.Just merge the library into the approriate place, you can use it anywhere

2. To start using the library,
	- Open the library, check the Template() function inside it,
	- edit the embedded html as well as you want.
	- There are some additional static link that will appear on rightside of the primary breadcrumb, you also can use it.
	- to start the auto-breadcrumb, just echo $this->breadcrumb->generate() on you view or
	- $data['breadcrumb'] = $this->breadcrumb->generate(); from your controller

3. Enjoy the library anywhere


text:
const ALL_METHODS = {
  compara: {
    name: 'Compara',
    icon: 'http://static.ensembl.org/i/ensembl-favicon.png'
  },
  eggnog: {
    name: 'eggNOG'
  },
  hgnc: {
    name: 'HGNC',
    icon: 'http://www.genenames.org/sites/genenames.org/files/genenames_favicon_0.ico'
  },
  homologene: {
    name: 'Homologene',
    icon: 'https://www.ncbi.nlm.nih.gov/favicon.ico'
  },
  inparanoid: {
    name: 'Inparanoid',
    icon: 'http://inparanoid.sbc.su.se/favicon.ico'
  },
  isobase: {
    name: 'Isobase',
  },
  oma: {
    name: 'OMA',
    icon: 'https://omictools.com/img/apple-touch-icon.png'
  },
  orthodb: {
    name: 'OrthoDB',
  },
  orthomcl: {
    name: 'orthoMCL',
    icon: 'http://orthomcl.org/orthomcl/images/OrthoMCL/favicon.ico'
  },
  panther: {
    name: 'Panther',
    icon: 'http://www.pantherdb.org/favicon.ico'
  },
  phylome: {
    name: 'Phylome',
    icon: 'http://phylomedb.org/sites/default/files/images/phylomedb.ico'
  },
  roundup: {
    name: 'RoundUp'
  },
  treefam: {
    name: 'TreeFam',
    icon: 'http://www.treefam.org/static/images/favicon.png'
  },
  zfin: {
    name: 'ZFIN',
    icon: 'https://zfin.org/images/zfinlogo.png'
//    icon: 'https://zfin.org/favicon.ico'
  }
};

const methodCellWidth = 25;

const methodHeaderStyle = {
  minWidth: methodCellWidth * Object.keys(ALL_METHODS).length,
  height: '70px',
};

const methodCellStyle = {
  width: methodCellWidth,
  display: 'inline-block',
  textAlign: 'center',
  lineHeight: '20px',
};

const methodHeaderCellStyle = {
  transform: 'translate(0px, 45px) rotate(-45deg)',
  width: methodCellWidth,
  display: 'inline-block',
};

export {
  ALL_METHODS,
  methodCellStyle,
  methodCellWidth,
  methodHeaderCellStyle,
  methodHeaderStyle,
};


text:
import passwordValidator from './password';

const returnStateBase = {
  isValid: false,
  state: 'base',
};
const returnStateStrong = {
  isValid: true,
  state: 'strong',
};

describe('Validating password input', () => {
  it('The password isnt long enough', () => {
    const result = passwordValidator({ value: '' });
    expect(result).toMatchObject(returnStateBase);
  });
  it('The password is very long enough', () => {
    const result = passwordValidator({ value: 'aaaaaaaaaaaaaaaa' });
    expect(result).toMatchObject(returnStateStrong);
  });
});


text:
require 'spec_helper'

module Askalot
  describe QuestionnairesHelper do
    describe 'option_id' do
      it 'generates id for option fields' do
        questionnaire = stub_model(Questionnaire, id: 11)
        question = stub_model(Question, id: 22, questionnaire: questionnaire)
        option = stub_model(Option, id: 33, question: question)
        helper.option_id(option).should == '11_22_33'
      end
    end

    describe 'option_tag' do
      it 'returns tags for radio or checkbox, depending on question type' do
        helper.option_tag(stub_model(Question, multiple?: true), '1_2_3').should\
          == '<input id="1_2_3" name="1_2_3" type="checkbox" value="1" />'
        helper.option_tag(stub_model(Question, multiple?: false), '1_2_3').should\
          == '<input id="1_2_3" name="1_2" type="radio" value="3" />'
      end
    end

    describe 'question_id' do
      it 'returns unique id for question elements' do
        helper.question_id(stub_model(Question, id: 1)).should == 'question_1'
      end
    end

    describe 'test_answer_tag' do
      it 'returns appropriate tag for text answers' do
        helper.text_answer_tag(stub_model(Question, id: 1)).should == \
          "<textarea id='question_1' />"
      end
    end
  end
end


text:
package com.limpygnome.parrot.component.ui;

import com.limpygnome.parrot.library.db.Database;
import com.limpygnome.parrot.library.db.DatabaseNode;
import javafx.event.EventHandler;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.web.WebView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.html.HTMLElement;

/**
 * Context menu for options of database nodes, when right-clicking web-view rendered by {@link WebViewStage}.
 */
public class ContextMenuHandler implements EventHandler<MouseEvent>
{
    private static final Logger LOG = LoggerFactory.getLogger(ContextMenuHandler.class);

    // The parent window/stage to which this belongs
    private WebViewStage webViewStage;

    // The current context menu; only instantiated when the context menu is open
    private ContextMenu contextMenu;

    public ContextMenuHandler(WebViewStage webViewStage)
    {
        this.webViewStage = webViewStage;
        attach();
    }

    /**
     * Attaches context menu to web view.
     */
    public void attach()
    {
        WebView webView = webViewStage.getWebView();

        // Disable default ctx menu
        webView.setContextMenuEnabled(false);

        // Hook mouse event
        webView.setOnMousePressed(this);
    }

    @Override
    public void handle(MouseEvent event)
    {
        WebView webView = webViewStage.getWebView();

        // Hide/destroy previous menu
        if (contextMenu != null)
        {
            contextMenu.hide();
            contextMenu = null;
        }

        // Determine if to show ctx menu
        if (event.getButton() == MouseButton.SECONDARY)
        {
            // Fetch element clicked
            String injectedScript = "document.elementFromPoint(" + event.getX() + "," + event.getY() + ");";
            netscape.javascript.JSObject object = (netscape.javascript.JSObject) webView.getEngine().executeScript(injectedScript);
            HTMLElement element = (HTMLElement) object;
            String selectedNodeId = element.getAttribute("id");

            if (selectedNodeId != null)
            {
                // Strip out _anchor from jstree
                if (selectedNodeId.endsWith("_anchor"))
                {
                    selectedNodeId = selectedNodeId.substring(0, selectedNodeId.length() - 7);
                }

                LOG.debug("ctx menu - node selected - id: {}", selectedNodeId);

                // Fetch database node
                Database database = webViewStage.getServiceFacade().getDatabaseService().getDatabase();

                if (database != null)
                {
                    DatabaseNode databaseNode = database.getNode(selectedNodeId);

                    if (databaseNode != null)
                    {
                        contextMenu = buildContextMenu(databaseNode);
                        contextMenu.show(webView, event.getScreenX(), event.getScreenY());

                        LOG.debug("showing context menu");
                    }
                    else
                    {
                        LOG.warn("unable to retrieve node - id: {}", selectedNodeId);
                    }
                }
                else
                {
                    LOG.warn("no database available, unable to retrieve database node - id: {}", selectedNodeId);
                }
            }
        }
    }

    private ContextMenu buildContextMenu(DatabaseNode databaseNode)
    {
        ContextMenu contextMenu = new ContextMenu();

        if (!databaseNode.isRoot())
        {
            MenuItem itemCopyClipboard = new MenuItem("Copy to clipboard");
            itemCopyClipboard.setOnAction(e ->
            {
                webViewStage.triggerEvent("document", "databaseClipboardEvent", databaseNode.getId());
            });

            contextMenu.getItems().addAll(itemCopyClipboard);
        }

        MenuItem itemAddEntry = new MenuItem("Add Entry");
        itemAddEntry.setOnAction(e -> {
            webViewStage.triggerEvent("document", "databaseEntryAdd", databaseNode.getId());
        });

        contextMenu.getItems().add(itemAddEntry);

        if (!databaseNode.isRoot())
        {
            MenuItem itemDeleteEntry = new MenuItem("Delete Entry");
            itemDeleteEntry.setOnAction(e ->
            {
                webViewStage.triggerEvent("document", "databaseEntryDelete", databaseNode.getId());
            });

            contextMenu.getItems().addAll(itemDeleteEntry);
        }

        // collapse/expand items
        SeparatorMenuItem collapseExpandSeparator = new SeparatorMenuItem();

        MenuItem itemExpand = new MenuItem("Expand");
        itemExpand.setOnAction(e ->
        {
            webViewStage.triggerEvent("document", "databaseEntryExpand", databaseNode.getId());
        });

        MenuItem itemExpandAll = new MenuItem("Expand All");
        itemExpandAll.setOnAction(e ->
        {
            webViewStage.triggerEvent("document", "databaseEntryExpandAll", databaseNode.getId());
        });

        MenuItem itemCollapse = new MenuItem("Collapse");
        itemCollapse.setOnAction(e ->
        {
            webViewStage.triggerEvent("document", "databaseEntryCollapse", databaseNode.getId());
        });

        MenuItem itemCollapseAll = new MenuItem("Collapse All");
        itemCollapseAll.setOnAction(e ->
        {
            webViewStage.triggerEvent("document", "databaseEntryCollapseAll", databaseNode.getId());
        });

        contextMenu.getItems().addAll(collapseExpandSeparator, itemExpand, itemExpandAll, itemCollapse, itemCollapseAll);

        return contextMenu;
    }

}


text:
declare class A {
  static prototype: Object; // error
}


text:
$module('boolean', function () {
  var $static = this;
  $static.TEST = function () {
    var first;
    var second;
    first = $t.fastbox(true, $g.________testlib.basictypes.Boolean);
    second = $t.fastbox(false, $g.________testlib.basictypes.Boolean);
    return $t.fastbox(((first.$wrapped && second.$wrapped) || first.$wrapped) || !second.$wrapped, $g.________testlib.basictypes.Boolean);
  };
});


text:
/// <reference path='fourslash.ts' />

////// no a or b
/////*1*/(a, b) => { }

goTo.marker("1");
verify.not.completionListContains("a");
verify.not.completionListContains("b");


text:
import GDALUtils; const GU = GDALUtils

GU.registerdrivers() do
    GU.read("ospy/data3/sites.shp") do sitesDS
        GU.read("ospy/data3/cache_towns.shp") do townsDS
            siteslayer = GU.fetchlayer(sitesDS, 0)
            townslayer = GU.fetchlayer(townsDS, 0)

            # use an attribute filter to restrict cache_towns.shp to "Nibley"
            GU.setattributefilter(townslayer, "NAME = 'Nibley'")

            GU.fetchfeature(townslayer, 0) do nibleyFeature
                # get the Nibley geometry and buffer it by 1500
                nibleyGeom = GU.getgeom(nibleyFeature)
                bufferGeom = GU.buffer(nibleyGeom, 1500)

                # use bufferGeom as a spatial filter on sites.shp to get all sites
                # within 1500 meters of Nibley
                GU.setspatialfilter(siteslayer, bufferGeom)

                # loop through the remaining features in sites.shp and print their
                # id values
                for sitefeature in siteslayer
                    id_index = GU.getfieldindex(sitefeature, "ID")
                    println(GU.fetchfield(sitefeature, id_index))
                end
            end
        end
    end
end


text:
using System;
using System.Drawing;
using UIKit;
using Foundation;
using CoreGraphics;
using RectangleF = CoreGraphics.CGRect;
using SizeF = CoreGraphics.CGSize;
using PointF = CoreGraphics.CGPoint;

namespace SidebarNavigation
{
	public class SidebarController : UIViewController
    {
        protected readonly Sidebar _sidebar;

		/// <summary>
		/// Required contructor.
		/// </summary>
		public SidebarController(IntPtr handle) : base(handle)
		{
		}

		/// <summary>
		/// Contructor.
		/// </summary>
		/// <param name="rootViewController">
		/// The view controller that the Sidebar is being added to.
		/// </param>
		/// <param name="contentViewController">
		/// The view controller for the content area.
		/// </param>
		/// <param name="menuViewController">
		/// The view controller for the side menu.
		/// </param>
		public SidebarController(
			UIViewController rootViewController,
			UIViewController contentViewController,
			UIViewController menuViewController)
		{
			_sidebar = new Sidebar(rootViewController, contentViewController, menuViewController);

			_sidebar.StateChangeHandler += (sender, e) => {
				if (StateChangeHandler != null)
					StateChangeHandler.Invoke(sender, e);
			};

			ChangeMenuView(menuViewController);
			ChangeContentView(contentViewController);

			AttachSidebarControllerToRootController(rootViewController);
		}

		/// <summary>
		/// This Event will be called when the Sidebar menu is Opened/Closed (at the end of the animation).
		/// The Event Arg is a Boolean = isOpen.
		/// </summary>
		public event EventHandler<bool> StateChangeHandler;

		/// <summary>
		/// The view controller shown in the content area.
		/// </summary>
        public virtual UIViewController ContentAreaController { get { return _sidebar.ContentViewController; } }

		/// <summary>
		/// The view controller for the side menu.
		/// This is what will be shown when the menu is displayed.
		/// </summary>
        public virtual UIViewController MenuAreaController { get { return _sidebar.MenuViewController; } }

		/// <summary>
		/// Exposes the underlying sidebar object
		/// </summary>
		public virtual Sidebar Sidebar => _sidebar;

		/// <summary>
		/// Determines the percent of width to complete slide action.
		/// </summary>
		public float FlingPercentage {
			get { return _sidebar.FlingPercentage; }
			set { _sidebar.FlingPercentage = value; }
		}

		/// <summary>
		/// Determines the minimum velocity considered a "fling" to complete slide action.
		/// </summary>
		public float FlingVelocity {
			get { return _sidebar.FlingVelocity; }
			set { _sidebar.FlingVelocity = value; }
		}

		/// <summary>
		/// Active area where the Pan gesture is intercepted.
		/// </summary>
		public float GestureActiveArea {
			get { return _sidebar.GestureActiveArea; }
			set { _sidebar.GestureActiveArea = value; }
		}

		/// <summary>
		/// Gets or sets a value indicating whether there should be shadowing effects on the content view.
		/// </summary>
		public bool HasShadowing {
			get { return _sidebar.HasShadowing; }
			set { _sidebar.HasShadowing = value; }
		}

		/// <summary>
		/// Gets or sets the shadow opacity.
		/// </summary>
		public float ShadowOpacity {
			get { return _sidebar.ShadowOpacity; }
			set { _sidebar.ShadowOpacity = value; }
		}

		/// <summary>
		/// Gets or sets the color of the shadow.
		/// </summary>
		public UIColor ShadowColor {
			get { return _sidebar.ShadowColor; }
			set { _sidebar.ShadowColor = value; }
		}

		/// <summary>
		/// Gets or sets the shadow radius.
		/// </summary>
		/// <value>The shadow radius.</value>
		public float ShadowRadius
		{
			get { return _sidebar.ShadowRadius; }
			set { _sidebar.ShadowRadius = value; }
		}

		/// <summary>
		/// Gets or sets a value indicating whether there should be a dark overlay effect on the content view.
		/// </summary>
		public bool HasDarkOverlay {
			get { return _sidebar.HasDarkOverlay; }
			set { _sidebar.HasDarkOverlay = value; }
		}

		/// <summary>
		/// Gets or sets a value indicating the dark overlay alpha.
		/// </summary>
		public float DarkOverlayAlpha {
			get { return _sidebar.DarkOverlayAlpha; }
			set { _sidebar.DarkOverlayAlpha = value; }
		}

		/// <summary>
		/// Determines if the menu should be reopened after the screen is roated.
		/// </summary>
		public bool ReopenOnRotate {
			get { return _sidebar.ReopenOnRotate; }
			set { _sidebar.ReopenOnRotate = value; }
		}

		/// <summary>
		/// Determines the width of the menu when open.
		/// </summary>
		public int MenuWidth {
			get { return _sidebar.MenuWidth; }
			set { _sidebar.MenuWidth = value; }
		}

		/// <summary>
		/// Determines if the menu is on the left or right of the screen.
		/// </summary>
		public MenuLocations MenuLocation {
			get { return _sidebar.MenuLocation; }
			set { _sidebar.MenuLocation = value; }
		}

		/// <summary>
		/// Disables all open/close actions when set to true.
		/// </summary>
		public bool Disabled {
			get { return _sidebar.Disabled; }
			set { _sidebar.Disabled = value; }
		}

		/// <summary>
		/// Gets or sets a value indicating whether the pan gesture is disabled.
		/// </summary>
		public bool DisablePanGesture
		{
			get { return _sidebar.DisablePanGesture; }
			set { _sidebar.DisablePanGesture = value; }
		}

		/// <summary>
		/// Gets the current state of the menu.
		/// Setting this property will open/close the menu respectively.
		/// </summary>
        public virtual bool IsOpen
		{
			get { return _sidebar.IsOpen; }
			set
			{
				_sidebar.IsOpen = value;
				if (_sidebar.IsOpen)
					CloseMenu();
				else
					OpenMenu();
			}
		}

		/// <summary>
		/// Toggles the menu open or closed.
		/// </summary>
        public virtual void ToggleMenu()
		{
			if (IsOpen)
				_sidebar.CloseMenu();
			else
				_sidebar.OpenMenu();
		}

		/// <summary>
		/// Shows the slideout navigation menu.
		/// </summary>
        public virtual void OpenMenu()
		{
			_sidebar.OpenMenu();
		}

		/// <summary>
		/// Hides the slideout navigation menu.
		/// </summary>
        public virtual void CloseMenu(bool animate = true)
		{
			_sidebar.CloseMenu(animate);
		}

		/// <summary>
		/// Replaces the content area view controller with the specified view controller.
		/// </summary>
		/// <param name="newContentView">
		/// New content view.
		/// </param>
        public virtual void ChangeContentView(UIViewController newContentView)
        {
			_sidebar.ChangeContentView(newContentView);
			AddContentViewToSidebar();
			CloseMenu();
		}

		/// <summary>
		/// Replaces the menu area view controller with the specified view controller.
		/// </summary>
		/// <param name="newMenuView">
		/// New menu view.
		/// </param>
        public virtual void ChangeMenuView(UIViewController newMenuView)
        {
			_sidebar.ChangeMenuView(newMenuView);
			AddMenuViewToSidebar();
		}

        protected virtual void AddContentViewToSidebar()
		{
			SetContentViewBounds();
			SetContentViewPosition();
			View.AddSubview(ContentAreaController.View);
			AddChildViewController(ContentAreaController);
		}

        protected virtual void SetContentViewBounds()
		{
			var sidebarBounds = View.Bounds;
			if (ContentAreaController.View.Bounds.Equals(sidebarBounds))
				return;
			ContentAreaController.View.Bounds = sidebarBounds;
		}

        protected virtual void SetContentViewPosition()
		{
			var sidebarBounds = View.Bounds;
			if (IsOpen)
				sidebarBounds.X = MenuWidth;
			ContentAreaController.View.Layer.AnchorPoint = new PointF(.5f, .5f);
			if (ContentAreaController.View.Frame.Location.Equals(sidebarBounds.Location))
				return;
			var sidebarCenter = new PointF(sidebarBounds.Left + sidebarBounds.Width / 2, sidebarBounds.Top + sidebarBounds.Height / 2);
			ContentAreaController.View.Center = sidebarCenter;
		}

        protected virtual void AddMenuViewToSidebar()
		{
			SetMenuViewPosition();
			View.AddSubview(MenuAreaController.View);
			View.SendSubviewToBack(MenuAreaController.View);
		}

        protected virtual void SetMenuViewPosition() {
			var menuFrame = MenuAreaController.View.Frame;
			menuFrame.X = MenuLocation == MenuLocations.Left ? 0 : View.Frame.Width - MenuWidth;
			menuFrame.Width = MenuWidth;
			menuFrame.Height = View.Frame.Height;
			MenuAreaController.View.Frame = menuFrame;
		}

        protected virtual void AttachSidebarControllerToRootController(UIViewController rootViewController) {
			rootViewController.AddChildViewController(this);
			rootViewController.View.AddSubview(this.View);
			this.DidMoveToParentViewController(rootViewController);
		}

		/// <summary>
		/// Ensures that the menu view gets properly positioned.
		/// </summary>
		public override void ViewDidLayoutSubviews()
		{
			base.ViewDidLayoutSubviews();
			SetMenuViewPosition();
		}

		/// <summary>
		/// Ensures that the menu view gets properly positioned.
		/// </summary>
		public override void ViewWillAppear(bool animated)
		{
			View.SetNeedsLayout();
			base.ViewWillAppear(animated);
		}

        protected bool _openWhenRotated = false;

		/// <summary>
		/// Overridden to handle reopening the menu after rotation.
		/// </summary>
		public override void WillRotate(UIInterfaceOrientation toInterfaceOrientation, double duration)
		{
			base.WillRotate(toInterfaceOrientation, duration);
			if (IsOpen)
				_openWhenRotated = true;
			_sidebar.CloseMenu(false);
		}

		/// <summary>
		/// Overridden to handle reopening the menu after rotation.
		/// </summary>
		public override void DidRotate(UIInterfaceOrientation fromInterfaceOrientation)
		{
			base.DidRotate(fromInterfaceOrientation);
			if (_openWhenRotated && ReopenOnRotate)
				_sidebar.OpenMenu();
			_openWhenRotated = false;
		}
	}
}


text:
package at.ac.tuwien.dsg.sanalytics.bridge.stdio;

import org.springframework.integration.transformer.GenericTransformer;
import org.springframework.stereotype.Component;

import at.ac.tuwien.dsg.sanalytics.events.Datapoint;

@Component("inputTransformer")
public class StringToDatapointTransformer implements GenericTransformer<String, Object>{

	@Override
	public Object transform(String source) {
		return Datapoint.from(source);
	}

}


text:
/*apply a natural box layout model to all elements but allowing components to change*/
html {
  box-sizing: border-box;

}

*, *:before, *:after {
  box-sizing: inherit;
}

html,body {

  font-size:30px;
  padding: 0; margin: 0;
}

.wrap-sketch-holder {
  /*-webkit-box-shadow: 3px 3px 5px 6px #ccc;
  -moz-box-shadow:    3px 3px 5px 6px #ccc;
  box-shadow:         3px 3px 5px 6px #ccc;*/

  position: fixed;
  display: flex;
  flex-grow: 1;
}
#sketch-holder{
  position: absolute;
  margin: auto;
}


text:
require 'google/protobuf'

require 'google/firestore/v1/document_pb'

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file("google/firestore/v1/aggregation_result.proto", :syntax => :proto3) do
    add_message "google.firestore.v1.AggregationResult" do
      map :aggregate_fields, :string, :message, 2, "google.firestore.v1.Value"
    end
  end
end

module Google
  module Cloud
    module Firestore
      module V1
        AggregationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.firestore.v1.AggregationResult").msgclass
      end
    end
  end
end


text:
typedef void (on_document_fetch)(mk_document *document);
void mk_dump_documents_from_coll(mk_session *session, mk_collection *collection, on_document_fetch on_fetch);

#endif


text:
package com.cnpc.framework.query.filter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class SimpleFilter extends BaseFilter {

	public SimpleFilter(ConditionOperator operator, IFilter leftHand,
			IFilter rightHand) {
		this.operator = operator;
		filterFragments.add(leftHand);
		filterFragments.add(rightHand);
	}

	public List getValues() throws RuntimeException {
		List ret = new ArrayList();
		IFilter filter;
		for (Iterator i$ = filterFragments.iterator(); i$.hasNext(); ret
				.addAll(filter.getValues()))
			filter = (IFilter) i$.next();
		return ret;
	}
}


text:
.page-container {margin:50px auto; width:600px;}
.page-container .alert{padding-left:50px; padding-right:50px;}