text:
package main

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"github.com/djavorszky/ddn/common/errs"
	"github.com/djavorszky/ddn/common/inet"
	"github.com/djavorszky/ddn/common/logger"
	"github.com/djavorszky/ddn/common/model"
	"github.com/djavorszky/ddn/common/status"
	vis "github.com/djavorszky/ddn/common/visibility"
	"github.com/djavorszky/ddn/server/brwsr"
	"github.com/djavorszky/ddn/server/database/data"
	"github.com/djavorszky/ddn/server/registry"
	"github.com/djavorszky/liferay"
	"github.com/gorilla/mux"
)

func apiSetLogLevel(w http.ResponseWriter, r *http.Request) {
	_, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	var lvl logger.LogLevel

	level := mux.Vars(r)["level"]
	switch strings.ToLower(level) {
	case "fatal":
		lvl = logger.FATAL
	case "error":
		lvl = logger.ERROR
	case "warn":
		lvl = logger.WARN
	case "info":
		lvl = logger.INFO
	case "debug":
		lvl = logger.DEBUG
	default:
		inet.SendFailure(w, http.StatusBadRequest, errs.UnknownParameter, level)
		return
	}

	if logger.Level == lvl {
		inet.SendSuccess(w, http.StatusOK, "Loglevel already at "+level)
		return
	}

	logger.Info("Changing loglevel: %s->%s", logger.Level, lvl)

	msg := fmt.Sprintf("Loglevel changed from %s to %s", logger.Level, lvl)

	logger.Level = lvl

	inet.SendSuccess(w, http.StatusOK, msg)
	return
}

func getAPIAgents(w http.ResponseWriter, r *http.Request) {
	_, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	agents := registry.List()

	if len(agents) == 0 {
		inet.SendFailure(w, http.StatusNotFound, errs.NoAgentsAvailable)
		return
	}

	inet.SendSuccess(w, http.StatusOK, agents)
}

func getAPIActiveAgents(w http.ResponseWriter, r *http.Request) {
	_, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	result := make([]model.Agent, 0)

	agents := registry.List()
	for _, agent := range agents {
		if !agent.Up {
			continue
		}

		result = append(result, agent)
	}

	if len(result) == 0 {
		inet.SendFailure(w, http.StatusNotFound, errs.NoAgentsAvailable)
		return
	}

	inet.SendSuccess(w, http.StatusOK, result)
}

// apiAgentByName returns an agent by its shortname
func getAPIAgentByName(w http.ResponseWriter, r *http.Request) {
	_, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)

	shortname := vars["agent"]

	agent, ok := registry.Get(shortname)
	if !ok {
		inet.SendFailure(w, http.StatusServiceUnavailable, errs.AgentNotFound)
		return
	}

	inet.SendSuccess(w, http.StatusOK, agent)
}

func getAPIDatabases(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	// Get private ones
	metas, err := db.FetchByCreator(user)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.QueryFailed, err.Error())

		logger.Error("Fetching private dbs failed: %v", err)
		return
	}

	databases := make([]data.Row, 0, len(metas))

	for _, meta := range metas {
		databases = append(databases, meta)
	}

	// Get public ones
	metas, err = db.FetchPublic()
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.QueryFailed, err.Error())

		logger.Error("Fetching public dbs failed: %v", err)
		return
	}

	for _, meta := range metas {
		databases = append(databases, meta)
	}

	inet.SendSuccess(w, http.StatusOK, databases)
}

func getAPIDatabaseByID(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	inet.SendSuccess(w, http.StatusOK, meta)
}

func getAPIDatabaseByAgentDBName(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByAgentDBNameFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	inet.SendSuccess(w, http.StatusOK, meta)
}

func dropAPIDatabaseByID(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	agent, ok := registry.Get(meta.AgentName)
	if !ok {
		inet.SendFailure(w, http.StatusForbidden, errs.AgentNotFound)
		return
	}

	meta.Status = status.DropInProgress

	db.Update(&meta)

	go dropAsync(agent, meta.ID, meta.DBName, meta.DBUser)

	inet.SendSuccess(w, http.StatusOK, "Started dropping database")
}

func dropAPIDatabaseByAgentDBName(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	agentName, dbname := vars["agent"], vars["dbname"]

	// Get private ones
	meta, err := db.FetchByDBNameAgent(dbname, agentName)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.QueryFailed, err.Error())

		logger.Error("Fetching database failed: %v", err)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	agent, ok := registry.Get(meta.AgentName)
	if !ok {
		inet.SendFailure(w, http.StatusForbidden, errs.AgentNotFound)
		return
	}

	meta.Status = status.DropInProgress

	db.Update(&meta)

	go dropAsync(agent, meta.ID, meta.DBName, meta.DBUser)

	inet.SendSuccess(w, http.StatusOK, "Started dropping database")
}

func importAPIDB(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	var req model.ClientRequest

	err = json.NewDecoder(r.Body).Decode(&req)
	if err != nil {
		inet.SendFailure(w, http.StatusBadRequest, errs.InvalidURL, err.Error())

		logger.Error("couldn't decode json request: %v", err)
		return
	}

	if req.AgentIdentifier == "" {
		inet.SendFailure(w, http.StatusBadRequest, errs.MissingParameters, "agent_identifier")
		return
	}

	if req.DumpLocation == "" {
		inet.SendFailure(w, http.StatusBadRequest, errs.MissingParameters, "dumpfile_location")
		return
	}

	agent, ok := registry.Get(req.AgentIdentifier)
	if !ok {
		inet.SendFailure(w, http.StatusBadRequest, errs.AgentNotFound, req.AgentIdentifier)

		return
	}

	ensureValues(&req.DatabaseName, &req.Username, &req.Password, agent.DBVendor)

	dbe := data.Row{
		DBName:     req.DatabaseName,
		DBUser:     req.Username,
		DBPass:     req.Password,
		DBSID:      agent.DBSID,
		AgentName:  req.AgentIdentifier,
		Dumpfile:   req.DumpLocation,
		Creator:    user,
		CreateDate: time.Now(),
		ExpiryDate: time.Now().AddDate(0, 1, 0),
		DBAddress:  agent.DBAddr,
		DBPort:     agent.DBPort,
		DBVendor:   agent.DBVendor,
		Status:     status.Accepted,
	}

	err = db.Insert(&dbe)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.PersistFailed, err.Error())

		logger.Error("failed inserting database: %v", err)
		db.Delete(dbe)
		return
	}

	if strings.HasPrefix(dbe.Dumpfile, "/") && config.MountLoc == "" {
		inet.SendFailure(w, http.StatusBadRequest, errs.NoFoldersMounted)
		db.Delete(dbe)
		return
	}

	go startImport(agent, dbe)

	inet.SendSuccess(w, http.StatusAccepted, dbe)
}

func startImport(agent model.Agent, dbe data.Row) {
	defer db.Update(&dbe)

	url := dbe.Dumpfile
	if strings.HasPrefix(dbe.Dumpfile, "/") {
		_, filename := filepath.Split(dbe.Dumpfile)
		logger.Debug("Starting to copy %s to %s/web/dumps/", filename, workdir)
		dst, err := os.OpenFile(fmt.Sprintf("%s/web/dumps/%s", workdir, filename), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
		if err != nil {
			errMsg := fmt.Sprintf("Failed creating downloadable file at web/dumps: %v", err)

			logger.Error(errMsg)
			dbe.Status = status.ImportFailed
			dbe.Message = errMsg
			return
		}
		defer dst.Close()

		src, err := os.Open(filepath.Join(config.MountLoc, dbe.Dumpfile))
		if err != nil {
			errMsg := fmt.Sprintf("Failed opening dumpfile at %v: %v", dbe.Dumpfile, err)

			logger.Error(errMsg)
			dbe.Status = status.ImportFailed
			dbe.Message = errMsg
			return
		}
		defer src.Close()

		_, err = io.Copy(dst, src)
		if err != nil {
			errMsg := fmt.Sprintf("Failed copying dumpfile %s -> %s: %v", src.Name(), dst.Name(), err)

			logger.Error(errMsg)
			dbe.Status = status.ImportFailed
			dbe.Message = errMsg
			return
		}

		logger.Debug("Copy successful, starting import")

		url = fmt.Sprintf("http://%s:%s/dumps/%s", config.ServerHost, config.ServerPort, filename)
	}

	_, err := agent.ImportDatabase(dbe.ID, dbe.DBName, dbe.DBUser, dbe.DBPass, url)
	if err != nil {
		errMsg := fmt.Sprintf("Import failed: %v", err)

		logger.Error(errMsg)

		dbe.Status = status.ImportFailed
		dbe.Message = errMsg
		return
	}

	dbe.Status = status.ImportInProgress
}

func createAPIDB(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	var req model.ClientRequest

	err = json.NewDecoder(r.Body).Decode(&req)
	if err != nil {
		inet.SendFailure(w, http.StatusBadRequest, errs.InvalidURL, err.Error())

		logger.Error("couldn't decode json request: %v", err)
		return
	}

	if req.AgentIdentifier == "" {
		inet.SendFailure(w, http.StatusBadRequest, errs.MissingParameters, "agent_identifier")

		return
	}

	agent, ok := registry.Get(req.AgentIdentifier)
	if !ok {
		inet.SendFailure(w, http.StatusBadRequest, errs.AgentNotFound, req.AgentIdentifier)

		return
	}

	ensureValues(&req.DatabaseName, &req.Username, &req.Password, agent.DBVendor)

	req.ID = registry.ID()
	dbe := data.Row{
		DBName:     req.DatabaseName,
		DBUser:     req.Username,
		DBPass:     req.Password,
		DBSID:      agent.DBSID,
		AgentName:  req.AgentIdentifier,
		Creator:    user,
		CreateDate: time.Now(),
		ExpiryDate: time.Now().AddDate(0, 1, 0),
		DBAddress:  agent.DBAddr,
		DBPort:     agent.DBPort,
		DBVendor:   agent.DBVendor,
		Status:     status.Success,
	}

	err = db.Insert(&dbe)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.PersistFailed, err.Error())

		logger.Error("failed inserting database: %v", err)
		return
	}

	_, err = agent.CreateDatabase(req.ID, req.DatabaseName, req.Username, req.Password)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.CreateFailed, err.Error())

		db.Delete(dbe)
		return
	}

	inet.SendSuccess(w, http.StatusOK, dbe)
}

func exportAPIDB(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	agent, ok := registry.Get(meta.AgentName)
	if !ok {
		inet.SendFailure(w, http.StatusInternalServerError, errs.AgentNotFound, meta.AgentName)
		return
	}

	resp, err := agent.ExportDatabase(meta.ID, meta.DBName, meta.DBUser, meta.DBPass)
	if err != nil {
		meta.Status = status.ExportFailed
		db.Update(&meta)

		inet.SendFailure(w, http.StatusInternalServerError, errs.ExportFailed)
		return
	}

	inet.SendSuccess(w, http.StatusOK, resp)
}

func recreateAPIDB(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	agent, ok := registry.Get(meta.AgentName)
	if !ok {
		inet.SendFailure(w, http.StatusInternalServerError, errs.AgentNotFound, meta.AgentName)
		return
	}

	_, err = agent.DropDatabase(meta.ID, meta.DBName, meta.DBUser)
	if err != nil {
		meta.Status = status.DropDatabaseFailed
		db.Update(&meta)

		inet.SendFailure(w, http.StatusInternalServerError, errs.DropFailed)
		return
	}

	_, err = agent.CreateDatabase(meta.ID, meta.DBName, meta.DBUser, meta.DBPass)
	if err != nil {
		meta.Status = status.CreateDatabaseFailed
		db.Update(&meta)

		inet.SendFailure(w, http.StatusInternalServerError, errs.CreateFailed)
		return
	}

	inet.SendSuccess(w, http.StatusOK, meta)
}

func browseAPI(w http.ResponseWriter, r *http.Request) {
	_, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	if config.MountLoc == "" {
		inet.SendFailure(w, http.StatusFailedDependency, errs.NoFoldersMounted)
		return
	}

	vars := mux.Vars(r)
	loc, ok := vars["loc"]
	if !ok {
		loc = "/"
	}

	files, err := brwsr.List(loc)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.FailedListingDirectory, err.Error())

		logger.Error("failed listing folder: %v", err)
		return
	}

	inet.SendSuccess(w, http.StatusOK, files)
}

func apiSetVisibility(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !isOwner(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	visibility := vars["visibility"]

	var visibilityNum int
	switch visibility {
	case "public":
		visibilityNum = vis.Public
	case "private":
		visibilityNum = vis.Private
	default:
		inet.SendFailure(w, http.StatusBadRequest, errs.MissingParameters, visibility)
		return
	}

	// If no change needed
	if visibilityNum == meta.Public {
		inet.SendSuccess(w, http.StatusOK, "Visibility already set to "+visibility)
		return
	}

	meta.Public = visibilityNum

	err = db.Update(&meta)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.UpdateFailed, err.Error())

		logger.Error("failed listing folder: %v", err)
		return
	}

	inet.SendSuccess(w, http.StatusOK, "Visibility updated successfully")
}

func apiExtendExpiry(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	amount, err := strconv.Atoi(vars["amount"])
	if err != nil {
		inet.SendFailure(w, http.StatusBadRequest, errs.InvalidURL, err.Error())

		logger.Error("Failed converting 'amount' to integer from URL: %s, %v", r.URL, err)
		return
	}

	var newExpiry time.Time
	switch vars["unit"] {
	case "days":
		newExpiry = meta.ExpiryDate.AddDate(0, 0, amount)
	case "months":
		newExpiry = meta.ExpiryDate.AddDate(0, amount, 0)
	case "year":
		newExpiry = meta.ExpiryDate.AddDate(amount, 0, 0)
	default:
		inet.SendFailure(w, http.StatusBadRequest, errs.UnknownParameter, vars["unit"])
		return
	}

	meta.ExpiryDate = newExpiry

	err = db.Update(&meta)
	if err != nil {
		inet.SendFailure(w, http.StatusInternalServerError, errs.UpdateFailed, err.Error())

		logger.Error("failed listing folder: %v", err)
		return
	}

	inet.SendSuccess(w, http.StatusOK, meta.ExpiryDate)
}

func apiAccessInfoByAgentDB(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByAgentDBNameFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	inet.SendSuccess(w, http.StatusOK, getDBAccess(meta))
}

func apiAccessInfoByID(w http.ResponseWriter, r *http.Request) {
	user, err := getAPIUser(r)
	if err != nil {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	vars := mux.Vars(r)
	meta, errr := getDatabaseByIDFrom(vars)
	if errr.httpStatus != 0 {
		inet.SendFailure(w, errr.httpStatus, errr.errors...)
		return
	}

	if !hasAccess(meta, user) {
		inet.SendFailure(w, http.StatusForbidden, errs.AccessDenied)
		return
	}

	inet.SendSuccess(w, http.StatusOK, getDBAccess(meta))
}

type dbAccess struct {
	JDBCDriver  string `json:"jdbc_driver"`
	JDBCUrl     string `json:"jdbc_url"`
	JDBCUrl6210 string `json:"jdbc_url_6210,omitempty"`
	User        string `json:"user"`
	Password    string `json:"password"`
	Database    string `json:"database,omitempty"`
	URL         string `json:"url"`
}

func getDBAccess(meta data.Row) dbAccess {
	var (
		jdbc     liferay.JDBC
		jdbc6210 liferay.JDBC
	)

	switch meta.DBVendor {
	case "mysql":
		jdbc = liferay.MysqlJDBCDXP(meta.DBAddress, meta.DBPort, meta.DBName, meta.DBUser, meta.DBPass)
		jdbc6210 = liferay.MysqlJDBC(meta.DBAddress, meta.DBPort, meta.DBName, meta.DBUser, meta.DBPass)
	case "mariadb":
		jdbc = liferay.MariaDBJDBC(meta.DBAddress, meta.DBPort, meta.DBName, meta.DBUser, meta.DBPass)
	case "postgres":
		jdbc = liferay.PostgreJDBC(meta.DBAddress, meta.DBPort, meta.DBName, meta.DBUser, meta.DBPass)
	case "oracle":
		jdbc = liferay.OracleJDBC(meta.DBAddress, meta.DBPort, meta.DBSID, meta.DBUser, meta.DBPass)
	case "mssql":
		jdbc = liferay.MSSQLJDBC(meta.DBAddress, meta.DBPort, meta.DBName, meta.DBUser, meta.DBPass)
	}

	dba := dbAccess{
		JDBCDriver: jdbc.Driver,
		JDBCUrl:    jdbc.URL,
		User:       meta.DBUser,
		Password:   meta.DBPass,
		URL:        meta.DBAddress + ":" + meta.DBPort,
	}

	if jdbc6210.URL != "" {
		dba.JDBCUrl6210 = jdbc6210.URL
	}

	if meta.DBVendor != "oracle" {
		dba.Database = meta.DBName
	}

	return dba
}

func getAPIUser(r *http.Request) (string, error) {
	auth := r.Header.Get("Authorization")
	if auth == "" {
		return "", fmt.Errorf("unauthorized request")
	}

	return auth, nil
}

func hasResult(meta data.Row) bool {
	if meta.Creator == "" {
		return false
	}
	return true
}

func hasAccess(meta data.Row, user string) bool {
	if meta.Public == vis.Private && meta.Creator != user {
		return false
	}
	return true
}

func isOwner(meta data.Row, user string) bool {
	return meta.Creator == user
}

type errResult struct {
	httpStatus int
	errors     []string
}

func getDatabaseByIDFrom(vars map[string]string) (data.Row, errResult) {
	id, err := strconv.Atoi(vars["id"])
	if err != nil {
		return data.Row{}, errResult{
			httpStatus: http.StatusBadRequest,
			errors:     []string{errs.InvalidURL},
		}
	}

	meta, err := db.FetchByID(id)
	if err != nil {
		logger.Error("Fetching database failed: %v", err)

		return data.Row{}, errResult{
			httpStatus: http.StatusInternalServerError,
			errors:     []string{errs.QueryFailed, err.Error()},
		}
	}

	if !hasResult(meta) {
		return data.Row{}, errResult{
			httpStatus: http.StatusNotFound,
			errors:     []string{errs.QueryNoResults},
		}
	}

	return meta, errResult{}
}

func getDatabaseByAgentDBNameFrom(vars map[string]string) (data.Row, errResult) {
	agent, dbname := vars["agent"], vars["dbname"]
	meta, err := db.FetchByDBNameAgent(dbname, agent)
	if err != nil {
		logger.Error("Fetching database failed: %v", err)

		return data.Row{}, errResult{
			httpStatus: http.StatusInternalServerError,
			errors:     []string{errs.QueryFailed, err.Error()},
		}
	}

	if !hasResult(meta) {
		return data.Row{}, errResult{
			httpStatus: http.StatusNotFound,
			errors:     []string{errs.QueryNoResults},
		}
	}

	return meta, errResult{}
}

/*
	func method(w http.ResponseWriter, r *http.Request) {}
*/


This summer, I injured my iliotibial band. From June to August, I walked and swam to maintain my cardiovascular fitness while I went through withdrawal. Running is an addiction like any other; it requires regular feeding. After adopting an extensive stretching and strengthening routine, I finally began to build my mileage. Although I had been injured previously and taken time off from running, I had never been forced to curtail my activity so dramatically. Back at square one, I had my moments of weakness: I insisted that I was done with running, that I would never run again, that I was finished as a runner, that I needed to move on with my life and forget the joy of running. But once a runner, always a runner. My spirit could not be so easily defeated. And I fought on and remained grateful for everything I did have in my life. Injuries teach patience, but they also teach gratitude. They reveal in sharp relief the world without running. For me, a world without running was a little less bright and beautiful, but nevertheless, a world worthy of thanksgiving.
Saturday morning, I ran along the Hudson River. It was forty degrees, 25 mile per hour headwind from the northeast, sleet slamming into my face with every step forward. Despite the obvious physical discomfort, I watched the foggy horizon, the river turned pewter and angry, the cherry trees bent under the coming storm, and felt lucky just to have the privilege to run a single mile, let alone nine.
As I look forward to a spring marathon, I need to get back to basics: more speed work, more miles, more stretching, more carbohydrates. I hope to shave nine minutes off my personal best and run a 3:10 marathon sometime around May. Between November and January, however, I'm focusing on building base fitness and weekly mileage. During my journey from injury to a new PR, I'll intermittently provide some training tips and recipes.
Recently, one of my friends asked me, "is it possible to train for a marathon running only every other day?" I am of the firm belief that finishing a marathon is a matter of the long run. If you can finish a 20 mile training run, you will be able to finish a marathon. (As anecdotal evidence, my dad just set a new marathon PR following this philosophy.) The question is, of course, how to work towards the 20 miler. Starting at a half-marathon distance long run, progressively increase the long run distance. Simple as that. Incorporate intervals and fast tempo runs during the week, along with a strong dose of hills. The following sample plan assumes that you regularly complete six mile runs and that you can do a half-marathon without too much trouble.
Following my freezing nine miler, I wanted a hot lunch. Unfortunately, the rain turned into snow while I showered, and the thought of trudging out into the slush sent shivers down my aching quads. I made a pepper jack grilled cheese: six slices deli cheese, two pieces wheat bread, one tablespoon olive oil for the pan—cook until browned on both sides and the cheese starts slipping over the crust in gooey strands. I also ate a mealy winter peach. For dinner, some serious protein was in order. I headed to RUB BBQ. My friends and I took on a pound of burnt ends, half a pound of brisket, half a pound of pastrami, and a rack and a half of ribs, along with beans, greens, and potato salad. Just enough food for two runners and a lapsed tennis player.
In high school, my physics teacher ran marathons and downed doughnuts like Flintstones vitamins. We took turns bringing in LaMar's: long johns, glazed yeast, blueberry cake, and the occasional apple fritter. Today, LaMar's has turned into Rays Donuts and Coffee, but I hear that the doughnut tradition continues. Back then, I preferred bike riding to running. But now, I understand the doughnut impulse. After barbecue, we wanted dessert. There's a Doughnut Plant right next to RUB. We ordered three doughnuts and ended up with six: apple cinnamon yeast, apple cinnamon cake, peanut butter and jelly, peanut butter and banana, pumpkin, and chocolate glazed. I adored the peanut butter and banana, a fluffy yeast dough piped through with rich, sweet banana custard, all dipped in peanut buttery icing. Sufficient nutrition to power a brief shakeout run Sunday morning; right now, I'm taking it one run at a time.
Marathoning: Eating Through InjuriesIn "Columbia University"
Marathoning: A Ten Minute Reflection on the OrdinaryIn "Columbia University"
Marathoning: The Fargo Marathon (Part 1)In "Running"


text:
Malayalam Print Gulf Live TV E-Paper Classifieds Subscription Feedback
When a 'Pappathy' sees the world through her eyes
Lady photographers are not a rarity now. There are professional and press photographers, and a few wildlife photographers in Kerala too. But there are not many for whom photography is not a hobby, but job. For Limi, photography is strictly her profession.
# Sujitha S
Published: Jan 16, 2016, 05:45 PM IST
"I needed another eye, and vision," says Pappathy Limi on her Facebook page 'Pappathy Kannu'.
Sure enough, Limi has a third eye, her camera. She is a wedding photographer who has covered over 100 weddings so far. The highlight of her career is an Arab wedding she covered in Dubai.
Lady photographers are not a rarity now. There are professional and press photographers and a few wildlife photographers in Kerala too. But there are not many for whom photography is not a hobby, but job. For Limi, photography is strictly her profession.
The accidental photographer
Limi studied Journalism for her PG and worked for a couple of Malayalam newspapers for a brief period. But she soon realised that was not her area. She had no passion for photography until she met her future husband and another shutterbug, Ashok. "In fact, I tried it to impress Ashok," quips Limi, though one would find it hard to believe it while browsing through her clicks.
"After we met, Ashok would always encourage me to learn photography. When two people get acquainted, they should also share knowledge, he would say. But I wasn't really interested. One day, however, it happened. Ashok was away and I decided to take a walk with the camera of a friend. I spent the entire day clicking and really loved one of them, an ant." And she became an expert.
Limi soon realised there is great demand for lady photographers among wedding planning companies as she started getting many offers. "A company based in Attingal approached me to work for them. I took up the job as my friends encouraged me. After that, I began getting more works."
"For pre-wedding and wedding photo shoots, many families, especially Muslims, prefer women photographers. Moreover, the brides are more comfortable that way," says Limi.
Limi has worked for many leading companies in Kerala. It was Lumiere Wedding Company, Kochi, that offered her the opportunity to cover a traditional Arab wedding. "It was a unique experience. They prefer women photographers there. Besides, Indian professionals in this field have great demand abroad."
'Women see things differently'
"It is a profession involving stress and high risk. Photography is not a glamorous field. When you take a project, you can't miss out on a single moment of that event. There is hectic work. May be that is why girls here hesitate to enter this profession," feels Limi. However, she thinks women can make a mark in the field.
"The views of women and men are different. When it comes to wedding photography, women have a good eye for candid moments. Men work rather mechanically."
Limi also tries her hand in modelling photography, applying her own ideas.
Journeying together
Apart from photography, there is one thing that both Limi and Ashok love -- travel. In fact, that passion united Limi, a native of Kollam, and Ashok from Kannur. It goes without saying that the couple loves to explore nature. And they are a constructing an earth home in a forest!
Yes, that is right. A four-member gang including Ashok and Limi is now engaged in constructing a cob home, a house made of soil and water. They purchased 0.75 acres of land in Kulamavu in Idukki district for the purpose. The 320-sq-feet house is planned to be completed by April.
"I heard there is one such home in Alappuzha. I don't think there is more in Kerala," says Ashok.
After the work is over, Ashok and Limi are planning to go on a Himalaya trip on their bike. All the best to the couple!
Degree student turns professional photographer amid lockdown
An evening with Raghu Rai
Disclaimer: Kindly avoid objectionable, derogatory, unlawful and lewd comments, while responding to reports. Such comments are punishable under cyber laws. Please keep away from personal attacks. The opinions expressed here are the personal opinions of readers and not that of Mathrubhumi.
Abhaya- a home for the homeless - celebrating 30th anniv
Privacy Policy Terms of Use Download App
Classifieds Feedback

redpajama_set_name: RedPajamaCommonCrawl


Dav Pilkey, cartoonist and author of the Captain Underpants series, illustrates beautifully how the combination of reading and your imagination can give you superpowers!
Year 2 have had great fun reading their way through this year's shortlisted Picture Books and coming up with their own titles based on the stories. Check out the Student Stories tab to see what they've come up with! Here's their photopeach about The Windy Farm by Doug MacLeod and Craig Smith.


text:
Anna Elisabeth Fischer
Rummelsburg, Niederbarnim, Brandenburg, Germany
The Life of Anna Elisabeth
When Anna Elisabeth Fischer was born on 5 July 1896, in Rummelsburg, Niederbarnim, Brandenburg, Germany, her father, Alex Fischer, was 31 and her mother, Anna Katharina Margaretha Doelle, was 32. She married Hermann Max Edmund Noack on 12 April 1941, in Wolfen, Bitterfeld, Saxony, Prussia, Germany. She died on 17 October 1981, in Jeßnitz, Bitterfeld, Saxony-Anhalt, Germany, at the age of 85.
Do you know this person? Do you have a story about her you would like to share? Sign in or Create a FREE Account
Learn about Anna Elisabeth's homeland.
Put your face in a costume from Anna Elisabeth's homelands.
Hermann Max Edmund Noack
Marriage: 12 April 1941
Wolfen, Bitterfeld, Saxony, Prussia, Germany
Anna Katharina Margaretha Doelle
Erna Fischer
Frida Rosa Fischer
Rosa Anna Fischer
Kurth Fischer
+1 More Child
Archduke Franz Ferdinand of Austria-Hungary and his wife were assassinated in Sarajevo, Bosnia-Herzegovina provoking World War I.
1914 · Germany declares war on Russia
On August 1, 1914, Germany declared war on Russia, sparking World War I. This would not be the last time Germany caused a world war. After the Allies defeated Germany, they signed the Treaty of Versailles.
1919 · Nazi party is founded
Founded by Anton Drexler and Karl Harrer, the German Worker's Party, which eventually would become the Nationalist Socialist German Worker�s Party or Nazi Party. The Nazi Party would eventually take full control over Germany in 1933 and spark a second World War.
German, Danish, and Jewish (Ashkenazic): occupational name for a fisherman, from Fisch + the agent suffix -er. This name is widespread throughout central and eastern Europe.
Possible Related Names
Fischler
Fiser
Visscher
Vissers
Wisman
Dictionary of American Family Names © Patrick Hanks 2003, 2006.
There are no historical documents attached to Anna Elisabeth.


Langlas was laid to rest Tuesday, Aug. 21, after funeral services at St. Peter the Apostle Catholic Church in East Naples.
Jim Langlas wasn't ready to die. He was only 67 years old.
From the outpouring of love and grief that accompanied his passing, neither were the many people whose lives he had touched ready for the Florida SouthWestern State College professor to be taken from them.
Langlas was laid to rest Tuesday, Aug. 21, after funeral services at St. Peter the Apostle Catholic Church in East Naples. He died Aug. 13, four days after sustaining massive brain injuries incurred by falling while climbing the attic pull-down stairs in his East Naples home.
Langlas spent his life teaching, and from all his accounts, the way he lived his own life served as a powerful teaching tool, as much as any wisdom he imparted in the classroom. After earning dual degrees from the University of St. Thomas in Minnesota, he received a Master of Arts from Northwestern University and a Ph.D. in English from Northern Illinois University.
Wook, currently an economics professor at DePaul University, traveled from Chicago to be with his American family. Wook was instrumental in another of Langlas' passions, as the one who introduced him to the martial art Taekwondo. Langlas became a black belt, a member of the U.S. Taekwando Team, and winner of a gold medal at the Taekwondo Federation World Championship. With his wife Michelle, he founded a taekwondo academy and trained hundreds of black belt students.
Langlas' son Jack provided his father's eulogy at St. Peter's, telling the congregation, "my father was the greatest man I've ever known." His father's mission, he said, was to inspire people, in whatever he did, and "it's our duty to pass on his compassion," and inspire others in turn.
"When he asked how are you, he really wanted to know," said Jack Langlas. "With dad, there was no small talk." The son's heartfelt tribute to his father earned an ovation from the congregation, not a sound one generally hears in church.
Jim Langlas retired in 2007 in Naples with Michelle, his wife of 43 years, but he "flunked retirement" and went back to teaching as a professor of English at Florida SouthWestern State College. Many of his Naples colleagues and students joined family and friends in paying their respects and saying goodbye on Tuesday.
"He always had good vibes. If you were having a bad day, he could change that," said Adrian Orelien, a student in one of Langlas' FSW English classes.
"He helped students outside of class, with personal problems, not just English," said America Gutierrez, another FSW student.
Originally from Iowa, Jim married Michelle, his college sweetheart, and got into theatrics to support her passion for drama, acting together with her in Marco Players productions including "Same Time Next Year," said Marco Players artistic director Beverly Dahlstrom. Langlas also wrote and published a book, "Heart of a Warrior," to guide and teach young people the way to self-discipline and self-control. The State of Illinois bestowed on him the Studs Terkel Humanities Award in 2005.
Keith Dameron of Marco Island, CEO of Step Smart Collier, dedicated to reducing accidents among Collier residents, particularly seniors, said that ladders are treacherous, and a major cause of deadly or injury-producing falls.
"Attic ladders are even worse – they're narrow, and make your balance much worse," he said. "Even young guys end up at the emergency room or the trauma center." Collier County, he said, has a 55 percent higher rate of serious falls than the state of Florida as a whole.
To remember Langlas, a Dr. James R. Langlas scholarship fund has been set up to help students who struggle financially, while meeting academic requirements. Donations can be made online at www.fsw.edu/foundation/givenow or at an FSW campus.


text:
Idaho National Guard identifies three soldiers killed in Black Hawk crash
(Idaho Army National Guard)
BOISE, Idaho - The Idaho Army National Guard has identified the three soldiers who were killed in a Black Hawk helicopter crash Tuesday night.
All three personnel on board were pilots participating in a routine training flight near Boise, officials said.
The soldiers were identified as 43-year-old Chief Warrant Officer 4 Jesse Anderson, 43-year-old Chief Warrant Officer 3 Matthew Peltzer, and 39-year-old Chief Warrant Officer George "Geoff" Laubhan.
Anderson was a senior instructor pilot who had served in the National Guard since 2008. He is survived by his wife and four children.
PREVIOUS: 3 Idaho National Guard personnel killed in Black Hawk crash
Peltzer was a pilot who had served in the National Guard since 2005. He leaves behind his wife and two children.
Laubhan was an instructor pilot who had served in the National Guard since 2010. He is survived by his wife and two children.
"The sudden and tragic loss of three of our fellow Guardsmen is extremely heartbreaking to every member of our Idaho National Guard family," said Maj. Gen. Michael Garshak, adjutant general of Idaho and commander of the Idaho National Guard. "I have received numerous messages of condolence from many people here in Idaho and throughout the nation, and all of your thoughts, prayers and support are sincerely appreciated and much needed. It is very comforting, at such a challenging time, to have the care and support of so many."
Military officials last made contact with the helicopter around 7:45 p.m. Tuesday. An Emergency Transmitter Locator device onboard was activated around 8 p.m.
Snowy weather conditions then hampered initial search efforts, an Idaho National Guard spokesperson told ABC News.
Crews eventually found the wreckage and personnel early Wednesday morning, south of Lucky Peak.
RELATED: 3 dead in helicopter crash in western New York, National Guard says
This is the second deadly crash of a Black Hawk helicopter from the National Guard in the past two weeks.
On January 20th, a Black Hawk from the New York National Guard -- which was also on a training mission -- crashed outside Rochester, killing three veteran pilots.
FOX News contributed to this report.


We are often asked "what should we do when we visit Blue Ridge"? There are so many things to do but the one experience that we think so many people would enjoy and that can bring some lasting memories is horseback riding in the Blue Ridge Mountains. This is often overlooked or in some cases avoided because of a lack of experience around horses. There are a number of trail rides available in North Georgia and most have guides and horse handlers that will make the experience enjoyable for everyone, beginners included.
If you are seeking trail rides with beautiful horses and experienced guides then there are a few choices but one really stands out. With mountain views and trails through the forest as well as some areas that overlook Lake Nottley we think you will enjoy A Step Above Stables. This adventure ride is sometimes overlooked because the address is Blairsville GA. The fact is, it is easier and faster to get to A Step Above Stables than some of the trail rides that list a Blue Ridge address. Their walking horses are gentle and their guides are experienced so you can choose just the right pace for your comfort.


text:
Inhuman democracy
Migration, particularly of the sans-papiers, was the focus of Other Voices on the 7th of February 2013. On a small, somewhat clumsy attic, a group of listeners was organised around the following speakers: Ammar Ayoub, a former sans-papiers, Thomas Swerts, a political sociologist and Zoé Genot a member of parliament of the party Ecolo. And it was here, through those speakers, that I learned for the first time (first time in the sense that I heard this through the mouth of reliable a trustworthy sources) what Belgian democracy looks like for migrants.
The first speaker was Ammar Ayoub, whose story made me fume with indignation about the injustice in the world, which apparently is not unfamiliar with the Belgian community either.
Ammar Ayoub, a well educated Syrian young man was forced to leave his country because of political persecution. And as so many political refugees, he was threatened with death because he was involved in political actions against the sitting president. So he was chased by the secret police. He risked to be locked up for being critical about the president. He was imprisoned for some time and once out of prison Ammar decided to ask asylum in Belgium, seeking for protection. His idea of Belgium was a democracy, respecting of human rights etc. But his experiences taught him different things about this country of 'milk and honey'.
His first year in Brussels was terrible, chaotic and there was no track left of humanity. Ammar had to find ways to survive on his own in Brussels. At the university of Leuven where he went to ask information to continue his studies in law, he was utterly crushed by the secretary who told him flat in his face to go back to his country, that Belgium wasn't the country of milk and honey (yes she is right here).
His interview in asylum centre was no success both as it resulted in his imprisonment in Liège and afterwards sent back to Germany (as he entered Europe through Germany) where he was locked up for three weeks. Contact with the extern world was forbidden, his only right being to talk to a lawyer. But even that was not respected; his lawyer turned up when it was too late to appeal.
What surprised him the most, was that the truth seems of no importance at all. It struck Ammar as well to find out that the talks of politicians who overflow of statements about human rights, democracy and all other nice promising talks contradict mostly the reality. Belgium, the so-called country of honey. Only for some.
Chicago: another view on the struggle of sans-papiers
In his PHD, Thomas Swerts compared the status of undocumented people in Chicago and Brussels. Surprisingly it appeared that non-citizens in US have many more chances to being treated well than those who arrive in Brussels. Why is this? How come that such a little city, the so-called capital city of the Europe, does not manage to deal better with this issue? Well the answer of Swerts was very clear. The Belgians struggle to stabilize their own politics as the opinions in the political world are too fragmented. Putting in place a correct and human migration policy doesn't find support under the pressure of nationalist parties such as N-VA.
Politicians pay no attention to the voices of immigrants or to those who support those immigrants. The story of Ammar is the poignant example of this. Zoé Genot, a Member of Parliament, confirmed this harsh and at the same time negligent behaviour of the politicians. There seems to be a tendency to say 'no no no'! Whenever someone in the Parliament propose to revise the migration policies in Belgium: "Politicians don't try to solve the problem and the policy is to strict", she says. "Normally there is never a commission on a Friday, but when it comes to cutting the family reunion, there was an exceptional one on Friday!" But, and that is new information to me, Europeans are allowed to bring about their parents? Can it be more discriminative?! And this is what Swerts as well revealed in his PHD: "In Belgium you have citizenship based on ethnicity, which is more exclusive". Another example of politicians using earplugs on the matter of the sans-papiers, is that even the hunger strikes undertaken by those people don't move them to do something.
In Chicago we hear a totally different story: undocumented people have a voice because they get organized. They have the power to influence the politicians. The stories about injustice become political and have definitely an effect on the policy of the states. Swerst gave an example of a boy who committed traffic violation after which he was captured and imprisoned. The State of Chicago wanted to deport him back to his country. No way that this happened. The whole community supported him and he came in the news. The boy was released because the societies in America have much better and well-organised communities who fight for the Human Rights. Conversely we see that the Belgian society is really divided, much more intolerant about immigrants. The solution to the present status of the sans-papiers would be, according to Swerts, to find new ways of being heard because hunger strikes or church occupations appeared to be vain cries for help.
For children and teenagers though, there is a little bit of hope maybe. Zoé and a few co party members try to fight for more human and just laws. The same applies for medical regularisation, which could be a winning case as "It is crazy to send these people back!" concluded Genot.
Pamela Vaessen
picture: Ali Selvi
Video reportage of the meeting
Pictures of the meeting by Ali Selvi
http://on.fb.me/UH3ZkC
Facebookpage Other Voices
https://www.facebook.com/OtherVoicesMeetings
Posted in: Other VoicesTagged: Ali Selvi, Ammar Ayoub, Belgium, democracy, human rights, migration, Other voices, Pamela Vaessen, sans-papiers, Syria, Thomas Swerts, Zoé GenotPermalinkLeave a comment
← Notre plus grand problème, c'est l'inégalité : pas le mot «allochtone »
Lieve Patrick →


This house is not a drive-by! It is much larger than it looks from the road. The house is like new. The interior was totally gutted in 2010. New drywall throughout, new wiring, new insulation, new paint, etc. The family room has 3/4 Brazilian Tahiti wood flooring. It also has an attractive wood stove that heats a good portion of the entire house. The beautiful kitchen offers attractive maple cabinets, granite counters, stainless steel appliances, bamboo flooring and a large pantry. The laundry area has tile flooring, granite sink and LG washer & dryer. The roof and water heater are 6 years old. The Pella windows and vinyl siding are all new in the last 6 years. The spacious (18x14) master suite offers a large walk-in closet and beautiful bathroom with granite flooring and a marble shower enclosure. The yard is beautifully landscaped with many perennial flowers and plants. It has a great garden area, plus many grape vines and fruit trees. Enjoy living in this like new house!
Lincoln Senior High School High School / Public 3 3.06 mi.
Keystone Academy * Elementary School, Middle School / Public 8 2.4 mi.
Lincoln Brick Elementary School * Elementary School / Public 2 2.57 mi.
Model Elementary School * Elementary School / Public N/A 2.6 mi.
Willis Baptist Academy * Elementary School, Middle School, High School / Private N/A 0.44 mi.
8366 McKean Road, Willis, MI 48191 is a 3 bedroom, 2 bath single family home was sold for $252,000.


Facebook has moved to shut down its social networking app exclusive to teen users called Lifestage, nearly a year after launching the tool, according to a new report. Lifestage is one of the social media giant's apps designed to clone Snapchat that worked to allow high school-aged users to take selfies and videos they can share with other teens from their school. Facebook has reportedly confirmed that the app has now been withdrawn from all platforms including Android, likely because it had never gained much traction among its intended audience since its debut last year. Moreover, it had been a while since Lifestage received its last update, suggesting that Facebook has long been considering to kill the app, seeing how it never really managed to take off.
Launched in October of last year, Lifestage was developed by Facebook software engineer Michael Sayman in an attempt to capture a major portion of the market dominated by Snapchat, consisting mainly of teens. The app's discovery tool allowed users to get connected with other users who were studying in their school. Users could then share selfie photos and videos with their community of classmates or schoolmates, though the app did not include a direct messaging tool that could have further deepened connections among teen users on the platform. The app was exclusively aimed at teenagers, so much so that individuals aged over 21 upon signing up were not allowed to use Lifestage, though the service was susceptible to deceptive tricks of entering a fake age to be able to search for other accounts and more.
Unlike other social networking apps, however, Lifestage did not have an option for users to control who can view the things they share on the platform, meaning that their photos and videos were visible to the public by default. Facebook said that while its teen-focused app has now ceased operations, teens remain a significant component of the Menlo Park, California-based company's global community, suggesting that the social media giant is expected to launch more apps in the future dedicated to this young demographic. In fact, Facebook was previously rumored to be working on a new tool called Talk that is also focused on teens. More updates related to that endeavor should follow shortly.


It's been two weeks (just two weeks!) since a record number of New Yorkers went to the polls for the state primary, and on Thursday the New York City Board of Elections is expected to certify the results.
Newer PostThe time to end felony disenfranchisement is now!
Older PostAsk A Reporter: What Can We Do About New York's Abysmal Voting Laws?


Sheikh Hasina has won a record fourth term as Prime Minister of Bangladesh, in an election overshadowed by clashes that killed at least 17 people and allegations of ballot box stuffing and voter intimidation.
Hasina's ruling Awami League party and its allies won 288 seats in the 300-seat parliament, with the main opposition securing only six, according to the Election Commission secretary Helal Uddin Ahmed.
However, the opposition alliance led by the Bangladesh National Party (BNP), has called on the country's election commission to void the results. It accuses Hasina's party of using stuffed ballot boxes and other illegal means to fix the result.
BNP spokesman Syed Moazzem Hossain Alal said there were "irregularities" in 221 of the 300 seats contested.
"We are demanding that a fresh election is held under a neutral government as early as possible," Kamal Hossain, who heads the alliance, told reporters.
Police say 21 people have died in election violence since the ballot was announced on 8 November.
Thirteen people were killed in clashes between Awami League and BNP supporters on Sunday, while three men were shot by police who said they were protecting polling booths.
Rights groups have accused Hasina's administration of stifling freedom of speech by toughening a draconian anti-press law and the enforced disappearance of dissenters.
Hasina rejects accusations of authoritarianism.


MGD Solutions helps companies produce or procure their products by leveraging our vast experience, substantial buying power and long-term relationships with countless overseas factories.
With over 80 years of experience designing, manufacturing and importing products from around the globe, MGD has a distinct advantage in the sourcing world. We have a proven track record of achieving significantly lower prices for our clients' products and having businesses rely on us as their trusted sourcing partner. Our team also handles all logistics in-house to help clients land their products at their warehouses in the most affordable, reliable and efficient way.
The expert team at MGD Solutions will take on all your Order Processing, Bookkeeping, Warehousing and Information Technology. With your back-office operations being handled by MGD Solutions you will have time again to focus on the most important parts of your business.
The best part about our service is that it costs substantially less than you are currently spending. MGD accomplishes this through software automation and applying 80+ years of wholesale experience to improve your business operations.
Our service includes state of the art proprietary software to run your business that is exclusive to MGD Solutions. As your customer requirements change your software requirements will also change. With MGD Solutions you have the advantage, as we build our software in-house, so customizations are both fast and free.
By grouping together with other MGD Solutions clients your company is able to achieve discounted rates with shipping companies, packaging companies, technology providers as well as many others. MGD also works with all our clients to source the cheapest packaging materials and other supplies to reduce operating costs.
Licensing can be a great form of additional revenue and can often result in exponential growth of consumer awareness. Our experience navigating the licensing landscape will give your brand the greatest chance for success. Whether you are looking to license your brand or you would like to find a complimentary license for your existing company, MGD has the experience and knowledge to maximize your search.
With MGD, a separate third-party warehouse or logistics company won't be necessary. Our bicoastal distribution centers ensure we can tackle any challenge. We are experts in handling orders that range from the largest direct to store distribution orders to individual e-commerce drop ships. Even packaging and repair services are fully handled in-house. MGD is a one-source solution for all your brand's warehousing needs.
Having great designs and a rapidly increasing order balance should be a good thing. Unfortunately, without the money to support your growth your business can come to a standstill. MGD can help you secure the financing you need. With our long standing financial relationships let us help you gain the capital to get your business back on track.
Gain a competitive advantage with our core areas of expertise.
We've grown a lot over the years ourselves. We leverage cutting edge technology to help you meet your goals. Our team of in-house programmers constantly update our custom software to meet your evolving needs. Because of this, we are able to streamline our process and reduce costs. Our commitment to efficiency means we can offer comprehensive services at competitive prices.
Shipping is expensive, for us and for our customers. That's why we spend countless hours negotiating and searching the globe for the best possible ways to move your products. Because of this commitment, we are able to offer the best delivery times in our industry but still maintain remarkably low price points.
Our network of suppliers throughout the globe is unmatched. Worried about credit, quality control and reliability? Our foreign offices can source virtually any materials necessary to manufacture your products with the same quality and care that you would.
With instant scalability go from taking 30 piece orders to 3000 piece orders overnight with no ramp up time while delivering the critical margins your retailers require.
MGD Solutions together with your company, helps you focus on the core of your business and brings you back-to-basics.
MGD Solutions…The better, simpler way.
Watch the MGD Solutions Back-to-Basics video.
© 2018 MGD Solutions, Inc.


text:
Shock: 'Bachelor' Villain Corinne Is Playing 'Exaggerated' Version of Herself, Says Ex
Ali Szubiak
ABC Press
With her seemingly opulent wealth, employment of a nanny and inability to cut up a cucumber on her own, Corinne Olympios of The Bachelor fame quickly became Season 21's archetypal villain. But according to one of Olympios's ex-boyfriends, the contestant's persona is dramatized and exaggerated for the sake of good TV. Quelle surprise.
Keith Berman -- who claims he merely "hooked up" with Olympios "a couple times" but has "stayed in touch" with her -- spoke at length with US Weekly about his former flame, noting her persona is mostly put-on for the cameras.
"It's right up her alley," he said, when asked whether her decision to appear on the show came as a surprise. "She's got a great personality for it. I was pumped that she was on it. I knew she would kill it, honestly."
Berman continued, saying Olympios offers an "exaggerated representation" of her personality, noting she's "very normal" but is "playing it up for TV."
"They're trying to portray her as some stupid girl, but she's really not that dumb," he continued, in what he probably thought was genuine praise. "She knows exactly what she's doing."
Berman also touched on Olympios's approach to wooing contestant Nick Viall, which appears to be strictly sexual in nature.
"She's a very good-looking girl, and she's just aggressive," he told the publication. "She's very aggressive, and when you're that good-looking of a girl, and you're aggressive, most guys aren't going to turn — who's going to turn a girl that looks like that down? She knows how to play up her sexiness. Nick is into it, and she knows."
Berman also alleges Olympios is essentially long-conning the show's producers in an attempt to get cast on a Bachelor spin-off series.
"She skipped the rose ceremony — no one's ever done that," he said. "She's setting herself up. Bachelor is going to invite her back for God knows what spinoff, Paradise and this and that. She's got followers growing by the second, so she's clearly doing something right."
Then + Now: 'The Bachelor'
Next: Corinne Is The New Chad: Funny Tweets About 'The Bachelor' Villain
Source: Shock: 'Bachelor' Villain Corinne Is Playing 'Exaggerated' Version of Herself, Says Ex


Management of severe blunt renal trauma in adult patients: a 10-year retrospective review from an emergency hospital.
Wong KY, Brennan JA, Calvert RC. Management of severe blunt renal trauma in adult patients: a 10-year retrospective review from an emergency hospital. BJU Int. 2012;110(8):E330.


"Damn you PPT! Each time I have a chance to push the market lower you appear."
Creditcane™: Yes it's me that you see in the rear view mirror.
Bullish short day. Midpoint below EMA(10). Tested and held SMA(144). Still failing the 61.8% minor retrace (1343.55). No daily 3LB changes (reversal is 1304.86). QE2infinity.
Doji day. Midpoint above EMA(10). Holding above the 38.2% minor retrace (81.70). Tested and failed SMA(21). No daily 3LB changes (reversal is 81.38).
Bearish short day. Midpoint below EMA(10). Tested and failed SMA(89). Tested and failed its 61.8% minor retrace (18.81). No daily 3LB changes (reversal is 26.66).
Bullish harami day. Midpoint below EMA(10). Still failing its 61.8% retrace (1600.40). Now failing all SMA's. No daily 3LB changes (reversal is 1559.40). Must have the precious.
Spinning top day. Midpoint below EMA(10). Tested and held SMA(21). Still failing its 38.2% minor retrace (1.2710). No daily 3LB changes (reversal is 1.2556).
Bullish short day (didn't confirm bearish engulfing). Midpoint above EMA(10). Tested and held SMA(144). Holding above its 61.8% retrace (38.86). No daily 3LB changes (reversal is 37.59).
Bullish short day. Holding above SMA(21). Midpoint above EMA(10). Holding above its 0.0% retrace (14.71). No daily 3LB changes (reversal is 17.65).
Bullish piercing day. Still failing all SMA's. Midpoint below EMA(10). Still failing its 0.0% retrace (81.14). No dally 3LB changes (reversal is 83.00).
Bearish short day. Failing all SMA's. Midpoint below EMA(10). Tested and held its 100.0% retrace (26.60). New low on daily 3LB (reversal is 29.49).
Bullish short day (didn't confirm bearish engulfing). Midpoint above EMA(10). Holding above SMA(144). Holding above its 50.0% retrace (43.76). No daily 3LB changes (reversal is 44.05).
Bullish short day. Tested and held SMA(55). Midpoint above EMA(10). Holding above its 61.8% minor retrace (0.7643). No daily 3LB changes (reversal is 0.7646).
Bullish short day. Midpoint below EMA(10). Still failing all SMA's. Tested and held its 38.2% minor retrace (3.280). No daily 3LB changes (reversal is 3.434).
Spinning top day. Tested and held SMA(55). Midpoint above EMA(10). Tested and held its 50.0% minor retrace (577.84). No daily 3LB changes (reversal is 572.27).
Bullish harami day. Midpoint below EMA(10). Failing all SMA's. Still failing its 38.2% minor retrace (277.27). No daily 3LB changes (reversal is 275.05).
Doji day. Still failing all SMA's. Midpoint above EMA(10). Tested and failed its 61.8% retrace (63.73). No daily 3LB changes (reversal is 65.97).
Creditcane™: Funny what happens when I step onto the trading floor.
Bearish long day. Midpoint above EMA(10). Tested and failed SMA(55,144). Tested and failed the 61.8% minor retrace (1343.55). No daily 3LB changes (reversal is 1304.86). QE2infinity.
Bullish long day. Midpoint below EMA(10). Tested and held the 38.2% minor retrace (81.70). Tested and failed SMA(21). Daily 3LB reversal up (reversal is 81.38).
Bullish long day (confirmed inverted hammer). Midpoint below EMA(10). Tested and held SMA(89). Tested and held its 61.8% minor retrace (18.81). No daily 3LB changes (reversal is 26.66).
Bearish long day. Midpoint below EMA(10). Tested and failed its 61.8% retrace (1600.40). Tested and failed SMA(21). No daily 3LB changes (reversal is 1559.40). Must have the precious.
Bearish long day. Midpoint above EMA(10). Tested and held SMA(21). Tested and failed its 38.2% minor retrace (1.2710). No daily 3LB changes (reversal is 1.2556).
Bearish engulfing day. Midpoint above EMA(10). Tested and failed SMA(55,89,144). Tested and failed its 61.8% retrace (38.86). No daily 3LB changes (reversal is 37.59).
Bearish short day. Tested and failed SMA(21). Midpoint above EMA(10). Holding above its 0.0% retrace (14.71). No daily 3LB changes (reversal is 17.65).
Bearish long day. Still failing all SMA's. Midpoint below EMA(10). Tested and failed its 0.0% retrace (81.14). New low on dally 3LB (reversal is 83.00).
Bearish long day. Failing SMA(21). Midpoint below EMA(10). Failing its 61.8% minor retrace (30.00). Daily 3LB reversal down (reversal is 29.49).
Bearish engulfing day. Midpoint above EMA(10). Tested and failed SMA(55). Holding above its 50.0% retrace (43.76). No daily 3LB changes (reversal is 44.05).
Bearish engulfing day. Tested and failed SMA(55,89,233). Midpoint above EMA(10). Holding above its 61.8% minor retrace (0.7643). No daily 3LB changes (reversal is 0.7646).
Creditcane™: The FOMC realized that more QE would bring my wrath.
Spinning top day. Midpoint above EMA(10). Tested and held SMA(55). Tested and failed the 50.0% minor retrace (1357.98). No daily 3LB changes (reversal is 1304.86). QE2infinity.
Inverted hammer day. Midpoint below EMA(10). Failing all SMA's. Failing its 61.8% minor retrace (18.81). New low on daily 3LB (reversal is 26.66).
Spinning top day. Midpoint above EMA(10). Holding above SMA(21). Tested and failed its 38.2% minor retrace (1.2710). No daily 3LB changes (reversal is 1.2556).
Doji day. Midpoint above EMA(10). Tested and afield SMA(55). Holding above its 50.0% retrace (43.76). New high on daily 3LB (reversal is 44.05).
Bearish short day. Tested and held SMA(55). Midpoint above EMA(10). Holding above its 61.8% minor retrace (0.7643). New high on daily 3LB (reversal is 0.7646).
"Say my name! QE! Say my name! QE!"
Creditcane™: Q: Are US large banks healthy? A: Not as long as they hold Level 3 Assets as mark-to-fantasy.
Bullish long day. Midpoint above EMA(10). Tested and held SMA(55). Tested and held the 50.0% minor retrace (1357.98). New high on daily 3LB (reversal is 1304.86). QE2infinity.
Bearish long day. Midpoint below EMA(10). Tested and failed the 38.2% minor retrace (81.70). Still failing SMA(21). New low on daily 3LB (reversal is 82.05).
Bullish thrusting day. Midpoint below EMA(10). Failing all SMA's. Failing its 61.8% minor retrace (18.81). No daily 3LB changes (reversal is 26.66).
Spinning top day. Midpoint above EMA(10). Holding above its 61.8% retrace (1600.40). Tested and held SMA(55). No daily 3LB changes (reversal is 1559.40). Must have the precious.
Bullish long day (didn't confirm bearish engulfing). Midpoint above EMA(10). Holding above SMA(21). Tested and failed its 38.2% minor retrace (1.2710). New high on daily 3LB (reversal is 1.2556).
Bullish short day. Midpoint above EMA(10). Tested and held SMA(55,144). Tested and held its 61.8% retrace (38.86). Daily 3LB reversal up (reversal is 37.59).
Bullish short day. Failing all SMA's. Midpoint below EMA(10). Holding above its 0.0% retrace (14.71). No daily 3LB changes (reversal is 17.65).
Bullish short day. Still failing all SMA's. Midpoint below EMA(10). Failing its 38.2% minor retrace (85.75). No dally 3LB changes (reversal is 86.83).
Bearish short day. Tested and failed SMA(21). Midpoint at EMA(10). Failing its 61.8% minor retrace (30.00). No daily 3LB changes (reversal is 27.20).
Bullish long day. Midpoint above EMA(10). Holding above SMA(144). Holding above its 50.0% retrace (43.76). New high on daily 3LB (reversal is 43.61).
Bullish short day. Tested and held SMA(55). Midpoint above EMA(10). Holding above its 61.8% minor retrace (0.7643). New high on daily 3LB (reversal is 0.7632).
Bullish short day. Midpoint above EMA(10). Tested and held SMA(21). Tested and held its 61.8% minor retrace (3.423). New high on daily 3LB (reversal is 3.307).
Bullish short day. Tested and held SMA(55). Midpoint above EMA(10). Holding above its 50.0% minor retrace (577.84). New high on daily 3LB (reversal is 572.27).
Bearish long day. Midpoint above EMA(10). Failing its 50.0% retrace (1.2233). Tested and failed SMA(144,89,55,21). Tested and failed peg (1.2000). No daily 3LB changes (reversal is 1.1910).
Bullish short day. Midpoint above EMA(10). Holding above SMA(21). Tested and failed its 38.2% minor retrace (59.15). Daily 3LB reversal up (reversal is 56.50).
Week Ahead Look: Father's Day Ed.


text:
Any news about PNAS auction?
kanor
Subject: Any news about PNAS auction? Wed Mar 24, 2010 8:18 pm
Kelan kaya auction ng PNAS? Meron pa ba?
embosed
Location : California, USA
Subject: Re: Any news about PNAS auction? Thu Mar 25, 2010 10:47 pm
Currently, the 3 factions of PNAS are suing each other in court. That means they are still waiting for the result of the judge decision whether who among the three will be the real PNAS group. It's a stalemate as of now.
Eldrich
Subject: Re: Any news about PNAS auction? Fri Mar 26, 2010 7:46 am
If they're waiting for a decision of the court then that will take a very long time. not less than a year for sure.
aqamano
Subject: PNAS AUCTION Sat Mar 27, 2010 11:32 am
Sana yung PNAS ang dapat e-recognized sa tatlong group. Para mawala na yung mga greedy coin dealer at ma-implement na yung totoong objective. mission at vision ng PNAS. Para sa akin bilang baguhan mas accomodating ang mga taga PNAS especially sa mga question mo tungkol sa coins heheehehe
coolacoin
Subject: Re: Any news about PNAS auction? Tue Apr 06, 2010 11:53 pm
Based on the recent court decision, the Villareal group lost the case. The same sala that awarded the decision also holds Angelo's case. Most probaly the case of Angelo would be judged on the same merit.
Subject: Re: Any news about PNAS auction? Wed Apr 07, 2010 2:56 am
According to my sources, this thing will drag up to 5 years. This case is not so simple as we think. Everybody wants to be a leader in the PNAS so as to get a position. Let us not conclude first who will be the winner. Only the court will decide who will be the real mac coy. That's why there's a law for this.
Of course every individual had its own optimistic view on their side to be the winner but we really never know until the final decision prevails.
embosed wrote:
I beg to disagree that everybody wants to lead PNAS. PNAS has no income right now and can be considered as a "white elephant". They have no auction, no new members, and the factions are spending money using their own resources. Who would want to inherit that kind of problems?
Subject: Re: Any news about PNAS auction? Wed Apr 14, 2010 12:44 pm
coolacoin wrote:
I agree with you coolacoin. The club has no income right now and whatever we have sold for the past months, it came from our own personal collections. Mostly were sold below acquisition value and 10% of the proceed went to PNAS own fund. The organization's expenditure is being financed by charitable men and no other means. The reason why the club decided not to hold many auctions is because we want to emphasize that the organization is not a business oriented nor a dealership company...it is a non-stock and a non-profit organization.
There is currently 1 PNAS based on papers and legality. True PNAS have 2 court cases. But these people have no right to claim legitimacy since there is only 1 PNAS registered in the SEC and currently, as far as proof is concerned, a legal and registered entity.
The current officers and board of directors have no stake in PNAS, so anybody can either become an officer or a board member as long as he is a member of good standing. If you'll ask me, I have already expressed that I have no interest in running the organization because I am tied-up to my business and studies.
Last election, we were almost forced to have a "hold-over" set of officers because nobody among the members would like to run as officers and nobody would like to renew membership because their waiting for the court to finally declare who is the winner furthermore, they don't want to participate in the melee, expenses, and pressure of running the organization.
Last month, the court dismissed the case filed by Atty. Villareal due to lack of merit and evidence. Atty. Villareal filed a case last year assailing the legitimacy of the current PNAS, claiming that his line-up is the legit PNAS. But because we are registered in SEC and have paid the past dues to the government that the past leaderships of PNAS since the 80s have failed to complied with. We have secured the members of PNAS their future.
This is how irresponsible the past leaders of PNAS are. They are more busy on their auctions and ebay selling than taking care of the true purpose and welfare of the members of the organization.
The same sala where we were granted such judgment holds our case against Angelo.
Regarding Angelo, PNAS has already offered him reconciliation several times in the past to minimize the damage, controversies, and further expenses. But Angelo instead of accepting our offers, lay down his conditions for us to accept before he would reunite with us. His conditions were very much in his favor therefore, we were forced to continue and pursue the case.
Subject: Re: Any news about PNAS auction?


Program plans and reports consists of BER documents that strategically guide programs, divisions, or BER as a whole.
Workshop reports document findings from BER-relevant workshops.
Program literature includes summary documents of BER programs and research activities.
Community research infrastructure includes collaborative research sites, networks, or databases designed to facilitate and organize investigators around a common set of goals, set of measurements, or combined analyses.
BER supports three DOE User Facilities that serve hundreds of scientists worldwide.