text:
package org.xutils.db.table;

import org.xutils.common.util.LogUtil;
import org.xutils.db.converter.ColumnConverter;
import org.xutils.db.converter.ColumnConverterFactory;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashSet;

public final class ColumnUtils {

    private ColumnUtils() {
    }

    private static final HashSet<Class<?>> BOOLEAN_TYPES = new HashSet<Class<?>>(2);
    private static final HashSet<Class<?>> INTEGER_TYPES = new HashSet<Class<?>>(2);
    private static final HashSet<Class<?>> AUTO_INCREMENT_TYPES = new HashSet<Class<?>>(4);

    static {
        BOOLEAN_TYPES.add(boolean.class);
        BOOLEAN_TYPES.add(Boolean.class);

        INTEGER_TYPES.add(int.class);
        INTEGER_TYPES.add(Integer.class);

        AUTO_INCREMENT_TYPES.addAll(INTEGER_TYPES);
        AUTO_INCREMENT_TYPES.add(long.class);
        AUTO_INCREMENT_TYPES.add(Long.class);
    }

    public static boolean isAutoIdType(Class<?> fieldType) {
        return AUTO_INCREMENT_TYPES.contains(fieldType);
    }

    public static boolean isInteger(Class<?> fieldType) {
        return INTEGER_TYPES.contains(fieldType);
    }

    public static boolean isBoolean(Class<?> fieldType) {
        return BOOLEAN_TYPES.contains(fieldType);
    }

    /* package */
    static Method findGetMethod(Class<?> entityType, Field field) {
        if (Object.class.equals(entityType)) return null;

        String fieldName = field.getName();
        Method getMethod = null;
        if (isBoolean(field.getType())) {
            getMethod = findBooleanGetMethod(entityType, fieldName);
        }
        if (getMethod == null) {
            String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
            try {
                getMethod = entityType.getDeclaredMethod(methodName);
            } catch (NoSuchMethodException e) {
                LogUtil.d(methodName + " not exist");
            }
        }

        if (getMethod == null) {
            return findGetMethod(entityType.getSuperclass(), field);
        }
        return getMethod;
    }

    /* package */
    static Method findSetMethod(Class<?> entityType, Field field) {
        if (Object.class.equals(entityType)) return null;

        String fieldName = field.getName();
        Class<?> fieldType = field.getType();
        Method setMethod = null;
        if (isBoolean(fieldType)) {
            setMethod = findBooleanSetMethod(entityType, fieldName, fieldType);
        }
        if (setMethod == null) {
            String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
            try {
                setMethod = entityType.getDeclaredMethod(methodName, fieldType);
            } catch (NoSuchMethodException e) {
                LogUtil.d(methodName + " not exist");
            }
        }

        if (setMethod == null) {
            return findSetMethod(entityType.getSuperclass(), field);
        }
        return setMethod;
    }

    @SuppressWarnings("unchecked")
    public static Object convert2DbValueIfNeeded(final Object value) {
        Object result = value;
        if (value != null) {
            Class<?> valueType = value.getClass();
            ColumnConverter converter = ColumnConverterFactory.getColumnConverter(valueType);
            result = converter.fieldValue2DbValue(value);
        }
        return result;
    }

    private static Method findBooleanGetMethod(Class<?> entityType, final String fieldName) {
        String methodName = null;
        if (fieldName.startsWith("is")) {
            methodName = fieldName;
        } else {
            methodName = "is" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
        }
        try {
            return entityType.getDeclaredMethod(methodName);
        } catch (NoSuchMethodException e) {
            LogUtil.d(methodName + " not exist");
        }
        return null;
    }

    private static Method findBooleanSetMethod(Class<?> entityType, final String fieldName, Class<?> fieldType) {
        String methodName = null;
        if (fieldName.startsWith("is")) {
            methodName = "set" + fieldName.substring(2, 3).toUpperCase() + fieldName.substring(3);
        } else {
            methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
        }
        try {
            return entityType.getDeclaredMethod(methodName, fieldType);
        } catch (NoSuchMethodException e) {
            LogUtil.d(methodName + " not exist");
        }
        return null;
    }

}


text:
#pragma once

#include <windows.h>
#include <TinySTL/stdint.h>

#include "Macros.h"

NAMESPACE(SPlay)

class Window
{
	public:
		// Constructor
		Window();

		// Destructor
		~Window();

		// Create
		static Window* create();

		// Initialize
		bool initialize();

		// Close
		void close();

		// Get layered size
		int getLayeredWidth() const {return m_iLayeredWidth;}
		int getLayeredHeight() const {return m_iLayeredHeight;}

		// Get layered buffer
		uint8_t* getLayeredBuffer() const {return m_pLayeredBuffer;}

		// Draw layered window
		void drawLayeredWindow();

		// Get window handle
		HWND getHwnd() const {return m_hWnd;}

		// Get window size
		int getWindowWidth() const {return m_iWidth;}
		int getWindowHeight() const {return m_iHeight;}

		// Message proc
		static LRESULT CALLBACK messageProc(HWND _hWnd, UINT _msg, WPARAM _wParam, LPARAM _lParam);

	private:
		// App instance
		HINSTANCE	m_hInstance;

		// Window handle
		HWND		m_hWnd;

		// Window class atom
		ATOM		m_sClassAtom;

		// Window size
		int			m_iWidth;
		int			m_iHeight;

		// Layered window info
		int			m_iLayeredWidth;
		int			m_iLayeredHeight;
		HDC			m_hLayeredDC;
		HBITMAP		m_hLayeredBitmap;
		BITMAPINFO	m_layeredBitmapInfo;
		uint8_t*	m_pLayeredBuffer;
		uint8_t*	m_pRenderBuffer;

		// Frame
		uint8_t*	m_pFrameBuffer;
		int			m_iFrameWidth;
		int			m_iFrameHeight;
		int			m_iFrameOffset;

		// Resize client area
		void resizeClientArea();

		// Center window
		void centerWindow();

		// Show mouse
		void showMouse(bool _bShow);

		// Load frame
		bool loadFrame();

		// Create layered window
		bool createLayeredWindow();

		// Destroy layered window
		void destroyLayeredWindow();

		// Draw screen
		void drawScreen();

		// Pre-multiply alpha
		void premultiplyAlpha(uint8_t* _pBuffer, int _iWidth, int _iHeight);

		// Update layered window
		void updateLayeredWindow();

		// Get frame point
		void getFramePoint(int& _iX, int& _iY);
};

ENDNAMESPACE

redpajama_set_name: RedPajamaGithub


text: Tool to convert 3D models into a small custom binary 3D model format


text:
package org.knowm.xchange.bittrex.dto.marketdata;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;

public class BittrexLevel {

  private final BigDecimal rate;
  private final BigDecimal quantity;

  /**
   * Constructor
   *
   * @param rate
   * @param quantity
   */
  public BittrexLevel(
      @JsonProperty("Rate") BigDecimal rate, @JsonProperty("Quantity") BigDecimal quantity) {

    this.rate = rate;
    this.quantity = quantity;
  }

  public BigDecimal getPrice() {

    return rate;
  }

  public BigDecimal getAmount() {

    return quantity;
  }

  @Override
  public String toString() {

    return "BittrexLevel [rate=" + rate + ", quantity=" + quantity + "]";
  }
}


text:
onmessage = function(e){
    let {dpsByTime, metric, margin} = e.data;
    let shutdowns = detectShutdowns(dpsByTime, metric, margin);
    postMessage(shutdowns);
};

// NOTE - expects dps sorted by time
function detectShutdowns(dpsByTime, metric, margin){
    // TODO - cache sorted result
    let dpsByValue = dpsByTime.slice().sort((a,b) => a[1] - b[1]),
        shutdowns = [],
        isShutdown = false;

    // TODO - bisect instead?
    for(let i = 0; i < dpsByValue.length; i++){
        let val = dpsByValue[i][1];
        if(isNaN(val)){
            continue;
        }

        // the rest of the values are above the margin,
        // so we good yo
        if(val > margin){
            break;
        }

        let index = dpsByTime.indexOf(dpsByValue[i]),
            prev = dpsByTime[--index];

        // find the first non NaN previous value
        while(prev && isNaN(prev[1])){
            prev = dpsByTime[--index];
        }

        // if the previous value is below the margin,
        // then this is not a new shutdown
        if(prev && prev[1] < margin){
            continue;
        }
        shutdowns.push(dpsByValue[i]);
    }

    // sort chronologically
    shutdowns = shutdowns.sort((a,b) => (+a[0]) - (+b[0]));

    return shutdowns;
}


text:
'use strict';

var inherits = require('../../function/inherits'),
	expect = require('expect.js');

describe('function/inherits', function () {
	it('should properly extend a constructor', function () {
		var inst, proto;

		function Foo() {}
		function Bar() {}

		proto = inherits(Bar, Foo);
		inst = new Bar();

		expect(proto.constructor).to.be(Bar);
		expect(inst).to.be.a(Bar);
		expect(inst).to.be.a(Foo);
	});
});


text:
![an intense doppio of programming](images/coffeescript_ristretto_medium.jpg)

[CoffeeScript Ristretto](http://leanpub.com/coffeescript-ristretto) is the companion book to *JavaScript Allongé*.


text:
title: Founder Friday | YWCA, Money Circle, and Home Renovations
date: 2018-10-05 14:00:00 -04:00
categories:
- founder friday
image: "/uploads/rawpixel-780507-unsplash.jpg"
posts:
- Founder Friday | FinCon, Women's Empowerment, and Harry Potter
- Founder Friday | Meal Delivery, Reproductive Health, and Self Worth
- Founder Friday | Budgeting, Lifestyle Creep, and Airbnb
---

Happy Friday! I hope you had a fantastic week. Here's what I was up to!

## **How I Earned Money This Week**

* We had two sets of Airbnb guests this week.

* Two of my new clients paid for their first month of [coaching](https://www.maggiegermano.com/coaching/).

## **How I Spent Money This Week**

* I think I mentioned this last week, but we had to get our basement shower completely demolished and rebuilt. The floor was cracked and leaking into the surrounding walls and floor. We paid the deposit for the work last week and the remaining balance this week. Thank goodness it's tax deductible as a business expense. Not only did we have to pay the contractor, but we also had to buy extra paint to touch up the parts of the bathroom that needed to be re-patched.

* I mentioned before that Dan and I are using [Sun Basket](https://sunbasket.com/invite/Mary1915063) for meal delivery until the wedding. We've been so stressed with all the life things going on that we haven't been able to feed ourselves healthy food. So we were charged this week for next week's meals. **Use [my link](https://sunbasket.com/invite/Mary1915063) to sign up for $40 off your first order!**

* I spent Wednesday in the city for meetings and the YWCA event. I bought a couple cups of tea and a chocolate chip scone (yum).

* The [Unladylike book](https://www.amazon.com/Unladylike-Field-Smashing-Patriarchy-Claiming/dp/039958045X) came out on Tuesday! I bought the book for myself and can't wait to get started. If you don't already listen to the [Unladylike podcast](https://unladylike.co/), you must start. And then check out the book!

* Dan bought me a bicycle over the summer. I've never been a big cyclist, but I've been enjoying going on long rides with Dan on the bike trail near our house. One problem: my butt hurts during and afterwards! I bought some [padded cycling shorts](https://smile.amazon.com/gp/product/B076Y2JW1X/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1) this week to help make my rides more comfortable. I'll report back!

![IMG_9211.JPG](/uploads/IMG_9211.JPG)

## **What I'm Writing**

This week, I wrote about how I saved up for my wedding while doing lots of other expensive things! [Check it out.](https://www.maggiegermano.com/blog/how-i-saved-money-for-my-wedding-while-buying-a-house-and-quitting-my-job/)

## **What I'm Up To**

* This past Wednesday, I spoke at the YWCA NCA Young Women's Leadership Council's [Women, Wealth, and Wine](https://www.facebook.com/events/261331111177190/). I talked with two groups of women about paying down debt, and had a great time!

* I'm participating in a salary negotiation workshop for the [Public Leadership Education Network](https://plen.org/) (PLEN) on Saturday, October 20th. I'm excited to chat with college students about negotiating for their future.

* I'm joining Emilie Aries for a [live podcast taping](https://www.facebook.com/events/177486379757315/) of the Bossed Up podcast on Monday, October 22nd! We'll be talking all about women and money. Tickets are free - [see you there](https://www.facebook.com/events/177486379757315/)?

* Next month, [Money Circle](https://www.maggiegermano.com/moneycircle/) is meeting to talk about [how to ask for a raise](https://www.maggiegermano.com/events/how-to-ask-for-a-raise/) at your current job. If you know you'll have to do this soon, [join us](https://www.eventbrite.com/e/money-circle-how-to-ask-for-a-raise-tickets-49618103082) on October 24th!

* If you can't make it to Money Circle this month, join us in [December](https://www.eventbrite.com/e/money-circle-how-to-plan-for-holiday-spending-tickets-50456857820) to talk about how to plan ahead for holiday spending. You'll be super prepared for next year!

![IMG_9175.JPG](/uploads/IMG_9175.JPG)

## **What I'm Excited About**

* My [speaker page](https://www.maggiegermano.com/speaking/) is up and live on my website! I'm expanding my business to include more public speaking and workshops. I want to reach more women to spread financial literacy at a level that is more affordable and accessible for them. [Check it out](https://www.maggiegermano.com/speaking/) and reach out if you'd like to hire me for your event!

* My wedding is coming up in just over a month! I'm really excited for the day to finally be here. I'm also incredibly excited to no longer be planning a wedding. It's not for the faint of heart.

* Dan and I are heading to Los Angeles next weekend. (I know, wtf are we doing traveling less than a month before the wedding?) But Dan was invited to attend a conference for free, including his flight and hotel stay, so I used Southwest points to join him. I'm meeting up with a couple fellow women in finance while I'm there. What else should I be sure to do?

![Screen Shot 2018-10-01 at 1.10.28 PM.png](/uploads/Screen%20Shot%202018-10-01%20at%201.10.28%20PM.png)

## **Money Tip to Take Into the Weekend**

![Have a good Vesak!.png](/uploads/Have%20a%20good%20Vesak!.png)

That's all from me today! Have a fantastic weekend!


text:
package org.wso2.carbon.mediator.call;

import org.wso2.carbon.mediator.service.AbstractMediatorService;
import org.wso2.carbon.mediator.service.ui.Mediator;

/**
 *
 */
public class CallMediatorService extends AbstractMediatorService {

    public String getTagLocalName() {
        return "call";
    }

    public String getDisplayName() {
        return "Call";
    }

    public String getLogicalName() {
        return "CallMediator";
    }

    public String getGroupName() {
        return "Core";
    }

    public Mediator getMediator() {
        return new CallMediator();
    }
}


text:
<?php

namespace App\Entity;

/**
 * Class WeatherForecastList
 * @package Entity
 */
class WeatherForecastList
{
    /**
     * @var WeatherForecast
     */
    protected $current;

    /**
     * @var WeatherForecast[]
     */
    protected $upcoming = [];

    /**
     * @return WeatherForecast
     */
    public function getCurrent()
    {
        return $this->current;
    }

    /**
     * @param WeatherForecast $current
     */
    public function setCurrent($current)
    {
        $this->current = $current;
    }

    /**
     * @return WeatherForecast[]
     */
    public function getUpcoming()
    {
        return $this->upcoming;
    }

    /**
     * @param WeatherForecast $forecast
     */
    public function addUpcoming($forecast)
    {
        $this->upcoming[] = $forecast;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>スキンモデルの描画 - Skin model drawing - PTW Tips</title>

PTW Tips

スキンモデルの描画 - Skin model drawing

        <canvas id="canvas" width="960" height="540"></canvas>


text:
/*
 * @(#)TableConfig.java
 *
 * @project    : org.morozko.java.mod.daogen
 * @package    : org.morozko.java.mod.daogen.gen.config
 * @creation   : 13-apr-2006
 */
package org.morozko.java.mod.daogen.gen.config;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *

 *
 * @author mfranci
 *
 */
public class TableConfig {

	private String xmlTable;

	public String getXmlTable() {
		return xmlTable;
	}

	public void setXmlTable(String xmlTable) {
		this.xmlTable = xmlTable;
	}

	public boolean isFake() {
		return fake;
	}

	public void setFake(boolean fake) {
		this.fake = fake;
	}

	public LoadConfig getLoad( String loadName ) {
		LoadConfig loadConfig = null;
		Iterator itLoad = this.getLoadList().iterator();
		while ( itLoad.hasNext() ) {
			LoadConfig current = (LoadConfig) itLoad.next();
			if ( current.getName().equals( loadName ) ) {
				loadConfig = current;
			}
		}
		return loadConfig;
	}

	public FieldConfig getFieldConfig( String fieldName ) {
		FieldConfig fieldConfig = null;
		Iterator it = this.getFields().iterator();
		while ( fieldConfig == null && it.hasNext() ) {
			FieldConfig current = (FieldConfig)it.next();
			// equalsIgnoreCase() instead of equals() is a bugfix for version 1.9.17
			if ( current.getFieldName().equalsIgnoreCase( fieldName ) ) {
				fieldConfig = current;
			}
		}
		return fieldConfig;
	}

	public TableConfig() {
		this.fields = new ArrayList();
		this.relations = new ArrayList();
		this.relationsOut = new ArrayList();
		this.fieldsUpdate = new ArrayList();
		this.loadList = new ArrayList();
		this.updateKey = null;
		this.aliasList = new ArrayList();
		this.operationsList = new ArrayList();
	}

	public List getOperationsList() {
		return operationsList;
	}

	private boolean fake;

	private List relationsOut;

	private List relations;

	private String tableName;

	private String tableUpdateSQL;

	private String tableViewSQL;

	private List fields;

	private List fieldsUpdate;

	private String[] updateKey;

	private String orderBy;

	private List loadList;

	private List aliasList;

	private String idGenerator;

	private List operationsList;

	/**
	 * @return the idGenerator
	 */
	public String getIdGenerator() {
		return idGenerator;
	}

	/**
	 * @param idGenerator the idGenerator to set
	 */
	public void setIdGenerator(String idGenerator) {
		this.idGenerator = idGenerator;
	}

	/**
	 * @return Restituisce il valore di loadList.
	 */
	public List getLoadList() {
		return loadList;
	}

	/**
	 * @return Restituisce il valore di orderBy.
	 */
	public String getOrderBy() {
		return orderBy;
	}

	/**
	 * @param orderBy il valore di orderBy da impostare.
	 */
	public void setOrderBy(String orderBy) {
		this.orderBy = orderBy;
	}

	/**
	 * @return Restituisce il valore di fields.
	 */
	public List getFields() {
		return fields;
	}

	/**
	 * @param fields il valore di fields da impostare.
	 */
	public void setFields(List fields) {
		this.fields = fields;
	}

	/**
	 * @return Restituisce il valore di tableName.
	 */
	public String getTableName() {
		return tableName;
	}

	/**
	 * @param tableName il valore di tableName da impostare.
	 */
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	/**
	 * @return Restituisce il valore di tableUpdateSQL.
	 */
	public String getTableUpdateSQL() {
		return tableUpdateSQL;
	}

	/**
	 * @param tableUpdateSQL il valore di tableUpdateSQL da impostare.
	 */
	public void setTableUpdateSQL(String tableUpdateSQL) {
		this.tableUpdateSQL = tableUpdateSQL;
	}

	/**
	 * @return Restituisce il valore di tableViewSQL.
	 */
	public String getTableViewSQL() {
		return tableViewSQL;
	}

	/**
	 * @param tableViewSQL il valore di tableViewSQL da impostare.
	 */
	public void setTableViewSQL(String tableViewSQL) {
		this.tableViewSQL = tableViewSQL;
	}

	/**
	 * @return Restituisce il valore di updateKey.
	 */
	public String[] getUpdateKey() {
		return updateKey;
	}

	/**
	 * @param updateKey il valore di updateKey da impostare.
	 */
	public void setUpdateKey(String[] updateKey) {
		this.updateKey = updateKey;
	}

	/**
	 * @return Restituisce il valore di fieldsUpdate.
	 */
	public List getFieldsUpdate() {
		return fieldsUpdate;
	}

	/**
	 * @return Restituisce il valore di relations.
	 */
	public List getRelations() {
		return relations;
	}

	/**
	 * @param relations il valore di relations da impostare.
	 */
	public void setRelations(List relations) {
		this.relations = relations;
	}

	/**
	 * @return Restituisce il valore di relationsOut.
	 */
	public List getRelationsOut() {
		return relationsOut;
	}

	/**
	 * @param relationsOut il valore di relationsOut da impostare.
	 */
	public void setRelationsOut(List relationsOut) {
		this.relationsOut = relationsOut;
	}

	/**
	 * @return Restituisce il valore di aliasList.
	 */
	public List getAliasList() {
		return aliasList;
	}

}


text:
package main

import ( // {{{
  "fmt"
  "time"
  "os"

  "github.com/mitchellh/packer/common"
  "github.com/mitchellh/packer/packer"
  "github.com/mitchellh/packer/packer/plugin"
) // }}}

type config struct { // {{{
  common.PackerConfig `mapstructure:",squash"`

  RawDuration string `mapstructure:"duration"`
  duration time.Duration

  // The Message to display in packer
  Message string

  // The configuration template
  tpl *packer.ConfigTemplate
} // }}}

type Provisioner struct { // {{{
  config config
} // }}}

func (p *Provisioner) Prepare(raws ...interface{}) error { // {{{
  md, err := common.DecodeConfig(&p.config, raws...)
  if err != nil {
    return err
  }

  p.config.tpl, err = packer.NewConfigTemplate()
  if err != nil {
    return err
  }
  p.config.tpl.UserVars = p.config.PackerUserVars

  // Accumulate any errors
  errs := common.CheckUnusedConfig(md)

  templates := map[string]*string{
    "message": &p.config.Message,
  }

  for n, ptr := range templates {
    var err error
    *ptr, err = p.config.tpl.Process(*ptr, nil)
    if err != nil {
      errs = packer.MultiErrorAppend(
        errs, fmt.Errorf("Error processing %s: %s", n, err))
    }
  }

  if p.config.RawDuration != "" {
    p.config.duration, err = time.ParseDuration(p.config.RawDuration)
    if err != nil {
      errs = packer.MultiErrorAppend(
        errs, fmt.Errorf("Failed parsing duration: %s", err))
    }
  }

  if errs != nil && len(errs.Errors) > 0 {
    return errs
  }

  return nil
} // }}}

func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { // {{{
  if p.config.Message != "" {
    ui.Say(p.config.Message)
  }

  time.Sleep(p.config.duration)

  return nil
} // }}}

func (p *Provisioner) Cancel() { // {{{
  os.Exit(0)
} // }}}

func main() { // {{{
  server, err := plugin.Server()
  if err != nil {
    panic(err)
  }

  server.RegisterProvisioner(new(Provisioner))
  server.Serve()
} // }}}


text:
using namespace std;
using namespace peli;

int main(int, char**)
{
	fstream f("canada.json", ios::in);
	f.sync_with_stdio(false);
	string str = string(istreambuf_iterator<char>(f), istreambuf_iterator<char>());
	istringstream ss(str);
	ss.sync_with_stdio(false);
	json::value v;

	auto start = chrono::high_resolution_clock::now();
	ss >> v;
	auto end = chrono::high_resolution_clock::now();

	cout << "loading canada.json taken " << chrono::duration_cast<chrono::microseconds>(end - start).count() << " us" << endl;

	return 0;
}


text:
using NUnit.Framework;
using RexMingla.Action.action.text;

namespace RexMingla.Action.Tests.action.text
{
    [TestFixture]
    public class TitleCaseActionTest
    {
        [Test]
        public void When_Multi_Word_Then_Capitalize_First_Letter_Of_Each_Word()
        {
            Assert.AreEqual("Capitalize Word", new TitleCaseAction().PerformAction("capitalize word"));
        }
    }
}


text:
function feature= bbci_apply_evalFeature(signal, bbci_feature, event)
%BBCI_APPLY_EVALFEATURE - Perform feature extration
%
%Synopsis:
%  FEATURE= bbci_apply_evalFeature(SIGNAL, BBCI_FEATURE, EVENT)
%
%Arguments:
%  SIGNAL - Structure buffering the continuous signals,
%      subfield of 'data' structure of bbci_apply, see bbci_apply_evalSignal
%  BBCI_FEATURE - Structure specifying the feature extraction,
%      subfield of 'bbci' structure of bbci_apply.
%  EVENTS - Array of Struct, specifying the event(s) at which a control
%      signal should be calculated. Each Struct has the fields
%      'time' and 'desc' like in the marker context,
%      see bbci_apply_evalCondition.
%
%Output:
%  FEATURE - Structure holding the extracted feature vector

% 02-2011 Benjamin Blankertz

fv= bbci_apply_getSegment(signal, event.time, bbci_feature.ival);

for k= 1:length(bbci_feature.fcn),
  fv= bbci_feature.fcn{k}(fv, bbci_feature.param{k}{:});
end
feature.x= fv.x(:);
feature.time= event.time;


text:
namespace autotune {
namespace tuners {

template <typename R, typename... Args>
class parallel_full_neighborhood_search
    : public abstract_tuner<countable_set, R, Args...> {
private:
  size_t max_iterations;

public:
  parallel_full_neighborhood_search(
      autotune::abstract_kernel<R, cppjit::detail::pack<Args...>> &f,
      countable_set &parameters, size_t max_iterations)
      : abstract_tuner<countable_set, R, Args...>(f, parameters),
        max_iterations(max_iterations) {}

private:
  virtual void tune_impl(Args &... args) override {

    bool is_initial = true;

    for (size_t i = 0; i < max_iterations; i++) {
      if (this->verbose) {
        std::cout << "--------- next iteration: " << i << " ---------"
                  << std::endl;
      }

			std::vector<countable_set> parameters_to_evaluate;
      if (is_initial) {
        parameters_to_evaluate.push_back(this->parameters);
        is_initial = false;
      }

      // initialize to first parameter combination and evaluate it
      size_t cur_index = 0;
      std::vector<int64_t> cur_offsets(this->parameters.size());

      for (size_t m = 0; m < this->parameters.size(); m++) {
        if (this->parameters[m]->prev()) {
          cur_offsets[m] = -1;
        } else {
          cur_offsets[m] = 0;
        }
      }

      // initial parameter combination occurs as cur_offsets[i] = 0 for all i;
      // only computed once due to cache

      // iterate hypercube and collect all valid grid points (= parameter
      // combinations)
      while (true) {
        if (cur_index == this->parameters.size()) {
          break;
        }

        // next() increments parameter and checks whether still within bounds
        if (cur_offsets[cur_index] < 1 && this->parameters[cur_index]->next()) {
          cur_offsets[cur_index] += 1;

          for (size_t k = 0; k < cur_index; k++) {
            // resets parameters
            // prev() won't do anything if result would be out of bounds
            // if was 1 -> 0; if 0 -> -1, cannot have been -1 as 0 is always
            // valid
            if (cur_offsets[k] > -1) {
              if (this->parameters[k]->prev()) {
                cur_offsets[k] -= 1;
              }
            }
            // if was at 1, now at 0, attempt -1
            if (cur_offsets[k] == 0) {
              if (this->parameters[k]->prev()) {
                cur_offsets[k] -= 1;
              }
            }
          }
          cur_index = 0;

          // std::cout << "cur_offsets: ";
          // for (size_t i = 0; i < cur_offsets.size(); i += 1) {
          //   if (i > 0) {
          //     std::cout << ", ";
          //   }
          //   std::cout << cur_offsets[i];
          // }
          // std::cout << std::endl;
          // this->parameters.print_values();

          parameters_to_evaluate.push_back(this->parameters);
        } else {
          cur_index += 1;
        }
      }

      this->evaluate_parallel(parameters_to_evaluate, args...);
      this->parameters = this->optimal_parameters;
    }
  }

  void reset_impl() override {}
};

} // namespace tuners
} // namespace autotune


text:
/**
 *    @file
 *      This file defines a derived unsolicited responder
 *      (i.e., server) for the Pair Device to Account protocol of the
 *      Weave Service Provisioning profile used for the Weave mock
 *      device command line functional testing tool.
 *
 */

#ifndef MOCKPAIRINGENDPOINT_H_
#define MOCKPAIRINGENDPOINT_H_

#include <Weave/Core/WeaveCore.h>
#include <Weave/Profiles/service-provisioning/ServiceProvisioning.h>

using ::nl::Weave::System::PacketBuffer;

class MockPairingServer
{
public:
    MockPairingServer();

    WEAVE_ERROR Init(nl::Weave::WeaveExchangeManager *exchangeMgr);
    WEAVE_ERROR Shutdown();

private:
    nl::Weave::WeaveExchangeManager *mExchangeMgr;

    WEAVE_ERROR SendStatusReport(uint32_t statusProfileId, uint16_t statusCode, WEAVE_ERROR sysError = WEAVE_NO_ERROR);

    static void HandleClientRequest(nl::Weave::ExchangeContext *ec, const nl::Inet::IPPacketInfo *addrInfo,
                                    const nl::Weave::WeaveMessageInfo *msgInfo, uint32_t profileId,
                                    uint8_t msgType, PacketBuffer *payload);
};

#endif /* MOCKPAIRINGENDPOINT_H_ */


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

if ($this->input->post('custom_load') === 'true') {
    $this->load->view($page, $page_data);
    return;
}

?>

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta property="fb:app_id" content="304646339905005" />
    <meta property="fb:admins" content="168610180217199"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo $page_data['title']; ?></title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="https://www.kan-eng.com/live/css/main.css">

<?php $this->load->view($page, $page_data); ?>


text:
<!DOCTYPE HTML>

		<title>How to make [almost] everything</title>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta name="description" content="Massimiliano Dibitonto, Fablab 2015 project and assignments portfolio" />
		<meta name="keywords" content="fablab, makers, fabacademy" />

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

Massimiliano

Dibitonto

How to make [almost] everything

Home

Email

  18- Project development

Intro

This collects answers to some key questions about my final project. All the documentation about the final project could be found in the  final project page.

What tasks have been completed, and what tasks remain?

In the final project page I'm keeping track of the completion of the tasks subdivided in 3 areas: making the case, making the electronics and programming. Each area has a progress bar that indicates the percentage of tasks done and you can find the description of all the problems and the troubleshooting.
                            All the tasks were completed.

what has worked? what hasn't?

 My biggest problem was with the case (the body of the duck). It is big and required many hours of print. To reduce the hours I reduced also the quality of the print but then it was not water resistant. So I had to test different settings (as described in the final project page) and I used also epoxic resin. However this is one thing I have to work more studying also the hydrodynamic and maybe I'll add a keel to make it more stable.

 The electronics worked fine and also the code. The only problem is that sometimes there is a timeout while downloading data from the web but this is not very significant as the info could be downloaded later.

what questions need to be resolved?

During the development of the project I have to solve different questions.The biggest problem is to make electronics safety work in a wet environment. Indeed the duck is meant to stay in a pool. Problems are related to insulation but also to interferences in the Wi-Fi communication as water can influence radio waves at 2.4 GHz. Another problem is related to power management. Electronics and code should be optimized to harvest energy to allow a longer duration of the battery. The most expensive part in terms of energy consumption is related to wireless communication.

 what will happen when?

I decide to keep the project simple in order to realize a first prototype and test and refine my idea. Beginning with too many functionalities could be dangerous for a correct project development. Moreover I learn a lot of things while making the prototype. The most important one was the problem with the water. Even with a good print I didn't had a waterproof case. I used epoxy resin but it partially solved the problem. So one of the future developments will be to find another way to make the case waterproof.
There are a couple of things that I want to develop in the future:

 improve the interaction with the user adding more physical feedbacks

make a distributed architecture that allows to expand the system adding sensors and actuators (maybe wireless connected)

add a ph sensor

add a chlorine dispenser

add a solar panel for battery recharge

what have you learned?

I've learned a lot about electonics and especially how to make my own boards instead of using pre-fabricated ones. The main advantage is that i can customize my board just to fit my needs.  So they do only the things I need and can be smaller and cheaper than the pre fabricated ones. Moreover I learned how to make complex programs in Arduino and to program other microcontrollers. I learned a lot also about 3D modelling, I used different softwares and followed a lot of tutorials and for sure I'll continue studying it.
                                I learned how to use SVN and a better way to manage projects.I learned that I can make almost everything :)

documentation during development

                               I documented all the steps during the development in the  final project page.

©   Attribution, non-commercial, share alike.

Design: HTML5 UP


text:
require_relative '../../lib/email/email'

class StageCraftWebApp
  get '/email/preview/:type' do
    not_found unless development?
    content_type 'text/html'
    Email::Sender.init # reset views
    Email::Sender.render(params[:type].to_sym, params)
  end

end


text:
package org.apereo.cas.configuration.model.core.web.tomcat;

import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This is {@link CasEmbeddedApacheTomcatAjpProperties}.
 *
 * @author Misagh Moayyed
 * @since 5.3.0
 */
@RequiresModule(name = "cas-server-webapp-tomcat")
@Getter
@Setter
@Accessors(chain = true)
public class CasEmbeddedApacheTomcatAjpProperties implements Serializable {

    private static final long serialVersionUID = -32143821503580896L;

    /**
     * Sets the protocol to handle incoming traffic.
     */
    private String protocol = "AJP/1.3";

    /**
     * The TCP port number on which this Connector will create a server socket and await incoming connections.
     * Your operating system will allow only one server application to listen to a
     * particular port number on a particular IP address. If the special value of 0 (zero) is used,
     * then Tomcat will select a free port at random to use for this connector.
     * This is typically only useful in embedded and testing applications.
     */
    private int port = 8009;

    /**
     * Set this attribute to true if you wish to have calls to request.isSecure() to return true for requests received
     * by this Connector (you would want this on an SSL Connector). The default value is false.
     */
    private boolean secure;

    /**
     * Set the secret that must be included with every request.
     */
    private String secret;

    /**
     * A boolean value which can be used to enable or disable
     * the TRACE HTTP method. If not specified, this attribute is set to false.
     */
    private boolean allowTrace;

    /**
     * Set this attribute to the name of the protocol you wish to have returned by calls to request.getScheme(). For example,
     * you would set this attribute to "https" for an SSL Connector.
     */
    private String scheme = "http";

    /**
     * Enable AJP support in CAS for the embedded Apache Tomcat container.
     */
    private boolean enabled;

    /**
     * The default timeout for asynchronous requests in milliseconds. If not specified, this attribute is set to 10000 (10 seconds).
     */
    private String asyncTimeout = "PT5S";

    /**
     * Set to true if you want calls to request.getRemoteHost() to perform DNS lookups in order to return the actual host name of the remote client.
     * Set to false to skip the DNS lookup and return the IP address in String form instead (thereby improving performance).
     * By default, DNS lookups are disabled.
     */
    private boolean enableLookups;

    /**
     * The maximum size in bytes of the POST which will be handled by the container
     * FORM URL parameter parsing. The feature can be disabled by setting this attribute to a value
     * less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
     */
    private int maxPostSize = 20971520;

    /**
     * If this Connector is being used in a proxy configuration, configure this attribute
     * to specify the server port to be returned for calls to request.getServerPort().
     */
    private int proxyPort = -1;

    /**
     * If this Connector is supporting non-SSL requests, and a request is received
     * for which a matching <security-constraint> requires SSL transport,
     * Catalina will automatically redirect the request to the port number specified here.
     */
    private int redirectPort = -1;

    /**
     * Additional attributes to be set on the AJP connector in form of key-value pairs.
     * Examples include:
     *

     *
{@code tomcatAuthentication}: If set to true, the authentication will be done in Tomcat.
     * Otherwise, the authenticated principal will be propagated from the native webserver
     * and used for authorization in Tomcat.
     * Note that this principal will have no roles associated with it. The default value is true.

     *
{@code maxThreads}: The maximum number of request processing threads to be created
     * by this Connector, which therefore determines the maximum number of simultaneous
     * requests that can be handled. If not specified, this attribute is set to 200.
     * If an executor is associated with this connector, this attribute is
     * ignored as the connector will execute tasks using the executor rather than an internal thread pool.

     *
{@code keepAliveTimeout}: The number of milliseconds this Connector
     * will wait for another AJP request before closing the connection.
     * The default value is to use the value that has been set for the connectionTimeout attribute.

     *
{@code maxCookieCount}: The maximum number of cookies that are permitted for a request.
     * A value of less than zero means no limit. If not specified, a default value of 200 will be used.

     *
{@code bufferSize}: The size of the output buffer to use. If less than or equal to zero,
     * then output buffering is disabled. The default value is -1 (i.e. buffering disabled)

     *
{@code clientCertProvider}: When client certificate information is presented in a
     * form other than instances of java.security.cert.X509Certificate it needs to be converted
     * before it can be used and this property controls which JSSE provider is used to perform
     * the conversion. For example it is used with the AJP connectors,
     * the HTTP APR connector and with the org.apache.catalina.valves.SSLValve.If not specified,
     * the default provider will be used.

     *
{@code connectionTimeout}: The number of milliseconds this Connector
     * will wait, after accepting a connection,
     * for the request URI line to be presented. The default value is infinite (i.e. no timeout).

     *
{@code address}: For servers with more than one IP address,
     * this attribute specifies which address will be used for listening on
     * the specified port. By default, this port will be used on all IP addresses associated with the server.
     * A value of 127.0.0.1 indicates that the Connector will only listen on the loopback interface.

     *

     *

     * See the Apache Tomcat documentation for a full list.
     */
    private Map<String, String> attributes = new LinkedHashMap<>(0);
}