text:
package com.mindoo.domino.jna.utils;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.List;

import com.mindoo.domino.jna.constants.ClusterLookup;
import com.mindoo.domino.jna.errors.NotesErrorUtils;
import com.mindoo.domino.jna.internal.ConsoleLine;
import com.mindoo.domino.jna.internal.ItemDecoder;
import com.mindoo.domino.jna.internal.Mem;
import com.mindoo.domino.jna.internal.Mem32;
import com.mindoo.domino.jna.internal.Mem64;
import com.mindoo.domino.jna.internal.NotesCallbacks;
import com.mindoo.domino.jna.internal.NotesConstants;
import com.mindoo.domino.jna.internal.NotesNativeAPI;
import com.mindoo.domino.jna.internal.NotesNativeAPI32;
import com.mindoo.domino.jna.internal.NotesNativeAPI64;
import com.mindoo.domino.jna.internal.Win32NotesCallbacks;
import com.mindoo.domino.jna.internal.handles.DHANDLE;
import com.mindoo.domino.jna.internal.structs.NotesConsoleEntryStruct;
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.ptr.ShortByReference;

public class ServerUtils {

	/**
	 * The NSGetServerClusterMates function retrieves a list of server names that belong to the
	 * same cluster as the server specified by pServerName.

	 * If the serverName parameter is NULL then the function retrieves the cluster
	 * members of the user's home server.

	 *

	 * The lookupMode parameter controls how the information is retrieved.

	 * If the {@link ClusterLookup#LOOKUP_NOCACHE} flag is specified then the information is
	 * retrieved using a NameLookup on the server only.

	 *

	 * If the {@link ClusterLookup#LOOKUP_CACHEONLY} flag is specified then the information is
	 * retrieved using the client's cluster name cache.

	 *

	 * If no flag (a value of NULL) is specified, then the information is retrieved first
	 * through the client's cluster name cache and if that is not successful, then through
	 * a NameLookup on the server.

	 * Note that the list returned does not include the input server name (or home server
	 * name if NULL was specified).

	 *

	 * {@link #getServerClusterMates(String, ClusterLookup)} uses the Address book specified by the user's location record.

	 * Unless cascading Address books or Directory Assistance is enabled, the Notes mail
	 * domain field in the user's location record must be set to the domain name for the
	 * server(s) in the cluster and the Home/mail server field must be set to a server in this domain.

	 *

	 * If the target server is in a different domain than specified in the user's location record
	 * then in order for {@link #getServerClusterMates(String, ClusterLookup)} to succeed, you must have cascading Address
	 * books or Directory Assistance enabled and the target domain's Address book must be in the
	 * list of Address books to be searched.

	 * @param serverName The name of the Lotus Domino Server where the lookup will be performed (canonical or abbreviated format). Specify a value of NULL if the client's home server is to be used for the lookup.
	 * @param lookupMode lookup mode or null for "first local cache, then remote lookup"
	 * @return server list
	 */
	@SuppressWarnings("unchecked")
	public static List<String> getServerClusterMates(String serverName, ClusterLookup lookupMode) {
		Memory serverNameCanonical = serverName==null ? null : NotesStringUtils.toLMBCS(NotesNamingUtils.toCanonicalName(serverName), true);

		short result;

		if (PlatformUtils.is64Bit()) {
			LongByReference phList = new LongByReference();

			result = NotesNativeAPI64.get().NSGetServerClusterMates(serverNameCanonical, lookupMode==null ? 0 : lookupMode.getValue(), phList);
			if (result == 2078) // "No cluster mates found"
				return Collections.emptyList();
			NotesErrorUtils.checkResult(result);

			long hList = phList.getValue();
			if (hList==0)
				return Collections.emptyList();

			Pointer pList = Mem64.OSLockObject(hList);
			try {
				@SuppressWarnings("rawtypes")
				List clusterMates = ItemDecoder.decodeTextListValue(pList, false);
				return clusterMates;
			}
			finally {
				Mem64.OSUnlockObject(hList);
				result = Mem64.OSMemFree(hList);
				NotesErrorUtils.checkResult(result);
			}
		}
		else {
			IntByReference phList = new IntByReference();

			result = NotesNativeAPI32.get().NSGetServerClusterMates(serverNameCanonical, lookupMode==null ? 0 : lookupMode.getValue(), phList);
			if (result == 2078) // "No cluster mates found"
				return Collections.emptyList();
			NotesErrorUtils.checkResult(result);

			int hList = phList.getValue();
			if (hList==0)
				return Collections.emptyList();

			Pointer pList = Mem32.OSLockObject(hList);
			try {
				@SuppressWarnings("rawtypes")
				List clusterMates = ItemDecoder.decodeTextListValue(pList, false);
				return clusterMates;
			}
			finally {
				Mem32.OSUnlockObject(hList);
				result = Mem32.OSMemFree(hList);
				NotesErrorUtils.checkResult(result);
			}
		}
	}

	/**
	 * This function is used to issue a console command to a server from an API program
	 * or from an API server add-in program.

	 *

	 * If you do not have remote access to the server an error will be returned.

	 * To have remote access to a server, you must be listed in the Server Document
	 * Administrators field or in the Admin variable in the server's notes.ini.

	 *

	 * NOTE: If you use this function to shut down a server (by entering the "exit" or
	 * "quit" commands), you may receive an error code of "Server not responding"
	 * or "Remote system no longer responding".

	 *

	 * Assuming that the server was active when you issued the command, these errors
	 * usually mean that your command was successful (the server shuts down before it
	 * can return a meaningful response).

	 *

	 * NOTE:  This function will return NOERROR if the server's disk is full, but
	 * the returned response buffer will be 0-length.
	 *
	 * @param server name of the server that is to receive the console command
	 * @param command  text command to send to the server's console
	 * @return returned server's response
	 */
	public static String sendConsoleCommand(String server, String command) {
		if (StringUtil.isEmpty(server)) {
			//prevent error "Invalid server or network name syntax" (error code: 274)
			server = IDUtils.getIdUsername();
		}
		Memory serverMem = NotesStringUtils.toLMBCS(server, true);
		Memory commandMem = NotesStringUtils.toLMBCS(command, true);

		if (PlatformUtils.is64Bit()) {
			LongByReference hResponseText = new LongByReference();

			short result = NotesNativeAPI64.get().NSFRemoteConsole(serverMem, commandMem, hResponseText);
			NotesErrorUtils.checkResult(result);

			long hResponseTextValue = hResponseText.getValue();
			if (hResponseTextValue==0) {
				return "";
			}

			Pointer ptr = Mem64.OSLockObject(hResponseTextValue);
			try {
				String txt = NotesStringUtils.fromLMBCS(ptr, -1);
				return txt;
			}
			finally {
				Mem64.OSUnlockObject(hResponseTextValue);
				Mem64.OSMemFree(hResponseTextValue);
			}
		}
		else {
			IntByReference hResponseText = new IntByReference();

			short result = NotesNativeAPI32.get().NSFRemoteConsole(serverMem, commandMem, hResponseText);
			NotesErrorUtils.checkResult(result);

			int hResponseTextValue = hResponseText.getValue();
			if (hResponseTextValue==0) {
				return "";
			}

			Pointer ptr = Mem32.OSLockObject(hResponseTextValue);
			try {
				String txt = NotesStringUtils.fromLMBCS(ptr, -1);
				return txt;
			}
			finally {
				Mem32.OSUnlockObject(hResponseTextValue);
				Mem32.OSMemFree(hResponseTextValue);
			}
		}
	}

	/**
	 * Handler to receive a server console line with text and meta data
	 */
	public interface ConsoleHandler {

		/**
		 * Method is called by {@link ServerUtils#openServerConsole(String, ConsoleHandler)}
		 * to check if we should stop listening for console messages.
		 *
		 * @return true to stop
		 */
		public boolean shouldStop();

		/**
		 * Method to receive the console line with text and meta data like the pid/tid/executable
		 * name
		 *
		 * @param line console line
		 */
		void messageReceived(IConsoleLine line);

	}

	/**
	 * Opens a remote console for the specified server. Please note that for Domino versions until
	 * R11 this command only works locally in the client. Domino R12.0.0 will provide console access
	 * on server side after the following Notes.ini variable has been set:
	 * DEBUG_ALLOW_REMOTE_CON_SERVER=1.
	 *
	 * @param serverName server name (abbreviated or canonical format) or empty string for local server
	 * @param handler handler to receive the console messages
	 */
	public static void openServerConsole(String serverName, ConsoleHandler handler) {
		String serverNameCanonical = StringUtil.isEmpty(serverName) ? IDUtils.getIdUsername() : NotesNamingUtils.toCanonicalName(serverName);
		Memory serverNameCanonicalMem = NotesStringUtils.toLMBCS(serverNameCanonical, true);

		{
			//for simplicity we send an empty synchronous remote console command
			//to check for the error "You are not authorized to use the remote console on this server"
			//otherwise that error status is just returned asynchronously via ASYNC_CONTEXT and the required
			//data structure is quite complex
			DHANDLE.ByReference hResponseText = DHANDLE.newInstanceByReference();

			short result = NotesNativeAPI.get().NSFRemoteConsole(serverNameCanonicalMem, null, hResponseText);
			NotesErrorUtils.checkResult(result);

			if (!hResponseText.isNull()) {
				Mem.OSMemFree(hResponseText.getByValue());
			}
		}

		String cmd = null; //"sh ta";
		Memory cmdMem = StringUtil.isEmpty(cmd) ? null : NotesStringUtils.toLMBCS(cmd, true);

		PointerByReference pAsyncCtx = new PointerByReference();
		DHANDLE.ByReference hAsyncQueue = DHANDLE.newInstanceByReference();
		DHANDLE.ByReference hAsyncBuffer = DHANDLE.newInstanceByReference();

		ShortByReference wSignals = new ShortByReference();
		IntByReference dwConsoleBuffID = new IntByReference();

		short result = NotesNativeAPI.get().QueueCreate(hAsyncQueue);
		NotesErrorUtils.checkResult(result);

		boolean asyncIOInitDone = false;

		try {
			NotesCallbacks.ASYNCNOTIFYPROC callback;
			if (PlatformUtils.isWin32()) {
				callback = new Win32NotesCallbacks.ASYNCNOTIFYPROCWin32() {

					@Override
					public void invoke(Pointer p1, Pointer p2) {
					}
				};
			}
			else {
				callback = new NotesCallbacks.ASYNCNOTIFYPROC() {

					@Override
					public void invoke(Pointer p1, Pointer p2) {
					}
				};
			}

			result = AccessController.doPrivileged((PrivilegedAction<Short>) ()->{
				return NotesNativeAPI.get().NSFRemoteConsoleAsync(serverNameCanonicalMem, cmdMem,
						NotesConstants.REMCON_GET_CONSOLE | NotesConstants.REMCON_GET_CONSOLE_META,
						hAsyncBuffer,
						null, null, wSignals, dwConsoleBuffID, hAsyncQueue.getByValue(), callback, null, pAsyncCtx);
			});

			NotesErrorUtils.checkResult(result);

			while (true) {
				if (handler.shouldStop()) {
					break;
				}

				NotesNativeAPI.get().NSFAsyncNotifyPoll(new Pointer(0), null, null);
				NotesNativeAPI.get().NSFUpdateAsyncIOStatus(pAsyncCtx.getValue());
				asyncIOInitDone = true;

				short hasData = NotesNativeAPI.get().QueueGet(hAsyncQueue.getByValue(), hAsyncBuffer);

				if (hasData==0) {
					Pointer ptr = Mem.OSLockObject(hAsyncBuffer);
					try {
						NotesConsoleEntryStruct consoleEntry = NotesConsoleEntryStruct.newInstance(ptr);
						consoleEntry.read();

						int len = consoleEntry.length;
						if (consoleEntry.type == 1) {
							String lineEncoded = NotesStringUtils.fromLMBCS(ptr.share(consoleEntry.size()),
									len);
							IConsoleLine consoleLine = ConsoleLine.parseConsoleLine(lineEncoded, 0);
							handler.messageReceived(consoleLine);
						}
					}
					finally {
						Mem.OSUnlockObject(hAsyncBuffer);
						Mem.OSMemFree(hAsyncBuffer.getByValue());
					}
				}
				else {
					try {
						Thread.sleep(100);
					} catch (InterruptedException e) {
						break;
					}
				}
			}
		}
		finally {
			if (asyncIOInitDone) {
				if (pAsyncCtx.getValue()!=null) {
					NotesNativeAPI.get().NSFCancelAsyncIO(pAsyncCtx.getValue());
				}
			}

			NotesNativeAPI.get().QueueDelete(hAsyncQueue.getByValue());
		}

	}
}


text:
module CircleCI
  module CLI
    module Response
      class Step
        attr_reader :type
        attr_reader :status

        def initialize(type, hash)
          @type = type
          @status = hash['status']
          @hash = hash
        end

        def actions
          @hash['actions'].map { |a| Action.new(a) }
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package org.apache.ibatis.submitted.timezone_edge_case;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface Mapper {

  @Select("select id, ts, d from records where id = #{id}")
  Record selectById(Integer id);

  @Insert("insert into records (id, ts, d) values (#{id}, #{ts}, #{d})")
  int insert(Record record);

}


text:
package prefuse.visual;

import prefuse.data.Node;

/**
 * VisualItem that represents a node in a graph. This interface combines
 * the {@link VisualItem} interface with the {@link prefuse.data.Node}
 * interface.
 *
 * @author jeffrey heer
 */
public interface NodeItem extends VisualItem, Node {

} // end of interface NodeItem


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using Aspose.Cells;
using System.Collections;
using System.Configuration;

namespace Aspose.UmbracoDatabaseDataExporterToExcel
{
    public partial class UmbracoDatabaseDataExporterToExcel : System.Web.UI.UserControl
    {
        #region Page load and events

        // page load event
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // verify page is not post back, so we can setup default page view.
                if (!Page.IsPostBack)
                {
                    // getting default DNN connection string
                    txtConString.Text = ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString;

                    // Load form view and data source Table, Views dropdownns
                    InitForm();
                }
            }
            catch (Exception exc)
            {
                lblMessage.Text = exc.Message;
            }
        }

        //Reload/Populate Tables & Views dropdownlist
        protected void LoadButton_Click(object sender, EventArgs e)
        {
            try
            {
                InitForm();
                lblMessage.Text = "Tables & Views Loaded Successfully.";
            }
            catch (Exception exc)
            {
                lblMessage.Text = exc.Message;
            }
        }

        //Export data file as per selected export type
        protected void ProcessButton_Click(object sender, EventArgs e)
        {
            try
            {
                // Check for license and apply if exists
                string licenseFile = Server.MapPath("~/App_Data/Aspose.Total.lic");
                if (File.Exists(licenseFile))
                {
                    License license = new License();
                    license.SetLicense(licenseFile);
                }

                String connString = txtConString.Text;
                //**STRING UPDATED**
                String Query = "SELECT * FROM " + ddlTables.SelectedValue + " ORDER BY 1";
                switch (ddlSource.SelectedValue)
                {
                    case "0":
                        if (ddlTables.Items.Count <= 0)
                        {
                            lblMessage.Text = "There are no tables to select data.";
                            return;
                        }
                        Query = "SELECT * FROM " + ddlTables.SelectedValue + " ORDER BY 1";
                        break;
                    case "1":
                        if (ddlViews.Items.Count <= 0)
                        {
                            lblMessage.Text = "There are no views to select data.";
                            return;
                        }
                        Query = "SELECT * FROM " + ddlViews.SelectedValue;
                        break;
                    case "2":
                        if (txtCustomQuery.Text.Trim().Equals(""))
                        {
                            lblMessage.Text = "Please enter custom query.";
                            return;
                        }
                        Query = txtCustomQuery.Text.Trim();
                        break;
                }

                using (var cn = new SqlConnection(connString))
                {
                    //opening database connection
                    cn.Open();

                    //creating datatable, sqlCommand and sqlReader objects
                    DataTable dt = new DataTable();
                    SqlCommand cmd = new SqlCommand(Query, cn);
                    SqlDataReader myReader = cmd.ExecuteReader();
                    dt.Load(myReader);

                    //creating leadoptions for excel file
                    LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);
                    loadOptions.CheckExcelRestriction = false;

                    //Instantiate a new Workbook with Load options to prevent max cell string length of 32k error
                    Workbook book = new Workbook(Server.MapPath("~/App_Data/Sample.xlsx"), loadOptions);

                    //Clear all the worksheets
                    book.Worksheets.Clear();

                    //Add a new Sheet "Data";
                    Worksheet sheet = book.Worksheets.Add("Exported Data");

                    //Data Table import to the worksheet, inserting from A1 cell of sheet
                    sheet.Cells.ImportDataTable(dt, true, "A1");

                    // Apply Hearder Row/First Row text to Bold
                    Cells.Style objStyle = new Cells.Style();
                    objStyle.Font.IsBold = true;

                    StyleFlag objStyleFlag = new StyleFlag();
                    objStyleFlag.FontBold = true;

                    sheet.Cells.ApplyRowStyle(0, objStyle, objStyleFlag);

                    // Fit columns width to contents
                    sheet.AutoFitColumns();

                    //Create unique file name
                    string fileName = System.Guid.NewGuid().ToString() + "." + ExportTypeDropDown.SelectedValue;

                    //Save workbook as per export type
                    book.Save(this.Response, fileName, ContentDisposition.Attachment, GetSaveFormat(ExportTypeDropDown.SelectedValue));
                    Response.End();
                }

                lblMessage.Text = "Data exported successfully.";

            }
            catch (Exception exc)
            {
                lblMessage.Text = exc.Message;
            }
        }

        #endregion

        #region Private methods

        //Form Initiating & Loading Tables and Views DropDownLists
        private void InitForm()
        {
            // Check for license and apply if exists
            string licenseFile = Server.MapPath("~/App_Data/Aspose.Total.lic");
            if (File.Exists(licenseFile))
            {
                License license = new License();
                license.SetLicense(licenseFile);
            }

            String connString = txtConString.Text;

            using (var cn = new SqlConnection(connString))
            {
                cn.Open();
                DataTable dt = new DataTable();
                try
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM information_schema.tables ORDER BY TABLE_NAME", cn);
                    SqlDataReader myReader = cmd.ExecuteReader();
                    dt.Load(myReader);
                    ddlTables.DataSource = dt;
                    ddlTables.DataTextField = "TABLE_NAME";
                    ddlTables.DataValueField = "TABLE_NAME";
                    ddlTables.DataBind();

                }
                catch (SqlException e)
                {
                    throw e;
                }

                dt = new DataTable();

                try
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM information_schema.views ORDER BY TABLE_NAME", cn);
                    SqlDataReader myReader = cmd.ExecuteReader();
                    dt.Load(myReader);

                    ddlViews.DataSource = dt;
                    ddlViews.DataTextField = "TABLE_NAME";
                    ddlViews.DataValueField = "TABLE_NAME";
                    ddlViews.DataBind();

                }
                catch (SqlException e)
                {
                    throw e;
                }
            }

            ddlSource.Attributes.Add("onchange", "javascript:sourceChanged();");

            ddlTables.Style["display"] = "none";
            ddlViews.Style["display"] = "none";
            txtCustomQuery.Style["display"] = "none";

            switch (ddlSource.SelectedValue)
            {
                case "0":
                    ddlTables.Style["display"] = "block";
                    break;
                case "1":
                    ddlViews.Style["display"] = "block";
                    break;
                case "2":
                    txtCustomQuery.Style["display"] = "block";
                    break;
            }

            // Create sample Excel file to use while generating exported file
            if (!File.Exists(Server.MapPath("~/App_Data/Sample.xlsx")))
            {
                File.Create(Server.MapPath("~/App_Data/Sample.xlsx"));
            }

        }

        //Get Save File Formats
        private XlsSaveOptions GetSaveFormat(string format)
        {
            XlsSaveOptions saveOption = new XlsSaveOptions(SaveFormat.Xlsx);

            switch (format)
            {
                case "xlsx":
                    saveOption = new XlsSaveOptions(SaveFormat.Xlsx); break;
                case "xlsb":
                    saveOption = new XlsSaveOptions(SaveFormat.Xlsb); break;
                case "xls":
                    saveOption = new XlsSaveOptions(SaveFormat.Excel97To2003); break;
                case "txt":
                    saveOption = new XlsSaveOptions(SaveFormat.TabDelimited); break;
                case "csv":
                    saveOption = new XlsSaveOptions(SaveFormat.CSV); break;
                case "ods":
                    saveOption = new XlsSaveOptions(SaveFormat.ODS); break;
            }

            return saveOption;
        }

        #endregion
    }
}