text:
'use strict';

var storage = require('./storage');

var list = [];
var topId = 0;

// prop utility
function gettersetter(store,cb) {
  var prop = function() {
    if (arguments.length) {
      store = arguments[0];
      if (cb){
        cb.call(null,store);
      }
    }
    return store;
  };

  prop.toJSON = function() {
    return store;
  };

  if (cb){
    cb.call(null,store);
  }
  return prop;
}

function prop(store,cb) {
  return gettersetter(store,cb);
}

var model = {
  Todo: function (data) {

    var that = this;

    this.id = data.id || ++topId;
    this.title = prop(data.title);

    this.completed = prop(data.completed || false,function(){
      storage.put(list);
    });

    this.editing = prop(data.editing || false, function(){
      that.title(that.title().trim());
      if (!that.title()) {
        that.remove();
      }
      storage.put(list);
    });

    this.remove = function () {
      list.splice(list.indexOf(that), 1);
      storage.put(list);
    };

  },

  Todos: function(){

    list = storage.get();

    // Update with props
    list = list.map(function(item) {
      topId = Math.max(item.id,topId);
      return new model.Todo(item);
    });

    this.add = function(title){
      list.push(new model.Todo({title: title}));
      storage.put(list);
    };

    this.completeAll = function () {
      var complete = allCompleted();
      for (var i = 0; i < list.length; i++) {
        list[i].completed(!complete);
      }
      storage.put(list);
    };

    var allCompleted = this.allCompleted = function () {
      for (var i = 0; i < list.length; i++) {
        if (!list[i].completed()) {
          return false;
        }
      }
      return true;
    };

    this.clearCompleted = function () {
      for (var i = list.length - 1; i >= 0; i--) {
        if (list[i].completed()) {
          list.splice(i, 1);
        }
      }
      storage.put(list);
    };

    this.amountCompleted = function () {
      var amount = 0;
      for (var i = 0; i < list.length; i++) {
        if (list[i].completed()) {
          amount++;
        }
      }
      return amount;
    };

    this.list = list;

  }
};

module.exports = model;


text:
#include <QWidget>

#include "ui_newcontactlistwindow.h"
#include "userstatus.h"
#include "uitools.h"
#include "contactlistmenu.h"
#include "statusbutton.h"

class QMenu;
class QMouseEvent;

namespace MoodBox
{

class SetupDialog;
class FindDialog;
class AutoUpdater;

using namespace Ui;

class NewContactListWindow : public QWidget, public NewContactListWindowClass
{
	Q_OBJECT

public:
	NewContactListWindow(QWidget *parent = NULL);

	SetupDialog *setupDialog;

	// Moves window to the right of specified widget
	void updatePosition(const QWidget *topWidget);

	void initAutoUpdater(AutoUpdater *autoUpdater);

	void setStatusButtonIcon(const QIcon &icon) { statusButton->setIconLabel(icon.pixmap(QSize(1000, 1000))); }

	void onMessageReceived(qint32 userId, bool isAllFriends = false);

	void clearContacts() { if (newContactListWidget) newContactListWidget->clearContacts(); }

	int getUnreadMessagesForContact(qint32 id) const;
	int getUnreadMessagesForAllFriends() const;

signals:
	void contactSelected(qint32 id);
	void contactImageDrop(qint32 id, const QImage &image);

	void unreadContacts(int);

	void goOnline();
	void goOffline();
	void goLogout();
	void goExit();

	void soundStateChanged(const bool enableSounds);

	void historyCleared();

public slots:
	void onShowProfileDialog();
	void onShowFindDialog();
	void onShowNetworkSettingsDialog();
	void onUserStatusChanged(UserStatus::UserStatusEnum userStatus);
	void onResizeNeeded(int newX);

protected:
	virtual void closeEvent(QCloseEvent *event);
	virtual void resizeEvent(QResizeEvent *event);

private:
	FindDialog *findDialog;

	StatusButton *statusButton;
	ContactListMenu *menu;

private slots:
	// Buttons
	void on_setupToolButton_toggled(bool checked);
	void on_findButton_toggled(bool checked);
	void onStatusButtonClicked();
};

}

#endif // NEWCONTACTLISTWINDOW_H

redpajama_set_name: RedPajamaGithub


text:
Ext.define('acesure.config.store.AccountLoginTypeStore', {
    extend: 'Ext.data.SimpleStore',
    model: 'acesure.config.model.AccountLoginTypeModel',
    data: [
	       [PASSWORD_TYPE_LOGIN, PASSWORD_DESC],
	       [USBKEY_TYPE_LOGIN, USBKEY_DESC],
	       [BOTH_TYPE_LOGIN, PASSWORD_OR_USBKEY_DESC]
	       ]
});


text:
3D View (Monitor and Playback)
==============================

The 3D view contains the following controls:

-   [View Controls](#ID4EV)
-   [Image Controls](#ID4EYE)
-   [View Settings](#ID4ELH)

View Controls
=============

**Figure 1.  Monitor view**

![](../../../../resources/k4w_kinectstudio_2dviewcontrols.png)

<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>

Control
Function
Description

View Mode
Displays the view mode and data source.

Settings
Displays the 3D view settings.

Default view
Displays the default view orientation.

Front View
Displays the front view orientation.

Left view
Displays the left view orientation.

Top view
Displays the top view orientation.

Zoom out
Decreases the zoom factor.

Zoom in
Increases the zoom factor.

| ![](../../../../resources/note.gif)Note                                                                                |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| For the Monitor 3D View, the view mode indicates: **MONITOR: NONE** when disconnected or **MONITOR: LIVE** monitoring live sensor streams. For the Playback 3D View, the view mode indicates: **INSPECT: NONE** when no file is open or **INSPECT: FILE** when inspecting or playing the file. |

Image Controls
==============

Displays three-dimensional (spatial) image data.

![](../../../../resources/k4w_kinectstudio_3dimagecontrols.png)

<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>

Control
Function
Description

Settings
Brings up the view settings.

Front view
Displays the front view orientation.

Left view
Displays the left view orientation.

Top view
Displays the top view orientation.

Zoom in
Increases the zoom factor.

Zoom out
Decreases the zoom factor.

<colgroup>
<col width="100%" />
</colgroup>

Note

Rotate the view by dragging over the 3D image. 'Dolly' the view by dragging over the 3D image while holding down the shift key. Pan by using the mouse wheel while holding down the Shift key. Zoom in or out by using the mouse wheel while holding down the Ctrl key.

When the orientation cube under the accessories render plug-in is enabled, the 3D orientation indicator cube in the upper right of the window shows the current orientation.

View Settings
=============

The 3D View Settings let you adjust the settings for individual render plugins. For more information, see [Kinect Studio Render Plugins](Kinect_Studio_Render_Plugins.md).

![](../../../../resources/k4w_kinectstudio_3dviewsettings.png)


text:
#ifndef LIBDICT_RB_TREE_H__
#define LIBDICT_RB_TREE_H__

#include <libdict/tree_common.h>

#include "dict.h"

BEGIN_DECL

typedef struct rb_node rb_node;
struct rb_node
{
    void* key;
    void* datum;
    intptr_t color;
    rb_node* llink;
    rb_node* rlink;
};

#define RB_RED   0
#define RB_BLACK 1

#define PARENT(node) ((rb_node*) ((node)->color & ~RB_BLACK))
#define COLOR(node)  ((node)->color & RB_BLACK)

#define SET_RED(node)       (node)->color &= (~(intptr_t) RB_BLACK)
#define SET_BLACK(node)     (node)->color |= ((intptr_t) RB_BLACK)
#define SET_PARENT(node, p) (node)->color = COLOR(node) | (intptr_t) (p)

typedef struct rb_tree
{
    TREE_FIELDS(rb_node);
} rb_tree;

struct rb_itor
{
    TREE_ITERATOR_FIELDS(rb_tree, rb_node);
};

rb_tree* rb_tree_new(dict_compare_func cmp_func);
dict* rb_dict_new(dict_compare_func cmp_func);
size_t rb_tree_free(rb_tree* tree, dict_delete_func delete_func);

dict_insert_result rb_tree_insert(rb_tree* tree, void* key);
void** rb_tree_search(rb_tree* tree, const void* key);
void** rb_tree_search_le(rb_tree* tree, const void* key);
void** rb_tree_search_lt(rb_tree* tree, const void* key);
void** rb_tree_search_ge(rb_tree* tree, const void* key);
void** rb_tree_search_gt(rb_tree* tree, const void* key);
dict_remove_result rb_tree_remove(rb_tree* tree, const void* key);
size_t rb_tree_clear(rb_tree* tree, dict_delete_func delete_func);
size_t rb_tree_traverse(rb_tree* tree, dict_visit_func visit, void* user_data);
bool rb_tree_select(rb_tree* tree, size_t n, const void** key, void** datum);
size_t rb_tree_count(const rb_tree* tree);
size_t rb_tree_min_path_length(const rb_tree* tree);
size_t rb_tree_max_path_length(const rb_tree* tree);
size_t rb_tree_total_path_length(const rb_tree* tree);
bool rb_tree_verify(const rb_tree* tree);

typedef struct rb_itor rb_itor;

rb_itor* rb_itor_new(rb_tree* tree);
dict_itor* rb_dict_itor_new(rb_tree* tree);
void rb_itor_free(rb_itor* tree);

bool rb_itor_valid(const rb_itor* itor);
void rb_itor_invalidate(rb_itor* itor);
bool rb_itor_next(rb_itor* itor);
bool rb_itor_prev(rb_itor* itor);
bool rb_itor_nextn(rb_itor* itor, size_t count);
bool rb_itor_prevn(rb_itor* itor, size_t count);
bool rb_itor_first(rb_itor* itor);
bool rb_itor_last(rb_itor* itor);
bool rb_itor_search(rb_itor* itor, const void* key);
bool rb_itor_search_le(rb_itor* itor, const void* key);
bool rb_itor_search_lt(rb_itor* itor, const void* key);
bool rb_itor_search_ge(rb_itor* itor, const void* key);
bool rb_itor_search_gt(rb_itor* itor, const void* key);
const void* rb_itor_key(const rb_itor* itor);
void** rb_itor_datum(rb_itor* itor);
int rb_itor_compare(const rb_itor* i1, const rb_itor* i2);
bool rb_itor_remove(rb_itor* itor);

END_DECL

#endif /* !LIBDICT_RB_TREE_H__ */


text:
var App = {}

App.deal = function () {
    App.socket.emit('deal');
}

App.stand = function () {
    App.socket.emit('stand');
}

App.hit = function () {
    App.socket.emit('hit');
}

App.getSuitHtml = function (suit) {
    var image = 'club.png';
    if (suit === 'H') {
        image = 'heart.png';
    } else if (suit === 'S') {
        image = 'spade.png';
    } else if (suit === 'D') {
        image = 'diamond.png';
    }
    return "";
}
App.getRankHtml = function (rank) {
    if (rank === 1) {
        return 'A';
    } else if (rank === 11) {
        return 'J';
    } else if (rank === 12) {
        return 'Q';
    } else if (rank === 13) {
        return 'K';
    }
    return rank;
}
App.getCardsHtml = function (cards) {
    var html = '';
    for (var i = 0; i < cards.length; i++) {

        var card = cards[i];

        html += App.getRankHtml(card.face);
        html += App.getSuitHtml(card.suit);
    }
    return html;
}
App.updatePlayer = function (player) {

    var html = App.getCardsHtml(player.cards);

    $('#playerCards').html(html);
    $('#playerScore').text(player.score);
}
App.updateDealer = function (dealer) {

    var html = App.getCardsHtml(dealer.cards);

    $('#dealerCards').html(html);
    $('#dealerScore').text(dealer.score);
}

App.updateResult = function (result) {
    var displayResult = result;

    if (result === 'None') {
        displayResult = '';
    }
    $('#result').text(displayResult);
}

App.disableButton = function (id) {

    $(id).attr('disabled', 'disabled');
}

App.enableButton = function (id) {
    $(id).removeAttr('disabled');
}
App.disableDeal = function () {
    App.disableButton('#deal');
    App.enableButton('#hit');
    App.enableButton('#stand');
}
App.enableDeal = function () {

    App.enableButton('#deal');
    App.disableButton('#hit');
    App.disableButton('#stand');
}
App.enableDealIfGameFinished = function (result) {
    if (result !== 'None') {
        App.enableDeal();
    }
}
App.dealResult = function (game) {
    App.disableDeal();
    App.updateDealer(game.dealer);
    App.updatePlayer(game.player);
    App.updateResult(game.result);
}
App.hitResult = function (game) {
    App.updateDealer(game.dealer);
    App.updatePlayer(game.player);
    App.updateResult(game.result);
    App.enableDealIfGameFinished(game.result);
}
App.standResult = function (game) {
    App.updateDealer(game.dealer);
    App.updatePlayer(game.player);
    App.updateResult(game.result);
    App.enableDealIfGameFinished(game.result);
}
App.registerClientActions = function () {

    $('#deal').click(function () {
        App.deal();
    });
    $('#stand').click(function () {
        App.stand();
    });
        $('#hit').click(function () {
        App.hit();
    });
}
App.registerServerActions = function () {
    App.socket.on('stand', function (game) {
        App.standResult(game);
    });
    App.socket.on('deal', function (game) {
        App.dealResult(game);
    });
    App.socket.on('hit', function (game) {
        App.hitResult(game);
    });
}

App.getUserName = function()
{
    App.socket.on('connect', function (){
      App.socket.emit('adduser', prompt("What's your name?"));
             });
        var userList = [];
    App.socket.on('update', function (users){
        userList = users;
        $('#user').empty();
        for(var i=0; i<userList.length; i++) {
            $('#user').append("
" + userList[i] + "
");
        }
    });
}
App.init = function () {

    var socket = io.connect('http://localhost:3000');
    App.socket = socket;
    App.registerClientActions();
    App.registerServerActions();
    App.enableDeal();
    App.getUserName();
}

$(document).ready(function () {
    App.init();
});


text:
#ifndef SDL_RGBSURFACE_HH
#define SDL_RGBSURFACE_HH

/*******************************************************************************
 * Handle a Graphical Surface
 ******************************************************************************/

#include "Video/internal/SDLBaseSurface.hh"
#include "Video/Color.hh"
#include "System/SDLRWOps.hh"

namespace SDLut
{
namespace video
{
namespace internal
{

class RGBSurface : public BaseSurface
{
    //To be able to construct RGBSurface from Font :
    friend class Font;
    friend class FontImpl;
    friend class FontExtend;

    //To be able to construct RGBSurface from Loader :
    friend class ImageLoader;

    friend class VideoSurface;

public:
    virtual Renderer getRenderer()
    {
        return SDL;
    }

protected:

    //set to true if the convert to Display format function has been called for this surface.
    bool optimised;

    ///Conversion Constructor
    explicit RGBSurface(SDL_Surface * s) throw (std::logic_error); ///< This one should be called only by friends

    ///Conversion Constructor with explicit ownership transfert
    explicit RGBSurface(std::auto_ptr<SDL_Surface> s) throw (std::logic_error);

public :

    //Constructor
    //BPP should NEVER be == 0 !!!!
    RGBSurface( int width, int height, int bpp,
                bool alpha = false,
                bool colorkey = false,
                bool hardware = false,
                unsigned long r_mask = r_default_mask,
                unsigned long g_mask = g_default_mask,
                unsigned long b_mask = b_default_mask,
                unsigned long a_mask = a_default_mask
              ) throw (std::logic_error);

    RGBSurface( void * pixeldata, int depth, int pitch, int width, int height,
                unsigned long r_mask = r_default_mask,
                unsigned long g_mask = g_default_mask,
                unsigned long b_mask = b_default_mask,
                unsigned long a_mask = a_default_mask
              ) throw (std::logic_error);

    RGBSurface(system::RWOps& rwops) throw (std::logic_error);

public :
    //should be used as the copy constructor. But should also be able to get DisplaySurface as input...
    RGBSurface(const RGBSurface & s ) throw (std::logic_error); // deep copy
    RGBSurface& operator=(const RGBSurface& s);
    //Conversion constructor
    //NB : will get called if the Surface is not RGB only.
    //RGBSurface(const BaseSurface & s ) throw (std::logic_error);
    //RGBSurface& operator=(const BaseSurface& s);

    //Destructor
    virtual ~RGBSurface() {}

    virtual bool resetColorKey(bool ckey, const PixelColor & key, bool rleAccel = true);
    virtual bool resetAlpha(bool alpha, unsigned int value, bool rleAccel = true);

    //Use Standard Colors here
    //setPixel();
    //getPixel();

    /*	void setUpdateRect(int x, int y, int w, int h);
    	int update(void);
    */

    ///Accessor to pixelFormat
    virtual const PixelFormat& getPixelFormat(void) const;

    virtual bool resize(int width, int height);

    bool isSRCColorKeyset(void);
    bool isSRCAlphaset(void);

    PixelColor getColorKey();

    bool isOptimised()
    {
        return optimised;
    }
    virtual bool convertToDisplayFormat(Renderer rend);

    //Beware ! The final blitting rectangle is saved in dest_rect.
    //blit all src into the current surface
    inline bool blit (const RGBSurface& src, Rect& dest_rect)
    {
        Rect src_rect(0,0,src.getWidth(), src.getHeight());
        return blit(src, dest_rect, src_rect);
    }
    //Blit only src_rect of src into the current surface.
    virtual bool blit (const RGBSurface& src, Rect& dest_rect, const Rect& src_rect);

    bool flip(bool vertical = true, bool horizontal = false);

    friend Core::Logger & operator << (Core::Logger & ostr, const RGBSurface & surf);

};

}
}
} //namespace SDLut::SDL

#endif


text:
#include "lksmith.h"
#include "test.h"

#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>

#define THREAD_WRAPPER_VOID(fn) \
static void *fn##_wrap(void *v __attribute__((unused))) { \
	return (void*)(intptr_t)fn(); \
}

#define THREAD_WRAPPER_INT(fn) \
static void *fn##_wrap(void *v) { \
	return (void*)(intptr_t)fn((int)(intptr_t)v); \
}

static pthread_mutex_t g_lock1 = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t g_lock2 = PTHREAD_MUTEX_INITIALIZER;

static sem_t g_inver_sem1;
static sem_t g_inver_sem2;

static int inver_thread_a(void)
{
	EXPECT_ZERO(pthread_mutex_lock(&g_lock1));
	EXPECT_ZERO(pthread_mutex_lock(&g_lock2));
	EXPECT_ZERO(pthread_mutex_unlock(&g_lock2));
	EXPECT_ZERO(sem_post(&g_inver_sem1));
	EXPECT_ZERO(sem_wait(&g_inver_sem2));
	EXPECT_ZERO(pthread_mutex_unlock(&g_lock1));
	return 0;
}

THREAD_WRAPPER_VOID(inver_thread_a);

static int inver_thread_b(void)
{
	EXPECT_ZERO(sem_wait(&g_inver_sem1));
	EXPECT_ZERO(pthread_mutex_lock(&g_lock2));
	EXPECT_EQ(pthread_mutex_trylock(&g_lock1), EBUSY);
	EXPECT_ZERO(sem_post(&g_inver_sem2));
	EXPECT_ZERO(pthread_mutex_unlock(&g_lock2));
	return 0;
}

THREAD_WRAPPER_VOID(inver_thread_b);

static int test_ab_inversion(void)
{
	pthread_t thread_a, thread_b;
	void *rval;

	EXPECT_ZERO(sem_init(&g_inver_sem1, 0, 0));
	EXPECT_ZERO(sem_init(&g_inver_sem2, 0, 0));
	EXPECT_ZERO(pthread_create(&thread_a, NULL, inver_thread_a_wrap, NULL));
	EXPECT_ZERO(pthread_create(&thread_b, NULL, inver_thread_b_wrap, NULL));
	EXPECT_ZERO(pthread_join(thread_a, &rval));
	EXPECT_EQ(rval, NULL);
	EXPECT_ZERO(pthread_join(thread_b, &rval));
	EXPECT_EQ(rval, NULL);
	EXPECT_EQ(find_recorded_error(EDEADLK), 1);
	EXPECT_ZERO(sem_destroy(&g_inver_sem1));
	EXPECT_ZERO(sem_destroy(&g_inver_sem2));
	clear_recorded_errors();

	return 0;
}

static int test_destroy_while_same_thread_has_locked(void)
{
	pthread_mutex_t mutex;
	EXPECT_ZERO(pthread_mutex_init(&mutex, NULL));
	EXPECT_ZERO(pthread_mutex_lock(&mutex));
	EXPECT_EQ(pthread_mutex_destroy(&mutex), EBUSY);
	EXPECT_EQ(find_recorded_error(EBUSY), 1);
	EXPECT_ZERO(pthread_mutex_unlock(&mutex));
	EXPECT_ZERO(pthread_mutex_destroy(&mutex));
	clear_recorded_errors();

	return 0;
}

static sem_t g_test_destroy_sem1;
static sem_t g_test_destroy_sem2;
static pthread_mutex_t g_test_destroy_mutex = PTHREAD_MUTEX_INITIALIZER;

static int test_destroy_helper1(void)
{
	EXPECT_ZERO(pthread_mutex_lock(&g_test_destroy_mutex));
	EXPECT_ZERO(sem_post(&g_test_destroy_sem1));
	EXPECT_ZERO(sem_wait(&g_test_destroy_sem2));
	EXPECT_ZERO(pthread_mutex_unlock(&g_test_destroy_mutex));
	return 0;
}

THREAD_WRAPPER_VOID(test_destroy_helper1);

static int test_destroy_while_other_thread_has_locked(void)
{
	pthread_t thread_c;
	void *rval;

	EXPECT_ZERO(sem_init(&g_test_destroy_sem1, 0, 0));
	EXPECT_ZERO(sem_init(&g_test_destroy_sem2, 0, 0));
	EXPECT_ZERO(pthread_create(&thread_c, NULL,
		test_destroy_helper1_wrap, NULL));
	sem_wait(&g_test_destroy_sem1);
	EXPECT_EQ(pthread_mutex_destroy(&g_test_destroy_mutex), EBUSY);
	EXPECT_EQ(find_recorded_error(EBUSY), 1);
	sem_post(&g_test_destroy_sem2);
	EXPECT_ZERO(pthread_join(thread_c, &rval));
	EXPECT_EQ(rval, NULL);
	EXPECT_ZERO(pthread_mutex_destroy(&g_test_destroy_mutex));
	EXPECT_ZERO(sem_destroy(&g_test_destroy_sem1));
	EXPECT_ZERO(sem_destroy(&g_test_destroy_sem2));
	clear_recorded_errors();
	return 0;
}

static sem_t g_test_bad_unlock_sem1;
static sem_t g_test_bad_unlock_sem2;
static pthread_mutex_t g_test_bad_unlock_mutex;

static int test_bad_unlock_helper1(void)
{
	EXPECT_ZERO(pthread_mutex_lock(&g_test_bad_unlock_mutex));
	EXPECT_ZERO(sem_post(&g_test_bad_unlock_sem1));
	EXPECT_ZERO(sem_wait(&g_test_bad_unlock_sem2));
	EXPECT_ZERO(pthread_mutex_unlock(&g_test_bad_unlock_mutex));
	return 0;
}

THREAD_WRAPPER_VOID(test_bad_unlock_helper1);

static int test_bad_unlock(void)
{
	pthread_t thread_d;
	void *rval;

	EXPECT_ZERO(sem_init(&g_test_bad_unlock_sem1, 0, 0));
	EXPECT_ZERO(sem_init(&g_test_bad_unlock_sem2, 0, 0));
	EXPECT_ZERO(pthread_mutex_init(&g_test_bad_unlock_mutex, NULL));
	EXPECT_ZERO(pthread_create(&thread_d, NULL,
		test_bad_unlock_helper1_wrap, NULL));
	sem_wait(&g_test_bad_unlock_sem1);
	EXPECT_EQ(pthread_mutex_unlock(&g_test_bad_unlock_mutex), EPERM);
	EXPECT_EQ(find_recorded_error(EPERM), 1);
	sem_post(&g_test_bad_unlock_sem2);
	EXPECT_ZERO(pthread_join(thread_d, &rval));
	EXPECT_EQ(rval, NULL);
	EXPECT_ZERO(pthread_mutex_destroy(&g_test_bad_unlock_mutex));
	EXPECT_ZERO(sem_destroy(&g_test_bad_unlock_sem1));
	EXPECT_ZERO(sem_destroy(&g_test_bad_unlock_sem2));
	clear_recorded_errors();
	return 0;
}

#define MAX_BIG_INVERSION_LOCKS 1024

static pthread_mutex_t g_locks[MAX_BIG_INVERSION_LOCKS];
static sem_t g_inver_sem[3];
static unsigned int g_bigenv_threads;

static int big_inversion_thread(int idx)
{
	unsigned int i;
	int next;

	next = (idx + 1) % g_bigenv_threads;
	EXPECT_ZERO(pthread_mutex_lock(&g_locks[idx]));
	EXPECT_ZERO(sem_post(&g_inver_sem[0]));
	if (idx == 0) {
		for (i = 0; i < g_bigenv_threads - 1; i++) {
			EXPECT_ZERO(sem_wait(&g_inver_sem[2]));
		}
		EXPECT_EQ(pthread_mutex_trylock(&g_locks[next]), EBUSY);
		EXPECT_EQ(find_recorded_error(EDEADLK), 1);
	} else {
		EXPECT_ZERO(sem_wait(&g_inver_sem[1]));
		EXPECT_EQ(pthread_mutex_trylock(&g_locks[next]), EBUSY);
		EXPECT_ZERO(sem_post(&g_inver_sem[2]));
		EXPECT_ZERO(pthread_mutex_lock(&g_locks[next]));
		EXPECT_ZERO(pthread_mutex_unlock(&g_locks[next]));
	}
	EXPECT_ZERO(pthread_mutex_unlock(&g_locks[idx]));
	return 0;
}

THREAD_WRAPPER_INT(big_inversion_thread);

static int test_big_inversion(unsigned int num_threads)
{
	unsigned int i;
	pthread_t thread[MAX_BIG_INVERSION_LOCKS];
	void *rval;

	g_bigenv_threads = num_threads;
	for (i = 0; i < sizeof(g_inver_sem)/sizeof(g_inver_sem[0]); i++) {
		EXPECT_ZERO(sem_init(&g_inver_sem[i], 0, 0));
	}
	for (i = 0; i < num_threads; i++) {
		EXPECT_ZERO(pthread_mutex_init(&g_locks[i], NULL));
	}
	for (i = 0; i < num_threads; i++) {
		EXPECT_ZERO(pthread_create(&thread[i], NULL,
			big_inversion_thread_wrap, (void*)(intptr_t)i));
	}
	for (i = 0; i < num_threads; i++) {
		EXPECT_ZERO(sem_wait(&g_inver_sem[0]));
	}
	for (i = 0; i < num_threads - 1; i++) {
		EXPECT_ZERO(sem_post(&g_inver_sem[1]));
	}
	for (i = 0; i < num_threads; i++) {
		EXPECT_ZERO(pthread_join(thread[i], &rval));
		EXPECT_EQ(rval, NULL);
	}
	for (i = 0; i < num_threads; i++) {
		EXPECT_ZERO(pthread_mutex_destroy(&g_locks[i]));
	}
	for (i = 0; i < sizeof(g_inver_sem)/sizeof(g_inver_sem[0]); i++) {
		EXPECT_ZERO(sem_destroy(&g_inver_sem[i]));
	}
	clear_recorded_errors();

	return 0;
}

static int test_take_sleeping_lock_while_holding_spin(void)
{
	pthread_mutex_t mutex;
	pthread_spinlock_t spin;
	EXPECT_ZERO(pthread_mutex_init(&mutex, NULL));
	EXPECT_ZERO(pthread_spin_init(&spin, 0));

	/* taking spin lock while holding mutex-- this is ok */
	EXPECT_ZERO(pthread_mutex_lock(&mutex));
	EXPECT_ZERO(pthread_spin_lock(&spin));
	EXPECT_ZERO(pthread_spin_unlock(&spin));
	EXPECT_ZERO(pthread_mutex_unlock(&mutex));
	EXPECT_EQ(find_recorded_error(EWOULDBLOCK), 0);

	/* taking mutex while holding spin lock-- this is not ok */
	EXPECT_ZERO(pthread_spin_lock(&spin));
	EXPECT_ZERO(pthread_mutex_lock(&mutex));
	EXPECT_ZERO(pthread_mutex_unlock(&mutex));
	EXPECT_ZERO(pthread_spin_unlock(&spin));
	EXPECT_EQ(find_recorded_error(EWOULDBLOCK), 1);

	/* we don't whine about the same problem more than once-- it would
	 * flood the logs */
	EXPECT_ZERO(pthread_spin_lock(&spin));
	EXPECT_ZERO(pthread_mutex_lock(&mutex));
	EXPECT_ZERO(pthread_mutex_unlock(&mutex));
	EXPECT_ZERO(pthread_spin_unlock(&spin));
	EXPECT_EQ(find_recorded_error(EWOULDBLOCK), 0);

	EXPECT_ZERO(pthread_spin_destroy(&spin));
	EXPECT_ZERO(pthread_mutex_destroy(&mutex));
	clear_recorded_errors();

	return 0;
}

static pthread_cond_t g_cond1;
static pthread_mutex_t g_cslock1;

static int cond_signaller1(void)
{
	EXPECT_ZERO(pthread_mutex_lock(&g_cslock1));
	EXPECT_ZERO(pthread_cond_signal(&g_cond1));
	EXPECT_ZERO(pthread_mutex_unlock(&g_cslock1));
	return 0;
}

THREAD_WRAPPER_VOID(cond_signaller1);

static int do_pthread_cond_wait(pthread_cond_t *__restrict cond,
	pthread_mutex_t *__restrict mutex,
	const struct timespec *__restrict ts)
{
	// The main reason for testing both pthread_cond_wait and
	// pthread_cond_timedwait here is to shake out bugs in our usage of
	// dlsym and friends.
	if (!ts) {
		return pthread_cond_wait(cond, mutex);
	}
	return pthread_cond_timedwait(cond, mutex, ts);
}

static int test_invalid_cond_wait(const struct timespec *ts)
{
	pthread_t thread;

	EXPECT_ZERO(pthread_mutex_init(&g_cslock1, NULL));
	EXPECT_ZERO(pthread_cond_init(&g_cond1, NULL));

	/* We must not call pthread_cond_wait on a mutex we don't actually
	 * hold. */
	EXPECT_EQ(do_pthread_cond_wait(&g_cond1, &g_cslock1, ts), EPERM);
	EXPECT_EQ(find_recorded_error(EPERM), 1);

	/* Here is an example of using the API correctly. */
	EXPECT_ZERO(pthread_mutex_lock(&g_cslock1));
	EXPECT_ZERO(pthread_create(&thread, NULL,
		cond_signaller1_wrap, NULL));
	EXPECT_EQ(do_pthread_cond_wait(&g_cond1, &g_cslock1, ts), 0);
	EXPECT_ZERO(pthread_mutex_unlock(&g_cslock1));
	EXPECT_ZERO(pthread_join(thread, NULL));

	/* test that we can destroy the pthread_cond and re-create it. */
	EXPECT_ZERO(pthread_cond_destroy(&g_cond1));
	EXPECT_ZERO(pthread_cond_init(&g_cond1, NULL));
	EXPECT_ZERO(pthread_cond_destroy(&g_cond1));
	EXPECT_ZERO(pthread_mutex_destroy(&g_cslock1));
	return 0;
}

static int test_recursion_on_nonrecursive(void)
{
	pthread_mutexattr_t attr;
	pthread_mutex_t mutex;
	int ty = PTHREAD_MUTEX_NORMAL;

	EXPECT_ZERO(pthread_mutexattr_init(&attr));
	EXPECT_ZERO(pthread_mutexattr_settype(&attr, ty));
	EXPECT_ZERO(pthread_mutex_init(&mutex, &attr));
	EXPECT_ZERO(pthread_mutex_lock(&mutex));
	EXPECT_EQ(pthread_mutex_trylock(&mutex), EBUSY);
	EXPECT_EQ(find_recorded_error(EDEADLK), 1);
	EXPECT_ZERO(pthread_mutex_unlock(&mutex));
	EXPECT_ZERO(pthread_mutexattr_destroy(&attr));
	EXPECT_ZERO(pthread_mutex_destroy(&mutex));
	return 0;
}

static pthread_cond_t g_tbcw_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t g_tbcw_lock1 = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t g_tbcw_lock2 = PTHREAD_MUTEX_INITIALIZER;

static int tbcw_thread1(void)
{
	int ret;

	pthread_mutex_lock(&g_tbcw_lock1);
	ret = pthread_cond_wait(&g_tbcw_cond, &g_tbcw_lock1);
	pthread_mutex_unlock(&g_tbcw_lock1);
	if (ret) {
		pthread_mutex_lock(&g_tbcw_lock2);
		pthread_cond_signal(&g_tbcw_cond);
		pthread_mutex_unlock(&g_tbcw_lock2);
	}
	return ret;
}

THREAD_WRAPPER_VOID(tbcw_thread1);

static int tbcw_thread2(void)
{
	int ret;

	pthread_mutex_lock(&g_tbcw_lock2);
	ret = pthread_cond_wait(&g_tbcw_cond, &g_tbcw_lock2);
	pthread_mutex_unlock(&g_tbcw_lock2);
	if (ret) {
		pthread_mutex_lock(&g_tbcw_lock1);
		pthread_cond_signal(&g_tbcw_cond);
		pthread_mutex_unlock(&g_tbcw_lock1);
	}
	return ret;
}

THREAD_WRAPPER_VOID(tbcw_thread2);

static int test_bad_cond_wait(void)
{
	pthread_t thread_1, thread_2;
	void *rval1 = NULL, *rval2 = NULL;

	EXPECT_ZERO(pthread_create(&thread_1, NULL, tbcw_thread1_wrap, NULL));
	EXPECT_ZERO(pthread_create(&thread_2, NULL, tbcw_thread2_wrap, NULL));
	EXPECT_ZERO(pthread_join(thread_1, &rval1));
	EXPECT_ZERO(pthread_join(thread_2, &rval2));
	if (rval1 == NULL) {
		EXPECT_NOT_EQ(rval2, NULL);
	} else if (rval2 == NULL) {
		EXPECT_NOT_EQ(rval1, NULL);
	} else {
		fprintf(stderr, "expected one of the threads to fail.");
		return EINVAL;
	}
	EXPECT_EQ(find_recorded_error(EINVAL), 1);
	clear_recorded_errors();
	return 0;
}

int main(void)
{
	struct timespec ts;

	set_error_cb(record_error);
	EXPECT_ZERO(test_ab_inversion());
	EXPECT_ZERO(test_destroy_while_same_thread_has_locked());
	EXPECT_ZERO(test_destroy_while_other_thread_has_locked());
	EXPECT_ZERO(test_bad_unlock());
	EXPECT_ZERO(test_big_inversion(3));
	EXPECT_ZERO(test_big_inversion(100));
	EXPECT_ZERO(test_take_sleeping_lock_while_holding_spin());
	EXPECT_ZERO(test_invalid_cond_wait(NULL));
	EXPECT_ZERO(test_invalid_cond_wait(NULL));

	get_current_timespec(&ts);
	ts.tv_sec += 600;
	EXPECT_ZERO(test_invalid_cond_wait(&ts));

	EXPECT_ZERO(test_recursion_on_nonrecursive());

	EXPECT_ZERO(test_bad_cond_wait());

	return EXIT_SUCCESS;
}


text:
package v1

import (
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"

	"github.com/openshift/origin/pkg/quota/apiserver/admission/apis/clusterresourceoverride"
)

func (obj *ClusterResourceOverrideConfig) GetObjectKind() schema.ObjectKind { return &obj.TypeMeta }

var GroupVersion = schema.GroupVersion{Group: "autoscaling.openshift.io", Version: "v1"}

var (
	schemeBuilder = runtime.NewSchemeBuilder(
		addKnownTypes,
		clusterresourceoverride.Install,
	)
	Install = schemeBuilder.AddToScheme
)

func addKnownTypes(scheme *runtime.Scheme) error {
	scheme.AddKnownTypes(GroupVersion,
		&ClusterResourceOverrideConfig{},
	)
	return nil
}


text:
fw_depends python3

pip install --install-option="--prefix=${PY3_ROOT}" -r $TROOT/requirements.txt

gunicorn hello:app -c gunicorn_conf.py &


text:
require 'leafy/core/metric_registry'

RSpec.describe Leafy::Core::MetricRegistry do

  class MetricMock

    def initialize(klass)
      @klass = klass
    end
    def is_a?(klass)
      @klass == klass
    end
  end

  let(:registry) { subject }

  let(:gauge) { MetricMock.new(Leafy::Core::Gauge) }
  let(:counter) { MetricMock.new(Leafy::Core::Counter) }
  let(:timer) { MetricMock.new(Leafy::Core::Timer) }
  let(:histogram) { MetricMock.new(Leafy::Core::Histogram) }
  let(:meter) { MetricMock.new(Leafy::Core::Meter) }

  it 'registeringAGaugeTriggersANotification' do
     expect(registry.register("thing", gauge)).to eq gauge

     #     verify(listener).onGaugeAdded("thing", gauge);
  end

  it 'removingAGaugeTriggersANotification' do
     registry.register("thing", gauge);

     expect(registry.remove("thing")).to eq true

     #      verify(listener).onGaugeRemoved("thing");
  end

  it 'registeringACounterTriggersANotification' do
    expect(registry.register("thing", counter)).to eq counter

    #       verify(listener).onCounterAdded("thing", counter);
  end

  it 'accessingACounterRegistersAndReusesTheCounter' do
    counter1 = registry.counter("thing");
    counter2 = registry.counter("thing");

    expect(counter1).to equal counter2

    #        verify(listener).onCounterAdded("thing", counter1);
  end

  it 'removingACounterTriggersANotification' do
    registry.register("thing", counter);

    expect(registry.remove("thing")).to eq true

    #      verify(listener).onCounterRemoved("thing");
  end

  it 'registeringAHistogramTriggersANotification' do
    expect(registry.register("thing", histogram)).to eq histogram

    #       verify(listener).onHistogramAdded("thing", histogram);
  end

  it 'accessingAHistogramRegistersAndReusesIt' do
    histogram1 = registry.histogram("thing");
    histogram2 = registry.histogram("thing");

    expect(histogram1).to be histogram2

    #        verify(listener).onHistogramAdded("thing", histogram1);
  end

  it 'removingAHistogramTriggersANotification' do
    registry.register("thing", histogram);

    expect(registry.remove("thing")).to eq true

    #      verify(listener).onHistogramRemoved("thing");
  end

  it 'registeringAMeterTriggersANotification' do
    expect(registry.register("thing", meter)).to eq meter

    #       verify(listener).onMeterAdded("thing", meter);
  end

  it 'accessingAMeterRegistersAndReusesIt' do
    meter1 = registry.meter("thing");
    meter2 = registry.meter("thing");

    expect(meter1).to be meter2

    #        verify(listener).onMeterAdded("thing", meter1);
  end

  it 'removingAMeterTriggersANotification' do
    registry.register("thing", meter);

    expect(registry.remove("thing")).to eq true

    #     verify(listener).onMeterRemoved("thing");
  end

  it 'registeringATimerTriggersANotification' do
    expect(registry.register("thing", timer)).to eq timer

    #      verify(listener).onTimerAdded("thing", timer);
  end

  it 'accessingATimerRegistersAndReusesIt' do
    timer1 = registry.timer("thing");
    timer2 = registry.timer("thing");

    expect(timer1).to be timer2

    #       verify(listener).onTimerAdded("thing", timer1);
  end

  it 'removingATimerTriggersANotification' do
    registry.register("thing", timer);

    expect(registry.remove("thing")).to eq true

    #        verify(listener).onTimerRemoved("thing");
  end

  it 'hasAMapOfRegisteredGauges' do
    registry.register("gauge", gauge)

    expect(registry.gauges['gauge']).to eq gauge
  end

  it 'hasAMapOfRegisteredCounters' do
    registry.register("counter", counter);

    expect(registry.counters['counter']).to eq counter
  end

  it 'hasAMapOfRegisteredHistograms' do
    registry.register("histogram", histogram);

    expect(registry.histograms['histogram']).to eq histogram
  end

  it 'hasAMapOfRegisteredMeters' do
    registry.register("meter", meter);

    expect(registry.meters['meter']).to eq meter
  end

  it 'hasAMapOfRegisteredTimers' do
    registry.register("timer", timer);

    expect(registry.timers['timer']).to eq timer
  end

  it 'hasASetOfRegisteredMetricNames' do
    registry.register("gauge", gauge);
    registry.register("counter", counter);
    registry.register("histogram", histogram);
    registry.register("meter", meter);
    registry.register("timer", timer);

    expect(registry.names).to match_array ["gauge", "counter", "histogram", "meter", "timer"]
  end
end


text:
module RuboCop
  module Cop
    module Lint
      # This lint sees if there is a mismatch between the number of
      # expected fields for format/sprintf/#% and what is actually
      # passed as arguments.
      #
      # @example
      #
      #   format('A value: %s and another: %i', a_value)
      #
      class FormatParameterMismatch < Cop
        # http://rubular.com/r/HdWs2uXZv4
        MSG = 'Number arguments (%i) to `%s` mismatches expected fields (%i).'
        FIELDS_REGEX = /%([\s#+-0\*])?([0-9]*)?(.[0-9]+)?[bBdiouxXeEfgGacps]/

        def fields_regex
          FIELDS_REGEX
        end

        def on_send(node)
          add_offense(node, :selector) if offending_node?(node)
        end

        private

        def offending_node?(node)
          if sprintf?(node) || format?(node) || percent?(node)
            num_of_args_for_format, num_of_expected_fields = count_matches(node)
            num_of_expected_fields != num_of_args_for_format
          else
            false
          end
        end

        def count_matches(node)
          receiver_node, _method_name, *args = *node

          if sprintf?(node) || format?(node)
            number_of_args_for_format = (args.size - 1)
            number_of_expected_fields = expected_fields(args.first).size
          elsif percent?(node)
            number_of_args_for_format = args.first.child_nodes.size
            number_of_expected_fields = expected_fields(receiver_node).size
          end

          [number_of_args_for_format, number_of_expected_fields]
        end

        def format_method?(name, node)
          receiver, method_name, *args = *node

          # commands have no explicit receiver
          return false unless !receiver && method_name == name

          args.size > 1 && :str == args.first.type
        end

        def expected_fields(node)
          node
            .loc
            .expression
            .source
            .scan(FIELDS_REGEX)
        end

        def format?(node)
          format_method?(:format, node)
        end

        def sprintf?(node)
          format_method?(:sprintf, node)
        end

        def percent?(node)
          receiver_node, method_name, *arg_nodes = *node

          method_name == :% &&
            ([:str, :dstr].include?(receiver_node.type) ||
             arg_nodes[0].type == :array)
        end

        def message(node)
          _receiver, method_name, *_args = *node
          num_args_for_format, num_expected_fields = count_matches(node)

          method_name = 'String#%' if '%' == method_name.to_s
          format(MSG, num_args_for_format, method_name, num_expected_fields)
        end
      end
    end
  end
end


text:
const express = require('express');
const router = new express.Router();
const db = require('../../database/index.js');
const hashUtils = require('./hashUtils.js');

// - validates the signup form. The 'payload' parameter is given by the data passed in by the post
// request
// - returns an object that contains success (bool), message (string), and errors (object that
// contains error strings, which are displayed on the form)
var validateSignupForm = function(payload) {
  const errors = {};
  let isFormValid = true;
  let message = '';

  if (!payload || typeof payload.houseName !== 'string' || payload.houseName.trim().length === 0) {
    isFormValid = false;
    errors.houseName = 'Please provide a house name.';
    if (payload.houseName.trim().length > 64) {
      errors.houseName = 'House name cannot be greater than 64 characters.';
    }
  }

  if (!payload || typeof payload.password !== 'string' || payload.password.trim().length < 8) {
    isFormValid = false;
    errors.password = 'Password must have at least 8 characters.';
  }

  if (!isFormValid) {
    message = 'Check the form for errors.';
  }

  return {
    success: isFormValid,
    message,
    errors
  };
};

// same as signup form
var validateLoginForm = function(payload) {
  const errors = {};
  let isFormValid = true;
  let message = '';

  if (!payload || typeof payload.houseName !== 'string' || payload.houseName.trim().length === 0) {
    isFormValid = false;
    errors.houseName = 'Please provide a house name.';
  }

  if (!payload || typeof payload.password !== 'string' || payload.password.trim().length < 8) {
    isFormValid = false;
    errors.password = 'Password must have at least 8 characters.';
  }

  if (!isFormValid) {
    message = 'Check the form for errors.';
  }

  return {
    success: isFormValid,
    message,
    errors
  };
};

router.post('/signup', (req, res, next) => {
  const validationResult = validateSignupForm(req.body);
  if (!validationResult.success) {
    return res.status(400).json({
      success: false,
      message: validationResult.message,
      errors: validationResult.errors
    });
  } else {

    // check if house name has already been taken
    var sql = 'SELECT * FROM houses WHERE housename = \'${houseName#}\'';
    db.query(sql, {houseName: req.body.houseName})
    .then((houseData) => {
      console.log('House data retrieved:', houseData);

      // if no house found in db, return error message
      if (houseData.length > 0) {
        return res.status(400).json({
          success: false,
          message: 'House name already taken.'
        });
      }

      //generate salt and hash
      hashUtils.salt(32, (err, salt) => {
        if (err) {
          console.error(err);
          return;
        }
        var saltString = salt.toString('hex');
        var hashedPW = hashUtils.hash('sha256').update(req.body.password + saltString).digest('hex');

        // write to database
        var sql = 'INSERT INTO houses (housename, password, salt) VALUES ($1, $2, $3);';

        db.query(sql, [req.body.houseName, hashedPW, saltString])
        .then((data) => {
          console.log('House written to DB successfully:', data);
        })
        .catch((err) => {
          console.log('Cannot write house to DB:', err);
        });
      });

      // return res with a 'signup successful' message
      return res.status(200).json({
        success: true,
        message: 'Sign up successful! Please log in with your new account.'
      });

    })
    .catch((err) => {
      console.log('Error retrieving house data:', err);
    });
  }
});

router.post('/login', (req, res, next) => {
  const validationResult = validateLoginForm(req.body);
  if (!validationResult.success) {
    return res.status(400).json({
      success: false,
      message: validationResult.message,
      errors: validationResult.errors
    });
  } else {
    // get house, password, and salt from database using houseName
    var houseQuery = 'SELECT * FROM houses WHERE housename = ${houseName}';
    db.one(houseQuery, {houseName: req.body.houseName})
    .then((houseData) => {
      console.log('House data retrieved:', houseData);

      // use salt and password input to generate hash
      var inputHash = hashUtils.hash('sha256').update(req.body.password + houseData.salt).digest('hex');

      // compare new hash to hash in database
      if (inputHash === houseData.password) {
        console.log('Passwords match');

        // check if a user exists
        var userQuery = 'SELECT * FROM users WHERE house_id=${houseId#}';
        db.query(userQuery, {houseId: houseData.id})
        .then((usersData) => {
          console.log('Users retrieved:', usersData);

          // update session with houseId
          var currentSeshId = req.cookies.fridgrSesh.id;
          var sessionQuery = 'UPDATE sessions SET house_id = ${houseId#} WHERE id = ${sessionId#}';
          db.query(sessionQuery, {houseId: houseData.id, sessionId: currentSeshId})
          .then((sessionData) => {
            console.log('Session updated with houseId:', sessionData);

            // add houseId to cookie
            var currentCookie = req.cookies.fridgrSesh;
            currentCookie['houseId'] = houseData.id;
            res.cookie('fridgrSesh', currentCookie);
            res.status(200).json(usersData);
          })
          .catch((err) => {
            console.log('Error updating session with houseId:', err);
          });
        })
        .catch((err) => {
          console.log('Error retrieving users:', err);
        });
      } else {
        console.log('Passwords do not match');
        // if no match, return error
        return res.status(401).json({
          success: false,
          message: 'Incorrect house name or password.'
        });
      }
    })
    .catch((err) => {
      console.log('Error retrieving house data:', err);

      // if no house found in db, return error message
      if (err.code === 0) {
        return res.status(400).json({
          success: false,
          message: 'Incorrect house name or password.'
        });
      }
    });
  }
});

router.post('/logout', (req, res, next) => {
  var currentSeshId = req.cookies.fridgrSesh.id;

  // clear out houseId and userId from cookie
  var currentCookie = req.cookies.fridgrSesh;
  delete currentCookie['houseId'];
  delete currentCookie['userId'];
  res.cookie('fridgrSesh', currentCookie);
  console.log('Credentials cleared from cookie');

  // clear out houseId and userId from session
  var sessionQuery = 'UPDATE sessions SET house_id = NULL, user_id = NULL WHERE id = ${sessionId#}';
  db.query(sessionQuery, {sessionId: currentSeshId})
  .then((sessionData) => {
    console.log('Credentials removed from session:', sessionData);

    return res.status(200).json({
      success: true,
      message: 'Logout successful!'
    });
  })
  .catch((err) => {
    console.log('Error occurred while clearing credentials from session:', err);
  });
});

module.exports = router;


text:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:textSize="16sp" >

    <TextView android:id="@+id/source"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
		android:textAppearance="?android:attr/textAppearanceLarge"
		/>
    <TextView android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:text=" ⇨ "
	    android:textAppearance="?android:attr/textAppearanceMedium"
		/>
    <TextView android:id="@+id/destination"
	    android:layout_width="fill_parent"
	    android:layout_height="wrap_content"
	   	android:textAppearance="?android:attr/textAppearanceLarge"
		/>

</LinearLayout>


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="Better View Nursery and Primary, Day and Boarding School next to Freedom City. Located in Najjanankumbi, 5KM along Entebbe Road. We strive to empower our pupils to be responsible, contributing members of the Ugandan community.">
        <meta name="author" content="Simon Katz">
        <meta http-equiv="cache-control" content="public, max-age=14400">
        <meta name="keywords" CONTENT="Better View, Better view school, better view nursery, better view primary, entebbe road school, Najjanankumbi school, freedom city school.">

        <title>Better View School.</title>

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

        <link rel="stylesheet" href="./css/bootstrap.min.css">

        <link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
        <link rel="stylesheet" href="./css/font-awesome.min.css">

        <link rel="stylesheet" href="./css/et-line-icons.css">

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

        <link rel="stylesheet" href="css/themify-icons.css">

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

        <link rel="stylesheet" href="./css/magnific-popup.css">

        <link rel="stylesheet" href="./css/swiper.min.css">

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

Better View School

Better to learn

Primary

Morning assembly

Nursery

Graduation day

Day Care

8months - 2years

Boarding

Dormitory Facility

                                  Primary School

Creating a well rounded pupil is what we strive for. We educate our children in and out of class.
We have extra curricular activities such as debate, sports, swimming and cultural dances to further learning.

                                  Nursery School

Our teachers approach educating our toddlers with patience, love and care; just like a parent would.
We balance out class time with play time to build social and communication skills as they grow.

Day Care

From 8months to 2years old, we provide day care for parents who want their children to get a headstart. The earlier they start, the earlier they learn language and social skills while they play with the numerous toys we have.

Boarding

Our facilities can accomodate over 150 pupils with room for expansion already on plan. We encourage parents interested in the borading section to visit us for a personal tour and impression of our school.

We are Better View School.

                                    Our goal is to provide a culture of academic excellence and instill within pupils a love of learning academically and socially.

                                    We strive to empower them to be responsible, contributing members of our community.

Our Location & Hours

Better View School

Next to freedom City

P.O.Box 7763, Kampala

Phone : (0414) 510-213

BetterViewSchool@yahoo.com

Primary

Monday - Friday

8:00am - 4:00pm

Nursery

Monday - Friday

Full Day 8:00am - 4:00pm

Half Day 8:00am - 12:30pm

Day Care

Monday - Friday

8:00am - 3:00pm

                                                                  Sports

                                                                  Computer Classes

                                                                  Our Ballet Dancers

                                                                  Swimming Classes

                                                                  School Choir

                                                                  Birthday Parties

                                                                  Swings and Slides

                                AIMS

Meeting the elementary education needs of the next generation in our economy. Creating a safe and fun learning environment while providing jobs for qualified Ugandans.

                                RELIGION

We consider religion to be a priority. We believe our God is a God of vision. We have respect for all recorgnized religions and pupils are taught to be God fearing and God Loving

                                HEALTH

The school has a qualified and experienced nurse to cater to the health of our pupils. Each child is reqiured to come with an immunisation card to track health and development.

                                TRANSPORT

The school currently has eight vans for transporting our children to and from school. Contact us for transport arrangements if you live in the area

Contact Us

(0414) 510-213

(0772) 426-731

(0754) 426-731

Location:

Najjanankumbi, 5KM along Entebbe Road.

Next to freedom City

Better View School

P.O.Box 7763, Kampala

BetterViewSchool@yahoo.com

                                                  <form name="sentMessage" id="contactForm" novalidate>

                                                                  <input type="text" class="big-input bg-transparent text-white" placeholder="Your Name *" id="name" required data-validation-required-message="Please enter your name.">

                                                                  <input type="email" class="big-input bg-transparent text-white" placeholder="Your Email *" id="email" required data-validation-required-message="Please enter your email address.">

                                                                  <input type="tel" class="big-input bg-transparent text-white" placeholder="Your Phone *" id="phone" required data-validation-required-message="Please enter your phone number.">

                                                                  <textarea class="big-textarea bg-transparent text-white" rows="9" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea>

                                                              <button type="submit" class="btn btn-rounded btn-medium">Send Message</button>

                                                  </form>


text:
//
//  YWHomeCell.h
//  YueSheng
//
//  Created by yellow on 16/7/18.
//  Copyright © 2016年 yellow. All rights reserved.
//

#import <UIKit/UIKit.h>

@class YWHomeStatus;

@interface YWHomeCell : UITableViewCell

/**
 *  通过一个tableView来创建一个cell
 */
+ (instancetype)cellWithTableView:(UITableView *)tableView;

/**
 *  首页模型
 */
@property (nonatomic, strong) YWHomeStatus *status;

@end


text:
package edu.umn.biomedicus.vocabulary;

import edu.umn.biomedicus.common.utilities.Patterns;
import edu.umn.biomedicus.exc.BiomedicusException;
import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import java.util.regex.Pattern;
import javax.inject.Singleton;
import org.rocksdb.Options;
import org.rocksdb.RocksDB;
import org.rocksdb.RocksDBException;

@Singleton
public class RocksDbVocabularyBuilder extends VocabularyBuilder {
  private static final Pattern MORE_THAN_TWO_NUMBERS_IN_A_ROW = Pattern.compile("[\\p{Nd}]{3,}");

  private RocksDbTermIndexBuilder words;

  private RocksDbTermIndexBuilder terms;

  private RocksDbTermIndexBuilder norms;

  @Override
  void setOutputPath(Path outputPath) {
    try {
      Files.createDirectories(outputPath);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    try (Options options = new Options().setCreateIfMissing(true).prepareForBulkLoad()){
      try {
        words = new RocksDbTermIndexBuilder(
            RocksDB.open(options, outputPath.resolve("wordsTerms").toString()),
            RocksDB.open(options, outputPath.resolve("wordsIndices").toString()));
        terms = new RocksDbTermIndexBuilder(
            RocksDB.open(options, outputPath.resolve("termsTerms").toString()),
            RocksDB.open(options, outputPath.resolve("termsIndices").toString()));
        norms = new RocksDbTermIndexBuilder(
            RocksDB.open(options, outputPath.resolve("normsTerms").toString()),
            RocksDB.open(options, outputPath.resolve("normsIndices").toString()));
      } catch (RocksDBException e) {
        throw new RuntimeException(e);
      }
    }
  }

  @Override
  TermIndexBuilder createWordsIndexBuilder() {
    return words;
  }

  @Override
  TermIndexBuilder createTermsIndexBuilder() {
    return terms;
  }

  @Override
  TermIndexBuilder createNormsIndexBuilder() {
    return norms;
  }

  @Override
  public void doShutdown() throws BiomedicusException {
    List<Exception> exceptions = new ArrayList<>();
    try {
      if (words != null) {
        words.close();
      }
    } catch (Exception e) {
      exceptions.add(e);
    }
    try {
      if (terms != null) {
        terms.close();
      }
    } catch (Exception e) {
      exceptions.add(e);
    }
    try {
      if (norms!= null) {
        norms.close();
      }
    } catch (Exception e) {
      exceptions.add(e);
    }

    if (exceptions.size() > 0) {
      BiomedicusException exception = new BiomedicusException("Failed to close RocksDB builders.");
      exceptions.forEach(exception::addSuppressed);
      throw exception;
    }
  }

  private static class RocksDbTermIndexBuilder implements TermIndexBuilder, Closeable {
    private final TreeSet<String> termSet = new TreeSet<>();
    private final RocksDB terms;
    private final RocksDB indices;

    public RocksDbTermIndexBuilder(RocksDB terms, RocksDB indices) {
      this.terms = terms;
      this.indices = indices;
    }

    @Override
    public void addTerm(String term) {
      if (MORE_THAN_TWO_NUMBERS_IN_A_ROW.matcher(term).find()) {
        return;
      }

      if (!termSet.contains(term) && Patterns.A_LETTER_OR_NUMBER.matcher(term).find()) {
        termSet.add(term);
      }
    }

    @Override
    public void doWrite() {
      int i = 0;
      for (String s : termSet) {
        byte[] termBytes = s.getBytes(StandardCharsets.UTF_8);
        byte[] indexBytes = ByteBuffer.allocate(4).putInt(i).array();
        try {
          terms.put(indexBytes, termBytes);
          indices.put(termBytes, indexBytes);
        } catch (RocksDBException e) {
          throw new RuntimeException(e);
        }
        i = Math.incrementExact(i);
      }
    }

    @Override
    public void close() {
      terms.close();
      indices.close();
    }
  }
}


text:
require 'rspec'
require 'yaml'
require 'kappa'
require 'common'
require 'uri'

include Twitch::V2

describe Twitch::V2::Team do
  before do
    WebMocks.load_dir(fixture('team'))
  end

  after do
    WebMock.reset!
  end

  describe '.new' do
    it 'can be created from a hash' do
      hash = yaml_load('team/eg.yml')
      t = Team.new(hash)
      expect(t.id).to eq(hash['_id'])
      expect(t.logo_url).to eq(hash['logo'])
      expect(t.display_name).to eq(hash['display_name'])
      expect(t.background_url).to eq(hash['background'])
      expect(t.updated_at.class).to eq(Time)
      expect(t.updated_at).to be < Time.now
      expect(t.updated_at.utc?).to be_truthy
      expect(t.created_at.class).to eq(Time)
      expect(t.created_at).to be < Time.now
      expect(t.created_at.utc?).to be_truthy
      expect(t.info).to eq(hash['info'])
      expect(t.banner_url).to eq(hash['banner'])
      expect(t.name).to eq(hash['name'])
    end
  end

  describe '#url' do
    it 'should return a valid URI' do
      t = Twitch.teams.get('teamliquid')
      expect(t).not_to be_nil
      u = t.url
      expect(u).not_to be_nil
      uri = URI.parse(u)
      expect(uri.class).to eq(URI::HTTP)
    end
  end
end

describe Twitch::V2::Teams do
  before do
    WebMocks.load_dir(fixture('team'))
  end

  after do
    WebMock.reset!
  end

  describe '#get' do
    it 'creates a Team from team name' do
      t = Twitch.teams.get('teamliquid')
      expect(t).not_to be_nil
    end

    it 'returns nil when team does not exist' do
      t = Twitch.teams.get('does_not_exist')
      expect(t).to be_nil
    end
  end

  describe '#all' do
    it 'returns all teams by default' do
      t = Twitch.teams.all
      expect(t.count).to eq(486)
    end

    it 'returns a limited number of teams when specified' do
      t = Twitch.teams.all(:limit => 10)
      expect(t.count).to eq(10)
    end
  end
end


text:
date: 2022-11-25T14:49:58-04:00
description: "An open source machine learning library for Python"
tags: [ "python-ml-libs" ]
title: "Scikit-learn Python Library"
---

# Scikit-learn

**Scikit-learn** is an [open source](open-source-software.md) [Python](python.md) [library](python-ml-libs.md) that efficiently implements multiple [machine learning](machine-learning.md) algorithms for [classification](ml-supervised-classification-learning.md), [regression](ml-supervised-regression-learning.md), and clustering.

## Scikit-learn resources

* [Official scikit-learn website](https://scikit-learn.org/)
* [Scikit-learn GitHub repository](https://github.com/scikit-learn/scikit-learn)


text:
import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import withStyles from 'isomorphic-style-loader/withStyles';
import s from './Headline.css';

class Headline extends React.Component {
  static propTypes = {
    children: PropTypes.element.isRequired,
  };

  render() {
    const { children } = this.props;
    return
{children}
;
  }
}

export default withStyles(s)(Headline);


text:
module.exports = {

    getMeta: function(meta) {

        if (meta.title && meta.title.toLowerCase().indexOf('wordpress.com') == -1) {
            // Aparently, WordPress.com is using title field incorrectly.
            return {
                title: meta.title
            };
        }
    },

    highestPriority: true
    // Example - http://www.wired.com/business/2013/10/slow-nextdoor-raises-fast-money/
};


text:
import argparse
import sys
import glob
import ezdxf
from ezdxf import recover
from ezdxf.addons import Importer

def fixed_by_ezdxf(filename):
    new_filename = filename.replace(".dxf", ".fix.dxf")
    # The original file is only readable but not to fix!
    doc, auditor = recover.readfile(filename)
    # Create a new valid DXF document:
    doc2 = ezdxf.new()
    # Import data into new document:
    importer = Importer(doc, doc2)
    importer.import_modelspace()
    importer.finalize()
    doc2.saveas(new_filename)
    print(f'saved fixed DXF file "{new_filename}"')

def recover_by_ezdxf(filename):
    # The original file is only readable but not to fix!
    new_filename = filename.replace(".dxf", ".rec.dxf")
    doc, auditor = recover.readfile(filename)
    doc.saveas(new_filename)
    print(f'saved recovered DXF file "{new_filename}"')

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "file",
        metavar="FILE",
        nargs="+",
        help='DXF file to fix, wildcards "*" and "?" are supported',
    )
    args = parser.parse_args(sys.argv[1:])
    for pattern in args.file:
        for filename in glob.glob(pattern):
            # Injecting the subclass markers is no longer necessary due to the
            # use of the simple_dxfattribs_loader().
            recover_by_ezdxf(filename)
            fixed_by_ezdxf(filename)

# This fixes are specific to the DXF file provided for issue #604
if __name__ == "__main__":
    main()


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;
using Azure.Core.Pipeline;
using Microsoft.Identity.Client;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Azure.Identity
{
    /// <summary>
    /// Enables authentication to Azure Active Directory using a client secret that was generated for an App Registration. More information on how
    /// to configure a client secret can be found here:
    /// https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-configure-app-access-web-apis#add-credentials-to-your-web-application
    /// </summary>
    public class ClientSecretCredential : TokenCredential
    {
        private readonly MsalConfidentialClient _client;
        private readonly CredentialPipeline _pipeline;

        /// <summary>
        /// Gets the Azure Active Directory tenant (directory) Id of the service principal
        /// </summary>
        internal string TenantId { get; }

        /// <summary>
        /// Gets the client (application) ID of the service principal
        /// </summary>
        internal string ClientId { get; }

        /// <summary>
        /// Gets the client secret that was generated for the App Registration used to authenticate the client.
        /// </summary>
        internal string ClientSecret { get; }

        /// <summary>
        /// Protected constructor for mocking.
        /// </summary>
        protected ClientSecretCredential()
        {
        }

        /// <summary>
        /// Creates an instance of the ClientSecretCredential with the details needed to authenticate against Azure Active Directory with a client secret.
        /// </summary>
        /// <param name="tenantId">The Azure Active Directory tenant (directory) Id of the service principal.</param>
        /// <param name="clientId">The client (application) ID of the service principal</param>
        /// <param name="clientSecret">A client secret that was generated for the App Registration used to authenticate the client.</param>
        public ClientSecretCredential(string tenantId, string clientId, string clientSecret)
            : this(tenantId, clientId, clientSecret, null, null, null)
        {
        }

        /// <summary>
        /// Creates an instance of the ClientSecretCredential with the details needed to authenticate against Azure Active Directory with a client secret.
        /// </summary>
        /// <param name="tenantId">The Azure Active Directory tenant (directory) Id of the service principal.</param>
        /// <param name="clientId">The client (application) ID of the service principal</param>
        /// <param name="clientSecret">A client secret that was generated for the App Registration used to authenticate the client.</param>
        /// <param name="options">Options that allow to configure the management of the requests sent to the Azure Active Directory service.</param>
        public ClientSecretCredential(string tenantId, string clientId, string clientSecret, ClientSecretCredentialOptions options)
            : this(tenantId, clientId, clientSecret, options, null, null)
        {
        }

        /// <summary>
        /// Creates an instance of the ClientSecretCredential with the details needed to authenticate against Azure Active Directory with a client secret.
        /// </summary>
        /// <param name="tenantId">The Azure Active Directory tenant (directory) Id of the service principal.</param>
        /// <param name="clientId">The client (application) ID of the service principal</param>
        /// <param name="clientSecret">A client secret that was generated for the App Registration used to authenticate the client.</param>
        /// <param name="options">Options that allow to configure the management of the requests sent to the Azure Active Directory service.</param>
        public ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options)
            : this(tenantId, clientId, clientSecret, options, null, null)
        {
        }

        internal ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
        {
            TenantId = tenantId ?? throw new ArgumentNullException(nameof(tenantId));

            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            ClientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret));

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalConfidentialClient(_pipeline, tenantId, clientId, clientSecret, options as ITokenCacheOptions);
        }

        /// <summary>
        /// Obtains a token from the Azure Active Directory service, using the specified client secret to authenticate. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.
        /// </summary>
        /// <param name="requestContext">The details of the authentication request.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        /// <returns>An <see cref="AccessToken"/> which can be used to authenticate service client calls.</returns>
        public override async ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default)
        {
            using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext);

            try
            {
                AuthenticationResult result = await _client.AcquireTokenForClientAsync(requestContext.Scopes, true, cancellationToken).ConfigureAwait(false);

                return scope.Succeeded(new AccessToken(result.AccessToken, result.ExpiresOn));
            }
            catch (Exception e)
            {
                throw scope.FailWrapAndThrow(e);
            }
        }

        /// <summary>
        /// Obtains a token from the Azure Active Directory service, using the specified client secret to authenticate. This method is called automatically by Azure SDK client libraries. You may call this method directly, but you must also handle token caching and token refreshing.
        /// </summary>
        /// <param name="requestContext">The details of the authentication request.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        /// <returns>An <see cref="AccessToken"/> which can be used to authenticate service client calls.</returns>
        public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default)
        {
            using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext);

            try
            {
                AuthenticationResult result = _client.AcquireTokenForClientAsync(requestContext.Scopes, false, cancellationToken).EnsureCompleted();

                return scope.Succeeded(new AccessToken(result.AccessToken, result.ExpiresOn));
            }
            catch (Exception e)
            {
                throw scope.FailWrapAndThrow(e);
            }
        }
    }
}


text:
using System;

using Oxide.Core;
using Oxide.Core.Plugins;

namespace Oxide.Plugins
{
    public class Timer
    {
        private Core.Libraries.Timer.TimerInstance instance;

        public Timer(Core.Libraries.Timer.TimerInstance instance)
        {
            this.instance = instance;
        }

        /// <summary>
        /// Gets the number of repetitions left on this timer
        /// </summary>
        public int Repetitions => instance.Repetitions;

        /// <summary>
        /// Gets the delay between each repetition
        /// </summary>
        public float Delay => instance.Delay;

        /// <summary>
        /// Gets the callback delegate
        /// </summary>
        public Action Callback => instance.Callback;

        /// <summary>
        /// Gets if this timer has been destroyed
        /// </summary>
        public bool Destroyed => instance.Destroyed;

        /// <summary>
        /// Gets the plugin to which this timer belongs, if any
        /// </summary>
        public Plugin Owner => instance.Owner;

        /// <summary>
        /// Destroys this timer
        /// </summary>
        public void Destroy() => instance.Destroy();
    }

    public class PluginTimers
    {
        private Core.Libraries.Timer timer = Interface.Oxide.GetLibrary<Core.Libraries.Timer>("Timer");
        private Plugin plugin;

        public PluginTimers(Plugin plugin)
        {
            this.plugin = plugin;
        }

        /// <summary>
        /// Creates a timer which fires once after the specified delay
        /// </summary>
        /// <param name="seconds"></param>
        /// <param name="callback"></param>
        public Timer Once(float seconds, Action callback)
        {
            return new Timer(timer.Once(seconds, callback, plugin));
        }

        /// <summary>
        /// Creates a timer which fires once after the specified delay
        /// </summary>
        /// <param name="seconds"></param>
        /// <param name="callback"></param>
        public Timer In(float seconds, Action callback)
        {
            return new Timer(timer.Once(seconds, callback, plugin));
        }

        /// <summary>
        /// Creates a timer which continuously fires at the specified interval
        /// </summary>
        /// <param name="interval"></param>
        /// <param name="callback"></param>
        public Timer Every(float interval, Action callback)
        {
            return new Timer(timer.Repeat(interval, -1, callback, plugin));
        }

        /// <summary>
        /// Creates a timer which fires a set number of times at the specified interval
        /// </summary>
        /// <param name="interval"></param>
        /// <param name="repeats"></param>
        /// <param name="callback"></param>
        public Timer Repeat(float interval, int repeats, Action callback)
        {
            return new Timer(timer.Repeat(interval, repeats, callback, plugin));
        }
    }
}


text:
package com.nhl.link.move.runtime.json.query.script;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.nhl.link.move.LmRuntimeException;
import com.nhl.link.move.runtime.json.query.BaseQuery;
import com.nhl.link.move.runtime.json.query.JsonNodeWrapper;
import com.nhl.link.move.runtime.json.query.JsonQuery;
import com.nhl.link.move.runtime.json.query.Utils;

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

abstract class BinaryOp extends BaseQuery {

    private static final List<JsonNodeWrapper> TRUE, FALSE;

    static {
        TRUE = Collections.singletonList(Utils.createWrapperNode(null, JsonNodeFactory.instance.booleanNode(true)));
        FALSE = Collections.singletonList(Utils.createWrapperNode(null, JsonNodeFactory.instance.booleanNode(false)));
    }

    private JsonQuery lhsValueQuery, rhsValueQuery;

    BinaryOp(JsonQuery lhsValueQuery, JsonQuery rhsValueQuery) {

        if (lhsValueQuery == null || rhsValueQuery == null) {
            throw new RuntimeException("Both left-hand and right-hand sides must be present");
        }

        this.lhsValueQuery = lhsValueQuery;
        this.rhsValueQuery = rhsValueQuery;
    }

    protected abstract boolean apply(JsonNode lhsValue, JsonNode rhsValue);

    @Override
    public final List<JsonNodeWrapper> doExecute(JsonNode rootNode, JsonNodeWrapper currentNode) {

        List<JsonNodeWrapper> leftResult = lhsValueQuery.execute(rootNode, currentNode);
        List<JsonNodeWrapper> rightResult = rhsValueQuery.execute(rootNode, currentNode);

        if (leftResult.isEmpty() || rightResult.isEmpty()) {
            return FALSE;
        }

        for (JsonNodeWrapper leftValue : leftResult) {
            if (Utils.isValueMissing(leftValue)) {
                return FALSE;
            }
            if (!leftValue.getNode().isValueNode()) {
                throw new LmRuntimeException(
                        "Expected (list of) value node(s) as a result of the left-hand side expression, but received: " +
                        leftValue.getNode().getNodeType().name());
            }
            for (JsonNodeWrapper rightValue : rightResult) {
                if (Utils.isValueMissing(rightValue)) {
                    return FALSE;
                }
                if (!rightValue.getNode().isValueNode()) {
                    throw new LmRuntimeException(
                            "Expected (list of) value node(s) as a result of the right-hand side expression, but received: " +
                            rightValue.getNode().getNodeType().name());
                }
                if (!apply(leftValue.getNode(), rightValue.getNode())) {
                    return FALSE;
                }
            }
        }
        return TRUE;
    }

}


text:
@interface PodsDummy_iOS_Hierarchy_Viewer : NSObject
@end
@implementation PodsDummy_iOS_Hierarchy_Viewer
@end


text:
/**
 * @author Vadim L. Bogdanov
 * @version $Revision$
 */
package javax.swing;

import java.beans.PropertyVetoException;

public class JRootPaneRTest extends SwingTestCase {
    private JFrame frame;

    public JRootPaneRTest(final String name) {
        super(name);
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
        if (frame != null) {
            frame.dispose();
            frame = null;
        }
    }

    public void testDefaultButton() throws PropertyVetoException {
        JInternalFrame iframe = new JInternalFrame("", true, true, true, true);
        JDesktopPane desktop = new JDesktopPane();
        desktop.add(iframe);
        JButton button = new JButton();
        iframe.getContentPane().add(button);
        iframe.getRootPane().setDefaultButton(button);
        frame = new JFrame();
        frame.setContentPane(desktop);
        frame.setVisible(true);
        iframe.setIcon(true);
        assertNull(iframe.getRootPane().getDefaultButton());
        iframe.setIcon(false);
        assertSame(button, iframe.getRootPane().getDefaultButton());
        iframe.setIcon(true);
        iframe.getContentPane().remove(button);
        iframe.setIcon(false);
        assertNull(iframe.getRootPane().getDefaultButton());
    }
}