text:
Wprowadzenie do zasobów NFS-u

<include nfs>

NFS Solarisa

<<<<<<< HEAD
Za pomoc± tego modu³u mo¿esz okre¶liæ katalogi (zwane w Solarisie
share) udostêpniane przez Twój system Solarisa za po¶rednictwem NFS-u
Na pierwszej stronie uka¿e siê lista katalogów i stacji klienckich,
dla których nastêpuje udostêpnianie. Klikaj±c nazwê katalogu mo¿esz zmieniæ
jego opcje lub rozpocz±æ udostêpnianie nowego katalogu.

Poni¿ej listy zasobów na tej samej stronie znajduje siê przycisk uaktywniaj±cy
bie¿±c± konfiguracjê. Dzieje siê to przez zatrzymanie i ponowne
uruchomienie dzia³aj±cych procesów serwera NFS-u.

Solaris nie pozwala na ponowne udostêpnianie katalogu zamontowanego poprzez
NFS z innego serwera - mo¿na udostêpniaæ jedynie katalogi na lokalnych
systemach plików. Je¿eli udostêpniany katalog zawiera punkt montowania
innego lokalnego sustemu plików, klienci NFS-u dla tego zasobu nie zobacz±
plików poni¿ej punktu montowania. Serwer musi udostêpniaæ ka¿dy lokalny
system plików osobno w celu zamontowania przez stacjê klienck± we
w³a¶ciwym punkcie jej drzewa katalogów.

=======
Za pomocą tego modułu możesz określić katalogi (zwane w Solarisie
share) udostępniane przez Twój system Solarisa za pośrednictwem NFS-u
Na pierwszej stronie ukaże się lista katalogów i stacji klienckich,
dla których następuje udostępnianie. Klikając nazwę katalogu możesz zmienić
jego opcje lub rozpocząć udostępnianie nowego katalogu.

Poniżej listy zasobów na tej samej stronie znajduje się przycisk uaktywniający
bieżącą konfigurację. Dzieje się to przez zatrzymanie i ponowne
uruchomienie działających procesów serwera NFS-u.

Solaris nie pozwala na ponowne udostępnianie katalogu zamontowanego poprzez
NFS z innego serwera - można udostępniać jedynie katalogi na lokalnych
systemach plików. Jeżeli udostępniany katalog zawiera punkt montowania
innego lokalnego sustemu plików, klienci NFS-u dla tego zasobu nie zobaczą
plików poniżej punktu montowania. Serwer musi udostępniać każdy lokalny
system plików osobno w celu zamontowania przez stację kliencką we
właściwym punkcie jej drzewa katalogów.

>>>>>>> upstream/master


text:
package io.spine.server.bc.given;

import io.spine.server.command.Command;
import io.spine.server.procman.ProcessManager;
import io.spine.test.bc.Project;
import io.spine.test.bc.ProjectId;
import io.spine.test.event.command.CreateProject;
import io.spine.test.event.command.StartProject;

public class ProjectCreationProcman extends ProcessManager<ProjectId, Project, Project.Builder> {

    protected ProjectCreationProcman(ProjectId id) {
        super(id);
    }

    @Command
    StartProject handle(CreateProject createProject) {
        return StartProject.newBuilder()
                           .build();
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.projecttango.examples.cpp.helloareadescription;

import android.content.Context;
import android.os.AsyncTask;

/**
 * Saves the ADF on a background thread and shows a progress dialog while saving.
 */
public class SaveAdfTask extends AsyncTask<Void, Integer, String> {

    /**
     * Listener to check if save ADF is successed.
     */
    public interface SaveAdfListener {
        void onSaveAdfFailed(String adfName);
        void onSaveAdfSuccess(String adfName, String adfUuid);
    }

    Context mContext;
    SaveAdfListener mCallbackListener;
    SaveAdfDialog mProgressDialog;
    String mAdfName;

    SaveAdfTask(Context context, SaveAdfListener callbackListener, String adfName) {
        mContext = context;
        mCallbackListener = callbackListener;
        mAdfName = adfName;
        mProgressDialog = new SaveAdfDialog(context);
    }

    /**
     * Call this method to marshall progress updates to the UI thread.
     */
    public void publishProgress(int progress) {
        super.publishProgress(progress);
    }

    /**
     * Sets up the progress dialog.
     */
    @Override
    protected void onPreExecute() {
        if (mProgressDialog != null) {
            mProgressDialog.show();
        }
    }

    /**
     * Performs long-running save in the background.
     */
    @Override
    protected String doInBackground(Void... params) {
        // This example implementation returns an empty-string on failure.
        String adfUuid = TangoJniNative.saveAdf();
        if (!adfUuid.isEmpty()) {
            TangoJniNative.setAdfMetadataValue(adfUuid, "name", mAdfName);
        }
        return adfUuid;
    }

    /**
     * Responds to progress updates events by updating the UI.
     */
    @Override
    protected void onProgressUpdate(Integer... progress) {
        if (mProgressDialog != null) {
            mProgressDialog.setProgress(progress[0]);
        }
    }

    /**
     * Dismisses the progress dialog and call the activity.
     */
    @Override
    protected void onPostExecute(String adfUuid) {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
        }
        if (mCallbackListener != null) {
            if (adfUuid.isEmpty()) {
                mCallbackListener.onSaveAdfFailed(mAdfName);
            } else {
                mCallbackListener.onSaveAdfSuccess(mAdfName, adfUuid);
            }
        }
    }
}


text:
@interface ExpectJobViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (strong,nonatomic) UITableView *tableView;

@property (strong,nonatomic) UIView *footerView;

@end

@implementation ExpectJobViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"管理求职意向";

    [self.view addSubview:self.tableView];

}

#pragma mark /-------footerView----------/
-(UIView *)footerView{
    if (!_footerView) {
        _footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 120)];
        _footerView.backgroundColor = whiteC;

        UIButton *addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [addBtn setTitle:@"添加期望职位" forState:UIControlStateNormal];
        [addBtn setImage:[UIImage imageNamed:@"add_icon_nav"] forState:UIControlStateNormal];
        addBtn.backgroundColor = blueC;
        addBtn.layer.masksToBounds = YES;
        addBtn.layer.cornerRadius = 3;
        [addBtn addTarget:self action:@selector(addBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [_footerView addSubview:addBtn];
        [addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(_footerView);
            make.centerX.equalTo(_footerView);
            make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-30, formBtnHeight));
        }];

    }
    return _footerView;
}

-(void)addBtnClick:(UIButton *)sender{
    HWLog(@"a");
    ExpectAddViewController *vc = [ExpectAddViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark /------tableView--------/
-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableFooterView = self.footerView;
        _tableView.tableFooterView.height = self.footerView.height;
        _tableView.sectionFooterHeight = 0;
        _tableView.backgroundColor = whiteC;
        _tableView.separatorStyle = NO;

    }
    return _tableView;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 1;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    UIView *headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, topToMargin)];
    headView.backgroundColor = grayC;

    return headView;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return topToMargin;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return SCREEN_WIDTH*0.2;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ExpectJobTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ca"];
    cell = [[ExpectJobTableViewCell alloc]initWithFrame:cell.bounds];
    cell.addressLabel.text = @"[西安]";
    cell.postLabel.text = @"iOS开发程序猿";
    cell.salaryLabel.text = @"7k-8k";
    cell.industryLabel.text = @"不限";

    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    ExpectAddViewController *vc = [ExpectAddViewController new];
    [self.navigationController pushViewController:vc animated:YES];
}

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

@end


text:
define([
    'dropbox'
],
function (Dropbox) {
    'use strict';

    var appKey = 'YOUR APP KEY';
    return new Dropbox.Client({key: appKey});
});


text:
class CreateServers < ActiveRecord::Migration
  def change
    create_table :servers do |t|
      t.string :name, null: false
      t.text :description
      t.string :password
      t.string :admin_password, null: false

      t.timestamps
    end
  end
end


text:
import random
import os
import json
import time
import threading

import simple_http_client

from front_base.host_manager import HostManagerBase

class HostManager(HostManagerBase):
    def __init__(self, config, logger, default_fn, fn, front):
        self.config = config
        self.logger = logger
        self.default_fn = default_fn
        self.fn = fn
        self.front = front
        self.load()
        if self.config.update_domains:
            threading.Thread(target=self.update_front_domains).start()

    def load(self):
        for fn in [self.fn, self.default_fn]:
            if not os.path.isfile(self.fn):
                continue

            lns = []
            try:
                with open(fn, "r") as fd:
                    ds = json.load(fd)
                    for top in ds:
                        subs = ds[top]
                        subs = [str(s) for s in subs]
                        lns.append([str(top), subs])
                self.ns = lns
                self.logger.info("load %s success", fn)
                return True
            except Exception as e:
                self.logger.warn("load %s for host fail.", fn)

    def get_sni_host(self, ip):
        top_domain, subs = random.choice(self.ns)
        sni = random.choice(subs)

        return sni, top_domain

    def update_front_domains(self):
        next_update_time = time.time()
        while self.front.running:
            if time.time() < next_update_time:
                time.sleep(4)
                continue

            try:
                timeout = 30
                if self.config.PROXY_ENABLE:
                    client = simple_http_client.Client(proxy={
                        "type": self.config.PROXY_TYPE,
                        "host": self.config.PROXY_HOST,
                        "port": self.config.PROXY_PORT,
                        "user": self.config.PROXY_USER,
                        "pass": self.config.PROXY_PASSWD,
                    }, timeout=timeout)
                else:
                    client = simple_http_client.Client(timeout=timeout)

                url = "https://raw.githubusercontent.com/XX-net/XX-Net/master/code/default/x_tunnel/local/cloudflare_front/front_domains.json"
                response = client.request("GET", url)
                if not response or response.status != 200:
                    if response:
                        self.logger.warn("update front domains fail:%d", response.status)
                    next_update_time = time.time() + (1800)
                    continue

                content = response.text
                if isinstance(content, memoryview):
                    content = content.tobytes()

                need_update = True
                front_domains_fn = self.fn
                if os.path.exists(front_domains_fn):
                    with open(front_domains_fn, "r") as fd:
                        old_content = fd.read()
                        if content == old_content:
                            need_update = False

                if need_update:
                    with open(front_domains_fn, "w") as fd:
                        fd.write(content)
                    self.load()

                    self.logger.info("updated cloudflare front domains from github.")

                next_update_time = time.time() + (4 * 3600)
            except Exception as e:
                next_update_time = time.time() + (1800)
                self.logger.exception("updated cloudflare front domains from github fail:%r", e)


text:
- Create a paid IBM Cloud account, and log into the dashboard.
- Choose Containers from the left hand hamburger navigation.

    ![](img/1-hamburger.png)

- Click the Create cluster button.

    ![](img/2-create-cluster.png)

- Select the Standard pay-as-you-go type of cluster (this allows for storage volumes and public floating IPs) and Create.

    ![](img/3-standard-cluster.png)

- Going back to the Dashboard from the navigation, you'll see your cluster.

- Click on it to see the cluster Overview.

    ![](img/4-overview.png)

- Click on Worker Nodes to get details on your worker nodes.

    ![](img/5-worker-nodes.png)

- It will take time for the cluster to complete provisioning, so go get some coffee.

## Connect to your Kubernetes cluster from your workstation
- Click on the Access link to download and configure the `bx` and `kubectl` CLIs. `kubectl` version >=1.7.6 is required.

    ![](img/6-access.png)

- Run the configuration commands, making sure that the `$KUBECONFIG` variable path is indeed correct (it may not reflect your actual home directory).
- You can then use `kubectl` or the `kubectl proxy` dashboard web UI that starts on localhost to inspect your Kubernetes environment.

## Provision and bind two MySQL-as-a-Service instances
- You can do this with the `bx` command too, but I prefer to work with the dashboard as it's just a one time setup operation with several options to browse through.
- Go to the hamburger navigation again and choose Data & Analytics.

    ![](img/7-hamburger-data-analytics.png)

- Click "Create"

    ![](img/8-create-data-analytics.png)

- You have a choice of two MySQL-as-a-Service providers, Compose and ClearDB. ClearDB is quicker to get running with for a PoC. You can use the free plan, but if you need better performance, choose a paid plan.

    ![](img/9-create-mysql-service.png)

- Take note of the credentials, and save them in a `scripts/kubernetes/secrets/service-credentials.txt` file you copy from [`scripts/kubernetes/secrets/service-credentials.txt.tpl`](../scripts/kubernetes/secrets/service-credentials.txt.tpl). There are variables for both a "Staging" database instance and a "Production" instance. They will be separate databases with separate credentials.

For ClearDB, the credentials can be found in the ClearDB Dashboard. Select your database and click the "System Information" tab
    ![](img/13-cleardb-credentials.png)

For Compose, the credentials will be shown right before you create the service.
    ![](img/12-compose-credentials.png)

- The IBM Cloud Container Service offers a way to autobind credentials, but using a secret from this credentials file gives us the option to use services in another organization and space and/or start it up later as its own pod.

- Repeat these steps to create a second database and make sure you have entries for both in the `scripts/kubernetes/secrets/service-credentials.txt` file.

## Provision and bind a Redis-as-a-Service
- You can do this with the `bx` command too, but I prefer to work with the dashboard as it's a one time setup operation with several options.
- Go to the hamburger navigation again and choose Data & Analytics.

    ![](img/7-hamburger-data-analytics.png)

- Click "Create"

    ![](img/8-create-data-analytics.png)

- You have a choice of two Redis-as-a-Service providers, Compose and Redis Cloud. Redis Cloud has a free tier, so you can just use that.

    ![](img/10-create-redis-service.png)

- Take note of the credentials, and save them in `scripts/kubernetes/secrets/service-credentials.txt`.

- For Compose, the credentials can be found by selecting the service from the dasboard, and clicking "Service Credentials"

    ![](img/14-redis-credentials.png)

## Provision and bind a Memcached-as-a-Service
- You can do this with the `bx` command too, but I prefer to work with the dashboard as it's a one time setup operation with several options.
- Go to the hamburger navigation again and choose Data & Analytics.

    ![](img/7-hamburger-data-analytics.png)

- Click "Create"

    ![](img/8-create-data-analytics.png)

- Choose Memcached from Redis Cloud.

    ![](img/11-create-memcached-service.png)

- Take note of the credentials, and save them in `scripts/kubernetes/secrets/service-credentials.txt`.


text:
package de.flapdoodle.mongomapper;

import com.google.common.base.Preconditions;
import com.mongodb.DBObject;

public class ObjectAsAttributeMapper<T,W extends ObjectMapper<T>> implements AttributeMapper<T> {

    private final W mapper;
    private final String name;

    public ObjectAsAttributeMapper(String name, W mapper) {
        this.name = name;
        this.mapper = mapper;
    }

    @Override
    public String name() {
        return name;
    }

    public W wrapped() {
        return mapper;
    }

    @Override
    public Object asDBObject(T value) {
        return mapper.asDBObject(value);
    }

    @Override
    public T asObject(Object value) {
        if (value!=null) {
            Preconditions.checkArgument(value instanceof DBObject,"value is not of type %s",DBObject.class);
            return mapper.asObject((DBObject) value);
        }
        return null;
    }
}


text:
#include "StdAfx.h"

#include "AssetClient.h"
#include "CSUnauthenticated.h"
#include "AssetServer.h"

#include <cmath>

using boost::asio::ip::tcp;

int AssetClient::_reqSinceLastPoll = 0;
int AssetClient::_kbTransferredSinceLastPoll = 0;
int AssetClient::_meshKbTransferredSinceLastPoll = 0;

/*
 * Stats functions
 */
int AssetClient::GetNumRequestsStat()
{
	int req = _reqSinceLastPoll;
	_reqSinceLastPoll = 0;

	return req;
}

int AssetClient::GetKBTransferredStat()
{
	int transfer = _kbTransferredSinceLastPoll;
	_kbTransferredSinceLastPoll = 0;

	return transfer;
}

int AssetClient::GetMeshKBTransferredStat()
{
	int transfer = _meshKbTransferredSinceLastPoll;
	_meshKbTransferredSinceLastPoll = 0;

	return transfer;
}

void AssetClient::AddRequestToStats()
{
	++_reqSinceLastPoll;
}

void AssetClient::AddTransferToStats(int bytes)
{
	//count anything under 1k as 1k
	if (bytes < 1000) {
		_kbTransferredSinceLastPoll += 1;

	} else {
		_kbTransferredSinceLastPoll += (int) floorf((bytes / 1000.0f) + 0.5f);

	}
}

void AssetClient::AddMeshTransferToStats(int bytes)
{
	//count anything under 1k as 1k
	if (bytes < 1000) {
		_meshKbTransferredSinceLastPoll += 1;

	} else {
		_meshKbTransferredSinceLastPoll += (int) floorf((bytes / 1000.0f) + 0.5f);

	}
}

AssetClient::AssetClient(boost::asio::io_service& ioService, AssetServer& server,
						 IAsyncStorageBackend::ptr storage, iwintramesh::MeshStorageBackend::ptr meshStorage) :
_ioService(ioService), _assetServer(server), _conn(ioService), _storage(storage),
_meshStorage(meshStorage)
{

}

AssetClient::~AssetClient()
{
	SAFELOG(AppLog::instance().out() << "~AssetClient" << std::endl);
}

void AssetClient::setInitialState()
{
	IConnectionState::ptr initialState(new CSUnauthenticated(_ioService, _storage, _meshStorage));
	this->setState(initialState);
}

tcp::socket& AssetClient::getConn()
{
	return _conn;
}

void AssetClient::setState(IConnectionState::ptr state)
{
	_state = state;
	_state->setClient(shared_from_this());
}

void AssetClient::startState()
{
	_state->start();
}

void AssetClient::start()
{
	try {
		SAFELOG(AppLog::instance().out() << "New client connection: " << _conn.remote_endpoint().address().to_string() << std::endl);
		_ep = _conn.remote_endpoint();
	}
	catch (...) {
		//just here because _conn.remote_endpoint() can throw if the socket is now somehow disconnected
	}

	_assetServer.clientConnect(shared_from_this());
	this->startState();
}

void AssetClient::disconnect()
{
	SAFELOG(AppLog::instance().out() << "Client disconnect: " << _ep.address().to_string() << std::endl);
	_conn.close();
	_assetServer.clientDisconnect(shared_from_this());
}

AssetServer& AssetClient::getParentServer()
{
	return _assetServer;
}

std::string AssetClient::getStatus()
{
	try {
		return _ep.address().to_string() + ": " + _state->getStateDescription();
	} catch (...) {
		return "DISCONNECTED";
	}
}


text:
#include <StdAfx.h>
#include <UI/Controls/StyleTree/StyleTreeCtrl.h>
#include <UI/UIFunctions.h>
#include <core/utility/strings.h>
#include <core/utility/output.h>

namespace controls
{
	static std::wstring CLASS = L"StyleTreeCtrl";

	void StyleTreeCtrl::Create(_In_ CWnd* pCreateParent, const bool bReadOnly)
	{
		m_bReadOnly = bReadOnly;

		auto style = TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_FULLROWSELECT |
					 WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE;
		if (!bReadOnly) style |= TVS_EDITLABELS;
		CTreeCtrl::Create(style, CRect(0, 0, 0, 0), pCreateParent, IDC_FOLDER_TREE);
		TreeView_SetBkColor(m_hWnd, ui::MyGetSysColor(ui::uiColor::Background));
		TreeView_SetTextColor(m_hWnd, ui::MyGetSysColor(ui::uiColor::Text));
		::SendMessageA(m_hWnd, WM_SETFONT, reinterpret_cast<WPARAM>(ui::GetSegoeFont()), false);
	}

	BEGIN_MESSAGE_MAP(StyleTreeCtrl, CTreeCtrl)
#pragma warning(push)
#pragma warning(disable : 26454)
	ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
	ON_NOTIFY_REFLECT(NM_RCLICK, OnRightClick)
	ON_NOTIFY_REFLECT(TVN_GETDISPINFO, OnGetDispInfo)
	ON_NOTIFY_REFLECT(TVN_ITEMEXPANDING, OnItemExpanding)
	ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnSelChanged)
	ON_NOTIFY_REFLECT(TVN_ENDLABELEDIT, OnEndLabelEdit)
	ON_NOTIFY_REFLECT(TVN_DELETEITEM, OnDeleteItem)
	ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk)
#pragma warning(pop)
	END_MESSAGE_MAP()

	LRESULT StyleTreeCtrl::WindowProc(const UINT message, const WPARAM wParam, const LPARAM lParam)
	{
		// Read the current hover local, since we need to clear it before we do any drawing
		switch (message)
		{
		case WM_GETDLGCODE:
			return OnGetDlgCode();
		case WM_CONTEXTMENU:
			OnContextMenu(reinterpret_cast<HWND>(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
			return 0;
		case WM_KEYDOWN:
			OnKeyDown(static_cast<UINT>(wParam), LOWORD(lParam), HIWORD(lParam));
			return 0;
		case WM_MOUSEMOVE:
		{
			const auto hItemCurHover = m_hItemCurHover;
			auto tvHitTestInfo = TVHITTESTINFO{};
			tvHitTestInfo.pt.x = GET_X_LPARAM(lParam);
			tvHitTestInfo.pt.y = GET_Y_LPARAM(lParam);

			WC_B_S(::SendMessage(m_hWnd, TVM_HITTEST, 0, reinterpret_cast<LPARAM>(&tvHitTestInfo)));
			if (tvHitTestInfo.hItem)
			{
				if (tvHitTestInfo.flags & TVHT_ONITEMBUTTON)
				{
					m_HoverButton = true;
				}
				else
				{
					m_HoverButton = false;
				}

				// If this is a new glow, clean up the old glow and track for leaving the control
				if (hItemCurHover != tvHitTestInfo.hItem)
				{
					ui::DrawTreeItemGlow(m_hWnd, tvHitTestInfo.hItem);

					if (hItemCurHover)
					{
						m_hItemCurHover = nullptr;
						ui::DrawTreeItemGlow(m_hWnd, hItemCurHover);
					}

					m_hItemCurHover = tvHitTestInfo.hItem;

					auto tmEvent = TRACKMOUSEEVENT{};
					tmEvent.cbSize = sizeof(TRACKMOUSEEVENT);
					tmEvent.dwFlags = TME_LEAVE;
					tmEvent.hwndTrack = m_hWnd;

					WC_B_S(TrackMouseEvent(&tmEvent));
				}
			}
			else
			{
				if (hItemCurHover)
				{
					m_hItemCurHover = nullptr;
					ui::DrawTreeItemGlow(m_hWnd, hItemCurHover);
				}
			}
			break;
		}
		case WM_MOUSELEAVE:
			if (m_hItemCurHover)
			{
				const auto hItemCurHover = m_hItemCurHover;
				m_hItemCurHover = nullptr;
				ui::DrawTreeItemGlow(m_hWnd, hItemCurHover);
			}

			return NULL;
		}

		return CTreeCtrl::WindowProc(message, wParam, lParam);
	}

	BOOL StyleTreeCtrl::PreTranslateMessage(MSG* pMsg)
	{
		// If edit control is visible in tree view control, when you send a
		// WM_KEYDOWN message to the edit control it will dismiss the edit
		// control. When the ENTER key was sent to the edit control, the
		// parent window of the tree view control is responsible for updating
		// the item's label in TVN_ENDLABELEDIT notification code.
		if (pMsg && pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE))
		{
			const auto edit = GetEditControl();
			if (edit)
			{
				edit->SendMessage(WM_KEYDOWN, pMsg->wParam, pMsg->lParam);
				return true;
			}
		}

		return CTreeCtrl::PreTranslateMessage(pMsg);
	}

	void StyleTreeCtrl::OnCustomDraw(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult)
	{
		ui::CustomDrawTree(pNMHDR, pResult, m_HoverButton, m_hItemCurHover);
		if (OnCustomDrawCallback) OnCustomDrawCallback(pNMHDR, pResult, m_hItemCurHover);
	}

	// Removes any existing node data and replaces it with lpData
	void StyleTreeCtrl::SetNodeData(HWND hWnd, HTREEITEM hItem, const LPVOID lpData) const
	{
		if (lpData)
		{
			auto tvItem = TVITEM{};
			tvItem.hItem = hItem;
			tvItem.mask = TVIF_PARAM;
			if (TreeView_GetItem(hWnd, &tvItem) && tvItem.lParam)
			{
				output::DebugPrintEx(
					output::dbgLevel::Hierarchy, CLASS, L"SetNodeData", L"Node %p, replacing data\n", hItem);
				if (FreeNodeDataCallback) FreeNodeDataCallback(tvItem.lParam);
			}
			else
			{
				output::DebugPrintEx(
					output::dbgLevel::Hierarchy, CLASS, L"SetNodeData", L"Node %p, first data\n", hItem);
			}

			tvItem.lParam = reinterpret_cast<LPARAM>(lpData);
			TreeView_SetItem(hWnd, &tvItem);
			// The tree now owns our lpData
		}
	}

	void StyleTreeCtrl::OnSelChanged(_In_opt_ NMHDR* pNMHDR, _In_opt_ LRESULT* pResult)
	{
		const auto pNMTV = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);

		if (pNMTV && pNMTV->itemNew.hItem)
		{
			m_bItemSelected = true;

			if (ItemSelectedCallback) ItemSelectedCallback(pNMTV->itemNew.hItem);
		}
		else
		{
			m_bItemSelected = false;
		}

		if (pResult) *pResult = 0;
	}

	std::wstring StyleTreeCtrl::GetItemTextW(HTREEITEM hItem) const
	{
		return strings::LPCTSTRToWstring(GetItemText(hItem));
	}

	HTREEITEM
	StyleTreeCtrl::AddChildNode(
		_In_ const std::wstring& szName,
		HTREEITEM hParent,
		const LPVOID lpData,
		const std::function<void(HTREEITEM hItem)>& itemAddedCallback) const
	{
		output::DebugPrintEx(
			output::dbgLevel::Hierarchy,
			CLASS,
			L"AddNode",
			L"Adding Node \"%ws\" under node %p, callback = %ws\n",
			szName.c_str(),
			hParent,
			itemAddedCallback != nullptr ? L"true" : L"false");
		auto tvInsert = TVINSERTSTRUCTW{};

		tvInsert.hParent = hParent;
		tvInsert.hInsertAfter = m_bSortNodes ? TVI_SORT : hParent;
		tvInsert.item.mask = TVIF_CHILDREN | TVIF_TEXT;
		tvInsert.item.cChildren = HasChildrenCallback ? I_CHILDRENCALLBACK : I_CHILDRENAUTO;
		tvInsert.item.pszText = const_cast<LPWSTR>(szName.c_str());
		const auto hItem =
			reinterpret_cast<HTREEITEM>(::SendMessage(m_hWnd, TVM_INSERTITEMW, 0, reinterpret_cast<LPARAM>(&tvInsert)));

		SetNodeData(m_hWnd, hItem, lpData);

		if (itemAddedCallback)
		{
			itemAddedCallback(hItem);
		}

		return hItem;
	}

	void StyleTreeCtrl::OnGetDispInfo(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult)
	{
		const auto lpDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);

		if (lpDispInfo && lpDispInfo->item.mask & TVIF_CHILDREN && HasChildrenCallback)
		{
			lpDispInfo->item.cChildren = HasChildrenCallback(reinterpret_cast<HTREEITEM>(lpDispInfo->item.lParam));
		}

		*pResult = 0;
	}

	// Assert that we want all keyboard input (including ENTER!)
	_Check_return_ UINT StyleTreeCtrl::OnGetDlgCode()
	{
		auto iDlgCode = CTreeCtrl::OnGetDlgCode() | DLGC_WANTMESSAGE;

		// Make sure that the control key is not pressed
		if (GetKeyState(VK_CONTROL) >= 0 && m_hWnd == ::GetFocus())
		{
			// Make sure that the Tab key is pressed
			if (GetKeyState(VK_TAB) < 0) iDlgCode &= ~(DLGC_WANTALLKEYS | DLGC_WANTMESSAGE | DLGC_WANTTAB);
		}

		return iDlgCode;
	}

	void StyleTreeCtrl::OnRightClick(_In_ NMHDR* /*pNMHDR*/, _In_ LRESULT* pResult)
	{
		// Send WM_CONTEXTMENU to self
		static_cast<void>(SendMessage(WM_CONTEXTMENU, reinterpret_cast<WPARAM>(m_hWnd), GetMessagePos()));

		// Mark message as handled and suppress default handling
		*pResult = 1;
	}

	void StyleTreeCtrl::OnContextMenu(_In_ HWND hwnd, const int x, const int y)
	{
		auto pos = POINT{x, y};
		// If we don't have a position, this may be keyboard initiated context menu. Use the highlighted/selected item to find a position.
		if (hwnd && -1 == pos.x && -1 == pos.y)
		{
			// Find the highlighted item
			const auto item = GetSelectedItem();

			if (item)
			{
				auto rc = RECT{};
				static_cast<void>(GetItemRect(item, &rc, true));
				pos.x = rc.left;
				pos.y = rc.top;
				::ClientToScreen(hwnd, &pos);
			}
		}
		// If we have a position, make sure the item at that position is selected.
		else
		{
			// Select the item that is at the point pos.
			UINT uFlags = NULL;
			auto ptTree = pos;
			ScreenToClient(&ptTree);
			const auto hClickedItem = HitTest(ptTree, &uFlags);

			if (hClickedItem != nullptr && TVHT_ONITEM & uFlags)
			{
				Select(hClickedItem, TVGN_CARET);
			}
		}

		if (HandleContextMenuCallback) HandleContextMenuCallback(pos.x, pos.y);
	}

	void StyleTreeCtrl::OnItemExpanding(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult)
	{
		*pResult = 0;

		const auto pNMTreeView = reinterpret_cast<NM_TREEVIEW*>(pNMHDR);
		if (pNMTreeView)
		{
			output::DebugPrintEx(
				output::dbgLevel::Hierarchy,
				CLASS,
				L"OnItemExpanding",
				L"Expanding item %p \"%ws\" action = 0x%08X state = 0x%08X\n",
				pNMTreeView->itemNew.hItem,
				GetItemTextW(pNMTreeView->itemOld.hItem).c_str(),
				pNMTreeView->action,
				pNMTreeView->itemNew.state);
			if (pNMTreeView->action & TVE_EXPAND)
			{
				if (!(pNMTreeView->itemNew.state & TVIS_EXPANDEDONCE))
				{
					if (ExpandNodeCallback) ExpandNodeCallback(pNMTreeView->itemNew.hItem);
				}
			}
		}
	}

	void StyleTreeCtrl::Refresh()
	{
		// Turn off redraw while we work on the window
		SetRedraw(false);

		OnSelChanged(nullptr, nullptr);

		EC_B_S(DeleteAllItems());
		if (OnRefreshCallback) OnRefreshCallback();

		// Turn redraw back on to update our view
		SetRedraw(true);
	}

	// This function will be called when we edit a node so we can attempt to commit the changes
	// TODO: In non-unicode builds, this gives us ANSI strings - need to figure out how to change that
	void StyleTreeCtrl::OnEndLabelEdit(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult)
	{
		const auto pTVDispInfo = reinterpret_cast<TV_DISPINFO*>(pNMHDR);
		*pResult = 0;

		if (!pTVDispInfo || !pTVDispInfo->item.pszText) return;

		if (OnLabelEditCallback) OnLabelEditCallback(pTVDispInfo->item.hItem, pTVDispInfo->item.pszText);
	}

	void StyleTreeCtrl::OnDblclk(_In_ NMHDR* /*pNMHDR*/, _In_ LRESULT* pResult)
	{
		if (OnDisplaySelectedItemCallback) OnDisplaySelectedItemCallback();

		// Don't do default behavior for double-click (We only want '+' sign expansion.
		// Double click should display the item, not expand the tree.)
		*pResult = 1;
	}

	void StyleTreeCtrl::OnKeyDown(const UINT nChar, const UINT nRepCnt, const UINT nFlags)
	{
		output::DebugPrintEx(output::dbgLevel::Menu, CLASS, L"OnKeyDown", L"0x%X\n", nChar);

		const auto bCtrlPressed = GetKeyState(VK_CONTROL) < 0;
		const auto bShiftPressed = GetKeyState(VK_SHIFT) < 0;
		const auto bMenuPressed = GetKeyState(VK_MENU) < 0;

		if (!bMenuPressed)
		{
			if (!KeyDownCallback || !KeyDownCallback(nChar, bShiftPressed, bCtrlPressed, bMenuPressed))
			{
				CTreeCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
			}
		}
	}

	// Tree control will call this for every node it deletes.
	void StyleTreeCtrl::OnDeleteItem(_In_ NMHDR* pNMHDR, _In_ LRESULT* pResult)
	{
		const auto pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
		if (pNMTreeView)
		{
			output::DebugPrintEx(
				output::dbgLevel::Hierarchy,
				CLASS,
				L"OnDeleteItem",
				L"Deleting item %p \"%ws\"\n",
				pNMTreeView->itemOld.hItem,
				GetItemTextW(pNMTreeView->itemOld.hItem).c_str());

			if (FreeNodeDataCallback) FreeNodeDataCallback(pNMTreeView->itemOld.lParam);

			if (!m_bShuttingDown)
			{
				// Collapse the parent if this is the last child
				const auto hPrev = TreeView_GetPrevSibling(m_hWnd, pNMTreeView->itemOld.hItem);
				const auto hNext = TreeView_GetNextSibling(m_hWnd, pNMTreeView->itemOld.hItem);

				if (!(hPrev || hNext))
				{
					output::DebugPrintEx(
						output::dbgLevel::Hierarchy,
						CLASS,
						L"OnDeleteItem",
						L"%p has no siblings\n",
						pNMTreeView->itemOld.hItem);
					const auto hParent = TreeView_GetParent(m_hWnd, pNMTreeView->itemOld.hItem);
					TreeView_SetItemState(m_hWnd, hParent, 0, TVIS_EXPANDED | TVIS_EXPANDEDONCE);
					auto tvItem = TVITEM{};
					tvItem.hItem = hParent;
					tvItem.mask = TVIF_PARAM;
					if (TreeView_GetItem(m_hWnd, &tvItem) && tvItem.lParam)
					{
						if (OnLastChildDeletedCallback) OnLastChildDeletedCallback(tvItem.lParam);
					}
				}
			}
		}

		*pResult = 0;
	}
} // namespace controls


text:
#ifndef __MNOTE_FUJI_ENTRY_H__
#define __MNOTE_FUJI_ENTRY_H__

#include <libexif/exif-format.h>
#include <libexif/fuji/mnote-fuji-tag.h>

typedef struct _MnoteFujiEntry        MnoteFujiEntry;
typedef struct _MnoteFujiEntryPrivate MnoteFujiEntryPrivate;

#include <libexif/fuji/exif-mnote-data-fuji.h>

struct _MnoteFujiEntry {
	MnoteFujiTag tag;
	ExifFormat format;
	unsigned long components;

	unsigned char *data;
	unsigned int size;

	ExifByteOrder order;
};

char *mnote_fuji_entry_get_value (MnoteFujiEntry *entry, char *val, unsigned int maxlen);

#endif /* __MNOTE_FUJI_ENTRY_H__ */


text:
var options = sharedRequire('js/options');

var mlclient = require('marklogic');
var boundClients = {};

var execAsTransaction = function (ex) {
  var self = this;
  var txid;

  return this.transactions.open().result()
  .then(function (resp) {
    txid = resp.txid;
    return ex(txid);
  })
  .then(function (result) {
    return self.transactions.commit(txid).result()
    .then(function () {
      return result;
    });
  })
  .catch(function (err) {
    return self.transactions.rollback(txid).result()
    .thenThrow(err);
  });
};

var getClient = function (user, password) {
  return mlclient.createDatabaseClient(_.merge(
    options.middleTier.db.clientConnection,
    {
      user: user,
      password: password
    }
  ));
};

var getBoundClient = function (user, password) {
  if (!boundClients[user]) {
    var connection = getClient(user, password);
    // TODO: this used to work -- determine best way to catch
    // errors in-app and keep logging from being spit out of dbclient
    // connections[role].setLogger({ console: false });

    var boundClient = {};

    var modules = {
      qnaDoc: require('./qnaDoc'),
      contributor: require('./contributor'),
      tags: require('./tags'),
      search: require('./search')
    };

    // have the individual modules handle binding themselves to the connection
    // by calling their exported function
    _.each(modules, function (mod, key) {
      boundClient[key] = mod(connection);
    });
    boundClient.transactions = connection.transactions;
    boundClient.execAsTransaction = execAsTransaction.bind(connection);
    boundClients[user] = boundClient;
  }
  return boundClients[user];
};

module.exports = {
  getBoundClient: getBoundClient,
  getGenericClient: getClient,
  execAsTransaction: execAsTransaction
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XS.Blog;
using XS.Blog.Entity;

/// <summary>
/// Album 的摘要说明
/// </summary>
public class GetAlbumHandler : Handler
{
    private AlbumInfo[] albumStr;
    public GetAlbumHandler(HttpContext context) : base(context) { }

    public override void Process()
    {
        var albumList = new AlbumManager().GetList(""," Order_Id asc ");

        albumStr = albumList.ToArray();

        WriteJson(new {
            state = "SUCCESS",
            list = albumStr.Select(x => new
            {
                id = x.Guid,
                name = x.Name
            })
        });
    }
}