text:
// NCCode.cpp

#include "stdafx.h"
#include <math.h>
#include "NCCode.h"
#include "OutputCanvas.h"
#include "interface/Geom.h"
#include "interface/MarkedObject.h"
#include "interface/PropertyColor.h"
#include "interface/PropertyList.h"
#include "interface/PropertyInt.h"
#include "interface/Tool.h"
#include "CNCConfig.h"
#include "CTool.h"
#include "Program.h"

#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <Standard_Failure.hxx>
#include <StdFail_NotDone.hxx>
#include "tinyxml/tinyxml.h"

#include <wx/progdlg.h>

#include <memory>
#include <sstream>

int CNCCode::s_arc_interpolation_count = 20;

void ColouredText::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "text" );
	heeksCAD->LinkXMLEndChild( root,  element );

	// add actual text as a child object
   	TiXmlText* text = heeksCAD->NewXMLText(m_str.utf8_str());
   	element->LinkEndChild(text);

	if(m_color_type != ColorDefaultType)element->SetAttribute( "col", CNCCode::GetColor(m_color_type));
}

void ColouredText::ReadFromXMLElement(TiXmlElement* element)
{
	m_color_type = CNCCode::GetColor(element->Attribute("col"));

	// get the text
	const char* text = element->GetText();
	if(text)m_str = wxString(Ctt(text));
}

// static
double PathObject::m_current_x[3] = {0, 0, 0};
double PathObject::m_prev_x[3] = {0, 0, 0};

void PathObject::WriteBaseXML(TiXmlElement *pElem)
{
	pElem->SetAttribute("tool_number", m_tool_number);

	pElem->SetDoubleAttribute("x", m_x[0]);
	pElem->SetDoubleAttribute("y", m_x[1]);
	pElem->SetDoubleAttribute("z", m_x[2]);

} // End WriteXML() method

void PathObject::ReadFromXMLElement(TiXmlElement* pElem)
{
	memcpy(m_prev_x, m_current_x, 3*sizeof(double));

	double x;
	if(pElem->Attribute("x", &x))m_current_x[0] = x * CNCCodeBlock::multiplier;
	if(pElem->Attribute("y", &x))m_current_x[1] = x * CNCCodeBlock::multiplier;
	if(pElem->Attribute("z", &x))m_current_x[2] = x * CNCCodeBlock::multiplier;

	memcpy(m_x, m_current_x, 3*sizeof(double));

	if (pElem->Attribute("tool_number"))
	{
		pElem->Attribute("tool_number", &m_tool_number);
	} // End if - then
	else
	{
		m_tool_number = 0;	// No tool selected.
	} // End if - else
}

void PathLine::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "line" );
	heeksCAD->LinkXMLEndChild( root,  element );

	PathObject::WriteBaseXML(element);
}

void PathLine::ReadFromXMLElement(TiXmlElement* pElem)
{
	PathObject::ReadFromXMLElement(pElem);
}

void PathLine::glVertices(const PathObject* prev_po)
{
	if(prev_po)glVertex3dv(prev_po->m_x);
	glVertex3dv(m_x);
}

void PathArc::GetBox(CBox &box,const PathObject* prev_po)
{
	PathObject::GetBox(box,prev_po);

	if(IsIncluded(gp_Pnt(0,1,0),prev_po))
		box.Insert(prev_po->m_x[0]+m_c[0],prev_po->m_x[1]+m_c[1]+m_radius,0);
	if(IsIncluded(gp_Pnt(0,-1,0),prev_po))
		box.Insert(prev_po->m_x[0]+m_c[0],prev_po->m_x[1]+m_c[1]-m_radius,0);
	if(IsIncluded(gp_Pnt(1,0,0),prev_po))
		box.Insert(prev_po->m_x[0]+m_c[0]+m_radius,prev_po->m_x[1]+m_c[1],0);
	if(IsIncluded(gp_Pnt(-1,0,0),prev_po))
		box.Insert(prev_po->m_x[0]+m_c[0]-m_radius,prev_po->m_x[1]+m_c[1],0);

}

bool PathArc::IsIncluded(gp_Pnt pnt,const PathObject* prev_po)
{
	double sx = -m_c[0];
	double sy = -m_c[1];
	// e = cs + se = -c + e - s
	double ex = -m_c[0] + m_x[0] - prev_po->m_x[0];
	double ey = -m_c[1] + m_x[1] - prev_po->m_x[1];
	double rs = sqrt(sx * sx + sy * sy);
	// double re = sqrt(ex * ex + ey * ey);
	m_radius = rs;

	double start_angle = atan2(sy, sx);
	double end_angle = atan2(ey, ex);

	if(m_dir == 1){
		if(end_angle < start_angle)end_angle += 6.283185307179;
	}
	else{
		if(start_angle < end_angle)start_angle += 6.283185307179;
	}

	// double angle_step = 0;

	if (start_angle == end_angle)
		// It's a full circle.
		return true;

	double the_angle = atan2(pnt.Y(),pnt.X());
	double the_angle2 = the_angle + 2*M_PI;
	return (the_angle >= start_angle && the_angle <= end_angle) || (the_angle2 >= start_angle && the_angle2 <= end_angle);
}

void PathArc::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element = heeksCAD->NewXMLElement( "arc" );
	heeksCAD->LinkXMLEndChild( root,  element );

	element->SetDoubleAttribute( "i", m_c[0]);
	element->SetDoubleAttribute( "j", m_c[1]);
	element->SetDoubleAttribute( "k", m_c[2]);
	element->SetDoubleAttribute( "d", m_dir);

	PathObject::WriteBaseXML(element);
}

void PathArc::ReadFromXMLElement(TiXmlElement* pElem)
{
	// get the attributes
	bool radius_set = false;
	if (pElem->Attribute("r"))
	{
		pElem->Attribute("r", &m_radius);
		m_radius *= CNCCodeBlock::multiplier;
		radius_set = true;
	}
	else
	{
		if (pElem->Attribute("i")) pElem->Attribute("i", &m_c[0]);
		if (pElem->Attribute("j")) pElem->Attribute("j", &m_c[1]);
		if (pElem->Attribute("k")) pElem->Attribute("k", &m_c[2]);
		if (pElem->Attribute("d")) pElem->Attribute("d", &m_dir);

		m_c[0] *= CNCCodeBlock::multiplier;
		m_c[1] *= CNCCodeBlock::multiplier;
		m_c[2] *= CNCCodeBlock::multiplier;
	}

	PathObject::ReadFromXMLElement(pElem);

	if(radius_set)
	{
		// set ij and direction from radius
		SetFromRadius();
	}
}

void PathArc::SetFromRadius()
{
	// make a circle at start point and end point
	gp_Pnt ps(m_prev_x[0], m_prev_x[1], m_prev_x[2]);
	gp_Pnt pe(m_x[0], m_x[1], m_x[2]);
	double r = fabs(m_radius);
	gp_Circ c1(gp_Ax2(ps, gp_Dir(0, 0, 1)), r);
	gp_Circ c2(gp_Ax2(pe, gp_Dir(0, 0, 1)), r);
	std::list<gp_Pnt> plist;
	intersect(c1, c2, plist);
	if(plist.size() == 2)
	{
		gp_Pnt p1 = plist.front();
		gp_Pnt p2 = plist.back();
		gp_Vec along(ps, pe);
		gp_Vec right = gp_Vec(0, 0, 1).Crossed(along);
		gp_Vec vc(p1, p2);
		bool left = vc.Dot(right) < 0;
		if((m_radius < 0) == left)
		{
			extract(gp_Vec(ps, p1), this->m_c);
			this->m_dir = 1;
		}
		else
		{
			extract(gp_Vec(ps, p2), this->m_c);
			this->m_dir = -1;
		}
		m_radius = r;
	}
}

void PathArc::glVertices(const PathObject* prev_po)
{
	if (prev_po == NULL) return;

	std::list<gp_Pnt> vertices = Interpolate( prev_po, CNCCode::s_arc_interpolation_count );
	glVertex3dv(prev_po->m_x);
	for (std::list<gp_Pnt>::const_iterator l_itVertex = vertices.begin(); l_itVertex != vertices.end(); l_itVertex++)
	{
		glVertex3d(l_itVertex->X(), l_itVertex->Y(), l_itVertex->Z());
	} // End for
}

std::list<gp_Pnt> PathArc::Interpolate( const PathObject *prev_po, const unsigned int number_of_points ) const
{
	std::list<gp_Pnt> points;

	double sx = -m_c[0];
	double sy = -m_c[1];
	// e = cs + se = -c + e - s
	double ex = -m_c[0] + m_x[0] - prev_po->m_x[0];
	double ey = -m_c[1] + m_x[1] - prev_po->m_x[1];
	double rs = sqrt(sx * sx + sy * sy);
	double re = sqrt(ex * ex + ey * ey);

	double start_angle = atan2(sy, sx);
	double end_angle = atan2(ey, ex);

	if(m_dir == 1){
		if(end_angle < start_angle)end_angle += 6.283185307179;
	}
	else{
		if(start_angle < end_angle)start_angle += 6.283185307179;
	}

	double angle_step = 0;

	if (start_angle == end_angle)
	{
		// It's a full circle.
		angle_step = (2 * M_PI) / number_of_points;
		if (m_dir == -1)
		{
			angle_step = -angle_step; // fix preview of full cw arcs
		}
	} // End if - then
	else
	{
		// It's an arc.
		angle_step = (end_angle - start_angle) / number_of_points;
	} // End if - else

	points.push_back( gp_Pnt( prev_po->m_x[0], prev_po->m_x[1], prev_po->m_x[2] ) );

	for(unsigned int i = 0; i< number_of_points; i++)
	{
		double angle = start_angle + angle_step * (i + 1);
		double r = rs + ((re - rs) * (i + 1)) /number_of_points;
		double x = prev_po->m_x[0] + m_c[0] + r * cos(angle);
		double y = prev_po->m_x[1] + m_c[1] + r * sin(angle);
		double z = prev_po->m_x[2] + ((m_x[2] - prev_po->m_x[2]) * (i+1))/number_of_points;

		points.push_back( gp_Pnt( x, y, z ) );
	}

	return(points);
}

ColouredPath::ColouredPath(const ColouredPath& c)
{
	operator=(c);
}

const ColouredPath &ColouredPath::operator=(const ColouredPath& c)
{
	Clear();
	m_color_type = c.m_color_type;
	for(std::list< PathObject* >::const_iterator It = c.m_points.begin(); It != c.m_points.end(); It++)
	{
		PathObject* object = *It;
		m_points.push_back(object->MakeACopy());
	}
	return *this;
}

void ColouredPath::Clear()
{
	for(std::list< PathObject* >::iterator It = m_points.begin(); It != m_points.end(); It++)
	{
		PathObject* object = *It;
		delete object;
	}
	m_points.clear();
}

void ColouredPath::glCommands()
{
	CNCCode::Color(m_color_type).glColor();
	glBegin(GL_LINE_STRIP);
	for(std::list< PathObject* >::iterator It = m_points.begin(); It != m_points.end(); It++)
	{
		PathObject* po = *It;
		po->glVertices(CNCCode::prev_po);
		CNCCode::prev_po = po;
	}
	glEnd();

}

void ColouredPath::GetBox(CBox &box)
{
	for(std::list< PathObject* >::iterator It = m_points.begin(); It != m_points.end(); It++)
	{
		PathObject* po= *It;
		po->GetBox(box,CNCCode::prev_po);
		CNCCode::prev_po = po;
	}
}

void ColouredPath::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "path" );
	heeksCAD->LinkXMLEndChild( root,  element );

	element->SetAttribute( "col", CNCCode::GetColor(m_color_type));
	for(std::list< PathObject* >::iterator It = m_points.begin(); It != m_points.end(); It++)
	{
		PathObject* po = *It;
		po->WriteXML(element);
	}
}

void ColouredPath::ReadFromXMLElement(TiXmlElement* element)
{
	// get the attributes
	m_color_type = CNCCode::GetColor(element->Attribute("col"), ColorRapidType);

	// loop through all the objects
	for(TiXmlElement* pElem = heeksCAD->FirstXMLChildElement( element ) ; pElem; pElem = pElem->NextSiblingElement())
	{
		std::string name(pElem->Value());
		if(name == "line")
		{
			PathLine *new_object = new PathLine;
			new_object->ReadFromXMLElement(pElem);
			m_points.push_back(new_object);
		}
		else if(name == "arc")
		{
			PathArc *new_object = new PathArc;
			new_object->ReadFromXMLElement(pElem);
			m_points.push_back(new_object);
		}
	}
}

double CNCCodeBlock::multiplier = 1.0;

HeeksObj *CNCCodeBlock::MakeACopy(void)const{return new CNCCodeBlock(*this);}

void CNCCodeBlock::WriteNCCode(wxTextFile &f, double ox, double oy)
{
	//TODO: offset is always in millimeters, but this gcode block could be in anything
	//I used inches, so I hacked it into working.
	wxString movement;
	std::list<ColouredText>::iterator it;
	for(it = m_text.begin(); it != m_text.end(); it++)
	{
		ColouredText ct = *it;
		switch(ct.m_color_type)
		{
			case ColorPrepType:
				f.AddLine(ct.m_str);
				break;
			case ColorRapidType:
			case ColorFeedType:
				movement = ct.m_str;
				break;
			case ColorAxisType:
				{
					wxString str = ct.m_str;
					wxChar axis = ct.m_str[0];
					double pos=0;
					ct.m_str.SubString(1,ct.m_str.size()-1).ToDouble(&pos);
					if(axis == 'X' || axis == 'x')
					{
						str = wxString::Format(_T("%c%f"),axis,pos+ox/25.4);
					}
					if(axis == 'Y' || axis == 'y')
					{
						str = wxString::Format(_T("%c%f"),axis,pos+oy/25.4);
					}
					movement.append(str);
				}
				break;
			default:
				break;
		}
	}

	if(movement.size())
		f.AddLine(movement);
}

void CNCCodeBlock::glCommands(bool select, bool marked, bool no_color)
{
	if(marked)glLineWidth(3);

	for(std::list<ColouredPath>::iterator It = m_line_strips.begin(); It != m_line_strips.end(); It++)
	{
		ColouredPath& line_strip = *It;
		line_strip.glCommands();
	}

	if(marked)glLineWidth(1);

}

void CNCCodeBlock::GetBox(CBox &box)
{
	for(std::list<ColouredPath>::iterator It = m_line_strips.begin(); It != m_line_strips.end(); It++)
	{
		ColouredPath& line_strip = *It;
		line_strip.GetBox(box);
	}
}

void CNCCodeBlock::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "ncblock" );
	heeksCAD->LinkXMLEndChild( root,  element );

	for(std::list<ColouredText>::iterator It = m_text.begin(); It != m_text.end(); It++)
	{
		ColouredText &text = *It;
		text.WriteXML(element);
	}

	for(std::list<ColouredPath>::iterator It = m_line_strips.begin(); It != m_line_strips.end(); It++)
	{
		ColouredPath &line_strip = *It;
		line_strip.WriteXML(element);
	}

	WriteBaseXML(element);
}

// static
HeeksObj* CNCCodeBlock::ReadFromXMLElement(TiXmlElement* element)
{
	CNCCodeBlock* new_object = new CNCCodeBlock;
	new_object->m_from_pos = CNCCode::pos;

	// loop through all the objects
	for(TiXmlElement* pElem = heeksCAD->FirstXMLChildElement( element ) ; pElem; pElem = pElem->NextSiblingElement())
	{
		std::string name(pElem->Value());
		if(name == "text")
		{
			ColouredText t;
			t.ReadFromXMLElement(pElem);
			new_object->m_text.push_back(t);
			CNCCode::pos += t.m_str.Len();
		}
		else if(name == "path")
		{
			ColouredPath l;
			l.ReadFromXMLElement(pElem);
			new_object->m_line_strips.push_back(l);
		}
		else if(name == "mode")
		{
			const char* units = pElem->Attribute("units");
			if(units)pElem->Attribute("units", &CNCCodeBlock::multiplier);
		}
	}

	if(new_object->m_text.size() > 0)CNCCode::pos++;

	new_object->m_to_pos = CNCCode::pos;

	new_object->ReadBaseXML(element);

	return new_object;
}

void CNCCodeBlock::AppendText(wxString& str)
{
	if(m_text.size() == 0)return;

	for(std::list<ColouredText>::iterator It = m_text.begin(); It != m_text.end(); It++)
	{
		ColouredText &text = *It;
		str.append(text.m_str);
	}
	str.append(_T("\n"));
}

void CNCCodeBlock::FormatText(wxTextCtrl *textCtrl, bool highlighted, bool force_format)
{
	if (m_formatted && !force_format) return;
	int i = m_from_pos;
	for(std::list<ColouredText>::iterator It = m_text.begin(); It != m_text.end(); It++)
	{
		ColouredText &text = *It;
		HeeksColor &col = CNCCode::Color(text.m_color_type);
		wxColour c(col.red, col.green, col.blue);
		int len = text.m_str.size();

		wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _T("Lucida Console"), wxFONTENCODING_SYSTEM);
		wxTextAttr ta(c);
		ta.SetFont(font);
		if(highlighted)ta.SetBackgroundColour(wxColour(218, 242, 142));
		else ta.SetBackgroundColour(wxColour(255, 255, 255));
		textCtrl->SetStyle(i, i+len, ta);
		i += len;
	}
	m_formatted = true;
}

long CNCCode::pos = 0;
// static
PathObject* CNCCode::prev_po = NULL;

std::map<std::string,ColorEnum> CNCCode::m_colors_s_i;
std::map<ColorEnum,std::string> CNCCode::m_colors_i_s;
std::vector<HeeksColor> CNCCode::m_colors;

const wxBitmap &CNCCode::GetIcon()
{
	static wxBitmap* icon = NULL;
	if(icon == NULL)icon = new wxBitmap(wxImage(theApp.GetResFolder() + _T("/icons/nccode.png")));
	return *icon;
}

void CNCCode::ClearColors(void)
{
	CNCCode::m_colors_s_i.clear();
	CNCCode::m_colors_i_s.clear();
	CNCCode::m_colors.clear();
}

void CNCCode::AddColor(const char* name, const HeeksColor& col)
{
	ColorEnum i = (ColorEnum)ColorCount();
	m_colors_s_i.insert(std::pair<std::string,ColorEnum>(std::string(name), i));
	m_colors_i_s.insert(std::pair<ColorEnum,std::string>(i, std::string(name)));
	m_colors.push_back(col);
}

ColorEnum CNCCode::GetColor(const char* name, ColorEnum def)
{
	if (name == NULL) return def;
	std::map<std::string,ColorEnum>::iterator it = m_colors_s_i.find(std::string(name));
	if (it != m_colors_s_i.end()) return it->second;
	else return def;
}

const char* CNCCode::GetColor(ColorEnum i, const char* def)
{
	std::map<ColorEnum,std::string>::iterator it = m_colors_i_s.find(i);
	if (it != m_colors_i_s.end()) return it->second.c_str();
	else return def;
}

// static
void CNCCode::ReadColorsFromConfig()
{
	CNCConfig config;
	long col;
	ClearColors();
	config.Read(_T("ColorDefaultType"),		&col, HeeksColor(0, 0, 0).COLORREF_color()); AddColor("default", HeeksColor((long)col));
	config.Read(_T("ColorBlockType"),		&col, HeeksColor(0, 0, 222).COLORREF_color()); AddColor("blocknum", HeeksColor((long)col));
	config.Read(_T("ColorMiscType"),		&col, HeeksColor(0, 200, 0).COLORREF_color()); AddColor("misc", HeeksColor((long)col));
	config.Read(_T("ColorProgramType"),		&col, HeeksColor(255, 128, 0).COLORREF_color()); AddColor("program", HeeksColor((long)col));
	config.Read(_T("ColorToolType"),		&col, HeeksColor(200, 200, 0).COLORREF_color()); AddColor("tool", HeeksColor((long)col));
	config.Read(_T("ColorCommentType"),		&col, HeeksColor(0, 200, 200).COLORREF_color()); AddColor("comment", HeeksColor((long)col));
	config.Read(_T("ColorVariableType"),	&col, HeeksColor(164, 88, 188).COLORREF_color()); AddColor("variable", HeeksColor((long)col));
	config.Read(_T("ColorPrepType"),		&col, HeeksColor(255, 0, 175).COLORREF_color()); AddColor("prep", HeeksColor((long)col));
	config.Read(_T("ColorAxisType"),		&col, HeeksColor(128, 0, 255).COLORREF_color()); AddColor("axis", HeeksColor((long)col));
	config.Read(_T("ColorRapidType"),		&col, HeeksColor(222, 0, 0).COLORREF_color()); AddColor("rapid", HeeksColor((long)col));
	config.Read(_T("ColorFeedType"),		&col, HeeksColor(0, 179, 0).COLORREF_color()); AddColor("feed", HeeksColor((long)col));
}

// static
void CNCCode::WriteColorsToConfig()
{
	CNCConfig config;

	config.Write(_T("ColorDefaultType"),	CNCCode::m_colors[ColorDefaultType	].COLORREF_color());
	config.Write(_T("ColorBlockType"),		CNCCode::m_colors[ColorBlockType	].COLORREF_color());
	config.Write(_T("ColorMiscType"),		CNCCode::m_colors[ColorMiscType	].COLORREF_color());
	config.Write(_T("ColorProgramType"),	CNCCode::m_colors[ColorProgramType	].COLORREF_color());
	config.Write(_T("ColorToolType"),		CNCCode::m_colors[ColorToolType	].COLORREF_color());
	config.Write(_T("ColorCommentType"),	CNCCode::m_colors[ColorCommentType	].COLORREF_color());
	config.Write(_T("ColorVariableType"),	CNCCode::m_colors[ColorVariableType].COLORREF_color());
	config.Write(_T("ColorPrepType"),		CNCCode::m_colors[ColorPrepType	].COLORREF_color());
	config.Write(_T("ColorAxisType"),		CNCCode::m_colors[ColorAxisType	].COLORREF_color());
	config.Write(_T("ColorRapidType"),		CNCCode::m_colors[ColorRapidType	].COLORREF_color());
	config.Write(_T("ColorFeedType"),		CNCCode::m_colors[ColorFeedType	].COLORREF_color());
}

void on_set_default_color	(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorDefaultType    ) = value;}
void on_set_block_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorBlockType		) = value;}
void on_set_misc_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorMiscType		) = value;}
void on_set_program_color	(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorProgramType	) = value;}
void on_set_tool_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorToolType		) = value;}
void on_set_comment_color	(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorCommentType	) = value;}
void on_set_variable_color	(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorVariableType	) = value;}
void on_set_prep_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorPrepType		) = value;}
void on_set_axis_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorAxisType		) = value;}
void on_set_rapid_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorRapidType		) = value;}
void on_set_feed_color		(HeeksColor value, HeeksObj* object)	{CNCCode::Color(ColorFeedType		) = value;}

// static
void CNCCode::GetOptions(std::list<Property *> *list)
{
	PropertyList* nc_options = new PropertyList(_("nc options"));

	PropertyList* text_colors = new PropertyList(_("text colors"));
	text_colors->m_list.push_back ( new PropertyColor ( _("default color"),		CNCCode::Color(ColorDefaultType		), NULL, on_set_default_color	 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("block color"),		CNCCode::Color(ColorBlockType		), NULL, on_set_block_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("misc color"),		CNCCode::Color(ColorMiscType		), NULL, on_set_misc_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("program color	"),	CNCCode::Color(ColorProgramType		), NULL, on_set_program_color	 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("tool color"),		CNCCode::Color(ColorToolType		), NULL, on_set_tool_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("comment color	"),	CNCCode::Color(ColorCommentType		), NULL, on_set_comment_color	 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("variable color"),	CNCCode::Color(ColorVariableType	), NULL, on_set_variable_color	 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("prep color"),		CNCCode::Color(ColorPrepType		), NULL, on_set_prep_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("axis color"),		CNCCode::Color(ColorAxisType		), NULL, on_set_axis_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("rapid color"),		CNCCode::Color(ColorRapidType		), NULL, on_set_rapid_color		 ) );
	text_colors->m_list.push_back ( new PropertyColor ( _("feed color"),		CNCCode::Color(ColorFeedType		), NULL, on_set_feed_color		 ) );
	nc_options->m_list.push_back(text_colors);

	list->push_back(nc_options);
}

CNCCode::CNCCode():m_highlighted_block(NULL), m_gl_list(0), m_user_edited(false)
{
	CNCConfig config;
	config.Read(_T("CNCCode_ArcInterpolationCount"), &CNCCode::s_arc_interpolation_count, 20);
}

CNCCode::~CNCCode()
{
	Clear();
}

const CNCCode &CNCCode::operator=(const CNCCode &rhs)
{
	HeeksObj::operator =(rhs);
	Clear();
	for(std::list<CNCCodeBlock*>::const_iterator It = rhs.m_blocks.begin(); It != rhs.m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		CNCCodeBlock* new_block = new CNCCodeBlock(*block);
		m_blocks.push_back(new_block);
	}
	return *this;
}

void CNCCode::Clear()
{
	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		delete block;
	}
	m_blocks.clear();
	DestroyGLLists();
	m_box = CBox();
	m_highlighted_block = NULL;
}

void CNCCode::glCommands(bool select, bool marked, bool no_color)
{
	if(m_gl_list)
	{
		glCallList(m_gl_list);
	}
	else{
		m_gl_list = glGenLists(1);
		glNewList(m_gl_list, GL_COMPILE_AND_EXECUTE);

		// render all the blocks
		CNCCode::prev_po = NULL;

		for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
		{
			CNCCodeBlock* block = *It;
			glPushName(block->GetIndex());
			block->glCommands(true, block == m_highlighted_block, false);
			glPopName();
		}

		glEndList();
	}
}

void CNCCode::GetBox(CBox &box)
{
	if(!m_box.m_valid)
	{
		for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
		{
			CNCCodeBlock* block = *It;
			block->GetBox(m_box);
		}
	}

	box.Insert(m_box);
}

void on_set_arc_interpolation_count(int value, HeeksObj*object)
{
	CNCCode::s_arc_interpolation_count = value;
	CNCConfig config;
	config.Write(_T("CNCCode_ArcInterpolationCount"), CNCCode::s_arc_interpolation_count);
}

void CNCCode::GetProperties(std::list<Property *> *list)
{
	list->push_back( new PropertyInt(_("Arc Interpolation Count"), CNCCode::s_arc_interpolation_count, this, on_set_arc_interpolation_count) );
	HeeksObj::GetProperties(list);
}

void CNCCode::GetTools(std::list<Tool*>* t_list, const wxPoint* p)
{
	HeeksObj::GetTools(t_list, p);
}

HeeksObj *CNCCode::MakeACopy(void)const{return new CNCCode(*this);}

void CNCCode::CopyFrom(const HeeksObj* object){operator=(*((CNCCode*)object));}

void CNCCode::WriteXML(TiXmlNode *root)
{
	TiXmlElement * element;
	element = heeksCAD->NewXMLElement( "nccode" );
	heeksCAD->LinkXMLEndChild( root,  element );

	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		block->WriteXML(element);
	}

	element->SetAttribute( "edited", m_user_edited ? 1:0);

	WriteBaseXML(element);
}

bool CNCCode::CanAdd(HeeksObj* object)
{
	return ((object != NULL) && (object->GetType() == NCCodeBlockType));
}

bool CNCCode::CanAddTo(HeeksObj* owner)
{
	return ((owner != NULL) && (owner->GetType() == ProgramType));
}

void CNCCode::SetClickMarkPoint(MarkedObject* marked_object, const double* ray_start, const double* ray_direction)
{
	if(marked_object->m_map.size() > 0)
	{
		MarkedObject* sub_marked_object = marked_object->m_map.begin()->second;
		if(sub_marked_object)
		{
			if(sub_marked_object->m_map.size() > 0)
			{
				HeeksObj* object = sub_marked_object->m_map.begin()->first;
				if(object && object->GetType() == NCCodeBlockType)
				{
					SetHighlightedBlock((CNCCodeBlock*)object);
					int from_pos = m_highlighted_block->m_from_pos;
					int to_pos = m_highlighted_block->m_to_pos;
					DestroyGLLists();
					theApp.m_output_canvas->m_textCtrl->ShowPosition(from_pos);
					theApp.m_output_canvas->m_textCtrl->SetSelection(from_pos, to_pos);
				}
			}
		}
	}
}

//static
HeeksObj* CNCCode::ReadFromXMLElement(TiXmlElement* element)
{
	CNCCode* new_object = new CNCCode;
	pos = 0;

	CNCCodeBlock::multiplier = 1.0;
	PathObject::m_current_x[0] = PathObject::m_current_x[1] = PathObject::m_current_x[2]  = 0.0;

	// loop through all the objects
	for(TiXmlElement* pElem = heeksCAD->FirstXMLChildElement( element ) ; pElem;	pElem = pElem->NextSiblingElement())
	{
		std::string name(pElem->Value());
		if(name == "ncblock")
		{
			HeeksObj* object = CNCCodeBlock::ReadFromXMLElement(pElem);
			new_object->m_blocks.push_back((CNCCodeBlock*)object);
		}
	}

	// loop through the attributes
	int i;
	element->Attribute("edited", &i);
	new_object->m_user_edited = (i != 0);

	new_object->ReadBaseXML(element);

	new_object->SetTextCtrl(theApp.m_output_canvas->m_textCtrl);

	return new_object;
}

void CNCCode::DestroyGLLists(void)
{
	if (m_gl_list)
	{
		glDeleteLists(m_gl_list, 1);
		m_gl_list = 0;
	}
}

void CNCCode::SetTextCtrl(wxTextCtrl *textCtrl)
{
	textCtrl->Clear();

	textCtrl->Freeze();

	wxFont font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, _T("Lucida Console"), wxFONTENCODING_SYSTEM);
	wxTextAttr ta;
	ta.SetFont(font);
	textCtrl->SetDefaultStyle(ta);

	wxString str;
	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		block->AppendText(str);
	}
	textCtrl->SetValue(str);

#ifndef WIN32
	// for Windows, this is done in COutputTextCtrl::OnPaint
	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		block->FormatText(textCtrl, block == m_highlighted_block, false);
	}
#endif

	textCtrl->Thaw();
}

void CNCCode::FormatBlocks(wxTextCtrl *textCtrl, int i0, int i1)
{
	textCtrl->Freeze();
	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		if (i0 <= block->m_from_pos && block->m_from_pos <= i1)
			block->FormatText(textCtrl, block == m_highlighted_block, false);
	}
	textCtrl->Thaw();
}

void CNCCode::HighlightBlock(long pos)
{
	SetHighlightedBlock(NULL);

	for(std::list<CNCCodeBlock*>::iterator It = m_blocks.begin(); It != m_blocks.end(); It++)
	{
		CNCCodeBlock* block = *It;
		if(pos < block->m_to_pos)
		{
			SetHighlightedBlock(block);
			break;
		}
	}
	DestroyGLLists();
}

static double Distance( const gp_Pnt start, const gp_Pnt end )
{
	double x_squared = (start.X() - end.X()) * (start.X() - end.X());
	double y_squared = (start.Y() - end.Y()) * (start.Y() - end.Y());
	double z_squared = (start.Z() - end.Z()) * (start.Z() - end.Z());

	return( sqrt( x_squared + y_squared + z_squared ) );
} // End Distance() routine

/**
	Generate as many points as is necessary such that the tool turns to the next
	cutting edge and, in that time (based on the spindle speed) advances at the
	feed rate.  We want to calculate material removal rate on a per-cutting edge
	basis.
 */
std::list<gp_Pnt> PathLine::Interpolate(
	const gp_Pnt & start_point,
	const gp_Pnt & end_point,
	const double feed_rate,
	const double spindle_rpm,
	const unsigned int number_of_cutting_edges) const
{
	std::list<gp_Pnt> points;

	double spindle_rps = spindle_rpm / 60.0;	// Revolutions Per Second.
	double time_between_cutting_edges = (1 / spindle_rps) / number_of_cutting_edges;

	double advance_distance = (feed_rate / 60.0) * time_between_cutting_edges;
	double number_of_interpolated_points = Distance( start_point, end_point ) / advance_distance;

	points.push_back( start_point );

	for ( int i=0; i < int(floor(number_of_interpolated_points)); i++)
	{
		double x = (((start_point.X() - end_point.X()) / number_of_interpolated_points) * i) + start_point.X();
		double y = (((start_point.Y() - end_point.Y()) / number_of_interpolated_points) * i) + start_point.Y();
		double z = (((start_point.Z() - end_point.Z()) / number_of_interpolated_points) * i) + start_point.Z();

		points.push_back( gp_Pnt( x, y, z ) );
	} // End for

	points.push_back( end_point );

	return(points);
} // End Interpolate() method

std::list<gp_Pnt> PathArc::Interpolate(
	const PathObject *previous_point,
	const double feed_rate,
	const double spindle_rpm,
	const unsigned int number_of_cutting_edges) const
{
	std::list<gp_Pnt> points;

	double spindle_rps = spindle_rpm / 60.0;	// Revolutions Per Second.
	double time_between_cutting_edges = (1 / spindle_rps) / number_of_cutting_edges;

	double advance_distance = (feed_rate / 60.0) * time_between_cutting_edges;

	// This distance is wrong for arcs.  We're doing a straight line distance but we really want a distance
	// around the arc.  TODO Fix this.
	double number_of_interpolated_points = Distance( gp_Pnt( previous_point->m_x[0], previous_point->m_x[1], previous_point->m_x[2] ),
							gp_Pnt( m_x[0], m_x[1], m_x[2] ) ) / advance_distance;

	points = Interpolate( previous_point, (unsigned int) (floor(number_of_interpolated_points)) );

	return(points);

} // End Interpolate() method

std::list< std::pair<PathObject *, CTool *> > CNCCode::GetPaths() const
{
	std::list< std::pair<PathObject *, CTool *> > paths;

	for(std::list<CNCCodeBlock*>::const_iterator l_itCodeBlock = m_blocks.begin(); l_itCodeBlock != m_blocks.end(); l_itCodeBlock++)
	{
		for (std::list<ColouredPath>::const_iterator l_itColouredPath = (*l_itCodeBlock)->m_line_strips.begin();
			l_itColouredPath != (*l_itCodeBlock)->m_line_strips.end(); l_itColouredPath++)
		{
			for (std::list< PathObject* >::const_iterator l_itPoint = l_itColouredPath->m_points.begin();
				l_itPoint != l_itColouredPath->m_points.end(); l_itPoint++)
			{
				CTool *pTool = CTool::Find( (*l_itPoint)->m_tool_number );
				if (pTool != NULL)
				{
					paths.push_back( std::make_pair( *l_itPoint, pTool ) );
				} // End if - then
			} // End for
		} // End for
	} // End for

	return(paths);
} // End GetPaths() method

void CNCCode::SetHighlightedBlock(CNCCodeBlock* block)
{
	if(m_highlighted_block)m_highlighted_block->FormatText(theApp.m_output_canvas->m_textCtrl, false, true);
	m_highlighted_block = block;
	if(m_highlighted_block)m_highlighted_block->FormatText(theApp.m_output_canvas->m_textCtrl, true, true);
}


text:
Helen Stratford
Helen Stratford: all About Culture
Museum Of Funeral Coaches
without comments
This museum shows us the habits and customs that the people engaged in the funeral ceremonies during the last third of the nineteenth century and the first half of the twentieth. I wanted to move to Barcelona and make a report of what was hidden there. Ask to speak to, Josep Diaz, and became passionate about my friendly guide and protector history of this unusual museum. Certainly there are other museums of its kind in the United States, Vienna, France and Italy, however the Barcelona is the most complete, original and which has more material. All the objects presented here are authentic, including the original cobblestone streets of Barcelona and the two gas lanterns (although today look with electric light) According tells me Josep Torras Christopher, manager of Funeral Services of Barcelona, made a effort to ensure that these floats are not destroyed, to condition and preserve the beauty with which they look now. We also found other objects such as belts and harnesses that served as an ornament for draft horses. The tour starts with the coaches "white" reserved to transport the deceased children and maidens. This is when Josep emphasis on showing the two types of shields that have all the floats. On one side is the "House of Charity" entity in charge of transferring the less fortunate and secondly, the shield of "la Diputacion de Barcelona" for floats larger and tended to be contracted by the bourgeoisie In the central part of the museum stands imposing the "Great Dumond" of French eighteenth century.
Written by Minna
September 21st, 2010 at 6:01 pm
« The City Museum
Martial Arts »
Subliminal Videos
The Lack
Artistic Style
The Journalist template by Lucian E. Marin — Built for WordPress

redpajama_set_name: RedPajamaCommonCrawl


At Redtek we are internationally recognised for our mastery as sports car engine specialists. In particular, we are highly committed to and competent at the preservation and optimisation of Porsche air cooled engines from 1965 to 1997.
Whether you are the owner of a humble T spec engine or a full titanium con rod 906 engine, then Redtek can help with experience and a full in house machine shop, enabling us to handle any machining aspects of the re-build without the engine leaving our sight and no-compromise culture.
With 25 years of track-proven experience in supercar engines ranging from Cosworth F1, to touring cars to race car engine development, legendary Porsche engine expert specialist Nick Fulljames is at the helm of the operation, ensuring that every re-build meets its unrivalled standards.
At Redtek we have the experience and skills to deliver the fastest, most reliable and well maintained engines that can deliver precise performance, whilst also delivering the longevity our clients desire.
The fully equipped workshop is at the heart of our business where our talented and skilled staff work their magic to exacting standards on what is at the heart of every awe-inspiring Porsche. Unlike other 'engine specialists' we personally carry out all CNC machining, reboring, crank balancing and seat fitting with our own machinery, all under one roof.
We offer all levels of attention from the overhaul of a top end to the complete build of a new Porsche race engine.
We would be most pleased to hear from you today to discuss your Porsche.
WHAT DO PEOPLE SAY ABOUT REDTEK?
"Nick's infectious about engines and perspires passion for what he does."
Copyright 2013. Redtek Porsche 911 engine specialists. Brackley, Northamptonshire.


text:
Home > Vol 8, No 11 (2019) >	Bhuvaneshwari
DOI: http://dx.doi.org/10.18203/2319-2003.ijbcp20194799
Analysis of spontaneous individual case safety reports reported at adverse drug reaction monitoring centre: tertiary care teaching hospital in South India
E. Bhuvaneshwari, T. Chakradhar, M. Sravani
Background: Drugs are double edged weapons, they are used in treatment of the patients but in return can harm as well. The safety of drug prescribing has become a need of the hour topic in medicine. Safety monitoring of patients via Pharmacovigilance tool has become an integral part of pharmacotherapy. This study has been undertaken to analyze the various individual case safety reports including the Special situation cases of medicational error and over dose and to promote the reporting of adverse drug reactions (ADRs) among the healthcare professionals (HCPs).
Methods: A retrospective non-interventional observational study was done for indexed period of six months at AMC-PvPI under Osmania Medical College and General Hospital. The reported individual case safety reports (ICSRs) are evaluated on basis of demographics of age and gender, seriousness criteria, outcome parameters and causality assessment of suspected drug (s) and suspected ADR/AE (s) as per the ICH guidelines and WHO causality assessment scale.
Results: A total of 177 ICSRs are reported out of that 137 were ADRs, 36-medication error cases and 4-cases of over dose. The incidence of ADRs in females are high compared with males was identical. The occurrence of ADRs in adult patients (61%) was significantly higher than other age groups. Of total ADRs, most of them were with analgesics (26%) and highly reported system organ classification was CNS. Overall, 79% patients were recovered from ADRs.
Conclusions: The results depicted an insight to the HCPs on the importance of monitoring and reporting of ICSRs. Our study results emphasized need to roll out a pharmacovigilance practice tool to ensure the safe use of drugs for better Pharmacotherapy and development of pharmacogenomic studies.
Health care professionals, Individual Case safety report, System organ classification, Adverse drug reaction, Adverse event, Toxic epidermal necrolysis
India Population. Available at: http://worldpopulation review.com/countries/india/. Accessed on 12 August 2019.
Shamna M, Dilip C, Ajmal M, Mohan ML, Shinu C, Jafer CP, et al. A prospective study on Adverse drug reactions of antibiotics in a tertiary care hospital. Saudi Pharmaceutical J. 2014;22(4):303-8.
Adhikari A, Bhattacharjee N, Bhattacharya S, Indu R, Ray M. Evaluation of adverse drug reports from a tertiary care hospital of Kolkata, West Bengal, India. J Young Pharm. 2017;9(3):311-4.
Sharma HL, Sharma KK. General Principles of Pharmacology. Principles of Pharmacology. 2nd ed. New Delhi: Paras Medical Publishers; 2011: 1-2.
Venkatasubbaiah MP, Reddy D, Satyanarayana SV. Analysis and reporting of adverse drug reactions at a tertiary care teaching hospital. Alexandria J Med. 2018;54(4):597-603.
Safety of Medicines In Public Health Programmes: Pharmacovigilance an essential tool, World Health Organization 2006. Available at: https://www.Who .int/medicines/areas/quality_safety/safety_efficacy/ Pharmacovigilance_B.pdf?ua=1. Accessed on 8 August 2019.
Sneha G, Sowmya N, Goka P, Rao N, Prasanthi N, Nadendia R, et al. An observational prospective study on prevalence and monitoring of adverse drug reactions in tertiary care teaching hospital. BJPR. 2016;11:1-9.
Kalaiselvan V, Thota P, Singh GN. Pharmacovigilance programme of India: recent developments and future perspectives. Ind J Pharmacol. 2016;48:624-8.
Indian Pharmacopoeia Commission, Ministry of Health and Family Welfare, Government of India. List of Adverse Drug Reaction monitoring Centers under PvPI. Available at: https://www.ipc.gov.in/ images/LIST_OF_270_AMC_UNDER_PvPI.pdf. Accessed on 8 August 2019.
Indian Pharmacopoeia Commission, Ministry of Health and Family Welfare, Government of India. ADR reporting form for HCPs. Available at: https://www.ipc.gov.in/PvPI/adr/ADR%20Reporting%20Form.pdf. Accessed on 21 August 2019.
Pharmacovigilance Program of India. Indian Pharmacopoeia Commission, Ministry of Health and Family Welfare, Government of India. Consumer reporting Medicines side effects reporting form in vernacular language Available at: https://www.ipc .gov.in/PvPI/adr/Telugu.pdf. Accessed on 21 August 2019.
Rajan A, Ramani PT, Raj S. A study on pattern of adverse drug reaction in an adverse drug reaction monitoring centre of a tertiary care hospital in South Kerala. Int J Basic Clin Pharmacol. 2019;8(8):1813-8.
Ferner RE. Adverse drug reactions. Medicine. 2016;44(7):416-21.
Alshakka M, Saeed GMA, Ali H, Prajapati SK, Ibrahim MI. Adverse Drug reactions and medication errors in tertiary care hospitals: a quantitative insight in Aden, Yemen. J Young Pharm. 2019;11(1):82-7.
World Health Organization. The third WHO Global Patient Safety Challenge: medication without harm. Available at: https://www.who.int/patientsafety/medi cation-safety/en/. Accessed on 21 August 2019.
Agency for Healthcare Research and Quality (AHRQ), U.S. Department of Health and Human Services. Patient safety network. Medication Errors and Adverse Drug Events. Available at: https://psnet.ahrq.gov/primers/primer/23/Medication-Errors-and-Adverse-Drug-Events. Accessed on 21 August 2019.
Petrova G, Stoimenova A, Dimitrova M, Kamusheva M, Petrova D, Georgiev O. Assessment of the expectancy, seriousness and severity of adverse drug reactions reported for chronic obstructive pulmonary disease therapy. Sage Open Med J. 2017;5(1):7.
Singh H, Dulhani N, Kumar BN, Singh P, Tewari P, Nayak K. A pharmacovigilance study in medicine department of tertiary care hospital in Chhattisgarh (Jagdalpur), India. J Young Pharm. 2010;2(1):95-100.
Gaur S, Paramjeet S, Srivastava B, Bhardwaj R, Ahuja S, Gunjita B. Evaluation of adverse drug reactions in teaching hospital in Kumoun region. JMSCR. 2016;4:12139-45.
Tabassum N, MohdIlyas, Ghori S, Reddy A, Mohiuddin M. Dermatological Adverse drug reactions in tertiary care hospital. Int J Pharm Sci Res. 2015;6(2):816-24.
Vijayakumar TM, Dhanaraju MD. Description of adverse drug reactions in a multi-specialty teaching hospital. Int J Integr Med. 2013;1:1-6.
Kathiria JM, Sattigeri BM, Desai PM, Patel SP. A Study of adverse drug reactions in patients admitted to intensive care unit of a tertiary care teaching rural hospital. Int J Pharm Pharm Sci. 2013;5(1):160-315.
Lobo GMA, Pinheiro SMB, Castro JGD, Momente VG, Pranchevicius MCS. Adverse drug reaction monitoring: support for Pharmacovigilance at a tertiary care hospital in northern Brazil. BMC Pharmacol Toxicol. 2013;14:5.
Swamy S, Bhanuprakash NP, Muralimohan SM. Profile of suspect adverse drug reactions in a teaching tertiary care hospital. J Pharmacol Clin Toxicol. 2013;1(1):1005.
Sen M, Singh A, Misra M. Retrospective analysis of adverse drug reactions reported at ADR monitoring centre under PvPI in a tertiary care hospital. Int J Basic Clin Pharmacol. 2018;7(7):303-8.
Mishra R, Jeevangi SK, Vardhamane S, Kumar S. Pharmacovigilance study in medicine department in a tertiary care hospital. Int J Basic Clin Pharmacol. 2016;5:2608-15.
Hemavathy G, Rathinam J, Preethi A, Divakar R. A retrospective analysis of adverse drug reactions reported at a tertiary care hospital in South India. Int J Basic Clin Pharmacol. 2018;7:1257-62.
Badyal DK, Kanish B, Gulrez G. Causality assessment and pattern of adverse drug reactions in a tertiary care hospital. Int J Basic Clin Pharmacol. 2018;7:210-4.
Sood A, Sood V, Prajapati H, Sharma A, Bansal R, Mahajan V. Pharmacovigilance analysis in a rural tertiary care hospital in North India: a retrospective study. Int J Basic Clin Pharmacol. 2016;5:1425-31.
Chan SL, Ang X, Sani LL, Ng HY, Winther MD, Liu JJ, et al. Prevalence and characteristics of adverse drug reactions at admission to hospital: a prospective observational study. Bri J Clin Pharmac. 2016;82(6):1636-46.


The winners of the Nikon D300s book by David Busch are: Michel Lamy and Ashley Quinn. Congratulations! To everybody else: there is more to come, soon. Stay tuned!
This entry was posted in Nikon D300s and tagged Nikon Rumors Giveaways. Bookmark the permalink. Trackbacks are closed, but you can post a comment.


Melinda Beck brings good design back to children's television. GPD08.
When I read yesterday about Gary Vaynerchuck's idea for "Good People Day 2008", I decided to get over my typically cynical self and contribute to the internet shout-outs. And from my at-home dad's perspective, one person who deserves some much needed credit is illustrator and graphic artist Melinda Beck.
The great thing about children's television network Noggin is they don't air commercials in-between the shows. Instead, they have other kid's related short programming, the most of which centers around the designs and illustrations of Melinda Beck. Melinda drew Noggin's "mascot" Moose A. Moose and his silent avian pal Zee, as well as most all of the other bumpers, network IDs and other interstitial pieces. The designs are playful, colorful and most importantly incredibly imaginative. After having your mind numbed to the design aesthetic of most kid's television, it's refreshing to see something that stands out from the rest.
So thanks Melinda Beck. I can't think of anyone better to give a shout-out to on Good People Day.
Check out Melinda Beck's work at her web site (including her work for Noggin here), or check out the Noggin web site, which is also full of her work.
(And, thanks to Greg from Daddytypes for originally explaining who Melinda was).
First, you might be wondering what this web site is. It's the blog that I've had ever since Sara was a few months old, and the place where I write about things related to children, parenting and fatherhood. Through it I've had a few quotes in newspapers and magazines, connected with fellow stay-at-home dads, and I've even gotten a new job. This month I've started writing for an online parenting magazine called Babble.com, blogging about products for children and parents. With Jane at home with me all day I'm not writing as much as I'd like to, but I'm getting paid to write, which is pretty cool.
Besides writing, I've also been busy with another of my passions - drinking. In my ongoing quest for the world's most diverse resume, I spent the 2006-2007 school year studying with the International Sommelier Guild. And after months of reading, tasting, and service practice I'm happy to report I passed my exams and graduated this fall. Now that I've got the sommelier pin on my lapel I'm not sure I'm going to actually work in a restaurant, but seeing as we live in the booze capital of the world, a degree in wine can't hurt.
Oh. And as you can see I also grew a beard. I think it's awesome, but Judy is convinced it's a sign that I've finally cracked.
While I was off drinking studying, Judy has quietly been supporting a family of four and spending as much time with our girls as she possibly can. Her medical practice is doing well and lately she has been busier than ever. It's OK to be busy though, because we still live less than three miles from her office so she's home fairly early every night. And let me tell you, Judy coming home is an event around here. Nothing gets our girls more excited than Mommy coming home. In our family Judy is the rock star. When she walks through the door at night it's like she's Bruce Springsteen and little Janie is Courtney Cox getting pulled up on stage (except Jane has better hair and can dance way better).
And speaking of drinking (was I speaking of drinking?) Judy is also very excited about this holiday season in particular, because it's the first one since 2002 that she hasn't been pregnant or nursing. Bottoms up!
"Look at the baby! She's so beautiful! Hi precious! What gorgeous red hair. Can you wait right here? I have to show my friend."
"Um, well actually I was headed over to the..."
"Martha! Come here! Look at this baby! Isn't she the prettiest baby you've ever seen?"
I never realized what a fuss people make over redheads. Or maybe (as the older brother of a sister with red hair) I just blocked it out. Anyway, Jane loves to dance and make animal noises (the "moo" of the cow is our particular favorite), and she loves everything to do with her big sister Sara.
Sara is also a very sweet girl who has become a really great big sister. She's patient, gentle (most of the time) and kind with her; and right now they're starting to play together which is really fun for Judy and I to watch. Sara is also thriving in pre-school (The Merryhill School) and amazes us every day with something new that she knows or says. The other night when we were eating dinner we started to "cheers." (As an aside, "cheers" is a big thing at our table, and one of Jane's favorite things to initiate. She'll grab her sippy cup, stick it out and exclaim "Jeee!" to which we all clink cups and say cheers.) Anyway, a few months ago we were clinking cups when Sara raised her cup and said (very solemnly), "To Merryhill."
Sara is also very much a little girl who loves girly things. Maybe it's the influence of the Disney Princesses, or maybe it's being around her Dad so much that has turned her into the complete opposite of me (which, again, is lucky for me). Her favorite colors are (of course) pink and white; she always wants to wear dresses; she holds her hem up when she walks down stairs; and I swear tonight she didn't ask Judy for help washing her hands after dinner, she told her, "I need assistance." I'm not sure if Cinderella says that to her Fairy Godmother, but she might.
So 2007 has been a good year for us, and we hope that this "letter" finds you and your family healthy and happy too. If you're interested, there are some ways during the year that you can keep track of what we're up to.
If you are into the social networking on the internet these days (all the cool kids are you know) you can follow me on Twitter or "friend" me on Facebook.
And also, if you get a chance, leave a comment below and let us know how you've been doing, or what you thought of my first crack at a family Christmas letter (which I think at one point in my life I swore I'd never do). Or you can leave a comment simply because hey, you made it through this enormous letter and you might as well is brag about it.


text:
Home / Applied Geekism / INTERVIEW: David Hewlett is a more interesting geek than me!
INTERVIEW: David Hewlett is a more interesting geek than me!
Captain John K. Kirk December 16, 2017	Applied Geekism, Celebrities
(image: via Syfy.com)
Innovation and invention are the traits loyal fans of Stargate Atlantis have come to expect from their favourite astrophysicist, Rodney McKay. But after meeting David Hewlett in person, you realize it's channeled from a natural source. When you hear about his work with Upgrade Required, his collaboration with Guillermo Del Toro, and just his unbridled curiosity in learning about what he doesn't know, this is a creative individual that you want – no, need – to sit down with, listen to and indulge yourself in a state of blissful, geeky fascination.
David began our conversation about his work with Del Toro. First, I need to mention that I've always been a big fan of David. It was hard for me to restrain my inner fan-boy from squee-ing throughout our chat. But I'm also a huge fan of Del Toro's work. Learning more about his creative capacity and imaginative muscle-power was a truly extraordinary opportunity that I couldn't afford to miss.
"My wife says I have a man-crush on him," he began, talking about Del Toro. "She's probably right. He's got this beautiful ability to make you feel like you're the centre of attention. His interactions with you are so real. I consider myself a friend of Guillermo now. I mean, I know he's got 50,000 people who feel the exactly same way, but I also know that the next time I see him, he will remember things about me. He's just that caring."
He brought up his collaboration in The Shape of Water.
"The man [Del Toro] is magic. We had met at the premiere of Splice. I auditioned for the part [The Shape of Water] and I got it, thinking, 'This is great; put it on the resume – feather in the cap.' But in the process, I learned he's so… well, it's entirely a Guillermo movie. We're like clay to him, you know? You think you would hate that, but the reality is that he's so giving. I'm at rehearsals, thinking, 'Why am I here'? I'm just muddling around, waiting for my scenes and he beckons me into his office and pulls out this tiny cross of red and gold and tells me that my character needs to wear this. He had found it in a flea market in Marrakesh or some place and he thought that this was perfect for my character. He thinks like this for every character in his movies and this is the level of detail that the man has when he puts a film together. In rehearsals, he will literally turn you and move you in front of the character and that's his magic; like magical realism."
Michael Stuhlbarg, Michael Shannon, Guillermo del Toro and David Hewlett during filming of "The Shape of Water." (photo: Kerry Hayes)
Working with Guillermo Del Toro is probably the best anecdote to start any conversation. But like attracts like, as my aged grandmother was wont to say. Creative people want to work with like-minded people, and when you talk to David, you can't help but notice his own innate curiosity and creativity.
David's projects are wide and varied. You just have to visit his production company's website, Monkeys & Parrots, to see what sorts of innovations he explores. One of the ventures that we talked about was Upgrade Required. More than just a television series, it's an episodic quest to enhance life through embracing technology. Imagine having the chance to be freed from our physical limitations in order to appreciate and enjoy life more. This is what Upgrade Required explores, with the idea that while this can improve life in general, it can have enormous implications on those who have severe limitations like disabilities and infirmities.
It comes from a real place. Hewlett's friend, Q, is a sufferer of spinal muscular atrophy. Upgrade Required looks at improving his personal situation by eventually creating a cybernetic exoskeleton to allow him to enjoy his life. Some episodes show articulated robotic limbs, AI control technologies like brain interfaces and all sorts of cybernetic devices and animations that will delight and fascinate the geek-multitudes of technology-loving fans out there.
(via https://filmtvinternet.com/mp/)
But this stems from David's seemingly near-inexhaustible reserve of skills. From actor and writer to tech-geek and internet-savvy producer, David courses the full limit of the definition of polymath.
"It's the 'Jack-of-all-Trades, Master-of-None' idea, I think." He humbly told me. "I find that I've always been paranoid about the educational side of stuff. It's a struggle, but I really am afraid of knowing if I have a sufficient base of knowledge to move to the next level. I mean, I don't know what I'm supposed to know! I dabble, but I've always been a nerd about computers and film technology. I didn't take television in school to watch television, I took it to learn about television technology. I love learning and am fascinated by what I don't know."
From my perspective as a fan and as the guy asking the questions from the other side of the coffee table, David's unrestrained curiosity shines forth when you speak to him. One of the striking things about our conversation was this statement.
"When I meet with people, I love finding out how is this person interesting? If they're an accountant, I want to know about what's cool about accounting! Why are they so nerdy about it?"
David gave me a truly geek-worthy reason for why he got into acting.
"Doctor Who. It was that realization that there aren't really Time-Lords so I guess I'll just have to pretend to be one! It's a fantastic profession for someone who is fascinated by a lot of things because you get to play with them. If you want to do your job well, you have to know about all sorts of things."
(via David Hewlett YouTube Channel / https://www.youtube.com/user/h0rrid/ )
But David's consistent love is technology.
"You know, when you and I were growing up, computers and robots were the technology craze. I don't think I ever grew up. Today, we have autonomous cars and robotic systems – and we have the internet with all the technological possibilities it can offer. I love robots – in fact, I, for one, welcome our robotic overlords!" He laughed.
"I took motorcycle courses, worked at a voicemail company; there's so much technology out there, how do we keep track of it all? I want to do something with Upgrade Required, turn this into my day job and if it helps people out, then that makes me feel better!"
David related specific instances of this.
"I call 'em 'Upgraders'," he explained. "There's this really nice kid in Italy who's going to be helping me out. He's freaking out because he has this really crappy text-to-speech unit he has to use and it's got to go from Italian to English to boot. He was upset because he was speaking too slow. Thanks to Upgrade, I knew a guy who knew a guy and so forth … and we got this guy from Quadstick who was able to suggest some open-source software that Stephen Hawking uses and created and bingo! He's up and running!"
This is what we at Pop Mythology like to call "Applied Geekism" at work. I shared my own reasons for indulging in nerd culture.
"But it's also escapism. It's not a better world, but it's a different one. I think so many people with disabilities gravitate towards sci-fi and fantasy because there's that promise of some sort of magic that can provide hope. I sometimes feel like I'm pulling back the curtain and working with the wizard – which is what it's like working with Guillermo."
The experience of life is the reason for David's obsession with technology – and by extension, Upgrade Required. The fact of the matter is that freeing people from the limitations of human life, regardless of the shape it comes in, allows them to experience a better human life. When you consider that the point of human learning is a gestalt effect, to better pursue and preserve those experiences for the benefit of others is a pursuit that's worth the struggle.
David Hewlett directing 'Debug.' (via http://www.otherworldsaustin.com)
"Something we have to consider … there are vibrant people who need to be documented. Look at Stephen Hawking. These people don't have the same life expectancy as others and we need their experiences to add to our shared learning. They want to share."
Speaking of experiences, this is the point in the conversation when I realise that I'm literally geeking out with David Hewlett. We're talking robotics, our mutual Commodore 64 happy times, Star Trek, Doctor Who and yes, even some Stargate: Atlantis. David's happy to lend his geek-icon status to any situation that might see technology improve someone's life. But at the foundation of it all though, it's the passion and shared excitement of talking to someone who has a similar appreciation and love of geek culture that feeds that enthusiasm.
Hearing about how David appreciates Guillermo Del Toro is resonating with me on a personal level as I am appreciating my encounter with David.
"He's a geek, like me." David says about Del Toro, "and the geek shall inherit the Earth." He affirms to me, and I heartily agree.
Ideas are the foundation for success. If this conversation has proven anything to me, it's that David Hewlett is no stranger to success.
Innovation and invention; that's what came out of this conversation. But I also saw his humour, his philanthropic drive to make his geekiness mean something in the real world and someone with whom I had a great deal in common.
Just lesser success. Oh, and interest level. I mean, my life isn't as interesting by any comparison, but I know good ideas when I hear them. This is a guy with great ideas, a lot of enthusiasm and the ability and contacts to make some serious geekculture improvements in people's lives.
… And I'm fascinated, and can't wait to see what he comes up with next.
INTERVIEW: Living the rogue's life with Allan Hawco of 'Caught'
INTERVIEW: You don't know our site? But we interviewed Chris Jericho!
INTERVIEW: Making history with Rebecca Liddiard of 'Frankie Drake Mysteries'
INTERVIEW: Laura Vandervoort in 'Jigsaw' and horror that can happen to you
INTERVIEW: 'Slasher: Guilty Party' creator Aaron Martin on what's *really* scary


text:
#Canadian #American
Matthew Perry Biography, Age, Height, Weight, Family, Wiki & More
Updated On : August 22, 2017
19 August,1969 (Tuesday)
Berkshire, Massachusetts
in Pounds- 145.5 lbs
Matthew Perry Photos
Matthew Perry Popularity on Social Media
Matthew Perry was born on 19-08-1969 in Williamstown in the state of Massachusetts, United States. He is a Canadian-American Film Actor & Television Actor.
Matthew Langford Perry
Matthew Perry Wiki Link
Matthew Perry Complete Bio & Career
Matthew was just an infant when his parents divorced and his custody was claimed by his mother. As a kid, he developed not one but two passions, acting and playing tennis. At the age of 15, he relocated from Canada to LA to stay with his father. He was still in high school when he grabbed his maiden acting role in the film titled A Night in the Life of Jimmy Reardon in the year 1988. He played the supporting role in this film. The film was hardly noticed though.
He made his small screen debut by acting in the sitcom titled Second Chance. After making guest appearances in various sitcoms, he finally got his first major breakthrough with the coming of age sitcom titled Friends in 1994. Friends in a very short time became one of the biggest hit television shows ever. He portrayed the sarcastic and witty character named Chandler Bing which became a household name.
The sitcom which features six friends became friends off the screen as well and it reflected on their on-screen performances. It became a must watch show in the whole US on every Thursday nights. Simultaneously, he acted in films like Almost Heroes, Three to Tango and Fools Rush In. He was cast opposite legendary actress Salma Hayek in the latter film. His film, The Whole Nine Yards in which he was cast alongside Amanda Peet and Bruce Willis was among one of his hit films of an otherwise lackluster film career.
After friends got over, he starred played a range of roles. He garnered a lot of applause for the series called Mr. Sunshine which aired in 2011. Besides performing, he was also the executive producer and writer of the show. He then developed the show The Odd Couple which began in 2015 and concluded in 2017. The last film that he did was 17 Again in 2009. He was cast alongside superstar Hollywood actors like Leslie Mann, Thomas Lennon, and Zac Efron in this film.
Matthew Perry Family, Relatives and Other Relations
He was born to Keith Morrison and John Bennett Perry. He was in a relationship with actress Julia Roberts from 1995 to 1996 and then dated Lizzy Caplan from 2006 to 2012.
John Bennett... Father
Life's Important Dates Of Matthew Perry
Matthew Perry Age, Birthday Facts and Birthday Countdown
52 years, 5months, 10 days old age Matthew Perry will turn 53 on 19 August, 2022. Only 6 months, 20 days, 20 hours,31 minutes has left for his next birthday.
Matthew Perry Born On Tuesday
Matthew Perry has celebrated the total number of 53 birthdays till date. See the analysis by days count and bar graph.
Maluma Biography, Age, Height, Weight, Girlfriend, Family, Wiki & More
Peyton Meyer Biography, Age, Height, Weight, Girlfriend, Family, Wiki & More