text:
package org.apache.jena.fuseki.server ;

import static java.lang.String.format ;
import static org.apache.jena.fuseki.Fuseki.serverLog ;

import java.io.FileInputStream ;
import java.util.* ;

import javax.servlet.DispatcherType ;
import javax.servlet.http.HttpServlet ;

import org.apache.jena.atlas.lib.DateTimeUtils ;
import org.apache.jena.atlas.lib.FileOps ;
import org.apache.jena.fuseki.Fuseki ;
import org.apache.jena.fuseki.FusekiException ;
import org.apache.jena.fuseki.HttpNames ;
import org.apache.jena.fuseki.mgt.ActionDataset ;
import org.apache.jena.fuseki.mgt.MgtFunctions ;
import org.apache.jena.fuseki.mgt.PageNames ;
import org.apache.jena.fuseki.servlets.* ;
import org.apache.jena.fuseki.validation.DataValidator ;
import org.apache.jena.fuseki.validation.IRIValidator ;
import org.apache.jena.fuseki.validation.QueryValidator ;
import org.apache.jena.fuseki.validation.UpdateValidator ;
import org.apache.jena.riot.WebContent ;
import org.apache.jena.sparql.mgt.ARQMgt ;
import org.eclipse.jetty.http.MimeTypes ;
import org.eclipse.jetty.security.* ;
import org.eclipse.jetty.security.authentication.BasicAuthenticator ;
import org.eclipse.jetty.server.Connector ;
import org.eclipse.jetty.server.Server ;
import org.eclipse.jetty.server.nio.BlockingChannelConnector ;
import org.eclipse.jetty.servlet.DefaultServlet ;
import org.eclipse.jetty.servlet.ServletContextHandler ;
import org.eclipse.jetty.servlet.ServletHolder ;
import org.eclipse.jetty.servlets.GzipFilter ;
import org.eclipse.jetty.util.security.Constraint ;
import org.eclipse.jetty.xml.XmlConfiguration ;

/**
 * SPARQLServer is the Jena server instance which wraps/utilizes
 * {@link org.eclipse.jetty.server.Server}. This class provides
 * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and
 * {@link org.eclipse.jetty.server.Server#stop()} commands as well as obtaining
 * instances of the server and server configuration. Finally we can obtain
 * instances of {@link org.apache.jena.fuseki.server.ServerConfig}.
 *
 */
public class SPARQLServer {
    static {
        Fuseki.init() ;
    }

    private ServerConfig        serverConfig ;

    private Server              server         = null ;
    private static List<String> epDataset      = Arrays.asList("*") ;

    /**
     * Default constructor which requires a {@link org.apache.jena.fuseki.server.ServerConfig}
     * object as input. We use this config to specify (verbose) logging, enable compression
     * etc.
     * @param config
     */
    public SPARQLServer(ServerConfig config) {
        this.serverConfig = config ;
        // Currently server-wide.
        Fuseki.verboseLogging = config.verboseLogging ;

        // GZip compression
        // Note that regardless of this setting we'll always leave it turned off
        // for the servlets
        // where it makes no sense to have it turned on e.g. update and upload

        ServletContextHandler context = buildServer(serverConfig.jettyConfigFile, config.enableCompression) ;
        configureDatasets(context) ;
    }

    private void configureDatasets(ServletContextHandler context) {
        // Build them all.
        for (DatasetRef dsDesc : serverConfig.datasets)
            configureOneDataset(context, dsDesc, serverConfig.enableCompression) ;

    }

    /**
     * Initialize the {@link SPARQLServer} instance.
     */
    public void start() {
        String now = DateTimeUtils.nowAsString() ;
        serverLog.info(format("%s %s %s", Fuseki.NAME, Fuseki.VERSION, Fuseki.BUILD_DATE)) ;
        // This does not get set usefully for Jetty as we use it.
        // String jettyVersion = org.eclipse.jetty.server.Server.getVersion() ;
        // serverLog.info(format("Jetty %s",jettyVersion)) ;
        String host = server.getConnectors()[0].getHost() ;
        if ( host != null )
            serverLog.info("Incoming connections limited to " + host) ;
        serverLog.info(format("Started %s on port %d", now, server.getConnectors()[0].getPort())) ;

        try {
            server.start() ;
        } catch (java.net.BindException ex) {
            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage()) ;
            System.exit(1) ;
        } catch (Exception ex) {
            serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex) ;
            System.exit(1) ;
        }

        ServletContextHandler context = (ServletContextHandler)server.getHandler() ;
    }

    /**
     * Stop the {@link SPARQLServer} instance.
     */
    public void stop() {
        String now = DateTimeUtils.nowAsString() ;
        serverLog.info(format("Stopped %s on port %d", now, server.getConnectors()[0].getPort())) ;
        try {
            server.stop() ;
        } catch (Exception ex) {
            Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex) ;
        }
        removeJMX() ;
    }

    /**
     * Get the Jetty instance.
     * @return Server
     */
    public Server getServer() {
        return server ;
    }

    /**
     * Get the datasets associated with the server.
     * @return returns the datasets via {@link org.apache.jena.fuseki.server.ServerConfig#datasets}
     */
    public List<DatasetRef> getDatasets() {
        return serverConfig.datasets ;
    }

    /**
     * Obtain the {@link org.apache.jena.fuseki.server.ServerConfig}
     * @return ServerConfig
     */
    public ServerConfig getServerConfig() {
        return serverConfig ;
    }

    // Later : private and in constructor.
    private ServletContextHandler buildServer(String jettyConfig, boolean enableCompression) {
        if ( jettyConfig != null ) {
            // --jetty-config=jetty-fuseki.xml
            // for detailed configuration of the server using Jetty features.
            server = configServer(jettyConfig) ;
        } else
            server = defaultServerConfig(serverConfig.port, serverConfig.loopback) ;
        // Keep the server to a maximum number of threads.
        // server.setThreadPool(new QueuedThreadPool(ThreadPoolSize)) ;

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS) ;
        context.setErrorHandler(new FusekiErrorHandler()) ;
        context.addEventListener(new FusekiServletContextListener(this));

        // Increase form size.
        context.getServletContext().getContextHandler().setMaxFormContentSize(10 * 1000 * 1000) ;

        // Wire up authentication if appropriate
        if ( jettyConfig == null && serverConfig.authConfigFile != null ) {
            Constraint constraint = new Constraint() ;
            constraint.setName(Constraint.__BASIC_AUTH) ;
            constraint.setRoles(new String[]{"fuseki"}) ;
            constraint.setAuthenticate(true) ;

            ConstraintMapping mapping = new ConstraintMapping() ;
            mapping.setConstraint(constraint) ;
            mapping.setPathSpec("/*") ;

            IdentityService identService = new DefaultIdentityService() ;

            ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ;
            securityHandler.addConstraintMapping(mapping) ;
            securityHandler.setIdentityService(identService) ;

            HashLoginService loginService = new HashLoginService("Fuseki Authentication", serverConfig.authConfigFile) ;
            loginService.setIdentityService(identService) ;

            securityHandler.setLoginService(loginService) ;
            securityHandler.setAuthenticator(new BasicAuthenticator()) ;

            context.setSecurityHandler(securityHandler) ;

            serverLog.debug("Basic Auth Configuration = " + serverConfig.authConfigFile) ;
        }

        // Wire up context handler to server
        server.setHandler(context) ;

        // Constants. Add RDF types.
        MimeTypes mt = new MimeTypes() ;
        mt.addMimeMapping("rdf", WebContent.contentTypeRDFXML + ";charset=utf-8") ;
        mt.addMimeMapping("ttl", WebContent.contentTypeTurtle + ";charset=utf-8") ;
        mt.addMimeMapping("nt", WebContent.contentTypeNTriples + ";charset=ascii") ;
        mt.addMimeMapping("nq", WebContent.contentTypeNQuads + ";charset=ascii") ;
        mt.addMimeMapping("trig", WebContent.contentTypeTriG + ";charset=utf-8") ;

        // mt.addMimeMapping("tpl", "text/html;charset=utf-8") ;
        context.setMimeTypes(mt) ;
        server.setHandler(context) ;

        serverLog.debug("Pages = " + serverConfig.pages) ;

        boolean installManager = true ;
        boolean installServices = true ;

        String validationRoot = "/validate" ;

        // Should all services be /_/.... or some such?

        if ( installManager || installServices ) {
            // TODO Respect port.
            if ( serverConfig.pagesPort != serverConfig.port )
                serverLog.warn("Not supported yet - pages on a different port to services") ;
             if ( serverConfig.pages != null ) {
                 if ( ! FileOps.exists(serverConfig.pages) )
                     serverLog.warn("No pages directory - "+serverConfig.pages) ;
                String base = serverConfig.pages ;
                Map<String, Object> data = new HashMap<String, Object>() ;
                data.put("mgt", new MgtFunctions()) ;
                SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ;
                addServlet(context, templateEngine, "*.tpl", false) ;
             }
        }

        if ( installManager ) {
            // Action when control panel selects a dataset.
            HttpServlet datasetChooser = new ActionDataset() ;
            addServlet(context, datasetChooser, PageNames.actionDatasetNames, false) ;
        }

        if ( installServices ) {
            // Validators
            HttpServlet validateQuery = new QueryValidator() ;
            HttpServlet validateUpdate = new UpdateValidator() ;
            HttpServlet validateData = new DataValidator() ;
            HttpServlet validateIRI = new IRIValidator() ;

            HttpServlet dumpService = new DumpServlet() ;
            HttpServlet generalQueryService = new SPARQL_QueryGeneral() ;

            addServlet(context, validateQuery, validationRoot + "/query", false) ;
            addServlet(context, validateUpdate, validationRoot + "/update", false) ;
            addServlet(context, validateData, validationRoot + "/data", false) ;
            addServlet(context, validateIRI, validationRoot + "/iri", false) ;

            // general query processor.
            addServlet(context, generalQueryService, HttpNames.ServiceGeneralQuery, enableCompression) ;
        }

        if ( installManager || installServices ) {
            String[] files = {"fuseki.html", "index.html"} ;
            context.setWelcomeFiles(files) ;
            addContent(context, "/", serverConfig.pages) ;
        }

        return context ;
    }

    /** Experimental - off by default. The überservlet sits on the dataset name and handles all requests.
      * Includes direct naming and quad access to the dataset.
      */
    public static boolean       überServlet       = false ;

    private static List<String> ListOfEmptyString = Arrays.asList("") ;

    private void configureOneDataset(ServletContextHandler context, DatasetRef dsDesc, boolean enableCompression) {
        String datasetPath = dsDesc.name ;
        if ( datasetPath.equals("/") )
            datasetPath = "" ;
        else
            if ( !datasetPath.startsWith("/") )
                datasetPath = "/" + datasetPath ;

        if ( datasetPath.endsWith("/") )
            datasetPath = datasetPath.substring(0, datasetPath.length() - 1) ;

        dsDesc.init() ;

        DatasetRegistry.get().put(datasetPath, dsDesc) ;
        serverLog.info(format("Dataset path = %s", datasetPath)) ;

        HttpServlet sparqlQuery = new SPARQL_QueryDataset() ;
        HttpServlet sparqlUpdate = new SPARQL_Update() ;
        HttpServlet sparqlUpload = new SPARQL_Upload() ;
        HttpServlet sparqlHttpR = new SPARQL_REST_R() ;
        HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ;
        HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ;

        if ( !überServlet ) {
            // If uberserver, these are unnecessary but can be used.
            // If just means the überservlet isn't handling these operations.
            addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ;
            addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ;
            addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size.
            addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ;
            addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ;
            // This adds direct operations on the dataset itself.
            // addServlet(context, datasetPath, sparqlDataset,
            // ListOfEmptyString, enableCompression) ;
        } else {
            // This is the servlet that analyses requests and dispatches them to
            // the appropriate servlet.
            // SPARQL Query, SPARQL Update -- handles dataset?query=
            // dataset?update=
            // Graph Store Protocol (direct and indirect naming) if enabled.
            // GET/PUT/POST on the dataset itself.
            // It also checks for a request that looks like a service request
            // and passes it
            // on to the service (this takes precedence over direct naming).
            addServlet(context, datasetPath, sparqlDataset, epDataset, enableCompression) ;
        }

        // Add JMX beans to record daatset and it's services.
        addJMX(dsDesc) ;
    }

    private static Server configServer(String jettyConfig) {
        try {
            serverLog.info("Jetty server config file = " + jettyConfig) ;
            Server server = new Server() ;
            XmlConfiguration configuration = new XmlConfiguration(new FileInputStream(jettyConfig)) ;
            configuration.configure(server) ;
            return server ;
        } catch (Exception ex) {
            serverLog.error("SPARQLServer: Failed to configure server: " + ex.getMessage(), ex) ;
            throw new FusekiException("Failed to configure a server using configuration file '" + jettyConfig + "'") ;
        }
    }

    private static Server defaultServerConfig(int port, boolean loopback) {
        // Server, with one NIO-based connector, large input buffer size (for
        // long URLs, POSTed forms (queries, updates)).
        Server server = new Server() ;

        // Using "= new SelectChannelConnector() ;" on Darwin (OS/X) causes
        // problems
        // with initialization not seen (thread scheduling?) in Joseki.

        // BlockingChannelConnector is better for pumping large responses back
        // but there have been observed problems with DirectMemory allocation
        // (-XX:MaxDirectMemorySize=1G does not help)
        // Connector connector = new SelectChannelConnector() ;

        // Connector and specific settings.
        BlockingChannelConnector bcConnector = new BlockingChannelConnector() ;
        // bcConnector.setUseDirectBuffers(false) ;

        Connector connector = bcConnector ;
        // Ignore. If set, then if this goes off, it keeps going off
        // and you get a lot of log messages.
        connector.setMaxIdleTime(0) ; // Jetty outputs a lot of messages if this
                                      // goes off.
        if ( loopback )
            connector.setHost("localhost");
        connector.setPort(port) ;
        // Some people do try very large operations ...
        connector.setRequestHeaderSize(64 * 1024) ;
        connector.setRequestBufferSize(5 * 1024 * 1024) ;
        connector.setResponseBufferSize(5 * 1024 * 1024) ;
        server.addConnector(connector) ;
        return server ;
    }

    private static void addContent(ServletContextHandler context, String pathSpec, String pages) {
        DefaultServlet staticServlet = new DefaultServlet() ;
        ServletHolder staticContent = new ServletHolder(staticServlet) ;
        staticContent.setInitParameter("resourceBase", pages) ;

        // Note we set GZip to false for static content because the Jetty
        // DefaultServlet has
        // a built-in GZip capability that is better for static content than the
        // mechanism the
        // GzipFilter uses for dynamic content
        addServlet(context, staticContent, pathSpec, false) ;
    }

    private void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
                            ServiceRef serviceRef, boolean enableCompression) {
        addServlet(context, datasetPath, servlet, serviceRef.endpoints, enableCompression) ;
    }

    // SHARE
    private static void addServlet(ServletContextHandler context, String datasetPath, HttpServlet servlet,
                                   List<String> pathSpecs, boolean enableCompression) {
        for (String pathSpec : pathSpecs) {
            if ( pathSpec.equals("") ) {
                // "" is special -- add as "base" and "base/"
                addServlet(context, servlet, datasetPath + "/", enableCompression) ;
                addServlet(context, servlet, datasetPath, enableCompression) ;
                continue ;
            }

            if ( pathSpec.endsWith("/") )
                pathSpec = pathSpec.substring(0, pathSpec.length() - 1) ;
            if ( pathSpec.startsWith("/") )
                pathSpec = pathSpec.substring(1, pathSpec.length()) ;
            addServlet(context, servlet, datasetPath + "/" + pathSpec, enableCompression) ;
        }
    }

    private static void addServlet(ServletContextHandler context, HttpServlet servlet, String pathSpec,
                                   boolean enableCompression) {
        ServletHolder holder = new ServletHolder(servlet) ;
        addServlet(context, holder, pathSpec, enableCompression) ;
    }

    private static void addServlet(ServletContextHandler context, ServletHolder holder, String pathSpec,
                                   boolean enableCompression) {
        if ( serverLog.isDebugEnabled() ) {
            if ( enableCompression )
                serverLog.debug("Add servlet @ " + pathSpec + " (with gzip)") ;
            else
                serverLog.debug("Add servlet @ " + pathSpec) ;
        }
        context.addServlet(holder, pathSpec) ;

        if ( enableCompression )
            context.addFilter(GzipFilter.class, pathSpec, EnumSet.allOf(DispatcherType.class)) ;
    }

    private void addJMX() {
        DatasetRegistry registry = DatasetRegistry.get() ;
        for (String ds : registry.keys()) {
            DatasetRef dsRef = registry.get(ds) ;
            addJMX(dsRef) ;
        }
    }

    private void addJMX(DatasetRef dsRef) {
        String x = dsRef.name ;
        // if ( x.startsWith("/") )
        // x = x.substring(1) ;
        ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x, dsRef) ;
        // For all endpoints
        for (ServiceRef sRef : dsRef.getServiceRefs()) {
            ARQMgt.register(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name, sRef) ;
        }
    }

    private void removeJMX() {
        DatasetRegistry registry = DatasetRegistry.get() ;
        for (String ds : registry.keys()) {
            DatasetRef ref = registry.get(ds) ;
        }
    }

    private void removeJMX(DatasetRef dsRef) {
        String x = dsRef.getName() ;
        ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x) ;
        for (ServiceRef sRef : dsRef.getServiceRefs()) {
            ARQMgt.unregister(Fuseki.PATH + ".dataset:name=" + x + "/" + sRef.name) ;
        }
    }
}


text:
/**
 * Jakarta Bean Validation TCK
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */
package org.hibernate.beanvalidation.tck.tests.traversableresolver;

import java.lang.annotation.ElementType;

import jakarta.validation.Path;
import jakarta.validation.TraversableResolver;

/**
 * @author Emmanuel Bernard
 */
public class ExceptionThrowingTraversableResolver implements TraversableResolver {

	public boolean isReachable(Object o, Path.Node node, Class<?> aClass, Path path, ElementType elementType) {
		throw new RuntimeException( "isReachable failed" );
	}

	public boolean isCascadable(Object o, Path.Node node, Class<?> aClass, Path path, ElementType elementType) {
		throw new RuntimeException( "isCascadable failed" );
	}
}

redpajama_set_name: RedPajamaGithub


text:
**Setting up NadekoBot on Linux Digital Ocean Droplet**
If you want Nadeko to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try Nadeko on Linux Digital Ocean Droplet using the link [DigitalOcean](http://m.do.co/c/46b4d3d44795/) (and using this link will be supporting Nadeko and will give you **$10 credit**)

**Operating System Compatibility**
It is recommended that you get **Ubuntu 16.04**, as there have been nearly no problems with it. Also, **32-bit systems are incompatible**.

Compatible operating systems:
- Ubuntu: 14.04, 16.04, 16.10, 17.04, 17.10
- Debian 8
- CentOS 7

**Setting up NadekoBot**
Assuming you have followed the link above to setup an account and Droplet with 64bit OS in Digital Ocean and got the `IP address and root password (in email)` to login, its time to get started.

**Go through this whole guide before setting up Nadeko**

#### Prerequisites
- Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- Download [WinSCP](https://winscp.net/eng/download.php) *(optional)*
- Create and Invite the bot.
	- Read here how to [create a Discord Bot application and invite it.](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#creating-discord-bot-application)

#### Starting up

- **Open PuTTY.exe** that you downloaded before, and paste or enter your `IP address` and then click **Open**.
If you entered your Droplets IP address correctly, it should show **login as:** in a newly opened window.
- Now for **login as:**, type `root` and press enter.
- It should then, ask for password, type the `root password` you have received in your **email address registered with Digital Ocean**, then press Enter.

If you are running your VPS/ droplet for the first time, it will most likely ask you to change your VPS root password, to do that, type the **password you received through email** it won't show any changes on the screen like `******` when password is being typed, press Enter once done.
Type a **new password**, press Enter and type the **new password** again and you're done.
**Write down and save the new password somewhere safe.**
After you've done that, you are ready to use your VPS.

#### Getting NadekoBot
##### Part I - Downloading the installer
Use the following command to get and run `linuxAIO.sh`
(Remember **Do Not** rename the file **linuxAIO.sh**)

`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`

You should see these following options after using the above command:

```
1. Download NadekoBot
2. Run Nadeko (Normally)
3. Run Nadeko with Auto Restart (Run Nadeko normally before using this.)
4. Auto-Install Prerequisites (For Ubuntu, Debian and CentOS)
5. Set up credentials.json (If you have downloaded NadekoBot already)
6. Set up pm2 for NadekoBot (see README)
7. Start Nadeko in pm2 (complete option 6 first)
8. Exit
```
##### Part II - Downloading Nadekobot prerequisites

**If** you are running NadekoBot for the first time on your system and never had any *prerequisites* installed and have Ubuntu, Debian or CentOS, Press `4` and `enter` key, then `y` when you see the following:
```
Welcome to NadekoBot Auto Prerequisites Installer.
Would you like to continue?
```
That will install all the prerequisites your system need to run NadekoBot.
(Optional) **If** you want to install it manually, you can try finding it [here.](https://github.com/Kwoth/NadekoBot-BashScript/blob/1.9/nadekoautoinstaller.sh)

Once *prerequisites* finish installing,

##### Part III - Installing Nadeko
Choose `1` to get the **most updated build of NadekoBot**

and then press `enter` key.

When installation is complete, you will see the options again.

Next, check out:
##### Part IV - Setting up credentials

- [1. Set up credentials.json](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-credentialsjson-file)
- [2. Get the Google API](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys)

You will need the following for the next step:
![botimg](https://cdn.discordapp.com/attachments/251504306010849280/276455844223123457/Capture.PNG)

- **Bot's Client ID** and **Bot's ID** (both are same) [(*required)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-credentialsjson-file)
- **Bot's Token** (not client secret) [(*required)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-credentialsjson-file)
- Your **Discord userID** [(*required)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-credentialsjson-file)
- **Google Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys)
- **LoL Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys)
- **Mashape Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys)
- **Osu Api Key** [(optional)](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys)

Once you have acquired them, press `5` to **Set up credentials.json**

You will be asked to enter the required informations, just follow the on-screen instructions and enter the required information.
*i.e* If you are asked **Bot's Token**, then just copy and paste or type the **Bot's Token** and press `enter` key.

(If you want to skip any optional infos, just press `enter` key without typing/pasting anything.)
Once done,
##### Part V - Checking if Nadeko is working
You should see the options again.
Next, press `2` to **Run Nadeko (Normally)**.
Check in your discord server if your new bot is working properly.

#### Part VI - Setup, Running Nadeko and Updating with [pm2](https://github.com/Unitech/pm2/blob/master/README.md) [strongly recommended]

**If you followed Part V and started Nadeko, make sure to exit the bot by using `.die` if it is running in your server, and/or by pressing `8` in the console to exit.**

You may be presented with the installer main menu from Step I. If not, simply download it again as described in the following section.

Nadeko can be run using [pm2](https://github.com/Unitech/pm2), a process manager that seamlessly handles keeping your bot up. Besides this, it handles disconnections and shutdowns gracefully, ensuring any leftover processes are properly killed. It also persists on server restart, so you can restart your server or VPS/computer and pm2 will manage the startup of your bot. Lastly, there is proper error logging and overall logging. These are just a few features of pm2, and it is a great way to run Nadeko with stability.

##### Setting up pm2/NodeJS for Nadeko

> If you already have NodeJS and pm2 installed on your system, you can skip the *Option 6* for installing pm2 which is a one-time thing. Scroll down to see startup instructions.

There is an automated script built in the Nadeko installer so installation and startup is a breeze. You may already have the `linuxAIO.sh` file downloaded from the first step, but you should download it again to keep up to date for potential changes in the installer. Download `linuxAIO.sh`:

`cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh`

We can then run the script: `sudo bash linuxAIO.sh` and you will be presented with the normal Nadeko installer options.

**Make sure you have installed Nadeko with the first option [1] before doing this, and also have installed the prerequisites with step [4].**

Simply choose **Option 6** to setup pm2 and install it along with NodeJS. This will update your NodeJS so there's no harm running it even if you have NodeJS on your system. It will also install pm2 and then exit to the installer menu again.

##### Running Nadeko with pm2 and Updating Nadeko within pm2

Once you are done installing pm2 with NodeJS, then you can select **Option 7** which will bring you to a menu of choices. These are the normal choices you have for running Nadeko.

- [1] Start with auto-restart with `.die` and no auto-update.
- [2] Start with auto-restart with `.die` *and* auto-update on restart as well.
- [3] Run normally without any auto-restart or auto-update functionality.

Simply choose one of these and Nadeko will start in pm2! If you did everything correctly, you can run the following to check your Nadeko setup:

`sudo pm2 status` to see all pm2 processes

`sudo pm2 info Nadeko` information about Nadeko

`sudo pm2 logs Nadeko` to view real-time logs of Nadeko (you can do `sudo pm2 logs Nadeko --lines <number>`) (number = how many lines you wish to output) for viewing more lines of the log. The logfile is also stored and presented at the top of these commands.

> **Updating Nadeko within pm2:**

**If you don't auto-update Nadeko and manually do, one simply needs to run the linuxAIO.sh script: `sudo sh linuxAIO.sh` as we normally would and choose [1] Download NadekoBot, then after downloading is complete/build is done, just `pm2 restart Nadeko` -- that's all!**

**NOTE:**  If you did the pm2 setup, you are done! You do not need to follow the startup instructions later in the guide, as we've used the script and pm2 to start Nadeko up already. Wasn't that easy? :-)

**Some other useful pm2 commands:**

`sudo pm2 startup && sudo pm2 save` will setup pm2 to persist even on system reboot by saving the process ID information as a system service. Just need to do this once if you wish.

`sudo pm2 stop Nadeko` will stop Nadeko properly and ensure it is shut down. `sudo pm2 restart Nadeko` will restart Nadeko properly as well, shutting it down first and promptly restarting.

This is the recommended way to keep Nadeko running smoothly.

#### Part VII - Running Nadeko on tmux [if you wish not to use pm2]

If your bot is working properly in your server, type `.die` to **shut down the bot**, then press `8` on the console to **exit**.
Next, [Run your bot again with **tmux**.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#running-nadekobot)

[Check this when you need to **restart** your **NadekoBot** anytime later along with tmux session.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#restarting-nadeko)

##### Running NadekoBot

**Create a new Session:**

- `tmux new -s nadeko`

The above command will create a new session named **nadeko** *(you can replace "nadeko" with anything you prefer and remember its your session name)* so you can run the bot in background without having to keep the PuTTY running.

**Next, we need to run `linuxAIO.sh` in order to get the latest running scripts with patches:**

- `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`

**From the options,**

Choose `2` to **Run NadekoBot normally.**
**NOTE:** With option `2` (Running normally), if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) in discord. The bot will shut down and will stay offline until you manually run it again. (best if you want to check the bot.)

Choose `3` to **Run NadekoBot with Auto Restart.**
**NOTE:** With option `3` (Running with Auto Restart), bot will auto run if you use `.die` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/#administration) making the command `.die` to function as restart.

It will show you the following options:
```
1. Run Auto Restart normally without Updating.
2. Run Auto Restart and update NadekoBot.
3. Exit
```

- With option `1. Run Auto Restart normally without Updating.` Bot will restart on `die` command and will not be downloading the latest build available.
- With option `2. Run Auto Restart and update NadekoBot.` Bot will restart and download the latest build of bot available everytime `die` command is used.

**Remember** that, while running with Auto Restart, you will need to [close the tmux session](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#restarting-nadeko) to stop the bot completely.

**Now check your Discord, the bot should be online**

Next to **move the bot to background** and to do that, press **CTRL+B, release, D** (that will detach the nadeko session using TMUX) and you can finally close **PuTTY**.

#### Restarting Nadeko

**Restarting NadekoBot:**

**If** you have chosen option `2` to **Run Nadeko with Auto Restart** from Nadeko's `linuxAIO.sh` *[(you got it from this step)](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#getting-nadekobot)*
You can simply type `.die` in the server you have your NadekoBot to make her restart.

**Restarting Nadeko with the Server:**

Open **PuTTY** and login as you have before, type `reboot` and press Enter.

**Restarting Manually:**

- Kill your previous session, check with `tmux ls`
- `tmux kill-session -t nadeko` (don't forget to replace "nadeko" to what ever you named your bot's session)
- [Run the bot again.](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/#running-nadekobot)

#### Updating Nadeko

- Connect to the terminal through **PuTTY**.
- `tmux kill-session -t nadeko` (don't forget to replace **nadeko** in the command with the name of your bot's session)
- Make sure the bot is **not** running.
- `tmux new -s nadeko` (**nadeko** is the name of the session)
- `cd ~ && wget -N https://github.com/Kwoth/NadekoBot-BashScript/raw/1.9/linuxAIO.sh && bash linuxAIO.sh`
- Choose `1` to update the bot with **latest build** available.
- Next, choose either `2` or `3` to run the bot again with **normally** or **auto restart** respectively.
- Done.

#### Additional Information

##### Setting up Music

To set up Nadeko for music and Google API Keys, follow [Setting up your API keys.][setup music]

##### tmux

- If you want to **see the sessions** after logging back again, type `tmux ls`, and that will give you the list of sessions running.
- If you want to **switch to/ see that session**, type `tmux a -t nadeko` (**nadeko** is the name of the session we created before so, replace **"nadeko"** with the session name you created.)
- If you want to **kill** NadekoBot **session**, type `tmux kill-session -t nadeko`

##### Setting up SFTP

- Open **WinSCP**
- Click on **New Site** (top-left corner).
- On the right-hand side, you should see **File Protocol** above a drop-down selection menu.
- Select **SFTP** *(SSH File Transfer Protocol)* if its not already selected.
- Now, in **Host name:** paste or type in your `Digital Ocean Droplets IP address` and leave `Port: 22` (no need to change it).
- In **Username:** type `root`
- In **Password:** type `the new root password (you changed at the start)`
- Click on **Login**, it should connect.
- It should show you the NadekoBot folder which was created by git earlier on the right-hand side window.
- Open that folder, then open the `src` folder, followed by another `NadekoBot` folder and you should see `credentials.json` there.

##### Setting up credentials.json

- Copy the `credentials.json` to desktop
- EDIT it as it is guided here: [Setting up credentials.json][setup credentials]
- Paste/put it back in the folder once done. `(Using WinSCP)`
- **If** you already have Nadeko 1.3.x setup and have `credentials.json` and `NadekoBot.db`, you can just copy and paste the `credentials.json` to `NadekoBot/src/NadekoBot` and `NadekoBot.db` to `NadekoBot/src/NadekoBot/bin/Release/netcoreapp2.0/data` using WinSCP.
**Or** follow the [Upgrading Guide.][upgrading]

[img7]: https://cdn.discordapp.com/attachments/251504306010849280/251505766370902016/setting_up_credentials.gif
[setup credentials]: http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-credentialsjson-file
[setup music]: http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#setting-up-your-api-keys
[upgrading]: http://nadekobot.readthedocs.io/en/latest/guides/Upgrading%20Guide/


text:
package com.iteye.weimingtom.fastfire.vm.effect;

import com.iteye.weimingtom.fastfire.port.image.FFFImage;
import com.iteye.weimingtom.fastfire.vm.window.FFFMainWin;

public class FFFFlashEffect extends FFFEffect {
	public FFFFlashEffect(FFFMainWin win, FFFImage dst) {
		super(win, 1000 / 24, dst);
	}

	@Override
	public boolean step() {
		return false;
	}
}


text:
package com.ja.markdown.modeller.sc.java.model;

import lombok.Data;

import org.apache.commons.lang3.StringUtils;

@Data
public class JavaDependency {
	public enum Scope {
		compile, test, provided, runtime
	};

	private String groupId;
	private String artifactId;
	private String version;
	private Scope scope;

	public static JavaDependency compile(final String dependency) {
		return dependency(Scope.compile, dependency);
	}

	public static JavaDependency test(final String dependency) {
		return dependency(Scope.test, dependency);
	}

	public static JavaDependency provided(final String dependency) {
		return dependency(Scope.provided, dependency);
	}

	public static JavaDependency runtime(final String dependency) {
		return dependency(Scope.runtime, dependency);
	}

	private static JavaDependency dependency(final Scope scope,
			final String dependency) {
		final String[] tokens = StringUtils.split(dependency, ":");
		if (tokens.length < 3) {
			throw new RuntimeException("Invalid dependency definition. "
					+ dependency);
		}
		final JavaDependency dep = new JavaDependency();
		dep.setGroupId(tokens[0]);
		dep.setArtifactId(tokens[1]);
		dep.setVersion(tokens[2]);
		if (!Scope.compile.equals(scope)) {
			dep.setScope(scope);
		}
		return dep;
	}
}


text:
using System;
using System.Collections.Generic;

using System.Text;

namespace hix
{
    public class Schema
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private List<Model> models;

        internal List<Model> Models
        {
            get { return models; }
            set { models = value; }
        }
    }
}


text:
var StatusWidgetModel = Backbone.Model.extend({

    url: "api/status",

    initialize: function() {
    }
})


text:
/// <reference path="../node/node.d.ts" />

declare module "through" {
	import stream = require("stream");

	function through(write?: (data) => void,
		end?: () => void,
		opts?: {
			autoDestroy: boolean;
		}): through.ThroughStream;

	module through {
		export interface ThroughStream extends stream.Transform {
			autoDestroy: boolean;
		}
	}

	export = through;
}


text:
var constants = require(__dirname + "/workbook-constants");

const EXPRESSION_SHEET_SUFFIXES = ["_expression", "_optimized_expression", "_sigmas"];

const addExpWarning = (workbook, message) => {
    let warningsCount;
    if (!Object.keys(workbook).includes("warnings")) {
        warningsCount = 0;
        workbook.warnings = [];
    } else {
        warningsCount = workbook.warnings.length;
    }
    const MAX_WARNINGS = 75;
    if (warningsCount < MAX_WARNINGS) {
        workbook.warnings.push(message);
    } else {
        workbook.errors.push(constants.errors.warningsCountError);
        return false;
    }
};

const addExpError = (workbook, message) => {
    const errorsCount = workbook.errors.length;
    const MAX_ERRORS = 20;
    if (errorsCount < MAX_ERRORS) {
        workbook.errors.push(message);
    } else {
        workbook.errors.push(constants.errors.errorsCountError);
        return false;
    }
};

const fillArray = (value, array, length) => { // mutator
    while (array.length < length) {
        array.push(value);
    }
    return array;
};

const isExpressionSheet = (sheetName) => {
    return EXPRESSION_SHEET_SUFFIXES.some(function (suffix) {
        return sheetName.includes(suffix);
    });
};

// Going to continue basing this section off of the parseWorkbookSheet function in spreadsheet-controller.js
var parseExpressionSheet = function (sheet) {

    var geneData = {};
    var expressionData = {
        errors: [],
        warnings: [],
        timePoints: [],
        columnGeneNames: []
    };

    // Check that id label is correct. Throw error if not.
    const idLabel = sheet.data[0][0];
    if (idLabel !== "id") {
        addExpError(expressionData, constants.errors.idLabelError(sheet.name));
    }
    expressionData.timePoints = sheet.data[0].slice(1);
    const numberOfDataPoints = expressionData.timePoints.length;
    let compareTimePoint = 0;
    for (let i = 0; i < numberOfDataPoints; i++) {
        if (isNaN(expressionData.timePoints[i]) && expressionData.timePoints[i] !== undefined) {
            addExpError(expressionData, constants.errors.nonNumericalTimePointsError(i + 1, sheet.name));
        } else if (expressionData.timePoints[i] < 0) {
            addExpError(expressionData, constants.errors.negativeTimePointError(i + 1, sheet.name));
        } else if (expressionData.timePoints[i] < compareTimePoint) {
            addExpError(expressionData, constants.errors.nonMonotonicTimePointsError(i + 1, sheet.name));
            break;
        } else {
            compareTimePoint = expressionData.timePoints[i];
        }

    }
    let geneNames = [];
    sheet.data.forEach(function (sheet) {

        const geneName = sheet[0];
        if (geneName) {
            geneNames.push(geneName);
            const rowData = sheet.slice(1);
            // Sometimes, missing data is at the end of the row. In this case, pad the
            // array with nulls
            if (rowData.length < numberOfDataPoints) {
                fillArray(null, rowData, numberOfDataPoints);
            }
            geneData[geneName] = rowData;
        }
    });
    geneNames = geneNames.slice(1);
    geneNames.forEach(x => expressionData.columnGeneNames.push(x));
    expressionData.data = geneData;
    if (expressionData.data.id) {
        // Throw warning in case of extraneous data
        // Need to add a case where it checks the depth of the columns, as well
        const rowLength = expressionData.data.id.length;
        let rowCounter = 0;
        let columnChecker = new Array(rowLength).fill(0);
        Object.values(expressionData.data).forEach(function (row) {
            if (row.length !== rowLength) {
                addExpWarning(expressionData, constants.warnings.extraneousDataWarning(sheet.name, row));
            }
            // Check for missing Column Headers
            if (rowCounter === 0) {
                for (let i = 0; i < rowLength; i++) {
                    if (sheet.data[0][i] === undefined) {
                        addExpError(expressionData, constants.errors.missingColumnHeaderError(sheet.name));
                    }
                }
            } else {
                for (var i = 0; i < rowLength; i++) {
                    if (sheet.data[rowCounter][i] !== undefined) {
                        columnChecker[i]++;
                    }
                }
            }

            let nonnullCount = 0;
            // check for empty rows
            for (let i = 0; i <= rowLength; i++) {
                if (i === rowLength) {
                    if (nonnullCount === 0) {
                        addExpError(expressionData, constants.errors.emptyExpressionRowError(i, sheet.name));
                        break;
                    }
                } else {
                    if (row[i]) {
                        nonnullCount++;
                    }
                }
            }
            rowCounter++;
        });
        // check for empty columns
        for (var i = 0; i < columnChecker.length; i++) {
            if (columnChecker[i] === 0) {
                addExpError(expressionData, constants.errors.emptyExpressionColumnError(i, sheet.name));
            }
        }
    }

    return expressionData;
};

module.exports = function (workbook) {
    const output = {
        expression: {},
        warnings: [],
        errors: []
    };
    var expCount = 0;

    workbook.forEach(function (sheet) {
        if (isExpressionSheet(sheet.name)) {
            output["expression"][sheet.name] = parseExpressionSheet(sheet);
            expCount++;
        }
    });

    if (expCount <= 0) {
        addExpWarning(output, constants.warnings.missingExpressionWarning());
    }
    return output;
};


text:
using Xunit;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Test
{
    public class SequenceEqualTests
    {
        //
        // SequenceEqual
        //

        [Fact]
        public static void RunSequenceEqualTest()
        {
            RunSequenceEqualTestCore(1024, 1024);
            RunSequenceEqualTestCore(1024, 1024, 512);
            RunSequenceEqualTestCore(1024, 1024, 1024 + 512);
            RunSequenceEqualTestCore(1024, 512);
            RunSequenceEqualTestCore(1024, 512, 512);
            RunSequenceEqualTestCore(1024, 512, 1024 + 256);
            RunSequenceEqualTestCore(0, 0);
            RunSequenceEqualTestCore(1024 * 1027, 1024 * 1027);
            RunSequenceEqualTestCore(1024 * 1027, 1024 * 1027, 1024 * 5);
            RunSequenceEqualTestCore(1024 * 1027, 1024 * 1027, (1024 * 1027) + (1024 * 5));
        }

        [Fact]
        public static void RunSequenceEqualTest2()
        {
            RunSequenceEqualTest2Core(0, 10, 0, 10);
            RunSequenceEqualTest2Core(0, 1000, 0, 1000);
            RunSequenceEqualTest2Core(0, 1, 0, 1);
            RunSequenceEqualTest2Core(0, 0, 0, 0);

            RunSequenceEqualTest2Core(0, 10, 1, 10);
            RunSequenceEqualTest2Core(0, 10, 1, 9);
            RunSequenceEqualTest2Core(0, 10, 1, 9);
            RunSequenceEqualTest2Core(0, 0, 0, 1);
        }

        [Fact]
        public static void RunSequenceEqualTest3()
        {
            // Regression tests
            RunSequenceEqualTest3Core(ParallelExecutionMode.Default);
            RunSequenceEqualTest3Core(ParallelExecutionMode.ForceParallelism);
        }

        private static void RunSequenceEqualTestCore(int leftSize, int rightSize, params int[] notEqual)
        {
            int[] left = new int[leftSize];
            for (int i = 0; i < leftSize; i++) left[i] = i * 2;
            int[] right = new int[rightSize];
            for (int i = 0; i < rightSize; i++) right[i] = i * 2;

            if (notEqual != null)
            {
                for (int i = 0; i < notEqual.Length; i++)
                {
                    // To make the elements not equal, we just invert them.
                    int idx = notEqual[i];
                    if (idx >= leftSize)
                        right[idx - leftSize] = -right[idx - leftSize];
                    else
                        left[idx] = -left[idx];
                }
            }

            bool expect = leftSize == rightSize && (notEqual == null || notEqual.Length == 0);
            bool result = left.AsParallel().AsOrdered().SequenceEqual(right.AsParallel().AsOrdered());

            if (expect != result)
            {
                string method = string.Format("RunSequenceEqualTest(leftSize={0}, rightSize={1}, notEqual={2}):", leftSize, rightSize, notEqual);
                Assert.True(false, string.Format(method + "  > FAILED.  Expect: {0}, real: {1}", expect, result));
            }
        }

        private static void RunSequenceEqualTest2Core(int range1From, int range1Count, int range2From, int range2Count)
        {
            bool expect = (range1From == range2From) && (range1Count == range2Count);
            IEnumerable<int>[] sources = {
                                             Enumerable.Range(range1From, range1Count),
                                             Enumerable.Range(range2From, range2Count)
                                         };
            List<ParallelQuery<int>>[] enumerables = new List<ParallelQuery<int>>[2];

            for (int t = 0; t < 2; t++)
            {
                IEnumerable<int> source = sources[t];

                enumerables[t] = new List<ParallelQuery<int>>
                {
                    source.AsParallel().AsOrdered(),
                    new LinkedList<int>(source).AsParallel().AsOrdered(),
                    source.AsParallel().AsOrdered().Where(i => true),
                    source.ToArray().AsParallel().AsOrdered().Where(i => true),
                    source.AsParallel().AsOrdered().Where(i=>true).Reverse().Reverse(),
                    source.Reverse().ToArray().AsParallel().AsOrdered().Where(i=>true).Reverse(),
                    source.AsParallel().AsOrdered().OrderBy(i => i),
                    source.AsParallel().AsOrdered().Select(i => i).Reverse().Reverse().Skip(0)
                };
            }

            foreach (ParallelQuery<int> ipe1 in enumerables[0])
            {
                foreach (ParallelQuery<int> ipe2 in enumerables[1])
                {
                    bool[] results = new bool[] { ipe1.SequenceEqual(ipe2), ipe2.SequenceEqual(ipe1) };
                    foreach (bool result in results)
                    {
                        if (result != expect)
                        {
                            string method = string.Format("RunSequenceEqualTest2([{0}..{1}) vs [{2}..{3}))",
                                range1From, range1From + range1Count, range2From, range2From + range2Count);
                            Assert.True(false, string.Format(method + "  >  FAILED. Expect: {0}, real: {1}", expect, result));
                        }
                    }
                }
            }
        }

        private static void RunSequenceEqualTest3Core(ParallelExecutionMode mode)
        {
            int collectionLength = 1999;

            try
            {
                new DisposeExceptionEnumerable<int>(Enumerable.Range(0, collectionLength)).AsParallel()
                    .WithDegreeOfParallelism(2)
                    .WithExecutionMode(ParallelExecutionMode.ForceParallelism)
                    .SequenceEqual(new DisposeExceptionEnumerable<int>(Enumerable.Range(0, collectionLength)).AsParallel());
            }
            catch (AggregateException)
            {
                return;
            }
            catch (Exception ex)
            {
                Assert.True(false, string.Format("RunSequenceEqualTest3(mode={1}):  > Failed: Expected AggregateException, got {0}", ex.GetType(), mode));
            }

            Assert.True(false, string.Format("RunSequenceEqualTest3(mode={0}):  > Failed: Expected AggregateException, got no exception", mode));
        }

        private class DisposeExceptionEnumerable<T> : IEnumerable<T>
        {
            private IEnumerable<T> _enumerable;
            public DisposeExceptionEnumerable(IEnumerable<T> enumerable)
            {
                _enumerable = enumerable;
            }

            public IEnumerator<T> GetEnumerator()
            {
                return new DisposeExceptionEnumerator<T>(_enumerable.GetEnumerator());
            }
            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
            {
                return new DisposeExceptionEnumerator<T>(_enumerable.GetEnumerator());
            }
        }

        private class DisposeExceptionEnumerator<T> : IEnumerator<T>
        {
            private IEnumerator<T> _enumerator;
            public DisposeExceptionEnumerator(IEnumerator<T> enumerator)
            {
                _enumerator = enumerator;
            }
            public T Current
            {
                get { return _enumerator.Current; }
            }
            public void Dispose()
            {
                _enumerator.Dispose();
                throw new ArgumentException();
            }

            object System.Collections.IEnumerator.Current
            {
                get { return _enumerator.Current; }
            }
            public bool MoveNext()
            {
                return _enumerator.MoveNext();
            }
            public void Reset()
            {
                _enumerator.Reset();
            }
        }
    }
}


text:
function y=highpass_filter_signal(x,fsout);
%
% function to utilize a pre-designed highpass filter to eliminate DC
% offset and 60 Hz hum in a speech or audio recording
%
% Inputs:
%   x: input signal to be filtered
%   fsout: sampling rate of signal
%
% Output:
%   y: highpass filtered speech

% determine name of .mat file with filter coefficients and load filter
% coefficients
    if (fsout == 6000) n=200;
    elseif (fsout == 6667) n=250;
    elseif (fsout == 8000) n=300;
    elseif (fsout == 10000) n=350;
    elseif (fsout == 16000) n=600;
    elseif (fsout == 20000) n=700;
    else
        fprintf('sampling rate incorrect \n');
        pause
    end
    filter_file=['hpf_fsout_',num2str(fsout),'_n_',num2str(n),'_fstop_',...
        num2str(100),'.mat'];
    load (filter_file);

% append zeros to signal input of length the same as the filter
    xin=[x' zeros(1,n)];

% filter input signal with filter coefficients
    xout=filter(b,1,xin);

% offset output samples by length of filter impulse response, n
    nl=length(x);
    y(1:nl)=xout(n:n+nl-1);

end


text:
<?php

namespace Vetal\SiteBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * CategoryRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class CategoryRepository extends EntityRepository {

  public function findAllOrderedByName() {
    return $this->createQueryBuilder('c') //->getEntityManager()
    ->orderBy('c.name', 'DESC')
    ->getQuery() //->createQuery('SELECT c FROM VetalSiteBundle:Category c ORDER BY c.name ASC')
    ->getResult();
  }
}


text:
$.fn.nextOrFirst = function(selector) {
    var next = this.next(selector);
    return (next.length) ? next : this.prevAll(selector).last();
}
$('document').ready(function() {
    document.addEventListener("DOMMouseScroll", catchWheel, false);
    document.addEventListener("mousewheel", catchWheel, false);
});
var counter = 0;
function catchWheel(e) {
    delta = e.wheelDelta || e.deltaY || e.detail;
    console.log(delta);
    counter = (counter + (delta<0?-1:1));
    console.log(counter);
    document.removeEventListener("DOMMouseScroll", catchWheel, false);
    document.removeEventListener("mousewheel", catchWheel, false);
    $('.wrapper').css({
        "transform": "rotateZ(" + (counter * 90) + "deg)"
    });
    $('.active_from_anchor').removeClass('active_from_anchor');
    $('#backgrounds > div').eq(counter % 4).addClass('active').siblings().removeClass('active');
    $(".carriage").stop(true).animate({
        textIndent: (-counter * 90)
    }, {
        step: function(now, fx) {
            $(this).css('transform', 'rotate(' + (now) + 'deg)');
        },
        duration: 7000,
        easing: 'easeOutElastic'
    });
    $('.page.active').removeClass('active');
    setTimeout(function() {
        $('.page[pageId=' + (-(counter % 4)) + ']').addClass('active');
        currentSlider = $('[anchor=' + (-counter % 4) + ']').attr('id');
        $('#' + currentSlider).addClass('active_from_anchor');
        document.addEventListener("DOMMouseScroll", catchWheel, false);
        document.addEventListener("mousewheel", catchWheel, false);
    }, 1500);
}
var $next = $('#headliners > .card').eq(3);
slider = setInterval(function() {
    $('#headliners.active_from_anchor > .card.active[order]').each(function(i, item) {
        if ($(item).attr('order') == '3') {
            $(item).removeClass('active').addClass('leaving');
        } else if ($(item).attr('order') == '2') {
            $(item).attr('order', '3');
        } else if ($(item).attr('order') == '1') {
            $(item).attr('order', '2');
        }
    });
    if ($('#headliners').hasClass('active_from_anchor')) {
        $next.addClass('active').attr('order', 1);
        $next = $next.nextOrFirst();
    }
    setTimeout(function() {
        $('#headliners.active_from_anchor > .card.leaving').removeClass('leaving').attr('order', false);
    }, 1000);
}, 5000);
pro_shows = setInterval(function() {
    $('#pro_shows.active_from_anchor > .card.active').addClass('leaving').removeClass('active').nextOrFirst().addClass('active');
    setTimeout(function() {
        $('#pro_shows.active_from_anchor > .leaving').removeClass('leaving');
    }, 1500)
}, 5000);
var clearTime = null;
$('#home_page').mousemove(function(e){
   w = window.innerWidth/2;
   h = window.innerHeight/2;
   $(this).find('[data-depth]').each(function(i,item){
    $(item).css('transform','translate('+($(this).data('depth')*0.1*(e.pageX-w))+'px,'+($(this).data('depth')*0.1*(e.pageY-h))+'px)');
   });
   $(this).addClass('lit');
   if(clearTime) clearTimeout(clearTime);
   clearTime = setTimeout(function(){
        $('#home_page').removeClass('lit');
   },1000);
});

$('#enter_site').click(function(){
    $('#home_page').css('display','none');
});


text:
<!DOCTYPE html>

    <title>Adron's Thrashing Code</title>
    <meta name="description" content="">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="alternate" href="/feed.xml" type="application/rss+xml" title="Coder, Messenger, Recon, Infrastructure, Ops, & A Sprinkling of Metal">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-16x16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="/img/favicons/favicon-96x96.png" sizes="96x96">
    <link rel="apple-touch-icon" sizes="57x57" href="/img/favicons/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/img/favicons/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/img/favicons/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/img/favicons/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/img/favicons/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/img/favicons/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/img/favicons/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/img/favicons/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/img/favicons/apple-touch-icon-180x180.png">
    <link rel="stylesheet" href="/css/custom.css">
    <link rel="stylesheet" href="/css/style.min.css">

Conf - Meetup - Events

Speaking - Presentations - Workshops

Calendar of Engagements

Thrashing Code News

Medium

Docs

Contact

Message

Hire

About

Adron's Thrashing Code

Coder, Messenger, Recon, Infrastructure, Ops, & A Sprinkling of Metal

December Coding & Hacking Projects | Top 5 Priorities

As of today I've made a few specific decisions that I'll announce on January 1st of 2017. But for now I've got a slew of other things I'm going to attempt to knock out in the coming days. Hopefully I can make them useful and fun to read, if not, that's cool too since I'll make use of it!

If you're a regular reader you'll get a few pieces of my opinion in the next 31 days.

The plan is to produce one blog entry per week related to Go around the language, toolchain, and hacking around in IDEs and related tooling.

I will be wrapping up several blog entries that you'll see going live over on Codeship's Blog. Topics include a bit o' Jenkins, Go, and what you can get out of Codeship and their respective toolchain and services!

Put together a sick new machine for myself and order by X-mas (no expectation of delivery, just ordering it! - also, blog it!!)

I am putting together some other project work for some un-named companies (primarily because I'm unsure if they'd want me to mention what they're working on at this time, so I'll keep that on the down low). But by proxy I will have some reviews of several technologies.

So mark, and go. We'll all see if I can knock these five things out by the end of December!

30. November 2016

Notes on Go / Future Writings

Notes & Thoughts on Go:

So far I like Go. Primarily because it is just simple. Simply RTFMing it gets one pretty far without any fuss. The hardest part of the language to grasp seems to be the same things I often have issue with, which is the ecosystem has it's own conventions are related things one just simply doesn't know. It involves going through the docs and just remembering where the GOPATH is, where the build files go, what the go commands do with the toolset, and related things.

One thing that required a bit of fiddling around with to get figured out was writing tests for Go. The convention to mark tests and have them executed is actually super easy once you know the specifics of the toolchain.

more

20. November 2016

I Want an Organized Go Project

After the last two cookbook style blog entries on a basic CLI with a simple service with Go there needed to be some organization around the projects. Here's the next steps on getting those projects organized.

more

04. November 2016

                    <form action="https://google.com/search" method="get">
                      <input type="hidden" name="sitesearch" value="http://blog.adron.me">
                      <input type="text" name="q" placeholder="search" class="search-input form-control">
                    </form>

Keyword Search

terraform

kubernetes

immutable infrastructure

html

javascript

ubuntu

node pdx

.net fringe

videos

About

Me, Adron

My Hobbies

My Photos

My Presentations

Collection of Docs & Notes

Photos

Node PDX 2016

Jon Oropeza @ Node PDX 2016

Node PDX 2016

Liz Abinante @ Node PDX 2016

Prague (Praha)

Praha hlavní nádraží

St Mary's Basilica

Bazylika Mariacka in Rynek Główny.

Visual Studio Code

Images from a review of Visual Studio Code.

Mono Develop & WebStorm

Working through Mono Develop & WebStorm.

« Newer Previous »


text:
published: true
title: The Tilted Earth
layout: post
---
One day the earth tipped over.
No, seriously just plunk, on her side
Like a drunk falling off a sidewalk
You can imagine my surprise,
Ok well everyones surprise and having the rotational effect of the earth weaken
Revolutions per minute were down,
Which of course means gravity weakens
At first I thought it was a direct result of the new steroids I was taking
Because everything seemed so much lighter
But then I noticed I had trouble walking down the street
Even when I was sober
Imagine That!
Now, I'm not one for much of tv or fox news, those phony little prick bastards
So I didn't really pay attention
And that Mrs. Davies, she always tell you a yarn longer than gigantic sea squid, that's at least 80 feet mind you
SO I didn't pay her no mind when she was trying tell me some malarky about the earth tipping over
I figured it was just her that was tipped
If you know what I mean

So anyways there I was thinking my doping was going good
I was on top of the world, literally at a least one point in the day
 I mean I guess if you think about it, not scientifically of course,
You think that your entire perspective would change and things would feel different
But not much seemed to change, at first anyways

People, and by people I pretty much just mean me, just went on with their lives as normal
I went to work, if you could call it that, mostly just me hanging around the corner looking to sell
Customers didn't really drop off much, a few were scared the first couple of days
But they came back around after a bit
Once they realized that is was in fact not the end of the world

The funny thing is just thinking about the earth now, like its laid down on its side for a rest of some sort
Well, it kind of fucks with your mind
Like, why the fuck did it do that
Invariably followed by, are we all going to die?
Nope, we sure didn't
At least not yet
As long as well don't start offing each other
Really the problem is all psychological
That sudden realization that hey were on a fucking planet that just fell the fuck over
Seriously, what happened?
That's some crazy shit right
Why did it tip over anyways?
There wasn't any explosion or impact with some other planetary body
That's what all those scientists say
And hey, they're supposed to be smart and know this shit, right?

So any who this psycho babble bullshit starts poppin up
And you know all those nutters out there are  preaching this end of days
Repent for your sins crap
Funny enough my business starts pickin up from them bastards
Guess they can't cope

I mean seriously life goes on right
Yeah yeah sure the earths gonna start cooling off because some hot mess at the center of it is out of alignment
That's what one of them scientists said anyways
Maybe he's lying his ass off so he can keep some sweet gig
Lecturing and tellin everyone what to believe
Big bucks I bet

But hey, my business is booming
People scared as shit that they got nothing to lose
Want to get that shit to fuck with their minds so they don't give a shit either
Fuck it

I figure make my money while I can
It's all about economics, I learned this shit in sixth grade
Coincidentally about the time I dropped out of school
Who needs that shit anyways.
Them smart ass motherfuckers can't fix it either
Guess they ain't gotta worry about student debt no more though

So anyways its all about supply and demand
I've got the supply, but shit that demand is outta sight now
Nobody, I mean nobody wants to think about the future

I guess they just get all depressed thinkin 'bout the tilted earth
And worried about what will happen to the future, if there is one
I say live your fuckin life today and enjoy the ride

It's kind like a tilt-a-whirl now, right?


text:
package org.apache.axis2.saaj;

import org.apache.axiom.om.OMElement;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import java.util.Iterator;

public class SOAPBodyElementImpl<T extends OMElement> extends SOAPElementImpl<T> implements SOAPBodyElement {

    /** @param element  */
    public SOAPBodyElementImpl(T element) {
        super(element);
    }

    public void setParentElement(SOAPElement parent) throws SOAPException {
        if (!(parent instanceof SOAPBody)) {
            throw new IllegalArgumentException("Parent is not a SOAPBody");
        }
        super.setParentElement(parent);
    }

    public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
        return super.addAttribute(qname, value);
    }

    public SOAPElement addChildElement(QName qname) throws SOAPException {
        return super.addChildElement(qname);
    }

    public QName createQName(String localName, String prefix) throws SOAPException {
        return super.createQName(localName, prefix);
    }

    public Iterator getAllAttributesAsQNames() {
        return super.getAllAttributesAsQNames();
    }

    public String getAttributeValue(QName qname) {
        return super.getAttributeValue(qname);
    }

    public Iterator getChildElements(QName qname) {
        return super.getChildElements(qname);
    }

    public QName getElementQName() {
        return super.getElementQName();
    }

    public boolean removeAttribute(QName qname) {
        return super.removeAttribute(qname);
    }

    public SOAPElement setElementQName(QName newName) throws SOAPException {
        return super.setElementQName(newName);
    }
}


text:
var _ = require('underscore');

module.exports = {

    getAppState : function() {
        var app = this.options.app;
        return app.state;
    },

    _updateAppState : function(path, value) {
        var state = this.getAppState();
        function visit(p, obj) {
            if (_.isArray(obj)) {
                state.setValues(p, obj);
            } else if (_.isObject(obj)) {
                _.each(obj, function(val, key) {
                    visit(p + '.' + key, val);
                });
            } else {
                state.setValue(p, obj);
            }
        }
        visit(path, value);
    },

    _getAppState : function(path) {
        var state = this.getAppState();
        return state.getValue(path);
    },

};