text:
package com.coolweather.app.activity;

import java.util.Date;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Window;
import android.widget.TextView;

import com.coolweather.app.util.BaseActivity;
import com.coolweather.app.util.HttpCallBackListener;
import com.coolweather.app.util.HttpUtil;
import com.coolweather.app.util.Utility;
import com.example.coolweather.R;

/**
 * @author Job
 *ÀûÓø÷ÖÖÀàÖз½·¨£¬¸ù¾Ý´ÓChooseAreaActivityÖлñµÃµÄµØÃû£¬´Ó·þÎñÆ÷»ñÈ¡ÌìÆø£¬ÔÚ´ËÒ³Ãæ¸üÐÂ
 */
public class WeatherActivity extends BaseActivity{

	TextView city_name;
	TextView refresh_time;
	TextView current_time;
	TextView weather_text;
	TextView temp1;
	TextView temp2;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.weather_layout);

		city_name=(TextView) findViewById(R.id.city_name);
		refresh_time=(TextView) findViewById(R.id.refresh_time);
		current_time=(TextView) findViewById(R.id.current_time);
		weather_text=(TextView) findViewById(R.id.weather_text);
		temp1=(TextView) findViewById(R.id.temp1);
		temp2=(TextView) findViewById(R.id.temp2);

		Intent intent=getIntent();
		String countyCode=intent.getStringExtra("countyCode");
		queryFromServer(countyCode);
	}

	/**
	 * @param countyCode
	 * ÀûÓûñµÃµÄcountyCode´Ó·þÎñÆ÷»ñÈ¡ÌìÆøÐÅÏ¢
	 *
	 */
	private void queryFromServer(String countyCode)
	{
		//Ê×ÏÈ£¬ÀûÓÃcountyCode»ñµÃµ±µØµÄÌìÆøcode
		String address="http://www.weather.com.cn/data/list3/city"+countyCode+".xml";

		//È»ºó£¬½«´Ó·þÎñÆ÷»ñµÃµÄxml´úÂë½âÎö£¬¸ñʽΪcounty/weathercode
		HttpUtil.sendHttpRequest(address, new HttpCallBackListener() {

			@Override
			public void onFinish(String response) {
				String[] array = response.split("\\|");
				if(array!=null&&array.length==2)
				{
					String weatherCode = array[1];

					//Ö®ºó£¬ÀûÓûñµÃµÄweatherCode´Ó·þÎñÆ÷»ñÈ¡ÌìÆøÐÅÏ¢£¬È»ºó´æ´¢µ½±¾µØ
					Utility.handleWeatherInfo(WeatherActivity.this, weatherCode);

					runOnUiThread(new Runnable() {
						public void run() {
							showWeather();
						}
					});
				}
			}

			@Override
			public void onError(Exception e) {
				runOnUiThread(new Runnable() {
					public void run() {
						refresh_time.setText("ͬ²½Ê§°Ü");
					}
				});
			}
		});
	}

	/**
	 * ´Ó±¾µØ¶ÁÈ¡ÌìÆøÊý¾Ý£¬½øÐÐÏÔʾ
	 */
	private void showWeather()
	{
		SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
//		TextView city_name;
//		TextView refresh_time;
//		TextView current_time;
//		TextView weather_text;
//		TextView temp1;
//		TextView temp2;
//		editor.putString("city_name", info.getCityName());
//		editor.putString("weather_code", info.getWeatherCode());
//		editor.putString("temp1", info.getTemp1());
//		editor.putString("temp2", info.getTemp2());
//		editor.putString("weather", info.getWeather());
//		editor.putString("pulish_time", info.getPulishTime());
//		editor.putString("current_date", sdf.format(new Date()));

		city_name.setText(preferences.getString("city_name", ""));
		refresh_time.setText("½ñÌì"+preferences.getString("pulish_time", "")+"·¢²¼");
		current_time.setText(preferences.getString("current_date", ""));
		weather_text.setText(preferences.getString("weather", ""));
		temp1.setText(preferences.getString("temp1", ""));
		temp2.setText(preferences.getString("temp2", ""));

	}

//	public static void startAction(Context context,String cityId)
//	{
//		Intent intent=new Intent(context, WeatherActivity.class);
//		intent.putExtra("cityId", cityId);
//		context.startActivity(intent);
//	}

}


text:
class RenameLeagueIdForeignKeyOnDivisions < ActiveRecord::Migration
  def change
    rename_column :divisions, :league_id, :custom_league_id
  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.ircclouds.irc.api.commands;

/**
 * CAP LS. Command to query available capabilities.
 *
 * @author Danny van Heumen
 */
public class CapLsCmd extends CapCmd
{

	@Override
	public String asString()
	{
		return "CAP LS";
	}
}


text:
typedef DPTR(struct TypeEquivalenceEntry) PTR_TypeEquivalenceEntry;
typedef struct TypeEquivalenceEntry
{
    static NgenHashValue HashTypeHandles(TypeHandle thA, TypeHandle thB)
    {
        LIMITED_METHOD_CONTRACT;

        UINT_PTR aPtr = thA.AsTAddr();
        UINT_PTR bPtr = thB.AsTAddr();
        DWORD hash = (DWORD)((aPtr + bPtr) >> 3);

        return hash;
    }

    bool Match(TypeHandle thA, TypeHandle thB)
    {
        LIMITED_METHOD_CONTRACT;

        return (((thA == m_thA) && (thB == m_thB)) ||
            ((thB == m_thA) && (thA == m_thB)));
    }

    void SetData(TypeHandle thA, TypeHandle thB, bool fEquivalent)
    {
        LIMITED_METHOD_CONTRACT;

        m_thA = thA;
        m_thB = thB;
        m_fEquivalent = fEquivalent;
    }

    bool GetEquivalence()
    {
        LIMITED_METHOD_CONTRACT;
        return m_fEquivalent;
    }

private:

    TypeHandle m_thA;
    TypeHandle m_thB;
    bool       m_fEquivalent;
} TypeEquivalenceEntry_t;

// The hash type itself. All common logic is provided by the NgenHashTable templated base class. See
// NgenHash.h for details.
typedef DPTR(class TypeEquivalenceHashTable) PTR_TypeEquivalenceHashTable;
class TypeEquivalenceHashTable : public NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>
{
    friend class NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>;
#ifdef DACCESS_COMPILE
    friend class NativeImageDumper;
#endif

public:
    typedef enum EquivalenceMatch
    {
        MatchUnknown,
        Match,
        NoMatch
    };

    // The LookupContext type we export to track GetValue/FindNextNestedClass enumerations is simply a rename
    // of the base classes' hash value enumerator.
    typedef NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>::LookupContext LookupContext;

#ifndef DACCESS_COMPILE
    static TypeEquivalenceHashTable *Create(AppDomain *pDomain, DWORD dwNumBuckets, CrstExplicitInit *pCrst);
    void RecordEquivalence(TypeHandle thA, TypeHandle thB, EquivalenceMatch match);
#endif
    EquivalenceMatch CheckEquivalence(TypeHandle thA, TypeHandle thB);

#ifdef DACCESS_COMPILE
    void EnumMemoryRegionsForEntry(TypeEquivalenceEntry_t *pEntry, CLRDataEnumMemoryFlags flags) { return; }
#endif

#if defined(FEATURE_PREJIT) && !defined(DACCESS_COMPILE)
private:

    bool ShouldSave(DataImage *pImage, TypeEquivalenceEntry_t *pEntry) { return false; }
    bool IsHotEntry(TypeEquivalenceEntry_t *pEntry, CorProfileData *pProfileData) { return false; }
    bool SaveEntry(DataImage *pImage, CorProfileData *pProfileData, TypeEquivalenceEntry_t *pOldEntry, TypeEquivalenceEntry_t *pNewEntry, EntryMappingTable *pMap) { return true; }
    void FixupEntry(DataImage *pImage, TypeEquivalenceEntry_t *pEntry, void *pFixupBase, DWORD cbFixupOffset) { return; }
#endif // FEATURE_PREJIT && !DACCESS_COMPILE

private:
#ifndef DACCESS_COMPILE
    TypeEquivalenceHashTable(LoaderHeap *pHeap, DWORD cInitialBuckets, CrstExplicitInit *pCrst) :
        NgenHashTable<TypeEquivalenceHashTable, TypeEquivalenceEntry, 4>(NULL, pHeap, cInitialBuckets),
        m_pHashTableCrst(pCrst)
    {
    }
#endif
    CrstExplicitInit*               m_pHashTableCrst;
};

#endif // FEATURE_TYPEEQUIVALENCE

#endif // !__CLASS_HASH_INCLUDED


text:
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';

class Breadcrumb {
    constructor() {
        this.onItemClick = new EventEmitter();
    }
    itemClick(event, item) {
        if (item.disabled) {
            event.preventDefault();
            return;
        }
        if (!item.url) {
            event.preventDefault();
        }
        if (item.command) {
            item.command({
                originalEvent: event,
                item: item
            });
        }
        this.onItemClick.emit({
            originalEvent: event,
            item: item
        });
    }
    onHomeClick(event) {
        if (this.home) {
            this.itemClick(event, this.home);
        }
    }
}
Breadcrumb.decorators = [
    { type: Component, args: [{
                selector: 'p-breadcrumb',
                template: `

                        <ng-container *ngIf="home.label">
                            {{home.label}}
                            <ng-template #htmlHomeLabel></ng-template>
                        </ng-container>

                    <a *ngIf="home.routerLink" [routerLink]="home.routerLink" [queryParams]="home.queryParams" [routerLinkActive]="'p-menuitem-link-active'" [routerLinkActiveOptions]="home.routerLinkActiveOptions||{exact:false}" class="p-menuitem-link" (click)="itemClick($event, home)"
                        [attr.target]="home.target" [attr.title]="home.title" [attr.id]="home.id" [attr.tabindex]="home.disabled ? null : '0'"
                        [fragment]="home.fragment" [queryParamsHandling]="home.queryParamsHandling" [preserveFragment]="home.preserveFragment" [skipLocationChange]="home.skipLocationChange" [replaceUrl]="home.replaceUrl" [state]="home.state">

                        <ng-container *ngIf="home.label">
                            {{home.label}}
                            <ng-template #htmlHomeRouteLabel></ng-template>
                        </ng-container>

                <ng-template ngFor let-item let-end="last" [ngForOf]="model">

                            <ng-container *ngIf="item.label">
                                {{item.label}}
                                <ng-template #htmlLabel></ng-template>
                            </ng-container>

                        <a *ngIf="item.routerLink" [routerLink]="item.routerLink" [queryParams]="item.queryParams" [routerLinkActive]="'p-menuitem-link-active'"  [routerLinkActiveOptions]="item.routerLinkActiveOptions||{exact:false}" class="p-menuitem-link" (click)="itemClick($event, item)"
                            [attr.target]="item.target" [attr.title]="item.title" [attr.id]="item.id" [attr.tabindex]="item.disabled ? null : '0'"
                            [fragment]="item.fragment" [queryParamsHandling]="item.queryParamsHandling" [preserveFragment]="item.preserveFragment" [skipLocationChange]="item.skipLocationChange" [replaceUrl]="item.replaceUrl" [state]="item.state">

                            <ng-container *ngIf="item.label">
                                {{item.label}}
                                <ng-template #htmlRouteLabel></ng-template>
                            </ng-container>

                </ng-template>

    `,
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                styles: [".p-breadcrumb{overflow-x:auto}.p-breadcrumb ul{align-items:center;display:flex;flex-wrap:nowrap;list-style-type:none;margin:0;padding:0}.p-breadcrumb .p-menuitem-text{line-height:1}.p-breadcrumb .p-menuitem-link{text-decoration:none}"]
            },] }
];
Breadcrumb.propDecorators = {
    model: [{ type: Input }],
    style: [{ type: Input }],
    styleClass: [{ type: Input }],
    home: [{ type: Input }],
    onItemClick: [{ type: Output }]
};
class BreadcrumbModule {
}
BreadcrumbModule.decorators = [
    { type: NgModule, args: [{
                imports: [CommonModule, RouterModule],
                exports: [Breadcrumb, RouterModule],
                declarations: [Breadcrumb]
            },] }
];

/**
 * Generated bundle index. Do not edit.
 */

export { Breadcrumb, BreadcrumbModule };
//# sourceMappingURL=primeng-breadcrumb.js.map


text:
@interface DetailsViewController ()
{
	ShowLocationController*		annotationsController;
	CGRect						editTextRect;			// rect of active text editing
}
- (void)focusMapAnimated:(BOOL)animate;
- (void)updateCancelButton;
- (void)fillDateLabel;
- (void)fillTitleField;
- (void)fillNotesField;
- (void)fillDistanceLabel;
- (void)layoutPictures;
- (void)presentImagePickerUsingCamera:(BOOL)useCamera;
- (void)dismissImagePicker;
- (void)keyboardWillShowNotification:(NSNotification*)notification;
- (void)keyboardWillHideNotification:(NSNotification*)notification;
- (void)openMapsWithDirections:(NSString*)directionStyle;
@end

@implementation DetailsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    self.location = nil;		// make sure we're still not observing the data model
}

//- (void)viewDidLoad
//{
//    [super viewDidLoad];
//}

- (void)viewWillAppear:(BOOL)animated
{
	[super viewWillAppear:animated];

	// Reset the view so it presents the current _location information
	// (this can't be done when _location is set, because not all of the
	//	outlet connections have been made)
	[self focusMapAnimated:NO];

	// Fill in the various details
	[self layoutPictures];
	[self updateCancelButton];
	[self fillDateLabel];
	[self fillTitleField];
	[self fillNotesField];
	[self fillDistanceLabel];

	NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter];
	[notificationCenter addObserver:self
						   selector:@selector(keyboardWillShowNotification:)
							   name:UIKeyboardWillShowNotification
							 object:nil];
	[notificationCenter addObserver:self
						   selector:@selector(keyboardWillHideNotification:)
							   name:UIKeyboardWillHideNotification
							 object:nil];

	// Set up the annotation and overlays controller
	annotationsController = [[ShowLocationController alloc] initWithMapView:_mapView];
	annotationsController.showLocation = _location;
}

- (void)viewWillDisappear:(BOOL)animated
{
//	self.location = nil;			// clear the data model, disconnecting the observer

	[[NSNotificationCenter defaultCenter] removeObserver:self];

	// Discard and disable the annotation controller
	annotationsController = nil;

	[super viewWillDisappear:animated];
}

//- (void)didReceiveMemoryWarning
//{
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}

#pragma mark Properties

- (void)setLocation:(SavedLocation *)location
{
	NSArray* volatileKeys = @[@"placemark",@"date",@"refining",@"name",@"notes"];
	// Stop observing changes to the previous location object
	for ( NSString* key in volatileKeys )
		[_location removeObserver:self forKeyPath:key];

	// Set the saved location object for the detail view
	_location = location;

	// Begin observing changes to this location object
	for ( NSString* key in volatileKeys )
		[location addObserver:self forKeyPath:key options:0 context:NULL];
}

#pragma mark Picture Maintenance

#define kPictureViewCollapsedHeight		((CGFloat)32)
#define kPictureViewExpandedHeight		((CGFloat)64)
#define kPictureViewIndividualWidth		((CGFloat)64)

- (void)layoutPictures
{
	NSUInteger pictureCount = _location.pictureCount;

	NSString* addButtonTitle = nil;
	UIImage* addButtonImage = nil;
	NSString* takeButtonTitle = nil;
	UIImage* takeButtonImage = nil;
	switch (pictureCount) {
		case 0:
			// No pictures: there's plenty of room for button titles and images
			addButtonTitle = @"Add Picture";
			takeButtonTitle = @"Take Picture";
			// fall through and set images too

		default:
			// 1-3 pictures: room for button images, but no titles
			addButtonImage = [UIImage imageNamed:kAddPictureButtonImageName];
			takeButtonImage = [UIImage imageNamed:kTakePictureButtonImageName];
			break;

		case kPicturesMax:
			// 4 pictures: no room for buttons
			break;
		}

	// Blank and disable the buttons that can't be used
	BOOL hasPhotoLibrary = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
	BOOL hasCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
	if (!hasPhotoLibrary)
		{
		addButtonImage = nil;
		addButtonTitle = nil;
		}
	if (!hasCamera)
		{
		takeButtonImage = nil;
		takeButtonTitle = nil;
		}

	[_addPictureButton setTitle:addButtonTitle forState:UIControlStateNormal];
	[_addPictureButton setImage:addButtonImage forState:UIControlStateNormal];
	_addPictureButton.enabled = hasPhotoLibrary;
	[_takePictureButton setTitle:takeButtonTitle forState:UIControlStateNormal];
	[_takePictureButton setImage:takeButtonImage forState:UIControlStateNormal];
	_takePictureButton.enabled = hasCamera;

	// Set the content and the width constraints for each of the four image views
	for ( NSUInteger i=0; i<kPicturesMax; i++ )
		{
		UIImageView* pictureView = [self valueForKey:[NSString stringWithFormat:@"picture%uView",(unsigned)i]];
		NSLayoutConstraint* widthConstraint = [self valueForKey:[NSString stringWithFormat:@"picture%uWidthConstraint",(unsigned)i]];
		if (i<pictureCount)
			{
			CGSize thumbSize = CGSizeMake(kPictureViewIndividualWidth*pictureView.contentScaleFactor,
										  kPictureViewExpandedHeight*pictureView.contentScaleFactor);
			pictureView.image = [_location thumbnailFittingSize:thumbSize forPictureAtIndex:i];
			widthConstraint.constant = 80;
			}
		else
			{
			pictureView.image = nil;
			widthConstraint.constant = 0;
			}
		}

	// Collapse the album view to kPictureViewCollapsedHeight if there are no pictures, or expand to kPictureViewExpandedHeight if there are
	_albumHeightConstraint.constant = ( pictureCount==0 ? kPictureViewCollapsedHeight : kPictureViewExpandedHeight );
}

- (void)presentImagePickerUsingCamera:(BOOL)useCamera
{
//	imagePopoverController = nil;		-- for later, if there's ever an iPad version ...

	// Create the image picker controller
	UIImagePickerController *cameraUI = [UIImagePickerController new];
	// Set the source type to either the camera or the photo library
	cameraUI.sourceType = ( useCamera ? UIImagePickerControllerSourceTypeCamera
									  : UIImagePickerControllerSourceTypePhotoLibrary );

	cameraUI.mediaTypes = @[(NSString*)kUTTypeImage];		// only interested in still pictures
	cameraUI.delegate = self;
//	if (useCamera || UIDevice.currentDevice.userInterfaceIdiom==UIUserInterfaceIdiomPhone)
//        {
		// Presenting the camera interface OR this is an iPhone: user full screen controller
		[self presentViewController:cameraUI animated:YES completion:nil];
//        }
//	else
//        {
//		// Presenting the photo library picker on an iPad: must use a pop-over
//		imagePopoverController = [[UIPopoverController alloc] initWithContentViewController:cameraUI];
//		[imagePopoverController presentPopoverFromRect:self.imageView.frame
//												inView:self.view
//							  permittedArrowDirections:UIPopoverArrowDirectionAny
//											  animated:YES];
//        }
}

- (void)dismissImagePicker
{
	// Dismiss the image picker interface and return to the detail view controller.
//	if (imagePopoverController!=nil)
//		{
//		// Picker was presented using a popover controller: dismiss the popover
//		[imagePopoverController dismissPopoverAnimated:YES];
//		imagePopoverController = nil;
//		}
//	else
//		{
		// Else, picker was presented in a full screen controller
		[self dismissViewControllerAnimated:YES completion:nil];
//		}
}

#pragma mark <UIImagePickerConrollerDelegate>

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
	NSString *mediaType = info[UIImagePickerControllerMediaType];
	if ([mediaType isEqualToString:(NSString*)kUTTypeImage])
        {
		// First try to get the edited image (cropped, rotated, whatever)
		UIImage *newImage = info[UIImagePickerControllerEditedImage];
		if (newImage==nil)
			// There was no edited image: use the original
			newImage = info[UIImagePickerControllerOriginalImage];

		// If the user used the camera to take a new picture, they will
		//	expect that (original or cropped) image to be added
		//	to their camera roll.
		if ([[NSUserDefaults standardUserDefaults] boolForKey:kPreferenceSaveToCameraRollKey]
			&& picker.sourceType==UIImagePickerControllerSourceTypeCamera)
			UIImageWriteToSavedPhotosAlbum(newImage,nil,nil,nil);

		// Add the image to the location and update the details
		[_location addPicture:newImage];
        }

	// Dismiss the camera/photo picker interface and discard it
	[self dismissImagePicker];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
	// Close the image picker interface and return to the detail view controller
	//	without making any changes to the selected image.
	[self dismissImagePicker];
}

#pragma mark Detail Maintenance

- (void)focusMapAnimated:(BOOL)animate
{
	// set up the map view
	[_mapView removeAnnotations:_mapView.annotations];	// remove all annotations
	[_mapView addAnnotation:_location];					// add this location as the only annotation
	[_mapView centerAtLocation:_location.location
					  animated:animate];
}

- (void)updateCancelButton
{
	[_updateButton setTitle:( _location.refining ? @"Stop Refining" : @"Update" )
				   forState:UIControlStateNormal];
}

- (void)fillDateLabel
{
	_dateLabel.text = _location.localizedDate;
}

- (void)fillTitleField
{
	// Fill the title field with
	//	(a) the user's title (black)
	//	(b) the geolocation information (dark grey or black)
	//	(c) a placeholder message
	NSString* userName = _location.name;
	if (userName.length!=0)
		{
		// User has supplied a title: use that
		_titleField.text = userName;
		_titleField.textColor = [UIColor darkTextColor];
		return;
		}

	CLPlacemark* placemark = _location.placemark;
	if (placemark!=nil)
		{
		// User has not supplied a title, but there's placemark info; fill in with placemark information
		NSString* name = placemark.name;
		NSString* address = ABCreateStringWithAddressDictionary(placemark.addressDictionary,NO);
		if (address==nil)
			address = @"";
		if (name.length==0 || [address hasPrefix:name])
			// no name or the address begins with name: use address
			_titleField.text = address;
		else
			// combine name and address
			_titleField.text = [NSString stringWithFormat:@"%@\r%@",name,address];
		// Make the text grey, indicating that's it a placeholder
		_titleField.textColor = [UIColor darkGrayColor];
		return;
		}

	// No user name and no placeholder information available: fill with a default placeholder message
	if (_location.geocodingFinished)
		{
		_titleField.text = @"Unknown Location";
		}
	else
		{
		CLLocationCoordinate2D raw = _location.coordinate;
		_titleField.text = [NSString stringWithFormat:@"Looking up location %f, %f",raw.latitude,raw.longitude];
		}
	_titleField.textColor = [UIColor lightGrayColor];
}

- (void)fillNotesField
{
	// Fill the notes field with either ther user's notes, or a placeholder message
	NSString* notes = _location.notes;
	if (notes.length!=0)
		{
		_notesField.text = notes;
		_notesField.textColor = [UIColor darkTextColor];
		return;
		}

	_notesField.text = @"Any details that might help you find your way back.";
	_notesField.textColor = [UIColor lightGrayColor];
}

- (void)fillDistanceLabel
{
	NSString* localizedDistance = nil;
	CLLocationDistance distance = 0;
	if (currentLocation!=nil)
		{
		distance = [_location.location distanceFromLocation:currentLocation];
		localizedDistance = [_location localizedDistance:distance];
		}
	_distanceLabel.text = localizedDistance;

	// Enable the directions button when the user is an apropriate distance away
	_walkButton.enabled = (distance>=50.0);
	_driveButton.enabled = (distance>=100.0);
}

#pragma mark <CLLocationManagerDelegate>

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
	[super locationManager:manager didUpdateLocations:locations];
	[self fillDistanceLabel];
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
	[super locationManager:manager didFailWithError:error];
	[self fillDistanceLabel];
}

#pragma mark <MKMapViewDelegate>

- (MKAnnotationView*)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
	return [annotationsController mapView:mapView viewForAnnotation:annotation];
}

- (MKOverlayRenderer*)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
	return [annotationsController mapView:mapView rendererForOverlay:overlay];
}

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
	// This don't do anything, but weird things were happening when the delegate didn't implement it.
}

- (void)mapView:(MKMapView *)mapView didFailToLocateUserWithError:(NSError *)error
{
	// This don't do anything, but weird things were happening when the delegate didn't implement it.
}

#pragma mark Keyboard Notifications

#define kVisibleFieldVerticalMargin	8.0		// make sure there's at least 8 pixels above and below the text field

- (void)keyboardWillShowNotification:(NSNotification*)notification
{
	// The keyboard is about to appear: make sure the editable text field is still
	//	visible once the keyboard appears.
	NSDictionary* info = notification.userInfo;
	CGRect keyboardRect = [info[UIKeyboardFrameEndUserInfoKey] CGRectValue];

	UIEdgeInsets contentInsets = UIEdgeInsetsMake(0,0,keyboardRect.size.height,0);
	_scrollView.contentInset = contentInsets;
	_scrollView.scrollIndicatorInsets = contentInsets;

	// Find out if the text field is being covered up by the keyboard.

	// Step one is to determine the top edge of the keyboard relative to the scroll view
	UIView* rootView = self.view;
	keyboardRect = [rootView convertRect:[rootView.window convertRect:keyboardRect fromWindow:nil]
								fromView:nil];
	// Now see if the text field will fit in the top portion of the scroll view
	CGRect scrollFrame = _scrollView.frame;
	CGFloat textFieldBottomLimit = CGRectGetMinY(scrollFrame)+editTextRect.size.height+2*kVisibleFieldVerticalMargin;
	if ( textFieldBottomLimit > CGRectGetMinY(keyboardRect) )
		{
		// Measuring from the scroll view's top edge, there's not enough screen space between
		//	that and the top of the keyboard to fit the text field and a little margin. We're going to
		//	have to move the whole thing up by temporarily shoving the map view above the navigation bar.
		[rootView layoutIfNeeded];
		[UIView animateWithDuration:[info[UIKeyboardAnimationDurationUserInfoKey] doubleValue]
						 animations:^{
							 _mapTopConstraint.constant = CGRectGetMinY(keyboardRect)-textFieldBottomLimit;
							 [rootView layoutIfNeeded];
							 }];
		}
	// At the same time, make the text field visible in the scroll view
	[_scrollView scrollRectToVisible:editTextRect animated:YES];
}

- (void)keyboardWillHideNotification:(NSNotification*)notification
{
	_scrollView.contentInset = UIEdgeInsetsZero;
	_scrollView.scrollIndicatorInsets = UIEdgeInsetsZero;

	if (_mapTopConstraint.constant!=0)
		{
		// The map view was moved up to make room; put it back (nicely)
		NSDictionary* info = notification.userInfo;
		UIView* rootView = self.view;
		[rootView layoutIfNeeded];
		[UIView animateWithDuration:[info[UIKeyboardAnimationDurationUserInfoKey] doubleValue]
						 animations:^{
							 _mapTopConstraint.constant = 0;
							 [rootView layoutIfNeeded];
						 }];
		}
}

#pragma mark <UITextViewDelegate>

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
	// Save the frame of the field, in scroll view coordinates, so we can
	//	later make sure the keyboard doesn't obscure it.
	editTextRect = [textView convertRect:textView.bounds toView:_scrollView];

	return YES;	// of course
}

- (void)textViewDidBeginEditing:(UITextView *)textView
{
	// The user is about to edit one of the text views

	if (textView==_titleField)
		{
		// User is editing the title field
		if (_location.name.length==0)
			{
			// The user has not assigned a name to the location.
			// The field contains either the geolocation information or a placeholder.
			// In the former case, select the text and let the user decide how much to use.
			// In the later, clear the field.
			// In both cases, reset the font and color to the ones used for the user's name
			textView.textColor = [UIColor darkTextColor];
			if (_location.geocodingFinished)
				// Select all of the text in the field, so the user can easily type over it (or not)
				[textView selectAll:self];
			else
				// Geocoding hasn't finished, so there's no default information
				textView.text = @"";
			}
		}
	if (textView==_notesField)
		{
		// User is editing the notes field
		if (_location.notes.length==0)
			{
			// The user notes were empty, which means the text field contains a placeholder.
			// Clear it before allowing editing to commence.
			textView.text = @"";
			textView.textColor = [UIColor darkTextColor];
			}
		}
}

- (void)textViewDidEndEditing:(UITextView *)textView
{
	if (textView==_titleField)
		{
		// Editing of the location's name has concluded. Update the value.
		_location.name = [_titleField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
		// Based on the updated value, re-fill the title view
		[self fillTitleField];
		}
	if (textView==_notesField)
		{
		// Save the notes in the data model
		_location.notes = [_notesField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
		[self fillNotesField];
		}
}

#pragma mark Key-Value Observing

- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void *)context
{
	if (object==_location)
		{
		if ([keyPath isEqualToString:@"placemark"] || [keyPath isEqualToString:@"name"])
			{
			if (!_titleField.isFirstResponder)
				[self fillTitleField];
			}
		else if ([keyPath isEqualToString:@"date"])
			{
			[self fillDateLabel];
			}
		else if ([keyPath isEqualToString:@"refining"])
			{
			[self updateCancelButton];
			}
		else if ([keyPath isEqualToString:@"notes"])
			{
			if (!_notesField.isFirstResponder)
				[self fillNotesField];
			}
		}
}

#pragma mark Actions

- (IBAction)addPicture:(id)sender
{
    // We're going to present an interface; dismiss the keyboard first
    [self dismissKeyboard:self];

	// The device has either a camera or a photo library, but not both.
	// Start the image picker interface immediately with what they have.
	[self presentImagePickerUsingCamera:NO];
}

- (IBAction)takePicture:(id)sender;
{
    [self dismissKeyboard:self];
	[self presentImagePickerUsingCamera:YES];
}

- (IBAction)viewPicture:(id)sender
{
	// Create the picture view controller
	UINavigationController* navigationController = self.navigationController;
	PictureViewController* pictureController = [self.storyboard instantiateViewControllerWithIdentifier:@"picture"];
	pictureController.location = _location;
	pictureController.pictureIndex = [[(UITapGestureRecognizer*)sender view] tag];
	[navigationController pushViewController:pictureController animated:YES];
}

- (IBAction)drivingDirections:(id)sender
{
	[self openMapsWithDirections:MKLaunchOptionsDirectionsModeDriving];
}

- (IBAction)walkingDirections:(id)sender
{
	[self openMapsWithDirections:MKLaunchOptionsDirectionsModeWalking];
}

- (void)openMapsWithDirections:(NSString*)directionStyle
{
	MKPlacemark* placemark = [[MKPlacemark alloc] initWithCoordinate:_location.coordinate
												   addressDictionary:_location.placemark.addressDictionary];
	MKMapItem* mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
	MKMapType mapType = [[NSUserDefaults standardUserDefaults] integerForKey:kPreferenceMapTypeKey];
	[mapItem openInMapsWithLaunchOptions:@{ MKLaunchOptionsDirectionsModeKey: directionStyle,
											MKLaunchOptionsMapTypeKey : @(mapType) }];
}

static enum {
	kForgetLocationAlert,
	kUpdateLocationAlert
} WhichAlert;

- (IBAction)forgetLocation:(id)sender
{
	NSString* message = (  [[DocumentController sharedController] syncWithCloud]
						 ? @"This location will be removed from this device, and all other synchronized devices."
						 : @"This location will be discard." );
	UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Delete Location?"
													message:message
												   delegate:self
										  cancelButtonTitle:@"Cancel"
										  otherButtonTitles:@"Delete", nil];
	WhichAlert = kForgetLocationAlert;
	[alert show];
}

- (IBAction)resetLocation:(id)sender
{
	if (_location.refining)
		{
		// Stop refining
		[_location.refiner stop];
		}
	else
		{
		// Put up a dialog asking if they want to replace the location with their current one
		UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Update Location?"
														message:@"Move this saved location to your current location?"
													   delegate:self
											  cancelButtonTitle:@"Cancel"
											  otherButtonTitles:@"Set Location", nil];
		WhichAlert = kUpdateLocationAlert;
		[alert show];
		}
}

- (IBAction)dismissKeyboard:(id)sender
{
	// Action message to stop editing the current text field, which
	//	dismisses the keyboard.
	[self.view endEditing:NO];
}

#pragma mark <UIAlertViewDelegate>

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
	switch (WhichAlert) {
		case kForgetLocationAlert:
			if (buttonIndex!=alertView.cancelButtonIndex)
				{
				// User tapped the button that was not the cancel button
				// Delete this saved location and dismiss the view controller
				[[LocationData sharedData] removeLocation:_location];
				[self.navigationController popViewControllerAnimated:YES];
				}
			break;

		case kUpdateLocationAlert:
			if (buttonIndex!=alertView.cancelButtonIndex && currentLocation!=nil)
				{
				// User tapped the button that was not the cancel button
				// Get the current location and change the saved location
				_location.location = currentLocation;

				// Refocus the map and update the date
				[self focusMapAnimated:YES];
				[self fillDateLabel];
				// The rest of the details either don't change or will update themselves
				}
			break;
	}
}

@end


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

Toggle button

<button type="button" id="button" role="button"/>
Button title


text:
package cf.rachlinski.cryspscript.runtime.exec.keyword.defaultkeywords;

import cf.rachlinski.cryspscript.control.ScriptEngine;
import cf.rachlinski.cryspscript.control.factories.ExecutionEnvironmentFactory;
import cf.rachlinski.cryspscript.runtime.dataStructs.stack.ParameterStack;
import cf.rachlinski.cryspscript.runtime.dataStructs.stack.TypeStack;
import cf.rachlinski.cryspscript.runtime.exec.keyword.Keyword;
import cf.rachlinski.cryspscript.runtime.exec.keyword.Runnable;
import cf.rachlinski.cryspscript.runtime.exec.method.IllegalMethodTypeException;

@Runnable("var")
public class Var extends Keyword
{
	private static final TypeStack EXPECTED_TYPES = new TypeStack(new Class<?>[] {String.class, Object.class, });

	public Var(ParameterStack args) throws IllegalMethodTypeException
	{
		super(args);
	}

	@Override
	public void run()
	{
		ExecutionEnvironmentFactory.getProvide().putVariable(((String) args.get(0).getValue()).trim(), args.get(1));
	}
}


text:
package kafka.controller

import com.typesafe.scalalogging.Logger
import kafka.utils.Logging

object StateChangeLogger {
  private val logger = Logger("state.change.logger")
}

/**
 * Simple class that sets `logIdent` appropriately depending on whether the state change logger is being used in the
 * context of the KafkaController or not (e.g. ReplicaManager and MetadataCache log to the state change logger
 * irrespective of whether the broker is the Controller).
 */
class StateChangeLogger(brokerId: Int, inControllerContext: Boolean, controllerEpoch: Option[Int]) extends Logging {

  if (controllerEpoch.isDefined && !inControllerContext)
    throw new IllegalArgumentException("Controller epoch should only be defined if inControllerContext is true")

  override lazy val logger = StateChangeLogger.logger

  locally {
    val prefix = if (inControllerContext) "Controller" else "Broker"
    val epochEntry = controllerEpoch.fold("")(epoch => s" epoch=$epoch")
    logIdent = s"[$prefix id=$brokerId$epochEntry] "
  }

  def withControllerEpoch(controllerEpoch: Int): StateChangeLogger =
    new StateChangeLogger(brokerId, inControllerContext, Some(controllerEpoch))

  def messageWithPrefix(message: String): String = msgWithLogIdent(message)

}


text:
set(DOCUMENTATION "This module contains the basic framework for Video IO as
well as the itk::FileListVideoIO mechanism that does not depend on any outside
libraries.")

itk_module(ITKVideoIO
  ENABLE_SHARED
  DEPENDS
    ITKIOImageBase
    ITKVideoCore
  TEST_DEPENDS
    ITKTestKernel
  DESCRIPTION
    "${DOCUMENTATION}"
)


text:
#include <string.h>
#include <v8.h>
#include <node.h>
#include <node_version.h>
#include <time.h>
#include <uv.h>

#include "odbc.h"
#include "odbc_connection.h"
#include "odbc_result.h"
#include "odbc_statement.h"

#ifdef dynodbc
#include "dynodbc.h"
#endif

#ifdef _WIN32
#include "strptime.h"
#endif

using namespace v8;
using namespace node;

uv_mutex_t ODBC::g_odbcMutex;
uv_async_t ODBC::g_async;

Nan::Persistent<Function> ODBC::constructor;

void ODBC::Init(v8::Handle<Object> exports) {
  DEBUG_PRINTF("ODBC::Init\n");
  Nan::HandleScope scope;

  Local<FunctionTemplate> constructor_template = Nan::New<FunctionTemplate>(New);

  // Constructor Template
  constructor_template->SetClassName(Nan::New("ODBC").ToLocalChecked());

  // Reserve space for one Handle<Value>
  Local<ObjectTemplate> instance_template = constructor_template->InstanceTemplate();
  instance_template->SetInternalFieldCount(1);

  // Constants
#if (NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION)

#else

#endif
  PropertyAttribute constant_attributes = static_cast<PropertyAttribute>(ReadOnly | DontDelete);
  constructor_template->Set(Nan::New<String>("SQL_CLOSE").ToLocalChecked(), Nan::New<Number>(SQL_CLOSE), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_DROP").ToLocalChecked(), Nan::New<Number>(SQL_DROP), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_UNBIND").ToLocalChecked(), Nan::New<Number>(SQL_UNBIND), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_RESET_PARAMS").ToLocalChecked(), Nan::New<Number>(SQL_RESET_PARAMS), constant_attributes);
  constructor_template->Set(Nan::New<String>("SQL_DESTROY").ToLocalChecked(), Nan::New<Number>(SQL_DESTROY), constant_attributes);
  constructor_template->Set(Nan::New<String>("FETCH_ARRAY").ToLocalChecked(), Nan::New<Number>(FETCH_ARRAY), constant_attributes);
  NODE_ODBC_DEFINE_CONSTANT(constructor_template, FETCH_OBJECT);

  // Prototype Methods
  Nan::SetPrototypeMethod(constructor_template, "createConnection", CreateConnection);
  Nan::SetPrototypeMethod(constructor_template, "createConnectionSync", CreateConnectionSync);

  // Attach the Database Constructor to the target object
  constructor.Reset(constructor_template->GetFunction());
  exports->Set(Nan::New("ODBC").ToLocalChecked(),
               constructor_template->GetFunction());

#if NODE_VERSION_AT_LEAST(0, 7, 9)
  // Initialize uv_async so that we can prevent node from exiting
  //uv_async_init( uv_default_loop(),
  //               &ODBC::g_async,
  //               ODBC::WatcherCallback);

  // Not sure if the init automatically calls uv_ref() because there is weird
  // behavior going on. When ODBC::Init is called which initializes the
  // uv_async_t g_async above, there seems to be a ref which will keep it alive
  // but we only want this available so that we can uv_ref() later on when
  // we have a connection.
  // so to work around this, I am possibly mistakenly calling uv_unref() once
  // so that there are no references on the loop.
  //uv_unref((uv_handle_t *)&ODBC::g_async);
#endif

  // Initialize the cross platform mutex provided by libuv
  uv_mutex_init(&ODBC::g_odbcMutex);
}

ODBC::~ODBC() {
  DEBUG_PRINTF("ODBC::~ODBC\n");
  this->Free();
}

void ODBC::Free() {
  DEBUG_PRINTF("ODBC::Free\n");
  if (m_hEnv) {
    uv_mutex_lock(&ODBC::g_odbcMutex);

    if (m_hEnv) {
      SQLFreeHandle(SQL_HANDLE_ENV, m_hEnv);
      m_hEnv = NULL;
    }

    uv_mutex_unlock(&ODBC::g_odbcMutex);
  }
}

NAN_METHOD(ODBC::New) {
  DEBUG_PRINTF("ODBC::New\n");
  Nan::HandleScope scope;
  ODBC* dbo = new ODBC();

  dbo->Wrap(info.Holder());

  dbo->m_hEnv = NULL;

  uv_mutex_lock(&ODBC::g_odbcMutex);

  // Initialize the Environment handle
  int ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &dbo->m_hEnv);

  uv_mutex_unlock(&ODBC::g_odbcMutex);

  if (!SQL_SUCCEEDED(ret)) {
    DEBUG_PRINTF("ODBC::New - ERROR ALLOCATING ENV HANDLE!!\n");

    Local<Value> objError = ODBC::GetSQLError(SQL_HANDLE_ENV, dbo->m_hEnv);

    return Nan::ThrowError(objError);
  }

  // Use ODBC 3.x behavior
  SQLSetEnvAttr(dbo->m_hEnv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);

  info.GetReturnValue().Set(info.Holder());
}

//void ODBC::WatcherCallback(uv_async_t *w, int revents) {
//  DEBUG_PRINTF("ODBC::WatcherCallback\n");
//  //i don't know if we need to do anything here
//}

/*
 * CreateConnection
 */

NAN_METHOD(ODBC::CreateConnection) {
  DEBUG_PRINTF("ODBC::CreateConnection\n");
  Nan::HandleScope scope;

  Local<Function> cb = info[0].As<Function>();
  Nan::Callback *callback = new Nan::Callback(cb);
  //REQ_FUN_ARG(0, cb);

  ODBC* dbo = Nan::ObjectWrap::Unwrap<ODBC>(info.Holder());

  //initialize work request
  uv_work_t* work_req = (uv_work_t *) (calloc(1, sizeof(uv_work_t)));

  //initialize our data
  create_connection_work_data* data =
    (create_connection_work_data *) (calloc(1, sizeof(create_connection_work_data)));

  data->cb = callback;
  data->dbo = dbo;

  work_req->data = data;

  uv_queue_work(uv_default_loop(), work_req, UV_CreateConnection, (uv_after_work_cb)UV_AfterCreateConnection);

  dbo->Ref();

  info.GetReturnValue().Set(Nan::Undefined());
}

void ODBC::UV_CreateConnection(uv_work_t* req) {
  DEBUG_PRINTF("ODBC::UV_CreateConnection\n");

  //get our work data
  create_connection_work_data* data = (create_connection_work_data *)(req->data);

  uv_mutex_lock(&ODBC::g_odbcMutex);

  //allocate a new connection handle
  data->result = SQLAllocHandle(SQL_HANDLE_DBC, data->dbo->m_hEnv, &data->hDBC);

  uv_mutex_unlock(&ODBC::g_odbcMutex);
}

void ODBC::UV_AfterCreateConnection(uv_work_t* req, int status) {
  DEBUG_PRINTF("ODBC::UV_AfterCreateConnection\n");
  Nan::HandleScope scope;

  create_connection_work_data* data = (create_connection_work_data *)(req->data);

  Nan::TryCatch try_catch;

  if (!SQL_SUCCEEDED(data->result)) {
    Local<Value> info[1];

    info[0] = ODBC::GetSQLError(SQL_HANDLE_ENV, data->dbo->m_hEnv);

    data->cb->Call(1, info);
  }
  else {
    Local<Value> info[2];
    info[0] = Nan::New<External>(data->dbo->m_hEnv);
    info[1] = Nan::New<External>(data->hDBC);

    Local<Value> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewInstance(2, info);

    info[0] = Nan::Null();
    info[1] = js_result;

    data->cb->Call(2, info);
  }

  if (try_catch.HasCaught()) {
      Nan::FatalException(try_catch);
  }

  data->dbo->Unref();
  delete data->cb;

  free(data);
  free(req);
}

/*
 * CreateConnectionSync
 */

NAN_METHOD(ODBC::CreateConnectionSync) {
  DEBUG_PRINTF("ODBC::CreateConnectionSync\n");
  Nan::HandleScope scope;

  ODBC* dbo = Nan::ObjectWrap::Unwrap<ODBC>(info.Holder());

  HDBC hDBC;

  uv_mutex_lock(&ODBC::g_odbcMutex);

  //allocate a new connection handle
  SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_DBC, dbo->m_hEnv, &hDBC);

  if (!SQL_SUCCEEDED(ret)) {
    //TODO: do something!
  }

  uv_mutex_unlock(&ODBC::g_odbcMutex);

  Local<Value> params[2];
  params[0] = Nan::New<External>(dbo->m_hEnv);
  params[1] = Nan::New<External>(hDBC);

  Local<Object> js_result = Nan::New<Function>(ODBCConnection::constructor)->NewInstance(2, params);

  info.GetReturnValue().Set(js_result);
}

/*
 * GetColumns
 */

Column* ODBC::GetColumns(SQLHSTMT hStmt, short* colCount) {
  SQLRETURN ret;
  SQLSMALLINT buflen;

  //always reset colCount for the current result set to 0;
  *colCount = 0;

  //get the number of columns in the result set
  ret = SQLNumResultCols(hStmt, colCount);

  if (!SQL_SUCCEEDED(ret)) {
    return new Column[0];
  }

  Column *columns = new Column[*colCount];

  for (int i = 0; i < *colCount; i++) {
    //save the index number of this column
    columns[i].index = i + 1;
    //TODO:that's a lot of memory for each field name....
    columns[i].name = new unsigned char[MAX_FIELD_SIZE];

    //set the first byte of name to \0 instead of memsetting the entire buffer
    columns[i].name[0] = '\0';

    //get the column name
    ret = SQLColAttribute( hStmt,
                           columns[i].index,
#ifdef STRICT_COLUMN_NAMES
                           SQL_DESC_NAME,
#else
                           SQL_DESC_LABEL,
#endif
                           columns[i].name,
                           (SQLSMALLINT) MAX_FIELD_SIZE,
                           (SQLSMALLINT *) &buflen,
                           NULL);

    //store the len attribute
    columns[i].len = buflen;

    //get the column type and store it directly in column[i].type
    ret = SQLColAttribute( hStmt,
                           columns[i].index,
                           SQL_DESC_TYPE,
                           NULL,
                           0,
                           NULL,
                           &columns[i].type);
  }

  return columns;
}

/*
 * FreeColumns
 */

void ODBC::FreeColumns(Column* columns, short* colCount) {
  for(int i = 0; i < *colCount; i++) {
      delete [] columns[i].name;
  }

  delete [] columns;

  *colCount = 0;
}

/*
 * GetColumnValue
 */

Handle<Value> ODBC::GetColumnValue( SQLHSTMT hStmt, Column column,
                                        uint16_t* buffer, int bufferLength) {
  Nan::EscapableHandleScope scope;
  SQLLEN len = 0;

  //reset the buffer
  buffer[0] = '\0';

  //TODO: SQLGetData can supposedly return multiple chunks, need to do this to
  //retrieve large fields
  int ret;

  switch ((int) column.type) {
    case SQL_INTEGER :
    case SQL_SMALLINT :
    case SQL_TINYINT : {
        int32_t value = 0;

        ret = SQLGetData(
          hStmt,
          column.index,
          SQL_C_SLONG,
          &value,
          sizeof(value),
          &len);

        DEBUG_PRINTF("ODBC::GetColumnValue - Integer: index=%i name=%s type=%lli len=%lli ret=%i val=%li\n",
                    column.index, column.name, column.type, len, ret, value);

        if (len == SQL_NULL_DATA) {
          return scope.Escape(Nan::Null());
        }
        else {
          return scope.Escape(Nan::New<Integer>(value));
        }
      }
      break;
    case SQL_NUMERIC :
    case SQL_DECIMAL :
    case SQL_BIGINT :
    case SQL_FLOAT :
    case SQL_REAL :
    case SQL_DOUBLE : {
        double value;

        ret = SQLGetData(
          hStmt,
          column.index,
          SQL_C_DOUBLE,
          &value,
          sizeof(value),
          &len);

         DEBUG_PRINTF("ODBC::GetColumnValue - Number: index=%i name=%s type=%lli len=%lli ret=%i val=%f\n",
                    column.index, column.name, column.type, len, ret, value);

        if (len == SQL_NULL_DATA) {
          return scope.Escape(Nan::Null());
          //return Null();
        }
        else {
          return scope.Escape(Nan::New<Number>(value));
          //return Number::New(value);
        }
      }
      break;
    case SQL_DATETIME :
    case SQL_TIMESTAMP : {
      //I am not sure if this is locale-safe or cross database safe, but it
      //works for me on MSSQL
#ifdef _WIN32
      struct tm timeInfo = {};

      ret = SQLGetData(
        hStmt,
        column.index,
        SQL_C_CHAR,
        (char *) buffer,
        bufferLength,
        &len);

      DEBUG_PRINTF("ODBC::GetColumnValue - W32 Timestamp: index=%i name=%s type=%lli len=%lli\n",
                    column.index, column.name, column.type, len);

      if (len == SQL_NULL_DATA) {
        return scope.Escape(Nan::Null());
        //return Null();
      }
      else {
        if (strptime((char *) buffer, "%Y-%m-%d %H:%M:%S", &timeInfo)) {
          //a negative value means that mktime() should use timezone information
          //and system databases to attempt to determine whether DST is in effect
          //at the specified time.
          timeInfo.tm_isdst = -1;

          //return scope.Escape(Date::New(Isolate::GetCurrent(), (double(mktime(&timeInfo)) * 1000));
          return scope.Escape(Nan::New<Date>(double(mktime(&timeInfo)) * 1000).ToLocalChecked());
        }
        else {
          return scope.Escape(Nan::New((char *)buffer).ToLocalChecked());
        }
      }
#else
      struct tm timeInfo = {
        tm_sec : 0
        , tm_min : 0
        , tm_hour : 0
        , tm_mday : 0
        , tm_mon : 0
        , tm_year : 0
        , tm_wday : 0
        , tm_yday : 0
        , tm_isdst : 0
        , tm_gmtoff : 0
        , tm_zone : 0
      };

      SQL_TIMESTAMP_STRUCT odbcTime;

      ret = SQLGetData(
        hStmt,
        column.index,
        SQL_C_TYPE_TIMESTAMP,
        &odbcTime,
        bufferLength,
        &len);

      DEBUG_PRINTF("ODBC::GetColumnValue - Unix Timestamp: index=%i name=%s type=%i len=%i\n",
                    column.index, column.name, column.type, len);

      if (len == SQL_NULL_DATA) {
        return scope.Escape(Nan::Null());
        //return Null();
      }
      else {
        timeInfo.tm_year = odbcTime.year - 1900;
        timeInfo.tm_mon = odbcTime.month - 1;
        timeInfo.tm_mday = odbcTime.day;
        timeInfo.tm_hour = odbcTime.hour;
        timeInfo.tm_min = odbcTime.minute;
        timeInfo.tm_sec = odbcTime.second;

        //a negative value means that mktime() should use timezone information
        //and system databases to attempt to determine whether DST is in effect
        //at the specified time.
        timeInfo.tm_isdst = -1;
#ifdef TIMEGM
        return scope.Escape(Nan::New<Date>((double(timegm(&timeInfo)) * 1000)
                          + (odbcTime.fraction / 1000000)).ToLocalChecked());
#else
        return scope.Escape(Nan::New<Date>((double(timelocal(&timeInfo)) * 1000)
                          + (odbcTime.fraction / 1000000)).ToLocalChecked());
#endif
        //return Date::New((double(timegm(&timeInfo)) * 1000)
        //                  + (odbcTime.fraction / 1000000));
      }
#endif
    } break;
    case SQL_BIT :
      //again, i'm not sure if this is cross database safe, but it works for
      //MSSQL
      ret = SQLGetData(
        hStmt,
        column.index,
        SQL_C_CHAR,
        (char *) buffer,
        bufferLength,
        &len);

      DEBUG_PRINTF("ODBC::GetColumnValue - Bit: index=%i name=%s type=%lli len=%lli\n",
                    column.index, column.name, column.type, len);

      if (len == SQL_NULL_DATA) {
        return scope.Escape(Nan::Null());
      }
      else {
        return scope.Escape(Nan::New((*buffer == '0') ? false : true));
      }
    default :
      Local<String> str;
      int count = 0;

      do {
        ret = SQLGetData(
          hStmt,
          column.index,
          SQL_C_TCHAR,
          (char *) buffer,
          bufferLength,
          &len);

        DEBUG_PRINTF("ODBC::GetColumnValue - String: index=%i name=%s type=%lli len=%lli value=%s ret=%i bufferLength=%i\n",
                      column.index, column.name, column.type, len,(char *) buffer, ret, bufferLength);

        if (len == SQL_NULL_DATA && str.IsEmpty()) {
          return scope.Escape(Nan::Null());
          //return Null();
        }

        if (SQL_NO_DATA == ret) {
          //we have captured all of the data
          //double check that we have some data else return null
          if (str.IsEmpty()){
            return scope.Escape(Nan::Null());
          }

          break;
        }
        else if (SQL_SUCCEEDED(ret)) {
          //we have not captured all of the data yet

          if (count == 0) {
            //no concatenation required, this is our first pass
#ifdef UNICODE
            str = Nan::New((uint16_t*) buffer).ToLocalChecked();
#else
            str = Nan::New((char *) buffer).ToLocalChecked();
#endif
          }
          else {
            //we need to concatenate
#ifdef UNICODE
            str = String::Concat(str, Nan::New((uint16_t*) buffer).ToLocalChecked());
#else
            str = String::Concat(str, Nan::New((char *) buffer).ToLocalChecked());
#endif
          }

          //if len is zero let's break out of the loop now and not attempt to
          //call SQLGetData again. The specific reason for this is because
          //some ODBC drivers may not correctly report SQL_NO_DATA the next
          //time around causing an infinite loop here
          if (len == 0) {
            break;
          }

          count += 1;
        }
        else {
          //an error has occured
          //possible values for ret are SQL_ERROR (-1) and SQL_INVALID_HANDLE (-2)

          //If we have an invalid handle, then stuff is way bad and we should abort
          //immediately. Memory errors are bound to follow as we must be in an
          //inconsisant state.
          assert(ret != SQL_INVALID_HANDLE);

          //Not sure if throwing here will work out well for us but we can try
          //since we should have a valid handle and the error is something we
          //can look into

          Local<Value> objError = ODBC::GetSQLError(
            SQL_HANDLE_STMT,
            hStmt,
            (char *) "[node-odbc] Error in ODBC::GetColumnValue"
          );

          Nan::ThrowError(objError);
          return scope.Escape(Nan::Undefined());
          break;
        }
      } while (true);

      return scope.Escape(str);
  }
}

/*
 * GetRecordTuple
 */

Local<Value> ODBC::GetRecordTuple ( SQLHSTMT hStmt, Column* columns,
                                         short* colCount, uint16_t* buffer,
                                         int bufferLength) {
  Nan::EscapableHandleScope scope;

  Local<Object> tuple = Nan::New<Object>();

  for(int i = 0; i < *colCount; i++) {
#ifdef UNICODE
    tuple->Set( Nan::New((uint16_t *) columns[i].name).ToLocalChecked(),
                GetColumnValue( hStmt, columns[i], buffer, bufferLength));
#else
    tuple->Set( Nan::New((const char *) columns[i].name).ToLocalChecked(),
                GetColumnValue( hStmt, columns[i], buffer, bufferLength));
#endif
  }

  return scope.Escape(tuple);
}

/*
 * GetRecordArray
 */

Local<Value> ODBC::GetRecordArray ( SQLHSTMT hStmt, Column* columns,
                                         short* colCount, uint16_t* buffer,
                                         int bufferLength) {
  Nan::EscapableHandleScope scope;

  Local<Array> array = Nan::New<Array>();

  for(int i = 0; i < *colCount; i++) {
    array->Set( Nan::New(i),
                GetColumnValue( hStmt, columns[i], buffer, bufferLength));
  }

  return scope.Escape(array);
}

/*
 * GetParametersFromArray
 */

Parameter* ODBC::GetParametersFromArray (Local<Array> values, int *paramCount) {
  DEBUG_PRINTF("ODBC::GetParametersFromArray\n");
  *paramCount = values->Length();

  Parameter* params = NULL;

  if (*paramCount > 0) {
    params = (Parameter *) malloc(*paramCount * sizeof(Parameter));
  }

  for (int i = 0; i < *paramCount; i++) {
    Local<Value> value = values->Get(i);

    params[i].ColumnSize       = 0;
    params[i].StrLen_or_IndPtr = SQL_NULL_DATA;
    params[i].BufferLength     = 0;
    params[i].DecimalDigits    = 0;

    DEBUG_PRINTF("ODBC::GetParametersFromArray - param[%i].length = %lli\n",
                 i, params[i].StrLen_or_IndPtr);

    if (value->IsString()) {
      Local<String> string = value->ToString();
      int length = string->Length();

      params[i].ValueType         = SQL_C_TCHAR;
      params[i].ColumnSize        = 0; //SQL_SS_LENGTH_UNLIMITED
#ifdef UNICODE
      params[i].ParameterType     = SQL_WVARCHAR;
      params[i].BufferLength      = (length * sizeof(uint16_t)) + sizeof(uint16_t);
#else
      params[i].ParameterType     = SQL_VARCHAR;
      params[i].BufferLength      = string->Utf8Length() + 1;
#endif
      params[i].ParameterValuePtr = malloc(params[i].BufferLength);
      params[i].StrLen_or_IndPtr  = SQL_NTS;//params[i].BufferLength;

#ifdef UNICODE
      string->Write((uint16_t *) params[i].ParameterValuePtr);
#else
      string->WriteUtf8((char *) params[i].ParameterValuePtr);
#endif

      DEBUG_PRINTF("ODBC::GetParametersFromArray - IsString(): params[%i] c_type=%i type=%i buffer_length=%lli size=%lli length=%lli value=%s\n",
                    i, params[i].ValueType, params[i].ParameterType,
                    params[i].BufferLength, params[i].ColumnSize, params[i].StrLen_or_IndPtr,
                    (char*) params[i].ParameterValuePtr);
    }
    else if (value->IsNull()) {
      params[i].ValueType = SQL_C_DEFAULT;
      params[i].ParameterType   = SQL_VARCHAR;
      params[i].StrLen_or_IndPtr = SQL_NULL_DATA;

      DEBUG_PRINTF("ODBC::GetParametersFromArray - IsNull(): params[%i] c_type=%i type=%i buffer_length=%lli size=%lli length=%lli\n",
                   i, params[i].ValueType, params[i].ParameterType,
                   params[i].BufferLength, params[i].ColumnSize, params[i].StrLen_or_IndPtr);
    }
    else if (value->IsInt32()) {
      int64_t  *number = new int64_t(value->IntegerValue());
      params[i].ValueType = SQL_C_SBIGINT;
      params[i].ParameterType   = SQL_BIGINT;
      params[i].ParameterValuePtr = number;
      params[i].StrLen_or_IndPtr = 0;

      DEBUG_PRINTF("ODBC::GetParametersFromArray - IsInt32(): params[%i] c_type=%i type=%i buffer_length=%lli size=%lli length=%lli value=%lld\n",
                    i, params[i].ValueType, params[i].ParameterType,
                    params[i].BufferLength, params[i].ColumnSize, params[i].StrLen_or_IndPtr,
                    *number);
    }
    else if (value->IsNumber()) {
      double *number   = new double(value->NumberValue());

      params[i].ValueType         = SQL_C_DOUBLE;
      params[i].ParameterType     = SQL_DECIMAL;
      params[i].ParameterValuePtr = number;
      params[i].BufferLength      = sizeof(double);
      params[i].StrLen_or_IndPtr  = params[i].BufferLength;
      params[i].DecimalDigits     = 7;
      params[i].ColumnSize        = sizeof(double);

      DEBUG_PRINTF("ODBC::GetParametersFromArray - IsNumber(): params[%i] c_type=%i type=%i buffer_length=%lli size=%lli length=%lli value=%f\n",
                    i, params[i].ValueType, params[i].ParameterType,
                    params[i].BufferLength, params[i].ColumnSize, params[i].StrLen_or_IndPtr,
		                *number);
    }
    else if (value->IsBoolean()) {
      bool *boolean = new bool(value->BooleanValue());
      params[i].ValueType         = SQL_C_BIT;
      params[i].ParameterType     = SQL_BIT;
      params[i].ParameterValuePtr = boolean;
      params[i].StrLen_or_IndPtr  = 0;

      DEBUG_PRINTF("ODBC::GetParametersFromArray - IsBoolean(): params[%i] c_type=%i type=%i buffer_length=%lli size=%lli length=%lli\n",
                   i, params[i].ValueType, params[i].ParameterType,
                   params[i].BufferLength, params[i].ColumnSize, params[i].StrLen_or_IndPtr);
    }
  }

  return params;
}

/*
 * CallbackSQLError
 */

Handle<Value> ODBC::CallbackSQLError (SQLSMALLINT handleType,
                                      SQLHANDLE handle,
                                      Nan::Callback* cb) {
  Nan::EscapableHandleScope scope;

  return scope.Escape(CallbackSQLError(
    handleType,
    handle,
    (char *) "[node-odbc] SQL_ERROR",
    cb));
}

Local<Value> ODBC::CallbackSQLError (SQLSMALLINT handleType,
                                      SQLHANDLE handle,
                                      char* message,
                                      Nan::Callback* cb) {
  Nan::EscapableHandleScope scope;

  Local<Object> objError = ODBC::GetSQLError(
    handleType,
    handle,
    message
  );

  Local<Value> info[1];
  info[0] = objError;
  cb->Call(1, info);

  return scope.Escape(Nan::Undefined());
}

/*
 * GetSQLError
 */

Local<Object> ODBC::GetSQLError (SQLSMALLINT handleType, SQLHANDLE handle) {
  Nan::EscapableHandleScope scope;

  return scope.Escape(GetSQLError(
    handleType,
    handle,
    (char *) "[node-odbc] SQL_ERROR"));
}

Local<Object> ODBC::GetSQLError (SQLSMALLINT handleType, SQLHANDLE handle, char* message) {
  Nan::EscapableHandleScope scope;

  DEBUG_PRINTF("ODBC::GetSQLError : handleType=%i, handle=%p\n", handleType, handle);

  Local<Object> objError = Nan::New<Object>();

  int32_t i = 0;
  SQLINTEGER native;

  SQLSMALLINT len;
  SQLINTEGER statusRecCount;
  SQLRETURN ret;
  char errorSQLState[14];
  char errorMessage[ERROR_MESSAGE_BUFFER_BYTES];

  ret = SQLGetDiagField(
    handleType,
    handle,
    0,
    SQL_DIAG_NUMBER,
    &statusRecCount,
    SQL_IS_INTEGER,
    &len);

  // Windows seems to define SQLINTEGER as long int, unixodbc as just int... %i should cover both
  DEBUG_PRINTF("ODBC::GetSQLError : called SQLGetDiagField; ret=%i, statusRecCount=%i\n", ret, statusRecCount);

  Local<Array> errors = Nan::New<Array>();
  objError->Set(Nan::New("errors").ToLocalChecked(), errors);

  for (i = 0; i < statusRecCount; i++){
    DEBUG_PRINTF("ODBC::GetSQLError : calling SQLGetDiagRec; i=%i, statusRecCount=%i\n", i, statusRecCount);

    ret = SQLGetDiagRec(
      handleType,
      handle,
      (SQLSMALLINT)(i + 1),
      (SQLTCHAR *) errorSQLState,
      &native,
      (SQLTCHAR *) errorMessage,
      ERROR_MESSAGE_BUFFER_CHARS,
      &len);

    DEBUG_PRINTF("ODBC::GetSQLError : after SQLGetDiagRec; i=%i\n", i);

    if (SQL_SUCCEEDED(ret)) {
      DEBUG_PRINTF("ODBC::GetSQLError : errorMessage=%s, errorSQLState=%s\n", errorMessage, errorSQLState);

      if (i == 0) {
        // First error is assumed the primary error
        objError->Set(Nan::New("error").ToLocalChecked(), Nan::New(message).ToLocalChecked());
#ifdef UNICODE
        objError->SetPrototype(Exception::Error(Nan::New((uint16_t *)errorMessage).ToLocalChecked()));
        objError->Set(Nan::New("message").ToLocalChecked(), Nan::New((uint16_t *)errorMessage).ToLocalChecked());
        objError->Set(Nan::New("state").ToLocalChecked(), Nan::New((uint16_t *)errorSQLState).ToLocalChecked());
#else
        objError->SetPrototype(Exception::Error(Nan::New(errorMessage).ToLocalChecked()));
        objError->Set(Nan::New("message").ToLocalChecked(), Nan::New(errorMessage).ToLocalChecked());
        objError->Set(Nan::New("state").ToLocalChecked(), Nan::New(errorSQLState).ToLocalChecked());
#endif
      }

      Local<Object> subError = Nan::New<Object>();

#ifdef UNICODE
      subError->Set(Nan::New("message").ToLocalChecked(), Nan::New((uint16_t *)errorMessage).ToLocalChecked());
      subError->Set(Nan::New("state").ToLocalChecked(), Nan::New((uint16_t *)errorSQLState).ToLocalChecked());
#else
      subError->Set(Nan::New("message").ToLocalChecked(), Nan::New(errorMessage).ToLocalChecked());
      subError->Set(Nan::New("state").ToLocalChecked(), Nan::New(errorSQLState).ToLocalChecked());
#endif
      errors->Set(Nan::New(i), subError);

    } else if (ret == SQL_NO_DATA) {
      break;
    }
  }

  if (statusRecCount == 0) {
    //Create a default error object if there were no diag records
    objError->Set(Nan::New("error").ToLocalChecked(), Nan::New(message).ToLocalChecked());
    objError->SetPrototype(Exception::Error(Nan::New(message).ToLocalChecked()));
    objError->Set(Nan::New("message").ToLocalChecked(), Nan::New(
      (const char *) "[node-odbc] An error occurred but no diagnostic information was available.").ToLocalChecked());
  }

  return scope.Escape(objError);
}

/*
 * GetAllRecordsSync
 */

Local<Array> ODBC::GetAllRecordsSync (HENV hENV,
                                     HDBC hDBC,
                                     HSTMT hSTMT,
                                     uint16_t* buffer,
                                     int bufferLength) {
  DEBUG_PRINTF("ODBC::GetAllRecordsSync\n");

  Nan::EscapableHandleScope scope;

  Local<Object> objError = Nan::New<Object>();

  int count = 0;
  int errorCount = 0;
  short colCount = 0;

  Column* columns = GetColumns(hSTMT, &colCount);

  Local<Array> rows = Nan::New<Array>();

  //loop through all records
  while (true) {
    SQLRETURN ret = SQLFetch(hSTMT);

    //check to see if there was an error
    if (ret == SQL_ERROR)  {
      //TODO: what do we do when we actually get an error here...
      //should we throw??

      errorCount++;

      objError = ODBC::GetSQLError(
        SQL_HANDLE_STMT,
        hSTMT,
        (char *) "[node-odbc] Error in ODBC::GetAllRecordsSync"
      );

      break;
    }

    //check to see if we are at the end of the recordset
    if (ret == SQL_NO_DATA) {
      ODBC::FreeColumns(columns, &colCount);

      break;
    }

    rows->Set(
      Nan::New(count),
      ODBC::GetRecordTuple(
        hSTMT,
        columns,
        &colCount,
        buffer,
        bufferLength)
    );

    count++;
  }
  //TODO: what do we do about errors!?!
  //we throw them
  return scope.Escape(rows);
}

#ifdef dynodbc
NAN_METHOD(ODBC::LoadODBCLibrary) {
  Nan::HandleScope scope;

  REQ_STR_ARG(0, js_library);

  bool result = DynLoadODBC(*js_library);

  info.GetReturnValue().Set((result) ? Nan::True() : Nan::False());
}
#endif

extern "C" void init(v8::Handle<Object> exports) {
#ifdef dynodbc
  exports->Set(Nan::New("loadODBCLibrary").ToLocalChecked(),
        Nan::New<FunctionTemplate>(ODBC::LoadODBCLibrary)->GetFunction());
#endif

  ODBC::Init(exports);
  ODBCResult::Init(exports);
  ODBCConnection::Init(exports);
  ODBCStatement::Init(exports);
}

NODE_MODULE(odbc_bindings, init)


text:
from __future__ import unicode_literals, division, absolute_import
from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
from time import sleep

import pytest

from flexget.components.managed_lists.lists.thetvdb_list import TheTVDBSet
from flexget.entry import Entry

@pytest.mark.online
class TestTheTVDBList(object):
    config = """
      tasks: {}
    """

    tvdb_config = {
        'username': 'flexget',
        'account_id': '80FB8BD0720CA5EC',
        'api_key': '4D297D8CFDE0E105',
    }

    def test_thetvdb_list_add(self):
        tvdb_set = TheTVDBSet(self.tvdb_config)
        # Clearing existing list
        tvdb_set.clear()

        entry = Entry(title='Marvels Daredevil', tvdb_id='281662')

        assert entry not in tvdb_set
        tvdb_set.add(entry)

        sleep(2)
        assert entry in tvdb_set


text:
class MyCommandFunc
{
public:

	MyCommandFunc(void);
	~MyCommandFunc(void);
};


text:
title:  Octopus's Garden
fandoms:
    - Buffy the Vampire Slayer
creators: Luminosity
song: Octopus's Garden
artist: The Beatles
date:   2005-03-03 10:00:00
mp4name: Luminosity-060-Octopus's-Garden.m4v
mp4size: 29.58 MB
width: 640
height: 480
---


text:
<?php

/*
 * This file is part of HeriJobQueueBundle.
 *
 * (c) Alexandre Mogère
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Heri\Bundle\JobQueueBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class QueueCreateCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('jobqueue:create')
            ->setDescription('Create a queue')
            ->addArgument('queue-name', InputArgument::REQUIRED, 'Which name do you want for the queue?')
            ->addOption('timeout', null, InputOption::VALUE_OPTIONAL, 'Timeout')
        ;
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queue = $this->getContainer()->get('jobqueue');

        $timeout = $input->getOption('timeout');
        $name = $input->getArgument('queue-name');

        $dialog = $this->getHelper('question');
        if (!$timeout) {
            $timeout = $dialog->ask(
                $output,
                '<question>Please enter the timeout</question> [<comment>90</comment>]: ',
                90
            );
        }

        if ($queue->create($name, $timeout)) {
            $action = 'created';
        } else {
            $action = 'updated';
        }

        $output->writeLn(sprintf('<info>Queue "%s" %s</info>', $name, $action));
    }
}


text:
ToolbarButton::ToolbarButton (const int iid, const String& buttonText,
                              Drawable* const normalIm, Drawable* const toggledOnIm)
   : ToolbarItemComponent (iid, buttonText, true),
     normalImage (normalIm),
     toggledOnImage (toggledOnIm),
     currentImage (nullptr)
{
    jassert (normalImage != nullptr);
}

ToolbarButton::~ToolbarButton()
{
}

//==============================================================================
bool ToolbarButton::getToolbarItemSizes (int toolbarDepth, bool /*isToolbarVertical*/, int& preferredSize, int& minSize, int& maxSize)
{
    preferredSize = minSize = maxSize = toolbarDepth;
    return true;
}

void ToolbarButton::paintButtonArea (Graphics&, int /*width*/, int /*height*/, bool /*isMouseOver*/, bool /*isMouseDown*/)
{
}

void ToolbarButton::contentAreaChanged (const Rectangle<int>&)
{
    buttonStateChanged();
}

void ToolbarButton::setCurrentImage (Drawable* const newImage)
{
    if (newImage != currentImage)
    {
        removeChildComponent (currentImage);
        currentImage = newImage;

        if (currentImage != nullptr)
        {
            enablementChanged();
            addAndMakeVisible (currentImage);
            updateDrawable();
        }
    }
}

void ToolbarButton::updateDrawable()
{
    if (currentImage != nullptr)
    {
        currentImage->setInterceptsMouseClicks (false, false);
        currentImage->setTransformToFit (getContentArea().toFloat(), RectanglePlacement::centred);
        currentImage->setAlpha (isEnabled() ? 1.0f : 0.5f);
    }
}

void ToolbarButton::resized()
{
    ToolbarItemComponent::resized();
    updateDrawable();
}

void ToolbarButton::enablementChanged()
{
    ToolbarItemComponent::enablementChanged();
    updateDrawable();
}

Drawable* ToolbarButton::getImageToUse() const
{
    if (getStyle() == Toolbar::textOnly)
        return nullptr;

    if (getToggleState() && toggledOnImage != nullptr)
        return toggledOnImage;

    return normalImage;
}

void ToolbarButton::buttonStateChanged()
{
    setCurrentImage (getImageToUse());
}


text:
import execa from 'execa';

import { Command } from '../types';

/**
 * Spawn the command.
 *
 * @export
 * @param {Command} command Command
 * @param {string[]} args Command arguments
 * @param {boolean} verbose Display more information
 * @returns {Promise<void>} Promise of spawn
 */
export default async function spawnCommand(
	command: Command,
	args: string[],
	verbose: boolean
): Promise<void> {
	// Verbose only NPM
	if (command.toLowerCase() === 'npm') {
		if (verbose) {
			args.push('--verbose');
		} else {
			args.push('--silent');
		}
	}

	await execa(command, args, {
		stdio: verbose ? 'inherit' : 'pipe'
	});
}


text:
import { Column, Entity, PrimaryColumn, Unique, Index } from "../../../../src"

@Entity()
@Unique(["name"])
@Index(["text"], { unique: true })
export class Photo {
    @PrimaryColumn()
    id: number

    @Column()
    name: string

    @Column()
    @Index({ unique: true })
    tag: string

    @Column({ unique: true })
    description: string

    @Column()
    text: string
}


text:
package com.beyondj.gateway.model;

import com.beyondj.gateway.model.loadbalancer.LoadBalancerDefinition;

import java.io.Serializable;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Represents a collection of HTTP proxy mapping rules.
 * <p/>
 * These can be created via a Java DSL and XML DSL (JAXB) or loaded from a database.
 */
public class HttpProxyRuleBase implements Serializable {

    private UUID id = UUID.randomUUID();
    private String location;
    private Map<String, HttpProxyRule> mappingRules = new ConcurrentHashMap<>();

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public Map<String, HttpProxyRule> getMappingRules() {
        return mappingRules;
    }

    public void setMappingRules(Map<String, HttpProxyRule> mappingRules) {
        this.mappingRules = mappingRules;
    }

    /**
     * DSL API to create or update a mapping rule for the given URI template
     */
    public HttpProxyRule rule(String uriTemplate, LoadBalancerDefinition loadBalancerDefinition) {
        HttpProxyRule answer = getMappingRules().get(uriTemplate);
        if (answer == null) {
            answer = new HttpProxyRule(loadBalancerDefinition, uriTemplate);
            getMappingRules().put(uriTemplate, answer);
        }
        return answer;
    }

    public UUID getId() {
        return id;
    }

    @Override
    public String toString() {

        StringBuilder builder = new StringBuilder("\n\nHttpProxyRuleBase{")
                .append("\nlocation=").append(location)
                .append("\nid=").append(id).
                        append("\nmappingRules=");

        for (String key : mappingRules.keySet()) {
            builder.append("\n").append(key).append("=").append(mappingRules.get(key));
        }
        return builder.toString();
    }

    public void addRule(HttpProxyRule rule) {

        String path = rule.getUriTemplate().getUriTemplate();
        HttpProxyRule existingRule = getMappingRules().get(path);
        if (existingRule != null) {
            existingRule.getDestinationUriTemplates().addAll(rule.getDestinationUriTemplates());
        } else {
            getMappingRules().put(rule.getUriTemplate().getUriTemplate(), rule);
        }
    }

    public void removeRule(HttpProxyRule rule) {
        String path = rule.getUriTemplate().getUriTemplate();
        HttpProxyRule existingRule = getMappingRules().get(path);
        if (existingRule != null) {
            existingRule.getDestinationUriTemplates().removeAll(rule.getDestinationUriTemplates());
        } else {
            getMappingRules().remove(rule.getUriTemplate().getUriTemplate());
        }
    }

    public void addRules(Map<String, HttpProxyRule> rules) {
        for (String key : rules.keySet()) {
            HttpProxyRule rule = rules.get(key);
            addRule(rule);
        }
    }

    public void removeRules(Map<String, HttpProxyRule> rules) {
        for (String key : rules.keySet()) {
            HttpProxyRule rule = rules.get(key);
            removeRule(rule);
        }
    }
}


text:
sudo dnf groupinstall "C Development Tools and Libraries" "Development Tools"
sudo dnf install ansible \
            ruby \
            ruby-devel \
            rubygem-mysql2 \
            mysql-utilities \
            rubygem-sqlite3 \
            sqlite \
            sqlite-libs \
            sqlite-devel \
            mariadb-devel \
            mariadb \
            rubygem-bundler \
            libffi-devel \
            libffi \
            rubygem-ffi \
            rubygem-hitimes \
            rpm-build \
            postgresql \
            postgresql-devel


text:
(function() {

    const {ipcRenderer} = require('electron');
    angular
        .module('myOnotes')
        .controller('notesController', ['$scope', '$mdDialog', '$mdToast', '$location', 'notesService', 'categoriesService', 'shortcutService', 'settingsService', 'loaderService', notesController]);

    function notesController($scope, $mdDialog, $mdToast, $location, notesService, categoriesService, shortcutService, settingsService, loaderService) {
        var vm = this,
            getNotes = function() {
                if (vm.currentCategory && vm.currentCategory.name) {
                    notesService.get(vm.currentCategory.name, function(notes) {
                        $scope.$apply(vm.notes = notes);
                    });
                }
            },
            addNote = function() {
                notesService.add(vm.inputNote);
                vm.inputNote = null;
                getNotes();
            },
            markAsDone = function(noteId, isDone) {
                notesService.markAsDone(noteId, isDone, function() {
                    getNotes();
                });
            },
            rmeoveNote = function(noteId) {
                notesService.remove(noteId, function() {
                    getNotes();
                });
            },
            getCategories = function() {
                categoriesService.getAll(function(categories) {
                    vm.categories = categories;
                });
            },
            updateName = function(noteId, noteName) {
                if (!noteName) {
                    addToast('Name cannot be empty...');
                    getNotes();
                    return;
                }

                notesService.updateName(noteId, noteName, function() {
                    addToast('Updated...');
                });
            },
            navigateToNoteInfo = function(noteId) {
                $location.path('/note-info/' + noteId);
            },
            addToast = function(message) {
                $mdToast.show(
                    $mdToast.simple()
                        .textContent(message)
                        .position('left')
                        .hideDelay(200));
            },
            handleChangeCategory = function(categoryName) {
                if (!categoryName) {
                    $mdToast.show(
                        $mdToast.simple()
                            .textContent('Category name cannot be empty.')
                            .position('left')
                            .hideDelay(1000));
                    return;
                }

                var preselectedCategory = vm.categories.find(function(category) {
                    return category.name === categoryName;
                });

                if (!preselectedCategory) {
                    $mdToast.show(
                        $mdToast.simple()
                            .textContent('Category does not exists...')
                            .position('left')
                            .hideDelay(1000));
                    return;
                }

                vm.currentCategory = preselectedCategory;
                settingsService.updateLastSelectedCategory(preselectedCategory.name);
                getNotes();
            },
            init = function() {
                shortcutService.removeAll();
                settingsService.getSettings(function(settings) {
                    categoriesService.getAll(function(categories) {
                        var preselectedCategory = categories.find(function(category) {
                            return category.name === settings.lastSelectedCategory;
                        });

                        vm.categories = categories;
                        if (preselectedCategory) {
                            vm.currentCategory = preselectedCategory;
                        } else {
                            vm.currentCategory = categories[0];
                        }

                        getNotes();
                    });
                });
            };

        init();
        // getCategories();
        // getNotes();

        vm.getNotes = getNotes;
        vm.addNote = addNote;
        vm.remove = rmeoveNote;
        vm.markAsDone = markAsDone;
        vm.updateName = updateName;
        vm.navigateToNoteInfo = navigateToNoteInfo;

        shortcutService.addShortcut("Ctrl+d", function() {
            if (!vm.currentCategory || !vm.currentCategory.name) {
                $mdDialog.show(
                    $mdDialog.alert()
                        .title('Cannot add notes before selecting a list..')
                        .ok('Okay!'));
                return;
            }

            $mdDialog.show(
                $mdDialog.prompt()
                    .title('Add new note..')
                    .ok('Okay!')
                    .cancel('Cancel'))
                .then(function(result) {
                    if (result) {
                        notesService.add(vm.currentCategory.name, result);
                        getNotes();
                    } else {
                        $mdToast.show(
                            $mdToast.simple()
                                .textContent('Note name cannot be empty.')
                                .position('left')
                                .hideDelay(1000));
                    }
                });
        });

        shortcutService.addShortcut('Ctrl+g', function() {
            $mdDialog.show(
                $mdDialog.prompt()
                    .title('Add new category..')
                    .ok('Okay!')
                    .cancel('Cancel')).then(function(result) {
                        if (result) {
                            loaderService.showLoader();
                            categoriesService.add(result, function(newCategory) {
                                settingsService.updateLastSelectedCategory(newCategory.name, function() {
                                    vm.currentCategory = newCategory;
                                    loaderService.hideLoader();
                                    getNotes();
                                });
                            });
                        } else {
                            $mdToast.show(
                                $mdToast.simple()
                                    .textContent('Category name cannot be empty.')
                                    .position('left')
                                    .hideDelay(1000));
                        }
                    });
        });

        shortcutService.addShortcut('Ctrl+space', function() {
            $mdDialog.show(
                $mdDialog.prompt()
                    .title('Change category..')
                    .ok('Okay!')
                    .cancel('Cancel')).then(function(result) {
                        handleChangeCategory(result);
                    });
        });
    }
})();


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SysAnalytics.Model.Attributes
{
    [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
    public sealed class CommentCategoryDescriptionAttribute : Attribute
    {
        public string Name { get; set; }
        public bool IsSystemGeneratedOnly { get; set; }
        public bool? IsPositive { get; set; }

        public CommentCategoryDescriptionAttribute(string aName, bool aIsSystemGeneratedOnly, bool aIsPosiitve)
        {
            Name = aName;
            IsSystemGeneratedOnly = aIsSystemGeneratedOnly;
            IsPositive = aIsPosiitve;
        }

        public CommentCategoryDescriptionAttribute(string aName, bool aIsSystemGeneratedOnly)
        {
            Name = aName;
            IsSystemGeneratedOnly = aIsSystemGeneratedOnly;
            IsPositive = null;
        }
    }
}


text:
@protocol AKStatusItemViewDelegate <NSObject>
@optional
-(void) mouseDownWithEvent: (NSEvent *)event;
-(void) mouseEnteredWithEvent: (NSEvent *)event;
@end

@interface AKStatusItemView : NSView <NSMenuDelegate>

@property (nonatomic) bool showIcon;
@property bool menuIsVisible;
@property (nonatomic) NSString *title;

@property NSTrackingArea *tracking;

- (void)menuWillOpen:(NSMenu *)menu;
- (void)menuDidClose:(NSMenu *)menu;

- (void) mouseEntered:(NSEvent *)event;

- (id)initWithStatusItem: (NSStatusItem *)statusItem;

@property (weak) id<AKStatusItemViewDelegate> delegate;
@property (weak) NSStatusItem *statusItem;

@end


text:
@if ($display)

{!! $field->renderBefore() !!}

getOption('root-class') }}">

key }}">
        position }}">
            {{ $field->label }}
            @if (! empty($field->getOption('tooltip')))
                getOption('tooltip') !!}">
            @endif

        @if (! empty($field->getOption('help')))
            ({!! $field->getOption('help') !!})
        @endif
        {!! Form::file($field->key, ['class' => 'form-control dynamo-file '.$field->getOption('class')]) !!}
        @if (! empty($item->{$field->key}))

Current: {$field->key} }}" target="_blank">{{ $item->{$field->key} }}

        @endif

{!! $field->renderAfter() !!}

@endif


text:
package com.octo.android.robospice.persistence.retrofit;

import java.io.File;
import java.util.List;

import retrofit.converter.Converter;
import android.app.Application;

import com.octo.android.robospice.persistence.exception.CacheCreationException;
import com.octo.android.robospice.persistence.file.InFileObjectPersister;
import com.octo.android.robospice.persistence.file.InFileObjectPersisterFactory;

public class RetrofitObjectPersisterFactory extends InFileObjectPersisterFactory {

    // ----------------------------------
    // ATTRIBUTES
    // ----------------------------------
    private Converter converter;

    // ----------------------------------
    // CONSTRUCTORS
    // ----------------------------------
    public RetrofitObjectPersisterFactory(Application application, Converter converter, File cacheFolder)
        throws CacheCreationException {
        this(application, converter, null, cacheFolder);
    }

    public RetrofitObjectPersisterFactory(Application application, Converter converter,
        List<Class<?>> listHandledClasses, File cacheFolder) throws CacheCreationException {
        super(application, listHandledClasses, cacheFolder);
        this.converter = converter;
    }

    public RetrofitObjectPersisterFactory(Application application, Converter converter) throws CacheCreationException {
        this(application, converter, null, null);
    }

    public RetrofitObjectPersisterFactory(Application application, Converter converter,
        List<Class<?>> listHandledClasses) throws CacheCreationException {
        this(application, converter, listHandledClasses, null);
    }

    // ----------------------------------
    // API
    // ----------------------------------
    @Override
    public <DATA> InFileObjectPersister<DATA> createInFileObjectPersister(Class<DATA> clazz, File cacheFolder)
        throws CacheCreationException {
        return new RetrofitObjectPersister<DATA>(getApplication(), converter, clazz, cacheFolder);
    }

}


text:
<?php
// autogenerated file 30.09.2013 15:20
// $Id: $
// $Log: $
//
//
require_once 'HistogramEntryType.php';
require_once 'EbatNs_ComplexType.php';

/**
 * A generic type used for histograms.
 *
 * @link http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/types/CharacteristicsSetProductHistogramType.html
 *
 */
class CharacteristicsSetProductHistogramType extends EbatNs_ComplexType
{
	/**
	 * @var HistogramEntryType
	 */
	protected $HistogramEntry;

	/**
	 * @return HistogramEntryType
	 * @param integer $index
	 */
	function getHistogramEntry($index = null)
	{
		if ($index !== null) {
			return $this->HistogramEntry[$index];
		} else {
			return $this->HistogramEntry;
		}
	}
	/**
	 * @return void
	 * @param HistogramEntryType $value
	 * @param  $index
	 */
	function setHistogramEntry($value, $index = null)
	{
		if ($index !== null) {
			$this->HistogramEntry[$index] = $value;
		} else {
			$this->HistogramEntry = $value;
		}
	}
	/**
	 * @return void
	 * @param HistogramEntryType $value
	 */
	function addHistogramEntry($value)
	{
		$this->HistogramEntry[] = $value;
	}
	/**
	 * @return
	 */
	function __construct()
	{
		parent::__construct('CharacteristicsSetProductHistogramType', 'urn:ebay:apis:eBLBaseComponents');
		if (!isset(self::$_elements[__CLASS__]))
				self::$_elements[__CLASS__] = array_merge(self::$_elements[get_parent_class()],
				array(
					'HistogramEntry' =>
					array(
						'required' => false,
						'type' => 'HistogramEntryType',
						'nsURI' => 'urn:ebay:apis:eBLBaseComponents',
						'array' => true,
						'cardinality' => '0..*'
					)
				));
	}
}
?>


text:
<!DOCTYPE html>

  <meta charset="UTF-8">

  <title>CodePen - A Pen by omathiaso</title>

  <link rel="stylesheet" href="css/normalize.css">

  <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'>

    <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />

  <input type="text" id="addTodo" placeholder="What todo next..."/>

Teach SCSS

Eat some Pizza

Make something on Codepen

Drink Coffee


text:
package io.cloudslang.content.jclouds.execute;

import io.cloudslang.content.jclouds.entities.inputs.ListServersInputs;
import io.cloudslang.content.jclouds.entities.outputs.Outputs;
import io.cloudslang.content.jclouds.factory.ComputeFactory;
import io.cloudslang.content.jclouds.services.ComputeService;
import org.jclouds.rest.ResourceNotFoundException;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

/**
 * Created by persdana on 7/7/2015.
 */
@RunWith(PowerMockRunner.class)
@PrepareForTest({ListServersExecutor.class, ComputeFactory.class})
public class ListServersExecutorTest {
    private static final String DELIMITER = ";;";
    private static final String INVALID_SERVER_ID_EXCEPTION_MESSAGE = "{\"itemNotFound\": {\"message\": \"Instance not found\", \"code\": 404}}";
    private static final String REGION = "us-east-1";

    @Rule
    public ExpectedException exception = ExpectedException.none();

    @Spy
    private ListServersExecutor toTest = new ListServersExecutor();

    @Mock
    ComputeService computeServiceMock;

    /**
     * Tests the execute method. Positive scenario.
     * @throws Exception
     */
    @Test
    public void testExecute() throws Exception {
        ListServersInputs intputs = Inputs.getListServerInputsForAmazon();
        PowerMockito.mockStatic(ComputeFactory.class);
        PowerMockito.doReturn(computeServiceMock).when(ComputeFactory.class, "getComputeService", intputs);
        Set<String> nodes = new HashSet<>();
        nodes.add("nod1");
        nodes.add("nod2");
        Mockito.doReturn(nodes).when(computeServiceMock).listNodes(REGION);

        Map<String, String> result = toTest.execute(intputs);

        Assert.assertEquals("0", result.get(Outputs.RETURN_CODE));
        Assert.assertEquals("nod2" + DELIMITER + "nod1", result.get(Outputs.RETURN_RESULT));
        verify(computeServiceMock).listNodes(REGION);
        verifyNoMoreInteractions(computeServiceMock);
    }

    @Test
    public void testExecuteNegativeScenario() throws Exception {
        exception.expect(ResourceNotFoundException.class);
        exception.expectMessage(INVALID_SERVER_ID_EXCEPTION_MESSAGE);

        ListServersInputs inputs = Inputs.getListServerInputsForAmazon();
        PowerMockito.mockStatic(ComputeFactory.class);
        PowerMockito.doReturn(computeServiceMock).when(ComputeFactory.class, "getComputeService", inputs);
        ResourceNotFoundException toThrow = new ResourceNotFoundException(INVALID_SERVER_ID_EXCEPTION_MESSAGE);
        Mockito.doThrow(toThrow).when(computeServiceMock).listNodes(REGION);

        toTest.execute(inputs);
    }
}


text:
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
  <meta charset="UTF-8">
  <title>iron-validator-behavior basic tests</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

  <script src="../../webcomponentsjs/webcomponents.js"></script>
  <script src="../../web-component-tester/browser.js"></script>
  <script src="../../test-fixture/test-fixture-mocha.js"></script>

  <link href="../../test-fixture/test-fixture.html" rel="import">
  <link href="../../iron-meta/iron-meta.html" rel="import">
  <link href="simple-validator.html" rel="import">

</head>
<body>

  <test-fixture id="basic">
    <template>
      <simple-validator></simple-validator>
    </template>
  </test-fixture>

  <script>

    suite('basic', function() {

      test('registered in <iron-meta>', function() {
        fixture('basic');
        assert.ok(new Polymer.IronMeta({type: 'validator'}).byKey('simple-validator'), 'simple-validator found in <iron-meta>');
      });

    });

  </script>

</body>
</html>


text:
<?php

namespace Psy\Test\CodeCleaner;

use Psy\CodeCleaner\FinalClassPass;

class FinalClassPassTest extends CodeCleanerTestCase
{
    public function setUp()
    {
        $this->setPass(new FinalClassPass());
    }

    /**
     * @dataProvider invalidStatements
     * @expectedException \Psy\Exception\FatalErrorException
     */
    public function testProcessStatementFails($code)
    {
        $this->parseAndTraverse($code);
    }

    public function invalidStatements()
    {
        $data = [
            ['final class A {} class B extends A {}'],
            ['class A {} final class B extends A {} class C extends B {}'],
            // array('namespace A { final class B {} } namespace C { class D extends \\A\\B {} }'),
        ];

        if (!defined('HHVM_VERSION')) {
            // For some reason Closure isn't final in HHVM?
            $data[] = ['class A extends \\Closure {}'];
        }

        return $data;
    }

    /**
     * @dataProvider validStatements
     */
    public function testProcessStatementPasses($code)
    {
        $this->parseAndTraverse($code);
        $this->assertTrue(true);
    }

    public function validStatements()
    {
        return [
            ['class A extends \\stdClass {}'],
            ['final class A extends \\stdClass {}'],
            ['class A {} class B extends A {}'],
        ];
    }
}


text:
define({
  "showLegend": "Legende anzeigen",
  "controlPopupMenuTitle": "Legen Sie fest, welche Aktionen im Kontextmenü für Layer angezeigt werden sollen.",
  "zoomto": "Zoomen auf",
  "transparency": "Transparenz",
  "controlPopup": "Pop-up aktivieren/deaktivieren",
  "moveUpAndDown": "Nach oben/Nach oben",
  "attributeTable": "Attributtabelle öffnen",
  "url": "Beschreibung/Elementdetails anzeigen/Herunterladen",
  "layerSelectorTitle": "Legen Sie fest, welche Layer in der Liste angezeigt werden sollen."
});


text:
package org.bouncycastle.jcajce.interfaces;

import java.security.Key;

public interface EdDSAKey
    extends Key
{
}


text:
package org.springframework.boot.web.servlet.server;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
import org.springframework.util.Assert;

/**
 * {@link BeanPostProcessor} that applies all {@link ServletWebServerFactoryCustomizer}s
 * from the bean factory to {@link ConfigurableServletWebServerFactory} beans.
 *
 * @author Dave Syer
 * @author Phillip Webb
 * @author Stephane Nicoll
 * @since 2.0.0
 */
public class ServletWebServerFactoryCustomizerBeanPostProcessor
		implements BeanPostProcessor, BeanFactoryAware {

	private ListableBeanFactory beanFactory;

	private List<ServletWebServerFactoryCustomizer> customizers;

	@Override
	public void setBeanFactory(BeanFactory beanFactory) {
		Assert.isInstanceOf(ListableBeanFactory.class, beanFactory,
				"ServletWebServerFactoryCustomizerBeanPostProcessor can only be used "
						+ "with a ListableBeanFactory");
		this.beanFactory = (ListableBeanFactory) beanFactory;
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName)
			throws BeansException {
		if (bean instanceof ConfigurableServletWebServerFactory) {
			postProcessBeforeInitialization((ConfigurableServletWebServerFactory) bean);
		}
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName)
			throws BeansException {
		return bean;
	}

	private void postProcessBeforeInitialization(
			ConfigurableServletWebServerFactory bean) {
		for (ServletWebServerFactoryCustomizer customizer : getCustomizers()) {
			customizer.customize(bean);
		}
	}

	private Collection<ServletWebServerFactoryCustomizer> getCustomizers() {
		if (this.customizers == null) {
			// Look up does not include the parent context
			this.customizers = new ArrayList<>(this.beanFactory
					.getBeansOfType(ServletWebServerFactoryCustomizer.class, false, false)
					.values());
			Collections.sort(this.customizers, AnnotationAwareOrderComparator.INSTANCE);
			this.customizers = Collections.unmodifiableList(this.customizers);
		}
		return this.customizers;
	}

}