content
stringlengths 7
2.61M
|
---|
There are a lot of things to say about Pam — a new 3D printer designed for professionals — but honestly, the one thing I keep coming back to is the fact that each of its pellet pods has a tiny little handle. I mean, nothing quite says hipster design like leather and brass, and I swear to god, it looks like those handles are made out of leather and brass.
Pam can print everything from thermoplastics to silicones
Anyway, this luxurious little design touch aside, Pam's built for business. It has a printing resolution of up to 40 μ and is able to work with up to four materials at the same time. Its makers, Pollen, claim it has "the largest range" of materials available, from thermoplastics to silicones, offering transparency, flexibility, elasticity, a range of colors, and even food-safe surfaces. Pam also comes with its own software, Honeyprint, which can be controlled remotely from "any device" and has its own API for managing printing tasks at a distance.
But, of course, it's expensive as hell, with a "limited time offer" price tag of €8,000 ($8,900) which the company predicts will double to €16,000 in 2017 with a shipping date of April next year. Let's hope those little handles are worth it. |
BISMARCK, N.D. (AP) - A few years ago, Bismarck High School administrators and staff recognized a “critical” need for students: mental health services.
A survey of a sample group of BHS students last year found 17.2 percent of students seriously considered attempting suicide. About 30 percent of students surveyed expressed prolonged feelings of sadness or hopelessness, which a local clinical counselor said would meet the criteria for a depressive disorder.
Recognizing the need, administrators and staff decided to do something. With a mix of district funding and community grants, the high school hired a mental health professional who provides therapy sessions to students during the school day, the Bismarck Tribune reported.
“We saw a need, and the need was kids struggling with depression and anxiety and not able to get access to service,” said Mike Yantes, a social worker at BHS.
Not just BHS, but other schools in the district have ongoing pilot projects this school year related to mental health. Simle Middle School received funding to offer additional mental health supports to students. Dorothy Moses Elementary School also has a therapist in the school.
“If we have kids struggling with depression, we can’t just say, well, nobody’s going to notice, and we’re not going to talk about it. No, we need to talk about it,” said interim BPS superintendent Jim Haussler, who petitioned the Bismarck School Board this year for additional mental health funding.
Schools in Bismarck offer various mental health supports for students, starting in the elementary schools.
Bismarck High began teaching a mental health “resiliency” curriculum to freshmen three years ago as a way to help students learn to deal with adversity. After that, high school staff and teachers noticed the students needed additional outside services.
“We saw it as critical,” said Brenda Lipp, a school psychologist at Bismarck High, whose been employed by the district for 35 years.
This year, they brought in Megan Kraft, a clinical counselor with The Village Family Service Center, who has an office in the school. Part of the reason for hiring Kraft was to eliminate a major barrier to students: access to therapy.
Kraft provides treatment during the school day, so students aren’t missing classes and may feel more comfortable in a familiar environment.
In mid-October, a couple weeks after Kraft started at BHS, she was referred about 20 students and began therapy with eight of them. The students are referred to a school counselor - often by a teacher or parent - who then refers them to Kraft.
The students Kraft sees are dealing with anxiety, depression and have a history of trauma, including abuse.
Though the agreement with Kraft this year is part of a pilot study, Ryan Johnson, assistant principal at BHS, said he hopes they can make it a permanent fixture at the school. Lipp, a school psychologist, said they’ll also look at ways to expand the program to the two other high schools in the district.
Jason Hornbacher, principal of Dorothy Moses Elementary School, said school-based mental health extends beyond just therapy.
“What’s more important is early intervention and early teaching,” said Hornbacher, who’s in his sixth year as principal of the school.
Similar to core classes, such as math or English, Dorothy Moses teaches its students social-emotional skills, including understanding emotions and how to manage them, empathy and problem solving.
Tracy Famias, a social worker at the school, said mental health is often stigmatized, but it shouldn’t be.
To teach children how to cope, six years ago the elementary schools in Bismarck started teaching a social-emotional curriculum. However, more than a decade ago, some schools began utilizing a “continuum of supports” for students, Famias said. At that time, there was a “high number of students who were struggling with emotions,” and many students in need of intensive services, such as therapy.
“If we taught (social and emotional skills) early, then we wouldn’t have this need for intensive services,” she said.
At Dorothy Moses, students in all grades are taught social-emotional skills through lessons, with one lesson taught each week, Famias said.
Though students are taught these skills, there are still students who need additional supports. New this year, the Dorothy Moses decided to partner with the West Central Human Service Center in Bismarck.
Famias and Hornbacher said there are challenges for students and their parents in accessing mental health services, such as access to appointments, transportation and financial hardships.
Once a week, a therapist and a case manager come to the school to provide weekly therapy sessions with students.
In addition, students receiving therapy also receive “intensive interventions” at the school, Famias said. This is for a student who may not be ready for a general education classroom to the point where it impacts the student’s learning. Instead, students may be taken to a smaller classroom, where they work one-on-one with a teacher, social worker and counselor.
The goal is to have the students in the program for two weeks, Famias said. During that time, the school develops a behavior plan and works with West Central on a transition plan to get the students back into the classroom.
In mid-October, there was one student in the program, according to Famias. Hornbacher said the plan is to monitor the students’ progress as they’re in the program, and, in the spring, data will be compiled on the program’s effectiveness.
Hornbacher said the program costs $75,000 a year for a teacher and instructional aide, which is funded by a federal grant. There’s no cost to the district for the therapeutic services.
Tim Gienger, clinical director at West Central, said the collaboration with Dorothy Moses is a first for the organization.
“There’s a lot of kids in the school that really fit our target of families we want to be working with,” Gienger said.
West Central’s “priority population” has a need for intensive services, including children in foster care or those with trauma, he said.
Once a week, West Central employees drive to Dorothy Moses to do a combination of behavioral health assessments and individual therapy with the kids, Gienger said. Eventually, they hope to get a group of children together to work on coping skills. |
Immunohistochemistry and molecular detection of nodal micrometastases in pancreatic cancer. PURPOSE Assays based on polymerase chain reaction (PCR) demonstrate mutated Kiras in the regional nodes of a majority of patients with node-negative stage I or II (T, N, M) pancreatic adenocarcinoma. The hypothesis that the presence of mutated Kiras equates with micrometastases has not been validated by detailed histologic examination nor has an impact on survival been demonstrated. METHODS We examined the paraffin blocks of the primary tumor and regional lymph nodes from all 30 patients from 1984 to 1998 with resected pN stage I or II pancreatic adenocarcinoma. DNA was analyzed for mutations in codon 12 of the Kiras oncogene by PCR and restriction digest with BstN1 (RFLP). All nodes were examined by histology of 4 hematoxylin and eosin-stained step sections and immunohistochemistry (HPE/IHC) with AE3/AE1 epithelial cell marker antibody. RESULTS Examination of the regional lymph nodes of the 30 patients demonstrated nodal metastases in 9 (30%) by step-section histology alone, 14 (46.7%) by HPE/IHC, 19 (63.3%) by PCR/RFLP, and 25 (83.3%) by a combination of PCR/RFLP and HPE/IHC. Seven cases were HPE/IHC positive yet PCR/RFLP negative while 10 cases were PCR/RFLP positive and HPE/IHC negative. Median survival (months) did not differ if nodes were negative or positive by HPE/IHC (20.5 vs 17.5) or PCR/RFLP (20.0 vs 19.0) or a combination of these techniques (25 vs 18.5). CONCLUSIONS A great majority (83.3%) of patients with pathologic stage I or II pancreatic cancer had metastases in their regional nodes. Step-sectioning with immunohistochemistry and PCR/RFLP are complementary tests in detection of metastatic cancer cells. Nodal micrometastases did not adversely influence survival. |
def compare_record(self, old, new, truncate, msg):
super().compare_record(old, new, msg=msg)
for keyword in ("phred_quality", "solexa_quality"):
q_old = old.letter_annotations.get(keyword)
q_new = new.letter_annotations.get(keyword)
if q_old is None or q_new is None:
continue
if truncate and q_old != q_new:
q_old = [min(q, truncate) for q in q_old]
q_new = [min(q, truncate) for q in q_new]
err_msg = "%s: mismatch in %s" % (msg, keyword)
self.assertEqual(q_old, q_new, msg=err_msg)
q_old = old.letter_annotations.get("phred_quality")
q_new = new.letter_annotations.get("solexa_quality")
if q_old is not None and q_new is not None:
converted = [round(QualityIO.solexa_quality_from_phred(q)) for q in q_old]
if truncate:
converted = [min(q, truncate) for q in converted]
err_msg = "%s: mismatch in phred_quality vs solexa_quality" % msg
self.assertEqual(converted, q_new, msg=err_msg)
q_old = old.letter_annotations.get("solexa_quality")
q_new = new.letter_annotations.get("phred_quality")
if q_old is not None and q_new is not None:
converted = [round(QualityIO.phred_quality_from_solexa(q)) for q in q_old]
if truncate:
converted = [min(q, truncate) for q in converted]
err_msg = "%s: mismatch in solexa_quality vs phred_quality" % msg
self.assertEqual(converted, q_new, msg=err_msg) |
package keeper_test
import (
"fmt"
"testing"
"github.com/cosmos/cosmos-sdk/baseapp"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
axelarnet "github.com/axelarnetwork/axelar-core/x/axelarnet/types"
"github.com/axelarnetwork/axelar-core/x/reward/keeper"
"github.com/axelarnetwork/axelar-core/x/reward/types"
"github.com/axelarnetwork/axelar-core/x/reward/types/mock"
tsstypes "github.com/axelarnetwork/axelar-core/x/tss/types"
"github.com/axelarnetwork/axelar-core/x/vote/exported"
votetypes "github.com/axelarnetwork/axelar-core/x/vote/types"
testutils "github.com/axelarnetwork/utils/test"
"github.com/axelarnetwork/utils/test/rand"
)
func TestHandleMsgRefundRequest(t *testing.T) {
var (
server types.MsgServiceServer
refundKeeper *mock.RefunderMock
bankKeeper *mock.BankerMock
ctx sdk.Context
router sdk.Router
msg *types.RefundMsgRequest
)
setup := func() {
refundKeeper = &mock.RefunderMock{
LoggerFunc: func(ctx sdk.Context) log.Logger { return log.TestingLogger() },
GetPendingRefundFunc: func(sdk.Context, types.RefundMsgRequest) (types.Refund, bool) {
return types.Refund{Payer: rand.AccAddr(), Fees: sdk.NewCoins(sdk.Coin{Denom: "uaxl", Amount: sdk.NewInt(1000)})}, true
},
DeletePendingRefundFunc: func(sdk.Context, types.RefundMsgRequest) {},
}
bankKeeper = &mock.BankerMock{
SendCoinsFromModuleToAccountFunc: func(sdk.Context, string, sdk.AccAddress, sdk.Coins) error { return nil },
}
var tssHandler = func(_ sdk.Context, _ sdk.Msg) (*sdk.Result, error) {
return &sdk.Result{}, nil
}
ctx = sdk.NewContext(nil, tmproto.Header{Height: rand.PosI64()}, false, log.TestingLogger())
router = baseapp.NewRouter()
router.AddRoute(sdk.NewRoute("tss", tssHandler))
msgServiceRtr := baseapp.NewMsgServiceRouter()
server = keeper.NewMsgServerImpl(refundKeeper, bankKeeper, msgServiceRtr, router)
}
repeatCount := 20
t.Run("should return error when unpack invalid inner message", testutils.Func(func(t *testing.T) {
setup()
any := cdctypes.Any{
TypeUrl: rand.StrBetween(5, 20),
Value: rand.Bytes(int(rand.I64Between(100, 1000))),
}
msg = &types.RefundMsgRequest{
Sender: rand.AccAddr(),
InnerMessage: &any,
}
_, err := server.RefundMsg(sdk.WrapSDKContext(ctx), msg)
assert.Error(t, err)
}).Repeat(repeatCount))
t.Run("should return error when failed to route inner message", testutils.Func(func(t *testing.T) {
setup()
msg = types.NewRefundMsgRequest(rand.AccAddr(), randomMsgLink())
_, err := server.RefundMsg(sdk.WrapSDKContext(ctx), msg)
assert.Error(t, err)
}).Repeat(repeatCount))
t.Run("should return error when failed to executed inner message", testutils.Func(func(t *testing.T) {
setup()
var evmHandler = func(_ sdk.Context, _ sdk.Msg) (*sdk.Result, error) {
return &sdk.Result{}, fmt.Errorf("failed to execute message")
}
router.AddRoute(sdk.NewRoute("evm", evmHandler))
voteReq := &votetypes.VoteRequest{
Sender: rand.AccAddr(),
PollKey: exported.NewPollKey(votetypes.ModuleName, rand.StrBetween(5, 100)),
Vote: exported.Vote{},
}
msg = types.NewRefundMsgRequest(rand.AccAddr(), voteReq)
_, err := server.RefundMsg(sdk.WrapSDKContext(ctx), msg)
assert.Error(t, err)
}).Repeat(repeatCount))
t.Run("should not refund transaction fee when no pending refund", testutils.Func(func(t *testing.T) {
setup()
refundKeeper.GetPendingRefundFunc = func(sdk.Context, types.RefundMsgRequest) (types.Refund, bool) { return types.Refund{}, false }
msg = types.NewRefundMsgRequest(rand.AccAddr(), &tsstypes.HeartBeatRequest{})
_, err := server.RefundMsg(sdk.WrapSDKContext(ctx), msg)
assert.NoError(t, err)
}).Repeat(repeatCount))
t.Run("should refund transaction fee when executed inner message successfully", testutils.Func(func(t *testing.T) {
setup()
msg = types.NewRefundMsgRequest(rand.AccAddr(), &tsstypes.HeartBeatRequest{})
_, err := server.RefundMsg(sdk.WrapSDKContext(ctx), msg)
assert.NoError(t, err)
assert.Len(t, refundKeeper.GetPendingRefundCalls(), 1)
assert.Len(t, bankKeeper.SendCoinsFromModuleToAccountCalls(), 1)
}).Repeat(repeatCount))
}
func randomMsgLink() *axelarnet.LinkRequest {
return axelarnet.NewLinkRequest(
rand.AccAddr(),
rand.StrBetween(5, 100),
rand.StrBetween(5, 100),
rand.StrBetween(5, 100))
}
|
Disturbing footage of a woman arguing with, hitting and even biting a dog has emerged online.
The woman was filmed on the Toronto subway on Friday by fellow passenger Roxy Huang, who uploaded the footage to Youtube.
She can be seen arguing with the dog, telling it to ‘stop it, right now’ and hitting it while the animal yelps in pain.
Thankfully it doesn’t take long for another passenger to intervene, telling the woman she has ‘got to stop hitting your dog’.
At this point the passengers tell a Toronto Transit worker that the woman is abusing the dog, leading to her being escorted off the train.
The woman has not been identified, and it is not known if she has been reported to the authorities. |
Public Works Delivery Systems in North America One of the 1998 International PublicWorks Congress and Expositions workshops focused on the methods of delivery currently used to provide public works services in North America. This article examines three public works delivery systems: traditional model, privatization in general, and managed competition. The three perspectives are intended to provide insight into actual methods, advantages and disadvantages, and trends of each approach based on experience rather than theory. |
// ReadOnlyURL returns the url for communication with git-daemon.
func ReadOnlyURL(app string) string {
roHost, err := config.GetString("git:ro-host")
if err != nil {
log.Error("git:ro-host config not found")
panic(err)
}
return fmt.Sprintf("git://%s/%s.git", roHost, app)
} |
Long-term outcome of children with febrile seizures. This study investigates the long-term outcome of children admitted to hospital for febrile seizures (FS) in Singapore. Children born between 1/1/1980 and 31/12/1982 who were admitted to the Singapore General Hospital between 1/1/81 and 31/12/82 with FS were the subjects of this study. Four hundred and seventy-nine children were identified. Their medical records were analysed. Four hundred and seventy-six children (99.4%) were traced in 1988. The average age at follow up was 7.3 years. There were no deaths or permanent neurological deficits from FS. Eighteen children had one or more afebrile seizure (AFS) following the initial FS. In 8 children a condition precipitating the AFS could be identified. Ten children (2.1%) had unprovoked AFS. Five children had one AFS, and the other 5 had more than one AFS. The incidence of epilepsy was 1.0%. Children with a FS lasting 30 minutes or more had a higher incidence of subsequent unprovoked AFS compared to children whose FS were less than 30 minutes. The incidences were 12.1% and 1.4% respectively (p = 0.003). Children with a family history of epilepsy and/or fits had an increased risk compared to children with no family history of fits or with a family history of FS only. The incidence were 9.1% and 1.6% respectively (p =.027). Sex, race, age of onset of FS, total number of recurrent FS and EEG findings were not significant predicators. |
Sticky carpets, dodgy music and questionable dance partners - what’s not to miss about some of the big players in the gone-but-not-forgotten Leeds night life scene?
It was the cheesy, colourful nightclub night we all loved to hate. It closed for the final time in 2006.
The much-missed T&C was a high-calibre hot spot for live music and club nights, and was home to the Love Train night.
Located on New Briggate, it was an attempt to bring some London sophistication to the city circa 1992.
This was the nightspot you visited after the nightclub playing hard house music until it was shut down in 2004. |
<gh_stars>0
from typing import List, Tuple
from enum import Enum
from copy import deepcopy
from src.coordinate import Coordinate
class Color(Enum):
WHITE = 0
BLACK = 1
class Type(Enum):
PAWN = 0
KNIGHT = 1
BISHOP = 2
ROOK = 3
QUEEN = 4
KING = 5
class Piece:
coordinate: Coordinate
color: Color
moved: bool
piece_type: Type
def __init__(
self,
color: Color,
coordinate: Coordinate,
piece_type: Type,
moved: bool = False,
) -> None:
"""
Arguments:
"""
self.color = color
self.coordinate = coordinate
self.piece_type = piece_type
self.moved = moved
def __str__(self) -> None:
return self.color.name + " " + self.piece_type.name
|
<filename>CloverFly/LxCategory/UIDevice+DeviceCode.h
//
// DeviceCode.h
/*
// ___ __ ____ _ _________
// / __// / / __ \| | / / __/ _ \
// / / / /_ / /_/ /| |/ / _// , _/
// /___//____/\____/_\___/___/_/|_|
// --------Created by clover--------
*/
#import <UIKit/UIKit.h>
@interface UIDevice(DeviceCode)
- (NSString *)getDeviceCode;
@end
|
<reponame>ayberkgerey5/FrameGraphx
// Copyright (c) 2018-2020, <NAME>. For more information see 'LICENSE'
#include "scene/Math/Frustum.h"
#include "UnitTest_Common.h"
static void Frustum_Test1 ()
{
Camera camera;
Frustum frustum;
AABB bbox;
camera.SetPerspective( 60.0_deg, 1.5f, vec2(0.1f, 100.0f) );
frustum.Setup( camera );
TEST( frustum.IsVisible( vec3{0.0f, 0.0f, 10.0f} ));
TEST( frustum.IsVisible( vec3{5.0f, 0.0f, 10.0f} ));
TEST( frustum.IsVisible( vec3{0.0f, 30.0f, 90.0f} ));
TEST( frustum.IsVisible( vec3{0.0f, 0.0f, 0.1f} ));
TEST( not frustum.IsVisible( vec3{0.0f, 0.0f, 110.0f} ));
TEST( not frustum.IsVisible( vec3{0.0f, 0.0f, -10.0f} ));
TEST( not frustum.IsVisible( vec3{0.0f, 10.0f, 10.0f} ));
TEST( not frustum.IsVisible( vec3{0.0f, -10.0f, 10.0f} ));
TEST( not frustum.IsVisible( vec3{ 10.0f, 0.0f, 10.0f} ));
TEST( not frustum.IsVisible( vec3{-10.0f, 0.0f, 10.0f} ));
bbox.SetExtent(vec3{ 2.0f }).SetCenter(vec3{ 0.0f, 0.0f, 10.0f });
TEST( frustum.IsVisible( bbox ));
bbox.SetCenter(vec3{ 0.0f, 0.0f, -10.0f });
TEST( not frustum.IsVisible( bbox ));
vec3 rays[4];
TEST( frustum.GetRays( OUT rays[0], OUT rays[1], OUT rays[2], OUT rays[3] ));
TEST( All(Equals( rays[0], vec3{ 0.6f, -0.4f, -0.69f}, 0.05f )) );
TEST( All(Equals( rays[1], vec3{ 0.6f, 0.4f, -0.69f}, 0.05f )) );
TEST( All(Equals( rays[2], vec3{-0.6f, -0.4f, -0.69f}, 0.05f )) );
TEST( All(Equals( rays[3], vec3{-0.6f, 0.4f, -0.69f}, 0.05f )) );
}
static void Frustum_Test2 ()
{
Camera camera;
Frustum frustum;
AABB bbox;
camera.SetPerspective( 60.0_deg, 1.5f, vec2(0.1f, 100.0f) )
.Move(vec3{ 100.0f, 0.0f, 50.0f }).Rotate( 180.0_deg, vec3{0.0f, 1.0f, 0.0f});
frustum.Setup( camera );
TEST( frustum.IsVisible( camera.transform.position + vec3{0.0f, 0.0f, -10.0f} ));
TEST( not frustum.IsVisible( camera.transform.position + vec3{0.0f, 0.0f, 10.0f} ));
}
static void Frustum_Test3 ()
{
Camera camera;
Frustum frustum1;
Frustum frustum2;
camera.SetPerspective( 60.0_deg, 1.5f, vec2(0.1f, 100.0f) );
frustum1.Setup( camera );
camera.Move(vec3{ 50.0f, 0.0f, 50.0f }).Rotate( -90.0_deg, vec3{0.0f, 1.0f, 0.0f});
frustum2.Setup( camera );
TEST( frustum1.IsVisible( frustum2 ));
camera = Camera{};
camera.SetPerspective( 60.0_deg, 1.5f, vec2(0.1f, 100.0f) ).Move(vec3{0.0f, 0.0f, -2.0f}).Rotate( 180_deg, vec3{0.0f, 1.0f, 0.0f});
frustum2.Setup( camera );
// TODO
//TEST( not frustum1.IsVisible( frustum2 ));
}
extern void UnitTest_Frustum ()
{
Frustum_Test1();
Frustum_Test2();
Frustum_Test3();
FG_LOGI( "UnitTest_Frustum - passed" );
}
|
User experience on numerical application between children with Down Syndrome and autism The use of information technology in special education can enhance the ability in learning process. The purpose of this study is to compare the experience of children with Down Syndrome (DS) and children with autism in using a mobile numerical application named MathDS. Five children with DS and six children with autism involved in this study. The results indicate that the students with autism are more confident and satisfied with the application compared to the children with DS. Furthermore the analysis shows that the children with autism can easily understand on how to use the application and can get familiar with the product easily compared to children with DS. This might be because of the characteristics and also the behavior of the children. |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class stock_move_consume(osv.osv_memory):
_name = "stock.move.consume"
_description = "Consume Products"
_columns = {
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True),
'location_id': fields.many2one('stock.location', 'Location', required=True),
'restrict_lot_id': fields.many2one('stock.production.lot', 'Lot'),
}
#TOFIX: product_uom should not have different category of default UOM of product. Qty should be convert into UOM of original move line before going in consume and scrap
def default_get(self, cr, uid, fields, context=None):
if context is None:
context = {}
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
if 'product_id' in fields:
res.update({'product_id': move.product_id.id})
if 'product_uom' in fields:
res.update({'product_uom': move.product_uom.id})
if 'product_qty' in fields:
res.update({'product_qty': move.product_uom_qty})
if 'location_id' in fields:
res.update({'location_id': move.location_id.id})
return res
def do_move_consume(self, cr, uid, ids, context=None):
if context is None:
context = {}
move_obj = self.pool.get('stock.move')
uom_obj = self.pool.get('product.uom')
move_ids = context['active_ids']
for data in self.browse(cr, uid, ids, context=context):
if move_ids and move_ids[0]:
move = move_obj.browse(cr, uid, move_ids[0], context=context)
qty = uom_obj._compute_qty(cr, uid, data['product_uom'].id, data.product_qty, data.product_id.uom_id.id)
move_obj.action_consume(cr, uid, move_ids,
qty, data.location_id.id, restrict_lot_id=data.restrict_lot_id.id,
context=context)
return {'type': 'ir.actions.act_window_close'}
|
// An executable file that generates two different test vectors
// shouldpass.md contains a dictionnary of datatype/topic/value -> frame
// that should be identified successfully by any distribution
// shoudlfail.md contains a set of non valid frames
#include "telemetry_core.h"
#include "stdio.h"
FILE * output;
// Not used. Don't care
int32_t read(void * buf, uint32_t sizeToRead)
{
return 0;
}
// Not used. Don't care
int32_t readable()
{
return 0;
}
int32_t write(void * buf, uint32_t sizeToWrite)
{
uint8_t * caster = (uint8_t*)(buf);
uint32_t i;
for(i = 0 ; i < sizeToWrite ; i++)
{
fprintf(output, "%02x", caster[i]);
}
}
int32_t writeable()
{
return 1;
}
void newentry(FILE * file, const char * topic, const char * msg)
{
fputs("string", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fputs(msg, file);
fputs("\t;\t", file);
publish(topic,msg);
fputs("\n", file);
}
void newentry_u8(FILE * file, const char * topic, uint8_t data)
{
fputs("u8", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%hhu", data);
fputs("\t;\t", file);
publish_u8(topic,data);
fputs("\n", file);
}
void newentry_u16(FILE * file, const char * topic, uint16_t data)
{
fputs("u16", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%hu", data);
fputs("\t;\t", file);
publish_u16(topic,data);
fputs("\n", file);
}
void newentry_u32(FILE * file, const char * topic, uint32_t data)
{
fputs("u32", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%u", data);
fputs("\t;\t", file);
publish_u32(topic,data);
fputs("\n", file);
}
void newentry_i8(FILE * file, const char * topic, int8_t data)
{
fputs("i8", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%hhi", data);
fputs("\t;\t", file);
publish_i8(topic,data);
fputs("\n", file);
}
void newentry_i16(FILE * file, const char * topic, int16_t data)
{
fputs("i16", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%hi", data);
fputs("\t;\t", file);
publish_i16(topic,data);
fputs("\n", file);
}
void newentry_i32(FILE * file, const char * topic, int32_t data)
{
fputs("i32", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%i", data);
fputs("\t;\t", file);
publish_i32(topic,data);
fputs("\n", file);
}
void newentry_f32(FILE * file, const char * topic, float data)
{
fputs("f32", file);
fputs("\t;\t", file);
fputs(topic, file);
fputs("\t;\t", file);
fprintf(file, "%f", data);
fputs("\t;\t", file);
publish_f32(topic,data);
fputs("\n", file);
}
int main()
{
TM_transport transport;
transport.write = write;
transport.read = read;
transport.readable = readable;
transport.writeable = writeable;
init_telemetry(&transport);
output = NULL;
output = fopen("valid_vectors.csv","w");
if(output == NULL)
{
printf("Failure : Could not open file for write.");
return -1;
}
// Test vectors
newentry(output, "foo" ,"bar");
newentry(output, "foo with spaces" ,"bar with spaces");
newentry(output, "0123456789" ,"0123456789");
newentry(output, "ABCD/EFGH:IJK" ,"abcdefghijk");
newentry(output, "lmnopqrstuv:123" ,"wxyz");
newentry_u8(output, "bar", 0);
newentry_u8(output, "foo", 255);
newentry_u8(output, "hello world", 127);
newentry_u16(output, "abcdef", 0);
newentry_u16(output, "bar", 65535);
newentry_u16(output, "fooqux", 256);
newentry_u32(output, "ghij", 0);
newentry_u32(output, "test", 1);
newentry_u32(output, "klmopq", 4294967295);
newentry_u32(output, "rstuv", 65536);
newentry_i8(output, "bar", 0);
newentry_i8(output, "plus", 1);
newentry_i8(output, "minus", -1);
newentry_i8(output, "foo", -127);
newentry_i8(output, "hello world", -127);
newentry_i16(output, "abcdef", 0);
newentry_i16(output, "minus", -1);
newentry_i16(output, "plus", 1);
newentry_i16(output, "bar", 32767);
newentry_i16(output, "fooqux", -32767);
newentry_i32(output, "ghij", 0);
newentry_i32(output, "minus", -1);
newentry_i32(output, "plus", 1);
newentry_i32(output, "klmopq", 2147483647);
newentry_i32(output, "rstuv", -2147483648);
newentry_f32(output, "zeropos", 0.f);
newentry_f32(output, "zeropos", -0.f);
newentry_f32(output, "normally perfect", 61.f);
newentry_f32(output, "other", 1.2e34);
newentry_f32(output, "otherneg", -1.2e34);
close(output);
printf("Valid test vector generation success.\n");
return 0;
}
|
New Hampshire State Police are trying to determine how a camper rolled over on Interstate 89 in Grantham on Saturday night.
Police said a trooper was driving north on the highway at 8:52 p.m. when he saw a pickup truck towing the 33-foot camper somehow lose control near exit 13 and roll over.
The driver of the pickup truck, Michael Tibbetts, 67, of Garland, Maine, did not suffer any injuries in the crash.
The highway was shut down for several hours due to the camper blocking the entire width of the highway.
Police are trying to determine the exact cause of the crash but said they are looking at driver fatigue and equipment issues as possible factors. |
Interrogating questions of national belonging, difference and xenophobia in South Africa abstract Questions about gender and sexuality that were central to the colonial project where women negotiated their connection to the nation through liaisons with men continue to be central to the process of building postcolonial African states. The establishment of many of these states has been embedded in dense body politics that often exclude genders and sexualities categorised as counter to citizenship. Exclusion in post-apartheid South Africa (SA), for instance, is evident in how black lesbians and queers are attacked and excluded for being sexually different. Consequently, ones gender, sexual and racial identities serve as a source of violence and constant negotiation for belonging to this democracy, irrespective of the progressive Constitution. The feeling of not being a proper citizen is equally evident in how nationals from the northern part of SA are in some spaces constructed by fellow citizens as bodies that do not belong. These polarised constructions generate outsider identities that are informed by notions of inferior pigmentation and language vis--vis dominant ones. Such dichotomised images of citizenship are reinforced by ever-evolving grammars and vocabularies about people foreign to SA, whose bodies and privacy warrant intrusion in very violent nationalised, racialised, gendered and sexualised ways, as evidenced by the 2008 and 2015 xenophobic attacks. Informed by my intersecting positionalities as a black foreign national who has lived in SA since 2008, the article analyses Zimbabwean migrants experiences of constantly negotiating the politics of national belonging and difference in SA that emerged during fieldwork engagements in Johannesburg between 2008 and 2015. The article interrogates subtle and overt institutionalised and everyday technologies of difference that not only force foreign nationals to live through heavily patrolled black bodies marked as different within specific temporal landscapes, places and spaces, but are also core to the xenophobic grammar that frames Zimbabweans as bodies that destabilise the very foundation and survival of the nation. |
EFFICACY-TO-EFFECTIVENESS CLINICAL TRIALS. Efficacy trials, which assess treatments in optimally selected patients under advantageous conditions for relatively short time periods, are necessary to gain regulatory approval for marketing. In contrast, effectiveness trials, which test treatments across a spectrum of patients in real-world conditions with follow-up periods that match typical treatment regimens, provide critical information on drug effects in those patients who may ultimately receive the treatment. We previously proposed a study design that integrates efficacy and effectiveness trials into a 2-component "efficacy-to-effectiveness (E2E) trial," in which if the initial efficacy trial component is positive, then the trial immediately and seamlessly transitions to the effectiveness trial component. However, we believe that total study duration could be even further shortened by simultaneously addressing efficacy and effectiveness too (EE2). An EE2 trial rigorously demonstrates efficacy, but uses broad inclusion characteristics of effectiveness trials. An example of a study using EE2 design, the IMMEDIATE (Immediate Myocardial Metabolic enhancement During Initial Assessment and Treatment in Emergency Care) trial, is provided. |
DRUG ADHERENCE AND PSYCHOLOGICAL FACTORS MATTER IN PATIENTS WITH RESISTANT HYPERTENSION - YES BUT WHICH ONES? Objective: Altered psychological profiles are associated with drug adherence and drug resistance in patients with resistant hypertension (RHTN). However, treatment resistance may also result from increased arterial stiffness and target organ damage. The aim of this study was to assess the association of psychological factors with both drug adherence and drug resistance in two subtypes of patients with RHTN: younger patients without cardiovascular complications versus older or vascular patients. Design and method: Ninety-seven patients with RHTN were enrolled and split in two groups: patients 60y or older or with previous cardiovascular diseases (VRHTN), and younger patients without cardiovascular complications (NVRHTN). Drug adherence was assessed by urinary Liquid Chromatography coupled with tandem Mass Spectrometry. Drug resistance was evaluated by 24-hour ambulatory blood pressure adjusted for the number of antihypertensive drugs and drug adherence. Psychological profile was assessed using five validated questionnaires: the Brief Symptom Inventory (BSI), the Toronto Alexithymia Scale (TAS-20), the Emotion Regulation Questionnaire (ERQ), the Cognitive Emotion Regulation Questionnaire (CERQ) and the Post Traumatic Diagnostic Scale (PDS). Results: The proportion of fully adherent, partly adherent, and totally non-adherent patients was significantly different between NVRHTN (37, 39 and 24%) and VRHTN (67, 26 and 7 %) respectively (p-value = 0.010). After multiple regression analysis, independent predictors of poor drug adherence in NVRHTN were adaptive strategies, male gender and family history of hypertension, accounting for 39.2% of the variability. Independent predictors of drug resistance were difficulties in planification and somatization, accounting for 39.0% of the variability. In the VRHTN group, predictors of drug adherence were yearly number of visits at the emergency department for hypertension and family history of cardiovascular events, accounting for 28.1% of the variability in drug adherence. Predictors of drug resistance were the number of visits at the emergency department and the total number of drugs prescribed per day, accounting for 35.0% of the variability in drug resistance. Conclusions: Poor drug adherence and altered psychological profiles appear to play a major role in younger patients with RHTN without cardiovascular complications. This subset of patients should be prioritized for assessment of drug adherence and psychological evaluation. |
#pragma once
/*
* Covariant Mozart Utility Library: Base
*
* Licensed under the Covariant Innovation General Public License,
* Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://covariant.cn/licenses/LICENSE-1.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Copyright (C) 2019 <NAME>(李登淳)
* Email: <EMAIL>
* Github: https://github.com/mikecovlee
*
* Library Version: 17.2.1
*/
#ifndef __cplusplus
#error E0001
#endif
#ifndef _MSC_VER
#if __cplusplus < 201103L
#error E0002
#endif
#endif
#define __Mozart 170601L
#include <exception>
#include <stdexcept>
#include <typeindex>
#include <typeinfo>
#include <string>
namespace cov {
class warning final : public std::exception {
std::string mWhat = "Mozart Warning";
public:
warning() = default;
explicit warning(const std::string &str) noexcept:
mWhat("Mozart Warning:" + str) {}
warning(const warning &) = default;
warning(warning &&) = default;
~warning() override = default;
const char *what() const noexcept override
{
return this->mWhat.c_str();
}
};
class error final : public std::exception {
std::string mWhat = "Mozart Error";
public:
error() = default;
explicit error(const std::string &str) noexcept:
mWhat("Mozart Error:" + str) {}
error(const error &) = default;
error(error &&) = default;
~error() override = default;
error &operator=(const error &) = default;
error &operator=(error &&) = default;
const char *what() const noexcept override
{
return this->mWhat.c_str();
}
};
class object {
public:
object() = default;
object(object &&) noexcept = default;
object(const object &) = default;
virtual ~object() = default;
virtual std::type_index object_type() const noexcept final
{
return typeid(*this);
}
virtual std::string to_string() const noexcept
{
return typeid(*this).name();
}
virtual object *clone() noexcept
{
return nullptr;
}
virtual bool equals(const object *ptr) const noexcept
{
return this == ptr;
}
};
}
|
Five years ago, Jessica Velazquez joined a pickup American football game with her little brothers and fell in love with the sport. Finding a league was surprisingly easy. Peewee flag football is surging in popularity in Mexico. So popular, in fact, that Jessica, now 18, thinks it might just unseat soccer as Mexico's favorite sport.
"I think it might be competitive with soccer nowadays," she said.
American football is now the No. 2 team sport in Mexico, and the NFL sees the country as a smart investment. Arturo Olivé, the managing director of NFL Mexico, estimates that the league's fan base has grown 300 percent in the past eight years, steadily gaining on soccer, the current top dog.
And parents couldn't be happier. Jesus Romero is a peewee coach whose 16-year-old daughter just started playing American football.
"She's a dancer, she likes jazz and all that, but she decided to try out. She loves it," Romero said.
A lifelong football player himself, Romero extols the virtues of the sport.
"It's a way to live," he said, as he leads his team of 11- and 12-year-old girls in warm-ups. "It's so different from soccer. Soccer players are so sweet. Football players are tough and disciplined."
Today, Mexico, with its huge fan base, is an NFL favorite for growing the organization's global reach.
After dismal ratings so far this season, there was a slight rebound after the presidential campaign ended. Analysts were quick to point out, however, that Seahawks-Patriots and Cowboys-Steelers represent two uniquely exciting matchups for the league. It remains unclear that the uptick is permanent.
So while the NFL ponders its options, it's also continuing to expand the league's international presence. With a saturated domestic market, the league is hoping to gain traction in Britain, Canada and China. But it's also looking to Mexico, where American football has been a staple for generations.
The first international regular season game took place in 2005 in Mexico City's Estadio Azteca. The Arizona Cardinals beat the San Francisco 49ers in front of a record 103,467 people. And it's hoping for similar success on Monday, when the Houston Texans play the Oakland Raiders.
But American football's history in Mexico goes back much further than 2005.
"We have more than 100 years of history with football," said Monterrey Institute of Technology coach Carlos Altamirano. "For the northern cities of Mexico, we love football more than soccer."
Those northern cities didn't have to look far to find their adoptive home team. For decades, the Dallas Cowboys have been a national favorite. In the 1960s, the Cowboys — or the Vaqueros de Dallas — became the first to broadcast games in Mexico when Tex Schramm, the original franchise general manager, allowed Mexican TV to broadcast Cowboys games for free.
Schramm's vision helped cement the team in the Mexican psyche.
"Even things such as players with their helmets off on the bench, getting to know them, getting to see them, that's how the Cowboys became one of the most popular teams in Mexico," said Victor Villalba, the manager of the Cowboys' Spanish-language properties.
Schramm had some help. In the 1960s, Cowboys kicker Danny Villanueva captured the imaginations of Hispanic football fans. Villanueva, a Mexican-American born in New Mexico, was only with the Cowboys from 1965 to '67, but he was a superstar for fans in Mexico.
"There is no doubt that seeing the name 'Villanueva' on the back of the jersey had something to do with the fact that people were really endeared to the Dallas Cowboys," Villalba said.
The Cowboys — and their jerseys — continue to be massively popular.
"When the Cowboys played the Steelers [in Dallas] back in 2012, the amount of people that had traveled from Mexico wearing both Cowboys jerseys and Steelers jerseys was unbelievable," Villalba recalled.
Now, as kickoff approaches for a sold-out game in Mexico City, Arturo Olivé and NFL Mexico are optimistic.
"We still have a long way to go to catch up with soccer, but at least now we know that we are well ahead of the rest of the team sports in our country," Olivé said.
While he may be right, there is still a chicken-and-egg conundrum facing the sport. Attracting the best athletes requires money, and money requires the best athletes.
Coach Altamirano, whose Monterrey Tech Borregos (Rams) are one of the most dominant college teams in the country, laments the lack of opportunity.
"The only professional sport is soccer. It's the only sport that guys can dream to get to a professional team."
But developing professional-caliber sports teams and players takes time. And, as Olivé points out, football in Mexico may not match the U.S. in raw numbers, but the trend is positive. Which for now is more than the NFL can say in the U.S. |
import {
toISODate, isValidISODate, isValidISOYear, toISOYear, isValidISOMonth, toISOMonth,
} from './ISODate';
describe('ISO Date', () => {
describe('isValid', () => {
test('a valid date this year', () => {
expect(isValidISODate('2014-02-21')).toBe(true);
});
test('a year with 3 digits', () => {
expect(isValidISODate('201-02-21')).toBe(false);
});
test('a year with 5 digits', () => {
expect(isValidISODate('20102-02-21')).toBe(false);
});
test('an out of bound month', () => {
expect(isValidISODate('2019-13-21')).toBe(false);
});
test('a 00 month', () => {
expect(isValidISODate('2019-00-21')).toBe(false);
});
test('an out of bound day', () => {
expect(isValidISODate('2019-01-32')).toBe(false);
});
test('a 00 day', () => {
expect(isValidISODate('2019-01-00')).toBe(false);
});
test('an out of bound day of specific month', () => {
expect(isValidISODate('2019-02-30')).toBe(false);
});
test('an out of bound day of specific month of a nonleap year', () => {
expect(isValidISODate('2015-02-29')).toBe(false);
});
test('a normally out of bound day of specific month of leap year ', () => {
expect(isValidISODate('2016-02-29')).toBe(true);
});
test('does NOT work with an ISOString (2019-10-31T00:16:59.998Z)', () => {
expect(isValidISODate('2019-10-31T00:16:59.998Z')).toBe(false);
});
});
describe('toISODate', () => {
test('a Date Object', () => {
expect(toISODate(new Date(1571865848345))).toBe('2019-10-23');
});
test('a valid string', () => {
expect(toISODate('2019-02-23')).toBe('2019-02-23');
});
test('an invalid string', () => {
expect(() => toISODate('20190223')).toThrow();
});
test('toISODate returns in UTC Timezone, not the local one!', () => {
expect(toISODate(new Date('Mon Nov 04 2019 23:00:00 GMT-0500'))).toBe('2019-11-05');
});
});
});
describe('ISO Year', () => {
describe('isValid', () => {
test('a valid year', () => {
expect(isValidISOYear('2014')).toBe(true);
});
test('a year with 5 digits', () => {
expect(isValidISOYear('20142')).toBe(false);
});
test('a year with 3 digits', () => {
expect(isValidISOYear('201')).toBe(false);
});
test('a year w/ digits and letters', () => {
expect(isValidISOYear('2o12')).toBe(false);
});
test('fails with a valid ISODate', () => {
expect(isValidISOYear('2012-01-22')).toBe(false);
});
});
describe('toISOYear', () => {
test('valid digits of format yyyy', () => {
expect(toISOYear('2323')).toBe('2323');
});
test('valid ISODate', () => {
expect(toISOYear('2323-02-12')).toBe('2323');
});
test('valid Date objecet', () => {
expect(toISOYear(new Date(1571865848345))).toBe('2019');
});
test('digits too short', () => {
expect(() => toISOYear('232')).toThrow();
});
test('digits too long', () => {
expect(() => toISOYear('23223')).toThrow();
});
test('letters', () => {
expect(() => toISOYear('asda')).toThrow();
});
test('invalid ISO Date', () => {
expect(() => toISOYear('2012-01-00')).toThrow();
});
test('toISODate returns in UTC Timezone, not the local one!', () => {
expect(toISOYear(new Date('Tue Dec 31 2019 20:00:00 GMT-0500'))).toBe('2020');
});
});
});
describe('ISO Month', () => {
describe('isValid', () => {
test('a valid month at upper boundary', () => {
expect(isValidISOMonth('12')).toBe(true);
});
test('a valid month at lower boundary', () => {
expect(isValidISOMonth('01')).toBe(true);
});
test('a valid month in the middle', () => {
expect(isValidISOMonth('05')).toBe(true);
});
test('a month with 3 digits', () => {
expect(isValidISOYear('123')).toBe(false);
});
test('a month with 1 digits', () => {
expect(isValidISOYear('1')).toBe(false);
});
test('a month w/ digits and letters', () => {
expect(isValidISOYear('1o')).toBe(false);
});
test('fails with a valid ISODate', () => {
expect(isValidISOYear('2012-01-22')).toBe(false);
});
});
describe('toISOYear', () => {
test('valid digits of format mm', () => {
expect(toISOMonth('12')).toBe('12');
});
test('valid ISODate', () => {
expect(toISOMonth('2323-02-12')).toBe('02');
});
test('valid Date objecet', () => {
expect(toISOMonth(new Date(1571865848345))).toBe('10');
});
test('digits too short', () => {
expect(() => toISOMonth('1')).toThrow();
});
test('digits too long', () => {
expect(() => toISOMonth('123')).toThrow();
});
test('letters', () => {
expect(() => toISOMonth('asda')).toThrow();
});
test('invalid ISO Date', () => {
expect(() => toISOMonth('2012-01-00')).toThrow();
});
test('toISODate returns in UTC Timezone, not the local one!', () => {
expect(toISOMonth(new Date('Tue Dec 31 2019 20:00:00 GMT-0500'))).toBe('01');
});
});
});
|
import Component from '../component';
interface IProps {
element?: HTMLElement | string;
fade?: boolean;
}
export default class Alert extends Component {
static attachDOM(): void;
private onTransition;
constructor(props?: IProps);
show(): boolean;
hide(el?: HTMLElement): boolean;
onElementEvent(event: Event): void;
destroy(): void;
private getOpacity;
}
export {};
|
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/gcc.target/i386/avx512vl-vgetmantpd-1.c<gh_stars>1-10
/* { dg-do compile } */
/* { dg-options "-O2 -mavx512vl" } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vgetmantpd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m256d x, y;
volatile __m128d a, b;
volatile __mmask8 m;
void extern
avx512vl_test (void)
{
x = _mm256_getmant_pd (y, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src);
x = _mm256_mask_getmant_pd (x, m, y, _MM_MANT_NORM_p75_1p5,
_MM_MANT_SIGN_src);
x = _mm256_maskz_getmant_pd (m, y, _MM_MANT_NORM_p75_1p5,
_MM_MANT_SIGN_src);
a = _mm_getmant_pd (b, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src);
a = _mm_mask_getmant_pd (a, m, b, _MM_MANT_NORM_p75_1p5,
_MM_MANT_SIGN_src);
a = _mm_maskz_getmant_pd (m, b, _MM_MANT_NORM_p75_1p5,
_MM_MANT_SIGN_src);
}
|
Maggie, who was thought to be the world's oldest dog, has died in Australia aged 30 - or 133 in human years.
The Kelpie was owned by Victoria dairy farmer Brian McLaren.
He told a local newspaper that she died on Sunday night in her basket.
"She was 30. She was still going along nicely last week. She was walking from the dairy to the office and growling at the cats and all that sort of thing," Brian told the Weekly Times.
"She just went downhill in two days and I said yesterday morning when I went home for lunch, 'She hasn't got long now.'
"I'm sad, but I'm pleased she went the way she went."
Maggie's age can't be verified because Brian says he lost the dog's paperwork when she was a puppy.
Brian McLaren says his youngest son, Liam, was four years old when they bought Maggie. He's now 34.
Before she died, the farm dog was deaf and had been losing her vision.
The official holder of the world's oldest dog is held by an Australian Cattle Dog called Bluey who died in 1939 aged 29.
Guinness World Records says he was bought as a puppy in 1910 in Victoria and worked among cattle and sheep for nearly 20 years before being put to sleep.
Most dogs live for between eight and 15 years.
Authentic records of dogs living for more than 20 years are rare and generally involve smaller breeds.
Find us on Instagram at BBCNewsbeat and follow us on Snapchat, search for bbc_newsbeat |
Neurocytoma Presenting with Intraparenchymal Cerebral Hemorrhage Neurocytomas are uncommon intracranial neoplasms that have only recently been characterized pathologically. Neurocytomas are histologically benign neoplasms that are often quite large when diagnosed, and previous reports have commonly described presentation with mass effect or cerebrospinal fluid outflow obstruction. We describe the first case of neurocytoma presenting with intraparenchymal cerebral hemorrhage. |
A Plant-Derived Wound Therapeutic for Cost-Effective Treatment of Post-Surgical Scalp Wounds with Exposed Bone Background: To evaluate efficacy and cost-effectiveness of a plant-derived wound dressing (ONE), a mixture of hypericum oil (Hypericum perforatum L.) and neem oil (Azadirachta indica A. Juss.), in scalp wounds with exposed bone. Patients and Methods: All patients with scalp wounds with exposed bone, following the excision of skin tumors, and treated with ONE in 2011 were included. Time of healing, wound size, area of exposed bone, ease of handling, pain, and complications were evaluated. Costs of dressings and nursing time were compared with those cited in literature for other treatment modalities. Results: Fifteen consecutive patients with a mean age of 76.87 ± 10.3 years (59-90 years) were analyzed. The mean wound size was 10.9 ± 6.84 cm2 (0.4-22.6 cm2) with 4.8 ± 5.9 cm2 (0.3-20.7 cm2) of exposed bone. The time of complete healing by secondary intention was 8.1 weeks. Rapid formation of granulation tissue was observed which after 4 weeks covered the entire exposed bone surface in 11 of 15 cases (73%). Dressing change was simple with no pain reported; no infections or other complications occurred. Using ONE for a mean healing time of 56.7 days resulted in mean costs of EUR 423.73, which is substantially lower than those published for fascia lata, negative pressure therapy, or collagen matrix followed by skin grafting (EUR 1,612.82, EUR 4,411.80 and EUR 1,503.72, respectively). Conclusion: This retrospective, non-controlled analysis supports ONE as a simple-to-use and safe treatment option for scalp wounds with exposed bone. Treatment costs compare favorably to those published for other treatment modalities. |
The bus-size near-Earth asteroid 2012 JU (orbit delineated in blue) came within about 119,000 miles of Earth on May 13, 2012, but never posed a danger of hitting us.
An asteroid the size of a school bus gave Earth a close shave yesterday (May 13), passing well inside the orbit of the moon, but our planet was never in any danger of being hit.
The near-Earth asteroid 2012 JU, which is thought to be about 40 feet (12 meters) wide, came within 119,000 miles (191,500 kilometers) or so of our planet before zooming off into deep space, according to NASA's Near-Earth Object Program at the Jet Propulsion Laboratory in Pasadena, Calif. The moon orbits Earth at an average distance of 238,000 miles (382,900 km).
The asteroid-tracking office put together an animation of asteroid 2012 JU's orbit to illustrate its Sunday flyby. The space rock completes one lap around the sun every 3.2 years, according to a Near-Earth Object Program database.
Such close asteroid flybys aren't terribly uncommon.
On April 1, for example, the 150-foot-wide (46-m) asteroid 2012 EG5 came within about 143,000 miles (230,000 km) of our planet during its closest approach. And on March 26, two smaller space rocks buzzed Earth. One passed within 96,000 miles (154,000 km), while the other missed us by just 36,000 miles (58,000 km).
But those asteroids are all lightweights compared to 2005 YU55, a city-block-size space rock that came within 202,000 miles (325,000 km) of Earth last November. At 1,300 feet (400 m) wide, 2005 YU55 was the biggest asteroid to come so close to our planet since 1976, researchers said.
Researchers have discovered about 8,900 near-Earth asteroids, though they think many more are out there. Scientists with the Near-Earth Object Program and other teams of astronomers regularly monitor the sky for large, potentially dangerous asteroids to determine if they pose an impact threat to Earth.
Our planet occasionally gets pummeled by gigantic space rocks, sometimes with devastating consequences. For instance, the dinosaurs are thought to have been wiped out by a 6-mile-wide (10-km) asteroid that slammed into Earth 65 million years ago. |
from spotipy import Spotify
from spotipy.oauth2 import SpotifyOAuth
import os
class MusicModule(Spotify):
def __init__(self, local = "TV da sala de estar", volume = 60) -> None:
os.environ['SPOTIPY_CLIENT_ID'] = "ac075cdbffc643c4a56f92d41f905e48"
os.environ['SPOTIPY_CLIENT_SECRET'] = "<KEY>"
os.environ['SPOTIPY_REDIRECT_URI'] = "http://127.0.0.1:5000"
self.client = Spotify(client_credentials_manager=SpotifyOAuth(scope="user-read-playback-state,user-modify-playback-state"))
self.local = local
self.localid = None
self.volume = volume
self.devices = self.client.devices()
if self.local not in [i['name'] for i in self.devices['devices']]:
self.local = self.devices()['devices'][0]['name']
self.localid = self.devices()['devices'][0]['id']
# Actions
def searchTrack(self, searchStr):
result = self.client.search(searchStr)
result['name'] = result['tracks']['items'][0]['name']
result['artist'] = result['tracks']['items'][0]['artists'][0]['name']
return result['tracks']['items'][0]['uri']
def playTrack(self, uri = None, local = None, name = None):
if local != None:
self.local = local
self.client.transfer_playback(device_id=self.localid, force_play=True)
self.client.start_playback(uris=[uri])
return
return print("Error")
# Volume Control
def raiseVolume(self, by = 10):
self.volume += by
def lowerVolume(self, by = 10):
self.volume -= by |
package de.codecamp.vaadin.flowdui.factories.visandint;
import java.util.Set;
import org.jsoup.nodes.Element;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
import de.codecamp.vaadin.flowdui.ComponentFactory;
import de.codecamp.vaadin.flowdui.TemplateParserContext;
public class IconFactory
implements
ComponentFactory
{
@Override
public Component createComponent(Element element, TemplateParserContext context,
Set<String> consumedAttributes)
{
switch (element.tagName())
{
case "iron-icon":
case "vaadin-icon":
String attrIcon = context.readStringAttribute(element, "icon", null, consumedAttributes);
Icon icon;
if (attrIcon != null && attrIcon.contains(":"))
{
String[] attrIconTokens = attrIcon.split(":", 2);
icon = new Icon(attrIconTokens[0], attrIconTokens[1]);
}
else
{
if (attrIcon == null)
{
icon = new Icon();
}
else
{
try
{
icon = VaadinIcon.valueOf(attrIcon).create();
}
catch (IllegalArgumentException ex)
{
icon = new Icon(attrIcon);
}
}
}
context.readStringAttribute(element, TemplateParserContext.CUSTOM_ATTR_PREFIX + "color",
icon::setColor, consumedAttributes);
context.readStringAttribute(element, TemplateParserContext.CUSTOM_ATTR_PREFIX + "size",
icon::setSize, consumedAttributes);
return icon;
}
return null;
}
}
|
<reponame>kofes/satellite_image_analyze
#include "../inc/Satellite.hpp"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <list>
#include <string>
#include <cstring>
#include <vector>
using namespace satellite;
const std::string help =
"Usage\n\n"
" <exec_file> [option] <input> <output>\n\n"
"Options\n\n"
" -g, --gist - Generate gist of <input>.pro to <output>.var\n"
" -o, --one-var - Calculate sample mean of one distribution of <input>.var to <output>.var\n"
" -d, --double-var - Calculate sample mean of two distribution of <input>.var to <output>.var\n"
" -h, --help - Print 'help'\n\n"
"<input> <- 'test', if not setted.\n"
"<output> <- 'test', if not setted.\n";
void generate_gist ( std::ifstream& input, std::ofstream& output ) {
passport::Proection pass;
Image img;
short max = SHRT_MIN, min = SHRT_MAX;
unsigned long *buff;
if (!input.is_open()) {
std::cerr << "Error: file isn't exist" << std::endl;
return;
}
input >> pass;
if (pass.DATA_TYPE[0] != (uint8_t)(passport::DATA_TYPE::PROECTION)) {
std::cerr << "Error: file isn't proection" << std::endl;
return;
}
img.read(pass.getCountPixelsInLine(), pass.getCountLines(), input);
for (unsigned short i = 0; i < img.height(); ++i)
for (unsigned short j = 0; j < img.width(); ++j) {
max = (max > img[i][j]) ? max : img[i][j];
min = (img[i][j] <= 0 || min < img[i][j]) ? min : img[i][j];
}
if (max <= 0) {
output << 1 << 1 << '\n' << 0 << std::endl;
return;
}
buff = new unsigned long[max-min+1];
for (unsigned short i = 0; i < img.height(); ++i)
for (unsigned short j = 0; j < img.width(); ++j)
if (img[i][j] > 0) buff[img[i][j]-min]++;
output << min << ' ' << max << ' ' << 1 << std::endl;
for (unsigned short i = 0; i < max-min+1; ++i)
output << buff[i] << std::endl;
}
void clac_one_dist( std::ifstream& input, std::ofstream& output ) {
std::vector< std::pair<double, unsigned long> > buff;
short min, max;
double dh;
unsigned long sum = 0;
if (!input.is_open()) {
std::cerr << "Error: file isn't exist" << std::endl;
return;
}
input >> min >> max >> dh;
for (unsigned short i = 0; i < max-min+1; ++i) {
unsigned long tmp;
input >> tmp;
buff.push_back(std::make_pair((i+min+1)*dh, tmp));
sum += tmp;
}
output << math::first_row_moment(buff) << ' ' << math::central_moment(buff) << std::endl;
}
void clac_two_dist( std::ifstream& input, std::ofstream& output ) {
std::vector< std::pair<double, unsigned long> > buff;
short min, max;
std::pair<size_t, double> res;
double dh, minus_m, plus_m,
minus_d, plus_d;
if (!input.is_open()) {
std::cerr << "Error: file isn't exist" << std::endl;
return;
}
input >> min >> max >> dh;
for (unsigned short i = 0; i < max-min+1; ++i) {
unsigned long tmp;
input >> tmp;
buff.push_back(std::make_pair((i+min+1)*dh, tmp));
}
res = satellite::math::threshold_Otsu(buff);
std::cout << "Threshold: " << res.first << std::endl;
std::cout << "SC: " << res.second << std::endl;
minus_m = satellite::math::first_row_moment(buff, 1, 0, res.first);
minus_d = satellite::math::central_moment(buff, 2, 0, res.first);
plus_m = satellite::math::first_row_moment(buff, 1, res.first, buff.size());
plus_d = satellite::math::central_moment(buff, 2, res.first, buff.size());
output << minus_m << ' ' << minus_d << std::endl;
output << plus_m << ' ' << plus_d << std::endl;
}
int main (int argc, char* argv[]) {
if (argc < 2 || !std::strcmp(argv[1], "--help") || !std::strcmp(argv[1], "-h")) {
std::cout << help << std::endl;
return 0;
}
std::ifstream input;
std::ofstream output;
//GIST
if (!std::strcmp(argv[1], "--gist") || !std::strcmp(argv[1], "-g")) {
if (argc > 2) input.open(std::string(argv[2]) + ".pro");
else input.open("test.pro");
if (argc > 3) output.open(std::string(argv[3]) + ".var");
else output.open("test.var");
generate_gist(input, output);
return 0;
}
//ONE-VAR
if (!std::strcmp(argv[1], "--one-var") || !std::strcmp(argv[1], "-o")) {
if (argc > 2) input.open(std::string(argv[2]) + ".var");
else input.open("test.var");
if (argc > 3) output.open(std::string(argv[3]) + ".var");
else output.open("test.var");
clac_one_dist(input, output);
return 0;
}
//TWO-VAR
if (!std::strcmp(argv[1], "--double-var") || !std::strcmp(argv[1], "-d")) {
if (argc > 2) input.open(std::string(argv[2]) + ".var");
else input.open("test.var");
if (argc > 3) output.open(std::string(argv[3]) + ".var");
else output.open("test.var");
clac_two_dist(input, output);
return 0;
}
std::cout << "unknown token: " << argv[1] << std::endl;
std::cout << help << std::endl;
return 0;
}
|
/**
* Captures a snapshot of the current policy execution state. This method never blocks, instead assuming that a policy is
* currently starting its execution and returns an appropriate state.
* @return The current state of in-flight policy executions
*/
public EnrichPolicyExecutionState captureExecutionState() {
if (currentStateLock.writeLock().tryLock()) {
try {
long revision = policyRunCounter.get();
long currentPolicyExecutions = policyLocks.mappingCount();
return new EnrichPolicyExecutionState(currentPolicyExecutions > 0L, revision);
} finally {
currentStateLock.writeLock().unlock();
}
}
return new EnrichPolicyExecutionState(true, policyRunCounter.get());
} |
<reponame>plumbum/go-samples
package main
import (
"net/url"
"log"
"github.com/kr/pretty"
"strings"
)
func main() {
params := &url.Values{}
params.Set("first", "1")
params.Set("second", `"is quoted string"`)
params.Set("third", "Last number")
params.Set("fourth", "4") // WARNING! All keys sorted by alphabet
params.Add("array", "1")
params.Add("array", "2")
params.Add("array", "3")
myUrl := url.URL{
Scheme: "https",
User: url.UserPassword("user", "password"),
Host: "second.host.tld",
Path: "/uri/path/part",
RawQuery: params.Encode(),
Fragment: "fragment",
}
pretty.Println("Create URI string:", myUrl.String())
parsedUrl, err := url.Parse(myUrl.String()+"_tail")
if err != nil {
log.Fatalln(err)
}
pretty.Println(strings.Repeat("=", 80))
pretty.Println("Parse URI string")
pretty.Println(parsedUrl)
pretty.Println(parsedUrl.Query())
}
|
<reponame>kztrp/aiir-server<gh_stars>0
from django.apps import AppConfig
class AiirConfig(AppConfig):
name = 'aiir'
|
Representative Bureaucracy and Gender Consciousness: A Framework for Investigating Gendered Policy Outputs The theory of representative bureaucracy has received much sustained attention over the past forty plus years, resulting in a wealth of scholarship that investigates the representativeness of public bureaucracies, the kinds of outputs they produce, and the link between these two things. We know that women are more likely to be found in low-level positions, that they are disproportionately located in certain agency types, and that factors such as political culture, region, private sector employment levels, and female political representation often affect their levels of passive representation in government bureaucracies (i.e. Bowling, Kelleher, Jones and Wright 2006; Selden 1997; Sigelman 1976; Saltzstein 1983, 1986). However, we know surprisingly less about the ways in which women behave in public bureaucracies, how they potentially socialize their colleagues to be gender sensitive, how they perceive and advocate for their clientele and constituents, and how they produce outputs that are either gender responsive or gender neutral. This paper attempts to fill this gap by fleshing out the role of gender consciousness, explaining how this concept promises a much richer understanding of the role gender plays in American public bureaucracies, and offering suggestions for empirically examining the various steps of the representative bureaucracy puzzle. I argue here that the study of gender and representative bureaucracy is extraordinarily complex and in need of more nuanced methodological approaches. I contend that part of the explanation here is that scholars have underestimated and misconstrued the role gender plays in creating policy outputs that benefit female clientele and constituents. Drawing heavily from the work of Sally Coleman Selden and her concept of the minority representative role, I encourage scholars to develop a similar measure to assess gender consciousness among male and female administrators. Because gender consciousness holds promise as an explanatory variable for understanding the linkage between descriptive and substantive representation, and because we know so very little about the mechanisms that connect attitudes to behavior, it is especially important to consider this linkage when investigating administrative behavior. Doing so will shed light on important questions in the representative bureaucracy literature. |
import json
import re
from moto.core.responses import BaseResponse
from .exceptions import InvalidParameterValueException
from .models import dax_backends
class DAXResponse(BaseResponse):
@property
def dax_backend(self):
return dax_backends[self.region]
def create_cluster(self):
params = json.loads(self.body)
cluster_name = params.get("ClusterName")
node_type = params.get("NodeType")
description = params.get("Description")
replication_factor = params.get("ReplicationFactor")
iam_role_arn = params.get("IamRoleArn")
tags = params.get("Tags", [])
sse_specification = params.get("SSESpecification", {})
self._validate_arn(iam_role_arn)
self._validate_name(cluster_name)
cluster = self.dax_backend.create_cluster(
cluster_name=cluster_name,
node_type=node_type,
description=description,
replication_factor=replication_factor,
iam_role_arn=iam_role_arn,
tags=tags,
sse_specification=sse_specification,
)
return json.dumps(dict(Cluster=cluster.to_json()))
def delete_cluster(self):
cluster_name = json.loads(self.body).get("ClusterName")
cluster = self.dax_backend.delete_cluster(cluster_name)
return json.dumps(dict(Cluster=cluster.to_json()))
def describe_clusters(self):
params = json.loads(self.body)
cluster_names = params.get("ClusterNames", [])
max_results = params.get("MaxResults")
next_token = params.get("NextToken")
for name in cluster_names:
self._validate_name(name)
clusters, next_token = self.dax_backend.describe_clusters(
cluster_names=cluster_names, max_results=max_results, next_token=next_token
)
return json.dumps(
{"Clusters": [c.to_json() for c in clusters], "NextToken": next_token}
)
def _validate_arn(self, arn):
if not arn.startswith("arn:"):
raise InvalidParameterValueException(f"ARNs must start with 'arn:': {arn}")
sections = arn.split(":")
if len(sections) < 3:
raise InvalidParameterValueException(
f"Second colon partition not found: {arn}"
)
if len(sections) < 4:
raise InvalidParameterValueException(f"Third colon vendor not found: {arn}")
if len(sections) < 5:
raise InvalidParameterValueException(
f"Fourth colon (region/namespace delimiter) not found: {arn}"
)
if len(sections) < 6:
raise InvalidParameterValueException(
f"Fifth colon (namespace/relative-id delimiter) not found: {arn}"
)
def _validate_name(self, name):
msg = "Cluster ID specified is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens."
if not re.match("^[a-z][a-z0-9-]+[a-z0-9]$", name):
raise InvalidParameterValueException(msg)
if "--" in name:
raise InvalidParameterValueException(msg)
def list_tags(self):
params = json.loads(self.body)
resource_name = params.get("ResourceName")
tags = self.dax_backend.list_tags(resource_name=resource_name)
return json.dumps(tags)
def increase_replication_factor(self):
params = json.loads(self.body)
cluster_name = params.get("ClusterName")
new_replication_factor = params.get("NewReplicationFactor")
cluster = self.dax_backend.increase_replication_factor(
cluster_name=cluster_name, new_replication_factor=new_replication_factor
)
return json.dumps({"Cluster": cluster.to_json()})
def decrease_replication_factor(self):
params = json.loads(self.body)
cluster_name = params.get("ClusterName")
new_replication_factor = params.get("NewReplicationFactor")
node_ids_to_remove = params.get("NodeIdsToRemove")
cluster = self.dax_backend.decrease_replication_factor(
cluster_name=cluster_name,
new_replication_factor=new_replication_factor,
node_ids_to_remove=node_ids_to_remove,
)
return json.dumps({"Cluster": cluster.to_json()})
|
Rheological properties of blood in patients with chronic liver disease. We analyzed rheologic parameters, including erythrocyte rigidity (ER), whole blood and plasma viscosity, erythrocyte and platelet count, hemoglobin, hematocrit, mean corpuscular volume (MCV), fibrinogen, erythrocyte sedimentation rate (ESR), cholesterol, triglyceride, high-density lipoprotein (HDL), low-density lipoprotein (LDL), very-low density lipoprotein (VLDL), and gamma globulin levels in 18 patients with chronic liver disease and 20 healthy volunteers. Fifteen patients had cryptogenic cirrhosis while 3 had chronic active hepatitis. ER and MCV was significantly higher in the patient group than the control group while whole blood and plasma viscosities were significantly lower. There were significant correlations between ER and blood and plasma viscosity, ER and MCV, plasma and blood viscosity, HDL and plasma viscosity and a negative correlation between ER and ESR. Our results demonstrate that erythrocytes become more rigid in chronic liver disease. We suggest that erythrocytes with increased rigidity can impair hepatic microvascular circulation and thus contribute to liver dysfunction. |
def as_a0_rat(g, T):
as_f = as_fact()
T = T.to(u.MeV)
as_a0 = as_f*g**(-1/3)/T
return as_a0 |
PHILADELPHIA (AP) — D’Angelo Russell rang up a scoring burst that helped Brooklyn dial up an upset and filled Philly’s home court with a barrage of boos.
Poised for a postseason breakthrough, Russell flourished and hit a string of jumpers in the third that never let the Sixers seriously chip away at the lead. LeVert’s third 3 in the fourth made it a 16-point game and there was no looking back — at least not for Russell as he raised his arms in celebration as he headed down the tunnel into Brooklyn’s locker room.
Nets: C Jarrett Allen was whistled for fouls on Philadelphia’s first two possessions.
76ers: Butler and Tobias Harris are both eligible for free agency and could stick around after they were acquired in mid-season trades. Team owner Josh Harris said both players could be re-signed. “It’s really hard to get good players of their caliber. Now that we’ve attracted them into our system, we’re going to work really hard at keeping them around for a while,” Harris said.
Harris said Brown was a “great coach” but offered no assurance he would return to the bench for another season if the Sixers failed to make a deep run in the playoffs. |
// FindPuzzles analyzes a chess game represented by a list of UCI moves
// and returns tactical puzzles from the game (or an empty slice
// if there are no interesting tactical puzzles).
func FindPuzzles(ctx context.Context, moves []string) []Puzzle {
log.Printf("Analyzing a game with %d moves\n", len(moves))
enginePath := viper.GetString("EnginePath")
cmd := exec.Command(enginePath)
log.Printf("Starting %s\n", enginePath)
engineOut, err := cmd.StdoutPipe()
if err != nil {
log.Fatalf("Failed to pipe engine output: %v\n", err)
}
engineIn, err := cmd.StdinPipe()
if err != nil {
log.Fatalf("Failed to pipe engine input: %v\n", err)
}
err = cmd.Start()
if err != nil {
log.Fatalf("Failed to start engine: %v\n", err)
}
state := analysisState{puzzles: make([]Puzzle, 0), positionsAnalyzed: make(chan int, 10)}
done := make(chan int)
go processOutput(engineOut, &state, done)
initializeEngineSession(engineIn)
for i := 6; i < len(moves); i++ {
select {
case <-ctx.Done():
break
default:
analyzeMove(engineIn, moves[:i], moves[i], &state)
}
}
engineIn.Write([]byte("quit"))
engineIn.Close()
cmd.Wait()
<-done
return state.puzzles
} |
Topological kinematic constraints: dislocations and the glide principle Topological defects play an important role in the physics of elastic media and liquid crystals. Defect kinematics in elastic media is restrained by rigid constraints of purely topological origin. An example is the glide motion of dislocations, a topic which has been extensively studied through the years by metallurgists. To date, most theoretical investigations of this phenomenon were heuristic or numerical. Here, we outline a mathematical derivation of this universal effect and report on new generalizations. Our formalism makes it possible to address the full non-linear theory of relevance at short distance where violations of the standard glide constraint become possible. Our new derivation enables us to systematically predict and estimate corrections to the standard, linear order, glide motion. Our analysis is very broad and pertains to both classical and quantum media. To fully capture the generality of this effect, we arrive at a mathematical definition of the glide constraint which has a universal status. When fused with the mass continuity equations, this then dictates glide motion within linear elasticity and leads to new non-linear corrections in a general elastic medium. It further enables us to study the kinematics of dislocations in arbitrary spatial dimensions (or space-time dimensions in the quantum arena). As an example, we analyze the restricted climb associated with edge dislocations in 3±1D. Quite generally, the climb constraint is equivalent to the condition that dislocations do not communicate with compressional stresses at long distances. |
It’s good to know that the FBI, ICE, and MPAA are working diligently to prevent the movie industry from losing billions of dollars of revenue to piracy through entirely practical, pragmatic means, isn’t it? I’ll tell you, I have long wanted to bootleg a movie, but every time I come close to hitting the record button on my double-deck DVD copier, I encounter this message and stop dead in my tracks:
This has been very helpful in stopping me from pirating DVDs and Blu-Rays, because it instantly makes me think about the consequences, which otherwise I’d be totally oblivious to. But sometimes I still think about it. At night, I dream of how sweet the forbidden fruit of piracy would taste. So, it was with great relief that I discovered that the FBI, ICE, and MPAA announced today that they will be adding two new, non-skippable warnings before every home video feature presentation. Take a look at these beauties after the jump!
Because two badges are more threatening than one.
In all seriousness, I am highly sympathetic to the copyright industry’s (vastly overblown but still legitimate) claim that piracy has cost the U.S. economy 360,000 jobs, $16 billion in lost wages, and $2.6 billion in lost taxes. I believe that piracy is downright wrong, hurting both the artist and the investor who makes the artist’s work possible.
But give me a break. All that doubling the amount of annoying messages one can’t fast-forward through on a Blu-Ray is going to do, ironically, is make people more inclined to buy pirated copies without said messages!
This doesn’t come anywhere near SOPA in terms of moronic approaches to stop piracy, but it won’t do a lick of good. It’s time for the film industry and the MPAA to start embracing more inventive solutions to the problem. Apple was able to make an impressive dent in domestic music theft with iTunes — it’s time for Hollywood to do the same.
Make sure to stock up on the old versions of your favorite Blu-Rays and DVDs while they still only have one message. You can support Critic Speak in doing so by following this link to Amazon.com.
Source: Digital Trends |
package tsmt
import (
"encoding/xml"
"github.com/fgrid/iso20022"
)
type Document01000103 struct {
XMLName xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:tsmt.010.001.03 Document"`
Message *BaselineMatchReportV03 `xml:"BaselnMtchRpt"`
}
func (d *Document01000103) AddMessage() *BaselineMatchReportV03 {
d.Message = new(BaselineMatchReportV03)
return d.Message
}
// Scope
// The BaselineMatchReport message is sent by the matching application to the parties involved in the establishment of a transaction.
// The message is used to inform about either the successful establishment of a transaction (baseline) or the mis-matches found between two baseline initiation messages.
// Usage
// The BaselineMatchReport message can be sent by the matching application to
// - the parties involved in the establishment of a transaction in the push-through mode, that is the senders of InitialBaselineSubmission and BaselineReSubmission messages including the instruction push-through. In the outlined scenario the message is used to inform either about the successful establishment of a transaction in the matching application or about mis-matches found between two baseline initiation messages,or
// - the party establishing a transaction in the lodge mode, that is the sender of an InitialBaselineSubmission message including the instruction lodge. In the outlined scenario the message is used to inform about the successful establishment of a transaction in the matching application.
type BaselineMatchReportV03 struct {
// Identifies the report.
ReportIdentification *iso20022.MessageIdentification1 `xml:"RptId"`
// Unique identification assigned by the matching application to the transaction.
// This identification is to be used in any communication between the parties.
TransactionIdentification *iso20022.SimpleIdentificationInformation `xml:"TxId"`
// Unique identification assigned by the matching application to the baseline when it is established.
EstablishedBaselineIdentification *iso20022.DocumentIdentification3 `xml:"EstblishdBaselnId,omitempty"`
// Identifies the status of the transaction by means of a code.
TransactionStatus *iso20022.TransactionStatus4 `xml:"TxSts"`
// Reference to the transaction for each financial institution which is a party to the transaction.
UserTransactionReference []*iso20022.DocumentIdentification5 `xml:"UsrTxRef,omitempty"`
// Party that buys goods or services, or a financial instrument.
Buyer *iso20022.PartyIdentification26 `xml:"Buyr"`
// Party that sells goods or services, or a financial instrument.
Seller *iso20022.PartyIdentification26 `xml:"Sellr"`
// The financial institution of the buyer, uniquely identified by its BIC.
BuyerBank *iso20022.BICIdentification1 `xml:"BuyrBk"`
// The financial institution of the seller, uniquely identified by its BIC.
SellerBank *iso20022.BICIdentification1 `xml:"SellrBk"`
// Specifies the number of matching trials for a baseline.
BaselineEstablishmentTrials *iso20022.Limit1 `xml:"BaselnEstblishmtTrils"`
// Identifies the two baselines compared in this report.
ComparedDocumentReference []*iso20022.DocumentIdentification4 `xml:"CmpardDocRef"`
// Description of the differences between the two proposed baselines
Report *iso20022.MisMatchReport3 `xml:"Rpt"`
// Information on the next processing step required.
RequestForAction *iso20022.PendingActivity2 `xml:"ReqForActn,omitempty"`
}
func (b *BaselineMatchReportV03) AddReportIdentification() *iso20022.MessageIdentification1 {
b.ReportIdentification = new(iso20022.MessageIdentification1)
return b.ReportIdentification
}
func (b *BaselineMatchReportV03) AddTransactionIdentification() *iso20022.SimpleIdentificationInformation {
b.TransactionIdentification = new(iso20022.SimpleIdentificationInformation)
return b.TransactionIdentification
}
func (b *BaselineMatchReportV03) AddEstablishedBaselineIdentification() *iso20022.DocumentIdentification3 {
b.EstablishedBaselineIdentification = new(iso20022.DocumentIdentification3)
return b.EstablishedBaselineIdentification
}
func (b *BaselineMatchReportV03) AddTransactionStatus() *iso20022.TransactionStatus4 {
b.TransactionStatus = new(iso20022.TransactionStatus4)
return b.TransactionStatus
}
func (b *BaselineMatchReportV03) AddUserTransactionReference() *iso20022.DocumentIdentification5 {
newValue := new (iso20022.DocumentIdentification5)
b.UserTransactionReference = append(b.UserTransactionReference, newValue)
return newValue
}
func (b *BaselineMatchReportV03) AddBuyer() *iso20022.PartyIdentification26 {
b.Buyer = new(iso20022.PartyIdentification26)
return b.Buyer
}
func (b *BaselineMatchReportV03) AddSeller() *iso20022.PartyIdentification26 {
b.Seller = new(iso20022.PartyIdentification26)
return b.Seller
}
func (b *BaselineMatchReportV03) AddBuyerBank() *iso20022.BICIdentification1 {
b.BuyerBank = new(iso20022.BICIdentification1)
return b.BuyerBank
}
func (b *BaselineMatchReportV03) AddSellerBank() *iso20022.BICIdentification1 {
b.SellerBank = new(iso20022.BICIdentification1)
return b.SellerBank
}
func (b *BaselineMatchReportV03) AddBaselineEstablishmentTrials() *iso20022.Limit1 {
b.BaselineEstablishmentTrials = new(iso20022.Limit1)
return b.BaselineEstablishmentTrials
}
func (b *BaselineMatchReportV03) AddComparedDocumentReference() *iso20022.DocumentIdentification4 {
newValue := new (iso20022.DocumentIdentification4)
b.ComparedDocumentReference = append(b.ComparedDocumentReference, newValue)
return newValue
}
func (b *BaselineMatchReportV03) AddReport() *iso20022.MisMatchReport3 {
b.Report = new(iso20022.MisMatchReport3)
return b.Report
}
func (b *BaselineMatchReportV03) AddRequestForAction() *iso20022.PendingActivity2 {
b.RequestForAction = new(iso20022.PendingActivity2)
return b.RequestForAction
}
|
def removes(self, symbols, invert=False):
for index in xrange(len(self.nonTerminalsByIndex) - 1, -1, -1):
nonterm = self.nonTerminalsByIndex[index]
if (nonterm in symbols and not invert) or \
(invert and nonterm not in symbols):
del self.nonTerminalsByIndex[index]
del self.nonTerminalsByName[nonterm.name]
del self.productions[nonterm.name]
for nonterm in self.nonTerminalsByName:
prodlist = self.productions[nonterm]
for index, prod in enumeratex(prodlist, reverse=True, indexed=True):
for su in prod.rhs:
if (su.symbol in symbols and not invert) or \
(invert and su.symbol not in symbols):
del prodlist[index]
break |
A FORMER Toogoolawah Uniting Church minister will not spend a day behind bars for the "brazen" sexual abuse of a 12-year-old boy in the 1960s.
In his late 20s and early 30s minister Barry Dangerfield forced a young boy to engage in sexual acts when taking him for driving lessons.
The Brisbane District Court heard the offences occurred in "broad daylight" on country roads.
On Thursday Dangerfield, 83, pleaded guilty to five counts of indecent treatment of a boy under 14 and five counts of indecent acts between males.
The court heard Dangerfield had officiated at the victim's wedding years after the offending because there were no other ministers available.
In a statement to the court the victim said he did not report the crimes at the time because of Dangerfield's position in the church.
The court heard the victim felt "very alone and vulnerable" and considered suicide. He still suffers flashbacks and has psychological scars from the abuse.
Defence lawyer Julian Noud said Dangerfield was a "spiritual man" who had lived a "blameless life".
Mr Noud said in the more than 50 years since the offences Dangerfield had never committed another crime.
Dangerfield served as the Roma Uniting Church superintendent after he left Toogoolawah.
Chief Judge Kerry O'Brien agreed that since offending Dangerfield had rehabilitated himself and lived an otherwise "exemplary life".
Dangerfield was sentenced to three years jail, wholly suspended.
Judge O'Brien said if the offending had occurred today, or as recently as 20 years ago, Dangerfield would have spent time behind bars.
The victim's family now lives on the Sunshine Coast. Maroochydore Child Protection Investigation Unit's Phil Hurst said he wanted to thank the victim for coming forward.
Detective Senior Sergeant Hurst said police could not secure convictions without the courage of victims.
"The victims are the most powerful people because they know who the offenders are," he said.
"We would like to thank them for the bravery in coming forward.
"It's the only way we can protect the community from those people."
If you need help phone Lifeline on 13 11 14. |
<reponame>dasariramacharan/RamasTaskBoard<filename>app/app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
//Components used for routing
//import { TaskBoardComponent } from './task/task-board.component';
import { TasksComponent} from './task/tasks.component';
import { TaskComponent } from './task/task.component';
import { TaskListComponent } from './task/task-list.component';
import { LoginComponent } from './login/login.component';
//Lazy Loading
// import { MilestoneListComponent } from './milestone/milestone-list.component';
// import { MilestoneComponent } from './milestone/milestone.component';
// import { MilestoneResolver } from './milestone/shared/milestone-resolver.service';
//moved to separate feature module and doing eagerly loading
//import { ProjectBoardComponent } from './project/project-board.component';
// import { ProjectComponent } from './project/project.component';
// import { ProjectListComponent } from './project/project-list.component';
import { PageNotFoundComponent } from './page-not-found.component';
import { CanActivateAuthGaurd } from './can-activate-service';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/projects', },//note: you can still redirect to projects even though its part of child routes
{ path: 'login' , component : LoginComponent},
//{ path: 'projects', component: ProjectListComponent },
// { path: 'projects/:id', component: ProjectComponent }, -- not used
{ path: 'tasks',
component: TasksComponent,
canActivate : [CanActivateAuthGaurd],
canActivateChild : [CanActivateAuthGaurd],
children:[
{ path: '', component: TaskListComponent },
{ path: ':id', component: TaskComponent },
]
},
//Lazy Loaded Feature
{ path: 'milestones', loadChildren: 'app/milestone/milestones.module#MilestonesModule' },
// { path: 'milestones', component: MilestoneListComponent },
// { path: 'milestones/:id',
// component: MilestoneComponent ,
// resolve :{ milestone: MilestoneResolver}
// },
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule{ }
export const routableComponents = [
// ProjectListComponent,
// ProjectComponent,
TasksComponent,
TaskListComponent,
TaskComponent,
//Lazy loaded - feature milestone
// MilestoneListComponent,
// MilestoneComponent,
PageNotFoundComponent,
LoginComponent
];
|
// Returns true iff boolean input is changing from an un-triggered state to a triggered state
// Returns false if boolean input doesn't exist
bool InputManager::IsBooleanInputTriggering(std::string const & name) const
{
auto iter = boolean_inputs_.find(name);
if(iter != boolean_inputs_.end())
return iter->second.triggered_ && !iter->second.triggered_last_update_;
return false;
} |
""""Desafio 85. Faça um programa em que um usuário digite sete valores numéricos e cadastre-os em uma lista única que
mantenha separados os pares e os ímpares. No final mostre os pares e os ímpares em ordem crescente. """
numeros = [[], []]
valor = 0
for num in range(1, 8):
valor = int(input(f"Digite o {num}o número da lista: "))
if valor % 2 == 0:
numeros[0].append(valor)
else:
numeros[1].append(valor)
print()
print(f"O conjunto dos números foi: {numeros}")
numeros[0].sort()
print(f"O conjunto dos pares foi: {numeros[0]}")
numeros[1].sort()
print(f"O conjunto dos impares foi: {numeros[1]}")
|
Reorganizing Care and Work: Process and Productivity Gains A Montreal-area hospital implemented organizational changes to improve the psychosocial environment for patients and health care workers and enhance organizational efficiency. This article describes a participatory approach to improving the organization of care and work, an approach focused on productivity gains in an organization. Productivity gains were analyzed in 13 units of the Department of Nursing, which had introduced a series of organizational changes. Changes introduced in care and work organization led to productivity gains in all units overseen by the Nursing Directorate. A reorganization of care and work based on the psychosocial work environment and staff participation can have positive outcomes, both for employees and for the wider organization. |
British police said two people, a 66-year-old man and a 33-year-old woman, had been found unconscious on a bench in a shopping centre on Sunday in the southern English city of Salisbury after exposure to the unknown substance.
Police have reported the serious incident and told that both the patients are in intensive care.
London: Former Russian spy Sergei Skripal, who was convicted by Russia of betraying agents to British intelligence, was critically ill on Monday after exposure to an unidentified substance in Britain, two sources close to the investigation told Reuters.
Both are critically ill in intensive care. Police declared a major incident.
Skripal, once a colonel in Russia's GRU military intelligence service, was convicted in Russia of treason in 2006 but exchanged as part of a Cold War-style spy swap in 2010 on the tarmac of Vienna airport. Skripal is 66 years old.
British police did not release the names of those who were being treated but two sources close to the investigation told Reuters that the critically ill man was Skripal. It was unclear what the substance was, they said.
"This has not been declared as a counter-terrorism incident and we would urge people not to speculate," Wiltshire police's Temporary Assistant Chief Constable Craig Holden told reporters.
"However, I must emphasise that we retain an open mind, and that we continue to review this position."
Relations between Britain and Russia have been strained since the murder of ex-KGB agent Alexander Litvinenko with radioactive polonium-210 in London in 2006, a killing which a British inquiry said was probably approved by President Vladimir Putin.
The Kremlin has repeatedly denied any involvement in the killing.
Litvinenko, 43, an outspoken critic of Putin who fled Russia for Britain six years to the day before he was poisoned, died after drinking green tea laced with the rare and very potent radioactive isotope at London's Millennium Hotel.
It took some time for British doctors to discern the cause of Litvinenko's illness.
Skripal, who was arrested in 2004 by Russia's Federal Security Service (FSB) on suspicion of betraying dozens of Russian agents to British intelligence, was sentenced to 13 years in prison in 2006.
But he was later pardoned in 2010 by then-President Dmitry Medvedev as part of a spy swap to bring 10 Russian agents held in the United States back to Moscow.
The swap, one of the biggest since the Cold War ended in 1991, took place on the tarmac of Vienna airport where a Russian and a US jet parked side by side before the agents were exchanged.
One of the Russian spies exchanged for Skripal was Anna Chapman, who was greeted as a hero by the Kremlin. She was one of 10 spies who tried to blend in to American society in an apparent bid to get close to power brokers and learn secrets. They were arrested by the FBI in 2010.
Putin, himself a former KGB officer, sang patriotic songs with the returned spies.
Since finding refuge in Britain, Skripal kept largely out of the spotlight until he was seen making strange movements on a bench in Wiltshire on Sunday.
"On the bench there was a couple, an older guy and a younger girl. She was sort of leant-in on him, it looked like she'd passed out maybe. He was doing some strange hand movements, looking up to the sky," witness Freya Church told the BBC. |
An Indian adventurer declared himself the ruler of an unclaimed strip of land in North Africa between Sudan and Egypt, and is encouraging people to apply for citizenship, according to media reports.
Suyash Dixit, a computer engineer from Indore, dodged terrorists in the barren desert and undertook a perilous six-hour drive to declare himself king of the 'Kingdom of Dixit' in Bir Tawil, an 800-square mile tract, that according to a Fox News report, was declared by Jeopardy champion Ken Jennings as being "there for the taking if anyone was up to the challenge".
The stretch of land is believed to be the largest area unclaimed by any recognised nation, the report said. Bir Tawil's existence is the result of a border drawn up by the British in 1899.
"The route that I took is under Egyptian military (it is an international border) and is an area of terrorists so military have 'shoot at sight' orders," The Telegraph quoted Dixit as saying.
"But, if your bucket list ideas are not scary enough then they are not worth trying! You need permissions to even enter the route to this place. We [had] three conditions; no photos of military areas, be back in a single day and no valuables," Dixit said, according to the report.
He even designed a flag — red and yellow with a crest in the centre — for the newly-formed country, International Business Times reported. He named himself King Suyash I, decided the capital city should be Suyashpur, and proclaimed the national animal to be a lizard, as it was the only species he saw around, the report added.
Dixit's declaration through a Facebook post starts as follows: I, Suyash Dixit, first of my name and the protector of the realm, declare myself as the king of "Kingdom of Dixit". I call myself, King Suyash First from today. I declare this unclaimed land of Bir Tawil as my country from now to the eternity of time. I pledge to continue to work for the prosperity of my people of the country and this motherland.
Following is the rest of the post formally announcing the kingdom:
Firstpost is now on WhatsApp. For the latest analysis, commentary and news updates, sign up for our WhatsApp services. Just go to Firstpost.com/Whatsapp and hit the Subscribe button. |
<reponame>IsFairy/optolith-client
import { fromDefault } from "../../../../Data/Record"
export interface Die {
"@@name": "Die"
sides: number
amount: number
}
// eslint-disable-next-line @typescript-eslint/no-redeclare
export const Die =
fromDefault ("Die")
<Die> ({
amount: 0,
sides: 0,
})
|
An EPIDbased method to determine mechanical deformations in a linear accelerator PURPOSE Medical linear accelerators (linac) are delivering increasingly complex treatments using modern techniques in radiation therapy. Complete and precise mechanical QA of the linac is therefore necessary to ensure that there is no unexpected deviation from the gantry's planned course. However, state-of-the-art EPID-based mechanical QA procedures often neglect some degrees of freedom (DOF) like the in-plane rotations of the gantry and imager or the source movements inside the gantry head. Therefore, the purpose of this work is to characterize a 14 DOF method for the mechanical QA of linacs. This method seeks to measure every mechanical deformation in a linac, including source movements, in addition to relevant clinical parameters like mechanical and radiation isocenters. METHODS A widely available commercial phantom and a custom-made accessory inserted in the linac's interface mount are imaged using the electronic portal imaging device (EPID) at multiple gantry angles. Then, simulated images are generated using the nominal geometry of the linac and digitized models of the phantoms. The nominal geometry used to generate these images can be modified using 14 DOF (3 rigid rotations and 3 translations for the imager and the gantry, and 2 in-plane translations of the source) and any change will modify the simulated image. The set of mechanical deformations that minimizes the differences between the simulated and measured image is found using a genetic algorithm coupled with a gradient-descent optimizer. Phantom mispositioning and gantry angular offset were subsequently calculated and extracted from the results. Simulations of the performances of the method for different levels of noise in the phantom models were performed to calculate the absolute uncertainty of the measured mechanical deformations. The measured source positions and the center of collimation were used to define the beam central axis and calculate the radiation isocenter position and radius. RESULTS After the simultaneous optimization of the 14 DOF, the average distance between the center of the measured and simulated ball bearings on the imager was 0.086 mm. Over the course of a full counter-clockwise gantry rotation, all mechanical deformations were measured, showing sub-millimeter translations and rotations smaller than 1° along every axis. The average absolute uncertainty of the 14 DOF (1 SD) was 0.15 mm or degree. Phantom positioning errors were determined with more than 0.1 mm precision. Errors introduced in the experimental setup like phantom positioning errors, source movements or gantry angular offsets were all successfully detected by our QA method. The mechanical deformations measured are shown to be reproducible over the course of a few weeks and are not sensitive to the experimental setup. CONCLUSION This work presents of new method for an accurate mechanical QA of the linacs. It features a 14 DOF model of the mechanical deformations that is both more complete and precise than other available methods. It has demonstrated sub-millimeter accuracy through simulation and experimentation. Introduced errors were successfully detected with high precision. |
def _is_requires_satisfied(arg, argv):
SYS_PLATFORM_TAGS = ['win32', 'linux', 'darwin', 'cywgin']
OS_NAME_TAGS = ['posix', 'nt', 'java']
if arg.startswith('-'):
flag = arg in argv
elif arg.startswith('module:'):
parts = arg.split(':')
if len(parts) != 2:
raise ValueError('xdoctest REQUIRES directive has too many parts')
modname = parts[1]
flag = _module_exists(modname)
elif arg.lower() in SYS_PLATFORM_TAGS:
flag = sys.platform.startswith(arg.lower())
elif arg.lower() in OS_NAME_TAGS:
flag = os.name.startswith(arg.lower())
else:
msg = utils.codeblock(
'''
Argument to REQUIRES directive must be either
(1) a PLATFORM or OS tag (e.g. win32, darwin, linux),
(2) a command line flag prefixed with '--', or
(3) a module prefixed with 'module:'.
Got arg={!r}
''').replace('\n', ' ').strip().format(arg)
raise ValueError(msg)
return flag |
<filename>app/src/main/java/org/chromium/chrome/browser/download/ui/FilterAdapter.java
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.download.ui;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.download.ui.DownloadManagerUi.DownloadUiObserver;
import org.chromium.chrome.browser.widget.TintedDrawable;
/** An adapter that allows selecting an item from a list displayed in the drawer. */
class FilterAdapter extends BaseAdapter
implements AdapterView.OnItemClickListener, DownloadUiObserver {
private int mSelectedBackgroundColor;
private DownloadManagerUi mManagerUi;
private int mSelectedIndex;
@Override
public int getCount() {
return DownloadFilter.getFilterCount();
}
@Override
public Object getItem(int position) {
return DownloadFilter.FILTER_LIST[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Resources resources = mManagerUi.getActivity().getResources();
TextView labelView = null;
if (convertView instanceof TextView) {
labelView = (TextView) convertView;
} else {
labelView = (TextView) LayoutInflater.from(mManagerUi.getActivity()).inflate(
R.layout.download_manager_ui_drawer_filter, null);
}
int iconId = DownloadFilter.getDrawableForFilter(position);
labelView.setText(DownloadFilter.getStringIdForFilter(position));
Drawable iconDrawable = null;
if (position == mSelectedIndex) {
// Highlight the selected item by changing the foreground and background colors.
labelView.setBackgroundColor(mSelectedBackgroundColor);
iconDrawable = TintedDrawable.constructTintedDrawable(
resources, iconId, R.color.light_active_color);
labelView.setTextColor(
ApiCompatibilityUtils.getColor(resources, R.color.light_active_color));
} else {
// Draw the item normally.
labelView.setBackground(null);
iconDrawable = TintedDrawable.constructTintedDrawable(
resources, iconId, R.color.descriptive_text_color);
labelView.setTextColor(
ApiCompatibilityUtils.getColor(resources, R.color.default_text_color));
}
labelView.setCompoundDrawablesWithIntrinsicBounds(iconDrawable, null, null, null);
return labelView;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mManagerUi.onFilterChanged(position);
}
public void initialize(DownloadManagerUi manager) {
mManagerUi = manager;
mSelectedBackgroundColor = ApiCompatibilityUtils
.getColor(mManagerUi.getActivity().getResources(), R.color.default_primary_color);
}
@Override
public void onFilterChanged(int filter) {
if (mSelectedIndex == filter) return;
mSelectedIndex = filter;
notifyDataSetChanged();
mManagerUi.closeDrawer();
}
@Override
public void onManagerDestroyed() {
mManagerUi = null;
}
}
|
/*
* Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "imx335_cmos.h"
#include "imx335_cmos_ex.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "mpi_isp.h"
#include "mpi_ae.h"
#include "mpi_awb.h"
#define IMX335_ID 335
#define IMX335_HIG_4BITS(x) (((x) & 0xF0000) >> 16)
#define IMX335_MID_8BITS(x) (((x) & 0x0FF00) >> 8)
#define IMX335_LOW_8BITS(x) ((x) & 0x000ff)
#ifndef MAX
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#endif
#ifndef MIN
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#endif
ISP_SNS_STATE_S *g_pastImx335[ISP_MAX_PIPE_NUM] = {HI_NULL};
#define IMX335_SENSOR_SET_CTX(dev, pstCtx) ((g_pastImx335[dev]) = (pstCtx))
#define IMX335_SENSOR_RESET_CTX(dev) (g_pastImx335[dev] = HI_NULL)
static HI_U32 g_au32InitExposure[ISP_MAX_PIPE_NUM] = {0};
static HI_U32 g_au32LinesPer500ms[ISP_MAX_PIPE_NUM] = {0};
static HI_U16 g_au16InitWBGain[ISP_MAX_PIPE_NUM][ISP_RGB_CHN_NUM] = {{0}};
static HI_U16 g_au16SampleRgain[ISP_MAX_PIPE_NUM] = {0};
static HI_U16 g_au16SampleBgain[ISP_MAX_PIPE_NUM] = {0};
static HI_BOOL g_quick_start_en[ISP_MAX_PIPE_NUM] = {HI_FALSE};
static HI_U32 g_u32Imx335AGain[ISP_MAX_PIPE_NUM] = {[0 ...(ISP_MAX_PIPE_NUM - 1)] = 1024}; /* again 1024 */
static HI_U32 g_u32Imx335DGain[ISP_MAX_PIPE_NUM] = {[0 ...(ISP_MAX_PIPE_NUM - 1)] = 1024}; /* dgain 1024 */
static HI_BOOL g_abAERouteExValid[ISP_MAX_PIPE_NUM] = {0};
static ISP_AE_ROUTE_S g_astInitAERoute[ISP_MAX_PIPE_NUM] = {{0}};
static ISP_AE_ROUTE_EX_S g_astInitAERouteEx[ISP_MAX_PIPE_NUM] = {{0}};
static ISP_AE_ROUTE_S g_astInitAERouteSF[ISP_MAX_PIPE_NUM] = {{0}};
static ISP_AE_ROUTE_EX_S g_astInitAERouteSFEx[ISP_MAX_PIPE_NUM] = {{0}};
ISP_SNS_COMMBUS_U g_aunImx335BusInfo[ISP_MAX_PIPE_NUM] = {
[0] = { .s8I2cDev = 0},
[1 ... ISP_MAX_PIPE_NUM - 1] = { .s8I2cDev = -1}
};
static ISP_FSWDR_MODE_E g_genFSWDRMode[ISP_MAX_PIPE_NUM] = {
[0 ... ISP_MAX_PIPE_NUM - 1] = ISP_FSWDR_NORMAL_MODE
};
typedef struct hiIMX335_STATE_S {
HI_U32 u32BRL;
HI_U32 u32RHS1_MAX;
HI_U32 u32deltaRHS1;
} IMX335_STATE_S;
IMX335_STATE_S g_astimx335State[ISP_MAX_PIPE_NUM] = {{0}};
static HI_U32 g_au32MaxTimeGetCnt[ISP_MAX_PIPE_NUM] = {0};
static HI_U32 g_au32STimeFps[ISP_MAX_PIPE_NUM] = {[0 ...(ISP_MAX_PIPE_NUM - 1)] = 30}; /* time fps 30 */
static HI_U32 g_au32LGain[ISP_MAX_PIPE_NUM] = {0};
ISP_SNS_COMMBUS_U *imx335_get_bus_Info(VI_PIPE vi_pipe)
{
return &g_aunImx335BusInfo[vi_pipe];
}
ISP_SNS_STATE_S *imx335_get_ctx(VI_PIPE vi_pipe)
{
return g_pastImx335[vi_pipe];
}
const IMX335_VIDEO_MODE_TBL_S g_astImx335ModeTbl[IMX335_MODE_BUTT] = {
{IMX335_VMAX_5M_30FPS_12BIT_LINEAR, IMX335_FULL_LINES_MAX, 30, 2.0,
2592, 1944, 0, WDR_MODE_NONE, "IMX335_5M_30FPS_12BIT_LINEAR_MODE"},
{IMX335_VMAX_5M_30FPS_10BIT_WDR, IMX335_FULL_LINES_MAX, 30, 15.0,
2592, 1944, 0, WDR_MODE_2To1_LINE, "IMX335_5M_30FPS_10BIT_WDR_MODE"},
};
#define IMX335_VMAX_ADDR_L 0x3030
#define IMX335_VMAX_ADDR_M 0x3031
#define IMX335_VMAX_ADDR_H 0x3032
#define IMX335_Y_OUT_SIZE_LOW 0x3056
#define IMX335_Y_OUT_SIZE_HIGH 0x3057
#define IMX335_SHR0_LOW 0x3058
#define IMX335_SHR0_MIDDLE 0x3059
#define IMX335_SHR0_HIGH 0x305A
#define IMX335_SHR1_LOW 0x305C
#define IMX335_SHR1_MIDDLE 0x305D
#define IMX335_SHR1_HIGH 0x305E
#define IMX335_RHS1_LOW 0x3068
#define IMX335_RHS1_MIDDLE 0x3069
#define IMX335_RHS1_HIGH 0x306A
#define IMX335_GAIN_LONG_LOW 0x30E8
#define IMX335_GAIN_LONG_HIGH 0x30E9
#define IMX335_GAIN_SHORT_LOW 0x30EA
#define IMX335_GAIN_SHORT_HIGH 0x30EB
#define IMX335_RES_IS_5M_12BIT_LINEAR(w, h) (((w) == 2592) && ((h) == 1944))
#define IMX335_RES_IS_5M_10BIT_WDR(w, h) (((w) == 2592) && ((h) == 1944))
#define IMX335_RES_IS_4M_12BIT_LINEAR(w, h) (((w) == 2592) && ((h) == 1520))
#define IMX335_RES_IS_4M_10BIT_WDR(w, h) (((w)== 2592) && ((h)== 1520))
#define IMX335_RES_IS_4M_10BIT_WDR_EX(w, h) (((w) == 2560) && ((h) == 1440))
/* sensor gain */
#define IMX335_AGAIN_MIN 1024
#define IMX335_AGAIN_MAX 32381 /* the max again is 32381 */
#define IMX335_DGAIN_MIN 1024
#define IMX335_DGAIN_MAX 128914
#define IMX335_AD_GAIN_TBL_RANGE 241
#define IMX335_AGAIN_TBL_RANGE 100
#define IMX335_DGAIN_TBL_RANGE 140
#define IMX335_WDR_BRL 3968 /* 1984 x2 */
#define IMX335_ERR_MODE_PRINT(pstSensorImageMode, pstSnsState) \
do { \
SNS_ERR_TRACE("Not support! Width:%d, Height:%d, Fps:%f, WDRMode:%d\n", \
(pstSensorImageMode)->u16Width, \
(pstSensorImageMode)->u16Height, \
(pstSensorImageMode)->f32Fps, \
(pstSnsState)->enWDRMode); \
} while (0)
static HI_VOID cmos_get_ae_comm_default(VI_PIPE vi_pipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft,
ISP_SNS_STATE_S *pstSnsState)
{
HI_U32 u32Lines;
HI_FLOAT f32MaxFps;
CMOS_CHECK_POINTER_VOID(pstAeSnsDft);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
u32Lines = g_astImx335ModeTbl[pstSnsState->u8ImgMode].u32VertiLines;
f32MaxFps = g_astImx335ModeTbl[pstSnsState->u8ImgMode].f32MaxFps;
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
pstSnsState->u32FLStd = u32Lines * 2; /* x2 */
pstAeSnsDft->u32LinesPer500ms = u32Lines * f32MaxFps; /* Because one FSC is equal to 2 VMAX */
g_astimx335State[vi_pipe].u32RHS1_MAX = g_astimx335State[vi_pipe].u32BRL * 2; /* x2 */
g_astimx335State[vi_pipe].u32deltaRHS1 =
(u32Lines * 2) - (g_astimx335State[vi_pipe].u32BRL * 2) - 2; /* Lines * 2 - BRL * 2 - 2 */
} else {
pstSnsState->u32FLStd = u32Lines;
pstAeSnsDft->u32LinesPer500ms = u32Lines * f32MaxFps / 2; /* div 2 */
}
pstAeSnsDft->stIntTimeAccu.f32Offset = 0;
pstAeSnsDft->u32MaxIntTime = pstSnsState->u32FLStd - 8; /* sub 8 */
pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd;
pstAeSnsDft->u32FlickerFreq = 0;
pstAeSnsDft->stIntTimeAccu.enAccuType = AE_ACCURACY_LINEAR;
pstAeSnsDft->stIntTimeAccu.f32Accuracy = 1;
pstAeSnsDft->stAgainAccu.enAccuType = AE_ACCURACY_TABLE;
pstAeSnsDft->stAgainAccu.f32Accuracy = 1;
pstAeSnsDft->stDgainAccu.enAccuType = AE_ACCURACY_TABLE;
pstAeSnsDft->stDgainAccu.f32Accuracy = 1;
pstAeSnsDft->u32ISPDgainShift = 8; /* accuracy: 8 */
pstAeSnsDft->u32MinISPDgainTarget = 1 << pstAeSnsDft->u32ISPDgainShift;
pstAeSnsDft->u32MaxISPDgainTarget = 2 << pstAeSnsDft->u32ISPDgainShift; /* max 2 */
(hi_void)memcpy_s(&pstAeSnsDft->stPirisAttr, sizeof(ISP_PIRIS_ATTR_S),
&g_gstPirisAttr, sizeof(ISP_PIRIS_ATTR_S));
pstAeSnsDft->enMaxIrisFNO = ISP_IRIS_F_NO_1_4;
pstAeSnsDft->enMinIrisFNO = ISP_IRIS_F_NO_5_6;
pstAeSnsDft->bAERouteExValid = HI_FALSE;
pstAeSnsDft->stAERouteAttr.u32TotalNum = 0;
pstAeSnsDft->stAERouteAttrEx.u32TotalNum = 0;
pstAeSnsDft->u32InitExposure = g_au32InitExposure[vi_pipe] ? g_au32InitExposure[vi_pipe] : 130000; /* 130000 */
pstAeSnsDft->u32LinesPer500ms = g_au32LinesPer500ms[vi_pipe] ? g_au32LinesPer500ms[vi_pipe] :
pstAeSnsDft->u32LinesPer500ms;
pstAeSnsDft->stQuickStart.bQuickStartEn = g_quick_start_en[vi_pipe];
pstAeSnsDft->stQuickStart.u8BlackFrameNum = 0;
return;
}
static HI_VOID cmos_get_ae_linear_default(VI_PIPE vi_pipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft,
ISP_SNS_STATE_S *pstSnsState)
{
hi_unused(pstSnsState);
pstAeSnsDft->au8HistThresh[0] = 0xd;
pstAeSnsDft->au8HistThresh[1] = 0x28;
pstAeSnsDft->au8HistThresh[2] = 0x60; /* index 2 */
pstAeSnsDft->au8HistThresh[3] = 0x80; /* index 3 */
pstAeSnsDft->u8AeCompensation = 0x38;
pstAeSnsDft->enAeExpMode = AE_EXP_HIGHLIGHT_PRIOR;
pstAeSnsDft->u32MinIntTime = 2; /* min 2 */
pstAeSnsDft->u32MaxIntTimeTarget = 65535; /* max 65535 */
pstAeSnsDft->u32MinIntTimeTarget = pstAeSnsDft->u32MinIntTime;
pstAeSnsDft->stIntTimeAccu.f32Offset = -0.198; /* offset: -0.198 */
pstAeSnsDft->u32MaxAgain = IMX335_AGAIN_MAX;
pstAeSnsDft->u32MinAgain = IMX335_AGAIN_MIN;
pstAeSnsDft->u32MaxAgainTarget = pstAeSnsDft->u32MaxAgain;
pstAeSnsDft->u32MinAgainTarget = pstAeSnsDft->u32MinAgain;
pstAeSnsDft->u32MaxDgain = IMX335_DGAIN_MAX; /* if Dgain enable,please set ispdgain bigger than 1 */
pstAeSnsDft->u32MinDgain = IMX335_DGAIN_MIN;
pstAeSnsDft->u32MaxDgainTarget = pstAeSnsDft->u32MaxDgain;
pstAeSnsDft->u32MinDgainTarget = pstAeSnsDft->u32MinDgain;
pstAeSnsDft->bAERouteExValid = g_abAERouteExValid[vi_pipe];
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteAttr, sizeof(ISP_AE_ROUTE_S),
&g_astInitAERoute[vi_pipe], sizeof(ISP_AE_ROUTE_S));
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteAttrEx, sizeof(ISP_AE_ROUTE_EX_S),
&g_astInitAERouteEx[vi_pipe], sizeof(ISP_AE_ROUTE_EX_S));
return;
}
static HI_VOID cmos_get_ae_2to1_line_wdr_default(VI_PIPE vi_pipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft,
ISP_SNS_STATE_S *pstSnsState)
{
HI_U32 u32Fll = IMX335_VMAX_5M_30FPS_10BIT_WDR;
HI_U32 u32MaxFps = 30;
pstSnsState->u32FLStd = u32Fll * u32MaxFps / SNS_DIV_0_TO_1(g_au32STimeFps[vi_pipe]);
if ((pstSnsState->u32FLStd % 4) != 0) { /* 4 */
pstSnsState->u32FLStd = pstSnsState->u32FLStd - (pstSnsState->u32FLStd % 4) + 4; /* 4 */
}
pstSnsState->u32FLStd = pstSnsState->u32FLStd * 2; /* 2 */
pstAeSnsDft->u32MaxIntTime = pstSnsState->u32FLStd - 8; /* sub 8 */
pstAeSnsDft->au8HistThresh[0] = 0xc;
pstAeSnsDft->au8HistThresh[1] = 0x18;
pstAeSnsDft->au8HistThresh[2] = 0x60; /* index 2 */
pstAeSnsDft->au8HistThresh[3] = 0x80; /* index 3 */
pstAeSnsDft->u8AeCompensation = 0x38;
pstAeSnsDft->stIntTimeAccu.f32Accuracy = 4; /* Accuracy 4 */
pstAeSnsDft->u32MinIntTime = 4; /* min 4 */
pstAeSnsDft->u32MaxIntTimeTarget = 65535; /* max 65535 */
pstAeSnsDft->u32MinIntTimeTarget = pstAeSnsDft->u32MinIntTime;
pstAeSnsDft->stIntTimeAccu.f32Offset = -0.396; /* offset: -0.396 */
pstAeSnsDft->u32MaxIntTimeStep = 1000; /* MaxIntTimeStep 1000 */
pstAeSnsDft->bMaxTimeStepEnable = HI_TRUE;
pstAeSnsDft->u32MaxDecTimeStep[0] = 1000; /* 1000 lines */
pstAeSnsDft->u32MaxIncTimeStep[0] = 1000; /* 1000 lines */
pstAeSnsDft->u32LFMinExposure = 15000000; /* LFMinExposure 15000000 */
pstAeSnsDft->enAeExpMode = AE_EXP_LOWLIGHT_PRIOR;
pstAeSnsDft->u32MaxAgain = IMX335_AGAIN_MAX;
pstAeSnsDft->u32MinAgain = IMX335_AGAIN_MIN;
pstAeSnsDft->u32MaxAgainTarget = pstAeSnsDft->u32MaxAgain;
pstAeSnsDft->u32MinAgainTarget = pstAeSnsDft->u32MinAgain;
pstAeSnsDft->u32MaxDgain = IMX335_DGAIN_MAX; /* if Dgain enable,please set ispdgain bigger than 1 */
pstAeSnsDft->u32MinDgain = IMX335_DGAIN_MIN;
pstAeSnsDft->u32MaxDgainTarget = 1024; /* min 1024 */
pstAeSnsDft->u32MinDgainTarget = 1024; /* min 1024 */
pstAeSnsDft->u32MaxISPDgainTarget = 16 << pstAeSnsDft->u32ISPDgainShift; /* max 16 << shift */
pstAeSnsDft->bDiffGainSupport = HI_TRUE;
pstAeSnsDft->u32ExpRatioMin = 0x80; /* The exposure ration from 2x to convergence */
if (g_genFSWDRMode[vi_pipe] != ISP_FSWDR_LONG_FRAME_MODE) {
pstAeSnsDft->u16ManRatioEnable = HI_TRUE;
pstAeSnsDft->au32Ratio[0] = 0x400;
pstAeSnsDft->au32Ratio[1] = 0x40;
pstAeSnsDft->au32Ratio[2] = 0x40; /* array index 2 */
}
pstAeSnsDft->bAERouteExValid = g_abAERouteExValid[vi_pipe];
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteAttr, sizeof(ISP_AE_ROUTE_S),
&g_astInitAERoute[vi_pipe], sizeof(ISP_AE_ROUTE_S));
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteAttrEx, sizeof(ISP_AE_ROUTE_EX_S),
&g_astInitAERouteEx[vi_pipe], sizeof(ISP_AE_ROUTE_EX_S));
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteSFAttr, sizeof(ISP_AE_ROUTE_S),
&g_astInitAERouteSF[vi_pipe], sizeof(ISP_AE_ROUTE_S));
(hi_void)memcpy_s(&pstAeSnsDft->stAERouteSFAttrEx, sizeof(ISP_AE_ROUTE_EX_S),
&g_astInitAERouteSFEx[vi_pipe], sizeof(ISP_AE_ROUTE_EX_S));
return;
}
static HI_S32 cmos_get_ae_default(VI_PIPE vi_pipe, AE_SENSOR_DEFAULT_S *pstAeSnsDft)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER(pstAeSnsDft);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
cmos_get_ae_comm_default(vi_pipe, pstAeSnsDft, pstSnsState);
switch (pstSnsState->enWDRMode) {
default:
case WDR_MODE_NONE:
cmos_get_ae_linear_default(vi_pipe, pstAeSnsDft, pstSnsState);
break;
case WDR_MODE_2To1_LINE:
/* FS WDR mode */
cmos_get_ae_2to1_line_wdr_default(vi_pipe, pstAeSnsDft, pstSnsState);
break;
}
return HI_SUCCESS;
}
static HI_VOID cmos_config_vmax(ISP_SNS_STATE_S *pstSnsState, HI_U32 u32VMAX)
{
if (pstSnsState->enWDRMode == WDR_MODE_NONE) {
pstSnsState->astRegsInfo[0].astI2cData[5].u32Data = IMX335_LOW_8BITS(u32VMAX); /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[6].u32Data = IMX335_MID_8BITS(u32VMAX); /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[7].u32Data = IMX335_HIG_4BITS(u32VMAX); /* index 7 */
} else {
pstSnsState->astRegsInfo[0].astI2cData[8].u32Data = IMX335_LOW_8BITS(u32VMAX); /* index 8 */
pstSnsState->astRegsInfo[0].astI2cData[9].u32Data = IMX335_MID_8BITS(u32VMAX); /* index 9 */
pstSnsState->astRegsInfo[0].astI2cData[10].u32Data = IMX335_HIG_4BITS(u32VMAX); /* index 10 */
}
return;
}
/* the function of sensor set fps */
static HI_VOID cmos_fps_set(VI_PIPE vi_pipe, HI_FLOAT f32Fps, AE_SENSOR_DEFAULT_S *pstAeSnsDft)
{
HI_U32 u32Lines, u32LinesMax, u32VMAX;
HI_FLOAT f32MaxFps, f32MinFps;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER_VOID(pstAeSnsDft);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
u32Lines = g_astImx335ModeTbl[pstSnsState->u8ImgMode].u32VertiLines;
u32LinesMax = g_astImx335ModeTbl[pstSnsState->u8ImgMode].u32MaxVertiLines;
f32MaxFps = g_astImx335ModeTbl[pstSnsState->u8ImgMode].f32MaxFps;
f32MinFps = g_astImx335ModeTbl[pstSnsState->u8ImgMode].f32MinFps;
if ((f32Fps > f32MaxFps) || (f32Fps < f32MinFps)) {
SNS_ERR_TRACE("Not support Fps: %f\n", f32Fps);
return;
}
u32VMAX = u32Lines * f32MaxFps / SNS_DIV_0_TO_1_FLOAT(f32Fps);
u32VMAX = (u32VMAX > u32LinesMax) ? u32LinesMax : u32VMAX;
if (pstSnsState->u8ImgMode == IMX335_5M_30FPS_10BIT_WDR_MODE) {
u32VMAX = ((u32VMAX % 4) != 0) ? (u32VMAX - (u32VMAX % 4) + 4) : u32VMAX; /* u32VMAX % 4 */
}
cmos_config_vmax(pstSnsState, u32VMAX);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
pstSnsState->u32FLStd = u32VMAX * 2; /* x2 */
pstAeSnsDft->u32LinesPer500ms = u32Lines * f32MaxFps; /* Because one FSC is equal to 2 VMAX */
g_astimx335State[vi_pipe].u32RHS1_MAX = g_astimx335State[vi_pipe].u32BRL * 2; /* x2 */
g_astimx335State[vi_pipe].u32deltaRHS1 =
(u32VMAX * 2) - (g_astimx335State[vi_pipe].u32BRL * 2) - 2; /* VMAX * 2 - BRL * 2 - 2 */
pstAeSnsDft->u32MaxDecTimeStep[0] =
pstSnsState->u32FLStd - (IMX335_WDR_BRL * 2) - 2 - 10; /* 2 10 limit sensor step */
pstAeSnsDft->u32MaxIncTimeStep[0] =
pstSnsState->u32FLStd - (IMX335_WDR_BRL * 2) - 2 - 10; /* 2 10 limit sensor step */
} else {
pstSnsState->u32FLStd = u32VMAX;
pstAeSnsDft->u32LinesPer500ms = u32Lines * f32MaxFps / 2; /* div 2 */
}
pstAeSnsDft->f32Fps = f32Fps;
g_au32STimeFps[vi_pipe] = (HI_U32)f32Fps;
pstAeSnsDft->u32FullLinesStd = pstSnsState->u32FLStd;
pstAeSnsDft->u32MaxIntTime = pstSnsState->u32FLStd - 8; /* sub 8 */
pstSnsState->au32FL[0] = pstSnsState->u32FLStd;
pstAeSnsDft->u32FullLines = pstSnsState->au32FL[0];
pstAeSnsDft->u32HmaxTimes =
(1000000000) / (pstSnsState->u32FLStd * SNS_DIV_0_TO_1_FLOAT(f32Fps)); /* 1000000000ns */
return;
}
static HI_VOID cmos_slow_framerate_set(VI_PIPE vi_pipe, HI_U32 u32FullLines,
AE_SENSOR_DEFAULT_S *pstAeSnsDft)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER_VOID(pstAeSnsDft);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
u32FullLines = (u32FullLines > (2 * 2 * IMX335_VMAX_5M_30FPS_10BIT_WDR)) ? /* x2 x2 */
(2 * 2 * IMX335_VMAX_5M_30FPS_10BIT_WDR) : u32FullLines; /* x2 x2 */
if ((u32FullLines % 4) != 0) { /* %4 */
u32FullLines = u32FullLines + (4 - (u32FullLines % 4)); /* FL + 4 - FL % 4 */
}
pstSnsState->au32FL[0] = u32FullLines;
g_astimx335State[vi_pipe].u32RHS1_MAX = g_astimx335State[vi_pipe].u32BRL * 2; /* x2 */
g_astimx335State[vi_pipe].u32deltaRHS1 =
u32FullLines - (g_astimx335State[vi_pipe].u32BRL * 2) - 2; /* FL - BRL * 2 - 2 */
} else {
u32FullLines = (u32FullLines > IMX335_FULL_LINES_MAX) ? IMX335_FULL_LINES_MAX : u32FullLines;
pstSnsState->au32FL[0] = u32FullLines;
}
if (pstSnsState->enWDRMode == WDR_MODE_NONE) {
pstSnsState->astRegsInfo[0].astI2cData[5].u32Data = IMX335_LOW_8BITS(pstSnsState->au32FL[0]); /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[6].u32Data = IMX335_MID_8BITS(pstSnsState->au32FL[0]); /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[7].u32Data = IMX335_HIG_4BITS(pstSnsState->au32FL[0]); /* index 7 */
} else {
pstSnsState->astRegsInfo[0].astI2cData[8].u32Data = IMX335_LOW_8BITS(pstSnsState->au32FL[0] >> 1); /* index 8 */
pstSnsState->astRegsInfo[0].astI2cData[9].u32Data = IMX335_MID_8BITS(pstSnsState->au32FL[0] >> 1); /* index 9 */
pstSnsState->astRegsInfo[0].astI2cData[10].u32Data = /* index 10 */
IMX335_HIG_4BITS(pstSnsState->au32FL[0] >> 1);
}
pstAeSnsDft->u32FullLines = pstSnsState->au32FL[0];
pstAeSnsDft->u32MaxIntTime = pstSnsState->au32FL[0] - 8; /* MaxIntTime: Flstd - 8 */
return;
}
/* Again and Dgain use the same table, Step is 0.3db */
static HI_U32 g_ad_gain_table[IMX335_AD_GAIN_TBL_RANGE] = {
1024, 1059, 1097, 1135, 1175, 1217, 1259,
1304, 1349, 1397, 1446, 1497, 1549, 1604, /* 3.9dB */
1660, 1719, 1779, 1842, 1906, 1973, 2043,
2114, 2189, 2266, 2345, 2428, 2513, 2601, /* 8.1dB */
2693, 2788, 2886, 2987, 3092, 3201, 3313,
3430, 3550, 3675, 3804, 3938, 4076, 4219, /* 12.3dB */
4368, 4521, 4680, 4845, 5015, 5191, 5374,
5562, 5758, 5960, 6170, 6387, 6611, 6843, /* 16.5dB */
7084, 7333, 7591, 7857, 8133, 8419, 8715,
9021, 9338, 9667, 10006, 10358, 10722, 11099, /* 20.7dB */
11489, 11893, 12311, 12743, 13191, 13655, 14135,
14631, 15146, 15678, 16229, 16799, 17390, 18001, /* 24.9dB */
18633, 19288, 19966, 20668, 21394, 22146, 22924,
23730, 24564, 25427, 26320, 27245, 28203, 29194, /* 29.1dB */
30220, 31282, 32381, 33519, 34697, 35917, 37179,
38485, 39838, 41238, 42687, 44187, 45740, 47347, /* 33.3dB */
49011, 50734, 52517, 54362, 56273, 58250, 60297,
62416, 64610, 66880, 69230, 71663, 74182, 76789, /* 37.5dB */
79487, 82281, 85172, 88165, 91264, 94471, 97791,
101228, 104785, 108468, 112279, 116225, 120310, 124537, /* 41.7dB */
128914, 133444, 138134, 142988, 148013, 153215, 158599,
164172, 169942, 175914, 182096, 188495, 195119, 201976, /* 45.9dB */
209074, 216421, 224027, 231900, 240049, 248485, 257217,
266256, 275613, 285299, 295325, 305703, 316446, 327567, /* 50.1dB */
339078, 350994, 363329, 376097, 389314, 402995, 417157,
431817, 446992, 462700, 478961, 495793, 513216, 531251, /* 54.3dB */
549921, 569246, 589250, 609958, 631393, 653582, 676550,
700326, 724936, 750412, 776783, 804081, 832338, 861589, /* 58.5dB */
891867, 923209, 955652, 989236, 1024000, 1059985, 1097236,
1135795, 1175709, 1217026, 1259795, 1304067, 1349895, 1397333, /* 62.7dB */
1446438, 1497269, 1549887, 1604353, 1660734, 1719095, 1779508,
1842044, 1906777, 1973786, 2043149, 2114949, 2189273, 2266209, /* 66.9dB */
2345848, 2428287, 2513622, 2601956, 2693394, 2788046, 2886024,
2987445, 3092431, 3201105, 3313599, 3430046, 3550585, 3675361, /* 71.1dB */
3804521, 3938220, 4076617 /* 72.0dB */
};
static HI_VOID cmos_inttime_update_linear(VI_PIPE vi_pipe, HI_U32 u32IntTime)
{
HI_U32 u32Value;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
u32Value = pstSnsState->au32FL[0] - u32IntTime;
u32Value = MIN(u32Value, IMX335_FULL_LINES_MAX);
u32Value = MIN(MAX(u32Value, 9), (pstSnsState->au32FL[0] - 1)); /* max 9 */
pstSnsState->astRegsInfo[0].astI2cData[0].u32Data = IMX335_LOW_8BITS(u32Value); /* SHR0 */
pstSnsState->astRegsInfo[0].astI2cData[1].u32Data = IMX335_MID_8BITS(u32Value);
pstSnsState->astRegsInfo[0].astI2cData[2].u32Data = IMX335_HIG_4BITS(u32Value); /* index 2 */
return;
}
static HI_VOID cmos_inttime_update_reg_2to1_line(HI_U32 u32SHR1, HI_U32 u32RHS1, HI_U32 u32SHR0,
ISP_SNS_STATE_S *pstSnsState)
{
pstSnsState->au32WDRIntTime[0] = u32RHS1 - u32SHR1;
pstSnsState->au32WDRIntTime[1] = pstSnsState->au32FL[0] - u32SHR0;
pstSnsState->astRegsInfo[0].astI2cData[0].u32Data = IMX335_LOW_8BITS(u32SHR0);
pstSnsState->astRegsInfo[0].astI2cData[1].u32Data = IMX335_MID_8BITS(u32SHR0);
pstSnsState->astRegsInfo[0].astI2cData[2].u32Data = IMX335_HIG_4BITS(u32SHR0); /* index 2 */
pstSnsState->astRegsInfo[0].astI2cData[5].u32Data = IMX335_LOW_8BITS(u32SHR1); /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[6].u32Data = IMX335_MID_8BITS(u32SHR1); /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[7].u32Data = IMX335_HIG_4BITS(u32SHR1); /* index 7 */
pstSnsState->astRegsInfo[0].astI2cData[11].u32Data = IMX335_LOW_8BITS(u32RHS1); /* index 11 */
pstSnsState->astRegsInfo[0].astI2cData[12].u32Data = IMX335_MID_8BITS(u32RHS1); /* index 12 */
pstSnsState->astRegsInfo[0].astI2cData[13].u32Data = IMX335_HIG_4BITS(u32RHS1); /* index 13 */
return;
}
static HI_VOID cmos_inttime_update_2to1_line_long(VI_PIPE vi_pipe, HI_U32 u32IntTime)
{
HI_U32 u32RHS1, u32SHR0, u32SHR1, u32RHS1Limit, u32ShortExpMod4, u32ShortExpMod8, u32LimitTmp;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
static HI_U32 u32PreRHS1 = 0;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
pstSnsState->au32WDRIntTime[1] = u32IntTime;
u32SHR0 = pstSnsState->au32FL[1] - u32IntTime + (u32IntTime % 4); /* IntTime % 4 */
u32ShortExpMod4 = pstSnsState->au32WDRIntTime[0] % 4; /* au32WDRIntTime % 4 */
u32ShortExpMod8 = pstSnsState->au32WDRIntTime[0] % 8; /* au32WDRIntTime % 8 */
if (u32ShortExpMod8 == 0) {
u32SHR1 = 18; /* min 18 */
u32RHS1 = 18 + pstSnsState->au32WDRIntTime[0]; /* min 18 */
} else {
if (u32ShortExpMod4 == u32ShortExpMod8) {
u32SHR1 = 18; /* min 18 */
u32RHS1 = 18 + pstSnsState->au32WDRIntTime[0] - u32ShortExpMod8; /* min 18 */
} else {
u32SHR1 = 22; /* min 22 */
u32RHS1 = 22 + pstSnsState->au32WDRIntTime[0] - u32ShortExpMod4; /* min 22 */
}
}
u32LimitTmp = (IMX335_WDR_BRL * 2) + 2; /* 2 from sensor limit */
if (pstSnsState->au32FL[0] > u32LimitTmp) {
u32RHS1Limit = pstSnsState->au32FL[0] - u32LimitTmp;
} else {
u32RHS1Limit = u32LimitTmp - pstSnsState->au32FL[0];
}
if (u32PreRHS1 > u32RHS1) {
if ((u32PreRHS1 - u32RHS1) > u32RHS1Limit) {
u32RHS1 = u32PreRHS1 - (u32RHS1Limit - (u32RHS1Limit % 8)); /* 8x */
}
} else {
if ((u32RHS1 - u32PreRHS1) > u32RHS1Limit) {
u32RHS1 = u32PreRHS1 + (u32RHS1Limit - (u32RHS1Limit % 8)); /* 8x */
}
}
if ((HI_S32)(u32SHR0 - u32PreRHS1) < 18) { /* difference must > 18 */
u32SHR0 = u32PreRHS1 + 18; /* difference must > 18 */
}
cmos_inttime_update_reg_2to1_line(u32SHR1, u32RHS1, u32SHR0, pstSnsState);
u32PreRHS1 = u32RHS1;
return;
}
static HI_VOID cmos_inttime_update_2to1_line(VI_PIPE vi_pipe, HI_U32 u32IntTime)
{
static HI_BOOL bFirst[ISP_MAX_PIPE_NUM] = { [0 ...(ISP_MAX_PIPE_NUM - 1)] = 1 };
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
if (bFirst[vi_pipe]) { /* short exposure */
pstSnsState->au32WDRIntTime[0] = u32IntTime;
bFirst[vi_pipe] = HI_FALSE;
} else { /* long exposure */
cmos_inttime_update_2to1_line_long(vi_pipe, u32IntTime);
bFirst[vi_pipe] = HI_TRUE;
}
return;
}
/* while isp notify ae to update sensor regs, ae call these funcs. */
static HI_VOID cmos_inttime_update(VI_PIPE vi_pipe, HI_U32 u32IntTime)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
cmos_inttime_update_2to1_line(vi_pipe, u32IntTime);
} else {
cmos_inttime_update_linear(vi_pipe, u32IntTime);
}
return;
}
static HI_VOID cmos_again_calc_table(VI_PIPE vi_pipe, HI_U32 *pu32AgainLin, HI_U32 *pu32AgainDb)
{
int i;
CMOS_CHECK_POINTER_VOID(pu32AgainLin);
CMOS_CHECK_POINTER_VOID(pu32AgainDb);
if (*pu32AgainLin >= g_ad_gain_table[IMX335_AGAIN_TBL_RANGE]) {
*pu32AgainLin = g_ad_gain_table[IMX335_AGAIN_TBL_RANGE];
*pu32AgainDb = IMX335_AGAIN_TBL_RANGE;
} else {
for (i = 1; i < (IMX335_AGAIN_TBL_RANGE + 1); i++) {
if (*pu32AgainLin < g_ad_gain_table[i]) {
*pu32AgainLin = g_ad_gain_table[i - 1];
*pu32AgainDb = i - 1;
break;
}
}
}
g_u32Imx335AGain[vi_pipe] = *pu32AgainLin;
return;
}
static HI_VOID cmos_dgain_calc_table(VI_PIPE vi_pipe, HI_U32 *pu32DgainLin, HI_U32 *pu32DgainDb)
{
int i;
CMOS_CHECK_POINTER_VOID(pu32DgainLin);
CMOS_CHECK_POINTER_VOID(pu32DgainDb);
hi_unused(vi_pipe);
if (*pu32DgainLin >= g_ad_gain_table[IMX335_DGAIN_TBL_RANGE]) {
*pu32DgainLin = g_ad_gain_table[IMX335_DGAIN_TBL_RANGE];
*pu32DgainDb = IMX335_DGAIN_TBL_RANGE;
} else {
for (i = 1; i < (IMX335_DGAIN_TBL_RANGE + 1); i++) {
if (*pu32DgainLin < g_ad_gain_table[i]) {
*pu32DgainLin = g_ad_gain_table[i - 1];
*pu32DgainDb = i - 1;
break;
}
}
}
g_u32Imx335DGain[vi_pipe] = *pu32DgainLin;
return;
}
static HI_VOID cmos_gains_update(VI_PIPE vi_pipe, HI_U32 u32Again, HI_U32 u32Dgain)
{
static HI_BOOL bFirstGain[ISP_MAX_PIPE_NUM] = { [0 ...(ISP_MAX_PIPE_NUM - 1)] = 1 };
HI_U32 u32Tmp;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
if (bFirstGain[vi_pipe]) {
u32Tmp = u32Again + u32Dgain;
g_au32LGain[vi_pipe] = u32Tmp;
pstSnsState->astRegsInfo[0].astI2cData[3].u32Data = IMX335_LOW_8BITS(u32Tmp); /* index 3 */
pstSnsState->astRegsInfo[0].astI2cData[4].u32Data = IMX335_MID_8BITS(u32Tmp); /* index 4 */
bFirstGain[vi_pipe] = HI_FALSE;
} else {
u32Tmp = u32Again + u32Dgain;
pstSnsState->astRegsInfo[0].astI2cData[14].u32Data = IMX335_LOW_8BITS(u32Tmp); /* index 14 */
pstSnsState->astRegsInfo[0].astI2cData[15].u32Data = IMX335_MID_8BITS(u32Tmp); /* index 15 */
bFirstGain[vi_pipe] = HI_TRUE;
}
} else {
u32Tmp = u32Again + u32Dgain;
g_au32LGain[vi_pipe] = u32Tmp;
pstSnsState->astRegsInfo[0].astI2cData[3].u32Data = IMX335_LOW_8BITS(u32Tmp); /* index 3 */
pstSnsState->astRegsInfo[0].astI2cData[4].u32Data = IMX335_MID_8BITS(u32Tmp); /* index 4 */
pstSnsState->astRegsInfo[0].astI2cData[14].u32Data = IMX335_LOW_8BITS(u32Tmp); /* index 14 */
pstSnsState->astRegsInfo[0].astI2cData[15].u32Data = IMX335_MID_8BITS(u32Tmp); /* index 15 */
}
return;
}
static HI_U32 g_au32LastIntTimeMaxTmp[ISP_MAX_PIPE_NUM] = { [0 ...(ISP_MAX_PIPE_NUM - 1)] = 4 }; /* int timemax 4 */
static HI_VOID cmos_get_inttime_max_2to1_line_long_frame(VI_PIPE vi_pipe,
HI_U32 *au32Ratio, HI_U32 *au32IntTimeMax,
HI_U32 *au32IntTimeMin, HI_U32 *pu32LFMaxIntTime)
{
HI_U32 u32ShortMax0, u32ShortMax, u32ShortTimeMinLimit;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
CMOS_CHECK_POINTER_VOID(au32Ratio);
CMOS_CHECK_POINTER_VOID(pu32LFMaxIntTime);
u32ShortTimeMinLimit = 4; /* u32ShortTimeMinLimit 4 */
u32ShortMax0 = pstSnsState->au32FL[1] - 280 - pstSnsState->au32WDRIntTime[0]; /* sub 280 */
u32ShortMax = pstSnsState->au32FL[0] - 280; /* sub 280 */
u32ShortMax = (u32ShortMax0 < u32ShortMax) ? u32ShortMax0 : u32ShortMax;
au32IntTimeMax[1] = u32ShortMax;
au32IntTimeMin[1] = u32ShortTimeMinLimit;
g_au32LastIntTimeMaxTmp[vi_pipe] = u32ShortTimeMinLimit;
return;
}
static HI_VOID cmos_get_inttime_max_2to1_line_auto_long_frame(VI_PIPE vi_pipe, HI_U32 *au32Ratio,
HI_U32 *au32IntTimeMax, HI_U32 *au32IntTimeMin, HI_U32 *pu32LFMaxIntTime)
{
HI_U32 u32ShortMax0, u32ShortMax, u32ShortTimeMinLimit, u32delta, u32deltaRHS1;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
CMOS_CHECK_POINTER_VOID(pu32LFMaxIntTime);
u32ShortTimeMinLimit = 4; /* u32ShortTimeMinLimit 4 */
u32deltaRHS1 = g_astimx335State[vi_pipe].u32deltaRHS1 - (g_astimx335State[vi_pipe].u32deltaRHS1 % 8); /* RHS % 8 */
if (pstSnsState->au32WDRIntTime[0] == u32ShortTimeMinLimit && au32Ratio[0] == 0x40) {
u32ShortMax0 = pstSnsState->au32FL[1] - 280 - pstSnsState->au32WDRIntTime[0]; /* sub 280 */
u32ShortMax = pstSnsState->au32FL[0] - 280; /* sub 280 */
u32ShortMax = (u32ShortMax0 < u32ShortMax) ? u32ShortMax0 : u32ShortMax;
au32IntTimeMax[0] = u32ShortMax;
au32IntTimeMin[0] = u32ShortTimeMinLimit;
g_au32LastIntTimeMaxTmp[vi_pipe] = u32ShortTimeMinLimit;
return;
}
u32ShortMax0 = ((pstSnsState->au32FL[1] - 280 - pstSnsState->au32WDRIntTime[0]) * 0x40) / /* sub 280 */
SNS_DIV_0_TO_1(au32Ratio[0]);
u32ShortMax = ((pstSnsState->au32FL[0] - 280) * 0x40) / SNS_DIV_0_TO_1(au32Ratio[0] + 0x40); /* sub 280 */
u32ShortMax = (u32ShortMax0 < u32ShortMax) ? u32ShortMax0 : u32ShortMax;
u32ShortMax = (u32ShortMax > (g_astimx335State[vi_pipe].u32RHS1_MAX - 18)) ? /* sub 18 */
(g_astimx335State[vi_pipe].u32RHS1_MAX - 18) : u32ShortMax; /* sub 18 */
if (u32ShortMax > g_au32LastIntTimeMaxTmp[vi_pipe]) {
u32delta = u32ShortMax - g_au32LastIntTimeMaxTmp[vi_pipe];
if (u32delta > g_astimx335State[vi_pipe].u32deltaRHS1) {
u32ShortMax = g_au32LastIntTimeMaxTmp[vi_pipe] + u32deltaRHS1;
}
} else if (g_au32LastIntTimeMaxTmp[vi_pipe] > u32ShortMax) {
u32delta = g_au32LastIntTimeMaxTmp[vi_pipe] - u32ShortMax;
if (u32delta > g_astimx335State[vi_pipe].u32deltaRHS1) {
u32ShortMax = g_au32LastIntTimeMaxTmp[vi_pipe] - u32deltaRHS1;
}
}
g_au32LastIntTimeMaxTmp[vi_pipe] = u32ShortMax ? u32ShortMax : 1;
if (u32ShortMax >= u32ShortTimeMinLimit) {
au32IntTimeMax[0] = u32ShortMax;
au32IntTimeMax[1] = (au32IntTimeMax[0] * au32Ratio[0]) >> 6; /* shift 6 */
au32IntTimeMin[0] = u32ShortTimeMinLimit;
au32IntTimeMin[1] = (au32IntTimeMin[0] * au32Ratio[0]) >> 6; /* shift 6 */
return;
}
u32ShortMax = u32ShortTimeMinLimit;
au32IntTimeMax[0] = u32ShortMax;
au32IntTimeMax[1] = (au32IntTimeMax[0] * 0xFFF) >> 6; /* shift 6 */
au32IntTimeMin[0] = au32IntTimeMax[0];
au32IntTimeMin[1] = au32IntTimeMax[1];
return;
}
static HI_VOID cmos_get_inttime_max_2to1_line_normal(VI_PIPE vi_pipe,
HI_U32 *au32Ratio, HI_U32 *au32IntTimeMax,
HI_U32 *au32IntTimeMin, HI_U32 *pu32LFMaxIntTime)
{
HI_U32 u32ShortMax0, u32ShortMax, u32ShortTimeMinLimit;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
u32ShortTimeMinLimit = 4; /* u32ShortTimeMinLimit 4 */
u32ShortMax0 = ((pstSnsState->au32FL[1] - 280 - pstSnsState->au32WDRIntTime[0]) * 0x40) / /* sub 280 */
SNS_DIV_0_TO_1(au32Ratio[0]);
u32ShortMax = ((pstSnsState->au32FL[0] - 280) * 0x40) / SNS_DIV_0_TO_1(au32Ratio[0] + 0x40); /* sub 280 */
u32ShortMax = (u32ShortMax0 < u32ShortMax) ? u32ShortMax0 : u32ShortMax;
u32ShortMax = (u32ShortMax > (g_astimx335State[vi_pipe].u32RHS1_MAX - 18)) ? /* sub 18 */
(g_astimx335State[vi_pipe].u32RHS1_MAX - 18) : u32ShortMax; /* sub 18 */
u32ShortMax = (u32ShortMax == 0) ? 1 : u32ShortMax;
g_au32LastIntTimeMaxTmp[vi_pipe] = u32ShortMax;
*pu32LFMaxIntTime = g_astimx335State[vi_pipe].u32RHS1_MAX - 18; /* sub 18 */
if (u32ShortMax >= u32ShortTimeMinLimit) {
au32IntTimeMax[0] = u32ShortMax;
au32IntTimeMax[1] = (au32IntTimeMax[0] * au32Ratio[0]) >> 6; /* shift 6 */
au32IntTimeMin[0] = u32ShortTimeMinLimit;
au32IntTimeMin[1] = (au32IntTimeMin[0] * au32Ratio[0]) >> 6; /* shift 6 */
return;
}
u32ShortMax = u32ShortTimeMinLimit;
au32IntTimeMax[0] = u32ShortMax;
au32IntTimeMax[1] = (au32IntTimeMax[0] * 0xFFF) >> 6; /* shift 6 */
au32IntTimeMin[0] = au32IntTimeMax[0];
au32IntTimeMin[1] = au32IntTimeMax[1];
return;
}
static HI_VOID cmos_get_inttime_max_2to1_line(VI_PIPE vi_pipe,
HI_U32 *au32Ratio, HI_U32 *au32IntTimeMax,
HI_U32 *au32IntTimeMin, HI_U32 *pu32LFMaxIntTime)
{
switch (g_genFSWDRMode[vi_pipe]) {
case ISP_FSWDR_LONG_FRAME_MODE:
cmos_get_inttime_max_2to1_line_long_frame(vi_pipe, au32Ratio, au32IntTimeMax, au32IntTimeMin,
pu32LFMaxIntTime);
break;
case ISP_FSWDR_AUTO_LONG_FRAME_MODE:
cmos_get_inttime_max_2to1_line_auto_long_frame(vi_pipe, au32Ratio, au32IntTimeMax, au32IntTimeMin,
pu32LFMaxIntTime);
break;
case ISP_FSWDR_NORMAL_MODE:
cmos_get_inttime_max_2to1_line_normal(vi_pipe, au32Ratio, au32IntTimeMax, au32IntTimeMin,
pu32LFMaxIntTime);
break;
default:
break;
}
return;
}
static HI_VOID cmos_get_inttime_max(VI_PIPE vi_pipe, HI_U16 u16ManRatioEnable,
HI_U32 *au32Ratio, HI_U32 *au32IntTimeMax,
HI_U32 *au32IntTimeMin, HI_U32 *pu32LFMaxIntTime)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER_VOID(au32Ratio);
CMOS_CHECK_POINTER_VOID(au32IntTimeMax);
CMOS_CHECK_POINTER_VOID(au32IntTimeMin);
CMOS_CHECK_POINTER_VOID(pu32LFMaxIntTime);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
hi_unused(u16ManRatioEnable);
switch (pstSnsState->enWDRMode) {
case WDR_MODE_2To1_LINE:
cmos_get_inttime_max_2to1_line(vi_pipe, au32Ratio, au32IntTimeMax, au32IntTimeMin, pu32LFMaxIntTime);
break;
default:
break;
}
return;
}
/* Only used in FSWDR mode */
static HI_VOID cmos_ae_fswdr_attr_set(VI_PIPE vi_pipe, AE_FSWDR_ATTR_S *pstAeFSWDRAttr)
{
CMOS_CHECK_POINTER_VOID(pstAeFSWDRAttr);
g_genFSWDRMode[vi_pipe] = pstAeFSWDRAttr->enFSWDRMode;
g_au32MaxTimeGetCnt[vi_pipe] = 0;
return;
}
static HI_S32 cmos_init_ae_exp_function(AE_SENSOR_EXP_FUNC_S *pstExpFuncs)
{
CMOS_CHECK_POINTER(pstExpFuncs);
(hi_void)memset_s(pstExpFuncs, sizeof(AE_SENSOR_EXP_FUNC_S), 0, sizeof(AE_SENSOR_EXP_FUNC_S));
pstExpFuncs->pfn_cmos_get_ae_default = cmos_get_ae_default;
pstExpFuncs->pfn_cmos_fps_set = cmos_fps_set;
pstExpFuncs->pfn_cmos_slow_framerate_set = cmos_slow_framerate_set;
pstExpFuncs->pfn_cmos_inttime_update = cmos_inttime_update;
pstExpFuncs->pfn_cmos_gains_update = cmos_gains_update;
pstExpFuncs->pfn_cmos_again_calc_table = cmos_again_calc_table;
pstExpFuncs->pfn_cmos_dgain_calc_table = cmos_dgain_calc_table;
pstExpFuncs->pfn_cmos_get_inttime_max = cmos_get_inttime_max;
pstExpFuncs->pfn_cmos_ae_fswdr_attr_set = cmos_ae_fswdr_attr_set;
return HI_SUCCESS;
}
/* AWB default parameter and function */
#define CALIBRATE_STATIC_TEMP 4900
#define CALIBRATE_STATIC_WB_R_GAIN 0x1E3
#define CALIBRATE_STATIC_WB_GR_GAIN 0x100
#define CALIBRATE_STATIC_WB_GB_GAIN 0x100
#define CALIBRATE_STATIC_WB_B_GAIN 0x1d1
/* Calibration results for Auto WB Planck */
#define CALIBRATE_AWB_P1 (-0x0012)
#define CALIBRATE_AWB_P2 0x010b
#define CALIBRATE_AWB_Q1 (-0x0007)
#define CALIBRATE_AWB_A1 0x2711F
#define CALIBRATE_AWB_B1 0x0080
#define CALIBRATE_AWB_C1 (-0x1A5C1)
/* Rgain and Bgain of the golden sample */
#define GOLDEN_RGAIN 0
#define GOLDEN_BGAIN 0
static HI_S32 cmos_get_awb_default(VI_PIPE vi_pipe, AWB_SENSOR_DEFAULT_S *pstAwbSnsDft)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER(pstAwbSnsDft);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
(hi_void)memset_s(pstAwbSnsDft, sizeof(AWB_SENSOR_DEFAULT_S), 0, sizeof(AWB_SENSOR_DEFAULT_S));
pstAwbSnsDft->u16WbRefTemp = CALIBRATE_STATIC_TEMP;
pstAwbSnsDft->au16GainOffset[0] = CALIBRATE_STATIC_WB_R_GAIN;
pstAwbSnsDft->au16GainOffset[1] = CALIBRATE_STATIC_WB_GR_GAIN;
pstAwbSnsDft->au16GainOffset[2] = CALIBRATE_STATIC_WB_GB_GAIN; /* index 2 */
pstAwbSnsDft->au16GainOffset[3] = CALIBRATE_STATIC_WB_B_GAIN; /* index 3 */
pstAwbSnsDft->as32WbPara[0] = CALIBRATE_AWB_P1;
pstAwbSnsDft->as32WbPara[1] = CALIBRATE_AWB_P2;
pstAwbSnsDft->as32WbPara[2] = CALIBRATE_AWB_Q1; /* index 2 */
pstAwbSnsDft->as32WbPara[3] = CALIBRATE_AWB_A1; /* index 3 */
pstAwbSnsDft->as32WbPara[4] = CALIBRATE_AWB_B1; /* index 4 */
pstAwbSnsDft->as32WbPara[5] = CALIBRATE_AWB_C1; /* index 5 */
pstAwbSnsDft->u16GoldenRgain = GOLDEN_RGAIN;
pstAwbSnsDft->u16GoldenBgain = GOLDEN_BGAIN;
switch (pstSnsState->enWDRMode) {
default:
case WDR_MODE_NONE:
(hi_void)memcpy_s(&pstAwbSnsDft->stCcm, sizeof(AWB_CCM_S), &g_stAwbCcm, sizeof(AWB_CCM_S));
(hi_void)memcpy_s(&pstAwbSnsDft->stAgcTbl, sizeof(AWB_AGC_TABLE_S),
&g_stAwbAgcTable, sizeof(AWB_AGC_TABLE_S));
break;
case WDR_MODE_2To1_LINE:
(hi_void)memcpy_s(&pstAwbSnsDft->stCcm, sizeof(AWB_CCM_S), &g_stAwbCcmFsWdr, sizeof(AWB_CCM_S));
(hi_void)memcpy_s(&pstAwbSnsDft->stAgcTbl, sizeof(AWB_AGC_TABLE_S),
&g_stAwbAgcTableFSWDR, sizeof(AWB_AGC_TABLE_S));
break;
}
pstAwbSnsDft->u16InitRgain = g_au16InitWBGain[vi_pipe][0];
pstAwbSnsDft->u16InitGgain = g_au16InitWBGain[vi_pipe][1];
pstAwbSnsDft->u16InitBgain = g_au16InitWBGain[vi_pipe][2]; /* index 2 */
pstAwbSnsDft->u16SampleRgain = g_au16SampleRgain[vi_pipe];
pstAwbSnsDft->u16SampleBgain = g_au16SampleBgain[vi_pipe];
return HI_SUCCESS;
}
static HI_S32 cmos_init_awb_exp_function(AWB_SENSOR_EXP_FUNC_S *pstExpFuncs)
{
CMOS_CHECK_POINTER(pstExpFuncs);
(hi_void)memset_s(pstExpFuncs, sizeof(AWB_SENSOR_EXP_FUNC_S), 0, sizeof(AWB_SENSOR_EXP_FUNC_S));
pstExpFuncs->pfn_cmos_get_awb_default = cmos_get_awb_default;
return HI_SUCCESS;
}
static ISP_CMOS_DNG_COLORPARAM_S g_stDngColorParam = {{ 378, 256, 430 }, { 439, 256, 439 }};
static HI_VOID cmos_get_isp_dng_default(ISP_SNS_STATE_S *pstSnsState, ISP_CMOS_DEFAULT_S *pstDef)
{
(hi_void)memcpy_s(&pstDef->stDngColorParam, sizeof(ISP_CMOS_DNG_COLORPARAM_S), &g_stDngColorParam,
sizeof(ISP_CMOS_DNG_COLORPARAM_S));
switch (pstSnsState->u8ImgMode) {
default:
case IMX335_5M_30FPS_12BIT_LINEAR_MODE:
pstDef->stSensorMode.stDngRawFormat.u8BitsPerSample = 12; /* 12bit */
pstDef->stSensorMode.stDngRawFormat.u32WhiteLevel = 4095; /* max 4095 */
break;
case IMX335_5M_30FPS_10BIT_WDR_MODE:
pstDef->stSensorMode.stDngRawFormat.u8BitsPerSample = 10; /* 10bit */
pstDef->stSensorMode.stDngRawFormat.u32WhiteLevel = 1023; /* max 1023 */
break;
}
pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleH.u32Denominator = 1;
pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleH.u32Numerator = 1;
pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleV.u32Denominator = 1;
pstDef->stSensorMode.stDngRawFormat.stDefaultScale.stDefaultScaleV.u32Numerator = 1;
pstDef->stSensorMode.stDngRawFormat.stCfaRepeatPatternDim.u16RepeatPatternDimRows = 2; /* pattern 2 */
pstDef->stSensorMode.stDngRawFormat.stCfaRepeatPatternDim.u16RepeatPatternDimCols = 2; /* pattern 2 */
pstDef->stSensorMode.stDngRawFormat.stBlcRepeatDim.u16BlcRepeatRows = 2; /* pattern 2 */
pstDef->stSensorMode.stDngRawFormat.stBlcRepeatDim.u16BlcRepeatCols = 2; /* pattern 2 */
pstDef->stSensorMode.stDngRawFormat.enCfaLayout = CFALAYOUT_TYPE_RECTANGULAR;
pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[0] = 0;
pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[1] = 1;
pstDef->stSensorMode.stDngRawFormat.au8CfaPlaneColor[2] = 2; /* index 2, CfaPlaneColor 2 */
pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[0] = 0;
pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[1] = 1;
pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[2] = 1; /* index 2, CfaPattern 1 */
pstDef->stSensorMode.stDngRawFormat.au8CfaPattern[3] = 2; /* index 3, CfaPattern 2 */
pstDef->stSensorMode.bValidDngRawFormat = HI_TRUE;
return;
}
static void cmos_get_isp_linear_default(ISP_CMOS_DEFAULT_S *pstDef)
{
pstDef->unKey.bit1Demosaic = 1;
pstDef->pstDemosaic = &g_stIspDemosaic;
pstDef->unKey.bit1Sharpen = 1;
pstDef->pstSharpen = &g_stIspYuvSharpen;
pstDef->unKey.bit1Drc = 1;
pstDef->pstDrc = &g_stIspDRC;
pstDef->unKey.bit1Gamma = 1;
pstDef->pstGamma = &g_stIspGamma;
pstDef->unKey.bit1BayerNr = 1;
pstDef->pstBayerNr = &g_stIspBayerNr;
pstDef->unKey.bit1AntiFalseColor = 1;
pstDef->pstAntiFalseColor = &g_stIspAntiFalseColor;
pstDef->unKey.bit1Ldci = 1;
pstDef->pstLdci = &g_stIspLdci;
pstDef->unKey.bit1Dehaze = 1;
pstDef->pstDehaze = &g_stIspDehaze;
pstDef->unKey.bit1Lsc = 1;
pstDef->pstLsc = &g_stCmosLsc_6mm;
pstDef->unKey.bit1Lcac = 1;
pstDef->pstLcac = &g_stIspLCac;
(hi_void)memcpy_s(&pstDef->stNoiseCalibration, sizeof(ISP_CMOS_NOISE_CALIBRATION_S),
&g_stIspNoiseCalibration, sizeof(ISP_CMOS_NOISE_CALIBRATION_S));
return;
}
static void cmos_get_isp_2to1_line_wdr_default(ISP_CMOS_DEFAULT_S *pstDef)
{
pstDef->unKey.bit1Clut = 1;
pstDef->pstClut = &g_stIspCLUTWDR;
pstDef->unKey.bit1Dpc = 1;
pstDef->pstDpc = &g_stCmosDpcWDR;
pstDef->unKey.bit1Demosaic = 1;
pstDef->pstDemosaic = &g_stIspDemosaicWdr;
pstDef->unKey.bit1Sharpen = 1;
pstDef->pstSharpen = &g_stIspYuvSharpenWdr;
pstDef->unKey.bit1Drc = 1;
pstDef->pstDrc = &g_stIspDRCWDR;
pstDef->unKey.bit1Gamma = 1;
pstDef->pstGamma = &g_stIspGammaFSWDR;
#ifdef CONFIG_HI_ISP_PREGAMMA_SUPPORT
pstDef->unKey.bit1PreGamma = 0;
pstDef->pstPreGamma = &g_stPreGamma;
#endif
pstDef->unKey.bit1BayerNr = 1;
pstDef->pstBayerNr = &g_stIspBayerNrWdr2To1;
pstDef->unKey.bit1Detail = 1;
pstDef->pstDetail = &g_stIspDetailWdr2To1;
#ifdef CONFIG_HI_ISP_CR_SUPPORT
pstDef->unKey.bit1Ge = 1;
pstDef->pstGe = &g_stIspWdrGe;
#endif
pstDef->unKey.bit1AntiFalseColor = 1;
pstDef->pstAntiFalseColor = &g_stIspWdrAntiFalseColor;
pstDef->unKey.bit1Ldci = 0;
pstDef->pstLdci = &g_stIspWdrLdci;
pstDef->unKey.bit1Dehaze = 0;
pstDef->pstDehaze = &g_stIspDehazeWDR;
pstDef->unKey.bit1Lsc = 1;
pstDef->pstLsc = &g_stCmosLsc_4mm;
pstDef->unKey.bit1Lcac = 1;
pstDef->pstLcac = &g_stIspLCacWdr;
pstDef->stWdrSwitchAttr.au32ExpRatio[0] = 0x400;
(hi_void)memcpy_s(&pstDef->stNoiseCalibration, sizeof(ISP_CMOS_NOISE_CALIBRATION_S), &g_stIspNoiseCalibration,
sizeof(ISP_CMOS_NOISE_CALIBRATION_S));
return;
}
static HI_S32 cmos_get_isp_default(VI_PIPE vi_pipe, ISP_CMOS_DEFAULT_S *pstDef)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER(pstDef);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
(hi_void)memset_s(pstDef, sizeof(ISP_CMOS_DEFAULT_S), 0, sizeof(ISP_CMOS_DEFAULT_S));
#ifdef CONFIG_HI_ISP_CA_SUPPORT
pstDef->unKey.bit1Ca = 1;
pstDef->pstCa = &g_stIspCA;
#endif
pstDef->unKey.bit1Clut = 1;
pstDef->pstClut = &g_stIspCLUT;
pstDef->unKey.bit1Dpc = 1;
pstDef->pstDpc = &g_stCmosDpc;
pstDef->unKey.bit1Wdr = 1;
pstDef->pstWdr = &g_stIspWDR;
#ifdef CONFIG_HI_ISP_HLC_SUPPORT
pstDef->unKey.bit1Hlc = 0;
pstDef->pstHlc = &g_stIspHlc;
#endif
#ifdef CONFIG_HI_ISP_EDGEMARK_SUPPORT
pstDef->unKey.bit1EdgeMark = 0;
pstDef->pstEdgeMark = &g_stIspEdgeMark;
#endif
#ifdef CONFIG_HI_ISP_CR_SUPPORT
pstDef->unKey.bit1Ge = 1;
pstDef->pstGe = &g_stIspGe;
#endif
pstDef->unKey.bit1Detail = 1;
pstDef->pstDetail = &g_stIspDetail;
switch (pstSnsState->enWDRMode) {
default:
case WDR_MODE_NONE:
cmos_get_isp_linear_default(pstDef);
break;
case WDR_MODE_2To1_LINE:
cmos_get_isp_2to1_line_wdr_default(pstDef);
break;
}
pstDef->stSensorMode.u32SensorID = IMX335_ID;
pstDef->stSensorMode.u8SensorMode = pstSnsState->u8ImgMode;
cmos_get_isp_dng_default(pstSnsState, pstDef);
return HI_SUCCESS;
}
static HI_VOID cmos_get_isp_blacklevel_cal(VI_PIPE vi_pipe, ISP_CMOS_BLACK_LEVEL_S *pstBlackLevel)
{
if ((g_u32Imx335DGain[vi_pipe] >= 12288) && (g_u32Imx335DGain[vi_pipe] < 16384)) { /* range;[12288, 16384) */
pstBlackLevel->au16BlackLevel[0] = 217; /* index 0, value 217 */
pstBlackLevel->au16BlackLevel[1] = 211; /* index 1, value 211 */
pstBlackLevel->au16BlackLevel[2] = 208; /* index 2, value 208 */
pstBlackLevel->au16BlackLevel[3] = 216; /* index 3, value 216 */
return;
}
if ((g_u32Imx335DGain[vi_pipe] >= 16384) && (g_u32Imx335DGain[vi_pipe] < 20480)) { /* range;[16384, 20480) */
pstBlackLevel->au16BlackLevel[0] = 223; /* index 0, value 223 */
pstBlackLevel->au16BlackLevel[1] = 228; /* index 1, value 228 */
pstBlackLevel->au16BlackLevel[2] = 229; /* index 2, value 229 */
pstBlackLevel->au16BlackLevel[3] = 219; /* index 3, value 219 */
return;
}
if ((g_u32Imx335DGain[vi_pipe] >= 20480) && (g_u32Imx335DGain[vi_pipe] < 24576)) { /* range;[20480, 24576) */
pstBlackLevel->au16BlackLevel[0] = 248; /* index 0, value 248 */
pstBlackLevel->au16BlackLevel[1] = 255; /* index 1, value 255 */
pstBlackLevel->au16BlackLevel[2] = 256; /* index 2, value 256 */
pstBlackLevel->au16BlackLevel[3] = 244; /* index 3, value 244 */
return;
}
if ((g_u32Imx335DGain[vi_pipe] >= 24576) && (g_u32Imx335DGain[vi_pipe] < 28672)) { /* range;[24576, 28672) */
pstBlackLevel->au16BlackLevel[0] = 277; /* index 0, value 277 */
pstBlackLevel->au16BlackLevel[1] = 283; /* index 1, value 283 */
pstBlackLevel->au16BlackLevel[2] = 285; /* index 2, value 285 */
pstBlackLevel->au16BlackLevel[3] = 272; /* index 3, value 272 */
return;
}
if ((g_u32Imx335DGain[vi_pipe] >= 28672) && (g_u32Imx335DGain[vi_pipe] < 31768)) { /* range;[28672, 31768) */
pstBlackLevel->au16BlackLevel[0] = 303; /* index 0, value 303 */
pstBlackLevel->au16BlackLevel[1] = 308; /* index 1, value 308 */
pstBlackLevel->au16BlackLevel[2] = 310; /* index 2, value 310 */
pstBlackLevel->au16BlackLevel[3] = 295; /* index 3, value 295 */
return;
}
pstBlackLevel->au16BlackLevel[0] = 330; /* index 0, value 330 */
pstBlackLevel->au16BlackLevel[1] = 338; /* index 1, value 338 */
pstBlackLevel->au16BlackLevel[2] = 339; /* index 2, value 339 */
pstBlackLevel->au16BlackLevel[3] = 323; /* index 3, value 323 */
return;
}
static HI_S32 cmos_get_isp_black_level(VI_PIPE vi_pipe, ISP_CMOS_BLACK_LEVEL_S *pstBlackLevel)
{
HI_S32 i;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
if (pstBlackLevel == HI_NULL) {
printf("null pointer when get isp black level value!\n");
return -1;
}
/* Don't need to update black level when iso change */
pstBlackLevel->bUpdate = HI_TRUE;
if (pstBlackLevel->bUpdate == HI_TRUE) {
if (g_u32Imx335AGain[vi_pipe] < 32381) { /* range;[0, 32381) */
for (i = 0; i < ISP_BAYER_CHN_NUM; i++) {
pstBlackLevel->au16BlackLevel[i] = 0xC8; /* 12bit,0xC8 */
}
return 0;
}
if (g_u32Imx335DGain[vi_pipe] < 12288) { /* range;[0, 12288) */
for (i = 0; i < ISP_BAYER_CHN_NUM; i++) {
pstBlackLevel->au16BlackLevel[i] = 0xC8; /* 12bit,0xC8 */
}
return 0;
}
cmos_get_isp_blacklevel_cal(vi_pipe, pstBlackLevel);
return 0;
}
if (pstSnsState->enWDRMode == WDR_MODE_NONE) {
for (i = 0; i < ISP_BAYER_CHN_NUM; i++) {
pstBlackLevel->au16BlackLevel[i] = 0xC8; /* 12bit,0xC8 */
}
return 0;
}
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
for (i = 0; i < ISP_BAYER_CHN_NUM; i++) {
pstBlackLevel->au16BlackLevel[i] = 0xC8; /* 10bit 50, 12bit 200 */
}
return 0;
}
for (i = 0; i < ISP_BAYER_CHN_NUM; i++) {
pstBlackLevel->au16BlackLevel[i] = 0xC8; /* 10bit 50, 12bit 200 */
}
return 0;
}
static HI_VOID cmos_set_pixel_detect(VI_PIPE vi_pipe, HI_BOOL bEnable)
{
HI_U32 u32FullLines_5Fps = 0;
HI_U32 u32MaxIntTime_5Fps;
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
return;
} else {
if (pstSnsState->u8ImgMode == IMX335_5M_30FPS_12BIT_LINEAR_MODE) {
u32FullLines_5Fps = (IMX335_VMAX_5M_30FPS_12BIT_LINEAR * 30) / 5; /* 30fps, 5fps */
} else {
return;
}
}
u32MaxIntTime_5Fps = u32FullLines_5Fps - 8; /* sub 8 */
if (bEnable) { /* setup for ISP pixel calibration mode */
IMX335_write_register(vi_pipe, IMX335_GAIN_LONG_LOW, 0x00); /* gain */
IMX335_write_register(vi_pipe, IMX335_GAIN_LONG_HIGH, 0x00);
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_L, IMX335_LOW_8BITS(u32FullLines_5Fps)); /* VMAX */
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_M, IMX335_MID_8BITS(u32FullLines_5Fps));
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_H, IMX335_HIG_4BITS(u32FullLines_5Fps));
IMX335_write_register(vi_pipe, IMX335_SHR0_LOW, IMX335_LOW_8BITS(u32MaxIntTime_5Fps));
IMX335_write_register(vi_pipe, IMX335_SHR0_MIDDLE, IMX335_MID_8BITS(u32MaxIntTime_5Fps));
IMX335_write_register(vi_pipe, IMX335_SHR0_MIDDLE, IMX335_HIG_4BITS(u32MaxIntTime_5Fps));
} else { /* setup for ISP 'normal mode' */
pstSnsState->u32FLStd = (pstSnsState->u32FLStd > IMX335_FULL_LINES_MAX) ? IMX335_FULL_LINES_MAX
: pstSnsState->u32FLStd;
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_L, IMX335_LOW_8BITS(pstSnsState->u32FLStd));
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_M, IMX335_MID_8BITS(pstSnsState->u32FLStd));
IMX335_write_register(vi_pipe, IMX335_VMAX_ADDR_H, IMX335_HIG_4BITS(pstSnsState->u32FLStd));
pstSnsState->bSyncInit = HI_FALSE;
}
return;
}
static HI_S32 cmos_set_wdr_mode(VI_PIPE vi_pipe, HI_U8 u8Mode)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
pstSnsState->bSyncInit = HI_FALSE;
switch (u8Mode & 0x3F) {
case WDR_MODE_NONE:
pstSnsState->enWDRMode = WDR_MODE_NONE;
printf("linear mode\n");
break;
case WDR_MODE_2To1_LINE:
pstSnsState->enWDRMode = WDR_MODE_2To1_LINE;
printf("2to1 line WDR mode\n");
break;
default:
SNS_ERR_TRACE("NOT support this mode!\n");
return HI_FAILURE;
}
(hi_void)memset_s(pstSnsState->au32WDRIntTime,
sizeof(pstSnsState->au32WDRIntTime), 0, sizeof(pstSnsState->au32WDRIntTime));
return HI_SUCCESS;
}
static HI_VOID cmos_comm_sns_reg_info_init(VI_PIPE vi_pipe, ISP_SNS_STATE_S *pstSnsState)
{
hi_u32 i;
pstSnsState->astRegsInfo[0].enSnsType = ISP_SNS_I2C_TYPE;
pstSnsState->astRegsInfo[0].unComBus.s8I2cDev = g_aunImx335BusInfo[vi_pipe].s8I2cDev;
pstSnsState->astRegsInfo[0].u8Cfg2ValidDelayMax = 2; /* DelayMax 2 */
pstSnsState->astRegsInfo[0].u32RegNum = 8; /* RegNum 8 */
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
pstSnsState->astRegsInfo[0].u32RegNum += 8; /* RegNum add 8 */
}
for (i = 0; i < pstSnsState->astRegsInfo[0].u32RegNum; i++) {
pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = HI_TRUE;
pstSnsState->astRegsInfo[0].astI2cData[i].u8DevAddr = IMX335_I2C_ADDR;
pstSnsState->astRegsInfo[0].astI2cData[i].u32AddrByteNum = IMX335_ADDR_BYTE;
pstSnsState->astRegsInfo[0].astI2cData[i].u32DataByteNum = IMX335_DATA_BYTE;
}
/* shutter related */
pstSnsState->astRegsInfo[0].astI2cData[0].u8DelayFrmNum = 0;
pstSnsState->astRegsInfo[0].astI2cData[0].u32RegAddr = IMX335_SHR0_LOW; /* SHR0 */
pstSnsState->astRegsInfo[0].astI2cData[1].u8DelayFrmNum = 0;
pstSnsState->astRegsInfo[0].astI2cData[1].u32RegAddr = IMX335_SHR0_MIDDLE;
pstSnsState->astRegsInfo[0].astI2cData[2].u8DelayFrmNum = 0; /* index 2 */
pstSnsState->astRegsInfo[0].astI2cData[2].u32RegAddr = IMX335_SHR0_HIGH; /* index 2 */
pstSnsState->astRegsInfo[0].astI2cData[3].u8DelayFrmNum = 0; /* index 3 */
pstSnsState->astRegsInfo[0].astI2cData[3].u32RegAddr = IMX335_GAIN_LONG_LOW; /* index 3 */
pstSnsState->astRegsInfo[0].astI2cData[4].u8DelayFrmNum = 0; /* index 4 */
pstSnsState->astRegsInfo[0].astI2cData[4].u32RegAddr = IMX335_GAIN_LONG_HIGH; /* index 4 */
/* Vmax */
pstSnsState->astRegsInfo[0].astI2cData[5].u8DelayFrmNum = 0; /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[5].u32RegAddr = IMX335_VMAX_ADDR_L; /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[6].u8DelayFrmNum = 0; /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[6].u32RegAddr = IMX335_VMAX_ADDR_M; /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[7].u8DelayFrmNum = 0; /* index 7 */
pstSnsState->astRegsInfo[0].astI2cData[7].u32RegAddr = IMX335_VMAX_ADDR_H; /* index 7 */
return;
}
static HI_VOID cmos_2to1_line_wdr_sns_reg_info_init(VI_PIPE vi_pipe, ISP_SNS_STATE_S *pstSnsState)
{
hi_unused(vi_pipe);
pstSnsState->astRegsInfo[0].astI2cData[3].u8DelayFrmNum = 1; /* index 3 */
pstSnsState->astRegsInfo[0].astI2cData[4].u8DelayFrmNum = 1; /* index 4 */
pstSnsState->astRegsInfo[0].astI2cData[5].u8DelayFrmNum = 0; /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[5].u32RegAddr = IMX335_SHR1_LOW; /* index 5 */
pstSnsState->astRegsInfo[0].astI2cData[6].u8DelayFrmNum = 0; /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[6].u32RegAddr = IMX335_SHR1_MIDDLE; /* index 6 */
pstSnsState->astRegsInfo[0].astI2cData[7].u8DelayFrmNum = 0; /* index 7 */
pstSnsState->astRegsInfo[0].astI2cData[7].u32RegAddr = IMX335_SHR1_HIGH; /* index 7 */
pstSnsState->astRegsInfo[0].astI2cData[8].u8DelayFrmNum = 1; /* index 8 */
pstSnsState->astRegsInfo[0].astI2cData[8].u32RegAddr = IMX335_VMAX_ADDR_L; /* index 8 */
pstSnsState->astRegsInfo[0].astI2cData[9].u8DelayFrmNum = 1; /* index 9 */
pstSnsState->astRegsInfo[0].astI2cData[9].u32RegAddr = IMX335_VMAX_ADDR_M; /* index 9 */
pstSnsState->astRegsInfo[0].astI2cData[10].u8DelayFrmNum = 1; /* index 10 */
pstSnsState->astRegsInfo[0].astI2cData[10].u32RegAddr = IMX335_VMAX_ADDR_H; /* index 10 */
pstSnsState->astRegsInfo[0].astI2cData[11].u8DelayFrmNum = 0; /* index 11 */
pstSnsState->astRegsInfo[0].astI2cData[11].u32RegAddr = IMX335_RHS1_LOW; /* index 11 */
pstSnsState->astRegsInfo[0].astI2cData[12].u8DelayFrmNum = 0; /* index 12 */
pstSnsState->astRegsInfo[0].astI2cData[12].u32RegAddr = IMX335_RHS1_MIDDLE; /* index 12 */
pstSnsState->astRegsInfo[0].astI2cData[13].u8DelayFrmNum = 0; /* index 13 */
pstSnsState->astRegsInfo[0].astI2cData[13].u32RegAddr = IMX335_RHS1_HIGH; /* index 13 */
pstSnsState->astRegsInfo[0].astI2cData[14].u8DelayFrmNum = 1; /* index 14 */
pstSnsState->astRegsInfo[0].astI2cData[14].u32RegAddr = IMX335_GAIN_SHORT_LOW; /* index 14 */
pstSnsState->astRegsInfo[0].astI2cData[15].u8DelayFrmNum = 1; /* index 15 */
pstSnsState->astRegsInfo[0].astI2cData[15].u32RegAddr = IMX335_GAIN_SHORT_HIGH; /* index 15 */
return;
}
static HI_VOID cmos_sns_reg_info_update(VI_PIPE vi_pipe, ISP_SNS_STATE_S *pstSnsState)
{
hi_u32 i;
hi_unused(vi_pipe);
for (i = 0; i < pstSnsState->astRegsInfo[0].u32RegNum; i++) {
if (pstSnsState->astRegsInfo[0].astI2cData[i].u32Data ==
pstSnsState->astRegsInfo[1].astI2cData[i].u32Data) {
pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = HI_FALSE;
} else {
pstSnsState->astRegsInfo[0].astI2cData[i].bUpdate = HI_TRUE;
}
}
return;
}
static HI_S32 cmos_get_sns_regs_info(VI_PIPE vi_pipe, ISP_SNS_REGS_INFO_S *pstSnsRegsInfo)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
CMOS_CHECK_POINTER(pstSnsRegsInfo);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
if ((pstSnsState->bSyncInit == HI_FALSE) || (pstSnsRegsInfo->bConfig == HI_FALSE)) {
cmos_comm_sns_reg_info_init(vi_pipe, pstSnsState);
if (pstSnsState->enWDRMode == WDR_MODE_2To1_LINE) {
cmos_2to1_line_wdr_sns_reg_info_init(vi_pipe, pstSnsState);
}
pstSnsState->bSyncInit = HI_TRUE;
} else {
cmos_sns_reg_info_update(vi_pipe, pstSnsState);
}
pstSnsRegsInfo->bConfig = HI_FALSE;
(hi_void)memcpy_s(pstSnsRegsInfo, sizeof(ISP_SNS_REGS_INFO_S),
&pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S));
(hi_void)memcpy_s(&pstSnsState->astRegsInfo[1], sizeof(ISP_SNS_REGS_INFO_S),
&pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S));
pstSnsState->au32FL[1] = pstSnsState->au32FL[0];
return HI_SUCCESS;
}
static HI_S32 cmos_set_image_mode(VI_PIPE vi_pipe, ISP_CMOS_SENSOR_IMAGE_MODE_S *pstSensorImageMode)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
HI_U8 u8SensorImageMode;
CMOS_CHECK_POINTER(pstSensorImageMode);
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER(pstSnsState);
u8SensorImageMode = pstSnsState->u8ImgMode;
pstSnsState->bSyncInit = HI_FALSE;
switch (pstSnsState->enWDRMode) {
case WDR_MODE_2To1_LINE:
if (IMX335_RES_IS_5M_10BIT_WDR(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height) ||
IMX335_RES_IS_4M_10BIT_WDR(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height)) {
u8SensorImageMode = IMX335_5M_30FPS_10BIT_WDR_MODE;
g_astimx335State[vi_pipe].u32BRL = 1984 * 2; /* BRL 1984 * 2 */
pstSnsState->u32FLStd = IMX335_VMAX_5M_30FPS_10BIT_WDR;
break;
}
IMX335_ERR_MODE_PRINT(pstSensorImageMode, pstSnsState);
return HI_FAILURE;
case WDR_MODE_NONE:
if (IMX335_RES_IS_5M_12BIT_LINEAR(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height) ||
IMX335_RES_IS_4M_12BIT_LINEAR(pstSensorImageMode->u16Width, pstSensorImageMode->u16Height)) {
u8SensorImageMode = IMX335_5M_30FPS_12BIT_LINEAR_MODE;
g_astimx335State[vi_pipe].u32BRL = 1984 * 2; /* BRL 1984 * 2 */
pstSnsState->u32FLStd = IMX335_VMAX_5M_30FPS_12BIT_LINEAR;
break;
}
IMX335_ERR_MODE_PRINT(pstSensorImageMode, pstSnsState);
return HI_FAILURE;
default:
IMX335_ERR_MODE_PRINT(pstSensorImageMode, pstSnsState);
return HI_FAILURE;
}
if ((pstSnsState->bInit == HI_TRUE) && (u8SensorImageMode == pstSnsState->u8ImgMode)) {
/* Don't need to switch SensorImageMode */
return ISP_DO_NOT_NEED_SWITCH_IMAGEMODE;
}
pstSnsState->u8ImgMode = u8SensorImageMode;
pstSnsState->au32FL[0] = pstSnsState->u32FLStd;
pstSnsState->au32FL[1] = pstSnsState->au32FL[0];
return HI_SUCCESS;
}
static HI_VOID sensor_global_init(VI_PIPE vi_pipe)
{
ISP_SNS_STATE_S *pstSnsState = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pstSnsState);
CMOS_CHECK_POINTER_VOID(pstSnsState);
pstSnsState->bInit = HI_FALSE;
pstSnsState->bSyncInit = HI_FALSE;
pstSnsState->u8ImgMode = IMX335_5M_30FPS_12BIT_LINEAR_MODE;
pstSnsState->enWDRMode = WDR_MODE_NONE;
pstSnsState->u32FLStd = IMX335_VMAX_5M_30FPS_12BIT_LINEAR;
pstSnsState->au32FL[0] = IMX335_VMAX_5M_30FPS_12BIT_LINEAR;
pstSnsState->au32FL[1] = IMX335_VMAX_5M_30FPS_12BIT_LINEAR;
(hi_void)memset_s(&pstSnsState->astRegsInfo[0], sizeof(ISP_SNS_REGS_INFO_S), 0, sizeof(ISP_SNS_REGS_INFO_S));
(hi_void)memset_s(&pstSnsState->astRegsInfo[1], sizeof(ISP_SNS_REGS_INFO_S), 0, sizeof(ISP_SNS_REGS_INFO_S));
return;
}
static HI_S32 cmos_init_sensor_exp_function(ISP_SENSOR_EXP_FUNC_S *pstSensorExpFunc)
{
CMOS_CHECK_POINTER(pstSensorExpFunc);
(hi_void)memset_s(pstSensorExpFunc, sizeof(ISP_SENSOR_EXP_FUNC_S), 0, sizeof(ISP_SENSOR_EXP_FUNC_S));
pstSensorExpFunc->pfn_cmos_sensor_init = IMX335_init;
pstSensorExpFunc->pfn_cmos_sensor_exit = IMX335_exit;
pstSensorExpFunc->pfn_cmos_sensor_global_init = sensor_global_init;
pstSensorExpFunc->pfn_cmos_set_image_mode = cmos_set_image_mode;
pstSensorExpFunc->pfn_cmos_set_wdr_mode = cmos_set_wdr_mode;
pstSensorExpFunc->pfn_cmos_get_isp_default = cmos_get_isp_default;
pstSensorExpFunc->pfn_cmos_get_isp_black_level = cmos_get_isp_black_level;
pstSensorExpFunc->pfn_cmos_set_pixel_detect = cmos_set_pixel_detect;
pstSensorExpFunc->pfn_cmos_get_sns_reg_info = cmos_get_sns_regs_info;
return HI_SUCCESS;
}
static HI_S32 IMX335_set_bus_info(VI_PIPE vi_pipe, ISP_SNS_COMMBUS_U unSNSBusInfo)
{
g_aunImx335BusInfo[vi_pipe].s8I2cDev = unSNSBusInfo.s8I2cDev;
return HI_SUCCESS;
}
static HI_S32 sensor_ctx_init(VI_PIPE vi_pipe)
{
ISP_SNS_STATE_S *pastSnsStateCtx = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pastSnsStateCtx);
if (pastSnsStateCtx == HI_NULL) {
pastSnsStateCtx = (ISP_SNS_STATE_S *)malloc(sizeof(ISP_SNS_STATE_S));
if (pastSnsStateCtx == HI_NULL) {
SNS_ERR_TRACE("Isp[%d] SnsCtx malloc memory failed!\n", vi_pipe);
return HI_ERR_ISP_NOMEM;
}
}
(hi_void)memset_s(pastSnsStateCtx, sizeof(ISP_SNS_STATE_S), 0, sizeof(ISP_SNS_STATE_S));
IMX335_SENSOR_SET_CTX(vi_pipe, pastSnsStateCtx);
return HI_SUCCESS;
}
static HI_VOID sensor_ctx_exit(VI_PIPE vi_pipe)
{
ISP_SNS_STATE_S *pastSnsStateCtx = HI_NULL;
IMX335_SENSOR_GET_CTX(vi_pipe, pastSnsStateCtx);
SENSOR_FREE(pastSnsStateCtx);
IMX335_SENSOR_RESET_CTX(vi_pipe);
return;
}
static HI_S32 sensor_register_callback(VI_PIPE vi_pipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib)
{
HI_S32 s32Ret;
ISP_SENSOR_REGISTER_S stIspRegister;
AE_SENSOR_REGISTER_S stAeRegister;
AWB_SENSOR_REGISTER_S stAwbRegister;
ISP_SNS_ATTR_INFO_S stSnsAttrInfo;
CMOS_CHECK_POINTER(pstAeLib);
CMOS_CHECK_POINTER(pstAwbLib);
s32Ret = sensor_ctx_init(vi_pipe);
if (s32Ret != HI_SUCCESS) {
return HI_FAILURE;
}
stSnsAttrInfo.eSensorId = IMX335_ID;
s32Ret = cmos_init_sensor_exp_function(&stIspRegister.stSnsExp);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("cmos init exp function failed!\n");
return HI_FAILURE;
}
s32Ret = HI_MPI_ISP_SensorRegCallBack(vi_pipe, &stSnsAttrInfo, &stIspRegister);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor register callback function failed!\n");
return s32Ret;
}
s32Ret = cmos_init_ae_exp_function(&stAeRegister.stSnsExp);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("cmos init ae exp function failed!\n");
return HI_FAILURE;
}
s32Ret = HI_MPI_AE_SensorRegCallBack(vi_pipe, pstAeLib, &stSnsAttrInfo, &stAeRegister);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor register callback function to ae lib failed!\n");
return s32Ret;
}
s32Ret = cmos_init_awb_exp_function(&stAwbRegister.stSnsExp);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("cmos init awb exp function failed!\n");
return HI_FAILURE;
}
s32Ret = HI_MPI_AWB_SensorRegCallBack(vi_pipe, pstAwbLib, &stSnsAttrInfo, &stAwbRegister);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor register callback function to awb lib failed!\n");
return s32Ret;
}
return HI_SUCCESS;
}
static HI_S32 sensor_unregister_callback(VI_PIPE vi_pipe, ALG_LIB_S *pstAeLib, ALG_LIB_S *pstAwbLib)
{
HI_S32 s32Ret;
CMOS_CHECK_POINTER(pstAeLib);
CMOS_CHECK_POINTER(pstAwbLib);
s32Ret = HI_MPI_ISP_SensorUnRegCallBack(vi_pipe, IMX335_ID);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor unregister callback function failed!\n");
return s32Ret;
}
s32Ret = HI_MPI_AE_SensorUnRegCallBack(vi_pipe, pstAeLib, IMX335_ID);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor unregister callback function to ae lib failed!\n");
return s32Ret;
}
s32Ret = HI_MPI_AWB_SensorUnRegCallBack(vi_pipe, pstAwbLib, IMX335_ID);
if (s32Ret != HI_SUCCESS) {
SNS_ERR_TRACE("sensor unregister callback function to awb lib failed!\n");
return s32Ret;
}
sensor_ctx_exit(vi_pipe);
return HI_SUCCESS;
}
static HI_S32 sensor_set_init(VI_PIPE vi_pipe, ISP_INIT_ATTR_S *pstInitAttr)
{
CMOS_CHECK_POINTER(pstInitAttr);
g_au32InitExposure[vi_pipe] = pstInitAttr->u32Exposure;
g_au32LinesPer500ms[vi_pipe] = pstInitAttr->u32LinesPer500ms;
g_au16InitWBGain[vi_pipe][0] = pstInitAttr->u16WBRgain;
g_au16InitWBGain[vi_pipe][1] = pstInitAttr->u16WBGgain;
g_au16InitWBGain[vi_pipe][2] = pstInitAttr->u16WBBgain; /* index 2 */
g_au16SampleRgain[vi_pipe] = pstInitAttr->u16SampleRgain;
g_au16SampleBgain[vi_pipe] = pstInitAttr->u16SampleBgain;
g_quick_start_en[vi_pipe] = pstInitAttr->stQuickStart.bQuickStartEn;
g_abAERouteExValid[vi_pipe] = pstInitAttr->bAERouteExValid;
(hi_void)memcpy_s(&g_astInitAERoute[vi_pipe], sizeof(ISP_AE_ROUTE_S),
&pstInitAttr->stAERoute, sizeof(ISP_AE_ROUTE_S));
(hi_void)memcpy_s(&g_astInitAERouteEx[vi_pipe], sizeof(ISP_AE_ROUTE_EX_S),
&pstInitAttr->stAERouteEx, sizeof(ISP_AE_ROUTE_EX_S));
(hi_void)memcpy_s(&g_astInitAERouteSF[vi_pipe], sizeof(ISP_AE_ROUTE_S),
&pstInitAttr->stAERouteSF, sizeof(ISP_AE_ROUTE_S));
(hi_void)memcpy_s(&g_astInitAERouteSFEx[vi_pipe], sizeof(ISP_AE_ROUTE_EX_S),
&pstInitAttr->stAERouteSFEx, sizeof(ISP_AE_ROUTE_EX_S));
return HI_SUCCESS;
}
ISP_SNS_OBJ_S stSnsImx335Obj = {
.pfnRegisterCallback = sensor_register_callback,
.pfnUnRegisterCallback = sensor_unregister_callback,
.pfnStandby = IMX335_standby,
.pfnRestart = IMX335_restart,
.pfnMirrorFlip = HI_NULL,
.pfnWriteReg = IMX335_write_register,
.pfnReadReg = IMX335_read_register,
.pfnSetBusInfo = IMX335_set_bus_info,
.pfnSetInit = sensor_set_init
};
|
<reponame>xufwind95/go-web-base
package util
import (
"errors"
"time"
log "github.com/cihub/seelog"
"github.com/dgrijalva/jwt-go"
"github.com/xufwind95/go-web-base/config"
)
var (
jwtSecret string
jwtExpiration int64
)
func InitJwtConfig(conf *config.Config) {
jwtSecret = conf.JWT.Privatekey
jwtExpiration = conf.JWT.Expiration
}
// 使用指定的密码生成token
func SignToken(id uint) (tokenString string, err error) {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"id": id,
"exp": time.Now().Add(time.Second * time.Duration(jwtExpiration*10)).Unix(),
"nbf": time.Now().Unix(),
"iat": time.Now().Unix(),
})
tokenString, err = token.SignedString([]byte(jwtSecret))
if err != nil {
log.Info("Failed to sign a new token, due to " + err.Error())
}
return
}
// 验证秘钥格式是否正确
func secretFunc(secret string) jwt.Keyfunc {
return func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, jwt.ErrSignatureInvalid
}
return []byte(secret), nil
}
}
var TokenError = errors.New("parse token failed")
// 验证token是否合法,合法的返回用户名和密码
func ParseToken(tokenString string) (uint64, error) {
token, err := jwt.Parse(tokenString, secretFunc(jwtSecret))
if err != nil {
return 0, err
}
if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
id := uint64(claims["id"].(float64))
return id, nil
} else {
return 0, TokenError
}
}
|
<reponame>cuilei5205189/nodi
import { Vector2, Vector3 } from 'three';
import { AccessTypes } from '../../../data/AccessTypes';
import DataAccess from '../../../data/DataAccess';
import DataTree from '../../../data/DataTree';
import { DataTypes } from '../../../data/DataTypes';
import InputManager from '../../../io/InputManager';
import OutputManager from '../../../io/OutputManager';
import NPlane from '../../../math/geometry/NPlane';
import NPoint from '../../../math/geometry/NPoint';
import NComplexNumber from '../../../math/primitive/NComplexNumber';
import NodeBase from '../../NodeBase';
const SQRT3 = 1.73205080757;
export default class RectangularSpiral extends NodeBase {
get displayName (): string {
return 'Rect Spiral';
}
public registerInputs (manager: InputManager): void {
manager.add('o', 'Base plane for grid', DataTypes.PLANE, AccessTypes.ITEM).setDefault(new DataTree().add([new NPlane()]));
manager.add('r', 'Radius of spiral cells', DataTypes.NUMBER, AccessTypes.ITEM).setDefault(new DataTree().add([1]));
manager.add('n', '# of spiral corners', DataTypes.NUMBER, AccessTypes.ITEM).setDefault(new DataTree().add([36]));
}
public registerOutputs (manager: OutputManager): void {
manager.add('p', 'Points at grid centers', DataTypes.POINT, AccessTypes.LIST);
}
public solve (access: DataAccess): void {
const plane = access.getData(0) as NPlane;
const radius = access.getData(1) as number;
const count = access.getData(2) as number;
const offset = plane.origin;
const dx = plane.xAxis;
const dy = plane.yAxis;
const points = [];
const r = 2 * radius / SQRT3;
const n = count + 1;
for (let i = 1; i < n; i++) {
const v2 = this.pointAtRectSpiral(i);
const v = offset.clone().add(dx.clone().multiplyScalar(v2.x * r)).add(dy.clone().multiplyScalar(v2.y * r));
points.push(v);
}
access.setDataList(0, points);
}
private pointAtRectSpiral (index: number): Vector2 {
const position = new Vector2();
if (index > 1) {
const N = Math.floor(Math.ceil((Math.sqrt(index) + 1) / 2));
const m = index - (2 * N - 3) * (2 * N - 3) - 1;
const l = (N - 1) * 2;
const r = Math.floor(m / l);
const t = m % l;
const ir = (new NComplexNumber(0, 1)).pow(r + 1);
const irt = ir.mul(new NComplexNumber(0, t));
const s0 = new NComplexNumber(N - 1, -N + 2);
const s = s0.mul(ir);
const a = s.add(irt);
position.set(a.real, a.imag);
}
return position;
}
}
|
/**
* *************************************************
* Projekt: hipchat-api2
* <p/>
* Autor: <NAME>
* <p/>
* Data utworzenia: 2016-01-09
* *************************************************
*/
package pl.ppwozniak.hipchat.api2.request.users;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;
import lombok.ToString;
import pl.ppwozniak.hipchat.api2.common.AbstractRequest;
import pl.ppwozniak.hipchat.api2.common.ApiData;
import pl.ppwozniak.hipchat.api2.common.ClientJsonMapper;
import pl.ppwozniak.hipchat.api2.request.users.body.ShareLinkWithUserRequestBody;
/**
* @author wp
*/
@ToString(callSuper = true)
public class ShareLinkWithUserRequest extends AbstractRequest {
private static final String REQUEST_URL_PART1 = "user/";
private static final String REQUEST_URL_PART2 = "share/link";
private String idOrName;
private String message;
private String link;
public ShareLinkWithUserRequest(String idOrName, String message, String link) {
this.idOrName = idOrName;
this.message = message;
this.link = link;
}
public ShareLinkWithUserRequest(String idOrName, String link) {
this(idOrName, "", link);
}
@Override
public HttpRequest getRequest(String token) {
Unirest.setObjectMapper(new ClientJsonMapper());
HttpRequestWithBody request = Unirest.post(ApiData.URL + REQUEST_URL_PART1 + idOrName + "/" + REQUEST_URL_PART2)
.queryString(ApiData.TOKEN_PARAM_NAME, token)
.header("Content-Type", "application/json");
ShareLinkWithUserRequestBody body = new ShareLinkWithUserRequestBody(message, link);
request.body(body);
setUrl(request.getUrl());
return request;
}
}
|
Medical leaders celebrate the ascent of woman Richard H Smith The BMJ s editor in chief, Fiona Godlee, gathered together an unprecedented number of female medical leaders earlier this week in celebration of the fact that eight medical royal colleges are now led by women. The senior women are (left to right) Sue Bailey, chair of the Academy of Medical Royal Colleges; Kate Lovett, dean of the Royal College of Psychiatrists; Carrie MacEwen, chair elect of the Academy of Medical Royal Colleges and former president of the Royal College of Ophthalmologists; Nicola Strickland, president of the Royal College of Radiologists; Jane Dacre, president of the Royal College of Physicians; |
<reponame>sdmengchen12580/permission
package com.joker.api.wrapper;
import android.app.Activity;
import com.joker.api.Permissions4M;
/**
* Created by joker on 2017/8/5.
*/
public interface Wrapper extends ListenerWrapper, AnnotationWrapper {
/**
* get activity
*
* @return
*/
Activity getActivity();
/**
* request code
*
* @param code
* @return
*/
Wrapper requestCodes(int... code);
/**
* request permission
*
* @param permission {@link android.Manifest.permission}
* @return
*/
Wrapper requestPermissions(String... permission);
/**
* android setting page or phone manager page
*
* @param pageType {@link Permissions4M.PageType}
* @return
*/
Wrapper requestPageType(@Permissions4M.PageType int pageType);
/**
* whether should apply permission force
*
* @param force true if force
* @return
*/
Wrapper requestForce(boolean force);
/**
* called when use custom rationale, in case fall in to drop-dead
* <p>
* custom rationale -> ensure button -> Permissions4M.request ->
* if(custom rationale) -> custom rationale
*
* @return
*/
Wrapper requestOnRationale();
/**
* allow the android(under {@link android.os.Build.VERSION_CODES#M}, above
* {@link android.os.Build.VERSION_CODES#LOLLIPOP}) to request permission
*
* @param allow true if allow
* @return
*/
Wrapper requestUnderM(boolean allow);
/**
* get the context({@link android.app.Activity}, {@link android.app.Fragment},
* {@link android.support.v4.app.Fragment})
*
* @return {@link android.app.Activity} or {@link android.app.Fragment} or
* {@link android.support.v4.app.Fragment}
*/
Object getContext();
/**
* request permission
*/
void request();
/**
* multiple permission request by sync
*/
void requestSync();
int[] getRequestCodes();
String[] getRequestPermissions();
boolean isRequestOnRationale();
boolean isRequestUnderM();
@Permissions4M.PageType
int getPageType();
boolean isRequestForce();
}
|
Sen. Barbara Boxer (D-Calif.) questioned the Republican Party's commitment to women after Senate Republicans boycotted a vote for Gina McCarthy, the president's nominee to lead the Environmental Protection Agency, and showed no indication they'll show up for a rescheduled vote this week.
Boxer, chairwoman of the Environment and Public Works Committee, has scheduled a second committee vote on McCarthy for Thursday. "So far, they haven't suggested that they're going to be there, which is quite irritating," Boxer told reporters on Capitol Hill Tuesday afternoon. "She's probably the most qualified person ever nominated for the EPA. She's worked for four Republican governors. She's answered more than a thousand of their questions. And they've all voted for her before for other positions. It just makes no sense to me. This woman deserves a promotion.
"They say they're for womens' advancement," Boxer continued. "Here's a clear case where they ought to prove it."
Republicans skipped the committee's vote Thursday, preventing a quorum on whether to send McCarthy’s nomination to the full Senate. Under Senate rules, a majority of committee members must be present for a vote. That means Boxer needed 10 members of the committee to show up. The absence of committee Republicans as well as Sen. Max Baucus (D-Mont.) and Sen. Frank Lautenberg (D-N.J.) left Democrats with only eight. Lautenberg's poor health has kept him from the Hill recently. Baucus was attending another hearing.
Sen. David Vitter (R-La.), the ranking member on the committee, submitted five "transparency" questions on McCarthy ahead of his meeting Tuesday with EPA Acting Administrator Bob Perciasepe. Requests ranged from improving the agency’s response to Freedom of Information Act requests to reviewing McCarthy's private email accounts. Sen. Tom Carper (D-Del.), a member of the committee, told HuffPost there was "some progress on one or two of those questions" and "ongoing conversations to see if there might be some common ground on the other three."
"I'm just encouraged there are good discussions going on," Carper said. "I think it's in good faith on both sides."
John Barrasso (R-Wyo.), a Republican on the committee, didn't sound particularly open to negotiation. "I believe the EPA is failing America," he said. "I believe Gina McCarthy has been a significant part of that failure over the past four years. I opposed her nomination and will continue to oppose her nomination."
Boxer, meanwhile, seemed to leave the door open for Republicans. "If I got a letter from them saying they would help us get a quorum -- that's all I ask. If they want to vote no on her, fine. Just come to the hearing. Do your job." |
Elliptic Flowers: simply connected billiard tables with chaotic or non-chaotic flows moving around chaotic or non-chaotic cores We introduce a class of billiards with chaotic unidirectional flows (or non-chaotic unidirectional flows with"vortices") which go around a chaotic or non-chaotic"core", where orbits can change their orientation. Moreover, the corresponding billiard tables are simply connected in difference with many attempts to build billiards with interesting and/or exotic dynamics by putting inside billiard tables various"scatterers"with funny shapes. Therefore the billiards in this new class are amenable to experimental studies in physics labs as well as to the rigorous mathematical ones, which may shed a new light on understanding of classical and quantum dynamics of Hamiltonian systems. Introduction Among the main advances of the 20th century science was the discovery that deterministic (dynamical) systems can demonstrate an enormously broad variety of behaviors, from completely regular (integrable) to completely chaotic. Most of the essential steps in this striking progress were based on finding various classes of dynamical systems, which demonstrated new, often unexpected and counter-intuitive, types of behavior. Billiards play a special role in the list of basic classes of dynamical systems. While being arguably the most ancient class of dynamical systems ever studied (what is called now integrability of billiards in circles, was known for millennia) it remains on a forefront of the theory of dynamical systems and their applications. This special role of billiards is mainly due to two factors. Billiards form one of the most visual classes of dynamical systems (if not just the most visual one) and besides, billiards are natural models of many real life phenomena, first of all in physics. The purpose of this paper is to introduce a new class of billiards, which demonstrate various new surprising properties. At the same time, these billiards are amenable to rigorous mathematical, as well as to promising numerical, and even to experimental, studies. Formally these billiards could be considered as generalizations of the first class of billiards, which was presented as a justification of the discovery of a new mechanism of chaos (hyperbolicity) in dynamical systems, called the mechanism of defocusing. Boundaries of the first billiard tables, which demonstrated the mechanism of defocusing, consist of arcs of circles, so that the arcs completing all components of the boundary to the full circles lie within the corresponding billiard table. Such systems were called flower-like billiards, and later referred to as Bunimovich flowers (see e.g. ). In what follows we will refer to this class of billiards as to circular flowers. It is worthwhile to mention that so beloved, especially by the physics community, stadium billiard is, in fact, a very special and even a singular example in this class. Indeed, a stadium arose from a flower with two circular petals by taking their common tangents. Such billiards were initially called squashes. A squash becomes stadium, when two circular arcs have the same radius. The boundaries of the presented in this paper class of billiards consist of pieces of ellipses. Therefore these billiards will be called elliptic flowers (EF). However, in difference with circular flowers, which always have chaotic and ergodic dynamics, this class of billiards demonstrates a large variety of possible behaviors. For instance, a billiard is called a track billiard if almost all its orbits always move clockwise or counter-clockwise. Again, an ancient example of such dynamics is given by an integrable billiard between two concentric circles. A natural (although somewhat ambitious) question was whether there exist track billiards with chaotic behavior. This question arises in quantum chaos in search of examples/situations where Shnirelman peak in the spectrum of the Schroedinger operator may appear. In a track billiard this peak naturally appears in the phase space at the common boundary of tracks. Although existence of chaotic tracks sounded a little bit too exotic, it was proved that there exist such billiards. In elliptic flowers, which the present paper introduces, always exist tracks, which could be chaotic or non-chaotic. However, these tracks do not occupy the entire phase space, as it was in. Instead these tracks are going around a core, which also is an invariant set with a positive measure. Dynamics in the core also (as in tracks) can be chaotic or non-chaotic. A simple description of dynamics in the elliptic flowers billiards is the existence of a core surrounded by two flows (tracks) going in the opposite directions, which could be chaotic or have internal "vortices". Dynamics in the core could be chaotic or be the one typical for a generic Hamiltonian system, i.e. a mixture of elliptic islands and chaotic "seas". It should be noted that an integrable billiard in ellipse has two integrable tracks, consisting of orbits tangent to the confocal smaller ellipses. The corresponding (integrable) core consists of orbits which intersect the segment between the foci after any reflection off the boundary. Therefore the new in spirit elliptic flowers are the ones where either tracks or cores are chaotic, or the both are chaotic. Of course, if a billiard has a caustic, then orbits which do not intersect the caustic form two tracks, and the rest form a core. However, the issue is to investigate dynamics in tracks and core. Examples with regular dynamics, e.g. ellipses are well known. An important property of the elliptic flowers is that these billiard tables are simply connected. In other words, they do not have any internal boundaries, which are often used in constructions of billiards with various exotic behaviors. Therefore, elliptic flowers can be built as experimental devices joining in the labs mushrooms, which actually have more sophisticated, than the elliptic flowers, boundaries. In this respect, it is also worthwhile to mention that by varying the natural parameters, which describe the EFs, one can change dynamics of elliptic flowers in several ways. Such studies may shed a new light on our understanding of dynamics of generic Hamiltonian systems, both in the classical and quantum settings. Another possible use of elliptic flowers comes from the theory of the slowfast systems, where a recent breakthrough established importance of nonergodicity for effective averaging over fast dynamics. Particularly, mushroom billiards, which always have a divided into KAM islands and ergodic chaotic "seas" phase space, were effectively used in these studies. Indeed, the elliptic flowers, which we consider here, are always non-ergodic because of existence of at least three ergodic components, which are tracks and a core. Moreover, the boundaries of elliptic flowers can be smoothed, what cannot be done for mushroom billiards and for circular flowers. In the present paper the examples are given of elliptic flowers billiards with chaotic and non-chaotic tracks, surrounding chaotic and non-chaotic cores. Moreover, the first example of another phenomenon is given, which goes against the developed community intuition about billiards. It is universally known that, although mechanism of defocusing generates chaotic (hyperbolic) dynamics, the correlations in billiards with at least one focusing component of the boundary always decay slowly (power-like). On another hand, the correlations decay exponentially in dispersing billiards ( ). We demonstrate that in the chaotic cores of the elliptic flowers the correlations may decay exponentially. This result once again shows that the mechanism of dispersing is a special case of the mechanism of defocusing, not just formally, what is obvious, but also factually. Indeed, the purely focusing billiards can generate any type of behavior which dispersing billiards may generate as well as quite different dynamics from the one of dispersing billiards. (Defocusing is clearly more general because this mechanism allows the orbits to converge and diverge in configuration space, while dispersing allows only divergence of the orbits. Therefore dispersing is the limiting case of defocusing when orbits never converge). Our goal here is to present the simplest sub-classes of the elliptic flowers billiards which demonstrate all the described above new types of dynamics. Therefore in this paper we consider only the simplest elliptic flowers billiards. It allows to provide either simple and visual proofs, or the results immediately follow from the already existing ones in the mathematical theory of billiards. These general results actually have quite sophisticated and long proofs, but they allow almost immediately conclude our results here. Already consideration of these simplest cases allows to get all the promised results on coexistence of chaotic or non-chaotic tracks with chaotic or non-chaotic cores. All four possible types of coexistence are demonstrated. However, the dynamics of general elliptic flower billiards is much richer. Therefore some natural questions, which arise for the future studies of the EFs billiards, are discussed in the last section. Some conjectures on possible existence of elliptic flowers with even more rich dynamics are also formulated there. Multilayered Elliptic Flowers Billiards Construction of a multilayered elliptic flower billiard (MEF-billiard) starts with a choice of any convex polygon on the Euclidean plane. Let A 1, A 2,...A n be the vertices of a convex polygon A. This polygon will be called a base for the corresponding family of elliptic flowers billiards. The first elliptic layer over A is formed by all ellipses, which do not intersect A and have focuses at the points A i and A i+1, where i varies between 1 and n, and i + 1 is taken modulus n. In other words, the first layer of ellipses over a polygon A consists of all ellipses with focuses at the ends of one and the same side of A. The second layer of ellipses over A is a union of all ellipses which have focuses at the points A i and A i+2, where again i + 2 is taken mod(n). Clearly the second layer of ellipses over the polygon A consists of all ellipses with focuses at the ends of small diagonals of A, which connect the ends of two neighboring sides of A. Analogously, a layer of ellipses number m over a given polygon is defined in the same way, where, instead of (i + 2) (mod n), one should take (i + m) (mod n). Therefore all ellipses have focuses at some vertices of A. It is easy to see that a regular polygon with n vertices has n/2 layers, if n is an even number, and (n + 1)/2 layers, if n is odd. Fig. 1 the base polygon A is a square. There are only two layers in this case. Observe because the lines passing through the sides of A never intersect outside of the polygon A. It is easy to see that such situation occurs only when A is a triangle or a square. We will consider in what follows a special subset of the set of all unstructured elliptic flowers, which are constructed in the following way. Clearly, the ends of any regular (smooth) component of the boundary of a structural elliptic flower belong to lines containing two different sides of the base polygon A (Fig. 1, Fig. 2). However, if A is a polygon with n ≥ 5 sides then the lines containing the sides of A do intersect outside of this base polygon (Fig. 3). As a result, these lines form a finite partition the plane into some compact closed sets and some infinite sets which we will call zones. It is worthwhile to mention that our construction is much more general than a construction of a billiard table which contains a given caustic K. Recall that a curve K is a caustic for a billiard if from one link of a billiard orbit being tangent to K follows that all other links of this orbit are also tangent to K. Given a convex curve K, one can obtain a billiard table possessing this curve K as a caustic by the following string construction. Take a rope with the length larger that the length of K. Then go around K tightly keeping the rope at its full length. The resulting closed curve is a billiard table Q which has K as a caustics. This construction smoothens, i.e. even if the curve K is only piecewise C 1 the so constructed curve (boundary of a billiard table Q) always will be globally C 1. For instance, if K is a triangle then the boundary of the resulting billiard table, consisting of six elliptic arcs, is globally C 1, but the curvature is discontinuous in the six points where the ellipses are glued together. For the sake of simplicity and clarity we will ignore a detailed consideration of elliptic flowers which can be constructed with a special procedure (choice of ellipses and their focuses) for each zone. Also for the same reason we will study in this paper only the simplest classes of the elliptic flower billiards. Therefore in what follows we will consider elliptic flowers billiards with the boundary components only from the first and/or the second layers. Moreover, we will study here only regular polygons with n ≤ 6 as the bases of the EFs billiards. It is easy to see that in these cases there are only two layers and two zones if n = 3 or 4, and two layers and three zones if n = 5 or 6 (see Fig. 2). Remarkably, already these the simplest elliptic flowers have all the main new features which were discussed in the introduction. Besides, clearly only such elliptic flowers would be the most easy to build in the experimental labs. Recall that a billiard is a dynamical system generated by an uniform motion of a point particle within a region Q in the Euclidean plane. This region Q is a configuration space of a billiard, which is called a billiard table. The boundary ∂Q of Q consists of a finite number of smooth (at least C 2 ) curves, which are called the regular components of ∂Q. A point particle moves along the straight lines within Q, and it gets elastically reflected off the boundary, i.e. the angle of incidence equals the angle of reflection. These angles are formed by the internal unit normal vector n(q) at the point of reflection q ∈ ∂Q and the vectors of the particle's velocities just before and just after a moment of the reflection off the boundary of the billiard table. Therefore, the orbits of billiards are broken lines, consisting of straight segments (links) which connect two points at the boundary of a billiard table, where two consecutive reflections occur. Without any loss of generality we may assume that a constant speed of the particle equals one. Billiards are Hamiltonian systems. Therefore the billiard dynamics preserves the phase volume. It is easy to see that the set of orbits which hit singular points of the boundary of a billiard table has measure zero. The major questions about billiards are related to ergodic and statistical properties of these dynamical systems with respect to the invariant measure. Certainly, only positive measure tracks are of interest. For instance, a billiard within any convex region Q with smooth boundary has zero measure "tracks" consisting of tangent to ∂Q orbits. It is well-known that a billiard in ellipse E is an integrable dynamical system. One positive measure family of orbits of such billiard consists of all orbits which are tangent between any two consecutive reflections off E to some confocal with E ellipse. Another positive measure family of orbits consists of all such orbits that the straight line, which contain a segment between any two consecutive reflections off ∂E, is tangent to some confocal with E hyperbola. The two families of orbits, tangent to the confocal ellipses and hyperbolas, are separated in the phase space by the set of orbits which pass through the focuses of E between any two consecutive reflections off the boundary. It is worthwhile to recall that, according to the optical definition of ellipses, an ellipse E is a such closed curve that there are two points F 1 and F 2 with the property that a ray of light passing through F 1 will pass after reflection off ∂E through F 2, and vice versa. Certainly the orbits tangent to confocal ellipses form tracks with regular (even integrable) dynamics. In what follows the regular boundary components of the flower billiard tables will be sometimes referred to as to petals. Main Results This section presents several statements, which show that structural elliptic flowers always have tracks which could be chaotic (hyperbolic) or non-chaotic. Likewise the dynamics in a core, which is the complement to tracks in the phase space of a billiard, could be chaotic or not. A billiard in ellipse has a core consisting of such orbit which between any two consecutive reflections off the boundary intersect the segment connecting the focuses. Denote by M (A), Q(A) the phase space and the configuration space (billiard table) built over the base polygon A. A core Co(M (A)) is the complement to the tracks T r(A) in the phase space M (A). The projection of the core Co(M (A)) to the billiard table Q(A) will be called a base core and denoted by Co(Q(A)). We start with the following simple Proposition. Proposition 3.1. Let A be a regular polygon with n ≤ 6 sides. Then any structural elliptic flower billiard with the base A will have two tracks. The EF billiards built over triangles and squares will always have a base core A. The EF billiards built over pentagons and hexagons will have the same base core A if their boundaries belong to the zones 1 and 2. Otherwise, if the boundary of an elliptic flower billiard table intersect zone 3, then a core is a convex polygon, which is a proper subset of A. Proof. If the boundary of a billiard table Q(A) does not intersect zone 3, then the statement immediately follows from the construction of the structural multilayered elliptic flowers and from the optical definition of ellipses. Let now the boundary of Q(A) intersects zone 3 (see Fig.2(b)). Connect then each point, which is an end point of a boundary component (elliptic arc) in this zone, by the straight segments to the another focus (D in Fig. 2 (b)) of the corresponding ellipse. (Observe, that this end point B is already connected to one focus of this ellipse by the straight line which belongs to the boundary of the zone 3). Then the collection of all straight lines, which are going through all such segments, cut out a smaller convex polygon A from the A. Again, the construction of the structured multilayered elliptic flowers, together with the optical definition of the ellipses, ensures that A is indeed the base core of the billiard in Q(A). Actually any structural elliptic flower billiard has two tracks of positive measure. A proof of the corresponding general statement uses the same argument as the Proposition above. Proof. The base polygon A is convex. Therefore it lies on one side of a line going through any side of A. Then by construction of the structural elliptic flowers it follows from the optical definition of ellipses that if any link of a billiard orbit goes through some vertex of A then all other links of such orbit also contain one vertex of A. By making now an analogous consideration to the one in the proof of Proposition 3.1, we obtain that a billiard in any structured elliptic flower Q(A) with the base A has two tracks. Likewise, the corresponding core coincides with A, if the boundary ∂Q(A) belongs only to the zones 1 and 2. Otherwise, a core Co(Q(A)) of the corresponding billiard is a convex polygon, which is a proper subset of the base polygon A. Observe that the Corollary 3.3 implies also that the core is an invariant subset of the corresponding billiard dynamics. This statement immediately follows from the construction of the structural multilayered elliptic flowers and the proof of the Proposition 3.1 and Theorem 3.2. As was already mentioned, in what follows we will mainly concentrate on the case when the base polygon A is a regular polygon with n ≤ 6 sides. Proposition 3.6. If the base polygon A is a regular triangle or a square then the dynamics on the corresponding core of a structural elliptic flower over A cannot be ergodic. Proof. Indeed, according to the Remark 1 (see also Fig. 1) the boundary ∂Q(A) of a structural elliptic flower over a regular triangle consists of six regular components, which contain three pairs of arcs of two confocal ellipses. Moreover, a period two orbit which connects the ends of the small axes for any pair of these ellipses is a stable elliptic periodic orbit. Therefore the dynamics on a core of EF billiards, built over a regular triangles, is not ergodic. The same is true for the four pairs of the arcs of confocal ellipses in case when A is a square. It is easy to see that the boundary of a structural elliptic flower built over square contains two pairs of arcs of confocal ellipses (Fig. 1). Therefore, in this case there are at least two elliptic periodic orbits (of period two) in the core. Therefore the core is not an ergodic (chaotic) components of the corresponding elliptic flower billiard. The large and the small axes of ellipses will be denoted by a i and b i respectively, where the index i refers to one of the ellipses which contain the ith boundary components of an elliptic flower billiard table. Also c 2 = a 2 −b 2, where c is a half-length of the segment connecting the focuses of an ellipse. In this paper our main goal is to demonstrate in the simplest examples the richness of dynamics of the elliptic flowers billiards. Therefore in what follows we will consider the simplest billiards in this class called special one layer (SOL) elliptic flowers. Construction of special one layer elliptic flowers: Let A be an arbitrary convex polygon with n vertices. Consider the straight semi-lines which have the ends at the centers of the sides of A, are orthogonal to the corresponding sides, and do not intersect A. Then a special one layer elliptic flower is a billiard table with n boundary components, which are the arcs of ellipses with the focuses located at the ends of the small diagonals of A and the ends on two semi-lines orthogonal to the (intersecting) sides of A, which the corresponding small diagonal connects (Fig. 4). If A is a triangle, then the sides play also the role of small diagonals. The next statement shows that, there are structural elliptic flowers with an ergodic core if a regular base polygon has at least five sides. (It should be mentioned though that structural elliptic flowers built over non-regular triangles and rectangulars may also have ergodic dynamics on their core). Theorem 3.7. If a number of sides of the base regular polygon A is n ≥ 5, then there exist structured elliptic flowers Q(A) such that dynamics of the corresponding billiard, restricted to the core, is hyperbolic and ergodic. Proof. For the sake of clarity and brevity we will present a proof only for SOL elliptic flowers. Consider a hyperbolic and ergodic circular flower billiard, where all the corresponding circles have the same radius R, and the centers of all these circles are at the centers of the small diagonals of A. Recall that all circular arcs, which complement regular components of an ergodic circular flower to the entire circles, belong to the interior of the billiard table. Recall now that the maximal radius of curvature of the boundary of an ellipse with the parameters (semi-axes lengths) a and b equals The osculating circle with this maximal radius is tangent to an ellipse at an end of its small axis. We call such circle a maximal osculating circle. Substitute now each of these n circles by the tangent to them ellipses with the focuses located at the centers of the corresponding shortest diagonals of A and the small axis orthogonal to these diagonals. As a result of we obtain a special one layer elliptic flower Q(A), where the ends of the regular components of the boundary ∂Q(A) lie on the lines orthogonal to the sides of the regular polygon A at their centers. All n regular components of the boundary of Q(A) are the arcs of ellipses, each of which has focuses at the ends of the shortest diagonals A i, A (i+2) of A. In what follows we will refer to such diagonals of any polygon as to small diagonals (just having in mind that in a general convex polygon not all small diagonals could be also the shortest ones). Observe that there are no ellipses among them with the same focuses because n ≥ 5. Denote by l the length of sides of the base polygon A. Then the lengths of its small diagonals are equal to 2l cos(/n). So c in the relation equals l cos(/n). The centers of all ellipses are at the centers of the corresponding shortest (small) diagonals of the basic polygon A. The distances between these points and the center of the polygon A equal l(cos(2/n)) 2 sin(/n) Consider now the maximal osculating circle tangent to a boundary component at its point with the minimal curvature (i.e. at the end of the small axis of the corresponding ellipse). Take sufficiently large radius R for an ergodic circular flower over A. Observe that R = b, where b is the length of the small semi-axis of the ellipse tangent to a regular component of the boundary of the circular flower. It immediately follows from the relations and that for any n ≥ 5 the maximal osculating circle consists of two arcs. The first arc goes outside of the elliptic flower billiard table, and the second arc completely lies within the billiard table Q(A) if R is large enough or if c is small enough. In other words, both these conditions mean that the base polygon should be sufficiently small in comparison with the size of the elliptic flower billiard table Q(A). Take now any interior point q of any regular component of the boundary ∂Q(A). Then any straight segment, which connects q to any other regular component of the boundary will intersect the osculating circle at the point q within the billiard table Q(A). Sufficient conditions of ergodicity of the two-dimensional billiards were extensively studied (see e.g. ). However, the cores of elliptic flower billiards have the special property which allows to reduce these conditions just to one. Namely, any orbit in the core cannot have two consecutive reflections off one and the same regular component (an elliptic arc) of the boundary ∂Q(A). Therefore, it is enough for ergodicity that any link of any orbit in the core intersect both osculating circles of two ellipses at the points, which this link connect. Recall now that any orbit of the core of the elliptic flower billiard intersects the base polygon A between any two consecutive reflections off the boundary. Thus each link of such orbit intersect both osculating circles tangent to the boundary ∂Q(A) at the ends of this link. Therefore the defocusing mechanism ensures that dynamics in the core of the elliptic flower Q(A) is completely hyperbolic, i.e. it has nonvanishing Lyapunov exponents. The ergodicity of the dynamics in the core immediately follows from. Remark 3. Observe that the chaotic cores of the special one layer elliptic flowers are nonempty subsets of the base polygon A. The sizes of these subsets decrease when b = R increases. These cores are regular convex polygons, which, when b tends to infinity, converge to the polygon formed by the lines orthogonal to the sides of A at their ends. Remark 4. A necessary condition of ergodicity of a two-dimensional billiard says that all focusing components of the boundary should be absolutely focusing. However, all orbits of the core cannot have two consecutive collisions with one and the same regular component of the boundary. Therefore the absolute focusing condition does not play any role here. Observe also that in the papers dealing with general results on ergodicity of billiards only ergodicity in the entire phase space was studied, rather than ergodicity of dynamics on some subset of the phase space. However, the corresponding proofs can be applied word by word for our case, when the core is an ergodic component with a positive, but not full, measure. We will consider now conditions of hyperbolicity and ergodicity of dynamics in tracks. The orbits in tracks, in difference with the core, may have any number of consecutive reflections off the one and the same regular boundary component of an elliptic flower. Therefore, in dealing with tracks we will require all regular components of the boundary to be absolutely focusing. Recall that a C 2 -smooth focusing curve is absolutely focusing if any parallel beam of rays, which is fallen on, will leave this curve after any series of consecutive reflections off as a convergent (focused) beam. Proof. In what follows tracks, which are hyperbolic and ergodic, will be called chaotic tracks. Again for the sake of clarity and simplicity we will consider only special one layer flower billiards. Consider now (the same as above) small perturbations of the hyperbolic and ergodic circular flower, when all n equal circles become equal ellipses with focuses at the ends of the small diagonals of A. Let also their small axis equals 2R, and thus b = R. All n regular components of the boundary of Q(A) are the arcs of ellipses, each of which has focuses at the ends of the shortest diagonals A i, A (i+2) of A. Recall that there are no ellipses with the same focuses because n ≥ 5. The polygon A is regular and the corresponding circular flower has identical arcs of a circle with radius R. Therefore each of the circles containing a component of this circular flower intersects only two neighboring boundary components. We can keep this property for an elliptic flower by choosing sufficiently large (with respect to the size of the base polygon A) circles. Indeed, it immediately follows from the relation. Now, it follows from the symmetry of A and the symmetry of our construction that the maximal osculating circles to the ellipses, which form the boundary of elliptic flower billiard table intersect only two neighboring osculating circles. Besides any largest osculating circle does not contain the ends (which belong to the boundary of the billiard table) of the short diagonals of the neighboring osculating circles. Therefore divergence of the orbits beats convergence at any link of an orbit which connects two points of different boundary components. However in tracks, in difference with core, orbits may have any number of consecutive reflections off one and the same boundary components. Therefore each regular boundary component should be absolutely focusing. The condition for the symmetric arcs of ellipses with center at an end of the small diagonal of ellipse to be absolutely focusing was found in. This condition says that projections of these arcs to the large axis of ellipse should not exceed a/ √ 2. It is easy to see that this condition is satisfied if we choose sufficiently large R = b (for a fixed base polygon A with at least five sides). Clearly for regular triangles and for the squares this condition never holds. A sufficient condition of the absolute focusing for petals of SOL elliptic flowers can be obtained from an elementary geometric consideration. This sufficient condition of absolute focusing says that the angle between the minor axis of an ellipse and the line connecting the center of an ellipse to the end point of the corresponding component of the boundary (petal) must be smaller than /4. Clearly this angle is a decreasing function of the length b of the small axis, and the condition of the absolute focusing holds for sufficiently large R = b. By combining now the proofs of theorems and 3.2 and 3.7 we obtain Theorem 3.9. There exist hyperbolic elliptic flowers billiards with phase space consisting of three ergodic components of positive measure, which are two chaotic tracks and a chaotic core. Exactly the same proof, as the one of Theorem 3.8 goes again for special one layer elliptic flowers with at least five sided regular base polygon by perturbing a hyperbolic and ergodic circular flower with large circles. For general multilayered elliptic flowers a proof is quite analogous in logic but contains various extra trigonometric formulas. Once again, our goal in this paper is just to show that the dynamics described in theorems 3.7, 3.8 and 3.9 does exist in elliptic flowers. General multilayered elliptic flowers provide for more possibilities, some of which will be described in the last section. Wild Rose and Narcissus: the simplest elliptic flower billiards with chaotic tracks and chaotic core. It was shown above that, if an elliptic flower has chaotic tracks and chaotic core, then a minimal number of sides of a basic polygon A is five. Besides, a general multilayered elliptic flower billiard table, built over a 5-polygon, has more than five petals (regular components of the boundary). We give now the simplest example of an elliptic flower with all the properties considered in the theorems 3.7, 3.8 and 3.9. (It can be done by choosing b either large or small enough). Consider a regular convex pentagon A. Construct now a special one layer (SOL) elliptic flower over A. This flower has five petals, and therefore it can be naturally called a wild rose elliptic flower billiard. Let also each ellipse containing these petals have focuses at the ends of the corresponding small diagonal of A. It was shown in Theorem 3.9 that this billiard has a chaotic core surrounded by chaotic tracks if the size of the base pentagon A is relatively small in comparison with the size of the corresponding billiard table Q(A). This wild rose billiard is the simplest one to built in a lab. Observe also that an experimenter can choose a relevant size of this devise. Another simple example is the Narcissus billiard, which is built over a regular hexagons exactly at the same fashion as the wild rose was built over a regular pentagon (Fig. 4). Some Open Questions and Conjectures As it was shown above, elliptic flower billiards demonstrate a large variety of behaviors, some of which have never been observed before, or even conjectured to exist. Therefore the first natural general question for the future studies of elliptic flowers is to understand how the changes in the dynamics of these billiards occur. Elliptic flower billiard can be specified by several parameters, all of which have a clear and visual geometric meaning. Therefore various types of bifurcations, which occur in these billiards, could be described in some clear geometric terms. Certainly, some trivial answers are immediately there, e.g. how a core may loose ergodicity by acquiring elliptic periodic orbit(s). However, a question on appearance of "vortices" with regular dynamics within chaotic flows in tracks is, certainly, of interest. Another question is whether immediately infinitely many vortices appear in chaotic tracks as a result of such transition. A general intuition suggests that it is likely the case. However, even in this situation it would be interesting to look at the structure of the set of vortices, and determine whether or not there is some kind of "coherence" between them. Another interesting issue, although probably essentially a technical one, is about construction of elliptic flowers with some specific properties for any convex polygon taken as a base. The results of the present paper were intentionally dealing with the simplest situation, when the base polygon is regular. There are still, at least theoretical, possibilities that there exist elliptic flowers billiards, which have some interesting properties not considered in the present paper. Recall that in all the examples of multilayered elliptic flower billiards, studied in the present paper, all petals (regular components of the boundary) belonged only to the first or to the second layer of the base polygon. Moreover, mostly even the simpler class of special one layer elliptic flowers was analysed. One may expect that the studies of elliptic flowers with the higher levels petals will bring some new examples of an unseen before behaviors, which are amenable to rigorous studies. Observe also that all elliptic flowers considered in our paper had C 0 boundary. However, it is easy to construct elliptic flowers with C 1 and with C 2 boundaries. (See, for instance, the string construction described in the section 2). Could such elliptic flowers billiards demonstrate analogous properties to the ones studied here? Certainly the tracks will be there, but it is not so clear about other features. Intriguing could be also the future studies of quantum elliptic flowers billiards. One may expect to see some new surprises there. Another general question is whether it is possible to construct billiards with similar dynamics when a core is any convex set on a plane rather than a polygon. |
In honor of the way United Airlines re-accommodates its excess passengers, I decided to do a list today of the Best Airplane Movies.
Most of the movie's action has to take place in flight, which rules out "The Aviator" and other movies about planes that mostly take place on the ground. It also needs to involve nonmilitary flight, which excludes lots of war movies and "Top Gun."
Clearly, this leaves out a lot of really good movies that have great flying sequences. And in some cases, it's a close call that you're welcome to dispute. Does "Flight of the Phoenix" -- I preferred the old one -- qualify? Most of that took place in the desert after the plane crashed, so I decided no. How about "Flight," "Sully" or "Fearless," which have incredible scenes on board planes? Same decision. They're primarily about what happens after the plane lands or crashes.
1. Airplane! Easy choice for No. 1. One of the funniest movies ever, and it launched new comedic careers for several actors -- Leslie Nielsen and Lloyd Bridges, for starters -- previously known for drama.
2. The Right Stuff. I'm cheating here, but there are great flight sequences on planes and in space, so I decided to go with it. This story about the early days of our manned space program is a fantastic ode not just to the astronauts but to test pilots like Chuck Yeager.
3. Air Force One. Harrison Ford makes a great president, and I never get tired of watching this movie about terrorists who seize the president's plane.
4. Con Air. Newly released-from-prison Nicolas Cage, on his way home to reunite with his wife and daughter, battles psychotic convicts led by the great John Malkovich.
5. Spirit of St. Louis. I have a soft spot for this story of Charles Lindbergh's historic flight across the Atlantic, even if James Stewart was way too old for the role. This and the book it was based on helped me better picture just how amazing Lindbergh's feat was.
6. Airport. This was the movie that not only launched a long series of other, lesser Airport movies but also provided some of the inspiration for "Airplane!" An all-star cast helped elevate the melodrama here.
7. Only Angels Have Wings. Terrific 1939 Cary Grant flick about a South American air freight company. I decided there are enough different flight scenes to qualify, but I admit it's borderline. Watch for it on TCM.
8. Snakes on a Plane. Ridiculous but wildly entertaining, anchored by the great Samuel L. Jackson. I saw this in a theater, and the audience reaction was almost as much fun as the movie.
9. United 93. Tense, real-time drama about the events of 9/11, focused on the passengers and crew of the plane that crashed in Shanksville and turned "Let's roll" into a national catchphrase for heroism.
10. The Great Waldo Pepper. Lots of terrific flying sequences, with Robert Redford as a barn-storming pilot.
Which ones did I miss? |
<gh_stars>1-10
import "../../package"
import * as React from "react"
import {Component} from "react"
import * as _ from "lodash"
import * as moment from "moment"
import {Button, Container, Dimmer, Form, Icon, Image, Input, Loader, Message, Step,} from "semantic-ui-react"
import {DailyCards} from "./DailyCards"
import Task, {TaskUpdateParameter} from "../models/Task"
import CommonConfig from "../models/CommonConfig"
import Project from "../models/Project"
import Label from "../models/Label"
import {DragDropContext} from "react-dnd"
import ReduxToastr, {toastr} from "react-redux-toastr"
import Icebox from "./Icebox"
import UiConfig from "../models/UiConfig"
import NavigationMenu from "./NavigationMenu"
import {INITIAL_SHARED_STATE} from "../reducers/index"
import IconFilter from "./IconFilter"
import Filter from "../models/Filter"
import HTML5Backend from 'react-dnd-html5-backend'
const Steps = ({ activeGroupIndex }: { activeGroupIndex: number }) => (
<Step.Group>
<Step disabled={activeGroupIndex !== 0}>
<Image
size="tiny"
src="https://d1x0mwiac2rqwt.cloudfront.net/bab0a0c4b1c3135a24bd0518417b66e3/as/logo_todoist_schema.png"
/>
<Step.Content title="STEP 1: Set token" description="Set your todoist token to sync tasks and any more" />
</Step>
<Step disabled={activeGroupIndex !== 1}>
<Image
size="tiny"
src="https://www.google.co.jp/images/branding/googleg/1x/googleg_standard_color_128dp.png"
/>
<Step.Content
title="STEP 2: Login"
description="Login with your google account to sync settings in your devices"
/>
</Step>
</Step.Group>
)
export interface TopProps {
tasks: Task[]
projects: Project[]
labels: Label[]
isLoading: boolean
guardLoading: boolean
error: Error
config: CommonConfig
uiConfig: UiConfig
filter: Filter
token: string
isTokenUpdating: boolean
tokenUpdateError: Error
auth: any
authError: any
profile: any
onReload: () => void
onBackgroundReload: () => void
onUpdateTask: (parameter: TaskUpdateParameter) => void
onRemoveTask: (id: number) => void
onChangeConfig: (config: CommonConfig) => void
onChangeUiConfig: (config: UiConfig) => void
onChangeFilter: (filter: Filter) => void
onUpdateToken: (token: string) => void
onLogin: (provider: string) => void
onLogout: () => void
}
export interface TopState {
hasErrorToast: boolean
inputToken: string
}
const readyToLoadingTasks = (config: CommonConfig): boolean => {
return !_.isEmpty(config)
}
@DragDropContext(HTML5Backend)
export default class extends Component<TopProps, TopState> {
constructor(props: TopProps) {
super(props)
this.state = {
hasErrorToast: false,
inputToken: props.token,
}
this.onChangeFilterWord = _.debounce(this.onChangeFilterWord, 500)
this.onBackgroundReload = this.onBackgroundReload.bind(this)
}
componentWillReceiveProps(nextProps: TopProps) {
// props変わったぜ! AND firebaseとしてロード完了&何かとれたよー
if (!_.isEqual(this.props.config, nextProps.config) && readyToLoadingTasks(nextProps.config)) {
nextProps.onReload()
}
// XXX: mumumumumu....
if (nextProps.auth.isLoaded && !nextProps.config) {
nextProps.onChangeConfig(INITIAL_SHARED_STATE.config);
}
// Error toaster handlings (Avoid infinite loop)
if (!_.isEqual(this.props.error, nextProps.error)) {
if (nextProps.error) {
toastr.error(nextProps.error.name, nextProps.error.message, {
showCloseButton: false,
removeOnHover: false,
})
this.setState({ hasErrorToast: true })
} else {
if (this.state.hasErrorToast) {
toastr.removeByType("error")
this.setState({ hasErrorToast: false })
}
}
}
}
componentDidMount() {
window.addEventListener("focus", this.onBackgroundReload, true)
}
componentWillUnmount() {
window.removeEventListener("focus", this.onBackgroundReload)
}
onChangeFilterWord(word) {
this.props.onChangeFilter({ ...this.props.filter, ...{ word } })
}
onBackgroundReload() {
if (readyToLoadingTasks(this.props.config)) {
this.props.onBackgroundReload()
}
}
render() {
const needsValidTodoistToken = !this.props.token || this.props.tokenUpdateError
const needsLogin = this.props.auth.isLoaded && this.props.auth.isEmpty
if (needsValidTodoistToken) {
return (
<Container textAlign="center" style={{ marginTop: 60 }}>
<Steps activeGroupIndex={0} />
<Form onSubmit={() => this.props.onUpdateToken(this.state.inputToken)}>
<Form.Field inline required>
<label>
<Icon name="pencil" />Todoist API token
</label>
<Form.Input
type="password"
name="todoistToken"
value={this.state.inputToken}
onChange={(e, { name, value }) => this.setState({ inputToken: value })}
/>
</Form.Field>
<Button loading={this.props.isTokenUpdating}>Submit</Button>
<Message error visible={!!this.props.tokenUpdateError}>
Token is invalid!!
</Message>
</Form>
</Container>
)
}
if (needsLogin) {
return (
<Container textAlign="center" style={{ marginTop: 60 }}>
<Steps activeGroupIndex={1} />
<div style={{ padding: 50 }}>
<Button color="google plus" onClick={() => this.props.onLogin("google")}>
Login with Google
</Button>
</div>
</Container>
)
}
if (!readyToLoadingTasks(this.props.config)) {
return (
<div>
<Dimmer active page>
<Loader
content="Loading settings of your account..."
size="huge"
active={this.props.isLoading}
/>
</Dimmer>
</div>
)
}
return (
<div>
<NavigationMenu
projects={this.props.projects}
labels={this.props.labels}
config={this.props.config}
uiConfig={this.props.uiConfig}
isLoading={this.props.isLoading}
onReload={this.props.onReload}
onLogout={this.props.onLogout}
onChangeConfig={this.props.onChangeConfig}
onChangeUiConfig={this.props.onChangeUiConfig}
/>
<div style={{ padding: 10, marginTop: 70 }}>
<Dimmer active={this.props.isLoading && this.props.guardLoading} page>
<Loader
content="Loading"
size="huge"
active={this.props.isLoading && this.props.guardLoading}
/>
</Dimmer>
<div
style={
this.props.uiConfig.filter
? {
opacity: 1,
maxHeight: "100%",
transformOrigin: "top",
transition: "all 0.5s",
}
: {
opacity: 0,
maxHeight: 0,
transformOrigin: "top",
transition: "all 0.5s",
}
}
>
<div style={{ display: "flex", justifyContent: "flex-end", paddingTop: 10, paddingBottom: 20 }}>
<Input
placeholder="Filter task name by regexp"
icon="filter"
iconPosition="left"
style={{ width: 300, marginRight: 20 }}
onChange={(e, data) => this.onChangeFilterWord(data.value)}
/>
<IconFilter
icons={_(this.props.tasks)
.map(t => t.icon)
.uniq()
.value()}
iconDisabledMap={this.props.filter.iconDisabledMap}
onChangeIconDisabledMap={iconDisabledMap =>
this.props.onChangeFilter({ ...this.props.filter, ...{ iconDisabledMap } })
}
/>
</div>
</div>
<div
style={
this.props.uiConfig.icebox
? {
overflowY: "scroll",
position: "fixed",
height: "85vh",
transition: "all 0.5s",
}
: {
transform: "translate(-400px)",
transition: "all 0.5s",
position: "fixed",
}
}
>
<Icebox
tasks={this.props.tasks.filter(x => !x.dueDate)}
taskSortField={this.props.uiConfig.taskSortField}
taskOrder={this.props.uiConfig.taskOrder}
milestone={this.props.uiConfig.milestone}
seal={this.props.uiConfig.seal}
filter={this.props.uiConfig.filter ? this.props.filter : undefined}
onUpdateTask={this.props.onUpdateTask}
onRemoveTask={this.props.onRemoveTask}
width={350}
/>
</div>
<div
style={
this.props.uiConfig.icebox
? {
transform: "scale(0.9, 0.9)",
transformOrigin: "top",
transition: "all 0.5s",
marginLeft: 350,
}
: {
transformOrigin: "top",
transition: "all 0.5s",
}
}
>
<DailyCards
baseDate={moment()}
tasks={this.props.tasks.filter(x => x.dueDate)}
taskSortField={this.props.uiConfig.taskSortField}
taskOrder={this.props.uiConfig.taskOrder}
timeLamps={this.props.uiConfig.timeLamps}
lampTime={this.props.config.lampTime}
milestone={this.props.uiConfig.milestone}
seal={this.props.uiConfig.seal}
warning={this.props.uiConfig.warning}
isTasksExpanded={this.props.uiConfig.isTasksExpanded}
minutesToUsePerDay={this.props.config.minutesToUsePerDay}
minutesToUsePerSpecificDays={this.props.config.minutesToUsePerSpecificDays.dict || {}}
numberOfCards={this.props.uiConfig.numberOfCards}
numberOfCardsPerRow={this.props.uiConfig.numberOfCardsPerRow}
onlyWeekday={this.props.uiConfig.onlyWeekday}
filter={this.props.uiConfig.filter ? this.props.filter : undefined}
onUpdateTask={this.props.onUpdateTask}
onRemoveTask={this.props.onRemoveTask}
/>
</div>
</div>
<ReduxToastr
timeOut={0}
newestOnTop={false}
preventDuplicates
position="bottom-right"
transitionIn="fadeIn"
transitionOut="fadeOut"
/>
</div>
)
}
}
|
Optimal Timing to Purchase Options We study the optimal timing of derivative purchases in incomplete markets. In our model, an investor attempts to maximize the spread between her model price and the offered market price through optimally timing her purchase. Both the investor and the market value the options by risk-neutral expectations but under different equivalent martingale measures representing different market views. The structure of the resulting optimal stopping problem depends on the interaction between the respective market price of risk and the option payoff. In particular, a crucial role is played by the delayed purchase premium that is related to the stochastic bracket between the market price and the buyer's risk premia. Explicit characterization of the purchase timing is given for two representative classes of Markovian models: (i) defaultable equity models with local intensity; (ii) diffusion stochastic volatility models. Several numerical examples are presented to illustrate the results. Our model is also applicable to the optimal rolling of long-dated options and sequential buying and selling of options. |
Book Review and Notice: Religious and Spiritual Groups in Modern America his Introduction. With the above thought as a startingpoint, Cluff proceeds to outline the various types of psychic phenomena (extrasensory perception, biofeedback, outof-body experiences, etc.) along with backup material to demonstrate the documentation of such occurrences. After giving the reader a concise background in the terminology of the psychic researcher, he examines some leading psychics and the implications of interaction with spiritual entities both good and evil (angels and demons). Cluff carefully examines the biblical approach to spiritual communication and gives a set of intelligent guidelines for "Other Entity Involvement." The approach here is one of assurance that God is on our side, and because of our faith in Him, we need not fear anything, and can therefore be open to communication, yet cautious. On the basis of this open thinking, and the current parapsychological research, Cluff goes on to construct a suggested cosmology, fitting together the pieces of the psychic/spiritual/mystical puzzle. Hence, a whole new world of thinking is open to the reader. Cluff has made an excellent attempt at integrating the study of parapsychology and theology. This is a very delicate field, because of the long-standing prejudice against such "occult" subjects. The emphasis is that what we once thought of as being occult or hidden is now being revealed as a part of God's creation, and a very natural part of this spiritual reality that the Church has so long spoken of. The author speaks not only in terms of research that he has read about, but in terms of personal experience as well, thus giving credence to his writings. In a time when we have been sucked into the materialistic/social action machinery, and the Christian faith has become so diluted through demythologizing and secularizing, this small book opens up the spiritual doors that the Church has long ago closed to its people. Every c1ergyperson should read this book not only because of its fresh, openminded approach, but also because the field of psychic research is so popular today, and so much a part of our culture. The minister (especially the pastoral counselor) who knows nothing about psychic research will find that many of his people will seek out occult and mystical groups rather than Church-related prayer groups. The psychically naive pastor will lose many of his sheep to another fold. Cluff's biblical parallels are important for clergy who wish to begin a study of this field. Most modern writings in parapsychology are concerned only with hardcore physical data, where this author is more concerned with how these physical data can relate to and enhance our faith. Not that explanations of how the miracles and supernatural events happened will give us faith, but, rather, that demonstrations of God's work in the world about us will strengthen the faith that is there. Regrettably, Cluff does not really deal with the false psychic experience, and even naively accredits a stage mentalist (magician) with being a psychic who could predict newspaper headlines weeks before they appeared. However, this volume is a good primer for the sensitive pastor and counselor. Cluff has given the Christian community a valuable contribution, and has paved the way for further work in this important area of pastoral concern. |
A new parking garage coming to downtown Palo Alto that would provide 339 spots and expected to cost more than $20 million. The new structure is estimated to be finished in 2020. Weekly file photo.
For the second time in two weeks, the Palo Alto City Council approved on Tuesday night moving ahead with construction of a new garage that would add hundreds of spots to a badly congested commercial area.
But unlike the parking structure that the council approved for the California Avenue area earlier this month, the five-story downtown garage would have a retail component, the council decided by a unanimous vote. Once built, the new facility would have about 339 spaces and one level of basement parking.
The council's unanimous vote underscores the severe nature of downtown's parking challenges. While members are typically extremely cautious about approving tall and bulky buildings in the downtown area, the new garage moved ahead despite its 50-foot height. And just like with the California Avenue facility, the council agreed to go with the priciest of the options, choosing the only alternative on the menu that includes a basement.
The new garage would go up on the corner of Hamilton Avenue and Waverley Street, currently the site of a city-owned parking lot with 86 spaces.
Public Works staff had recommended moving ahead with a five-story garage with a retail component but without a basement. That proposal would have accommodated about 291 cars. The one that the council approved would have 339 spaces, up to 3,800 square feet of retail and a price tag of more than $20 million.
While the council agreed that it's critical to boost downtown's parking supply, Councilwoman Karen Holman wondered about the visual impact of the new facility. Most buildings around Hamilton and Waverley are one or two stories, she noted.
But despite Holman's concerns about whether the new garage will satisfy downtown's urban-design guidelines, others were more comfortable moving ahead with the new facility, which is part of an infrastructure plan that the council approved in 2014.
Vice Mayor Liz Kniss, who made the motion to include a basement and retail in the new garage, said construction of the facility is compatible with the council's other recent actions on parking, including a new permit program aimed at steering downtown employees away from residential streets. The different parking initiatives, she said, "really play into each other."
"We're talking about supply," Kniss said. "This is more supply -- pretty substantial supply."
Councilman Tom DuBois was less excited about going with the most expensive option and leaned toward the cheaper alternative proposed by staff.
"I don't think we can go with a Cadillac version on every single infrastructure project," DuBois said.
If things go as planned, the city will complete the design of the new garage by September 2018 and complete construction by winter 2020.
A Cadillac> Seriously? How about a Bentley or an Aston Martin? If you're going to stick your kids with uncontrolled deficit spending and $500,000,000 in unfunded pension liabilities, let them see where all our money goes.
On the very same night, the City Council votes to implement parking meters to *discourage* driving and to build a parking garage to *encourage* driving.
That clinking clanking sound of money, money, money, money.
The garage is needed. It will make it easier to find parking. At very least they can reduce parking of all day workers in the adjacent residental neighborhoods.
This is a vicious cycle - allow giant buildings that don't have enough parking and then make taxpayers build garages for downtown developers and office buildings to park the employees of these buildings. I say this ins't not our problem. Kick these workers out of the residential areas and make their employers and the developers buy and run their own garages.
We don't need another oversized eye sore of a building downtown. Our recently elected council people either never really believed that they represent the residents of Palo Alto who elected them or the tens of thousands of dollars of developer contributions (reported after the election) have swayed them to the development side. This parking garage is a give away to developers and does nothing for residents except take our money and give it away. Money that could be used for parks, playing fields, pools, more summer classes, better roads and other infrastructure to make residents lives better - but no we have to keep the developers happy.
Now that we will have more parking I'm sure that city management will continue to allow massive offices to go up and up. The whole city management is about overdeveloping and destroying Palo Alto so that they and their friends can get rich.
It is only a viscous cycle if you are a resident. If you are a real-estate developer, or one of the real-estate industry's servitors in government, it is a virtuous cycle.
parking, not angle. The lot is a disaster as marked. The City is oblivious to what it is doing.
Street markings and configurations at Jordan on Middlefield and Cal Ave have created dangerous conditions with sharp turns and narrow lanes and visual distraction. The roundabout at Cowper and Coleridge is an absolute atrocity.
Why are cars so much larger, and therefore more difficult to park, than they were in the past? Seems NUTS!
Totally agree with Out of Control that the city is oblivious and/or sadistic.
Why are they adding so many giant Botts Dots? The ones on Middlefield are intrusive and prevent cars from making their turns off an already clogged street.
Really dangerous are the ones on Embarcadero leading to northbound Alma. They protrude 1/3 of the way into the off ramp and force cars trying to avoid them to swerve back into jammed Embarcedero.
There's NO cross-vehicular traffic just before the underpass. WHY are they there??
Does someone have the giant Botts Dots franchise?
I'm distressed that our beloved neighborhood toy store is closing and instead a giant, ugly garage will replace it to service our of towners. Locals depend on stores like the toy store. Our children grew up with gifts from there and we have find memories. Similarly the art supply store was driven out and replaced by a useless boutique watch shop. This is tearing up the fabric of our town as the city optimizes for our of towners and developers, paying scant attention to residents. Shame on our officials for they are selling us out. |
Merging Arts and Bioethics: An Interdisciplinary Experiment in Cultural and Scientific Mediation How to engage the public in a reflection on the most pressing ethical issues of our time? What if part of the solution lies in adopting an interdisciplinary and collaborative strategy to shed light on critical issues in bioethics? An example is Art+Biothique, an innovative project that brought together bioethicists, art historians and artists with the aim of expressing bioethics through arts in order to convey the "sensitive" aspect of many health ethics issues. The aim of this project was threefold: 1) to identify and characterize mechanisms for the meeting of arts and bioethics; 2) to experiment with and co-construct a dialogue between arts and bioethics; and 3) to initiate a public discussion on bioethical issues through the blending of arts and bioethics. In connection with an exhibition held in March 2016 at the Espace Projet, a non-profit art space in Montral (Canada), the project developed a platform that combined artworks, essays and cultural & scientific mediation activities related to the work of six duos of young bioethics researchers and emerging artists. Each duo worked on a variety of issues, such as the social inclusion of disabled people, the challenges of practical applications of nanomedicine and regenerative medicine, and a holistic approach to contemporary diseases. This project, which succeeded in stimulating an interdisciplinary dialogue and collaboration between bioethics and arts, is an example of an innovative approach to knowledge transfer that can move bioethics reflection into the public space. |
with inp = ~calldataload(0):
foo = inp
exp = 0
while foo >= 256:
foo = ~div(foo, 256)
exp += 1
with x = ~div(inp, 16 ** exp):
while 1:
y = ~div(x + ~div(inp, x) + 1, 2)
if x == y:
return x
x = y
|
<reponame>audacious-software/PassiveDataKit-Android<gh_stars>1-10
package com.audacious_software.passive_data_kit.generators.environment.services;
import android.app.IntentService;
import android.content.Intent;
import com.audacious_software.passive_data_kit.Logger;
import com.audacious_software.passive_data_kit.generators.environment.Geofences;
import com.google.android.gms.location.Geofence;
import com.google.android.gms.location.GeofenceStatusCodes;
import com.google.android.gms.location.GeofencingEvent;
import java.util.HashMap;
import java.util.List;
import androidx.annotation.Nullable;
public class GeofencesService extends IntentService {
public GeofencesService() {
super("Passive Data Kit Geofence Service");
}
public GeofencesService(String name) {
super(name);
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {
GeofencingEvent geofencingEvent = GeofencingEvent.fromIntent(intent);
long now = System.currentTimeMillis();
if (geofencingEvent.hasError()) {
HashMap<String, Object> payload = new HashMap<>();
payload.put("error_code", geofencingEvent.getErrorCode());
switch (geofencingEvent.getErrorCode()) {
case GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE:
payload.put("error", "GEOFENCE_NOT_AVAILABLE: Geofence service is not available now.");
break;
case GeofenceStatusCodes.GEOFENCE_TOO_MANY_GEOFENCES:
payload.put("error", "GEOFENCE_TOO_MANY_GEOFENCES: App has registered more than 100 geofences.");
break;
case GeofenceStatusCodes.GEOFENCE_TOO_MANY_PENDING_INTENTS:
payload.put("error", "GEOFENCE_TOO_MANY_PENDING_INTENTS: App has provided more than 5 different PendingIntents.");
break;
default:
payload.put("error", "Non-geofence error code encountered.");
}
Logger.getInstance(this).log("pdk_geofence_error", payload);
} else {
String transition = Geofences.GEOFENCE_TRANSITION_UNKNOWN;
switch (geofencingEvent.getGeofenceTransition()) {
case Geofence.GEOFENCE_TRANSITION_DWELL:
transition = Geofences.GEOFENCE_TRANSITION_DWELL;
break;
case Geofence.GEOFENCE_TRANSITION_ENTER:
transition = Geofences.GEOFENCE_TRANSITION_ENTER;
break;
case Geofence.GEOFENCE_TRANSITION_EXIT:
transition = Geofences.GEOFENCE_TRANSITION_EXIT;
break;
}
List<Geofence> triggeringGeofences = geofencingEvent.getTriggeringGeofences();
for (Geofence fence : triggeringGeofences) {
Geofences.getInstance(this).recordTransition(fence.getRequestId(), transition, now);
}
}
}
}
|
from person import Person
class CareTaker(Person):
def __init__(self, type, name, address, dob, email, bloodgroup):
super().__init__(name, address, dob, email, bloodgroup)
self.type = type
def get_type(self):
return self.type
c1 = CareTaker(0, "saurabh", "ii<NAME>", "30/07/1996", "<EMAIL>", "B+")
print(c1.get_type())
print(c1.get_dob()) |
Much debate has taken place over the last few months concerning raising the minimum wage in New Jersey to $15 an hour. The sticking point in the debate centered on the type of employees covered by the minimum wage legislation and what the phase-in period should be. Super markets and roller staking rinks, that employee lots of teens, rightfully felt strongly that the legislation should have a carve-out for unskilled youngsters who were 16-18 years of age.
In Governor Murphy’s January 15th State of the State address he renewed his commitment to the drive for $15 and mentioned it in regard to the dilemma of ALICE an acronym for Asset Limited Income Constrained Employed and used to describe hard working people who are employed yet struggle from pay check to pay check. There are 41,066 ALICE households in Mercer County.
The United Way of Northern New Jersey publishes an annual ALICE report that quantifies the cost of a basic household budget in each of the New Jersey’s counties and shows how many working families are struggling to survive. ALICE represents the thousands of hard working families in New Jersey who have jobs but are unable to afford the basic necessities of housing, food child care, health care and transportation. A sizeable portion of these folks face homelessness due to inadequate wages.
On January 17th, Governor Murphy announced that he and legislative leaders had resolved the sticking points and struck a “historic” deal on a $15 minimum wage. The resolution would result in a gross increase from the existing minimum wage of $8.85 an hour to $15 by January of 2024 (farmer workers would go to $12.50 in 2024 and employees of small businesses and seasonal workers to $15 in 2026 – there was no special provision to reduce the wage increase for teenagers). When fully implemented, this would result in over a $1,000-month gross increase in wages for a person working 40 hours a week and thus hopefully allowing them to maintain housing in our high housing cost State (a 40-hour per week worker would earn $31,200 up from $18,400).
The actual amount received will be slightly less due to FICA and other mandatory pay roll deductions. The downside is that the present timetable for the phase in of the legislation brings the rate up to $10 on July 1, 2019 and subsequently brings the wage to $11 an hour in January of 2020 with the next $1 increase not scheduled until January of 2021. As such, the gross increase after the July, 2019 will only increase their gross earnings by about $200 a month and $372 a month in January of 2020. While the deal that was struck will help hundreds of thousands of people, it is doubtful that it will provide sufficient resources to solve the housing problem faced by many of the ALICE population who are struggling to maintain housing while the minimum wage legislation is being phased-in.
Fortunately, there is a simple solution to partially address this problem, which is to create a time-limited Shallow Subsidy Program which will allow ALICE and other low-income populations to avert a housing crisis during the ramp up of the minimum wage legislation. This program would not be an open-ended entitlement program for all ALICE persons. It is targeted toward those who are homeless or at risk of loss of housing and who would meet all other criteria of the program.
The concept of a general Shallow Subsidy Program has been discussed as a viable solution to low income populations without adequate income to maintain housing for many years. There is no reason to doubt that it would be effective for the population outlined above. Essentially, it would provide a small ($300-$500 a month) time-limited (1-3 years) rental subsidy for persons who are extremely rent burdened and whose housing expenses are over 65%-70% of their household income.
It is important to point out that this column is proposing a fiscally prudent Shallow Subsidy Program specifically for persons whose housing insecurity would be resolved by the minimum wage legislation. As such, the adult recipient of the subsidy would have to be employed, be homeless or at risk of loss of housing and that after receiving the time-limited Shallow Subsidy the household would no longer be extremely rent burdened and could achieve self-sufficiently thought their increase of wages pursuant to the increase to the minimum wage.
Instead of providing millions of dollars in Economic Development Authority subsidies to companies that never provide jobs, why not provide stable housing to hard working folks like Vanessa Sullivan, who lives in Trenton’s East Ward, and was the focus of a lengthy profile in The New York Times Magazine, by Princeton University Sociology Professor Dr. Mathew Desmond, entitled “Why Work Doesn’t Work Anymore.” This is the kind of pragmatic not pie-in-the-sky progressive solutions that the Murphy Administration needs to implement to address the State’s growing inequality gap.
Irwin Stoolmacher is the President of the Stoolmacher Consulting Group, a fundraising and strategic planning consulting firm that works with nonprofit agencies that serve the truly needy among us.
'The witch hunt is over' - or 'I'm f***ed'? |
Similarities and Differences among Protein Dynamics Studied by Variable Temperature Nuclear Magnetic Resonance Relaxation. Understanding and describing the dynamics of proteins is one of the major challenges in biology. Here, we use multifield variable-temperature NMR longitudinal relaxation (R1) measurements to determine the hierarchical activation energies of motions of four different proteins: two small globular proteins (GB1 and the SH3 domain of -spectrin), an intrinsically disordered protein (the C-terminus of the nucleoprotein of the Sendai virus, Sendai Ntail), and an outer membrane protein (OmpG). The activation energies map the motions occurring in the side chains, in the backbone, and in the hydration shells of the proteins. We were able to identify similarities and differences in the average motions of the proteins. We find that the NMR relaxation properties of the four proteins do share similar features. The data characterizing average backbone motions are found to be very similar, the same for methyl group rotations, and similar activation energies are measured. The main observed difference occurs for the intrinsically disordered Sendai Ntail, where we observe much lower energy of activation for motions of protons associated with the protein-solvent interface as compared to the others. We also observe variability between the proteins regarding side chain 15N relaxation of lysine residues, with a higher activation energy observed in OmpG. This hints at strong interactions with negatively charged lipids in the bilayer and provides a possible mechanistic clue for the "positive-inside" rule for helical membrane proteins. Overall, these observations refine the understanding of the similarities and differences between hierarchical dynamics in proteins. |
/* eslint-disable sonarjs/no-duplicate-string */
import {
Append,
IfNotExists,
Min,
Minus,
Plus,
Pop,
Remove,
ThothError,
} from "@thothom/core";
import { getExpressionAttributeValues } from "../../../lib/utils/get-data-properties/get-expression-attribute-values";
import { mapData } from "../../../lib/utils/get-data-properties/helpers/map-data";
import { formatWhere } from "../../../lib/utils/get-where-properties/helpers/get-array-where";
describe("getExpressionAttributeValues", () => {
describe("With simple entity", () => {
it("should return mapped keys and values", () => {
const formattedData = formatWhere({
foo: "foo",
bar: "bar",
fooBar: "fooBar",
barFoo: "barFoo",
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result).toStrictEqual({
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEbar": { S: "bar" },
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEbarfoo": { S: "barFoo" },
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEfoo": { S: "foo" },
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEfoobar": { S: "fooBar" },
});
});
it("should return mapped keys and values (Append SaveOperator)", () => {
const formattedData = formatWhere({
bar: Append(1, 2),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result).toStrictEqual({
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEbar": { L: [{ N: "1" }, { N: "2" }] },
// eslint-disable-next-line @typescript-eslint/naming-convention
":emptyList": { L: [] },
});
});
it("should return mapped keys and values (IfNotExists SaveOperator)", () => {
const formattedData = formatWhere({
bar: IfNotExists(1),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(result).toStrictEqual({ ":UPDATEbar": { N: "1" } });
});
it("should return mapped keys and values (Plus SaveOperator)", () => {
const formattedData = formatWhere({
bar: Plus(1),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(result).toStrictEqual({ ":UPDATEbar": { N: "1" } });
});
it("should return mapped keys and values (Minus SaveOperator)", () => {
const formattedData = formatWhere({
bar: Minus(1),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(result).toStrictEqual({ ":UPDATEbar": { N: "-1" } });
});
it("should return mapped keys and values (Remove SaveOperator)", () => {
const formattedData = formatWhere({
bar: Remove(),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result).toStrictEqual({});
});
it("should return mapped keys and values (Pop SaveOperator)", () => {
const formattedData = formatWhere({
bar: Pop(1),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result).toStrictEqual({});
});
});
describe("With nested entity", () => {
it("should return mapped keys and values", () => {
const formattedData = formatWhere({
foo: {
bar: "bar",
},
fooBar: {
barFoo: "barFoo",
},
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result).toStrictEqual({
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEfooBar": { S: "bar" },
// eslint-disable-next-line @typescript-eslint/naming-convention
":UPDATEfoobarBarfoo": { S: "barFoo" },
});
});
});
describe("General errors", () => {
it("should throw error with Min operator", () => {
const formattedData = formatWhere({
bar: Min(1),
});
const { valuesMap } = mapData(formattedData);
let result: any;
try {
result = getExpressionAttributeValues(valuesMap);
} catch (err: any) {
result = err;
}
expect(result instanceof ThothError).toBeTruthy();
expect(result.code).toBe("NOT_IMPLEMENTED");
expect(result.origin).toBe("THOTHOM");
expect(result.message).toBe("Invalid SaveOperator");
expect(result.details).toStrictEqual([
'Dynamodb doesn\'t support SaveOperator "min"',
]);
});
});
});
|
Morphologic and morphometrical study of the muscle spindle in muscular dystrophy. OBJECTIVE To determine the morphologic and the morphometrical features of spindles in biopsies of patients with different types of muscular dystrophy and investigate the possible involvement of the spindle in the pathologic process of these diseases. STUDY DESIGN The following variables were studied in biopsy specimens from 10 patients with Duchenne or Becker dystrophy, 9 with limb-girdle dystrophy, 3 with congenital dystrophy and 3 with facioscapulohumeral dystrophy: diameter and area of spindle; thickness of the capsule; number, diameter and area of intrafusal fibers; and number and area of nuclei. RESULTS The statistical evaluation of the data showed significant differences regarding the thickness of the capsule, which was greater in patients than in controls, while the diameter and the area of the fibers were all smaller in patients than in controls. The area of nuclei of fibers was increased; this was a common feature for all types of muscular dystrophy. CONCLUSION These findings indicate that the spindle possibly participates in the pathologic process of different types of muscular dystrophies. |
Market Forces in European Soccer1 Recent decades have witnessed major changes in the market for European soccer. The most profound were the Bosman ruling, which lifted restrictions in the European labor market for soccer talent, and the introduction of the Champions League, a high-profile international competition that generates high revenues for participating clubs. This paper studies the effects of these changes on the closeness of national and international competitions, from both a theoretical and an empirical perspective. We show that competitive balance in national competitions has not been affected. International quality differences did increase, mainly as a result of the Bosman ruling. |
Is Larry Hogan's administration focusing on special interests over broader public interest?
Gov. Larry Hogan has taken a well-worn page from the right-wing handbook and announced the appointment of a panel of business executives to identify state regulations that should be dismantled. It's tempting to dismiss the panel as a sop to his conservative base, but it poses a serious threat to the environment and public health. For one thing, the panel's composition is the very definition of bias. If you want to run a better government, why not appoint a panel that includes all points of view? Why not ask this more balanced group not just to consider regulatory cutbacks but also to identify areas where regulation needs to be stronger to save lives and keep Maryland's very lucrative natural resources, including the Chesapeake Bay, clean?
The panel is just the latest in a series of disconcerting signs that the governor has fallen in step with the extreme mantra of certain members of the U.S. House of Representatives, who constantly hold hearings in search of evidence that regulations lose jobs and cost huge and unwarranted amounts of money. Efforts to protect the environment are always in the bullseye during such attacks. The problem, of course, is that a series of careful studies done by reputable economists shows that those rules create as many jobs as are "lost," shifting the location but not the amount of employment. The reason is that workers are hired to manufacture, install and operate pollution control equipment. Of course, it costs industry money to take those steps, but the money pays for additional jobs, and, after all, it's money spent cleaning up some of the pollution that they impose on the rest of us.
Environmental rules produce tangible benefits. By cleaning up the air and water, they prevent death and serious illness, save health care costs, and cut down the millions of days people would otherwise take off from work and school because they are sick. Elaborate analyses prepared by the Environmental Protection Agency show that these benefits far outweigh industry costs.
To bring the implications of Governor Hogan's blue ribbon, deregulatory SWAT team to life, consider what he's been doing about smog (or ozone) pollution. As soon as he was elected, he took the unprecedented step of suspending a final rule signed by his predecessor. The rule would have required two of the biggest, dirtiest, coal-fired power plants in the state, which are owned by NRG and located in Dickerson and Chalk Point, to operate state-of-the-art smokestack scrubbers, switch to natural gas or shut down. A few days ago, the Maryland Department of the Environment issued a rewritten proposal that is now being hustled through public comment and expert review. It puts an imaginary bubble over all the coal plants owned by a single company and allowing them to run full speed unless emissions exceed a 24-hour average. This approach is significantly weaker than the final rule the governor ditched.
Smog exacerbates asthma, chronic obstructive pulmonary disease (COPD) and other cardiovascular illnesses, and it causes premature death. According to the American Lung Association some 150,000 children and 435,000 adults suffer from asthma in Maryland — 14,000 children and 47,000 adults in Baltimore City are among that number. Over 600,000 people in our state have COPD and other cardiovascular diseases, and 10 percent live in the city.
Because of these very serious public health problems, EPA is scheduled in October to require sharp reductions in the amount of pollutants that cause smog. Why Maryland should take three steps back when it will soon need to take three steps forward is as mysterious as it is ill-advised.
The governor says his deregulatory panel will hunt for additional regulations that might discourage businesses from moving to or staying in Maryland. Yet if he tried — and I suspect he did not — he could not find a single reliable study supporting the notion that a state's regulatory climate has a major influence on where businesses locate. Rather, energy and labor costs are the key motivators. When you consider the economic importance of a clean Chesapeake Bay to the state's financial security, strong environmental protection should be a no-brainer.
As for the bias inherent in the all-business membership of the so-called "Regulatory Reform Commission," either the governor has made the fundamental mistake of thinking that business leaders somehow represent the interests of all Marylanders or he is simply preoccupied with fulfilling campaign promises to wealthy contributors. Neither rationale is reassuring, and a third is painfully obvious: His administration, which should be pursuing the broad public interest, is instead focusing on special interests.
Rena Steinzor is a professor at the University of Maryland Carey Law School who specialized in environmental law and a past president of the Center for Progressive Reform (www.progressivereform.org). Her email is rsteinzor@law.umaryland.edu. |
Live in Covington minutes to restaurants and commerce. Enjoy this renovated 1 bedroom 1 bath condo with beautiful views of the river for a great home or weekend getaway! Lessor pays condo fee, water, and up to $85 in electricity. Lessee pays for internet, cable & phone. Amenities include heated pool, designated parking space, trash pick up, elevator, security, granite and office area. Carefree living at it's best! |
def iris_dataset():
pd = pytest.importorskip('pandas')
df = pd.read_csv('examples/data/iris.csv')
df.Species = df.Species.astype('category')
return df |
Now that the financial independence, retire early (FIRE) movement is growing more mainstream, you can’t throw a rock without hitting someone who thinks the whole thing is a bad idea.
And there are legitimate criticisms of the concept, from the fact that most people — especially minimum wage earners and those earning below the median — can probably never achieve full early retirement in our economy, to the truth that not everyone is temperamentally cut out for early retirement.
You’ll get no argument from me there. As much as I’d like everyone to have an equal chance at early retirement, the current reality is that low earners can’t even afford rent in most U.S. cities right now, so we have a long way to go as a society before everyone can attain financial independence.
For people who can’t imagine what they’d do outside of work, the best answer is certainly to keep working (though it’s not a bad idea to save a good cushion for yourself at the same time, because your job may not always love you back, and of course make sure you’re saving enough for traditional retirement).
But those who get most fired up in disdain for the movement like to focus on a few key points that aren’t actually true.
It’s a compelling image, isn’t it, of people pursuing early retirement holed up in our freezing cold homes (because we’re too cheap to pay for heat), wearing socks full of holes (because we’re too cheap to buy new ones), eating rice and beans (obviously) with only library books as entertainment (because $10 a month for Netflix NFLX, +1.58% is too expensive)?
The only problem? That’s not true.
Virtually everyone pursuing FIRE lives what looks like a pretty normal middle-class lifestyle. We spend on things we value, like travel and time with loved ones, and we eat normal food. (Some of us even famously spend large sums on craft beer.) Where we differ is that we get strategic about cutting out spending that doesn’t add value to our lives, and we’re ruthless about avoiding mindless spending and lifestyle inflation. Most of us don’t upgrade our cars or homes often (or ever), we don’t pay for unnecessary and easily replaced things like cable TV and we don’t spend money just because others expect it of us.
But large numbers of us living some faux poverty existence to make it all possible? That’s not a thing.
In nearly every critique of the FIRE movement, someone will quickly shout, “But it’s been a historically long bull market! It’s going to go down and likely not repeat these gains anytime soon!” And that’s true. But they say it as though we don’t know that, and haven’t planned for it.
You’ll meet few laypeople who can talk in as much depth about the history of the stock markets or about the science of safe withdrawal rates as those pursuing or living in early retirement. We know the ins and outs of the Trinity Study, we know the shortcomings of the “4% rule,” we’re well aware that market volatility is part of the deal and we build our plans to guard against sequence of returns risk.
In plenty of FIRE critiques, you’ll see the false conflation of early retirement and claiming Social Security early, at age 62, instead of at the expert-recommended 67 or even 70. The problem is, again, it’s not how most early-retirement aficionados actually think about Social Security. In fact, many of us don’t even count it in our calculations at all.
While it’s true that retiring early will reduce your ultimate Social Security benefits, because those benefits are factored on your 35 highest earning years and a bunch of years with zeros will inevitably drag down your average, it’s not true that we’re all jumping to claim Social Security at 62 just because we’re not working.
Instead of criticizing early retirees for not working long enough, perhaps we should instead invite everyone to emulate the savings behavior of those pursuing FIRE.
Another common refrain in FIRE-hater articles is, “But what about health care?!” As though we’ve all collectively forgotten that we live in human bodies that might sometimes require professional looking-after.
Health care in early retirement is a top concern for nearly everyone pondering leaving traditional employment, and it’s the single biggest reason why so many people stay at work even when they could otherwise quit and create a job opening for someone else. The uncertainty around health care is a great source of anxiety for plenty of working people, too, but early retirees have even greater urgency in figuring things out. Fortunately, there are several good options for early retirement health care right now, and if the political landscape shifts enough to change that, we’ll adapt.
The bigger problem that we should all be focusing on is how much traditionally retired seniors still have to pay for health care when they have Medicare coverage, and how unprepared most of them are for that.
This is the one that every early retiree I know finds most laughable, because there’s some definite projection going on with the folks making this claim. Just because someone might be bored without an employer telling them what to do every day doesn’t mean everyone would be bored in the same situation. Those of us who seek early retirement are generally people of many interests, and I know in my case, I will never come close to checking everything off my life list, even though I have nearly endless free time now to pursue my own interests.
If you have a life list that’s miles long, then don’t worry about being bored in early retirement. And if you are legitimately worried about being bored without a job? Then keep working as long as you’re able to. It’s as simple as that.
Related to the boredom myth is the idea that every early retiree is destined for an identity crisis after we lose our job titles or other aspects of our work identity. And certainly some might. But that’s a normal feature of retirement at any age, not just early retirement, and it’s something that many of us who’ve ever worked will have to cope with at some point.
The years of planning for early retirement give you plenty of time to consider how you’ll derive identity and purpose from your postwork life. That could be through volunteering, though involvement in the lives of loved ones, or even from work itself, though work you do for yourself and on your own terms rather than an employer’s.
But just continuing to work is no guarantee of retirement success. The two benefits of working longer are you can increase your Social Security benefit by claiming it later (but you can also achieve this through proper planning, even without continuing to work past 65), and you need your retirement savings to last fewer years.
Most Americans are dramatically undersaving for retirement, with only a third of Americans having anything saved in a 401(k), and the average couple having a mere $5,000 put away for retirement. Most retirees are wholly reliant on Social Security for their retirement income (and they’re spending an alarming proportion of that benefit on their health-care costs, even with Medicare). At the same time, new analysis shows that more workers over 50 are being forced out of longtime jobs and into early retirement well before they feel ready.
The solution? We all need to be saving more, and much earlier.
What are aspiring early retirees doing? We’re saving more, and much earlier.
FIRE haters like to trot out the statistic that there’s a spike in deaths right around retirement for those who claim Social Security at the earliest possible age: 62. But they’re confusing correlation and causation. Those who claim Social Security right at 62 tend to be the sickest among us, and so it’s expected that many of them would die young.
That doesn’t mean that retirement causes death, or that continuing to work guarantees living longer. There’s equal evidence that work is killing us, and planning your escape from the workplace might just be the best thing you can do to improve your odds of living longer and have more healthy years to enjoy.
Are you ready for early retirement? Or just kidding yourself? |
Madhvacharya
Biography
The biography of Madhvacharya is unclear. Many sources date him to 1238–1317 period, but some place him about the 1199-1278 period.
Madhvācārya was born in Pajaka near Udupi, a coastal district in the present day Indian state of Karnataka. Traditionally it is believed that Naddantillaya (Sanskrit: Madhyageha, Madhyamandira) was the name of his father and Vedavati was Madhvācārya's mother. Born in a Tulu speaking Vaishnavite Brahmin household, he was named Vāsudeva. Later he became famous by the names Purnaprajna, Anandatirtha and Madhvacarya (or just Madhva). Pūrnaprajña was the name given to him at the time of his initiation into sannyasa (renunciation), as a teenager. The name conferred on him when he became the head of his monastery was "Ānanda Tīrtha". All three of his later names are found in his works. Madhvācārya or Madhva are names most commonly found in modern literature on him, or Dvaita Vedanta related literature.
Madhva began his school after his Upanayana at age seven, became a monk or Sannyasi in his teenage. He joined an Advaita Vedanta monastery in Dwarka (Gujarat), accepted his guru to be Achyutrapreksha, who is also referred to as Achyutraprajna in some sources. Madhva studied the Upanishads and the Advaita literature, but was unconvinced by its nondualism philosophy of oneness of human soul and god, had frequent disagreements with his guru, left the monastery, and began his own Dvaita movement based on dualism premises of Dvi – asserting that human soul and god (as Vishnu) are two different things. Madhva never acknowledged Achyutrapreksha as his guru or his monastic lineage in his writings.
According to Dehsen, perhaps there were two individuals named Madhvacharya in 13th century India, with Anandatirtha – the younger Madhva being the most important early disciple of the elder Madhvacharya, and their works and life overlapped in Udupi, Tattvavada being the name adopted for Dvaita Vedanta by Anandatirtha. Madhvacharya established a matha (monastery) dedicated to Dvaita philosophy, and this became the sanctuary for a series of Dvaita scholars such as Jayatirtha, Vyasatirtha, Vadiraja Tirtha and Raghavendra Tirtha who followed in footsteps of Madhva.
A number of hagiographies have been written by Madhva's disciples and followers. Of these, the most referred to is the sixteen cantos Sanskrit biography Madhvavijaya by Nārāyana Panditācārya – son of Trivikrama Pandita, who himself was a disciple of Madhva.
Self proclamation as being avatar of Wind god
In several of his texts, state Sarma and other scholars, "Madhvacharya proclaims himself to be the third avatar or incarnation of Vayu, wind god, the son of Vishnu". He, thus, asserted himself to be like Hanuman – the first avatar of Vayu, and Bhima – a Pandava in the Mahabharata and the second avatar of Vayu. In one of his bhasya on the Brahma Sutras, he asserts that the authority of the text is from his personal encounter with Vishnu. Madhva, states Sarma, believed himself to be an intermediary between Vishnu and Dvaita devotees, guiding the latter in their journey towards Vishnu.
Works of Madhvacharya
Thirty seven Dvaita texts are attributed to Madhvacharya. Of these, thirteen are bhasya (review and commentary) on earliest Principal Upanishads, a Madhva-bhasya on the foundational text of Vedanta school of Hinduism – Brahma Sutras, another Gita-bhasya on Bhagavad Gita, a commentary on forty hymns of the Rigveda, a review of the Mahabharata in poetic style, a commentary called Bhagavata-tatparya-nirnaya on Bhagavata Purana, plus stotras, poems and texts on bhakti of Vishnu and his avatars. The Anu-Vyakhyana, a supplement to Madhvacharya's commentary on Brahma Sutras, is his masterpiece, states Sharma.
While being a profusely productive writer, Madhvacharya restricted the access to and distribution of his works to outsiders who were not part of Dvaita school, according to Sarma. However, Bartley disagrees and states that this is inconsistent with the known history of extensive medieval Vedantic debates on religious ideas in India which included Dvaita school's ideas.
Metaphysics
The metaphysical reality is plural, stated Madhvacharya. There are primarily two tattvas or categories of reality — svatantra tattva (independent reality) and asvatantra tattva (dependent reality). Ishvara (as God Vishnu or Krishna) is the cause of the universe and the only independent reality, in Madhvacharya's view. The created universe is the dependent reality, consisting of Jīva (individual souls) and Jada (matter, material things). Individual souls are plural, different and distinct realities. Jīvas are sentient and matter is non-sentient, according to Madhvacharya.
Madhva further enumerates the difference between dependent and independent reality as a fivefold division (pancha-bheda) between God, souls and material things. These differences are:
(1) Between material things;
(2) Between material thing and soul;
(3) Between material thing and God;
(4) Between souls; and
(5) Between soul and God.
This difference is neither temporary nor merely practical; it is an invariable and natural property of everything. Madhva calls it Taratamya (gradation in pluralism). There is no object like another, according to Madhvacharya. There is no soul like another. All souls are unique, reflected in individual personalities. The sea is full; the tank is full; a pot is full; everything is full, yet each fullness is different, asserted Madhvacharya.
Even in liberation (moksha), states Madhvacharya, the bliss is different for each person, based on each's degree of knowledge and spiritual perfection. This liberation, according to him, is only achievable with grace of God Krishna.
Nature of the Brahman
Madhva conceptualised Brahman as a being who enjoys His own bliss, while the entire universe evolves through a nebulous chaos. He manifests, every now and then, to help the evolution process. The four primary manifestation of Him as the Brahman are, according to Madhva, Vasudeva, Pradyumna, Aniruddha and Sankarasana, which are respectively responsible for the redemptive, creative, sustaining and destructive aspects in the universe. His secondary manifestations are many, and all manifestations are at par with each other, it is the same infinite no matter how He manifests. Brahman is the creator of the universe, perfect in knowledge, perfect in knowing, perfect in its power, and distinct from souls, distinct from matter. For liberation, mere intellectual conceptualization of Brahman as creator is not enough, the individual soul must feel attraction, love, attachment and devotional surrender to Him, and only His grace leads to redemption and liberation, according to Madhva.
The Vishnu as Brahman concept of Madhvacharya is a concept similar to God in major world religions. His writings led some early colonial-era Indologists such as George Abraham Grierson to suggest the 13th-century Madhva was influenced by Christianity, but later scholarship has rejected this theory.
Atat tvam asi
One of the Mahavakyas (great sayings) in Hinduism is Tat tvam asi, or "Thou art That", found in verse 6.8.7 of the ~700 BCE text Chandogya Upanishad. This section of Chandogya Upanishad is credited to sage Uddalaka and the text considered central in Vedanta and the Brahma Sutras, interpreted to mean that there is no difference between the soul within (Thou) and the Brahman (That).
The Dvaita school led by Madhva reinterpreted this section, by parsing the Sanskrit text as Atat tvam asi or "Thou are not That", asserting that there is no Sanskrit rule which does not allow such parsing. He accepted that the tradition and prior scholars had all interpreted the text to be "Tat tvam asi", but then asserted that there is no metaphysical or logical requirement that he should too.
Soteriology
Madhvacharya considered Jnana Yoga and Karma Yoga to be insufficient to the path of liberation without Bhakti. Narayana or Vishnu was the supreme God to Madhva, who can only be reached through Vayu – the son of God; further, states Madhva, faith leads to the grace of God, and grace leads to the liberation of soul.
The knowledge of God, for Madhvacharya, is not a matter of intellectual acceptance of the concept, but an attraction, affection, constant attachment, loving devotion and complete surrender to the grace of God. He rejects monist theories that knowledge liberates, asserting instead that it is Divine grace through Bhakti that liberates. To Madhva, God obscures reality by creating Maya and Prakriti, which causes bondage and suffering; and only God can be the source of soul's release. Liberation occurs when, with the grace of God, one knows the true nature of self and the true nature of God.
Ethics
Evil and suffering in the world, according to Madhvacharya, originates in man, and not God. Every Jiva (individual soul) is the agent of actions, not Jada (matter), and not Ishvara (God). While Madhva asserts each individual self is the Kartritva (real agency), the self is not an absolutely independent agent to him. This is because, states Madhva, the soul is influenced by sensory organs, one's physical body and such material things which he calls as gifts of God. Man has free will, but is influenced by his innate nature, inclinations and past karma.
Madhvacharya asserts, Yathecchasi tatha kuru, which Sharma translates and explains as "one has the right to choose between right and wrong, a choice each individual makes out of his own responsibility and his own risk". Madhva does not address the problem of evil, that is how can evil exist with that of a God who is omnipotent, omniscient, and omnibenevolent. According to Sharma, "Madhva's tripartite classification of souls makes it unnecessary to answer the problem of evil". According to David Buchta, this does not address the problem of evil, because the omnipotent God "could change the system, but chooses not to" and thus sustains the evil in the world. This view of self's agency of Madhvacharya was, states Buchta, an outlier in Vedanta school and Indian philosophies in general.
Moral laws and ethics exist, according to Madhva, and are necessary for the grace of God and for liberation.
Views on other schools
Madhvacharya was a fierce critic of competing Vedanta schools, and other schools of Indian philosophies such as Buddhism and Jainism. He wrote up arguments against twenty one ancient and medieval era Indian scholars to help establish the foundations of his own school of thought.
Madhvacharya was fiercest critic of Advaita Vedanta, accusing Shankara and Advaitins for example, as "deceitful demons" teaching Buddhism under the cover of Vedanta. Advaita's nondualism asserts that Atman (soul) and Brahman are blissful and identical, unchanging transcendent Reality, there is interconnected oneness of all souls and Brahman, and there are no pluralities. Madhva in contrast asserts that Atman (soul) and Brahman are different, only Vishnu is the Lord (Brahman), individual souls are also different and depend on Vishnu, and there are pluralities. Madhva criticized Advaita as being a version of Mahayana Buddhism, which he regarded as nihilistic. Of all schools, Madhva focussed his criticism on Advaita most, and he wrote four major texts, including Upadhikhandana and Tattvadyota, primarily dedicated to criticizing Advaita.
Madhvacharya disagreed with aspects of Ramanuja's Vishishtadvaita. Vishishtadvaita school, a realist system of thought like Madhvacharya's Dvaita school, also asserts that Jiva (human souls) and Brahman (as Vishnu) are different, a difference that is never transcended. God Vishnu alone is independent, all other gods and beings are dependent on Him, according to both Madhvacharya and Ramanuja. However, in contrast to Madhvacharya's views, Vishishtadvaita school asserts "qualified non-dualism", that souls share the same essential nature of Brahman, and that there is a universal sameness in the quality and degree of bliss possible for human souls, and every soul can reach the bliss state of God Himself. While the older school of Vishishtadvaita asserted "qualitative monism and quantitative pluralism of souls", states Sharma, Madhvacharya asserted both "qualitative and quantitative pluralism of souls".
Shankara's Advaita school and Ramanuja's Vishishtadvaita school are premised on the assumption that all souls can hope for and achieve the state of blissful liberation; in contrast, Madhvacharya believed that some souls are eternally doomed and damned.
Madhvacharya's style of criticism of other schools of Indian philosophy was part of the ancient and medieval Indian tradition. He was part of the Vedanta school, which emerged in post-Vedic period as the most influential of the six schools of Hindu philosophy, and his targeting of Advaita tradition, states Bryant, reflects it being the most influential of Vedanta schools.
Influence
Madhvacharya views represent a subschool of Vaishnavism, just like Ramanuja's. Both championed Vishnu, often in the saguna form of Vishnu's avatar Krishna. However, 11th-century Ramanuja's ideas have been most influential in Vaishnavism.
Madhvacharya's ideas led to the founding of Haridasa sect of Vaishnavism in Karnataka, also referred to as Vyasakuta, Dasakuta or Dasa Dasapantha, known for their devotional songs and music during the Bhakti movement.
Other influential subschools of Vaishnavism competed with the ideas of Madhvacharya, such as the Chaitanya subschool, whose Jiva Gosvami asserts only Krishna is "Svayam Bhagavan" (original form of God), in contrast to Madhva who asserts that all Vishnu avatars are equal and identical, with both sharing the belief that emotional devotion to God is the means to spiritual liberation. According to Sharma, the influence of Madhva's Dvaita ideas have been most prominent on the Chaitanya school of Bengal Vaishnavism, and in Assam.
A subsect of Gaudiya Vaishnavas from Orissa and West Bengal claim to be followers of Madhvacharya. Madhva established in Udupi Krishna Matha attached to a god Krishna temple. Gaudiya Vaishnavas also worship Krishna, who is in the mode of Vrindavana.
Hindu-Christian controversies
Madhvacharya was misperceived and misrepresented by both Christian missionaries and Hindu writers during the colonial era scholarship. The similarities in the primacy of one God, dualism and distinction between man and God, devotion to God, the son of God as the intermediary, predestination, the role of grace in salvation, as well as the similarities in the legends of miracles in Christianity and Madhvacharya's Dvaita tradition fed these stories. Among Christian writers, GA Grierson creatively asserted that Madhva's ideas evidently were "borrowed from Christianity, quite possibly promulgated as a rival to the central doctrine of that faith". Among Hindu writers, according to Sarma, SC Vasu creatively translated Madhvacharya's works to identify Madhvacharya with Christ, rather than compare their ideas.
Modern scholarship rules out the influence of Christianity on Madhvacharya, as there is no evidence that there ever was a Christian settlement where Madhvacharya grew up and lived, or that there was a sharing or discussion of ideas between someone with knowledge of the Bible and Christian legends, and him.
Monasteries
Madhvacharya established eight mathas (monasteries) in Udupi. These are referred to as Madhva mathas, or Udupi ashta matha, and include Palimaru matha, Adamaru matha, Krishnapura matha, Puttige matha, Shirur matha, Sodhe matha, Kaniyooru matha and Pejavara matha. These eight surround the Anantheswara Krishna Hindu temple. The matha are laid out in a rectangle, the temples on a square grid pattern. The monks in the matha are sannyasis, and the tradition of their studies and succession (Paryaya system) were established by Madhvacharya.
There are Madhva mathas set up all over India. Including those in Udupi, there are twenty four Madhva mathas in India. The main center of Madhva's tradition is in Karnataka. The monastery has a pontiff system, that rotates after a fixed period of time. The pontiff is called Swamiji, and he leads daily Krishna prayers according to Madhva tradition, as well as annual festivals. The process and Vedic mantra rituals for Krishna worship in Dvaita monasteries follow the procedure written by Madhvacharya in Tantrasara. The Krishna worship neither involves bali (sacrifice) nor any fire rituals.
The succession ceremony in Dvaita school involves the outgoing Swamiji welcoming the incoming one, then walking together to the icon of Madhvacharya at the entrance of Krishna temple in Udupi, offering water to him, expressing reverence then handing over the same vessel with water that Madhvacharya used when he handed over the leadership of the monastery he founded.
The monastery include kitchens, bhojan-shala, run by monks and volunteers. These serve food daily to nearly 15,000 to 20,000 monks, students and visiting pilgrims without social discrimination. During succession ceremonies, over 80,000 people are served a vegetarian meal by Udupi bhojan-shalas.
Film
In 1986 a film directed by G. V. Iyer named Madhvacharya was premiered, it was one of the films made entirely in Kannada language. |
<reponame>voitovychm/Docker-client
package com.sombrainc.global;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.sombrainc.repository.DockerClientDAO;
import com.sombrainc.repository.IDockerClientDAO;
import org.mongodb.morphia.Datastore;
public class BaseModule extends AbstractModule {
@Override
protected void configure() {
bind(Datastore.class).toProvider(DatastoreProvider.class).asEagerSingleton();
bind(IDockerClientDAO.class).to(DockerClientDAO.class).in(Singleton.class);
}
}
|
/**
* User model description.
*
* @author Gregory Smirnov (artress@ngs.ru)
* @version 1.1
* @since 07/02/2019
*/
public class User {
/**
* Param "id" in in the POST request.
*/
public static final String PARAM_ID = "id";
/**
* Param "name" in in the POST request.
*/
public static final String PARAM_NAME = "name";
/**
* Param "login" in in the POST request.
*/
public static final String PARAM_LOGIN = "login";
/**
* Param "email" in in the POST request.
*/
public static final String PARAM_EMAIL = "email";
/**
* User's id.
*/
private int id;
/**
* User's name.
*/
private String name;
/**
* User's login.
*/
private String login;
/**
* User's e-mail.
*/
private String email;
/**
* User's creation date.
*/
private Date createDate;
/**
* Creates a new user with the specified params.
*
* @param id - the specified user's id.
* @param name - the specified user's name.
* @param login - the specified user's login.
* @param email - the specified user's email.
*/
public User(String id, String name, String login, String email) {
this.id = Integer.parseInt(id);
this.name = name;
this.login = login;
this.email = email;
this.createDate = new Date();
}
/**
* Gets user's id.
*
* @return user's id.
*/
public int getId() {
return this.id;
}
/**
* Sets the specified user's id.
*
* @param id - the specified new user's id.
*/
public void setId(int id) {
this.id = id;
}
/**
* Gets user's name.
*
* @return user's name.
*/
public String getName() {
return this.name;
}
/**
* Sets the specified user's name.
*
* @param name - the specified user's name.
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets user's login.
*
* @return user's login.
*/
public String getLogin() {
return this.login;
}
/**
* Sets the specified user's login.
*
* @param login - the specified user's login.
*/
public void setLogin(String login) {
this.login = login;
}
/**
* Gets user's e-mail.
*
* @return user's e-mail.
*/
public String getEmail() {
return this.email;
}
/**
* Sets the specified user's e-mail.
*
* @param email - the specified user's e-mail.
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Gets user's creation date.
*
* @return user's creation date.
*/
public Date getCreateDate() {
return this.createDate;
}
/**
* Sets the specified user's creation date
*
* @param createDate - the specified user's creation date.
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* Checks this user equivalence to the specified user.
*
* @param o - the specified user.
* @return true if users are equals.
*/
@Override
public boolean equals(Object o) {
boolean result;
if (this == o) {
result = true;
} else if (o == null || getClass() != o.getClass()) {
result = false;
} else {
User user = (User) o;
result = this.id == user.id
&& Objects.equals(this.name, user.name)
&& Objects.equals(this.login, user.login)
&& Objects.equals(this.email, user.email);
}
return result;
}
/**
* Calculates this user's hash code.
*
* @return this user's hash code.
*/
@Override
public int hashCode() {
return Objects.hash(this.id, this.name, this.login, this.email);
}
/**
* Presents this user in a String-view.
*
* @return this user's String-view.
*/
@Override
public String toString() {
return String.format("%nUser {id=%d, name='%s, login='%s, email='%s, createDate=%s}%n",
this.id, this.name, this.login, this.email, this.createDate);
}
} |
Myocardial covering on epicardial coronary arteries. Prevalence, localization and significance. Epicardial coronary arteries are on occasion covered by myocardial musculature (mural stretches). Premural segments of the left anterior descendent artery, and only of this artery, seem to be sites of predilection for arteriosclerotic stenosis and for coronary thrombosis. The myocardial covering can be demonstrated angiographically as a "milking effect" and surgical correction consisting of myotomy has recently proved successful. |
<gh_stars>1-10
//package com.company;
//
//public class Bicicleta extends ViajeStrategy{
//
// @Override
// public Double calcularTiempo(Punto puntoDePartida, Punto puntoDeLlegada) {
// return puntoDePartida.calcularDistacia(puntoDeLlegada) / 0.050366 * 1.5;
// }
//}
|
Evers made stops around the badger state including here in Wausau on Wednesday to speak with local folks and focus in on key matters that need the most fixing.
“The state’s budget as you know is the most important policy lever that we have in the state of Wisconsin,” Evers said.
Though the state’s budget isn’t revealed until March of 2019 Evers said it gives him time to figure out what matters most to Wisconsinites.
“We are in process of baking that and we want the people to be part of putting the ingredients in that cake,” Evers said.
Citizens split up into groups to talk about a variety of topics including healthcare, transportation and kid’s needs.
Wausau resident Joel Lewis said he want’s every Wisconsinite to have the security of healthcare.
“There’s 84 thousand people currently in the state that don’t have badger care and can’t afford market place insurance and if we don’t have citizens in good health then how can they be productive members of our community,” Lewis said.
Evers said he is willing to work with republicans on the issues discussed on Wednesday.
He said he believes they want to fix the same issues he does. |
The 21-year-old's stealthily devastating, masterfully modulated turn in Luca Guadagnino's Italy-set love story is one for the ages.
You don't immediately notice how extraordinary Timothee Chalamet is in Luca Guadagnino’s playful and profound coming-of-age masterpiece Call Me by Your Name.
As Elio, a brainy, brooding boy of 17 who falls in love with Oliver, his father’s 24-year-old research assistant (Armie Hammer, tremendous), in Italy during the summer of 1983, the actor at first comes off as an affably precocious but low-key teen. He toggles casually between English, French and Italian; plays piano with ironic panache; looks natural lolling about with a book in his hands, sunglasses and headphones on, or hunched over, pencil pressed to paper. Just wait: This is a performance so subtle and unfussy — so startlingly free of the kind of mannered, Method-y intensity that often dooms the work of young thesps — that you don’t see it coming straight for your gut.
The moment Chalamet’s greatness might begin to register comes 30 minutes in. Oliver has recently arrived from the States, and he, Elio and some friends are at a nightclub. Whatever attraction exists between the two young men is, at this point, unacknowledged, though their exchanges have been tinged with erotic tension, as well as rivalry and misapprehension. Elio, sitting at a slight remove from the others, suddenly leans forward, watching Oliver intently as he dances. He chews his lips, drags on a cigarette. In Chalamet’s gaze is a gathering storm of conflicting impulses: desire, defensiveness, fear, fascination. Elio shakes it off, chugs his cocktail and hits the dance floor — swinging his hips, rolling his shoulders…and ignoring Oliver completely. Rarely has the tug of war between a teen’s inner and outer selves been conveyed with such exhilarating immediacy.
Therein is the genius of Chalamet in Call Me by Your Name: He pulls you far into the churning depths — the lust and longing, self-loathing, zigzagging intellect and abiding goodness — below Elio’s placid surface. That, of course, is part of the actor’s task: to conjure a character’s emotional life. But even the best sometimes miscalculate, giving away too much or too little, or calling attention to the effort. Chalamet walks a tightrope: He respects Elio’s reserve — his elusiveness, his somewhat studied nonchalance — while letting you see the thrillingly human mess underneath. There’s breathtaking craft and control in the performance, but not once do you sense the tools at work.
Whereas Andre Aciman’s first-person novel, from which the film is adapted, makes the reader privy to the protagonist’s most intimate thoughts, Guadagnino and screenwriter James Ivory have given Elio no voiceover or monologue. With his delicate romantic features and wiry limbs, Chalamet builds an almost pointillist portrait via sighs and shrugs, grimaces and glances, smiles and variations in voice and posture (not to mention a handful of hungry kisses and one innovative bit of debauchery involving a peach). Once the actor gets his hooks in you, you’re with Elio through every flickering doubt, burst of boldness and swell of tenderness; Chalamet turns this sun-dappled love story into a thriller of the heart.
Call Me by Your Name is about a young man mustering the courage to want what he wants and feel what he feels — “to speak and not die,” as 16th-century French author Marguerite de Navarre wrote in The Heptameron, a line referenced in the film. And just as Elio, by the end, has collapsed the once-daunting distance between his inner and outer selves, Chalamet has collapsed the distances between performer, character and viewer. You may not realize how much until you’re watching the doozy of a final shot and Elio’s tears become your own. |
A narrative review of current functional assessment of the upper esophageal sphincter : Swallowing is a physiological process organized in a sequence of events grouped in extraesophageal and esophageal phase. Changes in the swallowing mechanism can be seen in many clinical situations. Difficulties in the study of the extraesophageal phase of this mechanism occur frequently due to the velocity of this moment, compared to the esophageal phase, as well as the structural characteristics of the upper esophageal sphincter (UES). The aim of this paper is to make a literature review on current functional assessment of the UES. The authors conducted a PubMed search of research published between August 2009 and December 2020, looking for publications related to the topic studied. All diagnostic methods (imaging and endoscopic), as well as conventional manometry, present technical difficulties for their performance and interpretation of results. The emergence of high-resolution manometry (HRM) brought a great advance in the diagnostic study of the pathophysiological phenomena that affect the UES, as well as the repercussion in this location of other esophageal disorders. Functional study of UES through HRM has allowed not only a better understanding of its functioning under normal and pathological conditions, but also an increased number of situations in which it can be applied. |
<filename>unit_tests/__init__.py
__all__ = [
'main',
'test_candle',
'test_stock'
] |
def bootstrap_hotkeys(bus: EventBus) -> None:
register_event(
bus, EVENT_ID_HOTKEY_EVENT_TRIGGERED, QUEUE_EVENT_NORMAL, CONSUME_EVENT_PROTECTION,
HotkeyEventTriggeredEvent, HotkeyEventTriggeredEvent(BoundServiceActionData('', EMPTY_MAPPING))
)
register_event(
bus, EVENT_ID_REGISTER_HOTKEY_EVENT, QUEUE_EVENT_NORMAL, REQUEST_EVENT_PROTECTION,
RegisterHotkeyEventEvent, RegisterHotkeyEventEvent('', BoundServiceActionData('', EMPTY_MAPPING))
)
register_event(
bus, EVENT_ID_REMOVE_HOTKEY_EVENT, QUEUE_EVENT_NORMAL, REQUEST_EVENT_PROTECTION,
RemoveHotkeyEventEvent, RemoveHotkeyEventEvent('')
)
register_event(
bus, EVENT_ID_SET_MASTER_HOTKEY_SEQUENCE, QUEUE_EVENT_NORMAL, REQUEST_EVENT_PROTECTION,
SetMasterHotkeySequenceEvent, SetMasterHotkeySequenceEvent('')
)
register_event(
bus, EVENT_ID_HOTKEY_BOUND_SERVICE_ANNOUNCEMENT, QUEUE_EVENT_NORMAL, RESPONSE_EVENT_PROTECTION,
HotkeyBoundServiceAnnouncementEvent, HotkeyBoundServiceAnnouncementEvent(
BoundServiceActionSchema(NOT_PARTICIPANT, '', {})
)
)
register_event(
bus, EVENT_ID_HOTKEY_UNBIND_SERVICE_ANNOUNCEMENT, QUEUE_EVENT_NORMAL, RESPONSE_EVENT_PROTECTION,
HotkeyUnbindServiceAnnouncementEvent, HotkeyUnbindServiceAnnouncementEvent(
NOT_PARTICIPANT, ''
)
)
set_state(
bus, STATE_ID_HOTKEY_EVENTS,
HotkeyEventState, HotkeyEventState(EMPTY_TUPLE, EMPTY_TUPLE)
) |
def gt(*args):
if (len(args) == 0):
raise Exception("You need to provide at least one argument for the data!")
data = args[0]
children = args[1:]
r = GenericTree(data)
for c in reversed(children):
r.insert_child(c)
return r |
Robert Herman’s New York is a solitary place, where isolated individuals meet the elements on empty streets or subway platforms.
Mr. Herman, 57, came to New York in 1976 to study filmmaking and soon found his calling in photography, wandering the city with a camera and a supply of Kodachrome film that captured the oversaturated reds and blues he saw around him. It was a period of emotional turmoil for Mr. Herman, who was hospitalized several times for what was, much later, diagnosed as bipolar disorder.
“I felt like a very vulnerable person,” he said recently in his studio in Lower Manhattan. “Photography was my intermediary between me and the world. I was trying to find peace wandering the city. After a while you get in a Zen space and the world slows down. And when you’re an outsider, you notice things that other people just walk by.”
Robert Herman
He shot in manic states, depressed states and everything in between, capturing the struggles of ordinary New Yorkers in the 1980s and the loneliness that ran through a city where so many people lived by themselves. Photography, he said, was a way to level his mood swings. At one point, he threw himself in front of a U.P.S. truck. Finally, in 1992, he received a proper diagnosis and began effective treatment that quieted the emotional chaos. Through it all, he continued walking and photographing.
The photographs come from a new book called “The New Yorkers,” which contains images taken between 1978 and 2005.
Mr. Herman, whose parents owned movie theaters, grew up watching films like “Blow-Up” over and over, and his photographs are intended to be read as still movies, he said.
“I’m a witness,” he said. “I want to record what I see as an outsider and use the frame and light to say something about how I feel about what I’m shooting. Photography shows you how clearly or not you’re thinking. It’s an externalization of your progress.”
Robert Herman
Follow Lens on Facebook and Twitter. |
<filename>pq-crypto/sike_r3/sikep434r3_fp.h
/********************************************************************************************
* Supersingular Isogeny Key Encapsulation Library
*
* Abstract: modular arithmetic for P434
*********************************************************************************************/
#pragma once
#include "sikep434r3.h"
/*#define mp_sub434_p2 S2N_SIKE_P434_R3_NAMESPACE(mp_sub434_p2)*/
void mp_sub434_p2(const digit_t* a, const digit_t* b, digit_t* c);
/*#define mp_sub434_p4 S2N_SIKE_P434_R3_NAMESPACE(mp_sub434_p4)*/
void mp_sub434_p4(const digit_t* a, const digit_t* b, digit_t* c);
/*#define fpadd434 S2N_SIKE_P434_R3_NAMESPACE(fpadd434)*/
void fpadd434(const digit_t* a, const digit_t* b, digit_t* c);
/*#define fpsub434 S2N_SIKE_P434_R3_NAMESPACE(fpsub434)*/
void fpsub434(const digit_t* a, const digit_t* b, digit_t* c);
/*#define fpneg434 S2N_SIKE_P434_R3_NAMESPACE(fpneg434)*/
void fpneg434(digit_t* a);
/*#define fpdiv2_434 S2N_SIKE_P434_R3_NAMESPACE(fpdiv2_434)*/
void fpdiv2_434(const digit_t* a, digit_t* c);
/*#define fpcorrection434 S2N_SIKE_P434_R3_NAMESPACE(fpcorrection434)*/
void fpcorrection434(digit_t* a);
/*#define digit_x_digit S2N_SIKE_P434_R3_NAMESPACE(digit_x_digit)*/
void digit_x_digit(const digit_t a, const digit_t b, digit_t* c);
/*#define mp_mul S2N_SIKE_P434_R3_NAMESPACE(mp_mul)*/
void mp_mul(const digit_t* a, const digit_t* b, digit_t* c, const unsigned int nwords);
/*#define rdc_mont S2N_SIKE_P434_R3_NAMESPACE(rdc_mont)*/
void rdc_mont(digit_t* ma, digit_t* mc);
|
Case for diagnosis. Atypical Grovers disease☆☆☆ A 55-year-old male presented with an eight-month history of erythematous papules and plaques with demarcated areas of spared skin on his trunk, upper extremities, neck, and face. Grovers disease is a rare, acquired disorder of unknown origin, which is classically characterized by the appearance of erythematous papules on the upper trunk that are usually transient. As in the present case, there are reports of atypical disease, with facial involvement, pityriasis rubra pilaris-like lesions, and a more chronic course. associated with fine superficial scaling (Fig. 3). His medical history was significant for gastroesophageal reflux disease, treated with esomeprazole. There were no significant anomalies on general lab tests (CBC, chemistry panel, hepatic profile), and HIV, hepatitis B, hepatitis C, and VDRL serologies were all non-reactive. Two punch skin biopsies were taken, which showed suprabasal focal acantholysis with numerous dyskeratotic cells and eosinophils (Fig. 4). Discussion GD, also known as transient acantholytic dermatosis, is an uncommon acquired condition of unknown origin, first described by Ralph Grover in 1970. 1,2 It affects middle aged and older adults, with predominance in males (2---3:1 ratio) and Caucasians. It's characterized by erythematous papules and occasionally vesicles, primarily on the upper trunk and proximal extremities, associated with variable pruritus. 3---5 Although it was first described as a transient disease, lasting just for a few weeks, subsequent reports have shown that GD could last for several months or be recurrent. 1---3 The reported case presented with extensive facial involvement, an uncommon feature of GD. Gantz et al. conducted a systematic review of 69 patients with atypical distribution GD which showed that facial or scalp lesions were present in 24% of these cases. 6 Other atypical locations included palms, soles, axillae, inguinal folds, and dermatomeric or Blaschkoid distribution. Another noteworthy aspect of the clinical presentation of this patient was the presence of well-demarcated areas of spared skin, which could be a strong diagnostic pitfall towards pityriasis rubra pilaris (PRP). However, there are case reports of PRP with histopathology compatible with GD and cases of GD with histopathology of PRP, which suggests that in some patients there is an overlap between these two diseases. 7 Regarding dermoscopy, the features described include a pink background with polymorphous vessels (glomerular, dotted, lineal, and hairpin) and star-or oval-shaped yellowwhite structures with a white halo, besides scaling. 8,9 Typically, histopathology shows focal acantholysis and different degrees of dyskeratosis. There are four histologic subtypes: Darier's disease-like, pemphigus-like, Hailey-Hailey-like, and spongiotic. These subtypes can appear alone or coexist. 1,10 First-line treatment consists of the use of emollients and topical steroids and vitamin D analogs, associated with H1 antihistamines. Therapy with systemic retinoids, oral steroids, or phototherapy is reserved for extensive or treatment-resistant cases. In the present case, narrowband UVB phototherapy was used, with a successfully response after 18 sessions. Financial support None declared. Authors' contributions Pablo Vargas-Mora: Approval of the final version of the manuscript; conception and planning of the study; elaboration and writing of the manuscript; obtaining, analyzing, and interpreting the data; effective participation in research orientation; critical review of the literature; critical review of the manuscript. Diego Orlandi: Approval of the final version of the manuscript; conception and planning of the study; elaboration and writing of the manuscript; obtaining, analyzing, and interpreting the data; effective participation in research orientation; critical review of the literature; critical review of the manuscript. Irene Araya: Approval of the final version of the manuscript; conception and planning of the study; elaboration and writing of the manuscript; obtaining, analyzing, and interpreting the data; effective participation in research orientation; critical review of the manuscript. Claudia Morales: Approval of the final version of the manuscript; conception and planning of the study; obtaining, analyzing, and interpreting the data; effective participation in research orientation; critical review of the manuscript. |
class StackBoard:
"""
Represents a board for the Connect 4 game using a stack-like data structure.
From the user point of view a board is a WxH grid with width W and height H.
Each cell of the grid has a coordinate (x,y), where x grows from left to
right (starting from 0 until W-1) and y grows from bottom to up (starting from 0 until H-1).
For instance, a 7x6 board can be depicted as follows:
(0,0) (6,0)
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
| | | | | | | |
|-|-|-|-|-|-|-|
(0,5) (6,5)
"""
INVALID_TOKEN = None
def __init__(self, width, height):
#self.data = [[]]*width
self.data = [[] for i in range(width)]
self.w = width
self.h = height
def copy(self):
"""
Creates an deep copy of this board.
"""
b = Board(self.w, self.h)
b.data = [x[:] for x in self.data]
return b
def deep_copy(self):
"""
Creates an deep copy of this board.
Same as the copy method.
"""
return self.copy()
def shallow_copy(self):
"""
Creates a shallow (alias) copy of this board.
"""
b = Board(self.w, self.h)
b.data = self.data
return b
def can_push_token(self, column):
"""
Tells if a token can be pushed down to the given column.
"""
if len(self.data[column]) < self.h:
return True
return False
def push_token(self, token, column):
"""
Push the given token down to the given column, if possible.
Returns the row where the token has been pushed, on success; otherwise,
returns -1.
"""
row = len(self.data[column])
if row >= self.h:
return -1
self.data[column].append(token)
return self.to_user_row(row)
def pop_token(self, column):
"""
Pop the token on top of the given column, if possible.
Returns the token stored on the top of the column, if present;
otherwise, returns INVALID_TOKEN.
"""
if len(self.data[column]) == 0:
return self.INVALID_TOKEN
return self.data[column].pop()
def get_token(self, column, row):
"""
Returns the token stored in (column,row) position of the board, if
present; otherwise, returns INVALID_TOKEN.
"""
impl_row = self.to_impl_row(row)
if impl_row >= len(self.data[column]):
return self.INVALID_TOKEN
return self.data[column][impl_row]
def has_token(self, column, row):
"""
Tells if the (column,row) position of the board contains a valid token.
"""
impl_row = self.to_impl_row(row)
if impl_row < len(self.data[column]):
return True
return False
def get_column_empty_row(self, column):
"""
Returns the first row of the given column where it is possible to store
a token, if any; otherwise, returns -1.
"""
row = len(self.data[column])
if row >= self.h:
return -1
return self.to_user_row(row)
def width(self):
"""
Returns the width of the board.
"""
return self.w
def height(self):
"""
Returns the height of the board.
"""
return self.h
def num_column_tokens(self, column):
"""
Get the number of tokens pushed in the given column.
"""
return len(self.data[column])
def is_column_full(self, column):
"""
Tells if the given column is full of tokens.
"""
return len(self.data[column]) == self.h
def is_full(self):
"""
Tells if this board is full of tokens.
"""
for c in range(self.w):
if not self.is_column_full(c):
return False
return True
def is_column_empty(self, column):
"""
Tells if the given column is empty.
"""
return len(self.data[column]) == 0
def is_empty(self):
"""
Tells if this board has no token
"""
for c in range(self.w):
if not self.is_column_empty(c):
return False
return True
def clear(self):
"""
Clears the whole board.
"""
#self.data = [[]]*self.w
self.data = [[] for i in range(self.w)]
def __str__(self):
"""
Creates a string representation of this board.
"""
#return str(self.data)
w = -1
for x in range(self.w):
for y in range(self.h):
elem_len = 1
if self.has_token(x, y):
elem_len = len(str(self.get_token(x, y)))
w = max(w, elem_len)
out = [['{:>{width}}'.format(str(self.get_token(x,y) if self.has_token(x,y) else ' '), width=w) for x in range(self.w)] for y in range(self.h)]
s = ''
for x in out:
s += '\n['
s += ' '.join(x)
s += ']'
#s = '\n['.join([' '.join(x)+']' for x in out])
s += '\n-' + '--'*w*self.w
s += '\n ' + ' '.join(['{:>{width}}'.format(x, width=w) for x in range(self.w)]) + '\n'
return s
def to_user_row(self, impl_row):
"""
Transforms the given row from internal representation to user
representation.
"""
if impl_row < 0:
return -1
return self.h-impl_row-1
def to_impl_row(self, user_row):
"""
Transforms the given row from user representation to internal
representation.
"""
if user_row < 0:
return -1
return self.h-user_row-1 |
Michigan State beat Duke to win the East Regional of the NCAA tournament. A three-pointer by Kenny Goins was the key shot to send Spartans to Final Four.
WASHINGTON — The ball almost seemed to hang in the air Sunday evening at Capital One Arena, as Kenny Goins held a pose and watched it fall. The Michigan State bench was frozen. The Spartans fans behind them were silent.
Then, when Goins’ go-ahead three found the net: Pandemonium.
The sure-handed senior put Michigan State ahead in the final minute, and a missed free throw by R.J. Barrett with 5.2 seconds left on the clock helped seal the deal.
And so, in arguably the most highly-anticipated matchup of the Elite Eight — a meeting of powerhouse programs with high-profile coaches and a plethora of stars — Michigan State was able to hold on, defeating the Blue Devils, 68-67, in an absolute thriller.
"As soon as it left my hand I knew it was good. I was kind of planning my celebration."
The Spartans (32-6) will return to the Final Four for the first time since 2015 — when they, coincidentally, lost to Duke in the national semifinal. They’ll face Texas Tech, the winner in the West Region, on Saturday.
THRILLERS:After four classics, was this the best Elite Eight set of games?
Winston, who sprinted away from the crowd on the final possession to end the game, led the way with 20 points and 10 assists for Michigan State, while Xavier Tillman added 19 points and nine boards. Zion Williamson had 24 points and 14 rebounds for Duke.
The first three Elite Eight games were spectacular — including a pair of overtime games — but this one always seemed destined to be the best of the bunch. This, after all, was Duke and Michigan State, Mike Krzyzewski and Tom Izzo — a pair of legendary coaches and legendary programs with a combined 19 Final Four appearances and seven national titles between them.
The victory was a bit of redemption for Izzo, who entered the game just 1-11 against Krzyzewski. The Duke coach was seeking his record 13th Final Four. He is currently tied for first with John Wooden.
“To be the best, you got to beat the best and there’s no question they are the best,” Izzo said.
"I've had some great Final Fours, but this one ranks right up there with maybe the best, the way we had to do it all season."
From the beginning, the matchup lived up to the hype. There was the requisite Williamson slams, and a wave of Winston floaters. Cam Reddish, who had been a gametime decision with a knee injury, checked into the game after two minutes to a massive ovation from the Duke-heavy crowd. The energy in Capital One Arena was everything that was expected.
As the half progressed, momentum swung between the teams in long stretches, each of them several minutes long. First, the Blue Devils opened up a nine-point lead with a 12-0 run. Then Winston ended it with a pair of baskets, and the Spartans went on a 13-0 run over their own to close out the half ahead 34-30.
All the while, the specter of foul trouble hung over Williamson, who was forced to briefly ride the bench after picking up his second foul with 4:52 left in the half.
He didn't seem to mind in the second half, though — continuing to play as aggressively as ever, both on offense and on the boards. Williamson bodied Michigan State big man Xavier Tillman into a pair of quick fouls, forcing him out of the game, then took advantage of substitute Nick Ward. The projected No. 1 overall pick in this summer's NBA draft more than lived up to the hype, in this game and throughout the weekend.
But Michigan State had its own answers. Matt McQuaid, who had a poster in the first half, hit a spinning how-did-I-do-that layup midway through the second. Tillman took the ball on a breakaway and threw down a one-handed slam, Williamson-style.
With a little more than three minutes remaining, it was a two-point game — setting up the epic finale to an epic evening.
“When it came to the last seconds, we trusted everybody," Winston said.
The loss by Duke is the expected end in college basketball for Williamson, Barrett, Reddish and point guard Tre Jones. All four freshmen are expected to be taken in the first round of the NBA draft with Williamson anticipated as the No. 1 overall pick.
They'll leave with an ACC tournament title, but without their desired national championship or a Final Four to celebrate.
"Only one team can finish on top," Williamson said. "The odds of (a national championship) are slim.
"And just look around the locker room and see your teammates, your brothers. And you just think this group probably will never play together." |
Preparations of toxic components from Naja kaouthia venom by selective heat denaturation. A simple procedure to prepare the toxic components from Naja kaouthia venom for use as immunogens has been studied. The aim was to produce serum rich in antitoxins. By heating the venom (1-6 mg/ml) at 100 degrees C for 10 min at pH 5.0, at least 10 proteins with MW greater than 25,000 daltons were precipitated and removed. The toxic components, i.e., postsynaptic toxins, Direct Lytic Factor (DLF), and phospholipase A2 were relatively stable to this treatment; however, their activities were progressively lost as the heating time was prolonged. The LD50S of the heated (100 degrees C, 10 min) and the unheated venom were 0.37 and 0.325 mg/kg, respectively. As compared to the unheated venom, immunization of rabbits with the heated venom resulted in a 3.38-fold increase in precipitable antibodies against N. kaouthia toxin 3 and a 1.85-fold increase in neutralizing capacity. This toxin preparation should be useful as an immunogen or as a starting material for chemical modification prior to immunization in the production of potent therapeutic antiserum. |
Cerebral gumma mimicking glioblastoma on magnetic resonance images--case report. A 39-year-old female presented with a syphilitic cerebral gumma mimicking small glioblastoma multiforme manifesting as visual impairment. Magnetic resonance imaging showed a low signal intensity area on T1-weighted images and marked small ring-like enhancement less than 1 cm in diameter following the administration of gadolinium. The symptoms and radiological abnormalities improved several weeks after penicillin therapy. The small ring-like enhancement was probably caused by inflammation associated with treponemal infection. A mass with a small ring-like enhancement less than 1 cm in diameter is a useful finding indicating an inflammatory lesion rather than a glial tumor. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.