text:
// PFObject.h
// Copyright 2011 Parse, Inc. All rights reserved.

#import <Foundation/Foundation.h>
#import "PFACL.h"
#import "PFConstants.h"

@protocol PFSubclassing;

/*!
 A Parse Framework Object that is a local representation of data persisted to the Parse cloud.
 This is the main class that is used to interact with objects in your app.
*/
@class PFRelation;
@class PFTask;

NS_REQUIRES_PROPERTY_DEFINITIONS
@interface PFObject : NSObject {
    BOOL dirty;

    // An array of NSDictionary of NSString -> PFFieldOperation.
    // Each dictionary has a subset of the object's keys as keys, and the
    // changes to the value for that key as its value.
    // There is always at least one dictionary of pending operations.
    // Every time a save is started, a new dictionary is added to the end.
    // Whenever a save completes, the new data is put into fetchedData, and
    //     a dictionary is removed from the start.
    NSMutableArray *operationSetQueue;

    // Our best estimate as to what the current data is, based on
    // the last fetch from the server, and the set of pending operations.
    NSMutableDictionary *estimatedData;
}

#pragma mark Constructors

/*! @name Creating a PFObject */

/*!
 Creates a new PFObject with a class name.
 @param className A class name can be any alphanumeric string that begins with a letter. It represents an object in your app, like a User of a Document.
 @result Returns the object that is instantiated with the given class name.
 */
+ (PFObject *)objectWithClassName:(NSString *)className;

/*!
 Creates a reference to an existing PFObject for use in creating associations between PFObjects.  Calling isDataAvailable on this
 object will return NO until fetchIfNeeded or refresh has been called.  No network request will be made.

 @param className The object's class.
 @param objectId The object id for the referenced object.
 @result A PFObject without data.
 */
+ (PFObject *)objectWithoutDataWithClassName:(NSString *)className
                                    objectId:(NSString *)objectId;

/*!
 Creates a new PFObject with a class name, initialized with data constructed from the specified set of objects and keys.
 @param className The object's class.
 @param dictionary An NSDictionary of keys and objects to set on the new PFObject.
 @result A PFObject with the given class name and set with the given data.
 */
+ (PFObject *)objectWithClassName:(NSString *)className dictionary:(NSDictionary *)dictionary;

/*!
 Initializes a new PFObject with a class name.
 @param newClassName A class name can be any alphanumeric string that begins with a letter. It represents an object in your app, like a User or a Document.
 @result Returns the object that is instantiated with the given class name.
 */
- (id)initWithClassName:(NSString *)newClassName;

#pragma mark -
#pragma mark Properties

/*! @name Managing Object Properties */

/*!
 The class name of the object.
 */
@property (readonly) NSString *parseClassName;

/*!
 The id of the object.
 */
@property (nonatomic, retain) NSString *objectId;

/*!
 When the object was last updated.
 */
@property (nonatomic, retain, readonly) NSDate *updatedAt;

/*!
 When the object was created.
 */
@property (nonatomic, retain, readonly) NSDate *createdAt;

/*!
 The ACL for this object.
 */
@property (nonatomic, retain) PFACL *ACL;

/*!
 Returns an array of the keys contained in this object. This does not include
 createdAt, updatedAt, authData, or objectId. It does include things like username
 and ACL.
 */
- (NSArray *)allKeys;

#pragma mark -
#pragma mark Get and set

/*!
 Returns the object associated with a given key.
 @param key The key that the object is associated with.
 @result The value associated with the given key, or nil if no value is associated with key.
 */
- (id)objectForKey:(NSString *)key;

/*!
 Sets the object associated with a given key.
 @param object The object.
 @param key The key.
 */
- (void)setObject:(id)object forKey:(NSString *)key;

/*!
 Unsets a key on the object.
 @param key The key.
 */
- (void)removeObjectForKey:(NSString *)key;

/*!
 * In LLVM 4.0 (XCode 4.5) or higher allows myPFObject[key].
 @param key The key.
 */
- (id)objectForKeyedSubscript:(NSString *)key;

/*!
 * In LLVM 4.0 (XCode 4.5) or higher allows myObject[key] = value
 @param object The object.
 @param key The key.
 */
- (void)setObject:(id)object forKeyedSubscript:(NSString *)key;

/*!
 Returns the relation object associated with the given key
 @param key The key that the relation is associated with.
 */
- (PFRelation *)relationforKey:(NSString *)key;

#pragma mark -
#pragma mark Array add and remove

/*!
 Adds an object to the end of the array associated with a given key.
 @param object The object to add.
 @param key The key.
 */
- (void)addObject:(id)object forKey:(NSString *)key;

/*!
 Adds the objects contained in another array to the end of the array associated
 with a given key.
 @param objects The array of objects to add.
 @param key The key.
 */
- (void)addObjectsFromArray:(NSArray *)objects forKey:(NSString *)key;

/*!
 Adds an object to the array associated with a given key, only if it is not
 already present in the array. The position of the insert is not guaranteed.
 @param object The object to add.
 @param key The key.
 */
- (void)addUniqueObject:(id)object forKey:(NSString *)key;

/*!
 Adds the objects contained in another array to the array associated with
 a given key, only adding elements which are not already present in the array.
 The position of the insert is not guaranteed.
 @param objects The array of objects to add.
 @param key The key.
 */
- (void)addUniqueObjectsFromArray:(NSArray *)objects forKey:(NSString *)key;

/*!
 Removes all occurrences of an object from the array associated with a given
 key.
 @param object The object to remove.
 @param key The key.
 */
- (void)removeObject:(id)object forKey:(NSString *)key;

/*!
 Removes all occurrences of the objects contained in another array from the
 array associated with a given key.
 @param objects The array of objects to remove.
 @param key The key.
 */
- (void)removeObjectsInArray:(NSArray *)objects forKey:(NSString *)key;

#pragma mark -
#pragma mark Increment

/*!
 Increments the given key by 1.
 @param key The key.
 */
- (void)incrementKey:(NSString *)key;

/*!
 Increments the given key by a number.
 @param key The key.
 @param amount The amount to increment.
 */
- (void)incrementKey:(NSString *)key byAmount:(NSNumber *)amount;

#pragma mark -
#pragma mark Save

/*! @name Saving an Object to Parse */

/*!
 Saves the PFObject.
 @result Returns whether the save succeeded.
 */
- (BOOL)save;

/*!
 Saves the PFObject and sets an error if it occurs.
 @param error Pointer to an NSError that will be set if necessary.
 @result Returns whether the save succeeded.
 */
- (BOOL)save:(NSError **)error;

/*!
 Saves the PFObject asynchronously.
 */
- (void)saveInBackground;

/*!
 Saves the PFObject asynchronously and executes the given callback block.
 @param block The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)
 */
- (void)saveInBackgroundWithBlock:(PFBooleanResultBlock)block;

/*!
 Saves the PFObject asynchronously and calls the given callback.
 @param target The object to call selector on.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.
 */
- (void)saveInBackgroundWithTarget:(id)target selector:(SEL)selector;

/*!
  @see saveEventually:
 */
- (void)saveEventually;

/*!
 Saves this object to the server at some unspecified time in the future, even if Parse is currently inaccessible.
 Use this when you may not have a solid network connection, and don't need to know when the save completes.
 If there is some problem with the object such that it can't be saved, it will be silently discarded.  If the save
 completes successfully while the object is still in memory, then callback will be called.

 Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
 They will be sent immediately if possible.  Otherwise, they will be sent the next time a network connection is
 available.  Objects saved this way will persist even after the app is closed, in which case they will be sent the
 next time the app is opened.  If more than 10MB of data is waiting to be sent, subsequent calls to saveEventually
 will cause old saves to be silently discarded until the connection can be re-established, and the queued objects
 can be saved.
 */
- (void)saveEventually:(PFBooleanResultBlock)callback;

#pragma mark -
#pragma mark Save All

/*! @name Saving Many Objects to Parse */

/*!
 Saves a collection of objects all at once.
 @param objects The array of objects to save.
 @result Returns whether the save succeeded.
 */
+ (BOOL)saveAll:(NSArray *)objects;

/*!
 Saves a collection of objects all at once and sets an error if necessary.
 @param objects The array of objects to save.
 @param error Pointer to an NSError that will be set if necessary.
 @result Returns whether the save succeeded.
 */
+ (BOOL)saveAll:(NSArray *)objects error:(NSError **)error;

/*!
 Saves a collection of objects all at once asynchronously.
 @param objects The array of objects to save.
 */
+ (void)saveAllInBackground:(NSArray *)objects;

/*!
 Saves a collection of objects all at once asynchronously and the block when done.
 @param objects The array of objects to save.
 @param block The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)
 */
+ (void)saveAllInBackground:(NSArray *)objects
                      block:(PFBooleanResultBlock)block;

/*!
 Saves a collection of objects all at once asynchronously and calls a callback when done.
 @param objects The array of objects to save.
 @param target The object to call selector on.
 @param selector The selector to call. It should have the following signature: (void)callbackWithError:(NSError *)error. error will be nil on success and set if there was an error.
 */
+ (void)saveAllInBackground:(NSArray *)objects
                     target:(id)target
                   selector:(SEL)selector;

#pragma mark -
#pragma mark Refresh

/*! @name Getting an Object from Parse */

/*!
 Gets whether the PFObject has been fetched.
 @result YES if the PFObject is new or has been fetched or refreshed.  NO otherwise.
 */
- (BOOL)isDataAvailable;

#if PARSE_IOS_ONLY
// Deprecated and intentionally not available on the new OS X SDK

/*!
 Refreshes the PFObject with the current data from the server.
 */
- (void)refresh;

/*!
 Refreshes the PFObject with the current data from the server and sets an error if it occurs.
 @param error Pointer to an NSError that will be set if necessary.
 */
- (void)refresh:(NSError **)error;

/*!
 Refreshes the PFObject asynchronously and executes the given callback block.
 @param block The block to execute. The block should have the following argument signature: (PFObject *object, NSError *error)
 */
- (void)refreshInBackgroundWithBlock:(PFObjectResultBlock)block;

/*!
 Refreshes the PFObject asynchronously and calls the given callback.
 @param target The target on which the selector will be called.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject *)refreshedObject error:(NSError *)error. error will be nil on success and set if there was an error. refreshedObject will be the PFObject with the refreshed data.
 */
- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector;
#endif

/*!
 Fetches the PFObject with the current data from the server.
 */
- (void)fetch;
/*!
 Fetches the PFObject with the current data from the server and sets an error if it occurs.
 @param error Pointer to an NSError that will be set if necessary.
 */
- (void)fetch:(NSError **)error;

/*!
 Fetches the PFObject's data from the server if isDataAvailable is false.
 */
- (PFObject *)fetchIfNeeded;

/*!
 Fetches the PFObject's data from the server if isDataAvailable is false.
 @param error Pointer to an NSError that will be set if necessary.
 */
- (PFObject *)fetchIfNeeded:(NSError **)error;

/*!
 Fetches the PFObject asynchronously and executes the given callback block.
 @param block The block to execute. The block should have the following argument signature: (PFObject *object, NSError *error)
 */
- (void)fetchInBackgroundWithBlock:(PFObjectResultBlock)block;

/*!
 Fetches the PFObject asynchronously and calls the given callback.
 @param target The target on which the selector will be called.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject *)refreshedObject error:(NSError *)error. error will be nil on success and set if there was an error. refreshedObject will be the PFObject with the refreshed data.
 */
- (void)fetchInBackgroundWithTarget:(id)target selector:(SEL)selector;

/*!
 Fetches the PFObject's data asynchronously if isDataAvailable is false, then calls the callback block.
 @param block The block to execute.  The block should have the following argument signature: (PFObject *object, NSError *error)
 */
- (void)fetchIfNeededInBackgroundWithBlock:(PFObjectResultBlock)block;

/*!
 Fetches the PFObject's data asynchronously if isDataAvailable is false, then calls the callback.
 @param target The target on which the selector will be called.
 @param selector The selector to call.  It should have the following signature: (void)callbackWithResult:(PFObject *)fetchedObject error:(NSError *)error. error will be nil on success and set if there was an error.
 */
- (void)fetchIfNeededInBackgroundWithTarget:(id)target
                                   selector:(SEL)selector;

/*! @name Getting Many Objects from Parse */

/*!
 Fetches all of the PFObjects with the current data from the server
 @param objects The list of objects to fetch.
 */
+ (void)fetchAll:(NSArray *)objects;

/*!
 Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.
 @param objects The list of objects to fetch.
 @param error Pointer to an NSError that will be set  if necessary
 */
+ (void)fetchAll:(NSArray *)objects error:(NSError **)error;

/*!
 Fetches all of the PFObjects with the current data from the server
 @param objects The list of objects to fetch.
 */
+ (void)fetchAllIfNeeded:(NSArray *)objects;

/*!
 Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.
 @param objects The list of objects to fetch.
 @param error Pointer to an NSError that will be set  if necessary
 */
+ (void)fetchAllIfNeeded:(NSArray *)objects error:(NSError **)error;

/*!
 Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.
 @param objects The list of objects to fetch.
 @param block The block to execute. The block should have the following argument signature: (NSArray *objects, NSError *error)
 */
+ (void)fetchAllInBackground:(NSArray *)objects
                       block:(PFArrayResultBlock)block;

/*!
 Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.
 @param objects The list of objects to fetch.
 @param target The target on which the selector will be called.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error. error will be nil on success and set if there was an error. fetchedObjects will the array of PFObjects that were fetched.
 */
+ (void)fetchAllInBackground:(NSArray *)objects
                      target:(id)target
                    selector:(SEL)selector;

/*!
 Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.
 @param objects The list of objects to fetch.
 @param block The block to execute. The block should have the following argument signature: (NSArray *objects, NSError *error)
 */
+ (void)fetchAllIfNeededInBackground:(NSArray *)objects
                               block:(PFArrayResultBlock)block;

/*!
 Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.
 @param objects The list of objects to fetch.
 @param target The target on which the selector will be called.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error. error will be nil on success and set if there was an error. fetchedObjects will the array of PFObjects
 that were fetched.
 */
+ (void)fetchAllIfNeededInBackground:(NSArray *)objects
                              target:(id)target
                            selector:(SEL)selector;

#pragma mark -
#pragma mark Delete

/*! @name Removing an Object from Parse */

/*!
 Deletes the PFObject.
 @result Returns whether the delete succeeded.
 */
- (BOOL)delete;

/*!
 Deletes the PFObject and sets an error if it occurs.
 @param error Pointer to an NSError that will be set if necessary.
 @result Returns whether the delete succeeded.
 */
- (BOOL)delete:(NSError **)error;

/*!
 Deletes the PFObject asynchronously.
 */
- (void)deleteInBackground;

/*!
 Deletes the PFObject asynchronously and executes the given callback block.
 @param block The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)
 */
- (void)deleteInBackgroundWithBlock:(PFBooleanResultBlock)block;

/*!
 Deletes the PFObject asynchronously and calls the given callback.
 @param target The object to call selector on.
 @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.
 */
- (void)deleteInBackgroundWithTarget:(id)target
                            selector:(SEL)selector;

/*!
 Deletes this object from the server at some unspecified time in the future, even if Parse is currently inaccessible.
 Use this when you may not have a solid network connection, and don't need to know when the delete completes.
 If there is some problem with the object such that it can't be deleted, the request will be silently discarded.

 Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
 to Parse. They will be sent immediately if possible.  Otherwise, they will be sent the next time a network connection
 is available. Delete requests will persist even after the app is closed, in which case they will be sent the
 next time the app is opened.  If more than 10MB of saveEventually or deleteEventually commands are waiting to be sent,
 subsequent calls to saveEventually or deleteEventually will cause old requests to be silently discarded until the
 connection can be re-established, and the queued requests can go through.
 */
- (void)deleteEventually;

#pragma mark -

@end


text:
require_relative '../../test_helper'
require_relative '../../support/utils/operation_test_utils'
# require_relative '../../support/utils/jsonapi_test_utils'

class OfferTranslationCreateTest < ActiveSupport::TestCase
  # include JsonapiTestUtils
  include OperationTestUtils

  let(:user) { users(:researcher) }
  let(:offer) { offers(:basic) }
  let(:basic_params) do
    {
      offer_id: offer.id,
      name: 'OfferTranslation',
      description: 'OfferDescription',
      opening_specification: 'OfferOpeningSpecification',
      source: 'GoogleTranslate',
      locale: 'pl'
    }
  end

  describe '::OfferTranslation::Create' do
    it 'must create an OfferTranslation given valid data' do
      operation_must_work ::OfferTranslation::Create, basic_params
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
#ifndef _EXT4_JBD2_H
#define _EXT4_JBD2_H

#include <linux/fs.h>
#include <linux/jbd2.h>
#include "ext4.h"

#define EXT4_JOURNAL(inode)	(EXT4_SB((inode)->i_sb)->s_journal)

/* Define the number of blocks we need to account to a transaction to
 * modify one block of data.
 *
 * We may have to touch one inode, one bitmap buffer, up to three
 * indirection blocks, the group and superblock summaries, and the data
 * block to complete the transaction.
 *
 * For extents-enabled fs we may have to allocate and modify up to
 * 5 levels of tree + root which are stored in the inode. */

#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb)				\
	(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)   \
	 ? 27U : 8U)

/* Extended attribute operations touch at most two data buffers,
 * two bitmap buffers, and two group summaries, in addition to the inode
 * and the superblock, which are already accounted for. */

#define EXT4_XATTR_TRANS_BLOCKS		6U

/* Define the minimum size for a transaction which modifies data.  This
 * needs to take into account the fact that we may end up modifying two
 * quota files too (one for the group, one for the user quota).  The
 * superblock only gets updated once, of course, so don't bother
 * counting that again for the quota updates. */

#define EXT4_DATA_TRANS_BLOCKS(sb)	(EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
					 EXT4_XATTR_TRANS_BLOCKS - 2 + \
					 EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))

/*
 * Define the number of metadata blocks we need to account to modify data.
 *
 * This include super block, inode block, quota blocks and xattr blocks
 */
#define EXT4_META_TRANS_BLOCKS(sb)	(EXT4_XATTR_TRANS_BLOCKS + \
					EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))

/* Delete operations potentially hit one directory's namespace plus an
 * entire inode, plus arbitrary amounts of bitmap/indirection data.  Be
 * generous.  We can grow the delete transaction later if necessary. */

#define EXT4_DELETE_TRANS_BLOCKS(sb)	(2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64)

/* Define an arbitrary limit for the amount of data we will anticipate
 * writing to any given transaction.  For unbounded transactions such as
 * write(2) and truncate(2) we can write more than this, but we always
 * start off at the maximum transaction size and grow the transaction
 * optimistically as we go. */

#define EXT4_MAX_TRANS_DATA		64U

/* We break up a large truncate or write transaction once the handle's
 * buffer credits gets this low, we need either to extend the
 * transaction or to start a new one.  Reserve enough space here for
 * inode, bitmap, superblock, group and indirection updates for at least
 * one block, plus two quota updates.  Quota allocations are not
 * needed. */

#define EXT4_RESERVE_TRANS_BLOCKS	12U

#define EXT4_INDEX_EXTRA_TRANS_BLOCKS	8

#ifdef CONFIG_QUOTA
/* Amount of blocks needed for quota update - we know that the structure was
 * allocated so we need to update only data block */
#define EXT4_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 1 : 0)
/* Amount of blocks needed for quota insert/delete - we do some block writes
 * but inode, sb and group updates are done only once */
#define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
		(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)

#define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
		(EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
#else
#define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
#endif
#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))

int
ext4_mark_iloc_dirty(handle_t *handle,
		     struct inode *inode,
		     struct ext4_iloc *iloc);

/*
 * On success, We end up with an outstanding reference count against
 * iloc->bh.  This _must_ be cleaned up later.
 */

int ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
			struct ext4_iloc *iloc);

int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);

/*
 * Wrapper functions with which ext4 calls into JBD.
 */
void ext4_journal_abort_handle(const char *caller, unsigned int line,
			       const char *err_fn,
		struct buffer_head *bh, handle_t *handle, int err);

int __ext4_journal_get_write_access(const char *where, unsigned int line,
				    handle_t *handle, struct buffer_head *bh);

int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
		  int is_metadata, struct inode *inode,
		  struct buffer_head *bh, ext4_fsblk_t blocknr);

int __ext4_journal_get_create_access(const char *where, unsigned int line,
				handle_t *handle, struct buffer_head *bh);

int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
				 handle_t *handle, struct inode *inode,
				 struct buffer_head *bh);

int __ext4_handle_dirty_super(const char *where, unsigned int line,
			      handle_t *handle, struct super_block *sb);

#define ext4_journal_get_write_access(handle, bh) \
	__ext4_journal_get_write_access(__func__, __LINE__, (handle), (bh))
#define ext4_forget(handle, is_metadata, inode, bh, block_nr) \
	__ext4_forget(__func__, __LINE__, (handle), (is_metadata), (inode), \
		      (bh), (block_nr))
#define ext4_journal_get_create_access(handle, bh) \
	__ext4_journal_get_create_access(__func__, __LINE__, (handle), (bh))
#define ext4_handle_dirty_metadata(handle, inode, bh) \
	__ext4_handle_dirty_metadata(__func__, __LINE__, (handle), (inode), \
				     (bh))
#define ext4_handle_dirty_super(handle, sb) \
	__ext4_handle_dirty_super(__func__, __LINE__, (handle), (sb))

handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle);

#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)

/* Note:  Do not use this for NULL handles.  This is only to determine if
 * a properly allocated handle is using a journal or not. */
static inline int ext4_handle_valid(handle_t *handle)
{
	if ((unsigned long)handle < EXT4_NOJOURNAL_MAX_REF_COUNT)
		return 0;
	return 1;
}

static inline void ext4_handle_sync(handle_t *handle)
{
	if (ext4_handle_valid(handle))
		handle->h_sync = 1;
}

static inline void ext4_handle_release_buffer(handle_t *handle,
						struct buffer_head *bh)
{
	if (ext4_handle_valid(handle))
		jbd2_journal_release_buffer(handle, bh);
}

static inline int ext4_handle_is_aborted(handle_t *handle)
{
	if (ext4_handle_valid(handle))
		return is_handle_aborted(handle);
	return 0;
}

static inline int ext4_handle_has_enough_credits(handle_t *handle, int needed)
{
	if (ext4_handle_valid(handle) && handle->h_buffer_credits < needed)
		return 0;
	return 1;
}

static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks)
{
	return ext4_journal_start_sb(inode->i_sb, nblocks);
}

#define ext4_journal_stop(handle) \
	__ext4_journal_stop(__func__, __LINE__, (handle))

static inline handle_t *ext4_journal_current_handle(void)
{
	return journal_current_handle();
}

static inline int ext4_journal_extend(handle_t *handle, int nblocks)
{
	if (ext4_handle_valid(handle))
		return jbd2_journal_extend(handle, nblocks);
	return 0;
}

static inline int ext4_journal_restart(handle_t *handle, int nblocks)
{
	if (ext4_handle_valid(handle))
		return jbd2_journal_restart(handle, nblocks);
	return 0;
}

static inline int ext4_journal_blocks_per_page(struct inode *inode)
{
	if (EXT4_JOURNAL(inode) != NULL)
		return jbd2_journal_blocks_per_page(inode);
	return 0;
}

static inline int ext4_journal_force_commit(journal_t *journal)
{
	if (journal)
		return jbd2_journal_force_commit(journal);
	return 0;
}

static inline int ext4_jbd2_file_inode(handle_t *handle, struct inode *inode)
{
	if (ext4_handle_valid(handle))
		return jbd2_journal_file_inode(handle, EXT4_I(inode)->jinode);
	return 0;
}

static inline void ext4_update_inode_fsync_trans(handle_t *handle,
						 struct inode *inode,
						 int datasync)
{
	struct ext4_inode_info *ei = EXT4_I(inode);

	if (ext4_handle_valid(handle)) {
		ei->i_sync_tid = handle->h_transaction->t_tid;
		if (datasync)
			ei->i_datasync_tid = handle->h_transaction->t_tid;
	}
}

/* super.c */
int ext4_force_commit(struct super_block *sb);

/*
 * Ext4 inode journal modes
 */
#define EXT4_INODE_JOURNAL_DATA_MODE	0x01 /* journal data mode */
#define EXT4_INODE_ORDERED_DATA_MODE	0x02 /* ordered data mode */
#define EXT4_INODE_WRITEBACK_DATA_MODE	0x04 /* writeback data mode */

static inline int ext4_inode_journal_mode(struct inode *inode)
{
	if (EXT4_JOURNAL(inode) == NULL)
		return EXT4_INODE_WRITEBACK_DATA_MODE;	/* writeback */
	/* We do not support data journalling with delayed allocation */
	if (!S_ISREG(inode->i_mode) ||
	    test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
		return EXT4_INODE_JOURNAL_DATA_MODE;	/* journal data */
	if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) &&
	    !test_opt(inode->i_sb, DELALLOC))
		return EXT4_INODE_JOURNAL_DATA_MODE;	/* journal data */
	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
		return EXT4_INODE_ORDERED_DATA_MODE;	/* ordered */
	if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
		return EXT4_INODE_WRITEBACK_DATA_MODE;	/* writeback */
	else
		BUG();
}

static inline int ext4_should_journal_data(struct inode *inode)
{
	return ext4_inode_journal_mode(inode) & EXT4_INODE_JOURNAL_DATA_MODE;
}

static inline int ext4_should_order_data(struct inode *inode)
{
	return ext4_inode_journal_mode(inode) & EXT4_INODE_ORDERED_DATA_MODE;
}

static inline int ext4_should_writeback_data(struct inode *inode)
{
	return ext4_inode_journal_mode(inode) & EXT4_INODE_WRITEBACK_DATA_MODE;
}

/*
 * This function controls whether or not we should try to go down the
 * dioread_nolock code paths, which makes it safe to avoid taking
 * i_mutex for direct I/O reads.  This only works for extent-based
 * files, and it doesn't work if data journaling is enabled, since the
 * dioread_nolock code uses b_private to pass information back to the
 * I/O completion handler, and this conflicts with the jbd's use of
 * b_private.
 */
static inline int ext4_should_dioread_nolock(struct inode *inode)
{
	if (!test_opt(inode->i_sb, DIOREAD_NOLOCK))
		return 0;
	if (!S_ISREG(inode->i_mode))
		return 0;
	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
		return 0;
	if (ext4_should_journal_data(inode))
		return 0;
	return 1;
}

#endif	/* _EXT4_JBD2_H */


text:
This package defines a macro that approximates the syntax for associated consts that is used in nightly Rust builds, but it turns the consts into functions so no nightly features are required. Therefore, we can have the appearance (but not the advantages) of associated consts in stable Rust.

Requires rust 1.3 or higher. This package will be irrelevant whenever associated consts get stabilized.

For documentation, run `cargo doc`.


text:
package com.belteshazzar.jquery.functions.callers;

import org.w3c.dom.Element;

import com.belteshazzar.jquery.functions.IntStringElementFunction;

public class IntStringElementFunctionCaller {

	private IntStringElementFunction function;

	public IntStringElementFunctionCaller(IntStringElementFunction function) {
		this.function = function;
	}

	public Element call(int i, String s) {
		return function.apply(i,s);
	}

}


text:
"""Tests for exceptions module."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.autograph.operators import exceptions
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import errors_impl
from tensorflow.python.framework import test_util
from tensorflow.python.platform import test

class ExceptionsTest(test.TestCase):

  def test_assert_tf_untriggered(self):
    with self.cached_session() as sess:
      t = exceptions.assert_stmt(
          constant_op.constant(True), lambda: constant_op.constant('ignored'))
      self.evaluate(t)

  @test_util.run_deprecated_v1
  def test_assert_tf_triggered(self):
    with self.cached_session() as sess:
      t = exceptions.assert_stmt(
          constant_op.constant(False),
          lambda: constant_op.constant('test message'))

      with self.assertRaisesRegexp(errors_impl.InvalidArgumentError,
                                   'test message'):
        self.evaluate(t)

  @test_util.run_deprecated_v1
  def test_assert_tf_multiple_printed_values(self):
    two_tensors = [
        constant_op.constant('test message'),
        constant_op.constant('another message')
    ]
    with self.cached_session() as sess:
      t = exceptions.assert_stmt(
          constant_op.constant(False), lambda: two_tensors)

      with self.assertRaisesRegexp(errors_impl.InvalidArgumentError,
                                   'test message.*another message'):
        self.evaluate(t)

  def test_assert_python_untriggered(self):
    side_effect_trace = []

    def expression_with_side_effects():
      side_effect_trace.append(object())
      return 'test message'

    exceptions.assert_stmt(True, expression_with_side_effects)

    self.assertListEqual(side_effect_trace, [])

  def test_assert_python_triggered(self):
    if not __debug__:
      # Python assertions only be tested when in debug mode.
      return

    side_effect_trace = []
    tracer = object()

    def expression_with_side_effects():
      side_effect_trace.append(tracer)
      return 'test message'

    with self.assertRaisesRegexp(AssertionError, 'test message'):
      exceptions.assert_stmt(False, expression_with_side_effects)
    self.assertListEqual(side_effect_trace, [tracer])

if __name__ == '__main__':
  test.main()


text:
package expressions

import (
	"fmt"
	"strings"

	"github.com/juju/errors"
	"github.com/pingcap/tidb/util/types"
)

// https://dev.mysql.com/doc/refman/5.7/en/string-functions.html

func builtinLength(args []interface{}, _ map[interface{}]interface{}) (v interface{}, err error) {
	switch x := args[0].(type) {
	case nil:
		return nil, nil
	case string:
		return int64(len(x)), nil
	default:
		return nil, invArg(x, "length")
	}
}

// See: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_concat
func builtinConcat(args []interface{}, ctx map[interface{}]interface{}) (v interface{}, err error) {
	var s []byte
	for _, a := range args {
		if a == nil {
			return nil, nil
		}
		ss, err := types.ToString(a)
		if err != nil {
			return nil, errors.Trace(err)
		}
		s = append(s, []byte(ss)...)
	}

	return string(s), nil
}

// See: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_concat-ws
func builtinConcatWS(args []interface{}, ctx map[interface{}]interface{}) (v interface{}, err error) {
	var sep string
	s := make([]string, 0, len(args))
	for i, a := range args {
		if a == nil {
			if i == 0 {
				return nil, nil
			}
			continue
		}
		ss, err := types.ToString(a)
		if err != nil {
			return nil, errors.Trace(err)
		}

		if i == 0 {
			sep = ss
			continue
		}
		s = append(s, ss)
	}

	return strings.Join(s, sep), nil
}

// See: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_left
func builtinLeft(args []interface{}, _ map[interface{}]interface{}) (v interface{}, err error) {
	str, ok := args[0].(string)
	if !ok {
		return nil, errors.Errorf("BuiltinLeft invalid args, need string but get %T", args[0])
	}
	// TODO: deal with other types
	length, ok := args[1].(int64)
	if !ok {
		return nil, errors.Errorf("BuiltinLeft invalid args, need int but get %T", args[1])
	}
	l := int(length)
	if l < 0 {
		l = 0
	} else if l > len(str) {
		l = len(str)
	}
	return str[:l], nil
}

// See: https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_repeat
func builtinRepeat(args []interface{}, ctx map[interface{}]interface{}) (v interface{}, err error) {
	ch := fmt.Sprintf("%v", args[0])
	num := 0
	switch x := args[1].(type) {
	case int64:
		num = int(x)
	case uint64:
		num = int(x)
	}
	if num < 1 {
		return "", nil
	}
	return strings.Repeat(ch, num), nil
}


text:
package br.com.caelum.leilao.dominio;

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

public class Leilao {

	private String descricao;
	private List<Lance> lances;

	public Leilao(String descricao) {
		this.descricao = descricao;
		this.lances = new ArrayList<Lance>();
	}

	public void propoe(Lance lance) {
		if (lances.isEmpty() || podeDarLance(lance.getUsuario())) {
			lances.add(lance);
		}
	}

	public void dobraLance(Usuario usuario) {
		if(lances.isEmpty()) return;
		Lance ultimoLance = getUltimoLanceDo(usuario);
		if(ultimoLance != null) {
			propoe(new Lance(usuario, ultimoLance.getValor() * 2));
		}
	}

	private Lance getUltimoLanceDo(Usuario usuario) {
		for(int i = lances.size() - 1; i >= 0; i--) {
			Lance lance = lances.get(i);
			if(lance.getUsuario().equals(usuario)) {
				return lance;
			}
		}
		return null;
	}

	private boolean podeDarLance(Usuario usuario) {
		int totalLances = getQtdeLancesDo(usuario);
		return !getUltimoLanceDado().getUsuario().equals(usuario) && totalLances < 5;
	}

	private int getQtdeLancesDo(Usuario usuario) {
		int total = 0;
		for (Lance l : lances) {
			if (l.getUsuario().equals(usuario))
				total++;
		}
		return total;
	}

	private Lance getUltimoLanceDado() {
		if (lances.isEmpty())
			return null;
		return lances.get(lances.size() - 1);
	}

	public String getDescricao() {
		return descricao;
	}

	public List<Lance> getLances() {
		return Collections.unmodifiableList(lances);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.example.dexopener.multiproject.test" />


text:
//
//  BFSeparatorTableViewCell.h
//  OpenShop
//
//  Created by Jirka Apps
//  Copyright (c) 2015 Business Factory. All rights reserved.
//

@import UIKit;

#import "BFSeparatorLine.h"
#import "BFTableViewCell.h"

/**
 * `BFNCheckmarkTableViewCell` class extends the base table view cell with separator
 * lines displayed according to the cell selection and highlighting.
 */
@interface BFSeparatorTableViewCell : BFTableViewCell

/**
 *  Bottom horizontal separator line.
 */
@property (weak, nonatomic) IBOutlet BFSeparatorLine *bottomSeparatorLine;
/**
 *  Top horizontal separator line.
 */
@property (weak, nonatomic) IBOutlet BFSeparatorLine *topSeparatorLine;

@end


text:
<readable><title>405253184_5f611f3880</title><content>
animals in the snow
Two black and tan dogs are fighting in snow .
Two dogs are laying in the snow with their mouths open .
Two dogs try to bite each other while laying in the snow .
Two dogs wrestle in the snow .
</content></readable>


text:
package org.apache.james.jspf.policies.local;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.apache.james.jspf.core.SPF1Record;
import org.apache.james.jspf.core.SPFRecordParser;
import org.apache.james.jspf.core.exceptions.NeutralException;
import org.apache.james.jspf.core.exceptions.NoneException;
import org.apache.james.jspf.core.exceptions.PermErrorException;
import org.apache.james.jspf.core.exceptions.SPFResultException;
import org.apache.james.jspf.core.exceptions.TempErrorException;
import org.apache.james.jspf.policies.PolicyPostFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class to support Fallback feature
 */
public class FallbackPolicy implements PolicyPostFilter {
    private static final Logger LOGGER = LoggerFactory.getLogger(FallbackPolicy.class);

    private Map<String,SPF1Record> entryMap;

    private SPFRecordParser parser;

    public FallbackPolicy(SPFRecordParser parser) {
        entryMap = Collections.synchronizedMap(new HashMap<String,SPF1Record>());
        this.parser = parser;
    }

    /**
     * Add a entry.
     *
     * @param rawHost
     *            the host or ipaddress for which the entry should be added.
     * @param rawSpfRecord
     *            the spfRecord to add
     * @throws IllegalArgumentException
     *             get thrown on invalid spfRecord
     */
    public void addEntry(String rawHost, String rawSpfRecord)
            throws IllegalArgumentException {
        String host;
        try {
            LOGGER.debug("Start parsing SPF-Record: {}", rawSpfRecord);
            SPF1Record spfRecord = parser.parse(rawSpfRecord);
            if (rawHost.startsWith("*")) {
                host = rawHost.substring(1);
                LOGGER.debug("Convert host {} to {}", rawHost, host);
            } else if (rawHost.endsWith("*")) {
                int length = rawHost.length();
                host = rawHost.substring(length - 1, length);
                LOGGER.debug("Convert host {} to {}", rawHost, host);
            } else {
                host = rawHost;
            }

            entryMap.put(host, spfRecord);
        } catch (SPFResultException e) {
            throw new IllegalArgumentException("Invalid SPF-Record: "
                    + rawSpfRecord);
        }

    }

    /**
     * Clear all entries
     *
     */
    public void clearEntrys() {
        LOGGER.debug("Clear all entries");
        entryMap.clear();
    }

    /**
     * Remove entry
     *
     * @param host
     *            The host
     */
    public void removeEntry(String host) {
        LOGGER.debug("Remove fallback entry for host: {}", host);
        synchronized (entryMap) {
            entryMap.remove(getRawEntry(host));
        }
    }

    /**
     * @see org.apache.james.jspf.policies.PolicyPostFilter#getSPFRecord(java.lang.String, org.apache.james.jspf.core.SPF1Record)
     */
    public SPF1Record getSPFRecord(String currentDomain, SPF1Record res) throws PermErrorException, TempErrorException, NoneException, NeutralException {
        if (res == null) {
            return getMySPFRecord(currentDomain);
        } else {
            return res;
        }
    }

    /**
     * Return the SPF1Record for the given host
     *
     * @param host
     *            the hostname or ipaddress
     * @return the SPF1Record of null if no SPF1Record was found in fallback for
     *         the given host
     */
    protected SPF1Record getMySPFRecord(String host) {
        SPF1Record entry = null;

        synchronized (entryMap) {
            entry = getRawEntry(host);
        }

        if (entry != null) {
            return entry;
        } else {
            return null;
        }
    }

    /**
     * Return the Object stored in the map which match the given host. Keep in
     * mind that this method should only called in a synchronized method or
     * block
     *
     * @param host
     *            the host
     * @return the stored object for the given host or null
     */
    private SPF1Record getRawEntry(String host) {
        Iterator<String> fallBackIt = entryMap.keySet().iterator();

        while (fallBackIt.hasNext()) {
            String rawHost = fallBackIt.next();

            if ((rawHost.startsWith(".") && host.startsWith(rawHost))
                    || rawHost.endsWith(".") && host.endsWith(rawHost)) {
                return entryMap.get(rawHost);
            }
        }
        return null;
    }

}


text:
<meta charset="UTF-8">
<title>missiles</title>

  <canvas id="canvas" tabindex="1" width="1" height="1" ></canvas>

  <canvas id="minimap" width="200" height="200"></canvas>
  <canvas id="player-armor" width="200" height="20"></canvas>
  <canvas id="player-shields" width="200" height="20"></canvas>

fps goes here

 Depart

  <canvas id="map" width="1000" height="1000" hidden=true></canvas>
  <canvas id="pausemenu" width="400" height="200" hidden=true></canvas>


text:
require "spec_helper_ar"

describe Draisine::Partitioner do
  include_context "Salesforce stubs"

  describe ".partition" do
    let(:start_date) { 1.day.ago }
    let(:end_date) { 10.minutes.since }

    before do
      allow(Draisine).to receive(:salesforce_client).and_return(sf_client)
      Lead.create_without_callbacks!(salesforce_id: 'A000')
      allow(sf_client).to receive(:get_updated_ids).and_return(['A000', 'A001'])
      allow(sf_client).to receive(:get_deleted_ids).and_return(['D000'])
    end

    it "produces partitions for updated ids and deleted ids" do
      partitions = described_class.partition(model_class: Lead, start_date: start_date, end_date: end_date)
      expect(partitions).to have(1).element
      partition = partitions.first
      expect(partition.updated_ids).to eq(['A000', 'A001'])
      expect(partition.deleted_ids).to eq(['D000'])
    end

    it "splits partitions if neccessary" do
      partitions = described_class.partition(model_class: Lead, start_date: start_date, end_date: end_date, partition_size: 2)
      expect(partitions).to have(2).elements
      expect(partitions.flat_map(&:updated_ids).compact).to eq(['A000', 'A001'])
      expect(partitions.flat_map(&:deleted_ids).compact).to eq(['D000'])
    end

    it "includes unpersisted records ids" do
      lead = Lead.create_without_callbacks!(salesforce_id: '')
      partition = described_class.partition(model_class: Lead, start_date: start_date, end_date: end_date).first
      expect(partition.unpersisted_ids).to eq([lead.id])
    end

    it "still returns a partition for zero updated / deleted ids" do
      Lead.delete_all
      allow(sf_client).to receive(:get_updated_ids).and_return([])
      allow(sf_client).to receive(:get_deleted_ids).and_return([])
      partitions = described_class.partition(model_class: Lead, start_date: start_date, end_date: end_date)
      partition = partitions.first
      expect(partition).to be_a(Draisine::Partition)
    end
  end
end


text:
package com.thebluealliance.androidclient.datafeed.deserializers;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.reflect.TypeToken;
import com.thebluealliance.androidclient.helpers.AwardHelper;
import com.thebluealliance.androidclient.models.Award;

import java.lang.reflect.Type;
import java.util.List;

public class AwardDeserializer implements JsonDeserializer<Award> {

    @Override
    public Award deserialize(final JsonElement json, Type typeOf, JsonDeserializationContext context) throws JsonParseException {
        final JsonObject a = json.getAsJsonObject();
        final Award award = new Award();

        if (a.has("event_key") && a.has("award_type")) {
            int awardEnum = a.get("award_type").getAsInt();
            String eventKey = a.get("event_key").getAsString();

            award.setKey(AwardHelper.createAwardKey(eventKey, awardEnum));
            award.setEnum(awardEnum);
            award.setEventKey(eventKey);
        } else {

            if (a.has("award_type")) {
                award.setEnum(a.get("award_type").getAsInt());
            }

            if (a.has("event_key")) {
                award.setEventKey(a.get("event_key").getAsString());
            }
        }

        if (a.has("name")) {
            award.setName(a.get("name").getAsString());
        }

        if (a.has("year")) {
            award.setYear(a.get("year").getAsInt());
        }

        if (a.has("recipient_list")) {
            award.setRecipientList(context.deserialize(a.get("recipient_list"), new TypeToken<List<Award.AwardRecipient>>(){}.getType()));
        }

        return award;
    }

    public static class AwardRecipientDeserializer implements JsonDeserializer<Award.AwardRecipient>,
                                                              JsonSerializer<Award.AwardRecipient> {

        @Override
        public Award.AwardRecipient deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
            Award.AwardRecipient recipient = new Award.AwardRecipient();
            JsonObject data = json.getAsJsonObject();

            if (data.has("awardee") && !data.get("awardee").isJsonNull()) {
                recipient.setAwardee(data.get("awardee").getAsString());
            }

            if (data.has("team_key") && !data.get("team_key").isJsonNull()) {
                recipient.setTeamKey(data.get("team_key").getAsString());
            }

            return recipient;
        }

        @Override
        public JsonElement serialize(Award.AwardRecipient src, Type typeOfSrc, JsonSerializationContext context) {
            JsonObject recipient = new JsonObject();
            recipient.addProperty("awardee", src.getAwardee());
            recipient.addProperty("team_key", src.getTeamKey());
            return recipient;
        }
    }
}


text:
<!doctype html>

    <meta charset="utf-8">

    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>Increase the PHP File Upload Limit</title>

    <link href="/dashboard/stylesheets/normalize.css" rel="stylesheet" type="text/css" /><link href="/dashboard/stylesheets/all.css" rel="stylesheet" type="text/css" />
    <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />

    <link href="/dashboard/images/favicon.png" rel="icon" type="image/png" />

Apache Friends

              Menu

Applications

FAQs

HOW-TO Guides

PHPInfo

phpMyAdmin

Documentation

          Download PDF
          increase-php-file-upload-limit.pdf

Increase the PHP File Upload Limit

By default, XAMPP imposes a 128M limit on files uploaded through PHP. To increase the allowed file size for uploads through PHP, follow these steps:

Edit the php.ini file in the xamppfiles/etc/ subdirectory of your XAMPP installation directory (usually, /Applications/XAMPP). Within this file, find the post_max_size and upload_max_filesize variables and change them to reflect the new file upload limit. For example, to restrict uploads to not more than 16M, change these variables as shown below:

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size=16M
...
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize=16M

Save your changes to the file.

Restart the Apache server.

The new file upload limit will now come into effect.

Follow us on Twitter

Like us on Facebook

Add us to your G+ Circles

Blog

Privacy Policy

                    CDN provided by

Copyright (c) 2017, Apache Friends


text:
Sequel.migration do
  change do
    create_table :reg_1010 do
      column :id, Integer, primary_key: true
      column :id_pai, Integer, index: true, null: false
      column :num_proc, String, size: 20
      column :id_sec_jud, String, size: 1000
      column :id_vara, String, size: 2
      column :ind_nat_acao, String, size: 2
      column :desc_dec_jud, String, size: 100
      column :dt_sent_jud, Date
      column :cnpj_pai, String, size: 14, index: true
    end
  end
end


text:
package co.mindie.cindy.webservice.resolver.builtin;

import co.mindie.cindy.core.annotation.Load;
import co.mindie.cindy.webservice.annotation.Resolver;
import co.mindie.cindy.core.annotation.Wired;
import co.mindie.cindy.webservice.resolver.IResolver;
import co.mindie.cindy.webservice.resolver.ResolverContext;

@Load(creationPriority = -1)
@Resolver(managedInputClasses = { String.class }, managedOutputClasses = { int[].class })
public class StringToIntArrayResolver implements IResolver<String, int[]> {

	////////////////////////
	// VARIABLES
	////////////////

	@Wired private StringToStringArrayResolver stringArrayResolver;
	@Wired private StringToIntResolver intResolver;

	////////////////////////
	// CONSTRUCTORS
	////////////////

	public StringToIntArrayResolver() {

	}

	////////////////////////
	// METHODS
	////////////////

	@Override
	public int[] resolve(String input, Class<?> expectedOutputType, ResolverContext resolverContext) {
		if (input == null) {
			return null;
		}

		String[] array = this.stringArrayResolver.resolve(input, String[].class, resolverContext);
		int[] intArray = new int[array.length];

		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = this.intResolver.resolve(array[i], int.class, resolverContext);
		}

		return intArray;
	}

	////////////////////////
	// GETTERS/SETTERS
	////////////////
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/newprod_fragment"
    android:layout_margin="20dp"
    android:background="@android:color/white">

    <com.rengwuxian.materialedittext.MaterialEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:id="@+id/np_prod"
        android:hint="@string/np_prod_hint"
        app:met_floatingLabel="highlight"
        app:met_floatingLabelText="@string/np_prod_label"
        app:met_maxCharacters="20"
        app:met_minCharacters="1"/>

    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_below="@+id/np_prod"
        android:layout_alignParentLeft="true"
        android:id="@+id/np_img"
        android:src="@android:drawable/ic_menu_camera"
        android:background="@android:color/black" />

    <Button
        style="?android:attr/borderlessButtonStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:id="@+id/np_photoButton"
        android:layout_below="@+id/np_prod"
        android:layout_toRightOf="@+id/np_img"
        android:text="@string/np_photo"
        android:textColor="@color/primaryColor"
        android:background="@android:color/white"
        android:clickable="true"/>

    <android.support.v7.widget.CardView
        android:id="@+id/np_card"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:foreground="?android:attr/selectableItemBackground"
        card_view:cardBackgroundColor="@color/primaryColorDark"
        card_view:cardCornerRadius="2dp"
        card_view:cardElevation="2dp">

        <com.balysv.materialripple.MaterialRippleLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="25dp"
            android:paddingLeft="25dp"
            app:mrl_rippleDelayClick="true"
            >
            <TextView
                style="?android:attr/textAppearanceButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/np_buttonSend"
                android:gravity="center"
                android:padding="5dp"
                android:singleLine="true"
                android:text="@string/send"
                android:clickable="true"
                android:textColor="@color/icons"/>
        </com.balysv.materialripple.MaterialRippleLayout>
    </android.support.v7.widget.CardView>

    <com.rengwuxian.materialedittext.MaterialEditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="8dp"
        android:layout_below="@+id/np_img"
        android:layout_above="@+id/np_card"
        android:id="@+id/np_desc"
        android:hint="@string/np_descr_hint"
        app:met_floatingLabel="highlight"
        app:met_floatingLabelText="@string/np_descr_label"
        app:met_maxCharacters="750"
        app:met_minCharacters="1"
        />

</RelativeLayout>


text:
#ifndef __HIREDIS_LIBEVENT_H__
#define __HIREDIS_LIBEVENT_H__
#include <event.h>
#include "hiredis.h"
#include "async.h"

typedef struct redisLibeventEvents {
    redisAsyncContext *context;
    struct event rev, wev;
} redisLibeventEvents;

static void redisLibeventReadEvent(int fd, short event, void *arg) {
    ((void)fd); ((void)event);
    redisLibeventEvents *e = (redisLibeventEvents*)arg;
    redisAsyncHandleRead(e->context);
}

static void redisLibeventWriteEvent(int fd, short event, void *arg) {
    ((void)fd); ((void)event);
    redisLibeventEvents *e = (redisLibeventEvents*)arg;
    redisAsyncHandleWrite(e->context);
}

static void redisLibeventAddRead(void *privdata) {
    redisLibeventEvents *e = (redisLibeventEvents*)privdata;
    event_add(&e->rev,NULL);
}

static void redisLibeventDelRead(void *privdata) {
    redisLibeventEvents *e = (redisLibeventEvents*)privdata;
    event_del(&e->rev);
}

static void redisLibeventAddWrite(void *privdata) {
    redisLibeventEvents *e = (redisLibeventEvents*)privdata;
    event_add(&e->wev,NULL);
}

static void redisLibeventDelWrite(void *privdata) {
    redisLibeventEvents *e = (redisLibeventEvents*)privdata;
    event_del(&e->wev);
}

static void redisLibeventCleanup(void *privdata) {
    redisLibeventEvents *e = (redisLibeventEvents*)privdata;
    event_del(&e->rev);
    event_del(&e->wev);
    free(e);
}

static int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) {
    redisContext *c = &(ac->c);
    redisLibeventEvents *e;

    /* Nothing should be attached when something is already attached */
    if (ac->ev.data != NULL)
        return REDIS_ERR;

    /* Create container for context and r/w events */
    e = (redisLibeventEvents*)malloc(sizeof(*e));
    e->context = ac;

    /* Register functions to start/stop listening for events */
    ac->ev.addRead = redisLibeventAddRead;
    ac->ev.delRead = redisLibeventDelRead;
    ac->ev.addWrite = redisLibeventAddWrite;
    ac->ev.delWrite = redisLibeventDelWrite;
    ac->ev.cleanup = redisLibeventCleanup;
    ac->ev.data = e;

    /* Initialize and install read/write events */
    event_set(&e->rev,c->fd,EV_READ,redisLibeventReadEvent,e);
    event_set(&e->wev,c->fd,EV_WRITE,redisLibeventWriteEvent,e);
    event_base_set(base,&e->rev);
    event_base_set(base,&e->wev);
    return REDIS_OK;
}
#endif


text:
package com.github.weisj.darklaf.ui.text.dummy;

import java.awt.*;
import java.awt.event.InputMethodListener;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseWheelListener;
import java.beans.PropertyChangeListener;
import java.lang.ref.WeakReference;

import javax.swing.*;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.TextUI;
import javax.swing.text.Caret;
import javax.swing.text.Document;
import javax.swing.text.Highlighter;

public class DummyEditorPane extends JEditorPane {

    private WeakReference<JEditorPane> editorPane;
    private PropertyChangeListener propertyChangeListener;

    public void setEditorPane(final JEditorPane editor) {
        this.editorPane = new WeakReference<>(editor);
        if (editor != null) {
            copyProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, editor);
            copyProperty(JEditorPane.W3C_LENGTH_UNITS, editor);
        }
    }

    protected void copyProperty(final String key, final JEditorPane editorPane) {
        putClientProperty(key, editorPane.getClientProperty(key));
    }

    public PropertyChangeListener getPropertyChangeListener() {
        return propertyChangeListener;
    }

    private JEditorPane getEditor() {
        return editorPane != null ? editorPane.get() : null;
    }

    @Override
    public Document getDocument() {
        JEditorPane editor = getEditor();
        if (editor == null) return super.getDocument();
        return editor.getDocument();
    }

    @Override
    public Font getFont() {
        JEditorPane editor = getEditor();
        if (editor == null) return null;
        return editor.getFont();
    }

    @Override
    public Color getForeground() {
        JEditorPane editor = getEditor();
        if (editor == null) return null;
        return editor.getForeground();
    }

    @Override
    public Color getBackground() {
        JEditorPane editor = getEditor();
        if (editor == null) return null;
        return editor.getBackground();
    }

    @Override
    public boolean isEditable() {
        JEditorPane editor = getEditor();
        if (editor == null) return false;
        return editor.isEditable();
    }

    @Override
    protected void setUI(final ComponentUI newUI) {}

    @Override
    public void setUI(final TextUI ui) {}

    @Override
    public void updateUI() {}

    @Override
    public void addPropertyChangeListener(final PropertyChangeListener listener) {
        propertyChangeListener = listener;
    }

    @Override
    public synchronized void addMouseListener(final MouseListener l) {}

    @Override
    public synchronized void addMouseMotionListener(final MouseMotionListener l) {}

    @Override
    public synchronized void addMouseWheelListener(final MouseWheelListener l) {}

    @Override
    public void addInputMethodListener(final InputMethodListener l) {}

    @Override
    public void setHighlighter(final Highlighter h) {}

    @Override
    public void setTransferHandler(final TransferHandler newHandler) {}

    @Override
    public void setCaret(final Caret c) {}

    @Override
    public void setDocument(final Document doc) {}

    @Override
    public void setDisabledTextColor(final Color c) {}

    @Override
    public void setDragEnabled(final boolean b) {}

    @Override
    public LayoutManager getLayout() {
        return null;
    }

    @Override
    public void setLayout(final LayoutManager mgr) {
        if (mgr instanceof DocumentListener) {
            Document doc = getDocument();
            if (doc != null) doc.removeDocumentListener((DocumentListener) mgr);
        }
    }
}


text:
module Functionally
  VERSION = "0.0.1"
end


text:
import initializeReducer from '../lib/initialize-reducer'
export default initializeReducer({ isPinging: false }, {
  PING: (state) => ({ ...state, isPinging: true }),
  PONG: (state) => ({ ...state, isPinging: false })
})


text:
package org.dcm4chex.archive.web.maverick;

/**
 *
 * @author gunter.zeilinger@tiani.com
 * @version $Revision: 1099 $ $Date: 2004-04-29 22:11:59 +0800 (周四, 29 4月 2004) $
 * @since 28.01.2004
 */
public class CollapsePatientCtrl extends Dcm4JbossController {

    private int patPk;

    public final void setPatPk(int patPk)
    {
        this.patPk = patPk;
    }

    protected String perform() throws Exception {
        FolderForm folderForm = FolderForm.getFolderForm(getCtx().getRequest());
        folderForm.getPatientByPk(patPk).getStudies().clear();
        return SUCCESS;
    }
}


text:
package com.jtattoo.plaf;

import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.border.*;

/**
 *
 * @author Michael Hagen
 */
public class BaseSpinnerUI extends BasicSpinnerUI {
    /**
     * Used by the default LayoutManager class - SpinnerLayout for
     * missing (null) editor/nextButton/previousButton children.
     */
    private static final Dimension zeroSize = new Dimension(0, 0);

    private MyLayoutManager myLayoutManager = null;

    /**
     * Returns a new instance of BaseSpinnerUI.  SpinnerListUI
     * delegates are allocated one per JSpinner.
     *
     * @param c the JSpinner (not used)
     * @see ComponentUI#createUI
     * @return a new BasicSpinnerUI object
     */
    public static ComponentUI createUI(JComponent c) {
        return new BaseSpinnerUI();
    }

    /**
     * Create a LayoutManager that manages the editor,
     * nextButton, and previousButton
     * children of the JSpinner.  These three children must be
     * added with a constraint that identifies their role:
     * "Editor", "Next", and "Previous". The default layout manager
     * can handle the absence of any of these children.
     *
     * @return a LayoutManager for the editor, next button, and previous button.
     * @see #createNextButton
     * @see #createPreviousButton
     * @see #createEditor
     */
    protected LayoutManager createLayout() {
        if (myLayoutManager == null) {
            myLayoutManager = new MyLayoutManager();
        }
        return myLayoutManager;
    }

    protected Component createNextButton() {
        JButton button = new SpinButton(SwingConstants.NORTH);
        if (JTattooUtilities.isLeftToRight(spinner)) {
            Border border = BorderFactory.createMatteBorder(0, 1, 1, 0, AbstractLookAndFeel.getFrameColor());
            button.setBorder(border);
        } else {
            Border border = BorderFactory.createMatteBorder(0, 0, 1, 1, AbstractLookAndFeel.getFrameColor());
            button.setBorder(border);
        }
        installNextButtonListeners(button);
        return button;
    }

    protected Component createPreviousButton() {
        JButton button = new SpinButton(SwingConstants.SOUTH);
        if (JTattooUtilities.isLeftToRight(spinner)) {
            Border border = BorderFactory.createMatteBorder(0, 1, 0, 0, AbstractLookAndFeel.getFrameColor());
            button.setBorder(border);
        } else {
            Border border = BorderFactory.createMatteBorder(0, 0, 0, 1, AbstractLookAndFeel.getFrameColor());
            button.setBorder(border);
        }
        installPreviousButtonListeners(button);
        return button;
    }

//------------------------------------------------------------------------------
    public static class SpinButton extends NoFocusButton {
        private static Dimension minSize = new Dimension(14, 12);
        private int direction = SwingConstants.NORTH;

        public SpinButton(int aDirection) {
            super();
            setInheritsPopupMenu(true);
            direction = aDirection;
        }

        public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            size.width = Math.max(size.width, minSize.width);
            size.height = Math.max(size.height, minSize.height);
            return size;
        }

        public void paint(Graphics g) {
            Color colors[] = null;
            ButtonModel model = getModel();
            if (isEnabled()) {
                if (model.isPressed() && model.isArmed())
                    colors = AbstractLookAndFeel.getTheme().getPressedColors();
                else {
                    if (model.isRollover())
                        colors = AbstractLookAndFeel.getTheme().getRolloverColors();
                    else if (JTattooUtilities.isFrameActive(this))
                        colors = AbstractLookAndFeel.getTheme().getButtonColors();
                    else
                        colors = AbstractLookAndFeel.getTheme().getInActiveColors();
                }
            }
            else
                colors = AbstractLookAndFeel.getTheme().getDisabledColors();
            JTattooUtilities.fillHorGradient(g, colors, 0, 0, getWidth(), getHeight());
            paintBorder(g);
            g.setColor(getForeground());
            int w = 4;
            int h = 3;
            int x = (getWidth() - w) / 2;
            int y = (getHeight() - h) / 2;
            if (direction == SwingConstants.NORTH) {
                for (int i = 0; i < h; i++) {
                    g.drawLine(x + (h - i) - 1, y + i, x + w - (h - i) + 1, y + i);
                }
            } else {
                for (int i = 0; i < h; i++) {
                    g.drawLine(x + i, y + i, x + w - i, y + i);
                }
            }
        }

    }

//------------------------------------------------------------------------------
    private static class MyLayoutManager implements LayoutManager {
        //
        // LayoutManager
        //
        private Component nextButton = null;
        private Component previousButton = null;
        private Component editor = null;

        public void addLayoutComponent(String name, Component c) {
            if ("Next".equals(name)) {
                nextButton = c;
            } else if ("Previous".equals(name)) {
                previousButton = c;
            } else if ("Editor".equals(name)) {
                editor = c;
            }
        }

        public void removeLayoutComponent(Component c) {
            if (c == nextButton) {
                c = null;
            } else if (c == previousButton) {
                previousButton = null;
            } else if (c == editor) {
                editor = null;
            }
        }

        private Dimension preferredSize(Component c) {
            return (c == null) ? zeroSize : c.getPreferredSize();
        }

        public Dimension preferredLayoutSize(Container parent) {
            Dimension nextD = preferredSize(nextButton);
            Dimension previousD = preferredSize(previousButton);
            Dimension editorD = preferredSize(editor);

            // Force the editors height to be a multiple of 2
            editorD.height = ((editorD.height + 1) / 2) * 2;

            Dimension size = new Dimension(editorD.width, editorD.height);
            size.width += Math.max(nextD.width, previousD.width);
            Insets insets = parent.getInsets();
            size.width += insets.left + insets.right;
            size.height += insets.top + insets.bottom + 4;
            return size;
        }

        public Dimension minimumLayoutSize(Container parent) {
            return preferredLayoutSize(parent);
        }

        private void setBounds(Component c, int x, int y, int width, int height) {
            if (c != null) {
                c.setBounds(x, y, width, height);
            }
        }

        public void layoutContainer(Container parent) {
            int width  = parent.getWidth();
            int height = parent.getHeight();

            Insets insets = parent.getInsets();
            Dimension nextD = preferredSize(nextButton);
            Dimension previousD = preferredSize(previousButton);
            int buttonsWidth = Math.max(nextD.width, previousD.width);
            int editorHeight = height - (insets.top + insets.bottom);

            // The arrowButtonInsets value is used instead of the JSpinner's
            // insets if not null. Defining this to be (0, 0, 0, 0) causes the
            // buttons to be aligned with the outer edge of the spinner's
            // border, and leaving it as "null" places the buttons completely
            // inside the spinner's border.
            Insets buttonInsets = UIManager.getInsets("Spinner.arrowButtonInsets");
            if (buttonInsets == null) {
                buttonInsets = insets;
            }

            // Deal with the spinner's componentOrientation property.
            int editorX, editorWidth, buttonsX;
            if (parent.getComponentOrientation().isLeftToRight()) {
                editorX = insets.left;
                editorWidth = width - insets.left - buttonsWidth - buttonInsets.right;
                buttonsX = width - buttonsWidth - buttonInsets.right;
            } else {
                buttonsX = buttonInsets.left;
                editorX = buttonsX + buttonsWidth;
                editorWidth = width - buttonInsets.left - buttonsWidth - insets.right;
            }

            int nextY = buttonInsets.top;
            int nextHeight = (height / 2) + (height % 2) - nextY;
            int previousY = buttonInsets.top + nextHeight;
            int previousHeight = height - previousY - buttonInsets.bottom;

            setBounds(editor,         editorX,  insets.top, editorWidth, editorHeight);
            setBounds(nextButton,     buttonsX, nextY,      buttonsWidth, nextHeight);
            setBounds(previousButton, buttonsX, previousY,  buttonsWidth, previousHeight);
        }

    }

}


text:
package org.camunda.bpm.qa.upgrade.scenarios7110.removaltime;

import org.camunda.bpm.engine.HistoryService;
import org.camunda.bpm.engine.batch.Batch;
import org.camunda.bpm.engine.history.HistoricProcessInstance;
import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
import org.camunda.bpm.engine.runtime.Job;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import java.util.Date;
import java.util.List;

import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import static org.junit.Assert.assertThat;

/**
 * @author Tassilo Weidner
 */
public class RemovalTimeBatchTest {

  @Rule
  public ProcessEngineRule engineRule = new ProcessEngineRule("camunda.cfg.xml");

  protected HistoryService historyService;

  @Before
  public void assignService() {
    historyService = engineRule.getHistoryService();
  }

  @Test
  public void shouldSetRemovalTimeForRootProcessInstanceOnly() {
    // given
    HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery()
      .processInstanceBusinessKey("rootProcessInstance");

    HistoricProcessInstance historicRootProcessInstance = query.singleResult();

    HistoricProcessInstance historicChildProcessInstance = historyService.createHistoricProcessInstanceQuery()
      .superProcessInstanceId(historicRootProcessInstance.getId())
      .singleResult();

    // assume
    assertThat(historicRootProcessInstance.getRemovalTime(), nullValue());
    assertThat(historicChildProcessInstance.getRemovalTime(), nullValue());

    // when
    syncExec(
      historyService.setRemovalTimeToHistoricProcessInstances()
        .absoluteRemovalTime(new Date())
        .byQuery(query)
        .hierarchical()
        .executeAsync()
    );

    historicRootProcessInstance = query.singleResult();

    historicChildProcessInstance = historyService.createHistoricProcessInstanceQuery()
      .superProcessInstanceId(historicRootProcessInstance.getId())
      .singleResult();

    // then
    assertThat(historicRootProcessInstance.getRemovalTime(), notNullValue());
    assertThat(historicChildProcessInstance.getRemovalTime(), nullValue());
  }

  // helper ////////////////////////////////////////////////////////////////////////////////////////////////////////////

  protected void syncExec(Batch batch) {
    String seedJobDefinitionId = batch.getSeedJobDefinitionId();

    String jobId = engineRule.getManagementService().createJobQuery()
      .jobDefinitionId(seedJobDefinitionId)
      .singleResult()
      .getId();

    engineRule.getManagementService().executeJob(jobId);

    String batchJobDefinitionId = batch.getBatchJobDefinitionId();

    List<Job> jobs = engineRule.getManagementService().createJobQuery()
      .jobDefinitionId(batchJobDefinitionId)
      .list();

    for (Job job : jobs) {
      engineRule.getManagementService().executeJob(job.getId());
    }

    String monitorJobDefinitionId = batch.getMonitorJobDefinitionId();

    jobId = engineRule.getManagementService().createJobQuery()
      .jobDefinitionId(monitorJobDefinitionId)
      .singleResult()
      .getId();

    engineRule.getManagementService().executeJob(jobId);
  }

}


text:
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
using System.IO;
using System;

namespace U3d {
  class EditorRun {
    [MenuItem ("U3d/Example/Build")]
    static void Build() {
      Debug.Log("Building Example2");

      BuildTarget Target;
#if UNITY_2017_3_OR_NEWER
      Target = BuildTarget.StandaloneOSX;
#else
      Target = BuildTarget.StandaloneOSXIntel64;
#endif

      BuildPlayer(EditorBuildSettings.scenes, "target/Example2.app", Target, BuildOptions.None);
    }

    private static void BuildPlayer(EditorBuildSettingsScene[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) {
      FileSystemUtil.EnsureParentExists(target_dir);
      string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
      if (res.Length > 0) {
        throw new Exception("BuildPlayer failure: " + res);
      }
    }
  }

  class FileSystemUtil {
    public static void EnsureParentExists(string target_dir) {
      DirectoryInfo parent = Directory.GetParent(target_dir);
      if (!parent.Exists) {
        Directory.CreateDirectory(parent.FullName);
      }
    }
  }
}


text:
/**
 * PieSeries visualizes data as a circular chart divided into wedges which represent data as a
 * percentage of a whole.
 *
 * @class PieSeries
 * @constructor
 * @extends MarkerSeries
 */
Y.PieSeries = Y.Base.create("pieSeries", Y.MarkerSeries, [], {
    /**
     * @private
     */
    _map: null,

    /**
     * @private
     */
    _image: null,

    /**
     * @private
     */
    _setMap: function()
    {
        var id = "pieHotSpotMapi_" + Math.round(100000 * Math.random()),
            cb = this.get("graph").get("contentBox"),
            areaNode;
        if(this._image)
        {
            cb.removeChild(this._image);
            while(this._areaNodes && this._areaNodes.length > 0)
            {
                areaNode = this._areaNodes.shift();
                this._map.removeChild(areaNode);
            }
            cb.removeChild(this._map);
        }
        this._image = document.createElement("img");
        this._image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAABCAYAAAD9yd/wAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABJJREFUeNpiZGBgSGPAAgACDAAIkABoFyloZQAAAABJRU5ErkJggg==";
        cb.appendChild(this._image);
        this._image.setAttribute("usemap", "#" + id);
        this._image.style.zIndex = 3;
        this._image.style.opacity = 0;
        this._image.setAttribute("alt", "imagemap");
        this._map = document.createElement("map");
        this._map.style.zIndex = 5;
        cb.appendChild(this._map);
        this._map.setAttribute("name", id);
        this._map.setAttribute("id", id);
        this._areaNodes = [];
    },

    /**
     * @private
     */
    _categoryDisplayName: null,

    /**
     * @private
     */
    _valueDisplayName: null,

    /**
     * @private
     */
    addListeners: function()
    {
        var categoryAxis = this.get("categoryAxis"),
            valueAxis = this.get("valueAxis");
        if(categoryAxis)
        {
            categoryAxis.after("dataReady", Y.bind(this._categoryDataChangeHandler, this));
            categoryAxis.after("dataUpdate", Y.bind(this._categoryDataChangeHandler, this));
        }
        if(valueAxis)
        {
            valueAxis.after("dataReady", Y.bind(this._valueDataChangeHandler, this));
            valueAxis.after("dataUpdate", Y.bind(this._valueDataChangeHandler, this));
        }
        this.after("categoryAxisChange", this.categoryAxisChangeHandler);
        this.after("valueAxisChange", this.valueAxisChangeHandler);
        this.after("stylesChange", this._updateHandler);
    },

    /**
     * @private
     */
    validate: function()
    {
        this.draw();
        this._renderered = true;
    },

    /**
     * @private
     */
    _categoryAxisChangeHandler: function(e)
    {
        var categoryAxis = this.get("categoryAxis");
        categoryAxis.after("dataReady", Y.bind(this._categoryDataChangeHandler, this));
        categoryAxis.after("dataUpdate", Y.bind(this._categoryDataChangeHandler, this));
    },

    /**
     * @private
     */
    _valueAxisChangeHandler: function(e)
    {
        var valueAxis = this.get("valueAxis");
        valueAxis.after("dataReady", Y.bind(this._valueDataChangeHandler, this));
        valueAxis.after("dataUpdate", Y.bind(this._valueDataChangeHandler, this));
    },

    /**
     * Constant used to generate unique id.
     *
     * @private
     */
    GUID: "pieseries",

    /**
     * @private (protected)
     * Handles updating the graph when the x Axis values
     * change.
     */
    _categoryDataChangeHandler: function(event)
    {
       if(this._rendered && this.get("categoryKey") && this.get("valueKey"))
        {
            this.draw();
        }
    },

    /**
     * @private (protected)
     * Handles updating the chart when the y Axis values
     * change.
     */
    _valueDataChangeHandler: function(event)
    {
        if(this._rendered && this.get("categoryKey") && this.get("valueKey"))
        {
            this.draw();
        }
    },

    /**
     * @protected
     *
     * Draws the series. Overrides the base implementation.
     *
     * @method draw
     */
    draw: function()
    {
        var graph = this.get("graph"),
            w = graph.get("width"),
            h = graph.get("height");
        if(isFinite(w) && isFinite(h) && w > 0 && h > 0)
        {
            this._rendered = true;
            this.drawSeries();
            this.fire("drawingComplete");
        }
    },

    /**
     * @private
     */
    drawPlots: function()
    {
        var values = this.get("valueAxis").getDataByKey(this.get("valueKey")).concat(),
            catValues = this.get("categoryAxis").getDataByKey(this.get("categoryKey")).concat(),
            totalValue = 0,
            itemCount = values.length,
            styles = this.get("styles").marker,
            fillColors = styles.fill.colors,
            fillAlphas = styles.fill.alphas || ["1"],
            borderColors = styles.border.colors,
            borderWeights = [styles.border.weight],
            borderAlphas = [styles.border.alpha],
            tbw = borderWeights.concat(),
            tbc = borderColors.concat(),
            tba = borderAlphas.concat(),
            tfc,
            tfa,
            padding = styles.padding,
            graph = this.get("graph"),
            w = graph.get("width") - (padding.left + padding.right),
            h = graph.get("height") - (padding.top + padding.bottom),
            startAngle = -90,
            halfWidth = w / 2,
            halfHeight = h / 2,
            radius = Math.min(halfWidth, halfHeight),
            i = 0,
            value,
            angle = 0,
            lc,
            la,
            lw,
            wedgeStyle,
            marker,
            graphOrder = this.get("graphOrder"),
            isCanvas = DRAWINGAPI == "canvas";

        for(; i < itemCount; ++i)
        {
            value = values[i];

            values.push(value);
            if(!isNaN(value))
            {
                totalValue += value;
            }
        }

        tfc = fillColors ? fillColors.concat() : null;
        tfa = fillAlphas ? fillAlphas.concat() : null;
        this._createMarkerCache();
        if(isCanvas)
        {
            this._setMap();
            this._image.width = w;
            this._image.height = h;
        }
        for(i = 0; i < itemCount; i++)
        {
            value = values[i];
            if(totalValue === 0)
            {
                angle = 360 / values.length;
            }
            else
            {
                angle = 360 * (value / totalValue);
            }
            angle = Math.round(angle);
            if(tfc && tfc.length < 1)
            {
                tfc = fillColors.concat();
            }
            if(tfa && tfa.length < 1)
            {
                tfa = fillAlphas.concat();
            }
            if(tbw && tbw.length < 1)
            {
                tbw = borderWeights.concat();
            }
            if(tbw && tbc.length < 1)
            {
                tbc = borderColors.concat();
            }
            if(tba && tba.length < 1)
            {
                tba = borderAlphas.concat();
            }
            lw = tbw ? tbw.shift() : null;
            lc = tbc ? tbc.shift() : null;
            la = tba ? tba.shift() : null;
            startAngle += angle;
            wedgeStyle = {
                border: {
                    color:lc,
                    weight:lw,
                    alpha:la
                },
                fill: {
                    color:tfc ? tfc.shift() : this._getDefaultColor(i, "slice"),
                    alpha:tfa ? tfa.shift() : null
                },
                shape: "wedge",
                props: {
                    arc: angle,
                    radius: radius,
                    startAngle: startAngle,
                    x: halfWidth,
                    y: halfHeight
                },
                width: w,
                height: h
            };
            marker = this.getMarker(wedgeStyle, graphOrder, i);
            if(isCanvas)
            {
                this._addHotspot(wedgeStyle.props, graphOrder, i);
            }
        }
        this._clearMarkerCache();
    },

    _addHotspot: function(cfg, seriesIndex, index)
    {
        var areaNode = document.createElement("area"),
            i = 1,
            x = cfg.x,
            y = cfg.y,
            arc = cfg.arc,
            startAngle = cfg.startAngle - arc,
            endAngle = cfg.startAngle,
            radius = cfg.radius,
            ax = x + Math.cos(startAngle / 180 * Math.PI) * radius,
            ay = y + Math.sin(startAngle / 180 * Math.PI) * radius,
            bx = x + Math.cos(endAngle / 180 * Math.PI) * radius,
            by = y + Math.sin(endAngle / 180 * Math.PI) * radius,
            numPoints = Math.floor(arc/10) - 1,
            divAngle = (arc/(Math.floor(arc/10)) / 180) * Math.PI,
            angleCoord = Math.atan((ay - y)/(ax - x)),
            pts = x + ", " + y + ", " + ax + ", " + ay,
            cosAng,
            sinAng,
            multDivAng;
        for(i = 1; i <= numPoints; ++i)
        {
            multDivAng = divAngle * i;
            cosAng = Math.cos(angleCoord + multDivAng);
            sinAng = Math.sin(angleCoord + multDivAng);
            if(startAngle <= 90)
            {
                pts += ", " + (x + (radius * Math.cos(angleCoord + (divAngle * i))));
                pts += ", " + (y + (radius * Math.sin(angleCoord + (divAngle * i))));
            }
            else
            {
                pts += ", " + (x - (radius * Math.cos(angleCoord + (divAngle * i))));
                pts += ", " + (y - (radius * Math.sin(angleCoord + (divAngle * i))));
            }
        }
        pts += ", " + bx + ", " + by;
        pts += ", " + x + ", " + y;
        this._map.appendChild(areaNode);
        areaNode.setAttribute("class", "yui3-seriesmarker");
        areaNode.setAttribute("id", "hotSpot_" + seriesIndex + "_" + index);
        areaNode.setAttribute("shape", "polygon");
        areaNode.setAttribute("coords", pts);
        this._areaNodes.push(areaNode);

    },

    /**
     * Resizes and positions markers based on a mouse interaction.
     *
     * @protected
     * @method updateMarkerState
     * @param {String} type state of the marker
     * @param {Number} i index of the marker
     */
    updateMarkerState: function(type, i)
    {
        if(this._markers[i])
        {
            var state = this._getState(type),
                markerStyles,
                indexStyles,
                marker = this._markers[i],
                styles = this.get("styles").marker;
            markerStyles = state == "off" || !styles[state] ? styles : styles[state];
            indexStyles = this._mergeStyles(markerStyles, {});
            indexStyles.fill.color = indexStyles.fill.colors[i % indexStyles.fill.colors.length];
            indexStyles.fill.alpha = indexStyles.fill.alphas[i % indexStyles.fill.alphas.length];
            marker.update(indexStyles);
        }
    },

    /**
     * @private
     */
    _createMarker: function(styles, order, index)
    {
        var cfg = Y.clone(styles),
            marker;
        cfg.graphic = this.get("graphic");
        marker = new Y.Shape(cfg);
        marker.addClass("yui3-seriesmarker");
        marker.node.setAttribute("id", "series_" + order + "_" + index);
        return marker;
    },

    /**
     * @private
     */
    _clearMarkerCache: function()
    {
        var len = this._markerCache.length,
            i = 0,
            marker;
        for(; i < len; ++i)
        {
            marker = this._markerCache[i];
            if(marker && marker.node && marker.parentNode)
            {
                marker.parentNode.removeChild(marker.node);
            }
        }
        this._markerCache = [];
    },

    /**
     * @private
     */
    _getPlotDefaults: function()
    {
         var defs = {
            padding:{
                top: 0,
                left: 0,
                right: 0,
                bottom: 0
            },
            fill:{
                alphas:["1"]
            },
            border: {
                weight: 0,
                alpha: 1
            }
        };
        defs.fill.colors = this._defaultSliceColors;
        defs.border.colors = this._defaultBorderColors;
        return defs;
    },

    /**
     * @private
     */
    _defaultLineColors:["#426ab3", "#d09b2c", "#000000", "#b82837", "#b384b5", "#ff7200", "#779de3", "#cbc8ba", "#7ed7a6", "#007a6c"],

    /**
     * @private
     */
    _defaultFillColors:["#6084d0", "#eeb647", "#6c6b5f", "#d6484f", "#ce9ed1", "#ff9f3b", "#93b7ff", "#e0ddd0", "#94ecba", "#309687"],

    /**
     * @private
     */
    _defaultBorderColors:["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"],

    /**
     * @private
     */
    _defaultSliceColors: ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"],

    /**
     * @private
     * @description Colors used if style colors are not specified
     */
    _getDefaultColor: function(index, type)
    {
        var colors = {
                line: this._defaultLineColors,
                fill: this._defaultFillColors,
                border: this._defaultBorderColors,
                slice: this._defaultSliceColors
            },
            col = colors[type],
            l = col.length;
        index = index || 0;
        if(index >= l)
        {
            index = index % l;
        }
        type = type || "fill";
        return colors[type][index];
    }
}, {
    ATTRS: {
        /**
         * Read-only attribute indicating the type of series.
         *
         * @attribute type
         * @type String
         * @default pie
         */
        type: {
            value: "pie"
        },

        /**
         * Order of this instance of this type.
         *
         * @attribute order
         * @type Number
         */
        order: {},

        /**
         * Reference to the Graph in which the series is drawn into.
         *
         * @attribute graph
         * @type Graph
         */
        graph: {},

        /**
         * Reference to the Axis instance used for assigning
         * category values to the graph.
         *
         * @attribute categoryAxis
         * @type Axis
         */
        categoryAxis: {
            value: null,

            validator: function(value)
            {
                return value !== this.get("categoryAxis");
            }
        },

        /**
         * Reference to the Axis instance used for assigning
         * series values to the graph.
         *
         * @attribute categoryAxis
         * @type Axis
         */
        valueAxis: {
            value: null,

            validator: function(value)
            {
                return value !== this.get("valueAxis");
            }
        },

        /**
         * Indicates which array to from the hash of value arrays in
         * the category Axis instance.
         */
        categoryKey: {
            value: null,

            validator: function(value)
            {
                return value !== this.get("categoryKey");
            }
        },
        /**
         * Indicates which array to from the hash of value arrays in
         * the value Axis instance.
         */
        valueKey: {
            value: null,

            validator: function(value)
            {
                return value !== this.get("valueKey");
            }
        },

        /**
         * Name used for for displaying category data
         *
         * @attribute categoryDisplayName
         * @type String
         */
        categoryDisplayName: {
            setter: function(val)
            {
                this._categoryDisplayName = val;
                return val;
            },

            getter: function()
            {
                return this._categoryDisplayName || this.get("categoryKey");
            }
        },

        /**
         * Name used for for displaying value data
         *
         * @attribute valueDisplayName
         * @type String
         */
        valueDisplayName: {
            setter: function(val)
            {
                this._valueDisplayName = val;
                return val;
            },

            getter: function()
            {
                return this._valueDisplayName || this.get("valueKey");
            }
        },

        /**
         * @private
         */
        slices: null

        /**
         * Style properties used for drawing markers. This attribute is inherited from MarkerSeries. Below are the default values:
         *

         *
fill

A hash containing the following values:
         *

         *
colors

An array of colors to be used for the marker fills. The color for each marker is retrieved from the
         *              array below:

         *              ["#66007f", "#a86f41", "#295454", "#996ab2", "#e8cdb7", "#90bdbd","#000000","#c3b8ca", "#968373", "#678585"]
         *

         *
alphas

An array of alpha references (Number from 0 to 1) indicating the opacity of each marker fill. The default value is [1].

         *

         *

         *
border

A hash containing the following values:
         *

         *
color

An array of colors to be used for the marker borders. The color for each marker is retrieved from the
         *              array below:

         *              ["#205096", "#b38206", "#000000", "#94001e", "#9d6fa0", "#e55b00", "#5e85c9", "#adab9e", "#6ac291", "#006457"]
         *
alpha

Number from 0 to 1 indicating the opacity of the marker border. The default value is 1.

         *
weight

Number indicating the width of the border. The default value is 1.

         *

         *

         *
over

hash containing styles for markers when highlighted by a mouseover event. The default
         *      values for each style is null. When an over style is not set, the non-over value will be used. For example,
         *      the default value for marker.over.fill.color is equivalent to marker.fill.color.

         *

         *
         * @attribute styles
         * @type Object
         */
    }
});


text:
2019 CLC

Rules

Entries

Schedule

Draws/Results

History


text:
package com.facebook.buck.features.ocaml;

import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.rules.args.Arg;
import com.facebook.buck.shell.ShellStep;
import com.facebook.buck.step.ExecutionContext;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.nio.file.Path;
import java.util.Optional;

/**
 * This step is run when `native_plugin=True` is set in an `ocaml_library` rule.
 *
 * <p>This builds a `.cmxs` file from the corresponding `.cmo`/`cma` file that was built as part of
 * the static library compilation.
 *
 * <p>`.cmxs` files are generally used as dynamically-linked plugins for native-compiled ocaml. See
 * the built-in `Dynlink` ocaml module for more info.
 */
public class OcamlNativePluginStep extends ShellStep {

  public final ImmutableMap<String, String> environment;
  public final ImmutableList<String> cxxCompiler;
  public final ImmutableList<String> ocamlCompilerCommandPrefix;
  public final ImmutableList<String> flags;
  public final Optional<String> stdlib;
  public final Path output;
  public final ImmutableList<Arg> cDepInput;
  public final ImmutableList<Path> input;

  private final ImmutableList<String> ocamlInput;

  public OcamlNativePluginStep(
      BuildTarget buildTarget,
      Path workingDirectory,
      ImmutableMap<String, String> environment,
      ImmutableList<String> cxxCompiler,
      ImmutableList<String> ocamlCompilerCommandPrefix,
      ImmutableList<String> flags,
      Optional<String> stdlib,
      Path output,
      ImmutableList<Arg> cDepInput,
      ImmutableList<Path> input,
      ImmutableList<String> ocamlInput) {
    super(Optional.of(buildTarget), workingDirectory);
    this.environment = environment;
    this.ocamlCompilerCommandPrefix = ocamlCompilerCommandPrefix;
    this.cxxCompiler = cxxCompiler;
    this.flags = flags;
    this.stdlib = stdlib;
    this.output = output;
    this.cDepInput = cDepInput;
    this.input = input;
    this.ocamlInput = ocamlInput;
  }

  @Override
  public String getShortName() {
    return "OCaml native dynamic library";
  }

  @Override
  protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
    ImmutableList.Builder<String> cmd =
        ImmutableList.<String>builder()
            .addAll(ocamlCompilerCommandPrefix)
            .addAll(OcamlCompilables.DEFAULT_OCAML_FLAGS);

    if (stdlib.isPresent()) {
      cmd.add("-nostdlib", OcamlCompilables.OCAML_INCLUDE_FLAG, stdlib.get());
    }

    return cmd.add("-shared")
        .add("-o", output.toString())
        .addAll(flags)
        .addAll(ocamlInput)
        .addAll(input.stream().map(Object::toString).iterator())
        .build();
  }

  @Override
  public ImmutableMap<String, String> getEnvironmentVariables(ExecutionContext context) {
    return environment;
  }
}