text:
static void* textUpdateContext = &textUpdateContext;

@implementation AB_ExpandableTextWatcher

- (void) awakeFromNib
{
    [self setupInitialSizes];
}

- (void) setupInitialSizes
{
    for (UITextView* textView in expandableTextViews)
    {
        [textView addObserver:self
                   forKeyPath:@"text"
                      options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld
                      context:textUpdateContext];

        [self sizeExpandableTextView:textView];
    }
}

- (void) dealloc
{
    [self closeExpandableViews];
}

- (void) closeExpandableViews
{
    for (UITextView* textView in expandableTextViews)
    {
        [textView removeObserver:self
                      forKeyPath:@"text"
                         context:textUpdateContext];
    }

    expandableTextViews = @[];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
                        change:(NSDictionary *)change context:(void *)context
{
    if (textUpdateContext == context)
    {
        UITextView* textView = (UITextView*) object;
        [self sizeExpandableTextView:textView];
    }
    else
    {
        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    }
}

- (void) sizeExpandableTextView:(UITextView*)expandableText
{
    BOOL originallySelected = expandableText.selectable;
    expandableText.selectable = YES;
    CGFloat dif = 0.f;

    NSMutableParagraphStyle* paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
    paragraphStyle.alignment = expandableText.textAlignment;

    NSString* contentString = expandableText.text;
    NSDictionary* stringAttributes = @{
                                       NSFontAttributeName: expandableText.font,
                                       NSParagraphStyleAttributeName: paragraphStyle,
                                       NSForegroundColorAttributeName: expandableText.textColor ? expandableText.textColor : [UIColor blackColor],
                                       };

    if (expandableText.text.length > 0)
    {
        expandableText.contentInset = UIEdgeInsetsMake(0.0, 0, 0.0, 0);
        expandableText.contentOffset = CGPointMake(0.f, 0.f);
        expandableText.textContainerInset = UIEdgeInsetsMake(0.0, 0, 0.0, 0);

        CGSize expectedLabelSize = [contentString boundingRectWithSize:
                                    CGSizeMake(expandableText.frame.size.width - 10.f, CGFLOAT_MAX)
                                                               options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
                                                            attributes:stringAttributes context:nil].size;

        CGRect expandableTextFrame = expandableText.frame;

        CGFloat oldExpandableSize = expandableTextFrame.size.height;
        expandableTextFrame.size.height = MAX(self.minimumSize, expectedLabelSize.height);

        dif = expandableTextFrame.size.height - oldExpandableSize;
    }

    dif += self.endBufferSize;

    [self recursivelyAdjustView:expandableText by:dif];

    expandableText.attributedText = [[NSAttributedString alloc] initWithString:contentString
                                                                    attributes:stringAttributes];

    expandableText.selectable = originallySelected;
    expandableText.contentOffset = CGPointZero;
    [self.delegate textViewsChangedSize:self];
}

- (void) recursivelyAdjustView:(UIView*)viewToAdjust by:(CGFloat)dif
{
    CGRect f = viewToAdjust.frame;
    f.size.height += dif;

    UIViewAutoresizing mask = viewToAdjust.autoresizingMask;
    viewToAdjust.autoresizingMask = UIViewAutoresizingNone;
    if (viewToAdjust.superview && viewToAdjust != self.rootView)
    {
        [self recursivelyAdjustView:viewToAdjust.superview by:dif];
    }

    viewToAdjust.frame = f;
    viewToAdjust.autoresizingMask = mask;
}

@end


text:
package com.example.login.activity;

import android.content.Context;

public class UserStruct
{
	public String strUsrId;
	public String strPassWd;
	public String strUsrName;
	public Context context;
}

redpajama_set_name: RedPajamaGithub


text:
#include "required_defines.hpp"

#include "performance_measure.hpp"

#include <boost/math/special_functions/gamma.hpp>
#include <boost/array.hpp>

#define T double
#include "../test/test_gamma_data.ipp"

template <std::size_t N>
double gamma_evaluate2(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += boost::math::tgamma(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma")
{
   double result = gamma_evaluate2(factorials);
   result += gamma_evaluate2(near_1);
   result += gamma_evaluate2(near_2);
   result += gamma_evaluate2(near_0);
   result += gamma_evaluate2(near_m10);
   result += gamma_evaluate2(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

template <std::size_t N>
double lgamma_evaluate2(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += boost::math::lgamma(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma")
{
   double result = lgamma_evaluate2(factorials);
   result += lgamma_evaluate2(near_1);
   result += lgamma_evaluate2(near_2);
   result += lgamma_evaluate2(near_0);
   result += lgamma_evaluate2(near_m10);
   result += lgamma_evaluate2(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

template <std::size_t N>
double tgamma1pm1_evaluate2(const boost::array<boost::array<T, 2>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += boost::math::tgamma1pm1(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(gamma1pm1_test, "tgamma1pm1")
{
   double result = tgamma1pm1_evaluate2(gammap1m1_data);

   consume_result(result);
   set_call_count(
      sizeof(gammap1m1_data) / sizeof(gammap1m1_data[0]));
}

#ifdef TEST_CEPHES

extern "C" {

double gamma(double);
double lgam(double);

}

template <std::size_t N>
double gamma_evaluate_cephes(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += gamma(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-cephes")
{
   double result = gamma_evaluate_cephes(factorials);
   result += gamma_evaluate_cephes(near_1);
   result += gamma_evaluate_cephes(near_2);
   result += gamma_evaluate_cephes(near_0);
   result += gamma_evaluate_cephes(near_m10);
   result += gamma_evaluate_cephes(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

template <std::size_t N>
double lgamma_evaluate_cephes(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += lgam(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-cephes")
{
   double result = lgamma_evaluate_cephes(factorials);
   result += lgamma_evaluate_cephes(near_1);
   result += lgamma_evaluate_cephes(near_2);
   result += lgamma_evaluate_cephes(near_0);
   result += lgamma_evaluate_cephes(near_m10);
   result += lgamma_evaluate_cephes(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

#endif

#ifdef TEST_GSL

#include <gsl/gsl_sf_gamma.h>

template <std::size_t N>
double gamma_evaluate_gsl(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += gsl_sf_gamma(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(gamma_test, "gamma-gsl")
{
   double result = gamma_evaluate_gsl(factorials);
   result += gamma_evaluate_gsl(near_1);
   result += gamma_evaluate_gsl(near_2);
   result += gamma_evaluate_gsl(near_0);
   result += gamma_evaluate_gsl(near_m10);
   result += gamma_evaluate_gsl(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

template <std::size_t N>
double lgamma_evaluate_gsl(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
      result += gsl_sf_lngamma(data[i][0]);
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(lgamma_test, "lgamma-gsl")
{
   double result = lgamma_evaluate_gsl(factorials);
   result += lgamma_evaluate_gsl(near_1);
   result += lgamma_evaluate_gsl(near_2);
   result += lgamma_evaluate_gsl(near_0);
   result += lgamma_evaluate_gsl(near_m10);
   result += lgamma_evaluate_gsl(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

#endif

#ifdef TEST_DCDFLIB
#include <dcdflib.h>

template <std::size_t N>
double gamma_evaluate2_dcd(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
   {
      double x = data[i][0];
      result += gamma_x(&x);
   }
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(gamma_test_dcd, "gamma-dcd")
{
   double result = gamma_evaluate2_dcd(factorials);
   result += gamma_evaluate2_dcd(near_1);
   result += gamma_evaluate2_dcd(near_2);
   result += gamma_evaluate2_dcd(near_0);
   result += gamma_evaluate2_dcd(near_m10);
   result += gamma_evaluate2_dcd(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

template <std::size_t N>
double lgamma_evaluate2_dcd(const boost::array<boost::array<T, 3>, N>& data)
{
   double result = 0;
   for(unsigned i = 0; i < N; ++i)
   {
      double x = data[i][0];
      result += gamma_log(&x);
   }
   return result;
}

BOOST_MATH_PERFORMANCE_TEST(lgamma_test_dcd, "lgamma-dcd")
{
   double result = lgamma_evaluate2_dcd(factorials);
   result += lgamma_evaluate2_dcd(near_1);
   result += lgamma_evaluate2_dcd(near_2);
   result += lgamma_evaluate2_dcd(near_0);
   result += lgamma_evaluate2_dcd(near_m10);
   result += lgamma_evaluate2_dcd(near_m55);

   consume_result(result);
   set_call_count(
      (sizeof(factorials)
      + sizeof(near_1)
      + sizeof(near_2)
      + sizeof(near_0)
      + sizeof(near_m10)
      + sizeof(near_m55)) / sizeof(factorials[0]));
}

#endif


text:
namespace trace
{
    enum class level_t
    {
        Error = 0,
        Warning = 1,
        Info = 2,
        Verbose = 3
    };

    void set_level(level_t level);
    bool is_enabled(level_t level);
    void verbose(const pal::char_t* format, ...);
    void info(const pal::char_t* format, ...);
    void warning(const pal::char_t* format, ...);
    void error(const pal::char_t* format, ...);
};

#endif // TRACE_H